FEAT_CREATE_POLICY_GRID : RV
This commit is contained in:
parent
47b829183b
commit
ad99c39335
@ -60,9 +60,15 @@ $routes->group("/client", ["filter" => "authMVC"], function($routes){
|
|||||||
$routes->get("list/(:any)", "ClientController::getKycDocsById/$1");
|
$routes->get("list/(:any)", "ClientController::getKycDocsById/$1");
|
||||||
$routes->get("delete/(:any)", "ClientController::deleteClientKycDocs/$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("/util", ["filter" => "authMVC"], function($routes){
|
$routes->group("/util", ["filter" => "authMVC"], function($routes){
|
||||||
$routes->get("clients-with-policies", "EmployeeController::getClientWithPolicies");
|
$routes->get("clients-with-policies", "EmployeeController::getClientWithPolicies");
|
||||||
$routes->get("police-by-insurer/(:any)", "ClientController::getPolicesByInsurerId/$1");
|
$routes->get("police-by-insurer/(:any)", "ClientController::getPolicesByInsurerId/$1");
|
||||||
|
$routes->get("kyc-other-docs-delete/(:any)", "ClientController::deleteClientKycOtherDocs/$1");
|
||||||
|
$routes->get("policy-premium", "ClientController::getpolicyGridData/$1");
|
||||||
});
|
});
|
||||||
|
|||||||
@ -23,6 +23,9 @@ use App\Models\PolicesModel;
|
|||||||
use App\Models\TPABranchModel;
|
use App\Models\TPABranchModel;
|
||||||
use App\Models\TPAModel;
|
use App\Models\TPAModel;
|
||||||
use App\Models\StateModel;
|
use App\Models\StateModel;
|
||||||
|
use App\Models\PolicyGridModel;
|
||||||
|
use App\Models\PolicyPremium1Model;
|
||||||
|
use App\Models\PolicyPremium2Model;
|
||||||
|
|
||||||
|
|
||||||
class ClientController extends AdminController
|
class ClientController extends AdminController
|
||||||
@ -45,6 +48,9 @@ class ClientController extends AdminController
|
|||||||
protected $tpaBranchModel;
|
protected $tpaBranchModel;
|
||||||
protected $tpaModel;
|
protected $tpaModel;
|
||||||
protected $stateModel;
|
protected $stateModel;
|
||||||
|
protected $policyGridModel;
|
||||||
|
protected $policyPremium1Model;
|
||||||
|
protected $policyPremium2Model;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -67,6 +73,9 @@ class ClientController extends AdminController
|
|||||||
$this->tpaBranchModel = new TPABranchModel();
|
$this->tpaBranchModel = new TPABranchModel();
|
||||||
$this->tpaModel = new TPAModel();
|
$this->tpaModel = new TPAModel();
|
||||||
$this->stateModel = new StateModel();
|
$this->stateModel = new StateModel();
|
||||||
|
$this->policyGridModel = new PolicyGridModel();
|
||||||
|
$this->policyPremium1Model = new PolicyPremium1Model();
|
||||||
|
$this->policyPremium2Model = new PolicyPremium2Model();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
@ -97,6 +106,7 @@ class ClientController extends AdminController
|
|||||||
$data['tpa'] = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
|
$data['tpa'] = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
|
||||||
$data['state'] = $this->stateModel->getAllStates();
|
$data['state'] = $this->stateModel->getAllStates();
|
||||||
$data['RM'] = $this->userModel->findAll();
|
$data['RM'] = $this->userModel->findAll();
|
||||||
|
$data['policyGridData'] = $this->policyGridModel->findAll();
|
||||||
|
|
||||||
// echo "<pre>";
|
// echo "<pre>";
|
||||||
// print_r($data); die;
|
// print_r($data); die;
|
||||||
@ -113,23 +123,22 @@ class ClientController extends AdminController
|
|||||||
$this->myLogger->logme('error','Edit Client Onboarding function called');
|
$this->myLogger->logme('error','Edit Client Onboarding function called');
|
||||||
$headerData['page_name'] = 'Edit Client Onboarding';
|
$headerData['page_name'] = 'Edit Client Onboarding';
|
||||||
|
|
||||||
$editData['RM'] = $this->userModel->findAll();
|
$editData['RM'] = $this->userModel->findAll();
|
||||||
$editData['tpa'] = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
|
$editData['tpa'] = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
|
||||||
$editData['state'] = $this->stateModel->getAllStates();
|
$editData['state'] = $this->stateModel->getAllStates();
|
||||||
$editData['police'] = $this->policesModel->findAll();
|
$editData['police'] = $this->policesModel->findAll();
|
||||||
$editData['entity'] = $this->kycEntityTypeModel->findAll();
|
$editData['entity'] = $this->kycEntityTypeModel->findAll();
|
||||||
$editData['insurer'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
|
$editData['insurer'] = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
|
||||||
$editData['kyc_docs'] = $this->kycDocsModel->findAll();
|
$editData['kyc_docs'] = $this->kycDocsModel->findAll();
|
||||||
|
$editData['policyGridData'] = $this->policyGridModel->findAll();
|
||||||
|
|
||||||
|
|
||||||
$editData['client'] = $this->clientModel->where(['id' => $id, 'is_active' => 1])->first();
|
$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_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_relation'] = $this->clientRMModel->where(['client_id' => $id, 'is_active' => 1])->findAll();
|
||||||
$editData['client_policy'] = $this->clientPolicyModel->getClientPolicyByClientId($id);
|
$editData['client_policy'] = $this->clientPolicyModel->getClientPolicyByClientId($id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// echo "<pre>";
|
// echo "<pre>";
|
||||||
// print_r($editData); die;
|
// print_r($editData); die;
|
||||||
|
|
||||||
@ -170,19 +179,20 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
public function createClientKYCInfo()
|
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'));
|
$File = file_Upload($this->request->getFile('file_name'));
|
||||||
if(!empty($File)){
|
if(!empty($File)){
|
||||||
$data['file_name'] = $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();
|
$data['created_by'] = get_session_userid();
|
||||||
$insert = $this->clientKYCDocsModel->insert($data);
|
$insert = $this->clientKYCDocsModel->insert($data);
|
||||||
if($insert){
|
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{
|
}else{
|
||||||
echo json_encode(array("status" => false));
|
echo json_encode(array("status" => false));
|
||||||
}
|
}
|
||||||
@ -210,11 +220,22 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function deleteClientKycDocs($id=null)
|
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();
|
$delete = $this->clientKYCDocsModel->where('id', $id)->delete();
|
||||||
if($delete){
|
if($delete){
|
||||||
echo json_encode(array("status" => true ));
|
echo json_encode(array("status" => true, 'id' => $id ));
|
||||||
}else{
|
}else{
|
||||||
echo json_encode(array("status" => false));
|
echo json_encode(array("status" => false));
|
||||||
}
|
}
|
||||||
@ -382,26 +403,46 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$this->myLogger->logme('error','Client policy CREATE function called');
|
$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);
|
list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
|
||||||
|
|
||||||
$data['insurer_branch_id'] = $insurerBranchId;
|
$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);
|
list($tpaBranchId, $tpaId) = explode('-', $tpaValue);
|
||||||
|
|
||||||
$data['tpa_branch_id'] = $tpaBranchId;
|
$data['tpa_branch_id'] = $tpaBranchId;
|
||||||
$data['tpa_id'] = $tpaId;
|
$data['tpa_id'] = $tpaId;
|
||||||
$data['policy_id'] = $this->request->getPost('policy_id');
|
$data['policy_id'] = $this->request->getPost('policy_id');
|
||||||
$data['client_id'] = $this->request->getPost('client_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);
|
$insert = $this->clientPolicyModel->insert($data);
|
||||||
if($insert){
|
if($insert){
|
||||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($this->request->getPost('client_id'));
|
$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{
|
}else{
|
||||||
echo json_encode(array("status" => false));
|
echo json_encode(array("status" => false));
|
||||||
}
|
}
|
||||||
@ -412,34 +453,137 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$this->myLogger->logme('error','Client policy function called');
|
$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');
|
$client_id = $this->request->getPost('client_id');
|
||||||
|
|
||||||
$insurerValue = (string) $this->request->getPost('insurer');
|
$insurerValue = (string) $this->request->getPost('insurer');
|
||||||
list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
|
list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
|
||||||
|
|
||||||
$data['insurer_branch_id'] = $insurerBranchId;
|
$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);
|
list($tpaBranchId, $tpaId) = explode('-', $tpaValue);
|
||||||
|
|
||||||
$data['tpa_branch_id'] = $tpaBranchId;
|
$data['tpa_branch_id'] = $tpaBranchId;
|
||||||
$data['tpa_id'] = $tpaId;
|
$data['tpa_id'] = $tpaId;
|
||||||
$data['policy_id'] = $this->request->getPost('policy_id');
|
$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();
|
$data['updated_by'] = get_session_userid();
|
||||||
$insert = $this->clientPolicyModel->update($id,$data);
|
$insert = $this->clientPolicyModel->update($id,$data);
|
||||||
$lastQuery = $this->clientPolicyModel->getLastQuery();
|
$lastQuery = $this->clientPolicyModel->getLastQuery();
|
||||||
|
|
||||||
|
// echo '<pre>';
|
||||||
|
// print_r($lastQuery); die;
|
||||||
|
|
||||||
if($insert){
|
if($insert){
|
||||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($client_id);
|
$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{
|
}else{
|
||||||
echo json_encode(array("status" => false));
|
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)
|
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));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -13,6 +13,7 @@ class ClientKYCDocsModel extends Model
|
|||||||
'client_id',
|
'client_id',
|
||||||
'kyc_doc_type_id',
|
'kyc_doc_type_id',
|
||||||
'file_name',
|
'file_name',
|
||||||
|
'other_docs_name',
|
||||||
'is_active',
|
'is_active',
|
||||||
"created_by",
|
"created_by",
|
||||||
"updated_by",
|
"updated_by",
|
||||||
|
|||||||
@ -16,6 +16,23 @@ class ClientPolicyModel extends Model
|
|||||||
"insurer_branch_id",
|
"insurer_branch_id",
|
||||||
"tpa_id",
|
"tpa_id",
|
||||||
"tpa_branch_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",
|
"created_by",
|
||||||
"updated_by",
|
"updated_by",
|
||||||
"Is_active",
|
"Is_active",
|
||||||
@ -59,4 +76,24 @@ class ClientPolicyModel extends Model
|
|||||||
->getResult();
|
->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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,4 +16,14 @@ class PolicesModel extends Model
|
|||||||
"updated_by",
|
"updated_by",
|
||||||
"is_active",
|
"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',
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
@ -108,7 +108,7 @@ body {
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="emp_code">Employee Code<span class="text-danger">*</span></label>
|
<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>
|
||||||
<div class="form-group col-md-8">
|
<div class="form-group col-md-8">
|
||||||
<label for="first_name">Name<span class="text-danger">*</span></label>
|
<label for="first_name">Name<span class="text-danger">*</span></label>
|
||||||
@ -120,7 +120,7 @@ body {
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label for="email">Email<span class="text-danger">*</span></label>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ body {
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label for="mobile">Mobile Number<span class="text-danger">*</span></label>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ body {
|
|||||||
|
|
||||||
<div class="form-group text-right m-b-0">
|
<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="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>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -196,7 +196,6 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#team').multiselect({
|
$('#team').multiselect({
|
||||||
nonSelectedText: 'Select Team',
|
nonSelectedText: 'Select Team',
|
||||||
enableFiltering: false,
|
enableFiltering: false,
|
||||||
@ -205,6 +204,7 @@ $(document).ready(function () {
|
|||||||
buttonWidth:'100%'
|
buttonWidth:'100%'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#btnAdd').click(function(){
|
$('#btnAdd').click(function(){
|
||||||
$('#first_name').val('');
|
$('#first_name').val('');
|
||||||
$('#last_name').val('');
|
$('#last_name').val('');
|
||||||
@ -224,6 +224,7 @@ $(document).ready(function () {
|
|||||||
$('#role').val('')
|
$('#role').val('')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$('body').on('click', '.btnEdit', function () {
|
$('body').on('click', '.btnEdit', function () {
|
||||||
var user_id = $(this).attr('data-id');
|
var user_id = $(this).attr('data-id');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -232,6 +233,7 @@ $(document).ready(function () {
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
|
$('#updateModal').modal('show');
|
||||||
$('#role').val('')
|
$('#role').val('')
|
||||||
$('#UserForm').attr('action', '<?php echo base_url('user/edit');?>');
|
$('#UserForm').attr('action', '<?php echo base_url('user/edit');?>');
|
||||||
$('#UserId').val(res.data.id);
|
$('#UserId').val(res.data.id);
|
||||||
@ -256,6 +258,7 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('body').on('click', '.btnDelete', function () {
|
$('body').on('click', '.btnDelete', function () {
|
||||||
|
|
||||||
Swal.fire({
|
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 {
|
function onlyNumbers(event){
|
||||||
constructor(table, header = true) {
|
var charcode;
|
||||||
this.table = table;
|
charcode = event.which || event.keyCode;
|
||||||
this.rows = Array.from(table.querySelectorAll("tr"));
|
if(charcode>= 48 && charcode <= 57)return true;
|
||||||
if (!header && this.rows[0].querySelectorAll("th").length) {
|
return false;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -44,12 +44,12 @@
|
|||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="pan">PAN<span class="text-danger">*</span></label>
|
<label for="pan">PAN<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="pan"
|
<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>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="gst">GST<span class="text-danger">*</span></label>
|
<label for="gst">GST<span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="gst"
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -99,7 +99,7 @@
|
|||||||
<label for="pincode">Pincode<span
|
<label for="pincode">Pincode<span
|
||||||
class="text-danger">*</span></label>
|
class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="pincode"
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -119,107 +119,100 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
var PrimaryKey = $('#general_PrimaryKey').val();
|
||||||
|
var form_action = '';
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
$("#general_form").submit(function(event) {
|
$("#general_form").submit(function(event) {
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var isValid = validateForm();
|
var isValid = $('#general_form').parsley().validate();
|
||||||
var PrimaryKey = $('#general_PrimaryKey').val();
|
if (!isValid) {
|
||||||
var form_action = '';
|
console.log('Form is Empty', 'Warning');
|
||||||
|
return ;
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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>
|
</script>
|
||||||
@ -1,9 +1,7 @@
|
|||||||
<div class="tab-pane fade" id="branch-tab">
|
<div class="tab-pane fade" id="branch-tab">
|
||||||
|
|
||||||
<div class="row float-right" style="padding-bottom: 10px;">
|
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
|
||||||
<div class="col-6">
|
<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>
|
||||||
<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>
|
</div>
|
||||||
|
|
||||||
<div class="table-responsive" id="branch_table" >
|
<div class="table-responsive" id="branch_table" >
|
||||||
@ -24,10 +22,8 @@
|
|||||||
<div class="row" id="add_branch">
|
<div class="row" id="add_branch">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row float-right" style="position: relative; bottom: 20px;">
|
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||||
<div class="col-6">
|
<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>
|
||||||
<button type="button" class="btn btn-primary waves-effect waves-light btnBack"><i class="fa fa-list" aria-hidden="true"></i></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
@ -40,10 +36,8 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="branch_name">Branch Name<span
|
<label for="branch_name">Branch Name<span class="text-danger">*</span></label>
|
||||||
class="text-danger">*</span></label>
|
<input type="text" class="form-control" id="branch_name" placeholder="Enter Branch Name" name="branch_name" required>
|
||||||
<input type="text" class="form-control" id="branch_name"
|
|
||||||
placeholder="Enter Branch Name" name="branch_name" required>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="branch_code">Branch Code<span
|
<label for="branch_code">Branch Code<span
|
||||||
@ -83,91 +77,30 @@
|
|||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="first_name">Name<span
|
<label for="first_name">Name<span class="text-danger">*</span></label>
|
||||||
class="text-danger">*</span></label>
|
<input value="" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="name" required>
|
||||||
<input type="text" class="form-control" id="name0"
|
|
||||||
placeholder="Enter Contact Name" name="name[]" >
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="last_name">Email<span
|
<label for="last_name">Email<span class="text-danger">*</span></label>
|
||||||
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>
|
||||||
<input type="text" class="form-control" id="email0"
|
|
||||||
placeholder="Enter Contact Email" name="email[]" >
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="mobile">Mobile<span
|
<label for="mobile">Mobile<span class="text-danger">*</span></label>
|
||||||
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>
|
||||||
<input type="text" class="form-control" id="mobile0"
|
|
||||||
placeholder="Enter Contact Mobile" name="mobile[]" >
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="designation">Designation<span
|
<label for="designation">Designation<span class="text-danger">*</span></label>
|
||||||
class="text-danger">*</span></label>
|
<input value="" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="designation" required>
|
||||||
<input type="text" class="form-control" id="designation0"
|
|
||||||
placeholder="Enter Designation Name" name="designation[]" >
|
|
||||||
</div>
|
</div>
|
||||||
</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>
|
<div id="container"></div>
|
||||||
<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>
|
</div>
|
||||||
<div class="form-group text-right m-b-0">
|
<div class="form-group text-right m-b-0">
|
||||||
@ -185,16 +118,33 @@
|
|||||||
|
|
||||||
<script>
|
<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 () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
var branch_PrimaryKey = $('#client_id_branch').val();
|
|
||||||
var branch_form_action = '';
|
|
||||||
|
|
||||||
$('#add_branch').hide();
|
$('#add_branch').hide();
|
||||||
$('.btnBack').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(){
|
$('#btnBranchAdd').click(function(){
|
||||||
|
|
||||||
@ -210,21 +160,27 @@ $(document).ready(function () {
|
|||||||
$('#state').val('');
|
$('#state').val('');
|
||||||
$('#district').val('');
|
$('#district').val('');
|
||||||
$('#branch_city').val('');
|
$('#branch_city').val('');
|
||||||
|
$('#branch_form')[0].reset();
|
||||||
$('#name0').val('');
|
$('.ac').css('display', 'block');
|
||||||
$('#email0').val('');
|
contactCount = 1
|
||||||
$('#mobile0').val('');
|
|
||||||
$('#designation0').val('');
|
|
||||||
|
|
||||||
$('#name1').val('');
|
|
||||||
$('#email1').val('');
|
|
||||||
$('#mobile1').val('');
|
|
||||||
$('#designation1').val('');
|
|
||||||
|
|
||||||
$('#name2').val('');
|
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||||
$('#email2').val('');
|
for (var i = 0; i < buttonIds.length; i++) {
|
||||||
$('#mobile2').val('');
|
var firstElement = buttonIds[i].split('_')[0];
|
||||||
$('#designation2').val('');
|
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(){
|
$('.btnBack').click(function(){
|
||||||
@ -239,47 +195,39 @@ $(document).ready(function () {
|
|||||||
$('#state').val('');
|
$('#state').val('');
|
||||||
$('#district').val('');
|
$('#district').val('');
|
||||||
$('#branch_city').val('');
|
$('#branch_city').val('');
|
||||||
|
$('#branch_form')[0].reset();
|
||||||
$('#name0').val('');
|
$('.ac').css('display', 'block');
|
||||||
$('#email0').val('');
|
|
||||||
$('#mobile0').val('');
|
|
||||||
$('#designation0').val('');
|
|
||||||
|
|
||||||
$('#name1').val('');
|
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||||
$('#email1').val('');
|
for (var i = 0; i < buttonIds.length; i++) {
|
||||||
$('#mobile1').val('');
|
var firstElement = buttonIds[i].split('_')[0];
|
||||||
$('#designation1').val('');
|
console.log(firstElement);
|
||||||
|
|
||||||
$('#name2').val('');
|
// Find the element by its ID
|
||||||
$('#email2').val('');
|
var elementToRemove = document.getElementById(firstElement);
|
||||||
$('#mobile2').val('');
|
console.log(elementToRemove);
|
||||||
$('#designation2').val('');
|
|
||||||
|
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) {
|
$("#branch_form").submit(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
branch_PrimaryKey = $('#client_id_branch').val();
|
||||||
|
branch_PrimaryKey_2 = $('#branch_PrimaryKey').val();
|
||||||
|
|
||||||
// Perform validation
|
if (branch_PrimaryKey === '' || branch_PrimaryKey_2 === '') {
|
||||||
var isValid = true; // Assuming you have a function for form validation
|
toastr.error('Client is required', 'Error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var isValid = $('#branch_form').parsley().validate();
|
||||||
|
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
|
|
||||||
@ -294,6 +242,8 @@ $(document).ready(function () {
|
|||||||
contentType: false,
|
contentType: false,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log(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();
|
$('#branch_list tr').remove();
|
||||||
var branchTableInsert = ''
|
var branchTableInsert = ''
|
||||||
$.each(res.data, function(index, item) {
|
$.each(res.data, function(index, item) {
|
||||||
@ -301,7 +251,7 @@ $(document).ready(function () {
|
|||||||
<tr>
|
<tr>
|
||||||
<td>${item.branch_name}</td>
|
<td>${item.branch_name}</td>
|
||||||
<td>${item.branch_code}</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>
|
</tr>
|
||||||
`;
|
`;
|
||||||
});
|
});
|
||||||
@ -319,7 +269,11 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('body').on('click', '.btnBranchEdit', function () {
|
$('body').on('click', '.btnBranchEdit', function () {
|
||||||
|
|
||||||
|
console.log(branch_form_action);
|
||||||
|
|
||||||
var branch_id = $(this).attr('data-id');
|
var branch_id = $(this).attr('data-id');
|
||||||
branch_form_action = '<?= base_url("client/branch/edit"); ?>';
|
branch_form_action = '<?= base_url("client/branch/edit"); ?>';
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -339,13 +293,16 @@ $(document).ready(function () {
|
|||||||
$('#district').val(res.data.district);
|
$('#district').val(res.data.district);
|
||||||
$('#branch_city').val(res.data.city);
|
$('#branch_city').val(res.data.city);
|
||||||
$('#branch_PrimaryKey').val(res.data.id);
|
$('#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) {
|
$.each(res.contact, function(index, contact) {
|
||||||
if (contact !== undefined) {
|
if (contact !== undefined) {
|
||||||
$('#name' + index).val(contact.name !== undefined ? contact.name : '');
|
appendContactHtml(contact);
|
||||||
$('#email' + index).val(contact.email !== undefined ? contact.email : '');
|
|
||||||
$('#mobile' + index).val(contact.mobile !== undefined ? contact.mobile : '');
|
|
||||||
$('#designation' + index).val(contact.designation !== undefined ? contact.designation : '');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -355,9 +312,141 @@ $(document).ready(function () {
|
|||||||
console.error(status, error);
|
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>
|
</script>
|
||||||
@ -1,27 +1,57 @@
|
|||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
<div class="tab-pane fade" id="KYC-DOC-tab">
|
<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="col-12">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form role="form" class="parsley-examples" method="post" id="kyc_form"
|
<form role="form" class="parsley-examples" method="post" id="kyc_form"
|
||||||
enctype="multipart/form-data">
|
enctype="multipart/form-data">
|
||||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
<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="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="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="kyc_doc_type_id" value="0" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="emp_code">Document Type</label>
|
<label for="emp_code">Other Documents<span
|
||||||
<select class="form-control" id="kyc_docs" name="kyc_doc_id" required>
|
class="text-danger">*</span></label>
|
||||||
<option value="">Select Kyc Docs</option>
|
<input type="text" class="form-control" id="other_docs_name" placeholder="Document Name" name="other_docs_name" required>
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="kyc_docs">File</label>
|
<label for="kyc_docs">File<span
|
||||||
<input class="form-control" type="file" name="file_name"
|
class="text-danger">*</span></label>
|
||||||
multiple="true" id="kyc_docs_file" required>
|
<input class="form-control" type="file" name="file_name" multiple="true" id="kyc_docs_file" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4 align-self-end">
|
<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>
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"id="btnSubmit">Upload</button>
|
||||||
@ -33,8 +63,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div> <!-- end col-->
|
</div> <!-- end col-->
|
||||||
</div>
|
</div>
|
||||||
|
<!-- end row -->
|
||||||
|
|
||||||
<div class="col-lg-8">
|
|
||||||
|
<div class="col-lg-12" id="other_docs_table">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
@ -46,7 +78,7 @@
|
|||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="tbody">
|
<tbody id="other_docs">
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div> <!-- end table-responsive-->
|
</div> <!-- end table-responsive-->
|
||||||
@ -54,37 +86,116 @@
|
|||||||
</div>
|
</div>
|
||||||
</div> <!-- end card -->
|
</div> <!-- end card -->
|
||||||
</div> <!-- end col -->
|
</div> <!-- end col -->
|
||||||
<!-- end row -->
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- end -->
|
<!-- end -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
var kycPrimaryKey = $('#kyc_PrimaryKey').val();
|
var kycPrimaryKey = $('#kyc_PrimaryKey').val();
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
kycPrimaryKey = $('#kyc_PrimaryKey').val();
|
||||||
// $('#kyc_docs').change(function(){
|
$('#others').hide()
|
||||||
// var selectedValue = $(this).val()
|
$('#other_docs_table').hide();
|
||||||
// console.log(selectedValue);
|
|
||||||
// })
|
$(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 === '') {
|
||||||
if(kycPrimaryKey !== ''){
|
toastr.error('Client is required', 'Error');
|
||||||
var OptionsHTML3 =""
|
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({
|
$.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",
|
type: "GET",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
processData: false,
|
processData: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
success: function(res) {
|
success: function (res) {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
$.each(res.data, function(index, item) {
|
var tbody = $('#tbody');
|
||||||
OptionsHTML3 += '<option value="' + item.id + '">' + item.file_name + '</option>';
|
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) {
|
error: function (xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
@ -92,30 +203,52 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var table = '';
|
var table = '';
|
||||||
var data = <?= isset($client_kyc) ? json_encode($client_kyc) : '[]' ?>;
|
var data = <?= isset($client_kyc) ? json_encode($client_kyc) : '[]' ?>;
|
||||||
$('#tbody tr').remove();
|
console.log(data)
|
||||||
|
$('#other_docs tr').remove();
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
table += `
|
if(item.kyc_doc_type_id == '0'){
|
||||||
|
table += `
|
||||||
<tr id="kyc-${item.id}">
|
<tr id="kyc-${item.id}">
|
||||||
<td>${item.client_file_name}</td>
|
<td>${item.other_docs_name}</td>
|
||||||
<td>${item.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>
|
<td><i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i></td>
|
||||||
</tr>
|
</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) {
|
$("#kyc_form").submit(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
// Perform validation
|
var isValid = $('#kyc_form').parsley().validate();
|
||||||
var isValid = validateForm(); // Assuming you have a function for form validation
|
|
||||||
var rowHtml = '';
|
var rowHtml = '';
|
||||||
var form_action = '';
|
var form_action = '';
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
@ -129,42 +262,33 @@
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: formData,
|
data: formData,
|
||||||
url: form_action,
|
url: '<?= base_url("client/kyc/create"); ?>',
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
processData: false,
|
processData: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
console.log(res);
|
console.log(res);
|
||||||
if(kycPrimaryKey === ''){
|
$('#kyc_form').trigger('reset')
|
||||||
$.toast({
|
var message = (kycPrimaryKey === '') ? 'KYC Docs Uploaded successfully' : 'KYC Docs Uploaded successfully';
|
||||||
text: 'Client Relation Info',
|
toastr.success(message, 'Success');
|
||||||
heading: "Submitted Sucessfully",
|
|
||||||
position: 'top-right',
|
$('#other_docs tr').remove();
|
||||||
icon: 'success',
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
$.toast({
|
|
||||||
text: 'Client Relation Info',
|
|
||||||
heading: "Updated Sucessfully",
|
|
||||||
position: 'top-right',
|
|
||||||
icon: 'success',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
$('#tbody tr').remove();
|
|
||||||
$.each(res.data, function(index, item) {
|
$.each(res.data, function(index, item) {
|
||||||
rowHtml += `
|
console.log("Current item:", item);
|
||||||
<tr id="kyc-${item.id}">
|
if (item.kyc_doc_type_id == '0') {
|
||||||
<td>${item.client_file_name}</td>
|
console.log("Appending item:", item);
|
||||||
<td>${item.file_name}</td>
|
var rowHtml = `
|
||||||
<td><i data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px;"></i></td>
|
<tr id="kyc-${item.id}">
|
||||||
</tr>
|
<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) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
@ -175,6 +299,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('body').on('click', '.btnKycDelete', function () {
|
$('body').on('click', '.btnKycDelete', function () {
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
@ -190,6 +315,33 @@
|
|||||||
|
|
||||||
var kyc_id = $(this).attr('data-id');
|
var kyc_id = $(this).attr('data-id');
|
||||||
$.get('<?php echo base_url('client/kyc/delete/');?>'+kyc_id, function (data) {
|
$.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)
|
console.log('kyc-'+ kyc_id)
|
||||||
if(data){
|
if(data){
|
||||||
$('#kyc-'+ kyc_id).remove();
|
$('#kyc-'+ kyc_id).remove();
|
||||||
@ -201,31 +353,29 @@
|
|||||||
|
|
||||||
|
|
||||||
function validateForm() {
|
function validateForm() {
|
||||||
var isValid = true;
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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>
|
</script>
|
||||||
@ -65,10 +65,11 @@
|
|||||||
extend: 'csv',
|
extend: 'csv',
|
||||||
text: 'CSV',
|
text: 'CSV',
|
||||||
title: 'ClientList',
|
title: 'ClientList',
|
||||||
|
className: 'my_class',
|
||||||
exportOptions: {
|
exportOptions: {
|
||||||
columns: ':not(:last-child)'
|
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>
|
</script>
|
||||||
@ -45,7 +45,7 @@ body {
|
|||||||
<ul class="nav nav-pills navtab-bg">
|
<ul class="nav nav-pills navtab-bg">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="#general-q-tab" data-toggle="tab" aria-expanded="false"
|
<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="mr-1"><i class="mdi mdi-contacts"></i></span>
|
||||||
<span class="d-none d-sm-inline-block">General</span>
|
<span class="d-none d-sm-inline-block">General</span>
|
||||||
</a>
|
</a>
|
||||||
@ -57,19 +57,19 @@ body {
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<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="mr-1"><i class="mdi mdi-account-switch"></i></span>
|
||||||
<span class="d-none d-sm-inline-block"> Relationship Manager</span>
|
<span class="d-none d-sm-inline-block"> Relationship Manager</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<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="mr-1"><i class="mdi mdi-source-branch"></i></span>
|
||||||
<span class="d-none d-sm-inline-block">Branch & Contacts</span>
|
<span class="d-none d-sm-inline-block">Branch & Contacts</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<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="mr-1"><i class="mdi mdi-book-open-page-variant"></i></span>
|
||||||
<span class="d-none d-sm-inline-block">Policies</span>
|
<span class="d-none d-sm-inline-block">Policies</span>
|
||||||
</a>
|
</a>
|
||||||
@ -88,3 +88,33 @@ body {
|
|||||||
</div>
|
</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="tab-pane fade" id="police-tab">
|
||||||
|
|
||||||
|
|
||||||
<div class="row float-right" style="padding-bottom: 10px;">
|
<div class="row float-right" style="padding-bottom: 10px; position: relative;right: 13px;">
|
||||||
<div class="col-6">
|
<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>
|
||||||
<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>
|
</div>
|
||||||
|
|
||||||
<div class="table-responsive" id="table_list" >
|
<div class="table-responsive" id="table_list" >
|
||||||
@ -28,10 +27,8 @@
|
|||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<div class="row float-right" style="position: relative; bottom: 20px;">
|
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||||
<div class="col-6">
|
<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>
|
||||||
<button type="button" class="btn btn-primary waves-effect waves-light btnBack"><i class="fa fa-list" aria-hidden="true"></i></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
@ -41,13 +38,15 @@
|
|||||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||||
<input type="hidden" name="PrimaryKey" id="policy_PrimaryKey" />
|
<input type="hidden" name="PrimaryKey" id="policy_PrimaryKey" />
|
||||||
<input type="hidden" id="policy_form_action" />
|
<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-group">
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="email">Insurer<span
|
<label for="email">Insurer<span
|
||||||
class="text-danger">*</span></label>
|
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>
|
<option value="">Select Insurer</option>
|
||||||
<?php foreach($insurer as $value) { ?>
|
<?php foreach($insurer as $value) { ?>
|
||||||
<option value="<?= $value['id'] . '-' . $value['insurer_id']?>"><?= $value['insurer_name'] . '-' . $value['branch_code'] ?></option>
|
<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">
|
<div class="form-group col-md-4">
|
||||||
<label for="policy">Policies<span
|
<label for="policy">Policies<span
|
||||||
class="text-danger">*</span></label>
|
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>
|
<option value="" selected>Select Policy</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="mobile">TPA<span
|
<label for="mobile">TPA<span
|
||||||
class="text-danger">*</span></label>
|
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>
|
<option value="">Select TPA</option>
|
||||||
<?php foreach($tpa as $value) { ?>
|
<?php foreach($tpa as $value) { ?>
|
||||||
<option value="<?= $value['id']. '-' . $value['tpa_id'] ?>"><?= $value['tpa_short_name'] . '-' . $value['branch_code'] ?></option>
|
<option value="<?= $value['id']. '-' . $value['tpa_id'] ?>"><?= $value['tpa_short_name'] . '-' . $value['branch_code'] ?></option>
|
||||||
@ -72,6 +71,22 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
||||||
<div class="form-group text-right m-b-0">
|
<div class="form-group text-right m-b-0">
|
||||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||||
@ -89,44 +104,59 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||||
|
var policy_client = $('#policy_PrimaryKey').val();
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
var policy_PrimaryKey = $('#client_id_police').val();
|
//Configure Flatpicker for the policy start date datepicker.
|
||||||
var policy_client = $('#policy_PrimaryKey').val();
|
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();
|
$('#add_form').hide();
|
||||||
$('.btnBack').hide();
|
$('.btnBack').hide();
|
||||||
|
|
||||||
|
|
||||||
$('.btnAdd').click(function(){
|
$('.btnAdd').click(function(){
|
||||||
$('#add_form').show();
|
$('#add_form').show();
|
||||||
$('#table_list').hide();
|
$('#table_list').hide();
|
||||||
$('.btnBack').show();
|
$('.btnBack').show();
|
||||||
$('.btnAdd').hide();
|
$('.btnAdd').hide();
|
||||||
$('#policy_form_action').val('<?= base_url("client/policy/edit"); ?>');
|
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
||||||
;
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$('.btnBack').click(function(){
|
$('.btnBack').click(function(){
|
||||||
|
|
||||||
|
$('#GMC').remove();
|
||||||
|
$('#GPA').remove();
|
||||||
$('#add_form').hide();
|
$('#add_form').hide();
|
||||||
$('#table_list').show();
|
$('#table_list').show();
|
||||||
$('.btnBack').hide();
|
$('.btnBack').hide();
|
||||||
$('.btnAdd').show();
|
$('.btnAdd').show();
|
||||||
$('#insurer').val('');
|
$('#insurer').val('');
|
||||||
$('#tpa').val('');
|
$('#tpa').val('');
|
||||||
|
$('#start_date').val('');
|
||||||
|
$('#end_date').val('');
|
||||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
toastr.options = {
|
|
||||||
"timeOut": 2000,
|
|
||||||
"closeButton": true,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (policy_PrimaryKey !== '') {
|
if (policy_PrimaryKey !== '') {
|
||||||
var policyTable = '';
|
var policyTable = '';
|
||||||
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
data.forEach(function(item) {
|
data.forEach(function(item) {
|
||||||
policyTable += `
|
policyTable += `
|
||||||
@ -134,7 +164,10 @@ $(document).ready(function () {
|
|||||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||||
<td>${item.policy_name}</td>
|
<td>${item.policy_name}</td>
|
||||||
<td>${item.tpa_short} - ${item.tpa_branch_code}</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>
|
</tr>
|
||||||
`;
|
`;
|
||||||
});
|
});
|
||||||
@ -142,75 +175,93 @@ $(document).ready(function () {
|
|||||||
$('#policy_table').append(policyTable);
|
$('#policy_table').append(policyTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//for form submit using AJAX
|
||||||
$("#policy_form").submit(function(event) {
|
$("#policy_form").submit(function(event) {
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
if (policy_PrimaryKey === '' && policy_client === '') {
|
policy_PrimaryKey = $('#client_id_policy').val();
|
||||||
toastr.error('Client ID is required', 'Error');
|
policy_client = $('#policy_PrimaryKey').val();
|
||||||
$('#insurer').val('');
|
|
||||||
$('#tpa').val('');
|
if (policy_PrimaryKey === '' && policy_client === '') {
|
||||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
toastr.error('Client is required', 'Error');
|
||||||
return;
|
$('#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]);
|
console.log(res);
|
||||||
var policy_form_action = $('#policy_form_action').val();
|
var message = (policy_PrimaryKey === '') ? 'Policy Created successfully' : 'Policy Updated Successfully';
|
||||||
|
toastr.success(message, 'Success');
|
||||||
|
|
||||||
$.ajax({
|
$('#policy_table tr').remove();
|
||||||
data: formData,
|
var policyTable = '';
|
||||||
url: policy_form_action,
|
$.each(res.data, function(index, item) {
|
||||||
type: "POST",
|
policyTable += `
|
||||||
dataType: 'json',
|
<tr>
|
||||||
processData: false,
|
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||||
contentType: false,
|
<td>${item.policy_name}</td>
|
||||||
success: function(res) {
|
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
||||||
|
<td>
|
||||||
if (res.status === false) {
|
<a data-id="${item.id}" class="btnPolicyEdit mdi mdi-lead-pencil" href="#" style="font-size:18px;"></a>
|
||||||
toastr.error('Policy Dose Not Create', 'Error');
|
<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>
|
||||||
return;
|
</td>
|
||||||
}
|
</tr>
|
||||||
|
`;
|
||||||
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').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() {
|
$('#insurer').change(function() {
|
||||||
var id = $(this).val();
|
var id = $(this).val();
|
||||||
var url = "<?= base_url("util/police-by-insurer/") ?>" + id;
|
var url = "<?= base_url("util/police-by-insurer/") ?>" + id;
|
||||||
|
|
||||||
$.get(url, function(res) {
|
$.get(url, function(res) {
|
||||||
res = JSON.parse(res)
|
res = JSON.parse(res)
|
||||||
|
console.log(res)
|
||||||
var OptionsHTML = '';
|
var OptionsHTML = '';
|
||||||
|
OptionsHTML += '<option value="" selected>Select Policy</option>';
|
||||||
$.each(res.data, function(index, item) {
|
$.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);
|
$('#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 () {
|
$('body').on('click', '.btnPolicyEdit', function () {
|
||||||
|
|
||||||
var policy_form_action = '';
|
var policy_form_action = '';
|
||||||
var policy_id = $(this).data('id');
|
var policy_id = $(this).data('id');
|
||||||
|
console.log('1', policy_id)
|
||||||
|
var policyId = $(this).attr('data-id');
|
||||||
|
console.log('2', policyId)
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?= base_url("client/policy/list/") ?>' + policy_id,
|
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);
|
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id);
|
||||||
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id);
|
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id);
|
||||||
$('#policy').val(res.data.policy_id);
|
$('#policy').val(res.data.policy_id);
|
||||||
|
$('#policy_type_id').val(res.data.policy_type_id);
|
||||||
$('#policy_PrimaryKey').val(res.data.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 = '';
|
var policeOptionHTML = '';
|
||||||
$.each(res.policy, function(index, item) {
|
$.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);
|
$('#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>
|
</script>
|
||||||
@ -2,6 +2,13 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card-body">
|
<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">
|
<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" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||||
<input type="hidden" name="PrimaryKey" id="relation_PrimaryKey" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
<input type="hidden" name="PrimaryKey" id="relation_PrimaryKey" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||||
@ -44,10 +51,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group text-right m-b-0">
|
<div class="form-group text-right m-b-0">
|
||||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="client_rm_btnSubmit">Submit</button>
|
||||||
id="btnSubmit">Submit</button>
|
|
||||||
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
|
||||||
id="btnBack">Cancel</button>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -58,42 +62,57 @@
|
|||||||
<!-- end -->
|
<!-- end -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
|
||||||
|
|
||||||
var relation_PrimaryKey = $('#relation_PrimaryKey').val()
|
|
||||||
|
|
||||||
$('#account_manager').multiselect({
|
var relation_PrimaryKey = $('#relation_PrimaryKey').val();
|
||||||
nonSelectedText: 'Select Account Manager',
|
|
||||||
enableFiltering: false,
|
$(document).ready(function(){
|
||||||
enableCaseInsensitiveFiltering: false,
|
|
||||||
includeSelectAllOption : false,
|
relation_PrimaryKey = $('#relation_PrimaryKey').val()
|
||||||
buttonWidth:'100%'
|
|
||||||
|
$('#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();
|
event.preventDefault();
|
||||||
|
relation_PrimaryKey = $('#relation_PrimaryKey').val()
|
||||||
|
|
||||||
// Perform validation
|
var isValid = true;
|
||||||
var isValid = validateForm(); // Assuming you have a function for form validation
|
|
||||||
var form_action = '';
|
var form_action = '';
|
||||||
|
|
||||||
|
if (relation_PrimaryKey === '') {
|
||||||
|
toastr.error('Client is required', 'Error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
|
|
||||||
if(relation_PrimaryKey === ''){
|
if(relation_PrimaryKey === ''){
|
||||||
@ -113,22 +132,9 @@
|
|||||||
contentType: false,
|
contentType: false,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
if(relation_PrimaryKey === ''){
|
var message = (relation_PrimaryKey === '') ? 'Client Relation Created successfully' : 'Client Relation Updated successfully';
|
||||||
$.toast({
|
toastr.success(message, 'Success');
|
||||||
text: 'Client Relation Info',
|
$('#branch_tab').click();
|
||||||
heading: "Submitted Sucessfully",
|
|
||||||
position: 'top-right',
|
|
||||||
icon: 'success',
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
$.toast({
|
|
||||||
text: 'Client Relation Info',
|
|
||||||
heading: "Updated Sucessfully",
|
|
||||||
position: 'top-right',
|
|
||||||
icon: 'success',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
@ -139,25 +145,24 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function validateForm() {
|
$('#client_rm_edit').click(function(){
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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>
|
</script>
|
||||||
@ -481,5 +481,23 @@
|
|||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/toastr@2.1.4/toastr.min.js"></script>
|
<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">
|
<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>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@ -76,10 +76,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Preloader
|
|
||||||
-------------------------------------------------------*/
|
|
||||||
|
|
||||||
.loader-mask {
|
.loader-mask {
|
||||||
position: fixed;
|
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>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(window).on('load', function() {
|
$(window).on('load', function() {
|
||||||
// Preloader
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}, 1000); // 5000 milliseconds = 5 seconds
|
}, 1000);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -428,9 +436,9 @@
|
|||||||
<span class="logo-sm">
|
<span class="logo-sm">
|
||||||
<img src="<?= base_url()."public"; ?>/assets/images/n.png" alt="" height="24">
|
<img src="<?= base_url()."public"; ?>/assets/images/n.png" alt="" height="24">
|
||||||
</span>
|
</span>
|
||||||
<span class="logo-lg">
|
<!-- <span class="logo-lg">
|
||||||
<img src="<?= base_url()."public"; ?>/assets/images/logo-light.png" alt="" height="20">
|
<img src="<?= base_url()."public"; ?>/assets/images/logo-light.png" alt="" height="20">
|
||||||
</span>
|
</span> -->
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -480,9 +488,9 @@
|
|||||||
<span class="logo-sm">
|
<span class="logo-sm">
|
||||||
<img src="<?= base_url()."public"; ?>/assets/images/n.png" alt="" height="24">
|
<img src="<?= base_url()."public"; ?>/assets/images/n.png" alt="" height="24">
|
||||||
</span>
|
</span>
|
||||||
<span class="logo-lg">
|
<!-- <span class="logo-lg">
|
||||||
<img src="<?= base_url()."public"; ?>./assets/images/logo-light.png" alt="" height="20">
|
<img src="<?= base_url()."public"; ?>./assets/images/logo-light.png" alt="" height="20">
|
||||||
</span>
|
</span> -->
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
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>
|
||||||
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "nHANCE",
|
"name": "nHANCE",
|
||||||
"short_name": "NHANCE",
|
"short_name": "NHANCE",
|
||||||
"description": "Description of your PWA",
|
"description": "Description of your PWA",
|
||||||
"start_url": "http://localhost/nhance/user/list",
|
"start_url": "http://localhost/nhance/",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"background_color": "#ffffff",
|
"background_color": "#ffffff",
|
||||||
"theme_color": "#ffffff",
|
"theme_color": "#ffffff",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user