new update

This commit is contained in:
Luca Haid
2025-04-24 13:39:26 +02:00
parent adabe9a7a2
commit 4108eb99c9
22 changed files with 992 additions and 337 deletions

View File

@@ -0,0 +1,23 @@
<?php
class WarehouseCategory extends TTCrudBaseModel {
public int $id;
public string $name;
public string $description;
public int $create;
public int $create_by;
public ?int $edit;
public ?int $edit_by;
}
// SQL:
// CREATE TABLE `WarehouseCategory` (
// `id` INT NOT NULL AUTO_INCREMENT,
// `name` VARCHAR(255) NOT NULL,
// `description` TEXT NOT NULL,
// `create` INT NOT NULL,
// `create_by` INT NOT NULL,
// `edit` INT DEFAULT NULL,
// `edit_by` INT DEFAULT NULL,
// PRIMARY KEY (`id`)
// ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

View File

@@ -0,0 +1,30 @@
<?php
class WarehouseCategoryController extends TTCrud {
protected string $headerTitle = 'Kategorien';
protected string $createText = 'Kategorie erstellen';
protected string $singleText = 'Kategorie';
// @formatter:off
protected array $columns = [
['key' => 'title', 'text' => 'Titel', 'required' => true,],
['key' => 'description', 'text' => 'Beschreibung', 'required' => true],
['key' => 'create', 'text' => 'Erstellt am', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center']],
['key' => 'create_by', 'text' => 'Erstellt von', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center']],
['key' => 'edit', 'text' => 'Bearbeitet am', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center']],
['key' => 'edit_by', 'text' => 'Bearbeitet von', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center']],
['key' => 'actions', 'text' => 'Aktionen', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center', 'priority' => 10]],
];
// @formatter:on
protected array $additionalActions = [['key' => 'openHistory', 'title' => 'Historie', 'class' => 'fas fa-history text-primary']];
protected function beforeUpdate($postData): bool {
(new WarehouseHistoryController)->create($postData, $this->mod);
return true;
}
protected function getHistoryAction() {
self::returnJson((new WarehouseHistoryController)->getHistory($this->request->id, $this->mod, $this->columns));
}
}