Commit 14a9f03b authored by Matthew Dizon's avatar Matthew Dizon

final changes

parent eb870834
# Generated by Django 3.0.5 on 2021-06-03 01:26
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Kiosk', '0002_auto_20210527_1147'),
]
operations = [
migrations.AlterField(
model_name='food',
name='price',
field=models.FloatField(max_length=250, validators=[django.core.validators.MinValueValidator(1)]),
),
migrations.AlterField(
model_name='order',
name='qty',
field=models.FloatField(max_length=250, validators=[django.core.validators.MinValueValidator(1)]),
),
]
from django.db import models from django.db import models
from django.core.validators import MinValueValidator
# Create your models here. # Create your models here.
class Account(models.Model): class Account(models.Model):
...@@ -17,7 +18,7 @@ class Account(models.Model): ...@@ -17,7 +18,7 @@ class Account(models.Model):
class Food(models.Model): class Food(models.Model):
name = models.CharField(max_length=250, unique=True) name = models.CharField(max_length=250, unique=True)
description = models.CharField(max_length=250) description = models.CharField(max_length=250)
price = models.FloatField(max_length=250) price = models.FloatField(max_length=250, validators=[MinValueValidator(1)])
created_at = models.DateTimeField(auto_now_add=True) created_at = models.DateTimeField(auto_now_add=True)
def getName(self): def getName(self):
...@@ -59,7 +60,7 @@ class Order(models.Model): ...@@ -59,7 +60,7 @@ class Order(models.Model):
] ]
food = models.ForeignKey(Food, on_delete=models.CASCADE) food = models.ForeignKey(Food, on_delete=models.CASCADE)
qty = models.FloatField(max_length=250) qty = models.FloatField(max_length=250, validators=[MinValueValidator(1)])
ordered_at = models.DateTimeField(auto_now_add=True) ordered_at = models.DateTimeField(auto_now_add=True)
cust_order = models.ForeignKey(Customer, on_delete=models.CASCADE) cust_order = models.ForeignKey(Customer, on_delete=models.CASCADE)
payment_mode = models.CharField(max_length=4, choices=PAYMENT_MODE_CHOICES, default=CASH) payment_mode = models.CharField(max_length=4, choices=PAYMENT_MODE_CHOICES, default=CASH)
......
...@@ -106,7 +106,7 @@ label { ...@@ -106,7 +106,7 @@ label {
.table-striped > thead { .table-striped > thead {
text-align: center; text-align: center;
background-color: #7D68D9; background-color: #A894FF;
} }
.list-group-item > span { .list-group-item > span {
...@@ -120,4 +120,8 @@ label { ...@@ -120,4 +120,8 @@ label {
.card { .card {
background-color: #9e89fa; background-color: #9e89fa;
}
.dataTables_wrapper > .dataTables_info {
color: white !important;
} }
\ No newline at end of file
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<div class="d-flex flex-row"> <div class="d-flex flex-row">
<div class="form-group w-50"> <div class="form-group w-50">
<label for="name"> Price (₱): </label> <label for="name"> Price (₱): </label>
<input type="number" class="form-control" id="price" name="price" required> <input type="number" min="1" class="form-control" id="price" name="price" required>
</div> </div>
<div class="form-group w-50 mx-4"> <div class="form-group w-50 mx-4">
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<div class="form-group w-50 mx-4"> <div class="form-group w-50 mx-4">
<label for="name"> Quantity: </label> <label for="name"> Quantity: </label>
<input type="number" class="form-control" id="qty" name="qty" required> <input type="number" min="1" class="form-control" id="qty" name="qty" required>
</div> </div>
</div> </div>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons">
<link rel="stylesheet" href="{% static '/bootstrap/css/bootstrap.css' %}"> <link rel="stylesheet" href="{% static '/bootstrap/css/bootstrap.css' %}">
<link rel="stylesheet" href="{% static '/bootstrap/css/custom.css' %}"> <link rel="stylesheet" href="{% static '/bootstrap/css/custom.css' %}">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.css">
<script src="{% static '/bootstrap/jquery-3.4.1.slim.min.js' %}"></script> <script src="{% static '/bootstrap/jquery-3.4.1.slim.min.js' %}"></script>
<script src="{% static '/bootstrap/popper.min.js' %}"></script> <script src="{% static '/bootstrap/popper.min.js' %}"></script>
...@@ -15,7 +16,7 @@ ...@@ -15,7 +16,7 @@
<body> <body>
<nav class="navbar navbar-expand-lg navbar-light sticky-top"> <nav class="navbar navbar-expand-lg navbar-light sticky-top">
<a class="navbar-brand mb-0" href="/"><span style="color: #9179FA;">GrabGrub</span></a> <a class="navbar-brand mb-0" href="#"><span style="color: #9179FA;">GrabGrub</span></a>
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
<li class="nav-item mx-2"> <li class="nav-item mx-2">
Miguel Bandelaria | 190518 Miguel Bandelaria | 190518
...@@ -29,10 +30,10 @@ ...@@ -29,10 +30,10 @@
</ul> </ul>
</nav> </nav>
<div class="container-fluid pt-3" style="background-color: #23272B; height: 100%;"> <div class="container-fluid pt-3" style="background-color: #23272B; min-height: 100%;">
<div class="row"> <div class="row">
{% if request.path != "/" and request.path != "/signup" %} {% if request.path != "/" and request.path != "/signup" %}
<div class ="col-2 justify-content-left"> <div class ="col-2 justify-content-left position-sticky">
<ul class="nav flex-column"> <ul class="nav flex-column">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link {% if request.path == '/home' %} active {% endif %}" href="/home"> View Orders </a> <a class="nav-link {% if request.path == '/home' %} active {% endif %}" href="/home"> View Orders </a>
...@@ -65,5 +66,8 @@ ...@@ -65,5 +66,8 @@
</footer> </footer>
{% block js %}
{% endblock js %}
</body> </body>
</html> </html>
\ No newline at end of file
{% extends 'Kiosk/base.html' %} {% extends 'Kiosk/base.html' %}
{% load static %} {% load static %}
{% block content %} {% block content %}
<section class="jumbotron text-center"> <section class="jumbotron text-center">
<div class="container"> <div class="container">
<h1 class="jumbotron-heading">Orders</h1> <h1 class="jumbotron-heading">Orders</h1>
<p>A table of all orders</p> <p>A table of all orders</p>
<a href="{% url 'add_order' %}"><button class="btn btn-dark-grabgrub">Add Order</button></a> <a href="{% url 'add_order' %}"><button class="btn btn-dark-grabgrub">Add Order</button></a>
</div> </div>
</section> </section>
{% if message %} {% if message %}
<p class="mt-3 alert alert-success"> {{message}}</p> <p class="mt-3 alert alert-success"> {{message}}</p>
{% endif %} {% endif %}
<div class="col-12"> <div class="col-12">
<table class="table table-striped"> <table class="table table-striped" id="order_table">
<thead> <thead>
<th scope="col"> Customer Name </th> <th scope="col"> Customer Name </th>
<th scope="col"> Food Ordered </th> <th scope="col"> Food Ordered </th>
<th scope="col"> Date Ordered </th> <th scope="col"> Date Ordered </th>
<th scope="col"></th> <th scope="col" class="no-sort"></th>
</thead> </thead>
<tbody> <tbody>
{% for order in orders %} {% for order in orders %}
<tr> <tr>
<td> {{ order.cust_order.getName }} </td> <td> {{ order.cust_order.getName }} </td>
<td> {{ order.food.getName }} </td> <td> {{ order.food.getName }} </td>
<td> {{ order.ordered_at }} </td> <td> {{ order.ordered_at }} </td>
<td><a href="{% url 'view_order_details' order.pk %}"><button class="btn btn-dark-grabgrub">Details</button></a></td> <td><a href="{% url 'view_order_details' order.pk %}"><button class="btn btn-dark-grabgrub">Details</button></a></td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div>
{% endblock %} {% endblock %}
\ No newline at end of file
{% block js %}
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.js"></script>
<script>
$(document).ready( function () {
$('#order_table').DataTable({
"order": [],
"columnDefs": [ {
"targets" : 'no-sort',
"orderable": false,
}],
language: {
searchPlaceholder: "Search Order"
},
"bPaginate": false
});
} );
</script>
{% endblock %}
\ No newline at end of file
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<div class="d-flex flex-row"> <div class="d-flex flex-row">
<div class="form-group w-50"> <div class="form-group w-50">
<label for="name"> Price (₱): </label> <label for="name"> Price (₱): </label>
<input type="number" class="form-control" id="price" name="price" value="{{food.price}}" required> <input type="number" min="1" class="form-control" id="price" name="price" value="{{food.price}}" required>
</div> </div>
<div class="form-group w-50 mx-4"> <div class="form-group w-50 mx-4">
<label for="name"> Date Created: </label> <label for="name"> Date Created: </label>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<div class="form-group w-50 mx-4"> <div class="form-group w-50 mx-4">
<label for="name"> Quantity: </label> <label for="name"> Quantity: </label>
<input type="number" class="form-control" id="qty" name="qty" value="{{order.qty}}" required> <input type="number" min="1" class="form-control" id="qty" name="qty" value="{{order.qty}}" required>
</div> </div>
</div> </div>
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
{% endif %} {% endif %}
<div class="col-12"> <div class="col-12">
<table class="table table-striped"> <table class="table table-striped" id="customer_table">
<thead> <thead>
<th scope="col"> Customer Name </th> <th scope="col"> Customer Name </th>
<th scope="col"> Address </th> <th scope="col"> Address </th>
<th scope="col"> City </th> <th scope="col"> City </th>
<th scope="col"></th> <th scope="col" class="no-sort"></th>
</thead> </thead>
<tbody> <tbody>
{% for customer in customers %} {% for customer in customers %}
...@@ -33,4 +33,22 @@ ...@@ -33,4 +33,22 @@
</tbody> </tbody>
</table> </table>
</div> </div>
{% endblock %}
{% block js %}
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.js"></script>
<script>
$(document).ready( function () {
$('#customer_table').DataTable({
"order": [],
"columnDefs": [ {
"targets" : 'no-sort',
"orderable": false,
}],
language: {
searchPlaceholder: "Search Customer"
},
"bPaginate": false
});
} );
</script>
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
{% endif %} {% endif %}
<div class="col-12"> <div class="col-12">
<table class="table table-striped"> <table class="table table-striped" id="food_table">
<thead> <thead>
<th scope="col"> Food Name </th> <th scope="col"> Food Name </th>
<th scope="col"> Description </th> <th scope="col"> Description </th>
<th scope="col"> Price (₱) </th> <th scope="col"> Price (₱) </th>
<th scope="col"> Date Created </th> <th scope="col"> Date Created </th>
<th scope="col"></th> <th scope="col" class="no-sort"></th>
</thead> </thead>
<tbody> <tbody>
{% for food in foods %} {% for food in foods %}
...@@ -36,4 +36,22 @@ ...@@ -36,4 +36,22 @@
</tbody> </tbody>
</table> </table>
</div> </div>
{% endblock %}
{% block js %}
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.js"></script>
<script>
$(document).ready( function () {
$('#food_table').DataTable({
"order": [],
"columnDefs": [ {
"targets" : 'no-sort',
"orderable": false,
}],
language: {
searchPlaceholder: "Search Food"
},
"bPaginate": false
});
} );
</script>
{% endblock %} {% endblock %}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment