From f2e55a3a235c744d3f6c75749133c3049d3226ed Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 14 Mar 2024 15:25:04 +0530 Subject: [PATCH 01/32] FEAT_IMPORT_EXPORT : RV --- app/Config/Autoload.php | 2 +- app/Config/Routes.php | 2 + app/Controllers/ClientController.php | 29 +- app/Controllers/EmpDataServiceController.php | 166 ++++++ app/Controllers/EmployeeController.php | 305 ++++++++-- app/Controllers/EmployeeServiceController.php | 97 ++++ app/Controllers/LoginController.php | 5 +- app/Helpers/excel_import_export_helper.php | 261 +++++++++ app/Models/BatchFileModel.php | 25 + app/Models/BatchListModel.php | 20 + app/Models/EmpEndorsementModel.php | 28 + app/Models/EmployeeModel.php | 1 + app/Models/EmployeePolicyModel.php | 136 +++++ app/Views/UserList.php | 8 + app/Views/client_basic_info.php | 82 ++- app/Views/client_kyc.php | 47 +- app/Views/client_policy.php | 10 - app/Views/client_rm.php | 3 + app/Views/employee_upload.php | 540 ++++++++++-------- app/Views/excel_errors.php | 159 ++++-- app/Views/import_export.php | 32 ++ app/Views/insurer_or_tpa_data.php | 334 +++++++++++ app/Views/layout/header.php | 4 - .../session => public/sample_excel}/.gitkeep | 0 public/sample_excel/inception.xls | Bin 0 -> 10240 bytes public/sample_excel/inception_1.xls | Bin 0 -> 10240 bytes public/sample_excel/inception_2.xls | Bin 0 -> 10240 bytes public/sample_excel/inception_3.xls | Bin 0 -> 10240 bytes 28 files changed, 1885 insertions(+), 411 deletions(-) create mode 100644 app/Controllers/EmpDataServiceController.php create mode 100644 app/Helpers/excel_import_export_helper.php create mode 100644 app/Models/BatchFileModel.php create mode 100644 app/Models/BatchListModel.php create mode 100644 app/Models/EmpEndorsementModel.php create mode 100644 app/Views/import_export.php create mode 100644 app/Views/insurer_or_tpa_data.php rename {writable/session => public/sample_excel}/.gitkeep (100%) create mode 100644 public/sample_excel/inception.xls create mode 100644 public/sample_excel/inception_1.xls create mode 100644 public/sample_excel/inception_2.xls create mode 100644 public/sample_excel/inception_3.xls diff --git a/app/Config/Autoload.php b/app/Config/Autoload.php index dfba0156..33f1403b 100755 --- a/app/Config/Autoload.php +++ b/app/Config/Autoload.php @@ -99,5 +99,5 @@ class Autoload extends AutoloadConfig * @var string[] * @phpstan-var list */ - public $helpers = ['uuid','session','utility', 'form', 'url', 'oauth', 'fileupload']; + public $helpers = ['uuid','session','utility', 'form', 'url', 'oauth', 'fileupload', 'excel_import_export', 'file']; } diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f8a6622c..e64d9709 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -187,6 +187,8 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){ $routes->get("kyc-other-docs-delete/(:any)", "ClientController::deleteClientKycOtherDocs/$1"); $routes->get("policy-premium", "ClientController::getpolicyGridData/$1"); $routes->get("update-policy-status", "ClientController::updateClientPolicyStatus/$1"); + $routes->get("download-excel/(:any)", "EmployeeController::downloadSampleExcelFile/$1"); + $routes->post("import-export", "EmployeeController::importExport"); }); $routes->cli('processjob', 'JobWorker::processJob'); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 8575d6b0..5612386c 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -90,20 +90,11 @@ class ClientController extends AdminController public function index() { - // $token = $_SESSION; - // $token = $request->getHeaderLine('Authorization'); - - - // print_r(JWTToken::getIdFromToken($token)); - - // die(); - $this->myLogger->logme('error','Client list function called'); $headerData['page_name'] = 'Client List'; $data['clientList'] = $this->clientModel->getCreatedByUserName(); $data['client_rm'] = $this->clientRMModel->getAllClientRM(); - // echo '
';
-        // print_r($data); die;
+
         echo view('layout/header', $headerData);
         echo view('client_list', $data);
         echo view('layout/footer');
@@ -138,18 +129,18 @@ class ClientController extends AdminController
     // In your controller
     public function deposit($id = null)
     {
-    $headerData['page_name'] = 'Client Deposit';
+        $headerData['page_name'] = 'Client Deposit';
 
-    $data['clientData'] = $this->clientPolicyModel->getinsurerswithclientid($id);
-    $data['depositsummary'] = $this->clientPolicyModel->getDepositlistsummary($id);
+        $data['clientData'] = $this->clientPolicyModel->getinsurerswithclientid($id);
+        $data['depositsummary'] = $this->clientPolicyModel->getDepositlistsummary($id);
 
-    // Fetch associated insurer names and balances
-    $balances = $this->clientPolicyModel->getBalances($id);
-    $data['balances'] = $balances;
+        // Fetch associated insurer names and balances
+        $balances = $this->clientPolicyModel->getBalances($id);
+        $data['balances'] = $balances;
 
-    echo view('layout/header', $headerData);
-    echo view('client_deposit_list', $data);
-    echo view('layout/footer');
+        echo view('layout/header', $headerData);
+        echo view('client_deposit_list', $data);
+        echo view('layout/footer');
     }
    
     public function view_Deposit($insurerId) 
diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php
new file mode 100644
index 00000000..28efc8cf
--- /dev/null
+++ b/app/Controllers/EmpDataServiceController.php
@@ -0,0 +1,166 @@
+myLogger = \Config\Services::mylogger();
+        $this->employeeModel = new EmployeeModel();
+        $this->employeePolicyModel = new EmployeePolicyModel();
+        $this->clientModel       = new ClientModel();
+        $this->fileModel         = new FileModel();
+        $this->clientPolicyModel = new ClientPolicyModel();
+        $this->batchListModel    = new BatchListModel();
+        $this->batchFileModel    = new BatchFileModel();
+        $this->empEndorsementModel    = new EmpEndorsementModel();
+    }
+
+
+    public function batchFilesAndBatchListEntry($data, $filename, $objects){
+       $random_number_count = 4;
+       $data['batch_code'] = generate_random_string($random_number_count);
+       $data['created_by'] = get_session_userid();
+       $data['file_name'] = $filename;
+       $insert = $this->batchFileModel->insert($data);
+       $batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
+
+       if($insert){
+          foreach($objects as $value){
+            $batch_list_data['batch_code'] =  $batch_file_batch_code['batch_code'];
+            $batch_list_data['emp_policy_id'] =  $value->employee_policy_id ?? $value->emp_id;
+            $batch_list_data['created_by'] = get_session_userid();
+             $this->batchListModel->insert($batch_list_data);
+          }
+       }
+       return true;
+        
+    }
+    
+
+    public function generateExcelForAdditionandInception($batch_files_data, $export_data, $file_name)
+    {
+
+        $data = transform_objects_to_array_for_inception($export_data);
+        $headers = [
+            'S.No', 'NAME OF EMP/DEP', 'EMP ID', 'EMP/DEP TYPE', 'RELATION', 'DOB', 'GENDER', 'PRE EXISTING AILMENTS',
+            'BASIC COVER SI', 'DATE OF COVERAGE', 'AGE', 'RELATIONSHIP', 'REMARKS', 'POLICY END DATE', 'NO OF DAYS', 'TPA ID', 'UHID',
+            'PREMIUM', 'PR0 RATA PREMIUM', 'GST', 'TOTAL'
+        ];
+        
+        // Create a temporary file in memory
+        $tempFile = tmpfile();
+
+        // Generate Excel file with the temporary file
+        $value = generate_excel($headers, $data, $tempFile, 1);
+
+        // Generate a random filename
+        $randomFilename = $file_name;
+
+        if($value){
+           $return = $this->batchFilesAndBatchListEntry($batch_files_data, $randomFilename, $export_data);
+           if($return){
+
+                // Set the appropriate headers for Excel file download
+                header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+                header('Content-Disposition: attachment;filename="' . $randomFilename . '"');
+                header('Cache-Control: max-age=0');
+
+                // Rewind the temporary file pointer
+                rewind($tempFile);
+
+                // Output the contents of the temporary file to the browser
+                fpassthru($tempFile);
+
+                // Close and remove the temporary file
+                fclose($tempFile);
+
+           }else{
+               return false;
+           }
+        }
+
+
+
+    }
+
+
+    public function generateExcelForCorrection($file_name, $objects, $batch_files_data)
+    {
+
+        $correction_data = transform_objects_to_array_for_correction($objects);
+
+        $headers = [
+            'Emp Code', 'RISK ID', 'NAME OF EMP/DEP', 'EMP/DEP TYPE', 'RELATION', 'DOB', 'GENDER', 'Wrong Data', 'Correct Data', 'Remarks', 'Endorsement_Id'
+        ];
+
+
+         // Create a temporary file in memory
+         $tempFile = tmpfile();
+
+         // Generate Excel file with the temporary file
+         $value = generate_excel($headers, $correction_data, $tempFile);
+ 
+         // Generate a random filename
+         $randomFilename = $file_name;
+ 
+         if($value){
+            $return = $this->batchFilesAndBatchListEntry($batch_files_data, $randomFilename, $objects);
+            if($return){
+ 
+                 // Set the appropriate headers for Excel file download
+                 header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+                 header('Content-Disposition: attachment;filename="' . $randomFilename . '"');
+                 header('Cache-Control: max-age=0');
+ 
+                 // Rewind the temporary file pointer
+                 rewind($tempFile);
+ 
+                 // Output the contents of the temporary file to the browser
+                 fpassthru($tempFile);
+ 
+                 // Close and remove the temporary file
+                 fclose($tempFile);
+
+                 return true;
+ 
+            }else{
+                return false;
+            }
+         }
+
+    }
+    
+}
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index e47f06a2..21448fe0 100644
--- a/app/Controllers/EmployeeController.php
+++ b/app/Controllers/EmployeeController.php
@@ -12,11 +12,16 @@ use App\Models\EmployeeModel;
 use App\Models\EmployeePolicyModel;
 use App\Models\ClientModel;
 use App\Models\FileModel;
+use App\Models\BatchListModel;
+use App\Models\BatchFileModel;
+use App\Models\EmpEndorsementModel;
+use App\Models\ClientPolicyModel;
 
 use App\Controllers\Jobs ;
 use App\Controllers\JobWorker ;
 use App\Controllers\Jobs\SubJob;
 use App\Controllers\EmployeeServiceController;
+use App\Controllers\EmpDataServiceController;
 
 use CodeIgniter\API\ResponseTrait;
 
@@ -32,6 +37,11 @@ class EmployeeController extends AdminController
     protected $employeePolicyModel;
     protected $clientModel;
     protected $fileModel;
+    protected $batchListModel;
+    protected $batchFileModel;
+    protected $empEndorsementModel;
+    protected $clientPolicyModel;
+
     public function __construct()
     {
         // helper('utility');
@@ -41,6 +51,10 @@ class EmployeeController extends AdminController
         $this->employeePolicyModel = new EmployeePolicyModel();
         $this->clientModel = new ClientModel();
         $this->fileModel = new FileModel();
+        $this->batchListModel    = new BatchListModel();
+        $this->batchFileModel    = new BatchFileModel();
+        $this->empEndorsementModel    = new EmpEndorsementModel();
+        $this->clientPolicyModel  = new ClientPolicyModel();
     }
 
     public function list()
@@ -177,6 +191,9 @@ class EmployeeController extends AdminController
         }
 
         $data['actions'] = ['inception' => 'Inception + Addition + Deletion','correction' =>'Correction','si_enhancement' =>'SI Enhancement'];
+        $data['events'] = ['inception' => 'Inception + Addition','correction' =>'Correction', 'deletion'=>'Deletion' ,'si_enhancement' =>'SI Enhancement'];
+        $data['import_or_export'] = ['import' => 'Import','export' =>'Export'];
+        $data['insurer_or_tpa'] = ['insurer' => 'Insurer','tpa' =>'TPA'];
         $data['fileList'] = $this->fileModel
                             ->select(['files.*','up.emp_code','up.first_name','pm.name as policy_name','c.short_name'])
                             ->join('user_profiles up','files.created_by = up.id')
@@ -186,77 +203,251 @@ class EmployeeController extends AdminController
         // dd($data['fileList']);die();
         if($this->request->getMethod() == "get")
         {
-           $this->loadLayout('employee_upload',$data);    
+           $this->loadLayout('import_export',$data);    
         }
         
     }
 
     public function getExcelFileErrors()
     {
+        $file_id = $this->request->uri->getSegment(3);
+        $empServiceController = new EmployeeServiceController();
         
-         $file_id = $this->request->uri->getSegment(3);
-         $file = $this->fileModel->find($file_id);
-         $error_data = json_decode($file['reason']);
-         $file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
+        // Render views and capture output
+        $result = $empServiceController->getExcelErrorData($file_id);
 
-         //check the file exist or not
-         if(!file_exists($file_name_with_path))
-         {
-            $error_message = "File not found";
-            $this->myLogger->logme('error',($error_message . ' for file id ' . $file_id));
-         }
-
-         $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
-         $sheet = $spreadsheet->getActiveSheet();
+        // echo '
';
+        // print_r($result); die;
+        echo view('excel_errors', $result);
     
-         $highestRowAndColumn = $sheet->getHighestRowAndColumn();
-         $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
-         $data['excel_header'] = $excel_data[0];
-         unset($excel_data[0]);
-         $data['excel_data'] = $excel_data;
-         
+    }
 
-         echo '
';
+     /**This downloadSampleExcelFile() function facilitates downloading various sample Excel files  
+    ** based on user-selected actions, handling file retrieval and download processes. **/
+    public function downloadSampleExcelFile($actionType = null)
+    {
+        // $actionType = $this->request->getGet();
+        $filePath = '';
+        // Path to your file
+        if($actionType == 'inception'){
+            $filePath = ROOTPATH . 'public/sample_excel/inception.xls';
 
-            // foreach ($error_data->error_data as $key => $value) {
-            //     print_r($excel_data[$key]);
-            //     foreach($value as $key2 => $value2){
-            //         // echo '
';
-            //         // print_r($excel_data[$key][$value2->col_idx]);
-            //     }
-                
-            // }
-            $finalArray = [];
-            foreach ($error_data->error_data as $key => $value) {
-                foreach($value as $key2 => $value2){
-                    $error_data = $value2->error;
+        }else if($actionType == 'correction'){
+            $filePath = ROOTPATH . 'public/sample_excel/inception_1.xls';
 
-                    echo '
';
-                    // print_r([$value2->col_idx]);
-                    $excel_data[$key][$value2->col_idx] = $error_data;
-                    // print_r($excel_data[$key]);
-                   
-                }
-                // print_r($excel_data[$key]);
-               // array_push($finalArray, $excel_data);
-            }
+        }else if($actionType == 'si_enhancement'){
+            $filePath = ROOTPATH . 'public/sample_excel/inception_2.xls';
+        }
+        
+        // Check if the file exists
+        if (file_exists($filePath)) {
+            
+            // Set the appropriate MIME type
+            $mimeType = mime_content_type($filePath);
 
-            print_r($excel_data);
-
- die; 
-           
-
-        //  echo '###################################################################### 
'; - // print_r($excel_data); - // echo '######################################################################
'; - // print_r($error_data->error_data); die; - - $headerData['page_name'] = 'Excel Error'; - echo view('layout/header', $headerData); - echo view('excel_errors', $data); - echo view('layout/footer'); + // Send the file to the client for download + return $this->response->download($filePath, null, $mimeType); + } else { + // File not found, show an error message or redirect + return redirect()->back()->with('error', 'File not found.'); + } } + public function importExport() + { + + $this->myLogger->logme('error','importExport function called'); + $empDataServiceController = new EmpDataServiceController(); + $client_id = $this->request->getPost('client_id'); + $client_policy_id = $this->request->getPost('client_policy_id'); + $insurer_or_tpa = $this->request->getPost('insurer_or_tpa'); + $event_type = $this->request->getPost('event_type'); + $actions = $this->request->getPost('action_type'); + + $batch_data = [ + 'client_id' => $client_id, + 'client_policy_id' => $client_policy_id, + 'insurer_or_tpa' => $insurer_or_tpa, + 'event_type' => $event_type, + 'actions' => $actions, + ]; + + $client_data = $this->clientModel->where('id', $client_id)->first(); + $policy_name = $this->clientPolicyModel->select('policies.name') + ->join('policies', 'policies.id = client_policy.policy_id') + ->where('client_policy.id', $client_policy_id)->first(); + $file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $policy_name['name']); + + if($actions == 'export'){ + + if($event_type == 'inception'){ + + $objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($client_policy_id, $insurer_or_tpa, $event_type, $actions); + $count = count($objects); + $this->myLogger->logme('error','Inception export data count : {data}', ['data'=> $count ]); + $batch_data['count'] = $count; -} + if($count == 0){ + + session()->setFlashdata('error', 'No data found'); + return redirect()->to(base_url('employee/upload')); + } + + $this->myLogger->logme('error','Inception export file name : {data}', ['data'=> $file_name ]); + $empDataServiceController->generateExcelForAdditionandInception($batch_data, $objects, $file_name); + + } else if($event_type == 'correction'){ + + $objects = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($client_id, $client_policy_id, $insurer_or_tpa); + $count = count($objects); + $this->myLogger->logme('error','Correction export data count : {data}', ['data'=> $count ]); + $batch_data['count'] = $count; + if($count == 0){ + session()->setFlashdata('error', 'No data found'); + return redirect()->to(base_url('employee/upload')); + } + $this->myLogger->logme('error','Correction export file name : {data}', ['data'=> $file_name ]); + $empDataServiceController->generateExcelForCorrection($file_name, $objects, $batch_data); + } + + }else if($actions == 'import'){ + + if($event_type == 'inception'){ + + $file = $this->request->getFile('import_file_data'); + $is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); + $filename = $file->getName(); + + $this->myLogger->logme('error','Inception Import file name : {data}', ['data'=> $filename ]); + $random_number_count = 4; + $batch_code = generate_random_string($random_number_count); + + $this->myLogger->logme('error','Inception Import BATCH CODE : {data}', ['data'=> $batch_code ]); + + $batch_data['batch_code'] = $batch_code; + $batch_data['created_by'] = get_session_userid(); + $batch_data['file_name'] = $filename; + $insert = $this->batchFileModel->insert($batch_data); + $batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first(); + + $file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name']; + + //check the file exist or not + if(!file_exists($file_name_with_path)) + { + session()->setFlashdata('error', 'File not found'); + return redirect()->to(base_url('employee/upload')); + } + + $data = read_excel_file_to_array($file_name_with_path); + unset($data[0]); + array_pop($data); + // dd($data ); + foreach ($data as $key => $value) { + // Check if the array is not empty and has the necessary data + if (!empty($value) && (isset($value[15]) || isset($value[16]))) { + + // Extract the client_policy_id and tpa_id from the array + $tpa_id = $value[15] != null ? $value[15] : ''; + $uhid = $value[16] != null ? $value[16] : ''; + $emp_code = $value[2]; + $name = $value[1]; + + // echo $tpa_id, $uhid, $emp_code, $name; die; + $this->employeePolicyModel->updateTPAIDorUHID( $client_policy_id, $client_id, $name, $emp_code, $uhid, $tpa_id); + $query = $this->employeePolicyModel->getLastQuery(); + echo $query . "
"; + + }else{ + + session()->setFlashdata('error', 'Something went wrong'); + return redirect()->to(base_url('employee/upload')); + } + + } + + session()->setFlashdata('success', 'Data updated successfully'); + return redirect()->to(base_url('employee/upload')); + + }else if($event_type == 'correction'){ + + $file = $this->request->getFile('import_file_data'); + $is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); + $filename = $file->getName(); + + $this->myLogger->logme('error','Correction Import file name : {data}', ['data'=> $filename ]); + $random_number_count = 4; + $batch_code = generate_random_string($random_number_count); + $this->myLogger->logme('error','Correction Import BATCH CODE : {data}', ['data'=> $batch_code ]); + + + $batch_data['batch_code'] = $batch_code; + $batch_data['created_by'] = get_session_userid(); + $batch_data['file_name'] = $filename; + $insert = $this->batchFileModel->insert($batch_data); + $batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first(); + + $file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name']; + + if(!file_exists($file_name_with_path)) + { + session()->setFlashdata('error', 'File not found'); + return redirect()->to(base_url('employee/upload')); + } + + $data = read_excel_file_to_array($file_name_with_path); + unset($data[0]); + // dd($data); + foreach ($data as $key => $value) { + + if (!empty($value) && isset($value[10])) { + + $emp_code = $value[0]; + $uhid = $value[1]; + $endorsement_id = $value[10] != null ? $value[10] : ''; + // $this->employeePolicyModel->updateCorrectionData($emp_code, $uhid, $endorsement_id); + + $queryData = $this->empEndorsementModel->select('emp_endorsement.*') + ->join('employees', 'employees.id = emp_endorsement.emp_id') + ->join('employee_polices', 'employee_polices.employee_id = employees.id') + ->where('employees.emp_code', $emp_code) + ->where('employees.client_id', $client_id) + ->where('employee_polices.client_policy_id', $client_policy_id) + ->where('employee_polices.uhid', $uhid) + ->get() + ->getResultArray(); + + // dd($queryData); + + foreach ($queryData as $endorsementData) { + + $emp_endoresment_id = $endorsementData['id']; + $emp_id = $endorsementData['emp_id']; + $field_name = $endorsementData['field_name']; + $new_value = $endorsementData['new_value']; + $this->empEndorsementModel->where('id', $emp_endoresment_id)->set('endorsement_id', $endorsement_id)->update(); + $this->employeeModel->where('id', $emp_id)->set($field_name, $new_value)->update(); + } + + $query = $this->employeePolicyModel->getLastQuery(); + echo $query . "
"; + }else{ + session()->setFlashdata('error', 'Something went wrong'); + return redirect()->to(base_url('employee/upload')); + } + + } + + session()->setFlashdata('success', 'Data updated successfully'); + return redirect()->to(base_url('employee/upload')); + + } + + } + + + } + + +} \ No newline at end of file diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index 5d97f51b..ccf52ee4 100644 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -378,6 +378,103 @@ class EmployeeServiceController extends AdminController } +// --------------------------------------------------------------------------------- + + + public function getExcelErrorData($file_id){ + + $file = $this->fileModel->find($file_id); + $error_data = json_decode($file['reason']); + + // return $error_data; + + $file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name']; + + //check the file exist or not + if(!file_exists($file_name_with_path)) + { + $error_message = "File not found"; + $this->myLogger->logme('error',($error_message . ' for file id ' . $file_id)); + } + + $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path); + $sheet = $spreadsheet->getActiveSheet(); + + $highestRowAndColumn = $sheet->getHighestRowAndColumn(); + $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); + $excelErrorData['excel_header'] = $excel_data[0]; + unset($excel_data[0]); + // echo '
';
+
+         if($error_data->error_type == 1){
+
+            $finalArray = [];
+            foreach ($error_data->error_data as $key => $value) {
+    
+                foreach ($value as $key2 => $value2) {
+                    $error_data = $value2->error;
+                    $data = ['value' => $excel_data[$key][$value2->col_idx], 'error'=>$error_data,];
+                    $excel_data[$key][$value2->col_idx] = $data;
+    
+                }
+                array_push($finalArray, $excel_data[$key]);
+            }
+    
+            foreach ($finalArray as $fkey => $value){
+                foreach ($value as $vkey => $arrayData){
+                    if(!is_array($arrayData)){
+                        $data = ['value' => $arrayData];
+                        $finalArray[$fkey][$vkey] =  $data;
+                    }
+                }
+            }
+    
+            $excelErrorData['excel_data'] = $finalArray;
+            return $excelErrorData;
+
+         }else if($error_data->error_type == 2){
+
+
+            $allErrors = [];
+            $typeTowArray = [];
+
+            foreach ($error_data->error_data as $index => $item) {
+
+                foreach ($item as $field) {
+                    if (!isset($allErrors[$index])) {
+                        $allErrors[$index] = [];
+                    }
+                    $allErrors[$index] = array_merge($allErrors[$index], $field->error);
+                }
+            }
+
+
+            foreach ($allErrors as $key => $value){
+                $data = ['value' => $excel_data[$key][1], 'error'=>$value,];
+                $excel_data[$key][1] = $data;
+                array_push($typeTowArray, $excel_data[$key]);
+            }
+
+            foreach ($typeTowArray as $fkey => $value){
+                foreach ($value as $vkey => $arrayData){
+                    if(!is_array($arrayData)){
+                        $data = ['value' => $arrayData];
+                        $typeTowArray[$fkey][$vkey] =  $data;
+                    }
+                }
+            }
+
+            $excelErrorData['excel_data'] = $typeTowArray;
+            return $excelErrorData;
+
+         }
+
+
+
+ }
+
+
+// ---------------------------------------------------------------------------------
 
     
 }
diff --git a/app/Controllers/LoginController.php b/app/Controllers/LoginController.php
index 1dc8fb89..70863177 100644
--- a/app/Controllers/LoginController.php
+++ b/app/Controllers/LoginController.php
@@ -46,7 +46,7 @@ class LoginController extends BaseController
                         set_session_data($session_data);
                         log_message('error', 'Set The UserId : `'. $user->id .'` in Session');
                         log_message('error', 'Is User Login Sucessfully');
-                        $this->getUserDeviceInfo($user->id);
+                        $this->getUserDeviceInfo($user->id, 'NhanceUser');
                         return redirect()->to(base_url('/dashboard/view'));
 
                     }else{
@@ -79,7 +79,7 @@ class LoginController extends BaseController
     }
 
 
-    public function getUserDeviceInfo($userId){
+    public function getUserDeviceInfo($userId, $type_of_user){
 
         // Load the UserAgent library
         $userAgent = $this->request->getUserAgent();
@@ -95,6 +95,7 @@ class LoginController extends BaseController
 
         $datd = [
            'user_id' => $userId,
+           'user_type' => $type_of_user,
            'ip' => $ipAddress,
            'platform' => $platform,
            'broswer' => $browser,
diff --git a/app/Helpers/excel_import_export_helper.php b/app/Helpers/excel_import_export_helper.php
new file mode 100644
index 00000000..9a655c2e
--- /dev/null
+++ b/app/Helpers/excel_import_export_helper.php
@@ -0,0 +1,261 @@
+getActiveSheet()->setTitle('Sheet 1');
+
+        // Set headers into the spreadsheet
+        $spreadsheet->getActiveSheet()->fromArray([$headers], null, 'A1');
+
+        // Set data into the spreadsheet
+        $spreadsheet->getActiveSheet()->fromArray($data, null, 'A2');
+
+        if($totals){
+            // Call the helper function for Calculate GST, Pro Rata Premium, and Total sums for inception
+            add_totals_row($spreadsheet, $data);
+        }
+
+        // Create Excel writer
+        $writer = new Xlsx($spreadsheet);
+
+        try {
+            // Save Excel file to the specified path
+            $writer->save($filename);
+            return true; // Return true if file was successfully saved
+        } catch (\Exception $e) {
+            // Log or handle the exception
+            return false; // Return false if there was an error saving the file
+        }
+    }
+}
+
+
+if (! function_exists('transform_objects_to_array_for_inception')) {
+    function transform_objects_to_array_for_inception($objects) {
+
+        // Define an array to store the transformed data
+        $data  = [];
+        $TPAID = "";
+        $UHID  = "";
+
+        // Initialize serial number
+        $serialNumber = 1;
+
+        // Iterate through each object
+        foreach ($objects as $obj) {
+            // Extract all values for the object
+            $rowData = [
+                $serialNumber++,                     // Serial Number
+                $obj->emp_name,                      // Employee Name
+                $obj->emp_code,                      // Employee Code
+                $obj->emp_type,                      // Employee Type
+                $obj->emp_relationship_code,         // Relationship Code
+                $obj->emp_dob,                       // Date of Birth
+                $obj->emp_gender,                    // Employee Gender
+                $obj->pre_existing_alignments,       // Pre-existing Alignments
+                $obj->basic_cover_si,                // Basic Cover SI
+                $obj->date_coverage,                 // Date Coverage
+                $obj->emp_age,                       // Employee Age
+                $obj->emp_relationship,              // Employee Relationship
+                $obj->change_event,                  // Change Event
+                $obj->policy_end_date,               // Policy End Date
+                $obj->days,                          // Days
+                $TPAID,                              //EMPTY FIELD FOR TPA ID  
+                $UHID,                               //EMPTY FIELD FOR UHID 
+                $obj->premium,                       // Premium
+                $obj->rata_premimum,                 // Rata Premium
+                $obj->gst,                           // GST
+                $obj->total                          // Total
+            ];
+
+            // Append the row data to the main data array
+            $data[] = $rowData;
+        }
+
+        return $data;
+    }
+}
+
+
+if (! function_exists('transform_objects_to_array_for_correction')) {
+    function transform_objects_to_array_for_correction($objects) {
+
+        // Define an array to store the transformed data
+        $data  = [];
+        $endorsement_id = "";
+
+        // Iterate through each object
+        foreach ($objects as $obj) {
+            // Extract all values for the object
+            $rowData = [
+                $obj->emp_code,                         
+                $obj->uhid,                             
+                $obj->emp_name,                         
+                $obj->emp_type,                         
+                $obj->relationship_code,                      
+                $obj->emp_dob,                          
+                $obj->emp_gender,                        
+                $obj->old_value,                     
+                $obj->new_value,                    
+                $obj->remarks,                     
+                $endorsement_id,
+            ];
+
+            // Append the row data to the main data array
+            $data[] = $rowData;
+        }
+
+        return $data;
+    }
+}
+
+
+if (!function_exists('add_totals_row')) {
+    function add_totals_row(Spreadsheet $spreadsheet, array $data)
+    {
+        // Calculate GST, Pro Rata Premium, and Total sums
+        $gstSum = 0;
+        $proRataPremiumSum = 0;
+        $totalSum = 0;
+
+        foreach ($data as $row) {
+            $gstSum += $row[18];
+            $proRataPremiumSum += $row[19];
+            $totalSum += $row[20];
+        }
+
+        // Add a new row with sums
+        $lastRow = count($data) + 1; // To get the last row number
+        $spreadsheet->getActiveSheet()->setCellValue('R' . ($lastRow + 1), 'TOTALS');
+        $spreadsheet->getActiveSheet()->setCellValue('S' . ($lastRow + 1), $gstSum);
+        $spreadsheet->getActiveSheet()->setCellValue('T' . ($lastRow + 1), $proRataPremiumSum);
+        $spreadsheet->getActiveSheet()->setCellValue('U' . ($lastRow + 1), $totalSum);
+    }
+}
+
+
+if (!function_exists('read_excel_file_to_array')) {
+    function read_excel_file_to_array($file)
+    {
+        // Load the Excel file
+        $spreadsheet = IOFactory::load($file);
+
+        // Get the active sheet
+        $sheet = $spreadsheet->getActiveSheet();
+
+        // Get the highest row and column numbers
+        $highestRow = $sheet->getHighestRow();
+        $highestColumn = $sheet->getHighestColumn();
+
+        $data = [];
+
+        // Iterate through each row
+        for ($row = 1; $row <= $highestRow; $row++) {
+            // Initialize the row data array
+            $rowData = [];
+
+            // Iterate through each column in the row
+            for ($col = 'A'; $col <= $highestColumn; $col++) {
+                // Get the cell value
+                $value = $sheet->getCell($col . $row)->getValue();
+                
+                // Add the cell value to the row data array
+                $rowData[] = $value;
+            }
+
+            // Add the row data to the main data array
+            $data[] = $rowData;
+        }
+
+        // Return the array containing data from the Excel file
+        return $data;
+    }
+}
+
+
+// app/Helpers/filename_helper.php
+
+if (! function_exists('generate_filename')) {
+    function generate_filename($client_short_name, $event_type, $actions, $insurer_or_tpa, $policy_name) {
+
+        $evenTypeLabel = '';
+        if($event_type == 'inception'){
+            $evenTypeLabel = 'I';
+        }else if($event_type == 'deletion'){
+            $evenTypeLabel = 'D';
+        }else if($event_type == 'correction'){
+            $evenTypeLabel = 'C';
+        }else if($event_type == 'si_enhancement'){
+            $evenTypeLabel = 'SI';
+        }
+
+        $insurer_or_tpa_lable = "";
+        if($insurer_or_tpa == 'insurer'){
+            $insurer_or_tpa_lable = 'I';
+        }else if($insurer_or_tpa == 'tpa'){
+            $insurer_or_tpa_lable = 'T';
+        }
+
+        $actions = 'E';
+        $currentDateTime = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
+        $formattedDateTime = $currentDateTime->format('d-m-Y_H-i-s');
+        $policy_name = 'dsfjaisdjfa;ldsfaksl;dfaksdfaksdf';
+        $policy_name = str_replace(' ', '_', $policy_name);
+
+        // Generate file name
+        $file_name = $client_short_name. '_' . $policy_name . '_' . $insurer_or_tpa_lable . $actions . $evenTypeLabel . '_' . $formattedDateTime . '.xlsx';
+        return $file_name;
+    }
+}
diff --git a/app/Models/BatchFileModel.php b/app/Models/BatchFileModel.php
new file mode 100644
index 00000000..d97a7391
--- /dev/null
+++ b/app/Models/BatchFileModel.php
@@ -0,0 +1,25 @@
+findAll();
         return ($result);
    }
+
+    //------------------------------------------------------------------
+
+    public function getInceptionEmployeeDataForExportExcel($client_policy_id, $insurer_or_tpa, $event_type)
+    {
+        return $this->db->table('employee_polices')
+            ->select('employees.name AS emp_name,
+                    employees.emp_code AS emp_code,
+                    employees.dob  AS emp_dob,
+                    employees.gender AS emp_gender,
+                    employees.change_event AS change_event,
+                    employees.relationship AS emp_relationship,
+                    employees.relationship_code AS emp_relationship_code,
+                    TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
+                    "Has Define" as emp_type,
+
+                    employee_polices.id as employee_policy_id, 
+                    employee_polices.pre_existing_alignments, 
+                    employee_polices.basic_cover_si, 
+                    employee_polices.date_coverage, 
+                    employee_polices.policy_end_date, 
+                    employee_polices.days,
+                    employee_polices.premium,
+                    employee_polices.rata_premimum,
+                    employee_polices.gst,
+                    (employee_polices.rata_premimum + employee_polices.gst) AS total, 
+                    batch_data.emp_policy_id, 
+                    batch_data.bl AS batch_list_batch_code, 
+                    batch_data.bf AS batch_files_batch_code')
+
+            ->join('employees', 'employees.id = employee_polices.employee_id', 'left')
+            ->join("(
+                SELECT 
+                    batch_list.emp_policy_id, 
+                    batch_list.batch_code as bl, 
+                    batch_files.batch_code as bf
+                FROM batch_files 
+                LEFT JOIN batch_list ON batch_files.batch_code = batch_list.batch_code 
+                WHERE batch_files.event_type = 'inception' 
+                    AND batch_files.actions = 'export' 
+                    AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}') as batch_data", 'employee_polices.id = batch_data.emp_policy_id', 'left')
+            ->where('batch_data.bf', null)
+            ->where('batch_data.bl', null)
+            ->where('employee_polices.client_policy_id', $client_policy_id)
+            ->get()
+            ->getResult();
+    }
+
+
+    public function getCorrectionEmployeesDataForExportExcel($client_id, $client_policy_id, $insurer_or_tpa)
+    {
+
+        return $this->db->table('emp_endorsement')
+        ->select('emp_endorsement.id, 
+                    emp_endorsement.emp_id, 
+                    emp_endorsement.emp_code, 
+                    emp_endorsement.endorsement_id, 
+                    emp_endorsement.old_value, 
+                    emp_endorsement.new_value, 
+                    emp_endorsement.field_name, 
+                    emp_endorsement.remarks, 
+                    employees.name AS emp_name, 
+                    employees.dob AS emp_dob, 
+                    employees.gender AS emp_gender, 
+                    employees.client_id AS emp_client_id, 
+                    "Has Define" as emp_type,
+                    employee_polices.uhid,
+                    employees.relationship_code,
+                    batch_data.emp_policy_id, 
+                    batch_data.bl AS batch_list_batch_code, 
+                    batch_data.bf AS batch_files_batch_code')
+        ->join('employees', 'employees.id = emp_endorsement.emp_id', 'left')
+        ->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
+        ->join("(SELECT batch_list.emp_policy_id, 
+                    batch_list.batch_code as bl, 
+                    batch_files.batch_code as bf 
+                    FROM batch_files 
+                    LEFT JOIN batch_list ON batch_files.batch_code = batch_list.batch_code 
+                    WHERE batch_files.event_type = 'correction' 
+                    AND batch_files.actions = 'export' 
+                    AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}') as batch_data", 'emp_endorsement.emp_id = batch_data.emp_policy_id', 'left', false)
+        ->where('batch_data.bf IS NULL')
+        ->where('batch_data.bl IS NULL')
+        ->where('emp_endorsement.endorsement_id', '')
+        ->where('employees.client_id', $client_id)
+        ->where('employee_polices.client_policy_id', $client_policy_id)
+        ->get()
+        ->getResult();
+
+    }
+
+
+    public function updateTPAIDorUHID( $client_policy_id, $client_id, $name, $emp_code, $uhid, $tpa_id)
+    {
+
+        // $this->table('employee_polices')
+        // ->join('employees', 'employees.id = employee_polices.employee_id')
+        // ->set('employee_polices.tpa_id', $tpa_id)
+        // ->set('employee_polices.uhid', $uhid)
+        // ->where('employees.emp_code', $emp_code)
+        // ->where('employees.name', $name)
+        // ->where('employees.client_id', $client_id)
+        // ->where('employee_polices.client_policy_id', $client_policy_id)
+        // ->update();
+
+        $query = "UPDATE employee_polices
+                    JOIN employees ON employees.id = employee_polices.employee_id
+                    SET employee_polices.tpa_id = '{$tpa_id}', 
+                        employee_polices.uhid = '{$uhid}'
+                    WHERE employees.emp_code = '{$emp_code}'
+                    AND employees.name = '{$name}'
+                    AND employees.client_id = '{$client_id}'
+                    AND employee_polices.client_policy_id = '{$client_policy_id}'";
+
+        $this->query($query);
+
+
+    }
+
+
+    public function updateCorrectionData($emp_code, $uhid, $endorsement_id){
+
+        $sql = "
+            UPDATE emp_endorsement 
+            JOIN employees ON employees.id = emp_endorsement.emp_id
+            JOIN employee_polices ON employees.id = employee_polices.employee_id
+            SET emp_endorsement.endorsement_id = '$endorsement_id'
+            WHERE employees.emp_code = '$emp_code'
+            AND employee_polices.uhid = '$uhid'
+        ";
+        $query = $this->query($sql);
+    }
+
+    
+    //------------------------------------------------------------------
 }
diff --git a/app/Views/UserList.php b/app/Views/UserList.php
index 47806801..bb36986f 100644
--- a/app/Views/UserList.php
+++ b/app/Views/UserList.php
@@ -291,5 +291,13 @@ function onlyNumbers(event){
     return false;
 }
 
+var form = document.getElementById("UserForm");
+
+// Add submit event listener to the form
+form.addEventListener("submit", function(event) {
+    // Disable the submit button to avoid multiple submissions
+    document.getElementById("btnSubmit").disabled = true;
+});
+
 
 
diff --git a/app/Views/client_basic_info.php b/app/Views/client_basic_info.php
index c7a54c83..e743434f 100644
--- a/app/Views/client_basic_info.php
+++ b/app/Views/client_basic_info.php
@@ -127,8 +127,13 @@ $(document).ready(function () {
     $("#general_form").submit(function(event) {
 
         event.preventDefault(); 
+
+        var $submitButton = $('#general_form').find('button[type="submit"]');
+        $submitButton.prop('disabled', true); // Disable the submit button
+
         var isValid = $('#general_form').parsley().validate();    
         if (!isValid) { 
+            $submitButton.prop('disabled', false);
             console.log('Form is Empty', 'Warning');
             return ; 
         }
@@ -162,7 +167,7 @@ $(document).ready(function () {
                         $('#kyc_tab').click();
                         var message = (PrimaryKey === '') ? 'Client General Info Created successfully' : 'Client General Info Updated successfully';
                         toastr.success(message, 'Success');
-
+                        $submitButton.prop('disabled', false);
                     }, 1000);
                 }
                 
@@ -177,42 +182,57 @@ $(document).ready(function () {
                 $('#kyc_PrimaryKey').val(res.data.id);
                 $('#entity_type').val(res.data.entity_type_id);
 
-                $.ajax({
-                    url: '' + res.data.entity_type_id,
-                    type: "GET",
-                    dataType: 'json',
-                    processData: false,
-                    contentType: false,
-                    success: function (res) {
-                        
-                        console.log(res);
-                        var tbody = $('#tbody');
-                        tbody.empty(); 
+                console.log()
 
-                        $.each(res.data, function (index, item) {
-                            var row = `
-                                         ${item.file_name}
-                                        
- - - -
- - - `; - tbody.append(row); - }); - }, - error: function (xhr, status, error) { - console.error(xhr.responseText); - console.error(status, error); - } - }); + if(PrimaryKey === ''){ + $.ajax({ + url: '' + res.data.entity_type_id, + type: "GET", + dataType: 'json', + processData: false, + contentType: false, + success: function (res) { + + console.log('kyc docs', res); + var tbody = $('#tbody'); + tbody.empty(); + $.each(res.data, function (index, item) { + var row = ` + ${item.file_name} +
+ + + +
+ + + `; + tbody.append(row); + }); + }, + error: function (xhr, status, error) { + console.error(xhr.responseText); + console.error(status, error); + } + }); + } }, error: function (xhr, status, error) { console.error(xhr.responseText); console.error(status, error); + setTimeout(function() { + $('.loader').fadeOut(); + $('.loader-mask').delay(350).fadeOut('slow'); + $submitButton.prop('disabled', false); + if (xhr.status === 404) { + toastr.warning('Resource not found', 'Warning'); + } else if (xhr.status === 500) { + toastr.warning('Internal server error', 'Warning'); + } else { + toastr.warning('Unknown error occurred', 'Warning'); + } + }, 1000); } }); }); diff --git a/app/Views/client_kyc.php b/app/Views/client_kyc.php index 9ea8fbea..59051f6a 100644 --- a/app/Views/client_kyc.php +++ b/app/Views/client_kyc.php @@ -94,7 +94,7 @@ +//-------------------------------------------------------------------------------------- + + + /**This function updates the download link based on the selected option in the dropdown menu. **/ + $('#upload-action-type').change(function() { + + var selectedValue = $(this).val(); + if(selectedValue !== ''){ + $('#file_upload').show(); + var fullURL = '' + selectedValue; + $('#excel_download').attr('href', fullURL); + }else{ + $('#file_upload').hide(); + $('#excel_download').removeAttr('href'); + } + }); + + + /** This function verifies if the download link (#excel_download) has its href attribute set, + ** ensuring proper link configuration. **/ + + $('#excel_download').click(function() { + + // Check if the element with ID "excel_download" has the href attribute set + if (!$(this).attr('href')) { + // If href attribute is not set, show an error message + toastr.warning('Please select an Action to download a sample Excel.', 'Warning'); + } else { + console.log('Download action triggered.'); + } + }); +//-------------------------------------------------------------------------------------- + + \ No newline at end of file diff --git a/app/Views/excel_errors.php b/app/Views/excel_errors.php index 0b9b2044..25b100ad 100644 --- a/app/Views/excel_errors.php +++ b/app/Views/excel_errors.php @@ -1,34 +1,125 @@ -
-
-
-
-
-
-

Excel Error List

-
-
-
- - - - - - - - - - - - - - - - - -
-
-
-
-
- -
\ No newline at end of file + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
> + '; + echo '' . implode("
", $data['error']) . '
'; + } + ?> +
+
+ + + + + + + + + + + + + + diff --git a/app/Views/import_export.php b/app/Views/import_export.php new file mode 100644 index 00000000..361c9124 --- /dev/null +++ b/app/Views/import_export.php @@ -0,0 +1,32 @@ + + + + + + + + diff --git a/app/Views/insurer_or_tpa_data.php b/app/Views/insurer_or_tpa_data.php new file mode 100644 index 00000000..3a2af61c --- /dev/null +++ b/app/Views/insurer_or_tpa_data.php @@ -0,0 +1,334 @@ +
+ +
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index 21d677aa..672924c5 100644 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -43,10 +43,6 @@ /assets/css/jodit.css" rel="stylesheet" type="text/css" /> - - - - diff --git a/writable/session/.gitkeep b/public/sample_excel/.gitkeep similarity index 100% rename from writable/session/.gitkeep rename to public/sample_excel/.gitkeep diff --git a/public/sample_excel/inception.xls b/public/sample_excel/inception.xls new file mode 100644 index 0000000000000000000000000000000000000000..850d8d0654fa519e3adc68ad8e194c5be89f09b0 GIT binary patch literal 10240 zcmeHNeT-aH6+dsjXJ^~lEwtc*vyW|eDgA<$sE9%KYg!h&AMIAGq=~-nyzNdqJJZb0 zB5V9uD)@(i1ciizV6X&H)cAo35=AJQ7)|`BCYaa|Q~ZMj#biO$puqb3o%`O*o0(m^ zt;7VD)J}P19FtPVZbR&*#EE6uNWMQ7*1f5xz37VuL)sSdH~ne@*VAY zQm@wuGZ0Fz*w^TTCBH?3WAD;ymtI%nYRM0D%qgX8mk#+kxE4QqH#ag2h+2JE19@?z zAPv1>cjOBuLb_HK024a!~bemrH}lz!bB%RuAfGEdkr5K?zIrcLe*JEX&Aq zs^7PJIsL7o98K~wkyd$_yTq>SNOo`E?o6azzRDfqqbLWq4i6vLIyjh#tdU2!Weg6I z1R8tE`Zcl!iKpd4=y+KEzG&m_mlHPWoEoLSx-vRlx)lF%bV^-{|D8*J7(TUWo>zQ7 zZ#I5lXln84S1d!{vJ8FGGW6t<^q9`OuakG9R}fK(lLr$mKK+p;=~2kpV|9t__t+!J zRg9lF>CY28UOY7ajs6tZ5B?} zi4#^YuDz0ZnJz%0Oh8!TBGiAvE3eB?a`e! z2v-hf$Dn6$v>yz+++xlxL(tyr?!J9Pqa))t42|K;-rqMqG++;m-jv;Ij}IyPjR4W_ z%;YERF=q}Q>UWB{D|eNhoQqi*bZ7F1icTe8D&nnRY^qdranDXW`2zeswl`~M_YaNl z8yeYV_YLhH&W`LGhn9&cr+CP<-CNvZ#kPSW=Tuy~G-)rZ z1XV!cUT4}KD?3M=nJJp<7AE19akrQUZ{N&JX(A6%SQ}+$`lw;+Jw!CyCQ8%r_z(;j zowmI$5QZUqr&F17%kX=_IWjXfowrLtj-B8bE|CKd<3~%gGcGiLvNY$wQl~uU6yc`v zQV}x)dyYW;%#>YrN)UcCXhyh=a4R^UxIpA+IX~yvb)4XuRs|jx%yi0!XNz{(&E@7G zryr$>Krjcu(q6BE>D+XbRXoiw=$JC-I!3i@yP77QwD3! zEx2UGV_B!u&0*BwBHrnC$k(xbL%K{P)}rFUE0|p^AwUyzKy0f!Ahsg7b65ymTgJ-BMY#<<&qOxqh|PLEro2qi;OH6X>01j#u%TyQ z%s~|OjD1eoZr5uML|(1s#p^E*Ja5GFq?U#2uLwLJmo5Ozq4IZ3wpd#%f4qOU6OFm3kq?pGMB_9y z^6`s6BMqyiiN@E5Mm`2rBMr0LL}Q>e@?oVk(HO0bd{_anx#oj6^m~QBX_=OVt&n~( ztq@xDh-ro8U7EK|D}p|H!L*`i(SFm4p+(D0D~=XzHmwBSBxtQ^CDEdtrqzNLEi|nZ zTC~lyTICXrJkwf*7VR;u)z~mO>!y{Kck357(`rK>=ijv2(c+i6AHzGeGov^&(&5lI zlOZ3!ZsQ2_r5o z*wcmQyH|x?wfaqeE6xYZBcDMMv0&5ss>hi!(!y0lw48^GdMAjME3Z?y5;&f3eH)~s z*H{t)>TdYn*dD_CbYlj6P9OVIDmyMcikisR!_P)q5KX8K4cA0QeI7&;Rx}-+4rYN3 z@(^-2Ee$K0OFT4TMZ;qbHH9$?#*;)7h9{fRgzJ10u0z8(%;=o?Xsl2S`sf?Vk0_EI zZ6QU%Y}AeTF@A{vNhc!4Ac@o=i7bgEqDcJsjsVH!)mh>i$Y{$)LffN?B;)CbDw_Ml z22HezhM1WdyA^Y^4oP%LB+)vbMC*J)e86C?)##2Xl1>jvOp!eHWrKtstHlekbR+hS zUznk5GZa%a8^!;bc!>ecM#wjQjn$#y`p@8}n5t;v;NFPUV|2t7&Cgyk@xqO+TUQG` z7*{mwtDHeJ@g>o452>Mv*P&tl$*An$EG5)88$2BeMe}>h_$E>3n}nk2u5t#^B$h;z zs6&&eL&N-+LB!YlCaGvhWdtYdW-19Zoz<0{1R6gpT?|g5`N_Y+a)mth(-5re!r3gL zk)K3w7oye7P!fLaf{#pYN_x5J^z3sF{kxAoPa+SjhZG+{FdHQ6EMU&g$R@pJs{ z)TvZjz*W9MZaQvemus?S0ar+8H8-`uf*vXVHHLh;M(4gc8?@9#ehV^DS~f#JaknV8 zEod=satF!Cwgzk|#kLhxuDXSK9W{kDV=BLOaAP<92~K*j6+IWpA5WOQs1>_fTCPH$;pASi z-Q(oWn3nhA`jU*{DYS3{o^kYCVB}k`H%qVH#xBp1v{i43(8k`^7uG0blt z46TvJnO>xq7r9xlUqLq`ihFOENs)?}YTMfn;YIBbHG2i8VSa~Y>j~?AuvxIJRZjlm z&vUQ+@Yn5k9+Pj#haOEalW=F_?pVe*ziE73<^2fij7&lMA#M2wZ1oZhy3b-yfNmm6Y3CZuQ zCkbQT%1H{qT+t)v-v2u;&zr=;HcvLZpD*uh4_KJxFjhCMY)f!&5;>t)*~xc_;rv9o zG*g9pL5VH6kHq|@bxM`ImxZ)oD1U5C_P6BZ(_e?+HEY1>(h5U_{wXe zQ*Gb;VnQ}w{{262cls16fwP~$c}nd?WrEv{%5&9zRGwpUs62BVMWu!p-{9HCeC2%) z4kf*KmPa4^+k+6M&upXgqR#*0z8BU_oU-^VYlrT{7iWfu1H)W-k)7{Y&nOzNDFQo$*-1j_P-@1oSqeS`Pq zIcq)i*SEZ8R0g48LNU1dA1G&s=bCe{pX(Qd!2L|E|uFIK{TCLUim?`Ps= Ie^CE_0Ldo-IRF3v literal 0 HcmV?d00001 diff --git a/public/sample_excel/inception_1.xls b/public/sample_excel/inception_1.xls new file mode 100644 index 0000000000000000000000000000000000000000..850d8d0654fa519e3adc68ad8e194c5be89f09b0 GIT binary patch literal 10240 zcmeHNeT-aH6+dsjXJ^~lEwtc*vyW|eDgA<$sE9%KYg!h&AMIAGq=~-nyzNdqJJZb0 zB5V9uD)@(i1ciizV6X&H)cAo35=AJQ7)|`BCYaa|Q~ZMj#biO$puqb3o%`O*o0(m^ zt;7VD)J}P19FtPVZbR&*#EE6uNWMQ7*1f5xz37VuL)sSdH~ne@*VAY zQm@wuGZ0Fz*w^TTCBH?3WAD;ymtI%nYRM0D%qgX8mk#+kxE4QqH#ag2h+2JE19@?z zAPv1>cjOBuLb_HK024a!~bemrH}lz!bB%RuAfGEdkr5K?zIrcLe*JEX&Aq zs^7PJIsL7o98K~wkyd$_yTq>SNOo`E?o6azzRDfqqbLWq4i6vLIyjh#tdU2!Weg6I z1R8tE`Zcl!iKpd4=y+KEzG&m_mlHPWoEoLSx-vRlx)lF%bV^-{|D8*J7(TUWo>zQ7 zZ#I5lXln84S1d!{vJ8FGGW6t<^q9`OuakG9R}fK(lLr$mKK+p;=~2kpV|9t__t+!J zRg9lF>CY28UOY7ajs6tZ5B?} zi4#^YuDz0ZnJz%0Oh8!TBGiAvE3eB?a`e! z2v-hf$Dn6$v>yz+++xlxL(tyr?!J9Pqa))t42|K;-rqMqG++;m-jv;Ij}IyPjR4W_ z%;YERF=q}Q>UWB{D|eNhoQqi*bZ7F1icTe8D&nnRY^qdranDXW`2zeswl`~M_YaNl z8yeYV_YLhH&W`LGhn9&cr+CP<-CNvZ#kPSW=Tuy~G-)rZ z1XV!cUT4}KD?3M=nJJp<7AE19akrQUZ{N&JX(A6%SQ}+$`lw;+Jw!CyCQ8%r_z(;j zowmI$5QZUqr&F17%kX=_IWjXfowrLtj-B8bE|CKd<3~%gGcGiLvNY$wQl~uU6yc`v zQV}x)dyYW;%#>YrN)UcCXhyh=a4R^UxIpA+IX~yvb)4XuRs|jx%yi0!XNz{(&E@7G zryr$>Krjcu(q6BE>D+XbRXoiw=$JC-I!3i@yP77QwD3! zEx2UGV_B!u&0*BwBHrnC$k(xbL%K{P)}rFUE0|p^AwUyzKy0f!Ahsg7b65ymTgJ-BMY#<<&qOxqh|PLEro2qi;OH6X>01j#u%TyQ z%s~|OjD1eoZr5uML|(1s#p^E*Ja5GFq?U#2uLwLJmo5Ozq4IZ3wpd#%f4qOU6OFm3kq?pGMB_9y z^6`s6BMqyiiN@E5Mm`2rBMr0LL}Q>e@?oVk(HO0bd{_anx#oj6^m~QBX_=OVt&n~( ztq@xDh-ro8U7EK|D}p|H!L*`i(SFm4p+(D0D~=XzHmwBSBxtQ^CDEdtrqzNLEi|nZ zTC~lyTICXrJkwf*7VR;u)z~mO>!y{Kck357(`rK>=ijv2(c+i6AHzGeGov^&(&5lI zlOZ3!ZsQ2_r5o z*wcmQyH|x?wfaqeE6xYZBcDMMv0&5ss>hi!(!y0lw48^GdMAjME3Z?y5;&f3eH)~s z*H{t)>TdYn*dD_CbYlj6P9OVIDmyMcikisR!_P)q5KX8K4cA0QeI7&;Rx}-+4rYN3 z@(^-2Ee$K0OFT4TMZ;qbHH9$?#*;)7h9{fRgzJ10u0z8(%;=o?Xsl2S`sf?Vk0_EI zZ6QU%Y}AeTF@A{vNhc!4Ac@o=i7bgEqDcJsjsVH!)mh>i$Y{$)LffN?B;)CbDw_Ml z22HezhM1WdyA^Y^4oP%LB+)vbMC*J)e86C?)##2Xl1>jvOp!eHWrKtstHlekbR+hS zUznk5GZa%a8^!;bc!>ecM#wjQjn$#y`p@8}n5t;v;NFPUV|2t7&Cgyk@xqO+TUQG` z7*{mwtDHeJ@g>o452>Mv*P&tl$*An$EG5)88$2BeMe}>h_$E>3n}nk2u5t#^B$h;z zs6&&eL&N-+LB!YlCaGvhWdtYdW-19Zoz<0{1R6gpT?|g5`N_Y+a)mth(-5re!r3gL zk)K3w7oye7P!fLaf{#pYN_x5J^z3sF{kxAoPa+SjhZG+{FdHQ6EMU&g$R@pJs{ z)TvZjz*W9MZaQvemus?S0ar+8H8-`uf*vXVHHLh;M(4gc8?@9#ehV^DS~f#JaknV8 zEod=satF!Cwgzk|#kLhxuDXSK9W{kDV=BLOaAP<92~K*j6+IWpA5WOQs1>_fTCPH$;pASi z-Q(oWn3nhA`jU*{DYS3{o^kYCVB}k`H%qVH#xBp1v{i43(8k`^7uG0blt z46TvJnO>xq7r9xlUqLq`ihFOENs)?}YTMfn;YIBbHG2i8VSa~Y>j~?AuvxIJRZjlm z&vUQ+@Yn5k9+Pj#haOEalW=F_?pVe*ziE73<^2fij7&lMA#M2wZ1oZhy3b-yfNmm6Y3CZuQ zCkbQT%1H{qT+t)v-v2u;&zr=;HcvLZpD*uh4_KJxFjhCMY)f!&5;>t)*~xc_;rv9o zG*g9pL5VH6kHq|@bxM`ImxZ)oD1U5C_P6BZ(_e?+HEY1>(h5U_{wXe zQ*Gb;VnQ}w{{262cls16fwP~$c}nd?WrEv{%5&9zRGwpUs62BVMWu!p-{9HCeC2%) z4kf*KmPa4^+k+6M&upXgqR#*0z8BU_oU-^VYlrT{7iWfu1H)W-k)7{Y&nOzNDFQo$*-1j_P-@1oSqeS`Pq zIcq)i*SEZ8R0g48LNU1dA1G&s=bCe{pX(Qd!2L|E|uFIK{TCLUim?`Ps= Ie^CE_0Ldo-IRF3v literal 0 HcmV?d00001 diff --git a/public/sample_excel/inception_2.xls b/public/sample_excel/inception_2.xls new file mode 100644 index 0000000000000000000000000000000000000000..850d8d0654fa519e3adc68ad8e194c5be89f09b0 GIT binary patch literal 10240 zcmeHNeT-aH6+dsjXJ^~lEwtc*vyW|eDgA<$sE9%KYg!h&AMIAGq=~-nyzNdqJJZb0 zB5V9uD)@(i1ciizV6X&H)cAo35=AJQ7)|`BCYaa|Q~ZMj#biO$puqb3o%`O*o0(m^ zt;7VD)J}P19FtPVZbR&*#EE6uNWMQ7*1f5xz37VuL)sSdH~ne@*VAY zQm@wuGZ0Fz*w^TTCBH?3WAD;ymtI%nYRM0D%qgX8mk#+kxE4QqH#ag2h+2JE19@?z zAPv1>cjOBuLb_HK024a!~bemrH}lz!bB%RuAfGEdkr5K?zIrcLe*JEX&Aq zs^7PJIsL7o98K~wkyd$_yTq>SNOo`E?o6azzRDfqqbLWq4i6vLIyjh#tdU2!Weg6I z1R8tE`Zcl!iKpd4=y+KEzG&m_mlHPWoEoLSx-vRlx)lF%bV^-{|D8*J7(TUWo>zQ7 zZ#I5lXln84S1d!{vJ8FGGW6t<^q9`OuakG9R}fK(lLr$mKK+p;=~2kpV|9t__t+!J zRg9lF>CY28UOY7ajs6tZ5B?} zi4#^YuDz0ZnJz%0Oh8!TBGiAvE3eB?a`e! z2v-hf$Dn6$v>yz+++xlxL(tyr?!J9Pqa))t42|K;-rqMqG++;m-jv;Ij}IyPjR4W_ z%;YERF=q}Q>UWB{D|eNhoQqi*bZ7F1icTe8D&nnRY^qdranDXW`2zeswl`~M_YaNl z8yeYV_YLhH&W`LGhn9&cr+CP<-CNvZ#kPSW=Tuy~G-)rZ z1XV!cUT4}KD?3M=nJJp<7AE19akrQUZ{N&JX(A6%SQ}+$`lw;+Jw!CyCQ8%r_z(;j zowmI$5QZUqr&F17%kX=_IWjXfowrLtj-B8bE|CKd<3~%gGcGiLvNY$wQl~uU6yc`v zQV}x)dyYW;%#>YrN)UcCXhyh=a4R^UxIpA+IX~yvb)4XuRs|jx%yi0!XNz{(&E@7G zryr$>Krjcu(q6BE>D+XbRXoiw=$JC-I!3i@yP77QwD3! zEx2UGV_B!u&0*BwBHrnC$k(xbL%K{P)}rFUE0|p^AwUyzKy0f!Ahsg7b65ymTgJ-BMY#<<&qOxqh|PLEro2qi;OH6X>01j#u%TyQ z%s~|OjD1eoZr5uML|(1s#p^E*Ja5GFq?U#2uLwLJmo5Ozq4IZ3wpd#%f4qOU6OFm3kq?pGMB_9y z^6`s6BMqyiiN@E5Mm`2rBMr0LL}Q>e@?oVk(HO0bd{_anx#oj6^m~QBX_=OVt&n~( ztq@xDh-ro8U7EK|D}p|H!L*`i(SFm4p+(D0D~=XzHmwBSBxtQ^CDEdtrqzNLEi|nZ zTC~lyTICXrJkwf*7VR;u)z~mO>!y{Kck357(`rK>=ijv2(c+i6AHzGeGov^&(&5lI zlOZ3!ZsQ2_r5o z*wcmQyH|x?wfaqeE6xYZBcDMMv0&5ss>hi!(!y0lw48^GdMAjME3Z?y5;&f3eH)~s z*H{t)>TdYn*dD_CbYlj6P9OVIDmyMcikisR!_P)q5KX8K4cA0QeI7&;Rx}-+4rYN3 z@(^-2Ee$K0OFT4TMZ;qbHH9$?#*;)7h9{fRgzJ10u0z8(%;=o?Xsl2S`sf?Vk0_EI zZ6QU%Y}AeTF@A{vNhc!4Ac@o=i7bgEqDcJsjsVH!)mh>i$Y{$)LffN?B;)CbDw_Ml z22HezhM1WdyA^Y^4oP%LB+)vbMC*J)e86C?)##2Xl1>jvOp!eHWrKtstHlekbR+hS zUznk5GZa%a8^!;bc!>ecM#wjQjn$#y`p@8}n5t;v;NFPUV|2t7&Cgyk@xqO+TUQG` z7*{mwtDHeJ@g>o452>Mv*P&tl$*An$EG5)88$2BeMe}>h_$E>3n}nk2u5t#^B$h;z zs6&&eL&N-+LB!YlCaGvhWdtYdW-19Zoz<0{1R6gpT?|g5`N_Y+a)mth(-5re!r3gL zk)K3w7oye7P!fLaf{#pYN_x5J^z3sF{kxAoPa+SjhZG+{FdHQ6EMU&g$R@pJs{ z)TvZjz*W9MZaQvemus?S0ar+8H8-`uf*vXVHHLh;M(4gc8?@9#ehV^DS~f#JaknV8 zEod=satF!Cwgzk|#kLhxuDXSK9W{kDV=BLOaAP<92~K*j6+IWpA5WOQs1>_fTCPH$;pASi z-Q(oWn3nhA`jU*{DYS3{o^kYCVB}k`H%qVH#xBp1v{i43(8k`^7uG0blt z46TvJnO>xq7r9xlUqLq`ihFOENs)?}YTMfn;YIBbHG2i8VSa~Y>j~?AuvxIJRZjlm z&vUQ+@Yn5k9+Pj#haOEalW=F_?pVe*ziE73<^2fij7&lMA#M2wZ1oZhy3b-yfNmm6Y3CZuQ zCkbQT%1H{qT+t)v-v2u;&zr=;HcvLZpD*uh4_KJxFjhCMY)f!&5;>t)*~xc_;rv9o zG*g9pL5VH6kHq|@bxM`ImxZ)oD1U5C_P6BZ(_e?+HEY1>(h5U_{wXe zQ*Gb;VnQ}w{{262cls16fwP~$c}nd?WrEv{%5&9zRGwpUs62BVMWu!p-{9HCeC2%) z4kf*KmPa4^+k+6M&upXgqR#*0z8BU_oU-^VYlrT{7iWfu1H)W-k)7{Y&nOzNDFQo$*-1j_P-@1oSqeS`Pq zIcq)i*SEZ8R0g48LNU1dA1G&s=bCe{pX(Qd!2L|E|uFIK{TCLUim?`Ps= Ie^CE_0Ldo-IRF3v literal 0 HcmV?d00001 diff --git a/public/sample_excel/inception_3.xls b/public/sample_excel/inception_3.xls new file mode 100644 index 0000000000000000000000000000000000000000..850d8d0654fa519e3adc68ad8e194c5be89f09b0 GIT binary patch literal 10240 zcmeHNeT-aH6+dsjXJ^~lEwtc*vyW|eDgA<$sE9%KYg!h&AMIAGq=~-nyzNdqJJZb0 zB5V9uD)@(i1ciizV6X&H)cAo35=AJQ7)|`BCYaa|Q~ZMj#biO$puqb3o%`O*o0(m^ zt;7VD)J}P19FtPVZbR&*#EE6uNWMQ7*1f5xz37VuL)sSdH~ne@*VAY zQm@wuGZ0Fz*w^TTCBH?3WAD;ymtI%nYRM0D%qgX8mk#+kxE4QqH#ag2h+2JE19@?z zAPv1>cjOBuLb_HK024a!~bemrH}lz!bB%RuAfGEdkr5K?zIrcLe*JEX&Aq zs^7PJIsL7o98K~wkyd$_yTq>SNOo`E?o6azzRDfqqbLWq4i6vLIyjh#tdU2!Weg6I z1R8tE`Zcl!iKpd4=y+KEzG&m_mlHPWoEoLSx-vRlx)lF%bV^-{|D8*J7(TUWo>zQ7 zZ#I5lXln84S1d!{vJ8FGGW6t<^q9`OuakG9R}fK(lLr$mKK+p;=~2kpV|9t__t+!J zRg9lF>CY28UOY7ajs6tZ5B?} zi4#^YuDz0ZnJz%0Oh8!TBGiAvE3eB?a`e! z2v-hf$Dn6$v>yz+++xlxL(tyr?!J9Pqa))t42|K;-rqMqG++;m-jv;Ij}IyPjR4W_ z%;YERF=q}Q>UWB{D|eNhoQqi*bZ7F1icTe8D&nnRY^qdranDXW`2zeswl`~M_YaNl z8yeYV_YLhH&W`LGhn9&cr+CP<-CNvZ#kPSW=Tuy~G-)rZ z1XV!cUT4}KD?3M=nJJp<7AE19akrQUZ{N&JX(A6%SQ}+$`lw;+Jw!CyCQ8%r_z(;j zowmI$5QZUqr&F17%kX=_IWjXfowrLtj-B8bE|CKd<3~%gGcGiLvNY$wQl~uU6yc`v zQV}x)dyYW;%#>YrN)UcCXhyh=a4R^UxIpA+IX~yvb)4XuRs|jx%yi0!XNz{(&E@7G zryr$>Krjcu(q6BE>D+XbRXoiw=$JC-I!3i@yP77QwD3! zEx2UGV_B!u&0*BwBHrnC$k(xbL%K{P)}rFUE0|p^AwUyzKy0f!Ahsg7b65ymTgJ-BMY#<<&qOxqh|PLEro2qi;OH6X>01j#u%TyQ z%s~|OjD1eoZr5uML|(1s#p^E*Ja5GFq?U#2uLwLJmo5Ozq4IZ3wpd#%f4qOU6OFm3kq?pGMB_9y z^6`s6BMqyiiN@E5Mm`2rBMr0LL}Q>e@?oVk(HO0bd{_anx#oj6^m~QBX_=OVt&n~( ztq@xDh-ro8U7EK|D}p|H!L*`i(SFm4p+(D0D~=XzHmwBSBxtQ^CDEdtrqzNLEi|nZ zTC~lyTICXrJkwf*7VR;u)z~mO>!y{Kck357(`rK>=ijv2(c+i6AHzGeGov^&(&5lI zlOZ3!ZsQ2_r5o z*wcmQyH|x?wfaqeE6xYZBcDMMv0&5ss>hi!(!y0lw48^GdMAjME3Z?y5;&f3eH)~s z*H{t)>TdYn*dD_CbYlj6P9OVIDmyMcikisR!_P)q5KX8K4cA0QeI7&;Rx}-+4rYN3 z@(^-2Ee$K0OFT4TMZ;qbHH9$?#*;)7h9{fRgzJ10u0z8(%;=o?Xsl2S`sf?Vk0_EI zZ6QU%Y}AeTF@A{vNhc!4Ac@o=i7bgEqDcJsjsVH!)mh>i$Y{$)LffN?B;)CbDw_Ml z22HezhM1WdyA^Y^4oP%LB+)vbMC*J)e86C?)##2Xl1>jvOp!eHWrKtstHlekbR+hS zUznk5GZa%a8^!;bc!>ecM#wjQjn$#y`p@8}n5t;v;NFPUV|2t7&Cgyk@xqO+TUQG` z7*{mwtDHeJ@g>o452>Mv*P&tl$*An$EG5)88$2BeMe}>h_$E>3n}nk2u5t#^B$h;z zs6&&eL&N-+LB!YlCaGvhWdtYdW-19Zoz<0{1R6gpT?|g5`N_Y+a)mth(-5re!r3gL zk)K3w7oye7P!fLaf{#pYN_x5J^z3sF{kxAoPa+SjhZG+{FdHQ6EMU&g$R@pJs{ z)TvZjz*W9MZaQvemus?S0ar+8H8-`uf*vXVHHLh;M(4gc8?@9#ehV^DS~f#JaknV8 zEod=satF!Cwgzk|#kLhxuDXSK9W{kDV=BLOaAP<92~K*j6+IWpA5WOQs1>_fTCPH$;pASi z-Q(oWn3nhA`jU*{DYS3{o^kYCVB}k`H%qVH#xBp1v{i43(8k`^7uG0blt z46TvJnO>xq7r9xlUqLq`ihFOENs)?}YTMfn;YIBbHG2i8VSa~Y>j~?AuvxIJRZjlm z&vUQ+@Yn5k9+Pj#haOEalW=F_?pVe*ziE73<^2fij7&lMA#M2wZ1oZhy3b-yfNmm6Y3CZuQ zCkbQT%1H{qT+t)v-v2u;&zr=;HcvLZpD*uh4_KJxFjhCMY)f!&5;>t)*~xc_;rv9o zG*g9pL5VH6kHq|@bxM`ImxZ)oD1U5C_P6BZ(_e?+HEY1>(h5U_{wXe zQ*Gb;VnQ}w{{262cls16fwP~$c}nd?WrEv{%5&9zRGwpUs62BVMWu!p-{9HCeC2%) z4kf*KmPa4^+k+6M&upXgqR#*0z8BU_oU-^VYlrT{7iWfu1H)W-k)7{Y&nOzNDFQo$*-1j_P-@1oSqeS`Pq zIcq)i*SEZ8R0g48LNU1dA1G&s=bCe{pX(Qd!2L|E|uFIK{TCLUim?`Ps= Ie^CE_0Ldo-IRF3v literal 0 HcmV?d00001 From 434abf1a8c70fcfa031b7c48abda969c198f3a55 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 14 Mar 2024 15:57:20 +0530 Subject: [PATCH 02/32] CHANGE_EXCEL_HELPER : RV --- app/Helpers/excel_import_export_helper.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Helpers/excel_import_export_helper.php b/app/Helpers/excel_import_export_helper.php index 9a655c2e..e594f650 100644 --- a/app/Helpers/excel_import_export_helper.php +++ b/app/Helpers/excel_import_export_helper.php @@ -251,7 +251,6 @@ if (! function_exists('generate_filename')) { $actions = 'E'; $currentDateTime = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $formattedDateTime = $currentDateTime->format('d-m-Y_H-i-s'); - $policy_name = 'dsfjaisdjfa;ldsfaksl;dfaksdfaksdf'; $policy_name = str_replace(' ', '_', $policy_name); // Generate file name From 9aeff5d36028a35e24646162e2a1aa33b4988a08 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Thu, 14 Mar 2024 17:22:01 +0530 Subject: [PATCH 03/32] CHANGE_CLIENT_MODULE_POLICY_PREMIUM_AND_RAC_RATE : AADHAVAN --- app/Config/Routes.php | 23 +- app/Controllers/ClientController.php | 80 +- app/Controllers/EmployeeRestController.php | 284 ++++ app/Controllers/LoginController.php | 14 +- .../RestAuthenticationController.php | 53 +- app/Models/AuthHistoryModel.php | 1 + app/Models/ClientPolicyModel.php | 2 +- app/Models/EmployeeModel.php | 17 + app/Models/PolicesModel.php | 20 + app/Models/PolicyPremium1Model.php | 4 + app/Models/RelationshipModel.php | 23 + app/Views/client_branch.php | 17 + app/Views/client_kyc.php | 38 + app/Views/client_policy.php | 47 +- app/Views/client_rm.php | 5 + app/Views/insurer_basic_info.php | 15 +- app/Views/insurer_branch.php | 38 + app/Views/kyc_docs.php | 36 + app/Views/kyc_entity_type_basic_info.php | 14 +- app/Views/layout/header.php | 16 + app/Views/policies.php | 37 + app/Views/policy_gmc_terms.php | 29 +- app/Views/policy_gpa_terms.php | 21 +- app/Views/policy_grid.php | 1144 ++++++++++++++--- app/Views/policy_type_basic_info.php | 14 +- app/Views/tpa_basic_info.php | 13 +- app/Views/tpa_branch.php | 32 + 27 files changed, 1786 insertions(+), 251 deletions(-) create mode 100644 app/Controllers/EmployeeRestController.php create mode 100644 app/Models/RelationshipModel.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index c65a956a..9bda7547 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -194,11 +194,28 @@ $routes->cli('processjob', 'JobWorker::processJob'); // $routes->get("/api", "RestAuthenticationController::index"); -$routes->post("/api/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber"); -$routes->post("/api/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData"); +$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber"); +$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData"); $routes->group("/api", ["filter" => "authJWT"], function($routes){ $routes->post("logined", "RestAuthenticationController::logined"); $routes->post("getId", "RestAuthenticationController::getUserIdFromToken"); +}); + + +$routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1"); +$routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile"); + +$routes->get("/getEmployeePolicy", "EmployeeRestController::getEmployeePolicy"); +$routes->post("/employeeUpload", "EmployeeRestController::employeeUpload"); + + +$routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ + $routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence"); + $routes->post("editEmployeeAndDependence", "EmployeeRestController::editEmployeeAndDependence"); + $routes->post("addEmployeeAndDependence", "EmployeeRestController::addEmployeeAndDependence"); + $routes->get("/relationshipList", "EmployeeRestController::relationshipList"); +}); + + -}); \ No newline at end of file diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 8575d6b0..bf7767d4 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -592,18 +592,85 @@ class ClientController extends AdminController public function createClientPolicyPremium() { + // print_r($this->request->getPost());die(); $policy_type = $this->request->getPost('policy_type'); $client_id = $this->request->getPost('client_id'); $client_policy_id = $this->request->getPost('client_policy_id'); $policy_grid_id = $this->request->getPost('policy_grid_id'); + $multiplier = $this->request->getPost('multiplier'); + $si_or_bp = $this->request->getPost('si_or_bp'); + $basic_multiplier = $this->request->getPost('basic_multiplier'); + $premium_multiplier =$this->request->getPost('premium_multiplier'); + $basic_pay = $this->request->getPost('basic_pay'); if($policy_type !== null && $policy_type !== ''){ - $data = $this->request->getPost(); - $data['created_by'] = get_session_userid(); $this->policyPremium1Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update(); - $insert = $this->policyPremium1Model->insert($data); + $premiumData = $this->request->getPost('premium'); + for ($i = 0; $i < count($premiumData); $i++) { + $data = [ + 'client_id' => $client_id, + 'client_policy_id' => $client_policy_id, + 'policy_grid_id' => $policy_grid_id, + 'created_by' => get_session_userid(), + ]; + + if(is_array($this->request->getPost('si'))){ + $si = isset($this->request->getPost('si')[$i]) ? $this->request->getPost('si')[$i] : null; + }else{ + $si = $this->request->getPost('si'); + } + + if(is_array($this->request->getPost('premium'))){ + $premium = isset($this->request->getPost('premium')[$i]) ? $this->request->getPost('premium')[$i] : null; + }else{ + $premium = $this->request->getPost('premium'); + } + // $basic_gpa_premium = isset($basic_gpa_premium[$i]) ? $basic_gpa_premium[$i] : null; + if ($si !== null) { + $data['si'] = $si; + } + if ($premium !== null) { + $data['premium'] = $premium; + } + + if ($multiplier !== null) { + $data['multiplier'] = $multiplier; + } + + if ($si_or_bp !== null) { + $data['si_or_bp'] = $si_or_bp; + } + + if ($premium_multiplier !== null) { + $data['multiplier'] = $premium_multiplier; + } + + if ($basic_multiplier !== null) { + $data['basic_multiplier'] = $basic_multiplier; + } + + if ($basic_pay !== null) { + $data['basic_pay'] = $basic_pay; + } + + $this->policyPremium1Model->insert($data); + } + $data = $this->request->getPost(); + $insert = true; + + if($insert){ + return $this->respond(['status' => true,'code' => 200,'data' => $data], 200); + }else{ + return $this->respond(['status' => false,'code' => 404, 'data' => $data,'message' => 'no data found'], 200); + + } + // print_r($data); + // die(); + // $data['created_by'] = get_session_userid(); + // $this->policyPremium1Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update(); + // $insert = $this->policyPremium1Model->insert($data); }else{ $this->policyPremium2Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update(); @@ -752,9 +819,9 @@ class ClientController extends AdminController $search_term = 'GPA'; } $results = $this->policyGridModel->like('policy_type', $search_term)->findAll(); - if($search_term === 'GPA'){ $premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll(); + }else{ $premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll(); } @@ -763,6 +830,8 @@ class ClientController extends AdminController // echo '
';
         // print_r($results);
         // print_r($data[0]->policy_type); die;
+                    // echo "hello";
+            // print_r($premiumData);
         return $this->respond(['status' => true,'code' => 200,'data' => $results, 'premiumData' => $premiumData, 'count' => $emp_count, 'policy_name' => $policy_name], 200);
 
     }
@@ -887,8 +956,7 @@ class ClientController extends AdminController
     }
 
     public function policyGPATerms()
-    {
-        
+    {   
         try {
             $this->myLogger->logme('error','Policy GPA Terms CREATE function called');
 
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
new file mode 100644
index 00000000..8692e2df
--- /dev/null
+++ b/app/Controllers/EmployeeRestController.php
@@ -0,0 +1,284 @@
+myLogger = \Config\Services::mylogger();
+        $this->employeeModel = new EmployeeModel();
+        $this->employeePolicyModel = new EmployeePolicyModel();
+        $this->clientModel = new ClientModel();
+        $this->policesModel = new PolicesModel();
+        $this->relationshipModel = new RelationshipModel();
+    }
+
+  
+    public function getEmployeeProfile()
+    {
+       try {
+            $emp_code = $this->request->getGet('emp_code');
+            if ($emp_code) {
+                $relationship = 'self';
+                $employee = $this->employeeModel->where('emp_code', $emp_code)
+                                                ->where('relationship', $relationship)
+                                                ->first();
+                $result = $employee;
+                    return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
+            } else {
+                $result = "No Match's";
+                    return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
+            }
+       } catch (\Throwable $th) {
+        return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
+       }
+   }
+
+
+    public function editEmployeeProfile()
+    {
+        try {
+            $data = $this->request->getJSON();
+            if ($data) {
+                $id = $data->id;
+                $employee = $this->employeeModel->update($id, $data);
+
+                if ($employee) {
+                    $result = [];
+                    return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
+                } else {
+                    $result = "No Match's";
+                    return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
+                }
+            }
+       } catch (\Throwable $th) {
+        return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
+       }
+        
+    }
+
+
+    public function getEmployeeAndDependence()
+    {
+        try {
+            $emp_code = $this->request->getGet('emp_code');
+            if ($emp_code) {
+                $employee = $this->employeeModel->where('emp_code', $emp_code)
+                                                ->findAll();
+                
+                $result = $employee;
+                    return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
+            } else {
+                $result = "No Match's";
+                    return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
+            }
+       } catch (\Throwable $th) {
+        return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
+       }
+        
+    }
+
+
+    public function editEmployeeAndDependence()
+    {
+        try {
+            $data = $this->request->getJSON();
+            if ($data) {
+                $updatedCount = 0;
+                foreach ($data as $item) {
+                    $id = $item->id;
+                    $employee = $this->employeeModel->update($id, (array)$item);
+                    if ($employee) {
+                        $updatedCount++;
+                    }
+                }
+    
+                if ($updatedCount > 0) {
+                    $result = [];
+                    return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
+                } else {
+                    $result = "No Matches";
+                    return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 404);
+                }
+            }
+        } catch (\Throwable $th) {
+            return $this->respond(['status' => 'failed','code' => 500,'data' => $th], 500);
+        }
+        
+    }
+
+
+    public function addEmployeeAndDependence()
+    {
+        try {
+            $data = $this->request->getJSON();
+           
+
+            if ($data) {
+                $updatedCount = 0;
+                foreach ($data as $item) {
+                    $extractData['name'] = $item->name;
+                    $extractData['emp_code']= $item->emp_code;
+                    $extractData['email_corporate']=$item->email_corporate;
+                    $extractData['relationship_code']=$item->relationship_code;
+                    $extractData['mobile']=$item->mobile;
+                    $extractData['gender']=$item->gender;
+                    $extractData['dob']=$item->dob;
+                    $extractData['client_id']=$item->client_id;   
+                    // print_r($extractData);die();
+                    $employee = $this->employeeModel->insert($extractData);
+                    if ($employee) {
+                        $updatedCount++;
+                    }
+                }
+    
+                if ($updatedCount > 0) {
+                    $result = [];
+                    return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
+                } else {
+                    $result = "No Matches";
+                    return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 404);
+                }
+            }
+        } catch (\Exception $e) {
+            return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
+        }
+        
+    }
+
+
+    public function getEmployeePolicy()
+    {            
+        $id= 1;
+        try {
+            $keysToRemove  = ["sum_insured","family_floater","corporatebuffer","family_floaters"];
+
+            $empPolicy = $this->employeeModel->getEmployeePolicy($id);
+            if ($empPolicy) {
+
+                $result = [];
+                foreach ($empPolicy as $array) { 
+                    $decodedArray = json_decode($array->Policy_Terms);
+                    $refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove));
+
+                    // $client_id =$array->ClientId;
+                    // $policy_id =$array->PolicyId;
+
+                    // $rackRate = $this->policesModel->getPolicySlabRatesForEmpOnboard($policy_id, $client_id);
+
+                    // $array->Policy_Terms = json_encode($refusingData);
+                    $array->Policy_Terms = $refusingData;
+
+                    $result[] = $array;
+                }
+                return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);             
+            }else{
+                return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
+            }
+        } catch (\Exception $e) {
+            return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
+        }
+    }
+
+
+    public function relationshipList()
+    {
+        try {
+           
+            $relation_ships= $this->relationshipModel->findAll();
+
+            if(count($relation_ships) > 0){
+                return $this->respond(['status' => 'success','code' => 200,'data' => $relation_ships], 200);             
+            }else{
+                return $this->respond(['status' => 'success','code' => 200,'data' => "No Data..!"], 200);             
+            }
+
+        } catch (\Exception $e) {
+            return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
+        }
+    }
+
+
+    public function employeeUpload()
+    {
+        if ($this->request->getFile('file')) {
+            // Load PHPExcel library
+            require_once APPPATH . 'third_party/PHPExcel/PHPExcel.php';
+    
+            // Load the uploaded file
+            $file = $this->request->getFile('file');
+    
+            // Load file into PHPExcel
+            $inputFileType = PHPExcel_IOFactory::identify($file->getPathname());
+            $objReader = PHPExcel_IOFactory::createReader($inputFileType);
+            $objPHPExcel = $objReader->load($file->getPathname());
+    
+            // Get the active sheet
+            $sheet = $objPHPExcel->getActiveSheet();
+    
+            // Get the highest row number
+            $highestRow = $sheet->getHighestRow();
+    
+            // Assuming your data starts from the second row (after headers)
+            for ($row = 2; $row <= $highestRow; $row++) {
+                // Get cell values
+                $name = $sheet->getCellByColumnAndRow(0, $row)->getValue();
+                $email = $sheet->getCellByColumnAndRow(1, $row)->getValue();
+                // Assuming you have more columns, adjust indexes accordingly
+    
+                // Store data into database (Example using CodeIgniter's database methods)
+                $data = array(
+                    'name' => $name,
+                    'email' => $email,
+                    // Add more fields as necessary
+                );
+                // Insert data into the database table
+                $this->db->insert('employees', $data);
+            }
+    
+            // Optionally, you can delete the uploaded file after processing
+            unlink($file->getPathname());
+    
+            // Optionally, you can redirect the user to a success page
+            redirect('employee/success');
+        } else {
+            // Handle case when no file was uploaded
+            echo 'No file uploaded!';
+        }
+        
+    }
+
+
+
+}
\ No newline at end of file
diff --git a/app/Controllers/LoginController.php b/app/Controllers/LoginController.php
index 1dc8fb89..d1cc950c 100644
--- a/app/Controllers/LoginController.php
+++ b/app/Controllers/LoginController.php
@@ -46,7 +46,8 @@ class LoginController extends BaseController
                         set_session_data($session_data);
                         log_message('error', 'Set The UserId : `'. $user->id .'` in Session');
                         log_message('error', 'Is User Login Sucessfully');
-                        $this->getUserDeviceInfo($user->id);
+                    
+                        // $this->getUserDeviceInfo($user->id);
                         return redirect()->to(base_url('/dashboard/view'));
 
                     }else{
@@ -79,7 +80,7 @@ class LoginController extends BaseController
     }
 
 
-    public function getUserDeviceInfo($userId){
+    public function getUserDeviceInfo($userId, $type_of_user){
 
         // Load the UserAgent library
         $userAgent = $this->request->getUserAgent();
@@ -93,16 +94,19 @@ class LoginController extends BaseController
         // Get the user's IP address
         $ipAddress = $this->request->getIPAddress();
 
+        
         $datd = [
-           'user_id' => $userId,
+            'user_id' => $userId,
+           'user_type' => $type_of_user,
            'ip' => $ipAddress,
            'platform' => $platform,
            'broswer' => $browser,
         ];
-        
+        // print_r($datd);
+        // die();
         $AuthHistoryModel = new AuthHistoryModel;
         $insertAuthHistory = $AuthHistoryModel->insert($datd);
-
+        return $datd;
     }
 
     
diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php
index e56cffb7..ac43c791 100644
--- a/app/Controllers/RestAuthenticationController.php
+++ b/app/Controllers/RestAuthenticationController.php
@@ -4,8 +4,12 @@
 
 
 namespace App\Controllers;
+
+use App\Controllers\LoginController;
 use App\Helpers\DepositHelper;
 use App\Helpers\JWTToken;
+use App\Helpers\HttpRequestHelper;
+
 use CodeIgniter\HTTP\IncomingRequest;
 use CodeIgniter\HTTP\RequestInterface;
 use CodeIgniter\HTTP\ResponseInterface;
@@ -15,7 +19,7 @@ use CodeIgniter\API\ResponseTrait;
 
 
 use App\Models\EmployeeModel;
-
+use App\Models\AuthHistoryModel;
 
 use Firebase\JWT\JWT;
 // require_once('../vendor/autoload.php');
@@ -28,6 +32,7 @@ class RestAuthenticationController extends AdminController
 
     protected $myLogger;
     protected $employeeModel;
+    protected $authHistoryModel;
 
     
     public function __construct()
@@ -36,6 +41,7 @@ class RestAuthenticationController extends AdminController
         $this->myLogger = \Config\Services::mylogger();
 
         $this->employeeModel       = new EmployeeModel();
+        $this->authHistoryModel    = new AuthHistoryModel();
                 
     }
 
@@ -60,17 +66,22 @@ class RestAuthenticationController extends AdminController
     {
         try {
             $mobile_number = $this->request->getJSON()->mobile_number;
-        
-            $employeeData = $this->employeeModel->where('mobile', $mobile_number)->first();
+            $randomNumber = rand(100000, 999999);
+
+            $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
+            
             if ($employeeData) {
-                $result = ['user_verification' => true];
-                return ['status' => 'success','code' => 200,'data' => $result];
+                $id= $employeeData["id"];
+                $otp = $this->employeeModel->where('id', $id)->set('otp', $randomNumber)->update();
+                $result = ['user_verification' => true , 'otp'=>$randomNumber];
+                return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
             } else {
                 $result = ['user_verification' => false];
-                return ['status' => 'failed','code' => 404,'data' => $result];
+                return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
+
             }
         } catch (\Throwable $th) {
-            return ['status' => 'failed','code' => 505,'data' => $th];
+            return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
         }
     }
     
@@ -79,16 +90,34 @@ class RestAuthenticationController extends AdminController
     {
         try {
             $mobile_number = $this->request->getJSON()->mobile_number;
+            $otp = $this->request->getJSON()->otp;
 
             $employeeData = $this->employeeModel->where('mobile', $mobile_number)->first();
-            if ($employeeData) {
+            if ($employeeData && $otp == $employeeData["otp"]) {
+                $auth =  HttpRequestHelper::getRequestInfo();
+                if ($auth) {
+                    $data = [
+                        'user_id' => $employeeData['id'],
+                       'user_type' => 'employee',
+                       'ip' => $auth['ip'],
+                       'platform' => $auth['platform'],
+                       'broswer' => $auth['browser'],
+                    ];
+
+                    $authdata= $this->authHistoryModel->insert($data);
+                                        
+                }
+                $otp_null = $this->employeeModel->where('id', $employeeData["id"])->set('otp', null)->update();
+
+
+
                 $result = JWTToken::encode($employeeData);
-            return ['status' => 'success','code' => 200,'data' => $result];
+            return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
             } else {
-                return ['status' => 'failed','code' => 404,'data' => "No data"];
+                return $this->respond(['status' => 'failed','code' => 404,'data' => "No data"],404);
             }
-        } catch (\Throwable $th) {
-            return ['status' => 'failed','code' => 500,'data' => $th];
+        } catch (\Exception $e) {
+            return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
         }
     }
 
diff --git a/app/Models/AuthHistoryModel.php b/app/Models/AuthHistoryModel.php
index 17c83357..ae91aed8 100644
--- a/app/Models/AuthHistoryModel.php
+++ b/app/Models/AuthHistoryModel.php
@@ -10,6 +10,7 @@ class AuthHistoryModel extends Model
     protected $allowedFields        = [
         "id",
         "user_id",
+        "user_type",
         "ip",
         "platform",
         "broswer",
diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php
index e6955601..b8dbc9d9 100644
--- a/app/Models/ClientPolicyModel.php
+++ b/app/Models/ClientPolicyModel.php
@@ -32,6 +32,7 @@ class ClientPolicyModel extends Model
         "earned_premium_amount",
         "claims_incurred_amount",
         "policy_terms",
+        "open_for_enrollment",
         "created_by",
         "updated_by",
         "Is_active",
@@ -226,5 +227,4 @@ public function getDepositlistsummary($id)
         ->getResult();
 }
 
-
 }
diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php
index 78cd79f4..17991b8a 100644
--- a/app/Models/EmployeeModel.php
+++ b/app/Models/EmployeeModel.php
@@ -10,9 +10,11 @@ class EmployeeModel extends Model
     protected $primaryKey       = 'id';
     protected $allowedFields    = [
         "id",
+        "client_id",
         "employee_id",
         "change_event",
         "relationship_id",
+        "relationship",
         "batch_id",
         "emp_code",
         "name",
@@ -21,9 +23,24 @@ class EmployeeModel extends Model
         "mobile",
         "gender",
         "dob",
+        "otp",
         "emp_status",
         "created_by",
         "updated_by",
         "is_active",
     ];
+
+
+
+    public function getEmployeePolicy($id)
+    {
+
+        return $this->db->table('employee_polices')
+                        ->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId, client_policy.open_for_enrollment as OpenForEnrollment') // Select all columns from both tables
+                        ->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
+                        ->join('policies', 'policies.id = client_policy.policy_id')
+                        ->where('employee_polices.employee_id', $id)
+                        ->get()
+                        ->getResult();
+   }
 }
diff --git a/app/Models/PolicesModel.php b/app/Models/PolicesModel.php
index 23b47f0e..074575f3 100644
--- a/app/Models/PolicesModel.php
+++ b/app/Models/PolicesModel.php
@@ -28,4 +28,24 @@ class PolicesModel extends Model
         ->get()
         ->getResult();
     }
+
+
+    
+    public function getPolicySlabRatesForEmpOnboard($policy_id,$client_id)
+    { 
+
+        $premium_slab_data = null;
+        $policyPremium1Model = new policyPremium1Model();
+
+        $premium_slab_data = $policyPremium1Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
+        if((isset($premium_slab_data)))
+        {
+            $policyPremium2Model = new policyPremium2Model();
+            $premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
+        }
+        $grid_id = $premium_slab_data[0]['policy_grid_id'];
+        $policyGridModel = new policyGridModel();
+        $results = $policyGridModel->find($grid_id);
+        return ['slab_rates' => $premium_slab_data,'grid_master' => $results];
+    }
 }
diff --git a/app/Models/PolicyPremium1Model.php b/app/Models/PolicyPremium1Model.php
index 517127b0..ec5d5b65 100644
--- a/app/Models/PolicyPremium1Model.php
+++ b/app/Models/PolicyPremium1Model.php
@@ -15,6 +15,10 @@ class PolicyPremium1Model extends Model
         'client_policy_id',
         'policy_grid_id',
         'si',
+        'si_or_bp',
+        'basic_multiplier',
+        'premium_multiplier',
+        'basic_pay',
         'premium',
         'multiplier',
         "created_by",
diff --git a/app/Models/RelationshipModel.php b/app/Models/RelationshipModel.php
new file mode 100644
index 00000000..ff0a103f
--- /dev/null
+++ b/app/Models/RelationshipModel.php
@@ -0,0 +1,23 @@
+';
         $.ajax({
@@ -301,6 +309,10 @@ $(document).ready(function () {
             dataType: 'json',
             success: function (res) {
 
+                setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                }, 1000);
                 console.log(res)
                 $('#add_branch').show();
                 $('#branch_table').hide();
@@ -329,6 +341,11 @@ $(document).ready(function () {
             error: function (xhr, status, error) {
                 console.error(xhr.responseText);
                 console.error(status, error);
+                setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                    toastr.warning('Something Wrong!', 'warning');
+                }, 1000);
             }        
         });
             console.log(branch_form_action);    
diff --git a/app/Views/client_kyc.php b/app/Views/client_kyc.php
index 9ea8fbea..c21e07c0 100644
--- a/app/Views/client_kyc.php
+++ b/app/Views/client_kyc.php
@@ -144,6 +144,9 @@
                 return; 
             }
 
+            $('.loader').fadeIn();
+            $('.loader-mask').fadeIn();
+
             $.ajax({
                 url: '', 
                 type: 'POST', 
@@ -151,6 +154,10 @@
                 processData: false,
                 contentType: false,
                 success: function (res) {
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                    }, 1000);
                     // res = JSON.parse(res)
                     // console.log(res);
                     form.trigger('reset')
@@ -166,12 +173,20 @@
                 error: function (xhr, status, error) {
                     console.error(xhr.responseText);
                     console.error(status, error);
+
+                    setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                    toastr.warning('Something Wrong!', 'warning');
+                }, 1000);
                 }
             });
         });
 
         if(kycPrimaryKey !== ''){
 
+            $('.loader').fadeIn();
+            $('.loader-mask').fadeIn();
             $.ajax({
                 url: '' + '',
                 type: "GET",
@@ -179,6 +194,10 @@
                 processData: false,
                 contentType: false,
                 success: function (res) {
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                    }, 1000);
                     console.log(res);
                     var tbody = $('#tbody');
                     tbody.empty(); 
@@ -200,6 +219,12 @@
                 error: function (xhr, status, error) {
                     console.error(xhr.responseText);
                     console.error(status, error);
+
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                        toastr.warning('Something Wrong!', 'warning');
+                    }, 1000);
                 }
             });
 
@@ -263,6 +288,9 @@
             }
             var formData = new FormData($('#kyc_form')[0]);
 
+            $('.loader').fadeIn();
+            $('.loader-mask').fadeIn();
+
             $.ajax({
                 data: formData,
                 url: '',
@@ -272,6 +300,10 @@
                 contentType: false,
                 success: function(res) {
 
+                    setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                }, 1000);
                     console.log(res);
                     $('#kyc_form').trigger('reset')
                     var message = (kycPrimaryKey === '') ? 'KYC Docs Uploaded successfully' : 'KYC Docs Uploaded successfully';
@@ -296,6 +328,12 @@
                 error: function(xhr, status, error) {
                     console.error(xhr.responseText);
                     console.error(status, error);
+
+                    setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                    toastr.warning('Something Wrong!', 'warning');
+                }, 1000);
                 }
             });
 
diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php
index 116a8467..c40d7200 100644
--- a/app/Views/client_policy.php
+++ b/app/Views/client_policy.php
@@ -330,7 +330,7 @@
 
         $.get(url, function(res) {
             // res = JSON.parse(res)// 
-            console.log(res)
+            // console.log(res)
             var OptionsHTML = '';
             OptionsHTML += '';
             $.each(res.data, function(index, item) {
@@ -348,7 +348,7 @@
     $('#policy').change(function(){
 
         var dataId = $(this).children('option:selected').attr('data-id');
-        console.log('dataId', dataId)
+        // console.log('dataId', dataId)
         $('#policy_type_id').val(dataId);
 
         // if(dataId == 1){
@@ -366,15 +366,20 @@
         // var policy_id = $(this).data('id');
         // console.log('1', policy_id)
         var policy_id = $(this).attr('data-id');
-        console.log('2', policy_id)
+        // console.log('2', policy_id)
 
+            $('.loader').fadeIn();
+            $('.loader-mask').fadeIn();
         $.ajax({
             url: '' + policy_id,
             type: "GET",
             dataType: 'json',
             success: function (res) {
-
-                console.log('clientPolicy : ', res);
+                setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                }, 1000);
+                // console.log('clientPolicy : ', res);
                 $('#policy_form_action').val('');
 
                 if (res.status === false) {
@@ -409,7 +414,7 @@
                 
                 var policeOptionHTML = '';
                 $.each(res.policy, function(index, item) {
-                    console.log(item)
+                    // console.log(item)
                     policeOptionHTML += '';
                 });
                 $('#policy').html(policeOptionHTML);
@@ -417,6 +422,11 @@
             error: function (xhr, status, error) {
                 console.error(xhr.responseText);
                 console.error(status, error);
+                setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                    toastr.warning('Something Wrong!', 'warning');
+                }, 1000);
             }        
         });
     });
@@ -428,7 +438,7 @@
         var client_id = $('#client_id_policy').val()
 
 
-        console.log('client_policy_id', client_policy_id);
+        // console.log('client_policy_id', client_policy_id);
 
         if(client_policy_id){
             $('.loader').fadeIn();
@@ -442,7 +452,7 @@
                 client_policy_id : client_policy_id,
             },
             success: function(res) {
-                console.log(res);
+                // console.log(res);
                 if(res) {
                     setTimeout(function() {
                         $('.loader').fadeOut();
@@ -694,6 +704,7 @@
     }
 
     function convertCommaNumberToWords(input) {
+        // console.log(input);
         const number = parseInt(input.replace(/,/g, ''), 10);
         return convertNumberToWords(number);
     }
@@ -706,11 +717,23 @@
     }
 
 
-    function formatNumber(input) {
-        var value = input.value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
-        input.value = value;
-    }
+    function formatNumber(input, maxLength) {
+        maxLength=16;
+    let value = input.value.replace(/\D/g, ''); // Remove non-numeric characters
+    
+    // Limit the number of digits
+    value = value.slice(0, maxLength);
+    
+    // Format the number with commas using Indian numbering system
+    value = Number(value).toLocaleString('en-IN');
+    input.value = value;
 
+    basicPayMultiple(input)
+        if (input.id == 'gpa_si') {
+            gpaSumInsureMultiplier();
+        }
 
+    return ;
+}
 
 
\ No newline at end of file
diff --git a/app/Views/client_rm.php b/app/Views/client_rm.php
index fa7a7b52..fc8dbdae 100644
--- a/app/Views/client_rm.php
+++ b/app/Views/client_rm.php
@@ -151,6 +151,11 @@ $(document).ready(function(){
                     error: function(xhr, status, error) {
                         console.error(xhr.responseText);
                         console.error(status, error);
+                        setTimeout(function() {
+                            $('.loader').fadeOut();
+                            $('.loader-mask').delay(350).fadeOut('slow');
+                            toastr.warning('Something Wrong!', 'warning');
+                        }, 1000);
                     }
                 });
 
diff --git a/app/Views/insurer_basic_info.php b/app/Views/insurer_basic_info.php
index 9acef300..8abe76d4 100644
--- a/app/Views/insurer_basic_info.php
+++ b/app/Views/insurer_basic_info.php
@@ -79,6 +79,10 @@ $(document).ready(function () {
 
             var formData = new FormData($('#insurer_general_form')[0]);
             var OptionsHTML1 = ''
+
+            $('.loader').fadeIn();
+            $('.loader-mask').fadeIn();
+            
             $.ajax({
                 data: formData,
                 url: form_action,
@@ -87,7 +91,10 @@ $(document).ready(function () {
                 processData: false,
                 contentType: false,
                 success: function(res) {
-                    
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                    }, 1000);
                     console.log(res);
                     $('#insurer_id').val(res.data.id);
                     $('#insurer_id_branch').val(res.data.id);
@@ -108,6 +115,12 @@ $(document).ready(function () {
                 error: function (xhr, status, error) {
                     console.error(xhr.responseText);
                     console.error(status, error);
+
+                    setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                    toastr.warning('Something Wrong!', 'warning');
+                }, 1000);
                 }
             });
         }
diff --git a/app/Views/insurer_branch.php b/app/Views/insurer_branch.php
index 44c276f0..638abe01 100644
--- a/app/Views/insurer_branch.php
+++ b/app/Views/insurer_branch.php
@@ -222,6 +222,8 @@ $(document).ready(function () {
 
             var formData = new FormData($('#insurer_branch_form')[0]);
 
+            $('.loader').fadeIn();
+            $('.loader-mask').fadeIn();
             $.ajax({
                 data: formData,
                 url: insurer_branch_form_action,
@@ -230,6 +232,10 @@ $(document).ready(function () {
                 processData: false,
                 contentType: false,
                 success: function(res) {
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                    }, 1000);
                     console.log(res);
                     // $('#insurer_branch_list tr').remove();
                     var insurerBranchTableInsert = ''
@@ -254,6 +260,12 @@ $(document).ready(function () {
                 error: function (xhr, status, error) {
                     console.error(xhr.responseText);
                     console.error(status, error);
+
+                    setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                    toastr.warning('Something Wrong!', 'warning');
+                }, 1000);
                 }
             });
 
@@ -266,12 +278,19 @@ $(document).ready(function () {
         contactCount =1;
         var branch_id = $(this).attr('data-id');
         insurer_branch_form_action = '';
+
+        $('.loader').fadeIn();
+        $('.loader-mask').fadeIn();
         $.ajax({
             url: ''+branch_id,
             type: "GET",
             dataType: 'json',
             success: function (res) {
 
+                setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                }, 1000);
                 $('#add_branch').show();
                 $('#branch_table').hide();
                 $('.btnBack').show();
@@ -300,6 +319,12 @@ $(document).ready(function () {
             error: function (xhr, status, error) {
                 console.error(xhr.responseText);
                 console.error(status, error);
+
+                setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                    toastr.warning('Something Wrong!', 'warning');
+                }, 1000);
             }        
         });
     });
@@ -317,10 +342,17 @@ $(document).ready(function () {
 
         var insurer_branch_action = base_url + insurer_Branch_PrimaryKey;
         if ($('#insurer_id_branch').val() != '') {
+
+            $('.loader').fadeIn();
+            $('.loader-mask').fadeIn();
             $.ajax({
                 url: insurer_branch_action, 
                 type: 'GET',
                 success: function(response) {
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                    }, 1000);
                     var branchTable = '';
                     $.each(response.insuer_branch, function(index, item) {
                         branchTable += `
@@ -336,6 +368,12 @@ $(document).ready(function () {
                 error: function(xhr, status, error) {
                     console.error(xhr.responseText);
                     console.error(status, error);
+
+                    setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                    toastr.warning('Something Wrong!', 'warning');
+                }, 1000);
                 }
             });
         }
diff --git a/app/Views/kyc_docs.php b/app/Views/kyc_docs.php
index 4e4be6f3..94fef8af 100644
--- a/app/Views/kyc_docs.php
+++ b/app/Views/kyc_docs.php
@@ -155,6 +155,8 @@ $(document).ready(function () {
 
             var formData = new FormData($('#kyc_docs_form')[0]);
 
+            $('.loader').fadeIn();
+            $('.loader-mask').fadeIn();
             $.ajax({
                 data: formData,
                 url: kyc_docs_form_action,
@@ -163,6 +165,10 @@ $(document).ready(function () {
                 processData: false,
                 contentType: false,
                 success: function(res) {
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                    }, 1000);
                     console.log(res);
                     $('#insurer_branch_list tr').remove();
                     var insurerBranchTableInsert = ''
@@ -183,6 +189,12 @@ $(document).ready(function () {
                 error: function (xhr, status, error) {
                     console.error(xhr.responseText);
                     console.error(status, error);
+
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                        toastr.warning('Something Wrong!', 'warning');
+                    }, 1000);
                 }
             });
         }
@@ -191,11 +203,17 @@ $(document).ready(function () {
     $('body').on('click', '.btnBranchEdit', function () {
         var branch_id = $(this).attr('data-id');
         kyc_docs_form_action = '';
+        $('.loader').fadeIn();
+        $('.loader-mask').fadeIn();
         $.ajax({
             url: ''+branch_id,
             type: "GET",
             dataType: 'json',
             success: function (res) {
+                setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                }, 1000);
                 console.log("right.........");
                 $('#add_branch').show();
                 $('#branch_table').hide();
@@ -211,6 +229,12 @@ $(document).ready(function () {
             error: function (xhr, status, error) {
                 console.error(xhr.responseText);
                 console.error(status, error);
+
+                setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                    toastr.warning('Something Wrong!', 'warning');
+                }, 1000);
             }        
         });
     });
@@ -228,6 +252,8 @@ $(document).ready(function () {
         var kyc_docs_action = base_url + kyc_Docs_PrimaryKey;
         console.log(kyc_docs_action);
         if (kyc_Docs_PrimaryKey != '') {
+            $('.loader').fadeIn();
+            $('.loader-mask').fadeIn();
             $.ajax({
                 url: kyc_docs_action,
                 type: "GET",
@@ -235,6 +261,10 @@ $(document).ready(function () {
                 processData: false,
                 contentType: false,
                 success: function(res) {
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                    }, 1000);
                     var insurerBranchTableInsert = '';
                     $.each(res.kyc_docs, function(index, item) {
                         insurerBranchTableInsert += `
@@ -249,6 +279,12 @@ $(document).ready(function () {
                     error: function (xhr, status, error) {
                         console.error(xhr.responseText);
                         console.error(status, error);
+
+                        setTimeout(function() {
+                            $('.loader').fadeOut();
+                            $('.loader-mask').delay(350).fadeOut('slow');
+                            toastr.warning('Something Wrong!', 'warning');
+                        }, 1000);
                     }
                 });
             }
diff --git a/app/Views/kyc_entity_type_basic_info.php b/app/Views/kyc_entity_type_basic_info.php
index 18cff9f4..081803cc 100644
--- a/app/Views/kyc_entity_type_basic_info.php
+++ b/app/Views/kyc_entity_type_basic_info.php
@@ -54,7 +54,9 @@ $(document).ready(function () {
             }
 
             var formData = new FormData($('#kyc_general_form')[0]);
-            var OptionsHTML1 = ''
+            var OptionsHTML1 = '';
+            $('.loader').fadeIn();
+            $('.loader-mask').fadeIn();
             $.ajax({
                 data: formData,
                 url: form_action,
@@ -63,6 +65,10 @@ $(document).ready(function () {
                 processData: false,
                 contentType: false,
                 success: function(res) {
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                    }, 1000);
                     console.log(res);
                     $('#kyc_type_id').val(res.data.PrimaryKey);
                     $('#kyc_id_docs').val(res.data.PrimaryKey);
@@ -73,6 +79,12 @@ $(document).ready(function () {
                 error: function (xhr, status, error) {
                     console.error(xhr.responseText);
                     console.error(status, error);
+
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                        toastr.warning('Something Wrong!', 'warning');
+                    }, 1000);
                 }
             });
         }
diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php
index 21d677aa..d9b9f461 100644
--- a/app/Views/layout/header.php
+++ b/app/Views/layout/header.php
@@ -200,6 +200,22 @@
 
 
 
+        
+
+        
 
         
 
+
\ No newline at end of file
diff --git a/app/Views/policy_type_basic_info.php b/app/Views/policy_type_basic_info.php
index 2ce5ae8c..f11a109c 100644
--- a/app/Views/policy_type_basic_info.php
+++ b/app/Views/policy_type_basic_info.php
@@ -71,7 +71,9 @@ $(document).ready(function () {
             }
 
             var formData = new FormData($('#policytype_general_form')[0]);
-            var OptionsHTML1 = ''
+            var OptionsHTML1 = '';
+            $('.loader').fadeIn();
+            $('.loader-mask').fadeIn();
             $.ajax({
                 data: formData,
                 url: form_action,
@@ -80,6 +82,10 @@ $(document).ready(function () {
                 processData: false,
                 contentType: false,
                 success: function(res) {
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                    }, 1000);
 
                     $('#policy_type_id').val(res.data.PrimaryKey);
                     $('#policy_id_type').click();
@@ -90,6 +96,12 @@ $(document).ready(function () {
                 error: function (xhr, status, error) {
                     console.error(xhr.responseText);
                     console.error(status, error);
+
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                        toastr.warning('Something Wrong!', 'warning');
+                    }, 1000);
                 }
             });
         }
diff --git a/app/Views/tpa_basic_info.php b/app/Views/tpa_basic_info.php
index 7ebe2c1c..0a103bc7 100644
--- a/app/Views/tpa_basic_info.php
+++ b/app/Views/tpa_basic_info.php
@@ -56,7 +56,9 @@ $(document).ready(function () {
             }
 
             var formData = new FormData($('#tpa_general_form')[0]);
-            var OptionsHTML1 = ''
+            var OptionsHTML1 = '';
+            $('.loader').fadeIn();
+            $('.loader-mask').fadeIn();
             $.ajax({
                 data: formData,
                 url: form_action,
@@ -65,6 +67,10 @@ $(document).ready(function () {
                 processData: false,
                 contentType: false,
                 success: function(res) {
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                    }, 1000);
                     
                     console.log(res);
                     $('#tpa_id').val(res.data.id);
@@ -86,6 +92,11 @@ $(document).ready(function () {
                 error: function (xhr, status, error) {
                     console.error(xhr.responseText);
                     console.error(status, error);
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                        toastr.warning('Something Wrong!', 'warning');
+                    }, 1000);
                 }
             });
         }
diff --git a/app/Views/tpa_branch.php b/app/Views/tpa_branch.php
index d1eb9977..7c99a4d3 100644
--- a/app/Views/tpa_branch.php
+++ b/app/Views/tpa_branch.php
@@ -231,6 +231,10 @@ $(document).ready(function () {
                 processData: false,
                 contentType: false,
                 success: function(res) {
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                    }, 1000);
                     console.log(res);
                     $('#tpa_branch_list tr').remove();
                     var tpaBranchTableInsert = ''
@@ -253,6 +257,11 @@ $(document).ready(function () {
                 error: function (xhr, status, error) {
                     console.error(xhr.responseText);
                     console.error(status, error);
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                        toastr.warning('Something Wrong!', 'warning');
+                    }, 1000);
                 }
             });
         }
@@ -263,11 +272,17 @@ $(document).ready(function () {
         contactCount =1;
         var branch_id = $(this).attr('data-id');
         tpa_branch_form_action = '';
+        $('.loader').fadeIn();
+        $('.loader-mask').fadeIn();
         $.ajax({
             url: ''+branch_id,
             type: "GET",
             dataType: 'json',
             success: function (res) {
+                setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                }, 1000);
                 console.log("tpa.............");
                 console.log(res)
                 $('#add_branch').show();
@@ -297,6 +312,12 @@ $(document).ready(function () {
             error: function (xhr, status, error) {
                 console.error(xhr.responseText);
                 console.error(status, error);
+
+                setTimeout(function() {
+                    $('.loader').fadeOut();
+                    $('.loader-mask').delay(350).fadeOut('slow');
+                    toastr.warning('Something Wrong!', 'warning');
+                }, 1000);
             }        
         });
     });
@@ -310,10 +331,16 @@ $(document).ready(function () {
 
         var tpa_branch_action = base_url + tpa_Branch_PrimaryKey;
         if ($('#tpa_id_branch').val() != '') {
+            $('.loader').fadeIn();
+            $('.loader-mask').fadeIn();
             $.ajax({
                 url: tpa_branch_action, 
                 type: 'GET',
                 success: function(response) {
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                    }, 1000);
                     var branchTable = '';
                     $.each(response.tpa_branch, function(index, item) {
                         branchTable += `
@@ -329,6 +356,11 @@ $(document).ready(function () {
                 error: function(xhr, status, error) {
                     console.error(xhr.responseText);
                     console.error(status, error);
+                    setTimeout(function() {
+                        $('.loader').fadeOut();
+                        $('.loader-mask').delay(350).fadeOut('slow');
+                        toastr.warning('Something Wrong!', 'warning');
+                    }, 1000);
                 }
             });
         }

From 65bb5a0c63da120316c139134d41afeca29cc4c8 Mon Sep 17 00:00:00 2001
From: aadhavan valli 
Date: Thu, 14 Mar 2024 17:48:38 +0530
Subject: [PATCH 04/32] CHANGE_IN_POLICY_RAC_RATE : AADHAVAN

---
 app/Views/policy_grid.php | 114 +++++++-------------------------------
 1 file changed, 19 insertions(+), 95 deletions(-)

diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php
index 27c53f10..a86cdd40 100644
--- a/app/Views/policy_grid.php
+++ b/app/Views/policy_grid.php
@@ -102,7 +102,7 @@
         }
 
         grid_html = `
-        
+
@@ -124,7 +124,7 @@ } grid_html = ` -
+
@@ -149,7 +149,7 @@ } grid_html = ` -
+
@@ -184,7 +184,7 @@ } grid_html = ` -
+
@@ -217,7 +217,7 @@ } grid_html = ` -
+
@@ -252,7 +252,7 @@ } grid_html = ` -
+
@@ -287,7 +287,7 @@ grid_html = ` -
+
@@ -316,7 +316,7 @@ grid_html = ` -
+
@@ -345,7 +345,7 @@ } grid_html = ` -
+
@@ -378,7 +378,7 @@ grid_html = ` -
+
@@ -422,83 +422,7 @@ $('#si_or_bp').change(function(){ var selectedValue = $(this).val(); - var client_policy_id = $('#grid'); - $('#client_policy_id').val(client_policy_id); - console.log("client_policy_id", client_policy_id); - $('.loader').fadeIn(); - $('.loader-mask').fadeIn(); - - $.ajax({ - url: '' , - type: "GET", - data: { client_policy_id: client_policy_id}, - dataType: 'json', - success: function (res) { - $('#nameOfThePolicy').html(' - ' + res.policy_name); - $('#grid_emp_count').val(res.count); - - if (res.status === false) { - toastr.error(res.status); - return; - } - var policy_grid_id_value = ''; - if (res.premiumData && res.premiumData.length > 0 && res.premiumData[0].policy_grid_id) { - policy_grid_id_value = res.premiumData[0].policy_grid_id; - } - - $('#grid_content_input').empty(); - var policeGridOptionHTML = ''; - policeGridOptionHTML += ` `; - $.each(res.data, function(index, item) { - policeGridOptionHTML += ''; - }); - $('#grid').html(policeGridOptionHTML); - - - if (res.premiumData && res.premiumData.length > 0) { - addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id, res.premiumData[0].si_or_bp); - - res.premiumData.shift(); - $.each(res.premiumData, function(index, item){ - if (item.si_or_bp == '1') { - appendGridtHtml('1_1_1_1', item); - }else{ - appendGridtHtml(item.policy_grid_id, item); - } - }); - - } else { - console.log("res.premiumData is undefined, null, or empty."); - } - - $('#bs-example-modal-lg').modal('show'); - - - $("#gpa_si").trigger("keyup"); - $("#basic_gpa_premium").trigger("keyup"); - - $("#sum_insured").trigger("keyup"); - $("#premium").trigger("keyup"); - - $("input[name='si[]']").trigger("keyup"); - $("input[name='premium[]']").trigger("keyup") - - setTimeout(function() { - $('.loader').fadeOut(); - $('.loader-mask').delay(350).fadeOut('slow'); - }, 1000); - }, - error: function (xhr, status, error) { - console.error(xhr.responseText); - console.error(status, error); - setTimeout(function() { - $('.loader').fadeOut(); - $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); - }, 1000); - } - }); si_or_bp_two(selectedValue); @@ -913,7 +837,7 @@ else if(ui_type == '3'){ html = ` -
+
@@ -935,7 +859,7 @@ html =` -
+
@@ -959,7 +883,7 @@ html = ` -
+
@@ -987,7 +911,7 @@ }else if(ui_type == '6'){ html =` -
+
@@ -1017,7 +941,7 @@ }else if(ui_type == '7'){ html = ` -
+
@@ -1045,7 +969,7 @@ }else if(ui_type == '8'){ html = ` -
+
@@ -1069,7 +993,7 @@ }else if(ui_type == '9'){ html = ` -
+
@@ -1093,7 +1017,7 @@ }else if(ui_type == '10'){ html = ` -
+
@@ -1121,7 +1045,7 @@ }else if(ui_type == '11'){ html = ` -
+
From 9411d5d29766f8ee0f69d39e0c66f42e37cb4890 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Fri, 15 Mar 2024 11:13:04 +0530 Subject: [PATCH 05/32] CHANGE_POLICY_GRID : AADHAVAN --- app/Config/Routes.php | 2 +- app/Controllers/ClientController.php | 56 +- app/Controllers/EmployeeRestController.php | 3 +- app/Views/client_policy.php | 113 +++-- app/Views/policy_gmc_terms.php | 8 +- app/Views/policy_grid.php | 561 +++++++++------------ 6 files changed, 377 insertions(+), 366 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 06d67bd7..f1363b80 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -213,10 +213,10 @@ $routes->post("/employeeUpload", "EmployeeRestController::employeeUpload"); $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ + $routes->get("/relationshipList", "EmployeeRestController::relationshipList"); $routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence"); $routes->post("editEmployeeAndDependence", "EmployeeRestController::editEmployeeAndDependence"); $routes->post("addEmployeeAndDependence", "EmployeeRestController::addEmployeeAndDependence"); - $routes->get("/relationshipList", "EmployeeRestController::relationshipList"); }); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index ab1c21fc..8d8b8104 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -598,7 +598,13 @@ class ClientController extends AdminController $this->policyPremium1Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update(); - $premiumData = $this->request->getPost('premium'); + if($si_or_bp == '1'){ + $premiumData = $this->request->getPost('sum_premium'); + + }else{ + $premiumData = $this->request->getPost('premium'); + } + for ($i = 0; $i < count($premiumData); $i++) { $data = [ 'client_id' => $client_id, @@ -607,17 +613,35 @@ class ClientController extends AdminController 'created_by' => get_session_userid(), ]; - if(is_array($this->request->getPost('si'))){ - $si = isset($this->request->getPost('si')[$i]) ? $this->request->getPost('si')[$i] : null; + if ($si_or_bp == '2') { + if(is_array($this->request->getPost('basic_si'))){ + $si = isset($this->request->getPost('basic_si')[$i]) ? $this->request->getPost('basic_si')[$i] : null; + }else{ + $si = $this->request->getPost('basic_si'); + } + } else { + if(is_array($this->request->getPost('si'))){ + $si = isset($this->request->getPost('si')[$i]) ? $this->request->getPost('si')[$i] : null; + }else{ + $si = $this->request->getPost('si'); + } + } + + + if($si_or_bp == '1'){ + if(is_array($this->request->getPost('sum_premium'))){ + $premium = isset($this->request->getPost('sum_premium')[$i]) ? $this->request->getPost('sum_premium')[$i] : null; + }else{ + $premium = $this->request->getPost('sum_premium'); + } }else{ - $si = $this->request->getPost('si'); + if(is_array($this->request->getPost('premium'))){ + $premium = isset($this->request->getPost('premium')[$i]) ? $this->request->getPost('premium')[$i] : null; + }else{ + $premium = $this->request->getPost('premium'); + } } - if(is_array($this->request->getPost('premium'))){ - $premium = isset($this->request->getPost('premium')[$i]) ? $this->request->getPost('premium')[$i] : null; - }else{ - $premium = $this->request->getPost('premium'); - } // $basic_gpa_premium = isset($basic_gpa_premium[$i]) ? $basic_gpa_premium[$i] : null; if ($si !== null) { $data['si'] = $si; @@ -626,17 +650,21 @@ class ClientController extends AdminController $data['premium'] = $premium; } - if ($multiplier !== null) { - $data['multiplier'] = $multiplier; + if($si_or_bp == 2){ + if ($premium_multiplier !== null) { + $data['multiplier'] = $premium_multiplier; + } + }else{ + if ($multiplier !== null) { + $data['multiplier'] = $multiplier; + } } if ($si_or_bp !== null) { $data['si_or_bp'] = $si_or_bp; } - if ($premium_multiplier !== null) { - $data['multiplier'] = $premium_multiplier; - } + if ($basic_multiplier !== null) { $data['basic_multiplier'] = $basic_multiplier; diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 8692e2df..87ada1ac 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -180,8 +180,9 @@ class EmployeeRestController extends AdminController public function getEmployeePolicy() { - $id= 1; + // $id= 4; try { + $id = $this->request->getGet('id'); $keysToRemove = ["sum_insured","family_floater","corporatebuffer","family_floaters"]; $empPolicy = $this->employeeModel->getEmployeePolicy($id); diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 3048d0ca..a9df6485 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -654,31 +654,31 @@ }; function convertNumberToWords(number) { - if (number === 0) { - return numberWords[number]; - } + if (number === 0) { + return numberWords[number]; + } - let word = ''; + let word = ''; - if (number >= 10000000) { - word += convertNumberToWords(Math.floor(number / 10000000)) + " Crore "; - number %= 10000000; - } + if (number >= 10000000) { + word += convertNumberToWords(Math.floor(number / 10000000)) + " Crore "; + number %= 10000000; + } - if (number >= 100000) { - word += convertNumberToWords(Math.floor(number / 100000)) + " Lakh "; - number %= 100000; - } + if (number >= 100000) { + word += convertNumberToWords(Math.floor(number / 100000)) + " Lakh "; + number %= 100000; + } - if (number >= 1000) { - word += convertNumberToWords(Math.floor(number / 1000)) + " Thousand "; - number %= 1000; - } + if (number >= 1000) { + word += convertNumberToWords(Math.floor(number / 1000)) + " Thousand "; + number %= 1000; + } - if (number >= 100) { - word += convertNumberToWords(Math.floor(number / 100)) + " Hundred "; - number %= 100; - } + if (number >= 100) { + word += convertNumberToWords(Math.floor(number / 100)) + " Hundred "; + number %= 100; + } if (number > 0) { if (word !== '') { @@ -708,22 +708,67 @@ function formatNumber(input, maxLength) { - maxLength=16; - let value = input.value.replace(/\D/g, ''); // Remove non-numeric characters - - // Limit the number of digits - value = value.slice(0, maxLength); - - // Format the number with commas using Indian numbering system - value = Number(value).toLocaleString('en-IN'); - input.value = value; + + maxLength=16; + let value = input.value.replace(/\D/g, ''); // Remove non-numeric characters + + // Limit the number of digits + value = value.slice(0, maxLength); + + // Format the number with commas using Indian numbering system + value = Number(value).toLocaleString('en-IN'); + input.value = value; - basicPayMultiple(input) - if (input.id == 'gpa_si') { - gpaSumInsureMultiplier(); - } + basicPayMultiple(input) + if (input.id == 'gpa_si') { + gpaSumInsureMultiplier(); + } - return ; + if(input.id == 'basic_pay'){ + var inputNumber = input.value; + if (inputNumber) { + var result = convertCommaNumberToWords(inputNumber); + $("#gpa_basic_pay_number_word").text(result); + } else { + $("#gpa_basic_pay_number_word").text(""); + } + }else if(input.id == 'basic_gpa_si'){ + var inputNumber = input.value; + if (inputNumber) { + var result = convertCommaNumberToWords(inputNumber); + $("#basic_gpa_si_number_word").text(result); + } else { + $("#basic_gpa_si_number_word").text(""); + } + }else if(input.id == 'basic_gpa_premium'){ + var inputNumber = input.value; + if (inputNumber) { + var result = convertCommaNumberToWords(inputNumber); + $("#basic_gpa_premium_number_word").text(result); + } else { + $("#basic_gpa_premium_number_word").text(""); + } + }else if(input.id == 'gpa_si'){ + var inputNumber = input.value; + if (inputNumber) { + var result = convertCommaNumberToWords(inputNumber); + $("#gpa_sum_si_number_word").text(result); + } else { + $("#gpa_sum_si_number_word").text(""); + } + }else if(input.id == 'gpa_premium'){ + var inputNumber = input.value; + if (inputNumber) { + var result = convertCommaNumberToWords(inputNumber); + $("#gpa_sum_premium_number_word").text(result); + } else { + $("#gpa_sum_premium_number_word").text(""); + } + } + + return ; + // } + } \ No newline at end of file diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php index d0f182a1..e03b3e9d 100644 --- a/app/Views/policy_gmc_terms.php +++ b/app/Views/policy_gmc_terms.php @@ -465,9 +465,7 @@
-
- Days -
+
@@ -477,9 +475,7 @@
-
- Days -
+
diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php index a86cdd40..4c76b77e 100644 --- a/app/Views/policy_grid.php +++ b/app/Views/policy_grid.php @@ -58,11 +58,8 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp=false){ $('#grid_content_input').empty(); - // console.log ($('#Client_id').val()); - - var grid_container = document.getElementById('grid_content_input'); var dataIdValue = '' if(event === false){ @@ -82,18 +79,70 @@ } grid_html = ` -
+
-
-
-
-
+
`; } else if(dataIdValue == '2'){ @@ -414,107 +463,31 @@ $('#btnGridSubmit').hide(); } + + + grid_container.insertAdjacentHTML('beforeend', grid_html); $('#gpa_sum_insured').hide(); $('#btnGridSubmit').show(); - - $('#si_or_bp').change(function(){ - var selectedValue = $(this).val(); - - - - si_or_bp_two(selectedValue); - - }); - - if(data !== false && data.si){ - console.log('show'); - $('#gpa_sum_insured').show(); - $('#si_or_bp').val("1"); - }else{ - $('#si_or_bp').val("2"); - } - - $("#gpa_si").on("keyup", function() { - var inputNumber = $(this).val(); - if (inputNumber) { - var result = convertCommaNumberToWords(inputNumber); - $("#gpa_si_number_word").text(result); - } else { - $("#gpa_si_number_word").text(""); - } + $('#si_or_bp').val(si_or_bp); + setTimeout(() => { + $('#si_or_bp').trigger('change'); + }, 300); - }); - - $("#basic_gpa_premium").on("keyup", function() { - var inputNumber = $(this).val(); - if (inputNumber) { - var result = convertCommaNumberToWords(inputNumber); - $("#gpa_premium_number_word").text(result); - } else { - $("#gpa_premium_number_word").text(""); - } - }); - $("#sum_insured").on("keyup", function() { - var inputNumber = $(this).val(); - if (inputNumber) { - var result = convertCommaNumberToWords(inputNumber); - $("#sum_insured_number_word").text(result); - } else { - $("#sum_insured_number_word").text(""); - } - }); + - $("#premium").on("keyup", function() { - var inputNumber = $(this).val(); - if (inputNumber) { - var result = convertCommaNumberToWords(inputNumber); - $("#premium_number_word").text(result); - } else { - $("#premium_number_word").text(""); - } - }); - - - if (si_or_bp == '1') { - si_or_bp_two(si_or_bp); - }else if(si_or_bp == '2'){ - si_or_bp_two(si_or_bp); - } - - if (si_or_bp == '2') { - - console.log("data line-> 490", data); - $('#si_or_bp').val(si_or_bp); - $('#basic_multiplier').val(data.basic_multiplier); - $('#basic_pay').val(data.basic_pay); - $('#premium_multiplier').val(data.multiplier); - $('#basic_gpa_si').val(data.si); - $('#basic_gpa_premium').val(data.premium); - }else if (si_or_bp == '1') { - console.log("start"); - console.log(data); - $('#si_or_bp').val(si_or_bp); - $('#multiplier').val(data.multiplier); - $('#gpa_si').val(data.si); - $('#basic_gpa_premium').val(data.premium); - } - + }; $("#GridForm").submit(function(event) { var check = checkDuplicate(); - - console.log("check....."); - console.log(check); - event.preventDefault(); @@ -551,7 +524,7 @@ contentType: false, success: function(res) { - console.log(res); + console.log("Response",res); if (res.status === false) { toastr.error('Policy Dose Not Create', 'Error'); @@ -602,6 +575,7 @@ data: { client_policy_id: client_policy_id}, dataType: 'json', success: function (res) { + console.log('res',res); $('#nameOfThePolicy').html(' - ' + res.policy_name); $('#grid_emp_count').val(res.count); @@ -623,14 +597,20 @@ }); $('#grid').html(policeGridOptionHTML); - + var si_or_bp_value = ''; if (res.premiumData && res.premiumData.length > 0) { - addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id, res.premiumData[0].si_or_bp); + if(res.premiumData[0].si_or_bp){ + si_or_bp_value = res.premiumData[0].si_or_bp; + } + + addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id, si_or_bp_value); + + res.premiumData.shift(); $.each(res.premiumData, function(index, item){ if (item.si_or_bp == '1') { - appendGridtHtml('1_1_1_1', item); + appendGridtHtml('1', item); }else{ appendGridtHtml(item.policy_grid_id, item); } @@ -643,19 +623,23 @@ $('#bs-example-modal-lg').modal('show'); - $("#gpa_si").trigger("keyup"); - $("#basic_gpa_premium").trigger("keyup"); + // $("#gpa_si").trigger("keyup"); + // $("#basic_gpa_premium").trigger("keyup"); + + // $("#sum_insured").trigger("keyup"); + // $("#premium").trigger("keyup"); - $("#sum_insured").trigger("keyup"); - $("#premium").trigger("keyup"); - - $("input[name='si[]']").trigger("keyup"); - $("input[name='premium[]']").trigger("keyup") + // $('#basic_pay').trigger('keyup'); + // $("input[name='si[]']").trigger("keyup"); + // $("input[name='premium[]']").trigger("keyup") setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); }, 1000); + + $('#basic_gpa_si').trigger('keyup'); + }, error: function (xhr, status, error) { console.error(xhr.responseText); @@ -674,6 +658,8 @@ var grid_id=$(this)[0].value; var client_policy_id =$('#client_policy_id')[0].value; + + $('.loader').fadeIn(); $('.loader-mask').fadeIn(); @@ -683,8 +669,6 @@ data: { client_policy_id: client_policy_id}, dataType: 'json', success: function (res) { - appendGridtHtml('1_2'); - appendGridtHtml('1_2_1'); console.log('responce :', res); setTimeout(function() { @@ -692,7 +676,6 @@ $('.loader-mask').delay(350).fadeOut('slow'); }, 1000); if (res.premiumData.length > 0 && res.premiumData[0].policy_grid_id === grid_id) { - console.log("heelo"); $('#nameOfThePolicy').html(' - ' + res.policy_name); $('#grid_emp_count').val(res.count); @@ -714,43 +697,35 @@ policeGridOptionHTML += ''; }); // $('#grid').html(policeGridOptionHTML); - + var si_or_bp_value = ''; if (res.premiumData && res.premiumData.length > 0) { + + if(res.premiumData[0].si_or_bp){ + si_or_bp_value = res.premiumData[0].si_or_bp; - addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id, res.premiumData[0].si_or_bp); + $('#si_or_bp').val(si_or_bp_value); + + } + + + + addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id, si_or_bp_value); res.premiumData.shift(); $.each(res.premiumData, function(index, item){ - // console.log('premiumData index :',index) - // appendGridtHtml(item.policy_grid_id, item); - if (item.si_or_bp == '1') { - appendGridtHtml('1_1_1_1', item); - }else{ appendGridtHtml(item.policy_grid_id, item); - } }); } else { console.log("res.premiumData is undefined, null, or empty."); - } + } + }else if(res.data[0].policy_type == "GPA"){ + $('#si_or_bp').val('2'); - $('#bs-example-modal-lg').modal('show'); - $("#gpa_si").trigger("keyup"); - $("#basic_gpa_premium").trigger("keyup"); - - $("#sum_insured").trigger("keyup"); - $("#premium").trigger("keyup"); - - $("input[name='si[]']").trigger("keyup"); - $("input[name='premium[]']").trigger("keyup"); - }else{ - if($('#si_or_bp').val() == 2){ - addGridHTML(false, false, grid_id,) - } - // console.log("novkfdmmk"); - addGridHTML(false, false, grid_id) + setTimeout(() => { + $('#si_or_bp').trigger('change') + }, 300); } - // console.log("hello"); }, error: function (xhr, status, error) { console.error(xhr.responseText); @@ -764,7 +739,6 @@ }); }) - var Count = 1 function appendGridtHtml(ui_type = false, data = false,) { @@ -773,66 +747,29 @@ Count++; var container = document.getElementById('grid_content_input'); - - if(ui_type == '1_1' || ui_type == '1_1_1' || ui_type == '1_1_1_1') + if(ui_type == '1') { - if (ui_type == '1_1_1' || ui_type == '1_1_1_1') { - html=`
- - -
-
-
- - -
- -
-
- - -
`; - // return html; - }else{ - html =`
- - -
- `; - - // return html; - } - } - else if(ui_type == '1_2' || ui_type == '1_2_1') - { - if (ui_type == '1_2_1') { - html=`
- - -
-
-
- - -
-
-
- - -
- + html = `
+
+ + +
+
+
+ + +
+ +
+
+ + +
`; - }else{ - html =`
- - -
-
- - -
- `; - } + } + else if(ui_type == '1_2' ) + { + } else if(ui_type == '3'){ @@ -1072,77 +1009,14 @@ } - if (ui_type == '1_1' || ui_type == '1_1_1' || ui_type == '1_2' || ui_type == '1_2_1' || ui_type == '1_1_1_1') { - if(ui_type == '1_1'){ - $('#si_or_bp_1').empty().append(html); - $('#si_or_bp_1_1').empty(); - $('#gmc_add_more').hide() - $('#gmc_remove').show() - Count-- - $('#gmc_add_more_'+Count).hide() - Count++ - }else if(ui_type == '1_1_1'){ - $('#si_or_bp_2').empty().append(html); - $('#gmc_add_more').hide() - $('#gmc_remove').show() - Count-- - $('#gmc_add_more_'+Count).hide() - Count++ - }else if(ui_type == '1_2'){ - - $('#si_or_bp_1').empty(); - $('#si_or_bp_1_1').empty().append(html); - $('#gmc_add_more').hide() - $('#gmc_remove').show() - Count-- - $('#gmc_add_more_'+Count).hide() - Count++ - }else if(ui_type == '1_2_1'){ - $('#si_or_bp_2').empty().append(html); - $('#gmc_add_more').hide() - $('#gmc_remove').show() - Count-- - $('#gmc_add_more_'+Count).hide() - Count++ - }else if(ui_type == '1_1_1_1'){ - $('#si_or_bp_2').append(html); - $('#gmc_add_more').hide() - $('#gmc_remove').show() - Count-- - $('#gmc_add_more_'+Count).hide() - Count++ - - - console.log("data", data); - - if(data){ - $('input[name="premium[]"]').length; - $('input[name="premium[]"]').each(function(index) { - if (index === $('input[name="premium[]"]').length - 1) { - console.log("data.premium",data.premium); - $(this).val(data.premium); - // console.log("This ", $(this)[0].val(data.premium)); - // var basicGpaPremiumValue = $(this).val(); - - // if (basicGpaPremiumValue !== "" && basicGpaPremiumValue !== null) { - // console.log("Value of basic_gpa_premium[]: " + basicGpaPremiumValue); - // } else { - // console.log("basic_gpa_premium[] value is empty or null"); - // } - } - }); - } - - } - - }else{ + container.insertAdjacentHTML('beforeend', html); $('#gmc_add_more').hide(); $('#gmc_remove').show(); Count-- $('#gmc_add_more_'+Count).hide() Count++ - } + @@ -1185,7 +1059,6 @@ } - function checkDuplicate() { // console.log($('#grid')[0].value); @@ -1208,11 +1081,9 @@ premiumValues.push($(this).val()); }); - console.log("Checking for duplicates..."); for (var i = 0; i < siValues.length; i++) { for (var j = i + 1; j < siValues.length; j++) { if (siValues[i] === siValues[j] && premiumValues[i] === premiumValues[j]) { - console.log('Duplicate values found in si[] at indices', i, 'and', j); siDuplicates = true; } } @@ -1220,10 +1091,8 @@ if (siDuplicates || premiumDuplicates) { toastr.warning('Duplicates found!', 'warning'); - console.log('Duplicates found'); return true; } else { - console.log('No duplicates found'); return false; } }else if($('#grid')[0].value === '4'){ @@ -1244,12 +1113,10 @@ ageToValues.push($(this).val()); }); - console.log("Checking for duplicates..."); for (var i = 0; i < ageFromValues.length; i++) { for (var j = i + 1; j < ageFromValues.length; j++) { // Check for duplicates between age_from[] and age_to[] if (ageFromValues[i] === ageFromValues[j] && ageToValues[i] === ageToValues[j]) { - console.log('Duplicate values found in age_from[] and age_to[] at indices', i, 'and', j); ageDuplicates = true; } } @@ -1257,10 +1124,8 @@ if (ageDuplicates) { toastr.warning('Duplicates found!', 'warning'); - console.log('Duplicates found'); return true; } else { - console.log('No duplicates found'); return false; } @@ -1297,10 +1162,8 @@ if (siDuplicates || ageDuplicates) { toastr.warning('Duplicates found!', 'warning'); - console.log('Duplicates found'); return true; } else { - console.log('No duplicates found'); return false; } }else if($('#grid')[0].value === '6'){ @@ -1320,12 +1183,10 @@ ageToValues.push($(this).val()); }); - console.log("Checking for duplicates..."); for (var i = 0; i < ageFromValues.length; i++) { for (var j = i + 1; j < ageFromValues.length; j++) { // Check for duplicates between age_from[] and age_to[] if (ageFromValues[i] === ageFromValues[j] && ageToValues[i] === ageToValues[j]) { - console.log('Duplicate values found in age_from[] and age_to[] at indices', i, 'and', j); ageDuplicates = true; } } @@ -1333,10 +1194,8 @@ if (ageDuplicates) { toastr.warning('Duplicates found!', 'warning'); - console.log('Duplicates found'); return true; } else { - console.log('No duplicates found'); return false; } }else if($('#grid')[0].value === '7'){ @@ -1372,10 +1231,8 @@ if (siDuplicates || ageDuplicates) { toastr.warning('Duplicates found!', 'warning'); - console.log('Duplicates found'); return true; } else { - console.log('No duplicates found'); return false; } }else if($('#grid')[0].value === '10'){ @@ -1412,10 +1269,8 @@ if (siDuplicates || ageDuplicates) { toastr.warning('Duplicates found!', 'warning'); - console.log('Duplicates found'); return true; } else { - console.log('No duplicates found'); return false; } }else if($('#grid')[0].value === '8'){ @@ -1435,12 +1290,10 @@ gradeValues.push($(this).val()); }); - console.log("Checking for duplicates..."); for (var i = 0; i < siValues.length; i++) { for (var j = i + 1; j < siValues.length; j++) { // Check for duplicates between si[] and grade[] if (siValues[i] === siValues[j] && gradeValues[i] === gradeValues[j]) { - console.log('Duplicate values found in si[] and grade[] at indices', i, 'and', j); duplicatesFound = true; } } @@ -1448,10 +1301,8 @@ if (duplicatesFound) { toastr.warning('Duplicates found!', 'warning'); - console.log('Duplicates found'); return true; } else { - console.log('No duplicates found'); return false; } }else if($('#grid')[0].value === '9'){ @@ -1471,12 +1322,10 @@ gradeValues.push($(this).val()); }); - console.log("Checking for duplicates..."); for (var i = 0; i < siValues.length; i++) { for (var j = i + 1; j < siValues.length; j++) { // Check for duplicates between si[] and grade[] if (siValues[i] === siValues[j] && gradeValues[i] === gradeValues[j]) { - console.log('Duplicate values found in si[] and grade[] at indices', i, 'and', j); duplicatesFound = true; } } @@ -1484,10 +1333,8 @@ if (duplicatesFound) { toastr.warning('Duplicates found!', 'warning'); - console.log('Duplicates found'); return true; } else { - console.log('No duplicates found'); return false; } }else if ($('#grid')[0].value === '11') { @@ -1513,46 +1360,25 @@ maxSiValues.push($(this).val()); }); - console.log("Checking for duplicates..."); for (var i = 0; i < siValues.length; i++) { for (var j = i + 1; j < siValues.length; j++) { - console.log(maxSiValues); - console.log("maxSiValues[i] ", maxSiValues[i] ); - console.log("maxSiValues[j]", maxSiValues[j]); + // console.log(maxSiValues); + // console.log("maxSiValues[i] ", maxSiValues[i] ); + // console.log("maxSiValues[j]", maxSiValues[j]); if (siValues[i] === siValues[j] && gradeValues[i] === gradeValues[j] && maxSiValues[i] === maxSiValues[j]) { - console.log('Duplicate values found in si[], grade[], and max_si[] at indices', i, 'and', j); duplicatesFound = true; } } } if (duplicatesFound) { - console.log('Duplicates found'); toastr.warning('Duplicates found!', 'warning'); return true; } else { - console.log('No duplicates found'); return false; } } } - - - \ No newline at end of file From 755b1fc3531b1b0db4e996b0f14342634e7a32d1 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Fri, 15 Mar 2024 18:10:44 +0530 Subject: [PATCH 06/32] CHANGE_EMPLOYEE_REST_API :AADHAVAN --- app/Config/Routes.php | 3 +- app/Controllers/EmployeeRestController.php | 207 +++++++++++++++------ app/Models/EmployeeModel.php | 9 + app/Models/EmployeePolicyModel.php | 9 + app/Views/policy_grid.php | 72 +++---- 5 files changed, 208 insertions(+), 92 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f1363b80..41afa3d2 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -211,9 +211,10 @@ $routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfi $routes->get("/getEmployeePolicy", "EmployeeRestController::getEmployeePolicy"); $routes->post("/employeeUpload", "EmployeeRestController::employeeUpload"); +$routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence"); $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ - $routes->get("/relationshipList", "EmployeeRestController::relationshipList"); + $routes->get("relationshipList", "EmployeeRestController::relationshipList"); $routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence"); $routes->post("editEmployeeAndDependence", "EmployeeRestController::editEmployeeAndDependence"); $routes->post("addEmployeeAndDependence", "EmployeeRestController::addEmployeeAndDependence"); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 87ada1ac..9f2d3574 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -13,8 +13,13 @@ use App\Models\EmployeePolicyModel; use App\Models\ClientModel; use App\Models\PolicesModel; use App\Models\RelationshipModel; +use App\Models\FileModel; +use PhpOffice\PhpSpreadsheet\Spreadsheet; +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; +use PhpOffice\PhpSpreadsheet\IOFactory; + use CodeIgniter\API\ResponseTrait; use Illuminate\Http\Request; @@ -42,6 +47,7 @@ class EmployeeRestController extends AdminController $this->clientModel = new ClientModel(); $this->policesModel = new PolicesModel(); $this->relationshipModel = new RelationshipModel(); + $this->fileModel= new FileModel(); } @@ -144,26 +150,28 @@ class EmployeeRestController extends AdminController try { $data = $this->request->getJSON(); - if ($data) { - $updatedCount = 0; + $Count = 0; foreach ($data as $item) { - $extractData['name'] = $item->name; - $extractData['emp_code']= $item->emp_code; - $extractData['email_corporate']=$item->email_corporate; - $extractData['relationship_code']=$item->relationship_code; - $extractData['mobile']=$item->mobile; - $extractData['gender']=$item->gender; - $extractData['dob']=$item->dob; - $extractData['client_id']=$item->client_id; - // print_r($extractData);die(); - $employee = $this->employeeModel->insert($extractData); - if ($employee) { - $updatedCount++; - } + if (isset($item->id)) { + //update old data + $id = $item->id; + $employee = $this->employeeModel->update($id, (array)$item); + if ($employee) { + $Count++; + } + }else{ + //create new data + $employee = $this->employeeModel->insert($item); + if ($employee) { + $Count++; + } + + } + } - if ($updatedCount > 0) { + if ($Count > 0) { $result = []; return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200); } else { @@ -233,51 +241,132 @@ class EmployeeRestController extends AdminController public function employeeUpload() { - if ($this->request->getFile('file')) { - // Load PHPExcel library - require_once APPPATH . 'third_party/PHPExcel/PHPExcel.php'; - - // Load the uploaded file - $file = $this->request->getFile('file'); - - // Load file into PHPExcel - $inputFileType = PHPExcel_IOFactory::identify($file->getPathname()); - $objReader = PHPExcel_IOFactory::createReader($inputFileType); - $objPHPExcel = $objReader->load($file->getPathname()); - - // Get the active sheet - $sheet = $objPHPExcel->getActiveSheet(); - - // Get the highest row number - $highestRow = $sheet->getHighestRow(); - - // Assuming your data starts from the second row (after headers) - for ($row = 2; $row <= $highestRow; $row++) { - // Get cell values - $name = $sheet->getCellByColumnAndRow(0, $row)->getValue(); - $email = $sheet->getCellByColumnAndRow(1, $row)->getValue(); - // Assuming you have more columns, adjust indexes accordingly - - // Store data into database (Example using CodeIgniter's database methods) - $data = array( - 'name' => $name, - 'email' => $email, - // Add more fields as necessary - ); - // Insert data into the database table - $this->db->insert('employees', $data); - } - - // Optionally, you can delete the uploaded file after processing - unlink($file->getPathname()); - - // Optionally, you can redirect the user to a success page - redirect('employee/success'); - } else { - // Handle case when no file was uploaded - echo 'No file uploaded!'; + + $file = $this->request->getFile('file'); + $client_id = $this->request->getPost('client_id'); + $policy_id = $this->request->getPost('policy_id'); + + + $is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); + $filename = $file->getName(); + + $file_name_with_path = WRITEPATH."/uploads/import_excel/".$filename; + + //check the file exist or not + if(!file_exists($file_name_with_path)) + { + session()->setFlashdata('error', 'File not found'); + return redirect()->to(base_url('employee/upload')); } + + // Load the Excel file + $spreadsheet = IOFactory::load($file_name_with_path); + + // Get the active sheet + $sheet = $spreadsheet->getActiveSheet(); + + // Get the highest row and column numbers + $highestRow = $sheet->getHighestRow(); + $highestColumn = $sheet->getHighestColumn(); + + $data = []; + + // Iterate through each row + for ($row = 1; $row <= $highestRow; $row++) { + // Initialize the row data array + $rowData = []; + + // Iterate through each column in the row + for ($col = 'A'; $col <= $highestColumn; $col++) { + // Get the cell value + $value = $sheet->getCell($col . $row)->getValue(); + + // Add the cell value to the row data array + $rowData[] = $value; + } + + // Add the row data to the main data array + $data[] = $rowData; + } + + $extractData['file_name']= $filename; + $extractData['client_id']= $client_id; + $extractData['status']= 'success'; + $extractData['policy_id']= $policy_id; + $extractData['action']= 'enrollment'; + + // $extractData['created_by']=set_session_context('Employee'); + + $file_data =$this->fileModel->insert($extractData); + + // print_r(count($data)); + $extra = []; + for ($i = 0; $i < count($data); $i++) { + if ($i == 0) { + // Loop through the first row to extract keys + for ($j = 0; $j < count($data[$i]); $j++) { + $extra[$data[$i][$j]] = []; // Initialize keys with empty array + } + } else { + // Loop through subsequent rows + for ($j = 0; $j < count($data[$i]); $j++) { + // Append values to corresponding keys in $extra + if (isset($extra[$data[0][$j]])) { + // Make sure the key exists in the $extra array + $extra[$data[0][$j]][] = $data[$i][$j]; + } + } + } + } + + $dataToInsert = []; + foreach ($extra['id'] as $index => $id) { + $record = [ + // 'id' => $id, + 'emp_code' => $extra['emp_code'][$index], + 'name' => $extra['name'][$index], + // Check if the 'doj' key exists before accessing it + 'doj' => isset($extra['doj'][$index]) ? $extra['doj'][$index] : null, + 'gender' => $extra['gender'][$index], + 'relationship' => $extra['relationship'][$index], + 'dob' => $extra['dob'][$index], + 'email' => $extra['Email'][$index], + ]; + $dataToInsert[] = $record; + } + + // print_r($dataToInsert);die(); + + for ($a=0; $a employeeModel->insert($dataToInsert[$a]); + + $employee = $this->employeeModel->checkExistingEmpEntrollment($dataToInsert[$a]); + + // print_r($employee);die; + if (count($employee)) { + // $dataToInsert['id'] = $employee['id']; + $this->employeeModel->update($dataToInsert[$a], ['id' => $employee['id']]); + die(); + }else{ + + } + } + + + + + + // $query = $this->employeePolicyModel->getLastQuery(); + // echo $query . "
"; + // Return the array containing data from the Excel file + // return $data; + + + } diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index 7dd55c43..4e880bd2 100644 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -45,4 +45,13 @@ class EmployeeModel extends Model ->getResult(); } + + + + // for EMP rest API process do not change + public function checkExistingEmpEntrollment($arr) + { + return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->first(); + } + } diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 6bbaeafb..8424ab3c 100644 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -180,5 +180,14 @@ class EmployeePolicyModel extends Model } + + //for emp onboard do not change + public function checkExistingEmpPolicy($arr) + { + return $this->where('employee_id',$arr['employee_id']) + ->where('client_policy_id',$arr['client_policy_id']) + ->find(); + } + //------------------------------------------------------------------ } diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php index 4c76b77e..0734c5e4 100644 --- a/app/Views/policy_grid.php +++ b/app/Views/policy_grid.php @@ -629,16 +629,26 @@ // $("#sum_insured").trigger("keyup"); // $("#premium").trigger("keyup"); - // $('#basic_pay').trigger('keyup'); + $('#basic_pay').trigger('keyup'); + + $('input[name="si[]"]').each(function() { + $(this).trigger('keyup'); + }); + + + + $('input[name="premium[]"]').each(function() { + $(this).trigger('keyup'); + }); + // $("input[name='si[]']").trigger("keyup"); // $("input[name='premium[]']").trigger("keyup") setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - }, 1000); + }, 1000);si - $('#basic_gpa_si').trigger('keyup'); }, error: function (xhr, status, error) { @@ -1061,8 +1071,6 @@ function checkDuplicate() { - // console.log($('#grid')[0].value); - if ($('#grid')[0].value === '3') { var siInputs = $('input[name="si[]"]'); var premiumInputs = $('input[name="premium[]"]'); @@ -1504,17 +1512,17 @@ - $("#gpa_si").on("keyup", function() { - var inputNumber = $(this).val(); - if (inputNumber) { - var result = convertCommaNumberToWords(inputNumber); - $("#gpa_si_number_word").text(result); - } else { - $("#gpa_si_number_word").text(""); - } + // $("#gpa_si").on("keyup", function() { + // var inputNumber = $(this).val(); + // if (inputNumber) { + // var result = convertCommaNumberToWords(inputNumber); + // $("#gpa_si_number_word").text(result); + // } else { + // $("#gpa_si_number_word").text(""); + // } - }); + // }); // $("#basic_gpa_premium").on("keyup", function() { // var inputNumber = $(this).val(); @@ -1527,26 +1535,26 @@ // }); - $("#sum_insured").on("keyup", function() { - var inputNumber = $(this).val(); - if (inputNumber) { - var result = convertCommaNumberToWords(inputNumber); - $("#sum_insured_number_word").text(result); - } else { - $("#sum_insured_number_word").text(""); - } - }); + // $("#sum_insured").on("keyup", function() { + // var inputNumber = $(this).val(); + // if (inputNumber) { + // var result = convertCommaNumberToWords(inputNumber); + // $("#sum_insured_number_word").text(result); + // } else { + // $("#sum_insured_number_word").text(""); + // } + // }); - $("#premium").on("keyup", function() { - var inputNumber = $(this).val(); - if (inputNumber) { - var result = convertCommaNumberToWords(inputNumber); - $("#premium_number_word").text(result); - } else { - $("#premium_number_word").text(""); - } - }); + // $("#premium").on("keyup", function() { + // var inputNumber = $(this).val(); + // if (inputNumber) { + // var result = convertCommaNumberToWords(inputNumber); + // $("#premium_number_word").text(result); + // } else { + // $("#premium_number_word").text(""); + // } + // }); From 55f1fd88f5b23b0fc7e9fe763e30f9573cc2f0a7 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Sat, 16 Mar 2024 11:02:05 +0530 Subject: [PATCH 07/32] CHANGE_polictlistApiForEmpLogin:GWM --- app/Config/Routes.php | 4 +++- app/Controllers/EmployeeRestController.php | 6 +++++- app/Models/EmployeeModel.php | 2 +- app/Models/PolicesModel.php | 5 +++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 41afa3d2..1c832e4b 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -208,7 +208,7 @@ $routes->group("/api", ["filter" => "authJWT"], function($routes){ $routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1"); $routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile"); -$routes->get("/getEmployeePolicy", "EmployeeRestController::getEmployeePolicy"); + $routes->post("/employeeUpload", "EmployeeRestController::employeeUpload"); $routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence"); @@ -218,6 +218,8 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ $routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence"); $routes->post("editEmployeeAndDependence", "EmployeeRestController::editEmployeeAndDependence"); $routes->post("addEmployeeAndDependence", "EmployeeRestController::addEmployeeAndDependence"); + + $routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy"); }); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 9f2d3574..48db23f7 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -198,6 +198,7 @@ class EmployeeRestController extends AdminController $result = []; foreach ($empPolicy as $array) { + $decodedArray = json_decode($array->Policy_Terms); $refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove)); @@ -208,7 +209,10 @@ class EmployeeRestController extends AdminController // $array->Policy_Terms = json_encode($refusingData); $array->Policy_Terms = $refusingData; - + $getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array->ClientPolicyId,$array->ClientId); + $array->SlabRates = $getSlabAndGridData['slab_rates']; + $array->GridMaster = $getSlabAndGridData['grid_master']; + $result[] = $array; } return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200); diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index 4e880bd2..52382dc1 100644 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -37,7 +37,7 @@ class EmployeeModel extends Model { return $this->db->table('employee_polices') - ->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId, client_policy.open_for_enrollment as OpenForEnrollment') // Select all columns from both tables + ->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment') // Select all columns from both tables ->join('client_policy', 'client_policy.id = employee_polices.client_policy_id') ->join('policies', 'policies.id = client_policy.policy_id') ->where('employee_polices.employee_id', $id) diff --git a/app/Models/PolicesModel.php b/app/Models/PolicesModel.php index 074575f3..96e5e8f1 100644 --- a/app/Models/PolicesModel.php +++ b/app/Models/PolicesModel.php @@ -36,12 +36,13 @@ class PolicesModel extends Model $premium_slab_data = null; $policyPremium1Model = new policyPremium1Model(); - $premium_slab_data = $policyPremium1Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll(); - if((isset($premium_slab_data))) + + if((!count($premium_slab_data))) { $policyPremium2Model = new policyPremium2Model(); $premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll(); + } $grid_id = $premium_slab_data[0]['policy_grid_id']; $policyGridModel = new policyGridModel(); From 29fb6e4eb6985893c4348e9dd4e56ec7fd1cfd59 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Sat, 16 Mar 2024 12:29:17 +0530 Subject: [PATCH 08/32] ChangesPoilcyApi:GWM --- app/Controllers/EmployeeRestController.php | 51 +++++++++++++++++----- app/Models/PolicesModel.php | 3 +- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 48db23f7..e8ef9517 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -189,11 +189,12 @@ class EmployeeRestController extends AdminController public function getEmployeePolicy() { // $id= 4; - try { + // try { $id = $this->request->getGet('id'); - $keysToRemove = ["sum_insured","family_floater","corporatebuffer","family_floaters"]; + $keysToRemove = ["removable_keys"]; $empPolicy = $this->employeeModel->getEmployeePolicy($id); + // dd($empPolicy); if ($empPolicy) { $result = []; @@ -202,16 +203,44 @@ class EmployeeRestController extends AdminController $decodedArray = json_decode($array->Policy_Terms); $refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove)); - // $client_id =$array->ClientId; - // $policy_id =$array->PolicyId; - - // $rackRate = $this->policesModel->getPolicySlabRatesForEmpOnboard($policy_id, $client_id); - - // $array->Policy_Terms = json_encode($refusingData); + $array->Policy_Terms = $refusingData; $getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array->ClientPolicyId,$array->ClientId); $array->SlabRates = $getSlabAndGridData['slab_rates']; $array->GridMaster = $getSlabAndGridData['grid_master']; + + if($getSlabAndGridData['grid_master']['policy_type'] == "GPA"){ + $default_si = $array->Policy_Terms->sumInsured2; + $index = -1; + foreach ($array->SlabRates as $key => $value) { + if ($value['si'] == $default_si) { + $index = $key; + break; + } + } + if ($index >= 0) { + $element =$array->SlabRates[$index]; + array_splice($array->SlabRates, $index, 1); + array_unshift($array->SlabRates, $element); + } + + }else if($getSlabAndGridData['grid_master']['policy_type'] == "GMC"){ + + // re-arranging order of si + $default_si = $array->Policy_Terms->sum_insured; + $index = -1; + foreach ($array->SlabRates as $key => $value) { + if ($value['si'] == $default_si) { + $index = $key; + break; + } + } + if ($index >= 0) { + $element =$array->SlabRates[$index]; + array_splice($array->SlabRates, $index, 1); + array_unshift($array->SlabRates, $element); + } + } $result[] = $array; } @@ -219,9 +248,9 @@ class EmployeeRestController extends AdminController }else{ return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404); } - } catch (\Exception $e) { - return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); - } + // } catch (\Exception $e) { + // return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); + // } } diff --git a/app/Models/PolicesModel.php b/app/Models/PolicesModel.php index 96e5e8f1..9aa5811f 100644 --- a/app/Models/PolicesModel.php +++ b/app/Models/PolicesModel.php @@ -1,7 +1,8 @@ Date: Sat, 16 Mar 2024 13:46:51 +0530 Subject: [PATCH 09/32] ModelnameSmallcase:GWM --- app/Models/PolicesModel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Models/PolicesModel.php b/app/Models/PolicesModel.php index 9aa5811f..a33d1880 100644 --- a/app/Models/PolicesModel.php +++ b/app/Models/PolicesModel.php @@ -1,8 +1,8 @@ where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll(); if((!count($premium_slab_data))) { - $policyPremium2Model = new policyPremium2Model(); + $policyPremium2Model = new PolicyPremium2Model(); $premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll(); } From 409dd470d461d4e955342caec664d05ba13185e5 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Mon, 18 Mar 2024 15:14:16 +0530 Subject: [PATCH 10/32] CHANGES-IN-RESTAPI:GWM --- app/Config/Routes.php | 8 +- app/Controllers/EmployeeRestController.php | 97 +++++++++++++++++-- .../RestAuthenticationController.php | 65 +++++++++++++ app/Models/EmployeePolicyModel.php | 13 +++ app/Models/LevelContactModel.php | 1 + app/Models/PolicesModel.php | 3 +- 6 files changed, 179 insertions(+), 8 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 1c832e4b..43a4813a 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -195,9 +195,12 @@ $routes->cli('processjob', 'JobWorker::processJob'); -// $routes->get("/api", "RestAuthenticationController::index"); +//Employee login api's $routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber"); $routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData"); +//HR login api's +$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber"); +$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData"); $routes->group("/api", ["filter" => "authJWT"], function($routes){ $routes->post("logined", "RestAuthenticationController::logined"); @@ -220,6 +223,9 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ $routes->post("addEmployeeAndDependence", "EmployeeRestController::addEmployeeAndDependence"); $routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy"); + $routes->post("createOrUpdateEmployeePolicySiAmount", "EmployeeRestController::createOrUpdateEmployeePolicySiAmount"); + $routes->get("deleteDependence", "EmployeeRestController::deleteDependence"); + $routes->get("getEmployeeAndDependenceByClientId", "EmployeeRestController::getEmployeeAndDependenceByClientId"); }); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index e8ef9517..19c4c5b3 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -69,7 +69,7 @@ class EmployeeRestController extends AdminController } catch (\Throwable $th) { return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); } - } + } public function editEmployeeProfile() @@ -185,11 +185,65 @@ class EmployeeRestController extends AdminController } + public function deleteDependence() + { + try { + $delete = $this->employeeModel->where('id', $this->request->getGet('id'))->delete(); + + if ($delete) { + return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200); + } else { + return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404); + } + + } catch (\Exception $e) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); + } + + } + + + public function getEmployeeAndDependenceByClientId() + { + try { + $empData = $this->employeeModel + ->where('client_id', $this->request->getGet('client_id')) + ->where('relationship', 'self') + ->orderBy('id') + ->findAll(); + + $result = []; + + foreach ($empData as $employee) { + $employeeDependence = $this->employeeModel + ->where('emp_code', $employee['emp_code']) + ->where('relationship !=', 'self') + ->findAll(); + + // Use object notation to access properties and set 'dependence' + $employee['dependence'] = $employeeDependence ?: []; + + $result[] = $employee; + } + + // You probably meant to check $result, not $data + if ($result) { + return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200); + } else { + return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404); + } + + + } catch (\Exception $e) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); + } + + } + public function getEmployeePolicy() { - // $id= 4; - // try { + try { $id = $this->request->getGet('id'); $keysToRemove = ["removable_keys"]; @@ -248,9 +302,40 @@ class EmployeeRestController extends AdminController }else{ return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404); } - // } catch (\Exception $e) { - // return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); - // } + } catch (\Exception $e) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); + } + } + + public function createOrUpdateEmployeePolicySiAmount() + { + + try { + $requestData = $this->request->getJSON(); + + + $checkIfExist = $this->employeePolicyModel->where('employee_id', $requestData['employee_id']) + ->where('client_policy_id', $requestData['client_policy_id']) + ->findAll(); + // dd($checkIfExist); + if ($checkIfExist) { + + $empPolicy = $this->employeePolicyModel->updateSiAndPremium($requestData['client_policy_id'], $requestData['employee_id'], $requestData['basic_cover_si']); + + }else{ + + $data['employee_id']= $requestData['employee_id']; + $data['client_policy_id']= $requestData['client_policy_id']; + $data['basic_cover_si']= $requestData['basic_cover_si']; + + $this->employeePolicyModel->insert($data); + } + + return $this->respond(['status' => 'success','code' => 200,'data' => []], 200); + + } catch (\Exception $e) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); + } } diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index ac43c791..721e71a9 100644 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -20,6 +20,7 @@ use CodeIgniter\API\ResponseTrait; use App\Models\EmployeeModel; use App\Models\AuthHistoryModel; +use App\Models\LevelContactModel; use Firebase\JWT\JWT; // require_once('../vendor/autoload.php'); @@ -33,6 +34,7 @@ class RestAuthenticationController extends AdminController protected $myLogger; protected $employeeModel; protected $authHistoryModel; + protected $hrModel; public function __construct() @@ -42,6 +44,7 @@ class RestAuthenticationController extends AdminController $this->employeeModel = new EmployeeModel(); $this->authHistoryModel = new AuthHistoryModel(); + $this->hrModel = new LevelContactModel(); } @@ -121,6 +124,68 @@ class RestAuthenticationController extends AdminController } } + public function verifyHrWithMobileNumber() + { + try { + $mobile_number = $this->request->getJSON()->mobile_number; + $randomNumber = rand(100000, 999999); + + $HrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->first(); + + if ($HrData) { + $id= $HrData["id"]; + $otp = $this->hrModel->where('id', $id)->set('otp', $randomNumber)->update(); + $result = ['user_verification' => true , 'otp'=>$randomNumber]; + return $this->respond(['status' => 'success','code' => 200,'data' => $result],200); + } else { + $result = ['user_verification' => false]; + return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404); + + } + } catch (\Throwable $th) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); + } + } + + + public function getVerifiedHrData() + { + try { + $mobile_number = $this->request->getJSON()->mobile_number; + $otp = $this->request->getJSON()->otp; + + $hrData = $this->hrModel->where('mobile', $mobile_number)->first(); + if ($hrData && $otp == $hrData["otp"]) { + $auth = HttpRequestHelper::getRequestInfo(); + if ($auth) { + $data = [ + 'user_id' => $hrData['id'], + 'user_type' => 'hr', + 'ip' => $auth['ip'], + 'platform' => $auth['platform'], + 'broswer' => $auth['browser'], + ]; + + $authdata= $this->authHistoryModel->insert($data); + + } + $otp_null = $this->hrModel->where('id', $hrData["id"])->set('otp', null)->update(); + + $hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id') + ->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left') + ->where('level_contacts.mobile', $mobile_number ) + ->find(); + + $result = JWTToken::encode($hrData); + return $this->respond(['status' => 'success','code' => 200,'data' => $result],200); + } else { + return $this->respond(['status' => 'failed','code' => 404,'data' => "No data"],404); + } + } catch (\Exception $e) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500); + } + } + public function employeeLogout() diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 8424ab3c..530d8543 100644 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -189,5 +189,18 @@ class EmployeePolicyModel extends Model ->find(); } + + public function updateSiAndPremium( $client_policy_id, $employee_id,$basic_cover_si) + { + + + $query = "UPDATE employee_polices + SET employee_polices.basic_cover_si = '{$basic_cover_si}' + WHERE employee_polices.employee_id = '{$employee_id}' + AND employee_polices.client_policy_id = '{$client_policy_id}'"; + + $this->query($query); + } + //------------------------------------------------------------------ } diff --git a/app/Models/LevelContactModel.php b/app/Models/LevelContactModel.php index 635d3652..79a8f15a 100644 --- a/app/Models/LevelContactModel.php +++ b/app/Models/LevelContactModel.php @@ -20,6 +20,7 @@ class LevelContactModel extends Model "designation", "created_by", "updated_by", + "otp", "is_active", ]; diff --git a/app/Models/PolicesModel.php b/app/Models/PolicesModel.php index a33d1880..70724d71 100644 --- a/app/Models/PolicesModel.php +++ b/app/Models/PolicesModel.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Models\PolicyPremium1Model; use App\Models\PolicyPremium2Model; +use App\Models\PolicyGridModel; use CodeIgniter\Model; class PolicesModel extends Model @@ -46,7 +47,7 @@ class PolicesModel extends Model } $grid_id = $premium_slab_data[0]['policy_grid_id']; - $policyGridModel = new policyGridModel(); + $policyGridModel = new PolicyGridModel(); $results = $policyGridModel->find($grid_id); return ['slab_rates' => $premium_slab_data,'grid_master' => $results]; } From f601bb5cd5b5d59f4ab3b65bc4c454e10ba5f243 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Mon, 18 Mar 2024 19:39:39 +0530 Subject: [PATCH 11/32] FEATURE_EMPLOYEE_FILE_UPLOAD_MAIL_HELPER : AADHAVAN --- app/Config/Email.php | 14 +- app/Config/Routes.php | 1 + app/Controllers/ClientController.php | 337 +++++++++--------- app/Controllers/EmployeeRestController.php | 113 +++--- app/Helpers/MailHelper.php | 44 +++ app/Views/client_policy.php | 102 +++--- app/Views/policy_gpa_terms.php | 15 +- app/Views/policy_grid.php | 388 +++++++++------------ composer.json | 1 + 9 files changed, 544 insertions(+), 471 deletions(-) create mode 100644 app/Helpers/MailHelper.php diff --git a/app/Config/Email.php b/app/Config/Email.php index 4dce650b..b6ac8865 100644 --- a/app/Config/Email.php +++ b/app/Config/Email.php @@ -18,7 +18,7 @@ class Email extends BaseConfig /** * The mail sending protocol: mail, sendmail, smtp */ - public string $protocol = 'mail'; + public string $protocol = 'smtp'; /** * The server path to Sendmail. @@ -28,22 +28,22 @@ class Email extends BaseConfig /** * SMTP Server Hostname */ - public string $SMTPHost = ''; + public string $SMTPHost = 'mail.venbait.in'; /** * SMTP Username */ - public string $SMTPUser = ''; + public string $SMTPUser = 'bbone@venbait.in'; /** * SMTP Password */ - public string $SMTPPass = ''; + public string $SMTPPass = 'xk!L(N_-R#};'; /** * SMTP Port */ - public int $SMTPPort = 25; + public int $SMTPPort = 465; /** * SMTP Timeout (in seconds) @@ -62,7 +62,7 @@ class Email extends BaseConfig * to the server. 'ssl' means implicit SSL. Connection on port * 465 should set this to ''. */ - public string $SMTPCrypto = 'tls'; + public string $SMTPCrypto = 'ssl'; /** * Enable word-wrap @@ -77,7 +77,7 @@ class Email extends BaseConfig /** * Type of mail, either 'text' or 'html' */ - public string $mailType = 'text'; + public string $mailType = 'html'; /** * Character set (utf-8, iso-8859-1, etc.) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 41afa3d2..3d703e43 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -220,5 +220,6 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ $routes->post("addEmployeeAndDependence", "EmployeeRestController::addEmployeeAndDependence"); }); +$routes->post("sendEmail", "EmployeeRestController::send_email"); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 8d8b8104..87f633fa 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -583,175 +583,194 @@ class ClientController extends AdminController public function createClientPolicyPremium() { - // print_r($this->request->getPost());die(); - $policy_type = $this->request->getPost('policy_type'); - $client_id = $this->request->getPost('client_id'); - $client_policy_id = $this->request->getPost('client_policy_id'); - $policy_grid_id = $this->request->getPost('policy_grid_id'); - $multiplier = $this->request->getPost('multiplier'); - $si_or_bp = $this->request->getPost('si_or_bp'); - $basic_multiplier = $this->request->getPost('basic_multiplier'); - $premium_multiplier =$this->request->getPost('premium_multiplier'); - $basic_pay = $this->request->getPost('basic_pay'); + try { + $policy_type = $this->request->getPost('policy_type'); + $client_id = $this->request->getPost('client_id'); + $client_policy_id = $this->request->getPost('client_policy_id'); + $policy_grid_id = $this->request->getPost('policy_grid_id'); + $si_or_bp = $this->request->getPost('si_or_bp'); + $basic_multiplier = str_replace(',', '', $this->request->getPost('basic_multiplier')); + $premium_multiplier = str_replace(',', '', $this->request->getPost('premium_multiplier')); + $multiplier = str_replace(',', '', $this->request->getPost('multiplier')); + $basic_pay = str_replace(',', '', $this->request->getPost('basic_pay')); + + $data=[]; + $data['client_id'] = $client_id; + $data['client_policy_id'] = $client_policy_id; + $data['policy_grid_id'] = $policy_grid_id; + - if($policy_type !== null && $policy_type !== ''){ + $premium = []; - $this->policyPremium1Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update(); - - if($si_or_bp == '1'){ - $premiumData = $this->request->getPost('sum_premium'); - - }else{ - $premiumData = $this->request->getPost('premium'); + if ($policy_grid_id == '1' || $policy_grid_id == '2') { + $this->policyPremium1Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update(); + } else { + $this->policyPremium2Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update(); } + - for ($i = 0; $i < count($premiumData); $i++) { - $data = [ - 'client_id' => $client_id, - 'client_policy_id' => $client_policy_id, - 'policy_grid_id' => $policy_grid_id, - 'created_by' => get_session_userid(), - ]; - - if ($si_or_bp == '2') { - if(is_array($this->request->getPost('basic_si'))){ - $si = isset($this->request->getPost('basic_si')[$i]) ? $this->request->getPost('basic_si')[$i] : null; - }else{ - $si = $this->request->getPost('basic_si'); - } - } else { - if(is_array($this->request->getPost('si'))){ - $si = isset($this->request->getPost('si')[$i]) ? $this->request->getPost('si')[$i] : null; - }else{ - $si = $this->request->getPost('si'); - } - } - - - if($si_or_bp == '1'){ - if(is_array($this->request->getPost('sum_premium'))){ - $premium = isset($this->request->getPost('sum_premium')[$i]) ? $this->request->getPost('sum_premium')[$i] : null; - }else{ - $premium = $this->request->getPost('sum_premium'); - } - }else{ - if(is_array($this->request->getPost('premium'))){ - $premium = isset($this->request->getPost('premium')[$i]) ? $this->request->getPost('premium')[$i] : null; - }else{ - $premium = $this->request->getPost('premium'); - } - } - - // $basic_gpa_premium = isset($basic_gpa_premium[$i]) ? $basic_gpa_premium[$i] : null; - if ($si !== null) { - $data['si'] = $si; - } - if ($premium !== null) { - $data['premium'] = $premium; - } - - if($si_or_bp == 2){ - if ($premium_multiplier !== null) { - $data['multiplier'] = $premium_multiplier; - } - }else{ - if ($multiplier !== null) { + if($policy_grid_id == '1'){ + if ($si_or_bp == '1') { + $premium=str_replace(',', '', $this->request->getPost('gpa_sum_premium[]')); + $sum_insure=str_replace(',', '', $this->request->getPost('gpa_sum_si[]')); + $multiplier=$this->request->getPost('gpa_sum_multiplier'); + for ($i=0; $i < count($premium) ; $i++) { + $data['si'] = $sum_insure[$i]; + $data['premium'] = $premium[$i]; $data['multiplier'] = $multiplier; + $data['si_or_bp'] = $this->request->getPost('si_or_bp'); + + $policyPremium= $this->policyPremium1Model->insert($data); } - } - - if ($si_or_bp !== null) { - $data['si_or_bp'] = $si_or_bp; - } + } else { + $data['premium'] = str_replace(',', '', $this->request->getPost('gpa_basic_premium')); + $data['si'] = str_replace(',', '', $this->request->getPost('gpa_basic_si')); + $data['basic_multiplier'] = str_replace(',', '', $this->request->getPost('basic_multiplier')); + $data['multiplier'] = $this->request->getPost('premium_multiplier'); + $data['basic_pay'] = str_replace(',', '', $this->request->getPost('basic_pay')); + $data['si_or_bp'] = $this->request->getPost('si_or_bp'); - + $policyPremium= $this->policyPremium1Model->insert($data); + } + $data = $this->request->getPost(); + $insert = true; + }else if($policy_grid_id == '2'){ + $data['premium'] = str_replace(',', '', $this->request->getPost('gpa_premium')); + $data['si'] = str_replace(',', '', $this->request->getPost('gpa_si')); - if ($basic_multiplier !== null) { - $data['basic_multiplier'] = $basic_multiplier; + $policyPremium= $this->policyPremium1Model->insert($data); + + $data = $this->request->getPost(); + $insert = true; + }else if($policy_grid_id == '3'){ + $premium=$this->request->getPost('3_premium[]'); + $sum_insure =$this->request->getPost('3_si[]'); + for ($i=0; $i < count($premium) ; $i++) { + $data['premium'] = str_replace(',', '',$premium[$i]); + $data['si'] = str_replace(',', '', $sum_insure[$i]); + $dataa= $this->policyPremium2Model->insert($data); } - - if ($basic_pay !== null) { - $data['basic_pay'] = $basic_pay; + $data = $this->request->getPost(); + $insert = true; + }else if($policy_grid_id == '4'){ + $premium=$this->request->getPost('4_premium[]'); + $sum_insure =$this->request->getPost('4_si'); + $age_from =$this->request->getPost('4_age_from[]'); + $age_to =$this->request->getPost('4_age_to[]'); + for ($i=0; $i < count($premium) ; $i++) { + $data['premium'] = str_replace(',', '',$premium[$i]); + $data['si'] = str_replace(',', '', $sum_insure); + $data['age_from'] = $age_from[$i]; + $data['age_to'] = $age_to[$i]; + $dataa= $this->policyPremium2Model->insert($data); } - - $this->policyPremium1Model->insert($data); + $data = $this->request->getPost(); + $insert = true; + }else if($policy_grid_id == '5'){ + $premium=$this->request->getPost('5_premium[]'); + $sum_insure =$this->request->getPost('5_si[]'); + $age_from =$this->request->getPost('5_age_from[]'); + $age_to =$this->request->getPost('5_age_to[]'); + for ($i=0; $i < count($premium) ; $i++) { + $data['premium'] = str_replace(',', '',$premium[$i]); + $data['si'] = str_replace(',', '', $sum_insure[$i]); + $data['age_from'] = $age_from[$i]; + $data['age_to'] = $age_to[$i]; + $dataa= $this->policyPremium2Model->insert($data); + } + $data = $this->request->getPost(); + $insert = true; + }else if($policy_grid_id == '6'){ + $premium=$this->request->getPost('6_premium[]'); + $sum_insure =$this->request->getPost('6_si[]'); + $age_from =$this->request->getPost('6_age_from[]'); + $age_to =$this->request->getPost('6_age_to[]'); + for ($i=0; $i < count($premium) ; $i++) { + $data['premium'] = str_replace(',', '',$premium[$i]); + $data['si'] = str_replace(',', '', $sum_insure[$i]); + $data['age_from'] = $age_from[$i]; + $data['age_to'] = $age_to[$i]; + $dataa= $this->policyPremium2Model->insert($data); + } + $data = $this->request->getPost(); + $insert = true; + }else if($policy_grid_id == '7'){ + $premium=$this->request->getPost('7_premium[]'); + $sum_insure =$this->request->getPost('7_si[]'); + $age_from =$this->request->getPost('7_age_from[]'); + $age_to =$this->request->getPost('7_age_to[]'); + for ($i=0; $i < count($premium) ; $i++) { + $data['premium'] = str_replace(',', '',$premium[$i]); + $data['si'] = str_replace(',', '', $sum_insure[$i]); + $data['age_from'] = $age_from[$i]; + $data['age_to'] = $age_to[$i]; + $dataa= $this->policyPremium2Model->insert($data); + } + $data = $this->request->getPost(); + $insert = true; + }else if($policy_grid_id == '8'){ + $premium=$this->request->getPost('8_premium[]'); + $sum_insure =$this->request->getPost('8_si[]'); + $grade =$this->request->getPost('8_grade[]'); + for ($i=0; $i < count($premium) ; $i++) { + $data['premium'] = str_replace(',', '',$premium[$i]); + $data['si'] = str_replace(',', '', $sum_insure[$i]); + $data['grade'] = $grade[$i]; + $dataa= $this->policyPremium2Model->insert($data); + } + $data = $this->request->getPost(); + $insert = true; + }else if($policy_grid_id == '9'){ + $premium=$this->request->getPost('9_premium[]'); + $sum_insure =$this->request->getPost('9_si[]'); + $grade =$this->request->getPost('9_grade[]'); + for ($i=0; $i < count($premium) ; $i++) { + $data['premium'] = str_replace(',', '',$premium[$i]); + $data['si'] = str_replace(',', '', $sum_insure[$i]); + $data['grade'] = $grade[$i]; + $dataa= $this->policyPremium2Model->insert($data); + } + $data = $this->request->getPost(); + $insert = true; + }else if($policy_grid_id == '10'){ + $premium=$this->request->getPost('10_premium[]'); + $sum_insure =$this->request->getPost('10_si[]'); + $age_from =$this->request->getPost('10_age_from[]'); + $age_to =$this->request->getPost('10_age_to[]'); + for ($i=0; $i < count($premium) ; $i++) { + $data['premium'] = str_replace(',', '',$premium[$i]); + $data['si'] = str_replace(',', '', $sum_insure[$i]); + $data['age_from'] = $age_from[$i]; + $data['age_to'] = $age_to[$i]; + $policyPremium= $this->policyPremium2Model->insert($data); + } + $data = $this->request->getPost(); + $insert = true; + }else if($policy_grid_id == '11'){ + $premium=$this->request->getPost('11_premium[]'); + $sum_insure =$this->request->getPost('11_si[]'); + $grade =$this->request->getPost('11_grade[]'); + $max_sum_insure =$this->request->getPost('11_max_si[]'); + for ($i=0; $i < count($premium) ; $i++) { + $data['premium'] = str_replace(',', '',$premium[$i]); + $data['si'] = str_replace(',', '', $sum_insure[$i]); + $data['grade'] = $grade[$i]; + $data['max_si'] = $max_sum_insure[$i]; + $dataa= $this->policyPremium2Model->insert($data); + } + $data = $this->request->getPost(); + $insert = true; } - $data = $this->request->getPost(); - $insert = true; if($insert){ return $this->respond(['status' => true,'code' => 200,'data' => $data], 200); - }else{ + }else{ return $this->respond(['status' => false,'code' => 404, 'data' => $data,'message' => 'no data found'], 200); - - } - // print_r($data); - // die(); - // $data['created_by'] = get_session_userid(); - // $this->policyPremium1Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update(); - // $insert = $this->policyPremium1Model->insert($data); - }else{ - - $this->policyPremium2Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update(); - $premiumData = $this->request->getPost('premium'); - for ($i = 0; $i < count($premiumData); $i++) { - - $data = [ - 'client_id' => $client_id, - 'client_policy_id' => $client_policy_id, - 'policy_grid_id' => $policy_grid_id, - 'created_by' => get_session_userid(), - - ]; - - if(is_array($this->request->getPost('si'))){ - $si = isset($this->request->getPost('si')[$i]) ? $this->request->getPost('si')[$i] : null; - }else{ - $si = $this->request->getPost('si'); - } - $age_from = isset($this->request->getPost('age_from')[$i]) ? $this->request->getPost('age_from')[$i] : null; - $age_to = isset($this->request->getPost('age_to')[$i]) ? $this->request->getPost('age_to')[$i] : null; - $premium = isset($premiumData[$i]) ? $premiumData[$i] : null; - $grade = isset($this->request->getPost('grade')[$i]) ? $this->request->getPost('grade')[$i] : null; - $max_si = isset($this->request->getPost('max_si')[$i]) ? $this->request->getPost('max_si')[$i] : null; - - if ($si !== null) { - $data['si'] = $si; - } - - if ($age_from !== null) { - $data['age_from'] = $age_from; - } - - if ($age_to !== null) { - $data['age_to'] = $age_to; - } - - if ($premium !== null) { - $data['premium'] = $premium; - } - - if ($max_si !== null) { - $data['max_si'] = $max_si; - } - - if ($grade !== null) { - $data['grade'] = $grade; - } - - $this->policyPremium2Model->insert($data); - } - $data = $this->request->getPost(); - $insert = true; - } - - if($insert){ - return $this->respond(['status' => true,'code' => 200,'data' => $data], 200); - }else{ - return $this->respond(['status' => false,'code' => 404, 'data' => $data,'message' => 'no data found'], 200); - - } - + } + } catch (Exception $e) { + // Handle exceptions here + echo 'Error: ' . $e->getMessage(); + } } @@ -844,14 +863,12 @@ class ClientController extends AdminController }else{ $premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll(); } - - // echo '
';
         // print_r($results);
         // print_r($data[0]->policy_type); die;
                     // echo "hello";
-            // print_r($premiumData);
-        return $this->respond(['status' => true,'code' => 200,'data' => $results, 'premiumData' => $premiumData, 'count' => $emp_count, 'policy_name' => $policy_name], 200);
+            // return json_encode($premiumData);
+        return $this->respond(['status' => true,'code' => 200,'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name], 200);
 
     }
 
@@ -862,6 +879,7 @@ class ClientController extends AdminController
             
             $this->myLogger->logme('error','Terms CREATE function called');
             
+
             /*** Client Policy Table Primary Key(ID) ***/
             $client_policy_id = $this->request->getPost("client_policy_id");
 
@@ -870,6 +888,9 @@ class ClientController extends AdminController
                 $data['corporatebuffer'] = $this->request->getPost("corporatebuffer");
                 $data['family_floaters'] = $this->request->getPost("family_floaters") ?? [];                
 
+                if (!in_array("self", $data['family_floaters'])) {
+                    array_unshift($data['family_floaters'], "self");
+                }
             $data['waiverofpreexistingdiseases']   =$this->request->getPost("waiverofpreexistingdiseases");
             if ($data['waiverofpreexistingdiseases'] == 1) {
                 $data['maternitycoverage']   =$this->request->getPost("maternitycoverage");
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index 9f2d3574..56b8d097 100644
--- a/app/Controllers/EmployeeRestController.php
+++ b/app/Controllers/EmployeeRestController.php
@@ -2,6 +2,8 @@
 
 namespace App\Controllers;
 
+use App\Helpers\MailHelper;
+
 use CodeIgniter\HTTP\IncomingRequest;
 use CodeIgniter\HTTP\RequestInterface;
 use CodeIgniter\HTTP\ResponseInterface;
@@ -14,6 +16,7 @@ use App\Models\ClientModel;
 use App\Models\PolicesModel;
 use App\Models\RelationshipModel;
 use App\Models\FileModel;
+use App\Models\ClientPolicyModel;
 
 
 use PhpOffice\PhpSpreadsheet\Spreadsheet;
@@ -36,6 +39,7 @@ class EmployeeRestController extends AdminController
     protected $fileModel;
     protected $policesModel;
     protected $relationshipModel;
+    protected $clientPolicyModel;
 
     public function __construct()
     {
@@ -48,6 +52,7 @@ class EmployeeRestController extends AdminController
         $this->policesModel = new PolicesModel();
         $this->relationshipModel = new RelationshipModel();
         $this->fileModel= new FileModel();
+        $this->clientPolicyModel= new ClientPolicyModel();
     }
 
   
@@ -144,7 +149,7 @@ class EmployeeRestController extends AdminController
         
     }
 
-
+    
     public function addEmployeeAndDependence()
     {
         try {
@@ -220,7 +225,7 @@ class EmployeeRestController extends AdminController
         }
     }
 
-
+    // Get the RelationShip list
     public function relationshipList()
     {
         try {
@@ -238,18 +243,15 @@ class EmployeeRestController extends AdminController
         }
     }
 
-
+    // Upload the Sheet Data in DB
     public function employeeUpload()
     {
-
         $file = $this->request->getFile('file');
         $client_id = $this->request->getPost('client_id');
         $policy_id = $this->request->getPost('policy_id');
 
-
         $is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
         $filename = $file->getName();
-
         $file_name_with_path = WRITEPATH."/uploads/import_excel/".$filename;
 
         //check the file exist or not
@@ -258,7 +260,6 @@ class EmployeeRestController extends AdminController
             session()->setFlashdata('error', 'File not found');
             return redirect()->to(base_url('employee/upload'));
         }
-
         // Load the Excel file
         $spreadsheet = IOFactory::load($file_name_with_path);
 
@@ -289,17 +290,16 @@ class EmployeeRestController extends AdminController
             $data[] = $rowData;
         }
 
+        
         $extractData['file_name']= $filename;
         $extractData['client_id']= $client_id;
         $extractData['status']= 'success';
         $extractData['policy_id']= $policy_id;
         $extractData['action']= 'enrollment';
-
         //  $extractData['created_by']=set_session_context('Employee');
 
         $file_data =$this->fileModel->insert($extractData);
 
-        // print_r(count($data));
         $extra = [];
         for ($i = 0; $i < count($data); $i++) {
             if ($i == 0) {
@@ -318,57 +318,90 @@ class EmployeeRestController extends AdminController
                 }
             }
         }
-
+        // print_r("Extra", $extra);die;
         $dataToInsert = [];
+        $basic_cover_si= [];
         foreach ($extra['id'] as $index => $id) {
             $record = [
                 // 'id' => $id,
-                'emp_code' => $extra['emp_code'][$index],
+                'emp_code' => isset($extra['emp_code'][$index]) ? $extra['emp_code'][$index] : 0,
                 'name' => $extra['name'][$index],
                 // Check if the 'doj' key exists before accessing it
                 'doj' => isset($extra['doj'][$index]) ? $extra['doj'][$index] : null,
                 'gender' => $extra['gender'][$index],
                 'relationship' => $extra['relationship'][$index],
                 'dob' => $extra['dob'][$index],
-                'email' => $extra['Email'][$index],
+                'email_personal' => $extra['Email'][$index],
+                'client_id' => $client_id,
             ];
+            $record2 = [
+                'basic_cover_si' => isset($extra['sum_insure'][$index]) ? $extra['sum_insure'][$index] : 0,
+            ];
+
             $dataToInsert[] = $record;
+            $basic_cover_si[]= $record2;
         }
-
-                // print_r($dataToInsert);die();
-
-                for ($a=0; $a employeeModel->insert($dataToInsert[$a]);
-
-                     $employee = $this->employeeModel->checkExistingEmpEntrollment($dataToInsert[$a]);
-
-                    // print_r($employee);die;
-                     if (count($employee)) {
-                        // $dataToInsert['id'] = $employee['id'];
-                        $this->employeeModel->update($dataToInsert[$a], ['id' => $employee['id']]);
-                        die();
+        // print_r("dataToInsert", $dataToInsert);die;
+        for ($a=0; $a employeeModel->checkExistingEmpEntrollment($dataToInsert[$a]);
+                    $emp_id =0;
+                    if ($employee) {
+                        $emp_id =$employee['id'];
+                        $id =$emp_id;
+                        $result = $this->employeeModel->update($id, $dataToInsert[$a]);
+                        if ($result) {
+                            $log_message = 'Update Employee - '.$employee['name'].'('.$employee['emp_code'].') with PK '.$employee['id'];
+                            $this->myLogger->logme('error',('Update - ' . $employee['id'].' - '. $employee['emp_code'] .' - '.$employee['name']));
+                        }
                     }else{
+                        $result = $this->employeeModel->insert($dataToInsert[$a]);
+                        $emp_id =$result;
+                        if ($result) {
+                            $emp = $this->employeeModel->where('id', $result)->get()->getResult();
 
-                     }
-                }
-        
-        
-
-
-
-        
-        // $query = $this->employeePolicyModel->getLastQuery();
-        // echo $query . "
"; - // Return the array containing data from the Excel file - // return $data; + $policy_name = $this->employeePolicyModel->where('employee_id', $result)->get()->getResult();; + + + $log_message = 'Insert Employee- '.$dataToInsert[$a]['name'] .'('.$dataToInsert[$a]['emp_code'] .') with PK '; + $this->myLogger->logme('error',('Insert - ' . $dataToInsert[$a]['emp_code'] .' - '. $dataToInsert[$a]['name'])); + } + } + $emp_policy_data =[ + 'employee_id'=>$emp_id, + 'client_policy_id'=>$policy_id, + 'status'=> 'draft', + 'basic_cover_si'=> $basic_cover_si[$a] + ]; + + $employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $policy_id]); + if ($employee_policy) { + foreach ($employee_policy as $existing_policy) { + $this->employeePolicyModel->update($existing_policy['id'], $emp_policy_data); + } + } else { + $emp_policy = $this->employeePolicyModel->insert($emp_policy_data); + } + //trigger + // print_r($dataToInsert[$a]['email_personal']);die; + $policy = $this->clientPolicyModel->where('id', $policy_id)->first(); + $policy_name = $this->policesModel->where('id', $policy['policy_id'])->first(); + $mail = $dataToInsert[$a]['email_personal']; + $subject = 'Welcome, Employee Benefit Program Enrolment'; + $message = 'Dear ' . $dataToInsert[$a]['name'] . ",
We are glad to welcome you to the employee benefit program ," .$policy_name['name'] ."offered by your employer,


Click on the link below to review your personal and family details:
Review Details" ; + $return_log = MailHelper::send_email($mail,$subject, $message); + + // $a = json_decode( $return_log); + + // print_r($a);die; + // $this->myLogger->logme($return_log,''); + } } + } \ No newline at end of file diff --git a/app/Helpers/MailHelper.php b/app/Helpers/MailHelper.php new file mode 100644 index 00000000..6da40441 --- /dev/null +++ b/app/Helpers/MailHelper.php @@ -0,0 +1,44 @@ +setFrom('bbone@venbait.in', 'Venkat'); + + $email->setTo($emaill); + + $email->setSubject($subject); + $email->setMessage($message); + + if ($email->send()) { + return json_encode(['status' => 'success','code' => 200, 'message'=>'Email Sent Successfully...','data' => $emaill,],200); + } else { + return json_encode(['status' => 'failed','code' => 404,'message'=>'Email Sent Failed...','data' => $emaill ],404); + } + + } catch (Exception $e) { + return json_encode(['status' => 'failed','code' => 500,'data' => $e],500); + } + } + + + function logme($message, $email) { + // Your logging logic here + // For example, writing to a log file + file_put_contents('path/to/log/file.txt', $message . "\n", FILE_APPEND); + } +} +?> \ No newline at end of file diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index a9df6485..7e7dde33 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -694,9 +694,21 @@ } function convertCommaNumberToWords(input) { - // console.log(input); - const number = parseInt(input.replace(/,/g, ''), 10); - return convertNumberToWords(number); + let number; + if (input instanceof HTMLElement) { + const inputValue = input.value; + number = parseInt(inputValue.replace(/,/g, ''), 10); + var convert_word_value = convertNumberToWords(number); + + if (input.nextElementSibling !== null) { + input.nextElementSibling.textContent = convert_word_value; + } + } else { + number = parseInt(input.replace(/,/g, ''), 10); + } + var convert_word_value = convertNumberToWords(number); + + return convert_word_value; } function onlyNumbers(event){ @@ -709,6 +721,7 @@ function formatNumber(input, maxLength) { + // console.log("input", input); maxLength=16; let value = input.value.replace(/\D/g, ''); // Remove non-numeric characters @@ -723,48 +736,49 @@ if (input.id == 'gpa_si') { gpaSumInsureMultiplier(); } + convertCommaNumberToWords(input); - if(input.id == 'basic_pay'){ - var inputNumber = input.value; - if (inputNumber) { - var result = convertCommaNumberToWords(inputNumber); - $("#gpa_basic_pay_number_word").text(result); - } else { - $("#gpa_basic_pay_number_word").text(""); - } - }else if(input.id == 'basic_gpa_si'){ - var inputNumber = input.value; - if (inputNumber) { - var result = convertCommaNumberToWords(inputNumber); - $("#basic_gpa_si_number_word").text(result); - } else { - $("#basic_gpa_si_number_word").text(""); - } - }else if(input.id == 'basic_gpa_premium'){ - var inputNumber = input.value; - if (inputNumber) { - var result = convertCommaNumberToWords(inputNumber); - $("#basic_gpa_premium_number_word").text(result); - } else { - $("#basic_gpa_premium_number_word").text(""); - } - }else if(input.id == 'gpa_si'){ - var inputNumber = input.value; - if (inputNumber) { - var result = convertCommaNumberToWords(inputNumber); - $("#gpa_sum_si_number_word").text(result); - } else { - $("#gpa_sum_si_number_word").text(""); - } - }else if(input.id == 'gpa_premium'){ - var inputNumber = input.value; - if (inputNumber) { - var result = convertCommaNumberToWords(inputNumber); - $("#gpa_sum_premium_number_word").text(result); - } else { - $("#gpa_sum_premium_number_word").text(""); - } - } + // if(input.id == 'basic_pay'){ + // var inputNumber = input.value; + // if (inputNumber) { + // var result = convertCommaNumberToWords(inputNumber); + // $("#gpa_basic_pay_number_word").text(result); + // } else { + // $("#gpa_basic_pay_number_word").text(""); + // } + // }else if(input.id == 'basic_gpa_si'){ + // var inputNumber = input.value; + // if (inputNumber) { + // var result = convertCommaNumberToWords(inputNumber); + // $("#basic_gpa_si_number_word").text(result); + // } else { + // $("#basic_gpa_si_number_word").text(""); + // } + // }else if(input.id == 'basic_gpa_premium'){ + // var inputNumber = input.value; + // if (inputNumber) { + // var result = convertCommaNumberToWords(inputNumber); + // $("#basic_gpa_premium_number_word").text(result); + // } else { + // $("#basic_gpa_premium_number_word").text(""); + // } + // }else if(input.id == 'gpa_si'){ + // var inputNumber = input.value; + // if (inputNumber) { + // var result = convertCommaNumberToWords(inputNumber); + // $("#gpa_sum_si_number_word").text(result); + // } else { + // $("#gpa_sum_si_number_word").text(""); + // } + // }else if(input.id == 'gpa_premium'){ + // var inputNumber = input.value; + // if (inputNumber) { + // var result = convertCommaNumberToWords(inputNumber); + // $("#gpa_sum_premium_number_word").text(result); + // } else { + // $("#gpa_sum_premium_number_word").text(""); + // } + // } return ; // } diff --git a/app/Views/policy_gpa_terms.php b/app/Views/policy_gpa_terms.php index eabdb8bd..a3745720 100644 --- a/app/Views/policy_gpa_terms.php +++ b/app/Views/policy_gpa_terms.php @@ -417,6 +417,10 @@ return; } + setTimeout(function() { + $('.loader').fadeOut(); + $('.loader-mask').delay(350).fadeOut('slow'); + }, 1000); }, error: function(xhr, status, error) { console.error(xhr.responseText); @@ -466,7 +470,11 @@ data: {client_policy_id: client_policy_id}, success: function(res) { - console.log(res) + console.log(res); + setTimeout(function() { + $('.loader').fadeOut(); + $('.loader-mask').delay(350).fadeOut('slow'); + }, 1000); $('#nameOfThePolicyInGPA').html(' - ' + res.policy_name.name); if(res.count){ @@ -533,10 +541,7 @@ $("#sumInsured2").trigger("keyup"); $("#totalSumInsured").trigger("keyup"); - setTimeout(function() { - $('.loader').fadeOut(); - $('.loader-mask').delay(350).fadeOut('slow'); - }, 1000); + }, error: function(xhr, status, error) { diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php index 0734c5e4..4d95a66c 100644 --- a/app/Views/policy_grid.php +++ b/app/Views/policy_grid.php @@ -92,17 +92,17 @@
- +
- +
- +
@@ -132,12 +132,12 @@
- +
- +
@@ -155,12 +155,12 @@
- +
- +
`; @@ -176,12 +176,12 @@
- +
- +
@@ -196,26 +196,25 @@ for (var i = 1; i <= 11; i++) { $('#grid_' + i).remove(); } - grid_html = `
-
+
- +
- +
- +
- +
@@ -236,20 +235,20 @@
- +
- +
- +
- +
@@ -267,30 +266,30 @@ grid_html = `
-
+ +
- +
-
-
-
+
+
- +
-
+
- +
- +
-
+
`; } else if(dataIdValue == '7'){ @@ -304,20 +303,20 @@
- +
- +
- +
- +
@@ -339,16 +338,16 @@
- +
- +
- +
@@ -368,16 +367,16 @@
- +
- +
- +
@@ -397,20 +396,20 @@
- +
- +
- +
- +
@@ -430,21 +429,21 @@
- +
- +
- +
- +
@@ -467,6 +466,14 @@ grid_container.insertAdjacentHTML('beforeend', grid_html); + + if(dataIdValue == '1'){ + $('#gpa_sum_si').trigger('keyup'); + // $('input[name="gpa_sum_si[]"]').each(function() { + // console.log($(this)); + // $(this).trigger('keyup'); + // }); + } $('#gpa_sum_insured').hide(); $('#btnGridSubmit').show(); @@ -474,13 +481,6 @@ setTimeout(() => { $('#si_or_bp').trigger('change'); }, 300); - - - - - - - }; @@ -575,7 +575,16 @@ data: { client_policy_id: client_policy_id}, dataType: 'json', success: function (res) { + setTimeout(function() { + $('.loader').fadeOut(); + $('.loader-mask').delay(350).fadeOut('slow'); + }, 1000); console.log('res',res); + var temp_for_premiumData = JSON.parse(res.premiumData); + + res.premiumData= JSON.parse(res.premiumData); + + $('#nameOfThePolicy').html(' - ' + res.policy_name); $('#grid_emp_count').val(res.count); @@ -606,7 +615,6 @@ addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id, si_or_bp_value); - res.premiumData.shift(); $.each(res.premiumData, function(index, item){ if (item.si_or_bp == '1') { @@ -623,33 +631,29 @@ $('#bs-example-modal-lg').modal('show'); - // $("#gpa_si").trigger("keyup"); - // $("#basic_gpa_premium").trigger("keyup"); - - // $("#sum_insured").trigger("keyup"); - // $("#premium").trigger("keyup"); - + $("#gpa_si").trigger("keyup"); + $("#gpa_premium").trigger("keyup"); $('#basic_pay').trigger('keyup'); + $('#4_si').trigger('keyup'); - $('input[name="si[]"]').each(function() { + $('input[name="gpa_sum_si[]"]').each(function() { $(this).trigger('keyup'); }); - - - $('input[name="premium[]"]').each(function() { + $('input[name="gpa_sum_premium[]"]').each(function() { $(this).trigger('keyup'); }); - // $("input[name='si[]']").trigger("keyup"); - // $("input[name='premium[]']").trigger("keyup") - - setTimeout(function() { - $('.loader').fadeOut(); - $('.loader-mask').delay(350).fadeOut('slow'); - }, 1000);si - + var id_for_trigger =temp_for_premiumData[0].policy_grid_id; + $(`input[name="${id_for_trigger}_si[]"]`).each(function() { + console.log($(this)); + $(this).trigger('keyup'); + }); + $(`input[name="${id_for_trigger}_premium[]"]`).each(function() { + console.log($(this)); + $(this).trigger('keyup'); + }); }, error: function (xhr, status, error) { console.error(xhr.responseText); @@ -762,12 +766,12 @@ html = `
- +
- +
@@ -787,12 +791,12 @@
- +
- +
@@ -809,15 +813,15 @@
- +
- +
- +
@@ -833,20 +837,20 @@
- +
- +
- +
- +
@@ -859,29 +863,28 @@ html =`
-
+ +
- +
-
-
-
- - -
-
- - -
-
- - -
-
-
- - -
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
`; @@ -891,20 +894,20 @@
- +
- +
- +
- +
@@ -919,16 +922,16 @@
- +
- +
- +
@@ -943,16 +946,16 @@
- +
- +
- +
@@ -967,20 +970,20 @@
- +
- +
- +
- +
@@ -995,21 +998,21 @@
- +
- +
- +
- +
@@ -1072,8 +1075,8 @@ function checkDuplicate() { if ($('#grid')[0].value === '3') { - var siInputs = $('input[name="si[]"]'); - var premiumInputs = $('input[name="premium[]"]'); + var siInputs = $('input[name="3_si[]"]'); + var premiumInputs = $('input[name="3_premium[]"]'); var siValues = []; var premiumValues = []; @@ -1105,8 +1108,8 @@ } }else if($('#grid')[0].value === '4'){ - var ageFrom = $('input[name="age_from[]"]'); - var ageTo = $('input[name="age_to[]"]'); + var ageFrom = $('input[name="4_age_from[]"]'); + var ageTo = $('input[name="4_age_to[]"]'); var ageFromValues = []; var ageToValues = []; @@ -1138,9 +1141,9 @@ } }else if ($('#grid')[0].value === '5') { - var si = $('input[name="si[]"]'); - var ageFrom = $('input[name="age_from[]"]'); - var ageTo = $('input[name="age_to[]"]'); + var si = $('input[name="5_si[]"]'); + var ageFrom = $('input[name="5_age_from[]"]'); + var ageTo = $('input[name="5_age_to[]"]'); var si_array = []; var ageFrom_array = []; @@ -1175,8 +1178,8 @@ return false; } }else if($('#grid')[0].value === '6'){ - var ageFrom = $('input[name="age_from[]"]'); - var ageTo = $('input[name="age_to[]"]'); + var ageFrom = $('input[name="6_age_from[]"]'); + var ageTo = $('input[name="6_age_to[]"]'); var ageFromValues = []; var ageToValues = []; @@ -1207,9 +1210,9 @@ return false; } }else if($('#grid')[0].value === '7'){ - var si = $('input[name="si[]"]'); - var ageFrom = $('input[name="age_from[]"]'); - var ageTo = $('input[name="age_to[]"]'); + var si = $('input[name="7_si[]"]'); + var ageFrom = $('input[name="7_age_from[]"]'); + var ageTo = $('input[name="7_age_to[]"]'); var si_array = []; var ageFrom_array = []; @@ -1244,9 +1247,9 @@ return false; } }else if($('#grid')[0].value === '10'){ - var si = $('input[name="si[]"]'); - var ageFrom = $('input[name="age_from[]"]'); - var ageTo = $('input[name="age_to[]"]'); + var si = $('input[name="10_si[]"]'); + var ageFrom = $('input[name="10_age_from[]"]'); + var ageTo = $('input[name="10_age_to[]"]'); var si_array = []; var ageFrom_array = []; @@ -1282,8 +1285,8 @@ return false; } }else if($('#grid')[0].value === '8'){ - var siInputs = $('input[name="si[]"]'); - var gradeInputs = $('input[name="grade[]"]'); + var siInputs = $('input[name="8_si[]"]'); + var gradeInputs = $('input[name="8_grade[]"]'); var siValues = []; var gradeValues = []; @@ -1314,8 +1317,8 @@ return false; } }else if($('#grid')[0].value === '9'){ - var siInputs = $('input[name="si[]"]'); - var gradeInputs = $('input[name="grade[]"]'); + var siInputs = $('input[name="9_si[]"]'); + var gradeInputs = $('input[name="9_grade[]"]'); var siValues = []; var gradeValues = []; @@ -1346,9 +1349,9 @@ return false; } }else if ($('#grid')[0].value === '11') { - var siInputs = $('input[name="si[]"]'); - var gradeInputs = $('input[name="grade[]"]'); - var maxSiInputs = $('input[name="max_si[]"]'); + var siInputs = $('input[name="11_si[]"]'); + var gradeInputs = $('input[name="11_grade[]"]'); + var maxSiInputs = $('input[name="11_max_si[]"]'); var siValues = []; var gradeValues = []; @@ -1393,47 +1396,46 @@ { var multi = $('#basic_multiplier')[0].value.replace(/,/g, '') * input.value.replace(/,/g, ''); - $('#basic_gpa_si').val(multi).trigger('keyup'); + $('#gpa_basic_si').val(multi).trigger('keyup'); - var multi_2 = $('#basic_gpa_si')[0].value.replace(/,/g, '') * $('#premium_multiplier')[0].value.replace(/,/g, ''); + var multi_2 = $('#gpa_basic_si')[0].value.replace(/,/g, '') * $('#premium_multiplier')[0].value.replace(/,/g, ''); - $('#basic_gpa_premium').val(multi_2).trigger('keyup'); + $('#gpa_basic_premium').val(multi_2).trigger('keyup'); }else if(input.id == 'basic_multiplier') { var multi =input.value * $('#basic_pay')[0].value.replace(/,/g, ''); - $('#basic_gpa_si').val(multi).trigger('keyup'); + $('#gpa_basic_si').val(multi).trigger('keyup'); - var multi_2 = $('#basic_gpa_si')[0].value.replace(/,/g, '') * $('#premium_multiplier')[0].value.replace(/,/g, ''); + var multi_2 = $('#gpa_basic_si')[0].value.replace(/,/g, '') * $('#premium_multiplier')[0].value.replace(/,/g, ''); - $('#basic_gpa_premium').val(multi_2).trigger('keyup'); + $('#gpa_basic_premium').val(multi_2).trigger('keyup'); }else if(input.id == 'premium_multiplier') { - var multi = input.value.replace(/,/g, '') * $('#basic_gpa_si')[0].value.replace(/,/g, ''); + var multi = input.value.replace(/,/g, '') * $('#gpa_basic_si')[0].value.replace(/,/g, ''); - $('#basic_gpa_premium').val(multi).trigger('keyup'); - }else if(input.id == 'basic_gpa_si') + $('#gpa_basic_premium').val(multi).trigger('keyup'); + }else if(input.id == 'gpa_basic_si') { var multi = input.value.replace(/,/g, '') * $('#premium_multiplier')[0].value.replace(/,/g, ''); - $('#basic_gpa_premium').val(multi).trigger('keyup'); + $('#gpa_basic_premium').val(multi).trigger('keyup'); } } function gpaSumInsureMultiplier() { - - var element = $('#multiplier')[0]; - var sumInsured = $('input[name="si[]"]'); + var element = $('#gpa_sum_multiplier')[0]; + var sumInsured = $('input[name="gpa_sum_si[]"]'); if ($('#si_or_bp').val() == 2) { var premium = $('input[name="premium[]"]'); } else { - var premium = $('input[name="sum_premium[]"]'); + var premium = $('input[name="gpa_sum_premium[]"]'); } sumInsured.each(function(index) { @@ -1460,15 +1462,15 @@ $('#si_or_bp_sum_insure').css({'display':'none'}); $('#si_or_bp_basic_pay').css({'display':''}); - $('#multiplier').removeAttr('required'); - $('#gpa_si').removeAttr('required'); - $('#gpa_premium').removeAttr('required'); + $('#gpa_sum_multiplier').removeAttr('required'); + $('#gpa_sum_si').removeAttr('required'); + $('#gpa_sum_premium').removeAttr('required'); $('#basic_multiplier').attr('required', true); $('#premium_multiplier').attr('required', true); $('#basic_pay').attr('required', true); - $('#basic_gpa_si').attr('required', true); - $('#basic_gpa_premium').attr('required', true); + $('#gpa_basic_si').attr('required', true); + $('#gpa_basic_premium').attr('required', true); var gridContentInput = $('#grid_content_input'); @@ -1487,13 +1489,13 @@ $('#basic_multiplier').removeAttr('required'); $('#premium_multiplier').removeAttr('required'); $('#basic_pay').removeAttr('required'); - $('#basic_gpa_si').removeAttr('required'); - $('#basic_gpa_premium').removeAttr('required'); + $('#gpa_basic_si').removeAttr('required'); + $('#gpa_basic_premium').removeAttr('required'); - $('#multiplier').attr('required', true); - $('#gpa_si').attr('required', true); - $('#gpa_premium').attr('required', true); + $('#gpa_sum_multiplier').attr('required', true); + $('#gpa_sum_si').attr('required', true); + $('#gpa_sum_premium').attr('required', true); var gridContentInput = $('#grid_content_input'); @@ -1510,52 +1512,4 @@ } - - - // $("#gpa_si").on("keyup", function() { - // var inputNumber = $(this).val(); - // if (inputNumber) { - // var result = convertCommaNumberToWords(inputNumber); - // $("#gpa_si_number_word").text(result); - // } else { - // $("#gpa_si_number_word").text(""); - // } - - - // }); - - // $("#basic_gpa_premium").on("keyup", function() { - // var inputNumber = $(this).val(); - // if (inputNumber) { - // var result = convertCommaNumberToWords(inputNumber); - // $("#gpa_premium_number_word").text(result); - // } else { - // $("#gpa_premium_number_word").text(""); - // } - // }); - - - // $("#sum_insured").on("keyup", function() { - // var inputNumber = $(this).val(); - // if (inputNumber) { - // var result = convertCommaNumberToWords(inputNumber); - // $("#sum_insured_number_word").text(result); - // } else { - // $("#sum_insured_number_word").text(""); - // } - // }); - - - // $("#premium").on("keyup", function() { - // var inputNumber = $(this).val(); - // if (inputNumber) { - // var result = convertCommaNumberToWords(inputNumber); - // $("#premium_number_word").text(result); - // } else { - // $("#premium_number_word").text(""); - // } - // }); - - - \ No newline at end of file diff --git a/composer.json b/composer.json index d49707b4..12d029a0 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ "firebase/php-jwt": "^6.10", "google/apiclient": "^2.15.0", "laminas/laminas-escaper": "^2.9", + "phpmailer/phpmailer": "^6.9", "phpoffice/phpspreadsheet": "^2.0", "psr/log": "^1.1", "slim/slim": "^4.13" From d43e2ca101b31f64440cfb09ff9cf8055ee945a4 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Mon, 18 Mar 2024 19:45:05 +0530 Subject: [PATCH 12/32] GWM --- app/Config/Routes.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 2c879a72..74688631 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -212,11 +212,12 @@ $routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/ $routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile"); -$routes->post("/employeeUpload", "EmployeeRestController::employeeUpload"); -$routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence"); + + $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ + $routes->post("employeeUpload", "EmployeeRestController::employeeUpload"); $routes->get("relationshipList", "EmployeeRestController::relationshipList"); $routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence"); $routes->post("editEmployeeAndDependence", "EmployeeRestController::editEmployeeAndDependence"); From 62eec1f44c3caf44bae0c82425a45d4f5758b501 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Mon, 18 Mar 2024 20:09:46 +0530 Subject: [PATCH 13/32] GWM:CHANGE-IN-REST-API --- app/Config/Routes.php | 1 + app/Controllers/EmployeeRestController.php | 24 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 74688631..45cf2568 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -227,6 +227,7 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ $routes->post("createOrUpdateEmployeePolicySiAmount", "EmployeeRestController::createOrUpdateEmployeePolicySiAmount"); $routes->get("deleteDependence", "EmployeeRestController::deleteDependence"); $routes->get("getEmployeeAndDependenceByClientId", "EmployeeRestController::getEmployeeAndDependenceByClientId"); + $routes->get("getClientPolicy", "EmployeeRestController::getClientPolicy"); }); $routes->post("sendEmail", "EmployeeRestController::send_email"); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 0f9e82f1..44a17c02 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -52,7 +52,7 @@ class EmployeeRestController extends AdminController $this->policesModel = new PolicesModel(); $this->relationshipModel = new RelationshipModel(); $this->fileModel= new FileModel(); - $this->clientPolicyModel= new ClientPolicyModel(); + $this->clientPolicyModel = new ClientPolicyModel(); } @@ -245,6 +245,28 @@ class EmployeeRestController extends AdminController } + public function getClientPolicy() + { + try { + $ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id,, policies.id as policy_id, policies.name as policy_name') + ->join('policies', 'client_policy.policy_id = policies.id', 'left') + ->where('client_policy.client_id', $this->request->getGet('client_id') ) + ->findAll(); + + // You probably meant to check $result, not $data + if ($ClientPolicyData) { + return $this->respond(['status' => 'success', 'code' => 200, 'data' => $ClientPolicyData], 200); + } else { + return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404); + } + + + } catch (\Exception $e) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); + } + + } + public function getEmployeePolicy() { From f99c0ca5e2a14f25594990780f21a74077ecc953 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Tue, 19 Mar 2024 11:39:08 +0530 Subject: [PATCH 14/32] CHANGES-in-restApi:GWM --- app/Config/Routes.php | 2 +- app/Controllers/EmployeeRestController.php | 35 +++++++++---------- .../RestAuthenticationController.php | 2 +- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 45cf2568..cce60574 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -213,7 +213,7 @@ $routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfi - +$routes->get("getClientPolicy", "EmployeeRestController::getClientPolicy"); $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 44a17c02..139d39cd 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -211,29 +211,28 @@ class EmployeeRestController extends AdminController public function getEmployeeAndDependenceByClientId() { try { - $empData = $this->employeeModel - ->where('client_id', $this->request->getGet('client_id')) - ->where('relationship', 'self') - ->orderBy('id') - ->findAll(); + + $empData = $this->employeeModel->where('client_id', $this->request->getGet('client_id')) + ->where('relationship !=', null) + ->orderBy('emp_code')->orderBy('id')->findAll(); - $result = []; + // $result = []; - foreach ($empData as $employee) { - $employeeDependence = $this->employeeModel - ->where('emp_code', $employee['emp_code']) - ->where('relationship !=', 'self') - ->findAll(); + // foreach ($empData as $employee) { + // $employeeDependence = $this->employeeModel + // ->where('emp_code', $employee['emp_code']) + // ->where('relationship !=', 'self') + // ->findAll(); - // Use object notation to access properties and set 'dependence' - $employee['dependence'] = $employeeDependence ?: []; + // // Use object notation to access properties and set 'dependence' + // $employee['dependence'] = $employeeDependence ?: []; - $result[] = $employee; - } + // $result[] = $employee; + // } // You probably meant to check $result, not $data - if ($result) { - return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200); + if ($empData) { + return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200); } else { return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404); } @@ -248,7 +247,7 @@ class EmployeeRestController extends AdminController public function getClientPolicy() { try { - $ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id,, policies.id as policy_id, policies.name as policy_name') + $ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, policies.id as policy_id,policies.policy_type_id as policy_type_id, policies.name as policy_name') ->join('policies', 'client_policy.policy_id = policies.id', 'left') ->where('client_policy.client_id', $this->request->getGet('client_id') ) ->findAll(); diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index 721e71a9..d3a3c111 100644 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -176,7 +176,7 @@ class RestAuthenticationController extends AdminController ->where('level_contacts.mobile', $mobile_number ) ->find(); - $result = JWTToken::encode($hrData); + $result = JWTToken::encode($hrData['0']); return $this->respond(['status' => 'success','code' => 200,'data' => $result],200); } else { return $this->respond(['status' => 'failed','code' => 404,'data' => "No data"],404); From 5dfaba9c28c3f05e1d579d1b720b9cfc0ba424b8 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Tue, 19 Mar 2024 11:39:18 +0530 Subject: [PATCH 15/32] CHANGE_EMPLOYEE_REST_CONTROLLER_FILE_UPLOAD_LOG : AADHAVAN --- app/Config/Email.php | 12 +++++++++++- app/Controllers/EmployeeRestController.php | 7 ++----- app/Helpers/MailHelper.php | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/Config/Email.php b/app/Config/Email.php index b6ac8865..f7e3ae01 100644 --- a/app/Config/Email.php +++ b/app/Config/Email.php @@ -48,7 +48,7 @@ class Email extends BaseConfig /** * SMTP Timeout (in seconds) */ - public int $SMTPTimeout = 5; + public int $SMTPTimeout = 1000; /** * Enable persistent SMTP connections @@ -118,4 +118,14 @@ class Email extends BaseConfig * Enable notify message from server */ public bool $DSN = false; + + + + /** + * SMTP Debugging level. Set to 0 to disable debugging. + * Set to 1 to output server connection status only. + * Set to 2 for more detailed debugging output. + * Set to 3 for maximum debugging output. + */ + public int $SMTPDebug = 2; } diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 0f9e82f1..60823e71 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -512,12 +512,9 @@ class EmployeeRestController extends AdminController $subject = 'Welcome, Employee Benefit Program Enrolment'; $message = 'Dear ' . $dataToInsert[$a]['name'] . ",
We are glad to welcome you to the employee benefit program ," .$policy_name['name'] ."offered by your employer,


Click on the link below to review your personal and family details:
Review Details" ; $return_log = MailHelper::send_email($mail,$subject, $message); - - // $a = json_decode( $return_log); - - // print_r($a);die; - // $this->myLogger->logme($return_log,''); + $return_log = json_decode($return_log); + $this->myLogger->logme('info', "Email Status : {mail_status}, Sender Email:{email}", ['mail_status' => $return_log->status, 'email'=> $return_log->data]); } } diff --git a/app/Helpers/MailHelper.php b/app/Helpers/MailHelper.php index 6da40441..fd56e4f5 100644 --- a/app/Helpers/MailHelper.php +++ b/app/Helpers/MailHelper.php @@ -30,7 +30,7 @@ class MailHelper } } catch (Exception $e) { - return json_encode(['status' => 'failed','code' => 500,'data' => $e],500); + return json_encode(['status' => 'failed','code' => 500,'data' => $emaill],500); } } From 39374c0b4b9f90bc76c02cf57ffc2dfe4d6c3a09 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Tue, 19 Mar 2024 19:57:20 +0530 Subject: [PATCH 16/32] CHANGES-IN-GETPOLICYAPI:GWM --- app/Config/Routes.php | 2 +- app/Controllers/EmployeeRestController.php | 70 ++++++++++++------- .../RestAuthenticationController.php | 3 +- 3 files changed, 46 insertions(+), 29 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index cce60574..45cf2568 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -213,7 +213,7 @@ $routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfi -$routes->get("getClientPolicy", "EmployeeRestController::getClientPolicy"); + $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 36eddb23..1d9d8088 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -193,6 +193,8 @@ class EmployeeRestController extends AdminController public function deleteDependence() { try { + if($this->request->getGet('id')) + { $delete = $this->employeeModel->where('id', $this->request->getGet('id'))->delete(); if ($delete) { @@ -200,6 +202,10 @@ class EmployeeRestController extends AdminController } else { return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404); } + }else{ + return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404); + } + } catch (\Exception $e) { return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); @@ -211,31 +217,15 @@ class EmployeeRestController extends AdminController public function getEmployeeAndDependenceByClientId() { try { - - $empData = $this->employeeModel->where('client_id', $this->request->getGet('client_id')) - ->where('relationship !=', null) - ->orderBy('emp_code')->orderBy('id')->findAll(); - - // $result = []; - - // foreach ($empData as $employee) { - // $employeeDependence = $this->employeeModel - // ->where('emp_code', $employee['emp_code']) - // ->where('relationship !=', 'self') - // ->findAll(); - - // // Use object notation to access properties and set 'dependence' - // $employee['dependence'] = $employeeDependence ?: []; - - // $result[] = $employee; - // } - - // You probably meant to check $result, not $data - if ($empData) { - return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200); - } else { - return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404); - } + $empData = $this->employeePolicyModel->getEmployeePolicy( $this->request->getGet('client_id'), $this->request->getGet('client_policy_id')); + // $empData = $this->employeeModel->where('client_id', $this->request->getGet('client_id')) + // ->where('relationship !=', null) + + if ($empData) { + return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200); + } else { + return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404); + } } catch (\Exception $e) { @@ -251,10 +241,12 @@ class EmployeeRestController extends AdminController ->join('policies', 'client_policy.policy_id = policies.id', 'left') ->where('client_policy.client_id', $this->request->getGet('client_id') ) ->findAll(); - + + $result[] = $ClientPolicyData[0]; + $result[] = $ClientPolicyData[2]; // You probably meant to check $result, not $data if ($ClientPolicyData) { - return $this->respond(['status' => 'success', 'code' => 200, 'data' => $ClientPolicyData], 200); + return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200); } else { return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404); } @@ -271,9 +263,12 @@ class EmployeeRestController extends AdminController { try { $id = $this->request->getGet('id'); + $emp_code = $this->request->getGet('emp_code'); + $keysToRemove = ["removable_keys"]; $empPolicy = $this->employeeModel->getEmployeePolicy($id); + $empData = $this->employeeModel->where('emp_code',$emp_code)->findAll(); // dd($empPolicy); if ($empPolicy) { @@ -320,6 +315,27 @@ class EmployeeRestController extends AdminController array_splice($array->SlabRates, $index, 1); array_unshift($array->SlabRates, $element); } + + //map family floates array to employee and dependent + $familyFloates = $array->Policy_Terms->family_floaters; + $data = []; + foreach ($familyFloates as $familyFloatesValue) { + $dependent = preg_replace('/\d/', '', $familyFloatesValue); + if(count($empData)){ + foreach ($empData as $key => $value) { + if ($value['family_floater_key'] === $dependent) { + $temp['family_floater_key'] = $familyFloatesValue; + $temp['label'] = $value['relationship']; + $temp['name'] = $value['name']; + array_push($data,$temp); + unset($empData[$key]); + break; + } + } + } + } + $array->mapped_family_floaters = $data; + } $result[] = $array; diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index d3a3c111..61ef2ff6 100644 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -70,6 +70,7 @@ class RestAuthenticationController extends AdminController try { $mobile_number = $this->request->getJSON()->mobile_number; $randomNumber = rand(100000, 999999); + $randomNumber = 123456; $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first(); @@ -129,7 +130,7 @@ class RestAuthenticationController extends AdminController try { $mobile_number = $this->request->getJSON()->mobile_number; $randomNumber = rand(100000, 999999); - + $randomNumber = 123456; $HrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->first(); if ($HrData) { From 2f96dd8d472d632ad6763c171237b9e5ce98af23 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Tue, 19 Mar 2024 20:08:34 +0530 Subject: [PATCH 17/32] MODEL_FILE : AADHAVAN --- app/Models/EmployeeModel.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index 52382dc1..41c42a52 100644 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -24,6 +24,7 @@ class EmployeeModel extends Model "gender", "dob", "otp", + "family_floater_key", "emp_status", "created_by", "updated_by", From bcb83b85bf1367401bab8933132c0c11090783d1 Mon Sep 17 00:00:00 2001 From: bitbucket Date: Tue, 19 Mar 2024 21:45:04 +0530 Subject: [PATCH 18/32] GWM:CHANGES-IN-EMP-POLICY-API --- app/Controllers/EmployeeModel.php | 57 ++++++++++++++++++++++ app/Controllers/EmployeeRestController.php | 14 ++++++ 2 files changed, 71 insertions(+) create mode 100644 app/Controllers/EmployeeModel.php diff --git a/app/Controllers/EmployeeModel.php b/app/Controllers/EmployeeModel.php new file mode 100644 index 00000000..52382dc1 --- /dev/null +++ b/app/Controllers/EmployeeModel.php @@ -0,0 +1,57 @@ +db->table('employee_polices') + ->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment') // Select all columns from both tables + ->join('client_policy', 'client_policy.id = employee_polices.client_policy_id') + ->join('policies', 'policies.id = client_policy.policy_id') + ->where('employee_polices.employee_id', $id) + ->get() + ->getResult(); + } + + + + + // for EMP rest API process do not change + public function checkExistingEmpEntrollment($arr) + { + return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->first(); + } + +} diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 1d9d8088..cdeca663 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -161,12 +161,14 @@ class EmployeeRestController extends AdminController if (isset($item->id)) { //update old data $id = $item->id; + $item->family_floater_key = $this->RelationshipMap($item->relationship); $employee = $this->employeeModel->update($id, (array)$item); if ($employee) { $Count++; } }else{ //create new data + $item->family_floater_key = $this->RelationshipMap($item->relationship); $employee = $this->employeeModel->insert($item); if ($employee) { $Count++; @@ -190,6 +192,18 @@ class EmployeeRestController extends AdminController } + public function RelationshipMap($value){ + + if ($value === 'Mother' || $value === 'Father') { + return 'parent'; + } else if($value === 'Son' || $value === 'Daughter'){ + return 'child'; + }else if($value === 'Father in Law' || $value === 'Mother in Law'){ + return 'parent_in_law'; + }else if($value === 'Spouse'){ + return 'spouse'; + } + } public function deleteDependence() { try { From 32ba40df89a407b504a69a1eb74243ca1544fb3e Mon Sep 17 00:00:00 2001 From: bitbucket Date: Tue, 19 Mar 2024 23:48:21 +0530 Subject: [PATCH 19/32] CHANGES-INDATE-CONVERTION:GWM --- app/Controllers/EmployeeRestController.php | 44 ++++++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index cdeca663..4c543e4a 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -105,14 +105,20 @@ class EmployeeRestController extends AdminController try { $emp_code = $this->request->getGet('emp_code'); if ($emp_code) { - $employee = $this->employeeModel->where('emp_code', $emp_code) - ->findAll(); - - $result = $employee; - return $this->respond(['status' => 'success','code' => 200,'data' => $result],200); + $employee = $this->employeeModel->where('emp_code', $emp_code)->findAll(); + $dateConverter = function($item) { + if ($item['dob'] !== '0000-00-00') { + $dateTime = \DateTime::createFromFormat('Y-m-d', $item['dob']); + $item['dob'] = $dateTime->format('d-m-Y'); + } + return $item; + }; + $employee = array_map($dateConverter, $employee); + return $this->respond(['status' => 'success','code' => 200,'data' => $employee],200); + } else { - $result = "No Match's"; - return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404); + + return $this->respond(['status' => 'failed','code' => 404,'data' => []],404); } } catch (\Throwable $th) { return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); @@ -129,6 +135,7 @@ class EmployeeRestController extends AdminController $updatedCount = 0; foreach ($data as $item) { $id = $item->id; + $item->dob = $this->convertDateFormat($item->dob); $employee = $this->employeeModel->update($id, (array)$item); if ($employee) { $updatedCount++; @@ -162,6 +169,7 @@ class EmployeeRestController extends AdminController //update old data $id = $item->id; $item->family_floater_key = $this->RelationshipMap($item->relationship); + $item->dob = $this->convertDateFormat($item->dob); $employee = $this->employeeModel->update($id, (array)$item); if ($employee) { $Count++; @@ -169,6 +177,7 @@ class EmployeeRestController extends AdminController }else{ //create new data $item->family_floater_key = $this->RelationshipMap($item->relationship); + $item->dob = $this->convertDateFormat($item->dob); $employee = $this->employeeModel->insert($item); if ($employee) { $Count++; @@ -204,6 +213,21 @@ class EmployeeRestController extends AdminController return 'spouse'; } } + + private function convertDateFormat($dateString) + { + // Attempt to create a DateTime object from the provided date string + $dateTime = \DateTime::createFromFormat('d-m-Y', $dateString); + + // Check if the conversion was successful and the date string is in the format dd-mm-yyyy + if ($dateTime instanceof \DateTime) { + // Format the date to yyyy-mm-dd + return $dateTime->format('Y-m-d'); + } else { + // If the date string is not in the format dd-mm-yyyy, return null + return null; + } + } public function deleteDependence() { try { @@ -283,7 +307,6 @@ class EmployeeRestController extends AdminController $empPolicy = $this->employeeModel->getEmployeePolicy($id); $empData = $this->employeeModel->where('emp_code',$emp_code)->findAll(); - // dd($empPolicy); if ($empPolicy) { $result = []; @@ -338,9 +361,14 @@ class EmployeeRestController extends AdminController if(count($empData)){ foreach ($empData as $key => $value) { if ($value['family_floater_key'] === $dependent) { + $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->get()->getRow(); $temp['family_floater_key'] = $familyFloatesValue; $temp['label'] = $value['relationship']; $temp['name'] = $value['name']; + $temp['employee_id'] = $value['id']; + $temp['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null; + $temp['client_policy_id'] = $array->ClientPolicyId; + array_push($data,$temp); unset($empData[$key]); break; From e09b7199b8cd5b32804ec24d3a6a0df7e5765b29 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Tue, 19 Mar 2024 23:51:24 +0530 Subject: [PATCH 20/32] CHANGE_EMPLOYEE_REST_FILE_UPLOAD_MAIL : AADHAVAN --- app/Config/Filters.php | 2 +- app/Config/Routes.php | 6 +- app/Controllers/EmployeeRestController.php | 143 +++++++++++++++------ app/Controllers/Home.php | 2 +- app/Controllers/JobWorker.php | 38 +++++- app/Helpers/MailHelper.php | 15 +-- app/Models/EmployeeModel.php | 1 + app/Views/mail_welcome.php | 23 ++++ composer.json | 1 + public/assets/images/Nhance-Logo-Final.png | Bin 0 -> 4069 bytes 10 files changed, 173 insertions(+), 58 deletions(-) create mode 100644 app/Views/mail_welcome.php create mode 100644 public/assets/images/Nhance-Logo-Final.png diff --git a/app/Config/Filters.php b/app/Config/Filters.php index 4f16d072..40324597 100644 --- a/app/Config/Filters.php +++ b/app/Config/Filters.php @@ -44,7 +44,7 @@ class Filters extends BaseConfig */ public array $globals = [ 'before' => [ - 'HttpRequestLog' => ['except' => 'processjob'], + 'HttpRequestLog' => ['except' => 'cli/*'], // 'csrf', // 'invalidchars', ], diff --git a/app/Config/Routes.php b/app/Config/Routes.php index cce60574..ed5af8ac 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -6,7 +6,7 @@ use CodeIgniter\Router\RouteCollection; * @var RouteCollection $routes */ // $routes->get('/', 'LoginController::index'); -$routes->get('/test', 'Home::test'); +$routes->get('/test', 'Home::index'); $routes->get('/login', 'LoginController::index');///auth/google $routes->get('/logout', 'LoginController::logout'); $routes->get('/oauth2callback', 'LoginController::receiveGoogleOAuthResponse'); @@ -191,7 +191,8 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){ $routes->post("import-export", "EmployeeController::importExport"); }); -$routes->cli('processjob', 'JobWorker::processJob'); +$routes->cli('cli/processjob', 'JobWorker::processJob'); +$routes->cli('cli/processjobs', 'JobWorker::processJobs'); @@ -215,6 +216,7 @@ $routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfi $routes->get("getClientPolicy", "EmployeeRestController::getClientPolicy"); +$routes->post("employeeUpload", "EmployeeRestController::employeeUpload"); $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ $routes->post("employeeUpload", "EmployeeRestController::employeeUpload"); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 36eddb23..e46b0f93 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -18,6 +18,9 @@ use App\Models\RelationshipModel; use App\Models\FileModel; use App\Models\ClientPolicyModel; +use App\Controllers\Jobs ; +use App\Controllers\JobWorker ; + use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; @@ -411,26 +414,31 @@ class EmployeeRestController extends AdminController $highestRow = $sheet->getHighestRow(); $highestColumn = $sheet->getHighestColumn(); - $data = []; + $highestRowAndColumn = $sheet->getHighestRowAndColumn(); + $data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']); + // print_r($excel_data);die(); + // $data = []; + // $data[] =$excel_data; + // print_r($data);die; // Iterate through each row - for ($row = 1; $row <= $highestRow; $row++) { - // Initialize the row data array - $rowData = []; + // for ($row = 1; $row <= $highestRow; $row++) { + // // Initialize the row data array + // $rowData = []; - // Iterate through each column in the row - for ($col = 'A'; $col <= $highestColumn; $col++) { - // Get the cell value - $value = $sheet->getCell($col . $row)->getValue(); - - // Add the cell value to the row data array - $rowData[] = $value; - } - - // Add the row data to the main data array - $data[] = $rowData; - } + // // Iterate through each column in the row + // for ($col = 'A'; $col <= $highestColumn; $col++) { + // // Get the cell value + // $value = $sheet->getCell($col . $row)->getValue(); + // // print_r($value); + // // Add the cell value to the row data array + // $rowData[] = $value; + // } + // // Add the row data to the main data array + // $data[] = $rowData; + // } + // print_r($data);die; $extractData['file_name']= $filename; $extractData['client_id']= $client_id; @@ -442,6 +450,10 @@ class EmployeeRestController extends AdminController $file_data =$this->fileModel->insert($extractData); $extra = []; + //this change the column name into index number + for ($i = 0; $i < count($data[0]); $i++) { + $data[0][$i] = $i; + } for ($i = 0; $i < count($data); $i++) { if ($i == 0) { // Loop through the first row to extract keys @@ -462,27 +474,64 @@ class EmployeeRestController extends AdminController // print_r("Extra", $extra);die; $dataToInsert = []; $basic_cover_si= []; - foreach ($extra['id'] as $index => $id) { - $record = [ - // 'id' => $id, - 'emp_code' => isset($extra['emp_code'][$index]) ? $extra['emp_code'][$index] : 0, - 'name' => $extra['name'][$index], - // Check if the 'doj' key exists before accessing it - 'doj' => isset($extra['doj'][$index]) ? $extra['doj'][$index] : null, - 'gender' => $extra['gender'][$index], - 'relationship' => $extra['relationship'][$index], - 'dob' => $extra['dob'][$index], - 'email_personal' => $extra['Email'][$index], - 'client_id' => $client_id, - ]; - $record2 = [ - 'basic_cover_si' => isset($extra['sum_insure'][$index]) ? $extra['sum_insure'][$index] : 0, - ]; + // print_r($extra);die; + foreach ($extra['0'] as $index => $id) { + $relation =''; + if ($extra['5'][$index] === 'Mother' || $extra['5'][$index] === 'Father') { + $relation = 'parent'; + } else if($extra['5'][$index] === 'Son' || $extra['5'][$index] === 'Daughter'){ + $relation = 'child'; + }else if($extra['5'][$index] === 'Father in Law' || $extra['5'][$index] === 'Mother in Law'){ + $relation = 'parent_in_law'; + }else if($extra['5'][$index] === 'Spouse'){ + $relation = 'spouse'; + }else{ + $relation = 'self'; + } + + // Simplified formatDate function - $dataToInsert[] = $record; - $basic_cover_si[]= $record2; + + // Assigning formatted dates + // print_r($extra['3']);die; + $doj = $extra['3'][$index] ; + $dob = $extra['6'][$index] ; + + + // Change date format for $doj + $doj_new_format = date('Y-m-d', strtotime($doj)); // $doj_new_format will be "2001-02-12" + + // Change date format for $dob + $dob_new_format = date('Y-m-d', strtotime($dob)); + + // Your existing code here + + $emp_code =isset($extra['1'][$index]) ? $extra['1'][$index] : 0; + $name = $extra['2'][$index]; + + if($emp_code != 0 && $name != '' || $name != null){ + $record = [ + // 'id' => $id, + 'emp_code' => $emp_code, + 'name' => $name, + // Check if the 'doj' key exists before accessing it + 'doj' => $doj_new_format, + 'gender' => $extra['4'][$index], + 'relationship' => $extra['5'][$index], + 'family_floater_key' => $relation, + 'dob' => $dob_new_format, + 'email_corporate' => $extra['7'][$index], + 'mobile'=> $extra['8'][$index], + 'client_id' => $client_id, + + ]; + $record2 = [ + 'basic_cover_si' => isset($extra['9'][$index]) ? $extra['9'][$index] : 0, + ]; + $dataToInsert[] = $record; + $basic_cover_si[]= $record2; + } } - // print_r("dataToInsert", $dataToInsert);die; for ($a=0; $a employeeModel->checkExistingEmpEntrollment($dataToInsert[$a]); @@ -496,6 +545,7 @@ class EmployeeRestController extends AdminController $this->myLogger->logme('error',('Update - ' . $employee['id'].' - '. $employee['emp_code'] .' - '.$employee['name'])); } }else{ + $result = $this->employeeModel->insert($dataToInsert[$a]); $emp_id =$result; if ($result) { @@ -529,13 +579,24 @@ class EmployeeRestController extends AdminController // print_r($dataToInsert[$a]['email_personal']);die; $policy = $this->clientPolicyModel->where('id', $policy_id)->first(); $policy_name = $this->policesModel->where('id', $policy['policy_id'])->first(); - $mail = $dataToInsert[$a]['email_personal']; + $mail = $dataToInsert[$a]['email_corporate']; $subject = 'Welcome, Employee Benefit Program Enrolment'; - $message = 'Dear ' . $dataToInsert[$a]['name'] . ",
We are glad to welcome you to the employee benefit program ," .$policy_name['name'] ."offered by your employer,


Click on the link below to review your personal and family details:
Review Details" ; - $return_log = MailHelper::send_email($mail,$subject, $message); - $return_log = json_decode($return_log); - - $this->myLogger->logme('info', "Email Status : {mail_status}, Sender Email:{email}", ['mail_status' => $return_log->status, 'email'=> $return_log->data]); + // $message = 'Dear ' . $dataToInsert[$a]['name'] . ",
We are glad to welcome you to the employee benefit program ," .$policy_name['name'] ."offered by your employer,


Click on the link below to review your personal and family details:
Review Details" ; + $data['employee_name']=$dataToInsert[$a]['name']; + $data['policy_name']=$policy_name['name']; + + $message = view('mail_welcome', $data); + if ($dataToInsert[$a]['email_corporate'] != null || $dataToInsert[$a]['email_corporate'] != '' && $dataToInsert[$a]['relationship'] == 'Self') { + $job_details = new Jobs(); + $r = Jobs::addJob(['job_name' => 'send_email','payload' => ['mail' => $mail, 'subject' => $subject,'message'=> $message]]); + } + + // print_r($r);//die(); + // $jobWorker = new JobWorker(); + //JobWorker::processJob($r); + // $return_log = MailHelper::send_email($mail,$subject, $message); + // $return_log = json_decode($return_log); + // $this->myLogger->logme('info', "Email Status : {mail_status}, Sender Email:{email}", ['mail_status' => $return_log->status, 'email'=> $return_log->data]); } } diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 9280fa95..9f76bf77 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -6,7 +6,7 @@ class Home extends PublicController { public function index(): string { - return view('welcome_message'); + return view('mail_welcome'); } public function test() diff --git a/app/Controllers/JobWorker.php b/app/Controllers/JobWorker.php index f3a2ab2a..964d365a 100644 --- a/app/Controllers/JobWorker.php +++ b/app/Controllers/JobWorker.php @@ -14,7 +14,7 @@ class JobWorker extends AdminController * Constructs the class */ - private static $event_class_mapping = ['add' => ['type' => 'HC','handler' => 'App\\Helpers\\HttpRequestHelper'], 'sub' => ['type' => 'CC','handler' => 'App\\Controllers\\Jobs\SubJob'],'fancy_date_time_format' => [ 'type' => 'HF','handler' => 'fancy_date_time_format'],'addNumber' => ['type' => 'HC','handler' => 'App\\Model\\HttpRequestHelper'],'excelFileFormatValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'excelFileDataValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeeOnboard' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController']]; + private static $event_class_mapping = ['add' => ['type' => 'HC','handler' => 'App\\Helpers\\HttpRequestHelper'], 'sub' => ['type' => 'CC','handler' => 'App\\Controllers\\Jobs\SubJob'],'fancy_date_time_format' => [ 'type' => 'HF','handler' => 'fancy_date_time_format'],'addNumber' => ['type' => 'HC','handler' => 'App\\Model\\HttpRequestHelper'],'excelFileFormatValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'excelFileDataValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeeOnboard' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'send_email' => ['type' => 'HC','handler' => 'App\\Helpers\\MailHelper']]; public function __construct() { // echo 'HiC';//die(); @@ -27,12 +27,39 @@ class JobWorker extends AdminController // } } + public static function processJobs(array $jobdata = []) + { + // echo 'listen';//die(); + $query = " + SELECT id, name, payload, uuid + FROM jobs + WHERE status=? + ORDER BY created_dt ASC"; + $where_condition = [self::STATUS_QUEUED]; + $db = \Config\Database::connect(); + $jobs = $db->query($query, $where_condition)->getResult(); + + if(count($jobs)) + { + // echo count($jobs); + // print_r($jobs);die; + foreach($jobs as $key => $job) + { + // echo $job->id.' - '.$job->name; + //sleep(1); + + SELF::processjob(['id' => $job->id,'uuid' => $job->uuid]); + } + } + } /** * process jobs */ public static function processJob(array $jobdata = []) { - // echo 'listen';//die(); + // print_r($jobdata); + // echo 'listen'; + // die(); $query = " SELECT id, name, payload, uuid FROM jobs @@ -61,7 +88,9 @@ class JobWorker extends AdminController echo "\nProcessing job id - " . $job->id . "\n"; echo "Job name - " . $job->name . "\n"; - + // print_r(SELF::$event_class_mapping); + // echo array_key_exists($job->name,SELF::$event_class_mapping) ? 'mapped' : 'notmapped'; + // die(); try { $start = microtime(true); @@ -69,7 +98,7 @@ class JobWorker extends AdminController $job_status = self::STATUS_RUNNING; $db->query("UPDATE jobs SET status=? WHERE id=? AND uuid=?", [$job_status, $job->id,$job->uuid]); - if (!array_key_exists($job->name,SeLf::$event_class_mapping)) + if (!array_key_exists($job->name,SELF::$event_class_mapping)) { throw new \RuntimeException('Job ' . $job->name . ' handler not registered'); } @@ -145,6 +174,7 @@ class JobWorker extends AdminController // echo "Job $job->id $job_status. Response - $response \n"; echo "Job $job->id $job_status \n"; + return true; } else { diff --git a/app/Helpers/MailHelper.php b/app/Helpers/MailHelper.php index fd56e4f5..9709de46 100644 --- a/app/Helpers/MailHelper.php +++ b/app/Helpers/MailHelper.php @@ -12,11 +12,15 @@ use PHPMailer\PHPMailer\Exception; class MailHelper { - static function send_email($emaill, $subject, $message) + public static function send_email($params) { + $emaill = $params['mail']; + $subject = $params['subject']; + $message = $params['message']; try { $email = \Config\Services::email(); - $email->setFrom('bbone@venbait.in', 'Venkat'); + $email->setMailType('html'); + $email->setFrom('bbone@venbait.in', 'Nhance'); $email->setTo($emaill); @@ -33,12 +37,5 @@ class MailHelper return json_encode(['status' => 'failed','code' => 500,'data' => $emaill],500); } } - - - function logme($message, $email) { - // Your logging logic here - // For example, writing to a log file - file_put_contents('path/to/log/file.txt', $message . "\n", FILE_APPEND); - } } ?> \ No newline at end of file diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index 41c42a52..09eeb13d 100644 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -23,6 +23,7 @@ class EmployeeModel extends Model "mobile", "gender", "dob", + "doj", "otp", "family_floater_key", "emp_status", diff --git a/app/Views/mail_welcome.php b/app/Views/mail_welcome.php new file mode 100644 index 00000000..9ebdd64b --- /dev/null +++ b/app/Views/mail_welcome.php @@ -0,0 +1,23 @@ + + + + + + +
+ +
+
+ Dear, +

We are glad to welcome you to the employee benefit program, offered by your employer.

+
+ +
+
+ + + diff --git a/composer.json b/composer.json index 12d029a0..e0f50cfa 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ "firebase/php-jwt": "^6.10", "google/apiclient": "^2.15.0", "laminas/laminas-escaper": "^2.9", + "php-amqplib/php-amqplib": "^2.8", "phpmailer/phpmailer": "^6.9", "phpoffice/phpspreadsheet": "^2.0", "psr/log": "^1.1", diff --git a/public/assets/images/Nhance-Logo-Final.png b/public/assets/images/Nhance-Logo-Final.png new file mode 100644 index 0000000000000000000000000000000000000000..0d331b6844d5e4a205d94f90b8f999ba00b5041d GIT binary patch literal 4069 zcmVt`RVhW4sjMv=N^&GhPhjm62rg4e z+pW_GcJh5Gt*uPTB4*E-At{2yWo7{IBIEx)>{{f2I2g>Cb3XtmP@uqr0qg(kp!poY zckrY6f$x6;-rk3;Ef2&?ebiF2fbEros0f!{D-SDi<#oyC3cW@JG4J#(#-W)>`HjGq5LN^~#=+s%7}Do|h&u#`t~Sb{cx4G#ev=Hb?_LV*Gg4C)Lm;lROh z6CMIM{22-qcwp$N-0)8Q6jp`9<}MT{P+;nyE1@NXW2s>30tKcGlA#&gfG!HAE>K|V zAQ{^CT`+-Q>XWBXpg@7Cz?}H+U%xwt#>p8;o8JLtK!aIX4uhM;-s z;IUQnU>eY)aTpb(F@tBx0)I75PK}tFRCac^0_*EnV2Jmdk1vpc9M$n(Fj)NU!Ovd* zgZON>5b#sjd{*oK`Lel$+uOJJ`Kk!fMV?0Yij2*0BlFvDGR>fq*>0=&+uy{}FbJZB za}V$RJac*oM>sD&(gXeyUW5K^<26H4YrFFTf)+OyT82T)(Wdn((tT;Z?AY;QuHX%D zoU5&x3weV!WJYVMOCN( zsL0r5Ye!p+qXL(#=HwpPFpu15b~BzYT(g~8CMIL18*>24^EVo{+Q9|TVk_cD^da-U z8x0$#9&8mC{eET(mzdz-L@zy-#^=J!1XhJMztp0KHkT~t;Sa)Arsts9 z%x`n)!Zg$=%_3qJ8}foFZM4p5W2TKTcc2iWO)W-XMkkh#SJ0HH$)S^TF~=0cLG`~L zJA%xEyqO0E=t&AKiiIrf<@}*r?KTc(?m?HSiMCtFODabpRtt{L6idt0ZT|&)j$mvz zau*c~l#MqbheI{;JEDgc@>mfwKO;lM8d4jZ1!yiBubjkjy^V%*6JJwWM3yusr+)UB znj2)3ksWu?{7jj;9PXgAL|D)Ub$EFEfD5PAJ@)WfoZ+G4#dadKCF$WGFGTpJoP1r< zWQ4C{%wVNvqIPKknKCx$!Nnin2H$^z&f`USbXLS?`a(0*oSIWQm6-bF(F#~|7y1qp zR4osiH=kjb5XnTtUS_VW+9rEnNlE}dRF#OtC$adhLe6(!GH^tUJ1V>;CE%n|i*0E6 z#ANl*Z%HlJlgt=R>Fh;3OHX`Hn>LvuoaqQaY2Ix;tM@+WOX%zG|Frae`jTZp18w9Z%~( zY6-5H_C_@M(bCuQRp)AyE@BRndOdB%#ALMC^H3?RYoai|1Dk6rN@1~$XZu2W>tKk^ zzJxAW{(uU>sK3_|GWE*hV62yzx^cXN-|MSslBr=TCAG}ZITJbU?30ujehJk=3#Ej$ zYLq=EewR^er+e=w<4Fr26YWF`<~Bdgxc2JqKL~=82d)slLBZ)-dmzU=0191~Ze1wE65*dA!t0^zNJJY_;f~ z#IqPwx$U8$$khDudj0pc#iRe6_dnf20vpGmm&DP#xbSfPqP1Z2hX>GJfz8ll7-H^o zoanldr*&8rrd_(({JQ%9f*44~xvtvtR=HgFId|bVw{B>M(~)~fppEmd1AkKj5z}_) z$i$(rxuSLP^5_ambC;kBnx8PUgc3A>+n@uI#+xzgO03&g9*VByMw0#C9NLg2!>MiV zM9-EYGp9|MsZ{#&m*5m*^Cf1z{_pzZpt?+i(r#!1vJt|KZVFxBmF)^|r0)zlcG_AQLcYu1JGp{2X-9x*Mf~ z^4ay^4cd{BkZP|Bs^G)YoN}@=q=!HWDJ_0&%*?cL3~Y!>4GuV}SR+hLQkH(qhzQCW z3NrQY4&OfEfa>NrL8_x_nyO%GgZpJ=qgF@U8k`HZ>N7YUWNt_c-qCe#s`WJY;YZK{ znl+=)n=_`~F%~|uC&II=a#V)=6Yt+8;6>g8zfWXVp{4v zYS;QIApMwBzfBxo`*3vh(_n?x!r|NPcbktC4xXjBoTgSK@F74*F7Jb+B z6Zp(gqU%c*y{Yw!fiSwDHBDUzEfF{SinR~5wGoX`vjq`bMJaI^@PHFjn@BEFXE=tz zj*bE<*TTWib(BtK>b&0due6Iu9<5leS9|>e4{Mj{Wu}-aF+2xA_N|56r4S51f^^ zI{>j8CC<_KA_kpSPS1h|z3&yxjYcoQ#vJNChtc&x9(HLb*TD>~FafCCH$ey)H3?*4 z-qFpq?QYCZ55&~|-0NZI5r)g$j>VTDFNsKn_$Dyl2u48#8qzE5gk0w-%|Xnjb{YsN z7MKnUJ9nw*g(5;`6>MEbR*YkVY1hvvY^_y|m^vcioEEH*)VVRW0kZPOCsj8I5BV!6 z=p4JpSf%q+!*FBPhT^N11|eeKMnx~4E+hAlEkhGpl%Zp!21PSEV`bA{)I%rY~D zKDa_TpisU1C&Gpz+}`$`W5&{%u@5ji@RUbdW2%*AB~>%h?wgIIHb;hZlS5DfRM4a5 zP!lbk^J8d2(e)$<<}}{_&_p!QrZy>VxbJ#WgNFbvdRr%r za>E=VK4be3S3>uYy6edUd4;Wt>cn|yIx0!#P*X$JSS#SpgIPh6?Kuo8Z&ht+M5&j( zL>>|{Ne4Ay=+nj3QiWAJvLw+78qE&6Y0TqcXaX^{X@i6Z)5?h1$wQcCN~WSpmiJpM zvV^cbHP(r8OQU|nK?l^}1=C8cQ&5NbyVPa*=%q$7irag><6~$7mDh3KP< zfj)}zH8PP4{d?wLiO2%u1|^EOdm(h~Azcor!|u~Wj7ODWy_XF3UtH%q;vHBm?ii$q zdV_D&7_Wrxff^(j*HUZtb)G6HrYTa_NuhRyfIg=;DDcn>vWUyJRT+PJVCqPca6rao zp9?8zlt&#=|1Ie-uYbo5=su7(-wb$d9&^@H8r55MR-Xd+6 zT&VCHg$E~XJ=rVF>uv;i4!vQKTJz`>3oAAzm_~3`)3hbCf)^^Cd-%xe@Q72h0~;m^ ze6}0U0;b7iBy1X~<>?W8l zX(}s(ZaR}?Xo6|k<;*6W;O=hP_Es0f4C9y19%Kp8P*Sr`SsIWjIFQs6i8M)5=@Hor zZ}JRHFsaZA>zp|Y7?;!$3v&Y9RmDQjc*FW=)yC4uKz8b^E03QHQ+sjE8mEJyO^P{6 zl^K=LkgmaE5`>!FSUS6ICk}+J!8p1r|l*iyfc5p?JL|Sb|(8d-akNcJ{ zf~d-d2dXWIm<}O1*)-}Z%t$Y5Xj$i4%)yuoM(|zGLdo>OmROYTyUDJp@j?$YiM6XT3Yd2}1?XPGlwbKtYML+-m01jnXNoGw=04e|g00;m8 X000000Mb*F00000NkvXXu0mjfbUfZE literal 0 HcmV?d00001 From 62b47ab0a5e7a8a4ed38370b7be4707b02dde72a Mon Sep 17 00:00:00 2001 From: bitbucket Date: Wed, 20 Mar 2024 10:16:48 +0530 Subject: [PATCH 21/32] CHANGES-IN-EMP-POLICY-API : GWM --- app/Config/Routes.php | 2 +- app/Controllers/EmployeeRestController.php | 56 ++++++++++++++++++---- app/Models/EmployeePolicyModel.php | 3 +- 3 files changed, 50 insertions(+), 11 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 45cf2568..b74bb60d 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -214,7 +214,7 @@ $routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfi - +// $routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy"); $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ $routes->post("employeeUpload", "EmployeeRestController::employeeUpload"); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 4c543e4a..81dbf7a0 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -306,6 +306,7 @@ class EmployeeRestController extends AdminController $keysToRemove = ["removable_keys"]; $empPolicy = $this->employeeModel->getEmployeePolicy($id); + $empData = $this->employeeModel->where('emp_code',$emp_code)->findAll(); if ($empPolicy) { @@ -336,10 +337,35 @@ class EmployeeRestController extends AdminController array_unshift($array->SlabRates, $element); } + $employee_policy = $this->employeePolicyModel->where('employee_id',$id)->where('client_policy_id',$array->ClientPolicyId)->get()->getRow(); + if($employee_policy){ + $gpaSI['family_floater_key'] = 'self'; + $gpaSI['label'] = 'Self'; + $gpaSI['employee_id'] = $employee_policy->employee_id; + $gpaSI['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null; + $gpaSI['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null; + $gpaSI['client_policy_id'] = $array->ClientPolicyId; + + $array->mapped_family_floaters = $gpaSI; + }else{ + $gpaSI['family_floater_key'] = 'self'; + $gpaSI['label'] = 'Self'; + $gpaSI['employee_id'] = $id; + $gpaSI['basic_cover_si'] = null; + $gpaSI['premium'] = null; + $gpaSI['client_policy_id'] = $array->ClientPolicyId; + + $array->mapped_family_floaters = $gpaSI; + } + }else if($getSlabAndGridData['grid_master']['policy_type'] == "GMC"){ // re-arranging order of si $default_si = $array->Policy_Terms->sum_insured; + // Filter the array using the callback function + $getPremium = array_filter($array->SlabRates , function ($value) use ($default_si) { return $value['si'] == $default_si; } ); + $default_premium = $getPremium[0]['premium']; + $index = -1; foreach ($array->SlabRates as $key => $value) { if ($value['si'] == $default_si) { @@ -367,8 +393,8 @@ class EmployeeRestController extends AdminController $temp['name'] = $value['name']; $temp['employee_id'] = $value['id']; $temp['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null; - $temp['client_policy_id'] = $array->ClientPolicyId; - + $temp['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null; + $temp['client_policy_id'] = $array->ClientPolicyId; array_push($data,$temp); unset($empData[$key]); break; @@ -378,6 +404,15 @@ class EmployeeRestController extends AdminController } $array->mapped_family_floaters = $data; + $temp2=[]; + foreach ($array->SlabRates as $key => $value) { + $value['additional_premium'] = $value['premium'] - $default_premium; + array_push($temp2,$value); + } + $array->SlabRates = $temp2; + + + } $result[] = $array; @@ -399,24 +434,27 @@ class EmployeeRestController extends AdminController try { $requestData = $this->request->getJSON(); + foreach ($requestData as $key => $value) { - $checkIfExist = $this->employeePolicyModel->where('employee_id', $requestData['employee_id']) - ->where('client_policy_id', $requestData['client_policy_id']) + + $checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id) + ->where('client_policy_id', $value->client_policy_id) ->findAll(); // dd($checkIfExist); if ($checkIfExist) { - $empPolicy = $this->employeePolicyModel->updateSiAndPremium($requestData['client_policy_id'], $requestData['employee_id'], $requestData['basic_cover_si']); + $empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si,$value->premium); }else{ - $data['employee_id']= $requestData['employee_id']; - $data['client_policy_id']= $requestData['client_policy_id']; - $data['basic_cover_si']= $requestData['basic_cover_si']; + $data['employee_id']= $value->employee_id; + $data['client_policy_id']= $value->client_policy_id; + $data['basic_cover_si']= $value->basic_cover_si; + $data['premium']= $value->premium; $this->employeePolicyModel->insert($data); } - + } return $this->respond(['status' => 'success','code' => 200,'data' => []], 200); } catch (\Exception $e) { diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 530d8543..f69379b6 100644 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -190,12 +190,13 @@ class EmployeePolicyModel extends Model } - public function updateSiAndPremium( $client_policy_id, $employee_id,$basic_cover_si) + public function updateSiAndPremium( $client_policy_id, $employee_id,$basic_cover_si,$premium) { $query = "UPDATE employee_polices SET employee_polices.basic_cover_si = '{$basic_cover_si}' + , employee_polices.premium = '{$premium}' WHERE employee_polices.employee_id = '{$employee_id}' AND employee_polices.client_policy_id = '{$client_policy_id}'"; From d08cb10e0941964ac19ebc6e14e0901839fc0896 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Wed, 20 Mar 2024 16:13:51 +0530 Subject: [PATCH 22/32] CHANGE_EMPLOYEE_REST_FILE_UPLOAD_EMP_STATUS_KEY : AADHAVAN --- app/Controllers/ClientController.php | 24 +++++++++++++-- app/Controllers/EmployeeRestController.php | 35 ++++++++++++---------- app/Views/policy_gmc_terms.php | 5 +++- app/Views/policy_gpa_terms.php | 4 +-- 4 files changed, 48 insertions(+), 20 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 87f633fa..392f362e 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -834,6 +834,8 @@ class ClientController extends AdminController $client_policy_id = $this->request->getGet('client_policy_id'); $record = $this->clientPolicyModel->where('id', $client_policy_id)->first(); + $family_floater=json_decode($record['policy_terms'])->family_floater; + $emp_count = $this->employeeModel ->join('client_policy cp',"employees.client_id = cp.client_id") ->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id") ->where("employees.client_id",$record['client_id']) @@ -864,11 +866,29 @@ class ClientController extends AdminController $premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll(); } // echo '
';
-        // print_r($results);
+        // echo $family_floater;
+        $resultss = [];
+        if ($family_floater == 1) {
+
+            foreach ($results as $index => $record) {
+                if ($index == '8' || $index == '7') {
+                     // Clearing the $results array
+                    $resultss[$index] = $record; 
+                }
+            }
+        }else{
+            foreach ($results as $index => $record) {
+                if ($index == '0' || $index == '1' || $index == '2' || $index == '3' || $index == '4' || $index == '5' || $index == '6') {
+                    // Clearing the $results array
+                   $resultss[$index] = $record; 
+               }
+            }
+        }
+
         // print_r($data[0]->policy_type); die;
                     // echo "hello";
             // return json_encode($premiumData);
-        return $this->respond(['status' => true,'code' => 200,'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name], 200);
+        return $this->respond(['status' => true,'code' => 200,'data' => $resultss, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name,], 200);
 
     }
 
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index cb0cc648..dd0f951b 100644
--- a/app/Controllers/EmployeeRestController.php
+++ b/app/Controllers/EmployeeRestController.php
@@ -567,6 +567,8 @@ class EmployeeRestController extends AdminController
             $emp_code =isset($extra['1'][$index]) ? $extra['1'][$index] : 0;
             $name = $extra['2'][$index];
 
+            // print_r("--" . $emp_code. "---");
+            // print_r( $emp_code != 0 );
             if($emp_code != 0 && $name != '' || $name != null){
                 $record = [
                     // 'id' => $id,
@@ -575,12 +577,13 @@ class EmployeeRestController extends AdminController
                     // Check if the 'doj' key exists before accessing it
                     'doj' => $doj_new_format,
                     'gender' => $extra['4'][$index],
-                    'relationship' => $extra['5'][$index],
+                    'relationship' => ucfirst($extra['5'][$index]),
                     'family_floater_key' => $relation,
                     'dob' => $dob_new_format,
                     'email_corporate' => $extra['7'][$index],
                     'mobile'=> $extra['8'][$index],
                     'client_id' => $client_id,
+                    'emp_status'=>'draft'
                     
                 ];
                 $record2 = [
@@ -594,6 +597,7 @@ class EmployeeRestController extends AdminController
         { 
                     $employee = $this->employeeModel->checkExistingEmpEntrollment($dataToInsert[$a]);
                     $emp_id =0;
+
                     if ($employee) {
                         $emp_id =$employee['id'];
                         $id =$emp_id;
@@ -603,17 +607,18 @@ class EmployeeRestController extends AdminController
                             $this->myLogger->logme('error',('Update - ' . $employee['id'].' - '. $employee['emp_code'] .' - '.$employee['name']));
                         }
                     }else{
-                        
-                        $result = $this->employeeModel->insert($dataToInsert[$a]);
-                        $emp_id =$result;
-                        if ($result) {
-                            $emp = $this->employeeModel->where('id', $result)->get()->getResult();
+                        if ($dataToInsert[$a]['emp_code'] != 0) {
+                            $result = $this->employeeModel->insert($dataToInsert[$a]);
+                            $emp_id =$result;
+                            if ($result) {
+                                $emp = $this->employeeModel->where('id', $result)->get()->getResult();
 
-                            $policy_name = $this->employeePolicyModel->where('employee_id', $result)->get()->getResult();;
-                            
-                            
-                            $log_message = 'Insert Employee- '.$dataToInsert[$a]['name'] .'('.$dataToInsert[$a]['emp_code'] .') with PK ';
-                            $this->myLogger->logme('error',('Insert - ' .  $dataToInsert[$a]['emp_code'] .' - '. $dataToInsert[$a]['name']));
+                                $policy_name = $this->employeePolicyModel->where('employee_id', $result)->get()->getResult();;
+                                
+                                
+                                $log_message = 'Insert Employee- '.$dataToInsert[$a]['name'] .'('.$dataToInsert[$a]['emp_code'] .') with PK ';
+                                $this->myLogger->logme('error',('Insert - ' .  $dataToInsert[$a]['emp_code'] .' - '. $dataToInsert[$a]['name']));
+                            }
                         }
                     }
                     $emp_policy_data =[
@@ -644,10 +649,10 @@ class EmployeeRestController extends AdminController
             $data['policy_name']=$policy_name['name'];
             
             $message = view('mail_welcome', $data);
-            if ($dataToInsert[$a]['email_corporate'] != null || $dataToInsert[$a]['email_corporate'] != ''  &&  $dataToInsert[$a]['relationship'] == 'Self') {
-                $job_details  = new Jobs();
-                $r = Jobs::addJob(['job_name' => 'send_email','payload' => ['mail' => $mail, 'subject' => $subject,'message'=> $message]]);    
-            }
+            // if ($dataToInsert[$a]['email_corporate'] != null || $dataToInsert[$a]['email_corporate'] != ''  &&  $dataToInsert[$a]['relationship'] == 'Self') {
+            //     $job_details  = new Jobs();
+            //     $r = Jobs::addJob(['job_name' => 'send_email','payload' => ['mail' => $mail, 'subject' => $subject,'message'=> $message]]);    
+            // }
           
             // print_r($r);//die();
             // $jobWorker = new JobWorker();
diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php
index e03b3e9d..c1582a88 100644
--- a/app/Views/policy_gmc_terms.php
+++ b/app/Views/policy_gmc_terms.php
@@ -626,6 +626,8 @@ var grid_html = '';
 
 
         var gmc_policy_type_id = $(this).attr('id');
+        
+
         if(gmc_policy_type_id >= '2'){
 
             $('#policyGMCTerms').css('display', '');
@@ -640,11 +642,12 @@ var grid_html = '';
                 method: 'GET',
                 data: {client_policy_id: client_policy_id}, 
                 success: function(response) {
+                    console.log('response',response);
+
                     setTimeout(function() {
                         $('.loader').fadeOut();
                         $('.loader-mask').delay(350).fadeOut('slow');
                     }, 1000);
-                    console.log(response);
                     $('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name);
                     $('gmc_emp_count').val(response.count);
 
diff --git a/app/Views/policy_gpa_terms.php b/app/Views/policy_gpa_terms.php
index a3745720..c448e10e 100644
--- a/app/Views/policy_gpa_terms.php
+++ b/app/Views/policy_gpa_terms.php
@@ -446,12 +446,12 @@
     $('body').on('click', '.btnPolicyMaster', function () {
 
         var client_policy_id = $(this).data('id');
-        console.log('client_policy_id :' ,client_policy_id);
+        // console.log('client_policy_id :' ,client_policy_id);
 
         $('#gpa_client_policy_id').val(client_policy_id);
 
         var gpa_policy_type_id = $(this).attr('id');
-        console.log('gpa_policy_type_id', gpa_policy_type_id)
+        // console.log('gpa_policy_type_id', gpa_policy_type_id)
 
         if(gpa_policy_type_id == '1'){
 

From 00d4e9fbcc800e9aefbd1dfa92500d4eeb747c82 Mon Sep 17 00:00:00 2001
From: "venkatesh.r" 
Date: Thu, 21 Mar 2024 08:27:52 +0530
Subject: [PATCH 23/32] FEAT_IMOPARTEXPORT_SIE_DEL_COMPLETE : RV

---
 app/Controllers/EmpDataServiceController.php | 315 +++++++++++++++--
 app/Controllers/EmployeeController.php       | 344 ++++++++++++++++---
 app/Controllers/LoginController.php          |  10 +-
 app/Helpers/excel_import_export_helper.php   | 129 ++++++-
 app/Models/EmployeePolicyModel.php           | 341 ++++++++++++++++--
 app/Views/employee_upload.php                |   1 -
 app/Views/insurer_or_tpa_data.php            |   2 +-
 app/Views/policy_grid.php                    |   6 +-
 8 files changed, 1018 insertions(+), 130 deletions(-)

diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php
index 28efc8cf..b74999c9 100644
--- a/app/Controllers/EmpDataServiceController.php
+++ b/app/Controllers/EmpDataServiceController.php
@@ -49,18 +49,19 @@ class EmpDataServiceController extends BaseController
     }
 
 
-    public function batchFilesAndBatchListEntry($data, $filename, $objects){
+    public function batchFilesAndBatchListEntry($data, $objects){
+
        $random_number_count = 4;
        $data['batch_code'] = generate_random_string($random_number_count);
        $data['created_by'] = get_session_userid();
-       $data['file_name'] = $filename;
+        //    $data['file_name'] = $filename;
        $insert = $this->batchFileModel->insert($data);
        $batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
 
        if($insert){
           foreach($objects as $value){
             $batch_list_data['batch_code'] =  $batch_file_batch_code['batch_code'];
-            $batch_list_data['emp_policy_id'] =  $value->employee_policy_id ?? $value->emp_id;
+            $batch_list_data['emp_policy_id'] =  $value->primaryKey ?? $value->employee_policy_id ?? '';
             $batch_list_data['created_by'] = get_session_userid();
              $this->batchListModel->insert($batch_list_data);
           }
@@ -70,60 +71,108 @@ class EmpDataServiceController extends BaseController
     }
     
 
-    public function generateExcelForAdditionandInception($batch_files_data, $export_data, $file_name)
-    {
+    /**
+     * Generates an Excel file for Inception_Addititon_DependentAddititon, Correction, SI_Enhancement and Deletion events based on given export data.
+     *
+     * @param array $export_data An array containing export data such as 
+        * client_policy_id, 
+        * insurer_or_tpa, 
+        * event_type, 
+        * actions,
+        * file_name.
+     * @return bool True if the Excel file is successfully generated and exported, otherwise false.
+     */
 
-        $data = transform_objects_to_array_for_inception($export_data);
+    public function generateExcelForAdditionandInception($export_data)
+    {
+        // Fetch employee data for export from the database
+        $objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data['client_policy_id'], $export_data['insurer_or_tpa'], $export_data['event_type'], $export_data['actions']);
+        
+        // Log the count of exported data
+        $count = count($objects);
+        $export_data['count'] = $count;
+        $this->myLogger->logme('error', 'Inception export data count : {data}', ['data'=> $count ]);
+
+        // If no data is found for export, return false
+        if($count == 0){
+            return false;
+        }               
+
+        // Log the export file name
+        $this->myLogger->logme('error', 'Inception export file name : {data}', ['data'=> $export_data['file_name'] ]);
+
+        // Transform retrieved objects to an array suitable for export
+        $data = transform_objects_to_array_for_inception($objects);
+
+        // Define headers for the Excel file
         $headers = [
             'S.No', 'NAME OF EMP/DEP', 'EMP ID', 'EMP/DEP TYPE', 'RELATION', 'DOB', 'GENDER', 'PRE EXISTING AILMENTS',
             'BASIC COVER SI', 'DATE OF COVERAGE', 'AGE', 'RELATIONSHIP', 'REMARKS', 'POLICY END DATE', 'NO OF DAYS', 'TPA ID', 'UHID',
             'PREMIUM', 'PR0 RATA PREMIUM', 'GST', 'TOTAL'
         ];
-        
-        // Create a temporary file in memory
+
+        // Generate Excel file
         $tempFile = tmpfile();
+        $success = generate_excel($headers, $data, $tempFile, 1);
 
-        // Generate Excel file with the temporary file
-        $value = generate_excel($headers, $data, $tempFile, 1);
+        // If Excel generation is successful
+        if ($success) {
+            // Batch files and list entry
+            $return = $this->batchFilesAndBatchListEntry($export_data, $objects);
 
-        // Generate a random filename
-        $randomFilename = $file_name;
-
-        if($value){
-           $return = $this->batchFilesAndBatchListEntry($batch_files_data, $randomFilename, $export_data);
-           if($return){
-
-                // Set the appropriate headers for Excel file download
+            // If batch operation is successful
+            if ($return) {
+                // Set headers for Excel file download
                 header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
-                header('Content-Disposition: attachment;filename="' . $randomFilename . '"');
+                header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
                 header('Cache-Control: max-age=0');
 
-                // Rewind the temporary file pointer
+                // Output file contents
                 rewind($tempFile);
-
-                // Output the contents of the temporary file to the browser
                 fpassthru($tempFile);
 
-                // Close and remove the temporary file
+                // Close and remove temporary file
                 fclose($tempFile);
 
-           }else{
-               return false;
-           }
+                return true; // Excel file successfully generated and exported
+            } else {
+                return false; // Batch operation failed
+            }
         }
 
-
-
+        return false; // Excel generation failed
     }
 
-
-    public function generateExcelForCorrection($file_name, $objects, $batch_files_data)
+    
+    public function generateExcelForCorrection($export_data)
     {
 
+        $objects = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($export_data['client_id'], $export_data['client_policy_id'], $export_data['insurer_or_tpa']);
+        // dd($objects);
+        $count = count($objects);
+        $export_data['count'] = $count;
+        $this->myLogger->logme('error','Correction export data count : {data}', ['data'=> $count ]);
+
+        if($count == 0){                    
+            return false;
+        }  
+
+        $this->myLogger->logme('error','Correction export file name : {data}', ['data'=> $export_data['file_name'] ]);
+
         $correction_data = transform_objects_to_array_for_correction($objects);
 
         $headers = [
-            'Emp Code', 'RISK ID', 'NAME OF EMP/DEP', 'EMP/DEP TYPE', 'RELATION', 'DOB', 'GENDER', 'Wrong Data', 'Correct Data', 'Remarks', 'Endorsement_Id'
+            'Emp Code', 
+            'RISK ID', 
+            'NAME OF EMP/DEP', 
+            'EMP/DEP TYPE', 
+            'RELATION', 
+            'DOB', 
+            'GENDER', 
+            'Wrong Data', 
+            'Correct Data', 
+            'Remarks', 
+            'Endorsement_Id'
         ];
 
 
@@ -132,17 +181,93 @@ class EmpDataServiceController extends BaseController
 
          // Generate Excel file with the temporary file
          $value = generate_excel($headers, $correction_data, $tempFile);
- 
-         // Generate a random filename
-         $randomFilename = $file_name;
- 
+  
          if($value){
-            $return = $this->batchFilesAndBatchListEntry($batch_files_data, $randomFilename, $objects);
+            $return = $this->batchFilesAndBatchListEntry($export_data, $objects);
             if($return){
  
                  // Set the appropriate headers for Excel file download
                  header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
-                 header('Content-Disposition: attachment;filename="' . $randomFilename . '"');
+                 header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
+                 header('Cache-Control: max-age=0');
+ 
+                 // Rewind the temporary file pointer
+                 rewind($tempFile);
+ 
+                 // Output the contents of the temporary file to the browser
+                 fpassthru($tempFile);
+ 
+                 // Close and remove the temporary file
+                 fclose($tempFile);
+
+                 return true;
+ 
+            }else{
+
+                return false;
+            }
+         }
+
+    }
+    
+
+    public function generateExcelForSIEnhancement($export_data)
+    {
+
+        $objects = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($export_data['client_id'], $export_data['client_policy_id'], $export_data['insurer_or_tpa']);
+        
+        // dd($objects);
+        
+        $count = count($objects);
+        $export_data['count'] = $count;
+
+        $this->myLogger->logme('error','SI_Enhancement export data count : {data}', ['data'=> $count ]);
+
+        if($count == 0){                    
+            return false;
+        }  
+
+        $this->myLogger->logme('error','SI_Enhancement export file name : {data}', ['data'=> $export_data['file_name'] ]);
+
+        $si_data = transform_objects_to_array_for_si_enhancement($objects);
+
+        $headers = [
+            'S.No',
+            'NAME OF EMP/DEP',
+            'EMP ID',
+            'EMP/DEP TYPE',
+            'RELATION',
+            'DOB',
+            'GENDER',
+            'PRE EXISTING AILMENTS',
+            'BASIC COVER SI',
+            'Old Sum Insured',
+            'Date of Coverage',
+            'Policy End Date',
+            'No Of Days',
+            'Old SI Premium',
+            'New SI premium',
+            'Difference premium',
+            'Pro Rata Premium',
+            'GST',
+            'Total',
+            'ENDORSEMENT_ID'
+        ];
+        
+
+         // Create a temporary file in memory
+         $tempFile = tmpfile();
+
+         // Generate Excel file with the temporary file
+         $value = generate_excel($headers, $si_data, $tempFile);
+ 
+         if($value){
+            $return = $this->batchFilesAndBatchListEntry($export_data, $objects);
+            if($return){
+ 
+                 // Set the appropriate headers for Excel file download
+                 header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+                 header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
                  header('Cache-Control: max-age=0');
  
                  // Rewind the temporary file pointer
@@ -161,6 +286,120 @@ class EmpDataServiceController extends BaseController
             }
          }
 
+
     }
-    
+
+
+    public function generateExcelForDeletion($export_data)
+    {
+
+        $objects = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($export_data['client_id'], $$export_data['client_policy_id'], $$export_data['insurer_or_tpa']);
+        $count = count($objects);
+        $export_data['count'] = $count;
+
+        $this->myLogger->logme('error','Deletion export data count : {data}', ['data'=> $count ]);
+
+        if($count == 0){                    
+            return false;
+        }  
+
+        $this->myLogger->logme('error','Deletion export file name : {data}', ['data'=> $export_data['file_name'] ]);
+
+        $si_data = transform_objects_to_array_for_deletion($objects);
+
+        // dd($si_data);
+
+        $headers = [
+            'S.No',
+            'EMP ID',
+            'EMP NAME',
+            'DOB',
+            'GENDER',
+            'RELATIONSHIP',
+            'SUM INSURED',
+            'Date of Leaving',
+            'Policy End Date',
+            'No Of Days',
+            'Premium',
+            'Pro Rata Premium',
+            'GST',
+            'Total',
+            'Claim Status',
+            'ENDORSEMENT_ID'
+        ];
+        
+
+         // Create a temporary file in memory
+         $tempFile = tmpfile();
+
+         // Generate Excel file with the temporary file
+         $value = generate_excel($headers, $si_data, $tempFile, 2);
+  
+         if($value){
+            $return = $this->batchFilesAndBatchListEntry($export_data, $objects);
+            if( $return){
+ 
+                 // Set the appropriate headers for Excel file download
+                 header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+                 header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
+                 header('Cache-Control: max-age=0');
+ 
+                 // Rewind the temporary file pointer
+                 rewind($tempFile);
+ 
+                 // Output the contents of the temporary file to the browser
+                 fpassthru($tempFile);
+ 
+                 // Close and remove the temporary file
+                 fclose($tempFile);
+
+                 return true;
+ 
+            }else{
+                return false;
+            }
+         }
+
+
+    }
+
+
+    public function cashDepositCalculationForInception($arrayData = [])
+    {
+        $arrayData = array(
+            array(
+                0 => 6,
+                1 => 10,
+                2 => 17,
+                3 => 101,
+                4 => 102
+            ),
+        );
+
+        // Flatten the array to get all IDs in a single array
+        $idArray = call_user_func_array('array_merge', $arrayData);
+
+        // Select from the employee_policy table where the id is in the $idArray
+        $results = $this->employeePolicyModel
+                        ->select('employee_polices.pro_rata_premium')
+                        ->whereIn('id', $idArray)
+                        ->get()
+                        ->getResultArray();
+
+        // Output the results
+        print_r($results); die;
+        
+    }
+
+    public function cashDepositCalculationForSIEnhancement($arrayData)
+    {
+
+    }
+
+    public function cashDepositCalculationForDeletion($arrayData)
+    {
+
+    }
+
+    // -----------------------------------------------------------------------------------
 }
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index 21448fe0..d04be584 100644
--- a/app/Controllers/EmployeeController.php
+++ b/app/Controllers/EmployeeController.php
@@ -259,58 +259,70 @@ class EmployeeController extends AdminController
 
         $this->myLogger->logme('error','importExport function called');
         $empDataServiceController = new EmpDataServiceController();
+
         $client_id = $this->request->getPost('client_id');
         $client_policy_id = $this->request->getPost('client_policy_id');
         $insurer_or_tpa = $this->request->getPost('insurer_or_tpa');
         $event_type = $this->request->getPost('event_type');
-        $actions = $this->request->getPost('action_type');
+        $actions = $this->request->getPost('action_type');         
 
+        $client_data = $this->clientModel->where('id', $client_id)->first();
+        $policy_name = $this->clientPolicyModel->select('policies.name')->join('policies', 'policies.id = client_policy.policy_id')->where('client_policy.id', $client_policy_id)->first();
+        $file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $policy_name['name']);
+        
         $batch_data = [
             'client_id' => $client_id,
             'client_policy_id' => $client_policy_id,
             'insurer_or_tpa' => $insurer_or_tpa,
             'event_type' => $event_type,
             'actions' => $actions,
+            'file_name' => $file_name,
          ];
 
-        $client_data = $this->clientModel->where('id', $client_id)->first();
-        $policy_name = $this->clientPolicyModel->select('policies.name')
-                                    ->join('policies', 'policies.id = client_policy.policy_id')
-                                    ->where('client_policy.id', $client_policy_id)->first();
-        $file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $policy_name['name']);
-        
         if($actions == 'export'){
 
             if($event_type == 'inception'){
                 
-                $objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($client_policy_id, $insurer_or_tpa, $event_type, $actions);
-                $count = count($objects);
-                $this->myLogger->logme('error','Inception export data count : {data}', ['data'=> $count ]);
-                $batch_data['count'] = $count;
-    
-                if($count == 0){
+                $return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);  
+                if(!$return){
+                     session()->setFlashdata('error', 'No data found about this action');
+                     return redirect()->to(base_url('employee/upload')); 
+                }  else{
+                    $this->myLogger->logme('error','Successfully exported Excel file in Inception/Addition/DependentAddition.');
+                }
 
-                    session()->setFlashdata('error', 'No data found');
-                    return redirect()->to(base_url('employee/upload'));
-                }               
+            } else if($event_type == 'correction'){ 
 
-                $this->myLogger->logme('error','Inception export file name : {data}', ['data'=> $file_name ]);
-                $empDataServiceController->generateExcelForAdditionandInception($batch_data, $objects, $file_name);    
+                $return = $empDataServiceController->generateExcelForCorrection($batch_data); 
+                if(!$return){
+                    session()->setFlashdata('error', 'No data found about this action');
+                    return redirect()->to(base_url('employee/upload')); 
+               }  else{
+                   $this->myLogger->logme('error','Successfully exported Excel file in Correction.');
+               }
 
-            } else if($event_type == 'correction'){
+            } else if($event_type == 'si_enhancement'){
 
-                $objects = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($client_id, $client_policy_id, $insurer_or_tpa);
-                $count = count($objects);
-                $this->myLogger->logme('error','Correction export data count : {data}', ['data'=> $count ]);
-                $batch_data['count'] = $count;
-                if($count == 0){                    
-                    session()->setFlashdata('error', 'No data found');
-                    return redirect()->to(base_url('employee/upload'));
-                }  
-                $this->myLogger->logme('error','Correction export file name : {data}', ['data'=> $file_name ]);
-                $empDataServiceController->generateExcelForCorrection($file_name, $objects, $batch_data); 
+                $return = $empDataServiceController->generateExcelForSIEnhancement($batch_data); 
+                if(!$return){
+                    session()->setFlashdata('error', 'No data found about this action');
+                    return redirect()->to(base_url('employee/upload')); 
+               }  else{
+                   $this->myLogger->logme('error','Successfully exported Excel file in SI_Enhancement.');
+               }
+
+            }else if($event_type == 'deletion'){
+
+                $return = $empDataServiceController->generateExcelForDeletion($batch_data); 
+                if(!$return){
+                    session()->setFlashdata('error', 'No data found about this action');
+                    return redirect()->to(base_url('employee/upload')); 
+               }  else{
+                   $this->myLogger->logme('error','Successfully exported Excel file in Deletion.');
+               }
             }
 
+
         }else if($actions == 'import'){
 
             if($event_type == 'inception'){
@@ -328,22 +340,28 @@ class EmployeeController extends AdminController
                 $batch_data['batch_code'] = $batch_code;
                 $batch_data['created_by'] = get_session_userid();
                 $batch_data['file_name'] = $filename;
-                $insert = $this->batchFileModel->insert($batch_data);
-                $batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
+                // $insert = $this->batchFileModel->insert($batch_data);
+                $batch_file_batch_code = $this->batchFileModel->where('id', 2)->first();
 
+                $batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
+                $batch_code_for_batch_list['created_by'] = get_session_userid();
+ 
                 $file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
 
                 //check the file exist or not
                 if(!file_exists($file_name_with_path))
                 {
-                    session()->setFlashdata('error', 'File not found');
-                    return redirect()->to(base_url('employee/upload'));
+                    // session()->setFlashdata('error', 'File not found');
+                    // return redirect()->to(base_url('employee/upload'));
                 }
 
                 $data = read_excel_file_to_array($file_name_with_path);
                 unset($data[0]);
                 array_pop($data);
+                $count = count($data);
+                // $this->batchFileModel->where('id', $insert)->set('count', $count)->update();
                 // dd($data );
+                $employeeIds = [];
                 foreach ($data as $key => $value) {
                     // Check if the array is not empty and has the necessary data
                     if (!empty($value) && (isset($value[15]) || isset($value[16]))) {
@@ -354,21 +372,43 @@ class EmployeeController extends AdminController
                         $emp_code = $value[2];
                         $name = $value[1];
 
-                        // echo $tpa_id, $uhid, $emp_code, $name; die;
+                        $val = $this->employeePolicyModel
+                                ->select('employee_polices.id')
+                                ->join('employees', 'employees.id = employee_polices.employee_id')
+                                ->where('employee_polices.client_policy_id', $client_policy_id)
+                                ->where('employees.client_id', $client_id)
+                                ->where('employees.name', $name)
+                                ->where('employees.emp_code', $emp_code)
+                                ->where('employee_polices.is_active', 1)
+                                ->first();
+                        $batch_code_for_batch_list['emp_policy_id'] = $val['id'];
+                        $this->batchListModel->insert($batch_code_for_batch_list);
+                        array_push($employeeIds, $val['id']);
+
                         $this->employeePolicyModel->updateTPAIDorUHID( $client_policy_id, $client_id, $name, $emp_code, $uhid, $tpa_id);
-                        $query = $this->employeePolicyModel->getLastQuery();
-                        echo $query . "
"; + + // $query = $this->employeePolicyModel->getLastQuery(); + // echo $query . "
"; }else{ - session()->setFlashdata('error', 'Something went wrong'); - return redirect()->to(base_url('employee/upload')); + // session()->setFlashdata('error', 'Something went wrong'); + // return redirect()->to(base_url('employee/upload')); } } + $action = ['action' => 'inception']; + + $depositeData = [ + $employeeIds, + $action + ]; + $empDataServiceController->cashDepositCalculationForInception(); + // echo '
';
+                // print_r($depositeData); die;
                 
-                session()->setFlashdata('success', 'Data updated successfully');
-                return redirect()->to(base_url('employee/upload'));
+                // session()->setFlashdata('success', 'Data updated successfully');
+                // return redirect()->to(base_url('employee/upload'));
 
             }else if($event_type == 'correction'){
 
@@ -388,6 +428,9 @@ class EmployeeController extends AdminController
                 $insert = $this->batchFileModel->insert($batch_data);
                 $batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
 
+                $batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
+                $batch_code_for_batch_list['created_by'] = get_session_userid();
+
                 $file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
 
                 if(!file_exists($file_name_with_path))
@@ -398,6 +441,8 @@ class EmployeeController extends AdminController
 
                 $data = read_excel_file_to_array($file_name_with_path);
                 unset($data[0]);
+                $count = count($data);
+                $this->batchFileModel->where('id', $insert)->set('count', $count)->update();
                 // dd($data);
                 foreach ($data as $key => $value) {
 
@@ -406,10 +451,23 @@ class EmployeeController extends AdminController
                         $emp_code = $value[0];
                         $uhid = $value[1];
                         $endorsement_id = $value[10] != null ? $value[10] : '';
+
+                        $val = $this->employeePolicyModel
+                        ->select('employees.id')
+                        ->join('employees', 'employees.id = employee_polices.employee_id')
+                        ->where('employee_polices.client_policy_id', $client_policy_id)
+                        ->where('employees.client_id', $client_id)
+                        ->where('employee_polices.uhid', $uhid)
+                        ->where('employees.emp_code', $emp_code)
+                        ->where('employees.is_active', 1)
+                        ->first();
+                        $batch_code_for_batch_list['emp_policy_id'] = $val['id'];
+                        $this->batchListModel->insert($batch_code_for_batch_list);
+
                         // $this->employeePolicyModel->updateCorrectionData($emp_code, $uhid, $endorsement_id);
 
                        $queryData =  $this->empEndorsementModel->select('emp_endorsement.*')
-                                ->join('employees', 'employees.id = emp_endorsement.emp_id')
+                                ->join('employees', 'employees.id = emp_endorsement.pk')
                                 ->join('employee_polices', 'employee_polices.employee_id = employees.id')
                                 ->where('employees.emp_code', $emp_code)
                                 ->where('employees.client_id', $client_id)
@@ -430,8 +488,206 @@ class EmployeeController extends AdminController
                             $this->employeeModel->where('id', $emp_id)->set($field_name, $new_value)->update();
                         }
 
-                        $query = $this->employeePolicyModel->getLastQuery();
-                        echo $query . "
"; + // $query = $this->employeePolicyModel->getLastQuery(); + // echo $query . "
"; + }else{ + session()->setFlashdata('error', 'Something went wrong'); + return redirect()->to(base_url('employee/upload')); + } + + } + + session()->setFlashdata('success', 'Data updated successfully'); + return redirect()->to(base_url('employee/upload')); + + }else if($event_type == 'si_enhancement'){ + + $file = $this->request->getFile('import_file_data'); + $is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); + $filename = $file->getName(); + + $this->myLogger->logme('error','SI_Enhancement Import file name : {data}', ['data'=> $filename ]); + $random_number_count = 4; + $batch_code = generate_random_string($random_number_count); + $this->myLogger->logme('error','SI_Enhancement Import BATCH CODE : {data}', ['data'=> $batch_code ]); + + + $batch_data['batch_code'] = $batch_code; + $batch_data['created_by'] = get_session_userid(); + $batch_data['file_name'] = $filename; + $insert = $this->batchFileModel->insert($batch_data); + $batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first(); + + $batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code']; + $batch_code_for_batch_list['created_by'] = get_session_userid(); + + $file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name']; + + if(!file_exists($file_name_with_path)) + { + session()->setFlashdata('error', 'File not found'); + return redirect()->to(base_url('employee/upload')); + } + + $data = read_excel_file_to_array($file_name_with_path); + unset($data[0]); + $count = count($data); + $this->batchFileModel->where('id', $insert)->set('count', $count)->update(); + // dd($data); + foreach ($data as $key => $value) { + + if (!empty($value) && isset($value[19])) { + + $emp_name = $value[1]; + $emp_code = $value[2]; + // echo $emp_name .'-'. $emp_code; die; + $endorsement_id = $value[19] != null ? $value[19] : ''; + + $val = $this->employeePolicyModel + ->select('employee_polices.id') + ->join('employees', 'employees.id = employee_polices.employee_id') + ->where('employee_polices.client_policy_id', $client_policy_id) + ->where('employees.client_id', $client_id) + ->where('employees.name', $emp_name) + ->where('employees.emp_code', $emp_code) + ->where('employee_polices.is_active', 1) + ->first(); + $batch_code_for_batch_list['emp_policy_id'] = $val['id']; + $this->batchListModel->insert($batch_code_for_batch_list); + + + $this->employeePolicyModel->updateEndoresmentIdForSIEnhancement($emp_code, $client_id, $client_policy_id, $emp_name, $endorsement_id); + + $queryData = $this->employeePolicyModel + ->select('employee_polices.*') + ->join('employees', 'employee_polices.employee_id = employees.id') + ->where('employees.emp_code', $emp_code) + ->where('employees.name', $emp_name) + ->where('employees.client_id', $client_id) + ->where('employee_polices.client_policy_id', $client_policy_id) + ->where('employee_polices.is_active', 1) + ->first(); + + $queryData['is_active'] = 0; + $this->employeePolicyModel->save($queryData); + + unset($queryData['id']); + unset($queryData['created_by']); + unset($queryData['created_at']); + unset($queryData['updated_by']); + unset($queryData['updated_at']); + unset($queryData['is_active']); + + $queryData['basic_cover_si'] = $value[8]; + $queryData['premium'] = $value[14]; + $queryData['si_enhancement_date'] = $value[10]; + $queryData['rata_premimum'] = $value[16]; + $queryData['gst'] = $value[17]; + $queryData['created_by'] = get_session_userid(); + + //new insert + $this->employeePolicyModel->save($queryData); + + + // $query = $this->employeePolicyModel->getLastQuery(); + // echo $query . "
"; + }else{ + session()->setFlashdata('error', 'Something went wrong'); + return redirect()->to(base_url('employee/upload')); + } + + } + + session()->setFlashdata('success', 'Data updated successfully'); + return redirect()->to(base_url('employee/upload')); + + }else if($event_type == 'deletion'){ + + $file = $this->request->getFile('import_file_data'); + $is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); + $filename = $file->getName(); + + $this->myLogger->logme('error','Deletion Import file name : {data}', ['data'=> $filename ]); + $random_number_count = 4; + $batch_code = generate_random_string($random_number_count); + $this->myLogger->logme('error','Deletion Import BATCH CODE : {data}', ['data'=> $batch_code ]); + + + $batch_data['batch_code'] = $batch_code; + $batch_data['created_by'] = get_session_userid(); + $batch_data['file_name'] = $filename; + $insert = $this->batchFileModel->insert($batch_data); + $batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first(); + + $batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code']; + $batch_code_for_batch_list['created_by'] = get_session_userid(); + + $file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name']; + + if(!file_exists($file_name_with_path)) + { + session()->setFlashdata('error', 'File not found'); + return redirect()->to(base_url('employee/upload')); + } + + $data = read_excel_file_to_array($file_name_with_path); + unset($data[0]); + array_pop($data); + + $count = count($data); + $this->batchFileModel->where('id', $insert)->set('count', $count)->update(); + + foreach ($data as $key => $value) { + + if (!empty($value) && isset($value[15])) { + + $emp_name = $value[2]; //employee name + $emp_code = $value[1]; //employee code + $date_of_exit = $value[7]; // date of releving + + // echo $emp_name .'-'. $emp_code .'-'. $date_of_exit; die; + $endorsement_id = $value[15] != null ? $value[15] : ''; //endorsement id + + $val = $this->employeePolicyModel + ->select('employee_polices.id') + ->join('employees', 'employees.id = employee_polices.employee_id') + ->where('employee_polices.client_policy_id', $client_policy_id) + ->where('employees.client_id', $client_id) + ->where('employees.name', $emp_name) + ->where('employees.emp_code', $emp_code) + ->where('employee_polices.is_active', 1) + ->first(); + $batch_code_for_batch_list['emp_policy_id'] = $val['id']; + $this->batchListModel->insert($batch_code_for_batch_list); + + $this->employeePolicyModel->updateEndoresmentIdForDeletion($emp_code, $client_id, $client_policy_id, $emp_name, $endorsement_id); + + $deletionDataForEmployee = $this->empEndorsementModel + ->select('emp_endorsement.new_value, employees.id') + ->join('employees', 'emp_endorsement.emp_code = employees.emp_code') + ->join('employee_polices', 'employee_polices.employee_id = employees.id') + ->where('emp_endorsement.emp_code', $emp_code) + ->where('employees.client_id', $client_id) + ->where('employee_polices.client_policy_id', $client_policy_id) + ->where('emp_endorsement.name', $emp_name) + ->where('emp_endorsement.field_name', 'emp_status') + ->first(); + + $deletionDataForEmployee['updated_by'] = get_session_userid(); + $this->employeeModel->save($deletionDataForEmployee); + + + $deletionDataForEmployeePolicy = $this->employeePolicyModel->fetchEmpEndorsementData($emp_code, $client_policy_id, $emp_name); + $deletionDataForEmployeePolicy['updated_by'] = get_session_userid(); + $this->employeePolicyModel->save($deletionDataForEmployeePolicy); + + // echo '
';
+                        // print_r($deletionDataForEmployeePolicy); die;
+                        
+                        $this->employeePolicyModel->save($deletionDataForEmployeePolicy);
+                        
+                        // $query = $this->employeePolicyModel->getLastQuery();
+                        // echo $query . "
"; }else{ session()->setFlashdata('error', 'Something went wrong'); return redirect()->to(base_url('employee/upload')); @@ -449,5 +705,5 @@ class EmployeeController extends AdminController } - + // ------------------------------------------------------------------------------------------- } \ No newline at end of file diff --git a/app/Controllers/LoginController.php b/app/Controllers/LoginController.php index d18cb98c..c24f4ddc 100644 --- a/app/Controllers/LoginController.php +++ b/app/Controllers/LoginController.php @@ -45,20 +45,20 @@ class LoginController extends BaseController $session_data = ['isLoggedIn' => True ,'userid' => $user->id]; set_session_data($session_data); log_message('error', 'Set The UserId : `'. $user->id .'` in Session'); - log_message('error', 'Is User Login Sucessfully'); + log_message('error', 'User Login Sucessfully'); // $this->getUserDeviceInfo($user->id); $this->getUserDeviceInfo($user->id, 'NhanceUser'); return redirect()->to(base_url('/dashboard/view')); }else{ - log_message('error', 'Is User Not Activate'); - session()->setFlashdata('error', 'Is User Not Activate'); + log_message('error', 'User Not Activate'); + session()->setFlashdata('error', 'User Not Activate'); return redirect()->to(base_url('login')); } }else{ - log_message('error', 'Is User Not Register'); - session()->setFlashdata('error', 'Is User Not Register'); + log_message('error', 'User Not Register'); + session()->setFlashdata('error', 'User Not Register'); return redirect()->to(base_url('login')); } } diff --git a/app/Helpers/excel_import_export_helper.php b/app/Helpers/excel_import_export_helper.php index e594f650..55ed7eda 100644 --- a/app/Helpers/excel_import_export_helper.php +++ b/app/Helpers/excel_import_export_helper.php @@ -48,6 +48,19 @@ if (!function_exists('generate_random_string')) { if (!function_exists('generate_excel')) { + + /* + This function generates an Excel file using the given headers and data and saves it with the specified filename. + It utilizes the PhpSpreadsheet library to create and manipulate Excel files. + + Parameters: + - $headers: An array containing the column headers for the Excel sheet. + - $data: An array containing the data to be inserted into the Excel sheet. + - $filename: The name of the file to be saved. + - $totals (optional): A flag indicating whether to include total calculations in the Excel sheet. + */ + + function generate_excel($headers, $data, $filename, $totals = null) { // Create new Spreadsheet object @@ -62,9 +75,11 @@ if (!function_exists('generate_excel')) { // Set data into the spreadsheet $spreadsheet->getActiveSheet()->fromArray($data, null, 'A2'); - if($totals){ + if($totals == 1){ // Call the helper function for Calculate GST, Pro Rata Premium, and Total sums for inception add_totals_row($spreadsheet, $data); + }else if($totals == 2){ + add_totals_for_deletion($spreadsheet, $data); } // Create Excel writer @@ -162,6 +177,94 @@ if (! function_exists('transform_objects_to_array_for_correction')) { } +if (! function_exists('transform_objects_to_array_for_si_enhancement')) { + function transform_objects_to_array_for_si_enhancement($objects) { + + // Define an array to store the transformed data + $data = []; + $endorsement_id = ""; + + // Initialize serial number + $serialNumber = 1; + + // Iterate through each object + foreach ($objects as $obj) { + // Extract all values for the object + $rowData = [ + $serialNumber++, + $obj->emp_name, + $obj->emp_code, + $obj->emp_type, + $obj->emp_relationship_code, + $obj->emp_dob, + $obj->emp_gender, + $obj->pre_existing_alignments, + $obj->new_basic_cover_si, + $obj->old_basic_cover_si, + $obj->date_of_coverage, + $obj->policy_end_date, + $obj->no_of_days, + $obj->old_si_premium, + $obj->new_si_premium, + $obj->difference_premium, + $obj->pro_rata_premimum, + $obj->gst, + $obj->total , + $endorsement_id, + ]; + + // Append the row data to the main data array + $data[] = $rowData; + } + + return $data; + } +} + + +if (! function_exists('transform_objects_to_array_for_deletion')) { + function transform_objects_to_array_for_deletion($objects) { + + // Define an array to store the transformed data + $data = []; + $claim_status = ""; + $endorsement_id = ""; + + // Initialize serial number + $serialNumber = 1; + + // Iterate through each object + foreach ($objects as $obj) { + // Extract all values for the object + $rowData = [ + $serialNumber++, + $obj->emp_code, + $obj->emp_name, + $obj->emp_dob, + $obj->emp_gender, + $obj->emp_relationship, + $obj->basic_cover_si, + $obj->dateofexit, + $obj->policy_end_date, + $obj->no_of_days, + $obj->premium, + $obj->pro_rata_premium, + $obj->gst, + $obj->total, + $claim_status, + $endorsement_id + + ]; + + // Append the row data to the main data array + $data[] = $rowData; + } + + return $data; + } +} + + if (!function_exists('add_totals_row')) { function add_totals_row(Spreadsheet $spreadsheet, array $data) { @@ -186,6 +289,30 @@ if (!function_exists('add_totals_row')) { } +if (!function_exists('add_totals_for_deletion')) { + function add_totals_for_deletion(Spreadsheet $spreadsheet, array $data) + { + // Calculate GST, Pro Rata Premium, and Total sums + $gstSum = 0; + $proRataPremiumSum = 0; + $totalSum = 0; + + foreach ($data as $row) { + $proRataPremiumSum += $row[11]; + $gstSum += $row[12]; + $totalSum += $row[13]; + } + + // Add a new row with sums + $lastRow = count($data) + 1; // To get the last row number + $spreadsheet->getActiveSheet()->setCellValue('K' . ($lastRow + 1), 'TOTALS'); + $spreadsheet->getActiveSheet()->setCellValue('L' . ($lastRow + 1), $proRataPremiumSum); + $spreadsheet->getActiveSheet()->setCellValue('M' . ($lastRow + 1), $gstSum); + $spreadsheet->getActiveSheet()->setCellValue('N' . ($lastRow + 1), $totalSum); + } +} + + if (!function_exists('read_excel_file_to_array')) { function read_excel_file_to_array($file) { diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 6bbaeafb..26d3cd86 100644 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -17,12 +17,15 @@ class EmployeePolicyModel extends Model "batch_id", "status", "pre_existing_alignments", + "date_of_exit", + "reason_for_exit", "basic_cover_si", "date_coverage", "policy_end_date", "days", "premium", "rata_premimum", + "si_enhancement_date", "gst", "created_by", "updated_by", @@ -62,7 +65,7 @@ class EmployeePolicyModel extends Model TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age, "Has Define" as emp_type, - employee_polices.id as employee_policy_id, + employee_polices.id as primaryKey, employee_polices.pre_existing_alignments, employee_polices.basic_cover_si, employee_polices.date_coverage, @@ -75,7 +78,6 @@ class EmployeePolicyModel extends Model batch_data.emp_policy_id, batch_data.bl AS batch_list_batch_code, batch_data.bf AS batch_files_batch_code') - ->join('employees', 'employees.id = employee_polices.employee_id', 'left') ->join("( SELECT @@ -90,6 +92,7 @@ class EmployeePolicyModel extends Model ->where('batch_data.bf', null) ->where('batch_data.bl', null) ->where('employee_polices.client_policy_id', $client_policy_id) + ->where('employee_polices.is_active', 1) ->get() ->getResult(); } @@ -98,43 +101,247 @@ class EmployeePolicyModel extends Model public function getCorrectionEmployeesDataForExportExcel($client_id, $client_policy_id, $insurer_or_tpa) { - return $this->db->table('emp_endorsement') - ->select('emp_endorsement.id, - emp_endorsement.emp_id, - emp_endorsement.emp_code, - emp_endorsement.endorsement_id, - emp_endorsement.old_value, - emp_endorsement.new_value, - emp_endorsement.field_name, - emp_endorsement.remarks, - employees.name AS emp_name, - employees.dob AS emp_dob, - employees.gender AS emp_gender, - employees.client_id AS emp_client_id, - "Has Define" as emp_type, - employee_polices.uhid, - employees.relationship_code, - batch_data.emp_policy_id, - batch_data.bl AS batch_list_batch_code, - batch_data.bf AS batch_files_batch_code') - ->join('employees', 'employees.id = emp_endorsement.emp_id', 'left') - ->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left') - ->join("(SELECT batch_list.emp_policy_id, - batch_list.batch_code as bl, - batch_files.batch_code as bf - FROM batch_files - LEFT JOIN batch_list ON batch_files.batch_code = batch_list.batch_code + $sql = " + SELECT DISTINCT + emp_endorsement.id, + emp_endorsement.pk, + emp_endorsement.emp_code, + emp_endorsement.endorsement_id, + emp_endorsement.old_value, + emp_endorsement.new_value, + emp_endorsement.field_name, + emp_endorsement.remarks, + emp_endorsement.actions, + employees.id AS primaryKey, + employees.name AS emp_name, + employees.dob AS emp_dob, + employees.gender AS emp_gender, + employees.client_id AS emp_client_id, + 'Has Define' AS emp_type, + employee_polices.uhid, + employees.relationship_code, + batch_data.emp_policy_id, + batch_data.bl AS batch_list_batch_code, + batch_data.bf AS batch_files_batch_code + + FROM + emp_endorsement + LEFT JOIN + employees ON employees.id = emp_endorsement.pk + LEFT JOIN + employee_polices ON employees.id = employee_polices.employee_id + LEFT JOIN ( + SELECT batch_list.emp_policy_id, + batch_list.batch_code AS bl, + batch_files.batch_code AS bf + FROM + batch_files + LEFT JOIN + batch_list ON batch_files.batch_code = batch_list.batch_code WHERE batch_files.event_type = 'correction' AND batch_files.actions = 'export' - AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}') as batch_data", 'emp_endorsement.emp_id = batch_data.emp_policy_id', 'left', false) - ->where('batch_data.bf IS NULL') - ->where('batch_data.bl IS NULL') - ->where('emp_endorsement.endorsement_id', '') - ->where('employees.client_id', $client_id) - ->where('employee_polices.client_policy_id', $client_policy_id) - ->get() - ->getResult(); + AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}' + ) AS batch_data ON emp_endorsement.pk = batch_data.emp_policy_id + WHERE batch_data.bf IS NULL + AND batch_data.bl IS NULL + AND employees.client_id = '{$client_id}' + AND employee_polices.client_policy_id = '{$client_policy_id}' + AND emp_endorsement.actions = 'c' + AND (emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')"; + + // Execute the raw query + $query = $this->db->query($sql); + + // Get the result set + $result = $query->getResult(); + + return $result; + + } + + + public function getSIEnhancementEmployeesDataForExportExcel($client_id, $client_policy_id, $insurer_or_tpa){ + + $query = $this->db->query(" + SELECT + employee_polices.id AS primaryKey, + employees.name AS emp_name, + employees.emp_code AS emp_code, + employees.dob AS emp_dob, + employees.gender AS emp_gender, + employees.relationship_code AS emp_relationship_code, + 'Has Define' AS emp_type, + employee_polices.uhid AS risk_id, + employee_polices.pre_existing_alignments, + employee_polices.policy_end_date, + employee_polices.basic_cover_si as old_basic_cover_si, + employee_polices.premium as old_si_premium, + batch_data.emp_policy_id, + batch_data.bl AS batch_list_batch_code, + batch_data.bf AS batch_files_batch_code, + sidata.new_basic_cover_si, + sidata.new_si_premium, + sidata.date_of_coverage, + DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days, + sidata.new_si_premium - employee_polices.premium AS difference_premium, + ROUND((sidata.new_si_premium - employee_polices.premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premimum, + ROUND(((sidata.new_si_premium - employee_polices.premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst, + ((sidata.new_si_premium - employee_polices.premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) + ROUND(((sidata.new_si_premium - employee_polices.premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS total + + FROM + emp_endorsement a + LEFT JOIN + employees ON employees.emp_code = a.emp_code + LEFT JOIN + employee_polices ON employees.id = employee_polices.employee_id + LEFT JOIN ( + SELECT + aa.emp_code, + aa.new_value as 'new_basic_cover_si', + bb.new_value as 'new_si_premium', + cc.new_value as 'date_of_coverage' + FROM ( + SELECT + a1.emp_code, + a1.field_name, + a1.new_value + FROM + emp_endorsement as a1 + WHERE + a1.field_name = 'basic_cover_si' + ) aa + LEFT JOIN ( + SELECT + b1.emp_code, + b1.field_name, + b1.new_value + FROM + emp_endorsement as b1 + WHERE + b1.field_name = 'premium' + ) bb ON aa.emp_code = bb.emp_code + LEFT JOIN ( + SELECT + c1.emp_code, + c1.field_name, + c1.new_value + FROM + emp_endorsement as c1 + WHERE + c1.field_name = 'si_enhancement_date' + ) cc ON aa.emp_code = cc.emp_code + ) as sidata ON a.emp_code = sidata.emp_code + LEFT JOIN ( + SELECT DISTINCT + batch_list.emp_policy_id, + batch_list.batch_code AS bl, + batch_files.batch_code AS bf + FROM + batch_files + LEFT JOIN + batch_list ON batch_files.batch_code = batch_list.batch_code + WHERE + batch_files.event_type = 'si_enhancement' + AND batch_files.actions = 'export' + AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}' + ) AS batch_data ON employee_polices.id = batch_data.emp_policy_id + WHERE + batch_data.bf IS NULL + AND batch_data.bl IS NULL + AND employee_polices.client_policy_id = '{$client_policy_id}' + AND employee_polices.is_active = '1' + AND (a.endorsement_id IS NULL OR a.endorsement_id = '') + AND a.field_name = 'si_enhancement_date' + "); + + // Get the result set + $results = $query->getResult(); + return $results; + + } + + + public function getDeletionEmployeeDataForExportExcel($client_id, $client_policy_id, $insurer_or_tpa){ + + $query = $this->db->query(" + SELECT + employee_polices.id as primaryKey, + employees.name AS emp_name, + employees.emp_code AS emp_code, + employees.dob AS emp_dob, + employees.gender AS emp_gender, + employees.relationship AS emp_relationship, + 'Has Define' as emp_type, + + employee_polices.basic_cover_si, + employee_polices.uhid as risk_id, + employee_polices.policy_end_date, + employee_polices.premium, + + batch_data.emp_policy_id AS emp_policy_id, + batch_data.bl AS batch_list_batch_code, + batch_data.bf AS batch_files_batch_code, + + deletiondata.empstatus, + deletiondata.changeevent, + deletiondata.dateofexit, + deletiondata.reasonforexit, + deletiondata.status, + + DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) AS no_of_days, + ROUND((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365, 2) AS pro_rata_premium, + ROUND(((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18, 2) AS gst, + ROUND(((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) + (((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18), 2) AS total + FROM + emp_endorsement a + LEFT JOIN + employees ON a.emp_code = employees.emp_code + LEFT JOIN + employee_polices ON employees.id = employee_polices.employee_id + + LEFT JOIN( + + select aa.emp_code, aa.new_value as 'empstatus', bb.new_value as 'changeevent', cc.new_value as 'dateofexit', dd.new_value as 'reasonforexit', ee.new_value as 'status' from + + ( SELECT a1.emp_code, a1.field_name, a1.new_value from emp_endorsement as a1 where a1.field_name = 'emp_status') aa + left join + ( SELECT b1.emp_code, b1.field_name, b1.new_value from emp_endorsement as b1 where b1.field_name = 'change_event') bb on aa.emp_code = bb.emp_code + left join + ( SELECT c1.emp_code, c1.field_name, c1.new_value from emp_endorsement as c1 where c1.field_name = 'date_of_exit') cc on aa.emp_code = cc.emp_code + left join + ( SELECT d1.emp_code, d1.field_name, d1.new_value from emp_endorsement as d1 where d1.field_name = 'reason_for_exit') dd on aa.emp_code = dd.emp_code + left JOIN + ( SELECT e1.emp_code, e1.field_name, e1.new_value from emp_endorsement as e1 where e1.field_name = 'status') ee on aa.emp_code = ee.emp_code + + ) as deletiondata on a.emp_code = deletiondata.emp_code + + LEFT JOIN + ( + SELECT + batch_list.emp_policy_id, + batch_list.batch_code AS bl, + batch_files.batch_code AS bf + FROM + batch_files + LEFT JOIN + batch_list ON batch_files.batch_code = batch_list.batch_code + WHERE + batch_files.event_type = 'deletion' + AND batch_files.actions = 'export' + AND batch_files.insurer_or_tpa = 'insurer' + ) AS batch_data ON employee_polices.id = batch_data.emp_policy_id + WHERE + batch_data.bf IS NULL + AND batch_data.bl IS NULL + AND employee_polices.client_policy_id = 12 + AND employee_polices.is_active = 1 + AND (a.endorsement_id IS NULL OR a.endorsement_id = '') AND a.field_name = 'status' + "); + + $result = $query->getResult(); + return $result; + } @@ -170,7 +377,7 @@ class EmployeePolicyModel extends Model $sql = " UPDATE emp_endorsement - JOIN employees ON employees.id = emp_endorsement.emp_id + JOIN employees ON employees.id = emp_endorsement.pk JOIN employee_polices ON employees.id = employee_polices.employee_id SET emp_endorsement.endorsement_id = '$endorsement_id' WHERE employees.emp_code = '$emp_code' @@ -179,6 +386,66 @@ class EmployeePolicyModel extends Model $query = $this->query($sql); } + + public function updateEndoresmentIdForSIEnhancement($emp_code, $client_id, $client_policy_id, $emp_name, $endorsement_id){ + + $sql = " + UPDATE emp_endorsement + JOIN employee_polices ON employee_polices.id = emp_endorsement.pk + JOIN employees ON employee_polices.employee_id = employees.id + SET emp_endorsement.endorsement_id = '$endorsement_id' + WHERE employees.emp_code = '$emp_code' + AND employees.client_id = '$client_id' + AND employee_polices.client_policy_id = '$client_policy_id' + AND employees.name = '$emp_name' + "; + $query = $this->query($sql); + } + + + public function updateEndoresmentIdForDeletion($emp_code, $client_id, $client_policy_id, $emp_name, $endorsement_id){ + + $sql = " + UPDATE emp_endorsement + JOIN employee_polices ON employee_polices.id = emp_endorsement.pk + JOIN employees ON employee_polices.employee_id = employees.id + SET emp_endorsement.endorsement_id = '$endorsement_id' + WHERE employees.emp_code = '$emp_code' + AND employees.client_id = '$client_id' + AND employee_polices.client_policy_id = '$client_policy_id' + AND employees.name = '$emp_name' + "; + $query = $this->query($sql); + } + + + public function fetchEmpEndorsementData($emp_code, $client_policy_id, $emp_name) + { + // Your raw SQL query + $sql = " + SELECT + ep.id, + MAX(CASE WHEN ee.field_name = 'date_of_exit' THEN ee.new_value END) AS date_of_exit, + MAX(CASE WHEN ee.field_name = 'reason_for_exit' THEN ee.new_value END) AS reason_for_exit, + MAX(CASE WHEN ee.field_name = 'status' THEN ee.new_value END) AS status + FROM + emp_endorsement AS ee + JOIN + employee_polices AS ep ON ep.id = ee.pk + WHERE + ee.emp_code = '$emp_code' + AND ep.client_policy_id = $client_policy_id + AND ee.name = '$emp_name' + AND ee.field_name IN ('date_of_exit', 'reason_for_exit', 'status') + GROUP BY + ee.emp_code, ee.name, ep.id"; + + // Execute the raw SQL query + $query = $this->db->query($sql); + + // Fetch and return results + return $row = $query->getRowArray(); + } //------------------------------------------------------------------ } diff --git a/app/Views/employee_upload.php b/app/Views/employee_upload.php index 97d9fdbb..0ab75ae1 100644 --- a/app/Views/employee_upload.php +++ b/app/Views/employee_upload.php @@ -110,7 +110,6 @@ $('#file_upload').hide(); - // Declare a global variable to store API response data var clientPolicies = []; diff --git a/app/Views/insurer_or_tpa_data.php b/app/Views/insurer_or_tpa_data.php index 3a2af61c..b3318f13 100644 --- a/app/Views/insurer_or_tpa_data.php +++ b/app/Views/insurer_or_tpa_data.php @@ -1,4 +1,4 @@ -
+
diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php index a86cdd40..9034e889 100644 --- a/app/Views/policy_grid.php +++ b/app/Views/policy_grid.php @@ -82,7 +82,7 @@ } grid_html = ` -
+
@@ -773,7 +773,6 @@ Count++; var container = document.getElementById('grid_content_input'); - if(ui_type == '1_1' || ui_type == '1_1_1' || ui_type == '1_1_1_1') { if (ui_type == '1_1_1' || ui_type == '1_1_1_1') { @@ -791,7 +790,8 @@
-
`; +
+
`; // return html; }else{ html =`
From fcdd187fcc8f185b840de84c127ff4b9959c7d7a Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Thu, 21 Mar 2024 10:01:39 +0530 Subject: [PATCH 24/32] CHANGE_CLIENT_CONTROLLER_TERMS_VALUE_COMMA_REMOVE_ : AADHAVAN --- app/Config/Routes.php | 1 + app/Controllers/ClientController.php | 122 +++++++++++++++++---------- app/Views/policy_grid.php | 4 - 3 files changed, 77 insertions(+), 50 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 95e4900d..b14c375b 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -214,6 +214,7 @@ $routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfi +$routes->post("employeeUpload", "EmployeeRestController::employeeUpload"); $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){ $routes->post("employeeUpload", "EmployeeRestController::employeeUpload"); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 392f362e..775090ac 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -833,8 +833,10 @@ class ClientController extends AdminController $client_policy_id = $this->request->getGet('client_policy_id'); $record = $this->clientPolicyModel->where('id', $client_policy_id)->first(); - - $family_floater=json_decode($record['policy_terms'])->family_floater; + $family_floater =''; + if (isset(json_decode($record['policy_terms'])->family_floater)) { + $family_floater=json_decode($record['policy_terms'])->family_floater; + } $emp_count = $this->employeeModel ->join('client_policy cp',"employees.client_id = cp.client_id") ->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id") @@ -865,6 +867,10 @@ class ClientController extends AdminController }else{ $premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll(); } + // echo $record['client_id']; + // echo "-----"; + // echo $client_policy_id; + // print_r($premiumData);die; // echo '
';
         // echo $family_floater;
         $resultss = [];
@@ -876,19 +882,43 @@ class ClientController extends AdminController
                     $resultss[$index] = $record; 
                 }
             }
-        }else{
+        }else if($family_floater == 0){
             foreach ($results as $index => $record) {
                 if ($index == '0' || $index == '1' || $index == '2' || $index == '3' || $index == '4' || $index == '5' || $index == '6') {
                     // Clearing the $results array
                    $resultss[$index] = $record; 
                }
             }
+        }else{
+            foreach ($results as $index => $record) {
+                $resultss[$index] = $record; 
+            }
         }
+        $premiumDataa ='';
+        if ($family_floater == 0) {
+            // print_r($premiumData);die;
+            if (count($premiumData) == 0) {
+                $premiumDataa = $premiumData;
+            }else if ($premiumData[0]['policy_grid_id'] == '3' || $premiumData[0]['policy_grid_id'] == '4' || $premiumData[0]['policy_grid_id'] == '5' || $premiumData[0]['policy_grid_id'] == '6' || $premiumData[0]['policy_grid_id'] == '7' || $premiumData[0]['policy_grid_id'] == '8' || $premiumData[0]['policy_grid_id'] == '9' ) {
+                $premiumDataa = $premiumData;
+            }
+        } 
+        else if($family_floater == 1){
+            if(count($premiumData) == 0){
+                $premiumDataa = $premiumData;
+            }else if ($premiumData[0]['policy_grid_id'] == '10' || $premiumData[0]['policy_grid_id'] == '11') {
+                $premiumDataa = $premiumData;
+            }
+        }else{
+            $premiumDataa = $premiumData;
+        }
+        
+        // print_r($premiumData);die;
 
         // print_r($data[0]->policy_type); die;
                     // echo "hello";
             // return json_encode($premiumData);
-        return $this->respond(['status' => true,'code' => 200,'data' => $resultss, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name,], 200);
+        return $this->respond(['status' => true,'code' => 200,'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name,], 200);
 
     }
 
@@ -903,7 +933,7 @@ class ClientController extends AdminController
             /*** Client Policy Table Primary Key(ID) ***/
             $client_policy_id = $this->request->getPost("client_policy_id");
 
-            $data['sum_insured']   =$this->request->getPost("sum_insured");
+            $data['sum_insured']   =str_replace(',', '',$this->request->getPost("sum_insured"));
             $data['family_floater']   =$this->request->getPost("family_floater");
                 $data['corporatebuffer'] = $this->request->getPost("corporatebuffer");
                 $data['family_floaters'] = $this->request->getPost("family_floaters") ?? [];                
@@ -913,49 +943,49 @@ class ClientController extends AdminController
                 }
             $data['waiverofpreexistingdiseases']   =$this->request->getPost("waiverofpreexistingdiseases");
             if ($data['waiverofpreexistingdiseases'] == 1) {
-                $data['maternitycoverage']   =$this->request->getPost("maternitycoverage");
-                $data['twindelivery']   =$this->request->getPost("twindelivery");
-                $data['preandpostnatal']   =$this->request->getPost("preandpostnatal");
-                $data['babyday1cover']   =$this->request->getPost("babyday1cover");
+                $data['maternitycoverage']   =str_replace(',', '',$this->request->getPost("maternitycoverage"));
+                $data['twindelivery']   =str_replace(',', '',$this->request->getPost("twindelivery"));
+                $data['preandpostnatal']   =str_replace(',', '',$this->request->getPost("preandpostnatal"));
+                $data['babyday1cover']   =str_replace(',', '',$this->request->getPost("babyday1cover"));
             }else{
                 $data['maternitycoverage']   ="";
                 $data['twindelivery']   ="";
                 $data['preandpostnatal']   ="";
                 $data['babyday1cover']   ="";
             }
-            $data['9monthwaitingperiodwaived'] =$this->request->getPost("9monthwaitingperiodwaived");
-            $data['coverfromthedateofjoining'] =$this->request->getPost("coverfromthedateofjoining");
+            $data['9monthwaitingperiodwaived'] =str_replace(',', '',$this->request->getPost("9monthwaitingperiodwaived"));
+            $data['coverfromthedateofjoining'] =str_replace(',', '',$this->request->getPost("coverfromthedateofjoining"));
             $data['waiverof1,2,3&4thyearexclusions'] =$this->request->getPost("waiverof1,2,3&4thyearexclusions");
             $data['waiverof30dayswaitingperiod'] =$this->request->getPost("waiverof30dayswaitingperiod");
-            $data['prehospitalizationcover'] =$this->request->getPost("prehospitalizationcover");
+            $data['prehospitalizationcover'] =str_replace(',', '',$this->request->getPost("prehospitalizationcover"));
             // $data['posthospitalizationcover'] =$this->request->getPost("posthospitalizationcover");
-            $data['congenitaldiseasesinternal'] =$this->request->getPost("congenitaldiseasesinternal");
+            $data['congenitaldiseasesinternal'] =str_replace(',', '',$this->request->getPost("congenitaldiseasesinternal"));
             // $data['congenitaldiseasesexternal'] =$this->request->getPost("congenitaldiseasesexternal");
             $data['copayzonewisecopay'] =$this->request->getPost("copayzonewisecopay");
             $data['bioabsorbablestenttoriclensmultifocallens'] =$this->request->getPost("bioabsorbablestenttoriclensmultifocallens");
-            $data['roomrentlimit'] =$this->request->getPost("roomrentlimit");
-            $data['proportionatedeductionclause'] =$this->request->getPost("proportionatedeductionclause");
-            $data['nursingallowance'] =$this->request->getPost("nursingallowance");
-            $data['ailmentcapping'] =$this->request->getPost("ailmentcapping");
-            $data['ambulancecharges'] =$this->request->getPost("ambulancecharges");
-            $data['airambulance'] =$this->request->getPost("airambulance");
-            $data['familytransportationbenefit'] =$this->request->getPost("familytransportationbenefit");
-            $data['reasonableandcustomarycharges'] =$this->request->getPost("reasonableandcustomarycharges");
-            $data['ayudhtreatmentcover'] =$this->request->getPost("ayudhtreatmentcover");
-            $data['armdcovered'] =$this->request->getPost("armdcovered");
-            $data['suminsuredenhancement'] =$this->request->getPost("suminsuredenhancement");
-            $data['automaticsuminsuredreinstatement'] =$this->request->getPost("automaticsuminsuredreinstatement");
-            $data['additionalsicknessbenefit'] =$this->request->getPost("additionalsicknessbenefit");
-            $data['lasiksurgery'] =$this->request->getPost("lasiksurgery");
-            $data['midterminclusion'] =$this->request->getPost("midterminclusion");
-            $data['capd'] =$this->request->getPost("capd");
-            $data['organdonorexpenses'] =$this->request->getPost("organdonorexpenses");
-            $data['moderntreatmentsasperirdai'] =$this->request->getPost("moderntreatmentsasperirdai");
-            $data['Wellness'] =$this->request->getPost("Wellness");
-            $data['days_of_discharge'] =$this->request->getPost("days_of_discharge");
-            $data['days_from_dod'] =$this->request->getPost("days_from_dod");
-            $data['special_condition_label'] = $this->request->getPost("special_condition_label") ?? [];
-            $data['special_condition_input'] = $this->request->getPost("special_condition_input") ?? [];
+            $data['roomrentlimit'] =str_replace(',', '',$this->request->getPost("roomrentlimit"));
+            $data['proportionatedeductionclause'] =str_replace(',', '',$this->request->getPost("proportionatedeductionclause"));
+            $data['nursingallowance'] =str_replace(',', '',$this->request->getPost("nursingallowance"));
+            $data['ailmentcapping'] =str_replace(',', '',$this->request->getPost("ailmentcapping"));
+            $data['ambulancecharges'] =str_replace(',', '',$this->request->getPost("ambulancecharges"));
+            $data['airambulance'] =str_replace(',', '',$this->request->getPost("airambulance"));
+            $data['familytransportationbenefit'] =str_replace(',', '',$this->request->getPost("familytransportationbenefit"));
+            $data['reasonableandcustomarycharges'] =str_replace(',', '',$this->request->getPost("reasonableandcustomarycharges"));
+            $data['ayudhtreatmentcover'] =str_replace(',', '',$this->request->getPost("ayudhtreatmentcover"));
+            $data['armdcovered'] =str_replace(',', '',$this->request->getPost("armdcovered"));
+            $data['suminsuredenhancement'] =str_replace(',', '',$this->request->getPost("suminsuredenhancement"));
+            $data['automaticsuminsuredreinstatement'] =str_replace(',', '',$this->request->getPost("automaticsuminsuredreinstatement"));
+            $data['additionalsicknessbenefit'] =str_replace(',', '',$this->request->getPost("additionalsicknessbenefit"));
+            $data['lasiksurgery'] =str_replace(',', '',$this->request->getPost("lasiksurgery"));
+            $data['midterminclusion'] =str_replace(',', '',$this->request->getPost("midterminclusion"));
+            $data['capd'] =str_replace(',', '',$this->request->getPost("capd"));
+            $data['organdonorexpenses'] =str_replace(',', '',$this->request->getPost("organdonorexpenses"));
+            $data['moderntreatmentsasperirdai'] =str_replace(',', '',$this->request->getPost("moderntreatmentsasperirdai"));
+            $data['Wellness'] =str_replace(',', '',$this->request->getPost("Wellness"));
+            $data['days_of_discharge'] =str_replace(',', '',$this->request->getPost("days_of_discharge"));
+            $data['days_from_dod'] =str_replace(',', '',$this->request->getPost("days_from_dod"));
+            $data['special_condition_label'] = str_replace(',', '',$this->request->getPost("special_condition_label")) ?? [];
+            $data['special_condition_input'] = str_replace(',', '',$this->request->getPost("special_condition_input")) ?? [];
 
 
                 $jsonData = json_encode($data);
@@ -1023,14 +1053,14 @@ class ClientController extends AdminController
             /*** Client Policy Table Primary Key(ID) ***/
             $client_policy_id = $this->request->getPost("client_policy_id");
 
-            $data['sumInsured2']   =$this->request->getPost("sumInsured2");
-            $data['totalSumInsured'] =$this->request->getPost("totalSumInsured");
-            $data['accidentalDeathBenefit'] =$this->request->getPost("accidentalDeathBenefit");
-            $data['permanentTotalDisablement'] =$this->request->getPost("permanentTotalDisablement");
+            $data['sumInsured2']   =str_replace(',', '', $this->request->getPost("sumInsured2"));
+            $data['totalSumInsured'] =str_replace(',', '',$this->request->getPost("totalSumInsured"));
+            $data['accidentalDeathBenefit'] =str_replace(',', '',$this->request->getPost("accidentalDeathBenefit"));
+            $data['permanentTotalDisablement'] =str_replace(',', '',$this->request->getPost("permanentTotalDisablement"));
             $data['permanentPartialDisablement'] =$this->request->getPost("permanentPartialDisablement");
             $data['temporaryTotalDisablementBenefit'] =$this->request->getPost("temporaryTotalDisablementBenefit");
-            $data['accidentalHospitalizationExpenses'] =$this->request->getPost("accidentalHospitalizationExpenses");
-            $data['childrenEducationWelfareFund'] =$this->request->getPost("childrenEducationWelfareFund");
+            $data['accidentalHospitalizationExpenses'] =str_replace(',', '',$this->request->getPost("accidentalHospitalizationExpenses"));
+            $data['childrenEducationWelfareFund'] =str_replace(',', '',$this->request->getPost("childrenEducationWelfareFund"));
 
             $data['compassionateVisitExpenses']   =$this->request->getPost("compassionateVisitExpenses");
             if ($data['compassionateVisitExpenses'] == 1) {
@@ -1039,16 +1069,16 @@ class ClientController extends AdminController
                 $data['compassionateVisitExpensesData']   ="";
             }
 
-            $data['brokenBoneExpenses']   = $this->request->getPost("brokenBoneExpenses");
+            $data['brokenBoneExpenses']   = str_replace(',', '',$this->request->getPost("brokenBoneExpenses"));
             if ($data['brokenBoneExpenses'] == 1) {
-                $data['brokenBoneExpensesData']   = $this->request->getPost("brokenBoneExpensesData");
+                $data['brokenBoneExpensesData']   = str_replace(',', '',$this->request->getPost("brokenBoneExpensesData"));
             }else{
                 $data['brokenBoneExpensesData']   ="";
             }
 
-            $data['ambulanceCharges']   =$this->request->getPost("ambulanceCharges");
+            $data['ambulanceCharges']   =str_replace(',', '',$this->request->getPost("ambulanceCharges"));
             if ($data['ambulanceCharges'] == 1) {
-                $data['ambulanceChargesData']   =$this->request->getPost("ambulanceChargesData");
+                $data['ambulanceChargesData']   =str_replace(',', '',$this->request->getPost("ambulanceChargesData"));
             }else{
                 $data['ambulanceChargesData']   ="";
             }
diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php
index 4d95a66c..64af741e 100644
--- a/app/Views/policy_grid.php
+++ b/app/Views/policy_grid.php
@@ -780,10 +780,6 @@
                                 
                         
`; - } - else if(ui_type == '1_2' ) - { - } else if(ui_type == '3'){ From 16a730b3c553b044e08d8f2ff467f0246985a93a Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 21 Mar 2024 17:09:28 +0530 Subject: [PATCH 25/32] CHANGE_CLIENT_ONBOARDING_ADD_CLIENT_LOGO_IS_DOWNLOAD_BTN_POLICY_IS_ADDON : RV --- app/Controllers/ClientController.php | 13 ++- app/Controllers/EmpDataServiceController.php | 42 ++++----- app/Controllers/EmployeeController.php | 10 +-- app/Helpers/utility_helper.php | 37 ++++++-- app/Models/ClientModel.php | 2 + app/Models/ClientPolicyModel.php | 1 + app/Views/client_basic_info.php | 89 ++++++++++++++++++++ app/Views/client_policy.php | 21 ++++- 8 files changed, 177 insertions(+), 38 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 392f362e..b53251e2 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -230,8 +230,10 @@ class ClientController extends AdminController { $this->myLogger->logme('error','Client general info function called'); + $file_name = file_Upload($this->request->getFile('client_logo')); $data = $this->request->getPost(); $data['created_by'] = get_session_userid(); + $data['client_logo'] = $file_name; $insert = $this->clientModel->insert($data); if($insert){ $client_data = $this->clientModel->where(['id' => $insert, 'is_active' => 1])->first(); @@ -246,9 +248,13 @@ class ClientController extends AdminController public function editClientGeneralInfo() { $this->myLogger->logme('error','edit client general info function called'); + $file_name = file_Upload($this->request->getFile('client_logo')); $id = $this->request->getPost('PrimaryKey'); $data = $this->request->getPost(); $data['updated_by'] = get_session_userid(); + if(!empty($file_name)){ + $data['client_logo'] = $file_name; + } $update = $this->clientModel->update($id,$data); if($update){ return $this->respond(['status' => true,'code' => 200,'data' => $data], 200); @@ -511,6 +517,8 @@ class ClientController extends AdminController $data['claims_experience_for_last_3_years'] = $this->request->getPost('claims_experience_for_last_3_years'); $data['earned_premium_amount'] = $this->request->getPost('earned_premium_amount'); $data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount'); + $data['is_addon'] = $this->request->getPost('is_addon'); + @@ -565,6 +573,7 @@ class ClientController extends AdminController $data['claims_experience_for_last_3_years'] = $this->request->getPost('claims_experience_for_last_3_years'); $data['earned_premium_amount'] = $this->request->getPost('earned_premium_amount'); $data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount'); + $data['is_addon'] = $this->request->getPost('is_addon'); $data['updated_by'] = get_session_userid(); $insert = $this->clientPolicyModel->update($id,$data); @@ -583,7 +592,7 @@ class ClientController extends AdminController public function createClientPolicyPremium() { - try { + try { $policy_type = $this->request->getPost('policy_type'); $client_id = $this->request->getPost('client_id'); $client_policy_id = $this->request->getPost('client_policy_id'); @@ -767,7 +776,7 @@ class ClientController extends AdminController }else{ return $this->respond(['status' => false,'code' => 404, 'data' => $data,'message' => 'no data found'], 200); } - } catch (Exception $e) { + } catch (\Exception $e) { // Handle exceptions here echo 'Error: ' . $e->getMessage(); } diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index b74999c9..09493bbf 100644 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -16,6 +16,7 @@ use App\Models\FileModel; use App\Models\BatchListModel; use App\Models\BatchFileModel; use App\Models\EmpEndorsementModel; +use App\Models\ClientDepositModel; use App\Controllers\Jobs ; use PhpOffice\PhpSpreadsheet\Spreadsheet; @@ -32,6 +33,7 @@ class EmpDataServiceController extends BaseController protected $batchListModel; protected $batchFileModel; protected $empEndorsementModel; + protected $clientDepositModel; public function __construct() { @@ -46,6 +48,7 @@ class EmpDataServiceController extends BaseController $this->batchListModel = new BatchListModel(); $this->batchFileModel = new BatchFileModel(); $this->empEndorsementModel = new EmpEndorsementModel(); + $this->clientDepositModel = new ClientDepositModel(); } @@ -366,32 +369,31 @@ class EmpDataServiceController extends BaseController public function cashDepositCalculationForInception($arrayData = []) { - $arrayData = array( - array( - 0 => 6, - 1 => 10, - 2 => 17, - 3 => 101, - 4 => 102 - ), - ); + if (!empty($arrayData)) { + $query = $this->employeePolicyModel->query(" + SELECT SUM(rata_premimum + gst) AS total_sum + FROM employee_polices + WHERE id IN (" . implode(',', $arrayData) . ") + "); + $row = $query->getRow(); + $ + $insert = $this->clientDepositModel->insert(); + $query = $this->clientDepositModel->orderBy('id', 'DESC')->limit(1)->get(); + $cashDepositLastEntry = $query->getRow(); - // Flatten the array to get all IDs in a single array - $idArray = call_user_func_array('array_merge', $arrayData); + print_r($cashDepositLastEntry); die; - // Select from the employee_policy table where the id is in the $idArray - $results = $this->employeePolicyModel - ->select('employee_polices.pro_rata_premium') - ->whereIn('id', $idArray) - ->get() - ->getResultArray(); + + return $row ? $row->total_sum : 0; + + } else { + return 0; + } - // Output the results - print_r($results); die; } - public function cashDepositCalculationForSIEnhancement($arrayData) + public function cashDepositCalculationForSIEnhancement($arrayData = []) { } diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index d04be584..67e5f6b5 100644 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -399,11 +399,11 @@ class EmployeeController extends AdminController } $action = ['action' => 'inception']; - $depositeData = [ - $employeeIds, - $action - ]; - $empDataServiceController->cashDepositCalculationForInception(); + // $depositeData = [ + // $employeeIds, + // ]; + // print_r($employeeIds); die; + $empDataServiceController->cashDepositCalculationForInception($employeeIds); // echo '
';
                 // print_r($depositeData); die;
                 
diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php
index 34ede33e..ce5de4c4 100644
--- a/app/Helpers/utility_helper.php
+++ b/app/Helpers/utility_helper.php
@@ -44,32 +44,53 @@ if (!function_exists('change_date_format')) {
 }
 
 if (!function_exists('file_Upload')) {
-    
     function file_Upload($fileToUpload, $imageDetails = null)
     {
-        $fileName = $fileToUpload->getClientName();
-        if ($fileToUpload !== NULL && $fileName !== "") {
+        // Retrieve the name of the file
+        $fileName = $fileToUpload->getName();
+
+        // Check if the file is not null and has a name
+        if ($fileToUpload !== null && $fileName !== "") {
+            // Check if the file is valid and has not been moved already
             if ($fileToUpload->isValid() && !$fileToUpload->hasMoved()) {
-                // Check if the image exists in the upload folder
-                $existingImagePath = ROOTPATH . 'public/uploads/' . $imageDetails; // Adjust filename field based on your database structure
+                // Construct the path where the image should exist
+                $existingImagePath = ROOTPATH . 'public/uploads/logo/' . $imageDetails;
                 
+                // Check if imageDetails is not null and if the image exists in the upload folder
                 if ($imageDetails !== null && file_exists($existingImagePath)) {
                     // If the image exists, delete it
                     unlink($existingImagePath);
                 }
-        
+                
                 // Move the new image to the upload folder
-                $fileToUpload->move(ROOTPATH . 'public/uploads', $fileName);
+                $fileToUpload->move(ROOTPATH . 'public/uploads/logo', $fileName);
             }
         } else {
+            // Set fileName to empty string if file is null or doesn't have a name
             $fileName = "";
         }
         
+        // Return the file name
         return $fileName;
-        
     }
 }
 
+if (!function_exists('compressImage')) {
+    function compressImage($file, $destinationPath, $newWidth = 100, $newHeight = 100)
+    {
+        // Load the image manipulation library
+        $image = \Config\Services::image();
+
+        // Resize and compress the image
+        $image->withFile($file)
+              ->fit($newWidth, $newHeight, 'center')
+              ->save($destinationPath);
+
+        return true;
+    }
+}
+
+
 if (!function_exists('fancy_date_time_format')) 
 {
     function fancy_date_time_format($datetime,$return_type = 'fancy') {
diff --git a/app/Models/ClientModel.php b/app/Models/ClientModel.php
index 3ccf26a1..25a5249d 100644
--- a/app/Models/ClientModel.php
+++ b/app/Models/ClientModel.php
@@ -21,6 +21,8 @@ class ClientModel extends Model
         "city",
         "state",
         "pincode",
+        "is_download_btn",
+        "client_logo",
         "created_by",
         "updated_by",
         "is_active",
diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php
index b8dbc9d9..ff437dc1 100644
--- a/app/Models/ClientPolicyModel.php
+++ b/app/Models/ClientPolicyModel.php
@@ -33,6 +33,7 @@ class ClientPolicyModel extends Model
         "claims_incurred_amount",
         "policy_terms",
         "open_for_enrollment",
+        "is_addon",
         "created_by",
         "updated_by",
         "Is_active",
diff --git a/app/Views/client_basic_info.php b/app/Views/client_basic_info.php
index e743434f..278938f6 100644
--- a/app/Views/client_basic_info.php
+++ b/app/Views/client_basic_info.php
@@ -103,6 +103,21 @@
                             
+
+
+ +
+ Image dimensions 100 x 100 pixels and size of 200KB. +
+
+ " width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar"/> +
+
+ +
+ > + +
+
+ + +
-
+ -
- +
+ +
@@ -246,6 +251,8 @@ processData: false, contentType: false, success: function(res) { + + console.log(res); if (res.status === false) { toastr.error('Policy Dose Not Create', 'Error'); @@ -365,6 +372,8 @@ type: "GET", dataType: 'json', success: function (res) { + console.log(res) + setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); @@ -392,6 +401,12 @@ $('#policy_status').val(checkDateStatus(res.data.policy_end_date)); $('#policy_status_field').show(); + if (res.data.is_addon == 1) { + $('#is_addon').prop('checked', true); + } else { + $('#is_addon').prop('checked', false); + } + /** do not delete this comment condition // if(res.data.policy_type_id == 1){ From f315234755460d801a2e0df70d97b7f8f95fe4ef Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Thu, 21 Mar 2024 17:13:24 +0530 Subject: [PATCH 26/32] CHANGE_EMPLOYEE_REST_CONTROLLER_FILE_UPLOAD_GPA_GMC_CHECK_AND_GRID_CHECK : AADHAVAN --- app/Controllers/EmployeeRestController.php | 71 ++++++++++++++++++---- app/Views/client_policy.php | 4 +- 2 files changed, 62 insertions(+), 13 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 51ab6236..a3a32ea9 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -17,6 +17,7 @@ use App\Models\PolicesModel; use App\Models\RelationshipModel; use App\Models\FileModel; use App\Models\ClientPolicyModel; +use App\Models\PolicyPremium2Model; use App\Controllers\Jobs ; use App\Controllers\JobWorker ; @@ -43,6 +44,7 @@ class EmployeeRestController extends AdminController protected $policesModel; protected $relationshipModel; protected $clientPolicyModel; + protected $policyPremium2Model; public function __construct() { @@ -56,6 +58,7 @@ class EmployeeRestController extends AdminController $this->relationshipModel = new RelationshipModel(); $this->fileModel= new FileModel(); $this->clientPolicyModel = new ClientPolicyModel(); + $this->policyPremium2Model = new PolicyPremium2Model(); } @@ -483,13 +486,18 @@ class EmployeeRestController extends AdminController } } - // Upload the Sheet Data in DB + // Upload the Employee Detail in DB by Sheet Data public function employeeUpload() { $file = $this->request->getFile('file'); $client_id = $this->request->getPost('client_id'); $policy_id = $this->request->getPost('policy_id'); + $client_policy = $this->clientPolicyModel->where('id', $policy_id)->first(); + $policy = $this->policesModel->where('id', $client_policy['policy_id'])->first(); + + $policy_permium = $this->policyPremium2Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first(); + $is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); $filename = $file->getName(); $file_name_with_path = WRITEPATH."/uploads/import_excel/".$filename; @@ -567,10 +575,8 @@ class EmployeeRestController extends AdminController } } } - // print_r("Extra", $extra);die; $dataToInsert = []; $basic_cover_si= []; - // print_r($extra);die; foreach ($extra['0'] as $index => $id) { $relation =''; if ($extra['5'][$index] === 'Mother' || $extra['5'][$index] === 'Father') { @@ -624,29 +630,73 @@ class EmployeeRestController extends AdminController 'emp_status'=>'draft' ]; + + $basic_cover_si_value = ''; + + //Grid id is 10 and 11 sum insure value add only for self other grid type self sum insure is for the dependence + + if ($policy['policy_type_id'] != 1) { + if ($policy_permium['policy_grid_id'] == 10 || $policy_permium['policy_grid_id'] == 11) { + if (strtolower($extra['5'][$index]) == 'self') { + $basic_cover_si_value = $extra['9'][$index]; + }else{ + $basic_cover_si_value = null; + } + }else{ + if (strtolower($extra['5'][$index]) == 'self') { + $basic_cover_si_value = $extra['9'][$index]; + }else{ + for ($i=0; $i < count($extra['1']) ; $i++) { + + if ($extra['1'][$i] == $extra['1'][$index]) { + if (strtolower($extra['5'][$i]) == 'self') { + $basic_cover_si_value = $extra['9'][$i]; + } + } + } + } + } + } + $record2 = [ - 'basic_cover_si' => isset($extra['9'][$index]) ? $extra['9'][$index] : 0, + 'basic_cover_si' => $basic_cover_si_value, ]; + // print_r($basic_cover_si);die; $dataToInsert[] = $record; - $basic_cover_si[]= $record2; + $basic_cover_si[]= $basic_cover_si_value; } } for ($a=0; $a employeeModel->checkExistingEmpEntrollment($dataToInsert[$a]); $emp_id =0; + + $data_after_gpa_or_gmc =[]; + if ($policy['policy_type_id'] == 1) { + if (strtolower($dataToInsert[$a]['relationship']) == 'self') { + $data_after_gpa_or_gmc = $dataToInsert[$a]; + } + }else{ + $data_after_gpa_or_gmc = $dataToInsert[$a]; + } + + + if ($employee) { $emp_id =$employee['id']; $id =$emp_id; - $result = $this->employeeModel->update($id, $dataToInsert[$a]); + $result = $this->employeeModel->update($id, $data_after_gpa_or_gmc); if ($result) { $log_message = 'Update Employee - '.$employee['name'].'('.$employee['emp_code'].') with PK '.$employee['id']; $this->myLogger->logme('error',('Update - ' . $employee['id'].' - '. $employee['emp_code'] .' - '.$employee['name'])); } }else{ if ($dataToInsert[$a]['emp_code'] != 0) { - $result = $this->employeeModel->insert($dataToInsert[$a]); + $result =false; + if (count($data_after_gpa_or_gmc) != 0) { + $result = $this->employeeModel->insert($data_after_gpa_or_gmc); + } $emp_id =$result; if ($result) { $emp = $this->employeeModel->where('id', $result)->get()->getResult(); @@ -663,7 +713,7 @@ class EmployeeRestController extends AdminController 'employee_id'=>$emp_id, 'client_policy_id'=>$policy_id, 'status'=> 'draft', - 'basic_cover_si'=> $basic_cover_si[$a] + 'basic_cover_si'=>isset($basic_cover_si[$a]) ? $basic_cover_si[$a] : null ]; $employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $policy_id]); @@ -678,13 +728,12 @@ class EmployeeRestController extends AdminController //trigger // print_r($dataToInsert[$a]['email_personal']);die; - $policy = $this->clientPolicyModel->where('id', $policy_id)->first(); - $policy_name = $this->policesModel->where('id', $policy['policy_id'])->first(); + $mail = $dataToInsert[$a]['email_corporate']; $subject = 'Welcome, Employee Benefit Program Enrolment'; // $message = 'Dear ' . $dataToInsert[$a]['name'] . ",
We are glad to welcome you to the employee benefit program ," .$policy_name['name'] ."offered by your employer,


Click on the link below to review your personal and family details:
Review Details" ; $data['employee_name']=$dataToInsert[$a]['name']; - $data['policy_name']=$policy_name['name']; + $data['policy_name']=$policy['name']; $message = view('mail_welcome', $data); // if ($dataToInsert[$a]['email_corporate'] != null || $dataToInsert[$a]['email_corporate'] != '' && $dataToInsert[$a]['relationship'] == 'Self') { diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 7e7dde33..c689d787 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -282,8 +282,8 @@
From 602cceab7cfacaac3e7d26351e7ad58ef509f473 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Fri, 22 Mar 2024 10:22:23 +0530 Subject: [PATCH 27/32] CHANGE_EMPLOYEE_REST_CONTROLLER_UPDATE_KEY_CHANGE_SAVE : AADHAVAN --- app/Controllers/EmployeeRestController.php | 24 ++++++++++++++-------- app/Models/EmployeeModel.php | 10 ++++++--- app/Models/EmployeePolicyModel.php | 1 + app/Views/client_policy.php | 4 ++++ app/Views/policy_grid.php | 3 ++- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index a3a32ea9..1f26e4b9 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -631,11 +631,10 @@ class EmployeeRestController extends AdminController ]; - $basic_cover_si_value = ''; + $basic_cover_si_value = null; //Grid id is 10 and 11 sum insure value add only for self other grid type self sum insure is for the dependence - - if ($policy['policy_type_id'] != 1) { + // if ($policy['policy_type_id'] != 1) { if ($policy_permium['policy_grid_id'] == 10 || $policy_permium['policy_grid_id'] == 11) { if (strtolower($extra['5'][$index]) == 'self') { $basic_cover_si_value = $extra['9'][$index]; @@ -656,7 +655,7 @@ class EmployeeRestController extends AdminController } } } - } + // } $record2 = [ 'basic_cover_si' => $basic_cover_si_value, @@ -668,10 +667,11 @@ class EmployeeRestController extends AdminController } for ($a=0; $a employeeModel->checkExistingEmpEntrollment($dataToInsert[$a]); + $employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a]); $emp_id =0; $data_after_gpa_or_gmc =[]; + // print_r($policy);die; if ($policy['policy_type_id'] == 1) { if (strtolower($dataToInsert[$a]['relationship']) == 'self') { $data_after_gpa_or_gmc = $dataToInsert[$a]; @@ -681,12 +681,18 @@ class EmployeeRestController extends AdminController } - + date_default_timezone_set('Asia/Kolkata'); + $current_timestamp = time(); + $formatted_date_time = date('Y-m-d H:i:s', $current_timestamp); if ($employee) { + + $emp_id =$employee['id']; $id =$emp_id; - $result = $this->employeeModel->update($id, $data_after_gpa_or_gmc); + $data_after_gpa_or_gmc['id'] = $id; + $data_after_gpa_or_gmc['updated_at'] = $formatted_date_time; + $result = $this->employeeModel->save($data_after_gpa_or_gmc); if ($result) { $log_message = 'Update Employee - '.$employee['name'].'('.$employee['emp_code'].') with PK '.$employee['id']; $this->myLogger->logme('error',('Update - ' . $employee['id'].' - '. $employee['emp_code'] .' - '.$employee['name'])); @@ -719,7 +725,9 @@ class EmployeeRestController extends AdminController $employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $policy_id]); if ($employee_policy) { foreach ($employee_policy as $existing_policy) { - $this->employeePolicyModel->update($existing_policy['id'], $emp_policy_data); + $emp_policy_data['id']= $existing_policy['id']; + $emp_policy_data['updated_at'] = $formatted_date_time; + $this->employeePolicyModel->save($emp_policy_data); } } else { $emp_policy = $this->employeePolicyModel->insert($emp_policy_data); diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index 09eeb13d..5a564363 100644 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -29,6 +29,7 @@ class EmployeeModel extends Model "emp_status", "created_by", "updated_by", + "updated_at", "is_active", ]; @@ -51,9 +52,12 @@ class EmployeeModel extends Model // for EMP rest API process do not change - public function checkExistingEmpEntrollment($arr) - { - return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->first(); + public function checkExistingEmployee($arr) + { + return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->where('client_id', $arr['client_id'])->first(); } + + + } diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 6ac9eeb7..2eadf306 100644 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -29,6 +29,7 @@ class EmployeePolicyModel extends Model "gst", "created_by", "updated_by", + "updated_at", "is_active", ]; diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 496e9347..9c61f294 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -753,6 +753,10 @@ } convertCommaNumberToWords(input); + if (input.id == 'gpa_sum_si') { + gpaSumInsureMultiplier(input); + } + // if(input.id == 'basic_pay'){ // var inputNumber = input.value; // if (inputNumber) { diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php index 64af741e..8cc5b360 100644 --- a/app/Views/policy_grid.php +++ b/app/Views/policy_grid.php @@ -1424,7 +1424,8 @@ } } - function gpaSumInsureMultiplier() { + function gpaSumInsureMultiplier(element) { + console.log(element); var element = $('#gpa_sum_multiplier')[0]; var sumInsured = $('input[name="gpa_sum_si[]"]'); From b42704f25d59a4807dad808f7af129a46aeee2c9 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 22 Mar 2024 10:39:40 +0530 Subject: [PATCH 28/32] FIX_CLIENT_BRANCH_MOBILE_VALIDATAION : RV --- app/Views/client_branch.php | 14 ++++++++++---- app/Views/client_policy.php | 13 +++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/app/Views/client_branch.php b/app/Views/client_branch.php index 69e76287..c050dbc6 100644 --- a/app/Views/client_branch.php +++ b/app/Views/client_branch.php @@ -88,7 +88,7 @@
- +
@@ -97,7 +97,7 @@
- +
@@ -293,7 +293,6 @@ $(document).ready(function () { }); - $('body').on('click', '.btnBranchEdit', function () { console.log(branch_form_action); @@ -352,6 +351,13 @@ $(document).ready(function () { }); + $("#remove_btn").click(function(){ + $("#name").val(''); + $("#email").val(''); + $("#mobile").val(''); + $("#designation").val(''); + }) + // Initialize the contact count function appendContactHtml(contact = false, reset = false) { @@ -379,7 +385,7 @@ $(document).ready(function () {
- +
diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index bdbb763b..310e6bda 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -160,6 +160,12 @@ $('#table_list').hide(); $('.btnBack').show(); $('.btnAdd').hide(); + $('#insurer').val(''); + $('#tpa').val(''); + $('#start_date').val(''); + $('#end_date').val(''); + $('#policy').html(''); + $('#is_addon').prop('checked', false); $('#policy_form_action').val(''); }) @@ -299,6 +305,13 @@ `; }); $('#policy_table').append(policyTable); + + $('#insurer').val(''); + $('#tpa').val(''); + $('#start_date').val(''); + $('#end_date').val(''); + $('#policy').html(''); + $('#is_addon').prop('checked', false); }, error: function(xhr, status, error) { console.error(xhr.responseText); From c51c07ce633e3db2a790f094674e1f2ea08d8f57 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 22 Mar 2024 13:30:55 +0530 Subject: [PATCH 29/32] FIX_RAC_RATE_CLIENT_ID_SET : RV --- app/Controllers/ClientController.php | 4 ++++ app/Views/client_basic_info.php | 5 ++++- app/Views/client_policy.php | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index d2788578..b83853fc 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -596,6 +596,10 @@ class ClientController extends AdminController $policy_type = $this->request->getPost('policy_type'); $client_id = $this->request->getPost('client_id'); $client_policy_id = $this->request->getPost('client_policy_id'); + if(!empty($client_id) && $client_id != null){ + $client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first(); + $client_id = $client_policy_data['client_id']; + } $policy_grid_id = $this->request->getPost('policy_grid_id'); $si_or_bp = $this->request->getPost('si_or_bp'); $basic_multiplier = str_replace(',', '', $this->request->getPost('basic_multiplier')); diff --git a/app/Views/client_basic_info.php b/app/Views/client_basic_info.php index 278938f6..562b3ae1 100644 --- a/app/Views/client_basic_info.php +++ b/app/Views/client_basic_info.php @@ -203,8 +203,11 @@ $(document).ready(function () { $('#policy_PrimaryKey').val(res.data.id); $('#client_id_kyc').val(res.data.id); $('#kyc_PrimaryKey').val(res.data.id); + $('#Client_id').val(res.data.id); $('#entity_type').val(res.data.entity_type_id); + + var client_id_for_file = res.data.id; console.log() if(PrimaryKey === ''){ @@ -226,7 +229,7 @@ $(document).ready(function () {
- +
diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 0fdda4d3..5f8e1cef 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -294,10 +294,10 @@ From 2e79864c4069d7c0a7122c31a95c5f509f5b3fc4 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Sat, 23 Mar 2024 08:48:43 +0530 Subject: [PATCH 30/32] FIX_SHOW_LOGED_NAME_IN_HEADER : RV --- app/Controllers/LoginController.php | 2 +- app/Helpers/session_helper.php | 9 +++++++++ app/Views/layout/header.php | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/Controllers/LoginController.php b/app/Controllers/LoginController.php index c24f4ddc..cb86e2fd 100644 --- a/app/Controllers/LoginController.php +++ b/app/Controllers/LoginController.php @@ -42,7 +42,7 @@ class LoginController extends BaseController if($user){ if($user->is_active !== '0'){ - $session_data = ['isLoggedIn' => True ,'userid' => $user->id]; + $session_data = ['isLoggedIn' => True ,'userid' => $user->id, 'userData' => $user]; set_session_data($session_data); log_message('error', 'Set The UserId : `'. $user->id .'` in Session'); log_message('error', 'User Login Sucessfully'); diff --git a/app/Helpers/session_helper.php b/app/Helpers/session_helper.php index b42f04e7..29255bcc 100644 --- a/app/Helpers/session_helper.php +++ b/app/Helpers/session_helper.php @@ -19,6 +19,15 @@ if (!function_exists('get_session_userid')) { } } +if (!function_exists('get_session_userdata')) { + function get_session_userdata() + { + // $ci =& get_instance(); + $session = \Config\Services::session(); + return $session->get('userData'); + } +} + if (!function_exists('get_session_user')) { function get_session_user() { diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index f69de0f3..66cfab3d 100644 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -393,8 +393,8 @@
-
-
- Self - Spouse - Child 1 - Child 2 - Child 3 - Child 4 +
+
+ Self: + + Spouse: +
- Parent 1 - Parent 2 - Parent-In-Law 1 - Parent-In-Law 2 + Children: + +
+
+ Select Other Members: +
@@ -683,12 +698,37 @@ var grid_html = ''; if (key.includes("family_floaters")) { let checkboxes = document.querySelectorAll(`input[name="${key}[]"]`); if (jsonObject[key]) { - jsonObject[key].forEach(element => { - let checkbox = $(`#${element}`); - if (checkbox.is(":checkbox")) { - checkbox.prop("checked", true); - } - }); + console.log(jsonObject[key]); + if (jsonObject[key].childrens) { + $('#children').val(jsonObject[key].childrens); + } + + if (jsonObject[key].self == 0) { + $('#self').prop('checked', false); + } + + if (jsonObject[key].spouse == 0) { + $('#spouse').prop('checked', false); + }else{ + $('#spouse').prop('checked', true); + } + + + if(jsonObject[key]['either-parents-pil'] == 1){ + $('#family_floaters').val('EPORPIL'); + }else if(jsonObject[key].parents == 1 && jsonObject[key]['parents-in-law'] == 1){ + $('#family_floaters').val('2EPORPIL'); + }else if(jsonObject[key].parents == 2 && jsonObject[key]['parents-in-law'] == 2){ + $('#family_floaters').val('4EPORPIL'); + }else if(jsonObject[key].parents == 1){ + $('#family_floaters').val('1P'); + }else if(jsonObject[key].parents == 2){ + $('#family_floaters').val('2P'); + }else if(jsonObject[key]['parents-in-law'] == 1){ + $('#family_floaters').val('1PIL'); + }else if(jsonObject[key]['parents-in-law'] == 2){ + $('#family_floaters').val('2PIL'); + } } } diff --git a/app/Views/swagger/index.php b/app/Views/swagger/index.php new file mode 100644 index 00000000..865b2a23 --- /dev/null +++ b/app/Views/swagger/index.php @@ -0,0 +1,60 @@ + + + + + + + Swagger UI + + + + + + + +
+ + + + + + + \ No newline at end of file diff --git a/composer.json b/composer.json index e0f50cfa..77501e0f 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ "phpmailer/phpmailer": "^6.9", "phpoffice/phpspreadsheet": "^2.0", "psr/log": "^1.1", - "slim/slim": "^4.13" + "slim/slim": "^4.13", + "zircote/swagger-php": "^4.8" }, "require-dev": { "codeigniter/coding-standard": "^1.7", diff --git a/public/assets/api.yaml b/public/assets/api.yaml new file mode 100644 index 00000000..d8159bab --- /dev/null +++ b/public/assets/api.yaml @@ -0,0 +1,890 @@ +openapi: 3.0.0 +paths: + '/nhance/employeeRest/verifyEmployeeNumber': + post: + tags: + - Login + summary: 'Add a new VerifyEmployeeNumber to the store' + operationId: VerifyEmployeeNumber + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + mobile_number: + type: string + description: mobile_number + multipart/form-data: + schema: + type: object + properties: + mobile_number: + type: string + description: mobile_number + + responses: + '201': + description: 'Upload VerifyEmployeeNumber' + content: + application/json: + schema: + $ref: '#/components/schemas/VerifyEmployeeNumber' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + '/nhance/employeeRest/getVerifiedUserData': + post: + tags: + - Login + summary: ' GetVerifiedUserData' + operationId: GetVerifiedUserData + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + mobile_number: + type: string + description: mobile_number + otp: + type: string + description: otp + multipart/form-data: + schema: + type: object + properties: + mobile_number: + type: string + description: mobile_number + otp: + type: string + description: otp + responses: + '201': + description: 'GetVerifiedUserData' + content: + application/json: + schema: + $ref: '#/components/schemas/GetVerifiedUserData' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + '/nhance/employeeRest/verifyHrWithMobileNumber': + post: + tags: + - Login + summary: 'VerifyHrWithMobileNumber' + operationId: VerifyHrWithMobileNumber + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + mobile_number: + type: string + description: mobile_number + multipart/form-data: + schema: + type: object + properties: + mobile_number: + type: string + description: mobile_number + responses: + '201': + description: 'VerifyHrWithMobileNumber' + content: + application/json: + schema: + $ref: '#/components/schemas/VerifyHrWithMobileNumber' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + '/nhance/employeeRest/getVerifiedHrData': + post: + tags: + - Login + summary: ' GetVerifiedHrData' + operationId: GetVerifiedHrData + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + mobile_number: + type: string + description: mobile_number + otp: + type: string + description: otp + + multipart/form-data: + schema: + type: object + properties: + mobile_number: + type: string + description: mobile_number + otp: + type: string + description: otp + responses: + '201': + description: 'GetVerifiedHrData' + content: + application/json: + schema: + $ref: '#/components/schemas/GetVerifiedHrData' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + '/nhance/employeeRest/employeeUpload': + post: + tags: + # - EmployeeUpload + summary: 'Add a new EmployeeUpload to the store' + operationId: EmployeeUpload + parameters: + - name: auth + in: header + description: an authorization header + required: true + type: string + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + client_id: + type: integer + description: client_id + policy_id: + type: integer + description: policy_id + file: + type: string + format: binary + description: File to upload + application/json: + schema: + type: object + properties: + client_id: + type: integer + description: client_id + policy_id: + type: integer + description: policy_id + responses: + '201': + description: 'Upload EmployeeUpload' + content: + application/json: + schema: + $ref: '#/components/schemas/EmployeeUpload' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + '/nhance/getEmployeeProfile': + get: + tags: + # - EmployeeUpload + summary: 'GetEmployeeProfile' + operationId: GetEmployeeProfile + parameters: + - name: emp_code + in: query + description: an authorization header + required: true + type: string + responses: + '201': + description: 'GetEmployeeProfile' + content: + application/json: + schema: + $ref: '#/components/schemas/GetEmployeeProfile' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + '/nhance/editEmployeeProfile': + post: + tags: + # - EmployeeUpload + summary: 'EditEmployeeProfile' + operationId: EditEmployeeProfile + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The ID of the employee. + client_id: + type: string + description: The ID of the client. + relationship: + type: string + description: The relationship of the employee. + relationship_code: + type: string + description: The code representing the relationship. + change_event: + type: string + description: The change event associated with the employee. + batch_id: + type: string + description: The ID of the batch. + emp_code: + type: string + description: The code of the employee. + name: + type: string + description: The name of the employee. + email_personal: + type: string + description: The personal email of the employee. + email_corporate: + type: string + description: The corporate email of the employee. + mobile: + type: string + description: The mobile number of the employee. + gender: + type: string + description: The gender of the employee. + dob: + type: string + format: date + description: The date of birth of the employee. + doj: + type: string + format: date + description: The date of joining of the employee. + basic_pay: + type: string + description: The basic pay of the employee. + band: + type: string + description: The band of the employee. + designation: + type: string + description: The designation of the employee. + emp_status: + type: string + description: The status of the employee. + is_active: + type: string + description: Indicates if the employee is active. + file_id: + type: string + description: The ID of the file associated with the employee. + + responses: + '201': + description: 'EditEmployeeProfile' + content: + application/json: + schema: + $ref: '#/components/schemas/EditEmployeeProfile' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + '/nhance/employeeRest/relationshipList': + get: + tags: + # - EmployeeUpload + summary: 'RelationshipList' + operationId: RelationshipList + parameters: + - name: auth + in: header + description: an authorization header + required: true + type: string + responses: + '201': + description: 'RelationshipList' + content: + application/json: + schema: + $ref: '#/components/schemas/RelationshipList' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + '/nhance/employeeRest/getEmployeeAndDependence': + get: + tags: + # - EmployeeUpload + summary: 'GetEmployeeAndDependence' + operationId: GetEmployeeAndDependence + parameters: + - name: auth + in: header + description: an authorization header + required: true + type: string + - name: emp_code + in: query + description: an authorization header + required: true + type: string + responses: + '201': + description: 'GetEmployeeAndDependence' + content: + application/json: + schema: + $ref: '#/components/schemas/GetEmployeeAndDependence' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + '/nhance/employeeRest/editEmployeeAndDependence': + post: + tags: + # - EmployeeUpload + summary: 'EditEmployeeAndDependence' + operationId: EditEmployeeAndDependence + parameters: + - name: auth + in: header + description: an authorization header + required: true + type: string + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The ID of the employee. + client_id: + type: string + description: The ID of the client. + relationship: + type: string + description: The relationship of the employee. + relationship_code: + type: string + description: The code representing the relationship. + change_event: + type: string + description: The change event associated with the employee. + batch_id: + type: string + description: The ID of the batch. + emp_code: + type: string + description: The code of the employee. + name: + type: string + description: The name of the employee. + email_personal: + type: string + description: The personal email of the employee. + email_corporate: + type: string + description: The corporate email of the employee. + mobile: + type: string + description: The mobile number of the employee. + gender: + type: string + description: The gender of the employee. + dob: + type: string + format: date + description: The date of birth of the employee. + doj: + type: string + format: date + description: The date of joining of the employee. + basic_pay: + type: string + description: The basic pay of the employee. + band: + type: string + description: The band of the employee. + designation: + type: string + description: The designation of the employee. + emp_status: + type: string + description: The status of the employee. + is_active: + type: string + description: Indicates if the employee is active. + file_id: + type: string + description: The ID of the file associated with the employee. + + responses: + '201': + description: 'EditEmployeeAndDependence' + content: + application/json: + schema: + $ref: '#/components/schemas/EditEmployeeAndDependence' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + '/nhance/employeeRest/addEmployeeAndDependence': + post: + tags: + # - EmployeeUpload + summary: 'AddEmployeeAndDependence' + operationId: AddEmployeeAndDependence + parameters: + - name: auth + in: header + description: an authorization header + required: true + type: string + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + client_id: + type: string + description: The ID of the client. + relationship: + type: string + description: The relationship of the employee. + relationship_code: + type: string + description: The code representing the relationship. + change_event: + type: string + description: The change event associated with the employee. + batch_id: + type: string + description: The ID of the batch. + emp_code: + type: string + description: The code of the employee. + name: + type: string + description: The name of the employee. + email_personal: + type: string + description: The personal email of the employee. + email_corporate: + type: string + description: The corporate email of the employee. + mobile: + type: string + description: The mobile number of the employee. + gender: + type: string + description: The gender of the employee. + dob: + type: string + format: date + description: The date of birth of the employee. + doj: + type: string + format: date + description: The date of joining of the employee. + basic_pay: + type: string + description: The basic pay of the employee. + band: + type: string + description: The band of the employee. + designation: + type: string + description: The designation of the employee. + emp_status: + type: string + description: The status of the employee. + is_active: + type: string + description: Indicates if the employee is active. + file_id: + type: string + description: The ID of the file associated with the employee. + + responses: + '201': + description: 'EditEmployeeAndDependence' + content: + application/json: + schema: + $ref: '#/components/schemas/AddEmployeeAndDependence' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + '/nhance/employeeRest/getEmployeePolicy': + get: + tags: + # - EmployeeUpload + summary: 'GetEmployeePolicy' + operationId: GetEmployeePolicy + parameters: + - name: auth + in: header + description: an authorization header + required: true + type: string + - name: id + in: query + description: an authorization header + required: true + type: string + - name: emp_code + in: query + description: an authorization header + required: true + type: string + responses: + '201': + description: 'GetEmployeePolicy' + content: + application/json: + schema: + $ref: '#/components/schemas/GetEmployeePolicy' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + '/nhance/employeeRest/createOrUpdateEmployeePolicySiAmount': + post: + tags: + # - EmployeeUpload + summary: 'CreateOrUpdateEmployeePolicySiAmount' + operationId: CreateOrUpdateEmployeePolicySiAmount + parameters: + - name: auth + in: header + description: an authorization header + required: true + type: string + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + employee_id: + type: integer + description: The ID of the employee. + client_policy_id: + type: integer + description: The ID of the client. + basic_cover_si: + type: string + description: The Employee Policy. + premium: + type: string + description: The code representing the Employee Policy. + + responses: + '201': + description: 'CreateOrUpdateEmployeePolicySiAmount' + content: + application/json: + schema: + $ref: '#/components/schemas/CreateOrUpdateEmployeePolicySiAmount' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + '/nhance/employeeRest/deleteDependence': + get: + tags: + # - EmployeeUpload + summary: 'DeleteDependence' + operationId: DeleteDependence + parameters: + - name: auth + in: header + description: an authorization header + required: true + type: string + - name: id + in: query + description: an authorization header + required: true + type: string + responses: + '201': + description: 'DeleteDependence' + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteDependence' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + '/nhance/employeeRest/getEmployeeAndDependenceByClientId': + get: + tags: + # - EmployeeUpload + summary: 'GetEmployeeAndDependenceByClientId' + operationId: GetEmployeeAndDependenceByClientId + parameters: + - name: auth + in: header + description: an authorization header + required: true + type: string + - name: client_id + in: query + description: an authorization header + required: true + type: string + - name: client_policy_id + in: query + description: an authorization header + required: true + type: string + responses: + '201': + description: 'GetEmployeeAndDependenceByClientId' + content: + application/json: + schema: + $ref: '#/components/schemas/GetEmployeeAndDependenceByClientId' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + '/nhance/employeeRest/getClientPolicy': + get: + tags: + # - EmployeeUpload + summary: 'GetClientPolicy' + operationId: GetClientPolicy + parameters: + - name: auth + in: header + description: an authorization header + required: true + type: string + responses: + '201': + description: 'GetClientPolicy' + content: + application/json: + schema: + $ref: '#/components/schemas/GetClientPolicy' + '405': + description: 'Invalid input' + security: + - bearer_auth: [] + + + + + +components: + schemas: + EmployeeUpload: + title: EmployeeUpload + description: EmployeeUpload + properties: + client_id: + title: client_id + description: client_id + type: integer + policy_id: + title: policy_id + description: policy_id + type: integer + file: + title: file + description: file + type: string + format: binary + type: object + GetVerifiedUserData: + title: GetVerifiedUserData + description: GetVerifiedUserData + properties: + mobile_number: + title: mobile_number + description: mobile_number + type: string + otp: + title: otp + description: otp + type: string + type: object + VerifyEmployeeNumber: + title: VerifyEmployeeNumber + description: VerifyEmployeeNumber + properties: + mobile_number: + title: mobile_number + description: mobile_number + type: string + type: object + GetVerifiedHrData: + title: GetVerifiedHrData + description: GetVerifiedHrData + properties: + mobile_number: + title: mobile_number + description: mobile_number + type: string + otp: + title: otp + description: otp + type: string + type: object + VerifyHrWithMobileNumber: + title: VerifyHrWithMobileNumber + description: VerifyHrWithMobileNumber + properties: + mobile_number: + title: mobile_number + description: mobile_number + type: string + type: object + GetEmployeeProfile: + title: GetEmployeeProfile + description: GetEmployeeProfile + properties: + emp_code: + title: emp_code + description: emp_code + type: string + type: object + EditEmployeeProfile: + title: EditEmployeeProfile + description: EditEmployeeProfile + properties: + emp_code: + title: emp_code + description: emp_code + type: string + type: object + RelationshipList: + title: RelationshipList + description: RelationshipList + type: object + EditEmployeeAndDependence: + title: EditEmployeeAndDependence + description: EditEmployeeAndDependence + properties: + emp_code: + title: emp_code + description: emp_code + type: string + type: object + GetEmployeeAndDependence: + title: EditEmployeeAndDependence + description: EditEmployeeAndDependence + properties: + emp_code: + title: emp_code + description: emp_code + type: string + type: object + AddEmployeeAndDependence: + title: AddEmployeeAndDependence + description: AddEmployeeAndDependence + properties: + emp_code: + title: emp_code + description: emp_code + type: string + type: object + GetEmployeePolicy: + title: GetEmployeePolicy + description: GetEmployeePolicy + properties: + id: + title: id + description: id + type: integer + emp_code: + title: emp_code + description: emp_code + type: string + type: object + CreateOrUpdateEmployeePolicySiAmount: + title: CreateOrUpdateEmployeePolicySiAmount + description: CreateOrUpdateEmployeePolicySiAmount + properties: + employee_id: + title: employee_id + description: employee_id + type: integer + client_policy_id: + title: client_policy_id + description: client_policy_id + type: integer + basic_cover_si: + title: basic_cover_si + description: basic_cover_si + type: string + premium: + title: premium + description: premium + type: string + type: object + DeleteDependence: + title: DeleteDependence + description: DeleteDependence + properties: + id: + title: id + description: id + type: integer + type: object + GetEmployeeAndDependenceByClientId: + title: GetEmployeeAndDependenceByClientId + description: GetEmployeeAndDependenceByClientId + properties: + client_id: + title: client_id + description: client_id + type: integer + client_policy_id: + title: client_policy_id + description: client_policy_id + type: integer + type: object + GetClientPolicy: + title: GetClientPolicy + description: GetClientPolicy + type: object + + # securitySchemes: + # Authorization: + # type: http + # scheme: bearer + # bearerFormat: JWT \ No newline at end of file diff --git a/public/assets/swagger/favicon-16x16.png b/public/assets/swagger/favicon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..8b194e617af1c135e6b37939591d24ac3a5efa18 GIT binary patch literal 665 zcmV;K0%rY*P)}JKSduyL>)s!A4EhTMMEM%Q;aL6%l#xiZiF>S;#Y{N2Zz%pvTGHJduXuC6Lx-)0EGfRy*N{Tv4i8@4oJ41gw zKzThrcRe|7J~(YYIBq{SYCkn-KQm=N8$CrEK1CcqMI1dv9z#VRL_{D)L|`QmF8}}l zJ9JV`Q}p!p_4f7m_U`WQ@apR4;o;!mnU<7}iG_qr zF(e)x9~BG-3IzcG2M4an0002kNkl41`ZiN1i62V%{PM@Ry|IS_+Yc7{bb`MM~xm(7p4|kMHP&!VGuDW4kFixat zXw43VmgwEvB$hXt_u=vZ>+v4i7E}n~eG6;n4Z=zF1n?T*yg<;W6kOfxpC6nao>VR% z?fpr=asSJ&`L*wu^rLJ5Peq*PB0;alL#XazZCBxJLd&giTfw@!hW167F^`7kobi;( ze<<>qNlP|xy7S1zl@lZNIBR7#o9ybJsptO#%}P0hz~sBp00000NkvXXu0mjfUsDF? literal 0 HcmV?d00001 diff --git a/public/assets/swagger/favicon-32x32.png b/public/assets/swagger/favicon-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..249737fe44558e679f0b67134e274461d988fa98 GIT binary patch literal 628 zcmV-)0*n2LP)Ma*GM0}OV<074bNCP7P7GVd{iMr*I6y~TMLss@FjvgL~HxU z%Vvj33AwpD(Z4*$Mfx=HaU16axM zt2xG_rloN<$iy9j9I5 + + + + + Swagger UI + + + + + + + +
+ + + + + + diff --git a/public/assets/swagger/oauth2-redirect.html b/public/assets/swagger/oauth2-redirect.html new file mode 100644 index 00000000..a013fc82 --- /dev/null +++ b/public/assets/swagger/oauth2-redirect.html @@ -0,0 +1,68 @@ + + +Swagger UI: OAuth2 Redirect + + + + diff --git a/public/assets/swagger/swagger-ui-bundle.js b/public/assets/swagger/swagger-ui-bundle.js new file mode 100644 index 00000000..73773b75 --- /dev/null +++ b/public/assets/swagger/swagger-ui-bundle.js @@ -0,0 +1,92 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(function(){try{return require("esprima")}catch(e){}}()):"function"==typeof define&&define.amd?define(["esprima"],t):"object"==typeof exports?exports.SwaggerUIBundle=t(function(){try{return require("esprima")}catch(e){}}()):e.SwaggerUIBundle=t(e.esprima)}(window,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist",n(n.s=586)}([function(e,t,n){"use strict";e.exports=n(121)},function(e,t,n){e.exports=n(901)},function(e,t,n){e.exports=function(){"use strict";var e=Array.prototype.slice;function t(e,t){t&&(e.prototype=Object.create(t.prototype)),e.prototype.constructor=e}function n(e){return a(e)?e:z(e)}function r(e){return u(e)?e:V(e)}function o(e){return s(e)?e:W(e)}function i(e){return a(e)&&!c(e)?e:H(e)}function a(e){return!(!e||!e[f])}function u(e){return!(!e||!e[p])}function s(e){return!(!e||!e[h])}function c(e){return u(e)||s(e)}function l(e){return!(!e||!e[d])}t(r,n),t(o,n),t(i,n),n.isIterable=a,n.isKeyed=u,n.isIndexed=s,n.isAssociative=c,n.isOrdered=l,n.Keyed=r,n.Indexed=o,n.Set=i;var f="@@__IMMUTABLE_ITERABLE__@@",p="@@__IMMUTABLE_KEYED__@@",h="@@__IMMUTABLE_INDEXED__@@",d="@@__IMMUTABLE_ORDERED__@@",v={},m={value:!1},g={value:!1};function y(e){return e.value=!1,e}function b(e){e&&(e.value=!0)}function _(){}function x(e,t){t=t||0;for(var n=Math.max(0,e.length-t),r=new Array(n),o=0;o>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?w(e)+t:t}function S(){return!0}function C(e,t,n){return(0===e||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function A(e,t){return k(e,t,0)}function O(e,t){return k(e,t,t)}function k(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}var j,T,P,I="function"==typeof Symbol&&Symbol.iterator,M=I||"@@iterator";function N(e){this.next=e}function D(e,t,n,r){var o=0===e?t:1===e?n:[t,n];return r?r.value=o:r={value:o,done:!1},r}function R(){return{value:void 0,done:!0}}function L(e){return!!U(e)}function B(e){return e&&"function"==typeof e.next}function F(e){var t=U(e);return t&&t.call(e)}function U(e){var t=e&&(I&&e[I]||e["@@iterator"]);if("function"==typeof t)return t}function q(e){return e&&"number"==typeof e.length}function z(e){return null==e?Z():a(e)?e.toSeq():function(e){var t=ee(e)||"object"==typeof e&&new K(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}(e)}function V(e){return null==e?Z().toKeyedSeq():a(e)?u(e)?e.toSeq():e.fromEntrySeq():X(e)}function W(e){return null==e?Z():a(e)?u(e)?e.entrySeq():e.toIndexedSeq():Q(e)}function H(e){return(null==e?Z():a(e)?u(e)?e.entrySeq():e:Q(e)).toSetSeq()}function J(e){this._array=e,this.size=e.length}function K(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function $(e){this._iterable=e,this.size=e.length||e.size}function Y(e){this._iterator=e,this._iteratorCache=[]}function G(e){return!(!e||!e["@@__IMMUTABLE_SEQ__@@"])}function Z(){return j||(j=new J([]))}function X(e){var t=Array.isArray(e)?new J(e).fromEntrySeq():B(e)?new Y(e).fromEntrySeq():L(e)?new $(e).fromEntrySeq():"object"==typeof e?new K(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function Q(e){var t=ee(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function ee(e){return q(e)?new J(e):B(e)?new Y(e):L(e)?new $(e):void 0}function te(e,t,n,r){var o=e._cache;if(o){for(var i=o.length-1,a=0;a<=i;a++){var u=o[n?i-a:a];if(!1===t(u[1],r?u[0]:a,e))return a+1}return a}return e.__iterateUncached(t,n)}function ne(e,t,n,r){var o=e._cache;if(o){var i=o.length-1,a=0;return new N((function(){var e=o[n?i-a:a];return a++>i?{value:void 0,done:!0}:D(t,r?e[0]:a-1,e[1])}))}return e.__iteratorUncached(t,n)}function re(e,t){return t?function e(t,n,r,o){return Array.isArray(n)?t.call(o,r,W(n).map((function(r,o){return e(t,r,o,n)}))):ie(n)?t.call(o,r,V(n).map((function(r,o){return e(t,r,o,n)}))):n}(t,e,"",{"":e}):oe(e)}function oe(e){return Array.isArray(e)?W(e).map(oe).toList():ie(e)?V(e).map(oe).toMap():e}function ie(e){return e&&(e.constructor===Object||void 0===e.constructor)}function ae(e,t){if(e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if((e=e.valueOf())===(t=t.valueOf())||e!=e&&t!=t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function ue(e,t){if(e===t)return!0;if(!a(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||u(e)!==u(t)||s(e)!==s(t)||l(e)!==l(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!c(e);if(l(e)){var r=e.entries();return t.every((function(e,t){var o=r.next().value;return o&&ae(o[1],e)&&(n||ae(o[0],t))}))&&r.next().done}var o=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{o=!0;var i=e;e=t,t=i}var f=!0,p=t.__iterate((function(t,r){if(n?!e.has(t):o?!ae(t,e.get(r,v)):!ae(e.get(r,v),t))return f=!1,!1}));return f&&e.size===p}function se(e,t){if(!(this instanceof se))return new se(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(T)return T;T=this}}function ce(e,t){if(!e)throw new Error(t)}function le(e,t,n){if(!(this instanceof le))return new le(e,t,n);if(ce(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),tr?{value:void 0,done:!0}:D(e,o,n[t?r-o++:o++])}))},t(K,V),K.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},K.prototype.has=function(e){return this._object.hasOwnProperty(e)},K.prototype.__iterate=function(e,t){for(var n=this._object,r=this._keys,o=r.length-1,i=0;i<=o;i++){var a=r[t?o-i:i];if(!1===e(n[a],a,this))return i+1}return i},K.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,o=r.length-1,i=0;return new N((function(){var a=r[t?o-i:i];return i++>o?{value:void 0,done:!0}:D(e,a,n[a])}))},K.prototype[d]=!0,t($,W),$.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=F(this._iterable),r=0;if(B(n))for(var o;!(o=n.next()).done&&!1!==e(o.value,r++,this););return r},$.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=F(this._iterable);if(!B(n))return new N(R);var r=0;return new N((function(){var t=n.next();return t.done?t:D(e,r++,t.value)}))},t(Y,W),Y.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n,r=this._iterator,o=this._iteratorCache,i=0;i=r.length){var t=n.next();if(t.done)return t;r[o]=t.value}return D(e,o,r[o++])}))},t(se,W),se.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},se.prototype.get=function(e,t){return this.has(e)?this._value:t},se.prototype.includes=function(e){return ae(this._value,e)},se.prototype.slice=function(e,t){var n=this.size;return C(e,t,n)?this:new se(this._value,O(t,n)-A(e,n))},se.prototype.reverse=function(){return this},se.prototype.indexOf=function(e){return ae(this._value,e)?0:-1},se.prototype.lastIndexOf=function(e){return ae(this._value,e)?this.size:-1},se.prototype.__iterate=function(e,t){for(var n=0;n=0&&t=0&&nn?{value:void 0,done:!0}:D(e,i++,a)}))},le.prototype.equals=function(e){return e instanceof le?this._start===e._start&&this._end===e._end&&this._step===e._step:ue(this,e)},t(fe,n),t(pe,fe),t(he,fe),t(de,fe),fe.Keyed=pe,fe.Indexed=he,fe.Set=de;var ve="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){var n=65535&(e|=0),r=65535&(t|=0);return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0};function me(e){return e>>>1&1073741824|3221225471&e}function ge(e){if(!1===e||null==e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null==e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){if(e!=e||e===1/0)return 0;var n=0|e;for(n!==e&&(n^=4294967295*e);e>4294967295;)n^=e/=4294967295;return me(n)}if("string"===t)return e.length>Ce?function(e){var t=ke[e];return void 0===t&&(t=ye(e),Oe===Ae&&(Oe=0,ke={}),Oe++,ke[e]=t),t}(e):ye(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return function(e){var t;if(we&&void 0!==(t=be.get(e)))return t;if(void 0!==(t=e[Se]))return t;if(!xe){if(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[Se]))return t;if(void 0!==(t=function(e){if(e&&e.nodeType>0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}(e)))return t}if(t=++Ee,1073741824&Ee&&(Ee=0),we)be.set(e,t);else{if(void 0!==_e&&!1===_e(e))throw new Error("Non-extensible objects are not allowed as keys.");if(xe)Object.defineProperty(e,Se,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(void 0!==e.propertyIsEnumerable&&e.propertyIsEnumerable===e.constructor.prototype.propertyIsEnumerable)e.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},e.propertyIsEnumerable[Se]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[Se]=t}}return t}(e);if("function"==typeof e.toString)return ye(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function ye(e){for(var t=0,n=0;n=t.length)throw new Error("Missing value for key: "+t[n]);e.set(t[n],t[n+1])}}))},Te.prototype.toString=function(){return this.__toString("Map {","}")},Te.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},Te.prototype.set=function(e,t){return He(this,e,t)},Te.prototype.setIn=function(e,t){return this.updateIn(e,v,(function(){return t}))},Te.prototype.remove=function(e){return He(this,e,v)},Te.prototype.deleteIn=function(e){return this.updateIn(e,(function(){return v}))},Te.prototype.update=function(e,t,n){return 1===arguments.length?e(this):this.updateIn([e],t,n)},Te.prototype.updateIn=function(e,t,n){n||(n=t,t=void 0);var r=function e(t,n,r,o){var i=t===v,a=n.next();if(a.done){var u=i?r:t,s=o(u);return s===u?t:s}ce(i||t&&t.set,"invalid keyPath");var c=a.value,l=i?v:t.get(c,v),f=e(l,n,r,o);return f===l?t:f===v?t.remove(c):(i?We():t).set(c,f)}(this,Yt(e),t,n);return r===v?void 0:r},Te.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):We()},Te.prototype.merge=function(){return Ye(this,void 0,arguments)},Te.prototype.mergeWith=function(t){var n=e.call(arguments,1);return Ye(this,t,n)},Te.prototype.mergeIn=function(t){var n=e.call(arguments,1);return this.updateIn(t,We(),(function(e){return"function"==typeof e.merge?e.merge.apply(e,n):n[n.length-1]}))},Te.prototype.mergeDeep=function(){return Ye(this,Ge,arguments)},Te.prototype.mergeDeepWith=function(t){var n=e.call(arguments,1);return Ye(this,Ze(t),n)},Te.prototype.mergeDeepIn=function(t){var n=e.call(arguments,1);return this.updateIn(t,We(),(function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,n):n[n.length-1]}))},Te.prototype.sort=function(e){return xt(Bt(this,e))},Te.prototype.sortBy=function(e,t){return xt(Bt(this,t,e))},Te.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},Te.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new _)},Te.prototype.asImmutable=function(){return this.__ensureOwner()},Te.prototype.wasAltered=function(){return this.__altered},Te.prototype.__iterator=function(e,t){return new Ue(this,e,t)},Te.prototype.__iterate=function(e,t){var n=this,r=0;return this._root&&this._root.iterate((function(t){return r++,e(t[1],t[0],n)}),t),r},Te.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Ve(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},Te.isMap=Pe;var Ie,Me="@@__IMMUTABLE_MAP__@@",Ne=Te.prototype;function De(e,t){this.ownerID=e,this.entries=t}function Re(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n}function Le(e,t,n){this.ownerID=e,this.count=t,this.nodes=n}function Be(e,t,n){this.ownerID=e,this.keyHash=t,this.entries=n}function Fe(e,t,n){this.ownerID=e,this.keyHash=t,this.entry=n}function Ue(e,t,n){this._type=t,this._reverse=n,this._stack=e._root&&ze(e._root)}function qe(e,t){return D(e,t[0],t[1])}function ze(e,t){return{node:e,index:0,__prev:t}}function Ve(e,t,n,r){var o=Object.create(Ne);return o.size=e,o._root=t,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function We(){return Ie||(Ie=Ve(0))}function He(e,t,n){var r,o;if(e._root){var i=y(m),a=y(g);if(r=Je(e._root,e.__ownerID,0,void 0,t,n,i,a),!a.value)return e;o=e.size+(i.value?n===v?-1:1:0)}else{if(n===v)return e;o=1,r=new De(e.__ownerID,[[t,n]])}return e.__ownerID?(e.size=o,e._root=r,e.__hash=void 0,e.__altered=!0,e):r?Ve(o,r):We()}function Je(e,t,n,r,o,i,a,u){return e?e.update(t,n,r,o,i,a,u):i===v?e:(b(u),b(a),new Fe(t,r,[o,i]))}function Ke(e){return e.constructor===Fe||e.constructor===Be}function $e(e,t,n,r,o){if(e.keyHash===r)return new Be(t,r,[e.entry,o]);var i,a=31&(0===n?e.keyHash:e.keyHash>>>n),u=31&(0===n?r:r>>>n);return new Re(t,1<>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function et(e,t,n,r){var o=r?e:x(e);return o[t]=n,o}Ne[Me]=!0,Ne.delete=Ne.remove,Ne.removeIn=Ne.deleteIn,De.prototype.get=function(e,t,n,r){for(var o=this.entries,i=0,a=o.length;i=tt)return function(e,t,n,r){e||(e=new _);for(var o=new Fe(e,ge(n),[n,r]),i=0;i>>e)),i=this.bitmap;return 0==(i&o)?r:this.nodes[Qe(i&o-1)].get(e+5,t,n,r)},Re.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=ge(r));var u=31&(0===t?n:n>>>t),s=1<=nt)return function(e,t,n,r,o){for(var i=0,a=new Array(32),u=0;0!==n;u++,n>>>=1)a[u]=1&n?t[i++]:void 0;return a[r]=o,new Le(e,i+1,a)}(e,p,c,u,d);if(l&&!d&&2===p.length&&Ke(p[1^f]))return p[1^f];if(l&&d&&1===p.length&&Ke(d))return d;var m=e&&e===this.ownerID,g=l?d?c:c^s:c|s,y=l?d?et(p,f,d,m):function(e,t,n){var r=e.length-1;if(n&&t===r)return e.pop(),e;for(var o=new Array(r),i=0,a=0;a>>e),i=this.nodes[o];return i?i.get(e+5,t,n,r):r},Le.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=ge(r));var u=31&(0===t?n:n>>>t),s=o===v,c=this.nodes,l=c[u];if(s&&!l)return this;var f=Je(l,e,t+5,n,r,o,i,a);if(f===l)return this;var p=this.count;if(l){if(!f&&--p0&&r<32?ht(0,r,5,null,new st(n.toArray())):t.withMutations((function(e){e.setSize(r),n.forEach((function(t,n){return e.set(n,t)}))})))}function it(e){return!(!e||!e[at])}t(ot,he),ot.of=function(){return this(arguments)},ot.prototype.toString=function(){return this.__toString("List [","]")},ot.prototype.get=function(e,t){if((e=E(this,e))>=0&&e=e.size||t<0)return e.withMutations((function(e){t<0?yt(e,t).set(0,n):yt(e,0,t+1).set(t,n)}));t+=e._origin;var r=e._tail,o=e._root,i=y(g);return t>=_t(e._capacity)?r=vt(r,e.__ownerID,0,t,n,i):o=vt(o,e.__ownerID,e._level,t,n,i),i.value?e.__ownerID?(e._root=o,e._tail=r,e.__hash=void 0,e.__altered=!0,e):ht(e._origin,e._capacity,e._level,o,r):e}(this,e,t)},ot.prototype.remove=function(e){return this.has(e)?0===e?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},ot.prototype.insert=function(e,t){return this.splice(e,0,t)},ot.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=5,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):dt()},ot.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations((function(n){yt(n,0,t+e.length);for(var r=0;r>>t&31;if(r>=this.array.length)return new st([],e);var o,i=0===r;if(t>0){var a=this.array[r];if((o=a&&a.removeBefore(e,t-5,n))===a&&i)return this}if(i&&!o)return this;var u=mt(this,e);if(!i)for(var s=0;s>>t&31;if(o>=this.array.length)return this;if(t>0){var i=this.array[o];if((r=i&&i.removeAfter(e,t-5,n))===i&&o===this.array.length-1)return this}var a=mt(this,e);return a.array.splice(o+1),r&&(a.array[o]=r),a};var ct,lt,ft={};function pt(e,t){var n=e._origin,r=e._capacity,o=_t(r),i=e._tail;return a(e._root,e._level,0);function a(e,u,s){return 0===u?function(e,a){var u=a===o?i&&i.array:e&&e.array,s=a>n?0:n-a,c=r-a;return c>32&&(c=32),function(){if(s===c)return ft;var e=t?--c:s++;return u&&u[e]}}(e,s):function(e,o,i){var u,s=e&&e.array,c=i>n?0:n-i>>o,l=1+(r-i>>o);return l>32&&(l=32),function(){for(;;){if(u){var e=u();if(e!==ft)return e;u=null}if(c===l)return ft;var n=t?--l:c++;u=a(s&&s[n],o-5,i+(n<>>n&31,s=e&&u0){var c=e&&e.array[u],l=vt(c,t,n-5,r,o,i);return l===c?e:((a=mt(e,t)).array[u]=l,a)}return s&&e.array[u]===o?e:(b(i),a=mt(e,t),void 0===o&&u===a.array.length-1?a.array.pop():a.array[u]=o,a)}function mt(e,t){return t&&e&&t===e.ownerID?e:new st(e?e.array.slice():[],t)}function gt(e,t){if(t>=_t(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&31],r-=5;return n}}function yt(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new _,o=e._origin,i=e._capacity,a=o+t,u=void 0===n?i:n<0?i+n:o+n;if(a===o&&u===i)return e;if(a>=u)return e.clear();for(var s=e._level,c=e._root,l=0;a+l<0;)c=new st(c&&c.array.length?[void 0,c]:[],r),l+=1<<(s+=5);l&&(a+=l,o+=l,u+=l,i+=l);for(var f=_t(i),p=_t(u);p>=1<f?new st([],r):h;if(h&&p>f&&a5;m-=5){var g=f>>>m&31;v=v.array[g]=mt(v.array[g],r)}v.array[f>>>5&31]=h}if(u=p)a-=p,u-=p,s=5,c=null,d=d&&d.removeBefore(r,0,a);else if(a>o||p>>s&31;if(y!==p>>>s&31)break;y&&(l+=(1<o&&(c=c.removeBefore(r,s,a-l)),c&&pi&&(i=c.size),a(s)||(c=c.map((function(e){return re(e)}))),r.push(c)}return i>e.size&&(e=e.setSize(i)),Xe(e,t,r)}function _t(e){return e<32?0:e-1>>>5<<5}function xt(e){return null==e?St():wt(e)?e:St().withMutations((function(t){var n=r(e);je(n.size),n.forEach((function(e,n){return t.set(n,e)}))}))}function wt(e){return Pe(e)&&l(e)}function Et(e,t,n,r){var o=Object.create(xt.prototype);return o.size=e?e.size:0,o._map=e,o._list=t,o.__ownerID=n,o.__hash=r,o}function St(){return lt||(lt=Et(We(),dt()))}function Ct(e,t,n){var r,o,i=e._map,a=e._list,u=i.get(t),s=void 0!==u;if(n===v){if(!s)return e;a.size>=32&&a.size>=2*i.size?(r=(o=a.filter((function(e,t){return void 0!==e&&u!==t}))).toKeyedSeq().map((function(e){return e[0]})).flip().toMap(),e.__ownerID&&(r.__ownerID=o.__ownerID=e.__ownerID)):(r=i.remove(t),o=u===a.size-1?a.pop():a.set(u,void 0))}else if(s){if(n===a.get(u)[1])return e;r=i,o=a.set(u,[t,n])}else r=i.set(t,a.size),o=a.set(a.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=o,e.__hash=void 0,e):Et(r,o)}function At(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function Ot(e){this._iter=e,this.size=e.size}function kt(e){this._iter=e,this.size=e.size}function jt(e){this._iter=e,this.size=e.size}function Tt(e){var t=Jt(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=Kt,t.__iterateUncached=function(t,n){var r=this;return e.__iterate((function(e,n){return!1!==t(n,e,r)}),n)},t.__iteratorUncached=function(t,n){if(2===t){var r=e.__iterator(t,n);return new N((function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e}))}return e.__iterator(1===t?0:1,n)},t}function Pt(e,t,n){var r=Jt(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,o){var i=e.get(r,v);return i===v?o:t.call(n,i,r,e)},r.__iterateUncached=function(r,o){var i=this;return e.__iterate((function(e,o,a){return!1!==r(t.call(n,e,o,a),o,i)}),o)},r.__iteratorUncached=function(r,o){var i=e.__iterator(2,o);return new N((function(){var o=i.next();if(o.done)return o;var a=o.value,u=a[0];return D(r,u,t.call(n,a[1],u,e),o)}))},r}function It(e,t){var n=Jt(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=Tt(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=Kt,n.__iterate=function(t,n){var r=this;return e.__iterate((function(e,n){return t(e,n,r)}),!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function Mt(e,t,n,r){var o=Jt(e);return r&&(o.has=function(r){var o=e.get(r,v);return o!==v&&!!t.call(n,o,r,e)},o.get=function(r,o){var i=e.get(r,v);return i!==v&&t.call(n,i,r,e)?i:o}),o.__iterateUncached=function(o,i){var a=this,u=0;return e.__iterate((function(e,i,s){if(t.call(n,e,i,s))return u++,o(e,r?i:u-1,a)}),i),u},o.__iteratorUncached=function(o,i){var a=e.__iterator(2,i),u=0;return new N((function(){for(;;){var i=a.next();if(i.done)return i;var s=i.value,c=s[0],l=s[1];if(t.call(n,l,c,e))return D(o,r?c:u++,l,i)}}))},o}function Nt(e,t,n,r){var o=e.size;if(void 0!==t&&(t|=0),void 0!==n&&(n===1/0?n=o:n|=0),C(t,n,o))return e;var i=A(t,o),a=O(n,o);if(i!=i||a!=a)return Nt(e.toSeq().cacheResult(),t,n,r);var u,s=a-i;s==s&&(u=s<0?0:s);var c=Jt(e);return c.size=0===u?u:e.size&&u||void 0,!r&&G(e)&&u>=0&&(c.get=function(t,n){return(t=E(this,t))>=0&&tu)return{value:void 0,done:!0};var e=o.next();return r||1===t?e:D(t,s-1,0===t?void 0:e.value[1],e)}))},c}function Dt(e,t,n,r){var o=Jt(e);return o.__iterateUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterate(o,i);var u=!0,s=0;return e.__iterate((function(e,i,c){if(!u||!(u=t.call(n,e,i,c)))return s++,o(e,r?i:s-1,a)})),s},o.__iteratorUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterator(o,i);var u=e.__iterator(2,i),s=!0,c=0;return new N((function(){var e,i,l;do{if((e=u.next()).done)return r||1===o?e:D(o,c++,0===o?void 0:e.value[1],e);var f=e.value;i=f[0],l=f[1],s&&(s=t.call(n,l,i,a))}while(s);return 2===o?e:D(o,i,l,e)}))},o}function Rt(e,t){var n=u(e),o=[e].concat(t).map((function(e){return a(e)?n&&(e=r(e)):e=n?X(e):Q(Array.isArray(e)?e:[e]),e})).filter((function(e){return 0!==e.size}));if(0===o.length)return e;if(1===o.length){var i=o[0];if(i===e||n&&u(i)||s(e)&&s(i))return i}var c=new J(o);return n?c=c.toKeyedSeq():s(e)||(c=c.toSetSeq()),(c=c.flatten(!0)).size=o.reduce((function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}}),0),c}function Lt(e,t,n){var r=Jt(e);return r.__iterateUncached=function(r,o){var i=0,u=!1;return function e(s,c){var l=this;s.__iterate((function(o,s){return(!t||c0}function qt(e,t,r){var o=Jt(e);return o.size=new J(r).map((function(e){return e.size})).min(),o.__iterate=function(e,t){for(var n,r=this.__iterator(1,t),o=0;!(n=r.next()).done&&!1!==e(n.value,o++,this););return o},o.__iteratorUncached=function(e,o){var i=r.map((function(e){return e=n(e),F(o?e.reverse():e)})),a=0,u=!1;return new N((function(){var n;return u||(n=i.map((function(e){return e.next()})),u=n.some((function(e){return e.done}))),u?{value:void 0,done:!0}:D(e,a++,t.apply(null,n.map((function(e){return e.value}))))}))},o}function zt(e,t){return G(e)?t:e.constructor(t)}function Vt(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Wt(e){return je(e.size),w(e)}function Ht(e){return u(e)?r:s(e)?o:i}function Jt(e){return Object.create((u(e)?V:s(e)?W:H).prototype)}function Kt(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):z.prototype.cacheResult.call(this)}function $t(e,t){return e>t?1:e=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):xn(e,t)},mn.prototype.pushAll=function(e){if(0===(e=o(e)).size)return this;je(e.size);var t=this.size,n=this._head;return e.reverse().forEach((function(e){t++,n={value:e,next:n}})),this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):xn(t,n)},mn.prototype.pop=function(){return this.slice(1)},mn.prototype.unshift=function(){return this.push.apply(this,arguments)},mn.prototype.unshiftAll=function(e){return this.pushAll(e)},mn.prototype.shift=function(){return this.pop.apply(this,arguments)},mn.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):wn()},mn.prototype.slice=function(e,t){if(C(e,t,this.size))return this;var n=A(e,this.size);if(O(t,this.size)!==this.size)return he.prototype.slice.call(this,e,t);for(var r=this.size-n,o=this._head;n--;)o=o.next;return this.__ownerID?(this.size=r,this._head=o,this.__hash=void 0,this.__altered=!0,this):xn(r,o)},mn.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?xn(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},mn.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var n=0,r=this._head;r&&!1!==e(r.value,n++,this);)r=r.next;return n},mn.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new N((function(){if(r){var t=r.value;return r=r.next,D(e,n++,t)}return{value:void 0,done:!0}}))},mn.isStack=gn;var yn,bn="@@__IMMUTABLE_STACK__@@",_n=mn.prototype;function xn(e,t,n,r){var o=Object.create(_n);return o.size=e,o._head=t,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function wn(){return yn||(yn=xn(0))}function En(e,t){var n=function(n){e.prototype[n]=t[n]};return Object.keys(t).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(n),e}_n[bn]=!0,_n.withMutations=Ne.withMutations,_n.asMutable=Ne.asMutable,_n.asImmutable=Ne.asImmutable,_n.wasAltered=Ne.wasAltered,n.Iterator=N,En(n,{toArray:function(){je(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate((function(t,n){e[n]=t})),e},toIndexedSeq:function(){return new Ot(this)},toJS:function(){return this.toSeq().map((function(e){return e&&"function"==typeof e.toJS?e.toJS():e})).__toJS()},toJSON:function(){return this.toSeq().map((function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e})).__toJS()},toKeyedSeq:function(){return new At(this,!0)},toMap:function(){return Te(this.toKeyedSeq())},toObject:function(){je(this.size);var e={};return this.__iterate((function(t,n){e[n]=t})),e},toOrderedMap:function(){return xt(this.toKeyedSeq())},toOrderedSet:function(){return ln(u(this)?this.valueSeq():this)},toSet:function(){return tn(u(this)?this.valueSeq():this)},toSetSeq:function(){return new kt(this)},toSeq:function(){return s(this)?this.toIndexedSeq():u(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return mn(u(this)?this.valueSeq():this)},toList:function(){return ot(u(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){var t=e.call(arguments,0);return zt(this,Rt(this,t))},includes:function(e){return this.some((function(t){return ae(t,e)}))},entries:function(){return this.__iterator(2)},every:function(e,t){je(this.size);var n=!0;return this.__iterate((function(r,o,i){if(!e.call(t,r,o,i))return n=!1,!1})),n},filter:function(e,t){return zt(this,Mt(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},forEach:function(e,t){return je(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){je(this.size),e=void 0!==e?""+e:",";var t="",n=!0;return this.__iterate((function(r){n?n=!1:t+=e,t+=null!=r?r.toString():""})),t},keys:function(){return this.__iterator(0)},map:function(e,t){return zt(this,Pt(this,e,t))},reduce:function(e,t,n){var r,o;return je(this.size),arguments.length<2?o=!0:r=t,this.__iterate((function(t,i,a){o?(o=!1,r=t):r=e.call(n,r,t,i,a)})),r},reduceRight:function(e,t,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return zt(this,It(this,!0))},slice:function(e,t){return zt(this,Nt(this,e,t,!0))},some:function(e,t){return!this.every(kn(e),t)},sort:function(e){return zt(this,Bt(this,e))},values:function(){return this.__iterator(1)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some((function(){return!0}))},count:function(e,t){return w(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return function(e,t,n){var r=Te().asMutable();return e.__iterate((function(o,i){r.update(t.call(n,o,i,e),0,(function(e){return e+1}))})),r.asImmutable()}(this,e,t)},equals:function(e){return ue(this,e)},entrySeq:function(){var e=this;if(e._cache)return new J(e._cache);var t=e.toSeq().map(On).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(kn(e),t)},findEntry:function(e,t,n){var r=n;return this.__iterate((function(n,o,i){if(e.call(t,n,o,i))return r=[o,n],!1})),r},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},findLastEntry:function(e,t,n){return this.toKeyedSeq().reverse().findEntry(e,t,n)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(){return this.find(S)},flatMap:function(e,t){return zt(this,function(e,t,n){var r=Ht(e);return e.toSeq().map((function(o,i){return r(t.call(n,o,i,e))})).flatten(!0)}(this,e,t))},flatten:function(e){return zt(this,Lt(this,e,!0))},fromEntrySeq:function(){return new jt(this)},get:function(e,t){return this.find((function(t,n){return ae(n,e)}),void 0,t)},getIn:function(e,t){for(var n,r=this,o=Yt(e);!(n=o.next()).done;){var i=n.value;if((r=r&&r.get?r.get(i,v):v)===v)return t}return r},groupBy:function(e,t){return function(e,t,n){var r=u(e),o=(l(e)?xt():Te()).asMutable();e.__iterate((function(i,a){o.update(t.call(n,i,a,e),(function(e){return(e=e||[]).push(r?[a,i]:i),e}))}));var i=Ht(e);return o.map((function(t){return zt(e,i(t))}))}(this,e,t)},has:function(e){return this.get(e,v)!==v},hasIn:function(e){return this.getIn(e,v)!==v},isSubset:function(e){return e="function"==typeof e.includes?e:n(e),this.every((function(t){return e.includes(t)}))},isSuperset:function(e){return(e="function"==typeof e.isSubset?e:n(e)).isSubset(this)},keyOf:function(e){return this.findKey((function(t){return ae(t,e)}))},keySeq:function(){return this.toSeq().map(An).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return Ft(this,e)},maxBy:function(e,t){return Ft(this,t,e)},min:function(e){return Ft(this,e?jn(e):In)},minBy:function(e,t){return Ft(this,t?jn(t):In,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return zt(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return zt(this,Dt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(kn(e),t)},sortBy:function(e,t){return zt(this,Bt(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return zt(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return zt(this,function(e,t,n){var r=Jt(e);return r.__iterateUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterate(r,o);var a=0;return e.__iterate((function(e,o,u){return t.call(n,e,o,u)&&++a&&r(e,o,i)})),a},r.__iteratorUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterator(r,o);var a=e.__iterator(2,o),u=!0;return new N((function(){if(!u)return{value:void 0,done:!0};var e=a.next();if(e.done)return e;var o=e.value,s=o[0],c=o[1];return t.call(n,c,s,i)?2===r?e:D(r,s,c,e):(u=!1,{value:void 0,done:!0})}))},r}(this,e,t))},takeUntil:function(e,t){return this.takeWhile(kn(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=function(e){if(e.size===1/0)return 0;var t=l(e),n=u(e),r=t?1:0;return function(e,t){return t=ve(t,3432918353),t=ve(t<<15|t>>>-15,461845907),t=ve(t<<13|t>>>-13,5),t=ve((t=(t+3864292196|0)^e)^t>>>16,2246822507),t=me((t=ve(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(n?t?function(e,t){r=31*r+Mn(ge(e),ge(t))|0}:function(e,t){r=r+Mn(ge(e),ge(t))|0}:t?function(e){r=31*r+ge(e)|0}:function(e){r=r+ge(e)|0}),r)}(this))}});var Sn=n.prototype;Sn[f]=!0,Sn[M]=Sn.values,Sn.__toJS=Sn.toArray,Sn.__toStringMapper=Tn,Sn.inspect=Sn.toSource=function(){return this.toString()},Sn.chain=Sn.flatMap,Sn.contains=Sn.includes,En(r,{flip:function(){return zt(this,Tt(this))},mapEntries:function(e,t){var n=this,r=0;return zt(this,this.toSeq().map((function(o,i){return e.call(t,[i,o],r++,n)})).fromEntrySeq())},mapKeys:function(e,t){var n=this;return zt(this,this.toSeq().flip().map((function(r,o){return e.call(t,r,o,n)})).flip())}});var Cn=r.prototype;function An(e,t){return t}function On(e,t){return[t,e]}function kn(e){return function(){return!e.apply(this,arguments)}}function jn(e){return function(){return-e.apply(this,arguments)}}function Tn(e){return"string"==typeof e?JSON.stringify(e):String(e)}function Pn(){return x(arguments)}function In(e,t){return et?-1:0}function Mn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}return Cn[p]=!0,Cn[M]=Sn.entries,Cn.__toJS=Sn.toObject,Cn.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+Tn(e)},En(o,{toKeyedSeq:function(){return new At(this,!1)},filter:function(e,t){return zt(this,Mt(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return zt(this,It(this,!1))},slice:function(e,t){return zt(this,Nt(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=A(e,e<0?this.count():this.size);var r=this.slice(0,e);return zt(this,1===n?r:r.concat(x(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.findLastEntry(e,t);return n?n[0]:-1},first:function(){return this.get(0)},flatten:function(e){return zt(this,Lt(this,e,!1))},get:function(e,t){return(e=E(this,e))<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find((function(t,n){return n===e}),void 0,t)},has:function(e){return(e=E(this,e))>=0&&(void 0!==this.size?this.size===1/0||e=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,c=!0,f=!1;return{s:function(){n=o()(e)},n:function(){var e=n.next();return c=e.done,e},e:function(e){f=!0,u=e},f:function(){try{c||null==n.return||n.return()}finally{if(f)throw u}}}}function K(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1)try{return decodeURIComponent(t[1])}catch(e){console.error(e)}return null}function le(e){return t=e.replace(/\.[^./]*$/,""),O()(C()(t));var t}var fe=function(e,t){if(e>t)return"Value must be less than Maximum"},pe=function(e,t){if(et)return"Value must be less than MaxLength"},xe=function(e,t){if(e.length2&&void 0!==arguments[2]?arguments[2]:{},r=n.isOAS3,o=void 0!==r&&r,i=n.bypassRequiredCheck,a=void 0!==i&&i,u=[],s=e.get("required"),c=Object(q.a)(e,{isOAS3:o}),l=c.schema,f=c.parameterContentMediaType;if(!l)return u;var p=l.get("required"),h=l.get("maximum"),d=l.get("minimum"),v=l.get("type"),m=l.get("format"),g=l.get("maxLength"),b=l.get("minLength"),x=l.get("pattern");if(v&&(s||p||t)){var E="string"===v&&t,S="array"===v&&y()(t)&&t.length,C="array"===v&&w.a.List.isList(t)&&t.count(),A="array"===v&&"string"==typeof t&&t,O="file"===v&&t instanceof B.a.File,k="boolean"===v&&(t||!1===t),j="number"===v&&(t||0===t),T="integer"===v&&(t||0===t),P="object"===v&&"object"===_()(t)&&null!==t,I="object"===v&&"string"==typeof t&&t,M=[E,S,C,A,O,k,j,T,P,I],N=M.some((function(e){return!!e}));if((s||p)&&!N&&!a)return u.push("Required field is not provided"),u;if("object"===v&&"string"==typeof t&&(null===f||"application/json"===f))try{JSON.parse(t)}catch(e){return u.push("Parameter string value must be valid JSON"),u}if(x){var D=we(t,x);D&&u.push(D)}if(g||0===g){var R=_e(t,g);R&&u.push(R)}if(b){var L=xe(t,b);L&&u.push(L)}if(h||0===h){var F=fe(t,h);F&&u.push(F)}if(d||0===d){var U=pe(t,d);U&&u.push(U)}if("string"===v){var z;if(!(z="date-time"===m?ye(t):"uuid"===m?be(t):ge(t)))return u;u.push(z)}else if("boolean"===v){var V=me(t);if(!V)return u;u.push(V)}else if("number"===v){var W=he(t);if(!W)return u;u.push(W)}else if("integer"===v){var H=de(t);if(!H)return u;u.push(H)}else if("array"===v){var J;if(!C||!t.count())return u;J=l.getIn(["items","type"]),t.forEach((function(e,t){var n;"number"===J?n=he(e):"integer"===J?n=de(e):"string"===J&&(n=ge(e)),n&&u.push({index:t,error:n})}))}else if("file"===v){var K=ve(t);if(!K)return u;u.push(K)}}return u},Se=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(/xml/.test(t)){if(!e.xml||!e.xml.name){if(e.xml=e.xml||{},!e.$$ref)return e.type||e.items||e.properties||e.additionalProperties?'\n\x3c!-- XML example cannot be generated; root element name is undefined --\x3e':null;var r=e.$$ref.match(/\S*\/(\S+)$/);e.xml.name=r[1]}return Object(R.memoizedCreateXMLExample)(e,n)}var o=Object(R.memoizedSampleFromSchema)(e,n);return"object"===_()(o)?p()(o,null,2):o},Ce=function(){var e={},t=B.a.location.search;if(!t)return{};if(""!=t){var n=t.substr(1).split("&");for(var r in n)n.hasOwnProperty(r)&&(r=n[r].split("="),e[decodeURIComponent(r[0])]=r[1]&&decodeURIComponent(r[1])||"")}return e},Ae=function(t){return(t instanceof e?t:new e(t.toString(),"utf-8")).toString("base64")},Oe={operationsSorter:{alpha:function(e,t){return e.get("path").localeCompare(t.get("path"))},method:function(e,t){return e.get("method").localeCompare(t.get("method"))}},tagsSorter:{alpha:function(e,t){return e.localeCompare(t)}}},ke=function(e){var t=[];for(var n in e){var r=e[n];void 0!==r&&""!==r&&t.push([n,"=",encodeURIComponent(r).replace(/%20/g,"+")].join(""))}return t.join("&")},je=function(e,t,n){return!!P()(n,(function(n){return M()(e[n],t[n])}))};function Te(e){return"string"!=typeof e||""===e?"":Object(E.sanitizeUrl)(e)}function Pe(e){return!(!e||e.indexOf("localhost")>=0||e.indexOf("127.0.0.1")>=0||"none"===e)}function Ie(e){if(!w.a.OrderedMap.isOrderedMap(e))return null;if(!e.size)return null;var t=e.find((function(e,t){return t.startsWith("2")&&m()(e.get("content")||{}).length>0})),n=e.get("default")||w.a.OrderedMap(),r=(n.get("content")||w.a.OrderedMap()).keySeq().toJS().length?n:null;return t||r}var Me=function(e){return"string"==typeof e||e instanceof String?e.trim().replace(/\s/g,"%20"):""},Ne=function(e){return U()(Me(e).replace(/%20/g,"_"))},De=function(e){return e.filter((function(e,t){return/^x-/.test(t)}))},Re=function(e){return e.filter((function(e,t){return/^pattern|maxLength|minLength|maximum|minimum/.test(t)}))};function Le(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return!0};if("object"!==_()(e)||y()(e)||null===e||!t)return e;var r=d()({},e);return m()(r).forEach((function(e){e===t&&n(r[e],e)?delete r[e]:r[e]=Le(r[e],t,n)})),r}function Be(e){if("string"==typeof e)return e;if(e&&e.toJS&&(e=e.toJS()),"object"===_()(e)&&null!==e)try{return p()(e,null,2)}catch(t){return String(e)}return null==e?"":e.toString()}function Fe(e){return"number"==typeof e?e.toString():e}function Ue(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.returnAll,r=void 0!==n&&n,o=t.allowHashes,i=void 0===o||o;if(!w.a.Map.isMap(e))throw new Error("paramToIdentifier: received a non-Im.Map parameter as input");var a=e.get("name"),u=e.get("in"),s=[];return e&&e.hashCode&&u&&a&&i&&s.push("".concat(u,".").concat(a,".hash-").concat(e.hashCode())),u&&a&&s.push("".concat(u,".").concat(a)),s.push(a),r?s:s[0]||""}function qe(e,t){return Ue(e,{returnAll:!0}).map((function(e){return t[e]})).filter((function(e){return void 0!==e}))[0]}function ze(){return We(V()(32).toString("base64"))}function Ve(e){return We(H()("sha256").update(e).digest("base64"))}function We(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var He=function(e){return!e||!(!$(e)||!e.isEmpty())}}).call(this,n(62).Buffer)},function(e,t,n){var r=n(225),o=n(906);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=r(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,n){var r=n(17),o=n(9);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?o(e):t}},function(e,t,n){e.exports=n(990)()},function(e,t,n){e.exports=n(651)},function(e,t,n){e.exports=n(667)},function(e,t,n){var r=n(429),o=n(697),i=n(192),a=n(432);e.exports=function(e,t){return r(e)||o(e,t)||i(e,t)||a()}},function(e,t,n){var r=n(856),o=n(470),i=n(192),a=n(857);e.exports=function(e){return r(e)||o(e)||i(e)||a()}},function(e,t,n){"use strict";function r(e,t){return e===t}function o(e,t,n){if(null===t||null===n||t.length!==n.length)return!1;for(var r=t.length,o=0;o1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:r,n=null,i=null;return function(){return o(t,n,arguments)||(i=e.apply(null,arguments)),n=arguments,i}}))},function(e,t,n){var r=n(138),o=n(94);function i(t){return e.exports=i="function"==typeof o&&"symbol"==typeof r?function(e){return typeof e}:function(e){return e&&"function"==typeof o&&e.constructor===o&&e!==o.prototype?"symbol":typeof e},i(t)}e.exports=i},function(e,t,n){e.exports=n(671)},function(e,t,n){"use strict";e.exports=function(e,t,n,r,o,i,a,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,i,a,u],l=0;(s=new Error(t.replace(/%s/g,(function(){return c[l++]})))).name="Invariant Violation"}throw s.framesToPop=1,s}}},function(e,t){e.exports=function(){var e={location:{},history:{},open:function(){},close:function(){},File:function(){}};if("undefined"==typeof window)return e;try{e=window;for(var t=0,n=["File","Blob","FormData"];t5?s-5:0),l=5;l6?u-6:0),c=6;c>",null!=n[r])return e.apply(void 0,[n,r,o,i,a].concat(s));var l=i;return t?new Error("Required "+l+" `"+a+"` was not specified in `"+o+"`."):void 0}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function u(e,t){return a((function(n,r,o,a,u){var s=n[r];if(!t(s)){var c=i(s);return new Error("Invalid "+a+" `"+u+"` of type `"+c+"` supplied to `"+o+"`, expected `"+e+"`.")}return null}))}function s(e,t,n){return a((function(r,o,a,u,s){for(var c=arguments.length,l=Array(c>5?c-5:0),f=5;f5?a-5:0),s=5;s key("+l[f]+")"].concat(u));if(h instanceof Error)return h}}))}function l(e,t,n,r){return a((function(){for(var o=arguments.length,i=Array(o),a=0;a5?c-5:0),f=5;f4)}function s(e){var t=e.get("swagger");return"string"==typeof t&&t.startsWith("2.0")}function c(e){return function(t,n){return function(r){return n&&n.specSelectors&&n.specSelectors.specJson?u(n.specSelectors.specJson())?a.a.createElement(e,o()({},r,n,{Ori:t})):a.a.createElement(t,r):(console.warn("OAS3 wrapper: couldn't get spec"),null)}}}},function(e,t,n){"use strict"; +/* +object-assign +(c) Sindre Sorhus +@license MIT +*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,u,s=a(e),c=1;c0){var o=n.map((function(e){return console.error(e),e.line=e.fullPath?g(y,e.fullPath):null,e.path=e.fullPath?e.fullPath.join("."):null,e.level="error",e.type="thrown",e.source="resolver",k()(e,"message",{enumerable:!0,value:e.message}),e}));i.newThrownErrBatch(o)}return r.updateResolved(t)}))}},be=[],_e=V()(A()(S.a.mark((function e(){var t,n,r,o,i,a,u,s,c,l,f,p,h,d,v,m,g;return S.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=be.system){e.next=4;break}return console.error("debResolveSubtrees: don't have a system to operate on, aborting."),e.abrupt("return");case 4:if(n=t.errActions,r=t.errSelectors,o=t.fn,i=o.resolveSubtree,a=o.AST,u=void 0===a?{}:a,s=t.specSelectors,c=t.specActions,i){e.next=8;break}return console.error("Error: Swagger-Client did not provide a `resolveSubtree` method, doing nothing."),e.abrupt("return");case 8:return l=u.getLineNumberForPath?u.getLineNumberForPath:function(){},f=s.specStr(),p=t.getConfigs(),h=p.modelPropertyMacro,d=p.parameterMacro,v=p.requestInterceptor,m=p.responseInterceptor,e.prev=11,e.next=14,be.reduce(function(){var e=A()(S.a.mark((function e(t,o){var a,u,c,p,g,y,b;return S.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t;case 2:return a=e.sent,u=a.resultMap,c=a.specWithCurrentSubtrees,e.next=7,i(c,o,{baseDoc:s.url(),modelPropertyMacro:h,parameterMacro:d,requestInterceptor:v,responseInterceptor:m});case 7:return p=e.sent,g=p.errors,y=p.spec,r.allErrors().size&&n.clearBy((function(e){return"thrown"!==e.get("type")||"resolver"!==e.get("source")||!e.get("fullPath").every((function(e,t){return e===o[t]||void 0===o[t]}))})),T()(g)&&g.length>0&&(b=g.map((function(e){return e.line=e.fullPath?l(f,e.fullPath):null,e.path=e.fullPath?e.fullPath.join("."):null,e.level="error",e.type="thrown",e.source="resolver",k()(e,"message",{enumerable:!0,value:e.message}),e})),n.newThrownErrBatch(b)),H()(u,o,y),H()(c,o,y),e.abrupt("return",{resultMap:u,specWithCurrentSubtrees:c});case 15:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),w.a.resolve({resultMap:(s.specResolvedSubtree([])||Object(D.Map)()).toJS(),specWithCurrentSubtrees:s.specJson().toJS()}));case 14:g=e.sent,delete be.system,be=[],e.next=22;break;case 19:e.prev=19,e.t0=e.catch(11),console.error(e.t0);case 22:c.updateResolvedSubtree([],g.resultMap);case 23:case"end":return e.stop()}}),e,null,[[11,19]])}))),35),xe=function(e){return function(t){be.map((function(e){return e.join("@@")})).indexOf(e.join("@@"))>-1||(be.push(e),be.system=t,_e())}};function we(e,t,n,r,o){return{type:X,payload:{path:e,value:r,paramName:t,paramIn:n,isXml:o}}}function Ee(e,t,n,r){return{type:X,payload:{path:e,param:t,value:n,isXml:r}}}var Se=function(e,t){return{type:le,payload:{path:e,value:t}}},Ce=function(){return{type:le,payload:{path:[],value:Object(D.Map)()}}},Ae=function(e,t){return{type:ee,payload:{pathMethod:e,isOAS3:t}}},Oe=function(e,t,n,r){return{type:Q,payload:{pathMethod:e,paramName:t,paramIn:n,includeEmptyValue:r}}};function ke(e){return{type:ue,payload:{pathMethod:e}}}function je(e,t){return{type:se,payload:{path:e,value:t,key:"consumes_value"}}}function Te(e,t){return{type:se,payload:{path:e,value:t,key:"produces_value"}}}var Pe=function(e,t,n){return{payload:{path:e,method:t,res:n},type:te}},Ie=function(e,t,n){return{payload:{path:e,method:t,req:n},type:ne}},Me=function(e,t,n){return{payload:{path:e,method:t,req:n},type:re}},Ne=function(e){return{payload:e,type:oe}},De=function(e){return function(t){var n=t.fn,r=t.specActions,o=t.specSelectors,i=t.getConfigs,a=t.oas3Selectors,u=e.pathName,s=e.method,c=e.operation,l=i(),f=l.requestInterceptor,p=l.responseInterceptor,h=c.toJS();if(c&&c.get("parameters")&&c.get("parameters").filter((function(e){return e&&!0===e.get("allowEmptyValue")})).forEach((function(t){if(o.parameterInclusionSettingFor([u,s],t.get("name"),t.get("in"))){e.parameters=e.parameters||{};var n=Object(J.C)(t,e.parameters);(!n||n&&0===n.size)&&(e.parameters[t.get("name")]="")}})),e.contextUrl=L()(o.url()).toString(),h&&h.operationId?e.operationId=h.operationId:h&&u&&s&&(e.operationId=n.opId(h,u,s)),o.isOAS3()){var d="".concat(u,":").concat(s);e.server=a.selectedServer(d)||a.selectedServer();var v=a.serverVariables({server:e.server,namespace:d}).toJS(),g=a.serverVariables({server:e.server}).toJS();e.serverVariables=_()(v).length?v:g,e.requestContentType=a.requestContentType(u,s),e.responseContentType=a.responseContentType(u,s)||"*/*";var b=a.requestBodyValue(u,s),x=a.requestBodyInclusionSetting(u,s);Object(J.t)(b)?e.requestBody=JSON.parse(b):b&&b.toJS?e.requestBody=b.map((function(e){return D.Map.isMap(e)?e.get("value"):e})).filter((function(e,t){return!Object(J.q)(e)||x.get(t)})).toJS():e.requestBody=b}var w=y()({},e);w=n.buildRequest(w),r.setRequest(e.pathName,e.method,w);e.requestInterceptor=function(t){var n=f.apply(this,[t]),o=y()({},n);return r.setMutatedRequest(e.pathName,e.method,o),n},e.responseInterceptor=p;var E=m()();return n.execute(e).then((function(t){t.duration=m()()-E,r.setResponse(e.pathName,e.method,t)})).catch((function(t){console.error(t),r.setResponse(e.pathName,e.method,{error:!0,err:F()(t)})}))}},Re=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.path,n=e.method,r=d()(e,["path","method"]);return function(e){var o=e.fn.fetch,i=e.specSelectors,a=e.specActions,u=i.specJsonWithResolvedSubtrees().toJS(),s=i.operationScheme(t,n),c=i.contentTypeValues([t,n]).toJS(),l=c.requestContentType,f=c.responseContentType,p=/xml/i.test(l),h=i.parameterValues([t,n],p).toJS();return a.executeRequest($($({},r),{},{fetch:o,spec:u,pathName:t,method:n,parameters:h,requestContentType:l,scheme:s,responseContentType:f}))}};function Le(e,t){return{type:ie,payload:{path:e,method:t}}}function Be(e,t){return{type:ae,payload:{path:e,method:t}}}function Fe(e,t,n){return{type:fe,payload:{scheme:e,path:t,method:n}}}},function(e,t,n){e.exports=n(875)},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";var r=n(162),o=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],i=["scalar","sequence","mapping"];e.exports=function(e,t){var n,a;if(t=t||{},Object.keys(t).forEach((function(t){if(-1===o.indexOf(t))throw new r('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=(n=t.styleAliases||null,a={},null!==n&&Object.keys(n).forEach((function(e){n[e].forEach((function(t){a[String(t)]=e}))})),a),-1===i.indexOf(this.kind))throw new r('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}},function(e,t,n){var r=n(237)("wks"),o=n(239),i=n(44).Symbol,a="function"==typeof i;(e.exports=function(e){return r[e]||(r[e]=a&&i[e]||(a?i:o)("Symbol."+e))}).store=r},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(254)("wks"),o=n(187),i=n(34).Symbol,a="function"==typeof i;(e.exports=function(e){return r[e]||(r[e]=a&&i[e]||(a?i:o)("Symbol."+e))}).store=r},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){var r=n(65),o=n(866);e.exports=function(e,t){if(null==e)return{};var n,i,a=o(e,t);if(r){var u=r(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}},function(e,t,n){var r=n(44),o=n(86),i=n(98),a=n(114),u=n(181),s=function(e,t,n){var c,l,f,p,h=e&s.F,d=e&s.G,v=e&s.S,m=e&s.P,g=e&s.B,y=d?r:v?r[t]||(r[t]={}):(r[t]||{}).prototype,b=d?o:o[t]||(o[t]={}),_=b.prototype||(b.prototype={});for(c in d&&(n=t),n)f=((l=!h&&y&&void 0!==y[c])?y:n)[c],p=g&&l?u(f,r):m&&"function"==typeof f?u(Function.call,f):f,y&&a(y,c,f,e&s.U),b[c]!=f&&i(b,c,p),m&&_[c]!=f&&(_[c]=f)};r.core=o,s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,e.exports=s},function(e,t,n){var r=n(37);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};e.exports=o},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var r=n(41),o=n(116),i=n(87),a=/"/g,u=function(e,t,n,r){var o=String(i(e)),u="<"+t;return""!==n&&(u+=" "+n+'="'+String(r).replace(a,""")+'"'),u+">"+o+""};e.exports=function(e,t){var n={};n[e]=t(u),r(r.P+r.F*o((function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3})),"String",n)}},function(e,t,n){e.exports=!n(90)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){"use strict";n.d(t,"b",(function(){return h})),n.d(t,"e",(function(){return d})),n.d(t,"c",(function(){return m})),n.d(t,"a",(function(){return g})),n.d(t,"d",(function(){return y}));var r=n(73),o=n.n(r),i=n(17),a=n.n(i),u=n(55),s=n.n(u),c=n(392),l=n.n(c),f=function(e){return String.prototype.toLowerCase.call(e)},p=function(e){return e.replace(/[^\w]/gi,"_")};function h(e){var t=e.openapi;return!!t&&l()(t,"3")}function d(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=r.v2OperationIdCompatibilityMode;if(!e||"object"!==a()(e))return null;var i=(e.operationId||"").replace(/\s/g,"");return i.length?p(e.operationId):v(t,n,{v2OperationIdCompatibilityMode:o})}function v(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.v2OperationIdCompatibilityMode;if(r){var o="".concat(t.toLowerCase(),"_").concat(e).replace(/[\s!@#$%^&*()_+=[{\]};:<>|./?,\\'""-]/g,"_");return(o=o||"".concat(e.substring(1),"_").concat(t)).replace(/((_){2,})/g,"_").replace(/^(_)*/g,"").replace(/([_])*$/g,"")}return"".concat(f(t)).concat(p(e))}function m(e,t){return"".concat(f(t),"-").concat(e)}function g(e,t){return e&&e.paths?function(e,t){return function(e,t,n){if(!e||"object"!==a()(e)||!e.paths||"object"!==a()(e.paths))return null;var r=e.paths;for(var o in r)for(var i in r[o])if("PARAMETERS"!==i.toUpperCase()){var u=r[o][i];if(u&&"object"===a()(u)){var s={spec:e,pathName:o,method:i.toUpperCase(),operation:u},c=t(s);if(n&&c)return s}}return}(e,t,!0)||null}(e,(function(e){var n=e.pathName,r=e.method,o=e.operation;if(!o||"object"!==a()(o))return!1;var i=o.operationId;return[d(o,n,r),m(n,r),i].some((function(e){return e&&e===t}))})):null}function y(e){var t=e.spec,n=t.paths,r={};if(!n||t.$$normalized)return e;for(var i in n){var a=n[i];if(s()(a)){var u=a.parameters,c=function(e){var n=a[e];if(!s()(n))return"continue";var c=d(n,i,e);if(c){r[c]?r[c].push(n):r[c]=[n];var l=r[c];if(l.length>1)l.forEach((function(e,t){e.__originalOperationId=e.__originalOperationId||e.operationId,e.operationId="".concat(c).concat(t+1)}));else if(void 0!==n.operationId){var f=l[0];f.__originalOperationId=f.__originalOperationId||n.operationId,f.operationId=c}}if("parameters"!==e){var p=[],h={};for(var v in t)"produces"!==v&&"consumes"!==v&&"security"!==v||(h[v]=t[v],p.push(h));if(u&&(h.parameters=u,p.push(h)),p.length){var m,g=o()(p);try{for(g.s();!(m=g.n()).done;){var y=m.value;for(var b in y)if(n[b]){if("parameters"===b){var _,x=o()(y[b]);try{var w=function(){var e=_.value;n[b].some((function(t){return t.name&&t.name===e.name||t.$ref&&t.$ref===e.$ref||t.$$ref&&t.$$ref===e.$$ref||t===e}))||n[b].push(e)};for(x.s();!(_=x.n()).done;)w()}catch(e){x.e(e)}finally{x.f()}}}else n[b]=y[b]}}catch(e){g.e(e)}finally{g.f()}}}};for(var l in a)c(l)}}return t.$$normalized=!0,e}},function(e,t,n){"use strict";n.r(t),n.d(t,"NEW_THROWN_ERR",(function(){return i})),n.d(t,"NEW_THROWN_ERR_BATCH",(function(){return a})),n.d(t,"NEW_SPEC_ERR",(function(){return u})),n.d(t,"NEW_SPEC_ERR_BATCH",(function(){return s})),n.d(t,"NEW_AUTH_ERR",(function(){return c})),n.d(t,"CLEAR",(function(){return l})),n.d(t,"CLEAR_BY",(function(){return f})),n.d(t,"newThrownErr",(function(){return p})),n.d(t,"newThrownErrBatch",(function(){return h})),n.d(t,"newSpecErr",(function(){return d})),n.d(t,"newSpecErrBatch",(function(){return v})),n.d(t,"newAuthErr",(function(){return m})),n.d(t,"clear",(function(){return g})),n.d(t,"clearBy",(function(){return y}));var r=n(140),o=n.n(r),i="err_new_thrown_err",a="err_new_thrown_err_batch",u="err_new_spec_err",s="err_new_spec_err_batch",c="err_new_auth_err",l="err_clear",f="err_clear_by";function p(e){return{type:i,payload:o()(e)}}function h(e){return{type:a,payload:e}}function d(e){return{type:u,payload:e}}function v(e){return{type:s,payload:e}}function m(e){return{type:c,payload:e}}function g(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:l,payload:e}}function y(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!0};return{type:f,payload:e}}},function(e,t,n){"use strict";n.r(t),n.d(t,"UPDATE_SELECTED_SERVER",(function(){return r})),n.d(t,"UPDATE_REQUEST_BODY_VALUE",(function(){return o})),n.d(t,"UPDATE_REQUEST_BODY_INCLUSION",(function(){return i})),n.d(t,"UPDATE_ACTIVE_EXAMPLES_MEMBER",(function(){return a})),n.d(t,"UPDATE_REQUEST_CONTENT_TYPE",(function(){return u})),n.d(t,"UPDATE_RESPONSE_CONTENT_TYPE",(function(){return s})),n.d(t,"UPDATE_SERVER_VARIABLE_VALUE",(function(){return c})),n.d(t,"SET_REQUEST_BODY_VALIDATE_ERROR",(function(){return l})),n.d(t,"CLEAR_REQUEST_BODY_VALIDATE_ERROR",(function(){return f})),n.d(t,"setSelectedServer",(function(){return p})),n.d(t,"setRequestBodyValue",(function(){return h})),n.d(t,"setRequestBodyInclusion",(function(){return d})),n.d(t,"setActiveExamplesMember",(function(){return v})),n.d(t,"setRequestContentType",(function(){return m})),n.d(t,"setResponseContentType",(function(){return g})),n.d(t,"setServerVariableValue",(function(){return y})),n.d(t,"setRequestBodyValidateError",(function(){return b})),n.d(t,"clearRequestBodyValidateError",(function(){return _})),n.d(t,"initRequestBodyValidateError",(function(){return x}));var r="oas3_set_servers",o="oas3_set_request_body_value",i="oas3_set_request_body_inclusion",a="oas3_set_active_examples_member",u="oas3_set_request_content_type",s="oas3_set_response_content_type",c="oas3_set_server_variable_value",l="oas3_set_request_body_validate_error",f="oas3_clear_request_body_validate_error";function p(e,t){return{type:r,payload:{selectedServerUrl:e,namespace:t}}}function h(e){var t=e.value,n=e.pathMethod;return{type:o,payload:{value:t,pathMethod:n}}}function d(e){var t=e.value,n=e.pathMethod,r=e.name;return{type:i,payload:{value:t,pathMethod:n,name:r}}}function v(e){var t=e.name,n=e.pathMethod,r=e.contextType,o=e.contextName;return{type:a,payload:{name:t,pathMethod:n,contextType:r,contextName:o}}}function m(e){var t=e.value,n=e.pathMethod;return{type:u,payload:{value:t,pathMethod:n}}}function g(e){var t=e.value,n=e.path,r=e.method;return{type:s,payload:{value:t,path:n,method:r}}}function y(e){var t=e.server,n=e.namespace,r=e.key,o=e.val;return{type:c,payload:{server:t,namespace:n,key:r,val:o}}}var b=function(e){var t=e.path,n=e.method,r=e.validationErrors;return{type:l,payload:{path:t,method:n,validationErrors:r}}},_=function(e){var t=e.path,n=e.method;return{type:f,payload:{path:t,method:n}}},x=function(e){var t=e.pathMethod;return{type:f,payload:{path:t[0],method:t[1]}}}},function(e,t,n){var r=n(115);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){var r=n(62),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=a),i(o,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t){var n=Array.isArray;e.exports=n},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,n){var r; +/*! + Copyright (c) 2017 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t + * @license MIT + */ +var r=n(665),o=n(666),i=n(415);function a(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function d(e,t){if(s.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(e).length;default:if(r)return U(e).length;t=(""+t).toLowerCase(),r=!0}}function v(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return j(this,t,n);case"utf8":case"utf-8":return A(this,t,n);case"ascii":return O(this,t,n);case"latin1":case"binary":return k(this,t,n);case"base64":return C(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,o);if("number"==typeof t)return t&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,o){var i,a=1,u=e.length,s=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,u/=2,s/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var l=-1;for(i=n;iu&&(n=u-s),i=n;i>=0;i--){for(var f=!0,p=0;po&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function C(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function A(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:c>223?3:c>191?2:1;if(o+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(i=e[o+1]))&&(s=(31&c)<<6|63&i)>127&&(l=s);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(s=(15&c)<<12|(63&i)<<6|63&a)>2047&&(s<55296||s>57343)&&(l=s);break;case 4:i=e[o+1],a=e[o+2],u=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&u)&&(s=(15&c)<<18|(63&i)<<12|(63&a)<<6|63&u)>65535&&s<1114112&&(l=s)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},s.prototype.compare=function(e,t,n,r,o){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),u=Math.min(i,a),c=this.slice(r,o),l=e.slice(t,n),f=0;fo)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return _(this,e,t,n);case"ascii":return x(this,e,t,n);case"latin1":case"binary":return w(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function O(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;or)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function I(e,t,n,r,o,i){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function M(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function N(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function D(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function R(e,t,n,r,i){return i||D(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,i){return i||D(e,0,n,8),o.write(e,t,n,r,52,8),n+8}s.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},s.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},s.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||I(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},s.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,1,255,0),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):N(this,e,t,!0),t+4},s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);I(this,e,t,n,o-1,-o)}var i=0,a=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);I(this,e,t,n,o-1,-o)}var i=n-1,a=1,u=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/a>>0)-u&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,1,127,-128),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):N(this,e,t,!0),t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},s.prototype.writeFloatLE=function(e,t,n){return R(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return R(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return L(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!s.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function q(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(39))},function(e,t,n){e.exports=n(669)},function(e,t,n){e.exports=n(863)},function(e,t,n){e.exports=n(865)},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,n){"use strict";var r=n(24),o=n(29),i=n(486),a=n(108),u=n(487),s=n(132),c=n(207),l=n(19),f=[],p=0,h=i.getPooled(),d=!1,v=null;function m(){w.ReactReconcileTransaction&&v||r("123")}var g=[{initialize:function(){this.dirtyComponentsLength=f.length},close:function(){this.dirtyComponentsLength!==f.length?(f.splice(0,this.dirtyComponentsLength),x()):f.length=0}},{initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}}];function y(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=i.getPooled(),this.reconcileTransaction=w.ReactReconcileTransaction.getPooled(!0)}function b(e,t){return e._mountOrder-t._mountOrder}function _(e){var t=e.dirtyComponentsLength;t!==f.length&&r("124",t,f.length),f.sort(b),p++;for(var n=0;n + * @license MIT + * + * The MIT License (MIT) + * + * Copyright (c) 2013-2018 Viacheslav Lotsmanov + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +function n(e){return e instanceof t||e instanceof Date||e instanceof RegExp}function r(e){if(e instanceof t){var n=t.alloc?t.alloc(e.length):new t(e.length);return e.copy(n),n}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);throw new Error("Unexpected situation")}function o(e){var t=[];return e.forEach((function(e,i){"object"==typeof e&&null!==e?Array.isArray(e)?t[i]=o(e):n(e)?t[i]=r(e):t[i]=a({},e):t[i]=e})),t}function i(e,t){return"__proto__"===t?void 0:e[t]}var a=e.exports=function(){if(arguments.length<1||"object"!=typeof arguments[0])return!1;if(arguments.length<2)return arguments[0];var e,t,u=arguments[0],s=Array.prototype.slice.call(arguments,1);return s.forEach((function(s){"object"!=typeof s||null===s||Array.isArray(s)||Object.keys(s).forEach((function(c){return t=i(u,c),(e=i(s,c))===u?void 0:"object"!=typeof e||null===e?void(u[c]=e):Array.isArray(e)?void(u[c]=o(e)):n(e)?void(u[c]=r(e)):"object"!=typeof t||null===t||Array.isArray(t)?void(u[c]=a({},e)):void(u[c]=a(t,e))}))})),u}}).call(this,n(62).Buffer)},function(e,t,n){var r=n(139),o=n(13),i=n(138),a=n(94),u=n(192);e.exports=function(e,t){var n;if(void 0===a||null==e[i]){if(o(e)||(n=u(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var s=0,c=function(){};return{s:c,n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,f=!0,p=!1;return{s:function(){n=r(e)},n:function(){var e=n.next();return f=e.done,e},e:function(e){p=!0,l=e},f:function(){try{f||null==n.return||n.return()}finally{if(p)throw l}}}}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(251),o=n(250);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(100);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";e.exports={current:null}},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var s,c=[],l=!1,f=-1;function p(){l&&s&&(l=!1,s.length?c=s.concat(c):f=-1,c.length&&h())}function h(){if(!l){var e=u(p);l=!0;for(var t=c.length;t;){for(s=c,c=[];++f1)for(var n=1;n0&&"/"!==t[0]}));function oe(e,t,n){return t=t||[],te.apply(void 0,[e].concat(s()(t))).get("parameters",Object(f.List)()).reduce((function(e,t){var r=n&&"body"===t.get("in")?t.get("value_xml"):t.get("value");return e.set(Object(l.B)(t,{allowHashes:!1}),r)}),Object(f.fromJS)({}))}function ie(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(f.List.isList(e))return e.some((function(e){return f.Map.isMap(e)&&e.get("in")===t}))}function ae(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(f.List.isList(e))return e.some((function(e){return f.Map.isMap(e)&&e.get("type")===t}))}function ue(e,t){t=t||[];var n=w(e).getIn(["paths"].concat(s()(t)),Object(f.fromJS)({})),r=e.getIn(["meta","paths"].concat(s()(t)),Object(f.fromJS)({})),o=se(e,t),i=n.get("parameters")||new f.List,a=r.get("consumes_value")?r.get("consumes_value"):ae(i,"file")?"multipart/form-data":ae(i,"formData")?"application/x-www-form-urlencoded":void 0;return Object(f.fromJS)({requestContentType:a,responseContentType:o})}function se(e,t){t=t||[];var n=w(e).getIn(["paths"].concat(s()(t)),null);if(null!==n){var r=e.getIn(["meta","paths"].concat(s()(t),["produces_value"]),null),o=n.getIn(["produces",0],null);return r||o||"application/json"}}function ce(e,t){t=t||[];var n=w(e),r=n.getIn(["paths"].concat(s()(t)),null);if(null!==r){var o=t,i=a()(o,1)[0],u=r.get("produces",null),c=n.getIn(["paths",i,"produces"],null),l=n.getIn(["produces"],null);return u||c||l}}function le(e,t){t=t||[];var n=w(e),r=n.getIn(["paths"].concat(s()(t)),null);if(null!==r){var o=t,i=a()(o,1)[0],u=r.get("consumes",null),c=n.getIn(["paths",i,"consumes"],null),l=n.getIn(["consumes"],null);return u||c||l}}var fe=function(e,t,n){var r=e.get("url").match(/^([a-z][a-z0-9+\-.]*):/),i=o()(r)?r[1]:null;return e.getIn(["scheme",t,n])||e.getIn(["scheme","_defaultScheme"])||i||""},pe=function(e,t,n){return["http","https"].indexOf(fe(e,t,n))>-1},he=function(e,t){t=t||[];var n=e.getIn(["meta","paths"].concat(s()(t),["parameters"]),Object(f.fromJS)([])),r=!0;return n.forEach((function(e){var t=e.get("errors");t&&t.count()&&(r=!1)})),r},de=function(e,t){var n={requestBody:!1,requestContentType:{}},r=e.getIn(["resolvedSubtrees","paths"].concat(s()(t),["requestBody"]),Object(f.fromJS)([]));return r.size<1||(r.getIn(["required"])&&(n.requestBody=r.getIn(["required"])),r.getIn(["content"]).entrySeq().forEach((function(e){var t=e[0];if(e[1].getIn(["schema","required"])){var r=e[1].getIn(["schema","required"]).toJS();n.requestContentType[t]=r}}))),n};function ve(e){return f.Map.isMap(e)?e:new f.Map}},function(e,t,n){var r=n(58);function o(e,t,n,o,i,a,u){try{var s=e[a](u),c=s.value}catch(e){return void n(e)}s.done?t(c):r.resolve(c).then(o,i)}e.exports=function(e){return function(){var t=this,n=arguments;return new r((function(r,i){var a=e.apply(t,n);function u(e){o(a,r,i,u,s,"next",e)}function s(e){o(a,r,i,u,s,"throw",e)}u(void 0)}))}}},function(e,t,n){var r=n(134),o=n(55);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t,n){var r=n(310);e.exports=function(e,t,n){var o=null==e?void 0:r(e,t);return void 0===o?n:o}},function(e,t,n){"use strict";n.r(t),n.d(t,"SHOW_AUTH_POPUP",(function(){return d})),n.d(t,"AUTHORIZE",(function(){return v})),n.d(t,"LOGOUT",(function(){return m})),n.d(t,"PRE_AUTHORIZE_OAUTH2",(function(){return g})),n.d(t,"AUTHORIZE_OAUTH2",(function(){return y})),n.d(t,"VALIDATE",(function(){return b})),n.d(t,"CONFIGURE_AUTH",(function(){return _})),n.d(t,"showDefinitions",(function(){return x})),n.d(t,"authorize",(function(){return w})),n.d(t,"logout",(function(){return E})),n.d(t,"preAuthorizeImplicit",(function(){return S})),n.d(t,"authorizeOauth2",(function(){return C})),n.d(t,"authorizePassword",(function(){return A})),n.d(t,"authorizeApplication",(function(){return O})),n.d(t,"authorizeAccessCodeWithFormParams",(function(){return k})),n.d(t,"authorizeAccessCodeWithBasicAuthentication",(function(){return j})),n.d(t,"authorizeRequest",(function(){return T})),n.d(t,"configureAuth",(function(){return P}));var r=n(17),o=n.n(r),i=n(18),a=n.n(i),u=n(27),s=n.n(u),c=n(112),l=n.n(c),f=n(20),p=n.n(f),h=n(7),d="show_popup",v="authorize",m="logout",g="pre_authorize_oauth2",y="authorize_oauth2",b="validate",_="configure_auth";function x(e){return{type:d,payload:e}}function w(e){return{type:v,payload:e}}function E(e){return{type:m,payload:e}}var S=function(e){return function(t){var n=t.authActions,r=t.errActions,o=e.auth,i=e.token,a=e.isValid,u=o.schema,c=o.name,l=u.get("flow");delete p.a.swaggerUIRedirectOauth2,"accessCode"===l||a||r.newAuthErr({authId:c,source:"auth",level:"warning",message:"Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"}),i.error?r.newAuthErr({authId:c,source:"auth",level:"error",message:s()(i)}):n.authorizeOauth2({auth:o,token:i})}};function C(e){return{type:y,payload:e}}var A=function(e){return function(t){var n=t.authActions,r=e.schema,o=e.name,i=e.username,u=e.password,s=e.passwordType,c=e.clientId,l=e.clientSecret,f={grant_type:"password",scope:e.scopes.join(" "),username:i,password:u},p={};switch(s){case"request-body":!function(e,t,n){t&&a()(e,{client_id:t});n&&a()(e,{client_secret:n})}(f,c,l);break;case"basic":p.Authorization="Basic "+Object(h.a)(c+":"+l);break;default:console.warn("Warning: invalid passwordType ".concat(s," was passed, not including client id and secret"))}return n.authorizeRequest({body:Object(h.b)(f),url:r.get("tokenUrl"),name:o,headers:p,query:{},auth:e})}};var O=function(e){return function(t){var n=t.authActions,r=e.schema,o=e.scopes,i=e.name,a=e.clientId,u=e.clientSecret,s={Authorization:"Basic "+Object(h.a)(a+":"+u)},c={grant_type:"client_credentials",scope:o.join(" ")};return n.authorizeRequest({body:Object(h.b)(c),name:i,url:r.get("tokenUrl"),auth:e,headers:s})}},k=function(e){var t=e.auth,n=e.redirectUrl;return function(e){var r=e.authActions,o=t.schema,i=t.name,a=t.clientId,u=t.clientSecret,s=t.codeVerifier,c={grant_type:"authorization_code",code:t.code,client_id:a,client_secret:u,redirect_uri:n,code_verifier:s};return r.authorizeRequest({body:Object(h.b)(c),name:i,url:o.get("tokenUrl"),auth:t})}},j=function(e){var t=e.auth,n=e.redirectUrl;return function(e){var r=e.authActions,o=t.schema,i=t.name,a=t.clientId,u=t.clientSecret,s={Authorization:"Basic "+Object(h.a)(a+":"+u)},c={grant_type:"authorization_code",code:t.code,client_id:a,redirect_uri:n};return r.authorizeRequest({body:Object(h.b)(c),name:i,url:o.get("tokenUrl"),auth:t,headers:s})}},T=function(e){return function(t){var n,r=t.fn,i=t.getConfigs,u=t.authActions,c=t.errActions,f=t.oas3Selectors,p=t.specSelectors,h=t.authSelectors,d=e.body,v=e.query,m=void 0===v?{}:v,g=e.headers,y=void 0===g?{}:g,b=e.name,_=e.url,x=e.auth,w=(h.getConfigs()||{}).additionalQueryStringParams;if(p.isOAS3()){var E=f.selectedServer();n=l()(_,f.serverEffectiveValue({server:E}),!0)}else n=l()(_,p.url(),!0);"object"===o()(w)&&(n.query=a()({},n.query,w));var S=n.toString(),C=a()({Accept:"application/json, text/plain, */*","Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},y);r.fetch({url:S,method:"post",headers:C,query:m,body:d,requestInterceptor:i().requestInterceptor,responseInterceptor:i().responseInterceptor}).then((function(e){var t=JSON.parse(e.data),n=t&&(t.error||""),r=t&&(t.parseError||"");e.ok?n||r?c.newAuthErr({authId:b,level:"error",source:"auth",message:s()(t)}):u.authorizeOauth2({auth:x,token:t}):c.newAuthErr({authId:b,level:"error",source:"auth",message:e.statusText})})).catch((function(e){var t=new Error(e).message;if(e.response&&e.response.data){var n=e.response.data;try{var r="string"==typeof n?JSON.parse(n):n;r.error&&(t+=", error: ".concat(r.error)),r.error_description&&(t+=", description: ".concat(r.error_description))}catch(e){}}c.newAuthErr({authId:b,level:"error",source:"auth",message:t})}))}};function P(e){return{type:_,payload:e}}},function(e,t){var n=e.exports={version:"2.6.11"};"number"==typeof __e&&(__e=n)},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(148),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(59),o=n(152);e.exports=n(46)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,n){var r=n(701);e.exports=function(e){return null==e?"":r(e)}},function(e,t,n){e.exports=n(660)},function(e,t,n){"use strict";var r=n(876);e.exports=r},function(e,t,n){"use strict";n.r(t),n.d(t,"UPDATE_LAYOUT",(function(){return o})),n.d(t,"UPDATE_FILTER",(function(){return i})),n.d(t,"UPDATE_MODE",(function(){return a})),n.d(t,"SHOW",(function(){return u})),n.d(t,"updateLayout",(function(){return s})),n.d(t,"updateFilter",(function(){return c})),n.d(t,"show",(function(){return l})),n.d(t,"changeMode",(function(){return f}));var r=n(7),o="layout_update_layout",i="layout_update_filter",a="layout_update_mode",u="layout_show";function s(e){return{type:o,payload:e}}function c(e){return{type:i,payload:e}}function l(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e=Object(r.w)(e),{type:u,payload:{thing:e,shown:t}}}function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e=Object(r.w)(e),{type:a,payload:{thing:e,mode:t}}}},function(e,t,n){"use strict";var r=n(1152),o=n(1153);function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){o.isString(e)&&(e=b(e));return e instanceof i?e.format():i.prototype.format.call(e)},t.Url=i;var a=/^([a-z0-9.+-]+:)/i,u=/:[0-9]*$/,s=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),p=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(1154);function b(e,t,n){if(e&&o.isObject(e)&&e instanceof i)return e;var r=new i;return r.parse(e,t,n),r}i.prototype.parse=function(e,t,n){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var i=e.indexOf("?"),u=-1!==i&&i127?M+="x":M+=I[N];if(!M.match(h)){var R=T.slice(0,O),L=T.slice(O+1),B=I.match(d);B&&(R.push(B[1]),L.unshift(B[2])),L.length&&(b="/"+L.join(".")+b),this.hostname=R.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=r.toASCII(this.hostname));var F=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+F,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!v[w])for(O=0,P=l.length;O0)&&n.host.split("@"))&&(n.auth=j.shift(),n.host=n.hostname=j.shift());return n.search=e.search,n.query=e.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!E.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var C=E.slice(-1)[0],A=(n.host||e.host||E.length>1)&&("."===C||".."===C)||""===C,O=0,k=E.length;k>=0;k--)"."===(C=E[k])?E.splice(k,1):".."===C?(E.splice(k,1),O++):O&&(E.splice(k,1),O--);if(!x&&!w)for(;O--;O)E.unshift("..");!x||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),A&&"/"!==E.join("/").substr(-1)&&E.push("");var j,T=""===E[0]||E[0]&&"/"===E[0].charAt(0);S&&(n.hostname=n.host=T?"":E.length?E.shift():"",(j=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=j.shift(),n.host=n.hostname=j.shift()));return(x=x||n.host&&E.length)&&!T&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var e=this.host,t=u.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){var r=n(179),o=n(397);e.exports=n(147)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var r=n(250);e.exports=function(e){return Object(r(e))}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(123),o=n(702),i=n(703),a=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):i(e)}},function(e,t,n){var r=n(720),o=n(723);e.exports=function(e,t){var n=o(e,t);return r(n)?n:void 0}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";var r=n(201),o=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var i=n(161);i.inherits=n(52);var a=n(454),u=n(282);i.inherits(f,a);for(var s=o(u.prototype),c=0;c=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})}))},function(e,t){e.exports={}},function(e,t,n){n(658);for(var r=n(34),o=n(89),i=n(119),a=n(38)("toStringTag"),u="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),s=0;s1){for(var d=Array(h),v=0;v1){for(var g=Array(m),y=0;y=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,o=(n-r)/4294967296;this._block.writeUInt32BE(o,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var i=this._hash();return e?i.toString(e):i},o.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=o},function(e,t,n){var r=n(76),o=n(425),i=n(426),a=n(42),u=n(186),s=n(266),c={},l={};(t=e.exports=function(e,t,n,f,p){var h,d,v,m,g=p?function(){return e}:s(e),y=r(n,f,t?2:1),b=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(i(g)){for(h=u(e.length);h>b;b++)if((m=t?y(a(d=e[b])[0],d[1]):y(e[b]))===c||m===l)return m}else for(v=g.call(e);!(d=v.next()).done;)if((m=o(v,y,d.value,t))===c||m===l)return m}).BREAK=c,t.RETURN=l},function(e,t,n){"use strict";function r(e){return null==e}e.exports.isNothing=r,e.exports.isObject=function(e){return"object"==typeof e&&null!==e},e.exports.toArray=function(e){return Array.isArray(e)?e:r(e)?[]:[e]},e.exports.repeat=function(e,t){var n,r="";for(n=0;n1&&void 0!==arguments[1]?arguments[1]:{},r=Object(i.A)(t),a=r.type,u=r.example,s=r.properties,c=r.additionalProperties,l=r.items,f=n.includeReadOnly,p=n.includeWriteOnly;if(void 0!==u)return Object(i.e)(u,"$$ref",(function(e){return"string"==typeof e&&e.indexOf("#")>-1}));if(!a)if(s)a="object";else{if(!l)return;a="array"}if("object"===a){var d=Object(i.A)(s),v={};for(var m in d)d[m]&&d[m].deprecated||d[m]&&d[m].readOnly&&!f||d[m]&&d[m].writeOnly&&!p||(v[m]=e(d[m],n));if(!0===c)v.additionalProp1={};else if(c)for(var g=Object(i.A)(c),y=e(g,n),b=1;b<4;b++)v["additionalProp"+b]=y;return v}return"array"===a?o()(l.anyOf)?l.anyOf.map((function(t){return e(t,n)})):o()(l.oneOf)?l.oneOf.map((function(t){return e(t,n)})):[e(l,n)]:t.enum?t.default?t.default:Object(i.w)(t.enum)[0]:"file"!==a?h(t):void 0},v=function(e){return e.schema&&(e=e.schema),e.properties&&(e.type="object"),e},m=function e(t){var n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=f()({},Object(i.A)(t)),s=u.type,c=u.properties,l=u.additionalProperties,p=u.items,d=u.example,v=a.includeReadOnly,m=a.includeWriteOnly,g=u.default,y={},b={},_=t.xml,x=_.name,w=_.prefix,E=_.namespace,S=u.enum;if(!s)if(c||l)s="object";else{if(!p)return;s="array"}if(n=(w?w+":":"")+(x=x||"notagname"),E){var C=w?"xmlns:"+w:"xmlns";b[C]=E}if("array"===s&&p){if(p.xml=p.xml||_||{},p.xml.name=p.xml.name||_.name,_.wrapped)return y[n]=[],o()(d)?d.forEach((function(t){p.example=t,y[n].push(e(p,a))})):o()(g)?g.forEach((function(t){p.default=t,y[n].push(e(p,a))})):y[n]=[e(p,a)],b&&y[n].push({_attr:b}),y;var A=[];return o()(d)?(d.forEach((function(t){p.example=t,A.push(e(p,a))})),A):o()(g)?(g.forEach((function(t){p.default=t,A.push(e(p,a))})),A):e(p,a)}if("object"===s){var O=Object(i.A)(c);for(var k in y[n]=[],d=d||{},O)if(O.hasOwnProperty(k)&&(!O[k].readOnly||v)&&(!O[k].writeOnly||m))if(O[k].xml=O[k].xml||{},O[k].xml.attribute){var j=o()(O[k].enum)&&O[k].enum[0],T=O[k].example,P=O[k].default;b[O[k].xml.name||k]=void 0!==T&&T||void 0!==d[k]&&d[k]||void 0!==P&&P||j||h(O[k])}else{O[k].xml.name=O[k].xml.name||k,void 0===O[k].example&&void 0!==d[k]&&(O[k].example=d[k]);var I=e(O[k]);o()(I)?y[n]=y[n].concat(I):y[n].push(I)}return!0===l?y[n].push({additionalProp:"Anything can be here"}):l&&y[n].push({additionalProp:h(l)}),b&&y[n].push({_attr:b}),y}return r=void 0!==d?d:void 0!==g?g:o()(S)?S[0]:h(t),y[n]=b?[{_attr:b},r]:r,y};function g(e,t){var n=m(e,t);if(n)return u()(n,{declaration:!0,indent:"\t"})}var y=c()(g),b=c()(d)},function(e,t,n){"use strict";n.r(t),n.d(t,"UPDATE_CONFIGS",(function(){return i})),n.d(t,"TOGGLE_CONFIGS",(function(){return a})),n.d(t,"update",(function(){return u})),n.d(t,"toggle",(function(){return s})),n.d(t,"loaded",(function(){return c}));var r=n(3),o=n.n(r),i="configs_update",a="configs_toggle";function u(e,t){return{type:i,payload:o()({},e,t)}}function s(e){return{type:a,payload:e}}var c=function(){return function(){}}},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(2),o=n.n(r),i=o.a.Set.of("type","format","items","default","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","maxItems","minItems","uniqueItems","enum","multipleOf");function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.isOAS3;if(!o.a.Map.isMap(e))return{schema:o.a.Map(),parameterContentMediaType:null};if(!n)return"body"===e.get("in")?{schema:e.get("schema",o.a.Map()),parameterContentMediaType:null}:{schema:e.filter((function(e,t){return i.includes(t)})),parameterContentMediaType:null};if(e.get("content")){var r=e.get("content",o.a.Map({})).keySeq(),a=r.first();return{schema:e.getIn(["content",a,"schema"],o.a.Map()),parameterContentMediaType:a}}return{schema:e.get("schema",o.a.Map()),parameterContentMediaType:null}}},function(e,t,n){"use strict";n.r(t),n.d(t,"createStore",(function(){return C})),n.d(t,"combineReducers",(function(){return O})),n.d(t,"bindActionCreators",(function(){return j})),n.d(t,"applyMiddleware",(function(){return I})),n.d(t,"compose",(function(){return T}));var r=n(543),o="object"==typeof self&&self&&self.Object===Object&&self,i=(r.a||o||Function("return this")()).Symbol,a=Object.prototype,u=a.hasOwnProperty,s=a.toString,c=i?i.toStringTag:void 0;var l=function(e){var t=u.call(e,c),n=e[c];try{e[c]=void 0;var r=!0}catch(e){}var o=s.call(e);return r&&(t?e[c]=n:delete e[c]),o},f=Object.prototype.toString;var p=function(e){return f.call(e)},h=i?i.toStringTag:void 0;var d=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":h&&h in Object(e)?l(e):p(e)};var v=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object);var m=function(e){return null!=e&&"object"==typeof e},g=Function.prototype,y=Object.prototype,b=g.toString,_=y.hasOwnProperty,x=b.call(Object);var w=function(e){if(!m(e)||"[object Object]"!=d(e))return!1;var t=v(e);if(null===t)return!0;var n=_.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&b.call(n)==x},E=n(385),S="@@redux/INIT";function C(e,t,n){var r;if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(C)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var o=e,i=t,a=[],u=a,s=!1;function c(){u===a&&(u=a.slice())}function l(){return i}function f(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return c(),u.push(e),function(){if(t){t=!1,c();var n=u.indexOf(e);u.splice(n,1)}}}function p(e){if(!w(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(s)throw new Error("Reducers may not dispatch actions.");try{s=!0,i=o(i,e)}finally{s=!1}for(var t=a=u,n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(a)throw a;for(var r=!1,o={},u=0;u0&&(e.patches=[],e.callback&&e.callback(r)),r}function d(e,t,n,r,i){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var a=o._objectKeys(t),u=o._objectKeys(e),s=!1,c=u.length-1;c>=0;c--){var l=e[p=u[c]];if(!o.hasOwnProperty(t,p)||void 0===t[p]&&void 0!==l&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:"test",path:r+"/"+o.escapePathComponent(p),value:o._deepClone(l)}),n.push({op:"remove",path:r+"/"+o.escapePathComponent(p)}),s=!0):(i&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}),!0);else{var f=t[p];"object"==typeof l&&null!=l&&"object"==typeof f&&null!=f?d(l,f,n,r+"/"+o.escapePathComponent(p),i):l!==f&&(!0,i&&n.push({op:"test",path:r+"/"+o.escapePathComponent(p),value:o._deepClone(l)}),n.push({op:"replace",path:r+"/"+o.escapePathComponent(p),value:o._deepClone(f)}))}}if(s||a.length!=u.length)for(c=0;c0?r:n)(e)}},function(e,t){e.exports={}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t){e.exports=!0},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r=n(42),o=n(411),i=n(255),a=n(253)("IE_PROTO"),u=function(){},s=function(){var e,t=n(257)("iframe"),r=i.length;for(t.style.display="none",n(412).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("