Feature/warehouse

This commit is contained in:
Luca Haid
2024-07-16 06:55:46 +00:00
parent 8b4589523e
commit e75f13f8d8
64 changed files with 3207 additions and 265 deletions

View File

@@ -0,0 +1,9 @@
<?php
/**
* @property mixed|null $name
*/
class WarehouseLocation extends mfBaseModel
{
}

View File

@@ -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));
}
}

View File

@@ -0,0 +1,7 @@
<?php
class WarehouseLocationModel extends TTCrudBaseModel {
public int $id;
public string $title;
public int $assignedTo;
}