MERGE_EMP_WITH_MASTERS
This commit is contained in:
commit
d8fc4ab42c
@ -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");
|
||||
@ -60,8 +61,13 @@ $routes->group("/client", ["filter" => "authMVC"], function($routes){
|
||||
$routes->get("list/(:any)", "ClientController::getKycDocsById/$1");
|
||||
$routes->get("delete/(:any)", "ClientController::deleteClientKycDocs/$1");
|
||||
});
|
||||
$routes->group("premimum", ["filter" => "authMVC"], function($routes){
|
||||
$routes->post("create", "ClientController::createClientPolicyPremium");
|
||||
$routes->post("edit", "ClientController::editClientPolicyPremium");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$routes->group("/employee", ["filter" => "authMVC"], function($routes){
|
||||
$routes->get("list", "EmployeeController::list");
|
||||
$routes->get("search", "EmployeeController::search");
|
||||
@ -70,10 +76,85 @@ $routes->group("/employee", ["filter" => "authMVC"], function($routes){
|
||||
});
|
||||
|
||||
|
||||
$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("get-file-error/(:any)", "EmployeeController::getUploadedFileError/$1");
|
||||
$routes->get("kyc-other-docs-delete/(:any)", "ClientController::deleteClientKycOtherDocs/$1");
|
||||
$routes->get("policy-premium", "ClientController::getpolicyGridData/$1");
|
||||
});
|
||||
|
||||
$routes->cli('processjob', 'JobWorker::processJob');
|
||||
|
||||
@ -23,6 +23,9 @@ use App\Models\PolicesModel;
|
||||
use App\Models\TPABranchModel;
|
||||
use App\Models\TPAModel;
|
||||
use App\Models\StateModel;
|
||||
use App\Models\PolicyGridModel;
|
||||
use App\Models\PolicyPremium1Model;
|
||||
use App\Models\PolicyPremium2Model;
|
||||
|
||||
|
||||
class ClientController extends AdminController
|
||||
@ -45,6 +48,9 @@ class ClientController extends AdminController
|
||||
protected $tpaBranchModel;
|
||||
protected $tpaModel;
|
||||
protected $stateModel;
|
||||
protected $policyGridModel;
|
||||
protected $policyPremium1Model;
|
||||
protected $policyPremium2Model;
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -67,6 +73,9 @@ class ClientController extends AdminController
|
||||
$this->tpaBranchModel = new TPABranchModel();
|
||||
$this->tpaModel = new TPAModel();
|
||||
$this->stateModel = new StateModel();
|
||||
$this->policyGridModel = new PolicyGridModel();
|
||||
$this->policyPremium1Model = new PolicyPremium1Model();
|
||||
$this->policyPremium2Model = new PolicyPremium2Model();
|
||||
}
|
||||
|
||||
public function index()
|
||||
@ -97,6 +106,7 @@ class ClientController extends AdminController
|
||||
$data['tpa'] = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
|
||||
$data['state'] = $this->stateModel->getAllStates();
|
||||
$data['RM'] = $this->userModel->findAll();
|
||||
$data['policyGridData'] = $this->policyGridModel->findAll();
|
||||
|
||||
// echo "<pre>";
|
||||
// print_r($data); die;
|
||||
@ -113,23 +123,22 @@ class ClientController extends AdminController
|
||||
$this->myLogger->logme('error','Edit Client Onboarding function called');
|
||||
$headerData['page_name'] = 'Edit Client Onboarding';
|
||||
|
||||
$editData['RM'] = $this->userModel->findAll();
|
||||
$editData['tpa'] = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
|
||||
$editData['state'] = $this->stateModel->getAllStates();
|
||||
$editData['police'] = $this->policesModel->findAll();
|
||||
$editData['entity'] = $this->kycEntityTypeModel->findAll();
|
||||
$editData['insurer'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
|
||||
$editData['kyc_docs'] = $this->kycDocsModel->findAll();
|
||||
$editData['RM'] = $this->userModel->findAll();
|
||||
$editData['tpa'] = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
|
||||
$editData['state'] = $this->stateModel->getAllStates();
|
||||
$editData['police'] = $this->policesModel->findAll();
|
||||
$editData['entity'] = $this->kycEntityTypeModel->findAll();
|
||||
$editData['insurer'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
|
||||
$editData['kyc_docs'] = $this->kycDocsModel->findAll();
|
||||
$editData['policyGridData'] = $this->policyGridModel->findAll();
|
||||
|
||||
|
||||
$editData['client'] = $this->clientModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$editData['client_kyc'] = $this->clientKYCDocsModel->getKycDocsName($id);
|
||||
$editData['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $id)->findAll();
|
||||
$editData['client_branch'] = $this->clientBranchModel->where(['client_id' => $id, 'is_active' => 1])->findAll();
|
||||
$editData['client_relation'] = $this->clientRMModel->where(['client_id' => $id, 'is_active' => 1])->findAll();
|
||||
$editData['client_policy'] = $this->clientPolicyModel->getClientPolicyByClientId($id);
|
||||
|
||||
|
||||
|
||||
// echo "<pre>";
|
||||
// print_r($editData); die;
|
||||
|
||||
@ -170,19 +179,20 @@ class ClientController extends AdminController
|
||||
|
||||
public function createClientKYCInfo()
|
||||
{
|
||||
$this->myLogger->logme('error','create Client kyc function called');
|
||||
$this->myLogger->logme('error','create Client kyc function called');
|
||||
$data = $this->request->getPost();
|
||||
unset($data['file_name']);
|
||||
$File = file_Upload($this->request->getFile('file_name'));
|
||||
if(!empty($File)){
|
||||
$data['file_name'] = $File;
|
||||
}
|
||||
|
||||
$data['client_id'] = $this->request->getPost('client_id');
|
||||
$data['kyc_doc_type_id'] = $this->request->getPost('kyc_doc_id');
|
||||
$data['created_by'] = get_session_userid();
|
||||
$insert = $this->clientKYCDocsModel->insert($data);
|
||||
if($insert){
|
||||
$kycDocs = $this->clientKYCDocsModel->getKycDocsName($this->request->getPost('client_id'));
|
||||
echo json_encode(array("status" => true , 'data' => $kycDocs));
|
||||
|
||||
$kycDocs = $this->clientKYCDocsModel->where('client_id',$this->request->getPost('client_id'))->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $kycDocs, 'file_name' => $File));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
@ -210,11 +220,22 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
public function deleteClientKycDocs($id=null)
|
||||
{
|
||||
|
||||
$delete = $this->clientKYCDocsModel->where('kyc_doc_type_id', $id)->delete();
|
||||
if($delete){
|
||||
echo json_encode(array("status" => true, 'id' => $id ));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteClientKycOtherDocs($id=null)
|
||||
{
|
||||
|
||||
$delete = $this->clientKYCDocsModel->where('id', $id)->delete();
|
||||
if($delete){
|
||||
echo json_encode(array("status" => true ));
|
||||
echo json_encode(array("status" => true, 'id' => $id ));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
@ -382,26 +403,46 @@ class ClientController extends AdminController
|
||||
|
||||
$this->myLogger->logme('error','Client policy CREATE function called');
|
||||
|
||||
$insurerValue = (string) $this->request->getPost('insurer');
|
||||
$insurerValue = (string) $this->request->getPost('insurer');
|
||||
list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
|
||||
|
||||
$data['insurer_branch_id'] = $insurerBranchId;
|
||||
$data['insurer_id'] = $insurerId;
|
||||
$data['insurer_id'] = $insurerId;
|
||||
|
||||
$tpaValue = (string) $this->request->getPost('tpa');
|
||||
list($tpaBranchId, $tpaId) = explode('-', $tpaValue);
|
||||
|
||||
$data['tpa_branch_id'] = $tpaBranchId;
|
||||
$data['tpa_id'] = $tpaId;
|
||||
$data['policy_id'] = $this->request->getPost('policy_id');
|
||||
$data['client_id'] = $this->request->getPost('client_id');
|
||||
$data['tpa_branch_id'] = $tpaBranchId;
|
||||
$data['tpa_id'] = $tpaId;
|
||||
$data['policy_id'] = $this->request->getPost('policy_id');
|
||||
$data['policy_type_id'] = $this->request->getPost('policy_type_id');
|
||||
$data['client_id'] = $this->request->getPost('client_id');
|
||||
|
||||
|
||||
$data['created_by'] = get_session_userid();
|
||||
$data['insured'] = $this->request->getPost('insured');
|
||||
$data['no_of_lives'] = $this->request->getPost('no_of_lives');
|
||||
$data['policy_status'] = $this->request->getPost('policy_status');
|
||||
$data['no_of_employees'] = $this->request->getPost('no_of_employees');
|
||||
$data['earned_premium_date'] = change_date_format($this->request->getPost('earned_premium_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['claims_incurred_date'] = change_date_format($this->request->getPost('claims_incurred_date'), 'd-m-Y', 'Y-m-d'); $data['incurred_claims_ratio'] = $this->request->getPost('incurred_claims_ratio');
|
||||
$data['no_lives_at_inception'] = $this->request->getPost('no_lives_at_inception');
|
||||
$data['premium_paid_at_inception'] = $this->request->getPost('premium_paid_at_inception');
|
||||
$data['claims_experience_for_last_3_years'] = $this->request->getPost('claims_experience_for_last_3_years');
|
||||
$data['earned_premium_amount'] = $this->request->getPost('earned_premium_amount');
|
||||
$data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount');
|
||||
|
||||
|
||||
|
||||
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
|
||||
|
||||
|
||||
$data['created_by'] = get_session_userid();
|
||||
|
||||
$insert = $this->clientPolicyModel->insert($data);
|
||||
if($insert){
|
||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($this->request->getPost('client_id'));
|
||||
echo json_encode(array("status" => true , 'data' => $clientPoliceData));
|
||||
echo json_encode(array("status" => true , 'data' => $clientPoliceData, 'method' => 'CERATE'));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
@ -412,34 +453,137 @@ class ClientController extends AdminController
|
||||
|
||||
$this->myLogger->logme('error','Client policy function called');
|
||||
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
|
||||
$insurerValue = (string) $this->request->getPost('insurer');
|
||||
$insurerValue = (string) $this->request->getPost('insurer');
|
||||
list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
|
||||
|
||||
$data['insurer_branch_id'] = $insurerBranchId;
|
||||
$data['insurer_id'] = $insurerId;
|
||||
$data['insurer_id'] = $insurerId;
|
||||
|
||||
$tpaValue = (string) $this->request->getPost('tpa');
|
||||
$tpaValue = (string) $this->request->getPost('tpa');
|
||||
list($tpaBranchId, $tpaId) = explode('-', $tpaValue);
|
||||
|
||||
$data['tpa_branch_id'] = $tpaBranchId;
|
||||
$data['tpa_id'] = $tpaId;
|
||||
$data['policy_id'] = $this->request->getPost('policy_id');
|
||||
$data['tpa_branch_id'] = $tpaBranchId;
|
||||
$data['tpa_id'] = $tpaId;
|
||||
$data['policy_id'] = $this->request->getPost('policy_id');
|
||||
$data['policy_type_id'] = $this->request->getPost('policy_type_id');
|
||||
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
|
||||
|
||||
$data['insured'] = $this->request->getPost('insured');
|
||||
$data['no_of_lives'] = $this->request->getPost('no_of_lives');
|
||||
$data['policy_status'] = $this->request->getPost('policy_status');
|
||||
$data['no_of_employees'] = $this->request->getPost('no_of_employees');
|
||||
$data['earned_premium_date'] = change_date_format($this->request->getPost('earned_premium_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['claims_incurred_date'] = change_date_format($this->request->getPost('claims_incurred_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['incurred_claims_ratio'] = $this->request->getPost('incurred_claims_ratio');
|
||||
$data['no_lives_at_inception'] = $this->request->getPost('no_lives_at_inception');
|
||||
$data['premium_paid_at_inception'] = $this->request->getPost('premium_paid_at_inception');
|
||||
$data['claims_experience_for_last_3_years'] = $this->request->getPost('claims_experience_for_last_3_years');
|
||||
$data['earned_premium_amount'] = $this->request->getPost('earned_premium_amount');
|
||||
$data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount');
|
||||
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$insert = $this->clientPolicyModel->update($id,$data);
|
||||
$lastQuery = $this->clientPolicyModel->getLastQuery();
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($lastQuery); die;
|
||||
|
||||
if($insert){
|
||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($client_id);
|
||||
echo json_encode(array("status" => true , 'data' => $clientPoliceData));
|
||||
echo json_encode(array("status" => true , 'data' => $clientPoliceData , 'method' => 'EDIT'));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function createClientPolicyPremium()
|
||||
{
|
||||
$policy_type = $this->request->getPost('policy_type');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$client_policy_id = $this->request->getPost('client_policy_id');
|
||||
$policy_grid_id = $this->request->getPost('policy_grid_id');
|
||||
|
||||
if($policy_type !== null && $policy_type !== ''){
|
||||
|
||||
$data = $this->request->getPost();
|
||||
$data['created_by'] = get_session_userid();
|
||||
$this->policyPremium1Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update();
|
||||
$insert = $this->policyPremium1Model->insert($data);
|
||||
|
||||
}else{
|
||||
|
||||
$this->policyPremium2Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update();
|
||||
$premiumData = $this->request->getPost('premium');
|
||||
for ($i = 0; $i < count($premiumData); $i++) {
|
||||
|
||||
$data = [
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'policy_grid_id' => $policy_grid_id,
|
||||
'created_by' => get_session_userid(),
|
||||
|
||||
];
|
||||
|
||||
if(is_array($this->request->getPost('si'))){
|
||||
$si = isset($this->request->getPost('si')[$i]) ? $this->request->getPost('si')[$i] : null;
|
||||
}else{
|
||||
$si = $this->request->getPost('si');
|
||||
}
|
||||
$age_from = isset($this->request->getPost('age_from')[$i]) ? $this->request->getPost('age_from')[$i] : null;
|
||||
$age_to = isset($this->request->getPost('age_to')[$i]) ? $this->request->getPost('age_to')[$i] : null;
|
||||
$premium = isset($premiumData[$i]) ? $premiumData[$i] : null;
|
||||
$grade = isset($this->request->getPost('grade')[$i]) ? $this->request->getPost('grade')[$i] : null;
|
||||
$max_si = isset($this->request->getPost('max_si')[$i]) ? $this->request->getPost('max_si')[$i] : null;
|
||||
$created_by = get_session_userid();
|
||||
|
||||
if ($si !== null) {
|
||||
$data['si'] = $si;
|
||||
}
|
||||
|
||||
if ($age_from !== null) {
|
||||
$data['age_from'] = $age_from;
|
||||
}
|
||||
|
||||
if ($age_to !== null) {
|
||||
$data['age_to'] = $age_to;
|
||||
}
|
||||
|
||||
if ($premium !== null) {
|
||||
$data['premium'] = $premium;
|
||||
}
|
||||
|
||||
if ($max_si !== null) {
|
||||
$data['max_si'] = $max_si;
|
||||
}
|
||||
|
||||
if ($grade !== null) {
|
||||
$data['grade'] = $grade;
|
||||
}
|
||||
|
||||
$this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}
|
||||
|
||||
if($insert){
|
||||
echo json_encode(array("status" => true , 'data' => $data));
|
||||
}else{
|
||||
echo json_encode(array("status" => false , 'data' => $data));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function getKycDocsById($id=null)
|
||||
{
|
||||
|
||||
@ -493,4 +637,36 @@ class ClientController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
public function getpolicyGridData()
|
||||
{
|
||||
|
||||
$policy_id = $this->request->getGet('policy_id');
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
|
||||
$data = $this->policesModel->getPolicyPremium($policy_id);
|
||||
$pattern = '/gmc/i';
|
||||
$subject = $data[0]->policy_type;
|
||||
if (preg_match($pattern, $subject)) {
|
||||
$search_term = 'GMC';
|
||||
} else {
|
||||
$search_term = 'GPA';
|
||||
}
|
||||
$results = $this->policyGridModel->like('policy_type', $search_term)->findAll();
|
||||
|
||||
if($search_term === 'GPA'){
|
||||
|
||||
$premiumData = $this->policyPremium1Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
|
||||
}else{
|
||||
$premiumData = $this->policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($results);
|
||||
// print_r($data[0]->policy_type); die;
|
||||
echo json_encode(array("status" => true , 'data' => $results, 'premiumData' => $premiumData));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -13,6 +13,7 @@ class ClientKYCDocsModel extends Model
|
||||
'client_id',
|
||||
'kyc_doc_type_id',
|
||||
'file_name',
|
||||
'other_docs_name',
|
||||
'is_active',
|
||||
"created_by",
|
||||
"updated_by",
|
||||
|
||||
@ -16,6 +16,23 @@ class ClientPolicyModel extends Model
|
||||
"insurer_branch_id",
|
||||
"tpa_id",
|
||||
"tpa_branch_id",
|
||||
|
||||
"policy_start_date",
|
||||
"policy_end_date",
|
||||
|
||||
"insured",
|
||||
"no_of_employees",
|
||||
"no_of_lives",
|
||||
"no_lives_at_inception",
|
||||
"premium_paid_at_inception",
|
||||
"earned_premium_date",
|
||||
"claims_incurred_date",
|
||||
"incurred_claims_ratio",
|
||||
"claims_experience_for_last_3_years",
|
||||
"policy_status",
|
||||
"earned_premium_amount",
|
||||
"claims_incurred_amount",
|
||||
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"Is_active",
|
||||
@ -59,4 +76,24 @@ class ClientPolicyModel extends Model
|
||||
->getResult();
|
||||
|
||||
}
|
||||
|
||||
public function getPolicyPremium($policy_id){
|
||||
|
||||
return $this->db->table('policies')
|
||||
->select('policy_type.*')
|
||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
||||
->where('policies.id', $policy_id)
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
public function getPolicyPremiumPolicyTypeId($policy_type_id){
|
||||
|
||||
return $this->db->table('policies')
|
||||
->select('policy_type.*')
|
||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
||||
->where('policies.id', $policy_type_id)
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,9 +11,20 @@ class PolicesModel extends Model
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"insurer_id",
|
||||
"policy_type_id",
|
||||
"name",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
];
|
||||
|
||||
public function getPolicyPremium($policy_id){
|
||||
|
||||
return $this->db->table('policies')
|
||||
->select('policy_type.*')
|
||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
||||
->where('policies.id', $policy_id)
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
}
|
||||
|
||||
22
app/Models/PolicyGridModel.php
Normal file
22
app/Models/PolicyGridModel.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class PolicyGridModel extends Model
|
||||
{
|
||||
protected $table = 'policy_grid_master';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
'id',
|
||||
'policy_grid_type',
|
||||
'is_dependent_allowed',
|
||||
'max_dependent_age',
|
||||
'max_dependent_count',
|
||||
"created_by",
|
||||
"updated_by",
|
||||
'is_active',
|
||||
];
|
||||
|
||||
}
|
||||
25
app/Models/PolicyPremium1Model.php
Normal file
25
app/Models/PolicyPremium1Model.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class PolicyPremium1Model extends Model
|
||||
{
|
||||
protected $table = 'policy_premium_1';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
|
||||
'id',
|
||||
'client_id',
|
||||
'client_policy_id',
|
||||
'policy_grid_id',
|
||||
'si',
|
||||
'premium',
|
||||
'multiplier',
|
||||
"created_by",
|
||||
"updated_by",
|
||||
'is_active',
|
||||
|
||||
];
|
||||
}
|
||||
28
app/Models/PolicyPremium2Model.php
Normal file
28
app/Models/PolicyPremium2Model.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class PolicyPremium2Model extends Model
|
||||
{
|
||||
protected $table = 'policy_premium_2';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
|
||||
'id',
|
||||
'client_id',
|
||||
'client_policy_id',
|
||||
'policy_grid_id',
|
||||
'age_from',
|
||||
'age_to',
|
||||
'si',
|
||||
'premium',
|
||||
'grade',
|
||||
"created_by",
|
||||
"updated_by",
|
||||
'is_active',
|
||||
|
||||
];
|
||||
|
||||
}
|
||||
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",
|
||||
|
||||
@ -108,7 +108,7 @@ body {
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="emp_code">Employee Code<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="emp_code" placeholder="Enter Employee Code" name="emp_code" required>
|
||||
<input type="text" class="form-control" id="emp_code" placeholder="Enter Code" name="emp_code" required>
|
||||
</div>
|
||||
<div class="form-group col-md-8">
|
||||
<label for="first_name">Name<span class="text-danger">*</span></label>
|
||||
@ -120,7 +120,7 @@ body {
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="email">Email<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="email" placeholder="Enter Email" name="email" required>
|
||||
<input type="text" class="form-control" id="email" placeholder="Enter Email" name="email" data-parsley-trigger="change" data-parsley-type="email" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -128,7 +128,7 @@ body {
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="mobile">Mobile Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="mobile" placeholder="Enter Mobile Number" name="mobile" required>
|
||||
<input type="text" class="form-control" id="mobile" placeholder="Enter Mobile Number ( starting with 6, 7, 8, or 9 only. )" name="mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="10" pattern="^[6-9]\d{9}$" data-parsley-type-message="Please enter a valid 10-digit mobile number starting with 6, 7, 8, or 9." data-parsley-required-message="Please enter a valid 10-digit mobile number starting with 6, 7, 8, or 9." required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -159,7 +159,7 @@ body {
|
||||
|
||||
<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>
|
||||
<!-- <button type="button" class="btn btn-secondry waves-effect waves-light mr-1" data-dismiss="modal" aria-hidden="true">Close</button> -->
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -196,7 +196,6 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#team').multiselect({
|
||||
nonSelectedText: 'Select Team',
|
||||
enableFiltering: false,
|
||||
@ -205,6 +204,7 @@ $(document).ready(function () {
|
||||
buttonWidth:'100%'
|
||||
});
|
||||
|
||||
|
||||
$('#btnAdd').click(function(){
|
||||
$('#first_name').val('');
|
||||
$('#last_name').val('');
|
||||
@ -224,6 +224,7 @@ $(document).ready(function () {
|
||||
$('#role').val('')
|
||||
})
|
||||
|
||||
|
||||
$('body').on('click', '.btnEdit', function () {
|
||||
var user_id = $(this).attr('data-id');
|
||||
$.ajax({
|
||||
@ -232,6 +233,7 @@ $(document).ready(function () {
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
console.log(res)
|
||||
$('#updateModal').modal('show');
|
||||
$('#role').val('')
|
||||
$('#UserForm').attr('action', '<?php echo base_url('user/edit');?>');
|
||||
$('#UserId').val(res.data.id);
|
||||
@ -256,6 +258,7 @@ $(document).ready(function () {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '.btnDelete', function () {
|
||||
|
||||
Swal.fire({
|
||||
@ -279,68 +282,14 @@ $(document).ready(function () {
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
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++) { // Adjusted loop to exclude the last column
|
||||
if (row.children[i] !== undefined) {
|
||||
line += csvExport.safeData(row.children[i]);
|
||||
line += ",";
|
||||
}
|
||||
}
|
||||
// Remove the trailing comma
|
||||
line = line.slice(0, -1);
|
||||
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;
|
||||
}
|
||||
function onlyNumbers(event){
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if(charcode>= 48 && charcode <= 57)return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@ -44,12 +44,12 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="pan">PAN<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="pan"
|
||||
placeholder="Enter PAN Number" value="<?= isset($client['pan']) ? $client['pan'] : '' ?>" name="pan" required>
|
||||
placeholder="Enter PAN Number" value="<?= isset($client['pan']) ? $client['pan'] : '' ?>" name="pan" data-parsley-trigger="change" data-parsley-pattern="^[A-Z]{5}[0-9]{4}[A-Z]$" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="gst">GST<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="gst"
|
||||
placeholder="Enter GST Number" value="<?= isset($client['gst']) ? $client['gst'] : '' ?>" name="gst" required>
|
||||
placeholder="Enter GST Number" value="<?= isset($client['gst']) ? $client['gst'] : '' ?>" name="gst" data-parsley-trigger="change" data-parsley-pattern="^\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}[Z]{1}[A-Z\d]{1}$" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -99,7 +99,7 @@
|
||||
<label for="pincode">Pincode<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="pincode"
|
||||
placeholder="Enter Pincode" value="<?= isset($client['pincode']) ? $client['pincode'] : '' ?>" name="pincode" maxlength="6" required>
|
||||
placeholder="Enter Pincode" onkeypress = "return onlyNumbers(event)" value="<?= isset($client['pincode']) ? $client['pincode'] : '' ?>" name="pincode" maxlength="6" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -119,107 +119,100 @@
|
||||
|
||||
<script>
|
||||
|
||||
var PrimaryKey = $('#general_PrimaryKey').val();
|
||||
var form_action = '';
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$("#general_form").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
var isValid = validateForm();
|
||||
var PrimaryKey = $('#general_PrimaryKey').val();
|
||||
var form_action = '';
|
||||
|
||||
if (isValid) {
|
||||
|
||||
if(PrimaryKey === ''){
|
||||
form_action = '<?= base_url("client/general/create"); ?>';
|
||||
}else{
|
||||
form_action = '<?= base_url("client/general/edit"); ?>';
|
||||
}
|
||||
|
||||
var formData = new FormData($('#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);
|
||||
$('#client_id').val(res.data.id);
|
||||
$('#client_id_relation').val(res.data.id);
|
||||
$('#client_id_branch').val(res.data.id);
|
||||
$('#client_id_police').val(res.data.id);
|
||||
$('#client_id_kyc').val(res.data.id);
|
||||
$('#kyc_tab').click();
|
||||
|
||||
$.toast({
|
||||
text: 'Client General Info',
|
||||
heading: "Submitted Sucessfully",
|
||||
position: 'top-right',
|
||||
icon: 'success',
|
||||
bgColor: !1,
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/kyc/list/"); ?>'+res.data.entity_type_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
console.log(res);
|
||||
$.each(res.data, function(index, item) {
|
||||
OptionsHTML1 += '<option value="' + item.id + '">' + item.file_name + '</option>';
|
||||
});
|
||||
$('#kyc_docs').html(OptionsHTML1);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
var isValid = $('#general_form').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return ;
|
||||
}
|
||||
|
||||
if(PrimaryKey === ''){
|
||||
form_action = '<?= base_url("client/general/create"); ?>';
|
||||
}else{
|
||||
form_action = '<?= base_url("client/general/edit"); ?>';
|
||||
}
|
||||
|
||||
var formData = new FormData($('#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);
|
||||
$('#client_id').val(res.data.id);
|
||||
$('#client_id_relation').val(res.data.id);
|
||||
$('#client_id_branch').val(res.data.id);
|
||||
$('#branch_PrimaryKey').val(res.data.id);
|
||||
$('#client_id_policy').val(res.data.id);
|
||||
$('#policy_PrimaryKey').val(res.data.id);
|
||||
$('#client_id_kyc').val(res.data.id);
|
||||
$('#entity_type').val(res.data.entity_type_id);
|
||||
$('#kyc_tab').click();
|
||||
|
||||
var message = (PrimaryKey === '') ? 'Client General Info Created successfully' : 'Client General Info Updated successfully';
|
||||
toastr.success(message, 'Success');
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/kyc/list/"); ?>' + res.data.entity_type_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (res) {
|
||||
|
||||
console.log(res);
|
||||
var tbody = $('#tbody');
|
||||
tbody.empty();
|
||||
|
||||
$.each(res.data, function (index, item) {
|
||||
var row = `<tr>
|
||||
<td> ${item.file_name}</td>
|
||||
<td id="form_${item.id}" style=""><form class="ajax" ><input class="file-input__input" type="file" name="file_name">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id" />
|
||||
<input type="hidden" name="client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<button class="btn btn-sm btn-primary submit" style="position: relative;right: 80px;">Submit</button></form></td>
|
||||
<td id="name_${item.id}" style="display:none;"></td>
|
||||
<td><i data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px;"></i></td>
|
||||
</tr>`;
|
||||
tbody.append(row);
|
||||
});
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
// Perform validation for each field
|
||||
$('#general_form input, #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;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
function onlyNumbers(event){
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if(charcode>= 48 && charcode <= 57)return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@ -1,9 +1,7 @@
|
||||
<div class="tab-pane fade" id="branch-tab">
|
||||
|
||||
<div class="row float-right" style="padding-bottom: 10px;">
|
||||
<div class="col-6">
|
||||
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light"><i class="fa fa-plus-square" aria-hidden="true"></i></button>
|
||||
</div>
|
||||
<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" >
|
||||
@ -24,10 +22,8 @@
|
||||
<div class="row" id="add_branch">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<div class="row float-right" style="position: relative; bottom: 20px;">
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light btnBack"><i class="fa fa-list" aria-hidden="true"></i></button>
|
||||
</div>
|
||||
<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>
|
||||
@ -40,10 +36,8 @@
|
||||
<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>
|
||||
<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
|
||||
@ -83,91 +77,30 @@
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="first_name">Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="name0"
|
||||
placeholder="Enter Contact Name" name="name[]" >
|
||||
<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 type="text" class="form-control" id="email0"
|
||||
placeholder="Enter Contact Email" name="email[]" >
|
||||
<label for="last_name">Email<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Email" name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="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 type="text" class="form-control" id="mobile0"
|
||||
placeholder="Enter Contact Mobile" name="mobile[]" >
|
||||
<label for="mobile">Mobile<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Mobile ( starting with 6, 7, 8, or 9 only. )" name="mobile[]" id="mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="10" pattern="^[6-9]\d{9}$" data-parsley-type-message="Please enter a valid 10-digit mobile number starting with 6, 7, 8, or 9." data-parsley-required-message="Please enter a valid 10-digit mobile number starting with 6, 7, 8, or 9." required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="designation">Designation<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="designation0"
|
||||
placeholder="Enter Designation Name" name="designation[]" >
|
||||
<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>
|
||||
|
||||
<br>
|
||||
<h6 class="header-title">Contact 2</h6>
|
||||
<br>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="name">Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="name1"
|
||||
placeholder="Enter Contact Name" name="name[]" >
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="email">Email</label>
|
||||
<input type="text" class="form-control" id="email1"
|
||||
placeholder="Enter Contact Email" name="email[]" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile">Mobile</label>
|
||||
<input type="text" class="form-control" id="mobile1"
|
||||
placeholder="Enter Contact Mobile" name="mobile[]" >
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="designation">Designation</label>
|
||||
<input type="text" class="form-control" id="designation1"
|
||||
placeholder="Enter Designation Name" name="designation[]">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<h6 class="header-title">Contact 3</h6>
|
||||
<br>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="name">Name</label>
|
||||
<input type="text" class="form-control" id="name2"
|
||||
placeholder="Enter Contact Name" name="name[]" >
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="email">Email</label>
|
||||
<input type="text" class="form-control" id="email2"
|
||||
placeholder="Enter Contact Email" name="email[]" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile">Mobile</label>
|
||||
<input type="text" class="form-control" id="mobile2"
|
||||
placeholder="Enter Contact Mobile" name="mobile[]" >
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="designation">Designation</label>
|
||||
<input type="text" class="form-control" id="designation2"
|
||||
placeholder="Enter Designation Name" name="designation[]" >
|
||||
</div>
|
||||
</div>
|
||||
<div id="container"></div>
|
||||
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0">
|
||||
@ -185,15 +118,36 @@
|
||||
|
||||
<script>
|
||||
|
||||
var branch_form_action = '';
|
||||
var contactCount = 1;
|
||||
var branch_PrimaryKey = $('#client_id_branch').val();
|
||||
var branch_PrimaryKey_2 = $('#branch_PrimaryKey').val();
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var branch_PrimaryKey = $('#client_id_branch').val();
|
||||
var branch_form_action = '';
|
||||
|
||||
branch_PrimaryKey = $('#client_id_branch').val();
|
||||
branch_PrimaryKey_2 = $('#branch_PrimaryKey').val();
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('.btnBack').hide();
|
||||
|
||||
|
||||
|
||||
if(branch_PrimaryKey !== ''){
|
||||
|
||||
var branchTable = '';
|
||||
var data = <?= isset($client_branch) ? json_encode($client_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>
|
||||
`;
|
||||
});
|
||||
$('#branch_list').append(branchTable);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('#btnBranchAdd').click(function(){
|
||||
@ -210,21 +164,26 @@ $(document).ready(function () {
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
|
||||
$('#name0').val('');
|
||||
$('#email0').val('');
|
||||
$('#mobile0').val('');
|
||||
$('#designation0').val('');
|
||||
$('#branch_form')[0].reset();
|
||||
$('.ac').css('display', 'block');
|
||||
contactCount = 1
|
||||
|
||||
$('#name1').val('');
|
||||
$('#email1').val('');
|
||||
$('#mobile1').val('');
|
||||
$('#designation1').val('');
|
||||
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')
|
||||
}
|
||||
|
||||
$('#name2').val('');
|
||||
$('#email2').val('');
|
||||
$('#mobile2').val('');
|
||||
$('#designation2').val('');
|
||||
})
|
||||
|
||||
$('.btnBack').click(function(){
|
||||
@ -239,48 +198,43 @@ $(document).ready(function () {
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
|
||||
$('#name0').val('');
|
||||
$('#email0').val('');
|
||||
$('#mobile0').val('');
|
||||
$('#designation0').val('');
|
||||
$('#branch_form')[0].reset();
|
||||
$('.ac').css('display', 'block');
|
||||
|
||||
$('#name1').val('');
|
||||
$('#email1').val('');
|
||||
$('#mobile1').val('');
|
||||
$('#designation1').val('');
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
for (var i = 0; i < buttonIds.length; i++) {
|
||||
var firstElement = buttonIds[i].split('_')[0];
|
||||
console.log(firstElement);
|
||||
|
||||
$('#name2').val('');
|
||||
$('#email2').val('');
|
||||
$('#mobile2').val('');
|
||||
$('#designation2').val('');
|
||||
// Find the element by its ID
|
||||
var elementToRemove = document.getElementById(firstElement);
|
||||
console.log(elementToRemove);
|
||||
|
||||
if (elementToRemove) {
|
||||
console.log(elementToRemove);
|
||||
elementToRemove.parentNode.removeChild(elementToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
if(branch_PrimaryKey !== ''){
|
||||
|
||||
var branchTable = '';
|
||||
var data = <?= isset($client_branch) ? json_encode($client_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>
|
||||
`;
|
||||
});
|
||||
$('#branch_list').append(branchTable);
|
||||
}
|
||||
|
||||
|
||||
$("#branch_form").submit(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
branch_PrimaryKey = $('#client_id_branch').val();
|
||||
branch_PrimaryKey_2 = $('#branch_PrimaryKey').val();
|
||||
|
||||
// Perform validation
|
||||
var isValid = true; // Assuming you have a function for form validation
|
||||
|
||||
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]);
|
||||
@ -294,6 +248,8 @@ $(document).ready(function () {
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
console.log(res);
|
||||
var message = (branch_PrimaryKey === '') ? 'Client General Info Created successfully' : 'Client General Info Updated successfully';
|
||||
toastr.success(message, 'Success');
|
||||
$('#branch_list tr').remove();
|
||||
var branchTableInsert = ''
|
||||
$.each(res.data, function(index, item) {
|
||||
@ -301,7 +257,7 @@ $(document).ready(function () {
|
||||
<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>
|
||||
<td><a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
@ -319,7 +275,12 @@ $(document).ready(function () {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('body').on('click', '.btnBranchEdit', function () {
|
||||
|
||||
console.log(branch_form_action);
|
||||
|
||||
var branch_id = $(this).attr('data-id');
|
||||
branch_form_action = '<?= base_url("client/branch/edit"); ?>';
|
||||
$.ajax({
|
||||
@ -339,13 +300,16 @@ $(document).ready(function () {
|
||||
$('#district').val(res.data.district);
|
||||
$('#branch_city').val(res.data.city);
|
||||
$('#branch_PrimaryKey').val(res.data.id);
|
||||
|
||||
|
||||
$('#name').val(res.contact[0].name);
|
||||
$('#email').val(res.contact[0].email);
|
||||
$('#mobile').val(res.contact[0].mobile);
|
||||
$('#designation').val(res.contact[0].designation);
|
||||
|
||||
res.contact.shift();
|
||||
$.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 : '');
|
||||
appendContactHtml(contact);
|
||||
}
|
||||
});
|
||||
|
||||
@ -355,9 +319,139 @@ $(document).ready(function () {
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
console.log(branch_form_action);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
// Initialize the contact count
|
||||
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 value="${contact !== undefined && contact !== false ? contact.email : ''}" type="text" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" data-parsley-trigger="change" data-parsley-type="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="text" class="form-control" placeholder="Enter Contact Mobile ( starting with 6, 7, 8, or 9 only. )" name="mobile[]" id="${uniqueId}_mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" min="10" pattern="^[6-9]\d{9}$" data-parsley-type-message="Please enter a valid 10-digit mobile number starting with 6, 7, 8, or 9." data-parsley-required-message="Please enter a valid 10-digit mobile number starting with 6, 7, 8, or 9." 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){
|
||||
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;
|
||||
}
|
||||
|
||||
function onlyNumbers(event){
|
||||
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if(charcode>= 48 && charcode <= 57)return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -1,27 +1,57 @@
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
<div class="tab-pane fade" id="KYC-DOC-tab">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table id="kyc_table" class="table table-sm mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Document Name</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody">
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end table-responsive-->
|
||||
|
||||
<hr>
|
||||
|
||||
<button class="btn btn-primary waves-effect waves-light btn-sm" id="btn_other_docs">Other Documents</button>
|
||||
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
</div> <!-- end col -->
|
||||
|
||||
|
||||
<div class="row" id="others">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<form role="form" class="parsley-examples" method="post" id="kyc_form"
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="kyc_PrimaryKey" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<input type="hidden" name="client_id" id="client_id_kyc" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<input type="hidden" name="entity_type" id="entity_type" />
|
||||
<input type="hidden" name="client_id" id="client_id_kyc" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<input type="hidden" name="kyc_doc_type_id" value="0" />
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="emp_code">Document Type</label>
|
||||
<select class="form-control" id="kyc_docs" name="kyc_doc_id" required>
|
||||
<option value="">Select Kyc Docs</option>
|
||||
</select>
|
||||
<label for="emp_code">Other Documents<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="other_docs_name" placeholder="Document Name" name="other_docs_name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="kyc_docs">File</label>
|
||||
<input class="form-control" type="file" name="file_name"
|
||||
multiple="true" id="kyc_docs_file" required>
|
||||
<label for="kyc_docs">File<span
|
||||
class="text-danger">*</span></label>
|
||||
<input class="form-control" type="file" name="file_name" multiple="true" id="kyc_docs_file" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4 align-self-end">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"id="btnSubmit">Upload</button>
|
||||
@ -33,8 +63,10 @@
|
||||
</div>
|
||||
</div> <!-- end col-->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
<div class="col-lg-8">
|
||||
|
||||
<div class="col-lg-12" id="other_docs_table">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
@ -46,7 +78,7 @@
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody">
|
||||
<tbody id="other_docs">
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end table-responsive-->
|
||||
@ -54,37 +86,116 @@
|
||||
</div>
|
||||
</div> <!-- end card -->
|
||||
</div> <!-- end col -->
|
||||
<!-- end row -->
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
<script>
|
||||
|
||||
var kycPrimaryKey = $('#kyc_PrimaryKey').val();
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
// $('#kyc_docs').change(function(){
|
||||
// var selectedValue = $(this).val()
|
||||
// console.log(selectedValue);
|
||||
// })
|
||||
kycPrimaryKey = $('#kyc_PrimaryKey').val();
|
||||
$('#others').hide()
|
||||
$('#other_docs_table').hide();
|
||||
|
||||
$(document).on('click', '.submit', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
kycPrimaryKey = $('#kyc_PrimaryKey').val();
|
||||
|
||||
var form = $(this).closest('form');
|
||||
var formData = new FormData(form[0]);
|
||||
var fileInputs = form.find('input[type="file"]');
|
||||
var allowedExtensions = ['pdf', 'png', 'jpeg', 'jpg'];
|
||||
|
||||
|
||||
|
||||
if(kycPrimaryKey !== ''){
|
||||
var OptionsHTML3 =""
|
||||
if (kycPrimaryKey === '') {
|
||||
toastr.error('Client is required', 'Error');
|
||||
form.trigger('reset')
|
||||
return;
|
||||
}
|
||||
|
||||
var isFormEmpty = true;
|
||||
fileInputs.each(function() {
|
||||
var files = $(this)[0].files;
|
||||
if (files.length > 0) {
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var fileName = files[i].name;
|
||||
var fileExtension = fileName.split('.').pop().toLowerCase();
|
||||
if (allowedExtensions.indexOf(fileExtension) === -1) {
|
||||
form.trigger('reset')
|
||||
toastr.warning('File type not allowed: ' + fileName, 'Warning');
|
||||
return;
|
||||
}
|
||||
}
|
||||
isFormEmpty = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (isFormEmpty) {
|
||||
toastr.warning('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/kyc/list/"); ?>'+'<?= isset($client['entity_type_id']) ? $client['entity_type_id'] : '' ?>',
|
||||
url: '<?= base_url("client/kyc/create"); ?>',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (res) {
|
||||
res = JSON.parse(res)
|
||||
console.log(res);
|
||||
form.trigger('reset')
|
||||
$.each(res.data, function (index, item) {
|
||||
|
||||
$('#name_'+item.kyc_doc_type_id).show();
|
||||
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
|
||||
$('#form_'+item.kyc_doc_type_id).hide();
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
;
|
||||
|
||||
if(kycPrimaryKey !== ''){
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/kyc/list/"); ?>' + '<?= isset($client['entity_type_id']) ? $client['entity_type_id'] : '' ?>',
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
success: function (res) {
|
||||
console.log(res);
|
||||
$.each(res.data, function(index, item) {
|
||||
OptionsHTML3 += '<option value="' + item.id + '">' + item.file_name + '</option>';
|
||||
var tbody = $('#tbody');
|
||||
tbody.empty();
|
||||
|
||||
$.each(res.data, function (index, item) {
|
||||
var row = `<tr>
|
||||
<td> ${item.file_name}</td>
|
||||
<td id="form_${item.id}" style=""><form class="ajax" ><input class="file-input__input" type="file" name="file_name">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id" />
|
||||
<input type="hidden" name="client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<button class="btn btn-sm btn-primary submit" style="position: relative;right: 80px;">Submit</button></form></td>
|
||||
<td id="name_${item.id}" style="display:none;"></td>
|
||||
<td><i data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px;"></i></td>
|
||||
</tr>`;
|
||||
tbody.append(row);
|
||||
});
|
||||
$('#kyc_docs').html(OptionsHTML3);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
@ -92,30 +203,52 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var table = '';
|
||||
var data = <?= isset($client_kyc) ? json_encode($client_kyc) : '[]' ?>;
|
||||
$('#tbody tr').remove();
|
||||
console.log(data)
|
||||
$('#other_docs tr').remove();
|
||||
$.each(data, function(index, item) {
|
||||
table += `
|
||||
if(item.kyc_doc_type_id == '0'){
|
||||
table += `
|
||||
<tr id="kyc-${item.id}">
|
||||
<td>${item.client_file_name}</td>
|
||||
<td>${item.other_docs_name}</td>
|
||||
<td>${item.file_name}</td>
|
||||
<td><i data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px;"></i></td>
|
||||
<td><i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i></td>
|
||||
</tr>
|
||||
`;
|
||||
`;
|
||||
|
||||
}
|
||||
});
|
||||
$('#tbody').append(table);
|
||||
$('#other_docs').append(table);
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
// console.log(item.kyc_doc_type_id);
|
||||
// console.log('name_' + item.kyc_doc_type_id);
|
||||
// console.log(document.getElementById('name_' + item.kyc_doc_type_id));
|
||||
setTimeout(function() {
|
||||
$('#name_'+item.kyc_doc_type_id).show();
|
||||
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
|
||||
$('#form_'+item.kyc_doc_type_id).hide();
|
||||
}, 1000);
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('#btn_other_docs').click(function(){
|
||||
$('#others').toggle();
|
||||
$('#other_docs_table').toggle();
|
||||
});
|
||||
|
||||
|
||||
$("#kyc_form").submit(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
// Perform validation
|
||||
var isValid = validateForm(); // Assuming you have a function for form validation
|
||||
var isValid = $('#kyc_form').parsley().validate();
|
||||
var rowHtml = '';
|
||||
var form_action = '';
|
||||
if (isValid) {
|
||||
@ -129,42 +262,33 @@
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: form_action,
|
||||
url: '<?= base_url("client/kyc/create"); ?>',
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log(res);
|
||||
if(kycPrimaryKey === ''){
|
||||
$.toast({
|
||||
text: 'Client Relation Info',
|
||||
heading: "Submitted Sucessfully",
|
||||
position: 'top-right',
|
||||
icon: 'success',
|
||||
});
|
||||
}else{
|
||||
$.toast({
|
||||
text: 'Client Relation Info',
|
||||
heading: "Updated Sucessfully",
|
||||
position: 'top-right',
|
||||
icon: 'success',
|
||||
});
|
||||
}
|
||||
$('#tbody tr').remove();
|
||||
$('#kyc_form').trigger('reset')
|
||||
var message = (kycPrimaryKey === '') ? 'KYC Docs Uploaded successfully' : 'KYC Docs Uploaded successfully';
|
||||
toastr.success(message, 'Success');
|
||||
|
||||
$('#other_docs tr').remove();
|
||||
$.each(res.data, function(index, item) {
|
||||
rowHtml += `
|
||||
<tr id="kyc-${item.id}">
|
||||
<td>${item.client_file_name}</td>
|
||||
<td>${item.file_name}</td>
|
||||
<td><i data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px;"></i></td>
|
||||
</tr>
|
||||
`;
|
||||
console.log("Current item:", item);
|
||||
if (item.kyc_doc_type_id == '0') {
|
||||
console.log("Appending item:", item);
|
||||
var rowHtml = `
|
||||
<tr id="kyc-${item.id}">
|
||||
<td>${item.other_docs_name}</td>
|
||||
<td>${item.file_name}</td>
|
||||
<td><i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i></td>
|
||||
</tr>
|
||||
`;
|
||||
}
|
||||
$('#other_docs').append(rowHtml);
|
||||
});
|
||||
$('#tbody').append(rowHtml);
|
||||
$('#kyc_docs_file').val('');
|
||||
$('#kyc_docs').val('');
|
||||
$('#kyc_docs').val('Select Document Type');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
@ -175,6 +299,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '.btnKycDelete', function () {
|
||||
|
||||
Swal.fire({
|
||||
@ -190,6 +315,33 @@
|
||||
|
||||
var kyc_id = $(this).attr('data-id');
|
||||
$.get('<?php echo base_url('client/kyc/delete/');?>'+kyc_id, function (data) {
|
||||
console.log('kyc-'+ kyc_id)
|
||||
console.log(data)
|
||||
if(data){
|
||||
$('#form_'+kyc_id).show();
|
||||
$('#name_'+kyc_id).hide();
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '.btnKycOtherDelete', function () {
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You won't be able to revert this!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: "Yes, delete it!"
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
|
||||
var kyc_id = $(this).attr('data-id');
|
||||
$.get('<?php echo base_url('util/kyc-other-docs-delete/');?>'+kyc_id, function (data) {
|
||||
console.log('kyc-'+ kyc_id)
|
||||
if(data){
|
||||
$('#kyc-'+ kyc_id).remove();
|
||||
@ -201,31 +353,29 @@
|
||||
|
||||
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
// Perform validation for each field
|
||||
$('#kyc_form input, #kyc_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
|
||||
}
|
||||
}
|
||||
var isValid = true;
|
||||
|
||||
// Check for file inputs (assuming image files)
|
||||
if ($(this).is('input[type="file"]')) {
|
||||
var fileInput = $(this)[0];
|
||||
if (fileInput.files.length === 0) {
|
||||
console.log('Please select an image file');
|
||||
isValid = false;
|
||||
return false; // Exit the loop early
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
$('#kyc_form input, #kyc_form select').each(function() {
|
||||
if ($(this).is('input[type="text"]') || $(this).is('select')) {
|
||||
if ($.trim($(this).val()) == '') {
|
||||
console.log('Please fill in all fields');
|
||||
isValid = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($(this).is('input[type="file"]')) {
|
||||
var fileInput = $(this)[0];
|
||||
if (fileInput.files.length === 0) {
|
||||
console.log('Please select an image file');
|
||||
isValid = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -65,10 +65,11 @@
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'ClientList',
|
||||
className: 'my_class',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
@ -81,63 +82,4 @@
|
||||
|
||||
})
|
||||
|
||||
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>
|
||||
@ -45,7 +45,7 @@ body {
|
||||
<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">
|
||||
class="nav-link px-3 py-2 active" id="general_tab">
|
||||
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
|
||||
<span class="d-none d-sm-inline-block">General</span>
|
||||
</a>
|
||||
@ -57,19 +57,19 @@ body {
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#RM-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2">
|
||||
<a href="#RM-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="RM_tab">
|
||||
<span class="mr-1"><i class="mdi mdi-account-switch"></i></span>
|
||||
<span class="d-none d-sm-inline-block"> Relationship Manager</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#branch-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2">
|
||||
<a href="#branch-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="branch_tab">
|
||||
<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>
|
||||
<li class="nav-item">
|
||||
<a href="#police-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2">
|
||||
<a href="#police-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="policy_tab">
|
||||
<span class="mr-1"><i class="mdi mdi-book-open-page-variant"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Policies</span>
|
||||
</a>
|
||||
@ -88,3 +88,33 @@ body {
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
// $(document).ready(function(){
|
||||
// var tabid = localStorage.getItem('tabId');
|
||||
// console.log(tabid)
|
||||
// $('#'+tabid).click();
|
||||
// localStorage.removeItem('tabId')
|
||||
// })
|
||||
|
||||
|
||||
// $('#general_tab').click( function (){
|
||||
// localStorage.setItem('tabId', 'general_tab')
|
||||
// })
|
||||
|
||||
// $('#KYC-DOC-tab').click( function (){
|
||||
// localStorage.setItem('tabId', 'kyc_tab')
|
||||
// })
|
||||
// $('#RM_tab').click( function (){
|
||||
// localStorage.setItem('tabId', 'RM_tab')
|
||||
// })
|
||||
// $('#branch_tab').click( function (){
|
||||
// localStorage.setItem('tabId', 'branch_tab')
|
||||
// })
|
||||
// $('#policy_tab').click( function (){
|
||||
// localStorage.setItem('tabId', 'policy_tab')
|
||||
// })
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
<?php include('policy_grid.php'); ?>
|
||||
|
||||
<div class="tab-pane fade" id="police-tab">
|
||||
|
||||
|
||||
<div class="row float-right" style="padding-bottom: 10px;">
|
||||
<div class="col-6">
|
||||
<button type="button" id="BtnAdd" class="btn btn-primary waves-effect waves-light btnAdd"><i class="fa fa-plus-square" aria-hidden="true"></i></button>
|
||||
</div>
|
||||
<div class="row float-right" style="padding-bottom: 10px; position: relative;right: 13px;">
|
||||
<button type="button" id="BtnAdd" class="btn btn-primary waves-effect waves-light btnAdd btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy</button>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive" id="table_list" >
|
||||
@ -28,10 +27,8 @@
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row float-right" style="position: relative; bottom: 20px;">
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light btnBack"><i class="fa fa-list" aria-hidden="true"></i></button>
|
||||
</div>
|
||||
<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 btn-sm"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
@ -41,13 +38,15 @@
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="policy_PrimaryKey" />
|
||||
<input type="hidden" id="policy_form_action" />
|
||||
<input type="hidden" name="client_id" id="client_id_police" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<input type="hidden" id="policy_type_id" id="policy_type_id"/>
|
||||
<input type="hidden" name="client_id" id="client_id_policy" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="email">Insurer<span
|
||||
class="text-danger">*</span></label>
|
||||
<select class="form-control" id="insurer" name="insurer">
|
||||
<select class="form-control" id="insurer" name="insurer" required>
|
||||
<option value="">Select Insurer</option>
|
||||
<?php foreach($insurer as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id']?>"><?= $value['insurer_name'] . '-' . $value['branch_code'] ?></option>
|
||||
@ -57,14 +56,14 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="policy">Policies<span
|
||||
class="text-danger">*</span></label>
|
||||
<select class="form-control" id="policy" name="policy_id">
|
||||
<select class="form-control" id="policy" name="policy_id" required>
|
||||
<option value="" selected>Select Policy</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mobile">TPA<span
|
||||
class="text-danger">*</span></label>
|
||||
<select class="form-control" id="tpa" name="tpa">
|
||||
<select class="form-control" id="tpa" name="tpa" required>
|
||||
<option value="">Select TPA</option>
|
||||
<?php foreach($tpa as $value) { ?>
|
||||
<option value="<?= $value['id']. '-' . $value['tpa_id'] ?>"><?= $value['tpa_short_name'] . '-' . $value['branch_code'] ?></option>
|
||||
@ -72,6 +71,22 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="policy_start_date">Policy Start Date<span class="text-danger">*</span></label>
|
||||
<input value="" type="date" class="form-control" placeholder="Enter Start Date " name="policy_start_date" id="start_date" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="policy_end_date">Policy End Date<span class="text-danger">*</span></label>
|
||||
<input value="" type="date" class="form-control" placeholder="Enter End Date " name="policy_end_date" id="end_date" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="policy_fields"></div>
|
||||
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
@ -89,44 +104,59 @@
|
||||
|
||||
<script>
|
||||
|
||||
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||
var policy_client = $('#policy_PrimaryKey').val();
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var policy_PrimaryKey = $('#client_id_police').val();
|
||||
var policy_client = $('#policy_PrimaryKey').val();
|
||||
//Configure Flatpicker for the policy start date datepicker.
|
||||
flatpickr("#start_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
defaultDate: "today",
|
||||
allowInput: false,
|
||||
});
|
||||
|
||||
//Configure Flatpicker for the policy end date datepicker.
|
||||
flatpickr("#end_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
defaultDate: "today",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
$('#add_form').hide();
|
||||
$('.btnBack').hide();
|
||||
|
||||
|
||||
$('.btnAdd').click(function(){
|
||||
$('#add_form').show();
|
||||
$('#table_list').hide();
|
||||
$('.btnBack').show();
|
||||
$('.btnAdd').hide();
|
||||
$('#policy_form_action').val('<?= base_url("client/policy/edit"); ?>');
|
||||
;
|
||||
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('.btnBack').click(function(){
|
||||
|
||||
$('#GMC').remove();
|
||||
$('#GPA').remove();
|
||||
$('#add_form').hide();
|
||||
$('#table_list').show();
|
||||
$('.btnBack').hide();
|
||||
$('.btnAdd').show();
|
||||
$('#insurer').val('');
|
||||
$('#tpa').val('');
|
||||
$('#start_date').val('');
|
||||
$('#end_date').val('');
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||
|
||||
})
|
||||
|
||||
toastr.options = {
|
||||
"timeOut": 2000,
|
||||
"closeButton": true,
|
||||
};
|
||||
|
||||
if (policy_PrimaryKey !== '') {
|
||||
var policyTable = '';
|
||||
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
||||
console.log(data);
|
||||
|
||||
data.forEach(function(item) {
|
||||
policyTable += `
|
||||
@ -134,7 +164,10 @@ $(document).ready(function () {
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${item.policy_name}</td>
|
||||
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
||||
<td><a data-id="${item.id}" class="btnPolicyEdit" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnPolicyEdit" style="font-size:18px;"></i></a></td>
|
||||
<td>
|
||||
<a data-id="${item.id}" class="btnPolicyEdit mdi mdi-lead-pencil" href="#" style="font-size:18px;"></a>
|
||||
<a data-id="${item.policy_id}" class="btnPolicyModel mdi mdi-book-open" href="#" data-toggle="modal" data-target="#bs-example-modal-lg" style="font-size:18px;"></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
@ -142,75 +175,93 @@ $(document).ready(function () {
|
||||
$('#policy_table').append(policyTable);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
//for form submit using AJAX
|
||||
$("#policy_form").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
event.preventDefault();
|
||||
|
||||
if (policy_PrimaryKey === '' && policy_client === '') {
|
||||
toastr.error('Client ID is required', 'Error');
|
||||
$('#insurer').val('');
|
||||
$('#tpa').val('');
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||
return;
|
||||
policy_PrimaryKey = $('#client_id_policy').val();
|
||||
policy_client = $('#policy_PrimaryKey').val();
|
||||
|
||||
if (policy_PrimaryKey === '' && policy_client === '') {
|
||||
toastr.error('Client is required', 'Error');
|
||||
$('#insurer').val('');
|
||||
$('#tpa').val('');
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||
return;
|
||||
}
|
||||
|
||||
var isValid = $('#policy_form').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return ;
|
||||
}
|
||||
|
||||
var formData = new FormData($('#policy_form')[0]);
|
||||
var policy_form_action = $('#policy_form_action').val();
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: policy_form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error('Policy Dose Not Create', 'Error');
|
||||
return;
|
||||
}
|
||||
|
||||
var formData = new FormData($('#policy_form')[0]);
|
||||
var policy_form_action = $('#policy_form_action').val();
|
||||
console.log(res);
|
||||
var message = (policy_PrimaryKey === '') ? 'Policy Created successfully' : 'Policy Updated Successfully';
|
||||
toastr.success(message, 'Success');
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: policy_form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error('Policy Dose Not Create', 'Error');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(res);
|
||||
var message = (policy_PrimaryKey === '') ? 'Policy Created successfully' : 'Updated Successfully';
|
||||
toastr.success(message, 'Success');
|
||||
|
||||
$('#policy_table tr').remove();
|
||||
var policyTable = '';
|
||||
$.each(res.data, function(index, item) {
|
||||
policyTable += `
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${item.policy_name}</td>
|
||||
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
||||
<td><a data-id="${item.id}" class="btnPolicyEdit" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnPolicyEdit" style="font-size:18px;"></i></a></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#policy_table').append(policyTable);
|
||||
$('#add_form').hide();
|
||||
$('#table_list').show();
|
||||
$('.btnBack').hide();
|
||||
$('.btnAdd').show();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
$('#policy_table tr').remove();
|
||||
var policyTable = '';
|
||||
$.each(res.data, function(index, item) {
|
||||
policyTable += `
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${item.policy_name}</td>
|
||||
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
||||
<td>
|
||||
<a data-id="${item.id}" class="btnPolicyEdit mdi mdi-lead-pencil" href="#" style="font-size:18px;"></a>
|
||||
<a data-id="${item.policy_id}" class="btnPolicyModel mdi mdi-book-open" href="#" data-toggle="modal" data-target="#bs-example-modal-lg" style="font-size:18px;"></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
});
|
||||
|
||||
$('#policy_table').append(policyTable);
|
||||
$('#add_form').hide();
|
||||
$('#table_list').show();
|
||||
$('.btnBack').hide();
|
||||
$('.btnAdd').show();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//To get th POLICY base on Insurer
|
||||
$('#insurer').change(function() {
|
||||
var id = $(this).val();
|
||||
var url = "<?= base_url("util/police-by-insurer/") ?>" + id;
|
||||
|
||||
|
||||
$.get(url, function(res) {
|
||||
res = JSON.parse(res)
|
||||
console.log(res)
|
||||
var OptionsHTML = '';
|
||||
OptionsHTML += '<option value="" selected>Select Policy</option>';
|
||||
$.each(res.data, function(index, item) {
|
||||
OptionsHTML += '<option value="' + item.id + '">' + item.name + '</option>';
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id + '">' + item.name + '</option>';
|
||||
});
|
||||
|
||||
$('#policy').html(OptionsHTML);
|
||||
@ -221,10 +272,26 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
|
||||
// set the Policy_Type_id for Form Submit
|
||||
$('#policy').change(function(){
|
||||
var dataId = $(this).children('option:selected').attr('data-id');
|
||||
$('#policy_type_id').val(dataId);
|
||||
if(dataId == 1){
|
||||
appendPolicyFormFields(1)
|
||||
}else{
|
||||
appendPolicyFormFields(2)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// get the client policy data for edit
|
||||
$('body').on('click', '.btnPolicyEdit', function () {
|
||||
|
||||
var policy_form_action = '';
|
||||
var policy_id = $(this).data('id');
|
||||
console.log('1', policy_id)
|
||||
var policyId = $(this).attr('data-id');
|
||||
console.log('2', policyId)
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/policy/list/") ?>' + policy_id,
|
||||
@ -247,11 +314,20 @@ $(document).ready(function () {
|
||||
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id);
|
||||
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id);
|
||||
$('#policy').val(res.data.policy_id);
|
||||
$('#policy_type_id').val(res.data.policy_type_id);
|
||||
$('#policy_PrimaryKey').val(res.data.id);
|
||||
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
|
||||
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date));
|
||||
|
||||
if(res.data.policy_type_id == 1){
|
||||
appendPolicyFormFields(1, res.data);
|
||||
}else {
|
||||
appendPolicyFormFields(2, res.data);
|
||||
}
|
||||
|
||||
var policeOptionHTML = '';
|
||||
$.each(res.policy, function(index, item) {
|
||||
policeOptionHTML += '<option value="' + item.id + '" ' + (res.data.policy_id === item.id ? 'selected="selected"' : '') + '>' + item.name + '</option>';
|
||||
policeOptionHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id + '" ' + (res.data.policy_id === item.id ? 'selected="selected"' : '') + '>' + item.name + '</option>';
|
||||
});
|
||||
$('#policy').html(policeOptionHTML);
|
||||
},
|
||||
@ -263,9 +339,130 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
function appendPolicyFormFields(policy_type, data = false){
|
||||
|
||||
var html = '';
|
||||
var container = document.getElementById('policy_fields');
|
||||
|
||||
if(policy_type == 2){
|
||||
|
||||
$('#GMC').remove();
|
||||
$('#GPA').remove();
|
||||
|
||||
html = `
|
||||
<div id="GMC">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="insured">Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.insured : ''}" type="text" class="form-control" placeholder="Enter insured " name="insured" id="insured" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="no_of_employees">No of Employees<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.no_of_employees : ''}" type="text" class="form-control" placeholder="Enter No of Employees" name="no_of_employees" id="no_of_employees" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="no_of_lives">No of Lives<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.no_of_lives : ''}" type="text" class="form-control" placeholder="Enter No of Lives " name="no_of_lives" id="no_of_lives" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="no_lives_at_inception">No Lives at Inception<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.no_lives_at_inception : ''}" type="text" class="form-control" placeholder="Enter No Lives at Inception " name="no_lives_at_inception" id="no_lives_at_inception" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="earned_premium_date">Earned Premium Date<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? rearrangeDateFormat(data.earned_premium_date) : ''}" type="date" class="form-control" placeholder="Enter Earned Premium Date " name="earned_premium_date" id="earned_premium_date" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="earned_premium_amount">Earned Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.earned_premium_amount : ''}" type="text" class="form-control" placeholder="Enter Earned Premium " name="earned_premium_amount" id="earned_premium_amount" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claims_incurred_date">Claims Incurred Date<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? rearrangeDateFormat(data.claims_incurred_date) : ''}" type="date" class="form-control" placeholder="Enter Claims Incurred Date " name="claims_incurred_date" id="claims_incurred_date" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claims_incurred_amount">Claims Incurred<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.claims_incurred_amount : ''}" type="text" class="form-control" placeholder="Enter Claims Incurred " name="claims_incurred_amount" id="claims_incurred_amount" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="premium_paid_at_inception">Premium paid at Inception<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium_paid_at_inception : ''}" type="text" class="form-control" placeholder="Enter Premium paid at Inception" name="premium_paid_at_inception" id="premium_paid_at_inception" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="incurred_claims_ratio">Incurred Claims Ratio<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.incurred_claims_ratio : ''}" type="text" class="form-control" placeholder="Enter Claims Ratio" name="incurred_claims_ratio" id="incurred_claims_ratio" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="policy_status">Policy Status<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.policy_status : ''}" type="text" class="form-control" placeholder="Enter Policy Status " name="policy_status" id="policy_status" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
}else if(policy_type == 1){
|
||||
|
||||
$('#GMC').remove();
|
||||
$('#GPA').remove();
|
||||
|
||||
html = `
|
||||
<div class="form-row" id="GPA">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="insured">Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.insured : ''}" type="text" class="form-control" placeholder="Enter insured " name="insured" id="insured" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="no_of_employees">No of Employees<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.no_of_employees : ''}" type="text" class="form-control" placeholder="Enter No of Employees" name="no_of_employees" id="no_of_employees" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="policy_status">Policy Status<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.policy_status : ''}" type="text" class="form-control" placeholder="Enter Policy Status " name="policy_status" id="policy_status" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claims_experience_for_last_3_years">Claims Experience for Last 3 Years<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.claims_experience_for_last_3_years : ''}" type="text" class="form-control" placeholder="Enter Claims Experience for Last 3 Years " name="claims_experience_for_last_3_years" id="claims_experience_for_last_3_years" required>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
container.insertAdjacentHTML('beforeend', html);
|
||||
|
||||
if(policy_type == 2){
|
||||
//Configure Flatpicker for the earned_premium_date datepicker.
|
||||
flatpickr("#earned_premium_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
defaultDate: "today",
|
||||
allowInput: false,
|
||||
});
|
||||
|
||||
//Configure Flatpicker for the claims_incurred_date datepicker.
|
||||
flatpickr("#claims_incurred_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
defaultDate: "today",
|
||||
allowInput: false
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
|
||||
function rearrangeDateFormat(inputDate) {
|
||||
|
||||
if(inputDate !== null){
|
||||
var dateComponents = inputDate.split("-");
|
||||
var rearrangedDate = dateComponents[2] + "-" + dateComponents[1] + "-" + dateComponents[0];
|
||||
return rearrangedDate;
|
||||
}else{
|
||||
return '00-00-0000';
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -2,6 +2,13 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row float-right" style="position: relative; bottom: 20px; right:13px;">
|
||||
<button class="btn btn-primary btn-sm" id="client_rm_edit" ><span id="rm_icons" class="mdi mdi-lead-pencil"></span> Edit</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="relation_form" enctype="multipart/form-data">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="relation_PrimaryKey" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
@ -44,10 +51,7 @@
|
||||
|
||||
</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>
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="client_rm_btnSubmit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -58,42 +62,57 @@
|
||||
<!-- end -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
|
||||
var relation_PrimaryKey = $('#relation_PrimaryKey').val()
|
||||
|
||||
$('#account_manager').multiselect({
|
||||
nonSelectedText: 'Select Account Manager',
|
||||
enableFiltering: false,
|
||||
enableCaseInsensitiveFiltering: false,
|
||||
includeSelectAllOption : false,
|
||||
buttonWidth:'100%'
|
||||
var relation_PrimaryKey = $('#relation_PrimaryKey').val();
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
relation_PrimaryKey = $('#relation_PrimaryKey').val()
|
||||
|
||||
$('#account_manager').multiselect({
|
||||
nonSelectedText: 'Select Account Manager',
|
||||
enableFiltering: false,
|
||||
enableCaseInsensitiveFiltering: false,
|
||||
includeSelectAllOption : false,
|
||||
buttonWidth:'100%'
|
||||
});
|
||||
|
||||
|
||||
var data = <?= isset($client_relation) ? json_encode($client_relation) : '[]' ?>;
|
||||
if (relation_PrimaryKey !== '') {
|
||||
$('#client_rm_btnSubmit').hide();
|
||||
$.each(data, function(index, item) {
|
||||
$('#head option[value="' + item.user_id + '"]').prop('selected', true);
|
||||
$('#manager option[value="' + item.user_id + '"]').prop('selected', true);
|
||||
var $option = $('#account_manager option[value="' + item.user_id + '"]');
|
||||
if ($option.length > 0) {
|
||||
$option.prop('selected', true);
|
||||
}
|
||||
$('#account_manager').multiselect('refresh');
|
||||
$('#head').prop('disabled', true);
|
||||
$('#manager').prop('disabled', true);
|
||||
$('#account_manager').multiselect('disable');
|
||||
|
||||
|
||||
});
|
||||
|
||||
var data = <?= isset($client_relation) ? json_encode($client_relation) : '[]' ?>;
|
||||
if (relation_PrimaryKey !== '') {
|
||||
$.each(data, function(index, item) {
|
||||
$('#head option[value="' + item.user_id + '"]').prop('selected', true);
|
||||
$('#manager option[value="' + item.user_id + '"]').prop('selected', true);
|
||||
var $option = $('#account_manager option[value="' + item.user_id + '"]');
|
||||
if ($option.length > 0) {
|
||||
$option.prop('selected', true);
|
||||
}
|
||||
$('#account_manager').multiselect('refresh');
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//for Client RelationShip Manager Form Submit using AJAX
|
||||
$("#relation_form").submit(function(event) {
|
||||
|
||||
$("#relation_form").submit(function(event) {
|
||||
event.preventDefault();
|
||||
relation_PrimaryKey = $('#relation_PrimaryKey').val()
|
||||
|
||||
// Perform validation
|
||||
var isValid = validateForm(); // Assuming you have a function for form validation
|
||||
var isValid = true;
|
||||
var form_action = '';
|
||||
|
||||
if (relation_PrimaryKey === '') {
|
||||
toastr.error('Client is required', 'Error');
|
||||
return;
|
||||
}
|
||||
|
||||
if (isValid) {
|
||||
|
||||
if(relation_PrimaryKey === ''){
|
||||
@ -113,22 +132,9 @@
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
console.log(res);
|
||||
if(relation_PrimaryKey === ''){
|
||||
$.toast({
|
||||
text: 'Client Relation Info',
|
||||
heading: "Submitted Sucessfully",
|
||||
position: 'top-right',
|
||||
icon: 'success',
|
||||
});
|
||||
}else{
|
||||
$.toast({
|
||||
text: 'Client Relation Info',
|
||||
heading: "Updated Sucessfully",
|
||||
position: 'top-right',
|
||||
icon: 'success',
|
||||
});
|
||||
}
|
||||
|
||||
var message = (relation_PrimaryKey === '') ? 'Client Relation Created successfully' : 'Client Relation Updated successfully';
|
||||
toastr.success(message, 'Success');
|
||||
$('#branch_tab').click();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
@ -139,25 +145,24 @@
|
||||
}
|
||||
});
|
||||
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
// Perform validation for each field
|
||||
$('#relation_form input, #relation_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
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
$('#client_rm_edit').click(function(){
|
||||
|
||||
var isDisabled = $('#head').prop('disabled');
|
||||
console.log(isDisabled)
|
||||
$('#head').prop('disabled', !isDisabled);
|
||||
$('#manager').prop('disabled', !isDisabled);
|
||||
|
||||
if (isDisabled) {
|
||||
$('#account_manager').multiselect('enable');
|
||||
$('#client_rm_btnSubmit').show();
|
||||
$(this).html('<span id="rm_icons" class="fa fa-times-circle"></span> Close Edit ');
|
||||
} else {
|
||||
$('#account_manager').multiselect('disable');
|
||||
$('#client_rm_btnSubmit').hide();
|
||||
$(this).html('<span id="rm_icons" class="mdi mdi-lead-pencil"></span> Edit ');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
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>
|
||||
|
||||
|
||||
@ -481,5 +481,23 @@
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/toastr@2.1.4/toastr.min.js"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/toastr@2.1.4/build/toastr.min.css" rel="stylesheet">
|
||||
|
||||
<!-- flatpicker datepicker -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/flatpickr.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/flatpickr@4.6.13/dist/flatpickr.min.js"></script>
|
||||
|
||||
<!-- bootstrap datepicker -->
|
||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.10.0/js/bootstrap-datepicker.min.js"></script> -->
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
toastr.options = {
|
||||
"timeOut": 2000,
|
||||
"closeButton": true,
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -76,10 +76,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Preloader
|
||||
-------------------------------------------------------*/
|
||||
|
||||
.loader-mask {
|
||||
position: fixed;
|
||||
@ -176,16 +172,28 @@
|
||||
}
|
||||
|
||||
|
||||
.modal-full-width {
|
||||
width: 80% !important;
|
||||
/* width: 95% !important; */
|
||||
/* max-width: none; */
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
/* position: relative;
|
||||
flex: 1 1 auto; */
|
||||
padding: 2rem !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
$(window).on('load', function() {
|
||||
// Preloader
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000); // 5000 milliseconds = 5 seconds
|
||||
}, 1000);
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -428,9 +436,9 @@
|
||||
<span class="logo-sm">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/n.png" alt="" height="24">
|
||||
</span>
|
||||
<span class="logo-lg">
|
||||
<!-- <span class="logo-lg">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/logo-light.png" alt="" height="20">
|
||||
</span>
|
||||
</span> -->
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -481,9 +489,9 @@
|
||||
<span class="logo-sm">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/n.png" alt="" height="24">
|
||||
</span>
|
||||
<span class="logo-lg">
|
||||
<!-- <span class="logo-lg">
|
||||
<img src="<?= base_url()."public"; ?>./assets/images/logo-light.png" alt="" height="20">
|
||||
</span>
|
||||
</span> -->
|
||||
</a>
|
||||
</div>
|
||||
<!-- >>>>>>> 47b829183b576482986f721bd598c48341c0bbec -->
|
||||
@ -532,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>
|
||||
799
app/Views/policy_grid.php
Normal file
799
app/Views/policy_grid.php
Normal file
@ -0,0 +1,799 @@
|
||||
<!-- Modal content for the Large example -->
|
||||
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-full-width">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myLargeModalLabel">Policy Premium </h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form role="form" class="parsley-examples" method="post" id="GridForm" enctype="multipart/form-data">
|
||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>"/>
|
||||
<input type="hidden" name="client_id" id="Client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<input type="hidden" name="client_policy_id" id="client_policy_id" />
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="emp_code">Policy Premium Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="grid" name="policy_grid_id" onchange="addGridHTML(event)" required>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="form-row" id="grid_content_input">
|
||||
</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="btnGridSubmit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
<script>
|
||||
var policy_grid_id = $('#client_id').val();
|
||||
var grid_html = '';
|
||||
|
||||
$('#gmc_remove').hide();
|
||||
$('#btnGridSubmit').hide();
|
||||
|
||||
$('.close').click(function(){
|
||||
|
||||
for (var i = 1; i <= 11; i++) {
|
||||
$('#grid_' + i).remove();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
function addGridHTML(event = false, data = false, ui_type = false){
|
||||
|
||||
var grid_container = document.getElementById('grid_content_input');
|
||||
var dataIdValue = ''
|
||||
if(event === false){
|
||||
var dataIdValue = ui_type
|
||||
}else{
|
||||
var selectElement = event.target;
|
||||
var selectedOption = selectElement.options[selectElement.selectedIndex];
|
||||
dataIdValue = selectedOption.getAttribute('data-id');
|
||||
}
|
||||
|
||||
|
||||
if(dataIdValue == '1'){
|
||||
|
||||
for (var i = 1; i <= 11; i++) {
|
||||
$('#grid_' + i).remove();
|
||||
}
|
||||
|
||||
grid_html = `
|
||||
<div class="form-row" id="grid_1">
|
||||
<input value="1" type="hidden" name="policy_type">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Select <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="si_or_bp" required>
|
||||
<option value="2">Basic Pay</option>
|
||||
<option value="1">Sum Insured</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4" id="gpa_sum_insured">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si" id="gpa_si" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">Multiplier<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.multiplier : ''}" type="text" class="form-control" placeholder="Multiplier" name="multiplier" id="multiplier" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium" id="gpa_premium" required>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
} else if(dataIdValue == '2'){
|
||||
|
||||
for (var i = 1; i <= 11; i++) {
|
||||
$('#grid_' + i).remove();
|
||||
}
|
||||
|
||||
grid_html = `
|
||||
<div class="form-row" id="grid_2">
|
||||
<input value="1" type="hidden" name="policy_type">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si" id="gpa_si" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium" id="gpa_premium" required>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
} else if(dataIdValue == '3'){
|
||||
|
||||
|
||||
for (var i = 1; i <= 11; i++) {
|
||||
$('#grid_' + i).remove();
|
||||
}
|
||||
|
||||
grid_html = `
|
||||
<div class="form-row" id="grid_3">
|
||||
<div class="form-group col-md-5">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si[]" id="gpa_si" required>
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="gpa_premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0, 3)">x</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(3)">+</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
} else if(dataIdValue == '4'){
|
||||
|
||||
|
||||
for (var i = 1; i <= 11; i++) {
|
||||
$('#grid_' + i).remove();
|
||||
}
|
||||
|
||||
grid_html = `
|
||||
<div class="form-row" id="grid_4">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si" id="sum_insured" required>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,4)">x</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(4)">+</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
} else if(dataIdValue == '5'){
|
||||
|
||||
|
||||
for (var i = 1; i <= 11; i++) {
|
||||
$('#grid_' + i).remove();
|
||||
}
|
||||
|
||||
grid_html = `
|
||||
<div class="form-row" id="grid_5">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,5)">x</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(5)">+</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
} else if(dataIdValue == '6'){
|
||||
|
||||
|
||||
for (var i = 1; i <= 11; i++) {
|
||||
$('#grid_' + i).remove();
|
||||
}
|
||||
|
||||
grid_html = `
|
||||
<div class="form-row" id="grid_6">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si" id="sum_insured" required>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,6)">x</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(6)">+</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
} else if(dataIdValue == '7'){
|
||||
|
||||
|
||||
for (var i = 1; i <= 11; i++) {
|
||||
$('#grid_' + i).remove();
|
||||
}
|
||||
|
||||
grid_html = `
|
||||
<div class="form-row" id="grid_7">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,7)">x</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(7)">+</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
} else if(dataIdValue == '8'){
|
||||
|
||||
|
||||
for (var i = 1; i <= 11; i++) {
|
||||
$('#grid_' + i).remove();
|
||||
}
|
||||
|
||||
|
||||
grid_html = `
|
||||
|
||||
<div class="form-row" id="grid_8">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Grade/Band<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control" placeholder="Enter Grade/Band " name="grade[]" id="grade" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,8)">x</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(8)">+</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
} else if(dataIdValue == '9'){
|
||||
|
||||
for (var i = 1; i <= 11; i++) {
|
||||
$('#grid_' + i).remove();
|
||||
}
|
||||
|
||||
grid_html = `
|
||||
|
||||
<div class="form-row" id="grid_9">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Grade/Band<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control" placeholder="Enter Grade/Band " name="grade[]" id="grade" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,9)">x</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(9)">+</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
} else if(dataIdValue == '10'){
|
||||
|
||||
|
||||
for (var i = 1; i <= 11; i++) {
|
||||
$('#grid_' + i).remove();
|
||||
}
|
||||
|
||||
grid_html = `
|
||||
<div class="form-row" id="grid_10">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,10)">x</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(10)">+</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
} else if(dataIdValue == '11'){
|
||||
|
||||
for (var i = 1; i <= 11; i++) {
|
||||
$('#grid_' + i).remove();
|
||||
}
|
||||
|
||||
grid_html = `
|
||||
|
||||
<div class="form-row" id="grid_11">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Grade/Band<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control" placeholder="Enter Grade/Band " name="grade[]" id="grade" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">Max SI<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.max_si : ''}" type="text" class="form-control" placeholder="Enter Max SI" name="max_si[]" id="max_si" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,11)">x</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(11)">+</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
for (var i = 1; i <= 11; i++) {
|
||||
$('#grid_' + i).remove();
|
||||
}
|
||||
grid_html = '';
|
||||
$('#btnGridSubmit').hide();
|
||||
|
||||
}
|
||||
grid_container.insertAdjacentHTML('beforeend', grid_html);
|
||||
$('#gpa_sum_insured').hide();
|
||||
$('#btnGridSubmit').show();
|
||||
|
||||
|
||||
$('#si_or_bp').change(function(){
|
||||
|
||||
var selectedValue = $(this).val();
|
||||
if(selectedValue == 1){
|
||||
$('#gpa_sum_insured').show();
|
||||
}else {
|
||||
$('#gpa_sum_insured').hide();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if(data !== false && data.si){
|
||||
console.log('show');
|
||||
$('#gpa_sum_insured').show();
|
||||
$('#si_or_bp').val("1");
|
||||
}else{
|
||||
$('#si_or_bp').val("2");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
$("#GridForm").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var isValid = $('#GridForm').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return ;
|
||||
}
|
||||
|
||||
var formData = new FormData($('#GridForm')[0]);
|
||||
var policy_form_action = '<?= base_url("client/premimum/create") ?>';
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: policy_form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error('Policy Dose Not Create', 'Error');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(res);
|
||||
var message = (policy_PrimaryKey === '') ? 'Policy Premium Added successfully' : 'Policy Premium Added Successfully';
|
||||
toastr.success(message, 'Success');
|
||||
$('.close').click();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '.btnPolicyModel', function () {
|
||||
|
||||
|
||||
var policy_id = $(this).data('id');
|
||||
console.log('policy_id :' ,policy_id);
|
||||
var client_id = $('#Client_id').val();
|
||||
$('#client_policy_id').val(policy_id);
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("util/policy-premium") ?>' ,
|
||||
type: "GET",
|
||||
data: { policy_id: policy_id, client_id: client_id },
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
console.log('responce :', res);
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error(res.status);
|
||||
return;
|
||||
}
|
||||
var policy_grid_id_value = '';
|
||||
if (res.premiumData && res.premiumData.length > 0 && res.premiumData[0].policy_grid_id) {
|
||||
policy_grid_id_value = res.premiumData[0].policy_grid_id;
|
||||
}
|
||||
|
||||
$('#grid_content_input').empty();
|
||||
var policeGridOptionHTML = '';
|
||||
policeGridOptionHTML += ` <option value="">Select Premium Type</option>`;
|
||||
$.each(res.data, function(index, item) {
|
||||
policeGridOptionHTML += '<option data-id="'+ item.ui_type +'" value="' + item.id + '" ' + (policy_grid_id_value === item.id ? 'selected="selected"' : '') + '>' + item.policy_grid_type + '</option>';
|
||||
});
|
||||
$('#grid').html(policeGridOptionHTML);
|
||||
|
||||
|
||||
console.log('Length', res.premiumData.length)
|
||||
if (res.premiumData && res.premiumData.length > 0) {
|
||||
|
||||
addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id);
|
||||
|
||||
res.premiumData.shift();
|
||||
console.log(res.premiumData)
|
||||
$.each(res.premiumData, function(index, item){
|
||||
console.log('premiumData index :',index)
|
||||
appendGridtHtml(item.policy_grid_id, item);
|
||||
});
|
||||
|
||||
} else {
|
||||
console.log("res.premiumData is undefined, null, or empty.");
|
||||
}
|
||||
|
||||
$('#bs-example-modal-lg').modal('show');
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var Count = 1
|
||||
function appendGridtHtml(ui_type = false, data = false,) {
|
||||
|
||||
var html = '';
|
||||
console.log('appendGridtHtml function called ');
|
||||
// console.log('Grid Content',data)
|
||||
console.log('UI TYPE :', ui_type);
|
||||
Count++;
|
||||
var container = document.getElementById('grid_content_input');
|
||||
|
||||
if(ui_type == '3'){
|
||||
|
||||
html = `
|
||||
<div class="form-row" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-5">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si[]" id="gpa_si" required>
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="gpa_premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(3)">+</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
}else if(ui_type == '4'){
|
||||
|
||||
|
||||
html =`
|
||||
<div class="form-row" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(4)">+</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
}else if(ui_type == '5'){
|
||||
|
||||
|
||||
html = `
|
||||
<div class="form-row" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(5)">+</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
}else if(ui_type == '6'){
|
||||
|
||||
html =`
|
||||
<div class="form-row" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(6)">+</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
}else if(ui_type == '7'){
|
||||
|
||||
html = `
|
||||
<div class="form-row" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(7)">+</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
}else if(ui_type == '8'){
|
||||
|
||||
html = `
|
||||
<div class="form-row" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Grade/Band<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control" placeholder="Enter Grade/Band " name="grade[]" id="grade" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(8)">+</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
}else if(ui_type == '9'){
|
||||
|
||||
html = `
|
||||
<div class="form-row" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Grade/Band<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control" placeholder="Enter Grade/Band " name="grade[]" id="grade" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(9)">+</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
}else if(ui_type == '10'){
|
||||
|
||||
html = `
|
||||
<div class="form-row" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(10)">+</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
}else if(ui_type == '11'){
|
||||
|
||||
html = `
|
||||
<div class="form-row" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Grade/Band<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control" placeholder="Enter Grade/Band " name="grade[]" id="grade" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="premium[]" id="premium" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">Max SI<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.max_si : ''}" type="text" class="form-control" placeholder="Enter Max SI" name="max_si" id="max_si[]" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(11)">+</button>
|
||||
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
container.insertAdjacentHTML('beforeend', html);
|
||||
$('#gmc_add_more').hide()
|
||||
$('#gmc_remove').show()
|
||||
// console.log('count 1',Count)
|
||||
Count--
|
||||
// console.log('count 2',Count)
|
||||
$('#gmc_add_more_'+Count).hide()
|
||||
Count++
|
||||
// console.log('count 3',Count)
|
||||
|
||||
}
|
||||
|
||||
function removebutton(index, type) {
|
||||
|
||||
if(index == 0){
|
||||
var inputs = document.querySelectorAll('#grid_'+ type +' input');
|
||||
inputs.forEach(function(input) {
|
||||
input.value = '';
|
||||
});
|
||||
}else{
|
||||
|
||||
var element = document.getElementById('removeChild_'+ index);
|
||||
var gridContentDiv = document.getElementById('grid_content_input');
|
||||
var count = gridContentDiv.childElementCount;
|
||||
|
||||
if (element) {
|
||||
element.remove();
|
||||
}
|
||||
|
||||
if(count == 2){
|
||||
$('#gmc_add_more').show();
|
||||
}
|
||||
|
||||
index--;
|
||||
$('#gmc_add_more_'+index).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</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>
|
||||
|
||||
|
||||
@ -61,7 +61,9 @@
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true
|
||||
"sort-packages": true,
|
||||
"process-timeout": 900
|
||||
|
||||
},
|
||||
"scripts": {
|
||||
"test": "phpunit"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "nHANCE",
|
||||
"short_name": "NHANCE",
|
||||
"description": "Description of your PWA",
|
||||
"start_url": "http://localhost/nhance/user/list",
|
||||
"start_url": "http://localhost/nhance/",
|
||||
"display": "standalone",
|
||||
"background_color": "#ffffff",
|
||||
"theme_color": "#ffffff",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user