improv
This commit is contained in:
parent
66c4c1fe4f
commit
2c2e34b71e
42 changed files with 910 additions and 939 deletions
|
@ -12,6 +12,7 @@
|
|||
{% block javascripts %}
|
||||
<script src="/assets/js/app.js"></script>
|
||||
<script src="/assets/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="/assets/js/htmx.min.js"></script>
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
|
@ -34,5 +35,20 @@
|
|||
<div class="container mt-4">
|
||||
{% block body %}{% endblock %}
|
||||
</div>
|
||||
|
||||
<!-- Modal container for HTMX -->
|
||||
<div class="modal fade" id="htmxModal" tabindex="-1" aria-labelledby="htmxModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="htmxModalLabel">Modal title</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body" id="htmxModalBody">
|
||||
<!-- Content will be loaded here by HTMX -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>CreatedAt</th>
|
||||
<th>UpdatedAt</th>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>DesiredStock</th>
|
||||
|
@ -22,9 +19,6 @@
|
|||
{% for drink_stock in drink_stocks %}
|
||||
{% set drink_type = drink_stock.record.drinkType %}
|
||||
<tr>
|
||||
<td>{{ drink_type.id }}</td>
|
||||
<td>{{ drink_type.createdAt ? drink_type.createdAt|date('Y-m-d H:i:s') : '' }}</td>
|
||||
<td>{{ drink_type.updatedAt ? drink_type.updatedAt|date('Y-m-d H:i:s') : '' }}</td>
|
||||
<td>{{ drink_type.name }}</td>
|
||||
<td>{{ drink_type.description }}</td>
|
||||
<td>{{ drink_type.desiredStock }}</td>
|
||||
|
@ -36,7 +30,7 @@
|
|||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="7">no records found</td>
|
||||
<td colspan="5">no records found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
|
|
@ -1,42 +1,157 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}DrinkType{% endblock %}
|
||||
{% block title %}{{ drink_type.name }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>DrinkType</h1>
|
||||
<div class="container">
|
||||
<h1>{{ drink_type.name }}</h1>
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ drink_type.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>CreatedAt</th>
|
||||
<td>{{ drink_type.createdAt ? drink_type.createdAt|date('Y-m-d H:i:s') : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>UpdatedAt</th>
|
||||
<td>{{ drink_type.updatedAt ? drink_type.updatedAt|date('Y-m-d H:i:s') : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td>{{ drink_type.name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
<td>{{ drink_type.description }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>DesiredStock</th>
|
||||
<td>{{ drink_type.desiredStock }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title">Drink Details</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ drink_type.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>CreatedAt</th>
|
||||
<td>{{ drink_type.createdAt ? drink_type.createdAt|date('Y-m-d H:i:s') : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>UpdatedAt</th>
|
||||
<td>{{ drink_type.updatedAt ? drink_type.updatedAt|date('Y-m-d H:i:s') : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td>{{ drink_type.name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
<td>{{ drink_type.description }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>DesiredStock</th>
|
||||
<td>{{ drink_type.desiredStock }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="{{ path('app_drink_type_index') }}">back to list</a>
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title">Orders Containing This Drink</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if order_items|length > 0 %}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Order ID</th>
|
||||
<th>Date</th>
|
||||
<th>Quantity</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in order_items %}
|
||||
<tr>
|
||||
<td>{{ item.order.id }}</td>
|
||||
<td>{{ item.order.createdAt|date('Y-m-d H:i:s') }}</td>
|
||||
<td>{{ item.quantity }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p>No orders found for this drink.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="{{ path('app_drink_type_edit', {'id': drink_type.id}) }}">edit</a>
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title">Inventory History</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if inventory_records|length > 0 %}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Quantity</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for record in inventory_records %}
|
||||
<tr>
|
||||
<td>{{ record.createdAt|date('Y-m-d H:i:s') }}</td>
|
||||
<td>{{ record.quantity }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p>No inventory history found for this drink.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ include('drink_type/_delete_form.html.twig') }}
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title">Desired Stock History</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if desired_stock_history|length > 0 %}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Old Value</th>
|
||||
<th>New Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for log in desired_stock_history %}
|
||||
<tr>
|
||||
<td>{{ log.changeDate|date('Y-m-d H:i:s') }}</td>
|
||||
<td>{{ log.oldValue }}</td>
|
||||
<td>{{ log.newValue }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p>No desired stock history found for this drink.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-12">
|
||||
<a href="{{ path('app_drink_type_index') }}" class="btn btn-secondary">Back to list</a>
|
||||
<a href="{{ path('app_drink_type_edit', {'id': drink_type.id}) }}" class="btn btn-primary">Edit</a>
|
||||
{{ include('drink_type/_delete_form.html.twig') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
23
templates/form/theme.html.twig
Normal file
23
templates/form/theme.html.twig
Normal file
|
@ -0,0 +1,23 @@
|
|||
{% use 'bootstrap_5_layout.html.twig' %}
|
||||
|
||||
{%- block number_widget -%}
|
||||
{%- set type = type|default('number') -%}
|
||||
{%- set attr = attr|merge({
|
||||
'class': (attr.class|default('') ~ ' form-control number-input')|trim,
|
||||
'step': attr.step|default('1'),
|
||||
'min': attr.min|default(null),
|
||||
'max': attr.max|default(null)
|
||||
}) -%}
|
||||
|
||||
<div class="number-input-wrapper">
|
||||
<div class="input-group">
|
||||
<button class="btn btn-outline-secondary number-decrease" type="button" data-action="decrease">
|
||||
-
|
||||
</button>
|
||||
{{- block('form_widget_simple') -}}
|
||||
<button class="btn btn-outline-secondary number-increase" type="button" data-action="increase">
|
||||
+
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{%- endblock number_widget -%}
|
|
@ -23,7 +23,7 @@
|
|||
<tbody>
|
||||
{% for lowStock in low %}
|
||||
<tr>
|
||||
<td>{{ lowStock.record.drinkType.name }}</td>
|
||||
<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>
|
||||
|
@ -60,10 +60,20 @@
|
|||
{% set rowClass = 'table-success' %}
|
||||
{% endif %}
|
||||
<tr class="{{ rowClass }}">
|
||||
<td>{{ drinkStock.record.drinkType.name }}</td>
|
||||
<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>
|
||||
<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 %}
|
||||
</tbody>
|
||||
|
|
7
templates/inventory_record/_modal_form.html.twig
Normal file
7
templates/inventory_record/_modal_form.html.twig
Normal file
|
@ -0,0 +1,7 @@
|
|||
{{ form_start(form, {'attr': {'hx-post': form.vars.action, 'hx-target': '#htmxModalBody'}}) }}
|
||||
{{ form_widget(form) }}
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-primary">{{ button_label|default('Save') }}</button>
|
||||
</div>
|
||||
{{ form_end(form) }}
|
4
templates/order/_delete_form.html.twig
Normal file
4
templates/order/_delete_form.html.twig
Normal file
|
@ -0,0 +1,4 @@
|
|||
<form method="post" action="{{ path('app_order_delete', {'id': order.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ order.id) }}">
|
||||
<button class="btn">Delete</button>
|
||||
</form>
|
4
templates/order/_form.html.twig
Normal file
4
templates/order/_form.html.twig
Normal file
|
@ -0,0 +1,4 @@
|
|||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<button class="btn">{{ button_label|default('Save') }}</button>
|
||||
{{ form_end(form) }}
|
13
templates/order/edit.html.twig
Normal file
13
templates/order/edit.html.twig
Normal file
|
@ -0,0 +1,13 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Edit Order{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Edit Order</h1>
|
||||
|
||||
{{ include('order/_form.html.twig', {'button_label': 'Update'}) }}
|
||||
|
||||
<a href="{{ path('app_order_index') }}">back to list</a>
|
||||
|
||||
{{ include('order/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
39
templates/order/index.html.twig
Normal file
39
templates/order/index.html.twig
Normal file
|
@ -0,0 +1,39 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Order index{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Order index</h1>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>CreatedAt</th>
|
||||
<th>UpdatedAt</th>
|
||||
<th>Status</th>
|
||||
<th>actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for order in orders %}
|
||||
<tr>
|
||||
<td>{{ order.id }}</td>
|
||||
<td>{{ order.createdAt ? order.createdAt|date('Y-m-d H:i:s') : '' }}</td>
|
||||
<td>{{ order.updatedAt ? order.updatedAt|date('Y-m-d H:i:s') : '' }}</td>
|
||||
<td>{{ order.status }}</td>
|
||||
<td>
|
||||
<a href="{{ path('app_order_show', {'id': order.id}) }}">show</a>
|
||||
<a href="{{ path('app_order_edit', {'id': order.id}) }}">edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="5">no records found</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('app_order_new') }}">Create new</a>
|
||||
{% endblock %}
|
11
templates/order/new.html.twig
Normal file
11
templates/order/new.html.twig
Normal file
|
@ -0,0 +1,11 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}New Order{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Create new Order</h1>
|
||||
|
||||
{{ include('order/_form.html.twig') }}
|
||||
|
||||
<a href="{{ path('app_order_index') }}">back to list</a>
|
||||
{% endblock %}
|
34
templates/order/show.html.twig
Normal file
34
templates/order/show.html.twig
Normal file
|
@ -0,0 +1,34 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Order{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<h1>Order</h1>
|
||||
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ order.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>CreatedAt</th>
|
||||
<td>{{ order.createdAt ? order.createdAt|date('Y-m-d H:i:s') : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>UpdatedAt</th>
|
||||
<td>{{ order.updatedAt ? order.updatedAt|date('Y-m-d H:i:s') : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<td>{{ order.status }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a href="{{ path('app_order_index') }}">back to list</a>
|
||||
|
||||
<a href="{{ path('app_order_edit', {'id': order.id}) }}">edit</a>
|
||||
|
||||
{{ include('order/_delete_form.html.twig') }}
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue