first push

This commit is contained in:
2025-05-23 14:44:12 +08:00
commit abefd1b19b
817 changed files with 580289 additions and 0 deletions
+153
View File
@@ -0,0 +1,153 @@
<div class="modal-content">
<div class="modal-header bg-dark text-center">
<h5 class="modal-title white w-100" id="myModalLabel160">Add Vendor
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close">
</button>
</div>
<form hx-post="{{request.path}}" novalidate>
{% csrf_token %}
<div class="modal-body">
<div class="row">
<div class="col-md-6 col-12">
<div class="form-group">
<label>供应商</label>
{{vendor_form.name}}
{% for error in vendor_form.name.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>邮箱</label>
{{vendor_form.email}}
{% for error in vendor_form.email.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>电话</label>
{{vendor_form.phone}}
{% for error in vendor_form.phone.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>联系人</label>
{{vendor_form.contact_person}}
{% for error in vendor_form.contact_person.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>职位</label>
{{vendor_form.designation}}
{% for error in vendor_form.designation.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>GSTIN 号码</label>
{{vendor_form.gstin_number}}
{% for error in vendor_form.gstin_number.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>地址行1</label>
{{address_form.address_line_one}}
{% for error in address_form.address_line_one.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>地址行2</label>
{{address_form.address_line_two}}
{% for error in address_form.address_line_two.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>国家</label>
{{address_form.country}}
{% for error in address_form.country.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>省份</label>
{{address_form.state}}
{% for error in address_form.state.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>城市</label>
{{address_form.city}}
{% for error in address_form.city.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>邮政编码</label>
{{address_form.pin_code}}
{% for error in address_form.pin_code.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-12 col-12">
<div class="form-group">
<label>描述</label>
{{vendor_form.description}}
{% for error in vendor_form.description.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-light-secondary"
data-bs-dismiss="modal">
<i class="bx bx-x d-block d-sm-none"></i>
<span class="d-none d-sm-block">关闭</span>
</button>
<button type="submit" class="btn btn-info ml-1"
onclick="this.innerHTML = `<span class='spinner-grow spinner-grow-sm' role='status' aria-hidden='true'></span> Saving...`;"
>
<i class="bx bx-check d-block d-sm-none"></i>
<span class="d-none d-sm-block">保存</span>
</button>
</div>
</form>
</div>
<script>
htmx.on("htmx:beforeSwap", (e) => {
if (e.detail.target.id == "add-vendor-modal-content" && !e.detail.xhr.response) {
location.reload()
}
})
</script>
+67
View File
@@ -0,0 +1,67 @@
{% extends 'layouts/main-layout.html' %}
{% block content %}
<div class="page-heading">
<div class="page-title">
<div class="row">
<div class="col-12 col-md-6 order-md-1 order-last">
<h3>Vendor Details</h3>
</div>
<div class="col-12 col-md-6 order-md-2 order-first">
<nav aria-label="breadcrumb" class="breadcrumb-header float-start float-lg-end">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">Dashboard</a></li>
<li class="breadcrumb-item" aria-current="page">Vendors</li>
<li class="breadcrumb-item active" aria-current="page">Vendor Details</li>
</ol>
</nav>
</div>
</div>
</div>
<section class="section">
<div>
<a href="{% url 'vendors:list' %}" class="btn btn-sm btn-outline-info my-3">Back to Vendor List</a>
</div>
<div class="card">
<div class="card-body">
<h6 class="my-3">
<i class="bi bi-person-badge"></i>
<span>Vendor Information</span>
</h6>
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th scope="row">Vendor Name</th>
<td> {{vendor.name}} </td>
<th scope="row">Email</th>
<td> {{vendor.email}} </td>
</tr>
<tr>
<th scope="row">Phone</th>
<td> {{vendor.phone}} </td>
<th scope="row">Contact Person</th>
<td> {{vendor.contact_person}} </td>
</tr>
<tr>
<th scope="row">Designation</th>
<td>{{vendor.designation}}</td>
<th scope="row">GSTIN Number</th>
<td>{{vendor.gstin_number}}</td>
</tr>
<tr>
<th scope="row">Address</th>
<td colspan="3">{{vendor.address}}</td>
</tr>
<tr>
<th scope="row">Description</th>
<td colspan="3">{{vendor.description|urlize}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
{% include 'commons/history.html' %}
</section>
</div>
{% endblock content%}
+128
View File
@@ -0,0 +1,128 @@
{% extends 'layouts/main-layout.html' %}
{% block content %}
<div class="page-heading">
<div class="page-title">
<div class="row">
<div class="col-12 col-md-6 order-md-1 order-last">
<h3>供应商</h3>
</div>
<div class="col-12 col-md-6 order-md-2 order-first">
<nav aria-label="breadcrumb" class="breadcrumb-header float-start float-lg-end">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">Dashboard</a></li>
<li class="breadcrumb-item active" aria-current="page">Vendors</li>
</ol>
</nav>
</div>
</div>
</div>
<section class="section">
{% if perms.authentication.add_vendor %}
<div>
<button type="button" class="btn btn-sm btn-outline-info my-3"
hx-get="{% url 'vendors:add' %}" hx-target="#add-vendor-modal-content"
data-bs-toggle="modal" data-bs-target="#add-vendor-modal">添加供应商</button>
<div class="modal fade text-left" id="add-vendor-modal" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel160" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div id="add-vendor-modal-content" class="modal-content" hx-target="this"></div>
</div>
</div>
</div>
{% endif %}
<div class="card">
<div class="card-body">
{% if page_object %}
<div class="d-flex justify-content-end my-2 gap-2">
<input name="search_text" type="search" class='dataTable-input' autocomplete="off" placeholder='搜索'
hx-get="{% url 'vendors:search' page_object.number %}" hx-trigger="keyup changed delay:500ms, search" hx-target="#search_result">
{% if request.user.is_superuser %}
<button
type="button"
class="btn btn-secondary rounded"
data-bs-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
><i class="bi bi-download"></i></button>
<div class="dropdown-menu">
<a class="dropdown-item" href="{% url 'vendors:export_vendors_csv' %}"><i class="bi bi-filetype-csv"></i> CSV Format</a>
<a class="dropdown-item" href="{% url 'vendors:export_vendors_pdf' %}"><i class="bi bi-filetype-pdf"></i> PDF Format</a>
</div>
{% endif %}
</div>
{% endif %}
<div class="table-responsive">
<table class="table table-hover" id="table1">
<thead>
<tr>
<th>序号</th>
<th>供应商名称</th>
<th>联系人</th>
<th>邮箱</th>
<th>税号</th>
<th>电话号码</th>
<th>状态</th>
{% if perms.authentication.edit_vendor or perms.authentication.view_vendor or perms.authentication.delete_vendor %}
<th>操作</th>
{% endif %}
</tr>
</thead>
{% if page_object %}
<tbody id="search_result">
{% for vendors in page_object %}
<tr>
<td>{{forloop.counter}}</td>
<td>{{vendors.name}}</td>
<td>{{vendors.contact_person}}</td>
<td>{{vendors.email}}</td>
<td>{{vendors.gstin_number}}</td>
<td>{{vendors.phone}}</td>
<td>
{% if request.user.is_superuser %}
<div class="form-check form-switch">
<input
class="form-check-input"
hx-post="{% url 'vendors:status' vendors.id %}"
hx-headers='{"X-CSRFToken":"{{ csrf_token }}"}'
type="checkbox" {% if vendors.status %} checked {% endif %}
style="cursor: pointer;"
>
</div>
{% else %}
{% if vendors.status %} Active {% else %} Inactive {% endif %}
{% endif %}
</td>
<td>
<div class="btn-group btn-group-sm" role="group" aria-label="Basic example">
{% if perms.authentication.view_vendor %}
<a href="{% url 'vendors:details' vendors.id %}" class="btn btn-success"><i class="bi bi-eye-fill"></i></a>
{% endif %}
{% if perms.authentication.edit_vendor %}
<a href="{% url 'vendors:update_vendor' vendors.id %}" class="btn btn-info"><i class="bi bi-pencil-square"></i></a>
{% endif %}
{% if perms.authentication.delete_vendor %}
<form action="{% url 'vendors:delete_vendor' vendors.id %}" method="post" onsubmit="return confirm('Are you sure you want to delete this?')">
{% csrf_token %}
<button type="submit" value="Delete" class="btn btn-sm btn-danger"><i class="bi bi-trash3-fill"></i></button>
</form>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
{% else %}
<div class="alert alert-info" role="alert">
暂无记录
</div>
{% endif %}
</table>
</div>
{% include 'commons/pagination.html' %}
</div>
</div>
</section>
</div>
{% endblock content%}
+155
View File
@@ -0,0 +1,155 @@
{% extends 'layouts/main-layout.html' %}
{% block content %}
<div class="page-heading">
<div class="page-title">
<div class="row">
<div class="col-12 col-md-6 order-md-1 order-last">
<h3>Update Vendor</h3>
</div>
<div class="col-12 col-md-6 order-md-2 order-first">
<nav aria-label="breadcrumb" class="breadcrumb-header float-start float-lg-end">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">Dashboard</a></li>
<li class="breadcrumb-item">Vendors</li>
<li class="breadcrumb-item active" aria-current="page">Update Vendor</li>
</ol>
</nav>
</div>
</div>
</div>
<section class="section">
<div>
<a href="{% url 'vendors:list' %}" class="btn btn-sm btn-outline-info my-3">Back to Vendor List</a>
</div>
<form class="form row" action="{{request.path}}" method="post" novalidate>
{% csrf_token %}
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-md-6 col-12">
<div class="form-group">
<label>Vendor</label>
{{vendor_form.name}}
{% for error in vendor_form.name.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>Email</label>
{{vendor_form.email}}
{% for error in vendor_form.email.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>Phone</label>
{{vendor_form.phone}}
{% for error in vendor_form.phone.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>Contact Person</label>
{{vendor_form.contact_person}}
{% for error in vendor_form.contact_person.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>Designation</label>
{{vendor_form.designation}}
{% for error in vendor_form.designation.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>GSTIN Number</label>
{{vendor_form.gstin_number}}
{% for error in vendor_form.gstin_number.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>Address Line 1</label>
{{address_form.address_line_one}}
{% for error in address_form.address_line_one.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>Address Line 2</label>
{{address_form.address_line_two}}
{% for error in address_form.address_line_two.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>Country</label>
{{address_form.country}}
{% for error in address_form.country.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>State</label>
{{address_form.state}}
{% for error in address_form.state.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>City</label>
{{address_form.city}}
{% for error in address_form.city.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-6 col-12">
<div class="form-group">
<label>Zip Code</label>
{{address_form.pin_code}}
{% for error in address_form.pin_code.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
<div class="col-md-12 col-12">
<div class="form-group">
<label>Description</label>
{{vendor_form.description}}
{% for error in vendor_form.description.errors %}
<small class="text-danger mb-3">{{ error }}</small>
{% endfor %}
</div>
</div>
</div>
</div>
<div class="card-header">
<button type="submit" class="btn btn-sm btn-info float-end">Save</button>
</div>
</div>
</form>
</section>
</div>
{% endblock content%}
+52
View File
@@ -0,0 +1,52 @@
{% if page_object %}
{% for vendors in page_object %}
<tr>
<td>
{% if page_object.start_index %}
{{page_object.start_index|add:forloop.counter0}}
{% else %}
{{forloop.counter}}
{% endif %}
</td>
<td>{{vendors.name}}</td>
<td>{{vendors.contact_person}}</td>
<td>{{vendors.email}}</td>
<td>{{vendors.gstin_number}}</td>
<td>{{vendors.phone}}</td>
<td>
{% if request.user.is_superuser %}
<div class="form-check form-switch">
<input
class="form-check-input"
hx-post="{% url 'vendors:status' vendors.id %}"
hx-headers='{"X-CSRFToken":"{{ csrf_token }}"}'
type="checkbox" {% if vendors.status %} checked {% endif %}
style="cursor: pointer;"
>
</div>
{% else %}
{% if vendors.status %} Active {% else %} Inactive {% endif %}
{% endif %}
</td>
<td>
<div class="btn-group btn-group-sm" role="group" aria-label="Basic example">
{% if perms.authentication.view_vendor %}
<a href="{% url 'vendors:details' vendors.id %}" class="btn btn-success"><i class="bi bi-eye-fill"></i></a>
{% endif %}
{% if perms.authentication.edit_vendor %}
<a href="{% url 'vendors:update_vendor' vendors.id %}" class="btn btn-info"><i class="bi bi-pencil-square"></i></a>
{% endif %}
{% if perms.authentication.delete_vendor %}
<form action="{% url 'vendors:delete_vendor' vendors.id %}" method="post" onsubmit="return confirm('Are you sure you want to delete this?')">
{% csrf_token %}
<button type="submit" value="Delete" class="btn btn-sm btn-danger"><i class="bi bi-trash3-fill"></i></button>
</form>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
{% else %}
<td colspan="8" class="text-center"> No record found related to your search keyword</td>
{% endif %}
+56
View File
@@ -0,0 +1,56 @@
{% autoescape off %}
<style>
th,
td {
text-align: center;
width: 100%;
padding: 3px;
background-color: #d6eeee;
border-bottom: 2px solid white;
}
th {
background-color: rgb(65, 65, 192);
color: white;
}
@page {
size: letter landscape;
margin: 0.5cm;
}
</style>
<table style="width: 100%">
<thead>
<tr>
<th>Sl No.</th>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
<th>Contact Person</th>
<th>Designation</th>
<th>GSTIN No.</th>
<th>Address</th>
<th>Description</th>
</tr>
</thead>
{% if vendors %}
<tbody>
{% for vendor in vendors %}
<tr>
<td style="width: 50%">{{forloop.counter}}</td>
<td style="width: 70%">{{vendor.name}}</td>
<td>{{vendor.email}}</td>
<td style="width: 70%">{{vendor.phone}}</td>
<td style="width: 70%">{{vendor.contact_person}}</td>
<td>{{vendor.designation}}</td>
<td>{{vendor.gstin_number}}</td>
<td>{{vendor.address}}</td>
<td>{{vendor.description}}</td>
</tr>
{% endfor %}
</tbody>
{% else %}
<tr>
<td colspan="9">No record available!</td>
</tr>
{% endif %}
</table>
{% endautoescape %}