update
This commit is contained in:
@ -7,9 +7,8 @@
|
||||
@section('customcss')
|
||||
<style>
|
||||
/* .select2-container {
|
||||
z-index: 99999;
|
||||
} */
|
||||
|
||||
z-index: 99999;
|
||||
} */
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@ -54,8 +53,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" data-bs-backdrop="static" data-bs-keyboard="false" id="mdlNewItem"
|
||||
aria-labelledby="mdlNewItemLabel" aria-hidden="true">
|
||||
<div class="modal fade" data-bs-backdrop="static" data-bs-keyboard="false" id="mdlNewItem" aria-labelledby="mdlNewItemLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -71,23 +69,20 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<label for="add-name" class="col-form-label">Nama<span
|
||||
class="text-danger">*</span></label>
|
||||
<label for="add-name" class="col-form-label">Nama<span class="text-danger">*</span></label>
|
||||
<input type="text" name="add-name" id="add-name" class="form-control">
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<label for="add-type" class="col-form-label">Satuan<span
|
||||
class="text-danger">*</span></label>
|
||||
<select name="add-type" id="add-type" class="form-control" style="width:100%;">
|
||||
<option value="" selected disabled>Belum dipilih</option>
|
||||
@foreach ($unitTypes as $type)
|
||||
<label for="add-type" class="col-form-label">Satuan<span class="text-danger">*</span></label>
|
||||
<select name="add-type" id="add-type" class="form-control" style="width:100%;">
|
||||
<option value="" selected disabled>Belum dipilih</option>
|
||||
@foreach ($unitTypes as $type)
|
||||
<option value="{{ $type->id }}">{{ $type->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<label for="add-price" class="col-form-label">Harga Satuan<span
|
||||
class="text-danger">*</span></label>
|
||||
<div class="col-sm-12">
|
||||
<label for="add-price" class="col-form-label">Harga Satuan<span class="text-danger">*</span></label>
|
||||
<input type="text" name="add-price" id="add-price" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
@ -99,12 +94,10 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<label for="add-status" class="form-label">Status<span
|
||||
class="text-danger">*</span></label>
|
||||
<label for="add-status" class="form-label">Status<span class="text-danger">*</span></label>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" id="add-status">
|
||||
<label class="form-check-label" for="add-status"><span class="text-dark"
|
||||
id="add-txtStatus">Inactive</span></label>
|
||||
<label class="form-check-label" for="add-status"><span class="text-dark" id="add-txtStatus">Inactive</span></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -129,8 +122,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" data-bs-backdrop="static" data-bs-keyboard="false" id="mdlUpdtItem"
|
||||
aria-labelledby="mdlUpdtItemLabel" aria-hidden="true">
|
||||
<div class="modal fade" data-bs-backdrop="static" data-bs-keyboard="false" id="mdlUpdtItem" aria-labelledby="mdlUpdtItemLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -146,23 +138,20 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<label for="updt-name" class="col-form-label">Nama<span
|
||||
class="text-danger">*</span></label>
|
||||
<label for="updt-name" class="col-form-label">Nama<span class="text-danger">*</span></label>
|
||||
<input type="text" name="updt-name" id="updt-name" class="form-control">
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<label for="updt-type" class="col-form-label">Satuan<span
|
||||
class="text-danger">*</span></label>
|
||||
<select name="updt-type" id="updt-type" class="form-control" style="width:100%;">
|
||||
<option value="" selected disabled>Belum dipilih</option>
|
||||
@foreach ($unitTypes as $type)
|
||||
<label for="updt-type" class="col-form-label">Satuan<span class="text-danger">*</span></label>
|
||||
<select name="updt-type" id="updt-type" class="form-control" style="width:100%;">
|
||||
<option value="" selected disabled>Belum dipilih</option>
|
||||
@foreach ($unitTypes as $type)
|
||||
<option value="{{ $type->id }}">{{ $type->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<label for="updt-price" class="col-form-label">Harga Satuan<span
|
||||
class="text-danger">*</span></label>
|
||||
<div class="col-sm-12">
|
||||
<label for="updt-price" class="col-form-label">Harga Satuan<span class="text-danger">*</span></label>
|
||||
<input type="text" name="updt-price" id="updt-price" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
@ -174,12 +163,10 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<label for="updt-status" class="form-label">Status<span
|
||||
class="text-danger">*</span></label>
|
||||
<label for="updt-status" class="form-label">Status<span class="text-danger">*</span></label>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" id="updt-status">
|
||||
<label class="form-check-label" for="updt-status"><span class="text-dark"
|
||||
id="updt-txtStatus">Inactive</span></label>
|
||||
<label class="form-check-label" for="updt-status"><span class="text-dark" id="updt-txtStatus">Inactive</span></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -198,15 +185,14 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" id="btnDelItem_updt" class="btn btn-sm btn-warning">Hapus ?</button>
|
||||
<button type="button" class="btn btn-sm btn-secondary" data-bs-dismiss="modal">Tutup</button>
|
||||
<button type="button" class="btn btn-sm btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button id="btnSubmitUpdtItems" type="button" class="btn btn-sm btn-danger">Ubah data</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" data-bs-backdrop="static" data-bs-keyboard="false" id="mdlDelItem"
|
||||
aria-labelledby="mdlDelItemLabel" aria-hidden="true">
|
||||
<div class="modal fade" data-bs-backdrop="static" data-bs-keyboard="false" id="mdlDelItem" aria-labelledby="mdlDelItemLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered modal-sm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -225,7 +211,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-sm btn-danger" data-bs-dismiss="modal">Tutup</button>
|
||||
<button type="button" class="btn btn-sm btn-danger" data-bs-dismiss="modal">Close</button>
|
||||
<button id="btnSubmitDelItem" type="button" class="btn btn-sm btn-secondary">Iya, hapus</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -272,11 +258,11 @@
|
||||
else
|
||||
$('#updt-txtStatus').html('Inactive')
|
||||
});
|
||||
// fix modal select2
|
||||
$('#add-type').select2({
|
||||
// fix modal select2
|
||||
$('#add-type').select2({
|
||||
dropdownParent: $('#mdlNewItem'),
|
||||
});
|
||||
$('#updt-type').select2({
|
||||
$('#updt-type').select2({
|
||||
dropdownParent: $('#mdlUpdtItem'),
|
||||
});
|
||||
},
|
||||
@ -344,7 +330,7 @@
|
||||
$(td).attr('data-price', rowData.price);
|
||||
},
|
||||
},
|
||||
{
|
||||
{
|
||||
data: 'type_name',
|
||||
className: 'text-end text-nowrap',
|
||||
visible: true,
|
||||
@ -357,7 +343,7 @@
|
||||
visible: true,
|
||||
orderable: true,
|
||||
searchable: true,
|
||||
render: function(data, type, row, meta) {
|
||||
render: function(data, type, row, meta) {
|
||||
return (new Intl.NumberFormat('id-ID')).format(data);
|
||||
},
|
||||
},
|
||||
@ -412,7 +398,7 @@
|
||||
data.status = State.stts_isact.inactive;
|
||||
}
|
||||
|
||||
if($('#add-isAdmPrice').prop('checked')) {
|
||||
if ($('#add-isAdmPrice').prop('checked')) {
|
||||
data.is_adm_price = State.is_adm_price.yes
|
||||
} else {
|
||||
data.is_adm_price = State.is_adm_price.no
|
||||
@ -552,7 +538,7 @@
|
||||
$('#updt-status').prop('checked', false).trigger('change');
|
||||
}
|
||||
|
||||
if(data.is_adm_price == State.is_adm_price.yes) {
|
||||
if (data.is_adm_price == State.is_adm_price.yes) {
|
||||
$('#updt-isAdmPrice').prop('checked', true).trigger('change');
|
||||
} else {
|
||||
$('#updt-isAdmPrice').prop('checked', false).trigger('change');
|
||||
@ -575,7 +561,7 @@
|
||||
data.status = State.stts_isact.inactive;
|
||||
}
|
||||
|
||||
if($('#updt-isAdmPrice').prop('checked')) {
|
||||
if ($('#updt-isAdmPrice').prop('checked')) {
|
||||
data.is_adm_price = State.is_adm_price.yes
|
||||
} else {
|
||||
data.is_adm_price = State.is_adm_price.no
|
||||
@ -648,8 +634,8 @@
|
||||
let price = row.find('td[data-price]').data('price');
|
||||
ADel.passDataToView({
|
||||
id,
|
||||
name,
|
||||
price,
|
||||
name,
|
||||
price,
|
||||
});
|
||||
$('#mdlDelItem').data('id', id);
|
||||
$('#mdlDelItem').modal('show');
|
||||
@ -662,11 +648,15 @@
|
||||
});
|
||||
// on modal update
|
||||
$('#btnDelItem_updt').on('click', function(e) {
|
||||
const { id, name, price } = AUpdt.getData();
|
||||
const {
|
||||
id,
|
||||
name,
|
||||
price
|
||||
} = AUpdt.getData();
|
||||
ADel.passDataToView({
|
||||
id,
|
||||
name,
|
||||
price,
|
||||
price,
|
||||
});
|
||||
$('#mdlDelItem').data('id', id);
|
||||
$('#mdlDelItem').modal('show');
|
||||
|
||||
Reference in New Issue
Block a user