FIX_Helpdesk Issues and Endorsement xl changes for Report and duplicated Error Handle API Response in Sales Exec
This commit is contained in:
parent
4740765761
commit
c09629a86d
@ -145,25 +145,28 @@ $routes->group('api', ['filter' => 'appSignature'], function ($routes) {
|
||||
$routes->get("dashboard/productivityDashboard", "DashboardController::productivityDashboard");
|
||||
|
||||
//DASHBOARD Season 1 EXPORT EXCEL (ManagerDashboard - staffLevelPendingSummaryData)
|
||||
$routes->get("dashboard/downloadStaffPendingSummaryExcel", "ExcelExportController::downloadStaffPendingSummaryExcel");
|
||||
$routes->get("dashboard/downloadStaffPendingSummaryExcelByID", "ExcelExportController::downloadStaffPendingSummaryExcelByID");
|
||||
$routes->get("dashboard/downloadExcelStaffPendingSummary", "ExcelExportController::downloadExcelStaffPendingSummary");
|
||||
$routes->get("dashboard/downloadExcelStaffPendingSummaryByID", "ExcelExportController::downloadExcelStaffPendingSummaryByID");
|
||||
|
||||
//DASHBOARD Season 2 EXPORT EXCEL (businessDashboard)
|
||||
$routes->get("dashboard/downloadBrokerPoliciesExcel", "ExcelExportController::downloadBrokerPoliciesExcel");
|
||||
$routes->get("dashboard/downloadInsurerPoliciesExcel", "ExcelExportController::downloadInsurerPoliciesExcel");
|
||||
$routes->get("dashboard/downloadProductPoliciesExcel", "ExcelExportController::downloadProductPoliciesExcel");
|
||||
$routes->get("dashboard/downloadExcelBroker", "ExcelExportController::downloadBrokerPoliciesExcel");
|
||||
$routes->get("dashboard/downloadExcelInsurer", "ExcelExportController::downloadInsurerPoliciesExcel");
|
||||
$routes->get("dashboard/downloadExcelProduct", "ExcelExportController::downloadProductPoliciesExcel");
|
||||
|
||||
//DASHBOARD Season 3 EXPORT EXCEL (partnerDashboard)
|
||||
$routes->get("dashboard/downloadT50AgentPoliciesExcel", "ExcelExportController::downloadT50AgentPoliciesExcel"); // whole agent but top 50
|
||||
$routes->get("dashboard/downloadAgentMonthlyPoliciesExcel", "ExcelExportController::downloadAgentMonthlyPoliciesExcel"); // particular Agent
|
||||
$routes->get("dashboard/downloadLowPremiumAgentExcel", "ExcelExportController::downloadLowPremiumAgentExcel");
|
||||
$routes->get("dashboard/downloadAgentsWithoutPoliciesExcel", "ExcelExportController::downloadAgentsWithoutPoliciesExcel");
|
||||
$routes->get("dashboard/downloadExcelPerformingAgentsTop50", "ExcelExportController::downloadExcelPerformingAgentsTop50"); // PerformingAgents Top50
|
||||
$routes->get("dashboard/downloadExcelPerformingAgentsByID", "ExcelExportController::downloadExcelPerformingAgentsByID"); // PerformingAgents ParticularAgent
|
||||
$routes->get("dashboard/downloadExcelLowPremium", "ExcelExportController::downloadExcelLowPremium"); // NonPerforming Below50K
|
||||
$routes->get("dashboard/downloadExcelWithoutPolicies", "ExcelExportController::downloadExcelWithoutPolicies"); //NonPerforming NoBuiness
|
||||
|
||||
//DASHBOARD Season 4 EXPORT EXCEL AS ZIP (partnerDashboard - 3Excel in Zip Folder)
|
||||
$routes->get("dashboard/downloadExcelAsZIP", "ExcelExportController::downloadExcelAsZIP");
|
||||
|
||||
//DASHBOARD Season 5 EXPORT EXCEL (productivityDashboard)
|
||||
$routes->get("dashboard/downloadStaffAndProductPoliciesExcel", "ExcelExportController::downloadStaffAndProductPoliciesExcel");
|
||||
$routes->get("dashboard/downloadExcelStaffAndProduct", "ExcelExportController::downloadExcelStaffAndProduct");
|
||||
|
||||
//REPORT
|
||||
$routes->get('reports/endorsement-excel', 'ExcelExportController::downloadExcelEndorsement');
|
||||
|
||||
|
||||
|
||||
@ -212,18 +215,3 @@ $routes->get("processjob", "JobWorker::processJob");
|
||||
$routes->get('checkPolicyDoc', 'PolicyController::readFile');
|
||||
$routes->get('calculateCommission', 'PolicyController::calculateCommission');
|
||||
$routes->get('testPolicy', 'QuotationController::testPolicy');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -493,7 +493,7 @@ class DashboardController extends ResourceController
|
||||
|
||||
// Initialize the details array to ensure the final output is always structured.
|
||||
$message = "Partner Dashboard Data Retrieved Successfully";
|
||||
$details = [ 'monthlyPolicyCount' => [],'noPolicyTimeRange' => [],'below50tPremiumTimeRange' => []];
|
||||
$details = [ 'agentsPerformanceList' => [],'nonAgentsPerformanceList' => [],'nonAgentsPerformanceListPremium' => []];
|
||||
// 'agentNoPolicyLast10Days' => [],// 'agentBelow50tPremiumLast10Days' => [],
|
||||
|
||||
try {
|
||||
@ -501,7 +501,7 @@ class DashboardController extends ResourceController
|
||||
$date = $this->request->getGet('date');
|
||||
$date = $date ?? date('Y-m-d');
|
||||
|
||||
$data1 = $this->agentMonthlyPolicyCountandPremiumAmount($date, $manager_id, false);
|
||||
$data1 = $this->getDataPerformingAgents($date, $manager_id, false);
|
||||
|
||||
if (!empty($data1)) {
|
||||
|
||||
@ -513,9 +513,9 @@ class DashboardController extends ResourceController
|
||||
});
|
||||
}
|
||||
|
||||
$details['monthlyPolicyCount'] = $data1;
|
||||
$details['noPolicyTimeRange'] = $this->agentNoPolicyTimeRange($manager_id,$raw);
|
||||
$data2 = $this->getLowPremiumAgentData($manager_id,$raw);
|
||||
$details['agentsPerformanceList'] = $data1;
|
||||
$details['nonAgentsPerformanceList'] = $this->getDataNonAgentsPerformanceList($manager_id,$raw);
|
||||
$data2 = $this->getDataLowPremiumAgent($manager_id,$raw);
|
||||
if (!empty($data2)) {
|
||||
|
||||
$lastIndex2 = count(reset($data2)) - 1;
|
||||
@ -525,14 +525,14 @@ class DashboardController extends ResourceController
|
||||
return (float)$rowD[$lastIndex2] <=> (float)$rowC[$lastIndex2];
|
||||
});
|
||||
}
|
||||
$details['below50tPremiumTimeRange'] = $data2;
|
||||
$details['nonAgentsPerformanceListPremium'] = $data2;
|
||||
|
||||
|
||||
// $details['monthlyPremiumAmount'] = $this->agentMonthlyPremiumAmount($date,$manager_id,$raw);
|
||||
// $details['agentsPerformanceListPremium'] = $this->agentMonthlyPremiumAmount($date,$manager_id,$raw);
|
||||
|
||||
$ref['monthlyPolicyCountAndPremiumAmount_total_records'] = is_array($details['monthlyPolicyCount']) ? count($details['monthlyPolicyCount']) : 0;
|
||||
$ref['noPolicyTimeRange_total_records'] = is_array($details['noPolicyTimeRange']) ? count($details['noPolicyTimeRange']) : 0;
|
||||
$ref['below50tPremiumTimeRange_total_records'] = is_array($details['below50tPremiumTimeRange']) ? count($details['below50tPremiumTimeRange']) : 0;
|
||||
$ref['agentsPerformanceList_monthlyPolicyCountAndPremiumAmount_totalRecords'] = is_array($details['agentsPerformanceList']) ? count($details['agentsPerformanceList']) : 0;
|
||||
$ref['nonAgentsPerformanceList_noPolicyTimeRange_totalRecords'] = is_array($details['nonAgentsPerformanceList']) ? count($details['nonAgentsPerformanceList']) : 0;
|
||||
$ref['nonAgentsPerformanceListPremium_below50tPremiumTimeRange_totalRecords'] = is_array($details['nonAgentsPerformanceListPremium']) ? count($details['nonAgentsPerformanceListPremium']) : 0;
|
||||
|
||||
|
||||
// 2. Check for overall emptiness (optional, but good practice)
|
||||
@ -826,7 +826,7 @@ class DashboardController extends ResourceController
|
||||
}
|
||||
|
||||
//Step 2
|
||||
public function agentMonthlyPolicyCountandPremiumAmount($customDate,$manager_id, $raw){
|
||||
public function getDataPerformingAgents($customDate,$manager_id, $raw){
|
||||
|
||||
|
||||
$builder = $this->db->table('partner_policy pp');
|
||||
@ -890,7 +890,7 @@ class DashboardController extends ResourceController
|
||||
// }
|
||||
|
||||
//Step 3 no buiness
|
||||
public function agentNoPolicyTimeRange($managerId, $raw){
|
||||
public function getDataNonAgentsPerformanceList($managerId, $raw){
|
||||
|
||||
// $builder = $this->db->table('partner_agent pa');
|
||||
// $builder->select('
|
||||
@ -959,8 +959,8 @@ class DashboardController extends ResourceController
|
||||
}
|
||||
|
||||
//Step 4
|
||||
//any changed in this query also change in do the same in ExcelExportController - getLowPremiumAgentData
|
||||
public function getLowPremiumAgentData($manager_id, $raw){
|
||||
//any changed in this query also change in do the same in ExcelExportController - getDataLowPremiumAgent
|
||||
public function getDataLowPremiumAgent($manager_id, $raw){
|
||||
|
||||
$builder = $this->db->table('partner_policy pp');
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -75,7 +75,18 @@ class SalesExecutive extends ResourceController
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => []], 200);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);
|
||||
// return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);
|
||||
$message = $e->getMessage();
|
||||
if (strpos($message, '1062') !== false || strpos($message, 'Duplicate entry') !== false) {
|
||||
if (strpos($message, 'sales_executive_unique_mobile') !== false) {
|
||||
$message = 'Mobile number already exists';
|
||||
} elseif (strpos($message, 'sales_executive_email') !== false) {
|
||||
$message = 'Email already exists';
|
||||
} else {
|
||||
$message = 'Duplicate record found';
|
||||
}
|
||||
}
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $message], 500);
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,7 +121,18 @@ class SalesExecutive extends ResourceController
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => []], 200);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);
|
||||
// return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);
|
||||
$message = $e->getMessage();
|
||||
if (strpos($message, '1062') !== false || strpos($message, 'Duplicate entry') !== false) {
|
||||
if (strpos($message, 'sales_executive_unique_mobile') !== false) {
|
||||
$message = 'Mobile number already exists';
|
||||
} elseif (strpos($message, 'sales_executive_email') !== false) {
|
||||
$message = 'Email already exists';
|
||||
} else {
|
||||
$message = 'Duplicate record found';
|
||||
}
|
||||
}
|
||||
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $message], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user