CHANGE_THE_ALERT_MESSAGE
This commit is contained in:
parent
283dc369df
commit
d78343ace3
@ -721,21 +721,43 @@ class DashboardController extends AdminController
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No template found', 'message2' => 'Failed'], 200);
|
||||
}
|
||||
|
||||
|
||||
$emp_data = $this->employeePolicyModel->getEmployeePolicyForEcard($policy_id);
|
||||
if (count($emp_data) == 0) {
|
||||
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No employees found', 'message2' => 'Failed'], 200);
|
||||
}
|
||||
$ids = array_column($emp_data, 'id');
|
||||
|
||||
|
||||
$client_policy_data = $this->clientPolicyModel->where('id', $policy_id)->first();
|
||||
$sendMail = false;
|
||||
|
||||
if ($client_policy_data['policy_type_id'] == 3 && $client_policy_data['is_addon'] == 3) {
|
||||
$sendMail = true;
|
||||
} else {
|
||||
$relationships = array_column($emp_data, 'relationship');
|
||||
if (in_array('Self', $relationships)) {
|
||||
$sendMail = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($sendMail) {
|
||||
$message = 'Mail Queued';
|
||||
Jobs::addJob(['job_name' => 'sendMailForDownloadingECard','payload' => ['ids' => $ids,'client_policy_id' => $policy_id]]);
|
||||
$this->myLogger->logme('error', 'sendManualEcard - Mail Queued');
|
||||
} else {
|
||||
$message = 'E-card has already been sent to those employees.';
|
||||
$this->myLogger->logme('error', 'sendManualEcard - E-card has already been sent to those employees.');
|
||||
}
|
||||
|
||||
// print_r(($ids)); die;
|
||||
// print_r($this->clientPolicyModel->getLastQuery()); die;
|
||||
// $this->myLogger->logme('error', "Policy details fetched: " . json_encode($client_policy_data));
|
||||
Jobs::addJob(['job_name' => 'sendMailForDownloadingECard', 'payload' => ['ids' => $ids, 'client_policy_id' => $policy_id]]);
|
||||
// Jobs::addJob(['job_name' => 'sendMailForDownloadingECard', 'payload' => ['ids' => $ids, 'client_policy_id' => $policy_id]]);
|
||||
// $empEmpDataServiceController = new EmpDataServiceController();
|
||||
// $empEmpDataServiceController->sendMailForDownloadingECard($ids);
|
||||
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Mail Queued'], 200);
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => $message], 200);
|
||||
}
|
||||
|
||||
public function data_construct_for_bds($data)
|
||||
|
||||
@ -374,7 +374,8 @@ class EmployeePolicyModel extends Model
|
||||
public function getEmployeePolicyForEcard($policy_id = 0)
|
||||
{
|
||||
$result = $this->select([
|
||||
'employee_polices.id'
|
||||
'employee_polices.id',
|
||||
'emp.relationship',
|
||||
])
|
||||
->join('employees emp', 'employee_polices.employee_id = emp.id');
|
||||
if ($policy_id !=0 && !empty($policy_id)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user