Feature/warehouse
This commit is contained in:
9
application/WarehouseLocation/WarehouseLocation.php
Normal file
9
application/WarehouseLocation/WarehouseLocation.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property mixed|null $name
|
||||
*/
|
||||
class WarehouseLocation extends mfBaseModel
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?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));
|
||||
}
|
||||
|
||||
}
|
||||
7
application/WarehouseLocation/WarehouseLocationModel.php
Normal file
7
application/WarehouseLocation/WarehouseLocationModel.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
class WarehouseLocationModel extends TTCrudBaseModel {
|
||||
public int $id;
|
||||
public string $title;
|
||||
public int $assignedTo;
|
||||
}
|
||||
Reference in New Issue
Block a user