warehouse layers [switchable]
This commit is contained in:
@@ -202,7 +202,7 @@
|
||||
<div class="mb-6 d-flex align-items-center justify-content-between">
|
||||
<div>
|
||||
<h2 class="fs-4 mb-2">Storage Locations</h2>
|
||||
<p>Zones, aisles, and rack assignments</p>
|
||||
<p id="storage_subtitle">Zones, aisles, and rack assignments</p>
|
||||
</div>
|
||||
<div>
|
||||
<a href="<?php echo $server_url?>inventory/manage_storage.php" class="btn btn-secondary">
|
||||
@@ -228,9 +228,9 @@
|
||||
<thead class="table-secondary">
|
||||
<tr>
|
||||
<th class="py-3">Warehouse</th>
|
||||
<th class="py-3">Zone</th>
|
||||
<th class="py-3">Aisle Range</th>
|
||||
<th class="py-3">Rack Range</th>
|
||||
<th class="py-3" id="th_level1">Zone</th>
|
||||
<th class="py-3" id="th_level2">Aisle Range</th>
|
||||
<th class="py-3" id="th_level3">Rack Range</th>
|
||||
<th class="py-3">Items Stored</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@@ -251,9 +251,57 @@
|
||||
<?php require "../include_ending.php";?>
|
||||
|
||||
<script>
|
||||
// ── Location config ───────────────────────────────────────────────────────
|
||||
var advanced = false;
|
||||
var label_rack = 'Location';
|
||||
var label_zone = 'Zone';
|
||||
var label_aisle = 'Aisle';
|
||||
|
||||
function load_company_setting() {
|
||||
return ajax_request({
|
||||
url: '<?php echo $server_url?>setting/api/engine/company_setting.php',
|
||||
autoPrepare: true,
|
||||
checkRequired: 0,
|
||||
action: 'read',
|
||||
onSuccess: function(res) {
|
||||
var s = res.output;
|
||||
advanced = s.advanced_location == 1;
|
||||
label_rack = s.location_label_rack || (advanced ? 'Rack' : 'Location');
|
||||
label_zone = s.location_label_zone || 'Zone';
|
||||
label_aisle = s.location_label_aisle || 'Aisle';
|
||||
apply_location_labels();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function apply_location_labels() {
|
||||
// Stats card subtitles
|
||||
$('#total_capacity small').text(label_rack + ' positions available');
|
||||
$('#total_space_used small').text(label_rack + 's occupied');
|
||||
|
||||
// Storage tab subtitle + search
|
||||
$('#storage_subtitle').text(advanced
|
||||
? label_zone + 's, ' + label_aisle + 's, and ' + label_rack + ' assignments'
|
||||
: label_rack + ' assignments');
|
||||
$('#search_storage').attr('placeholder', advanced
|
||||
? 'Search by warehouse or ' + label_zone.toLowerCase() + '…'
|
||||
: 'Search by warehouse or ' + label_rack.toLowerCase() + '…');
|
||||
|
||||
// Table headers
|
||||
if (advanced) {
|
||||
$('#th_level1').text(label_zone).show();
|
||||
$('#th_level2').text(label_aisle + ' Range').show();
|
||||
$('#th_level3').text(label_rack + ' Range');
|
||||
} else {
|
||||
$('#th_level1').hide();
|
||||
$('#th_level2').hide();
|
||||
$('#th_level3').text(label_rack + ' Range');
|
||||
}
|
||||
}
|
||||
|
||||
// ── Current search terms (read by change_page_* when paginating) ─────
|
||||
var search_term_warehouse = '';
|
||||
var search_term_storage = '';
|
||||
var search_term_storage = '';
|
||||
|
||||
|
||||
// ── Stats card ───────────────────────────────────────────────────────
|
||||
@@ -379,7 +427,8 @@
|
||||
var filtered = kw ?
|
||||
alasql(`SELECT * FROM storage
|
||||
WHERE LOWER(warehouse_name) LIKE '%${kw}%'
|
||||
OR LOWER(zone) LIKE '%${kw}%'`) :
|
||||
OR LOWER(zone) LIKE '%${kw}%'
|
||||
OR LOWER(rack) LIKE '%${kw}%'`) :
|
||||
alasql(`SELECT * FROM storage`);
|
||||
|
||||
var page = generate_pagination('storage', filtered.length);
|
||||
@@ -396,11 +445,15 @@
|
||||
|
||||
var body = '';
|
||||
$.each(page_data, function(key, item) {
|
||||
var location_cells = advanced
|
||||
? `<td class="py-3">${item['zone']}</td>
|
||||
<td class="py-3">${item['aisle_from']} - ${item['aisle_to']}</td>
|
||||
<td class="py-3">${item['rack_from']} - ${item['rack_to']}</td>`
|
||||
: `<td class="py-3">${item['rack_from']} - ${item['rack_to']}</td>`;
|
||||
|
||||
body += `<tr>
|
||||
<td class="py-3">${item['warehouse_name']}</td>
|
||||
<td class="py-3">${item['zone']}</td>
|
||||
<td class="py-3">${item['aisle_from']} - ${item["aisle_to"]}</td>
|
||||
<td class="py-3">${item['rack_from']} - ${item["rack_to"]}</td>
|
||||
${location_cells}
|
||||
<td class="py-3"></td>
|
||||
<td class="py-3">
|
||||
<a href="<?php echo $server_url?>inventory/manage_storage.php?id=${item['id']}" class=""><i class="ti ti-eye fs-5"></i></a>
|
||||
@@ -477,6 +530,7 @@
|
||||
// ── Boot ─────────────────────────────────────────────────────────────
|
||||
$(async function() {
|
||||
try {
|
||||
await load_company_setting();
|
||||
await retrieve_stats();
|
||||
await retrieve_warehouse();
|
||||
await retrieve_storage();
|
||||
|
||||
Reference in New Issue
Block a user