547 lines
24 KiB
PHP
547 lines
24 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
use CodeIgniter\RESTful\ResourceController;
|
|
|
|
use App\Models\AgentModel;
|
|
use App\Models\EnquiryModel;
|
|
use App\Models\QuotationModel;
|
|
use App\Models\PolicyModel;
|
|
use App\Models\FilesModel;
|
|
use DateTime;
|
|
class EnquiryController extends ResourceController
|
|
{
|
|
protected $db;
|
|
protected $enquiryModel;
|
|
protected $AgentModel;
|
|
protected $QuotationModel;
|
|
protected $PolicyModel;
|
|
protected $FilesModel;
|
|
|
|
public function __construct()
|
|
{
|
|
|
|
$this->db = db_connect();
|
|
$this->enquiryModel = new EnquiryModel();
|
|
$this->AgentModel = new AgentModel();
|
|
$this->QuotationModel = new QuotationModel();
|
|
$this->PolicyModel = new PolicyModel();
|
|
$this->FilesModel = new FilesModel();
|
|
}
|
|
|
|
// List all enquiries
|
|
public function enquiryList()
|
|
{
|
|
try {
|
|
|
|
$agent_id = $this->request->getGet('agent_id');
|
|
$staff_id = $this->request->getGet('staff_id');
|
|
$enquiry_id = $this->request->getGet('enquiry_id');
|
|
$manager_id = $this->request->getGet('manager_id');
|
|
|
|
$from_date = $this->request->getGet('from_date');
|
|
$to_date = $this->request->getGet('to_date');
|
|
|
|
$status = $this->request->getGet('status');
|
|
|
|
$only_policy_data = $this->request->getGet('only_policy_data') ?? false;
|
|
|
|
|
|
// Date filter handling
|
|
if (empty($from_date) || empty($to_date)) {
|
|
// Default last 7 days
|
|
// $from_date = date('Y-m-d 00:00:00', strtotime('-7 days'));
|
|
// $to_date = date('Y-m-d 23:59:59');
|
|
$from_date = null;
|
|
$to_date = null;
|
|
} else {
|
|
// Convert d-m-Y → Y-m-d
|
|
$from_date = DateTime::createFromFormat('d-m-Y', $from_date)->format('Y-m-d 00:00:00');
|
|
$to_date = DateTime::createFromFormat('d-m-Y', $to_date)->format('Y-m-d 23:59:59');
|
|
}
|
|
|
|
if (!empty($staff_id) && !empty($manager_id)) {
|
|
$data = $this->enquiryModel->getEnquiry('STAFF&MANAGER', [$staff_id,$manager_id], $only_policy_data, $from_date, $to_date, $status);
|
|
} elseif (!empty($agent_id)) {
|
|
$data = $this->enquiryModel->getEnquiry('AGENT', $agent_id, $only_policy_data, $from_date, $to_date, $status);
|
|
} elseif (!empty($staff_id)) {
|
|
$data = $this->enquiryModel->getEnquiry('STAFF', $staff_id, $only_policy_data, $from_date, $to_date, $status);
|
|
} elseif (!empty($enquiry_id)) {
|
|
$data = $this->enquiryModel->getEnquiry('ENQUIRY',$enquiry_id, $only_policy_data);
|
|
} elseif (!empty($manager_id)) {
|
|
$data = $this->enquiryModel->getEnquiry('MANAGER',$manager_id, $only_policy_data, $from_date, $to_date, $status);
|
|
} else {
|
|
$data = $this->enquiryModel->getEnquiry('ALL');
|
|
}
|
|
|
|
|
|
foreach ($data as $key => $row) {
|
|
$data[$key]['created_on'] = date('d-m-Y h:i A', strtotime($row['created_on']));
|
|
$data[$key]['updated_on'] = date('d-m-Y h:i A', strtotime($row['updated_on']));
|
|
}
|
|
|
|
if (!empty($from_date) || empty(!$to_date)) {
|
|
$from_date = DateTime::createFromFormat('Y-m-d 00:00:00', $from_date)->format('d-m-Y');
|
|
$to_date = DateTime::createFromFormat('Y-m-d 23:59:59', $to_date)->format('d-m-Y');
|
|
}
|
|
|
|
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $data , 'from_date' => $from_date , 'to_date' => $to_date ], 200);
|
|
|
|
} catch (\Exception $e) {
|
|
return $this->respond(['status' => 'failed', 'code' => 500, 'error' => $e->getMessage()], 500);
|
|
}
|
|
}
|
|
|
|
// List all enquiries
|
|
public function enquiryQuotePolicyView()
|
|
{
|
|
try {
|
|
|
|
$enquiry_id = $this->request->getGet('enquiry_id');
|
|
|
|
if (!$enquiry_id) {
|
|
return $this->respond(['status' => 'failed','code' => 400,'data' => 'enquiry_id is required'], 200);
|
|
}
|
|
|
|
//Get enquiry details
|
|
$enquiry = $this->enquiryModel->select('partner_enquiry.* , I.name as insurer_name , I.short_name , VT.vehicle_type as vehicle_type ,PB.name as broker_name ,PA.name as agent_name')
|
|
->join('insurers I', 'I.id = partner_enquiry.insurer_id', 'left')
|
|
->join('vehicle_type VT', 'VT.id = partner_enquiry.vehicle_type_id', 'left')
|
|
->join('partner_brokers PB', 'PB.id = partner_enquiry.broker_id', 'left')
|
|
->join('partner_agent PA', 'PA.id = partner_enquiry.agent_id', 'left')
|
|
->where('partner_enquiry.id', $enquiry_id)
|
|
->where('partner_enquiry.is_active', 1)
|
|
->first();
|
|
|
|
if (!$enquiry) {
|
|
return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enquiry not found'], 200);
|
|
}
|
|
|
|
//Get related quotations
|
|
$quotations = $this->QuotationModel->select('partner_quotation.*, pe.reg_no , I.name as insurer_name, I.short_name , ipti.insurance_plan_type,pe.broker_id ,PB.name as broker_name,PA.name as agent_name , PP.policy_pdf_file_name , PP.id as policy_id , pm.value as payment_mode_value' )
|
|
->join('partner_enquiry pe', 'pe.id = partner_quotation.enquiry_id', 'left')
|
|
->join('insurers I', 'I.id = partner_quotation.insurer_id', 'left')
|
|
->join('partner_insurance_plan_type_master ipti', 'ipti.id = partner_quotation.insurance_plan_type_id', 'left')
|
|
->join('partner_brokers PB', 'PB.id = pe.broker_id', 'left')
|
|
->join('partner_agent PA', 'PA.id = pe.agent_id', 'left')
|
|
->join('partner_policy PP', 'PP.quotation_id = partner_quotation.id', 'left')
|
|
->join('partner_payment_mode_master pm', 'pm.id = partner_quotation.payment_mode_id', 'left')
|
|
->where('partner_quotation.enquiry_id', $enquiry_id)
|
|
->where('partner_quotation.is_active', 1)
|
|
->orderBy('partner_quotation.id', 'DESC')
|
|
->findAll();
|
|
|
|
//Get related policies
|
|
$policies = [];
|
|
if (!empty($quotations)) {
|
|
$quotationId = 0;
|
|
foreach ($quotations as $key => $value) {
|
|
if($value['status'] == 'Accepted') { $quotationId = $value['id']; }
|
|
}
|
|
|
|
$policies = $this->PolicyModel->select('partner_policy.*, pe.reg_no, I.name as insurer_name, I.short_name , pq.insured_declared_value, ipti.insurance_plan_type, pe.broker_id , PB.name as broker_name,PA.name as agent_name, pm.id as payment_mode_id , pm.value as payment_mode_value')
|
|
->join('partner_enquiry pe', 'pe.id = partner_policy.enquiry_id', 'left')
|
|
->join('partner_quotation pq', 'pq.id = partner_policy.quotation_id', 'left')
|
|
->join('insurers I', 'I.id = pq.insurer_id', 'left')
|
|
->join('partner_insurance_plan_type_master ipti', 'ipti.id = pq.insurance_plan_type_id', 'left')
|
|
->join('partner_brokers PB', 'PB.id = pe.broker_id', 'left')
|
|
->join('partner_agent PA', 'PA.id = pe.agent_id', 'left')
|
|
->join('partner_payment_mode_master pm', 'pm.id = pq.payment_mode_id', 'left')
|
|
->where('partner_policy.quotation_id', $quotationId)
|
|
->where('partner_policy.is_active', 1)
|
|
->first();
|
|
if (!empty($policies)) {
|
|
$policies['issued_date'] = format_date_for_client($policies['issued_date'] ?? null);
|
|
$policies['start_date'] = format_date_for_client($policies['start_date'] ?? null);
|
|
$policies['end_date'] = format_date_for_client($policies['end_date'] ?? null);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
// Final response
|
|
$data = [
|
|
'enquiry' => $enquiry,
|
|
'quotations' => $quotations,
|
|
'policies' => $policies
|
|
];
|
|
|
|
return $this->respond(['status' => 'success','code' => 200,'data' => $data], 200);
|
|
|
|
} catch (\Exception $e) {
|
|
return $this->respond(['status' => 'failed','code' => 500,'error' => $e->getMessage()], 500);
|
|
}
|
|
}
|
|
|
|
// CREATE enquiry
|
|
public function createEnquiry()
|
|
{
|
|
try {
|
|
$data = $this->request->getPost();
|
|
|
|
// handle file uploads
|
|
$idProofFile = $this->request->getFile('id_proof_file_name');
|
|
$rcFile = $this->request->getFile('rc_file_name');
|
|
$previousPolicy = $this->request->getFile('previous_policy_file_name');
|
|
|
|
$idProofFileName = null;
|
|
$rcFileName = null;
|
|
$previousPolicyFileName = null;
|
|
|
|
// ID proof upload
|
|
if ($idProofFile && $idProofFile->isValid()) {
|
|
$uploadPath = WRITEPATH . 'uploads/enquiry/id_proof/';
|
|
if (!is_dir($uploadPath)) mkdir($uploadPath, 0777, true);
|
|
$idProofFileName = time() . '_' . $idProofFile->getRandomName();
|
|
$idProofFile->move($uploadPath, $idProofFileName);
|
|
}
|
|
|
|
// RC upload
|
|
if ($rcFile && $rcFile->isValid()) {
|
|
$uploadPath = WRITEPATH . 'uploads/enquiry/rc/';
|
|
if (!is_dir($uploadPath)) mkdir($uploadPath, 0777, true);
|
|
$rcFileName = time() . '_' . $rcFile->getRandomName();
|
|
$rcFile->move($uploadPath, $rcFileName);
|
|
}
|
|
|
|
// Previous policy upload
|
|
if ($previousPolicy && $previousPolicy->isValid()) {
|
|
$uploadPath = WRITEPATH . 'uploads/enquiry/previous_policy/';
|
|
if (!is_dir($uploadPath)) mkdir($uploadPath, 0777, true);
|
|
$previousPolicyFileName = time() . '_' . $previousPolicy->getRandomName();
|
|
$previousPolicy->move($uploadPath, $previousPolicyFileName);
|
|
}
|
|
|
|
//get insurer_branch_id
|
|
if(isset($data['insurer_id']))
|
|
{
|
|
$query = $this->db->query("SELECT id FROM insurer_branch WHERE insurer_id = ? LIMIT 1", [$data['insurer_id']]);
|
|
$insurerBranchresult = $query->getRowArray();
|
|
}
|
|
|
|
|
|
$insertData = [
|
|
'agent_id' => $data['agent_id'],
|
|
'name' => $data['name'],
|
|
'mobile' => $data['mobile'],
|
|
'email' => $data['email'],
|
|
'reg_no' => $data['reg_no'],
|
|
'vehicle_type_id' => $data['vehicle_type_id'] ?? 0,
|
|
'rc_file_name' => $rcFileName,
|
|
'id_proof_file_name' => $idProofFileName,
|
|
'previous_policy_file_name' => $previousPolicyFileName,
|
|
'remarks' => $data['remarks'],
|
|
'manager_id' => $data['manager_id'] ,
|
|
'created_by' => $data['created_by'],
|
|
'is_data_created_by_handler' => $data['is_data_created_by_handler'] ?? 0 ,
|
|
|
|
'assigned_to' => $data['assigned_to'] ?? 0,
|
|
'insurer_id' => $data['insurer_id'] ?? 0,
|
|
'insurer_branch_id'=> $insurerBranchresult['id'] ?? 0,
|
|
'broker_id' => $data['broker_id'] ?? 0,
|
|
];
|
|
|
|
|
|
$enquiryId = $this->enquiryModel->insert($insertData , true);
|
|
|
|
// trigger_email('enquiry_created', ['enquiry_id' => $enquiryId]);
|
|
|
|
//create Quotation ana mark as accepted
|
|
$quotationData = [
|
|
'enquiry_id' => $enquiryId,
|
|
'insured_declared_value' => $data['insured_declared_value'] ?? 0,
|
|
'premium_amount' => $data['premium_amount'] ?? 0,
|
|
'insurance_plan_type_id' => $data['insurance_plan_type_id'] ?? 0,
|
|
'insurer_id' => $data['insurer_id'] ?? 0,
|
|
'insurer_branch_id' => $insurerBranchresult['id'] ?? 0,
|
|
'manager_id' => $data['manager_id'],
|
|
'payment_mode_id' => $data['payment_mode_id'] ?? 0,
|
|
'created_by' => $data['created_by'],
|
|
'status' => 'Accepted'
|
|
];
|
|
$QuotationId = $this->QuotationModel->insert($quotationData, true);
|
|
$this->enquiryModel->update($data['enquiry_id'], [ 'status' => 'Proposal Accepted' ]);
|
|
|
|
|
|
|
|
return $this->respond(['status' => 'success', 'code' => 200, 'message' => 'Enquiry created successfully'], 200);
|
|
|
|
} catch (\Exception $e) {
|
|
return $this->respond(['status' => 'failed', 'code' => 500, 'error' => $e->getMessage()], 500);
|
|
}
|
|
}
|
|
|
|
// UPDATE enquiry
|
|
public function updateEnquiry()
|
|
{
|
|
try {
|
|
$data = $this->request->getPost();
|
|
|
|
if (!isset($data['id'])) {
|
|
return $this->respond(['status' => 'failed', 'code' => 200, 'error' => 'ID Required'], 200);
|
|
}
|
|
|
|
$id = $data['id'];
|
|
$enquiry = $this->enquiryModel->find($id);
|
|
|
|
if (!$enquiry) {
|
|
return $this->respond(['status' => 'failed', 'code' => 200, 'error' => 'Data Not Found'], 200);
|
|
}
|
|
|
|
//get insurer_branch_id
|
|
if(isset($data['insurer_id']))
|
|
{
|
|
$query = $this->db->query("SELECT id FROM insurer_branch WHERE insurer_id = ? LIMIT 1", [$data['insurer_id']]);
|
|
$insurerBranchresult = $query->getRowArray();
|
|
}
|
|
|
|
|
|
|
|
$updateData = [
|
|
'agent_id' => $data['agent_id'] ?? $enquiry['agent_id'],
|
|
'name' => $data['name'] ?? $enquiry['name'],
|
|
'mobile' => $data['mobile'] ?? $enquiry['mobile'],
|
|
'email' => $data['email'] ?? $enquiry['email'],
|
|
'reg_no' => $data['reg_no'] ?? $enquiry['reg_no'],
|
|
'vehicle_type_id' => $data['vehicle_type_id'] ?? $enquiry['vehicle_type_id'],
|
|
'remarks' => $data['remarks'] ?? $enquiry['remarks'],
|
|
'updated_by' => $data['updated_by'] ?? null,
|
|
|
|
'assigned_to' => $data['assigned_to'] ?? $enquiry['assigned_to'],
|
|
'insurer_id' => $data['insurer_id'] ?? $enquiry['insurer_id'],
|
|
'insurer_branch_id'=> $insurerBranchresult['id'] ?? $enquiry['insurer_branch_id'],
|
|
'broker_id' => $data['broker_id'] ?? $enquiry['broker_id'],
|
|
];
|
|
|
|
// File updates
|
|
$idProofFile = $this->request->getFile('id_proof_file_name');
|
|
$rcFile = $this->request->getFile('rc_file_name');
|
|
$previousPolicy = $this->request->getFile('previous_policy_file_name');
|
|
|
|
if ($idProofFile && $idProofFile->isValid()) {
|
|
$uploadPath = WRITEPATH . 'uploads/enquiry/id_proof/';
|
|
if (!is_dir($uploadPath)) mkdir($uploadPath, 0777, true);
|
|
$idProofFileName = time() . '_' . $idProofFile->getRandomName();
|
|
$idProofFile->move($uploadPath, $idProofFileName);
|
|
$updateData['id_proof_file_name'] = $idProofFileName;
|
|
}
|
|
|
|
if ($rcFile && $rcFile->isValid()) {
|
|
$uploadPath = WRITEPATH . 'uploads/enquiry/rc/';
|
|
if (!is_dir($uploadPath)) mkdir($uploadPath, 0777, true);
|
|
$rcFileName = time() . '_' . $rcFile->getRandomName();
|
|
$rcFile->move($uploadPath, $rcFileName);
|
|
$updateData['rc_file_name'] = $rcFileName;
|
|
}
|
|
|
|
if ($previousPolicy && $previousPolicy->isValid()) {
|
|
$uploadPath = WRITEPATH . 'uploads/enquiry/previous_policy/';
|
|
if (!is_dir($uploadPath)) mkdir($uploadPath, 0777, true);
|
|
$previousPolicyFileName = time() . '_' . $previousPolicy->getRandomName();
|
|
$previousPolicy->move($uploadPath, $previousPolicyFileName);
|
|
$updateData['previous_policy_file_name'] = $previousPolicyFileName;
|
|
}
|
|
|
|
$this->enquiryModel->update($id, $updateData);
|
|
|
|
return $this->respond(['status' => 'success', 'code' => 200, 'message' => 'Enquiry updated successfully'], 200);
|
|
|
|
} catch (\Exception $e) {
|
|
return $this->respond(['status' => 'failed', 'code' => 500, 'error' => $e->getMessage()], 500);
|
|
}
|
|
}
|
|
|
|
//Assign to staff
|
|
public function enquiryAssignUpdate()
|
|
{
|
|
try {
|
|
|
|
$data = $this->request->getJSON(true);
|
|
|
|
if (!isset($data['id'])) {
|
|
return $this->respond(['status' => 'failed', 'code' => 200, 'error' => 'ID Required'], 200);
|
|
}
|
|
|
|
$id = $data['id'];
|
|
$enquiry = $this->enquiryModel->find($id);
|
|
|
|
if (!$enquiry) {
|
|
return $this->respond(['status' => 'failed', 'code' => 200, 'error' => 'Data Not Found'], 200);
|
|
}
|
|
|
|
//get insurer_branch_id
|
|
$query = $this->db->query("SELECT id FROM insurer_branch WHERE insurer_id = ? LIMIT 1", [$data['insurer_id']]);
|
|
$insurerBranchresult = $query->getRowArray();
|
|
|
|
$updateData = [
|
|
'assigned_to' => $data['assigned_to'],
|
|
'insurer_id' => $data['insurer_id'],
|
|
'insurer_branch_id'=> $insurerBranchresult['id'] ?? 0,
|
|
'broker_id' => $data['broker_id'] ?? 1,
|
|
];
|
|
|
|
$this->enquiryModel->update($id, $updateData);
|
|
|
|
// trigger_email('enquiry_assigned', ['enquiry_id' => $id]);
|
|
|
|
return $this->respond(['status' => 'success', 'code' => 200, 'message' => 'Enquiry updated successfully'], 200);
|
|
|
|
|
|
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $data], 200);
|
|
|
|
} catch (\Exception $e) {
|
|
return $this->respond(['status' => 'failed', 'code' => 500, 'error' => $e->getMessage()], 500);
|
|
}
|
|
}
|
|
|
|
// Download enquiry file
|
|
public function downloadEnquiryFile()
|
|
{
|
|
try {
|
|
$enquiryId = $this->request->getGet('enquiry_id');
|
|
$fileType = $this->request->getGet('file_type'); // rc | id_proof | previous_policy
|
|
|
|
if (!$enquiryId || !$fileType) {
|
|
return $this->respond(['status' => 'failed','code' => 400,'data' => 'enquiry_id and file_type are required'], 200);
|
|
}
|
|
|
|
// Map file_type to DB column and folder
|
|
$fileMap = [
|
|
'rc' => ['column' => 'rc_file_name', 'folder' => 'rc'],
|
|
'id_proof' => ['column' => 'id_proof_file_name', 'folder' => 'id_proof'],
|
|
'previous_policy' => ['column' => 'previous_policy_file_name', 'folder' => 'previous_policy'],
|
|
];
|
|
|
|
if (!array_key_exists($fileType, $fileMap)) {
|
|
return $this->respond(['status' => 'failed','code' => 400,'data' => 'Invalid file_type'], 200);
|
|
}
|
|
|
|
$fileColumn = $fileMap[$fileType]['column'];
|
|
$folder = $fileMap[$fileType]['folder'];
|
|
|
|
// Fetch record from DB
|
|
$fileRecord = $this->enquiryModel->where('is_active', 1)->find($enquiryId);
|
|
|
|
if (!$fileRecord || empty($fileRecord[$fileColumn])) {
|
|
return $this->respond([ 'status' => 'failed','code' => 404,'data' => 'File not found in database'], 200);
|
|
}
|
|
|
|
$filePath = WRITEPATH . "uploads/enquiry/{$folder}/" . $fileRecord[$fileColumn];
|
|
|
|
if (!file_exists($filePath)) {
|
|
return $this->respond(['status' => 'failed','code' => 404,'data' => 'File missing on server'], 200);
|
|
}
|
|
|
|
// Force file download
|
|
return $this->response->download($filePath, null);
|
|
|
|
} catch (\Exception $e) {
|
|
return $this->respond(['status' => 'failed','code' => 500,'message' => $e->getMessage() ], 500);
|
|
}
|
|
}
|
|
|
|
public function uploadEnquiryFiles()
|
|
{
|
|
try {
|
|
$enquiryId = $this->request->getPost('enquiry_id');
|
|
|
|
if (!$enquiryId) {
|
|
return $this->respond(['status' => 'failed', 'message' => 'enquiry_id required'], 404);
|
|
}
|
|
|
|
$files = $this->request->getFiles();
|
|
|
|
if (!$files) {
|
|
return $this->respond(['status' => 'failed', 'message' => 'No files uploaded'], 404);
|
|
}
|
|
|
|
|
|
$savedFiles = [];
|
|
|
|
foreach ($files['files'] as $file) {
|
|
if ($file->isValid()) {
|
|
$uploadPath = WRITEPATH . "uploads/enquiry/";
|
|
if (!is_dir($uploadPath)) {
|
|
mkdir($uploadPath, 0777, true);
|
|
}
|
|
|
|
// Generate file name
|
|
$newName = time() . '_' . $file->getRandomName();
|
|
$file->move($uploadPath, $newName);
|
|
|
|
// Save DB record
|
|
$this->FilesModel->insert([
|
|
'enquiry_id' => $enquiryId,
|
|
'file_name' => $newName,
|
|
'is_active' => 1,
|
|
'created_by' => $this->request->getPost('created_by') ?? 0,
|
|
]);
|
|
|
|
$savedFiles[] = $newName;
|
|
}
|
|
}
|
|
|
|
return $this->respond(['status' => 'success','uploaded_files' => $savedFiles ], 200);
|
|
|
|
} catch (\Exception $e) {
|
|
return $this->respond(['status' => 'failed', 'message' => $e->getMessage()], 500);
|
|
}
|
|
}
|
|
|
|
public function downloadEnquiryFiles()
|
|
{
|
|
|
|
|
|
$fileId = $this->request->getGet('file_id');
|
|
|
|
$file = $this->FilesModel->find($fileId);
|
|
|
|
if (!$file) {
|
|
return $this->respond(['status' => 'failed','message' => 'Invalid file id'], 404);
|
|
}
|
|
|
|
$filePath = WRITEPATH . "uploads/enquiry/{$file['file_name']}";
|
|
|
|
if (!file_exists($filePath)) {
|
|
return $this->respond([
|
|
'status' => 'failed',
|
|
'message' => 'File missing on server'
|
|
], 404);
|
|
}
|
|
|
|
// Force file download
|
|
return $this->response->download($filePath, null);
|
|
}
|
|
|
|
public function enquiryFiles()
|
|
{
|
|
$enquiryId = $this->request->getGet('enquiry_id');
|
|
|
|
if (!$enquiryId) {
|
|
return $this->respond(['status' => 'failed', 'message' => 'enquiry_id required'], 400);
|
|
}
|
|
|
|
|
|
$files = $this->FilesModel
|
|
->where('enquiry_id', $enquiryId)
|
|
->where('is_active', 1)
|
|
->findAll();
|
|
|
|
return $this->respond([
|
|
'status' => 'success',
|
|
'data' => $files
|
|
], 200);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|