From c3f949e1ac9c231c3fca429fec7af85f22ce06c5 Mon Sep 17 00:00:00 2001 From: Luca Haid Date: Wed, 24 Jul 2024 14:16:54 +0000 Subject: [PATCH] Feature/warehouse improvements --- .../WarehouseArticleController.php | 1 + .../WarehouseArticleModel.php | 1 + .../WarehouseEShopController.php | 29 ++++++++++++------- ...240724155700_warehouse_add_e_shop_hide.php | 22 ++++++++++++++ lib/Helper/Helper.php | 2 ++ .../js/pages/WarehouseEShop/WarehouseEShop.js | 9 ++++-- .../vue/tt-components/css/tt-table.css | 6 ++-- 7 files changed, 54 insertions(+), 16 deletions(-) create mode 100644 db/migrations/20240724155700_warehouse_add_e_shop_hide.php diff --git a/application/WarehouseArticle/WarehouseArticleController.php b/application/WarehouseArticle/WarehouseArticleController.php index a3df585bd..a85a9233f 100644 --- a/application/WarehouseArticle/WarehouseArticleController.php +++ b/application/WarehouseArticle/WarehouseArticleController.php @@ -18,6 +18,7 @@ class WarehouseArticleController extends TTCrud { ['key' => 'criticalAmount', 'text' => 'Kritische Menge', 'required' => true,'modal' => ['type' => 'number'], 'table' => ['class' => 'text-center']], // Stock/inventory related ['key' => 'isSerialDocumentation', 'text' => 'Seriennummern', 'required' => true,'modal' => ['type' => 'checkbox'], 'table' => false], // Boolean value ['key' => 'isEShop', 'text' => 'Ist E-Shop', 'required' => true,'modal' => ['type' => 'checkbox'], 'table' => false], // Boolean value + ['key' => 'isEShopHide', 'text' => 'E-Shop Versteckt', 'required' => true,'modal' => ['type' => 'checkbox'], 'table' => false], // Boolean value ['key' => 'actions', 'text' => 'Aktionen', 'required' => false, 'modal' => false, 'table' => ['filter' => false, 'sortable' => false, 'class' => 'text-center', 'priority' => 8]] ]; diff --git a/application/WarehouseArticle/WarehouseArticleModel.php b/application/WarehouseArticle/WarehouseArticleModel.php index 90d4c13d0..926920fac 100644 --- a/application/WarehouseArticle/WarehouseArticleModel.php +++ b/application/WarehouseArticle/WarehouseArticleModel.php @@ -10,6 +10,7 @@ class WarehouseArticleModel extends TTCrudBaseModel { public int $warningAmount; public int $criticalAmount; public int $isEShop; + public int $isEShopHide; public float $defaultSellMultiplier; public string $unit; public int $isSerialDocumentation; diff --git a/application/WarehouseEShop/WarehouseEShopController.php b/application/WarehouseEShop/WarehouseEShopController.php index bc90ecc02..f57b0afc9 100644 --- a/application/WarehouseEShop/WarehouseEShopController.php +++ b/application/WarehouseEShop/WarehouseEShopController.php @@ -1,4 +1,9 @@ postData['pagination']['page'] ?? 1; $perPage = $this->postData['pagination']['per_page'] ?? 10; - $filter['isEShop'] = 1; + $warehouseArticleFilter = $filter; + $warehouseArticleFilter['isEShop'] = 1; + $warehouseArticleFilter['isEShopHide'] = 0; - $rows = WarehouseArticleModel::getAll($filter, $perPage, ($page - 1) * $perPage, $order); - $filteredAvailable = WarehouseArticleModel::count($filter); - $totalRows = WarehouseArticleModel::count(['isEShop' => 1]); + $warehouseArticles = WarehouseArticleModel::getAll($warehouseArticleFilter, $perPage, ($page - 1) * $perPage, $order); + $warehouseArticlesTotal = WarehouseArticleModel::count(['isEShop' => 1, 'isEShopHide' => 0]); + $warehouseArticlesAvailable = WarehouseArticleModel::count($warehouseArticleFilter); - $packetRows = WarehouseArticlePacketModel::getAll(); + $warehousePackets = WarehouseArticlePacketModel::getAll(); + $warehousePacketsTotal = WarehouseArticlePacketModel::count(); + $warehousePacketsAvailable = WarehouseArticlePacketModel::count($filter); - $rows = [...$rows, ...$packetRows]; + $filteredAvailable = $warehouseArticlesAvailable + $warehousePacketsAvailable; + $totalRows = $warehouseArticlesTotal + $warehousePacketsTotal; + $rows = [...$warehouseArticles, ...$warehousePackets]; self::returnJson(["rows" => $rows, "pagination" => ["page" => $page, "total_pages" => ceil($filteredAvailable / $perPage), "per_page" => $perPage, - "filtered_available" => intval($filteredAvailable), - "total_rows" => intval($totalRows)]]); } - - + "filtered_available" => $filteredAvailable, + "total_rows" => $totalRows]]); } } \ No newline at end of file diff --git a/db/migrations/20240724155700_warehouse_add_e_shop_hide.php b/db/migrations/20240724155700_warehouse_add_e_shop_hide.php new file mode 100644 index 000000000..40d60e27d --- /dev/null +++ b/db/migrations/20240724155700_warehouse_add_e_shop_hide.php @@ -0,0 +1,22 @@ +getEnvironment() == "thetool") { + $WarehouseArticle = $this->table("WarehouseArticle"); + $WarehouseArticle->addColumn("isEShopHide", "integer", ["null" => false]); + $WarehouseArticle->update(); + } + } + + public function down(): void { + if ($this->getEnvironment() == "thetool") { + $WarehouseArticle = $this->table("WarehouseArticle"); + $WarehouseArticle->removeColumn("isEShopHide"); + $WarehouseArticle->update(); + } + } +} diff --git a/lib/Helper/Helper.php b/lib/Helper/Helper.php index da0c37603..b63e05c81 100644 --- a/lib/Helper/Helper.php +++ b/lib/Helper/Helper.php @@ -34,6 +34,8 @@ class Helper { $sql .= " AND `$columnName` LIKE '%" . $item . "%'"; } } + } else if ($filterValue === 0) { + $sql .= " AND `$columnName` = 0"; } return $sql; diff --git a/public/js/pages/WarehouseEShop/WarehouseEShop.js b/public/js/pages/WarehouseEShop/WarehouseEShop.js index 02a8579ad..2b43f7568 100644 --- a/public/js/pages/WarehouseEShop/WarehouseEShop.js +++ b/public/js/pages/WarehouseEShop/WarehouseEShop.js @@ -25,9 +25,12 @@ Vue.component('tt-expandable-shopping-cart', {

Einkaufswagen

@@ -52,7 +55,7 @@ Vue.component('warehouse-e-shop', { diff --git a/public/plugins/vue/tt-components/css/tt-table.css b/public/plugins/vue/tt-components/css/tt-table.css index c82bb660c..a5f2cfe63 100644 --- a/public/plugins/vue/tt-components/css/tt-table.css +++ b/public/plugins/vue/tt-components/css/tt-table.css @@ -261,7 +261,7 @@ td { .expanded { width: 500px; /* Expanded width */ height: 600px; /* Expanded height */ - z-index: 999999999999999; + z-index: 1000; } .toggle-button { @@ -323,8 +323,8 @@ td { .tt-expandable-shopping-cart.expanded .cart-count { position: unset !important; - width: 21px; - height: 21px; + width: 18px; + height: 18px; grid-column-start: 3; }