GWM
This commit is contained in:
parent
38dd58bfbd
commit
462e16e293
@ -41,6 +41,13 @@ $routes->group('api', ['filter' => 'appSignature'], function ($routes) {
|
|||||||
$routes->get('master/getInsurersMaster', 'MasterController::getInsurersMaster');
|
$routes->get('master/getInsurersMaster', 'MasterController::getInsurersMaster');
|
||||||
$routes->get('master/getStaffMaster', 'MasterController::getStaffMaster');
|
$routes->get('master/getStaffMaster', 'MasterController::getStaffMaster');
|
||||||
$routes->get('master/getAllBrokers', 'MasterController::getAllBrokers');
|
$routes->get('master/getAllBrokers', 'MasterController::getAllBrokers');
|
||||||
|
$routes->post('master/createBroker', 'PartnerPaymentModeController::createBroker');
|
||||||
|
$routes->post('master/updateBroker/(:num)', 'PartnerPaymentModeController::updateBroker/$1');
|
||||||
|
$routes->post('master/updateBrokerStatus/(:num)', 'PartnerPaymentModeController::updateBrokerStatus/$1');
|
||||||
|
$routes->get('master/getAllPaymentModelist', 'getAllPaymentModelist::list');
|
||||||
|
$routes->post('master/createPaymentMode', 'PartnerPaymentModeController::createPaymentMode');
|
||||||
|
$routes->post('master/updatePaymentMode/(:num)', 'PartnerPaymentModeController::updatePaymentMode/$1');
|
||||||
|
$routes->post('master/updatePaymentModeStatus/(:num)', 'PartnerPaymentModeController::updatePaymentModeStatus/$1');
|
||||||
|
|
||||||
//Agent
|
//Agent
|
||||||
$routes->get('agent/agentList', 'AgentController::agentList');
|
$routes->get('agent/agentList', 'AgentController::agentList');
|
||||||
|
|||||||
@ -102,10 +102,11 @@ class EnquiryController extends ResourceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Get enquiry details
|
//Get enquiry details
|
||||||
$enquiry = $this->enquiryModel->select('partner_enquiry.* , I.name as insurer_name , VT.vehicle_type as vehicle_type,PB.name as broker_name')
|
$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('insurers I', 'I.id = partner_enquiry.insurer_id', 'left')
|
||||||
->join('vehicle_type VT', 'VT.id = partner_enquiry.vehicle_type_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_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.id', $enquiry_id)
|
||||||
->where('partner_enquiry.is_active', 1)
|
->where('partner_enquiry.is_active', 1)
|
||||||
->first();
|
->first();
|
||||||
@ -115,11 +116,12 @@ class EnquiryController extends ResourceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Get related quotations
|
//Get related quotations
|
||||||
$quotations = $this->QuotationModel->select('partner_quotation.*, pe.reg_no , I.name as insurer_name, ipti.insurance_plan_type,PB.name as broker_name' )
|
$quotations = $this->QuotationModel->select('partner_quotation.*, pe.reg_no , I.name as insurer_name, I.short_name , ipti.insurance_plan_type,PB.name as broker_name,PA.name as agent_name' )
|
||||||
->join('partner_enquiry pe', 'pe.id = partner_quotation.enquiry_id', 'left')
|
->join('partner_enquiry pe', 'pe.id = partner_quotation.enquiry_id', 'left')
|
||||||
->join('insurers I', 'I.id = partner_quotation.insurer_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_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_brokers PB', 'PB.id = pe.broker_id', 'left')
|
||||||
|
->join('partner_agent PA', 'PA.id = pe.agent_id', 'left')
|
||||||
->where('partner_quotation.enquiry_id', $enquiry_id)
|
->where('partner_quotation.enquiry_id', $enquiry_id)
|
||||||
->where('partner_quotation.is_active', 1)
|
->where('partner_quotation.is_active', 1)
|
||||||
->orderBy('partner_quotation.id', 'DESC')
|
->orderBy('partner_quotation.id', 'DESC')
|
||||||
@ -133,12 +135,13 @@ class EnquiryController extends ResourceController
|
|||||||
if($value['status'] == 'Accepted') { $quotationId = $value['id']; }
|
if($value['status'] == 'Accepted') { $quotationId = $value['id']; }
|
||||||
}
|
}
|
||||||
|
|
||||||
$policies = $this->PolicyModel->select('partner_policy.*, pe.reg_no, I.name as insurer_name, pq.insured_declared_value, ipti.insurance_plan_type, pe.broker_id , PB.name as broker_name')
|
$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')
|
||||||
->join('partner_enquiry pe', 'pe.id = partner_policy.enquiry_id', 'left')
|
->join('partner_enquiry pe', 'pe.id = partner_policy.enquiry_id', 'left')
|
||||||
->join('partner_quotation pq', 'pq.id = partner_policy.quotation_id', 'left')
|
->join('partner_quotation pq', 'pq.id = partner_policy.quotation_id', 'left')
|
||||||
->join('insurers I', 'I.id = pq.insurer_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_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_brokers PB', 'PB.id = pe.broker_id', 'left')
|
||||||
|
->join('partner_agent PA', 'PA.id = pe.agent_id', 'left')
|
||||||
->where('partner_policy.quotation_id', $quotationId)
|
->where('partner_policy.quotation_id', $quotationId)
|
||||||
->where('partner_policy.is_active', 1)
|
->where('partner_policy.is_active', 1)
|
||||||
->first();
|
->first();
|
||||||
|
|||||||
@ -11,6 +11,7 @@ use App\Models\EndorsementTypeModel;
|
|||||||
use App\Models\InsurersModel;
|
use App\Models\InsurersModel;
|
||||||
use App\Models\StaffModel;
|
use App\Models\StaffModel;
|
||||||
use App\Models\PartnerBrokerModel;
|
use App\Models\PartnerBrokerModel;
|
||||||
|
use App\Models\PaymentModeModel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -26,6 +27,7 @@ class MasterController extends ResourceController
|
|||||||
protected $InsurersModel;
|
protected $InsurersModel;
|
||||||
protected $StaffModel;
|
protected $StaffModel;
|
||||||
protected $PartnerBrokerModel;
|
protected $PartnerBrokerModel;
|
||||||
|
protected $PaymentModeModel;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -39,6 +41,7 @@ class MasterController extends ResourceController
|
|||||||
$this->InsurersModel = new InsurersModel();
|
$this->InsurersModel = new InsurersModel();
|
||||||
$this->StaffModel = new StaffModel();
|
$this->StaffModel = new StaffModel();
|
||||||
$this->PartnerBrokerModel = new PartnerBrokerModel();
|
$this->PartnerBrokerModel = new PartnerBrokerModel();
|
||||||
|
$this->PaymentModeModel = new PaymentModeModel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,6 +129,8 @@ class MasterController extends ResourceController
|
|||||||
return $this->respond(['status' => 200,'message' => 'success','data' => $data]);
|
return $this->respond(['status' => 200,'message' => 'success','data' => $data]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Broker CRUD---------------------------------------------------------------------------
|
||||||
public function getAllBrokers()
|
public function getAllBrokers()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -134,6 +139,157 @@ class MasterController extends ResourceController
|
|||||||
return $this->respond(['status' => 200,'message' => 'success','data' => $data]);
|
return $this->respond(['status' => 200,'message' => 'success','data' => $data]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function createBroker()
|
||||||
|
{
|
||||||
|
$input = $this->request->getJSON(true);
|
||||||
|
|
||||||
|
if (empty($input['name'])) {
|
||||||
|
return $this->response->setJSON(['status' => 404, 'message' => 'Value is required']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'name' => $input['name'],
|
||||||
|
'is_active' => 1,
|
||||||
|
'created_by' => $input['created_by'] ?? null,
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->PartnerBrokerModel->insert($data);
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => 200,
|
||||||
|
'message' => 'Payment mode created successfully'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateBroker($id)
|
||||||
|
{
|
||||||
|
$input = $this->request->getJSON(true);
|
||||||
|
|
||||||
|
if (!$this->PartnerBrokerModel->find($id)) {
|
||||||
|
return $this->response->setJSON(['status' => 404, 'message' => 'Record not found']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'name' => $input['name'] ?? null,
|
||||||
|
'updated_by' => $input['updated_by'] ?? null,
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->PartnerBrokerModel->update($id, $data);
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => 200,
|
||||||
|
'message' => 'Payment mode updated successfully'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateBrokerStatus($id)
|
||||||
|
{
|
||||||
|
$input = $this->request->getJSON(true);
|
||||||
|
|
||||||
|
if (!isset($input['is_active'])) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => 404,
|
||||||
|
'message' => 'is_active field is required'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$record = $this->PartnerBrokerModel->find($id);
|
||||||
|
if (!$record) {
|
||||||
|
return $this->response->setJSON(['status' => 404, 'message' => 'Record not found']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->PartnerBrokerModel->update($id, [
|
||||||
|
'is_active' => $input['is_active'], // 1 or 0
|
||||||
|
'updated_by' => $input['updated_by'] ?? null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => 200,
|
||||||
|
'message' => 'Status updated successfully'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
//Payment Mode CRUD----------------------------------------------------------------------
|
||||||
|
public function getAllPaymentModelist()
|
||||||
|
{
|
||||||
|
$data = $this->PaymentModeModel->where('is_active', 1)->orderBy('id', 'DESC')->findAll();
|
||||||
|
|
||||||
|
return $this->response->setJSON(['status' => 200,'message' => 'success','data' => $data]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createPaymentMode()
|
||||||
|
{
|
||||||
|
$input = $this->request->getJSON(true);
|
||||||
|
|
||||||
|
if (empty($input['value'])) {
|
||||||
|
return $this->response->setJSON(['status' => 404, 'message' => 'Value is required']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'value' => $input['value'],
|
||||||
|
'is_active' => 1,
|
||||||
|
'created_by' => $input['created_by'] ?? null,
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->PaymentModeModel->insert($data);
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => 200,
|
||||||
|
'message' => 'Payment mode created successfully'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updatePaymentMode($id)
|
||||||
|
{
|
||||||
|
$input = $this->request->getJSON(true);
|
||||||
|
|
||||||
|
if (!$this->PaymentModeModel->find($id)) {
|
||||||
|
return $this->response->setJSON(['status' => 404, 'message' => 'Record not found']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'value' => $input['value'] ?? null,
|
||||||
|
'updated_by' => $input['updated_by'] ?? null,
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->PaymentModeModel->update($id, $data);
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => 200,
|
||||||
|
'message' => 'Payment mode updated successfully'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updatePaymentModeStatus($id)
|
||||||
|
{
|
||||||
|
$input = $this->request->getJSON(true);
|
||||||
|
|
||||||
|
if (!isset($input['is_active'])) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => 404,
|
||||||
|
'message' => 'is_active field is required'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$record = $this->PaymentModeModel->find($id);
|
||||||
|
if (!$record) {
|
||||||
|
return $this->response->setJSON(['status' => 404, 'message' => 'Record not found']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->PaymentModeModel->update($id, [
|
||||||
|
'is_active' => $input['is_active'], // 1 or 0
|
||||||
|
'updated_by' => $input['updated_by'] ?? null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'status' => 200,
|
||||||
|
'message' => 'Status updated successfully'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
//---------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
23
app/Models/PaymentModeModel.php
Normal file
23
app/Models/PaymentModeModel.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class PaymentModeModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'partner_payment_mode_master';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $returnType = 'array';
|
||||||
|
|
||||||
|
protected $allowedFields = [
|
||||||
|
'value',
|
||||||
|
'is_active',
|
||||||
|
'created_by',
|
||||||
|
'created_on',
|
||||||
|
'updated_by',
|
||||||
|
'updated_on'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $useTimestamps = false;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user