MERGE_LIVE_BDS_LIVE_ISSUES_FINAL
This commit is contained in:
commit
7e000aea28
@ -21,6 +21,7 @@ $routes->get("view", "EmployeeController::viewECard/$1");
|
||||
// $routes->get("exportQCRandRFQ", "LeadsController::exportQCRandRFQ");
|
||||
$routes->get("smapletest", "ClientController::smapletest");
|
||||
$routes->get("testMailAttachments", "ClientController::testMailAttachments");
|
||||
$routes->get("updatePolicyTermsKey", "ClientController::updatePolicyTermsKey");
|
||||
|
||||
$routes->post("add_advertise_image", "AppContentManagementController::add_advertise_image");
|
||||
$routes->get("add_image_index", "AppContentManagementController::add_image_index");
|
||||
@ -314,6 +315,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get('log_list', 'EmployeeController::listLogs');
|
||||
$routes->get('view_log/(:any)', 'EmployeeController::viewLog/$1');
|
||||
$routes->get('download_log/(:any)', 'EmployeeController::downloadLog/$1');
|
||||
$routes->post('checkDuplicateTableFieldValue', 'ClientController::checkDuplicateTableFieldValue');
|
||||
});
|
||||
|
||||
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
@ -323,6 +325,7 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("create", "PolicyTransactionController::createInceptionPolicy");
|
||||
$routes->get("list/(:any)", "PolicyTransactionController::getInceptionDataForEdit/$1");
|
||||
$routes->get("remove/(:any)", "PolicyTransactionController::removeCDMaster/$1");
|
||||
$routes->get("removePolicyTransaction/(:any)", "PolicyTransactionController::removePolicyTransaction/$1");
|
||||
});
|
||||
|
||||
$routes->group("endorsement", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
@ -118,6 +118,23 @@ class ClientController extends AdminController
|
||||
$this->leadsModel = new LeadsModel();
|
||||
}
|
||||
|
||||
public function checkDuplicateTableFieldValue()
|
||||
{
|
||||
$table = $this->request->getPost('table');
|
||||
$field = $this->request->getPost('field');
|
||||
$value = $this->request->getPost('value');
|
||||
|
||||
// Load the database if not already loaded
|
||||
$db = db_connect();
|
||||
|
||||
// Perform the query
|
||||
$builder = $db->table($table);
|
||||
$isDuplicate = $builder->where($field, $value)->countAllResults() > 0;
|
||||
|
||||
// Return the result
|
||||
return $this->response->setJSON(['isDuplicate' => $isDuplicate]);
|
||||
}
|
||||
|
||||
public function smapletest()
|
||||
{
|
||||
$headers = [
|
||||
@ -2138,11 +2155,15 @@ class ClientController extends AdminController
|
||||
$data['congenitaldiseasesinternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesinternal"));
|
||||
// $data['congenitaldiseasesexternal'] =$this->request->getPost("congenitaldiseasesexternal");
|
||||
$data['copayzonewisecopay'] = $this->request->getPost("copayzonewisecopay");
|
||||
$data['co_pay_details'] = str_replace(',', '', $this->request->getPost("co_pay_details"));
|
||||
|
||||
$data['bioabsorbablestenttoriclensmultifocallens'] = $this->request->getPost("bioabsorbablestenttoriclensmultifocallens");
|
||||
$data['roomrentlimit'] = str_replace(',', '', $this->request->getPost("roomrentlimit"));
|
||||
$data['proportionatedeductionclause'] = str_replace(',', '', $this->request->getPost("proportionatedeductionclause"));
|
||||
// $data['nursingallowance'] =str_replace(',', '',$this->request->getPost("nursingallowance"));
|
||||
$data['ailmentcapping'] = str_replace(',', '', $this->request->getPost("ailmentcapping"));
|
||||
$data['ailmentcapping'] = $this->request->getPost("ailmentcapping");
|
||||
$data['ailment_capping_details'] = str_replace(',', '', $this->request->getPost("ailment_capping_details"));
|
||||
|
||||
$data['ambulancecharges'] = str_replace(',', '', $this->request->getPost("ambulancecharges"));
|
||||
$data['airambulance'] = str_replace(',', '', $this->request->getPost("airambulance"));
|
||||
$data['familytransportationbenefit'] = str_replace(',', '', $this->request->getPost("familytransportationbenefit"));
|
||||
@ -2151,7 +2172,7 @@ class ClientController extends AdminController
|
||||
$data['ayudhtreatmentcover'] = str_replace(',', '', $this->request->getPost("ayudhtreatmentcover"));
|
||||
|
||||
$data['congenitaldiseasesexternal'] = str_replace(',', '', $this->request->getPost("congenitaldiseasesexternal"));
|
||||
$data['optionalparentalcopay'] = str_replace(',', '', $this->request->getPost("optionalparentalcopay"));
|
||||
// $data['optionalparentalcopay'] = str_replace(',', '', $this->request->getPost("optionalparentalcopay"));
|
||||
$data['posthospitalizationcover'] = str_replace(',', '', $this->request->getPost("posthospitalizationcover"));
|
||||
$data['corporatebuffer'] = str_replace(',', '', $this->request->getPost("corporatebuffer"));
|
||||
$data['sublimitofcorporatebuffer'] = str_replace(',', '', $this->request->getPost("sublimitofcorporatebuffer"));
|
||||
@ -3558,4 +3579,101 @@ class ClientController extends AdminController
|
||||
dd($result);
|
||||
}
|
||||
|
||||
public function updatePolicyTermsKey()
|
||||
{
|
||||
|
||||
$data = $this->clientPolicyModel
|
||||
->where("policy_terms IS NOT NULL AND policy_terms <> ''")
|
||||
->where('policy_type_id', 2)
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
for ($i = 0; $i < count($data); $i++) {
|
||||
|
||||
if (isset($data[$i]['policy_terms']) && !empty($data[$i]['policy_terms'])) {
|
||||
$policyTerms = json_decode($data[$i]['policy_terms'], true);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Set default value of copayzonewisecopay to "empty"
|
||||
$ans = isset($policyTerms['copayzonewisecopay']) ? $policyTerms['copayzonewisecopay'] : 'empty';
|
||||
|
||||
|
||||
// Initialize an empty array for the ordered policy terms
|
||||
$orderedPolicyTerms = [];
|
||||
|
||||
// Add copayzonewisecopay and copayzonewisecopaydata if they exist_
|
||||
if (isset($policyTerms['copayzonewisecopay'])) {
|
||||
|
||||
$orderedPolicyTerms['copayzonewisecopay'] = $policyTerms['copayzonewisecopay'];
|
||||
$orderedPolicyTerms['co_pay_details'] = isset($policyTerms['co_pay_details']) ? $policyTerms['co_pay_details'] : '';
|
||||
}
|
||||
|
||||
|
||||
// Add ailmentcapping and ailmentcappingdata if they exist_
|
||||
if (isset($policyTerms['ailmentcapping'])) {
|
||||
$orderedPolicyTerms['ailmentcapping'] = $policyTerms['ailmentcapping'];
|
||||
$orderedPolicyTerms['ailment_capping_details'] = isset($policyTerms['ailment_capping_details']) ? $policyTerms['ailment_capping_details'] : '';
|
||||
}
|
||||
|
||||
|
||||
// Now add the rest of the policy terms that are not copayzonewisecopay, copayzonewisecopaydata, ailmentcapping, or ailmentcapping_data_
|
||||
foreach ($policyTerms as $key => $value) {
|
||||
if (!in_array($key, ['copayzonewisecopay', 'co_pay_details', 'ailmentcapping', 'ailment_capping_details'])) {
|
||||
$orderedPolicyTerms[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Re-encode the ordered policy terms
|
||||
$updatedPolicyTerms = json_encode($orderedPolicyTerms);
|
||||
|
||||
|
||||
// Update the policyterms in the database_
|
||||
$this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]);
|
||||
|
||||
|
||||
// Handle different conditions for copayzonewisecopay
|
||||
if (strtolower($ans) == "nil" || $ans == 0) {
|
||||
// If copayzonewisecopay is "nil" or 0, reset it to 0 and add copayzonewisecopaydata as empty_
|
||||
if (isset($orderedPolicyTerms['copayzonewisecopay'])) {
|
||||
$orderedPolicyTerms['copayzonewisecopay'] = 0;
|
||||
$orderedPolicyTerms['co_pay_details'] = "";
|
||||
}
|
||||
|
||||
|
||||
// Rebuild the array after modification
|
||||
foreach ($policyTerms as $key => $value) {
|
||||
if (!in_array($key, ['copayzonewisecopay', 'co_pay_details'])) {
|
||||
$orderedPolicyTerms[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$updatedPolicyTerms = json_encode($orderedPolicyTerms);
|
||||
$this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]);
|
||||
continue;
|
||||
} elseif ($ans != 'empty' && $ans !== 'Nil' && $ans !== null && $ans != '' && $ans != 0) {
|
||||
// If copayzonewisecopay has a valid value, update it
|
||||
if (isset($orderedPolicyTerms['copayzonewisecopay'])) {
|
||||
$orderedPolicyTerms['copayzonewisecopay'] = 1;
|
||||
$orderedPolicyTerms['co_pay_details'] = $ans;
|
||||
}
|
||||
|
||||
|
||||
// Rebuild the array after modification
|
||||
foreach ($policyTerms as $key => $value) {
|
||||
if (!in_array($key, ['copayzonewisecopay', 'co_pay_details'])) {
|
||||
$orderedPolicyTerms[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$updatedPolicyTerms = json_encode($orderedPolicyTerms);
|
||||
$this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1795,9 +1795,21 @@ class EmployeeController extends AdminController
|
||||
// 'client_id' => 77,
|
||||
// 'client_policy_id' => 203,
|
||||
// 'client_branch_id' => 53,
|
||||
// 'insurer_or_tpa' => 'tpa',
|
||||
// ];
|
||||
|
||||
// $batch_data['insurer_or_tpa'] = 'insurer';
|
||||
// $batch_data['insurer_or_tpa'] = 'tpa';
|
||||
|
||||
//INCEPTION
|
||||
// $result = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($batch_data);
|
||||
|
||||
// CORRECTION
|
||||
// $result = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($batch_data);
|
||||
|
||||
//SI-ENHANCEMENT
|
||||
// $result = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($batch_data);
|
||||
|
||||
//DELETION
|
||||
// $result = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data);
|
||||
|
||||
// print_rr($result); die;
|
||||
|
||||
@ -690,6 +690,7 @@ class PolicyTransactionController extends BaseController
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||
->where('policy_transaction.id', $id)
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->first();
|
||||
|
||||
// $data['policy_issue_date'] = (isset($data['policy_issue_date']) && $data['policy_issue_date'] !== null && $data['policy_issue_date'] !== '')
|
||||
@ -810,6 +811,21 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
public function removePolicyTransaction($id)
|
||||
{
|
||||
if ($id) {
|
||||
|
||||
$data['is_active'] = 0;
|
||||
$this->policyTransactionModel->where('id', $id)->set($data)->update();
|
||||
$this->PTCOShareDetailsModel->where('pt_id', $id)->set($data)->update();
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Policy Transaction removed successfully'], 200);
|
||||
|
||||
} else {
|
||||
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to remove policy transaction'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
|
||||
// Policy Transaction Endorsement
|
||||
@ -962,6 +978,7 @@ class PolicyTransactionController extends BaseController
|
||||
->where('action_type', 'inception')
|
||||
->where('client_id', $this->request->getPost('client_id'))
|
||||
->where('client_policy_id', $this->request->getPost('client_policy_id'))
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->first();
|
||||
|
||||
$data['tsi'] = generate_tsi_code($issue_type['issue_type'] ?? 1);
|
||||
@ -1089,6 +1106,7 @@ class PolicyTransactionController extends BaseController
|
||||
->join('clients', 'clients.id = policy_transaction.client_id')
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
->where('policy_transaction.id', $id)
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->first();
|
||||
|
||||
// $data['policy_start_date'] = empty($data['policy_start_date']) ? '' : date('d/m/Y', strtotime($data['s_date']));
|
||||
@ -1278,6 +1296,8 @@ class PolicyTransactionController extends BaseController
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id')
|
||||
->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id')
|
||||
->where('policy_transaction.id', $pt_id)
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->where('pt_co_share_details.is_active', 1)
|
||||
->where('pt_co_share_details.statement_id IS NOT NULL')
|
||||
->where('insurer_statements.invoice_no IS NOT NULL')
|
||||
->countAllResults();
|
||||
@ -1676,6 +1696,7 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
public function validateInsurerStatement($params)
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
//get file info
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->insurerStatements->find($file_id);
|
||||
@ -1728,6 +1749,12 @@ class PolicyTransactionController extends BaseController
|
||||
// if all good return true, otherwise return false with messssage
|
||||
foreach ($excel_data as $excel_key => $excel_row)
|
||||
{
|
||||
$is_row_empty = check_row_is_empty_or_null($excel_row);
|
||||
if($is_row_empty)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$is_source_found = 0;
|
||||
$policy_start_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[4]);//policy_start_date from excel
|
||||
$policy_end_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[5]);//policy_end_date from excel
|
||||
|
||||
@ -331,6 +331,8 @@ class EmployeePolicyModel extends Model
|
||||
$client_branch_id = $ref_data['client_branch_id'];
|
||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (emp_endorsement.endorsement_id IS NOT NULL OR emp_endorsement.endorsement_id != '')" : "AND (emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')";
|
||||
|
||||
$sql = "
|
||||
SELECT DISTINCT
|
||||
emp_endorsement.id,
|
||||
@ -389,13 +391,14 @@ class EmployeePolicyModel extends Model
|
||||
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
||||
AND employees.client_branch_id = '{$client_branch_id}'
|
||||
AND emp_endorsement.actions = 'c'
|
||||
AND emp_endorsement.status != 'truncated'
|
||||
AND employee_polices.is_active = 1
|
||||
AND employee_polices.status = 'active'
|
||||
AND employees.is_active = 1
|
||||
AND employees.emp_status = 'active'
|
||||
AND (employee_polices.tpa_id IS NOT NULL AND employee_polices.tpa_id != '')
|
||||
AND (employee_polices.uhid IS NOT NULL AND employee_polices.uhid != '')
|
||||
AND (emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')";
|
||||
$endorsement_condition";
|
||||
|
||||
// Execute the raw query
|
||||
$query = $this->db->query($sql);
|
||||
@ -403,6 +406,8 @@ class EmployeePolicyModel extends Model
|
||||
// Get the result set
|
||||
$result = $query->getResult();
|
||||
|
||||
// dd($this->db->getLastQuery(), $result);
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
@ -416,6 +421,9 @@ class EmployeePolicyModel extends Model
|
||||
$client_branch_id = $ref_data['client_branch_id'];
|
||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||
|
||||
$endorsement_condition = "{$insurer_or_tpa}" === 'tpa' ? "AND (a.endorsement_id IS NOT NULL OR a.endorsement_id != '')" : "AND (a.endorsement_id IS NULL OR a.endorsement_id = '')";
|
||||
|
||||
|
||||
$query = $this->db->query("
|
||||
SELECT
|
||||
a.id as endorsement_primarykey,
|
||||
@ -528,8 +536,9 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
WHERE employee_polices.client_policy_id = '{$client_policy_id}'
|
||||
AND employees.client_branch_id = '{$client_branch_id}'
|
||||
AND (a.endorsement_id IS NULL OR a.endorsement_id = '')
|
||||
$endorsement_condition
|
||||
AND a.actions = 'si'
|
||||
AND a.status != 'truncated'
|
||||
AND employee_polices.is_active = 1
|
||||
AND employee_polices.status = 'active'
|
||||
AND employees.is_active = 1
|
||||
@ -539,6 +548,7 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
// Get the result set
|
||||
$results = $query->getResult();
|
||||
// dd($this->db->getLastQuery(), $results);
|
||||
return $results;
|
||||
|
||||
}
|
||||
|
||||
@ -386,7 +386,11 @@ class PolicyTransactionModel extends Model
|
||||
|
||||
$builder->orderBy('policy_transaction.id', 'desc');
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
$result = $builder->get()->getResultArray();
|
||||
|
||||
// dd($this->db->getLastQuery());
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getEndorsementTranctionListData($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $status = 0)
|
||||
|
||||
@ -137,6 +137,7 @@
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-5">
|
||||
<label for="event_name">Event<span class="text-danger">*</span></label>
|
||||
<select name="event" class="form-control" id="event" required>
|
||||
@ -209,7 +210,8 @@
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
|
||||
<!-- <div class="form-group col-md-12">
|
||||
<label for="event_name">Event<span class="text-danger">*</span></label>
|
||||
<select class="form-control" name="event_name_for_duplicate" id="event_name_for_duplicate">
|
||||
<option value="">Select</option>
|
||||
@ -221,7 +223,20 @@
|
||||
<option value="si_enhancement">SI Enhancement</option>
|
||||
<option value="si_enhancement">All</option>
|
||||
</select>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="event_name">Event<span class="text-danger">*</span></label>
|
||||
<select name="event_name_for_duplicate" class="form-control" id="event_name_for_duplicate" required>
|
||||
<option value="">Select</option>
|
||||
<?php if (!empty($events)){ ?>
|
||||
<?php foreach ($events as $key => $event) { ?>
|
||||
<option value="<?= $key ?>"><?= $event?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
|
||||
@ -862,6 +862,69 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
function checkDuplicateTableFieldValue(tableName, fieldName, value, callback) {
|
||||
$.ajax({
|
||||
url: '<?= base_url('util/checkDuplicateTableFieldValue') ?>', // Adjust this to your endpoint in CodeIgniter
|
||||
type: 'POST',
|
||||
data: {
|
||||
table: tableName,
|
||||
field: fieldName,
|
||||
value: value
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
if (typeof callback === 'function') {
|
||||
callback(response.isDuplicate); // Pass the result to the callback
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('AJAX Error:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function sendAjaxRequestForGlobal(url, method, data = {}, successCallback = null, errorCallback = null) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
method: method,
|
||||
data: data,
|
||||
dataType: 'json', // Expected response type
|
||||
success: function(response) {
|
||||
// If a success callback is provided, call it with the response
|
||||
if (successCallback) {
|
||||
successCallback(response);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle errors if provided error callback
|
||||
if (errorCallback) {
|
||||
errorCallback(xhr, status, error);
|
||||
} else {
|
||||
console.error('AJAX Error:', error);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function confirmActionSweertAlert(message = "Are you sure?", confirmText = "Yes, Proceed!", cancelText = "Cancel", icon = "warning") {
|
||||
return Swal.fire({
|
||||
title: message,
|
||||
icon: icon,
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: confirmText,
|
||||
cancelButtonText: cancelText
|
||||
}).then((result) => {
|
||||
return result.isConfirmed; // Returns true if confirmed, false otherwise
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -53,72 +53,74 @@ table.dataTable tbody td {
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped mb-0 nowrap" cellspacing="0" id="tickets-table">
|
||||
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th><div class="column-header">S.No.</div></th>
|
||||
<th><div class="column-header">Lead Type</div></th>
|
||||
<th><div class="column-header">Issuer</div></th>
|
||||
<th><div class="column-header">Client Type</div></th>
|
||||
<th><div class="column-header">Client / Branch</div></th>
|
||||
<th><div class="column-header">Entity Type</div></th>
|
||||
<th><div class="column-header">Branch Name</div></th>
|
||||
<th><div class="column-header">Branch Code</div></th>
|
||||
<th><div class="column-header">Contact Person Name</div></th>
|
||||
<th><div class="column-header">Contact Person Mobile</div></th>
|
||||
<th><div class="column-header">Policy Type</div></th>
|
||||
<th><div class="column-header">Status</div></th>
|
||||
<th><div class="column-header">Action</div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php if(isset($lead_data_list)) { ?>
|
||||
<?php foreach($lead_data_list as $index => $row){ ?>
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<td><?php echo $index + 1; ?></td>
|
||||
<td><?php echo $lead_type[$row['lead_type']] ?? '-'; ?></td>
|
||||
<td><?php echo $issuer[$row['issuer']] ?? '-'; ?></td>
|
||||
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
|
||||
<td><?php echo $row['client_type'] == 2 ? ($row['client_name'] ?? '-') : (($row['client_short_name'] ?? '-') . ' - ' . ($row['branch_name'] ?? '-')); ?></td>
|
||||
<td><?php echo $row['entity_type'] ?? '-'; ?></td>
|
||||
<td><?php echo $row['branch_name'] ?? '-'; ?></td>
|
||||
<td><?php echo $row['branch_code'] ?? '-'; ?></td>
|
||||
<td><?php echo $row['contact_person_name'] ?? '-'; ?></td>
|
||||
<td><?php echo $row['contact_person_mobile'] ?? '-'; ?></td>
|
||||
<td><?php echo $row['policy_type'] ?? '-'; ?></td>
|
||||
<td><?php echo $lead_status[$row['status']] ?? '-'; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript:void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="mdi mdi-dots-horizontal"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
<th><div class="column-header">S.No.</div></th>
|
||||
<th><div class="column-header">Lead Type</div></th>
|
||||
<th><div class="column-header">Issuer</div></th>
|
||||
<th><div class="column-header">Client Type</div></th>
|
||||
<th><div class="column-header">Client / Branch</div></th>
|
||||
<th><div class="column-header">Entity Type</div></th>
|
||||
<th><div class="column-header">Branch Name</div></th>
|
||||
<th><div class="column-header">Branch Code</div></th>
|
||||
<th><div class="column-header">Contact Person Name</div></th>
|
||||
<th><div class="column-header">Contact Person Mobile</div></th>
|
||||
<th><div class="column-header">Policy Type</div></th>
|
||||
<th><div class="column-header">Status</div></th>
|
||||
<th><div class="column-header">Action</div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php if(isset($lead_data_list)) { ?>
|
||||
<?php foreach($lead_data_list as $index => $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $index + 1; ?></td>
|
||||
<td><?php echo $lead_type[$row['lead_type']] ?? '-'; ?></td>
|
||||
<td><?php echo $issuer[$row['issuer']] ?? '-'; ?></td>
|
||||
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
|
||||
<td><?php echo $row['client_type'] == 2 ? ($row['client_name'] ?? '-') : (($row['client_short_name'] ?? '-') . ' - ' . ($row['branch_name'] ?? '-')); ?></td>
|
||||
<td><?php echo $row['entity_type'] ?? '-'; ?></td>
|
||||
<td><?php echo $row['branch_name'] ?? '-'; ?></td>
|
||||
<td><?php echo $row['branch_code'] ?? '-'; ?></td>
|
||||
<td><?php echo $row['contact_person_name'] ?? '-'; ?></td>
|
||||
<td><?php echo $row['contact_person_mobile'] ?? '-'; ?></td>
|
||||
<td><?php echo $row['policy_type'] ?? '-'; ?></td>
|
||||
<td><?php echo $lead_status[$row['status']] ?? '-'; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript:void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="mdi mdi-dots-horizontal"></i>
|
||||
</a>
|
||||
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 1; ?>" class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>">
|
||||
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>RFQ
|
||||
</a>
|
||||
<?php if($row['qcr_count'] > 0) { ?>
|
||||
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 2; ?>" class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>">
|
||||
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>QCR
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getLeadsDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
</a>
|
||||
<?php } ?>
|
||||
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 1; ?>" class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>">
|
||||
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>RFQ
|
||||
</a>
|
||||
<?php if($row['qcr_count'] > 0) { ?>
|
||||
<a href="<?= base_url('/rfq/list/').$row['id'] . '/' . 2; ?>" class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>">
|
||||
<i class="mdi mdi-note-text mr-2 text-muted font-18 vertical-middle"></i>QCR
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<tr>
|
||||
<td colspan="14" class="text-center">No data available</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<tr>
|
||||
<td colspan="14" class="text-center">No data available</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -174,7 +176,7 @@ $(document).ready(function() {
|
||||
|
||||
if (ticketsTable.length) {
|
||||
ticketsTable.DataTable({
|
||||
scrollX: true,
|
||||
// scrollX: true,
|
||||
dom: "<'row'<'col-sm-6'f><'col-sm-5 text-right'B>>" + // Filter left, buttons right
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
||||
|
||||
@ -341,43 +341,18 @@
|
||||
<label for="totalSumInsured">Co-Pay/Zone wise Co Pay</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<select name="copayzonewisecopay" id="copayzonewisecopay" class="form-control ">
|
||||
<option value="">Select an option</option>
|
||||
<option value="Nil">Nil</option>
|
||||
<option value="5%">5%</option>
|
||||
<option value="10%">10%</option>
|
||||
<option value="15%">15%</option>
|
||||
<option value="20%">20%</option>
|
||||
<option value="25%">25%</option>
|
||||
<option value="30%">30%</option>
|
||||
<option value="35%">35%</option>
|
||||
<option value="40%">40%</option>
|
||||
<option value="45%">45%</option>
|
||||
<option value="50%">50%</option>
|
||||
</select>
|
||||
<input type="radio" name="copayzonewisecopay" class="copayzonewisecopay" value="1"> Yes
|
||||
<input type="radio" name="copayzonewisecopay" class="copayzonewisecopay" value="0" style="margin-left:10px"> No
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Optional Parental Co-Pay</label>
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Co-pay Details</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<select name="optionalparentalcopay" id="optionalparentalcopay" class="form-control ">
|
||||
<option value="">Select an option</option>
|
||||
<option value="Nil">Nil</option>
|
||||
<option value="5%">5%</option>
|
||||
<option value="10%">10%</option>
|
||||
<option value="15%">15%</option>
|
||||
<option value="20%">20%</option>
|
||||
<option value="25%">25%</option>
|
||||
<option value="30%">30%</option>
|
||||
<option value="35%">35%</option>
|
||||
<option value="40%">40%</option>
|
||||
<option value="45%">45%</option>
|
||||
<option value="50%">50%</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" name="co_pay_details" id="co_pay_details" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
@ -430,6 +405,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Ailment capping Details</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="ailment_capping_details" id="ailment_capping_details" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Corporate Buffer</label>
|
||||
@ -705,6 +689,34 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('input[name="ailmentcapping"]').change(function() {
|
||||
|
||||
////console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
|
||||
} else {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "none");
|
||||
}
|
||||
});
|
||||
|
||||
$('input[name="copayzonewisecopay"]').change(function() {
|
||||
|
||||
////console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
|
||||
} else {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "none");
|
||||
}
|
||||
});
|
||||
|
||||
$('input[name="cataract"]').change(function() {
|
||||
|
||||
//console.log($(this).val());
|
||||
@ -1067,6 +1079,10 @@
|
||||
|
||||
}else if(element.name === "ayudhtreatmentcover"){
|
||||
element.parentElement.parentElement.nextElementSibling.style.display = '';
|
||||
}else if(element.name === "ailmentcapping"){
|
||||
element.parentElement.parentElement.nextElementSibling.style.display = '';
|
||||
}else if(element.name === "copayzonewisecopay"){
|
||||
element.parentElement.parentElement.nextElementSibling.style.display = '';
|
||||
}else if(element.name === "cataract"){
|
||||
element.parentElement.parentElement.nextElementSibling.style.display = '';
|
||||
}
|
||||
|
||||
@ -317,7 +317,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3" id="renewal" style="display: none;">
|
||||
<label for="addon_policy"> Renewal Source Policy <span id="base_danger"class="text-danger">*</span></label>
|
||||
<label for="addon_policy"> Renewal Source Policy <span id="base_danger"class="text-danger"></span></label>
|
||||
<select class="form-control" id="source_client_policy_id"name="source_client_policy_id" onchange="setRenewalPolicyData(this)">
|
||||
<option value="" selected>Select Renewal Source Policy</option>
|
||||
</select>
|
||||
@ -748,7 +748,7 @@
|
||||
<!-- end form row -->
|
||||
|
||||
<!-- Client form content modal-->
|
||||
<div class="modal fade" id="upload_enrollment_model" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal fade" id="upload_enrollment_model" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" data-backdrop="static">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -759,7 +759,6 @@
|
||||
<form class="parsley-examples" method="post" id="client_form" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="client_name">Client Name<span class="text-danger">*</span></label>
|
||||
@ -772,7 +771,7 @@
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="cost_center">PAN<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="pan" placeholder="Enter PAN No" name="pan">
|
||||
<input type="text" class="form-control" id="pan" placeholder="Enter PAN No" name="pan" onchange="validateInput(this, 'clients', 'pan')" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -789,7 +788,7 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="cost_center">Mobile<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="phone" placeholder="Enter Mobile Number" maxlength="10" name="phone"
|
||||
onkeypress="return onlyNumbers(event)">
|
||||
onkeypress="return onlyNumbers(event)" onchange="validateInput(this, 'clients', 'phone')">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
@ -799,7 +798,7 @@
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="aadhar">Aadhar<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="aadhar" placeholder="Enter Aadher No" name="aadhar">
|
||||
<input type="text" class="form-control" id="aadhar" placeholder="Enter Aadher No" name="aadhar" maxlength="12" onchange="validateInput(this, 'clients', 'aadhar')">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -809,7 +808,7 @@
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="short_name">Entity Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="entity_type_id" name="entity_type_id">
|
||||
<select class="form-control" id="entity_type_id_for_client" name="entity_type_id">
|
||||
<option value="" selected>Select Entity</option>
|
||||
<?php
|
||||
if (isset($entity) && count($entity)) {
|
||||
@ -843,7 +842,8 @@
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="gst">GST<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="gst" placeholder="Enter GST Number" data-parsley-error-message="Invalid GST Number. Example: 12ABCDE1234F5Z6" 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>
|
||||
<input type="text" class="form-control" id="gst" placeholder="Enter GST Number" onchange="validateInput(this, 'client_branch', 'gst')"
|
||||
data-parsley-error-message="Invalid GST Number. Example: 12ABCDE1234F5Z6" 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>
|
||||
@ -859,21 +859,21 @@
|
||||
</div>
|
||||
|
||||
<!-- Vehicle form content modal-->
|
||||
<div class="modal fade" id="vehicle_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false">
|
||||
<div class="modal fade" id="vehicle_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" data-backdrop="static">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">Add New Vehicle</h4>
|
||||
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<button type="button" id="vehicle_close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="modal-body" style="overflow-y: auto;height: 90vh;">
|
||||
<form class="parsley-examples" method="post" id="vehicle_form" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-6 client_type_div">
|
||||
<label for="client_type">Owner Type<span class="text-danger">*</span></label>
|
||||
<label for="Owner_type">Owner Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="Owner_type" name="Owner_type" required>
|
||||
<option value="">Select Owner type</option>
|
||||
<option value="1">Group</option>
|
||||
@ -883,12 +883,12 @@
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="cost_center">Vehicle No<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="modal_vehicle_no" placeholder="Enter Vehicle No" name="vehicle_no" required>
|
||||
<input type="text" class="form-control" id="modal_vehicle_no" placeholder="Enter Vehicle No" name="vehicle_no" onchange="validateInput(this, 'vehicle', 'vehicle_no')" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="rc">RC Book <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="rc" placeholder="Enter RC Book No" name="rc" required>
|
||||
<input type="text" class="form-control" id="rc" placeholder="Enter RC Book No" name="rc" onchange="validateInput(this, 'vehicle', 'rc')" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
@ -946,7 +946,7 @@
|
||||
</div>
|
||||
|
||||
<!-- CD No form content modal-->
|
||||
<div class="modal fade" id="cd_form_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal fade" id="cd_form_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -994,7 +994,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
var team_id = [];
|
||||
@ -1020,7 +1019,7 @@ $(document).ready(function(){
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
team_id = <?php echo json_encode(user_team()); ?>;
|
||||
@ -1089,6 +1088,7 @@ $(document).ready(function(){
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#vehicle_no').change(function(){
|
||||
|
||||
var val = $(this).val()
|
||||
var selectedOption = $(this).find('option:selected');
|
||||
var client_id = selectedOption.data('cid')
|
||||
@ -1116,9 +1116,12 @@ $(document).ready(function(){
|
||||
}
|
||||
|
||||
if(val == 'add_vehicle'){
|
||||
|
||||
$('#modal_vehicle_no').val('');
|
||||
var myModal = new bootstrap.Modal(document.getElementById('vehicle_modal'));
|
||||
myModal.show();
|
||||
|
||||
$(this).val('').select2();
|
||||
}
|
||||
})
|
||||
|
||||
@ -1127,6 +1130,65 @@ $(document).ready(function(){
|
||||
let owner_id = $(this).val();
|
||||
console.log('owner_id', owner_id);
|
||||
|
||||
if(owner_id == 'add_client'){
|
||||
|
||||
if($('#client_type').val()){
|
||||
|
||||
$('#vehicle_close_btn').click();
|
||||
|
||||
if ($('#client_type').val() == 2) {
|
||||
|
||||
$('.branchdiv').hide();
|
||||
$('.clienttypediv').show();
|
||||
$('#entity_type_id_for_client').prop('required', false);
|
||||
$('#branch_name').prop('required', false);
|
||||
$('#client_branch_id').prop('required', false);
|
||||
$('#branch_code').prop('required', false);
|
||||
$('#name').prop('required', false);
|
||||
$('#mobile').prop('required', false);
|
||||
$('#gst').prop('required', false);
|
||||
|
||||
$('#dob').prop('required', true);
|
||||
$('#phone').prop('required', true);
|
||||
$('#email').prop('required', true);
|
||||
$('#aadhar').prop('required', true);
|
||||
|
||||
} else {
|
||||
|
||||
$('.branchdiv').show();
|
||||
$('.clienttypediv').hide();
|
||||
$('#entity_type_id_for_client').prop('required', true);
|
||||
$('#branch_name').prop('required', true);
|
||||
$('#client_branch_id').prop('required', true);
|
||||
$('#branch_code').prop('required', true);
|
||||
$('#name').prop('required', true);
|
||||
$('#mobile').prop('required', true);
|
||||
$('#gst').prop('required', true);
|
||||
|
||||
$('#dob').prop('required', false);
|
||||
$('#phone').prop('required', false);
|
||||
$('#email').prop('required', false);
|
||||
$('#aadhar').prop('required', false);
|
||||
|
||||
}
|
||||
|
||||
var myModal = new bootstrap.Modal(document.getElementById('upload_enrollment_model'));
|
||||
myModal.show();
|
||||
|
||||
}else{
|
||||
|
||||
toastr.warning('Please select the Owner type', 'WARNING');
|
||||
}
|
||||
|
||||
|
||||
$('#client_form').attr('data-id', 1);
|
||||
|
||||
// Save form data from the #vehicle_form to localStorage
|
||||
saveFormDataToLocalStorage("#vehicle_form", "vehicleFormData");
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(branch_list != '') {
|
||||
// console.log(branch_list[client_id]);
|
||||
let data = branch_list[owner_id];
|
||||
@ -1552,10 +1614,10 @@ function getPolicyTransactionDataForEdit(input) {
|
||||
// Additional form handling logic
|
||||
if (res.data.issue_type == 2) {
|
||||
$('#renewal').show();
|
||||
$('#source_client_policy_id').attr('required', true);
|
||||
// $('#source_client_policy_id').attr('required', true);
|
||||
} else {
|
||||
$('#renewal').hide();
|
||||
$('#source_client_policy_id').attr('required', false);
|
||||
// $('#source_client_policy_id').attr('required', false);
|
||||
}
|
||||
|
||||
// Handle base policy visibility
|
||||
@ -1680,6 +1742,7 @@ function checkAndDistributeTax(input)
|
||||
let cgst = parseFloat($('#cgst_' + input).val());
|
||||
let sgst = parseFloat($('#sgst_' + input).val());
|
||||
let igst = parseFloat($('#igst_' + input).val());
|
||||
|
||||
if(((event.target.id).startsWith('cgst') || (event.target.id).startsWith('sgst') ))
|
||||
{
|
||||
if(cgst !== 0) { $('#sgst_' + input).val(cgst.toFixed(2)); }
|
||||
@ -1687,7 +1750,7 @@ function checkAndDistributeTax(input)
|
||||
|
||||
$('#igst_' + input).val(0.00);
|
||||
}
|
||||
else
|
||||
else if((event.target.id).startsWith('igst'))
|
||||
{
|
||||
$('#cgst_' + input).val(0.00);
|
||||
$('#sgst_' + input).val(0.00);
|
||||
@ -2177,12 +2240,21 @@ function removeRemoveInsured(element) {
|
||||
}
|
||||
|
||||
function appendOwner(data) {
|
||||
|
||||
$('#owner').empty();
|
||||
|
||||
$('#owner').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Owner'
|
||||
}));
|
||||
}));
|
||||
|
||||
$('#owner').append(
|
||||
$('<option>', {
|
||||
value: 'add_client',
|
||||
text: ' + Add Owner',
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
@ -2707,6 +2779,12 @@ $("#inception_form_id").submit(function(event) {
|
||||
|
||||
$("#client_form").submit(function(event) {
|
||||
|
||||
let form_type = $(this).data('id') || 0;
|
||||
|
||||
console.log('onsubmit event', this)
|
||||
console.log('onsubmit event get data value',form_type)
|
||||
console.log('client_type', $('#client_type').val());
|
||||
|
||||
event.preventDefault();
|
||||
isClientFormSubmitting = true;
|
||||
var isValid = $('#client_form').parsley().validate();
|
||||
@ -2719,10 +2797,13 @@ $("#client_form").submit(function(event) {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var client_type = $('#client_type').val();
|
||||
|
||||
var client_type = $('#client_type').val() || $('#Owner_type').val();
|
||||
console.log('client_type:', client_type);
|
||||
|
||||
//FORM Data
|
||||
var formData = new FormData($('#client_form')[0]);
|
||||
formData.append('client_type', client_type)
|
||||
formData.append('client_type', client_type);
|
||||
|
||||
$.ajax({
|
||||
data:formData,
|
||||
@ -2740,21 +2821,48 @@ $("#client_form").submit(function(event) {
|
||||
|
||||
if(res.status == true){
|
||||
getClientAndBranchAndPolicy(res.client_id, res.branch_id);
|
||||
setTimeout(function(){
|
||||
$('#client_id').val(res.client_id).change();
|
||||
|
||||
if(form_type != 1){
|
||||
|
||||
setTimeout(function(){
|
||||
$('#client_branch_id').val(res.branch_id).change();
|
||||
}, 1000)
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 2000)
|
||||
$('#client_id').val(res.client_id).change();
|
||||
setTimeout(function(){
|
||||
$('#client_branch_id').val(res.branch_id).change();
|
||||
}, 1000)
|
||||
}, 2000)
|
||||
|
||||
}else{
|
||||
|
||||
setTimeout(function(){
|
||||
$('#owner').val(res.client_id).change();
|
||||
$('#owner_branch').val(res.branch_id).change();
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
toastr.success(res.message, 'Success');
|
||||
|
||||
}else{
|
||||
toastr.error(res.message, 'Error');
|
||||
}
|
||||
|
||||
$('#client_form')[0].reset();
|
||||
$('.close').click();
|
||||
|
||||
if(form_type == 1){
|
||||
|
||||
var myModal = new bootstrap.Modal(document.getElementById('vehicle_modal'));
|
||||
myModal.show();
|
||||
|
||||
$('#client_form').removeAttr('data-id');
|
||||
|
||||
// Load form data into #vehicle_form from localStorage
|
||||
setFormDataFromLocalStorage("#vehicle_form", "vehicleFormData");
|
||||
}
|
||||
|
||||
isClientFormSubmitting = false;
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
@ -2898,6 +3006,7 @@ $("#CDMasterForm").submit(function(event) {
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
$('#cop_yes').change(function() {
|
||||
|
||||
if ($(this).is(':checked')) {
|
||||
$('#add_more_row').removeClass('d-none');
|
||||
$('.payby').removeClass('d-none');
|
||||
@ -2927,9 +3036,10 @@ $('#client_type').change(function() {
|
||||
}
|
||||
|
||||
if ($(this).val() == 2) {
|
||||
|
||||
$('.branchdiv').hide();
|
||||
$('.clienttypediv').show();
|
||||
$('#entity_type_id').prop('required', false);
|
||||
$('#entity_type_id_for_client').prop('required', false);
|
||||
$('#branch_name').prop('required', false);
|
||||
$('#client_branch_id').prop('required', false);
|
||||
$('#branch_code').prop('required', false);
|
||||
@ -2949,7 +3059,7 @@ $('#client_type').change(function() {
|
||||
} else {
|
||||
$('.branchdiv').show();
|
||||
$('.clienttypediv').hide();
|
||||
$('#entity_type_id').prop('required', true);
|
||||
$('#entity_type_id_for_client').prop('required', true);
|
||||
$('#branch_name').prop('required', true);
|
||||
$('#client_branch_id').prop('required', true);
|
||||
$('#branch_code').prop('required', true);
|
||||
@ -3025,6 +3135,8 @@ $('#Owner_type').on('change', function() {
|
||||
|
||||
var selectedClientType = $(this).val();
|
||||
|
||||
$('#client_type').val(selectedClientType).change();
|
||||
|
||||
if ($(this).val() == 2) {
|
||||
$('.ownerbranchdiv').hide();
|
||||
$('#owner_branch').prop('required', false);
|
||||
@ -3040,17 +3152,40 @@ $('#Owner_type').on('change', function() {
|
||||
value: '',
|
||||
text: 'Select Owner'
|
||||
}))
|
||||
|
||||
$('#owner').append(
|
||||
$('<option>', {
|
||||
value: 'add_client',
|
||||
text: ' + Add Owner',
|
||||
})
|
||||
);
|
||||
|
||||
// Populate client options based on selected client type
|
||||
if (selectedClientType) {
|
||||
// Populate vehicle options based on selected client type
|
||||
$.each(client_list, function(index, owner) {
|
||||
|
||||
if (owner.client_type == selectedClientType) {
|
||||
var option = $('<option>', {
|
||||
value: owner.id,
|
||||
text: owner.client_name,
|
||||
});
|
||||
$('#owner').append(option);
|
||||
|
||||
if(selectedClientType == '2'){
|
||||
|
||||
var option = $('<option>', {
|
||||
value: owner.id,
|
||||
text: (owner.client_name + ' - ' + (owner.pan ?? ''))
|
||||
});
|
||||
|
||||
$('#owner').append(option);
|
||||
|
||||
}else{
|
||||
|
||||
var option = $('<option>', {
|
||||
value: owner.id,
|
||||
text: owner.client_name,
|
||||
});
|
||||
$('#owner').append(option);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -3945,4 +4080,69 @@ function getURLParamsForReport() {
|
||||
console.log('pt_id', pt_id); // Retain the log if necessary
|
||||
}
|
||||
|
||||
function validateInput(input, table, field){
|
||||
|
||||
let value = $(input).val();
|
||||
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
|
||||
|
||||
let message = "Value is duplicate!";
|
||||
if(label){
|
||||
message = label + " already exists!";
|
||||
}
|
||||
|
||||
checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) {
|
||||
if (isDuplicate) {
|
||||
toastr.warning(message, 'WARNING');
|
||||
$(input).val('')
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function saveFormDataToLocalStorage(formSelector, storageKey) {
|
||||
// Initialize an empty object to store form data
|
||||
let formData = {};
|
||||
|
||||
// Iterate over all inputs in the form
|
||||
$(formSelector + " :input").each(function() {
|
||||
let input = $(this);
|
||||
let name = input.attr("name"); // Get the input's name attribute
|
||||
let value = input.val(); // Get the input's value
|
||||
|
||||
if (name) {
|
||||
if (name !== 'owner' && name !== 'branch_id') {
|
||||
formData[name] = value; // Add to the formData object if the input has a name
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Save the form data to local storage with the provided key
|
||||
localStorage.setItem(storageKey, JSON.stringify(formData));
|
||||
|
||||
console.log("Form data saved to local storage:", formData);
|
||||
}
|
||||
|
||||
function setFormDataFromLocalStorage(formSelector, storageKey) {
|
||||
// Retrieve the saved form data from localStorage
|
||||
let savedData = JSON.parse(localStorage.getItem(storageKey));
|
||||
|
||||
// If there's no saved data, do nothing
|
||||
if (!savedData) return;
|
||||
|
||||
// Iterate through the saved data and set the form inputs accordingly
|
||||
$.each(savedData, function(name, value) {
|
||||
let input = $(formSelector + " :input[name='" + name + "']");
|
||||
|
||||
// Check if the input is a checkbox or radio button
|
||||
if (input.is(':checkbox') || input.is(':radio')) {
|
||||
input.prop('checked', value); // Set the checked property
|
||||
} else {
|
||||
input.val(value); // Set the value for other input types
|
||||
}
|
||||
});
|
||||
|
||||
console.log("Form data loaded from local storage:", savedData);
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -289,6 +289,9 @@ table.dataTable tbody td {
|
||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
</a>
|
||||
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removePolicyTransaction(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -1071,6 +1074,7 @@ $(document).ready(function(){
|
||||
$('#policy_holder_name').val(client_name);
|
||||
|
||||
if(client_id == 'add_client') {
|
||||
|
||||
if($('#client_type').val()){
|
||||
$('#client_id').val('').change();
|
||||
var myModal = new bootstrap.Modal(document.getElementById('upload_enrollment_model'));
|
||||
@ -1118,11 +1122,11 @@ $('#issue_type').change(function(){
|
||||
$('#revenue_type').val('EA')
|
||||
$('#renewal').show()
|
||||
// $('.sded_dates').show()
|
||||
$('#source_client_policy_id').attr('required', true)
|
||||
// $('#source_client_policy_id').attr('required', true)
|
||||
}else{
|
||||
$('#renewal').hide()
|
||||
// $('.sded_dates').hide()
|
||||
$('#source_client_policy_id').attr('required', false)
|
||||
// $('#source_client_policy_id').attr('required', false)
|
||||
$('#policy_start_date').val('');
|
||||
$('#policy_end_date').val('');
|
||||
}
|
||||
@ -1243,7 +1247,7 @@ $('#cd_ac_no_data').change(function(){
|
||||
|
||||
// $('#policy_type_id').change(function() {
|
||||
|
||||
// var policy_type_id = $(this).val();
|
||||
// var policy_type_id = $(this).val();
|
||||
|
||||
// var client_id = $('#client_id').val();
|
||||
// var client_branch_id = $('#client_branch_id').val();
|
||||
@ -1501,4 +1505,32 @@ function hideDateField(input = null)
|
||||
}
|
||||
}
|
||||
|
||||
function removePolicyTransaction(input, pt_id) {
|
||||
|
||||
confirmActionSweertAlert("Do you want to delete this transaction?", "Yes, Proceed!", "No, Cancel").then((confirmed) => {
|
||||
if (confirmed) {
|
||||
let url = '<?= base_url('policy_tranction/inception/removePolicyTransaction/') ?>' + pt_id;
|
||||
|
||||
// Include `pt_id` in the AJAX request if necessary
|
||||
let requestData = { pt_id: pt_id };
|
||||
|
||||
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
||||
console.log('Data fetched successfully:', response);
|
||||
|
||||
if (response.status === true) {
|
||||
toastr.success(response.message, 'SUCCESS');
|
||||
window.location.reload();
|
||||
} else {
|
||||
toastr.warning(response.message, 'WARNING');
|
||||
}
|
||||
}, function(xhr, status, error) {
|
||||
console.error('Error fetching data:', error);
|
||||
console.error(xhr.responseText);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user