```php private function getStandardsSectionComponent(): Section { return Section::make('Standards') ->contained(false) ->schema(function (): array { $standardSections = []; foreach ($this->standards as $standard) { $standardSections[] = $this->getStandardSectionComponent($standard); } return $standardSections; }); } private function getStandardSectionComponent(Standard $standard): Section { return Section::make($standard->name) ->contained(true) ->headerActions([ $this->getStandardSectionEditAction($standard), ]) ->schema(function () use ($standard): array { $schema = []; $process = $this->getMountedTableActionRecord(); if ($process) { /** * Editing existing process modal schema */ $items = $process ->load('items') ->items ->where('standard_id', '=', $standard->id); if ($items->isNotEmpty()) { foreach ($items as $item) { $schema[] = TextEntry::make("item_{$item->title}") ->label("{$item->number} {$item->title}"); } } else { $schema[] = TextEntry::make("{$standard->name}_no_items") ->disableLabel() ->state('No items'); } } else { /** * Add new process modal schema */ $schema[] = TextEntry::make("{$standard->name}_no_items") ->disableLabel() ->state('No items'); } return $schema; }); } private function getStandardSectionEditAction(Standard $standard): Action { return Action::make("edit_{$standard->id}_action") ->label('Edit') ->icon(Heroicon::PencilSquare) ->tooltip("Click to edit standard items") ->color('primary') ->modal() ->slideOver() ->modalHeading("Edit {$standard->name}") ->modalSubmitActionLabel('Save'); // ->schema($this->getStandardSectionEditSchema($standard->id)); } ```