Feature/warehouse improvements

This commit is contained in:
Luca Haid
2024-07-24 14:16:54 +00:00
parent 9aafa93bc9
commit c3f949e1ac
7 changed files with 54 additions and 16 deletions

View File

@@ -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]]
];

View File

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

View File

@@ -1,4 +1,9 @@
<?php
// Warrenkorb löschen
// File Upload ermöglichen
// Hide Articles
class WarehouseEShopController extends TTCrud {
protected string $headerTitle = 'Energie Steiermark Shop';
@@ -29,22 +34,26 @@ class WarehouseEShopController extends TTCrud {
$page = $this->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]]); }
}

View File

@@ -0,0 +1,22 @@
<?php /** @noinspection ALL */
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class WarehouseAddEShopHide extends AbstractMigration {
public function up(): void {
if ($this->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();
}
}
}

View File

@@ -34,6 +34,8 @@ class Helper {
$sql .= " AND `$columnName` LIKE '%" . $item . "%'";
}
}
} else if ($filterValue === 0) {
$sql .= " AND `$columnName` = 0";
}
return $sql;

View File

@@ -25,9 +25,12 @@ Vue.component('tt-expandable-shopping-cart', {
<h3>Einkaufswagen</h3>
<ul class="list-group">
<template v-for="item in cartItems">
<li class="list-group-item d-flex justify-content-between align-items-center">
<li class="list-group-item" style="display:grid;grid-template-columns: 1fr auto;gap: 10px;">
{{ item.title }}
<span class="badge badge-primary badge-pill">{{ item.amount }}</span>
<div style="display:grid;grid-template-columns: 1fr 1fr;gap: 10px;">
<span class="badge badge-primary badge-pill" style="height: 16px">{{ item.amount }}</span>
<i style="cursor: pointer" class="fas fa-trash-alt text-danger" @click="cartItems.splice(cartItems.indexOf(item), 1)"></i>
</div>
</li>
</template>
</ul>
@@ -52,7 +55,7 @@ Vue.component('warehouse-e-shop', {
<tt-select v-model="createOrderDialogData.deliveryMode" label="Adresse" :options="[
{text: 'Einzelne Adresse', value: 'singleAddress'},
{text: 'Mehrere Adressen', value: 'multipleAddresses'},
// {text: 'Mehrere Adressen', value: 'multipleAddresses'},
]" sm row/>
<tt-input v-model="createOrderDialogData.deliveryAddressName" label="Name" sm row/>
<tt-input v-model="createOrderDialogData.deliveryAddressLine" label="Straße" sm row/>

View File

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