Change 'Rack' to 'Bin'

This commit is contained in:
Thanakorn S
2026-05-27 17:14:53 +07:00
parent b8798bc02d
commit 8f57ab5570
41 changed files with 931 additions and 933 deletions
+35 -35
View File
@@ -59,7 +59,7 @@
</div>
</div>
<!-- Advanced mode — zone + aisle range + rack range -->
<!-- Advanced mode — zone + aisle range + bin range -->
<div id="form_advanced" class="d-none">
<div class="row">
<div class="col-md-6 mb-3">
@@ -81,16 +81,16 @@
<div class="form-text">Must be same type as Aisle From</div>
</div>
<div class="col-md-3 mb-3">
<label for="rack_from" class="form-label" id="label_rack_from">Rack From</label>
<input type="text" class="form-control" id="rack_from" placeholder="e.g. 1 or A"
<label for="bin_from" class="form-label" id="label_bin_from">Bin From</label>
<input type="text" class="form-control" id="bin_from" placeholder="e.g. 1 or A"
pattern="^([0-9]+|[A-Za-z])$" title="Number or single letter">
<div class="form-text">Number (1–99) or letter (A–Z)</div>
</div>
<div class="col-md-3 mb-3">
<label for="rack_to" class="form-label" id="label_rack_to">Rack To</label>
<input type="text" class="form-control" id="rack_to" placeholder="e.g. 10 or J"
<label for="bin_to" class="form-label" id="label_bin_to">Bin To</label>
<input type="text" class="form-control" id="bin_to" placeholder="e.g. 10 or J"
pattern="^([0-9]+|[A-Za-z])$" title="Number or single letter">
<div class="form-text">Must be same type as Rack From</div>
<div class="form-text">Must be same type as Bin From</div>
</div>
</div>
</div>
@@ -122,7 +122,7 @@
<script>
// ── Location config ───────────────────────────────────────────────────────
var advanced = false;
var label_rack = 'Location';
var label_bin = 'Location';
var label_zone = 'Zone';
var label_aisle = 'Aisle';
@@ -135,7 +135,7 @@
onSuccess: function(res) {
var s = res.output;
advanced = s.advanced_location == 1;
label_rack = s.location_label_rack || (advanced ? 'Rack' : 'Location');
label_bin = s.location_label_bin || (advanced ? 'Bin' : 'Location');
label_zone = s.location_label_zone || 'Zone';
label_aisle = s.location_label_aisle || 'Aisle';
apply_location_labels();
@@ -150,13 +150,13 @@
$('#label_zone').text(label_zone);
$('#label_aisle_from').text(label_aisle + ' From');
$('#label_aisle_to').text(label_aisle + ' To');
$('#label_rack_from').text(label_rack + ' From');
$('#label_rack_to').text(label_rack + ' To');
$('#label_bin_from').text(label_bin + ' From');
$('#label_bin_to').text(label_bin + ' To');
} else {
$('#form_advanced').addClass('d-none');
$('#form_simple').removeClass('d-none');
$('#label_location_from').text(label_rack + ' From');
$('#label_location_to').text(label_rack + ' To');
$('#label_location_from').text(label_bin + ' From');
$('#label_location_to').text(label_bin + ' To');
$('#location_from').attr('placeholder', 'e.g. Shelf-A or 1');
$('#location_to').attr('placeholder', 'e.g. Shelf-E or 5');
}
@@ -164,14 +164,14 @@
// ── Save storage ──────────────────────────────────────────────────────────
function manage_storage() {
var zone, aisle_from, aisle_to, rack_from, rack_to;
var zone, aisle_from, aisle_to, bin_from, bin_to;
if (advanced) {
zone = $('#zone').val().trim();
aisle_from = $('#aisle_from').val().trim().toUpperCase();
aisle_to = $('#aisle_to').val().trim().toUpperCase();
rack_from = $('#rack_from').val().trim().toUpperCase();
rack_to = $('#rack_to').val().trim().toUpperCase();
bin_from = $('#bin_from').val().trim().toUpperCase();
bin_to = $('#bin_to').val().trim().toUpperCase();
var isNumeric = function(v) { return /^[0-9]+$/.test(v); };
var isAlpha = function(v) { return /^[A-Z]$/.test(v); };
@@ -182,8 +182,8 @@
if (!aisle_from || !aisle_to) {
alert('Please enter the full ' + label_aisle + ' range.'); return;
}
if (!rack_from || !rack_to) {
alert('Please enter the full ' + label_rack + ' range.'); return;
if (!bin_from || !bin_to) {
alert('Please enter the full ' + label_bin + ' range.'); return;
}
if (aisle_from && aisle_to) {
@@ -197,25 +197,25 @@
alert(label_aisle + ' From must be less than or equal to To.'); return;
}
}
if (rack_from && rack_to) {
if (isNumeric(rack_from) !== isNumeric(rack_to)) {
alert(label_rack + ' From and To must both be numbers or both be letters.'); return;
if (bin_from && bin_to) {
if (isNumeric(bin_from) !== isNumeric(bin_to)) {
alert(label_bin + ' From and To must both be numbers or both be letters.'); return;
}
if (isAlpha(rack_from) && rack_from.charCodeAt(0) > rack_to.charCodeAt(0)) {
alert(label_rack + ' From must be less than or equal to To.'); return;
if (isAlpha(bin_from) && bin_from.charCodeAt(0) > bin_to.charCodeAt(0)) {
alert(label_bin + ' From must be less than or equal to To.'); return;
}
if (isNumeric(rack_from) && parseInt(rack_from) > parseInt(rack_to)) {
alert(label_rack + ' From must be less than or equal to To.'); return;
if (isNumeric(bin_from) && parseInt(bin_from) > parseInt(bin_to)) {
alert(label_bin + ' From must be less than or equal to To.'); return;
}
}
} else {
// Simple mode — from/to, same value written to zone/aisle/rack
// Simple mode — from/to, same value written to zone/aisle/bin
var loc_from = $('#location_from').val().trim();
var loc_to = $('#location_to').val().trim();
if (!loc_from) {
alert('Please enter a ' + label_rack + ' From value.'); return;
alert('Please enter a ' + label_bin + ' From value.'); return;
}
// If To is blank, default to same as From (single location)
if (!loc_to) loc_to = loc_from;
@@ -225,14 +225,14 @@
var mf = loc_from.match(prefix_pattern);
var mt = loc_to.match(prefix_pattern);
if (mf && mt && mf[1] !== mt[1]) {
alert(label_rack + ' From and To must share the same prefix (e.g. Shelf-A → Shelf-E).'); return;
alert(label_bin + ' From and To must share the same prefix (e.g. Shelf-A → Shelf-E).'); return;
}
zone = loc_from;
aisle_from = loc_from;
aisle_to = loc_to;
rack_from = loc_from;
rack_to = loc_to;
bin_from = loc_from;
bin_to = loc_to;
}
return ajax_request({
@@ -245,8 +245,8 @@
zone: zone,
aisle_from: aisle_from,
aisle_to: aisle_to,
rack_from: rack_from,
rack_to: rack_to,
bin_from: bin_from,
bin_to: bin_to,
description: $('#description').val(),
},
onSuccess: function() {
@@ -287,11 +287,11 @@
$('#zone').val(d.zone || '');
$('#aisle_from').val(d.aisle_from || '');
$('#aisle_to').val(d.aisle_to || '');
$('#rack_from').val(d.rack_from || '');
$('#rack_to').val(d.rack_to || '');
$('#bin_from').val(d.bin_from || '');
$('#bin_to').val(d.bin_to || '');
} else {
$('#location_from').val(d.rack_from || '');
$('#location_to').val(d.rack_to || '');
$('#location_from').val(d.bin_from || '');
$('#location_to').val(d.bin_to || '');
}
$('button[type=submit]').text('Update Storage');
$('button[type=reset]').hide();