Django_Basic_Manufacturing_3/templates/purchasing/po_list.html
2025-08-22 17:05:22 +07:00

125 lines
5.3 KiB
HTML

{% extends 'base.html' %}
{% load indonesian_filters %}
{% block title %}Purchase Orders - Manufacturing App{% endblock %}
{% block content %}
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">Purchase Order List</h1>
<div class="btn-toolbar mb-2 mb-md-0">
<a href="{% url 'purchasing:create_po' %}" class="btn btn-sm btn-outline-success">
<i class="fas fa-plus"></i> Create Purchase Order
</a>
</div>
</div>
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endfor %}
{% endif %}
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead class="table-dark">
<tr>
<th>PO Number</th>
<th>Supplier</th>
<th>Order Date</th>
<th>Expected Delivery</th>
<th>Total Amount</th>
<th>Status</th>
<th>Items</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for po in pos %}
<tr>
<td><strong>{{ po.po_number }}</strong></td>
<td>{{ po.supplier.name }}</td>
<td>{{ po.order_date|date:"M d, Y" }}</td>
<td>
{% if po.expected_delivery_date %}
{{ po.expected_delivery_date|date:"M d, Y" }}
{% else %}
-
{% endif %}
</td>
<td>{{ po.total_amount|format_rupiah }}</td>
<td>
{% if po.status == 'ordered' %}
<span class="badge bg-warning">Ordered</span>
{% elif po.status == 'completed' %}
<span class="badge bg-success">Completed</span>
{% elif po.status == 'cancelled' %}
<span class="badge bg-danger">Cancelled</span>
{% else %}
<span class="badge bg-secondary">{{ po.get_status_display }}</span>
{% endif %}
</td>
<td>{{ po.items.count }} items</td>
<td>
<div class="btn-group" role="group">
<a href="{% url 'purchasing:po_detail' po.po_number %}" class="btn btn-sm btn-outline-primary" title="View">
<i class="fas fa-eye"></i>
</a>
<a href="{% url 'purchasing:edit_po' po.po_number %}" class="btn btn-sm btn-outline-secondary" title="Edit">
<i class="fas fa-edit"></i>
</a>
{% if po.status == 'ordered' %}
<a href="{% url 'purchasing:approve_po' po.po_number %}" class="btn btn-sm btn-outline-success" title="Approve">
<i class="fas fa-check"></i>
</a>
{% endif %}
<a href="{% url 'purchasing:delete_po' po.po_number %}" class="btn btn-sm btn-outline-danger" title="Delete">
<i class="fas fa-trash"></i>
</a>
</div>
</td>
</tr>
{% empty %}
<tr>
<td colspan="8" class="text-center text-muted">
No purchase orders found. <a href="{% url 'purchasing:create_po' %}">Create your first purchase order</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-md-4">
<div class="card">
<div class="card-body text-center">
<h3 class="text-primary">{{ pos.count }}</h3>
<h6 class="text-muted">Total Purchase Orders</h6>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-body text-center">
<h3 class="text-success">{{ total_value|format_rupiah:0 }}</h3>
<h6 class="text-muted">Total Purchase Value</h6>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-body text-center">
<h3 class="text-warning">{{ pending_orders }}</h3>
<h6 class="text-muted">Pending Orders</h6>
</div>
</div>
</div>
</div>
{% endblock %}