diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index f87019a..afeb733 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -862,21 +862,21 @@ class ClientController extends AdminController $data['created_by'] = get_session_userid(); $insert = $this->clientBranchModel->insert($data); - if ($insert) { - for ($i = 0; $i < count($this->request->getPost('name')); $i++) { - // Prepare data to insert - $data = [ - 'contact_type' => 'client', - 'ref_id' => $insert, - 'created_by' => get_session_userid(), - 'name' => $this->request->getPost('name')[$i], - 'email' => $this->request->getPost('email')[$i], - 'mobile' => $this->request->getPost('mobile')[$i], - 'designation' => $this->request->getPost('designation')[$i] - ]; - $contacts = $this->levelContactModel->insert($data); - } - } + // if ($insert) { + // for ($i = 0; $i < count($this->request->getPost('name')); $i++) { + // // Prepare data to insert + // $data = [ + // 'contact_type' => 'client', + // 'ref_id' => $insert, + // 'created_by' => get_session_userid(), + // 'name' => $this->request->getPost('name')[$i], + // 'email' => $this->request->getPost('email')[$i], + // 'mobile' => $this->request->getPost('mobile')[$i], + // 'designation' => $this->request->getPost('designation')[$i] + // ]; + // $contacts = $this->levelContactModel->insert($data); + // } + // } if ($insert) { $branchData = $this->clientBranchModel->where('client_id', $this->request->getPost('client_id'))->findAll(); @@ -965,22 +965,22 @@ class ClientController extends AdminController $this->myLogger->logme('error', 'Client branch EDITED by {data}', ['data' => get_session_userid()]); - if ($insert) { + // if ($insert) { - $this->levelContactModel->where('ref_id', $id)->where('contact_type', 'client')->delete(); - for ($i = 0; $i < count($this->request->getPost('name')); $i++) { - $data = [ - 'contact_type' => 'client', - 'ref_id' => $id, - 'updated_by' => get_session_userid(), - 'name' => $this->request->getPost('name')[$i], - 'email' => $this->request->getPost('email')[$i], - 'mobile' => $this->request->getPost('mobile')[$i], - 'designation' => $this->request->getPost('designation')[$i] - ]; - $contacts = $this->levelContactModel->insert($data); - } - } + // $this->levelContactModel->where('ref_id', $id)->where('contact_type', 'client')->delete(); + // for ($i = 0; $i < count($this->request->getPost('name')); $i++) { + // $data = [ + // 'contact_type' => 'client', + // 'ref_id' => $id, + // 'updated_by' => get_session_userid(), + // 'name' => $this->request->getPost('name')[$i], + // 'email' => $this->request->getPost('email')[$i], + // 'mobile' => $this->request->getPost('mobile')[$i], + // 'designation' => $this->request->getPost('designation')[$i] + // ]; + // $contacts = $this->levelContactModel->insert($data); + // } + // } if ($insert) { $branchData = $this->clientBranchModel->where('client_id', $client_id)->findAll(); @@ -1151,18 +1151,18 @@ class ClientController extends AdminController $base_policy = $this->request->getPost('base_policy'); - $insurerValue = (string) $this->request->getPost('insurer'); - list($insurerBranchId, $insurerId) = explode('-', $insurerValue); + // $insurerValue = (string) $this->request->getPost('insurer'); + // list($insurerBranchId, $insurerId) = explode('-', $insurerValue); - $data['insurer_branch_id'] = $insurerBranchId; - $data['insurer_id'] = $insurerId; + // $data['insurer_branch_id'] = $insurerBranchId; + // $data['insurer_id'] = $insurerId; - $tpaValue = (string) $this->request->getPost('tpa'); - list($tpaBranchId, $tpaId) = explode('-', $tpaValue); + // $tpaValue = (string) $this->request->getPost('tpa'); + // list($tpaBranchId, $tpaId) = explode('-', $tpaValue); - $data['tpa_branch_id'] = $tpaBranchId; + // $data['tpa_branch_id'] = $tpaBranchId; $data['client_id'] = $client_id; - $data['tpa_id'] = $tpaId; + // $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'); @@ -1185,12 +1185,12 @@ class ClientController extends AdminController $data['inception_type'] = $this->request->getPost('inception_type') ? 2 : 1; $data['enrolment_visibility'] = $this->request->getPost('enrolment_visibility') ? 1 : 0; $data['client_branch_id'] = $this->request->getPost('client_branch_id'); - $data['cd_ac_pk'] = $this->request->getPost('cd_ac_no'); + // $data['cd_ac_pk'] = $this->request->getPost('cd_ac_no'); $data['gst'] = $this->request->getPost('gst'); $data['disclaimer'] = $this->request->getPost('disclaimer'); $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['is_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0; + // $data['is_member_modify_allowed'] = $this->request->getPost('is_member_modify_allowed') ? 1 : 0; if ($data['inception_type'] == 2) { $data['open_date'] = change_date_format($this->request->getPost('open_date'), 'd-m-Y', 'Y-m-d'); $data['close_date'] = change_date_format($this->request->getPost('close_date'), 'd-m-Y', 'Y-m-d'); diff --git a/app/Controllers/DashboardController.php b/app/Controllers/DashboardController.php index 4df9136..34fee90 100755 --- a/app/Controllers/DashboardController.php +++ b/app/Controllers/DashboardController.php @@ -111,12 +111,12 @@ class DashboardController extends AdminController ->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left') ->findAll(); - $pendingActionsController = new PendingActionsController; - $pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard(); - $businessTeamData = $this->policyTransactionModel->getBusinessReportList(); - $financeTeamData = $this->policyTransactionModel->getFinanceReportList(); - $businessTeamStatusData = $this->data_construct_for_bds($businessTeamData); - $financeTeamStatusData = $this->data_construct_for_bds($financeTeamData); + // $pendingActionsController = new PendingActionsController; + // $pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard(); + // $businessTeamData = $this->policyTransactionModel->getBusinessReportList(); + // $financeTeamData = $this->policyTransactionModel->getFinanceReportList(); + // $businessTeamStatusData = $this->data_construct_for_bds($businessTeamData); + // $financeTeamStatusData = $this->data_construct_for_bds($financeTeamData); $groupedData = []; @@ -205,16 +205,16 @@ class DashboardController extends AdminController $data['client_branch_emp_list'] = $groupedData; $session = \Config\Services::session(); - $session->set('enrollment_data', json_encode($data)); + $session->set('enrollment_data', json_encode($data)); // echo "
";
-        $data['pendingActionsData'] = $pendingActionsData;
-        $data['businessTeamCount'] = count($businessTeamData) ?? 0;
-        $data['financeTeamCount'] = count($financeTeamData) ?? 0;
-        $data['businessTeamStatusData'] = $businessTeamStatusData;
-        $data['financeTeamStatusData'] = $financeTeamStatusData;
-        $data['policyStatus'] =  $this->policyStatus;
-        $data['colorShades'] =  $this->colorShades;
-        // print_r($data);die;
+        // $data['pendingActionsData'] = $pendingActionsData;
+        // $data['businessTeamCount'] = count($businessTeamData) ?? 0;
+        // $data['financeTeamCount'] = count($financeTeamData) ?? 0;
+        // $data['businessTeamStatusData'] = $businessTeamStatusData;
+        // $data['financeTeamStatusData'] = $financeTeamStatusData;
+        // $data['policyStatus'] =  $this->policyStatus;
+        // $data['colorShades'] =  $this->colorShades;
+        // dd($data);die;
 
         $data['page_name'] = 'Dashboard';
 
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index 813238f..3880919 100755
--- a/app/Controllers/EmployeeController.php
+++ b/app/Controllers/EmployeeController.php
@@ -291,7 +291,8 @@ class EmployeeController extends AdminController
         //for TPA/insurer upload
         $data['events'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
         //for inception upload
-        $data['actions'] = ['inception' => 'Inception (Employee + Dependents)',  'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrolment'];
+        // $data['actions'] = ['inception' => 'Inception (Employee + Dependents)',  'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrolment'];
+        $data['actions'] = ['enrollment' => 'Enrolment'];
 
         $data['import_or_export'] = ['import' => 'Import', 'export' => 'Export'];
         $data['insurer_or_tpa'] = ['insurer' => 'Insurer', 'tpa' => 'TPA'];
diff --git a/app/Controllers/LoginController.php b/app/Controllers/LoginController.php
index 10c4271..b3ca218 100755
--- a/app/Controllers/LoginController.php
+++ b/app/Controllers/LoginController.php
@@ -19,17 +19,16 @@ class LoginController extends BaseController
     //     set_session_data($session_data);
         // $isLoggedIn = check_session();
         $isLoggedIn = check_session();
-        
-        if ($isLoggedIn) {
+        $hasCookie = check_cookie();
+        if ($isLoggedIn || $hasCookie) {
             return redirect()->to(base_url('/dashboard/view'));
         }
         return view('login');
     }
 
-
+    
     public function receiveGoogleOAuthResponse()
     {  
-
         $UserModel = new UserModel();
         //echo 'DONE';die();
         if ($this->request->getGet('code')) {
@@ -52,7 +51,10 @@ class LoginController extends BaseController
                             'userProfile' => $value->picture,
                             'user_team'   => $user_team,
                         ];
-
+                        $path = getenv('cookie.Path');
+                        $domain = getenv('cookie.Domain');
+                        $https = getenv('ccokie.secure');
+                        setcookie('session_data', json_encode($session_data), time() + 12 * 60 * 60, $path, $domain, $https, true);
                         set_session_data($session_data);
 
                         log_message('error', 'Set The UserId : `'. $user->id .'` in Session');
@@ -82,12 +84,14 @@ class LoginController extends BaseController
 
     public function initiateGoogleOAuth()
     {
-         return googleOAuthLogin(false);
+        return googleOAuthLogin(false);
     }
 
     public function logout()
     {
+        $path = getenv('cookie.Path');
         session()->destroy();
+        setcookie('session_data', '', time() - 3600, $path);
         return redirect()->to(base_url('login'));
     }
 
diff --git a/app/Filters/AuthMVC.php b/app/Filters/AuthMVC.php
index aa40610..0a9f7a6 100755
--- a/app/Filters/AuthMVC.php
+++ b/app/Filters/AuthMVC.php
@@ -9,8 +9,7 @@ class AuthMVC implements FilterInterface
 {
     public function before(RequestInterface $request, $arguments = null)
     {
-        if (!check_session()) {
-            
+        if (!check_session() && !check_cookie()) {            
           return redirect()->to(base_url('/login'));
         }
 
diff --git a/app/Helpers/oauth_helper.php b/app/Helpers/oauth_helper.php
index a16ef36..9b3fba3 100755
--- a/app/Helpers/oauth_helper.php
+++ b/app/Helpers/oauth_helper.php
@@ -1,6 +1,6 @@
 getUserByEmail($value['userData']->email);
+            if($user){
+                if($user->is_active !== '0'){
+                    $user_team = $UserModel->getUserTeamsByUserID($user->id);
+                    // dd($user_team); 
+
+                    $session_data = [
+                        'isLoggedIn'  => True,
+                        'userid'      => $user->id, 
+                        'userData'    => $user, 
+                        'userProfile' => $value['userProfile'],
+                        'user_team'   => $user_team,
+                    ];
+                    set_session_data($session_data);
+                    // $this->getUserDeviceInfo($user->id, 'NhanceUser');
+                    // return redirect()->to(base_url('/dashboard/view'));
+                    return true;
+
+                }
+            // $session_data = (array)json_decode($_COOKIE['session_data']);
+            // set_session_data($session_data);
+        }       
+        }else{
+        return false;
+        }
+    }
+}
 
 if (!function_exists('check_session')) {
     function check_session()
@@ -148,9 +183,3 @@ if (!function_exists('user_team')) {
          return $session->get('user_team');
     }
 }
-
-
-
-
-
-
diff --git a/app/Views/DashBoard.php b/app/Views/DashBoard.php
index 4da6b9c..2272c30 100755
--- a/app/Views/DashBoard.php
+++ b/app/Views/DashBoard.php
@@ -188,35 +188,36 @@ body {
                 
- - + +
diff --git a/app/Views/client_basic_info.php b/app/Views/client_basic_info.php index 9e41c61..08c991a 100755 --- a/app/Views/client_basic_info.php +++ b/app/Views/client_basic_info.php @@ -70,7 +70,7 @@ input:checked + .slider:before {
-
+ +
-
+
-
-
+ + -
+
diff --git a/app/Views/client_branch.php b/app/Views/client_branch.php index 40e04f5..2622d41 100755 --- a/app/Views/client_branch.php +++ b/app/Views/client_branch.php @@ -85,19 +85,24 @@
-
+
-
+
+
+ + +
-
+ -
+
-
+ + +

- +
diff --git a/app/Views/client_list.php b/app/Views/client_list.php index ce079c6..3d6c579 100755 --- a/app/Views/client_list.php +++ b/app/Views/client_list.php @@ -88,7 +88,7 @@ table.dataTable thead th {