42 lines
1.6 KiB
PHP
42 lines
1.6 KiB
PHP
<?php
|
|
|
|
class WarehouseLocationController extends TTCrud {
|
|
protected string $headerTitle = 'Lagerorte';
|
|
protected string $createText = 'Lagerort erstellen';
|
|
|
|
protected array $columns = [
|
|
['key' => 'title', 'text' => 'Titel', 'required' => true],
|
|
['key' => 'assignedTo', 'text' => 'Zugewiesen an', 'required' => true, 'modal' => ['type' => 'select', 'items' => []]],
|
|
['key' => 'actions', 'text' => 'Aktionen', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center']],
|
|
];
|
|
|
|
protected array $additionalActions = [
|
|
['key' => 'openHistory', 'title' => 'Historie', 'class' => 'fas fa-history text-primary'],
|
|
];
|
|
|
|
protected array $infoMessages = [
|
|
'create' => 'Lagerort wurde erstellt',
|
|
'update' => 'Lagerort wurde aktualisiert',
|
|
'delete' => 'Lagerort wurde gelöscht',
|
|
'noChanges' => 'Keine Änderungen',
|
|
];
|
|
|
|
public function prepareCrudConfig() {
|
|
$users = array_map(function($user) {
|
|
return ['value' => $user->id, 'text' => $user->name];
|
|
}, UserModel::search(['employee' => true]));
|
|
|
|
$this->columns[1]['modal']['items'] = $users;
|
|
}
|
|
|
|
protected function beforeUpdate($postData): bool {
|
|
(new WarehouseHistoryController)->create($postData, $this->mod);
|
|
return true;
|
|
}
|
|
|
|
protected function getHistoryAction() {
|
|
$this->prepareCrudConfig();
|
|
self::returnJson((new WarehouseHistoryController)->getHistory($this->request->id, $this->mod, $this->columns));
|
|
}
|
|
|
|
} |