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

196 lines
8.2 KiB
HTML

{% extends 'base.html' %}
{% load indonesian_filters %}
{% block title %}Customer Details - {{ customer.name }}{% 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">Customer Details: {{ customer.name }}</h1>
<div class="btn-toolbar mb-2 mb-md-0">
<div class="btn-group me-2">
<a href="{% url 'sales:edit_customer' customer.id %}" class="btn btn-outline-primary">
<i class="fas fa-edit"></i> Edit
</a>
<a href="{% url 'sales:delete_customer' customer.id %}" class="btn btn-outline-danger">
<i class="fas fa-trash"></i> Delete
</a>
</div>
<a href="{% url 'sales:customer_list' %}" class="btn btn-outline-secondary">
<i class="fas fa-arrow-left"></i> Back to List
</a>
</div>
</div>
<div class="row">
<div class="col-lg-8">
<div class="card mb-4">
<div class="card-header">
<h5 class="mb-0">Customer Information</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<table class="table table-borderless">
<tr>
<th width="40%">Customer Code:</th>
<td>{{ customer.code }}</td>
</tr>
<tr>
<th>Customer Name:</th>
<td><strong>{{ customer.name }}</strong></td>
</tr>
<tr>
<th>Contact Person:</th>
<td>{{ customer.contact_person|default:"-" }}</td>
</tr>
<tr>
<th>Email:</th>
<td>
{% if customer.email %}
<a href="mailto:{{ customer.email }}">{{ customer.email }}</a>
{% else %}
-
{% endif %}
</td>
</tr>
<tr>
<th>Phone:</th>
<td>{{ customer.phone|default:"-" }}</td>
</tr>
</table>
</div>
<div class="col-md-6">
<table class="table table-borderless">
<tr>
<th width="40%">Tax ID:</th>
<td>{{ customer.tax_id|default:"-" }}</td>
</tr>
<tr>
<th>Status:</th>
<td>
{% if customer.is_active %}
<span class="badge bg-success">Active</span>
{% else %}
<span class="badge bg-secondary">Inactive</span>
{% endif %}
</td>
</tr>
<tr>
<th>Created:</th>
<td>{{ customer.created_at|date:"M d, Y H:i" }}</td>
</tr>
<tr>
<th>Last Updated:</th>
<td>{{ customer.updated_at|date:"M d, Y H:i" }}</td>
</tr>
</table>
</div>
</div>
{% if customer.address %}
<div class="mt-3">
<h6>Address:</h6>
<p class="mb-0">{{ customer.address|linebreaks }}</p>
</div>
{% endif %}
{% if customer.payment_terms %}
<div class="mt-3">
<h6>Payment Terms:</h6>
<p class="mb-0">{{ customer.payment_terms|linebreaks }}</p>
</div>
{% endif %}
</div>
</div>
{% if sales_orders %}
<div class="card">
<div class="card-header">
<h5 class="mb-0">Recent Sales Orders</h5>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Order Number</th>
<th>Order Date</th>
<th>Total Amount</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for order in sales_orders %}
<tr>
<td><strong>{{ order.so_number }}</strong></td>
<td>{{ order.order_date|date:"M d, Y" }}</td>
<td>{{ order.total_amount|format_rupiah }}</td>
<td>
<span class="badge bg-{{ order.status|yesno:'success,warning,danger' }}">
{{ order.get_status_display }}
</span>
</td>
<td>
<a href="{% url 'sales:so_detail' order.so_number %}" class="btn btn-sm btn-outline-primary">
<i class="fas fa-eye"></i> View
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
</div>
<div class="col-lg-4">
<div class="card mb-4">
<div class="card-header">
<h5 class="mb-0">Customer Statistics</h5>
</div>
<div class="card-body">
<div class="row text-center">
<div class="col-12 mb-3">
<div class="border rounded p-3">
<div class="display-4">{{ total_orders }}</div>
<h6 class="text-muted">Total Orders</h6>
</div>
</div>
<div class="col-12 mb-3">
<div class="border rounded p-3">
<div class="display-4">{{ total_value|format_rupiah:0 }}</div>
<h6 class="text-muted">Total Value</h6>
</div>
</div>
<div class="col-12">
<div class="border rounded p-3">
<div class="display-4">{{ pending_orders }}</div>
<h6 class="text-muted">Pending Orders</h6>
</div>
</div>
</div>
</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:create_so' %}" class="btn btn-success w-100 mb-2">
<i class="fas fa-plus"></i> Create Sales Order
</a>
<a href="{% url 'sales:edit_customer' customer.id %}" class="btn btn-primary w-100 mb-2">
<i class="fas fa-edit"></i> Edit Customer
</a>
<a href="{% url 'sales:customer_list' %}" class="btn btn-outline-secondary w-100">
<i class="fas fa-list"></i> View All Customers
</a>
</div>
</div>
</div>
</div>
{% endblock %}