As we have successfully managed to make a static page for staff dashboard, right now it's time to make a view for it, convert it to dynamic template, and connect the template and view to see the full interface.
For now, create the dashboard url and view and name them dashboard_staff located in "/panel/dashboard/staff/".
In the view:
you have to send all the orders to the template using orders key
this has to be a queryset of Order objects where they are sorted by their status. (pending, reject, approved, delivered, paid)
send all objects of Table model to the template using tables key.
template:
for different status fields, orders will have different buttons in front of them:
pending or approved: show/edit button
pending: approve and reject and button
approved: deliver button
delivered: pay button
Remember: All the buttons have to have the name=<ORDER_ID> in their html tag.
Note: buttons will not work as submit buttons. They just look like buttons. Use <a> tag to make them link.
For each order show the customer phone number, table number and created_at field.
As we have successfully managed to make a static page for staff dashboard, right now it's time to make a view for it, convert it to dynamic template, and connect the template and view to see the full interface.
For now, create the dashboard url and view and name them
dashboard_staff
located in "/panel/dashboard/staff/".In the view:
orders
keyTable
model to the template usingtables
key.template:
show/edit
buttonapprove
andreject
and buttondeliver
buttonpay
button Remember: All the buttons have to have thename=<ORDER_ID>
in their html tag. Note: buttons will not work as submit buttons. They just look like buttons. Use<a>
tag to make them link.For each order show the customer phone number, table number and created_at field.