This commit is contained in:
lubiana 2025-05-31 21:43:13 +02:00
parent e958163a4a
commit b8a5a1ff58
Signed by: lubiana
SSH key fingerprint: SHA256:vW1EA0fRR3Fw+dD/sM0K+x3Il2gSry6YRYHqOeQwrfk
79 changed files with 15113 additions and 0 deletions

View file

@ -0,0 +1,36 @@
{% extends 'layout.twig' %}
{% import 'components/form.twig' as form %}
{% block title %}Add New Drink Type - {{ parent() }}{% endblock %}
{% block content %}
<div class="row mb-4">
<div class="col">
<h2>Add New Drink Type</h2>
</div>
<div class="col-auto">
<a href="/drink-types" class="btn btn-secondary">
<i class="fas fa-arrow-left"></i> Back to List
</a>
</div>
</div>
<div class="card">
<div class="card-body">
{{ form.errors(error) }}
<form action="/drink-types" method="post">
{{ form.input('name', 'Name', data.name|default(''), 'text', true) }}
{{ form.textarea('description', 'Description', data.description|default(''), false, 3, 'Enter a description of the drink type') }}
{{ form.input('desired_stock', 'Desired Stock', data.desired_stock|default('10'), 'number', true, '', 'form-control-sm') }}
<div class="form-group mt-4">
{{ form.submit('Create Drink Type') }}
<a href="/drink-types" class="btn btn-link">Cancel</a>
</div>
</form>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,36 @@
{% extends 'layout.twig' %}
{% import 'components/form.twig' as form %}
{% block title %}Edit Drink Type - {{ parent() }}{% endblock %}
{% block content %}
<div class="row mb-4">
<div class="col">
<h2>Edit Drink Type</h2>
</div>
<div class="col-auto">
<a href="/drink-types" class="btn btn-secondary">
<i class="fas fa-arrow-left"></i> Back to List
</a>
</div>
</div>
<div class="card">
<div class="card-body">
{{ form.errors(error) }}
<form action="/drink-types/{{ drinkType.id }}" method="post">
{{ form.input('name', 'Name', drinkType.name, 'text', true) }}
{{ form.textarea('description', 'Description', drinkType.description, false, 3, 'Enter a description of the drink type') }}
{{ form.input('desired_stock', 'Desired Stock', drinkType.desiredStock, 'number', true, '', 'form-control-sm') }}
<div class="form-group mt-4">
{{ form.submit('Update Drink Type') }}
<a href="/drink-types/{{ drinkType.id }}" class="btn btn-link">Cancel</a>
</div>
</form>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,73 @@
{% extends 'layout.twig' %}
{% block title %}Drink Types - {{ parent() }}{% endblock %}
{% block content %}
<div class="row mb-4">
<div class="col">
<h2>Drink Types</h2>
</div>
<div class="col-auto">
<a href="/drink-types/create" class="btn btn-success">
<i class="fas fa-plus"></i> Add New Drink Type
</a>
</div>
</div>
{% if drinkTypes is empty %}
<div class="alert alert-info">
No drink types found. Click the button above to add your first drink type.
</div>
{% else %}
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Description</th>
<th>Desired Stock</th>
<th>Current Stock</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for drinkType in drinkTypes %}
<tr>
<td>{{ drinkType.id }}</td>
<td>{{ drinkType.name }}</td>
<td>{{ drinkType.description|default('-') }}</td>
<td>{{ drinkType.desiredStock }}</td>
<td>
{% if drinkType.currentStock is defined %}
{% if drinkType.currentStock < drinkType.desiredStock %}
<span class="text-danger">{{ drinkType.currentStock }}</span>
{% else %}
<span class="text-success">{{ drinkType.currentStock }}</span>
{% endif %}
{% else %}
-
{% endif %}
</td>
<td>
<div class="btn-group" role="group">
<a href="/drink-types/{{ drinkType.id }}" class="btn btn-sm btn-info">
<i class="fas fa-eye"></i> View
</a>
<a href="/drink-types/{{ drinkType.id }}/edit" class="btn btn-sm btn-primary">
<i class="fas fa-edit"></i> Edit
</a>
<form action="/drink-types/{{ drinkType.id }}/delete" method="post" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this drink type?');">
<button type="submit" class="btn btn-sm btn-danger">
<i class="fas fa-trash"></i> Delete
</button>
</form>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% endblock %}

View file

@ -0,0 +1,141 @@
{% extends 'layout.twig' %}
{% block title %}{{ drinkType.name }} - {{ parent() }}{% endblock %}
{% block content %}
<div class="row mb-4">
<div class="col">
<h2>Drink Type Details</h2>
</div>
<div class="col-auto">
<div class="btn-group" role="group">
<a href="/drink-types" class="btn btn-secondary">
<i class="fas fa-arrow-left"></i> Back to List
</a>
<a href="/drink-types/{{ drinkType.id }}/edit" class="btn btn-primary">
<i class="fas fa-edit"></i> Edit
</a>
<form action="/drink-types/{{ drinkType.id }}/delete" method="post" class="d-inline" onsubmit="return confirm('Are you sure you want to delete this drink type?');">
<button type="submit" class="btn btn-danger">
<i class="fas fa-trash"></i> Delete
</button>
</form>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="card mb-4">
<div class="card-header">
<h5 class="card-title mb-0">Basic Information</h5>
</div>
<div class="card-body">
<table class="table table-bordered">
<tr>
<th style="width: 30%">ID</th>
<td>{{ drinkType.id }}</td>
</tr>
<tr>
<th>Name</th>
<td>{{ drinkType.name }}</td>
</tr>
<tr>
<th>Description</th>
<td>{{ drinkType.description|default('No description provided') }}</td>
</tr>
<tr>
<th>Desired Stock</th>
<td>{{ drinkType.desiredStock }}</td>
</tr>
<tr>
<th>Current Stock</th>
<td>
{% if currentStock is defined %}
{% if currentStock < drinkType.desiredStock %}
<span class="text-danger">{{ currentStock }}</span>
{% else %}
<span class="text-success">{{ currentStock }}</span>
{% endif %}
{% else %}
Not available
{% endif %}
</td>
</tr>
<tr>
<th>Created At</th>
<td>{{ drinkType.createdAt|date('Y-m-d H:i:s') }}</td>
</tr>
<tr>
<th>Updated At</th>
<td>{{ drinkType.updatedAt|date('Y-m-d H:i:s') }}</td>
</tr>
</table>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card mb-4">
<div class="card-header">
<h5 class="card-title mb-0">Stock History</h5>
</div>
<div class="card-body">
{% if inventoryRecords is defined and inventoryRecords is not empty %}
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>Date</th>
<th>Quantity</th>
<th>Change</th>
</tr>
</thead>
<tbody>
{% for record in inventoryRecords %}
<tr>
<td>{{ record.createdAt|date('Y-m-d H:i:s') }}</td>
<td>{{ record.quantity }}</td>
<td>
{% if record.change > 0 %}
<span class="text-success">+{{ record.change }}</span>
{% elseif record.change < 0 %}
<span class="text-danger">{{ record.change }}</span>
{% else %}
<span class="text-muted">0</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="mt-3">
<a href="/inventory/history/{{ drinkType.id }}" class="btn btn-sm btn-info">
View Full History
</a>
</div>
{% else %}
<p class="text-muted">No inventory records found for this drink type.</p>
{% endif %}
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="card-title mb-0">Quick Actions</h5>
</div>
<div class="card-body">
<div class="d-grid gap-2">
<a href="/inventory/update" class="btn btn-primary">
<i class="fas fa-sync"></i> Update Stock
</a>
<a href="/orders/create" class="btn btn-success">
<i class="fas fa-shopping-cart"></i> Create Order
</a>
</div>
</div>
</div>
</div>
</div>
{% endblock %}