update automate get data pinjaman dan rekening
This commit is contained in:
parent
2af1fab695
commit
9df49c743a
@ -180,7 +180,32 @@
|
||||
$this->nama_cabang = $branch->name;
|
||||
} else {
|
||||
$this->nama_cabang = '';
|
||||
$this->addError('nama_cabang', 'Cabang Tidak Ditemukan');
|
||||
$this->kode_cabang = '';
|
||||
$this->dispatch('error-toast', 'Cabang Tidak Ditemukan');
|
||||
}
|
||||
}
|
||||
|
||||
public function getDataPinjaman()
|
||||
{
|
||||
$rekening = Rekening::where('nomor_rekening', $this->nomor_pinjaman)->first();
|
||||
if ($rekening) {
|
||||
$loantype = $rekening->loan_type->kode;
|
||||
if ($loantype > 4000) {
|
||||
$this->nomor_pinjaman = '';
|
||||
$this->dispatch('error-toast', 'Bukan Nomor Rekening Pinjaman');
|
||||
} else {
|
||||
$this->kode_debitur = $rekening->debitur->kode;
|
||||
$this->nama_debitur = $rekening->debitur->name;
|
||||
$this->nama_cabang = $rekening->branch->name;
|
||||
$this->kode_cabang = $rekening->branch->kode;
|
||||
}
|
||||
} else {
|
||||
$this->nomor_pinjaman = '';
|
||||
$this->kode_debitur = '';
|
||||
$this->nama_debitur = '';
|
||||
$this->nama_cabang = '';
|
||||
$this->kode_cabang = '';
|
||||
$this->dispatch('error-toast', 'Nomor Pinjaman Tidak Ditemukan');
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,16 +213,17 @@
|
||||
{
|
||||
$rekening = Rekening::where('nomor_rekening', $this->nomor_rekening)->first();
|
||||
if ($rekening) {
|
||||
$debitur = Debitur::where('id', $rekening->debitur_id)->first();
|
||||
if ($debitur) {
|
||||
$this->nama_rekening = $debitur->name;
|
||||
$loantype = $rekening->loan_type->kode;
|
||||
if ($loantype < 6000) {
|
||||
$this->nomor_rekening = '';
|
||||
$this->dispatch('error-toast', 'Bukan Nomor Rekening Tabungan');
|
||||
} else {
|
||||
$this->nama_rekening = '';
|
||||
$this->addError('nama_rekening', 'Nomor Rekening Tidak Ditemukan');
|
||||
$this->nama_rekening = $rekening->debitur->name;
|
||||
}
|
||||
} else {
|
||||
$this->nama_rekening = '';
|
||||
$this->addError('nama_rekening', 'Nomor Rekening Tidak Ditemukan');
|
||||
$this->nomor_rekening = '';
|
||||
$this->dispatch('error-toast', 'Nomor Rekening Tidak Ditemukan');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
<label class="required fw-semibold fs-6 mb-2">Nomor Pinjaman</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<input type="number" wire:model.defer="nomor_pinjaman" name="nomor_pinjaman" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Nomor Pinjaman"/>
|
||||
<input type="number" wire:change="getDataPinjaman" wire:model.defer="nomor_pinjaman" name="nomor_pinjaman" 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
|
||||
@ -39,7 +39,7 @@
|
||||
<label class="required fw-semibold fs-6 mb-2">Debitur</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<input type="number" wire:change="getDebitur" wire:model.defer="kode_debitur" name="kode_debitur" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Kode Debitur"/>
|
||||
<input type="number" wire:change="getDebitur" readonly wire:model.defer="kode_debitur" name="kode_debitur" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Kode Debitur"/>
|
||||
<!--end::Input-->
|
||||
@error('kode_debitur')
|
||||
<span class="text-danger">{{ $message }}</span> @enderror
|
||||
@ -62,7 +62,7 @@
|
||||
<label class="required fw-semibold fs-6 mb-2">Cabang</label>
|
||||
<!--end::Label-->
|
||||
<!--begin::Input-->
|
||||
<input type="text" wire:change="getBranch" wire:model.defer="kode_cabang" name="kode_cabang" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Kode Cabang"/>
|
||||
<input type="text" wire:change="getBranch" readonly wire:model.defer="kode_cabang" name="kode_cabang" class="form-control form-control-solid mb-3 mb-lg-0" placeholder="Kode Cabang"/>
|
||||
<!--end::Input-->
|
||||
@error('kode_cabang')
|
||||
<span class="text-danger">{{ $message }}</span> @enderror
|
||||
|
@ -142,6 +142,13 @@
|
||||
$('#kt_modal_add_subrogasi_jamkrindo').modal('hide');
|
||||
LaravelDataTables['subrogasi-jamkrindo-table'].ajax.reload();
|
||||
});
|
||||
|
||||
Livewire.on('success-toast', (message) => {
|
||||
toastr.success(message);
|
||||
});
|
||||
Livewire.on('error-toast', (message) => {
|
||||
toastr.error(message);
|
||||
});
|
||||
});
|
||||
|
||||
Inputmask.extendAliases({
|
||||
|
Loading…
Reference in New Issue
Block a user