diff --git a/htdocs/app/Http/Controllers/GudangController.php b/htdocs/app/Http/Controllers/GudangController.php
index b4a3cc02..ac62cbae 100644
--- a/htdocs/app/Http/Controllers/GudangController.php
+++ b/htdocs/app/Http/Controllers/GudangController.php
@@ -64,6 +64,7 @@ class GudangController extends Controller
$tasks['stat_perjenis_bulanan'] = $this->getUsagePerJenis('bulanan');
$tasks['stat_perjenis_tahunan'] = $this->getUsagePerJenis('tahunan');
$tasks['warningstok'] = $this->getLowStockWarnings();
+ $tasks['jenisRows'] = $this->getJenisRows();
return view('admin.gudang', $tasks);
}
}
@@ -654,4 +655,27 @@ class GudangController extends Controller
return array_values($grouped);
}
+
+ private function getJenisRows()
+ {
+ $rows = [];
+ $items = SIMBHPJenis::orderBy('jenis', 'ASC')->get();
+ foreach ($items as $item) {
+ $saldoBase = $this->getStockBaseByJenis($item->jenis);
+ $konversi = (int) ($item->konversi_kecil ?? 1);
+ if ($konversi <= 0) { $konversi = 1; }
+ $rows[] = [
+ 'id' => $item->id,
+ 'jenis' => $item->jenis,
+ 'satuan' => $item->satuan,
+ 'satuan_kecil' => $item->satuan_kecil ?? '',
+ 'konversi_kecil' => $konversi,
+ 'stok_minimum' => (int) ($item->stok_minimum ?? 0),
+ 'saldo' => $this->formatStockDisplay($saldoBase, $item->satuan, $item->satuan_kecil ?? '', $konversi),
+ 'warning' => ($saldoBase <= (int) ($item->stok_minimum ?? 0)) ? 'YA' : 'TIDAK',
+ ];
+ }
+
+ return $rows;
+ }
}
diff --git a/htdocs/resources/views/admin/gudang.blade.php b/htdocs/resources/views/admin/gudang.blade.php
index 75451726..d78da8e1 100644
--- a/htdocs/resources/views/admin/gudang.blade.php
+++ b/htdocs/resources/views/admin/gudang.blade.php
@@ -125,12 +125,50 @@
Tambah Jenis
-
@@ -495,11 +533,29 @@ $(document).ready(function() {
$('#out_pos').on('change', function(){ syncOutSatuanMode(); });
syncOutSatuanMode();
- $("#topbtntambahjenis").click(function(){ $("#modaltambahjenisbrg").modal('show'); $("#jenis_idne").val('new'); });
+ $("#topbtntambahjenis").click(function(){
+ $("#jenis_idne").val('new');
+ $("#jenis_deskripsi").val('');
+ $("#jenis_satuan").val('');
+ $("#jenis_satuan_kecil").val('');
+ $("#jenis_konversi_kecil").val('1');
+ $("#jenis_stok_minimum").val('0');
+ $("#modaltambahjenisbrg").modal('show');
+ });
$("#topbtnpemasukan").click(function(){ $("#modalpemasukan").modal('show'); });
$("#topbtnpengeluaran").click(function(){ $("#modalpengeluaran").modal('show'); });
$("#topbtnwarning").click(function(e){ e.preventDefault(); $('a[href="#tab_warning"]').tab('show'); });
$("#topbtnhapus").click(function(){ $("#modaleditor").modal('show'); $("#edit_id").val('delete'); });
+ $(document).on('click', '.btneditjenis', function(){
+ $("#jenis_idne").val($(this).data('id'));
+ $("#jenis_deskripsi").val($(this).data('jenis'));
+ $("#jenis_satuan").val($(this).data('satuan'));
+ $("#jenis_satuan_kecil").val($(this).data('satuan-kecil'));
+ $("#jenis_konversi_kecil").val($(this).data('konversi-kecil'));
+ $("#jenis_stok_minimum").val($(this).data('stok-minimum'));
+ $("#modaltambahjenisbrg").modal('show');
+ });
+ $('#gridjenisTable').DataTable();
$("#btnsimpanjenis").click(function(){
var val01=document.getElementById('jenis_idne').value;
@@ -559,10 +615,7 @@ $(document).ready(function() {
stack: 1
});
openedpage();
- $("#gridjenis").jqxGrid('updatebounddata', 'filter');
- $("#gridjenis").on('bindingcomplete', function (event) {
- $("#gridjenis").jqxGrid('sortby', 'tlsjenis', 'asc');
- });
+ setTimeout(function(){ location.reload(); }, 1000);
return false;
});
});
@@ -593,10 +646,7 @@ $(document).ready(function() {
stack: 1
});
openedpage();
- $("#gridjenis").jqxGrid('updatebounddata', 'filter');
- $("#gridjenis").on('bindingcomplete', function (event) {
- $("#gridjenis").jqxGrid('sortby', 'tlsjenis', 'asc');
- });
+ setTimeout(function(){ location.reload(); }, 1000);
return false;
});
});
@@ -627,10 +677,7 @@ $(document).ready(function() {
stack: 1
});
openedpage();
- $("#gridjenis").jqxGrid('updatebounddata', 'filter');
- $("#gridjenis").on('bindingcomplete', function (event) {
- $("#gridjenis").jqxGrid('sortby', 'tlsjenis', 'asc');
- });
+ setTimeout(function(){ location.reload(); }, 1000);
return false;
});
});
@@ -661,10 +708,7 @@ $(document).ready(function() {
stack: 1
});
openedpage();
- $("#gridjenis").jqxGrid('updatebounddata', 'filter');
- $("#gridjenis").on('bindingcomplete', function (event) {
- $("#gridjenis").jqxGrid('sortby', 'tlsjenis', 'asc');
- });
+ setTimeout(function(){ location.reload(); }, 1000);
return false;
});
});
@@ -673,38 +717,6 @@ $(document).ready(function() {
});
$("#in_total").autoNumeric( 'init', {aSep: ',', mDec: '0', vMax: '99999999999999999999999999'} );
$("#out_total").autoNumeric( 'init', {aSep: ',', mDec: '0', vMax: '99999999999999999999999999'} );
- var sourcerekap = {
- datatype: "json",
- datafields: [
- { name: 'id',type: 'text'},
- { name: 'tlsjenis',type: 'text'},
- { name: 'jenis',type: 'text'},
- { name: 'saldo',type: 'text'},
- { name: 'satuan',type: 'text'},
- { name: 'warning',type: 'text'},
- ],
- url: 'simbhp/rekapbhp',
- cache: false,
- };
- var datasaldo = new $.jqx.dataAdapter(sourcerekap);
- $("#gridjenis").jqxGrid({
- width : '100%',
- columnsresize : true,
- pageable : false,
- sortable : true,
- autoheight : true,
- theme : "energyblue",
- source : datasaldo,
- columns : [
- { text: 'Jenis', datafield: 'tlsjenis', width: '45%', cellsalign: 'left', align: 'center' },
- { text: 'Satuan', datafield: 'satuan', width: '20%', cellsalign: 'center', align: 'center' },
- { text: 'Sisa', datafield: 'saldo', width: '25%', cellsalign: 'right', align: 'center' },
- { text: 'Warning', datafield: 'warning', width: '10%', cellsalign: 'center', align: 'center' },
- ],
- });
- $("#gridjenis").on('bindingcomplete', function (event) {
- $("#gridjenis").jqxGrid('sortby', 'tlsjenis', 'asc');
- });
$('#export').click(function(){
var gridContent = $("#gridreportblnini").jqxGrid('exportdata', 'json');
data = $.parseJSON(gridContent);