Update besar apk finance
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<!--Lokasi nya : /views/employees/employees.php-->
|
||||
<?php $inventory_title='Jenis / Kode Barang';$inventory_subtitle='Atur identitas, satuan, cara tracking, serial, dan pembentukan harga beli.';$this->load->view('inventory_professional/_module_nav',get_defined_vars());?>
|
||||
<div class="container mt-4">
|
||||
<div class="card modern-card shadow-sm border-0 rounded-4">
|
||||
<div class="card-body p-4">
|
||||
|
||||
<div class="d-flex justify-content-between mb-3">
|
||||
<h5>Kode Barang</h5>
|
||||
<button class="btn btn-warning btn-add">Tambah</button>
|
||||
<div><h5 class="mb-1">Jenis / Kode Barang</h5><small class="text-muted">Master yang sudah digunakan dinonaktifkan, bukan dihapus.</small></div>
|
||||
<?php if($this->session->userdata('role')==='Admin'||check_permission('items','can_create')):?><button class="btn btn-primary btn-add"><i class="bi bi-plus-lg"></i> Tambah</button><?php endif?>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
@@ -16,9 +16,11 @@
|
||||
<th>Kode</th>
|
||||
<th>Nama</th>
|
||||
<th>Limit Stok</th>
|
||||
<th>Tracking Type</th>
|
||||
<th>Need Serial</th>
|
||||
<th>Tracking</th>
|
||||
<th>Perlu Serial</th>
|
||||
<th>Biaya ke Harga Beli</th>
|
||||
<th>Unit</th>
|
||||
<th>Status</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -64,6 +66,12 @@
|
||||
<option value="true">Ya</option>
|
||||
</select>
|
||||
|
||||
<div class="form-check mt-3 py-3 border rounded bg-light" style="padding-left: 30px">
|
||||
<input class="form-check-input" type="checkbox" id="allocate_purchase_cost" value="1">
|
||||
<label class="form-check-label fw-semibold" for="allocate_purchase_cost">Masukkan biaya pembelian ke harga beli satuan</label>
|
||||
<small class="d-block text-muted">Ongkir, asuransi, dan layanan bersih dari diskon/cashback dialokasikan per unit saat penerimaan.</small>
|
||||
</div>
|
||||
|
||||
<label class="mt-2">Unit</label>
|
||||
<select id="unit" class="form-control">
|
||||
<option value="PCS">PCS</option>
|
||||
@@ -71,6 +79,11 @@
|
||||
<option value="Lembar">Lembar</option>
|
||||
</select>
|
||||
|
||||
<div class="form-check form-switch mt-3">
|
||||
<input class="form-check-input" type="checkbox" id="is_active" checked>
|
||||
<label class="form-check-label" for="is_active">Aktif dan dapat dipilih pada transaksi baru</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
@@ -101,7 +114,9 @@ $(function(){
|
||||
$('#limit_stock').val('');
|
||||
$('#tracking_type').val('UNIT');
|
||||
$('#need_serial_number').val('false');
|
||||
$('#allocate_purchase_cost').prop('checked',false);
|
||||
$('#unit').val('PCS');
|
||||
$('#is_active').prop('checked',true);
|
||||
}
|
||||
|
||||
// ADD
|
||||
@@ -123,7 +138,9 @@ $(function(){
|
||||
$('#limit_stock').val(res.limit_stock);
|
||||
$('#tracking_type').val((res.tracking_type || 'UNIT').toUpperCase());
|
||||
$('#need_serial_number').val((res.need_serial_number || 'false').toLowerCase());
|
||||
$('#allocate_purchase_cost').prop('checked', Number(res.allocate_purchase_cost || 0) === 1);
|
||||
$('#unit').val(res.unit || 'PCS');
|
||||
$('#is_active').prop('checked',Number(res.is_active || 0) === 1);
|
||||
|
||||
action = 'edit';
|
||||
$('#modalKodebarang').modal('show');
|
||||
@@ -141,9 +158,13 @@ $(function(){
|
||||
limit_stock: $('#limit_stock').val(),
|
||||
tracking_type: $('#tracking_type').val(),
|
||||
need_serial_number: $('#need_serial_number').val(),
|
||||
unit: $('#unit').val()
|
||||
allocate_purchase_cost: $('#allocate_purchase_cost').is(':checked') ? 1 : 0,
|
||||
unit: $('#unit').val(),
|
||||
is_active: $('#is_active').is(':checked') ? 1 : 0
|
||||
};
|
||||
|
||||
if(window.APP_CSRF) data[APP_CSRF.name]=APP_CSRF.value;
|
||||
|
||||
if(!data.kode || !data.nama){
|
||||
Swal.fire('Warning','Kode dan nama barang wajib diisi','warning');
|
||||
return;
|
||||
@@ -171,34 +192,5 @@ $(function(){
|
||||
},'json');
|
||||
});
|
||||
|
||||
// DELETE
|
||||
$(document).on('click','.btn-delete',function(){
|
||||
|
||||
let id = $(this).data('id');
|
||||
|
||||
Swal.fire({
|
||||
title:'Hapus kode barang?',
|
||||
text:'Pastikan tidak dipakai item',
|
||||
icon:'warning',
|
||||
showCancelButton:true
|
||||
}).then(r=>{
|
||||
if(r.isConfirmed){
|
||||
|
||||
$.get("<?= base_url('kodebarang/delete/'); ?>"+id,function(res){
|
||||
|
||||
if(res.status){
|
||||
table.ajax.reload(null,false);
|
||||
Swal.fire('Sukses',res.message,'success');
|
||||
} else {
|
||||
Swal.fire('Error',res.message,'error');
|
||||
}
|
||||
|
||||
},'json');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user