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
+24
View File
@@ -0,0 +1,24 @@
<footer>
<div class="footer clearfix mb-0 text-muted">
<div class="float-start">
<p>{% now 'Y' %} &copy; Asset Management</p>
</div>
<div class="float-end">
<p>
Powered by
<a href="">Xiaoan</a>
</p>
</div>
</div>
</footer>
</div>
</div>
<script>
$(".modal").on("hidden.bs.modal", function () {
document.querySelectorAll(".modal-content").forEach((e)=>{
e.innerHTML = ""
})
});
</script>
</body>
</html>
+144
View File
@@ -0,0 +1,144 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{title}}</title>
<link rel="stylesheet" href="{% static 'assets/css/main/app.css' %}" />
<link rel="stylesheet" href="{% static 'assets/css/main/app-dark.css' %}" />
<link rel="shortcut icon" href="{% static 'assets/images/logo/Logo.svg' %}" type="image/x-icon" />
<link rel="shortcut icon" href="{% static 'assets/images/logo/Logo.png' %}" type="image/png" />
<link rel="stylesheet" href="{% static 'assets/css/shared/iconly.css' %}" />
<link rel="stylesheet" href="{% static 'assets/css/pages/simple-datatables.css' %}">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
<script src="{% static 'assets/js/jquery-3.6.0.min.js' %}"></script>
<script src="{% static 'assets/js/htmx.min.js' %}"></script>
<script defer src="{% static 'assets/js/app.js' %}"></script>
</head>
<body>
<!-- Changing Theme on Reload -->
<script>
const theme = localStorage.getItem('theme') || 'light';
document.body.className = theme;
</script>
<div id="app">
{% include 'commons/sidebar.html' %}
<div id="main">
<header class='mb-3'>
<nav class="navbar navbar-expand navbar-light ">
<div class="container-fluid">
<a href="#" class="burger-btn d-block d-xl-none">
<i class="bi bi-justify fs-3"></i>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
<!-- <li class="nav-item dropdown me-1">
<a class="nav-link active dropdown-toggle text-gray-600" href="#" data-bs-toggle="dropdown"
aria-expanded="false">
<i class='bi bi-envelope bi-sub fs-4'></i>
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdownMenuButton">
<li>
<h6 class="dropdown-header">Mail</h6>
</li>
<li><a class="dropdown-item" href="#">No new mail</a></li>
</ul>
</li> -->
<li class="nav-item dropdown me-3">
<a class="nav-link active dropdown-toggle text-gray-600" href="#" data-bs-toggle="dropdown"
aria-expanded="false">
<i class='bi bi-bell bi-sub fs-4'></i>
<span hx-trigger="load, notificationCountChanged from:body, every 5s" hx-get="{% url 'notifications:count' %}" hx-target="this"></span>
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdownMenuButton" onclick="event.stopPropagation();">
<li>
<h6 class="dropdown-header">Notifications</h6>
</li>
<span hx-get="{% url 'notifications:data' %}" hx-target="this" hx-trigger="load, notificationListChanged from:body, every 5s">
<li><a class="dropdown-item">No notification available</a></li>
</span>
</ul>
</li>
</ul>
<div class="dropdown">
<a href="#" data-bs-toggle="dropdown" aria-expanded="false">
<div class="user-menu d-flex">
<div class="user-name text-end me-3">
<h6 class="mb-0 text-gray-600">{{request.user.full_name}}</h6>
<p class="mb-0 text-sm text-gray-600">{% if request.user.is_superuser %} Administrator {% else %} {{request.user.role}} {% endif %}</p>
</div>
<div class="user-img d-flex align-items-center">
<div class="avatar avatar-md">
{% if request.user.profile_pic %}
<img src="{{request.user.profile_pic.url}}">
{% else %}
<img src="{% static 'assets/images/faces/1.jpg' %}">
{% endif %}
</div>
</div>
</div>
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdownMenuButton" style="min-width: 11rem;">
<li>
<h6 class="dropdown-header">Hello, {{request.user.full_name}}</h6>
</li>
<li>
<a class="dropdown-item" href={% if profile %}"javascript:void(0)"{% else %}"{% url 'authentication:profile' %}"{% endif %}>
<i class="icon-mid bi bi-person me-2"></i>
My Profile
</a>
</li>
<li>
<a class="dropdown-item" href="{% url 'password_change' %}">
<i class="icon-mid bi bi-key me-2"></i>
Change Password
</a>
</li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="{% url 'authentication:logout' %}"><i
class="icon-mid bi bi-box-arrow-left me-2"></i> Logout</a></li>
</ul>
</div>
</div>
</div>
</nav>
{% if messages %}
{% for message in messages %}
{% if message.tags == 'error' %}
<script>
Toastify({
text: "{{ message }}",
duration: 3000,
close: true,
style: {background: '#d9534f'}
}).showToast();
</script>
{% else %}
<script>
Toastify({
text: "{{ message }}",
duration: 3000,
close: true,
}).showToast();
</script>
{% endif %}
{% endfor %}
{% endif %}
</header>
+59
View File
@@ -0,0 +1,59 @@
{% if page_object and request.user.is_superuser %}
<div class="col-12 col-xl-12">
<div class="card">
<div class="card-header">
<h4>History</h4>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-hover table-lg">
<thead>
<tr>
<th>Sl No.</th>
<th>Description</th>
<th>Datetime</th>
</tr>
</thead>
<tbody>
{% for history in page_object %}
<tr>
<td class="col-3">
<div class="d-flex align-items-center">
<p class="font-bold ms-3 mb-0">{{page_object.start_index|add:forloop.counter0}}</p>
</div>
</td>
<td class="col-auto">
<p class="mb-0">
{% if history.history_type == "+" %}
Inserted
{% elif history.history_type == "^" %}
Restored
{% elif history.history_type == "-" %}
Deleted
{% else %}
{% if history.status != history.prev_record.status %}
{% if history.status %} Enabled {% else %} Disabled {% endif %}
{% elif history.is_assigned != history.prev_record.is_assigned %}
{% if history.is_assigned %} Assigned {% else %} Unassigned {% endif %}
{% else %}
Updated
{% endif %}
{% endif %}
by {{history.history_user.full_name}}
</p>
</td>
<td class="col-auto">
<p class="mb-0">
{{history.history_date}}
</p>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% include 'commons/pagination.html' %}
</div>
</div>
</div>
</div>
{% endif %}
+29
View File
@@ -0,0 +1,29 @@
<div class='dataTable-bottom'>Showing {{page_object.start_index}} to {{page_object.end_index}} of {{page_object.paginator.count }} entries</div>
<nav aria-label="Page navigation example">
<ul class="pagination pagination-primary justify-content-end">
<li class="page-item {% if not page_object.has_previous %} disabled {% endif %}">
<a class="page-link" {% if page_object.has_previous %} href="?page={{page_object.previous_page_number}}" {% endif %} tabindex="-1" aria-disabled="true">« Previous</a>
</li>
{% if page_object.previous_page_number >= 2 %}
<li class="page-item"><a class="page-link" href="?page=1">1 </a></li>
<li class="page-item disabled"><a class="page-link" href="?page={{ page_object.paginator.num_pages }}">...</a></li>
{% endif %}
{% if page_object.has_previous %}
<li class="page-item"><a class="page-link" href="?page={{ page_object.previous_page_number }}">{{ page_object.previous_page_number }} </a></li>
{% endif %}
{% for i in page_object.paginator.page_range %}
{% if page_object.number == i %}
<li class="page-item active"><a class="page-link" href="?page={{ i }}">{{ i}} </a></li>
{% elif i == page_object.next_page_number %}
<li class="page-item"><a class="page-link" href="?page={{ i }}">{{ i }} </a></li>
{% elif i == page_object.paginator.num_pages %}
<li class="page-item disabled"><a class="page-link" href="?page={{ page_object.paginator.num_pages }}">...</a></li>
<li class="page-item"><a class="page-link" href="?page={{ page_object.paginator.num_pages }}">{{ page_object.paginator.num_pages }} </a></li>
{% endif %}
{% endfor %}
<li class="page-item {% if not page_object.has_next %} disabled {% endif %}">
<a class="page-link" {% if page_object.has_next %} href="?page={{page_object.next_page_number}}" {% endif %} >Next »</a>
</li>
</ul>
</nav>
+222
View File
@@ -0,0 +1,222 @@
{% load static %}
<div id="sidebar" class="active">
<div class="sidebar-wrapper active">
<div class="sidebar-header position-relative">
<div class="d-flex justify-content-between align-items-center">
<div class="logo">
<a href="/"><img src="{% static 'assets/images/logo/asset_logo.png' %}" alt="Logo" srcset="" style="max-width: 90%; height: auto;"/></a>
</div>
<div class="theme-toggle d-flex gap-2 align-items-center mt-2">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true" role="img" class="iconify iconify--system-uicons" width="20"
height="20" preserveAspectRatio="xMidYMid meet" viewBox="0 0 21 21">
<g fill="none" fill-rule="evenodd" stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round">
<path
d="M10.5 14.5c2.219 0 4-1.763 4-3.982a4.003 4.003 0 0 0-4-4.018c-2.219 0-4 1.781-4 4c0 2.219 1.781 4 4 4zM4.136 4.136L5.55 5.55m9.9 9.9l1.414 1.414M1.5 10.5h2m14 0h2M4.135 16.863L5.55 15.45m9.899-9.9l1.414-1.415M10.5 19.5v-2m0-14v-2"
opacity=".3"></path>
<g transform="translate(-210 -1)">
<path d="M220.5 2.5v2m6.5.5l-1.5 1.5"></path>
<circle cx="220.5" cy="11.5" r="4"></circle>
<path d="m214 5l1.5 1.5m5 14v-2m6.5-.5l-1.5-1.5M214 18l1.5-1.5m-4-5h2m14 0h2">
</path>
</g>
</g>
</svg>
<div class="form-check form-switch fs-6">
<input class="form-check-input me-0" type="checkbox" id="toggle-dark" />
<label class="form-check-label"></label>
</div>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true" role="img" class="iconify iconify--mdi" width="20" height="20"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24">
<path fill="currentColor"
d="m17.75 4.09l-2.53 1.94l.91 3.06l-2.63-1.81l-2.63 1.81l.91-3.06l-2.53-1.94L12.44 4l1.06-3l1.06 3l3.19.09m3.5 6.91l-1.64 1.25l.59 1.98l-1.7-1.17l-1.7 1.17l.59-1.98L15.75 11l2.06-.05L18.5 9l.69 1.95l2.06.05m-2.28 4.95c.83-.08 1.72 1.1 1.19 1.85c-.32.45-.66.87-1.08 1.27C15.17 23 8.84 23 4.94 19.07c-3.91-3.9-3.91-10.24 0-14.14c.4-.4.82-.76 1.27-1.08c.75-.53 1.93.36 1.85 1.19c-.27 2.86.69 5.83 2.89 8.02a9.96 9.96 0 0 0 8.02 2.89m-1.64 2.02a12.08 12.08 0 0 1-7.8-3.47c-2.17-2.19-3.33-5-3.49-7.82c-2.81 3.14-2.7 7.96.31 10.98c3.02 3.01 7.84 3.12 10.98.31Z">
</path>
</svg>
</div>
<div class="sidebar-toggler x">
<a href="#" class="sidebar-hide d-xl-none d-block"><i class="bi bi-x bi-middle"></i></a>
</div>
</div>
</div>
<div class="sidebar-menu">
<ul class="menu">
<li class="sidebar-title">菜单</li>
<li class="sidebar-item {% if sidebar == 'index' %}active{% endif %}">
<a href="/" class="sidebar-link">
<i class="bi bi-grid-fill"></i>
<span>仪表盘</span>
</a>
</li>
{% if perms.authentication.delete_vendor or perms.authentication.edit_vendor or perms.authentication.add_vendor or perms.authentication.view_vendor %}
<li class="sidebar-item {% if sidebar == 'vendors' %}active{% endif %}">
<a href="{% url 'vendors:list' %}" class="sidebar-link">
<i class="bi bi-person-badge"></i>
<span>供应商</span>
</a>
</li>
{% endif %}
{% if perms.authentication.view_product or perms.authentication.delete_product or perms.authentication.edit_product or perms.authentication.add_product %}
<li class="sidebar-item {% if sidebar == 'products' %}active{% endif %}">
<a href="{% url 'products:list' %}" class="sidebar-link">
<i class="bi bi-display-fill"></i>
<span>产品</span>
</a>
</li>
{% endif %}
{% if perms.authentication.view_users or perms.authentication.delete_users or perms.authentication.edit_users or perms.authentication.add_users %} <li class="sidebar-item {% if sidebar == 'users' %}active{% endif %}">
<a href="{% url 'users:list' %}" class="sidebar-link">
<i class="bi bi bi-people-fill"></i>
<span>用户</span>
</a>
</li>
{% endif %}
{% if perms.authentication.edit_asset or perms.authentication.delete_asset or perms.authentication.delete_assign_asset or perms.authentication.add_assign_asset or perms.authentication.add_asset or perms.authentication.reassign_assign_asset %}
<li class="sidebar-item has-sub {% if sidebar == 'assets' %}active{% endif %}">
<a href="javascript:void(0)" class="sidebar-link">
<i class="bi bi-gear-fill"></i>
<span>资产</span>
</a>
<ul class="submenu {% if sidebar == 'assets' %}active{% endif %}">
{% if perms.authentication.edit_asset or perms.authentication.view_asset or perms.authentication.add_asset or perms.authentication.delete_asset %}
<li class="submenu-item {% if submenu == 'list' %}active{% endif %}">
<a href="{% url 'assets:list' %}">资产列表</a>
</li>
{% endif %}
{% if perms.authentication.add_asset %}
<li class="submenu-item {% if submenu == 'add' %}active{% endif %}">
<a href="{% url 'assets:add' %}">添加资产</a>
</li>
{% endif %}
{% if perms.authentication.reassign_assign_asset or perms.authentication.add_assign_asset or perms.authentication.delete_assign_asset %}
<li class="submenu-item {% if submenu == 'assigned-assets' %}active{% endif %}">
<a href="{% url 'assets:assigned_list' %}">已分配资产</a>
</li>
{% endif %}
</ul>
</li>
{% endif %}
<li class="sidebar-item has-sub {% if sidebar == 'admin' %}active{% endif %}">
<a href="javascript:void(0)" class="sidebar-link">
<i class="bi bi-person-fill"></i>
<span>管理</span>
</a>
<ul class="submenu {% if sidebar == 'admin' %}active{% endif %}">
{% if perms.authentication.add_location or perms.authentication.edit_location or perms.authentication.delete_location or perms.authentication.view_location %}
<li class="submenu-item {% if submenu == 'location' %}active{% endif %}">
<a href="{% url 'dashboard:locations' %}">位置信息</a>
</li>
{% endif %}
{% if perms.authentication.add_department or perms.authentication.delete_department or perms.authentication.edit_department %}
<li class="submenu-item {% if submenu == 'department' %}active{% endif %}">
<a href="{% url 'dashboard:departments' %}">部门信息</a>
</li>
{% endif %}
{% if perms.authentication.add_product_type or perms.authentication.edit_product_type or perms.authentication.edit_product_type %}
<li class="submenu-item {% if submenu == 'product_type' %}active{% endif %}">
<a href="{% url 'dashboard:product_type_list' %}">产品类型</a>
</li>
{% endif %}
{% if perms.authentication.delete_product_category or perms.authentication.add_product_category or perms.authentication.edit_product_category %}
<li class="submenu-item {% if submenu == 'product_category' %}active{% endif %}">
<a href="{% url 'dashboard:product_category_list' %}">产品类别</a>
</li>
{% endif %}
{% if request.user.is_superuser %}
<li class="submenu-item {% if submenu == 'roles' %}active{% endif %}">
<a href="{% url 'roles:list' %}">角色</a>
</li>
{% endif %}
</ul>
</li>
{% if perms.authentication.add_vendor or perms.authentication.add_location or perms.authentication.add_department or perms.authentication.add_product_type or perms.authentication.add_product_category %}
<li class="sidebar-item has-sub {% if sidebar == 'upload' %}active{% endif %}">
<a href="javascript:void(0)" class="sidebar-link">
<i class="bi bi-hdd-fill"></i>
<span>上传</span>
</a>
<ul class="submenu {% if sidebar == 'upload' %}active{% endif %}">
{% if perms.authentication.add_vendor %}
<li class="submenu-item {% if submenu == 'vendors' %}active{% endif %}">
<a href="{% url 'upload:vendor_list' %}">供应商</a>
</li>
{% endif %}
{% if perms.authentication.add_location %}
<li class="submenu-item {% if submenu == 'locations' %}active{% endif %}">
<a href="{% url 'upload:location_list' %}">位置</a>
</li>
{% endif %}
{% if perms.authentication.add_department %}
<li class="submenu-item {% if submenu == 'departments' %} active {% endif %}">
<a href="{% url 'upload:department_list' %}">部门</a>
</li>
{% endif %}
{% if perms.authentication.add_product_type %}
<li class="submenu-item {% if submenu == 'product_types' %}active{% endif %}">
<a href="{% url 'upload:product_type_list' %}">产品类型</a>
</li>
{% endif %}
{% if perms.authentication.add_product_category %}
<li class="submenu-item {% if submenu == 'product_categories' %}active{% endif %}">
<a href="{% url 'upload:product_category_list' %}">产品类别</a>
</li>
{% endif %}
</ul>
</li>
{% endif %}
<!-- 回收站 -->
<!-- {% if request.user.is_superuser %}
<li class="sidebar-item has-sub {% if sidebar == 'trash' %}active{% endif %}">
<a href="javascript:void(0)" class="sidebar-link">
<i class="bi bi-trash3-fill"></i>
<span>Recycle Bin</span>
</a>
<ul class="submenu {% if sidebar == 'trash' %}active{% endif %}">
<li class="submenu-item {% if submenu == 'vendors' %}active{% endif %}">
<a href="{% url 'recycle_bin:deleted_vendors' %}">Vendors</a>
</li>
<li class="submenu-item {% if submenu == 'products' %}active{% endif %}">
<a href="{% url 'recycle_bin:deleted_products' %}">Products</a>
</li>
<li class="submenu-item {% if submenu == 'users' %}active{% endif %}">
<a href="{% url 'recycle_bin:deleted_users' %}">Users</a>
</li>
<li class="submenu-item {% if submenu == 'assets' %}active{% endif %}">
<a href="{% url 'recycle_bin:deleted_assets' %}">Assets</a>
</li>
</ul>
</li>
{% endif %} -->
<!-- 支持 -->
<!-- {% if request.user.is_superuser %}
<li class="sidebar-item has-sub {% if sidebar == 'support' %}active{% endif %}">
<a href="javascript:void(0)" class="sidebar-link">
<i class="bi bi-person-video3"></i>
<span>Support</span>
</a>
<ul class="submenu {% if sidebar == 'support' %}active{% endif %}">
<li class="submenu-item {% if submenu == 'faq' %}active{% endif %}">
<a href="{% url 'support:support_faq' %}">FAQs</a>
</li>
<li class="submenu-item">
<a href="mailto:anand@vyrazu.com?subject=Help%20and%20Support%20[AM-From {{request.user.username}}]">Help & Support</a>
</li>
<li class="submenu-item">
<a href="#">Demo Videos</a>
</li>
</ul>
</li>
{% endif %} -->
<li class="sidebar-item {% if sidebar == 'notifications' %}active{% endif %}">
<a href="{% url 'notifications:list' %}" class="sidebar-link">
<i class="bi bi-bell-fill"></i>
<span>通知</span>
</a>
</li>
</ul>
</div>
</div>
</div>