accounting workflows
This commit is contained in:
@@ -89,7 +89,7 @@
|
||||
<div class="card">
|
||||
<div class="card-body p-4">
|
||||
<div class="row g-3 align-items-end">
|
||||
<div class="col-lg-6">
|
||||
<div class="col-lg-4">
|
||||
<div class="position-relative">
|
||||
<input type="text" id="search_input" class="form-control ps-9"
|
||||
placeholder="Search quotation number or contact...">
|
||||
@@ -98,7 +98,7 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="col-lg-2">
|
||||
<select id="filter_status" class="form-select">
|
||||
<option value="">All Status</option>
|
||||
<option value="0">Draft</option>
|
||||
@@ -109,7 +109,12 @@
|
||||
<option value="-1">Cancelled</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<div class="col-lg-2">
|
||||
<select id="filter_dept" class="form-select">
|
||||
<option value="">All Departments</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<button class="btn btn-secondary w-100" onclick="retrieve_quotations()">
|
||||
<i class="ti ti-search me-1"></i>Search
|
||||
</button>
|
||||
@@ -130,6 +135,7 @@
|
||||
<th>Date</th>
|
||||
<th>Valid Until</th>
|
||||
<th>Contact</th>
|
||||
<th>Department</th>
|
||||
<th>Items</th>
|
||||
<th>Grand Total</th>
|
||||
<th>Status</th>
|
||||
@@ -172,13 +178,15 @@
|
||||
|
||||
var keyword = $('#search_input').val().toLowerCase();
|
||||
var fil_status = $('#filter_status').val();
|
||||
var fil_dept = $('#filter_dept').val();
|
||||
|
||||
var data = all.filter(function(q) {
|
||||
var match_kw = !keyword ||
|
||||
var match_kw = !keyword ||
|
||||
(q.quotation_number || '').toLowerCase().includes(keyword) ||
|
||||
(q.contact_name || '').toLowerCase().includes(keyword);
|
||||
var match_st = fil_status === '' || String(q.status) === fil_status;
|
||||
return match_kw && match_st;
|
||||
var match_st = fil_status === '' || String(q.status) === fil_status;
|
||||
var match_dept = !fil_dept || String(q.department_id) === fil_dept;
|
||||
return match_kw && match_st && match_dept;
|
||||
});
|
||||
|
||||
// Stats from full list (unfiltered)
|
||||
@@ -208,6 +216,7 @@
|
||||
<td class="py-3">${format_date(q.quotation_date)}</td>
|
||||
<td class="py-3">${q.valid_until ? format_date(q.valid_until) : '<span class="text-muted">—</span>'}</td>
|
||||
<td class="py-3">${escape_html(q.contact_name || '—')}</td>
|
||||
<td class="py-3">${get_dept_label(q.department_id)}</td>
|
||||
<td class="py-3">${items.length} item${items.length !== 1 ? 's' : ''}</td>
|
||||
<td class="py-3 fw-semibold">${format_number(q.grand_total, 2)}</td>
|
||||
<td class="py-3">${status_badge[String(q.status)] || q.status}</td>
|
||||
@@ -222,11 +231,14 @@
|
||||
$('table#quotation_list tbody').html(body);
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$(async function() {
|
||||
await load_dept_cache();
|
||||
populate_dept_filter('filter_dept');
|
||||
retrieve_quotations();
|
||||
$('#search_input').on('keyup', function(e) {
|
||||
if (e.key === 'Enter') retrieve_quotations();
|
||||
});
|
||||
$('#filter_status, #filter_dept').on('change', retrieve_quotations);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user