Django_Basic_Manufacturing/templates/inventory/customer_list.html

108 lines
4.8 KiB
HTML

{% extends 'base.html' %}
{% block title %}Customers{% endblock %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h3 mb-0">
<i class="bi bi-people me-2"></i>
Customers
</h1>
<a href="{% url 'inventory:customer_create' %}" class="btn btn-primary">
<i class="bi bi-plus-circle me-2"></i>
New Customer
</a>
</div>
<div class="card">
<div class="card-body">
{% if customers %}
<div class="table-responsive">
<table class="table table-hover">
<thead class="table-light">
<tr>
<th>Code</th>
<th>Name</th>
<th>Type</th>
<th>Contact Person</th>
<th>Email</th>
<th>Phone</th>
<th>Credit Limit</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for customer in customers %}
<tr>
<td>
<strong>{{ customer.code }}</strong>
</td>
<td>{{ customer.name }}</td>
<td>
<span class="badge bg-{% if customer.customer_type == 'corporate' %}primary{% elif customer.customer_type == 'wholesale' %}info{% else %}secondary{% endif %}">
{{ customer.get_customer_type_display }}
</span>
</td>
<td>{{ customer.contact_person|default:"N/A" }}</td>
<td>{{ customer.email|default:"N/A" }}</td>
<td>{{ customer.phone|default:"N/A" }}</td>
<td>Rp {{ customer.credit_limit|floatformat:0 }}</td>
<td>
<span class="badge bg-{% if customer.is_active %}success{% else %}secondary{% endif %}">
{{ customer.is_active|yesno:"Active,Inactive" }}
</span>
</td>
<td>
<a href="{% url 'inventory:customer_detail' customer.pk %}" class="btn btn-sm btn-outline-primary">
<i class="bi bi-eye"></i>
</a>
<a href="{% url 'inventory:customer_edit' customer.pk %}" class="btn btn-sm btn-outline-warning ms-1">
<i class="bi bi-pencil"></i>
</a>
<a href="{% url 'inventory:customer_delete' customer.pk %}" class="btn btn-sm btn-outline-danger ms-1">
<i class="bi bi-trash"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if is_paginated %}
<nav aria-label="Page navigation" class="mt-4">
<ul class="pagination justify-content-center">
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}">Previous</a>
</li>
{% endif %}
<li class="page-item active">
<span class="page-link">Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}</span>
</li>
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.next_page_number }}">Next</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
{% else %}
<div class="text-center py-5">
<i class="bi bi-people display-1 text-muted"></i>
<h4 class="mt-3 text-muted">No Customers Found</h4>
<p class="text-muted">Start by adding your first customer.</p>
<a href="{% url 'inventory:customer_create' %}" class="btn btn-primary">
<i class="bi bi-plus-circle me-2"></i>
Add Customer
</a>
</div>
{% endif %}
</div>
</div>
{% endblock %}