Barcode Scan + Barcode Print

This commit is contained in:
Wian Drs
2026-06-30 11:16:31 +07:00
parent be5a02150e
commit 3ac6316da4
226 changed files with 1564 additions and 107 deletions
+57 -7
View File
@@ -89,7 +89,7 @@
<!-- MODAL (TIDAK DIUBAH STYLE) -->
<div class="modal fade" id="modalItem">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
<div class="modal-header bg-warning text-white">
<h5 class="modal-title" id="modalTitle">Item Invoice</h5>
@@ -98,9 +98,6 @@
<div class="modal-body">
<input type="hidden" id="item_id">
<div id="item_mode_label" class="alert alert-secondary py-1 small mb-3">
Mode: Manual Input
</div>
<div class="mb-2">
<label for="account_id" class="form-label">Tujuan Neraca (Account)</label>
@@ -124,7 +121,12 @@
<select id="item_select" class="form-control select-search"></select>
</div>
<div class="mb-2">
<div class="mb-2 d-none" id="wrap_barcode_select">
<label for="barcode_select" class="form-label">Barcode ID</label>
<select id="barcode_select" class="form-control select-search"></select>
</div>
<div class="mb-2" id="wrap_qty_item">
<label for="qty" class="form-label">Qty</label>
<input type="number" id="qty" class="form-control" min="0">
</div>
@@ -225,9 +227,11 @@ $(function(){
// ================= RESET UI =================
function resetForm(){
// $('#form_scan_barang').addClass('d-none');
$('#wrap_warehouse').addClass('d-none');
$('#wrap_item_select').addClass('d-none');
$('#wrap_nama_item').removeClass('d-none');
$('#wrap_qty_item').removeClass('d-none');
$('#warehouse_id').html('<option value="">Pilih Gudang</option>');
$('#item_select').html('<option value="">Pilih Item</option>');
@@ -270,12 +274,15 @@ $(function(){
$.get("<?= base_url('invoices/check_items_by_account/'); ?>" + account_id, function(res){
if(res.has_item){
// $('#form_scan_barang').removeClass('d-none');
$('#wrap_warehouse').removeClass('d-none');
$('#wrap_nama_item').addClass('d-none');
$('#wrap_qty_item').addClass('d-none');
loadWarehouse();
setMode('warehouse');
} else {
$('#wrap_nama_item').removeClass('d-none');
$('#wrap_qty_item').removeClass('d-none');
setMode('manual');
}
}, 'json').fail(function(){
@@ -305,6 +312,7 @@ $(function(){
if(!warehouse_id){
$('#wrap_nama_item').removeClass('d-none');
$('#wrap_qty_item').removeClass('d-none');
setMode('manual');
return;
}
@@ -328,10 +336,53 @@ $(function(){
$('#item_select').html(opt);
$('#wrap_item_select').removeClass('d-none');
$('#wrap_nama_item').addClass('d-none');
$('#wrap_qty_item').addClass('d-none');
setMode('item');
} else {
$('#wrap_item_select').addClass('d-none');
$('#wrap_nama_item').removeClass('d-none');
$('#wrap_qty_item').removeClass('d-none');
setMode('manual');
}
}, 'json');
}
$('#item_select').on('change', function(){
let item_id = $(this).val();
$('#wrap_barcode_select').addClass('d-none');
$('#barcode_select').html('<option value="">Loading...</option>');
if(!item_id){
$('#wrap_barcode_select').removeClass('d-none');
setMode('manual');
return;
}
loadItemBarcodes(item_id);
});
// ================= LOAD BARCODE ITEMS =================
function loadItemBarcodes(item_id){
return $.get("<?= base_url('items/get_list_barcode_id/'); ?>" + item_id, function(res){
if(res && res.length){
let opt = '<option value="">Pilih Item</option>';
res.forEach(i=>{
opt += `<option value="${i.barcode_id}">
${i.nama_barang} - ${i.barcode} - ${i.serial_number}
</option>`;
});
$('#barcode_select').html(opt);
$('#wrap_barcode_select').removeClass('d-none');
// set QTY jadi 1
let qty = Number($('#qty').val());
$('#qty').val(qty + 1);
setMode('item');
} else {
$('#wrap_barcode_select').addClass('d-none');
// $('#wrap_barcode_select').removeClass('d-none');
setMode('manual');
}
}, 'json');
@@ -1159,6 +1210,5 @@ $(function(){
$(`tr[data-group="${group}"]`).removeClass('table-secondary');
$(this).addClass('table-secondary');
});
</script>