107 lines
6.4 KiB
HTML

<!-- po_list.html -->
{% extends "base.html" %}
{% load i18n static %}
{% block title %}
Purchase Orders - {{ block.super }}
{% endblock %}
{% block content %}
<div class="row mt-4">
<!-- Success Message -->
{% if messages %}
{% for message in messages %}
<div class="alert alert-success">{{ message }}</div>
{% endfor %}
{% endif %}
<!-- Add New PO Button -->
<div class="d-flex justify-content-between mb-2">
<h3 class="">
{{ _("Purchase Orders") |capfirst }}
</h2>
{% if perms.django_ledger.add_purchaseordermodel%}
<div>
{% if perms.django_ledger.add_purchaseordermodel %}
<a href="{% url 'purchase_order_create' request.dealer.slug request.dealer.entity.slug %}"
class="btn btn-md btn-phoenix-primary"><i class="fa fa-plus me-2"></i>{{ _("Create New PO") }}</a>
{% endif %}
</div>
{% endif %}
</div>
{% include "partials/search_box.html" %}
<div class="table-responsive px-1 scrollbar mt-3">
<table class= "table align-items-center table-flush table-hover">
<thead>
<tr class="bg-body-highlight">
<th class="sort white-space-nowrap align-middle" scope="col" style="width:15%">PO Number</th>
<th class="sort white-space-nowrap align-middle" scope="col" style="width:40%">Description</th>
<th class="sort white-space-nowrap align-middle" scope="col" style="width:15%">Status</th>
<th class="sort white-space-nowrap align-middle" scope="col" style="width:15%">Created At</th>
<th class="sort white-space-nowrap align-middle" scope="col" style="width:15%">Actions</th>
</tr>
</thead>
<tbody class="list">
{% if purchase_orders %}
{% for po in purchase_orders %}
<tr class="hover-actions-trigger btn-reveal-trigger position-static">
<td class="align-middle product white-space-nowrap ps-1">{{ po.po_number }}</td>
<td class="align-middle product white-space-nowrap">{{ po.po_title }}</td>
<td class="align-middle product white-space-nowrap">
<span class="">
{% if po.po_status == 'draft' %}
<span class="text-warning me-2" data-feather="file"></span>
{% elif po.po_status == 'in_review' %}
<span class="text-info me-2" data-feather="search"></span>
{% elif po.po_status == 'paid' %}
<span class="text-success me-2" data-feather="dollar-sign"></span>
{% elif po.po_status == 'canceled' %}
<span class="text-danger me-2" data-feather="x-circle"></span>
{% elif po.po_status == 'fulfilled' %}
<span class="text-success me-2" data-feather="check-circle"></span>
{% elif po.po_status == 'approved' %}
<span class="text-success me-2" data-feather="thumbs-up"></span>
{% endif %}
{{ po.po_status|capfirst }}
</span>
</td>
<td class="align-middle product white-space-nowrap">{{ po.created|date:"M d, Y" }}</td>
<td class="align-middle white-space-nowrap">
<div class="btn-reveal-trigger position-static">
<button class="btn btn-sm dropdown-toggle dropdown-caret-none transition-none btn-reveal fs-10" type="button" data-bs-toggle="dropdown" data-boundary="window" aria-haspopup="true" aria-expanded="false" data-bs-reference="parent"><span class="fas fa-ellipsis-h fs-10"></span></button>
<div class="dropdown-menu dropdown-menu-end py-2">
{% if perms.django_ledger.change_purchaseordermodel %}
<a href="{% url 'purchase_order_detail' request.dealer.slug request.dealer.entity.slug po.pk %}" class="dropdown-item text-success-dark">{% trans 'Purchase Order Detail' %}</a>
{% endif %}
{% if po.po_status == 'fulfilled' %}
{% if perms.inventory.add_car %}
<a href="{% url 'view_items_inventory' dealer_slug=request.dealer.slug entity_slug=entity_slug po_pk=po.pk %}" class="dropdown-item text-success-dark">{% trans 'Inventory Items' %}</a>
{% endif %}
{% else %}
<button class="dropdown-item text-warning-dark" disabled><span class="fas fa-exclamation-triangle me-1"></span> Fulfill the PO Before Viewing Inventory</button>
{% endif %}
</div>
</div>
</td>
</tr>
{%endfor%}
{% else%}
<tr>
<td colspan="6" class="text-center">No purchase orders found.</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
{% if page_obj.paginator.num_pages > 1 %}
<div class="d-flex justify-content-end mt-3">
<div class="d-flex">
{% include 'partials/pagination.html'%}
</div>
</div>
{% endif %}
</div>
{% include 'modal/delete_modal.html' %}
{% endblock %}