This commit is contained in:
Gowtham M 2025-11-21 18:48:13 +05:30
parent 57cbd4f6c0
commit 43775669b0

View File

@ -347,7 +347,7 @@ class QuotationController extends ResourceController
$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()) {
@ -404,23 +404,19 @@ class QuotationController extends ResourceController
$this->QuotationModel->update($quotationId, $quotationData);
return $this->respond([
'status' => 'success',
'code' => 200,
'msg' => 'Quotation updated successfully'
], 200);
}
/* ------------------------------------------------------
* CASE 3: Create New Quotation
* ------------------------------------------------------ */
if (empty($quotationId))
{
$quotationData['created_by'] = $data['created_by'] ?? 0;
$quotationData['status'] = 'Accepted';
$newQuotationId = $this->QuotationModel->insert($quotationData, true);
/* --------------------------------------------
* Update Enquiry (Quotation Accepted)
* -------------------------------------------- */
@ -430,11 +426,12 @@ class QuotationController extends ResourceController
'status' => 'Proposal Accepted'
]);
}
/* ------------------------------------------------------
* If file uploaded Create Policy
* ------------------------------------------------------ */
if ($policyPdf && $policyPdf->isValid()) {
if (empty($policyId) && $policyPdf && $policyPdf->isValid()) {
$uploadDir = WRITEPATH . 'uploads/policy/policy_pdf/';
if (!is_dir($uploadDir)) {