Change 'Rack' to 'Bin'

This commit is contained in:
Thanakorn S
2026-05-27 17:14:53 +07:00
parent ea94b6a6ae
commit 987cf7ded9
41 changed files with 931 additions and 933 deletions
+56 -56
View File
@@ -87,9 +87,9 @@
</select>
</div>
<div class="mb-3 col-lg-3">
<label class="form-label" id="label_rack_from">From Rack</label>
<select name="rack" id="rack_from" role="from" class="form-select" required disabled>
<option value="">Please select rack</option>
<label class="form-label" id="label_bin_from">From Bin</label>
<select name="bin" id="bin_from" role="from" class="form-select" required disabled>
<option value="">Please select bin</option>
</select>
</div>
@@ -119,9 +119,9 @@
</select>
</div>
<div class="mb-3 col-lg-3">
<label class="form-label" id="label_rack_to">To Rack</label>
<select name="rack" id="rack_to" role="to" class="form-select" required>
<option value="">Please select rack</option>
<label class="form-label" id="label_bin_to">To Bin</label>
<select name="bin" id="bin_to" role="to" class="form-select" required>
<option value="">Please select bin</option>
</select>
</div>
@@ -157,7 +157,7 @@
// ── Location config ───────────────────────────────────────────────────────
var advanced = false;
var label_rack = 'Location';
var label_bin = 'Location';
var label_zone = 'Zone';
var label_aisle = 'Aisle';
var scan_sku_ready = false;
@@ -200,7 +200,7 @@
set_select_value('#zone_' + role, data.zone, data.zone);
set_select_value('#aisle_' + role, data.aisle, data.aisle);
}
set_select_value('#rack_' + role, data.rack, data.rack);
set_select_value('#bin_' + role, data.bin, data.bin);
if (role === 'from') {
scan_from_ready = true;
@@ -214,7 +214,7 @@
return String($('#warehouse_from').val()) === String(data.warehouse_id)
&& String($('#zone_from').val()) === String(data.zone)
&& String($('#aisle_from').val()) === String(data.aisle)
&& String($('#rack_from').val()) === String(data.rack);
&& String($('#bin_from').val()) === String(data.bin);
}
function validate_scanned_location(role, data, onSuccess) {
@@ -230,7 +230,7 @@
warehouse_id: data.warehouse_id,
zone: data.zone,
aisle: data.aisle,
rack: data.rack,
bin: data.bin,
product_sku: $('#product_sku').attr('secondary') || $('#product_sku').val(),
lot_number: $('#lot_number').val(),
serial_number: $('#serial_number').val()
@@ -243,7 +243,7 @@
$('#warehouse_to').val('');
$('#zone_to').html('<option value="">Please select ' + label_zone.toLowerCase() + '</option>').val('');
$('#aisle_to').html('<option value="">Please select ' + label_aisle.toLowerCase() + '</option>').val('');
$('#rack_to').html('<option value="">Please select ' + label_rack.toLowerCase() + '</option>').val('');
$('#bin_to').html('<option value="">Please select ' + label_bin.toLowerCase() + '</option>').val('');
}
function reset_stock_transfer_inputs() {
@@ -269,11 +269,11 @@
bootbox.alert('Scan the SKU label first.');
return;
}
if (!scan_from_ready && !$('#rack_from').val()) {
if (!scan_from_ready && !$('#bin_from').val()) {
bootbox.alert('Scan the from-location label before saving.');
return;
}
if (!scan_to_ready && !$('#rack_to').val()) {
if (!scan_to_ready && !$('#bin_to').val()) {
bootbox.alert('Scan the to-location label before saving.');
return;
}
@@ -290,19 +290,19 @@
$('#label_zone_to').text('To ' + label_zone);
$('#label_aisle_from').text('From ' + label_aisle);
$('#label_aisle_to').text('To ' + label_aisle);
$('#label_rack_from').text('From ' + label_rack);
$('#label_rack_to').text('To ' + label_rack);
$('#label_bin_from').text('From ' + label_bin);
$('#label_bin_to').text('To ' + label_bin);
// Update select placeholders
$('#zone_from, #zone_to').find('option:first').text('Please select ' + label_zone.toLowerCase());
$('#aisle_from, #aisle_to').find('option:first').text('Please select ' + label_aisle.toLowerCase());
$('#rack_from, #rack_to').find('option:first').text('Please select ' + label_rack.toLowerCase());
$('#bin_from, #bin_to').find('option:first').text('Please select ' + label_bin.toLowerCase());
} else {
$('#group_zone_from, #group_zone_to').hide();
$('#group_aisle_from, #group_aisle_to').hide();
$('#zone_from, #zone_to, #aisle_from, #aisle_to').prop('required', false).removeClass('is-invalid is-valid');
$('#label_rack_from').text('From ' + label_rack);
$('#label_rack_to').text('To ' + label_rack);
$('#rack_from, #rack_to').find('option:first').text('Please select ' + label_rack.toLowerCase());
$('#label_bin_from').text('From ' + label_bin);
$('#label_bin_to').text('To ' + label_bin);
$('#bin_from, #bin_to').find('option:first').text('Please select ' + label_bin.toLowerCase());
}
}
@@ -310,16 +310,16 @@
// ── Submit ────────────────────────────────────────────────────────────────
function manage_stock_transfer() {
var rack_from_val = $('#rack_from').val();
var rack_to_val = $('#rack_to').val();
var bin_from_val = $('#bin_from').val();
var bin_to_val = $('#bin_to').val();
var sku_val = $('#product_sku').attr('secondary') || $('#product_sku').val();
// Simple mode — mirror rack value to zone and aisle before submit
// Simple mode — mirror bin value to zone and aisle before submit
if (!advanced) {
$('#zone_from').val(rack_from_val);
$('#aisle_from').val(rack_from_val);
$('#zone_to').val(rack_to_val);
$('#aisle_to').val(rack_to_val);
$('#zone_from').val(bin_from_val);
$('#aisle_from').val(bin_from_val);
$('#zone_to').val(bin_to_val);
$('#aisle_to').val(bin_to_val);
}
return ajax_request({
@@ -330,12 +330,12 @@
'contact_id': $('#contact').attr('data-id'),
'warehouse_from': $('#warehouse_from').val(),
'warehouse_to': $('#warehouse_to').val(),
'zone_from': advanced ? $('#zone_from').val() : rack_from_val,
'aisle_from': advanced ? $('#aisle_from').val() : rack_from_val,
'rack_from': rack_from_val,
'zone_to': advanced ? $('#zone_to').val() : rack_to_val,
'aisle_to': advanced ? $('#aisle_to').val() : rack_to_val,
'rack_to': rack_to_val,
'zone_from': advanced ? $('#zone_from').val() : bin_from_val,
'aisle_from': advanced ? $('#aisle_from').val() : bin_from_val,
'bin_from': bin_from_val,
'zone_to': advanced ? $('#zone_to').val() : bin_to_val,
'aisle_to': advanced ? $('#aisle_to').val() : bin_to_val,
'bin_to': bin_to_val,
'product_sku': sku_val,
'lot_number': $('#lot_number').val(),
'serial_number': $('#serial_number').val(),
@@ -467,7 +467,7 @@
}
// ── Zone / Aisle / Rack loaders ───────────────────────────────────────────
// ── Zone / Aisle / Bin loaders ───────────────────────────────────────────
function retrieve_zone(type, callback) {
var extra = {
'warehouse_from': $('#warehouse_from').val(),
@@ -532,7 +532,7 @@
});
}
function retrieve_rack(type, callback) {
function retrieve_bin(type, callback) {
var extra = {
'warehouse_from': $('#warehouse_from').val(),
'warehouse_to': $('#warehouse_to').val(),
@@ -549,7 +549,7 @@
});
}
return ajax_request({
url: '<?php echo $server_url?>ics/api/engine/retrieve_rack.php',
url: '<?php echo $server_url?>ics/api/engine/retrieve_bin.php',
autoPrepare: true,
checkRequired: 0,
noLoading: true,
@@ -557,11 +557,11 @@
data: Object.assign({ 'type': type }, extra),
action: 'read',
onSuccess: function(res) {
var option = '<option value="">Please select ' + label_rack.toLowerCase() + '</option>';
var option = '<option value="">Please select ' + label_bin.toLowerCase() + '</option>';
$.each(res.output, function(key, item) {
option += '<option value="' + item + '">' + item + '</option>';
});
$('select[name="rack"][role="' + type + '"]').html(option).prop('disabled', false);
$('select[name="bin"][role="' + type + '"]').html(option).prop('disabled', false);
if (callback) callback();
}
});
@@ -573,7 +573,7 @@
$('#warehouse_from').html('<option value="">Select warehouse...</option>').prop('disabled', true);
$('#zone_from').html('<option value="">Please select ' + label_zone.toLowerCase() + '</option>').prop('disabled', true);
$('#aisle_from').html('<option value="">Please select ' + label_aisle.toLowerCase() + '</option>').prop('disabled', true);
$('#rack_from').html('<option value="">Please select ' + label_rack.toLowerCase() + '</option>').prop('disabled', true);
$('#bin_from').html('<option value="">Please select ' + label_bin.toLowerCase() + '</option>').prop('disabled', true);
}
@@ -616,23 +616,23 @@
$('select[name="zone"][role="from"]').val(data.zone).prop('disabled', true);
retrieve_aisle('from', function() {
$('select[name="aisle"][role="from"]').val(data.aisle).prop('disabled', true);
retrieve_rack('from', function() {
$('select[name="rack"][role="from"]').val(data.rack).prop('disabled', true);
retrieve_bin('from', function() {
$('select[name="bin"][role="from"]').val(data.bin).prop('disabled', true);
populate_to_side(data, to_wh);
});
});
});
} else {
// Simple mode — skip zone/aisle cascade, load rack directly
retrieve_rack('from', function() {
$('select[name="rack"][role="from"]').val(data.rack).prop('disabled', true);
// Simple mode — skip zone/aisle cascade, load bin directly
retrieve_bin('from', function() {
$('select[name="bin"][role="from"]').val(data.bin).prop('disabled', true);
populate_to_side_simple(data, to_wh);
});
}
// Common fields
$.each(data, function(key, item) {
if (!['warehouse', 'zone', 'aisle', 'rack', 'lot_number', 'serial_number', 'ref'].includes(key)) {
if (!['warehouse', 'zone', 'aisle', 'bin', 'lot_number', 'serial_number', 'ref'].includes(key)) {
$('#' + key).val(item);
}
});
@@ -655,16 +655,16 @@
$('select[name="zone"][role="to"]').val(data.ref.zone).prop('disabled', true);
retrieve_aisle('to', function() {
$('select[name="aisle"][role="to"]').val(data.ref.aisle).prop('disabled', true);
retrieve_rack('to', function() {
$('select[name="rack"][role="to"]').val(data.ref.rack).prop('disabled', true);
retrieve_bin('to', function() {
$('select[name="bin"][role="to"]').val(data.ref.bin).prop('disabled', true);
});
});
});
}
function populate_to_side_simple(data, to_wh) {
retrieve_rack('to', function() {
$('select[name="rack"][role="to"]').val(data.ref.rack).prop('disabled', true);
retrieve_bin('to', function() {
$('select[name="bin"][role="to"]').val(data.ref.bin).prop('disabled', true);
});
}
@@ -717,9 +717,9 @@
retrieve_warehouse('from');
});
// From warehouse → zone (advanced) or rack directly (simple)
// From warehouse → zone (advanced) or bin directly (simple)
$('select[name="warehouse"][role="from"]').on('change', function() {
if (advanced) { retrieve_zone('from'); } else { retrieve_rack('from'); }
if (advanced) { retrieve_zone('from'); } else { retrieve_bin('from'); }
});
// From zone → aisle (advanced only)
@@ -727,14 +727,14 @@
if (advanced) retrieve_aisle('from');
});
// From aisle → rack (advanced only)
// From aisle → bin (advanced only)
$('select[name="aisle"][role="from"]').on('change', function() {
if (advanced) retrieve_rack('from');
if (advanced) retrieve_bin('from');
});
// To warehouse → zone (advanced) or rack directly (simple)
// To warehouse → zone (advanced) or bin directly (simple)
$('select[name="warehouse"][role="to"]').on('change', function() {
if (advanced) { retrieve_zone('to'); } else { retrieve_rack('to'); }
if (advanced) { retrieve_zone('to'); } else { retrieve_bin('to'); }
});
// To zone → aisle (advanced only)
@@ -742,9 +742,9 @@
if (advanced) retrieve_aisle('to');
});
// To aisle → rack (advanced only)
// To aisle → bin (advanced only)
$('select[name="aisle"][role="to"]').on('change', function() {
if (advanced) retrieve_rack('to');
if (advanced) retrieve_bin('to');
});
<?php } ?>