Untitled
Edit Modal in Orchid Platformunknown
php
3 years ago
2.0 kB
11
Indexable
Never
// --> Table layout with edit button that open a modal protected function columns(): array { TD::make(__('Actions')) ->align(TD::ALIGN_CENTER) ->width('100px') ->render(function (Projectcost $projectcost) { return DropDown::make() ->icon('options-vertical') ->list([ ModalToggle::make(__('Edit')) ->modal('editProjectBudgetCost') ->method('editCost', ['projectcost' => $projectcost->id]) ->icon('pencil') ->asyncParameters([ 'projectcost' => $projectcost->id, ]) ]); }), } // --> ProjectEditScreen public function layout(): array { return [ Layout::modal('editProjectBudgetCost', [ Layout::rows([ Input::make('description') ->type('text') ->max(255) ->required() ->title(__('Cost description')), Input::make('cost') ->type('text') ->required() ->title(__('Estimated cost')) ->help('Specify the amount: use . for decimal instead of , (comma)'), Input::make('project_id') ->type('hidden'), ]), ]) ->title(__('Edit project budget cost')) ->applyButton(__('Save')) ->closeButton(__('Close')) ->async('asyncGetProjectCost'), ], } public function asyncGetProjectCost(Projectcost $projectcost): array { return [ 'projectcost' => $projectcost ]; }