Skip to content

Commit dd06d65

Browse files
[AIDAPP-1007] : Some users have reported that creating or viewing an asset generates an exception (#969)
* bugfix: Refactor modal heading and success notification for asset check-in/check-out actions * Resolve linting errors * Update code formatting and copyright headers --------- Co-authored-by: Rebecca Sheridan <rebecca.sheridan@canyongbs.com> Co-authored-by: rebecca-canyon <198644076+rebecca-canyon@users.noreply.github.com>
1 parent 55ec139 commit dd06d65

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

app-modules/inventory-management/src/Filament/Actions/CheckInAssetHeaderAction.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,19 @@ protected function setUp(): void
5555

5656
$this->label(__('Check In'));
5757

58-
/** @var Asset $asset */
59-
$asset = $this->getRecord();
58+
$this->modalHeading(function () {
59+
assert($this->getRecord() instanceof Asset);
6060

61-
$this->modalHeading(__("Check in {$asset->name}"));
61+
return __("Check in {$this->getRecord()->name}");
62+
});
6263

6364
$this->modalSubmitActionLabel(__('Done'));
6465

65-
$this->successNotificationTitle(__("Successfully checked in {$asset->name}"));
66+
$this->successNotificationTitle(function () {
67+
assert($this->getRecord() instanceof Asset);
68+
69+
return __("Successfully checked in {$this->getRecord()->name}");
70+
});
6671

6772
$this->schema([
6873
Textarea::make('notes')

app-modules/inventory-management/src/Filament/Actions/CheckOutAssetHeaderAction.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,19 @@ protected function setUp(): void
5656

5757
$this->label(__('Check Out'));
5858

59-
/** @var Asset $asset */
60-
$asset = $this->getRecord();
59+
$this->modalHeading(function () {
60+
assert($this->getRecord() instanceof Asset);
6161

62-
$this->modalHeading(__("Check out {$asset->name}"));
62+
return __("Check out {$this->getRecord()->name}");
63+
});
6364

6465
$this->modalSubmitActionLabel(__('Done'));
6566

66-
$this->successNotificationTitle(__("Successfully checked out {$asset->name}"));
67+
$this->successNotificationTitle(function () {
68+
assert($this->getRecord() instanceof Asset);
69+
70+
return __("Successfully checked out {$this->getRecord()->name}");
71+
});
6772

6873
$this->schema([
6974
Select::make('checked_out_to_id')

0 commit comments

Comments
 (0)