Django_Basic_Manufacturing_3/templates/sales/delivery_detail.html
2025-08-22 17:05:22 +07:00

172 lines
8.0 KiB
HTML

{% extends 'base.html' %}
{% load static %}
{% load indonesian_filters %}
{% block title %}Delivery {{ delivery.delivery_number }} - Manufacturing App{% endblock %}
{% block content %}
<div class="container-fluid mt-4">
<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">Delivery: {{ delivery.delivery_number }}</h1>
<div class="btn-toolbar mb-2 mb-md-0">
<a href="{% url 'sales:delivery_list' %}" class="btn btn-outline-primary ms-2">
<i class="fas fa-arrow-left"></i> Back to List
</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="row">
<div class="col-lg-8">
<div class="card mb-4">
<div class="card-header">
<h5 class="mb-0">Delivery Information</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<table class="table table-borderless">
<tr>
<th width="40%">Delivery Number:</th>
<td>{{ delivery.delivery_number }}</td>
</tr>
<tr>
<th>Sales Order:</th>
<td>
<a href="{% url 'sales:so_detail' delivery.so.so_number %}">
{{ delivery.so.so_number }}
</a>
</td>
</tr>
<tr>
<th>Customer:</th>
<td><strong>{{ delivery.so.customer.name }}</strong></td>
</tr>
<tr>
<th>Delivery Date:</th>
<td>{{ delivery.delivery_date|date:"M d, Y" }}</td>
</tr>
<tr>
<th>Delivered By:</th>
<td>{{ delivery.delivered_by.get_full_name|default:delivery.delivered_by.username }}</td>
</tr>
</table>
</div>
<div class="col-md-6">
<table class="table table-borderless">
<tr>
<th width="40%">Total Items:</th>
<td>{{ delivery.items.count }} items</td>
</tr>
<tr>
<th>Total Quantity:</th>
<td>{{ total_quantity|floatformat:0 }}</td>
</tr>
<tr class="table-info">
<th><strong>Total Value:</strong></th>
<td><strong>{{ total_value|format_rupiah }}</strong></td>
</tr>
<tr>
<th>Created:</th>
<td>{{ delivery.created_at|date:"M d, Y H:i" }}</td>
</tr>
</table>
</div>
</div>
{% if delivery.notes %}
<div class="mt-3">
<h6>Notes:</h6>
<p class="mb-0">{{ delivery.notes|linebreaks }}</p>
</div>
{% endif %}
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="mb-0">Delivery Items</h5>
</div>
<div class="card-body">
{% if delivery.items.all %}
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead class="table-dark">
<tr>
<th>Product</th>
<th>Quantity</th>
<th>Unit Price</th>
<th>Total Price</th>
<th>Previously Delivered</th>
</tr>
</thead>
<tbody>
{% for item in delivery.items.all %}
<tr>
<td>
<strong>{{ item.so_item.product.name }}</strong><br>
<small class="text-muted">{{ item.so_item.product.code }}</small>
</td>
<td>{{ item.delivered_quantity|floatformat:0 }}</td>
<td>{{ item.so_item.unit_price|format_rupiah }}</td>
<td>{{ item.item_total|format_rupiah }}</td>
<td>
{% if item.previously_delivered > 0 %}
<span class="badge bg-info">{{ item.previously_delivered|floatformat:0 }}</span>
{% else %}
<span class="badge bg-secondary">0</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="text-muted">No items in this delivery.</p>
{% endif %}
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card mb-4">
<div class="card-header">
<h5 class="mb-0">Sales Order Summary</h5>
</div>
<div class="card-body">
<h6>{{ delivery.so.so_number }}</h6>
<p class="mb-1"><i class="fas fa-user"></i> {{ delivery.so.customer.name }}</p>
<p class="mb-1"><i class="fas fa-calendar"></i> {{ delivery.so.order_date|date:"M d, Y" }}</p>
<p class="mb-1"><i class="fas fa-money-bill"></i> {{ delivery.so.total_amount|format_rupiah }}</p>
<a href="{% url 'sales:so_detail' delivery.so.so_number %}" class="btn btn-sm btn-outline-primary">
View Sales Order
</a>
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="mb-0">Quick Actions</h5>
</div>
<div class="card-body">
<a href="{% url 'sales:delivery_list' %}" class="btn btn-secondary w-100 mb-2">
<i class="fas fa-list"></i> View All Deliveries
</a>
<a href="{% url 'sales:so_detail' delivery.so.so_number %}" class="btn btn-primary w-100">
<i class="fas fa-shopping-cart"></i> Back to Sales Order
</a>
</div>
</div>
</div>
</div>
</div>
{% endblock %}