merage : RV
This commit is contained in:
commit
a74038db28
@ -41,8 +41,8 @@ class Filters extends BaseConfig
|
||||
*/
|
||||
public array $globals = [
|
||||
'before' => [
|
||||
'HttpRequestLog',
|
||||
'csrf',
|
||||
'HttpRequestLog' => ['except' => 'processjob'],
|
||||
// 'csrf',
|
||||
// 'invalidchars',
|
||||
],
|
||||
'after' => [
|
||||
|
||||
@ -28,6 +28,7 @@ $routes->group("/dashboard", ["filter" => "authMVC"], function($routes){
|
||||
$routes->get("view", "DashboardController::dashboard");
|
||||
});
|
||||
|
||||
|
||||
$routes->group("/client", ["filter" => "authMVC"], function($routes){
|
||||
|
||||
$routes->get("list", "ClientController::index");
|
||||
@ -66,9 +67,94 @@ $routes->group("/client", ["filter" => "authMVC"], function($routes){
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$routes->group("/employee", ["filter" => "authMVC"], function($routes){
|
||||
$routes->get("list", "EmployeeController::list");
|
||||
$routes->get("search", "EmployeeController::search");
|
||||
$routes->get("bulk-event-uplod", "EmployeeController::employeesUplodWithEvents");
|
||||
$routes->post("bulk-event-uplod", "EmployeeController::employeesUplodWithEvents");
|
||||
});
|
||||
|
||||
|
||||
$routes->group("/master", ["filter" => "authMVC"], function($routes){
|
||||
|
||||
|
||||
$routes->group("insurer", ["filter" => "authMVC"], function($routes){
|
||||
$routes->get("list", "MasterController::insurerList");
|
||||
$routes->get("create", "MasterController::insurerOnboarding");
|
||||
$routes->post("createpost", "MasterController::createInsurerGeneralInfo");
|
||||
$routes->post("edit", "MasterController::editInsurerGeneralInfo");
|
||||
$routes->get("list/(:any)", "MasterController::editInsurerOnboarding/$1");
|
||||
|
||||
$routes->group("branch", ["filter" => "authMVC"], function($routes){
|
||||
$routes->post("create", "MasterController::createInsurerBranch");
|
||||
$routes->post("edit", "MasterController::editInsurerBranch");
|
||||
$routes->get("editget/(:any)", "MasterController::editInsurerGet/$1");
|
||||
$routes->get("list/(:any)", "MasterController::insurerBranchList/$1");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$routes->group("tpa", ["filter" => "authMVC"], function($routes){
|
||||
$routes->get("list", "MasterController::tpaList");
|
||||
$routes->get("create", "MasterController::tpaOnboarding");
|
||||
$routes->post("createpost", "MasterController::createTPAGeneralInfo");
|
||||
$routes->post("edit", "MasterController::editTPAGeneralInfo");
|
||||
$routes->get("list/(:any)", "MasterController::editTPAOnboarding/$1");
|
||||
|
||||
$routes->group("branch", ["filter" => "authMVC"], function($routes){
|
||||
$routes->post("create", "MasterController::createTPABranch");
|
||||
$routes->get("editget/(:any)", "MasterController::editTPAGet/$1");
|
||||
$routes->post("edit", "MasterController::editTPABranch");
|
||||
$routes->get("list/(:any)", "MasterController::tpaBranchList/$1");
|
||||
});
|
||||
});
|
||||
|
||||
$routes->group("kyc", ["filter" => "authMVC"], function($routes){
|
||||
$routes->get("list", "MasterController::kycList");
|
||||
$routes->get("create", "MasterController::kycOnboarding");
|
||||
$routes->post("createpost", "MasterController::createKYCInfo");
|
||||
$routes->post("edit", "MasterController::editKYCInfo");
|
||||
$routes->get("list/(:any)", "MasterController::editKYCOnboarding/$1");
|
||||
$routes->get("delete/(:any)", "MasterController::deleteClientKycDocs/$1");
|
||||
|
||||
|
||||
$routes->group("kycdocs", ["filter" => "authMVC"], function($routes){
|
||||
$routes->post("createpost", "MasterController::createKycDocs");
|
||||
$routes->get("editget/(:any)", "MasterController::editKYCGet/$1");
|
||||
$routes->post("edit", "MasterController::editKYCDocs");
|
||||
$routes->get("list", "MasterController::tpaBranchList");
|
||||
$routes->get("list/(:any)", "MasterController::kycDocsList/$1");
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$routes->group("policy", ["filter" => "authMVC"], function($routes){
|
||||
$routes->get("list", "MasterController::policyTypeList");
|
||||
$routes->get("create", "MasterController::policyTypeOnboarding");
|
||||
$routes->post("createpost", "MasterController::createPolicyType");
|
||||
$routes->post("edit", "MasterController::editPolicyType");
|
||||
$routes->get("list/(:any)", "MasterController::editPolicyTypeOnboarding/$1");
|
||||
|
||||
|
||||
$routes->group("policies", ["filter" => "authMVC"], function($routes){
|
||||
$routes->post("createpost", "MasterController::createPolicies");
|
||||
$routes->get("editget/(:any)", "MasterController::editPoliciesGet/$1");
|
||||
$routes->post("edit", "MasterController::editPolicies");
|
||||
$routes->get("list", "MasterController::tpaBranchList");
|
||||
$routes->get("list/(:any)", "MasterController::policesList/$1");
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$routes->group("/util", ["filter" => "authMVC"], function($routes){
|
||||
$routes->get("clients-with-policies", "EmployeeController::getClientWithPolicies");
|
||||
$routes->get("police-by-insurer/(:any)", "ClientController::getPolicesByInsurerId/$1");
|
||||
$routes->get("kyc-other-docs-delete/(:any)", "ClientController::deleteClientKycOtherDocs/$1");
|
||||
$routes->get("policy-premium", "ClientController::getpolicyGridData/$1");
|
||||
});
|
||||
|
||||
$routes->cli('processjob', 'JobWorker::processJob');
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ abstract class BaseController extends Controller
|
||||
}
|
||||
|
||||
|
||||
public function loadLayout($view_name,$data)
|
||||
public function loadLayout($view_name,$data = [])
|
||||
{
|
||||
echo view('layout/header',$data);
|
||||
echo view($view_name, $data);
|
||||
|
||||
140
app/Controllers/EmployeeController.php
Normal file
140
app/Controllers/EmployeeController.php
Normal file
@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\FileModel;
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
use App\Controllers\JobWorker ;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
class EmployeeController extends AdminController
|
||||
{
|
||||
|
||||
use ResponseTrait;
|
||||
|
||||
protected $myLogger;
|
||||
protected $employeeModel;
|
||||
protected $employeePolicyModel;
|
||||
protected $clientModel;
|
||||
protected $fileModel;
|
||||
public function __construct()
|
||||
{
|
||||
// helper('utility');
|
||||
set_session_context('Employee');
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->fileModel = new FileModel();
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
// $model = new UserModel();
|
||||
$data = [];
|
||||
if(count($this->request->getGet()))
|
||||
{
|
||||
$filterData = $this->request->getGet();
|
||||
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(client_id: $filterData['client_id'],policy_id: $filterData['policy_id']);
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error','list called');
|
||||
$this->loadLayout('employee_list',$data);
|
||||
}
|
||||
|
||||
public function getClientWithPolicies()
|
||||
{
|
||||
//echo $this->request->isAJAX();die();
|
||||
$result = $this->clientModel->clientsWithPolicies();
|
||||
// print_r($result);die();
|
||||
if(!count($result))
|
||||
{
|
||||
return $this->respond(['dataStatus' => false,'code' => 404,'message' => 'no data found'], 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return $this->respond(['dataStatus' => true,'code' => 200,'data' => $result], 200);
|
||||
}
|
||||
}
|
||||
|
||||
//handles employee & dependent bulk upload with events like inception,addition,deletion, correction and SI enhancements
|
||||
public function employeesUplodWithEvents()
|
||||
{
|
||||
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'add','payload' => ['a' => 10, 'b' => 35]]);
|
||||
// print_r($r);//die();
|
||||
// // $jobWorker = new JobWorker();
|
||||
// JobWorker::processJob($r);
|
||||
// die();
|
||||
// echo $this->request->getMethod();die();
|
||||
// print_r($this->request->getFiles('emplist'));print_r($this->request->getPost('emplist'));
|
||||
// print_r($this->request->getPost('clients'));
|
||||
// print_r($this->request->getPost('policies'));
|
||||
// print_r($this->request->getPost('upload-action-type'));
|
||||
// die();
|
||||
if($this->request->getMethod() == 'post')
|
||||
{
|
||||
$filename = '';
|
||||
$validated = $this->validate([
|
||||
'emplist' => [
|
||||
'uploaded[emplist]',
|
||||
'mime_in[emplist,application/vnd.ms-excel,application/vnd,application/pdf]',
|
||||
'max_size[emplist,8192]',
|
||||
],
|
||||
]);
|
||||
|
||||
if ($validated) {
|
||||
$avatar = $this->request->getFile('emplist');
|
||||
$is_moved = $avatar->move(WRITEPATH . 'uploads/excel/');
|
||||
$filename = $avatar->getName();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->respond(['dataStatus' => false,'code' => 404,'message' => 'invalid file'], 200);
|
||||
}
|
||||
|
||||
//process post variable entry in file table
|
||||
$loggedInUserID = get_session_userid();
|
||||
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$policy_id = $this->request->getPost('policy_id');
|
||||
$action = $this->request->getPost('upload-action-type');
|
||||
$status = 'inprogress';
|
||||
|
||||
$file_id = $this->fileModel->insert(['file_name' => $filename,'client_id' => $client_id,'policy_id' => $policy_id,'created_by' => $loggedInUserID,'status' => $status,'action' => $action]);
|
||||
//die();
|
||||
$this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]);
|
||||
return $this->respond(['dataStatus' => true,'code' => 200,'data' => 'file upload success'], 200);
|
||||
|
||||
}
|
||||
|
||||
$data['actions'] = ['inception' => 'Inception','addition' => 'Addition','deletion' => 'Deletion','si_enhancement' =>'SI Enhancement'];
|
||||
$data['fileList'] = $this->fileModel
|
||||
->select(['files.*','up.emp_code','up.first_name'])
|
||||
->join('user_profiles up','files.created_by = up.id')
|
||||
->where('files.created_by',8)->orderBy('files.created_at','desc')->findAll();
|
||||
// print_r($data['fileList']);die();
|
||||
if($this->request->getMethod() == "get")
|
||||
{
|
||||
$this->loadLayout('employee_upload',$data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -22,4 +22,10 @@ class Home extends PublicController
|
||||
return 'from test service';
|
||||
}
|
||||
|
||||
public function addTwoNumbers($payload)
|
||||
{
|
||||
//echo $payload['a'] + $payload['b'];
|
||||
return $payload['a'] + $payload['b'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
154
app/Controllers/JobWorker.php
Normal file
154
app/Controllers/JobWorker.php
Normal file
@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
|
||||
use App\Models\JobModel;
|
||||
class JobWorker extends AdminController
|
||||
{
|
||||
const STATUS_DONE = 'done';
|
||||
const STATUS_QUEUED = 'queued';
|
||||
const STATUS_RUNNING = 'running';
|
||||
const STATUS_FAILED = 'failed';
|
||||
/**
|
||||
* 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']];
|
||||
public function __construct()
|
||||
{
|
||||
// echo 'HiC';//die();
|
||||
// parent::__construct();
|
||||
// $this->load->model('JobModel');
|
||||
// $this->dbm = $this->users_model;
|
||||
// if (php_sapi_name() !== 'cli')
|
||||
// {
|
||||
// die('Invalid context');
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* process jobs
|
||||
*/
|
||||
public static function processJob(array $jobdata = [])
|
||||
{
|
||||
// echo 'listen';//die();
|
||||
$query = "
|
||||
SELECT id, name, payload, uuid
|
||||
FROM jobs
|
||||
WHERE status=?
|
||||
ORDER BY created_dt ASC
|
||||
LIMIT 1 FOR UPDATE";
|
||||
$where_condition = [self::STATUS_QUEUED];
|
||||
|
||||
if(isset($jobdata) && count($jobdata))
|
||||
{
|
||||
$query = "
|
||||
SELECT id, name, payload, uuid
|
||||
FROM jobs
|
||||
WHERE status=? AND id=? AND uuid=?
|
||||
ORDER BY created_dt ASC
|
||||
LIMIT 1 FOR UPDATE";
|
||||
$where_condition = [self::STATUS_QUEUED,$jobdata['id'],$jobdata['uuid']];
|
||||
}
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
$job = $db->query($query, $where_condition)->getResult();
|
||||
// print_r($job);die();
|
||||
if ($job !== [])
|
||||
{
|
||||
$job = $job[0];
|
||||
|
||||
echo "\nProcessing job id - " . $job->id . "\n";
|
||||
echo "Job name - " . $job->name . "\n";
|
||||
|
||||
try
|
||||
{
|
||||
$start = microtime(true);
|
||||
$runtime = null;
|
||||
$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))
|
||||
{
|
||||
throw new \RuntimeException('Job ' . $job->name . ' handler not registered');
|
||||
}
|
||||
|
||||
$handler = SELF::$event_class_mapping[$job->name];
|
||||
$handleInstance = null;
|
||||
|
||||
if($handler['type'] == 'CC' || $handler['type'] == 'HC')
|
||||
{
|
||||
// echo 'CLASS - ' . $handler['type'].' - ' . $handler['handler'];
|
||||
$handlerClass = $handler['handler'];
|
||||
if(class_exists($handlerClass))
|
||||
{
|
||||
$handleInstance = new $handlerClass();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \RuntimeException('Job ' . $job->name . ' or handler class not found');
|
||||
// echo $e->getMessage();
|
||||
}
|
||||
|
||||
if (method_exists($handleInstance, $job->name))
|
||||
{
|
||||
$jobHandler = [$handleInstance, $job->name];
|
||||
//throw new \RuntimeException('Job ' . $job->name . ' not found');
|
||||
}
|
||||
else if(method_exists($handleInstance, 'handle'))
|
||||
{
|
||||
$jobHandler = [$handleInstance, 'handle'];
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \RuntimeException('Job ' . $job->name . ' or handler not found');
|
||||
}
|
||||
}
|
||||
else if($handler['type'] == 'HF')
|
||||
{
|
||||
// echo 'HF - ' . $handler['type'];
|
||||
$jobHandler = $handleInstance = $handler['handler'];
|
||||
// echo $jobHandler;
|
||||
|
||||
}
|
||||
else{
|
||||
throw new \RuntimeException('Job ' . $job->name . ' Invalid job type');
|
||||
}
|
||||
|
||||
$payload = json_decode($job->payload, true);
|
||||
if (!is_array($payload))
|
||||
{
|
||||
throw new \InvalidArgumentException('Invalid payload format here');
|
||||
}
|
||||
|
||||
$payload = is_array($payload) ? $payload : [];
|
||||
$response = $jobHandler($payload,$job->id);
|
||||
|
||||
$runtime = microtime(true) - $start;
|
||||
$job_status = self::STATUS_DONE;
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
//die();
|
||||
$job_status = self::STATUS_FAILED;
|
||||
$runtime = $runtime === null ? microtime(true) - $start : $runtime;
|
||||
$response = $e->getMessage();
|
||||
}
|
||||
|
||||
$db->query("UPDATE jobs SET status=?, run_time=?, response=? WHERE id=? AND uuid=?", [
|
||||
$job_status,
|
||||
$runtime,
|
||||
json_encode($response),
|
||||
$job->id,$job->uuid
|
||||
]);
|
||||
|
||||
echo "Job $job->id $job_status. Response - $response \n";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'no job found in queue';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
64
app/Controllers/Jobs.php
Normal file
64
app/Controllers/Jobs.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
|
||||
use App\Models\JobModel;
|
||||
class Jobs extends AdminController
|
||||
{
|
||||
const STATUS_DONE = 'done';
|
||||
const STATUS_QUEUED = 'queued';
|
||||
const STATUS_RUNNING = 'running';
|
||||
const STATUS_FAILED = 'failed';
|
||||
|
||||
protected $job_payload = [];
|
||||
protected $myLogger;
|
||||
/**
|
||||
* Constructs the class
|
||||
*/
|
||||
// public function __construct(array $payload = ['job_name' => 'check','payload' => ['a' => 10]])
|
||||
public function __construct()
|
||||
{
|
||||
// $this->job_payload = $payload;
|
||||
// $this->myLogger = \Config\Services::mylogger();
|
||||
}
|
||||
|
||||
/**
|
||||
* add jobs to queue
|
||||
*/
|
||||
public static function addJob(array $payload)
|
||||
{
|
||||
$jobModel = new JobModel();
|
||||
$myLogger = \Config\Services::mylogger();
|
||||
|
||||
try
|
||||
{
|
||||
if(!is_array($payload))
|
||||
{
|
||||
throw new \InvalidArgumentException('Invalid payload format while add job');
|
||||
}
|
||||
|
||||
if(!isset($payload['job_name']))
|
||||
{
|
||||
throw new \InvalidArgumentException('Job name not found while add job');
|
||||
}
|
||||
|
||||
if(!isset($payload['payload']))
|
||||
{
|
||||
throw new \InvalidArgumentException('Job payload not found while add job');
|
||||
}
|
||||
|
||||
$uuid = generate_uuid();
|
||||
$jobid = $jobModel->insert(['name' => $payload['job_name'],'uuid' => $uuid,'payload' => json_encode($payload['payload'])]);
|
||||
// echo $jobid;
|
||||
$myLogger->logme('error','new job {jobid} added to queue',['jobid' => $jobid]);
|
||||
return ['id' => $jobid,'uuid' => $uuid,'job_name' => $payload['job_name']];
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
$message = $e->getMessage();
|
||||
$myLogger->logme('error','{messgae}',['messgae' => $message]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
15
app/Controllers/Jobs/AddJob.php
Normal file
15
app/Controllers/Jobs/AddJob.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Jobs;
|
||||
|
||||
use App\Controllers\PublicController;
|
||||
class AddJob extends PublicController
|
||||
{
|
||||
|
||||
public function handle($payload)
|
||||
{
|
||||
//echo $payload['a'] + $payload['b'];
|
||||
return $payload['a'] + $payload['b'];
|
||||
}
|
||||
|
||||
}
|
||||
14
app/Controllers/Jobs/SubJob.php
Normal file
14
app/Controllers/Jobs/SubJob.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Jobs;
|
||||
|
||||
use App\Controllers\PublicController;
|
||||
|
||||
class SubJob extends PublicController
|
||||
{
|
||||
public function handle($payload)
|
||||
{
|
||||
return $payload['a'] - $payload['b'];
|
||||
}
|
||||
|
||||
}
|
||||
877
app/Controllers/MasterController.php
Normal file
877
app/Controllers/MasterController.php
Normal file
@ -0,0 +1,877 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
use App\Models\UserModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\ClientBranchModel;
|
||||
use App\Models\ClientKYCDocsModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\ClientRMModel;
|
||||
use App\Models\InsurerBranchModel;
|
||||
use App\Models\InsurerModel;
|
||||
use App\Models\KYCDocsModel;
|
||||
use App\Models\KYCEntityTypeModel;
|
||||
use App\Models\LevelContactModel;
|
||||
use App\Models\PolicesModel;
|
||||
use App\Models\TPABranchModel;
|
||||
use App\Models\TPAModel;
|
||||
use App\Models\StateModel;
|
||||
use App\Models\PolicyTypeModel;
|
||||
|
||||
class MasterController extends AdminController
|
||||
{
|
||||
use ResponseTrait;
|
||||
|
||||
protected $myLogger;
|
||||
protected $insurerModel;
|
||||
protected $userModel;
|
||||
protected $insurerBranchModel;
|
||||
protected $insurerKYCDocsModel;
|
||||
protected $insurerPolicyModel;
|
||||
protected $insurerRMModel;
|
||||
protected $kycDocsModel;
|
||||
protected $kycEntityTypeModel;
|
||||
protected $levelContactModel;
|
||||
protected $policesModel;
|
||||
protected $tpaBranchModel;
|
||||
protected $tpaModel;
|
||||
protected $stateModel;
|
||||
protected $policyTypeModel;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
set_session_context('Master');
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
|
||||
$this->insurerModel = new ClientModel();
|
||||
$this->userModel = new UserModel();
|
||||
// $this->insurerBranchModel = new ClientBranchModel();
|
||||
$this->insurerKYCDocsModel = new ClientKYCDocsModel();
|
||||
$this->insurerPolicyModel = new ClientPolicyModel();
|
||||
$this->insurerRMModel = new ClientRMModel();
|
||||
$this->insurerBranchModel = new InsurerBranchModel();
|
||||
$this->insurerModel = new InsurerModel();
|
||||
$this->kycDocsModel = new KYCDocsModel();
|
||||
$this->kycEntityTypeModel = new KYCEntityTypeModel();
|
||||
$this->levelContactModel = new LevelContactModel();
|
||||
$this->policesModel = new PolicesModel();
|
||||
$this->tpaBranchModel = new TPABranchModel();
|
||||
$this->tpaModel = new TPAModel();
|
||||
$this->stateModel = new StateModel();
|
||||
$this->policyTypeModel = new PolicyTypeModel();
|
||||
}
|
||||
|
||||
public function insurerList()
|
||||
{
|
||||
$this->myLogger->logme('error','Insurer list function called');
|
||||
$headerData['page_name'] = 'Insurer List';
|
||||
$data['insurerList'] = $this->insurerModel->findAll();
|
||||
$data['insurer_rm'] = $this->insurerRMModel->getAllClientRM();
|
||||
// echo '<pre>';
|
||||
// print_r($data['insurerList']); die;
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('insurer_list', $data);
|
||||
echo view('layout/footer');
|
||||
|
||||
// $this->loadLayout('insurer_onboarding', $data);
|
||||
}
|
||||
|
||||
|
||||
public function editInsurerOnboarding($id = null)
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Edit Insurer Onboarding function called');
|
||||
$headerData['page_name'] = 'Edit Insurer Onboarding';
|
||||
|
||||
$types = array(
|
||||
(object) array('id' => 'pvt', 'name' => 'PVT'),
|
||||
(object) array('id' => 'psu', 'name' => 'PSU')
|
||||
);
|
||||
|
||||
$editData['types'] = $types;
|
||||
$editData['RM'] = $this->userModel->findAll();
|
||||
$editData['tpa'] = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
|
||||
$editData['state'] = $this->stateModel->getAllStates();
|
||||
$editData['insurer'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
|
||||
|
||||
|
||||
$editData['insurer'] = $this->insurerModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$editData['insuer_branch'] = $this->insurerBranchModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll();
|
||||
|
||||
|
||||
// echo "<pre>";
|
||||
// print_r($editData); die;
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('insurer_onboarding', $editData);
|
||||
echo view('layout/footer');
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function insurerOnboarding()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Insurer Onboarding function called');
|
||||
$headerData['page_name'] = 'Insurer Onboarding';
|
||||
|
||||
$types = array(
|
||||
(object) array('id' => 'pvt', 'name' => 'PVT'),
|
||||
(object) array('id' => 'psu', 'name' => 'PSU')
|
||||
);
|
||||
|
||||
$data['types'] = $types;
|
||||
// print_r($data['types']);die();
|
||||
$data['entity'] = $this->kycEntityTypeModel->findAll();
|
||||
$data['kyc_docs'] = $this->kycDocsModel->findAll();
|
||||
$data['police'] = $this->policesModel->findAll();
|
||||
$data['insurer'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
|
||||
$data['tpa'] = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
|
||||
$data['state'] = $this->stateModel->getAllStates();
|
||||
$data['RM'] = $this->userModel->findAll();
|
||||
|
||||
// echo "<pre>";
|
||||
// print_r($data); die;
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('insurer_onboarding', $data);
|
||||
echo view('layout/footer');
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function createInsurerGeneralInfo()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Insurer general info function called');
|
||||
$data = $this->request->getPost();
|
||||
$data['created_by'] = get_session_userid();
|
||||
|
||||
$insert = $this->insurerModel->insert($data);
|
||||
if($insert){
|
||||
$insurer_data = $this->insurerModel->where(['id' => $insert, 'is_active' => 1])->first();
|
||||
echo json_encode(array("status" => true , 'data' => $insurer_data));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
public function createInsurerBranch()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Client branch CREATE function called');
|
||||
$data = $this->request->getPost();
|
||||
$data['created_by'] = get_session_userid();
|
||||
$insert = $this->insurerBranchModel->insert($data);
|
||||
|
||||
if($insert){
|
||||
for ($i = 0; $i < count($this->request->getPost('name')); $i++) {
|
||||
// Prepare data to insert
|
||||
$data = [
|
||||
'contact_type' => 'insurer',
|
||||
'ref_id' => $insert,
|
||||
'created_by' => get_session_userid(),
|
||||
'name' => $this->request->getPost('name')[$i],
|
||||
'email' => $this->request->getPost('email')[$i],
|
||||
'mobile' => $this->request->getPost('mobile')[$i],
|
||||
'designation' => $this->request->getPost('designation')[$i]
|
||||
];
|
||||
$contacts = $this->levelContactModel->insert($data);
|
||||
}
|
||||
}
|
||||
|
||||
if($insert){
|
||||
$branchData = $this->insurerBranchModel->where('insurer_id', $this->request->getPost('insurer_id'))->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $branchData));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function insurerBranchList($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Edit Insurer Onboarding function called');
|
||||
|
||||
$editData['insuer_branch'] = $this->insurerBranchModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll();
|
||||
|
||||
// Return JSON response
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($editData);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function editInsurerGeneralInfo()
|
||||
{
|
||||
$this->myLogger->logme('error','edit Insurer general info function called');
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
$data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$update = $this->insurerModel->update($id,$data);
|
||||
if($update){
|
||||
echo json_encode(array("status" => true , 'data' => $data));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function editInsurerGet($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Edit TPA Onboarding function called');
|
||||
|
||||
|
||||
$editData['insurerbranch'] = $this->insurerBranchModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$editData['levelcontact'] = $this->levelContactModel->where(['ref_id' => $id, 'contact_type' => 'insurer' , 'is_active' => 1])->findAll();
|
||||
// print_r($editData['tpa']);
|
||||
// Return JSON response
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($editData);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function editInsurerBranch()
|
||||
{
|
||||
$this->myLogger->logme('error','Insurer branch CREATE function called');
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
$data = $this->request->getPost();
|
||||
$update = $this->insurerBranchModel->update($id, $data);
|
||||
|
||||
// print_r($this->request->getPost('name[]'));
|
||||
// print_r($this->request->getPost('email[]'));
|
||||
// print_r($this->request->getPost('mobile[]'));
|
||||
// print_r($this->request->getPost('designation[]'));
|
||||
|
||||
if($update){
|
||||
$contactsToDelete = $this->levelContactModel->where(['ref_id' => $id,'contact_type' => 'insurer', 'is_active' => 1])->get()->getResult();
|
||||
foreach ($contactsToDelete as $contact) {
|
||||
$this->levelContactModel->delete($contact->id);
|
||||
}
|
||||
for ($i = 0; $i < count($this->request->getPost('name')); $i++) {
|
||||
// Prepare data to update
|
||||
$data = [
|
||||
'contact_type' => 'insurer',
|
||||
'ref_id' => $id,
|
||||
'created_by' => get_session_userid(),
|
||||
'name' => $this->request->getPost('name')[$i],
|
||||
'email' => $this->request->getPost('email')[$i],
|
||||
'mobile' => $this->request->getPost('mobile')[$i],
|
||||
'designation' => $this->request->getPost('designation')[$i]
|
||||
];
|
||||
$contacts = $this->levelContactModel->insert($data);
|
||||
}
|
||||
}
|
||||
|
||||
if($update){
|
||||
$branchData = $this->tpaBranchModel->where('tpa_id', $this->request->getPost('tpa_id'))->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $branchData));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Insurer Ends
|
||||
|
||||
|
||||
|
||||
|
||||
// TPA Start
|
||||
|
||||
|
||||
public function tpaList()
|
||||
{
|
||||
$this->myLogger->logme('error','TPA list function called');
|
||||
$headerData['page_name'] = 'TPA List';
|
||||
$data['tpaList'] = $this->tpaModel->findAll();
|
||||
// $data['insurer_rm'] = $this->insurerRMModel->getAllClientRM();
|
||||
// echo '<pre>';
|
||||
// print_r($data['insurerList']); die;
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('tpa_list', $data);
|
||||
echo view('layout/footer');
|
||||
|
||||
// $this->loadLayout('insurer_onboarding', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function tpaOnboarding()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','TPA Onboarding function called');
|
||||
$headerData['page_name'] = 'TPA Onboarding';
|
||||
|
||||
|
||||
// print_r($data['types']);die();
|
||||
$data['entity'] = $this->kycEntityTypeModel->findAll();
|
||||
$data['kyc_docs'] = $this->kycDocsModel->findAll();
|
||||
$data['police'] = $this->policesModel->findAll();
|
||||
$data['insurer'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
|
||||
$data['tpa'] = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
|
||||
$data['state'] = $this->stateModel->getAllStates();
|
||||
$data['RM'] = $this->userModel->findAll();
|
||||
|
||||
// echo "<pre>";
|
||||
// print_r($data); die;
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('tpa_onboarding', $data);
|
||||
echo view('layout/footer');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function createTPAGeneralInfo()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','TPA general info function called');
|
||||
$data = $this->request->getPost();
|
||||
$data['created_by'] = get_session_userid();
|
||||
|
||||
$insert = $this->tpaModel->insert($data);
|
||||
if($insert){
|
||||
$tpa_data = $this->tpaModel->where(['id' => $insert, 'is_active' => 1])->first();
|
||||
echo json_encode(array("status" => true , 'data' => $tpa_data));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function createTPABranch()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','TPA branch CREATE function called');
|
||||
$data = $this->request->getPost();
|
||||
$data['created_by'] = get_session_userid();
|
||||
$insert = $this->tpaBranchModel->insert($data);
|
||||
|
||||
if($insert){
|
||||
for ($i = 0; $i < count($this->request->getPost('name')); $i++) {
|
||||
// Prepare data to insert
|
||||
$data = [
|
||||
'contact_type' => 'tpa',
|
||||
'ref_id' => $insert,
|
||||
'created_by' => get_session_userid(),
|
||||
'name' => $this->request->getPost('name')[$i],
|
||||
'email' => $this->request->getPost('email')[$i],
|
||||
'mobile' => $this->request->getPost('mobile')[$i],
|
||||
'designation' => $this->request->getPost('designation')[$i]
|
||||
];
|
||||
$contacts = $this->levelContactModel->insert($data);
|
||||
}
|
||||
}
|
||||
|
||||
if($insert){
|
||||
$branchData = $this->tpaBranchModel->where('tpa_id', $this->request->getPost('tpa_id'))->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $branchData));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function editTPAOnboarding($id = null)
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Edit TPA Onboarding function called');
|
||||
$headerData['page_name'] = 'Edit TPA Onboarding';
|
||||
|
||||
$editData['tpa'] = $this->tpaModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$editData['tpa_branch'] = $this->tpaBranchModel->where(['tpa_id' => $id, 'is_active' => 1])->findAll();
|
||||
$editData['state'] = $this->stateModel->getAllStates();
|
||||
|
||||
|
||||
// echo "<pre>";
|
||||
// print_r($editData); die;
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('tpa_onboarding', $editData);
|
||||
echo view('layout/footer');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function editTPAGeneralInfo()
|
||||
{
|
||||
$this->myLogger->logme('error','edit TPA general info function called');
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
$data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$update = $this->tpaModel->update($id,$data);
|
||||
if($update){
|
||||
echo json_encode(array("status" => true , 'data' => $data));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function editTPAGet($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Edit TPA Onboarding function called');
|
||||
|
||||
|
||||
$editData['tpabranch'] = $this->tpaBranchModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$editData['levelcontact'] = $this->levelContactModel->where(['ref_id' => $id, 'contact_type' => 'tpa' , 'is_active' => 1])->findAll();
|
||||
// print_r($editData['tpa']);
|
||||
// Return JSON response
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($editData);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function editTPABranch()
|
||||
{
|
||||
$this->myLogger->logme('error','TPA branch CREATE function called');
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
$data = $this->request->getPost();
|
||||
$update = $this->tpaBranchModel->update($id, $data);
|
||||
|
||||
// print_r($this->request->getPost('name[]'));
|
||||
// print_r($this->request->getPost('email[]'));
|
||||
// print_r($this->request->getPost('mobile[]'));
|
||||
// print_r($this->request->getPost('designation[]'));
|
||||
|
||||
if($update){
|
||||
$contactsToDelete = $this->levelContactModel->where(['ref_id' => $id,'contact_type' => 'tpa', 'is_active' => 1])->get()->getResult();
|
||||
foreach ($contactsToDelete as $contact) {
|
||||
$this->levelContactModel->delete($contact->id);
|
||||
}
|
||||
for ($i = 0; $i < count($this->request->getPost('name')); $i++) {
|
||||
// Prepare data to update
|
||||
$data = [
|
||||
'contact_type' => 'tpa',
|
||||
'ref_id' => $id,
|
||||
'created_by' => get_session_userid(),
|
||||
'name' => $this->request->getPost('name')[$i],
|
||||
'email' => $this->request->getPost('email')[$i],
|
||||
'mobile' => $this->request->getPost('mobile')[$i],
|
||||
'designation' => $this->request->getPost('designation')[$i]
|
||||
];
|
||||
$contacts = $this->levelContactModel->insert($data);
|
||||
}
|
||||
}
|
||||
|
||||
if($update){
|
||||
$branchData = $this->tpaBranchModel->where('tpa_id', $this->request->getPost('tpa_id'))->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $branchData));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function tpaBranchList($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','TPA List function called');
|
||||
|
||||
$editData['tpa_branch'] = $this->tpaBranchModel->where(['tpa_id' => $id, 'is_active' => 1])->findAll();
|
||||
|
||||
// Return JSON response
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($editData);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Ends TPA Models
|
||||
|
||||
//Start KYC
|
||||
|
||||
|
||||
public function kycList()
|
||||
{
|
||||
$this->myLogger->logme('error','KYC list function called');
|
||||
$headerData['page_name'] = 'KYC List';
|
||||
$data['kycList'] = $this->kycEntityTypeModel->findAll();
|
||||
// $data['insurer_rm'] = $this->insurerRMModel->getAllClientRM();
|
||||
// echo '<pre>';
|
||||
// print_r($data['insurerList']); die;
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('kyc_list', $data);
|
||||
echo view('layout/footer');
|
||||
|
||||
// $this->loadLayout('insurer_onboarding', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function kycOnboarding()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','KYC Onboarding function called');
|
||||
$headerData['page_name'] = 'KYC Onboarding';
|
||||
|
||||
|
||||
// print_r($data['types']);die();
|
||||
$data['entity'] = $this->kycEntityTypeModel->findAll();
|
||||
$data['kyc_docs'] = $this->kycDocsModel->findAll();
|
||||
$data['police'] = $this->policesModel->findAll();
|
||||
$data['insurer'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
|
||||
$data['tpa'] = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
|
||||
$data['state'] = $this->stateModel->getAllStates();
|
||||
$data['RM'] = $this->userModel->findAll();
|
||||
|
||||
// echo "<pre>";
|
||||
// print_r($data); die;
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('kyc_onboarding', $data);
|
||||
echo view('layout/footer');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function createKYCInfo()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','KYC Entity Type general info function called');
|
||||
$data = $this->request->getPost();
|
||||
$data['created_by'] = get_session_userid();
|
||||
|
||||
$insert = $this->kycEntityTypeModel->insert($data);
|
||||
if($insert){
|
||||
$kyc_data = $this->kycEntityTypeModel->where(['id' => $insert, 'is_active' => 1])->first();
|
||||
echo json_encode(array("status" => true , 'data' => $kyc_data));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function createKycDocs()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Kyc Docs CREATE function called');
|
||||
$data = $this->request->getPost();
|
||||
$data['created_by'] = get_session_userid();
|
||||
$insert = $this->kycDocsModel->insert($data);
|
||||
|
||||
if($insert){
|
||||
$kycDocsData = $this->kycDocsModel->where('kyc_type_id', $this->request->getPost('kyc_type_id'))->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $kycDocsData));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function editKYCOnboarding($id = null)
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Edit KYC Onboarding function called');
|
||||
$headerData['page_name'] = 'Edit KYC Onboarding';
|
||||
|
||||
$editData['kyc'] = $this->kycEntityTypeModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$editData['kyc_docs'] = $this->kycDocsModel->where(['kyc_type_id' => $id, 'is_active' => 1])->findAll();
|
||||
|
||||
|
||||
// echo "<pre>";
|
||||
// print_r($editData); die;
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('kyc_onboarding', $editData);
|
||||
echo view('layout/footer');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function kycDocsList($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Edit KYC Docs Onboarding function called');
|
||||
|
||||
$editData['kyc_docs'] = $this->kycDocsModel->where(['kyc_type_id' => $id, 'is_active' => 1])->findAll();
|
||||
|
||||
// Return JSON response
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($editData);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function editKYCInfo()
|
||||
{
|
||||
$this->myLogger->logme('error','edit KYC general info function called');
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
$data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$update = $this->kycEntityTypeModel->update($id,$data);
|
||||
if($update){
|
||||
echo json_encode(array("status" => true , 'data' => $data));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function editKYCGet($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Edit KYC Onboarding function called');
|
||||
|
||||
$editData['policies'] = $this->kycDocsModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
|
||||
// Return JSON response
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($editData);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function editKYCDocs()
|
||||
{
|
||||
$this->myLogger->logme('error','edit KYC Docs function called');
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
$data['file_name'] = $this->request->getPost('file_name');
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$update = $this->kycDocsModel->update($id,$data);
|
||||
if($update){
|
||||
echo json_encode(array("status" => true , 'data' => $data));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Ends KYC
|
||||
|
||||
//Start Policy
|
||||
|
||||
|
||||
public function policyTypeList()
|
||||
{
|
||||
$this->myLogger->logme('error','Policy Type list function called');
|
||||
$headerData['page_name'] = 'Policy Type List';
|
||||
$data['policyList'] = $this->policyTypeModel->findAll();
|
||||
// $data['insurer_rm'] = $this->insurerRMModel->getAllClientRM();
|
||||
// echo '<pre>';
|
||||
// print_r($data['insurerList']); die;
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('policy_type_list', $data);
|
||||
echo view('layout/footer');
|
||||
|
||||
// $this->loadLayout('insurer_onboarding', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function policyTypeOnboarding()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Policy Type Onboarding function called');
|
||||
$headerData['page_name'] = 'Policy Type Onboarding';
|
||||
|
||||
|
||||
// print_r($data['types']);die();
|
||||
$data['entity'] = $this->kycEntityTypeModel->findAll();
|
||||
$data['kyc_docs'] = $this->kycDocsModel->findAll();
|
||||
$data['police'] = $this->policesModel->findAll();
|
||||
// $data['insurer'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
|
||||
$data['tpa'] = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
|
||||
$data['state'] = $this->stateModel->getAllStates();
|
||||
$data['RM'] = $this->userModel->findAll();
|
||||
$data['policy_type'] = $this->policyTypeModel->findAll();
|
||||
$data['insurer'] = $this->insurerModel ->findAll();
|
||||
// echo "<pre>";
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('policy_type_onboarding', $data);
|
||||
echo view('layout/footer');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function createPolicies()
|
||||
{
|
||||
$this->myLogger->logme('error','Policies CREATE function called');
|
||||
$data = $this->request->getPost();
|
||||
// print_r($data);
|
||||
// die();
|
||||
$data['created_by'] = get_session_userid();
|
||||
$insert = $this->policesModel->insert($data);
|
||||
if($insert){
|
||||
$policiesData = $this->policesModel->where('policy_type_id', $this->request->getPost('policy_type_id'))->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $policiesData));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function createPolicyType()
|
||||
{
|
||||
$this->myLogger->logme('error','Policy Type CREATE function called');
|
||||
$data = $this->request->getPost();
|
||||
|
||||
$data['created_by'] = get_session_userid();
|
||||
$insert = $this->policyTypeModel->insert($data);
|
||||
|
||||
if($insert){
|
||||
$policyTypeData = $this->policyTypeModel->where('id', $insert)->first();
|
||||
echo json_encode(array("status" => true , 'data' => $policyTypeData));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function editPolicyTypeOnboarding($id = null)
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Edit KYC Onboarding function called');
|
||||
$headerData['page_name'] = 'Edit KYC Onboarding';
|
||||
|
||||
$editData['policytype'] = $this->policyTypeModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$editData['policies'] = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll();
|
||||
$editData['insurer'] = $this->insurerModel-> findAll();
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('policy_type_onboarding', $editData);
|
||||
echo view('layout/footer');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function editPolicyType()
|
||||
{
|
||||
$this->myLogger->logme('error','edit Policy general info function called');
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
$data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$update = $this->policyTypeModel->update($id,$data);
|
||||
if($update){
|
||||
echo json_encode(array("status" => true , 'data' => $data));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function policesList($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Edit Policies Onboarding function called');
|
||||
|
||||
// $editData['policies'] = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll();
|
||||
|
||||
$policies = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll();
|
||||
|
||||
foreach ($policies as $policy) {
|
||||
// Retrieve the insurer information
|
||||
$insurer = $this->insurerModel->find($policy['insurer_id']);
|
||||
|
||||
// Add the insurer information to the editData array
|
||||
if ($insurer) {
|
||||
$editData['policies'][$policy['id']] = [
|
||||
'policy' => $policy,
|
||||
'insurer' => $insurer
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Return JSON response
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($editData);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function editPoliciesGet($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Edit Policies Onboarding function called');
|
||||
|
||||
$editData['policies'] = $this->policesModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
|
||||
// Return JSON response
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($editData);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function editPolicies()
|
||||
{
|
||||
$this->myLogger->logme('error','edit Policy general info function called');
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
$data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$update = $this->policesModel->update($id,$data);
|
||||
if($update){
|
||||
echo json_encode(array("status" => true , 'data' => $data));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -22,4 +22,6 @@ class HttpRequestHelper
|
||||
$data['postparams'] = is_array($data['postparams']) ? json_encode($data['postparams']) : $data['postparams'];
|
||||
return $data;
|
||||
}
|
||||
public static function add($payload)
|
||||
{return $payload['a'] + $payload['b'];}
|
||||
}
|
||||
|
||||
@ -70,3 +70,49 @@ if (!function_exists('file_Upload')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('fancy_date_time_format'))
|
||||
{
|
||||
function fancy_date_time_format($datetime,$return_type = 'fancy') {
|
||||
$currentDateTime = new DateTime();
|
||||
$passedDateTime = new DateTime($datetime);
|
||||
|
||||
|
||||
// Calculate the interval between the current time and the passed datetime
|
||||
$interval = $currentDateTime->diff($passedDateTime);
|
||||
// return change_date_format($datetime,'Y-m-d H:i:s','d M Y h:i a');
|
||||
// If the interval is more than 1 month, return the original datetime
|
||||
if ($interval->m > 1 || $interval->y > 0) {
|
||||
if($return_type = 'fancy'){ return change_date_format($datetime,'Y-m-d H:i:s','d M Y h:i a'); }
|
||||
return $datetime;
|
||||
} elseif ($interval->m == 1 && $interval->y == 0) {
|
||||
return "1 month ago";
|
||||
} elseif ($interval->d >= 7) {
|
||||
$weeks = floor($interval->d / 7);
|
||||
return $weeks == 1 ? "1 week ago" : "$weeks weeks ago";
|
||||
} elseif ($interval->d >= 1) {
|
||||
return $interval->d == 1 ? "1 day ago" : $interval->d . " days ago";
|
||||
} elseif ($interval->h >= 1) {
|
||||
return $interval->h == 1 ? "1 hour ago" : $interval->h . " hours ago";
|
||||
} elseif ($interval->i >= 1) {
|
||||
return $interval->i == 1 ? "1 minute ago" : $interval->i . " minutes ago";
|
||||
} else {
|
||||
return "Just now";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(!function_exists('check_string_date'))
|
||||
{
|
||||
function check_string_date($str)
|
||||
{
|
||||
if (DateTime::createFromFormat('Y-m-d H:i:s', $str) !== false) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
use App\Models\ClientPolicyModel;
|
||||
|
||||
class ClientModel extends Model
|
||||
{
|
||||
@ -25,6 +26,30 @@ class ClientModel extends Model
|
||||
"is_active",
|
||||
];
|
||||
|
||||
|
||||
|
||||
//get client and its associated policies in same array
|
||||
public function clientsWithPolicies()
|
||||
{
|
||||
|
||||
$columns = ['id', 'client_name','short_name'];
|
||||
$clients = $this->select($columns)->where('is_active',1)->findAll();
|
||||
|
||||
foreach ($clients as &$client) {
|
||||
$clientPolicyModel = new ClientPolicyModel();
|
||||
$clientPolicies = $clientPolicyModel->select(['client_policy.id','p.name'])
|
||||
->join('policies p', 'p.id = client_policy.policy_id')
|
||||
->where('client_policy.client_id',$client['id'])
|
||||
->where('client_policy.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$client['policies'] = $clientPolicies;
|
||||
}
|
||||
//print_r(($clients));die();
|
||||
return $clients;
|
||||
}
|
||||
|
||||
|
||||
public function getCreatedByUserName(){
|
||||
|
||||
return $this->db->table('clients')
|
||||
@ -37,3 +62,4 @@ class ClientModel extends Model
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
29
app/Models/EmployeeModel.php
Normal file
29
app/Models/EmployeeModel.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class EmployeeModel extends Model
|
||||
{
|
||||
protected $table = 'employees';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"employee_id",
|
||||
"change_event",
|
||||
"relationship_id",
|
||||
"batch_id",
|
||||
"emp_code",
|
||||
"name",
|
||||
"email_personal",
|
||||
"email_corporate",
|
||||
"mobile",
|
||||
"gender",
|
||||
"dob",
|
||||
"emp_status",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
];
|
||||
}
|
||||
48
app/Models/EmployeePolicyModel.php
Normal file
48
app/Models/EmployeePolicyModel.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class EmployeePolicyModel extends Model
|
||||
{
|
||||
protected $table = 'employee_polices';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"employee_id",
|
||||
"client_policy_id",
|
||||
"tpa_id",
|
||||
"uhid",
|
||||
"status",
|
||||
"pre_existing_alignments",
|
||||
"basic_cover_si",
|
||||
"date_coverage",
|
||||
"policy_end_date",
|
||||
"days",
|
||||
"premium",
|
||||
"rata_premimum",
|
||||
"gst",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
];
|
||||
|
||||
|
||||
public function getEmployeePolicy($client_id,$policy_id)
|
||||
{
|
||||
$result = $this->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active'])
|
||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
||||
->join('policies pm', 'cp.policy_id = pm.id') //pm - policy master
|
||||
->join('insurers im', 'cp.insurer_id = im.id') //im - insurar master
|
||||
->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurar branch
|
||||
->join('tpa tpam', 'cp.tpa_id = tpam.id') //tpam - tpa master
|
||||
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id') //tpab - tpa brach
|
||||
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
||||
->where('emp.client_id',$client_id)
|
||||
->where('employee_polices.client_policy_id',$policy_id)
|
||||
->findAll();
|
||||
return ($result);
|
||||
}
|
||||
}
|
||||
25
app/Models/FileModel.php
Normal file
25
app/Models/FileModel.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class FileModel extends Model
|
||||
{
|
||||
protected $table = 'files';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"file_name",
|
||||
"created_by",
|
||||
"is_active",
|
||||
"status",
|
||||
"reason",
|
||||
"action",
|
||||
"client_id",
|
||||
"policy_id"
|
||||
];
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -10,10 +10,24 @@ class InsurerModel extends Model
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"type",
|
||||
"name",
|
||||
"tpa_id",
|
||||
"short_name",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getCreatedByUserName(){
|
||||
|
||||
return $this->db->table('insurers')
|
||||
->select('insurers.*')
|
||||
// ->select('user_profiles.first_name as user_name')
|
||||
// ->join('user_profiles', 'user_profiles.id = clients.created_by')
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
20
app/Models/JobModel.php
Normal file
20
app/Models/JobModel.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class JobModel extends Model
|
||||
{
|
||||
protected $table = 'jobs';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"name",
|
||||
"payload",
|
||||
"response",
|
||||
"status",
|
||||
"run_time",
|
||||
"uuid"
|
||||
];
|
||||
}
|
||||
@ -11,6 +11,7 @@ class PolicesModel extends Model
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"insurer_id",
|
||||
"policy_type_id",
|
||||
"name",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
|
||||
21
app/Models/PolicyTypeModel.php
Normal file
21
app/Models/PolicyTypeModel.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class PolicyTypeModel extends Model
|
||||
{
|
||||
protected $table = 'policy_type';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"policy_type",
|
||||
"bap",
|
||||
"allocg",
|
||||
"alloci",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
];
|
||||
}
|
||||
@ -11,6 +11,7 @@ class TPAModel extends Model
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"name",
|
||||
"short_name",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
|
||||
@ -125,6 +125,9 @@ var branch_PrimaryKey_2 = $('#branch_PrimaryKey').val();
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
branch_PrimaryKey = $('#client_id_branch').val();
|
||||
branch_PrimaryKey_2 = $('#branch_PrimaryKey').val();
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('.btnBack').hide();
|
||||
|
||||
@ -146,6 +149,7 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('#btnBranchAdd').click(function(){
|
||||
|
||||
branch_form_action = '<?= base_url("client/branch/create"); ?>';
|
||||
@ -164,7 +168,6 @@ $(document).ready(function () {
|
||||
$('.ac').css('display', 'block');
|
||||
contactCount = 1
|
||||
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
for (var i = 0; i < buttonIds.length; i++) {
|
||||
var firstElement = buttonIds[i].split('_')[0];
|
||||
@ -224,11 +227,14 @@ $(document).ready(function () {
|
||||
|
||||
if (branch_PrimaryKey === '' || branch_PrimaryKey_2 === '') {
|
||||
toastr.error('Client is required', 'Error');
|
||||
$('#insurer').val('');
|
||||
$('#tpa').val('');
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||
return;
|
||||
}
|
||||
|
||||
var isValid = $('#branch_form').parsley().validate();
|
||||
|
||||
|
||||
if (isValid) {
|
||||
|
||||
var formData = new FormData($('#branch_form')[0]);
|
||||
@ -270,6 +276,7 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('body').on('click', '.btnBranchEdit', function () {
|
||||
|
||||
console.log(branch_form_action);
|
||||
@ -316,8 +323,6 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// Initialize the contact count
|
||||
function appendContactHtml(contact = false, reset = false) {
|
||||
|
||||
|
||||
255
app/Views/employee_list.php
Normal file
255
app/Views/employee_list.php
Normal file
@ -0,0 +1,255 @@
|
||||
|
||||
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Client</label> <br/>
|
||||
<select class="form-control" id="clients">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Policy</label> <br/>
|
||||
<select class="form-control" id="policies">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: right;">
|
||||
<a href="<?= base_url("employee/list"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title"></h4>
|
||||
<div class="page-title-right">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
<div class="row" id="client_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">Employees</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">SNO</th>
|
||||
<th class="font-weight-medium">Employee code</th>
|
||||
<th class="font-weight-medium">Name</th>
|
||||
<th class="font-weight-medium">Policy name</th>
|
||||
<th class="font-weight-medium">Insurar name</th>
|
||||
<th class="font-weight-medium">TPA ID</th>
|
||||
<th class="font-weight-medium">UHID ID</th>
|
||||
<th class="font-weight-medium">Policy status</th>
|
||||
<th class="font-weight-medium">Premium</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="font-12">
|
||||
<?php
|
||||
if(isset($employees))
|
||||
{
|
||||
foreach ($employees as $key => $employee) { ?>
|
||||
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<td><?php echo $employee['emp_code']?></td>
|
||||
<td><?php echo $employee['name']?></td>
|
||||
<td><?php echo $employee['policy_name']?></td>
|
||||
<td><?php echo $employee['insurer_short_name']?></td>
|
||||
<td><?php echo $employee['tpa_id']?></td>
|
||||
<td><?php echo $employee['uhid']?></td>
|
||||
<td><span class="badge badge-success">active</span></td>
|
||||
<td><?php echo $employee['premium']?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit Ticket</a>
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-check-all mr-2 text-muted font-18 vertical-middle"></i>Close</a>
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Remove</a>
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-star mr-2 font-18 text-muted vertical-middle"></i>Mark as Unread</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }}?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
<div id="loader" class="loader" style="display:none;">SPINNER</div>
|
||||
|
||||
<script>
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
|
||||
$( document ).ready(function() {
|
||||
console.log( "document loaded" );
|
||||
//fetchClientPolicies();
|
||||
|
||||
});
|
||||
|
||||
$( window ).on( "load", function() {
|
||||
console.log( "window loaded" );
|
||||
fetchClientPolicies();
|
||||
|
||||
});
|
||||
|
||||
|
||||
function fetchClientPolicies() {
|
||||
$('#loader').show();
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
||||
console.log('fetchClientPolicies');
|
||||
console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
// console.log(response.code);
|
||||
// console.log(response.dataStatus);
|
||||
// console.log(response.data);
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
clientPolicies = (response.data);
|
||||
// console.log(clientPolicies);
|
||||
appendClients(clientPolicies);
|
||||
} catch (error)
|
||||
{
|
||||
console.error('Error parsing API response data:', error);
|
||||
}
|
||||
} else if(response.code === 404 && response.dataStatus === false){
|
||||
console.error('no data found', response);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.error('Something went wrong!');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
});
|
||||
|
||||
$('#loader').hide();
|
||||
}
|
||||
|
||||
|
||||
function appendClients(data) {
|
||||
$.each(data, function(index, item) {
|
||||
$('#clients').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
function appendPolicies(data) {
|
||||
$('#policies').empty();
|
||||
$('#policies').append($('<option>', { value: '0',text: 'Select'}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
$('#policies').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.name
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
$('#clients').on('change', function() {
|
||||
var selectedClient = $(this).val();
|
||||
console.log(selectedClient);
|
||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||
|
||||
// Check if the selected option exists in apiData
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
return item.id === selectedClient;
|
||||
});
|
||||
console.log(foundPolicies.policies);
|
||||
appendPolicies(foundPolicies.policies);
|
||||
});
|
||||
|
||||
// Function to convert object to query parameters
|
||||
function objectToQueryString(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function fetchEmpolyeeList(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
var client_id = $('#clients').val();
|
||||
var policy_id = $('#policies').val();
|
||||
console.log(client_id+'-'+policy_id);
|
||||
if (client_id == '0' || policy_id == '0' ) {
|
||||
alert('Please select values in both dropdowns.');
|
||||
return;
|
||||
}
|
||||
|
||||
var queryParams = {
|
||||
client_id: client_id,
|
||||
policy_id: policy_id
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href')+"?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
|
||||
|
||||
// var apiURL2 = $('#get-emp-list').attr('href'); // Get href attribute value
|
||||
// console.log(apiURL);
|
||||
// $.ajax({
|
||||
// url: apiURL,
|
||||
// method: 'GET',
|
||||
// data: queryParams,
|
||||
// success: function(response) {
|
||||
// // Assuming response is a JSON array
|
||||
// // displayDataTables(response);
|
||||
// console.log(response);
|
||||
// },
|
||||
// error: function(xhr, status, error) {
|
||||
// console.error('Error:', error);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
305
app/Views/employee_upload.php
Normal file
305
app/Views/employee_upload.php
Normal file
@ -0,0 +1,305 @@
|
||||
<?php //echo fancy_date_time_format('2024-01-01 15:40:32');echo '<br>';?>
|
||||
<?php //echo fancy_date_time_format('2024-02-01 15:40:32');echo '<br>';?>
|
||||
<!-- <?php echo fancy_date_time_format('2024-02-10 15:40:32');echo '<br>';?> -->
|
||||
<!-- <?php echo fancy_date_time_format('2024-02-13 14:40:32');echo '<br>';?> -->
|
||||
<!-- <?php echo fancy_date_time_format('2024-02-13 14:58:00');echo '<br>';?> -->
|
||||
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<form id="emp-upload-form" action="<?php echo base_url().'employee/bulk-event-uplod'?>" method="post">
|
||||
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>" id="csrf_token">
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Client</label> <br/>
|
||||
<select name="client_id" class="form-control" id="client_id">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Policy</label> <br/>
|
||||
<select name="policy_id" class="form-control" id="policy_id">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Action</label> <br/>
|
||||
<select name="upload-action-type" class="form-control" id="upload-action-type">
|
||||
<option value="0">Select</option>
|
||||
<?php
|
||||
if(isset($actions) && count($actions))
|
||||
{
|
||||
foreach($actions as $key => $action)
|
||||
{
|
||||
echo "<option value=".$key.">".$action."</option>";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Choose file</label> <br/>
|
||||
<input type="file" name="emplist" id="emplist">
|
||||
</div></div>
|
||||
|
||||
<div class="col-8" style="text-align: right;">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title"></h4>
|
||||
<div class="page-title-right">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
<div class="row" id="file_list">
|
||||
<?php include('file_list.php');?>
|
||||
</div>
|
||||
<!-- end row -->
|
||||
<!-- Center modal content -->
|
||||
<div class="modal fade" id="file-err-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">File Rejected Reason</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h5>Overflowing text to show scroll behavior</h5>
|
||||
<p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
|
||||
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
<div id="loader" class="loader" style="display:none;">SPINNER</div>
|
||||
|
||||
<script>
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
|
||||
$( document ).ready(function() {
|
||||
console.log( "document loaded" );
|
||||
//fetchClientPolicies();
|
||||
//for modal pop up
|
||||
$('#file-err-modal').on('show.bs.modal', function (event) {
|
||||
var myVal = $(event.relatedTarget).data('err');
|
||||
$(this).find(".modal-body").text(myVal);
|
||||
});
|
||||
|
||||
//for form submit
|
||||
$("#emp-upload-form").submit(function(event) {
|
||||
event.preventDefault(); // Prevent default form submission
|
||||
console.log('submit called');
|
||||
// Check required fields
|
||||
if (!$(this)[0].checkValidity()) {
|
||||
// Form is invalid, handle error or notify user
|
||||
console.log('failed');
|
||||
return false;
|
||||
}
|
||||
console.log($(this));
|
||||
console.log($(this)[0]);
|
||||
|
||||
|
||||
// Create FormData object
|
||||
var formData = new FormData($(this)[0]);
|
||||
for (var pair of formData.entries()) {
|
||||
console.log(pair[0]+ ', ' + pair[1]);
|
||||
}
|
||||
// var formData = $("#emp-upload-form").serialize();
|
||||
// var file = document.getElementById('emplist').files[0];
|
||||
// formData.append('file', file);
|
||||
console.log(formData);
|
||||
// return false;
|
||||
// AJAX request
|
||||
$.ajax({
|
||||
url: $(this).attr("action"),
|
||||
type: "POST",
|
||||
data: formData,
|
||||
processData: false, // Prevent jQuery from automatically processing the data
|
||||
contentType: false, // Let jQuery handle the content type
|
||||
headers: {
|
||||
// "Content-Type":"multipart/form-data",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
// Request successful, handle response
|
||||
console.log(response);
|
||||
alert('success');
|
||||
window.location.reload();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Request failed, handle error
|
||||
console.error("Request failed:", status, error);
|
||||
alert('falied try again');
|
||||
}
|
||||
});
|
||||
});//end
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
$( window ).on( "load", function() {
|
||||
console.log( "window loaded" );
|
||||
fetchClientPolicies();
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
function fetchClientPolicies() {
|
||||
$('#loader').show();
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
||||
console.log('fetchClientPolicies');
|
||||
console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
// console.log(response.code);
|
||||
// console.log(response.dataStatus);
|
||||
// console.log(response.data);
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
clientPolicies = (response.data);
|
||||
// console.log(clientPolicies);
|
||||
appendClients(clientPolicies);
|
||||
} catch (error)
|
||||
{
|
||||
console.error('Error parsing API response data:', error);
|
||||
}
|
||||
} else if(response.code === 404 && response.dataStatus === false){
|
||||
console.error('no data found', response);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.error('Something went wrong!');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
});
|
||||
|
||||
$('#loader').hide();
|
||||
}
|
||||
|
||||
|
||||
function appendClients(data) {
|
||||
$.each(data, function(index, item) {
|
||||
$('#client_id').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
function appendPolicies(data) {
|
||||
$('#policy_id').empty();
|
||||
$('#policy_id').append($('<option>', { value: '0',text: 'Select'}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
$('#policy_id').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.name
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
$('#client_id').on('change', function() {
|
||||
var selectedClient = $(this).val();
|
||||
console.log(selectedClient);
|
||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||
|
||||
// Check if the selected option exists in apiData
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
return item.id === selectedClient;
|
||||
});
|
||||
console.log(foundPolicies.policies);
|
||||
appendPolicies(foundPolicies.policies);
|
||||
});
|
||||
|
||||
// Function to convert object to query parameters
|
||||
function objectToQueryString(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function fetchEmpolyeeList(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
var client_id = $('#client_id').val();
|
||||
var policy_id = $('#policy_id').val();
|
||||
console.log(client_id+'-'+policy_id);
|
||||
if (client_id == '0' || policy_id == '0' ) {
|
||||
alert('Please select values in both dropdowns.');
|
||||
return;
|
||||
}
|
||||
|
||||
var queryParams = {
|
||||
client_id: client_id,
|
||||
policy_id: policy_id
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href')+"?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
|
||||
|
||||
// var apiURL2 = $('#get-emp-list').attr('href'); // Get href attribute value
|
||||
// console.log(apiURL);
|
||||
// $.ajax({
|
||||
// url: apiURL,
|
||||
// method: 'GET',
|
||||
// data: queryParams,
|
||||
// success: function(response) {
|
||||
// // Assuming response is a JSON array
|
||||
// // displayDataTables(response);
|
||||
// console.log(response);
|
||||
// },
|
||||
// error: function(xhr, status, error) {
|
||||
// console.error('Error:', error);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
41
app/Views/file_list.php
Normal file
41
app/Views/file_list.php
Normal file
@ -0,0 +1,41 @@
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">Files</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">SNO</th>
|
||||
<th class="font-weight-medium">File name</th>
|
||||
<th class="font-weight-medium">User/Time</th>
|
||||
<th class="font-weight-medium">Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="font-12">
|
||||
<?php
|
||||
if(isset($fileList))
|
||||
{
|
||||
foreach ($fileList as $key => $file) { ?>
|
||||
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<td><?php echo $file['file_name']?></td>
|
||||
<td><?php echo fancy_date_time_format($file['created_at']).' by <strong>'.$file['first_name'].'</strong>'?></td>
|
||||
<td><?php echo $file['status']; if($file['status'] == 'failed')
|
||||
{
|
||||
echo '<span class="col-xl-3 col-lg-4 col-sm-6"> <i class="fe-alert-circle" data-toggle="modal" data-target="#file-err-modal" data-err="'.$file['reason'].'"></i></span>';
|
||||
}?></td>
|
||||
</tr>
|
||||
<?php }}?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
147
app/Views/insurer_basic_info.php
Normal file
147
app/Views/insurer_basic_info.php
Normal file
@ -0,0 +1,147 @@
|
||||
<div class="tab-pane fade active show" id="general-q-tab">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<form role="form" class="parsley-examples" method="post" id="insurer_general_form" enctype="multipart/form-data">
|
||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="insurer_General_PrimaryKey" value="<?= isset($insurer['id']) ? $insurer['id'] : '' ?>"/>
|
||||
<input type="hidden" name="insurer_id" id="insurer_id" />
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="entity_type_id">Insurer Type <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="type" name="type" required>
|
||||
<option value="">Select Type</option>
|
||||
<?php foreach ($types as $type): ?>
|
||||
<option value="<?= $type->id; ?>" <?= isset($insurer['type']) && $insurer['type'] == $type->id ? 'selected' : ''; ?>>
|
||||
<?= $type->name; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="insurer_name">Insurer Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="name"
|
||||
placeholder="Enter Insurer Name" value="<?= isset($insurer['name']) ? $insurer['name'] : '' ?>" name="name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="short_name">Insurer Short Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="short_name"
|
||||
placeholder="Enter Short Name" value="<?= isset($insurer['short_name']) ? $insurer['short_name'] : '' ?>" name="short_name" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
||||
id="btnBack">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$("#insurer_general_form").submit(function(events) {
|
||||
|
||||
events.preventDefault();
|
||||
// var isValid = validateForm();
|
||||
|
||||
var isValid = true;
|
||||
jQuery.each(events.target, function(index, event) {
|
||||
if (event.validity.valid) {
|
||||
|
||||
}else{
|
||||
isValid = false;
|
||||
}
|
||||
});
|
||||
|
||||
var PrimaryKey = $('#insurer_General_PrimaryKey').val();
|
||||
var form_action = '';
|
||||
if (isValid) {
|
||||
|
||||
if(PrimaryKey === ''){
|
||||
form_action = '<?= base_url("master/insurer/createpost"); ?>';
|
||||
}else{
|
||||
form_action = '<?= base_url("master/insurer/edit"); ?>';
|
||||
}
|
||||
|
||||
var formData = new FormData($('#insurer_general_form')[0]);
|
||||
var OptionsHTML1 = ''
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log(res);
|
||||
$('#insurer_id').val(res.data.id);
|
||||
$('#insurer_id_branch').val(res.data.id);
|
||||
$('#insurer_branch_contacts_id').click();
|
||||
|
||||
var message = "Insurer General Info";
|
||||
toastr.success(message, 'Success');
|
||||
|
||||
// $.toast({
|
||||
// text: 'Insurer General Info',
|
||||
// heading: "Submitted Sucessfully",
|
||||
// position: 'top-right',
|
||||
// icon: 'success',
|
||||
// bgColor: !1,
|
||||
// });
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
// Perform validation for each field
|
||||
$('#insurer_general_form input, #insurer_general_form select').each(function() {
|
||||
// Check for empty text inputs and selects
|
||||
if ($(this).is('input[type="text"]') || $(this).is('select')) {
|
||||
if ($.trim($(this).val()) == '') {
|
||||
alert('Please fill in all fields');
|
||||
isValid = false;
|
||||
return false; // Exit the loop early
|
||||
}
|
||||
}
|
||||
|
||||
// Check for file inputs (assuming image files)
|
||||
if ($(this).is('input[type="file"]')) {
|
||||
var fileInput = $(this)[0];
|
||||
if (fileInput.files.length === 0) {
|
||||
alert('Please select an image file');
|
||||
isValid = false;
|
||||
return false; // Exit the loop early
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
476
app/Views/insurer_branch.php
Normal file
476
app/Views/insurer_branch.php
Normal file
@ -0,0 +1,476 @@
|
||||
<div class="tab-pane fade" id="branch-tab">
|
||||
|
||||
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
|
||||
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive" id="branch_table" >
|
||||
|
||||
<table class="table table-borderless table-nowrap mb-0">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Branch Name</th>
|
||||
<th>Branch Code</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="insurer_branch_list">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="row" id="add_branch">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="insurer_branch_form"
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="insurer_Branch_PrimaryKey" />
|
||||
<input type="hidden" name="insurer_id" id="insurer_id_branch" value="<?= isset($insurer['id']) ? $insurer['id'] : '' ?>"/>
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branch_name">Branch Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_name"
|
||||
placeholder="Enter Branch Name" name="branch_name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branch_code">Branch Code<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_code"
|
||||
placeholder="Enter Branch Code" name="branch_code" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="state">State<span
|
||||
class="text-danger">*</span></label>
|
||||
<select class="form-control" id="state" name="state" required>
|
||||
<option value="">Select State</option>
|
||||
<?php foreach($state as $value) { ?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['state'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="district">District<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="district"
|
||||
placeholder="Enter District" name="district" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="city">City</label>
|
||||
<input type="text" class="form-control" id="branch_city"
|
||||
placeholder="Enter City" name="city" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<h6 class="header-title">Contact 1</h6>
|
||||
<br>
|
||||
|
||||
<div class="form-row">
|
||||
<input type="hidden" name="primarykey[]" id="contact_id_1" value=""/>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="first_name">Name<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="last_name">Email<span class="text-danger">*</span></label>
|
||||
<input value="" type="email" data-parsley-type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="email" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile">Mobile<span class="text-danger">*</span></label>
|
||||
<input name="mobile[]" pattern="[0-9]{10}" value="" type="tel" data-parsley-type="number" data-parsley-length="[10,10]" class="form-control" placeholder="Enter Contact Mobile" id="mobile" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="designation">Designation<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="designation" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="display: flex;">
|
||||
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac" onclick="appendContactHtml()" id="add">Add Contact</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="${uniqueId}_remove">Remove</button>
|
||||
</div>
|
||||
|
||||
<div id="container"></div>
|
||||
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
||||
id="btnBack">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var contactCount = 1;
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var insurer_Branch_PrimaryKey = $('#insurer_id_branch').val();
|
||||
var insurer_branch_form_action = '';
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('.btnBack').hide();
|
||||
|
||||
loadBranchList();
|
||||
|
||||
|
||||
$('#btnBranchAdd').click(function(){
|
||||
|
||||
insurer_branch_form_action = '<?= base_url("master/insurer/branch/create"); ?>';
|
||||
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
$('#btnBranchAdd').hide();
|
||||
|
||||
$('#branch_name').val('');
|
||||
$('#branch_code').val('');
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
|
||||
$('#name').val('');
|
||||
$('#email').val('');
|
||||
$('#mobile').val('');
|
||||
$('#designation').val('');
|
||||
|
||||
|
||||
contactCount = 1
|
||||
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
for (var i = 0; i < buttonIds.length; i++) {
|
||||
var firstElement = buttonIds[i].split('_')[0];
|
||||
console.log(firstElement);
|
||||
|
||||
// Find the element by its ID
|
||||
var elementToRemove = document.getElementById(firstElement);
|
||||
console.log(elementToRemove);
|
||||
|
||||
if (elementToRemove) {
|
||||
console.log(elementToRemove);
|
||||
elementToRemove.parentNode.removeChild(elementToRemove);
|
||||
}
|
||||
localStorage.removeItem('buttonIds')
|
||||
}
|
||||
})
|
||||
|
||||
$('.btnBack').click(function(){
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
$('#btnBranchAdd').show();
|
||||
|
||||
$('#branch_name').val('');
|
||||
$('#branch_code').val('');
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
|
||||
$('#name').val('');
|
||||
$('#email').val('');
|
||||
$('#mobile').val('');
|
||||
$('#designation').val('');
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
if(insurer_Branch_PrimaryKey !== ''){
|
||||
|
||||
var branchTable = '';
|
||||
var data = <?= isset($insurer_branch) ? json_encode($insurer_branch) : '[]' ?>;
|
||||
$.each(data, function(index, item) {
|
||||
branchTable += `
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_code}</td>
|
||||
<td><a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#insurer_branch_list').append(branchTable);
|
||||
}
|
||||
|
||||
|
||||
$("#insurer_branch_form").submit(function(events) {
|
||||
events.preventDefault();
|
||||
var isValid = $('#insurer_branch_form').parsley().validate();
|
||||
if (isValid) {
|
||||
|
||||
var formData = new FormData($('#insurer_branch_form')[0]);
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: insurer_branch_form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
console.log(res);
|
||||
// $('#insurer_branch_list tr').remove();
|
||||
var insurerBranchTableInsert = ''
|
||||
$.each(res.data, function(index, item) {
|
||||
insurerBranchTableInsert += `
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_code}</td>
|
||||
<td><a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a></td>
|
||||
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
$('#insurer_branch_list').append(insurerBranchTableInsert);
|
||||
$('#add_branch').hide();
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
$('#btnBranchAdd').show();
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('body').on('click', '.btnBranchEdit', function () {
|
||||
$('#container').html("");
|
||||
contactCount =1;
|
||||
var branch_id = $(this).attr('data-id');
|
||||
insurer_branch_form_action = '<?= base_url("master/insurer/branch/edit"); ?>';
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('master/insurer/branch/editget/');?>'+branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
$('#btnBranchAdd').hide();
|
||||
$('#branch_name').val(res.insurerbranch.branch_name);
|
||||
$('#branch_code').val(res.insurerbranch.branch_code);
|
||||
$('#state option[value="' + res.insurerbranch.state + '"]').prop('selected', true);
|
||||
$('#district').val(res.insurerbranch.district);
|
||||
$('#branch_city').val(res.insurerbranch.city);
|
||||
$('#insurer_Branch_PrimaryKey').val(res.insurerbranch.id);
|
||||
|
||||
$('#contact_id_1').val(res.levelcontact[0].id);
|
||||
$('.form-row').find('#name').val(res.levelcontact[0].name);
|
||||
$('#email').val(res.levelcontact[0].email);
|
||||
$('#mobile').val(res.levelcontact[0].mobile);
|
||||
$('#designation').val(res.levelcontact[0].designation);
|
||||
|
||||
res.levelcontact.shift();
|
||||
$.each(res.levelcontact, function(index, contact) {
|
||||
if (contact !== undefined) {
|
||||
appendContactHtml(contact);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '#btnSubmit', function(){
|
||||
|
||||
$('#insurer_branch_list').html(" ");
|
||||
loadBranchList();
|
||||
})
|
||||
|
||||
function loadBranchList()
|
||||
{
|
||||
var base_url = '<?= base_url("master/insurer/branch/list/"); ?>';
|
||||
|
||||
var insurer_branch_action = base_url + insurer_Branch_PrimaryKey;
|
||||
if ($('#insurer_id_branch').val() != '') {
|
||||
$.ajax({
|
||||
url: insurer_branch_action,
|
||||
type: 'GET',
|
||||
success: function(response) {
|
||||
var branchTable = '';
|
||||
$.each(response.insuer_branch, function(index, item) {
|
||||
branchTable += `
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_code}</td>
|
||||
<td><a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#insurer_branch_list').html(branchTable);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function appendContactHtml(contact = false, reset = false) {
|
||||
|
||||
console.log('appendContactHtml function called ')
|
||||
contactCount++;
|
||||
|
||||
var container = document.getElementById('container');
|
||||
var uniqueId = Date.now().toString();
|
||||
|
||||
var html = `
|
||||
<div id="${uniqueId}">
|
||||
<hr>
|
||||
<h6 class="header-title">Contact ${contactCount}</h6>
|
||||
<br>
|
||||
<div class="form-row">
|
||||
<input type="hidden" name="primarykey[]" id="contact_id_1" value="${contact !== undefined && contact !== false ? contact.id : ''}"/>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="${uniqueId}_name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
|
||||
<input data-parsley-type="email" value="${contact !== undefined && contact !== false ? contact.email : ''}" type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
|
||||
<input data-parsley-type="number" data-parsley-length="[10,10]" pattern="[0-9]{10}" value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="tel" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="display: flex;">
|
||||
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac" onclick="appendContactHtml()" id="${uniqueId}_add">Add Contact</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="${uniqueId}_remove">Remove</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
if(reset == false){
|
||||
container.insertAdjacentHTML('beforeend', html);
|
||||
storeButtonId(uniqueId + '_add');
|
||||
|
||||
if (contactCount >= 3) {
|
||||
hideStoredAddButtons();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function removeContact(button) {
|
||||
var uniqueId = button.id.split("_")[0];
|
||||
var contactSection = document.getElementById(uniqueId);
|
||||
|
||||
if (contactSection) {
|
||||
contactSection.parentNode.removeChild(contactSection);
|
||||
contactCount --;
|
||||
|
||||
if (contactCount < 3) {
|
||||
var addButton = document.querySelector('.ac');
|
||||
if (addButton) {
|
||||
addButton.style.display = 'block';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function storeButtonId(id) {
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
buttonIds.push(id);
|
||||
localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
|
||||
}
|
||||
|
||||
|
||||
function hideStoredAddButtons() {
|
||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
storedIds.forEach(function(id) {
|
||||
var addButton = document.getElementById(id);
|
||||
var first_addButton = document.querySelector('.ac')
|
||||
if (addButton) {
|
||||
addButton.style.display = 'none';
|
||||
first_addButton.style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showNextAddButton() {
|
||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
var addButtonShown = false;
|
||||
|
||||
// Iterate through the stored IDs to find the next "Add" button to show
|
||||
storedIds.forEach(function(id) {
|
||||
if (!addButtonShown) {
|
||||
var addButton = document.getElementById(id);
|
||||
if (addButton && addButton.style.display === 'none') {
|
||||
addButton.style.display = 'block';
|
||||
addButtonShown = true; // Set to true once an "Add" button is shown
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
$('#insurer_branch_form input, #insurer_branch_form select').each(function() {
|
||||
|
||||
if ($(this).is('input[name="emial[]"]') || $(this).is('input[type="text"]') || $(this).is('select') ) {
|
||||
if ($.trim($(this).val()) == '') {
|
||||
isValid = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
</script>
|
||||
134
app/Views/insurer_list.php
Normal file
134
app/Views/insurer_list.php
Normal file
@ -0,0 +1,134 @@
|
||||
<div class="row" id="insurer_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">Insurer List</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
||||
<a href="<?= base_url("master/insurer/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">Name</th>
|
||||
<th class="font-weight-medium">Type</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php if(is_array($insurerList)) {foreach($insurerList as $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $row['name']; ?> ( <?php echo $row['short_name']; ?> ) </td>
|
||||
<td><?php echo $row['type']; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="<?= base_url("master/insurer/list/"); ?><?= $row['id'];?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }}?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" ,
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'InsurerList',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
const btnExport = document.querySelector("#btnExport");
|
||||
const tableElement = document.querySelector("#tickets-table");
|
||||
|
||||
btnExport.addEventListener("click", () => {
|
||||
const obj = new csvExport(tableElement);
|
||||
const csvData = obj.exportCsv();
|
||||
const blob = new Blob([csvData], { type: "text/csv" });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = "UserList.csv";
|
||||
a.click();
|
||||
|
||||
setTimeout(() => {
|
||||
URL.revokeObjectURL(url);
|
||||
}, 500);
|
||||
});
|
||||
|
||||
|
||||
class csvExport {
|
||||
constructor(table, header = true) {
|
||||
this.table = table;
|
||||
this.rows = Array.from(table.querySelectorAll("tr"));
|
||||
if (!header && this.rows[0].querySelectorAll("th").length) {
|
||||
this.rows.shift();
|
||||
}
|
||||
}
|
||||
|
||||
exportCsv() {
|
||||
const lines = [];
|
||||
const ncols = this._longestRow();
|
||||
for (const row of this.rows) {
|
||||
let line = "";
|
||||
for (let i = 0; i < ncols - 1; i++) { // Exclude the last column
|
||||
if (row.children[i] !== undefined) {
|
||||
line += csvExport.safeData(row.children[i]);
|
||||
}
|
||||
line += i !== ncols - 2 ? "," : ""; // Adjusted for the last column exclusion
|
||||
}
|
||||
lines.push(line);
|
||||
}
|
||||
return lines.join("\n");
|
||||
}
|
||||
|
||||
_longestRow() {
|
||||
return this.rows.reduce((length, row) => (row.childElementCount > length ? row.childElementCount : length), 0);
|
||||
}
|
||||
|
||||
static safeData(td) {
|
||||
let data = td.textContent;
|
||||
//Replace all double quote to two double quotes
|
||||
data = data.replace(/"/g, `""`);
|
||||
//Replace , and \n to double quotes
|
||||
data = /[",\n"]/.test(data) ? `"${data}"` : data;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
69
app/Views/insurer_onboarding.php
Normal file
69
app/Views/insurer_onboarding.php
Normal file
@ -0,0 +1,69 @@
|
||||
<style>
|
||||
|
||||
body {
|
||||
.multiselect-native-select {
|
||||
position: relative;
|
||||
/* bottom: 32px; */
|
||||
select {
|
||||
border: 0 !important;
|
||||
clip: rect(0 0 0 0) !important;
|
||||
height: 1px !important;
|
||||
margin: -1px -1px -1px -3px !important;
|
||||
overflow: hidden !important;
|
||||
padding: 0 !important;
|
||||
position: absolute !important;
|
||||
width: 1px !important;
|
||||
left: 50%;
|
||||
top: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.multiselect-container{
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.multiselect-selected-text{
|
||||
float: left !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="row" id="insurer_add">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">Insurer Onboarding</h4>
|
||||
</div>
|
||||
<!-- <div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("master/insurer/list"); ?>" class="btn btn-primary waves-effect waves-light">Back</a>
|
||||
</div> -->
|
||||
</div>
|
||||
<ul class="nav nav-pills navtab-bg">
|
||||
<li class="nav-item">
|
||||
<a href="#general-q-tab" data-toggle="tab" aria-expanded="false"
|
||||
class="nav-link px-3 py-2 active">
|
||||
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
|
||||
<span class="d-none d-sm-inline-block">General</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#branch-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="insurer_branch_contacts_id">
|
||||
<span class="mr-1"><i class="mdi mdi-source-branch"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Branch & Contacts</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<?php include('insurer_basic_info.php'); ?>
|
||||
<?php include('insurer_branch.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
258
app/Views/kyc_docs.php
Normal file
258
app/Views/kyc_docs.php
Normal file
@ -0,0 +1,258 @@
|
||||
<div class="tab-pane fade" id="branch-tab">
|
||||
|
||||
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
|
||||
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add KYC Docs</button>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive" id="branch_table" >
|
||||
|
||||
<table class="table table-borderless table-nowrap mb-0">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>File Name</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="kyc_docs_list">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="row" id="add_branch">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="kyc_docs_form"
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="kyc_Docs_PrimaryKey" />
|
||||
<input type="hidden" name="kyc_type_id" id="kyc_type_id" value="<?= isset($kyc['id']) ? $kyc['id'] : '' ?>"/>
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="file_name">KYC Docs File Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="file_name"
|
||||
placeholder="Enter File Name" name="file_name" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
||||
id="btnBack">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var kyc_Docs_PrimaryKey = $('#kyc_General_PrimaryKey').val();
|
||||
var kyc_docs_form_action = '';
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('.btnBack').hide();
|
||||
|
||||
loadKYCDocsList();
|
||||
|
||||
|
||||
$('#btnBranchAdd').click(function(){
|
||||
|
||||
kyc_docs_form_action = '<?= base_url("master/kyc/kycdocs/createpost"); ?>';
|
||||
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
$('#btnBranchAdd').hide();
|
||||
|
||||
$('#file_name').val('');
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
|
||||
$('#name0').val('');
|
||||
$('#email0').val('');
|
||||
$('#mobile0').val('');
|
||||
$('#designation0').val('');
|
||||
|
||||
$('#name1').val('');
|
||||
$('#email1').val('');
|
||||
$('#mobile1').val('');
|
||||
$('#designation1').val('');
|
||||
|
||||
$('#name2').val('');
|
||||
$('#email2').val('');
|
||||
$('#mobile2').val('');
|
||||
$('#designation2').val('');
|
||||
})
|
||||
|
||||
$('.btnBack').click(function(){
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
$('#btnBranchAdd').show();
|
||||
|
||||
$('#file_name').val('');
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
|
||||
$('#name0').val('');
|
||||
$('#email0').val('');
|
||||
$('#mobile0').val('');
|
||||
$('#designation0').val('');
|
||||
|
||||
$('#name1').val('');
|
||||
$('#email1').val('');
|
||||
$('#mobile1').val('');
|
||||
$('#designation1').val('');
|
||||
|
||||
$('#name2').val('');
|
||||
$('#email2').val('');
|
||||
$('#mobile2').val('');
|
||||
$('#designation2').val('');
|
||||
|
||||
})
|
||||
|
||||
|
||||
if(kyc_Docs_PrimaryKey !== ''){
|
||||
|
||||
var branchTable = '';
|
||||
var data = <?= isset($insurer_branch) ? json_encode($insurer_branch) : '[]' ?>;
|
||||
$.each(data, function(index, item) {
|
||||
branchTable += `
|
||||
<tr>
|
||||
<td>${item.file_name}</td>
|
||||
<td><a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#insurer_branch_list').append(branchTable);
|
||||
}
|
||||
|
||||
|
||||
$("#kyc_docs_form").submit(function(events) {
|
||||
events.preventDefault();
|
||||
|
||||
var isValid = $('#kyc_docs_form').parsley().validate();
|
||||
|
||||
|
||||
if (isValid) {
|
||||
|
||||
var formData = new FormData($('#kyc_docs_form')[0]);
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: kyc_docs_form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
console.log(res);
|
||||
$('#insurer_branch_list tr').remove();
|
||||
var insurerBranchTableInsert = ''
|
||||
$.each(res.data, function(index, item) {
|
||||
insurerBranchTableInsert += `
|
||||
<tr>
|
||||
<td>${item.file_name}</td>
|
||||
<td><a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#insurer_branch_list').append(insurerBranchTableInsert);
|
||||
$('#add_branch').hide();
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
$('#btnBranchAdd').show();
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('click', '.btnBranchEdit', function () {
|
||||
var branch_id = $(this).attr('data-id');
|
||||
kyc_docs_form_action = '<?= base_url("master/kyc/kycdocs/edit"); ?>';
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('master/kyc/kycdocs/editget/');?>'+branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
console.log("right.........");
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
$('#btnBranchAdd').hide();
|
||||
$('#file_name').val(res.policies.file_name);
|
||||
$('#kyc_Docs_PrimaryKey').val(res.policies.id);
|
||||
|
||||
// $('#kyc_docs_list').html(" ");
|
||||
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '#btnSubmit', function() {
|
||||
$('#kyc_docs_list').html(" ");
|
||||
setTimeout(function() {
|
||||
loadKYCDocsList();
|
||||
}, 100) });
|
||||
|
||||
function loadKYCDocsList() {
|
||||
var base_url = '<?= base_url("master/kyc/kycdocs/list/"); ?>';
|
||||
|
||||
var kyc_docs_action = base_url + kyc_Docs_PrimaryKey;
|
||||
console.log(kyc_docs_action);
|
||||
if (kyc_Docs_PrimaryKey != '') {
|
||||
$.ajax({
|
||||
url: kyc_docs_action,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
var insurerBranchTableInsert = '';
|
||||
$.each(res.kyc_docs, function(index, item) {
|
||||
insurerBranchTableInsert += `
|
||||
<tr>
|
||||
<td>${item.file_name}</td>
|
||||
<td><a class="btnBranchEdit" data-id="${item.id}"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#kyc_docs_list').append(insurerBranchTableInsert);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
112
app/Views/kyc_entity_type_basic_info.php
Normal file
112
app/Views/kyc_entity_type_basic_info.php
Normal file
@ -0,0 +1,112 @@
|
||||
<div class="tab-pane fade active show" id="general-q-tab">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<form role="form" class="parsley-examples" method="post" id="kyc_general_form" enctype="multipart/form-data">
|
||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="kyc_General_PrimaryKey" value="<?= isset($kyc['id']) ? $kyc['id'] : '' ?>"/>
|
||||
<input type="hidden" name="kyc_type_id" id="kyc_type_id" />
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="kyc_name">KYC Entity Type Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="name"
|
||||
placeholder="Enter Kyc Entity Type Name" value="<?= isset($kyc['name']) ? $kyc['name'] : '' ?>" name="name" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
||||
id="btnBack">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$("#kyc_general_form").submit(function(events) {
|
||||
|
||||
events.preventDefault();
|
||||
var isValid = $('#kyc_general_form').parsley().validate();
|
||||
|
||||
var PrimaryKey = $('#kyc_General_PrimaryKey').val();
|
||||
var form_action = '';
|
||||
if (isValid) {
|
||||
|
||||
console.log("Primary KEy");
|
||||
console.log(PrimaryKey);
|
||||
if(PrimaryKey === ''){
|
||||
form_action = '<?= base_url("master/kyc/createpost"); ?>';
|
||||
}else{
|
||||
form_action = '<?= base_url("master/kyc/edit"); ?>';
|
||||
}
|
||||
|
||||
var formData = new FormData($('#kyc_general_form')[0]);
|
||||
var OptionsHTML1 = ''
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
console.log(res);
|
||||
$('#kyc_type_id').val(res.data.PrimaryKey);
|
||||
$('#kyc_id_docs').val(res.data.PrimaryKey);
|
||||
$('#kyc_docs_id').click();
|
||||
var message = "KYC Entity Type General Info";
|
||||
toastr.success(message, 'Success');
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
// Perform validation for each field
|
||||
$('#kyc_general_form input, #kyc_general_form select').each(function() {
|
||||
// Check for empty text inputs and selects
|
||||
if ($(this).is('input[type="text"]') || $(this).is('select')) {
|
||||
if ($.trim($(this).val()) == '') {
|
||||
alert('Please fill in all fields');
|
||||
isValid = false;
|
||||
return false; // Exit the loop early
|
||||
}
|
||||
}
|
||||
|
||||
// Check for file inputs (assuming image files)
|
||||
if ($(this).is('input[type="file"]')) {
|
||||
var fileInput = $(this)[0];
|
||||
if (fileInput.files.length === 0) {
|
||||
alert('Please select an image file');
|
||||
isValid = false;
|
||||
return false; // Exit the loop early
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
132
app/Views/kyc_list.php
Normal file
132
app/Views/kyc_list.php
Normal file
@ -0,0 +1,132 @@
|
||||
<div class="row" id="kyc_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">KYC List</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
||||
<a href="<?= base_url("master/kyc/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">Name</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php if(is_array($kycList)) {foreach($kycList as $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $row['name']; ?> </td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="<?= base_url("master/kyc/list/"); ?><?= $row['id'];?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }}?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" ,
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'KYCList',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
const btnExport = document.querySelector("#btnExport");
|
||||
const tableElement = document.querySelector("#tickets-table");
|
||||
|
||||
btnExport.addEventListener("click", () => {
|
||||
const obj = new csvExport(tableElement);
|
||||
const csvData = obj.exportCsv();
|
||||
const blob = new Blob([csvData], { type: "text/csv" });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = "KYCList.csv";
|
||||
a.click();
|
||||
|
||||
setTimeout(() => {
|
||||
URL.revokeObjectURL(url);
|
||||
}, 500);
|
||||
});
|
||||
|
||||
|
||||
class csvExport {
|
||||
constructor(table, header = true) {
|
||||
this.table = table;
|
||||
this.rows = Array.from(table.querySelectorAll("tr"));
|
||||
if (!header && this.rows[0].querySelectorAll("th").length) {
|
||||
this.rows.shift();
|
||||
}
|
||||
}
|
||||
|
||||
exportCsv() {
|
||||
const lines = [];
|
||||
const ncols = this._longestRow();
|
||||
for (const row of this.rows) {
|
||||
let line = "";
|
||||
for (let i = 0; i < ncols - 1; i++) { // Exclude the last column
|
||||
if (row.children[i] !== undefined) {
|
||||
line += csvExport.safeData(row.children[i]);
|
||||
}
|
||||
line += i !== ncols - 2 ? "," : ""; // Adjusted for the last column exclusion
|
||||
}
|
||||
lines.push(line);
|
||||
}
|
||||
return lines.join("\n");
|
||||
}
|
||||
|
||||
_longestRow() {
|
||||
return this.rows.reduce((length, row) => (row.childElementCount > length ? row.childElementCount : length), 0);
|
||||
}
|
||||
|
||||
static safeData(td) {
|
||||
let data = td.textContent;
|
||||
//Replace all double quote to two double quotes
|
||||
data = data.replace(/"/g, `""`);
|
||||
//Replace , and \n to double quotes
|
||||
data = /[",\n"]/.test(data) ? `"${data}"` : data;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
69
app/Views/kyc_onboarding.php
Normal file
69
app/Views/kyc_onboarding.php
Normal file
@ -0,0 +1,69 @@
|
||||
<style>
|
||||
|
||||
body {
|
||||
.multiselect-native-select {
|
||||
position: relative;
|
||||
/* bottom: 32px; */
|
||||
select {
|
||||
border: 0 !important;
|
||||
clip: rect(0 0 0 0) !important;
|
||||
height: 1px !important;
|
||||
margin: -1px -1px -1px -3px !important;
|
||||
overflow: hidden !important;
|
||||
padding: 0 !important;
|
||||
position: absolute !important;
|
||||
width: 1px !important;
|
||||
left: 50%;
|
||||
top: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.multiselect-container{
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.multiselect-selected-text{
|
||||
float: left !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="row" id="insurer_add">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">KYC Entity Type Onboarding</h4>
|
||||
</div>
|
||||
<!-- <div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("master/kyc/list"); ?>" class="btn btn-primary waves-effect waves-light">Back</a>
|
||||
</div> -->
|
||||
</div>
|
||||
<ul class="nav nav-pills navtab-bg">
|
||||
<li class="nav-item">
|
||||
<a href="#general-q-tab" data-toggle="tab" aria-expanded="false"
|
||||
class="nav-link px-3 py-2 active">
|
||||
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
|
||||
<span class="d-none d-sm-inline-block">General</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#branch-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="kyc_docs_id">
|
||||
<span class="mr-1"><i class="mdi mdi-source-branch"></i></span>
|
||||
<span class="d-none d-sm-inline-block">KYC Docs</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<?php include('kyc_entity_type_basic_info.php'); ?>
|
||||
<?php include('kyc_docs.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -471,6 +471,7 @@
|
||||
<!-- ========== Left Sidebar Start ========== -->
|
||||
<div class="left-side-menu">
|
||||
|
||||
|
||||
<!-- LOGO -->
|
||||
<div class="logo-box">
|
||||
<a href="index.html" class="logo logo-dark text-center">
|
||||
@ -493,6 +494,7 @@
|
||||
</span> -->
|
||||
</a>
|
||||
</div>
|
||||
<!-- >>>>>>> 47b829183b576482986f721bd598c48341c0bbec -->
|
||||
|
||||
<div class="h-100" data-simplebar>
|
||||
|
||||
@ -511,6 +513,24 @@
|
||||
<span> Clients </span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
||||
<i class="fas fa-user-tie"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> Employees </span>
|
||||
</a>
|
||||
<div class="collapse" id="sidebarDashboards">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/list')?>">List</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/bulk-event-uplod')?>">Upload</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-database-2-line"></i>
|
||||
@ -520,10 +540,16 @@
|
||||
<div class="collapse" id="sidebarDashboards">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="#">Insurer</a>
|
||||
<a href="<?= base_url('/master/insurer/list')?>">Insurer</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#">TPA</a>
|
||||
<a href="<?= base_url('/master/tpa/list')?>">TPA</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/kyc/list')?>">KYC</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/policy/list')?>">Policy</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
333
app/Views/policies.php
Normal file
333
app/Views/policies.php
Normal file
@ -0,0 +1,333 @@
|
||||
<div class="tab-pane fade" id="branch-tab">
|
||||
|
||||
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
|
||||
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policies</button>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive" id="branch_table" >
|
||||
|
||||
<table class="table table-borderless table-nowrap mb-0">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Insurer</th>
|
||||
<th>Name</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="policies_list">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="row" id="add_branch">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="tpa_branch_form" enctype="multipart/form-data">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="policy_type_PrimaryKey" />
|
||||
<input type="hidden" name="policy_type_id" id="policy_type_id" value="<?= isset($policytype['id']) ? $policytype['id'] : '' ?>"/>
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="insurer_id">Insurer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="insurer_id" name="insurer_id" required>
|
||||
<option value="0">Select Insurer</option>
|
||||
<?php if (!empty($insurer)) { foreach ($insurer as $insurer) : ?>
|
||||
<option value="<?= $insurer['id'] ?>"><?= $insurer['name'] ?></option>
|
||||
<?php endforeach; } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="name">Polices Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="name"
|
||||
placeholder="Enter Name" name="name" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
||||
id="btnBack">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var policy_type_PrimaryKey = $('#policy_type_id').val();
|
||||
var tpa_branch_form_action = '';
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('.btnBack').hide();
|
||||
|
||||
|
||||
loadPoliciesList();
|
||||
|
||||
|
||||
|
||||
|
||||
// var insurer_branch_action = '<?= base_url("master/insurer/list/"); ?>';
|
||||
// if ($('#policy_type_id').val() != '') {
|
||||
|
||||
// $.ajax({
|
||||
// url: insurer_branch_action,
|
||||
// type: 'GET',
|
||||
// success: function(response) {
|
||||
// console.log(response);
|
||||
// var branchTable = '';
|
||||
// $.each(response.policies, function(index, item) {
|
||||
// console.log(item);
|
||||
// branchTable += `
|
||||
// <tr>
|
||||
// <td>${item.insurer_id}</td>
|
||||
// <td>${item.name}</td>
|
||||
// <td><a class="btnBranchEdit" data-id="${item.id}"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
|
||||
// </tr>
|
||||
// `;
|
||||
// });
|
||||
// $('#policies_list').append(branchTable);
|
||||
// },
|
||||
// error: function(xhr, status, error) {
|
||||
// console.error(xhr.responseText);
|
||||
// console.error(status, error);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$('#btnBranchAdd').click(function(){
|
||||
|
||||
tpa_branch_form_action = '<?= base_url("master/policy/policies/createpost"); ?>';
|
||||
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
$('#btnBranchAdd').hide();
|
||||
|
||||
$('#insurer_id').val('');
|
||||
$('#name').val('');
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
|
||||
$('#name0').val('');
|
||||
$('#email0').val('');
|
||||
$('#mobile0').val('');
|
||||
$('#designation0').val('');
|
||||
|
||||
$('#name1').val('');
|
||||
$('#email1').val('');
|
||||
$('#mobile1').val('');
|
||||
$('#designation1').val('');
|
||||
|
||||
$('#name2').val('');
|
||||
$('#email2').val('');
|
||||
$('#mobile2').val('');
|
||||
$('#designation2').val('');
|
||||
})
|
||||
|
||||
$('.btnBack').click(function(){
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
$('#btnBranchAdd').show();
|
||||
|
||||
$('#insurer_id').val('');
|
||||
$('#name').val('');
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
|
||||
$('#name0').val('');
|
||||
$('#email0').val('');
|
||||
$('#mobile0').val('');
|
||||
$('#designation0').val('');
|
||||
|
||||
$('#name1').val('');
|
||||
$('#email1').val('');
|
||||
$('#mobile1').val('');
|
||||
$('#designation1').val('');
|
||||
|
||||
$('#name2').val('');
|
||||
$('#email2').val('');
|
||||
$('#mobile2').val('');
|
||||
$('#designation2').val('');
|
||||
|
||||
})
|
||||
|
||||
|
||||
if(policy_type_PrimaryKey !== ''){
|
||||
|
||||
var branchTable = '';
|
||||
var data = <?= isset($tpa_branch) ? json_encode($tpa_branch) : '[]' ?>;
|
||||
$.each(data, function(index, item) {
|
||||
branchTable += `
|
||||
<tr>
|
||||
<td>${item.insurer_id}</td>
|
||||
<td>${item.name}</td>
|
||||
<td><a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#policies_list').append(branchTable);
|
||||
}
|
||||
|
||||
|
||||
$("#tpa_branch_form").submit(function(events) {
|
||||
events.preventDefault();
|
||||
|
||||
var isValid = $('#tpa_branch_form').parsley().validate();
|
||||
|
||||
|
||||
if (isValid) {
|
||||
|
||||
var formData = new FormData($('#tpa_branch_form')[0]);
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: tpa_branch_form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
// console.log(res);
|
||||
// $('#policies_list tr').remove();s
|
||||
var tpaBranchTableInsert = ''
|
||||
$.each(res.data, function(index, item) {
|
||||
tpaBranchTableInsert += `
|
||||
<tr>
|
||||
<td>${item.insurer_id}</td>
|
||||
<td>${item.name}</td>
|
||||
<td><a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
// $('#policies_list').append(tpaBranchTableInsert);
|
||||
$('#policies_list').html("");
|
||||
loadPoliciesList();
|
||||
$('#add_branch').hide();
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
$('#btnBranchAdd').show();
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('click', '.btnBranchEdit', function () {
|
||||
var branch_id = $(this).attr('data-id');
|
||||
tpa_branch_form_action = '<?= base_url("master/policy/policies/edit"); ?>';
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('master/policy/policies/editget/');?>'+branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
$('#btnBranchAdd').hide();
|
||||
$('#insurer_id').val(res.policies.insurer_id);
|
||||
$('#name').val(res.policies.name);
|
||||
$('#policy_type_PrimaryKey').val(res.policies.id);
|
||||
|
||||
// $('#policies_list').html(" ");
|
||||
|
||||
$.each(res.contact, function(index, contact) {
|
||||
if (contact !== undefined) {
|
||||
$('#name' + index).val(contact.name !== undefined ? contact.name : '');
|
||||
$('#email' + index).val(contact.email !== undefined ? contact.email : '');
|
||||
$('#mobile' + index).val(contact.mobile !== undefined ? contact.mobile : '');
|
||||
$('#designation' + index).val(contact.designation !== undefined ? contact.designation : '');
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// document.querySelectorAll('.btnBranchEdit').forEach(item => {
|
||||
// item.addEventListener('click', event => {
|
||||
// // Prevent the default action of the link
|
||||
// event.preventDefault();
|
||||
|
||||
// // Get the data-id attribute value of the clicked element
|
||||
// const dataId = event.target.getAttribute('data-id');
|
||||
|
||||
// // Use the data-id value as needed
|
||||
// console.log(dataId);
|
||||
// });
|
||||
// });
|
||||
|
||||
|
||||
$('body').on('click', '#btnSubmit', function() {
|
||||
// $('#policies_list').html("");
|
||||
// loadPoliciesList();
|
||||
|
||||
setTimeout(function() {
|
||||
}, 1000) });
|
||||
|
||||
function loadPoliciesList() {
|
||||
var base_url = '<?= base_url("master/policy/policies/list/"); ?>';
|
||||
|
||||
var insurer_branch_action = base_url + policy_type_PrimaryKey;
|
||||
|
||||
if ($('#policy_type_id').val() != '') {
|
||||
|
||||
$.ajax({
|
||||
url: insurer_branch_action,
|
||||
type: 'GET',
|
||||
success: function(response) {
|
||||
var branchTable = '';
|
||||
$.each(response.policies, function(index, item) {
|
||||
console.log(item);
|
||||
branchTable += `
|
||||
<tr>
|
||||
<td value=''>${item.insurer.name}</td>
|
||||
<td>${item.policy.name}</td>
|
||||
<td><a class="btnBranchEdit" data-id="${item.policy.id}"><i data-id="${item.policy.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#policies_list').append(branchTable);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
129
app/Views/policy_type_basic_info.php
Normal file
129
app/Views/policy_type_basic_info.php
Normal file
@ -0,0 +1,129 @@
|
||||
<div class="tab-pane fade active show" id="general-q-tab">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<form role="form" class="parsley-examples" method="post" id="policytype_general_form" enctype="multipart/form-data">
|
||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="policytype_General_PrimaryKey" value="<?= isset($policytype['id']) ? $policytype['id'] : '' ?>"/>
|
||||
<input type="hidden" name="policy_id" id="policy_id" />
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="kyc_name">Policy Type Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="policy_type"
|
||||
placeholder="Enter Kyc Entity Type Name" value="<?= isset($policytype['policy_type']) ? $policytype['policy_type'] : '' ?>" name="policy_type" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="bap">Bap<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="bap"
|
||||
placeholder="Enter Bap" value="<?= isset($policytype['bap']) ? $policytype['bap'] : '' ?>" name="bap" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="allocg">Allocg<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="allocg"
|
||||
placeholder="Enter Short Name" value="<?= isset($policytype['allocg']) ? $policytype['allocg'] : '' ?>" name="allocg" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="alloci">Alloci<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="alloci"
|
||||
placeholder="Enter Alloci" value="<?= isset($policytype['alloci']) ? $policytype['alloci'] : '' ?>" name="alloci" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
||||
id="btnBack">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$("#policytype_general_form").submit(function(events) {
|
||||
|
||||
events.preventDefault();
|
||||
|
||||
var isValid = $('#policytype_general_form').parsley().validate();
|
||||
|
||||
var PrimaryKey = $('#policytype_General_PrimaryKey').val();
|
||||
var form_action = '';
|
||||
if (isValid) {
|
||||
|
||||
if(PrimaryKey === ''){
|
||||
form_action = '<?= base_url("master/policy/createpost"); ?>';
|
||||
}else{
|
||||
form_action = '<?= base_url("master/policy/edit"); ?>';
|
||||
}
|
||||
|
||||
var formData = new FormData($('#policytype_general_form')[0]);
|
||||
var OptionsHTML1 = ''
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
$('#policy_type_id').val(res.data.PrimaryKey);
|
||||
$('#policy_id_type').click();
|
||||
var message = "Policy Type General Info";
|
||||
toastr.success(message, 'Success');
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
// Perform validation for each field
|
||||
$('#policytype_general_form input, #policytype_general_form select').each(function() {
|
||||
// Check for empty text inputs and selects
|
||||
if ($(this).is('input[type="text"]') || $(this).is('select')) {
|
||||
if ($.trim($(this).val()) == '') {
|
||||
alert('Please fill in all fields');
|
||||
isValid = false;
|
||||
return false; // Exit the loop early
|
||||
}
|
||||
}
|
||||
|
||||
// Check for file inputs (assuming image files)
|
||||
if ($(this).is('input[type="file"]')) {
|
||||
var fileInput = $(this)[0];
|
||||
if (fileInput.files.length === 0) {
|
||||
alert('Please select an image file');
|
||||
isValid = false;
|
||||
return false; // Exit the loop early
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
138
app/Views/policy_type_list.php
Normal file
138
app/Views/policy_type_list.php
Normal file
@ -0,0 +1,138 @@
|
||||
<div class="row" id="policy_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">Policy Type List</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
||||
<a href="<?= base_url("master/policy/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">Policy Type</th>
|
||||
<th class="font-weight-medium">Bap</th>
|
||||
<th class="font-weight-medium">Allocg</th>
|
||||
<th class="font-weight-medium">alloci</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php if(is_array($policyList)) {foreach($policyList as $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $row['policy_type']; ?> </td>
|
||||
<td><?php echo $row['bap']; ?></td>
|
||||
<td><?php echo $row['allocg']; ?></td>
|
||||
<td><?php echo $row['alloci']; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="<?= base_url("master/policy/list/"); ?><?= $row['id'];?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }}?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" ,
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'TPAList',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
const btnExport = document.querySelector("#btnExport");
|
||||
const tableElement = document.querySelector("#tickets-table");
|
||||
|
||||
btnExport.addEventListener("click", () => {
|
||||
const obj = new csvExport(tableElement);
|
||||
const csvData = obj.exportCsv();
|
||||
const blob = new Blob([csvData], { type: "text/csv" });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = "PolicyTypeList.csv";
|
||||
a.click();
|
||||
|
||||
setTimeout(() => {
|
||||
URL.revokeObjectURL(url);
|
||||
}, 500);
|
||||
});
|
||||
|
||||
|
||||
class csvExport {
|
||||
constructor(table, header = true) {
|
||||
this.table = table;
|
||||
this.rows = Array.from(table.querySelectorAll("tr"));
|
||||
if (!header && this.rows[0].querySelectorAll("th").length) {
|
||||
this.rows.shift();
|
||||
}
|
||||
}
|
||||
|
||||
exportCsv() {
|
||||
const lines = [];
|
||||
const ncols = this._longestRow();
|
||||
for (const row of this.rows) {
|
||||
let line = "";
|
||||
for (let i = 0; i < ncols - 1; i++) { // Exclude the last column
|
||||
if (row.children[i] !== undefined) {
|
||||
line += csvExport.safeData(row.children[i]);
|
||||
}
|
||||
line += i !== ncols - 2 ? "," : ""; // Adjusted for the last column exclusion
|
||||
}
|
||||
lines.push(line);
|
||||
}
|
||||
return lines.join("\n");
|
||||
}
|
||||
|
||||
_longestRow() {
|
||||
return this.rows.reduce((length, row) => (row.childElementCount > length ? row.childElementCount : length), 0);
|
||||
}
|
||||
|
||||
static safeData(td) {
|
||||
let data = td.textContent;
|
||||
//Replace all double quote to two double quotes
|
||||
data = data.replace(/"/g, `""`);
|
||||
//Replace , and \n to double quotes
|
||||
data = /[",\n"]/.test(data) ? `"${data}"` : data;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
69
app/Views/policy_type_onboarding.php
Normal file
69
app/Views/policy_type_onboarding.php
Normal file
@ -0,0 +1,69 @@
|
||||
<style>
|
||||
|
||||
body {
|
||||
.multiselect-native-select {
|
||||
position: relative;
|
||||
/* bottom: 32px; */
|
||||
select {
|
||||
border: 0 !important;
|
||||
clip: rect(0 0 0 0) !important;
|
||||
height: 1px !important;
|
||||
margin: -1px -1px -1px -3px !important;
|
||||
overflow: hidden !important;
|
||||
padding: 0 !important;
|
||||
position: absolute !important;
|
||||
width: 1px !important;
|
||||
left: 50%;
|
||||
top: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.multiselect-container{
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.multiselect-selected-text{
|
||||
float: left !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="row" id="policy_add">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">Policy Type Onboarding</h4>
|
||||
</div>
|
||||
<!-- <div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("master/policy/list"); ?>" class="btn btn-primary waves-effect waves-light">Back</a>
|
||||
</div> -->
|
||||
</div>
|
||||
<ul class="nav nav-pills navtab-bg">
|
||||
<li class="nav-item">
|
||||
<a href="#general-q-tab" data-toggle="tab" aria-expanded="false"
|
||||
class="nav-link px-3 py-2 active">
|
||||
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
|
||||
<span class="d-none d-sm-inline-block">General</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#branch-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="policy_id_type">
|
||||
<span class="mr-1"><i class="mdi mdi-source-branch"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Policies</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<?php include('policy_type_basic_info.php'); ?>
|
||||
<?php include('policies.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
125
app/Views/tpa_basic_info.php
Normal file
125
app/Views/tpa_basic_info.php
Normal file
@ -0,0 +1,125 @@
|
||||
<div class="tab-pane fade active show" id="general-q-tab">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<form role="form" class="parsley-examples" method="post" id="tpa_general_form" enctype="multipart/form-data">
|
||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="tpa_General_PrimaryKey" value="<?= isset($tpa['id']) ? $tpa['id'] : '' ?>"/>
|
||||
<input type="hidden" name="tpa_id" id="tpa_id" />
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="tpa_name">TPA Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="name"
|
||||
placeholder="Enter TPA Name" value="<?= isset($tpa['name']) ? $tpa['name'] : '' ?>" name="name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="short_name">TPA Short Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="short_name" placeholder="Enter Short Name" value="<?= isset($tpa['short_name']) ? $tpa['short_name'] : '' ?>" name="short_name" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
||||
id="btnBack">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$("#tpa_general_form").submit(function(events) {
|
||||
|
||||
events.preventDefault();
|
||||
var isValid = $('#tpa_general_form').parsley().validate();
|
||||
|
||||
var PrimaryKey = $('#tpa_General_PrimaryKey').val();
|
||||
var form_action = '';
|
||||
if (isValid) {
|
||||
|
||||
if(PrimaryKey === ''){
|
||||
form_action = '<?= base_url("master/tpa/createpost"); ?>';
|
||||
}else{
|
||||
form_action = '<?= base_url("master/tpa/edit"); ?>';
|
||||
}
|
||||
|
||||
var formData = new FormData($('#tpa_general_form')[0]);
|
||||
var OptionsHTML1 = ''
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log(res);
|
||||
$('#tpa_id').val(res.data.id);
|
||||
$('#tpa_id_branch').val(res.data.id);
|
||||
$('#tpa_branch_contacts_id').click();
|
||||
|
||||
var message = "TPA General Info";
|
||||
toastr.success(message, 'Success');
|
||||
|
||||
// $.toast({
|
||||
// text: 'Insurer General Info',
|
||||
// heading: "Submitted Sucessfully",
|
||||
// position: 'top-right',
|
||||
// icon: 'success',
|
||||
// bgColor: !1,
|
||||
// });
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
// Perform validation for each field
|
||||
$('#tpa_general_form input, #tpa_general_form select').each(function() {
|
||||
// Check for empty text inputs and selects
|
||||
if ($(this).is('input[type="text"]') || $(this).is('select')) {
|
||||
if ($.trim($(this).val()) == '') {
|
||||
alert('Please fill in all fields');
|
||||
isValid = false;
|
||||
return false; // Exit the loop early
|
||||
}
|
||||
}
|
||||
|
||||
// Check for file inputs (assuming image files)
|
||||
if ($(this).is('input[type="file"]')) {
|
||||
var fileInput = $(this)[0];
|
||||
if (fileInput.files.length === 0) {
|
||||
alert('Please select an image file');
|
||||
isValid = false;
|
||||
return false; // Exit the loop early
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
467
app/Views/tpa_branch.php
Normal file
467
app/Views/tpa_branch.php
Normal file
@ -0,0 +1,467 @@
|
||||
<div class="tab-pane fade" id="branch-tab">
|
||||
|
||||
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
|
||||
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive" id="branch_table" >
|
||||
|
||||
<table class="table table-borderless table-nowrap mb-0">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Branch Name</th>
|
||||
<th>Branch Code</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tpa_branch_list">
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="row" id="add_branch">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="tpa_branch_form" enctype="multipart/form-data">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="tpa_Branch_PrimaryKey" />
|
||||
<input type="hidden" name="tpa_id" id="tpa_id_branch" value="<?= isset($tpa['id']) ? $tpa['id'] : '' ?>"/>
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branch_name">Branch Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_name"
|
||||
placeholder="Enter Branch Name" name="branch_name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branch_code">Branch Code<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_code"
|
||||
placeholder="Enter Branch Code" name="branch_code" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="state">State<span
|
||||
class="text-danger">*</span></label>
|
||||
<select class="form-control" id="state" name="state" required>
|
||||
<option value="">Select State</option>
|
||||
<?php if ($state) {
|
||||
foreach($state as $value) { ?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['state'] ?></option>
|
||||
<?php } }?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="district">District<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="district"
|
||||
placeholder="Enter District" name="district" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="city">City</label>
|
||||
<input type="text" class="form-control" id="branch_city"
|
||||
placeholder="Enter City" name="city" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<h6 class="header-title">Contact 1</h6>
|
||||
<br>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="first_name">Name<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="last_name">Email<span class="text-danger">*</span></label>
|
||||
<input value="" data-parsley-type="email" type="email" data-parsley-type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="email" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile">Mobile<span class="text-danger">*</span></label>
|
||||
<input value="" data-parsley-type="number" data-parsley-length="[10,10]" type="tel" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="mobile" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="designation">Designation<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="designation" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="display: flex;">
|
||||
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac" onclick="appendContactHtml()" id="add">Add Contact</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="${uniqueId}_remove">Remove</button>
|
||||
</div>
|
||||
|
||||
<div id="container"></div>
|
||||
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
||||
id="btnBack">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
<script>
|
||||
|
||||
var contactCount = 1;
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var tpa_Branch_PrimaryKey = $('#tpa_id_branch').val();
|
||||
var tpa_branch_form_action = '';
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('.btnBack').hide();
|
||||
|
||||
|
||||
loadBranchList();
|
||||
|
||||
$('#btnBranchAdd').click(function(){
|
||||
|
||||
tpa_branch_form_action = '<?= base_url("master/tpa/branch/create"); ?>';
|
||||
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
$('#btnBranchAdd').hide();
|
||||
|
||||
$('#branch_name').val('');
|
||||
$('#branch_code').val('');
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
|
||||
$('#name').val('');
|
||||
$('#email').val('');
|
||||
$('#mobile').val('');
|
||||
$('#designation').val('');
|
||||
|
||||
|
||||
|
||||
contactCount = 1
|
||||
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
for (var i = 0; i < buttonIds.length; i++) {
|
||||
var firstElement = buttonIds[i].split('_')[0];
|
||||
console.log(firstElement);
|
||||
|
||||
// Find the element by its ID
|
||||
var elementToRemove = document.getElementById(firstElement);
|
||||
console.log(elementToRemove);
|
||||
|
||||
if (elementToRemove) {
|
||||
console.log(elementToRemove);
|
||||
elementToRemove.parentNode.removeChild(elementToRemove);
|
||||
}
|
||||
localStorage.removeItem('buttonIds')
|
||||
}
|
||||
})
|
||||
|
||||
$('.btnBack').click(function(){
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
$('#btnBranchAdd').show();
|
||||
|
||||
$('#branch_name').val('');
|
||||
$('#branch_code').val('');
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
|
||||
$('#name').val('');
|
||||
$('#email').val('');
|
||||
$('#mobile').val('');
|
||||
$('#designation').val('');
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
if(tpa_Branch_PrimaryKey !== ''){
|
||||
|
||||
var branchTable = '';
|
||||
var data = <?= isset($tpa_branch) ? json_encode($tpa_branch) : '[]' ?>;
|
||||
$.each(data, function(index, item) {
|
||||
branchTable += `
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_code}</td>
|
||||
<td><a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a></td>
|
||||
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#tpa_branch_list').append(branchTable);
|
||||
}
|
||||
|
||||
|
||||
$("#tpa_branch_form").submit(function(events) {
|
||||
events.preventDefault();
|
||||
var isValid = $('#tpa_branch_form').parsley().validate();
|
||||
|
||||
if (isValid) {
|
||||
|
||||
var formData = new FormData($('#tpa_branch_form')[0]);
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: tpa_branch_form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
console.log(res);
|
||||
$('#tpa_branch_list tr').remove();
|
||||
var tpaBranchTableInsert = ''
|
||||
$.each(res.data, function(index, item) {
|
||||
tpaBranchTableInsert += `
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_code}</td>
|
||||
<td><a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a></td>
|
||||
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#tpa_branch_list').append(tpaBranchTableInsert);
|
||||
$('#add_branch').hide();
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
$('#btnBranchAdd').show();
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('click', '.btnBranchEdit', function () {
|
||||
$('#container').html("");
|
||||
contactCount =1;
|
||||
var branch_id = $(this).attr('data-id');
|
||||
tpa_branch_form_action = '<?= base_url("master/tpa/branch/edit"); ?>';
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('master/tpa/branch/editget/');?>'+branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
console.log("tpa.............");
|
||||
console.log(res)
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
$('#btnBranchAdd').hide();
|
||||
$('#branch_name').val(res.tpabranch.branch_name);
|
||||
$('#branch_code').val(res.tpabranch.branch_code);
|
||||
$('#state option[value="' + res.tpabranch.state + '"]').prop('selected', true);
|
||||
$('#district').val(res.tpabranch.district);
|
||||
$('#branch_city').val(res.tpabranch.city);
|
||||
$('#tpa_Branch_PrimaryKey').val(res.tpabranch.id);
|
||||
|
||||
$('.form-row').find('#name').val(res.levelcontact[0].name);
|
||||
$('#email').val(res.levelcontact[0].email);
|
||||
$('#mobile').val(res.levelcontact[0].mobile);
|
||||
$('#designation').val(res.levelcontact[0].designation);
|
||||
|
||||
res.levelcontact.shift();
|
||||
$.each(res.levelcontact, function(index, contact) {
|
||||
console.log(contact);
|
||||
if (contact !== undefined) {
|
||||
appendContactHtml(contact);
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
function loadBranchList()
|
||||
{
|
||||
var base_url = '<?= base_url("master/tpa/branch/list/"); ?>';
|
||||
|
||||
var tpa_branch_action = base_url + tpa_Branch_PrimaryKey;
|
||||
if ($('#tpa_id_branch').val() != '') {
|
||||
$.ajax({
|
||||
url: tpa_branch_action,
|
||||
type: 'GET',
|
||||
success: function(response) {
|
||||
var branchTable = '';
|
||||
$.each(response.tpa_branch, function(index, item) {
|
||||
branchTable += `
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_code}</td>
|
||||
<td><a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#tpa_branch_list').html(branchTable);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
function appendContactHtml(contact = false, reset = false) {
|
||||
|
||||
console.log('appendContactHtml function called ')
|
||||
contactCount++;
|
||||
|
||||
var container = document.getElementById('container');
|
||||
var uniqueId = Date.now().toString();
|
||||
|
||||
var html = `
|
||||
<div id="${uniqueId}">
|
||||
<hr>
|
||||
<h6 class="header-title">Contact ${contactCount}</h6>
|
||||
<br>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="${uniqueId}_name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
|
||||
<input data-parsley-type="email" value="${contact !== undefined && contact !== false ? contact.email : ''}" type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="tel" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
|
||||
<input data-parsley-type="number" data-parsley-length="[10,10]" value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="display: flex;">
|
||||
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac" onclick="appendContactHtml()" id="${uniqueId}_add">Add Contact</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="${uniqueId}_remove">Remove</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
if(reset == false){
|
||||
console.log(reset)
|
||||
container.insertAdjacentHTML('beforeend', html);
|
||||
storeButtonId(uniqueId + '_add');
|
||||
|
||||
if (contactCount >= 3) {
|
||||
hideStoredAddButtons();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function removeContact(button) {
|
||||
var uniqueId = button.id.split("_")[0];
|
||||
var contactSection = document.getElementById(uniqueId);
|
||||
|
||||
if (contactSection) {
|
||||
contactSection.parentNode.removeChild(contactSection);
|
||||
contactCount --;
|
||||
|
||||
if (contactCount < 3) {
|
||||
var addButton = document.querySelector('.ac');
|
||||
if (addButton) {
|
||||
addButton.style.display = 'block';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function storeButtonId(id) {
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
buttonIds.push(id);
|
||||
localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
|
||||
}
|
||||
|
||||
|
||||
function hideStoredAddButtons() {
|
||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
storedIds.forEach(function(id) {
|
||||
var addButton = document.getElementById(id);
|
||||
var first_addButton = document.querySelector('.ac')
|
||||
if (addButton) {
|
||||
addButton.style.display = 'none';
|
||||
first_addButton.style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showNextAddButton() {
|
||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
var addButtonShown = false;
|
||||
|
||||
// Iterate through the stored IDs to find the next "Add" button to show
|
||||
storedIds.forEach(function(id) {
|
||||
if (!addButtonShown) {
|
||||
var addButton = document.getElementById(id);
|
||||
if (addButton && addButton.style.display === 'none') {
|
||||
addButton.style.display = 'block';
|
||||
addButtonShown = true; // Set to true once an "Add" button is shown
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
$('#branch_form input, #branch_form select').each(function() {
|
||||
|
||||
if ($(this).is('input[type="text"]') || $(this).is('select')) {
|
||||
if ($.trim($(this).val()) == '') {
|
||||
isValid = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
</script>
|
||||
132
app/Views/tpa_list.php
Normal file
132
app/Views/tpa_list.php
Normal file
@ -0,0 +1,132 @@
|
||||
<div class="row" id="tpa_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">TPA List</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
||||
<a href="<?= base_url("master/tpa/create"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">Name</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php if(is_array($tpaList)) {foreach($tpaList as $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $row['name']; ?> ( <?php echo $row['short_name']; ?> ) </td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="<?= base_url("master/tpa/list/"); ?><?= $row['id'];?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }}?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" ,
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'TPAList',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
const btnExport = document.querySelector("#btnExport");
|
||||
const tableElement = document.querySelector("#tickets-table");
|
||||
|
||||
btnExport.addEventListener("click", () => {
|
||||
const obj = new csvExport(tableElement);
|
||||
const csvData = obj.exportCsv();
|
||||
const blob = new Blob([csvData], { type: "text/csv" });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = "TPAList.csv";
|
||||
a.click();
|
||||
|
||||
setTimeout(() => {
|
||||
URL.revokeObjectURL(url);
|
||||
}, 500);
|
||||
});
|
||||
|
||||
|
||||
class csvExport {
|
||||
constructor(table, header = true) {
|
||||
this.table = table;
|
||||
this.rows = Array.from(table.querySelectorAll("tr"));
|
||||
if (!header && this.rows[0].querySelectorAll("th").length) {
|
||||
this.rows.shift();
|
||||
}
|
||||
}
|
||||
|
||||
exportCsv() {
|
||||
const lines = [];
|
||||
const ncols = this._longestRow();
|
||||
for (const row of this.rows) {
|
||||
let line = "";
|
||||
for (let i = 0; i < ncols - 1; i++) { // Exclude the last column
|
||||
if (row.children[i] !== undefined) {
|
||||
line += csvExport.safeData(row.children[i]);
|
||||
}
|
||||
line += i !== ncols - 2 ? "," : ""; // Adjusted for the last column exclusion
|
||||
}
|
||||
lines.push(line);
|
||||
}
|
||||
return lines.join("\n");
|
||||
}
|
||||
|
||||
_longestRow() {
|
||||
return this.rows.reduce((length, row) => (row.childElementCount > length ? row.childElementCount : length), 0);
|
||||
}
|
||||
|
||||
static safeData(td) {
|
||||
let data = td.textContent;
|
||||
//Replace all double quote to two double quotes
|
||||
data = data.replace(/"/g, `""`);
|
||||
//Replace , and \n to double quotes
|
||||
data = /[",\n"]/.test(data) ? `"${data}"` : data;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
69
app/Views/tpa_onboarding.php
Normal file
69
app/Views/tpa_onboarding.php
Normal file
@ -0,0 +1,69 @@
|
||||
<style>
|
||||
|
||||
body {
|
||||
.multiselect-native-select {
|
||||
position: relative;
|
||||
/* bottom: 32px; */
|
||||
select {
|
||||
border: 0 !important;
|
||||
clip: rect(0 0 0 0) !important;
|
||||
height: 1px !important;
|
||||
margin: -1px -1px -1px -3px !important;
|
||||
overflow: hidden !important;
|
||||
padding: 0 !important;
|
||||
position: absolute !important;
|
||||
width: 1px !important;
|
||||
left: 50%;
|
||||
top: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.multiselect-container{
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.multiselect-selected-text{
|
||||
float: left !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="row" id="tpa_add">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">TPA Onboarding</h4>
|
||||
</div>
|
||||
<!-- <div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("master/tpa/list"); ?>" class="btn btn-primary waves-effect waves-light">Back</a>
|
||||
</div> -->
|
||||
</div>
|
||||
<ul class="nav nav-pills navtab-bg">
|
||||
<li class="nav-item">
|
||||
<a href="#general-q-tab" data-toggle="tab" aria-expanded="false"
|
||||
class="nav-link px-3 py-2 active">
|
||||
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
|
||||
<span class="d-none d-sm-inline-block">General</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#branch-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="tpa_branch_contacts_id">
|
||||
<span class="mr-1"><i class="mdi mdi-source-branch"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Branch & Contacts</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<?php include('tpa_basic_info.php'); ?>
|
||||
<?php include('tpa_branch.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -60,7 +60,9 @@
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true
|
||||
"sort-packages": true,
|
||||
"process-timeout": 900
|
||||
|
||||
},
|
||||
"scripts": {
|
||||
"test": "phpunit"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user