GWM
This commit is contained in:
parent
57cbd4f6c0
commit
43775669b0
@ -347,7 +347,7 @@ class QuotationController extends ResourceController
|
|||||||
$policyPdf = $this->request->getFile('policy_pdf_file_name');
|
$policyPdf = $this->request->getFile('policy_pdf_file_name');
|
||||||
|
|
||||||
/* ------------------------------------------------------
|
/* ------------------------------------------------------
|
||||||
* CASE 1: Update Policy (policy_id + file uploaded)
|
* Update Policy (policy_id + file uploaded)
|
||||||
* ------------------------------------------------------ */
|
* ------------------------------------------------------ */
|
||||||
if (!empty($policyId) && $policyPdf && $policyPdf->isValid()) {
|
if (!empty($policyId) && $policyPdf && $policyPdf->isValid()) {
|
||||||
|
|
||||||
@ -404,37 +404,34 @@ class QuotationController extends ResourceController
|
|||||||
|
|
||||||
$this->QuotationModel->update($quotationId, $quotationData);
|
$this->QuotationModel->update($quotationId, $quotationData);
|
||||||
|
|
||||||
return $this->respond([
|
|
||||||
'status' => 'success',
|
|
||||||
'code' => 200,
|
|
||||||
'msg' => 'Quotation updated successfully'
|
|
||||||
], 200);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------
|
/* ------------------------------------------------------
|
||||||
* CASE 3: Create New Quotation
|
* CASE 3: Create New Quotation
|
||||||
* ------------------------------------------------------ */
|
* ------------------------------------------------------ */
|
||||||
$quotationData['created_by'] = $data['created_by'] ?? 0;
|
if (empty($quotationId))
|
||||||
$quotationData['status'] = 'Accepted';
|
{
|
||||||
|
$quotationData['created_by'] = $data['created_by'] ?? 0;
|
||||||
|
$quotationData['status'] = 'Accepted';
|
||||||
|
|
||||||
$newQuotationId = $this->QuotationModel->insert($quotationData, true);
|
$newQuotationId = $this->QuotationModel->insert($quotationData, true);
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------
|
|
||||||
* Update Enquiry (Quotation Accepted)
|
|
||||||
* -------------------------------------------- */
|
|
||||||
$this->EnquiryModel->update($data['enquiry_id'], [
|
|
||||||
'broker_id' => $data['broker_id'] ?? 0,
|
|
||||||
'vehicle_type_id' => $data['vehicle_type_id'] ?? 0,
|
|
||||||
'status' => 'Proposal Accepted'
|
|
||||||
]);
|
|
||||||
|
|
||||||
|
/* --------------------------------------------
|
||||||
|
* Update Enquiry (Quotation Accepted)
|
||||||
|
* -------------------------------------------- */
|
||||||
|
$this->EnquiryModel->update($data['enquiry_id'], [
|
||||||
|
'broker_id' => $data['broker_id'] ?? 0,
|
||||||
|
'vehicle_type_id' => $data['vehicle_type_id'] ?? 0,
|
||||||
|
'status' => 'Proposal Accepted'
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------
|
/* ------------------------------------------------------
|
||||||
* If file uploaded → Create Policy
|
* If file uploaded → Create Policy
|
||||||
* ------------------------------------------------------ */
|
* ------------------------------------------------------ */
|
||||||
if ($policyPdf && $policyPdf->isValid()) {
|
if (empty($policyId) && $policyPdf && $policyPdf->isValid()) {
|
||||||
|
|
||||||
$uploadDir = WRITEPATH . 'uploads/policy/policy_pdf/';
|
$uploadDir = WRITEPATH . 'uploads/policy/policy_pdf/';
|
||||||
if (!is_dir($uploadDir)) {
|
if (!is_dir($uploadDir)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user