From 0d3c54f5c40d093de343a6e0b13471393198196a Mon Sep 17 00:00:00 2001 From: ebohm Date: Wed, 21 Oct 2020 15:53:22 +0100 Subject: [PATCH] updated reallocation --- EDMS/db.sqlite3 | Bin 192512 -> 196608 bytes .../migrations/0012_auto_20201020_1637.py | 18 +++++ .../migrations/0013_auto_20201020_1706.py | 18 +++++ EDMS/shoppingCart/models.py | 4 +- .../templates/shoppingCart/allocate.html | 2 +- .../templates/shoppingCart/delete_item.html | 22 ------ .../templates/shoppingCart/order_form.html | 37 ---------- .../templates/shoppingCart/status_row.html | 6 +- .../templates/shoppingCart/store.html | 67 ------------------ .../shoppingCart/store_dashBoard.html | 64 ++++++++--------- EDMS/shoppingCart/views.py | 8 ++- 11 files changed, 81 insertions(+), 165 deletions(-) create mode 100644 EDMS/shoppingCart/migrations/0012_auto_20201020_1637.py create mode 100644 EDMS/shoppingCart/migrations/0013_auto_20201020_1706.py delete mode 100644 EDMS/shoppingCart/templates/shoppingCart/delete_item.html delete mode 100644 EDMS/shoppingCart/templates/shoppingCart/order_form.html delete mode 100644 EDMS/shoppingCart/templates/shoppingCart/store.html diff --git a/EDMS/db.sqlite3 b/EDMS/db.sqlite3 index 8997b357ff783941c5ac0ef5c8aad3d43ed31788..844fc11b19428d161aafbad85841504fee44da47 100644 GIT binary patch delta 3178 zcmai0Yiu0V72bPi?b+wOP9QAACcAO!P((7hk9qA_!jHsBNF2XnL?e@!O?H8;+^lgn z=_4c?)6&9^R)7;tRVfk`RjWz}l^S)0>d>kP6@;pa#~-Sqq6z^D2oOJbR)RZc*JZt4 zhn44e);`}k=R4oIk8^Lt&z(y=v~fLZ4~0TZJv-Ec)bq&0+XP1KPu}qxs-+`nLGS1d zM}{J3alGTtdSx)(7V7C8IB|DrcD8u@uARBLGGkm$=T4SO(}D@c)iccb0)0eb-KFxdTI_kq0y>|U^Y!0rY+1a=qLonQyS4uI`%gI|5spFe@Vj}#5V*Z&aE zc%1x}JW75=&XZq|2grToUUG`elJAl{IYPce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3P|PWZAgOv&A+Fg~A~tDbih7VH zN`-<2n^?w6tD@pT5bc6XpjfX`PvTKQJa|w@FOv8VbdplMba=zS$9r#nd|##Ftb7u0 z?{T9hLMX`Y_PMn<8UoaOapn=>ypH)g?@E}eKjkpz2k-LufjO+q$~O5IN@AL=ftLq) z$j2ox4c5Vfq5e5=6_3|X2OnbZb>*dkd#1Q?d4clx@in$akgbJh_%deND&?PdwSa7` zzQV_=4j?T=ev_8jH)Rkyoq=>bUp91qI$t=i7bn9JY(ql|wxi^jAcT~VGN!VM`qgke zti+XAAg0Db(MV>dhr@!^%7E+0K9iTeh-xT*RnCm^Z zek=ly>C-w4^oj%AUr#E9=Zf@X4IX#IW}hfl)pNW@OW^8>d_gy^&}t0^-Pud!V#&zn z^{l38x~}DNT@R?Z1jBT_2KJpg8p|-ecYAQ;pePR9IH2>ML;}y{%G%kB#@3EIOU%q5 zJxXDSzFh{HzNx|C4$XIWHditBmjjPd7Fp@()>k!~g&Q diff --git a/EDMS/shoppingCart/migrations/0012_auto_20201020_1637.py b/EDMS/shoppingCart/migrations/0012_auto_20201020_1637.py new file mode 100644 index 0000000..fb4e59d --- /dev/null +++ b/EDMS/shoppingCart/migrations/0012_auto_20201020_1637.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.2 on 2020-10-20 15:37 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('shoppingCart', '0011_auto_20201019_1709'), + ] + + operations = [ + migrations.RenameField( + model_name='storeorder', + old_name='date_created', + new_name='date', + ), + ] diff --git a/EDMS/shoppingCart/migrations/0013_auto_20201020_1706.py b/EDMS/shoppingCart/migrations/0013_auto_20201020_1706.py new file mode 100644 index 0000000..6f24363 --- /dev/null +++ b/EDMS/shoppingCart/migrations/0013_auto_20201020_1706.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.2 on 2020-10-20 16:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('shoppingCart', '0012_auto_20201020_1637'), + ] + + operations = [ + migrations.AlterField( + model_name='storeorder', + name='date', + field=models.DateTimeField(), + ), + ] diff --git a/EDMS/shoppingCart/models.py b/EDMS/shoppingCart/models.py index cf661c8..2de2a2c 100644 --- a/EDMS/shoppingCart/models.py +++ b/EDMS/shoppingCart/models.py @@ -1,5 +1,6 @@ from django.db import models from django.contrib.auth.models import User +from datetime import timezone, datetime # Create your models here. @@ -52,7 +53,8 @@ class StoreOrder(models.Model): product = models.ForeignKey(Product, on_delete=models.SET_NULL, blank=True, null=True) status = models.CharField(max_length=200, null=True, choices=STATUS) quantity = models.IntegerField(default=0, null=True, blank=True) - date_created = models.DateTimeField(auto_now_add=True, null=True, blank=True) + date = models.DateTimeField(auto_now=0) + def __str__(self): return self.product.name \ No newline at end of file diff --git a/EDMS/shoppingCart/templates/shoppingCart/allocate.html b/EDMS/shoppingCart/templates/shoppingCart/allocate.html index fc927e1..62ebb1d 100644 --- a/EDMS/shoppingCart/templates/shoppingCart/allocate.html +++ b/EDMS/shoppingCart/templates/shoppingCart/allocate.html @@ -8,7 +8,7 @@ - + {% endblock content %} diff --git a/EDMS/shoppingCart/templates/shoppingCart/delete_item.html b/EDMS/shoppingCart/templates/shoppingCart/delete_item.html deleted file mode 100644 index 8ff1d72..0000000 --- a/EDMS/shoppingCart/templates/shoppingCart/delete_item.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends 'shoppingCart/store_dashBoard.html' %} -{% block content %} - - -
-
-
-
- -

Are you sure you want to delete "{{item}}"?

-
- {% csrf_token %} - Go back - - -
-
-
-
- - -{% endblock content %} \ No newline at end of file diff --git a/EDMS/shoppingCart/templates/shoppingCart/order_form.html b/EDMS/shoppingCart/templates/shoppingCart/order_form.html deleted file mode 100644 index 5105c24..0000000 --- a/EDMS/shoppingCart/templates/shoppingCart/order_form.html +++ /dev/null @@ -1,37 +0,0 @@ -{% extends 'shoppingCart/store_dashBoard.html' %} -{% load static %} -{% block content %} -{% load widget_tweaks %} - - -
-
-
- {% if action == 'create' %} -

Create Shop Order

- {% elif action == 'update' %} -

Update Shop Order

- {% endif %} - -
-
-
- -
-
-
-
- {% csrf_token %} - {% for field in form %} - {{field.label}} - {{field|add_class:'form-control'}} - - {% endfor %} -
- -
-
-
-
- -{% endblock %} \ No newline at end of file diff --git a/EDMS/shoppingCart/templates/shoppingCart/status_row.html b/EDMS/shoppingCart/templates/shoppingCart/status_row.html index 096fdef..a870741 100644 --- a/EDMS/shoppingCart/templates/shoppingCart/status_row.html +++ b/EDMS/shoppingCart/templates/shoppingCart/status_row.html @@ -3,7 +3,7 @@
-
+
Total Stores Available
@@ -16,12 +16,12 @@
-
+
Orders Delivered To Stores
-
{{delivered}}
+

{{delivered}}

diff --git a/EDMS/shoppingCart/templates/shoppingCart/store.html b/EDMS/shoppingCart/templates/shoppingCart/store.html deleted file mode 100644 index 620423a..0000000 --- a/EDMS/shoppingCart/templates/shoppingCart/store.html +++ /dev/null @@ -1,67 +0,0 @@ -{% extends 'shoppingCart/store_dashBoard.html' %} -{% block content %} -{% load widget_tweaks %} - - -
- -
-
-
-
-
Store: {{store.name}}
-
- Update Store - Delete Store - -
-
- -
-
-
Store Information
-
-

Name: {{store.name}}

-

Location: {{store.location}}

-

Capacity: {{store.name}}

-

Available: {{store.location}}

-
-
- -
-
-
Total Stores Orders
-
-

{{total_store_orders}}

-
-
-
-
- -
-
-
-
-
- {% for field in filter.form %} - {{field.label}} - {{field|add_class:'form-control-sm'}} - {% endfor %} - -
-
-
- -
-
- - - {% endfor %} - -
-
-
- - - -{% endblock content %} \ No newline at end of file diff --git a/EDMS/shoppingCart/templates/shoppingCart/store_dashBoard.html b/EDMS/shoppingCart/templates/shoppingCart/store_dashBoard.html index e1c7fb3..00b11f5 100644 --- a/EDMS/shoppingCart/templates/shoppingCart/store_dashBoard.html +++ b/EDMS/shoppingCart/templates/shoppingCart/store_dashBoard.html @@ -17,30 +17,27 @@ {% include 'shoppingCart/status_row.html' %} -
+
-
+
-
+
Create Store - +
- - {% for store in store %} + - - - - + + {% endfor %} @@ -48,32 +45,31 @@ -
-
+ + +
Name LocationAvailableSent

{{store}}

{{store.location}}

{{store.available}}{{store.capacity}}

{{store}}

{{store.location}}

+
- - - - - - - - - + + + + + - {% for storeorder in storeorder %} + {% for i in storeorder %} + - - - - - - - - + + + + + + + {% endfor %}
StoresProductsOrdersQuantityStatusAllocatedUpdateRemoveSTORE ORDERSTOREQUANTITYDATESTATUS
{{store}}{{store.product}}{{store.storeorder}}{{store.quantity}}{{store.status}}{{store.date_created}}UpdateCancel

{{i}}

{{i.store}}

{{i.quantity}}

{{i.date}}

{{i.status}}

{{i.date_created}}

@@ -82,7 +78,11 @@
{% endblock content %} -
+ + + + +
diff --git a/EDMS/shoppingCart/views.py b/EDMS/shoppingCart/views.py index c2b8bc5..ed4c884 100644 --- a/EDMS/shoppingCart/views.py +++ b/EDMS/shoppingCart/views.py @@ -47,11 +47,15 @@ def updateItem(request): print('ProductID: ', productId, 'Action:',action) return JsonResponse('item added', safe=False) -def store_dashBoard(request): +def store_dashBoard(request): store = Store.objects.all() total_stores = store.count() + products = Product.objects.all() + delivered = StoreOrder.objects.filter(status='Delivered').count() - context = {'store': store, 'total_stores':total_stores, } + storeorder = StoreOrder.objects.all() + + context = {'store': store, 'total_stores':total_stores,'products':products, 'storeorder':storeorder, 'delivered':delivered, } return render(request, 'ShoppingCart/store_dashBoard.html', context) def products(request):