!20 add username to order and item

This commit is contained in:
lubiana 2024-06-27 23:33:32 +02:00
parent 9d81464fd8
commit 511f12f10f
No known key found for this signature in database
12 changed files with 147 additions and 24 deletions

View file

@ -4,23 +4,29 @@
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
<link rel="icon" type="image/png" href="/static/img/slice-of-pizza.png" />
<link rel="stylesheet" href="/static/css/simple.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@exampledev/new.css@1.1.2/new.min.css">
<style>
label{
display: block;
}
</style>
<script src="/static/js/htmx.min.js"></script>
</head>
<body>
<header>
<nav>
<a href="{{ path('app_food_order_index') }}">Orders</a>
<a href="{{ path('app_food_vendor_index') }}">Vendors</a>
<a
href="https://hannover.ccc.de/gitlab/lubiana/futtern/issues/new"
target="_blank"
>Create Issue</a>
</nav>
</header>
<main>
{% block body %}{% endblock %}
</main>
<header>
<p>Hello {{ app.request.cookies.get('username', 'nobody') }} - <a href="{{ path('username') }}">change name</a></p>
<nav>
<a href="{{ path('app_food_order_index') }}">Orders</a> /
<a href="{{ path('app_food_vendor_index') }}">Vendors</a> /
<a
href="https://hannover.ccc.de/gitlab/lubiana/futtern/issues/new"
target="_blank"
>Create Issue</a>
</nav>
</header>
<main>
{% block body %}{% endblock %}
</main>
</body>
</html>

View file

@ -8,6 +8,7 @@
<table class="table">
<thead>
<tr>
<th>CreatedBy</th>
<th>Vendor</th>
<th>CreatedAt</th>
<th>ClosedAt</th>

View file

@ -11,6 +11,10 @@
<th>Vendor</th>
<td>{{ food_order.foodVendor.name }}</td>
</tr>
<tr>
<th>Created By</th>
<td>{{ food_order.createdBy }}</td>
</tr>
<tr>
<th>CreatedAt</th>
<td>{{ food_order.createdAt ? food_order.createdAt|date('Y-m-d H:i:s') : '' }}</td>
@ -32,6 +36,7 @@
<table class="table">
<thead>
<tr>
<th>username</th>
<th>name</th>
<th>extras</th>
<th>actions</th>
@ -40,6 +45,7 @@
<tbody>
{% for item in food_order.orderItems %}
<tr>
<td>{{ item.createdBy }}</td>
<td>{{ item.name }}</td>
<td>{{ item.extras }}</td>
<td>

View file

@ -1,4 +1,5 @@
<tr>
<td>{{ food_order.createdBy }}</td>
<td>{{ food_order.foodVendor.name }}</td>
<td>{{ food_order.createdAt ? food_order.createdAt|date('Y-m-d H:i:s') : '' }}</td>
<td>{{ food_order.closedAt ? food_order.closedAt|date('Y-m-d H:i:s') : '' }}</td>

View file

@ -12,7 +12,7 @@
</div>
<div>
{% for menuItem in menuItems %}
<button data-menu-item>{{ menuItem.name }}</button>
<a href="#" data-menu-item>{{ menuItem.name }}</a>
{% endfor %}
</div>
@ -23,6 +23,7 @@
<script>
document.querySelectorAll('[data-menu-item]').forEach(function(element) {
element.addEventListener('click', function(e) {
e.preventDefault();
document.getElementById('order_item_name').value = e.target.textContent
});
});

View file

@ -0,0 +1,9 @@
{% extends 'base.html.twig' %}
{% block title %}Tell me your name{% endblock %}
{% block body %}
<h1>Tell me your name</h1>
<p>By submitting the form, you agree that your username will be stored as a cookie.</p>
{{ include('_form.html.twig') }}
{% endblock %}