update approval create and update semua module parameter

This commit is contained in:
daengdeni 2023-12-26 15:00:48 +07:00
parent ab1caaf6f4
commit b7c189c6f6
7 changed files with 327 additions and 34 deletions

View File

@ -42,13 +42,55 @@
if ($this->edit_mode) {
// Emit a success event with a message
$branch = Branch::find($this->id);
$branch->update($data);
$this->dispatch('success', __('Branch updated'));
$approval = [
'method' => 'update',
'menu' => 'Parameter Cabang',
'old_request' => json_encode($branch),
'new_request' => json_encode($data),
'description' => 'Update Parameter Cabang',
'status' => '0',
'ref' => $this->kode
];
$is_approval = Approval::where('menu', 'Parameter Cabang')
->where('ref', $this->kode)
->where('status', '0')
->where('method', 'update')
->get()
->first();
if ($is_approval) {
$this->dispatch('error', 'Data Sedang Menunggu Approval');
} else {
Approval::create($approval);
$this->dispatch('success', 'Data Berhasil Di Update, Menunggu Approval');
}
} else {
// Emit a success event with a message
Branch::create($data);
$this->dispatch('success', __('New Branch created'));
$approval = [
'method' => 'create',
'menu' => 'Parameter Cabang',
'new_request' => json_encode($data),
'description' => 'Create Parameter Cabang',
'status' => '0',
'ref' => $this->kode
];
$is_approval = Approval::where('menu', 'Parameter Cabang')
->where('ref', $this->kode)
->where('status', '0')
->where('method', 'create')
->get()
->first();
if ($is_approval) {
$this->dispatch('error', 'Data Sedang Menunggu Approval');
$this->reset();
} else {
Approval::create($approval);
$this->dispatch('success', 'Data Berhasil Di Input, Menunggu Approval');
}
}
});

View File

@ -42,13 +42,55 @@
if ($this->edit_mode) {
// Emit a success event with a message
$currency = Currency::find($this->id);
$currency->update($data);
$this->dispatch('success', __('Currency updated'));
$approval = [
'method' => 'update',
'menu' => 'Parameter Mata Uang',
'old_request' => json_encode($currency),
'new_request' => json_encode($data),
'description' => 'Update Parameter Mata Uang',
'status' => '0',
'ref' => $this->kode
];
$is_approval = Approval::where('menu', 'Parameter Mata Uang')
->where('ref', $this->kode)
->where('status', '0')
->where('method', 'update')
->get()
->first();
if ($is_approval) {
$this->dispatch('error', 'Data Sedang Menunggu Approval');
} else {
Approval::create($approval);
$this->dispatch('success', 'Data Berhasil Di Update, Menunggu Approval');
}
} else {
// Emit a success event with a message
Currency::create($data);
$this->dispatch('success', __('New Currency created'));
$approval = [
'method' => 'create',
'menu' => 'Parameter Mata Uang',
'new_request' => json_encode($data),
'description' => 'Create Parameter Mata Uang',
'status' => '0',
'ref' => $this->kode
];
$is_approval = Approval::where('menu', 'Parameter Mata Uang')
->where('ref', $this->kode)
->where('status', '0')
->where('method', 'create')
->get()
->first();
if ($is_approval) {
$this->dispatch('error', 'Data Sedang Menunggu Approval');
$this->reset();
} else {
Approval::create($approval);
$this->dispatch('success', 'Data Berhasil Di Input, Menunggu Approval');
}
}
});
@ -69,8 +111,8 @@
public function delete($id)
{
$curency = Currency::find($id);
$curency->delete_by = auth()->user()->id;
$curency = Currency::find($id);
$curency->delete_by = auth()->user()->id;
$curency->deleted_at = now();
$approval = [

View File

@ -51,17 +51,58 @@
'registered_at' => $this->registered_at,
];
if ($this->edit_mode) {
// Emit a success event with a message
$debitur = Debitur::find($this->id);
$debitur->update($data);
$this->dispatch('success', __('Debitur updated'));
$approval = [
'method' => 'update',
'menu' => 'Parameter Debitur',
'old_request' => json_encode($debitur),
'new_request' => json_encode($data),
'description' => 'Update Parameter Debitur',
'status' => '0',
'ref' => $this->kode
];
$is_approval = Approval::where('menu', 'Parameter Debitur')
->where('ref', $this->kode)
->where('status', '0')
->where('method', 'update')
->get()
->first();
if ($is_approval) {
$this->dispatch('error', 'Data Sedang Menunggu Approval');
} else {
Approval::create($approval);
$this->dispatch('success', 'Data Berhasil Di Update, Menunggu Approval');
}
} else {
// Emit a success event with a message
Debitur::create($data);
$this->dispatch('success', __('New Debitur created'));
$approval = [
'method' => 'create',
'menu' => 'Parameter Debitur',
'new_request' => json_encode($data),
'description' => 'Create Parameter Debitur',
'status' => '0',
'ref' => $this->kode
];
$is_approval = Approval::where('menu', 'Parameter Debitur')
->where('ref', $this->kode)
->where('status', '0')
->where('method', 'create')
->get()
->first();
if ($is_approval) {
$this->dispatch('error', 'Data Sedang Menunggu Approval');
$this->reset();
} else {
Approval::create($approval);
$this->dispatch('success', 'Data Berhasil Di Input, Menunggu Approval');
}
}
});

View File

@ -41,14 +41,56 @@
if ($this->edit_mode) {
// Emit a success event with a message
$facility_type = FacilityType::find($this->id);
$facility_type->update($data);
$facility = FacilityType::find($this->id);
$this->dispatch('success', __('Facility Type updated'));
$approval = [
'method' => 'update',
'menu' => 'Parameter Jenis Fasilitas',
'old_request' => json_encode($facility),
'new_request' => json_encode($data),
'description' => 'Update Parameter Jenis Fasilitas',
'status' => '0',
'ref' => $this->kode
];
$is_approval = Approval::where('menu', 'Parameter Jenis Fasilitas')
->where('ref', $this->kode)
->where('status', '0')
->where('method', 'update')
->get()
->first();
if ($is_approval) {
$this->dispatch('error', 'Data Sedang Menunggu Approval');
} else {
Approval::create($approval);
$this->dispatch('success', 'Data Berhasil Di Update, Menunggu Approval');
}
} else {
// Emit a success event with a message
FacilityType::create($data);
$this->dispatch('success', __('New Facility Type created'));
$approval = [
'method' => 'create',
'menu' => 'Parameter Jenis Fasilitas',
'new_request' => json_encode($data),
'description' => 'Create Parameter Jenis Fasilitas',
'status' => '0',
'ref' => $this->kode
];
$is_approval = Approval::where('menu', 'Parameter Jenis Fasilitas')
->where('ref', $this->kode)
->where('status', '0')
->where('method', 'create')
->get()
->first();
if ($is_approval) {
$this->dispatch('error', 'Data Sedang Menunggu Approval');
$this->reset();
} else {
Approval::create($approval);
$this->dispatch('success', 'Data Berhasil Di Input, Menunggu Approval');
}
}
});

View File

@ -41,14 +41,56 @@
if ($this->edit_mode) {
// Emit a success event with a message
$guarantee_type = GuaranteeType::find($this->id);
$guarantee_type->update($data);
$guarante = GuaranteeType::find($this->id);
$this->dispatch('success', __('Guarante Type updated'));
$approval = [
'method' => 'update',
'menu' => 'Parameter Jenis Jaminan',
'old_request' => json_encode($guarante),
'new_request' => json_encode($data),
'description' => 'Update Parameter Jenis Jaminan',
'status' => '0',
'ref' => $this->kode
];
$is_approval = Approval::where('menu', 'Parameter Jenis Jaminan')
->where('ref', $this->kode)
->where('status', '0')
->where('method', 'update')
->get()
->first();
if ($is_approval) {
$this->dispatch('error', 'Data Sedang Menunggu Approval');
} else {
Approval::create($approval);
$this->dispatch('success', 'Data Berhasil Di Update, Menunggu Approval');
}
} else {
// Emit a success event with a message
GuaranteeType::create($data);
$this->dispatch('success', __('New Guarante Type created'));
$approval = [
'method' => 'create',
'menu' => 'Parameter Jenis Jaminan',
'new_request' => json_encode($data),
'description' => 'Create Parameter Jenis Jaminan',
'status' => '0',
'ref' => $this->kode
];
$is_approval = Approval::where('menu', 'Parameter Jenis Jaminan')
->where('ref', $this->kode)
->where('status', '0')
->where('method', 'create')
->get()
->first();
if ($is_approval) {
$this->dispatch('error', 'Data Sedang Menunggu Approval');
$this->reset();
} else {
Approval::create($approval);
$this->dispatch('success', 'Data Berhasil Di Input, Menunggu Approval');
}
}
});

View File

@ -41,14 +41,56 @@
if ($this->edit_mode) {
// Emit a success event with a message
$loan_type = LoanType::find($this->id);
$loan_type->update($data);
$loan = LoanType::find($this->id);
$this->dispatch('success', __('Loan Type updated'));
$approval = [
'method' => 'update',
'menu' => 'Parameter Jenis Jaminan',
'old_request' => json_encode($loan),
'new_request' => json_encode($data),
'description' => 'Update Parameter Jenis Jaminan',
'status' => '0',
'ref' => $this->kode
];
$is_approval = Approval::where('menu', 'Parameter Jenis Jaminan')
->where('ref', $this->kode)
->where('status', '0')
->where('method', 'update')
->get()
->first();
if ($is_approval) {
$this->dispatch('error', 'Data Sedang Menunggu Approval');
} else {
Approval::create($approval);
$this->dispatch('success', 'Data Berhasil Di Update, Menunggu Approval');
}
} else {
// Emit a success event with a message
LoanType::create($data);
$this->dispatch('success', __('New Loan Type created'));
$approval = [
'method' => 'create',
'menu' => 'Parameter Jenis Jaminan',
'new_request' => json_encode($data),
'description' => 'Create Parameter Jenis Jaminan',
'status' => '0',
'ref' => $this->kode
];
$is_approval = Approval::where('menu', 'Parameter Jenis Jaminan')
->where('ref', $this->kode)
->where('status', '0')
->where('method', 'create')
->get()
->first();
if ($is_approval) {
$this->dispatch('error', 'Data Sedang Menunggu Approval');
$this->reset();
} else {
Approval::create($approval);
$this->dispatch('success', 'Data Berhasil Di Input, Menunggu Approval');
}
}
});

View File

@ -73,13 +73,55 @@
if ($this->edit_mode) {
// Emit a success event with a message
$rekening = Rekening::find($this->id);
$rekening->update($data);
$this->dispatch('success', __('Rekening updated'));
$approval = [
'method' => 'update',
'menu' => 'Parameter Rekening',
'old_request' => json_encode($rekening),
'new_request' => json_encode($data),
'description' => 'Update Parameter Rekening',
'status' => '0',
'ref' => $this->kode
];
$is_approval = Approval::where('menu', 'Parameter Rekening')
->where('ref', $this->kode)
->where('status', '0')
->where('method', 'update')
->get()
->first();
if ($is_approval) {
$this->dispatch('error', 'Data Sedang Menunggu Approval');
} else {
Approval::create($approval);
$this->dispatch('success', 'Data Berhasil Di Update, Menunggu Approval');
}
} else {
// Emit a success event with a message
Rekening::create($data);
$this->dispatch('success', __('New Rekening created'));
$approval = [
'method' => 'create',
'menu' => 'Parameter Rekening',
'new_request' => json_encode($data),
'description' => 'Create Parameter Rekening',
'status' => '0',
'ref' => $this->kode
];
$is_approval = Approval::where('menu', 'Parameter Rekening')
->where('ref', $this->kode)
->where('status', '0')
->where('method', 'create')
->get()
->first();
if ($is_approval) {
$this->dispatch('error', 'Data Sedang Menunggu Approval');
$this->reset();
} else {
Approval::create($approval);
$this->dispatch('success', 'Data Berhasil Di Input, Menunggu Approval');
}
}
});