Feature/warehouse
This commit is contained in:
9
application/WarehouseEShop/WarehouseEShop.php
Normal file
9
application/WarehouseEShop/WarehouseEShop.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property mixed|null $name
|
||||
*/
|
||||
class WarehouseEShop extends mfBaseModel
|
||||
{
|
||||
|
||||
}
|
||||
41
application/WarehouseEShop/WarehouseEShopController.php
Normal file
41
application/WarehouseEShop/WarehouseEShopController.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
class WarehouseEShopController extends TTCrud {
|
||||
protected string $headerTitle = 'Energie Steiermark Shop';
|
||||
protected bool $createText = false;
|
||||
|
||||
protected array $columns = [
|
||||
['key' => 'title', 'text' => 'Titel'],
|
||||
['key' => 'category', 'text' => 'Kategorie'],
|
||||
['key' => 'amount', 'text' => 'Menge', 'table' => ['filter' => false,'sortable' => false,'class' => 'p-0 width-80']],
|
||||
['key' => 'add', 'text' => 'Hinzufügen', 'table' => ['filter' => false,'sortable' => false, 'class' => 'width-120 text-center']]
|
||||
];
|
||||
|
||||
protected array $infoMessages = [
|
||||
'create' => 'Not possible',
|
||||
'update' => 'Not possible',
|
||||
'delete' => 'Not possible',
|
||||
'noChanges' => 'Keine Änderungen',
|
||||
];
|
||||
|
||||
public function getAction() {
|
||||
$filter = $this->postData['filters'] ?? [];
|
||||
$order = $this->postData['order'] ?? ['key' => null, 'order' => 'ASC'];
|
||||
$page = $this->postData['pagination']['page'] ?? 1;
|
||||
$perPage = $this->postData['pagination']['per_page'] ?? 10;
|
||||
|
||||
$filter['isEShop'] = 1;
|
||||
|
||||
$rows = WarehouseArticleModel::getAll($filter, $perPage, ($page - 1) * $perPage, $order);
|
||||
$filteredAvailable = WarehouseArticleModel::count($filter);
|
||||
$totalRows = WarehouseArticleModel::count(['isEShop' => 1]);
|
||||
|
||||
self::returnJson(["rows" => $rows,
|
||||
"pagination" => ["page" => $page,
|
||||
"total_pages" => ceil($filteredAvailable / $perPage),
|
||||
"per_page" => $perPage,
|
||||
"filtered_available" => intval($filteredAvailable),
|
||||
"total_rows" => intval($totalRows)]]); }
|
||||
|
||||
|
||||
}
|
||||
7
application/WarehouseEShop/WarehouseEShopModel.php
Normal file
7
application/WarehouseEShop/WarehouseEShopModel.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
class WarehouseEShopModel extends TTCrudBaseModel {
|
||||
public int $id;
|
||||
public string $title;
|
||||
public int $assignedTo;
|
||||
}
|
||||
Reference in New Issue
Block a user