Merge branch 'main' of bitbucket.org:jubilian/nhance_partner_be
This commit is contained in:
commit
68ede6f3dd
@ -50,6 +50,7 @@ class EnquiryController extends ResourceController
|
|||||||
$enquiry_status = $this->request->getGet('enquiry_status');
|
$enquiry_status = $this->request->getGet('enquiry_status');
|
||||||
|
|
||||||
$only_policy_data = $this->request->getGet('only_policy_data') ?? false;
|
$only_policy_data = $this->request->getGet('only_policy_data') ?? false;
|
||||||
|
$show_policy_report = $this->request->getGet('show_policy_report') ?? 'All';
|
||||||
|
|
||||||
|
|
||||||
// Date filter handling
|
// Date filter handling
|
||||||
@ -69,15 +70,15 @@ class EnquiryController extends ResourceController
|
|||||||
|
|
||||||
|
|
||||||
if (!empty($staff_id) && !empty($manager_id)) {
|
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 ,$enquiry_status);
|
$data = $this->enquiryModel->getEnquiry('STAFF&MANAGER', [$staff_id,$manager_id], $only_policy_data, $show_policy_report, $from_date, $to_date, $status ,$enquiry_status);
|
||||||
} elseif (!empty($agent_id)) {
|
} elseif (!empty($agent_id)) {
|
||||||
$data = $this->enquiryModel->getEnquiry('AGENT', $agent_id, $only_policy_data, $from_date, $to_date, $status ,$enquiry_status);
|
$data = $this->enquiryModel->getEnquiry('AGENT', $agent_id, $only_policy_data, $show_policy_report, $from_date, $to_date, $status ,$enquiry_status);
|
||||||
} elseif (!empty($staff_id)) {
|
} elseif (!empty($staff_id)) {
|
||||||
$data = $this->enquiryModel->getEnquiry('STAFF', $staff_id, $only_policy_data, $from_date, $to_date, $status ,$enquiry_status);
|
$data = $this->enquiryModel->getEnquiry('STAFF', $staff_id, $only_policy_data, $show_policy_report, $from_date, $to_date, $status ,$enquiry_status);
|
||||||
} elseif (!empty($enquiry_id)) {
|
} elseif (!empty($enquiry_id)) {
|
||||||
$data = $this->enquiryModel->getEnquiry('ENQUIRY',$enquiry_id, $only_policy_data);
|
$data = $this->enquiryModel->getEnquiry('ENQUIRY',$enquiry_id, $only_policy_data, $show_policy_report);
|
||||||
} elseif (!empty($manager_id)) {
|
} elseif (!empty($manager_id)) {
|
||||||
$data = $this->enquiryModel->getEnquiry('MANAGER',$manager_id, $only_policy_data, $from_date, $to_date, $status ,$enquiry_status);
|
$data = $this->enquiryModel->getEnquiry('MANAGER',$manager_id, $only_policy_data, $show_policy_report, $from_date, $to_date, $status ,$enquiry_status);
|
||||||
}elseif (!empty($handler_id)) {
|
}elseif (!empty($handler_id)) {
|
||||||
|
|
||||||
$staffData = $this->db->table('partner_staff ps')
|
$staffData = $this->db->table('partner_staff ps')
|
||||||
@ -90,7 +91,7 @@ class EnquiryController extends ResourceController
|
|||||||
->get()->getResultArray();
|
->get()->getResultArray();
|
||||||
$staffIds = array_column($staffData, 'id');
|
$staffIds = array_column($staffData, 'id');
|
||||||
|
|
||||||
$data = $this->enquiryModel->getEnquiry('HANDLER',$staffIds, $only_policy_data, $from_date, $to_date, $status ,$enquiry_status);
|
$data = $this->enquiryModel->getEnquiry('HANDLER',$staffIds, $only_policy_data, $show_policy_report, $from_date, $to_date, $status ,$enquiry_status);
|
||||||
} else {
|
} else {
|
||||||
$data = $this->enquiryModel->getEnquiry('ALL');
|
$data = $this->enquiryModel->getEnquiry('ALL');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ use App\Models\StaffModel;
|
|||||||
use App\Models\PartnerBrokerModel;
|
use App\Models\PartnerBrokerModel;
|
||||||
use App\Models\PaymentModeModel;
|
use App\Models\PaymentModeModel;
|
||||||
use App\Models\PartnerPosModel;
|
use App\Models\PartnerPosModel;
|
||||||
|
use App\Models\PolicyModel;
|
||||||
|
|
||||||
|
|
||||||
class MasterController extends ResourceController
|
class MasterController extends ResourceController
|
||||||
@ -30,6 +30,7 @@ class MasterController extends ResourceController
|
|||||||
protected $PartnerBrokerModel;
|
protected $PartnerBrokerModel;
|
||||||
protected $PaymentModeModel;
|
protected $PaymentModeModel;
|
||||||
protected $PartnerPosModel;
|
protected $PartnerPosModel;
|
||||||
|
protected $PolicyModel;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -45,6 +46,7 @@ class MasterController extends ResourceController
|
|||||||
$this->PartnerBrokerModel = new PartnerBrokerModel();
|
$this->PartnerBrokerModel = new PartnerBrokerModel();
|
||||||
$this->PaymentModeModel = new PaymentModeModel();
|
$this->PaymentModeModel = new PaymentModeModel();
|
||||||
$this->PartnerPosModel = new PartnerPosModel();
|
$this->PartnerPosModel = new PartnerPosModel();
|
||||||
|
$this->PolicyModel = new PolicyModel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +128,16 @@ class MasterController extends ResourceController
|
|||||||
//Vehicle type CRUD---------------------------------------------------------------------
|
//Vehicle type CRUD---------------------------------------------------------------------
|
||||||
public function getVehicleTypeMaster()
|
public function getVehicleTypeMaster()
|
||||||
{
|
{
|
||||||
$data = $this->VehicleTypeMasterModel->findAll();
|
$valueFor = $this->request->getGet('value_for');
|
||||||
|
|
||||||
|
if(isset($valueFor) && $valueFor == 'dropdown')
|
||||||
|
{
|
||||||
|
$isActive = [1];
|
||||||
|
}else{
|
||||||
|
$isActive = [0,1];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $this->VehicleTypeMasterModel->whereIn('is_active',$isActive)->findAll();
|
||||||
|
|
||||||
if (!$data) {
|
if (!$data) {
|
||||||
return $this->failNotFound('No data found');
|
return $this->failNotFound('No data found');
|
||||||
@ -594,6 +605,10 @@ class MasterController extends ResourceController
|
|||||||
$tableName = $this->request->getGet('table_name');
|
$tableName = $this->request->getGet('table_name');
|
||||||
$pk = $this->request->getGet('pk');
|
$pk = $this->request->getGet('pk');
|
||||||
|
|
||||||
|
$policy = $this->PolicyModel->where('enquiry_id',$pk)->first();
|
||||||
|
|
||||||
|
$pk = $policy['id'];
|
||||||
|
|
||||||
if (!$tableName || !$pk) {
|
if (!$tableName || !$pk) {
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
|
|||||||
@ -21,6 +21,17 @@ class PolicyReportController extends Controller
|
|||||||
$toDate = $this->request->getGet('to_date');
|
$toDate = $this->request->getGet('to_date');
|
||||||
$fromDate = DateTime::createFromFormat('d-m-Y', $fromDate)->format('Y-m-d 00:00:00');
|
$fromDate = DateTime::createFromFormat('d-m-Y', $fromDate)->format('Y-m-d 00:00:00');
|
||||||
$toDate = DateTime::createFromFormat('d-m-Y', $toDate)->format('Y-m-d 23:59:59');
|
$toDate = DateTime::createFromFormat('d-m-Y', $toDate)->format('Y-m-d 23:59:59');
|
||||||
|
$show_policy_report = $this->request->getGet('show_policy_report') ?? 'All';
|
||||||
|
|
||||||
|
if ($show_policy_report === 'Verified') {
|
||||||
|
$statusValues = [1];
|
||||||
|
} elseif ($show_policy_report === 'Not Verified') {
|
||||||
|
$statusValues = [0];
|
||||||
|
} else {
|
||||||
|
$statusValues = [0, 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!$managerId || !$fromDate || !$toDate) {
|
if (!$managerId || !$fromDate || !$toDate) {
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
@ -189,7 +200,14 @@ class PolicyReportController extends Controller
|
|||||||
AND pp.created_on BETWEEN ? AND ?
|
AND pp.created_on BETWEEN ? AND ?
|
||||||
AND pe.manager_id = ?";
|
AND pe.manager_id = ?";
|
||||||
|
|
||||||
$bindings = [$fromDate, $toDate, $managerId];
|
$bindings = [$fromDate, $toDate, $managerId ];
|
||||||
|
|
||||||
|
$whereIn = implode(',', array_fill(0, count($statusValues), '?'));
|
||||||
|
|
||||||
|
if (!empty($statusValues)) {
|
||||||
|
$sql .= " AND pp.is_data_accuracy_checked IN ($whereIn)";
|
||||||
|
$bindings = array_merge($bindings, $statusValues);
|
||||||
|
}
|
||||||
|
|
||||||
$search = $this->request->getGet('search');
|
$search = $this->request->getGet('search');
|
||||||
|
|
||||||
@ -228,6 +246,8 @@ class PolicyReportController extends Controller
|
|||||||
|
|
||||||
$data = $query->getResultArray();
|
$data = $query->getResultArray();
|
||||||
|
|
||||||
|
// dd($whereIn, $bindings,$query,$data);
|
||||||
|
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
// EXCEL GENERATION
|
// EXCEL GENERATION
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
@ -252,6 +272,8 @@ class PolicyReportController extends Controller
|
|||||||
'PARTNER NAME',
|
'PARTNER NAME',
|
||||||
'BOOKING REF NO',
|
'BOOKING REF NO',
|
||||||
'INSURED DATE',
|
'INSURED DATE',
|
||||||
|
'INSURER',
|
||||||
|
'PLAN TYPE',
|
||||||
'POLICY NO',
|
'POLICY NO',
|
||||||
'INSURED NAME',
|
'INSURED NAME',
|
||||||
'REG NO',
|
'REG NO',
|
||||||
@ -299,6 +321,8 @@ class PolicyReportController extends Controller
|
|||||||
$d['partner_name'],
|
$d['partner_name'],
|
||||||
$d['booking_ref_no'],
|
$d['booking_ref_no'],
|
||||||
$d['issued_date'],
|
$d['issued_date'],
|
||||||
|
$d['insurer'],
|
||||||
|
$d['plan_type'],
|
||||||
$d['policy_number'],
|
$d['policy_number'],
|
||||||
$d['insured_name'],
|
$d['insured_name'],
|
||||||
$d['reg_no'],
|
$d['reg_no'],
|
||||||
|
|||||||
@ -40,7 +40,7 @@ class EnquiryModel extends Model
|
|||||||
protected $updatedField = 'updated_on';
|
protected $updatedField = 'updated_on';
|
||||||
|
|
||||||
|
|
||||||
public function getEnquiry($getBy = null , $Id = null , $only_policy_data = false, $from_date = null, $to_date = null , $status = null , $enquiry_status = null)
|
public function getEnquiry($getBy = null , $Id = null , $only_policy_data = false, $show_policy_report = 'All', $from_date = null, $to_date = null , $status = null , $enquiry_status = null)
|
||||||
{
|
{
|
||||||
$data = $this->select('partner_enquiry.*, partner_enquiry.name as insured_name,
|
$data = $this->select('partner_enquiry.*, partner_enquiry.name as insured_name,
|
||||||
VT.vehicle_type as vehicle_type,
|
VT.vehicle_type as vehicle_type,
|
||||||
@ -88,11 +88,21 @@ class EnquiryModel extends Model
|
|||||||
|
|
||||||
|
|
||||||
if($only_policy_data){
|
if($only_policy_data){
|
||||||
|
|
||||||
$data->where('P.id IS NOT NULL');
|
$data->where('P.id IS NOT NULL');
|
||||||
|
|
||||||
if($from_date != null){
|
if($from_date != null){
|
||||||
$data->where("P.created_on >=", $from_date)
|
$data->where("P.created_on >=", $from_date)
|
||||||
->where("P.created_on <=", $to_date);
|
->where("P.created_on <=", $to_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($show_policy_report == 'Verified')
|
||||||
|
{
|
||||||
|
$data->where("P.is_data_accuracy_checked", "1");
|
||||||
|
}else if($show_policy_report == 'Not Verified')
|
||||||
|
{
|
||||||
|
$data->where("P.is_data_accuracy_checked", "0");
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
if($from_date != null){
|
if($from_date != null){
|
||||||
$data->where("partner_enquiry.created_on >=", $from_date)
|
$data->where("partner_enquiry.created_on >=", $from_date)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user