Skip to content

Commit

Permalink
InlineEdit: format presenter, real update records
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed May 29, 2024
1 parent 88efb4c commit 569397c
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions app/UI/Edit/EditPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ public function createComponentGrid(): DataGrid
$inlineEdit = $grid->addInlineEdit();

$inlineEdit->onControlAdd[] = function ($container): void {
$container->addText('name', '')
->setRequired('aaa');
$container->addText('birth_date', '');
$container->addText('link', '');
$container->addSelect('status', '', [
'active' => 'Active',
'inactive' => 'Inactive',
'deleted' => 'Deleted',
]);
$container->addText('name', '')
->setRequired('aaa');
$container->addText('birth_date', '');
$container->addText('link', '');
$container->addSelect('status', '', [
'active' => 'Active',
'inactive' => 'Inactive',
'deleted' => 'Deleted',
]);
};

$inlineEdit->onSetDefaults[] = function (Container $container, Row $row): void {
Expand All @@ -73,7 +73,8 @@ public function createComponentGrid(): DataGrid
};

$inlineEdit->onSubmit[] = function ($id, $values): void {
$this->flashMessage('Record was updated! (not really)', 'success');
$this->dibiConnection->update('users', ['name' => $values['name']])->where('id = %i', $id)->execute();
$this->flashMessage('Record was updated!', 'success');
$this->redrawControl('flashes');
};

Expand Down

0 comments on commit 569397c

Please sign in to comment.