updateeeeee

This commit is contained in:
lubiana 2025-06-10 20:14:19 +02:00
parent 0c758749e0
commit ca9819a436
Signed by: lubiana
SSH key fingerprint: SHA256:vW1EA0fRR3Fw+dD/sM0K+x3Il2gSry6YRYHqOeQwrfk
12 changed files with 214 additions and 156 deletions

View file

@ -10,19 +10,18 @@
<tr>
<th>Name</th>
<th>Description</th>
<th>DesiredStock</th>
<th>DrinkStock</th>
<th>Wanted Stock</th>
<th>Current Stock</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for drink_stock in drink_stocks %}
{% set drink_type = drink_stock.record.drinkType %}
{% for drink_type in drink_types %}
<tr>
<td>{{ drink_type.name }}</td>
<td>{{ drink_type.description }}</td>
<td>{{ drink_type.desiredStock }}</td>
<td>{{ drink_stock.record.quantity }}</td>
<td>{{ drink_type.wantedStock }}</td>
<td>{{ drink_type.currentStock }}</td>
<td>
<a href="{{ path('app_drink_type_show', {'id': drink_type.id}) }}">show</a>
<a href="{{ path('app_drink_type_edit', {'id': drink_type.id}) }}">edit</a>

View file

@ -36,8 +36,12 @@
<td>{{ drink_type.description }}</td>
</tr>
<tr>
<th>DesiredStock</th>
<td>{{ drink_type.desiredStock }}</td>
<th>Current Stock</th>
<td>{{ drink_type.currentStock }}</td>
</tr>
<tr>
<th>Wanted Stock</th>
<td>{{ drink_type.wantedStock }}</td>
</tr>
</tbody>
</table>
@ -87,7 +91,7 @@
<h5 class="card-title">Inventory History</h5>
</div>
<div class="card-body">
{% if inventory_records|length > 0 %}
{% if stock_history|length > 0 %}
<table class="table table-striped">
<thead>
<tr>
@ -96,10 +100,10 @@
</tr>
</thead>
<tbody>
{% for record in inventory_records %}
{% for record in stock_history %}
<tr>
<td>{{ record.createdAt|date('Y-m-d H:i:s') }}</td>
<td>{{ record.quantity }}</td>
<td>{{ record.changeDate|date('Y-m-d H:i:s') }}</td>
<td>{{ record.newValue }}</td>
</tr>
{% endfor %}
</tbody>
@ -119,7 +123,7 @@
<h5 class="card-title">Desired Stock History</h5>
</div>
<div class="card-body">
{% if desired_stock_history|length > 0 %}
{% if wanted_history|length > 0 %}
<table class="table table-striped">
<thead>
<tr>
@ -128,7 +132,7 @@
</tr>
</thead>
<tbody>
{% for log in desired_stock_history %}
{% for log in wanted_history %}
<tr>
<td>{{ log.changeDate|date('Y-m-d H:i:s') }}</td>
<td>{{ log.newValue }}</td>

View file

@ -5,35 +5,6 @@
{% block body %}
<div class="container">
<h1>Drink Inventory</h1>
{% if low is not same as([]) %}
<div class="card">
<div class="card-header">
<h5 class="card-title">Low Stock Alert</h5>
</div>
<div class="card-body">
<table class="table table-striped">
<thead>
<tr>
<th>Drink Name</th>
<th>Current Stock</th>
<th>Desired Stock</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for lowStock in low %}
<tr>
<td><a href="{{ path('app_drink_type_show', {'id': lowStock.record.drinkType.id}) }}">{{ lowStock.record.drinkType.name }}</a></td>
<td>{{ lowStock.record.quantity }}</td>
<td>{{ lowStock.record.drinkType.desiredStock }}</td>
<td>{{ lowStock.stock.value|capitalize }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
<div class="card">
<div class="card-header">
<h5 class="card-title">Drink Inventory Overview</h5>
@ -43,36 +14,22 @@
<thead>
<tr>
<th>Drink Name</th>
<th>Description</th>
<th>Current Stock</th>
<th>Desired Stock</th>
<th>Status</th>
<th>Wanted Stock</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for drinkStock in drinkStocks %}
{% set rowClass = '' %}
{% if drinkStock.stock.value == 'critical' %}
{% set rowClass = 'table-danger' %}
{% elseif drinkStock.stock.value == 'low' %}
{% set rowClass = 'table-warning' %}
{% elseif drinkStock.stock.value == 'high' %}
{% set rowClass = 'table-success' %}
{% endif %}
<tr class="{{ rowClass }}">
<td><a href="{{ path('app_drink_type_show', {'id': drinkStock.record.drinkType.id}) }}">{{ drinkStock.record.drinkType.name }}</a></td>
<td>{{ drinkStock.record.quantity }}</td>
<td>{{ drinkStock.record.drinkType.desiredStock }}</td>
<td>{{ drinkStock.stock.value|capitalize }}</td>
{% for drinkType in drinkTypes %}
<tr>
<td>
<a href="{{ path('app_drink_type_show', {'id': drinkType.id}) }}">{{ drinkType.name }}</a>
</td>
<td>{{ drinkType.description }}</td>
<td>{{ drinkType.currentStock }}</td>
<td>{{ drinkType.wantedStock }}</td>
<td>
<a href="{{ path('app_inventory_record_modal', {drinkType: drinkStock.record.drinkType.id}) }}"
class="btn btn-primary"
hx-get="{{ path('app_inventory_record_modal', {drinkType: drinkStock.record.drinkType.id}) }}"
hx-target="#htmxModalBody"
hx-trigger="click"
data-bs-toggle="modal"
data-bs-target="#htmxModal"
data-drink-name="{{ drinkStock.record.drinkType.name }}">Update Stock</a>
</td>
</tr>
{% endfor %}
@ -81,7 +38,6 @@
<div class="mt-3">
<a href="{{ path('app_drink_type_index') }}" class="btn btn-primary">View All Drinks</a>
</div>
</div>
</div>
</div>