update detail jaminan
This commit is contained in:
parent
67b34dac43
commit
d049739b64
@ -27,7 +27,7 @@
|
||||
$search = request()->get('search');
|
||||
$query->where('nomor_pinjaman', 'like', "%" . $search['value'] . "%");
|
||||
}
|
||||
})->addColumn('jenis_jaminan', function ($row) {
|
||||
})->addIndexColumn()->addColumn('jenis_jaminan', function ($row) {
|
||||
$guarantee = GuaranteeType::where('id', $row->guarantee_type_id)->first();
|
||||
if ($guarantee)
|
||||
return $guarantee->kode . ' - ' . $guarantee->name;
|
||||
@ -65,7 +65,8 @@
|
||||
'scrollX' => false,
|
||||
'drawCallback' => 'function() { KTMenu.createInstances(); }',
|
||||
])
|
||||
->addTableClass('align-middle table-row-dashed fs-6 gy-5');
|
||||
->addTableClass('align-middle table-row-dashed fs-6 gy-5')
|
||||
->drawCallback("function() {" . file_get_contents(Module::getModulePath('writeoff').'Resources/views/pencatatan/detail_jaminan/_draw-scripts.js') . "}");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8,7 +8,9 @@
|
||||
class DetailJaminan extends BaseModel
|
||||
{
|
||||
protected $table = 'detail_jaminan';
|
||||
|
||||
protected $fillable = [
|
||||
'id_detail_jaminan',
|
||||
'nomor_pinjaman',
|
||||
'guarantee_type_id',
|
||||
'nomor_jaminan',
|
||||
|
@ -7,6 +7,7 @@
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Modules\Writeoff\DataTables\BranchDataTable;
|
||||
use Modules\Writeoff\DataTables\DetailJaminanDataTable;
|
||||
use Modules\Writeoff\Entities\Branch;
|
||||
use Modules\Writeoff\Entities\DetailJaminan;
|
||||
use Modules\Writeoff\Entities\HapusBuku;
|
||||
|
||||
@ -45,7 +46,8 @@
|
||||
|
||||
$hapusbuku = HapusBuku::where('nomor_pinjaman', $nomor_pinjaman)->first();
|
||||
if($hapusbuku){
|
||||
return $dataTable->render('writeoff::pencatatan.detail_jaminan.show', compact('hapusbuku'));
|
||||
$cabang = Branch::where('kode', $hapusbuku->kode_cabang)->first();
|
||||
return $dataTable->render('writeoff::pencatatan.detail_jaminan.show', compact('hapusbuku', 'cabang'));
|
||||
} else {
|
||||
return redirect()->route('pencatatan.detail_jaminan.index')->with('error', 'Nomor Pinjaman tidak ditemukan.');
|
||||
}
|
||||
|
@ -28,11 +28,12 @@
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'nomor_pinjaman' => 'required',
|
||||
'id_detail_jaminan' => 'nullable',
|
||||
'nomor_pinjaman' => 'nullable',
|
||||
'guarantee_type_id' => 'required',
|
||||
'nomor_jaminan' => 'required',
|
||||
'nilai_jaminan' => 'required|numeric',
|
||||
'status' => 'required|boolean',
|
||||
'nomor_jaminan' => 'nullable',
|
||||
'nilai_jaminan' => 'nullable|numeric',
|
||||
'status' => 'nullable|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
@ -40,4 +41,11 @@
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'id_detail_jaminan' => round(microtime(true) * 100)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,6 @@
|
||||
protected function prepareForValidation()
|
||||
: void
|
||||
{
|
||||
|
||||
$this->merge([
|
||||
'status' => $this->status=='on' ? 1 : 0,
|
||||
]);
|
||||
|
@ -2,23 +2,31 @@
|
||||
|
||||
namespace Modules\Writeoff\Livewire\DetailJaminan;
|
||||
|
||||
use Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Livewire\Component;
|
||||
use Modules\Writeoff\Entities\Branch;
|
||||
use Modules\Writeoff\Entities\DetailJaminan;
|
||||
use Modules\Writeoff\Entities\GuaranteeType;
|
||||
use Modules\Writeoff\Entities\HapusBuku;
|
||||
use Modules\Writeoff\Http\Requests\DetailJaminan\StoreDetailJaminanRequest;
|
||||
|
||||
class DetailJaminanModal extends Component
|
||||
{
|
||||
public $id;
|
||||
public $id_detail_jaminan;
|
||||
public $nomor_pinjaman;
|
||||
public $guarantee_type_id;
|
||||
public $nomor_jaminan;
|
||||
public $nilai_jaminan;
|
||||
public $pinjaman;
|
||||
public $status;
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('writeoff::livewire.detail-jaminan.detail-jaminan-modal');
|
||||
$this->pinjaman = request()->segment(3);
|
||||
$this->nomor_pinjaman = $this->pinjaman;
|
||||
$guarantee_types = GuaranteeType::all();
|
||||
return view('writeoff::livewire.detail-jaminan.detail-jaminan-modal', compact('guarantee_types'));
|
||||
}
|
||||
|
||||
public function submit()
|
||||
@ -29,6 +37,7 @@
|
||||
DB::transaction(function () {
|
||||
// Prepare the data for creating a new user
|
||||
$data = [
|
||||
'id_detail_jaminan' => round(microtime(true) * 100),
|
||||
'nomor_pinjaman' => $this->nomor_pinjaman,
|
||||
'guarantee_type_id' => $this->guarantee_type_id,
|
||||
'nomor_jaminan' => $this->nomor_jaminan,
|
||||
@ -36,8 +45,8 @@
|
||||
'status' => $this->status,
|
||||
];
|
||||
|
||||
Branch::create($data);
|
||||
$this->dispatch('success', __('Data jamina berhasil ditambahkan'));
|
||||
DetailJaminan::create($data);
|
||||
$this->dispatch('success', __('Data Detail Jaminan berhasil ditambahkan'));
|
||||
});
|
||||
|
||||
// Reset the form fields after successful submission
|
||||
|
@ -1,12 +1,12 @@
|
||||
<div class="modal fade" id="kt_modal_add_facility_type" tabindex="-1" aria-hidden="true" wire:ignore.self>
|
||||
<div class="modal fade" id="kt_modal_add_detail_jaminan" tabindex="-1" aria-hidden="true" wire:ignore.self>
|
||||
<!--begin::Modal dialog-->
|
||||
<div class="modal-dialog modal-dialog-centered mw-650px">
|
||||
<!--begin::Modal content-->
|
||||
<div class="modal-content">
|
||||
<!--begin::Modal header-->
|
||||
<div class="modal-header" id="kt_modal_add_facility_type_header">
|
||||
<div class="modal-header" id="kt_modal_add_detail_jaminan_header">
|
||||
<!--begin::Modal title-->
|
||||
<h2 class="fw-bold">Add Jenis Fasilitas</h2>
|
||||
<h2 class="fw-bold">Add Detail Jaminan</h2>
|
||||
<!--end::Modal title-->
|
||||
<!--begin::Close-->
|
||||
<div class="btn btn-icon btn-sm btn-active-icon-primary" data-bs-dismiss="modal" aria-label="Close">
|
||||
@ -18,41 +18,69 @@
|
||||
<!--begin::Modal body-->
|
||||
<div class="modal-body px-5 my-7">
|
||||
<!--begin::Form-->
|
||||
<form id="kt_modal_add_facility_type_form" class="form" action="#" wire:submit.prevent="submit">
|
||||
<form id="kt_modal_add_detail_jaminan" class="form" action="#" wire:submit.prevent="submit">
|
||||
<!--begin::Scroll-->
|
||||
<div class="d-flex flex-column scroll-y px-5 px-lg-10" id="kt_modal_add_facility_type_scroll" data-kt-scroll="true" data-kt-scroll-activate="true" data-kt-scroll-max-height="auto" data-kt-scroll-dependencies="#kt_modal_add_facility_type_header" data-kt-scroll-wrappers="#kt_modal_add_facility_type_scroll" data-kt-scroll-offset="300px">
|
||||
|
||||
<div class="d-flex flex-column scroll-y px-5 px-lg-10" id="kt_modal_add_detail_jaminan_scroll" data-kt-scroll="true" data-kt-scroll-activate="true" data-kt-scroll-max-height="auto" data-kt-scroll-dependencies="#kt_modal_add_detail_jaminan_header" data-kt-scroll-wrappers="#kt_modal_add_detail_jaminan_scroll" data-kt-scroll-offset="300px">
|
||||
<!--begin::Input group-->
|
||||
<div class="fv-row mb-7">
|
||||
<!--begin::Label-->
|
||||
<label class="required fw-semibold fs-6 mb-2">Kode Jenis Fasilitas</label>
|
||||
<label class="required fw-semibold fs-6 mb-2">Jenis Jaminan</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<input type="text" wire:model.defer="kode" name="kode" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Kode Jenis Fasilitas"/>
|
||||
<input type="text" name="nomor_pinjaman" id="nomor_pinjaman" value="{{ request()->segment(3) }}">
|
||||
<select wire:model.defer="guarantee_type_id" data-dropdown-parent="#kt_modal_add_detail_jaminan" data-placeholder="Pilih Detail Jaminan" name="guarantee_type_id" class="form-select form-select-solid mb-3 mb-lg-0">
|
||||
<option></option>
|
||||
@foreach($guarantee_types as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->kode }} - {{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<!--end::Input-->
|
||||
@error('kode')
|
||||
@error('guarantee_type_id')
|
||||
<span class="text-danger">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
<!--end::Input group-->
|
||||
<!--begin::Input group-->
|
||||
<div class="fv-row mb-7">
|
||||
<!--begin::Label-->
|
||||
<label class="required fw-semibold fs-6 mb-2">Nama Jenis Fasilitas</label>
|
||||
<label class="required fw-semibold fs-6 mb-2">Nomor Jaminan</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<input type="text" wire:model.defer="name" name="name" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Nama Jenis Fasilitas"/>
|
||||
<input type="text" wire:model.defer="nomor_jaminan" name="nomor_jaminan" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Nomor Jaminan"/>
|
||||
<!--end::Input-->
|
||||
@error('name')
|
||||
@error('nomor_jaminan')
|
||||
<span class="text-danger">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
<!--end::Input group-->
|
||||
<!--begin::Input group-->
|
||||
<div class="fv-row mb-7">
|
||||
<!--begin::Label-->
|
||||
<label class="required fw-semibold fs-6 mb-2">Nilai Jaminan</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<input type="text" data-inputmask="'alias': 'currency'" wire:model.defer="nilai_jaminan" name="nilai_jaminan" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Nilai Jaminan"/>
|
||||
<!--end::Input-->
|
||||
@error('nilai_jaminan')
|
||||
<span class="text-danger">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
<!--end::Input group-->
|
||||
<div class="fv-row mb-7">
|
||||
<label class="fw-semibold fs-6 mb-2">Status Data</label>
|
||||
<div class="form-check form-switch form-check-custom form-check-solid" style="display: block!important;">
|
||||
<input class="form-check-input h-20px w-30px me-5" type="checkbox" wire:model.defer="status" id="status" name="status"/>
|
||||
<label class="form-check-label" for="status">
|
||||
Aktif
|
||||
</label>
|
||||
@error('status')
|
||||
<span class="text-danger">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--end::Scroll-->
|
||||
<!--begin::Actions-->
|
||||
<div class="text-center pt-15">
|
||||
<button type="reset" class="btn btn-light me-3" data-bs-dismiss="modal" aria-label="Close" wire:loading.attr="disabled">Discard</button>
|
||||
<button type="submit" class="btn btn-primary" data-kt-facility_typees-modal-action="submit">
|
||||
<button type="submit" class="btn btn-primary" data-kt-detail_jaminan-modal-action="submit">
|
||||
<span class="indicator-label" wire:loading.remove>Submit</span>
|
||||
<span class="indicator-progress" wire:loading wire:target="submit">
|
||||
Please wait...
|
||||
|
@ -143,7 +143,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
|
||||
<label class="fw-semibold fs-6 mb-2">Status Data</label>
|
||||
<div class="form-check form-switch form-check-custom form-check-solid" style="display: block!important;">
|
||||
<input class="form-check-input h-20px w-30px me-5" type="checkbox" wire:model.defer="status" id="status" name="status"/>
|
||||
|
37
Resources/views/pencatatan/detail_jaminan/_draw-scripts.js
Normal file
37
Resources/views/pencatatan/detail_jaminan/_draw-scripts.js
Normal file
@ -0,0 +1,37 @@
|
||||
// Initialize KTMenu
|
||||
KTMenu.init();
|
||||
|
||||
// Add click event listener to delete buttons
|
||||
document.querySelectorAll('[data-kt-action="delete_row"]').forEach(function (element) {
|
||||
element.addEventListener('click', function () {
|
||||
Swal.fire({
|
||||
text: 'Are you sure you want to remove?',
|
||||
icon: 'warning',
|
||||
buttonsStyling: false,
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Yes',
|
||||
cancelButtonText: 'No',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-danger',
|
||||
cancelButton: 'btn btn-secondary',
|
||||
}
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
Livewire.dispatch('delete', { id : this.getAttribute('data-kt-id') });
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Add click event listener to update buttons
|
||||
document.querySelectorAll('[data-kt-action="update_row"]').forEach(function (element) {
|
||||
element.addEventListener('click', function () {
|
||||
Livewire.dispatch('update', { id : this.getAttribute('data-kt-id') });
|
||||
});
|
||||
});
|
||||
|
||||
// Listen for 'success' event emitted by Livewire
|
||||
Livewire.on('success', (message) => {
|
||||
// Reload the users-table datatable
|
||||
LaravelDataTables['detail_jaminan-table'].ajax.reload();
|
||||
});
|
@ -8,8 +8,7 @@
|
||||
{{ Breadcrumbs::render('detail.jaminan') }}
|
||||
@endsection
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card">
|
||||
<!--begin::Card header-->
|
||||
<div class="card-header border-0 pt-6">
|
||||
<!--begin::Card title-->
|
||||
@ -17,38 +16,28 @@
|
||||
<div class="d-flex flex-column px-5 px-lg-10">
|
||||
<!--begin::Input group-->
|
||||
<div class="fv-row mb-7">
|
||||
<label class="required fw-semibold fs-6 mb-2">Nomor Pinjaman</label>
|
||||
<label class="fw-semibold fs-6 mb-2">Nomor Pinjaman</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<input type="number" id="mySearchInput" name="nomor_pinjaman" data-kt-hapus_buku-table-filter="search" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Nomor Pinjaman"/>
|
||||
<!--end::Input-->
|
||||
@error('nomor_pinjaman')
|
||||
<span class="text-danger">{{ $message }}</span> @enderror
|
||||
<br>
|
||||
<!--end::Label-->
|
||||
{{ $hapusbuku->nomor_pinjaman}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex flex-column px-5 px-lg-10">
|
||||
<!--begin::Input group-->
|
||||
<div class="fv-row mb-7">
|
||||
<label class="required fw-semibold fs-6 mb-2">Debitur</label>
|
||||
<label class="fw-semibold fs-6 mb-2">Debitur</label><br>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<input type="number" id="mySearchInput" name="nomor_pinjaman" data-kt-hapus_buku-table-filter="search" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Nomor Pinjaman"/>
|
||||
<!--end::Input-->
|
||||
@error('nomor_pinjaman')
|
||||
<span class="text-danger">{{ $message }}</span> @enderror
|
||||
{{ $hapusbuku->kode_debitur.'/'.$hapusbuku->nama_debitur }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-column px-5 px-lg-10">
|
||||
<!--begin::Input group-->
|
||||
<div class="fv-row mb-7">
|
||||
<label class="required fw-semibold fs-6 mb-2">Cabang</label>
|
||||
<label class="fw-semibold fs-6 mb-2">Cabang</label><br>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<input type="number" id="mySearchInput" name="nomor_pinjaman" data-kt-hapus_buku-table-filter="search" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Nomor Pinjaman"/>
|
||||
<!--end::Input-->
|
||||
@error('nomor_pinjaman')
|
||||
<span class="text-danger">{{ $message }}</span> @enderror
|
||||
{{ $hapusbuku->kode_cabang.'/'.$cabang->name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -59,9 +48,9 @@
|
||||
<!--begin::Toolbar-->
|
||||
<div class="d-flex justify-content-end" data-kt-hapus_buku-table-toolbar="base">
|
||||
<!--begin::Add hapus_buku-->
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#kt_modal_nomor_pinjaman">
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#kt_modal_add_detail_jaminan">
|
||||
{!! getIcon('plus', 'fs-2', '', 'i') !!}
|
||||
Add Hapus Buku
|
||||
Add Detail Jaminan
|
||||
</button>
|
||||
<!--end::Add hapus_buku-->
|
||||
</div>
|
||||
@ -88,12 +77,9 @@
|
||||
@push('scripts')
|
||||
{{ $dataTable->scripts() }}
|
||||
<script>
|
||||
document.getElementById('mySearchInput').addEventListener('keyup', function () {
|
||||
window.LaravelDataTables['detail-jaminan-table'].search(this.value).draw();
|
||||
});
|
||||
document.addEventListener('livewire:initialized', function () {
|
||||
Livewire.on('success', function () {
|
||||
$('#kt_modal_detail_jaminan').modal('hide');
|
||||
$('#kt_modal_add_detail_jaminan').modal('hide');
|
||||
window.LaravelDataTables['detail-jaminan-table'].ajax.reload();
|
||||
});
|
||||
});
|
||||
@ -107,9 +93,9 @@
|
||||
});
|
||||
|
||||
$(function () {
|
||||
window.LaravelDataTables['hapus-buku-table'].search({{$hapusbuku->nomor_pinjaman}}).draw();
|
||||
$('#kt_modal_detail_jaminan').on('hidden.bs.modal', function () {
|
||||
$('#kt_modal_add_detail_jaminan').on('hidden.bs.modal', function () {
|
||||
$(this).find('form').trigger('reset');
|
||||
$("#nomor_pinjaman").val("{{ request()->segment(3) }}");
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
@ -78,6 +78,7 @@
|
||||
$(function(){
|
||||
$('#kt_modal_add_subrogasi_jamkrindo').on('hidden.bs.modal', function () {
|
||||
$(this).find('form').trigger('reset');
|
||||
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user