CHANGE_ENROLLMENT_STATUS_AND_REMINDER_MAIL : AADHAVAN
This commit is contained in:
parent
05132a2a9d
commit
f6882f9b2f
@ -138,7 +138,7 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("upload", "EmployeeController::employeesUplodWithEvents");
|
||||
$routes->get("excel_error/(:any)", "EmployeeController::getExcelFileErrors/$1");
|
||||
$routes->get("endorsement-list", "EmployeeController::endorsementList");
|
||||
$routes->get("enrollment-list", "EmployeeController::enrollmentClientList");
|
||||
$routes->match(['get','post'],'enrollment-list','EmployeeController::enrollmentClientList');
|
||||
$routes->get("empby_client_clientbranch/(:any)/(:any)", "EmployeeController::empby_client_clientbranch/$1/$2");
|
||||
$routes->get("truncate/(:any)", "EmployeeController::truncateFileData/$1");
|
||||
});
|
||||
@ -270,6 +270,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||
$routes->cli('cli/processjobs', 'JobWorker::processJobs');
|
||||
$routes->cli('cli/enrollment_status', 'JobWorker::enrollment_status');
|
||||
$routes->get("processjob", "JobWorker::processJob");
|
||||
|
||||
|
||||
|
||||
@ -729,7 +729,7 @@ class ClientController extends AdminController
|
||||
$base_policy = $this->request->getPost('base_policy');
|
||||
|
||||
|
||||
$insurerValue = (string) $this->request->getPost('insurer');
|
||||
$insurerValue = (string) $this->request->getPost('insurer');
|
||||
list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
|
||||
|
||||
|
||||
@ -814,8 +814,17 @@ class ClientController extends AdminController
|
||||
|
||||
|
||||
$data['policy_no'] = $this->request->getPost('policy_no');
|
||||
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
|
||||
if($data['inception_type'] == 2){
|
||||
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['reminder_date'] = change_date_format($this->request->getPost('reminder_date'), 'd-m-Y', 'Y-m-d');
|
||||
|
||||
}else{
|
||||
$data['policy_start_date'] = null;
|
||||
$data['policy_end_date'] = null;
|
||||
$data['reminder_date'] = null;
|
||||
}
|
||||
|
||||
$data['created_by'] = get_session_userid();
|
||||
|
||||
$insert = $this->clientPolicyModel->insert($data);
|
||||
@ -851,8 +860,8 @@ class ClientController extends AdminController
|
||||
$data['tpa_id'] = $tpaId;
|
||||
$data['policy_type_id'] = $this->request->getPost('policy_type_id');
|
||||
$data['policy_no'] = $this->request->getPost('policy_no');
|
||||
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
|
||||
// $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
|
||||
// $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
|
||||
|
||||
$data['insured'] = $this->request->getPost('insured');
|
||||
$data['no_of_lives'] = $this->request->getPost('no_of_lives');
|
||||
@ -874,6 +883,16 @@ class ClientController extends AdminController
|
||||
$data['cd_ac_no'] = $this->request->getPost('cd_ac_no');
|
||||
$data['gst'] = $this->request->getPost('gst');
|
||||
|
||||
if($data['inception_type'] == 2){
|
||||
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['reminder_date'] = change_date_format($this->request->getPost('reminder_date'), 'd-m-Y', 'Y-m-d');
|
||||
}else{
|
||||
$data['policy_start_date'] = null;
|
||||
$data['policy_end_date'] = null;
|
||||
$data['reminder_date'] = null;
|
||||
}
|
||||
|
||||
if($policy_type_id == 1 || $policy_type_id == 2 || $policy_type_id == 3 || $policy_type_id == 6 || $policy_type_id == 7){
|
||||
|
||||
$data['is_addon'] = 1;
|
||||
|
||||
@ -35,7 +35,6 @@ class DashboardController extends AdminController
|
||||
{
|
||||
$data = [];
|
||||
|
||||
|
||||
$results = $this->clientModel->select('clients.id as client_id, clients.client_name, clients.short_name,
|
||||
client_branch.id as client_branch_id, client_branch.branch_name,
|
||||
client_branch.branch_code, employees.id as employee_id,
|
||||
|
||||
@ -674,8 +674,15 @@ class EmployeeController extends AdminController
|
||||
$branch_list = $this->clientBranchModel->findAll();
|
||||
$data['client_list'] = $client_list;
|
||||
$data['branch_list'] = $branch_list;
|
||||
$this->myLogger->logme('error', 'list called');
|
||||
$this->loadLayout('enrollment_list', $data);
|
||||
|
||||
// Get session data if available
|
||||
$data['selected_client_id'] = session()->get('client_id');
|
||||
$data['selected_branch_id'] = session()->get('branch_id');
|
||||
$data['selected_type'] = session()->get('type');
|
||||
|
||||
$this->myLogger->logme('error', 'list called');
|
||||
return $this->loadLayout('enrollment_list', $data);
|
||||
|
||||
}
|
||||
|
||||
public function empby_client_clientbranch($client_id, $branch_id)
|
||||
@ -718,7 +725,7 @@ class EmployeeController extends AdminController
|
||||
$employeeId = $row['employee_id'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
return json_encode($groupedData);
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,13 @@ namespace App\Controllers;
|
||||
|
||||
|
||||
use App\Models\JobModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
|
||||
use App\Helpers\sendMailNotification;
|
||||
|
||||
class JobWorker extends AdminController
|
||||
{
|
||||
const STATUS_DONE = 'done';
|
||||
@ -228,6 +235,71 @@ class JobWorker extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public static function enrollment_status() {
|
||||
$clientModel = new ClientModel();
|
||||
$clientPolicyModel = new ClientPolicyModel();
|
||||
$notificationModel = new NotificationModel();
|
||||
$employeePolicyModel = new EmployeePolicyModel();
|
||||
$myLogger = \Config\Services::mylogger();
|
||||
|
||||
$client_policy_data = $clientPolicyModel->where('is_active', 1)
|
||||
->where('policy_status', 1)
|
||||
->where('inception_type', 2)
|
||||
->findAll();
|
||||
$currentDate = date('Y-m-d');
|
||||
|
||||
// Update policy status based on start and end dates
|
||||
foreach ($client_policy_data as $client_policy) {
|
||||
$id = $client_policy['id'];
|
||||
|
||||
if ($currentDate == $client_policy['policy_start_date']) {
|
||||
$clientPolicyModel->update($id, ['open_for_enrollment' => 1]);
|
||||
}
|
||||
if ($client_policy['policy_end_date'] < $currentDate) {
|
||||
$clientPolicyModel->update($id, ['open_for_enrollment' => 0]);
|
||||
}
|
||||
}
|
||||
|
||||
$reminder_whole_mail = [];
|
||||
foreach ($client_policy_data as $client_policy) {
|
||||
$employee = $employeePolicyModel->select('employees.*')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||
->where('employee_polices.client_policy_id', $client_policy['id'])
|
||||
->first();
|
||||
$client_data = $clientModel->find($client_policy['client_id']);
|
||||
$notification_data = $notificationModel->where('client_id', $client_policy['client_id'])
|
||||
->where('template_name', 'member_reminder_mail')
|
||||
->first();
|
||||
|
||||
if ($notification_data && $notification_data['enabled'] == 1 && $currentDate == $client_policy['reminder_date']) {
|
||||
$params['emp_data'] = $employee;
|
||||
$params['client_data'] = $client_data;
|
||||
$params['notification_data'] = $notification_data;
|
||||
$reminder_whole_mail[] = sendMailNotification::sendMailNotification('member_reminder_mail', $params);
|
||||
|
||||
}
|
||||
}
|
||||
// Process and queue bulk emails
|
||||
$temp_whole_data = [];
|
||||
$count = 0;
|
||||
foreach ($reminder_whole_mail as $whole_index => $values) {
|
||||
foreach ($values as $index => $value) {
|
||||
$temp_whole_data[] = $value;
|
||||
$count++;
|
||||
|
||||
if ($count == 20 || ($whole_index == count($reminder_whole_mail) - 1 && $index == count($values) - 1)) {
|
||||
if (!empty($temp_whole_data)) {
|
||||
Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $temp_whole_data]);
|
||||
$temp_whole_data = [];
|
||||
$count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return json_encode(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ class sendMailNotification
|
||||
{
|
||||
public static function sendMailNotification($action, $params)
|
||||
{
|
||||
print_r($params);die;
|
||||
$wholeData =[];
|
||||
if ($action == 'member_welcome_mail') {
|
||||
$dataToInsert = $params['dataToInsert'];
|
||||
$notification = $params['notification'];
|
||||
@ -37,7 +37,6 @@ class sendMailNotification
|
||||
}
|
||||
return $wholeData;
|
||||
} else if($action == 'member_reminder_mail'){
|
||||
|
||||
$EmployeeModel = new EmployeeModel();
|
||||
$emp_data = $params['emp_data'];
|
||||
$notification_data = $params['notification_data'];
|
||||
@ -51,27 +50,46 @@ class sendMailNotification
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
if ($emp_data && (isset($notification_data) && $notification_data['enabled'] == 1)) {
|
||||
if(isset($emp_data['relationship'])){
|
||||
if ($emp_data['relationship'] == 'Self') {
|
||||
if(count($emp_data) > 0){
|
||||
$mail ='';
|
||||
if ($emp_data['relationship'] == 'Self') {
|
||||
$employee_name =$emp_data['name'];
|
||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||
$mail = $emp_data['email_corporate'];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$mail ='';
|
||||
}
|
||||
|
||||
}else{
|
||||
$employee_name =$emp_data['name'];
|
||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||
$mail = $emp_data['email_corporate'];
|
||||
}
|
||||
|
||||
if (isset($mail) && !empty($mail)) {
|
||||
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
||||
}
|
||||
}else{
|
||||
foreach ($emp_data as $key => $value) {
|
||||
if ($value['relationship'] != 'Self') {
|
||||
|
||||
if ($value['relationship'] != 'Self') {
|
||||
$emp_data = $EmployeeModel->where('client_id', $client_data['id'])->where('emp_code', $value['emp_code'])->where('is_active',1)->findAll();
|
||||
|
||||
if(count($emp_data) > 1){
|
||||
$mail ='';
|
||||
foreach ($emp_data as $key => $values) {
|
||||
if ($value['relationship'] == 'Self') {
|
||||
$employee_name =$values['name'];
|
||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||
|
||||
$mail = $values['email_corporate'];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$mail ='';
|
||||
}
|
||||
|
||||
}else{
|
||||
$employee_name =$value['name'];
|
||||
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||
@ -81,13 +99,15 @@ class sendMailNotification
|
||||
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
||||
}
|
||||
}
|
||||
if (count($wholeData) < 1) {
|
||||
$wholeData = [];
|
||||
}
|
||||
return $wholeData;
|
||||
}else{
|
||||
return "false";
|
||||
}
|
||||
|
||||
if (count($wholeData) < 1) {
|
||||
$wholeData = [];
|
||||
}
|
||||
return $wholeData;
|
||||
// }else{
|
||||
// return "false";
|
||||
// }
|
||||
} else if($action == 'member_ecard_mail'){
|
||||
|
||||
$notification = $params['notification'];
|
||||
|
||||
@ -19,6 +19,7 @@ class ClientPolicyModel extends Model
|
||||
"policy_type_id",
|
||||
"policy_start_date",
|
||||
"policy_end_date",
|
||||
"reminder_date",
|
||||
"insured",
|
||||
"no_of_employees",
|
||||
"no_of_lives",
|
||||
|
||||
@ -112,6 +112,10 @@
|
||||
<label for="policy_end_date">Policy End Date<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter End Date " name="policy_end_date" id="end_date" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="reminder_date">Reminder Date<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Reminder Date " name="reminder_date" id="reminder_date" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4" id="policy_status_field">
|
||||
<label for="policy_status">Policy Status</label>
|
||||
<input value="" type="text" class="form-control" placeholder="Policy Status" id="policy_status" readonly>
|
||||
@ -174,6 +178,23 @@
|
||||
<?php include('other_policy_terms.php'); ?>
|
||||
|
||||
<script>
|
||||
|
||||
$('#inception_type').change(function () {
|
||||
var start_data = $('#start_date').parent();
|
||||
var end_data = $('#end_date').parent();
|
||||
var reminder_data = $('#reminder_date').parent();
|
||||
if($(this).prop('checked')){
|
||||
$(start_data).show();
|
||||
$(end_data).show();
|
||||
$(reminder_data).show();
|
||||
}else{
|
||||
$(start_data).hide();
|
||||
$(end_data).hide();
|
||||
$(reminder_data).hide();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||
var policy_client = $('#policy_PrimaryKey').val();
|
||||
|
||||
@ -218,6 +239,13 @@
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var reminderDatePicker = flatpickr("#reminder_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
defaultDate: endDate,
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
|
||||
$('#add_form').hide();
|
||||
$('.btnBack').hide();
|
||||
|
||||
@ -308,6 +336,8 @@
|
||||
// ordering: false
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
$('.btnAdd').click(function() {
|
||||
@ -711,6 +741,7 @@
|
||||
$('#policy_no').val(res.data.policy_no);
|
||||
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
|
||||
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date));
|
||||
$('#reminder_date').val(rearrangeDateFormat(res.data.reminder_date));
|
||||
$('#policy_status').val(checkDateStatus(res.data.policy_end_date));
|
||||
$('#gst_no').val(gst);
|
||||
$('#policy_status_field').show();
|
||||
@ -1189,6 +1220,7 @@
|
||||
$('#policy_no').val('');
|
||||
$('#start_date').val('');
|
||||
$('#end_date').val('');
|
||||
$('#reminder_date').val('');
|
||||
$('#base_policy').val('').change();
|
||||
|
||||
var client_id = $('#client_id_policy').val();
|
||||
@ -1289,6 +1321,14 @@
|
||||
$('#base_policy').prop('required', false);
|
||||
$('#base_danger').hide();
|
||||
}
|
||||
|
||||
if($('#inception_type').prop('checked')){
|
||||
|
||||
}else{
|
||||
$('#start_date').parent().hide();
|
||||
$('#end_date').parent().hide();
|
||||
$('#reminder_date').parent().hide();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@ -1359,6 +1399,7 @@
|
||||
|
||||
var dataId = 0;
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#base_policy').change(function() {
|
||||
|
||||
var client_policy_id = $(this).val() ? $(this).val() : 0;
|
||||
|
||||
@ -1,115 +1,336 @@
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
|
||||
<!-- Bootstrap JS -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
<!-- Bootstrap JS (ensure this is included) -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<style>
|
||||
/* Existing CSS ... */
|
||||
|
||||
.carousel-control-prev {
|
||||
left: -38px;
|
||||
}
|
||||
|
||||
.status-option {
|
||||
padding: 0.5rem !important;
|
||||
background-color: darkgrey;
|
||||
}
|
||||
|
||||
.emp-count-view-click {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.emp-status .col-6 {
|
||||
/* padding-bottom: 1rem; */
|
||||
padding-bottom: 0.3rem;
|
||||
}
|
||||
|
||||
.emp-status label {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.client-branch-label {
|
||||
padding: 0.2rem;
|
||||
border-radius: 0.2rem;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.scroll-container {
|
||||
display: flex;
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.scroll-item {
|
||||
flex: 0 0 auto;
|
||||
width: 25%; /* Adjust based on the number of items you want to show */
|
||||
width: 33%; /* Adjust based on the number of items you want to show */
|
||||
box-sizing: border-box;
|
||||
padding: 0 10px;
|
||||
}
|
||||
.center_text{
|
||||
text-align: center;
|
||||
}
|
||||
.card-body {
|
||||
padding: 0rem ;
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.col-xl-3 {
|
||||
max-width: 32% !important;
|
||||
}
|
||||
}
|
||||
|
||||
.number_css{
|
||||
.center_text {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.card-body {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.number_css {
|
||||
font-family: Roboto, sans-serif;
|
||||
color: #343a40;
|
||||
text-align: center;
|
||||
}
|
||||
.label_bottom_reduce{
|
||||
|
||||
.label_bottom_reduce {
|
||||
margin-bottom: .0rem;
|
||||
}
|
||||
|
||||
|
||||
.search-input {
|
||||
margin-bottom: 1rem;
|
||||
padding: 0.5rem;
|
||||
border-radius: 0.25rem;
|
||||
border: 1px solid #ced4da;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.carousel-inner {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.carousel-item {
|
||||
height: auto; /* Adjust if needed */
|
||||
/* margin-left: 80px; */
|
||||
}
|
||||
|
||||
.card {
|
||||
margin: 0 auto; /* Center card in carousel item */
|
||||
}
|
||||
|
||||
.carousel-control-prev, .carousel-control-next {
|
||||
width: 5%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.carousel-control-prev-icon, .carousel-control-next-icon {
|
||||
background-color: rgba(0,0,0,0.5); /* Change color as needed */
|
||||
}
|
||||
|
||||
.carousel-control-prev-icon {
|
||||
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg xmlns%3D"http://www.w3.org/2000/svg" fill%3D"%23000000" viewBox%3D"0 0 8 8"%3E%3Cpath d%3D"M2.5 0L4 1.5 1.5 4 4 6.5 2.5 8 0 4 2.5 0z"/%3E%3C/svg%3E');
|
||||
}
|
||||
|
||||
.carousel-control-next-icon {
|
||||
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg xmlns%3D"http://www.w3.org/2000/svg" fill%3D"%23000000" viewBox%3D"0 0 8 8"%3E%3Cpath d%3D"M5.5 8L4 6.5 6.5 4 4 1.5 5.5 0l4 4-4 4z"/%3E%3C/svg%3E');
|
||||
}
|
||||
|
||||
.show-item {
|
||||
display: inline-block !important;
|
||||
}
|
||||
|
||||
.hide-item {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.content-page {
|
||||
background-color: #e8eff5;
|
||||
}
|
||||
|
||||
html {
|
||||
background-color: #e8eff5;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="tab-pane fade" id="enrollment-dash-tab">
|
||||
|
||||
|
||||
|
||||
<div class="tab-pane fade" id="enrollment-dash-tab">
|
||||
<div class="row visa_status_count_view">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header"></div>
|
||||
<div class="card-body status-option" id="statusContent" style="padding: 0.5rem !important;background-color: #edf1f5;">
|
||||
<div class="scroll-container">
|
||||
<?php foreach ($client_branch_emp_list as $clients) { ?>
|
||||
<?php foreach ($clients['branches'] as $branches) { ?>
|
||||
<div class="scroll-item">
|
||||
<div class="card">
|
||||
<div class="card-body emp-count-view-click">
|
||||
<div class="d-flex justify-content-center">
|
||||
<div class="col-12 center_text" style="background-color: #02a8b5;">
|
||||
<label for="" class="client-branch-label">
|
||||
<?php echo isset($clients['short_name']) ? $clients['short_name'] : 'N/A'; ?> -
|
||||
<?php echo isset($branches['branch_name']) ? $branches['branch_name'] : 'N/A'; ?>
|
||||
</label>
|
||||
<div class="card" style="border: 0px;">
|
||||
<div class="card-body status-option" id="statusContent" style="padding: 0.5rem !important;background-color: white;">
|
||||
<!-- Search Input Field -->
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<select class="form-control" name="" id="">
|
||||
<option value="">Open Enrollment</option>
|
||||
<option value="">Close Enrollment</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-5"></div>
|
||||
<div class="col-4">
|
||||
<input type="text" id="searchInput" class="search-input" placeholder="Search by client or branch">
|
||||
</div>
|
||||
</div>
|
||||
<!-- Carousel Structure -->
|
||||
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel" data-interval="false">
|
||||
<div class="carousel-inner">
|
||||
<?php
|
||||
$itemsPerSlide = 3; // Number of items per slide
|
||||
$currentItem = 0; // Counter for items
|
||||
$isActive = true; // Variable to set the first item as active
|
||||
foreach ($client_branch_emp_list as $clients) {
|
||||
foreach ($clients['branches'] as $branches) {
|
||||
// Start a new carousel item if needed
|
||||
if ($currentItem % $itemsPerSlide == 0) {
|
||||
if (!$isActive) echo '</div>'; // Close previous carousel item
|
||||
echo '<div class="carousel-item' . ($isActive ? ' active' : '') . '">';
|
||||
$isActive = false;
|
||||
}
|
||||
?>
|
||||
<!-- New Card Layout for each item -->
|
||||
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="<?php echo $clients['short_name']; ?>" data-branch="<?php echo $branches['branch_name']; ?>">
|
||||
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
||||
<div class="card-header" >
|
||||
<div class="row">
|
||||
<div class="col-8 center_text emp-count-view-click" >
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="w-100 text-center" >
|
||||
<h3 class="my-2 py-1 number_css" ><span data-plugin="counterup" style="margin-left: 113px;font-size: 2.0rem;" onclick="enrollment_list(this, 'emp_count_view_click')"><?php echo isset($branches['employees']) ? count($branches['employees']) : '0'; ?></span></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 center_text emp-count-view-click" >
|
||||
<div class="d-flex justify-content-between">
|
||||
|
||||
<div class="w-100 text-center" >
|
||||
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Branch Info" style="text-align: center;"><?php echo isset($clients['short_name']) ? $clients['short_name'] : 'N/A'; ?> - <?php echo isset($branches['branch_name']) ? $branches['branch_name'] : 'N/A'; ?></h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="col-3 center_text emp-count-view-click" >
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="w-100 text-center" >
|
||||
<p class="mb-0 text-muted">
|
||||
<span class="text-success mr-2"></span>
|
||||
<span class="text-nowrap">Emp Count</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="row emp-status">
|
||||
<div class="col-12 center_text">
|
||||
<span class="number_css" style="font-size: x-large;"><?php echo isset($branches['employees']) ? count($branches['employees']) : '0'; ?></span><br>
|
||||
<i class="fa fa-users" aria-hidden="true"></i>
|
||||
<div class="card-body add_card_background_random" >
|
||||
|
||||
<input type="text" class="client_id" value="<?php echo $clients['client_id']; ?>" hidden>
|
||||
<input type="text" class="client_branch_id" value="<?php echo $branches['client_branch_id'] ?>" hidden>
|
||||
<div class="row emp-status" style="margin-top: -9px;">
|
||||
<div class="col-6 center_text emp-count-view-click" >
|
||||
<span style="font-size: large;color: white !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')"><?php echo isset($branches['emp_login']) ? $branches['emp_login'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
||||
</div>
|
||||
<div class="col-6 center_text emp-count-view-click" >
|
||||
<span style="font-size: large;color: white !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"><?php echo isset($branches['emp_login']) ? count($branches['employees']) - $branches['emp_login'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
||||
</div>
|
||||
<div class="col-6 center_text">
|
||||
<span style="font-size: x-large;" class="number_css"><?php echo isset($branches['emp_login']) ? $branches['emp_login'] : '0'; ?></span><br>
|
||||
<label class="label_bottom_reduce" for="" style="color: gray;font-family: var(--bs-body-font-family);font-size: var(--bs-body-font-size);">Logged-In</label>
|
||||
</div>
|
||||
<div class="col-6 center_text">
|
||||
<span style="font-size: x-large;" class="number_css"><?php echo isset($branches['emp_enroll']) ? count($branches['employees']) - $branches['emp_enroll'] : '0'; ?></span><br>
|
||||
<label class="label_bottom_reduce" for="" style="color: gray;font-family: var(--bs-body-font-family);font-size: var(--bs-body-font-size);">Draft</label>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-6 center_text">
|
||||
<span style="font-size: x-large;" class="number_css"><?php echo isset($branches['emp_login']) ? count($branches['employees']) - $branches['emp_login'] : '0'; ?></span><br>
|
||||
<label class="label_bottom_reduce" for="" style="color: gray;font-family: var(--bs-body-font-family);font-size: var(--bs-body-font-size);">Not Logged-In</label>
|
||||
</div>
|
||||
<div class="col-6 center_text">
|
||||
<span style="font-size: x-large;" class="number_css"><?php echo isset($branches['emp_enroll']) ? $branches['emp_enroll'] : '0'; ?></span><br>
|
||||
<label class="label_bottom_reduce" for="" style="color: gray;font-family: var(--bs-body-font-family);font-size: var(--bs-body-font-size);">Enrolled</label>
|
||||
<div class="row emp-status" style="margin-top: -9px;">
|
||||
|
||||
<div class="col-6 center_text emp-count-view-click" >
|
||||
<span style="font-size: large;color: white !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')"><?php echo isset($branches['emp_enroll']) ? count($branches['employees']) - $branches['emp_enroll'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
||||
</div>
|
||||
<div class="col-6 center_text emp-count-view-click" >
|
||||
<span style="font-size: large;color: white !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')"><?php echo isset($branches['emp_enroll']) ? $branches['emp_enroll'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$currentItem++;
|
||||
}
|
||||
}
|
||||
if ($currentItem % $itemsPerSlide != 0) echo '</div>'; // Close the last carousel item
|
||||
?>
|
||||
</div>
|
||||
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
|
||||
<!-- <span class="carousel-control-prev-icon" aria-hidden="true"></span> -->
|
||||
<!-- <span class="sr-only">Previous</span> -->
|
||||
<i class="fas fa-angle-left"></i>
|
||||
</a>
|
||||
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
|
||||
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
||||
<span class="sr-only">Next</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.scroll-container').on('wheel', function(e) {
|
||||
if (e.originalEvent.deltaY < 0) {
|
||||
this.scrollLeft -= 100; // Adjust scroll speed
|
||||
} else {
|
||||
this.scrollLeft += 100; // Adjust scroll speed
|
||||
}
|
||||
e.preventDefault();
|
||||
});
|
||||
$(document).ready(function() {
|
||||
// Scroll functionality
|
||||
$('.scroll-container').on('wheel', function(e) {
|
||||
if (e.originalEvent.deltaY < 0) {
|
||||
this.scrollLeft -= 100; // Adjust scroll speed
|
||||
} else {
|
||||
this.scrollLeft += 100; // Adjust scroll speed
|
||||
}
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// Search functionality
|
||||
$('#searchInput').on('input', function() {
|
||||
var searchValue = $(this).val().toLowerCase();
|
||||
var firstVisibleItem = null;
|
||||
|
||||
$('.scroll-item').each(function() {
|
||||
var itemText = $(this).find('h5').text().toLowerCase();
|
||||
|
||||
if (itemText.indexOf(searchValue) > -1) {
|
||||
$(this).removeClass('hide-item').addClass('show-item'); // Show item
|
||||
|
||||
if (!firstVisibleItem) {
|
||||
firstVisibleItem = $(this);
|
||||
}
|
||||
} else {
|
||||
$(this).removeClass('show-item').addClass('hide-item'); // Hide item
|
||||
}
|
||||
});
|
||||
|
||||
if (firstVisibleItem) {
|
||||
// Remove active class from all carousel items
|
||||
$('.carousel-item').removeClass('active');
|
||||
|
||||
// Add active class to the parent carousel item of the first visible item
|
||||
firstVisibleItem.closest('.carousel-item').addClass('active');
|
||||
|
||||
// Scroll to the first visible item
|
||||
$('html, body').animate({
|
||||
scrollTop: firstVisibleItem.offset().top
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
function enrollment_list(current_element, type) {
|
||||
var clientId = $(current_element).closest('.carousel-slide-item').find('.client_id').val();
|
||||
var branchId = $(current_element).closest('.carousel-slide-item').find('.client_branch_id').val();
|
||||
|
||||
var baseUrl = '<?php echo base_url(); ?>'; // Adjust this to your actual base URL if needed
|
||||
var url = baseUrl + 'employee/enrollment-list'; // Change this to the actual URL of your enroller_list page
|
||||
|
||||
var params = new URLSearchParams({
|
||||
client_id: clientId,
|
||||
branch_id: branchId,
|
||||
type: type
|
||||
});
|
||||
|
||||
// Redirect to the constructed URL with parameters
|
||||
window.location.href = `${url}?${params.toString()}`;
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Array of predefined colors
|
||||
var colors = ['yellowgreen', 'indianred', 'cadetblue', 'burlywood', 'darkolivegreen'];
|
||||
|
||||
// Counter to keep track of the current color index
|
||||
var colorIndex = 0;
|
||||
|
||||
// Apply a color from the array to each card-header in sequence
|
||||
document.querySelectorAll('.add_card_background_random').forEach(function(header) {
|
||||
header.style.backgroundColor = colors[colorIndex];
|
||||
colorIndex = (colorIndex + 1) % colors.length; // Move to the next color, cycling back to 0 if needed
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -228,6 +228,7 @@
|
||||
},
|
||||
success: function(response) {
|
||||
var data = JSON.parse(response);
|
||||
console.log(data);
|
||||
var table = $('#tickets-table').DataTable();
|
||||
table.clear();
|
||||
|
||||
@ -277,6 +278,12 @@
|
||||
});
|
||||
|
||||
table.draw();
|
||||
|
||||
function getUrlParameter(name) {
|
||||
var params = new URLSearchParams(window.location.search);
|
||||
return params.get(name);
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
@ -286,6 +293,43 @@
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
function getUrlParameter(name) {
|
||||
var params = new URLSearchParams(window.location.search);
|
||||
return params.get(name);
|
||||
}
|
||||
|
||||
// Check for URL parameters and set form values
|
||||
var client_id = getUrlParameter('client_id');
|
||||
var branch_id = getUrlParameter('branch_id');
|
||||
var type = getUrlParameter('type');
|
||||
|
||||
if (client_id) {
|
||||
$('#clients').val(client_id).trigger('change'); // Set client ID and trigger change event to populate branches
|
||||
}
|
||||
|
||||
if (branch_id) {
|
||||
setTimeout(function() { // Ensure branches are populated before setting branch ID
|
||||
$('#branch_id').val(branch_id).trigger('change');
|
||||
if($('#branch_id').val() != 0){
|
||||
$('#get-emp-list').click().trigger();
|
||||
|
||||
|
||||
}
|
||||
}, 500);
|
||||
|
||||
}
|
||||
if (history.pushState) {
|
||||
var newUrl = window.location.protocol + "//" + window.location.host + window.location.pathname;
|
||||
window.history.pushState({path: newUrl}, '', newUrl);
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
// var type = getUrlParameter('type');
|
||||
console.log("------------------------");
|
||||
console.log(type);
|
||||
$('#' + type).click().trigger();
|
||||
}, 1000);
|
||||
|
||||
$('#clients').select2();
|
||||
$('#branch_id').select2();
|
||||
var table = $('#tickets-table').DataTable({
|
||||
|
||||
@ -71,10 +71,11 @@
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css"/>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css" />
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user