{% extends 'base.html' %} {% block content %}

📊 Admin Dashboard

Welcome back! Here's your business overview

{% if inventory_kg <= 0 %}
⚠️

Critical: No Inventory Available

You cannot make any sales until you purchase more meat from farms.

Purchase Meat
{% elif inventory_kg < 100 %}
⚠️

Low Inventory Warning

Only {{ inventory_kg|kg }} remaining. Consider purchasing more meat soon.

Purchase Meat
{% endif %}
💰
Total Sales
{{ total_sales_amount|currency }}
{{ total_sold_kg|kg }} sold
👥
Total Customers
{{ total_customers }}
Active customers
📈
Total Revenue
{{ total_revenue|currency }}
Sales - Purchases
📦
Available Inventory
{{ inventory_kg|kg }}
{% if inventory_kg <= 0 %}Cannot sell {% elif inventory_kg < 100 %}Low stock {% else %}In stock{% endif %}

📊 Sales vs Purchases (Last 7 Days)

Sales
Purchases

📦 Inventory Trend (Last 30 Days)

💰 Revenue Breakdown

📋 Order Status Distribution

👥 Business Overview

👤
{{ total_customers }}
Customers
👷
{{ total_employees }}
Employees
📋
{{ pending_orders + approved_orders + assigned_orders + delivered_orders }}
Total Orders

📋 Order Status

{{ pending_orders }}
Pending
{{ approved_orders }}
Approved
🚚
{{ assigned_orders }}
Assigned
📦
{{ delivered_orders }}
Delivered
{% if account_names %}

🏦 Account Balances

{% for i in range(account_names|length) %} {% endfor %}
{% endif %}

📈 Recent Sales

View All
{% for sale in recent_sales %}
💰
{{ sale.customer.name }}
{{ sale.weight_kg|kg }} • {{ sale.date|date_format }}
{{ sale.total_amount|currency }}
{% else %}
No recent sales
{% endfor %}

📦 Recent Purchases

View All
{% for purchase in recent_purchases %}
📦
{{ purchase.farm.name if purchase.farm else 'Direct Purchase' }}
{{ purchase.weight_kg|kg }} • {{ purchase.date|date_format }}
{{ purchase.total_amount|currency }}
{% else %}
No recent purchases
{% endfor %}
{% endblock %}