From 2b2f8863bce5b4614f7ba94d0ea7bbc5ee3f061d Mon Sep 17 00:00:00 2001 From: sosokker Date: Sun, 19 Nov 2023 16:04:52 +0700 Subject: [PATCH] Update overview UI and sidebar UI --- core/settings.py | 2 +- inventory/views.py | 8 ++- templates/inventory/overview.html | 105 +++++++++++++++++++++++++++++- templates/nav.html | 10 ++- transaction/models.py | 6 +- 5 files changed, 122 insertions(+), 9 deletions(-) diff --git a/core/settings.py b/core/settings.py index e110366..b113482 100644 --- a/core/settings.py +++ b/core/settings.py @@ -109,7 +109,7 @@ AUTH_PASSWORD_VALIDATORS = [ LANGUAGE_CODE = 'en-us' -TIME_ZONE = 'UTC' +TIME_ZONE = 'Asia/Bangkok' USE_I18N = True diff --git a/inventory/views.py b/inventory/views.py index e16dbc7..94a334e 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -7,8 +7,9 @@ from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.decorators import login_required from inventory.models import Warehouse, Inventory, Item +from transaction.models import Customer, Transfer, Order from inventory.utils import stock_percentage_all, count_pending_supply -from transaction.models import Customer + @login_required def Over(request): @@ -24,6 +25,11 @@ class OverviewView(TemplateView, LoginRequiredMixin): context['customer_count'] = Customer.objects.count() context['stock_percentage'] = stock_percentage_all() context['pending_supply'] = count_pending_supply() + context['inventory_list'] = Inventory.objects.all() + context['inventory_count'] = Inventory.objects.count() + context['item_count'] = Item.objects.count() + context['order_count'] = Order.objects.count() + context['transfer_count'] = Transfer.objects.count() return context diff --git a/templates/inventory/overview.html b/templates/inventory/overview.html index c640717..54b9c28 100644 --- a/templates/inventory/overview.html +++ b/templates/inventory/overview.html @@ -30,7 +30,7 @@
{{ warehouse_count }}
- +
@@ -101,8 +101,81 @@ + + +
+
+
+
+
+
+ Inventory Count
+
{{ inventory_count }}
+
+
+ +
+
+
+
+
+ + +
+
+
+
+
+
+ Order Count
+
{{ order_count }}
+
+
+ +
+
+
+
+
+ + +
+
+
+
+
+
+ Item in Stock
+
{{ item_count }}
+
+
+ +
+
+
+
+
+ + +
+
+
+
+
+
+ Transfer Count
+
{{ transfer_count }}
+
+
+ +
+
+
+
+
+
@@ -130,6 +203,36 @@
+ + +
+ + +
+ + +
+
+
Inventory Stock Level
+
+
+ {% if inventory_list|length != 0 %} + {% for inv in inventory_list %} +

{{ inv.stock_identifier }} + {% if inv.stock_percentage == 100 %}Complete!{% else %}{{ inv.stock_percentage|floatformat:3 }}%{% endif %} +

+
+
+
+ {% endfor %} + {% else %} +

No Inventory Available!

+ {% endif %} +
+
+
+
+ diff --git a/templates/nav.html b/templates/nav.html index 2917fe7..c854b44 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -1,3 +1,5 @@ +{% load tz %} +