diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index b479f5ff..774d3f60 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -313,14 +313,8 @@ class EmployeeController extends AdminController 'c.short_name', 'cb.branch_name', 'cp.id as client_policy_id', - '(SELECT COUNT(*) - FROM employees e - JOIN employee_polices ep ON e.id = ep.employee_id - WHERE e.file_id = files.id AND ep.client_policy_id = files.policy_id) as employee_count', - '(SELECT SUM(ep.rata_premimum) + SUM(ep.gst) - FROM employees e - JOIN employee_polices ep ON e.id = ep.employee_id - WHERE e.file_id = files.id AND ep.client_policy_id = files.policy_id) as total', + '"0" as employee_count', + '"0" as total', 'policy_type.policy_type' , 'cp.policy_no' , ]) diff --git a/app/Helpers/MailHelper.php b/app/Helpers/MailHelper.php index 91e955b0..c55c2796 100755 --- a/app/Helpers/MailHelper.php +++ b/app/Helpers/MailHelper.php @@ -194,6 +194,11 @@ class MailHelper } else { $bcc = ''; } + if(isset($params['cc'])){ + $cc = $params['cc']; + }else{ + $cc = ''; + } $from_address = getenv('email.fromEmail'); @@ -255,7 +260,6 @@ class MailHelper } $apiResponse = json_decode($response, true); - if ($httpCode === 200) { return json_encode(['status' => 'success', 'code' => 200, 'message' => 'Email Sent Successfully...', 'data' => $emaill], 200); } else { @@ -289,116 +293,141 @@ class MailHelper } public static function send_email($params) - { - $myLogger = \Config\Services::mylogger(); +{ + $myLogger = \Config\Services::mylogger(); + + $emaill = $params['mail']; + $subject = $params['subject']; + $message = $params['message']; + $attachments = isset($params['attachments']) ? $params['attachments'] : []; + $common = isset($params['common']) ? $params['common'] : ''; + $bcc = isset($params['bcc']) ? $params['bcc'] : ''; + $cc = isset($params['cc']) ? $params['cc'] : ''; + + $from_address = getenv('email.fromEmail'); + try { + $curl = curl_init(); - $emaill = $params['mail']; - $subject = $params['subject']; - $message = $params['message']; - $attachments = isset($params['attachments']) ? $params['attachments'] : []; - $common = isset($params['common']) ? $params['common'] : ''; - - $from_address = getenv('email.fromEmail'); - try { - $curl = curl_init(); - - $postData = [ - 'from' => [ - 'address' => $from_address - ], - 'to' => [ - [ - 'email_address' => [ - 'address' => $emaill - ] + $postData = [ + 'from' => [ + 'address' => $from_address + ], + 'to' => [ + [ + 'email_address' => [ + 'address' => $emaill ] - ], - 'subject' => $subject, - 'htmlbody' => $message - ]; + ] + ], + 'subject' => $subject, + 'htmlbody' => $message + ]; - // Handle attachments - if (!empty($attachments)) { - $postData['attachments'] = []; - foreach ($attachments as $attachment) { - if (isset($attachment['filePath']) && file_exists($attachment['filePath'])) { - // Determine MIME type dynamically - $fileMimeType = mime_content_type($attachment['filePath']); - - $postData['attachments'][] = [ - 'content' => base64_encode(file_get_contents($attachment['filePath'])), - 'name' => $attachment['fileName'], - 'mime_type' => $fileMimeType, // Add mime_type field - ]; - } + // Add CC recipients if provided + if (!empty($cc)) { + $postData['cc'] = []; + // Handle both string and array inputs for CC + $ccEmails = is_array($cc) ? $cc : [$cc]; + foreach ($ccEmails as $ccEmail) { + $postData['cc'][] = [ + 'email_address' => [ + 'address' => $ccEmail + ] + ]; + } + } + + // Add BCC recipients if provided + if (!empty($bcc)) { + $postData['bcc'] = []; + // Handle both string and array inputs for BCC + $bccEmails = is_array($bcc) ? $bcc : [$bcc]; + foreach ($bccEmails as $bccEmail) { + $postData['bcc'][] = [ + 'email_address' => [ + 'address' => $bccEmail + ] + ]; + } + } + + // Handle attachments + if (!empty($attachments)) { + $postData['attachments'] = []; + foreach ($attachments as $attachment) { + if (isset($attachment['filePath']) && file_exists($attachment['filePath'])) { + // Determine MIME type dynamically + $fileMimeType = mime_content_type($attachment['filePath']); + + $postData['attachments'][] = [ + 'content' => base64_encode(file_get_contents($attachment['filePath'])), + 'name' => $attachment['fileName'], + 'mime_type' => $fileMimeType, + ]; } } - + } - curl_setopt_array($curl, [ - CURLOPT_URL => "https://api.zeptomail.in/v1.1/email", - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => "", - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 30, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => "POST", - CURLOPT_POSTFIELDS => json_encode($postData), - CURLOPT_HTTPHEADER => [ - "accept: application/json", - "authorization: Zoho-enczapikey " . getenv('ZEPTO_API_KEY'), - "cache-control: no-cache", - "content-type: application/json", - ], - ]); + curl_setopt_array($curl, [ + CURLOPT_URL => "https://api.zeptomail.in/v1.1/email", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "POST", + CURLOPT_POSTFIELDS => json_encode($postData), + CURLOPT_HTTPHEADER => [ + "accept: application/json", + "authorization: Zoho-enczapikey " . getenv('ZEPTO_API_KEY'), + "cache-control: no-cache", + "content-type: application/json", + ], + ]); - $mail_result = curl_exec($curl); - $err = curl_error($curl); - curl_close($curl); - // log_message('error','inside mail helper'); - // log_message('error', $response.' error->'.$err);die(); - $res['params'] = $params; - $MailDataHelper = new GmailResponseHandler(); - $apiResponse = json_decode($mail_result, true); - $res['zepto_api'] = $apiResponse; - if (isset($apiResponse['error'])) { - $response = $res; - $MailDataHelper->receive_and_distribute_param_to_functions($response); - return json_encode([ - 'status' => 'failed', - 'code' => 404, - 'message' => 'Email Sent Failed...' . $emaill, - 'data' => $res - ], 404); - } + $mail_result = curl_exec($curl); + $err = curl_error($curl); + curl_close($curl); - // $apiResponse = json_decode($response, true); - - // Check if request_id exists in response (indicates success) - if (isset($apiResponse['data'])) { - $response = $res; - $MailDataHelper->receive_and_distribute_param_to_functions($response); - return json_encode([ - 'status' => 'success', - 'code' => 200, - 'message' => 'Email Sent Successfully...' . $emaill, - 'data' => $res - ], 200); - } - - } catch (\Exception $e) { - $msg['error'] = $e->getMessage(); - $msg['params'] = $params; + $res['params'] = $params; + $MailDataHelper = new GmailResponseHandler(); + $apiResponse = json_decode($mail_result, true); + $res['zepto_api'] = $apiResponse; + + if (isset($apiResponse['error'])) { $response = $res; $MailDataHelper->receive_and_distribute_param_to_functions($response); return json_encode([ 'status' => 'failed', - 'code' => 500, - 'data' => $msg - ], 500); + 'code' => 404, + 'message' => 'Email Sent Failed...' . $emaill, + 'data' => $res + ], 404); } - } + if (isset($apiResponse['data'])) { + $response = $res; + $MailDataHelper->receive_and_distribute_param_to_functions($response); + return json_encode([ + 'status' => 'success', + 'code' => 200, + 'message' => 'Email Sent Successfully...' . $emaill, + 'data' => $res + ], 200); + } + + } catch (\Exception $e) { + $msg['error'] = $e->getMessage(); + $msg['params'] = $params; + $response = $res; + $MailDataHelper->receive_and_distribute_param_to_functions($response); + return json_encode([ + 'status' => 'failed', + 'code' => 500, + 'data' => $msg + ], 500); + } +} public static function bulk_mail(array $mails = []) { $model = new JobModel(); diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 6a8d590d..1d79f36d 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -226,6 +226,7 @@ class EmployeePolicyModel extends Model public function getInceptionEmployeeDataForExportExcel($ref_data, $return_type = 0) { + $client_id = $ref_data['client_id']; $client_policy_id = $ref_data['client_policy_id']; $client_branch_id = $ref_data['client_branch_id']; $insurer_or_tpa = $ref_data['insurer_or_tpa']; @@ -318,6 +319,9 @@ class EmployeePolicyModel extends Model WHERE batch_files.event_type = '{$event}' AND batch_files.actions = 'export' AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}' + AND batch_files.client_policy_id = '{$client_policy_id}' + AND batch_files.client_policy_id = '{$client_id}' + ) as batch_data ON employee_polices.id = batch_data.emp_policy_id WHERE employee_polices.client_policy_id = '{$client_policy_id}' AND (employee_polices.{$id} IS NULL OR employee_polices.{$id} = '') diff --git a/app/Views/insurer_list.php b/app/Views/insurer_list.php index 933ed3b4..150f9be2 100755 --- a/app/Views/insurer_list.php +++ b/app/Views/insurer_list.php @@ -1,70 +1,31 @@
diff --git a/app/Views/insurer_statement_list.php b/app/Views/insurer_statement_list.php index 2772907a..83dee914 100644 --- a/app/Views/insurer_statement_list.php +++ b/app/Views/insurer_statement_list.php @@ -108,75 +108,32 @@ table.dataTable tbody td { color: gray; } -custom-dropdown-menu { + .custom-dropdown-menu { display: none; - position: fixed; + position: absolute; background-color: #ffffff !important; - border: 1px solid rgba(0,0,0,.15); + border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 0.25rem; padding: 0.5rem 0; min-width: 10rem; z-index: 9999; - box-shadow: 0 0 10px rgba(0,0,0,0.1); + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } .custom-dropdown-menu .dropdown-item { display: block !important; width: 100% !important; padding: 0.5rem 1rem !important; - clear: both !important; - font-weight: 400 !important; color: #212529 !important; - text-align: inherit !important; - white-space: nowrap !important; - background-color: transparent !important; - border: 0 !important; text-decoration: none !important; - position: relative !important; + background-color: transparent !important; } .custom-dropdown-menu .dropdown-item:hover { background-color: #f8f9fa !important; color: #16181b !important; cursor: pointer !important; -} - -.custom-dropdown-menu .dropdown-item i { - margin-right: 8px !important; - vertical-align: middle !important; -} - -.table tbody tr { - cursor: pointer; -} - -/* Ensure the dropdown menu has a solid background */ -.custom-dropdown-menu::before { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: #ffffff; - z-index: -1; -} - -/* Add a subtle backdrop effect */ -.custom-dropdown-menu::after { - content: ''; - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: rgba(0,0,0,0.05); - z-index: -2; - pointer-events: none; -} - - - +}
diff --git a/app/Views/kyc_list.php b/app/Views/kyc_list.php index a28b2dfe..e6c0870f 100755 --- a/app/Views/kyc_list.php +++ b/app/Views/kyc_list.php @@ -1,70 +1,31 @@
diff --git a/app/Views/leads_list.php b/app/Views/leads_list.php index 78665e91..ddf4d238 100644 --- a/app/Views/leads_list.php +++ b/app/Views/leads_list.php @@ -37,72 +37,33 @@ table.dataTable tbody td { margin-bottom: 10px; } -custom-dropdown-menu { + +.custom-dropdown-menu { display: none; - position: fixed; + position: absolute; background-color: #ffffff !important; - border: 1px solid rgba(0,0,0,.15); + border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 0.25rem; padding: 0.5rem 0; min-width: 10rem; z-index: 9999; - box-shadow: 0 0 10px rgba(0,0,0,0.1); + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } .custom-dropdown-menu .dropdown-item { display: block !important; width: 100% !important; padding: 0.5rem 1rem !important; - clear: both !important; - font-weight: 400 !important; color: #212529 !important; - text-align: inherit !important; - white-space: nowrap !important; - background-color: transparent !important; - border: 0 !important; text-decoration: none !important; - position: relative !important; + background-color: transparent !important; } .custom-dropdown-menu .dropdown-item:hover { background-color: #f8f9fa !important; color: #16181b !important; cursor: pointer !important; -} - -.custom-dropdown-menu .dropdown-item i { - margin-right: 8px !important; - vertical-align: middle !important; -} - -.table tbody tr { - cursor: pointer; -} - -/* Ensure the dropdown menu has a solid background */ -.custom-dropdown-menu::before { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: #ffffff; - z-index: -1; -} - -/* Add a subtle backdrop effect */ -.custom-dropdown-menu::after { - content: ''; - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: rgba(0,0,0,0.05); - z-index: -2; - pointer-events: none; -} +} diff --git a/app/Views/policy_transaction_inception_list.php b/app/Views/policy_transaction_inception_list.php index 80f9fe62..0db12415 100644 --- a/app/Views/policy_transaction_inception_list.php +++ b/app/Views/policy_transaction_inception_list.php @@ -45,73 +45,32 @@ table.dataTable tbody td { .addbtnStyle{ margin-left: 20px !important; } -custom-dropdown-menu { +.custom-dropdown-menu { display: none; - position: fixed; + position: absolute; background-color: #ffffff !important; - border: 1px solid rgba(0,0,0,.15); + border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 0.25rem; padding: 0.5rem 0; min-width: 10rem; z-index: 9999; - box-shadow: 0 0 10px rgba(0,0,0,0.1); + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } .custom-dropdown-menu .dropdown-item { display: block !important; width: 100% !important; padding: 0.5rem 1rem !important; - clear: both !important; - font-weight: 400 !important; color: #212529 !important; - text-align: inherit !important; - white-space: nowrap !important; - background-color: transparent !important; - border: 0 !important; text-decoration: none !important; - position: relative !important; + background-color: transparent !important; } .custom-dropdown-menu .dropdown-item:hover { background-color: #f8f9fa !important; color: #16181b !important; cursor: pointer !important; -} - -.custom-dropdown-menu .dropdown-item i { - margin-right: 8px !important; - vertical-align: middle !important; -} - -.table tbody tr { - cursor: pointer; -} - -/* Ensure the dropdown menu has a solid background */ -.custom-dropdown-menu::before { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: #ffffff; - z-index: -1; -} - -/* Add a subtle backdrop effect */ -.custom-dropdown-menu::after { - content: ''; - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: rgba(0,0,0,0.05); - z-index: -2; - pointer-events: none; -} - +} +}