Updated WarehouseOrder and WarehouseOrderRequest

This commit is contained in:
Luca Haid
2025-03-06 10:29:48 +01:00
parent 9ce1c2a4fe
commit a4df764a49
21 changed files with 1236 additions and 721 deletions

View File

@@ -3,34 +3,45 @@
class WarehouseProjectController extends TTCrud {
protected string $headerTitle = 'Projekte';
protected string $createText = 'Neues Projekt erstellen';
protected string $singleText = 'Projekt';
//@formatter:off
protected array $columns = [
['key' => 'title', 'text' => 'Titel', 'required' => true, 'table' => ['class' => 'text-nowrap', 'priority' => 9]],
['key' => 'description', 'text' => 'Beschreibung', 'required' => true, 'table' => ['class' => 'text-nowrap']],
['key' => 'createBy', 'text' => 'Erstellt von', 'required' => true, 'type' => 'select', 'table' => ['class' => 'text-nowrap', 'filter' => 'select'], 'modal' => ['items' => [], 'type' => 'select']],
['key' => 'create', 'text' => 'Erstellt am', 'required' => true, 'table' => ['filter' => 'date', 'class' => 'text-center']],
['key' => 'address', 'text' => 'Adresse', 'required' => true, 'type' => 'autocomplete', 'table' => ['class' => 'text-nowrap', 'filter' => false], 'modal' => ['apiUrl' => '/Address/api?do=findAddress', 'items' => '/Address/api?do=findAddress', 'type' => 'autocomplete']],
['key' => 'status', 'text' => 'Status', 'required' => true, 'table' => ['filter' => 'select'], 'modal' => [ 'type' => 'select', 'items' => [ ['value' => 'erstellt', 'text' => 'Erstellt'], ['value' => 'in_bearbeitung', 'text' => 'In Bearbeitung'], ['value' => 'erledigt', 'text' => 'Erledigt'], ['value' => 'verrechnet', 'text' => 'Verrechnet']]]]
];
['key' => 'title', 'text' => 'Titel', 'required' => true],
['key' => 'description', 'text' => 'Projektbeschreibung', 'modal' => ['type' => 'textarea']],
['key' => 'startDate', 'text' => 'Startdatum', 'required' => true, 'modal' => ['type' => 'datepicker']],
['key' => 'endDate', 'text' => 'Enddatum', 'required' => true, 'modal' => ['type' => 'datepicker']],
['key' => 'positions', 'text' => 'Positionen', 'required' => true, 'modal' => ['type' => 'positions-manager', 'config' => [
'header' => 'Positionen',
'fields' => [
'articleId' => ['apiUrl' => '/WarehouseArticle/autoComplete','type' => 'autocomplete','customFieldReference' => 'WarehouseArticle','label' => 'Artikel'],
'amount' => ['type' => 'input', 'label' => 'Menge', 'inputType' => 'number'],
'purpose' => ['type' => 'input', 'label' => 'Zweck'],
],
'validateFormOptions' => [
['key' => 'articleId', 'message' => 'Bitte füllen Sie den Artikel aus'],
['key' => 'amount', 'message' => 'Bitte füllen Sie die Menge aus'],
['key' => 'purpose', 'message' => 'Bitte füllen Sie den Zweck aus'],
],
]], 'table' => false],
['key' => 'linkedOrderIds', 'text' => 'Verlinkte Bestellung', 'modal' => false],
//
['key' => 'assignedPersons', 'text' => 'Zugewiesene Personen', 'modal' => ['type' => 'positions-manager', 'config' => [
'header' => 'Zugewiesene Personen',
'fields' => [
'userId' => ['apiUrl' => '/WarehouseShippingNote/userAutoComplete','type' => 'autocomplete','label' => 'Person','customFieldReference' => 'User']
],
'validateFormOptions' => [
['key' => 'userId', 'message' => 'Bitte füllen Sie die Person aus'],
],
]], 'table' => false],
protected array $additionalActions = [
];
protected array $infoMessages = [
'create' => 'Projekt wurde erstellt',
'update' => 'Projekt wurde aktualisiert',
'delete' => 'Projekt wurde gelöscht',
'noChanges' => 'Keine Änderungen',
['key' => 'storageLocation', 'text' => 'Lagerort', 'modal' => ['type' => 'input']],
['key' => 'note', 'text' => 'Notiz', 'modal' => ['type' => 'textarea']],
['key' => 'createBy', 'text' => 'Erstellt von', 'required' => true, 'modal' => ['visible' => false, 'type' => 'select'], 'table' => ['filter' => 'select']],
['key' => 'create', 'text' => 'Erstellt', 'required' => true, 'modal' => false],
['key' => 'actions', 'text' => 'Aktionen', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center']],
];
//@formatter:on
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;
}
}