Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
711cb43983
@ -332,7 +332,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("send_manual_ecard/(:any)", "DashboardController::sendManualEcard/$1");
|
||||
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
|
||||
$routes->get("get_client_branch_data/(:any)", "ClientController::get_client_branch_data/$1");
|
||||
$routes->get("getLevelContects", "LeadsController::getLevelContects");
|
||||
$routes->get("getLevelContects", "LeadsControllerg::getLevelContects");
|
||||
$routes->get("get_emp_master_data_for_update/(:any)", "EmployeeController::get_emp_master_data_for_update/$1");
|
||||
$routes->get("send_mail_for_individual_employee_ecard/(:any)", "EmployeeController::send_mail_for_individual_employee_ecard/$1");
|
||||
$routes->post("update_emp_data", "EmployeeController::update_emp_data");
|
||||
@ -365,6 +365,9 @@ $routes->cli("cli/sendInstallmentRemainderMail","PolicyTransactionController::se
|
||||
|
||||
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->post("getMoreInfo","PolicyTransactionController::getMoreInfo");
|
||||
$routes->post("saveInstallment","PolicyTransactionController::saveInstallment");
|
||||
|
||||
$routes->group("inception", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->match(['get', 'post'], 'list', 'PolicyTransactionController::viewInception');
|
||||
$routes->post("create", "PolicyTransactionController::createInceptionPolicy");
|
||||
|
||||
@ -3807,13 +3807,13 @@ class ClientController extends AdminController
|
||||
'dob' => change_date_format($postData['dob'],'d/m/Y','Y-m-d'),
|
||||
'aadhar' => $postData['aadhar'],
|
||||
'phone' => $postData['phone'],
|
||||
'email' => $postData['email'],
|
||||
'entity_type_id' => 7
|
||||
]);
|
||||
} else {
|
||||
$client_data['entity_type_id'] = $postData['entity_type_id'];
|
||||
}
|
||||
|
||||
// print_rr($client_data);die();
|
||||
// Insert client data
|
||||
$client_insert = $this->clientModel->insert($client_data);
|
||||
|
||||
@ -3839,6 +3839,8 @@ class ClientController extends AdminController
|
||||
'contact_type' => 'client',
|
||||
'name' => $postData['name'],
|
||||
'mobile' => $postData['mobile'],
|
||||
'email' => $postData['email'],
|
||||
|
||||
];
|
||||
$this->levelContactModel->insert($contact_data);
|
||||
}
|
||||
@ -4018,7 +4020,8 @@ class ClientController extends AdminController
|
||||
->join('clients', 'client_branch.client_id = clients.id')
|
||||
->where(['client_branch.id' => $id, 'client_branch.is_active' => 1])
|
||||
->first();
|
||||
$branch_contact_data = $this->levelContactModel->where(['ref_id' => $id, 'contact_type' => 'client', 'is_active' => 1])->orderBy('id','asc')->first();
|
||||
$branch_contact_data = $this->levelContactModel->where(['ref_id' => $id, 'contact_type' => 'client', 'is_active' => 1])->findAll();
|
||||
// print_rr($branch_contact_data);die();
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $branch_data, 'contact' => $branch_contact_data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||
|
||||
@ -94,7 +94,7 @@ class LoginController extends BaseController
|
||||
// setcookie('session_data', '', time() - 3600, $path);
|
||||
$path = getenv('cookie.Path');
|
||||
$domain = getenv('cookie.Domain');
|
||||
$https = getenv('ccokie.secure');
|
||||
$https = getenv('cookie.secure');
|
||||
setcookie('session_data',null, time() -3600, $path, $domain, $https, true);
|
||||
return redirect()->to(base_url('login'));
|
||||
}
|
||||
|
||||
@ -235,8 +235,7 @@ class PolicyTransactionController extends BaseController
|
||||
->where('role', 3) // Assuming `role` is in `user_profiles`
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
// echo '<pre>';
|
||||
// echo '<pre>';
|
||||
// print_r($data['ppTeamsData']); die;
|
||||
|
||||
// dd($data);
|
||||
@ -2905,4 +2904,52 @@ class PolicyTransactionController extends BaseController
|
||||
$this->myLogger->logme('error', 'Exception: ' . $e->getMessage() . 'Page: ' . $e->getFile() . ' Line: ' . $e->getLine());
|
||||
}
|
||||
}
|
||||
|
||||
public function getMoreInfo() {
|
||||
|
||||
$pt_id = $this->request->getPost("pt_id");
|
||||
$data_to_send['bds_data'] = $this->BdsPlacementModel->where("is_active",1)->where("pt_id",$pt_id)->findAll();
|
||||
|
||||
foreach ($data_to_send['bds_data'] as &$data) {
|
||||
|
||||
$data['payment_date'] = (new \DateTime($data['payment_date']))->format('d-m-Y');
|
||||
}
|
||||
|
||||
if (!empty($data_to_send)) {
|
||||
|
||||
return $this->respond(['status' => true , "data" => $data_to_send],200);
|
||||
}else {
|
||||
|
||||
return $this->respond(['status' => false,"No Data Found For the Policy Transaction"],404);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function saveInstallment() {
|
||||
|
||||
$installments = $this->request->getPost('installments');
|
||||
|
||||
if (!$installments || !is_array($installments)) {
|
||||
return $this->respond(['status' => false, 'message' => 'No data received'], 400);
|
||||
}
|
||||
|
||||
$this->myLogger->logme("error",json_encode($installments));
|
||||
// die();
|
||||
|
||||
foreach ($installments as &$row) {
|
||||
// Convert date from d-m-Y to Y-m-d
|
||||
if (!empty($row['payment_date'])) {
|
||||
$date = \DateTime::createFromFormat('d-m-Y', $row['payment_date']);
|
||||
if ($date) {
|
||||
$row['payment_date'] = $date->format('Y-m-d');
|
||||
}
|
||||
}
|
||||
$this->BdsPlacementModel->save($row);
|
||||
}
|
||||
|
||||
return $this->respond(['status' => true, 'message' => 'Data saved successfully'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_branch_id">Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_branch_id" name="client_branch_id"
|
||||
onchange="getBranchData(this)">
|
||||
onchange="getBranchData(this,1)">
|
||||
<option value="">Select Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -207,6 +207,14 @@
|
||||
placeholder="Enter Branch Code" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="contact_person_summary">Contact Person's</label>
|
||||
<select class="form-control" name="contact_person_summary" id="contact_person_summary">
|
||||
<option value="">Select a Person</option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Contact Person Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="contact_person_name" name="contact_person_name"
|
||||
@ -289,6 +297,8 @@
|
||||
</div>
|
||||
</div><!-- end form row -->
|
||||
|
||||
<?php include("newClientModal.php") ?>
|
||||
|
||||
|
||||
<script>
|
||||
let claimIndex = 1;
|
||||
@ -373,6 +383,58 @@
|
||||
// }
|
||||
}
|
||||
});
|
||||
}else if (lead_type == 3) {
|
||||
|
||||
$('#client_id').prepend($('<option>', {
|
||||
value: 'add_client',
|
||||
text: '+ Add Client'
|
||||
}));
|
||||
$("#source_policy_id").removeAttr("required");
|
||||
$("#source_policy_id").closest("div") .find("label .text-danger").remove();
|
||||
|
||||
$("#source_policy_start_date").removeAttr("required");
|
||||
$("#source_policy_start_date").closest("div") .find("label .text-danger").remove();
|
||||
|
||||
$("#source_policy_end_date").removeAttr("required");
|
||||
$("#source_policy_end_date").closest("div") .find("label .text-danger").remove();
|
||||
|
||||
|
||||
|
||||
} else if (lead_type != 3) {
|
||||
$("#source_policy_id").prop("required",true);
|
||||
$("#source_policy_start_date").prop("required", true);
|
||||
$("#source_policy_end_date").prop("required", true);
|
||||
|
||||
|
||||
// Check if the asterisk doesn't already exist, then add it
|
||||
let $label = $("#source_policy_id")
|
||||
.closest("div")
|
||||
.find("label");
|
||||
|
||||
if ($label.find(".text-danger").length === 0) {
|
||||
$label.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
let $label2 = $("#source_policy_start_date")
|
||||
.closest("div")
|
||||
.find("label");
|
||||
|
||||
if ($label2.find(".text-danger").length === 0) {
|
||||
$label2.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
let $label3 = $("#source_policy_end_date")
|
||||
.closest("div")
|
||||
.find("label");
|
||||
|
||||
if ($label3.find(".text-danger").length === 0) {
|
||||
$label3.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
|
||||
var addOption = $('#client_id option[value="add_client"]');
|
||||
if (addOption.length > 0) {
|
||||
addOption.remove();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
var policy_end_datePicker = flatpickr("#policy_end_date_" + increment, {
|
||||
@ -406,8 +468,9 @@
|
||||
$('#tpa_' + increment).select2();
|
||||
$('#proposed_insurer').select2();
|
||||
$('#proposed_tpa').select2();
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
//------------------------------ GET DATA ( EDIT, BRANCH, POLICY ) ---------------------------------------------------------------------------
|
||||
|
||||
//view and edit Lead data function
|
||||
@ -576,10 +639,15 @@
|
||||
});
|
||||
}
|
||||
|
||||
var allContacts = "";
|
||||
//client branch data
|
||||
function getBranchData(input) {
|
||||
function getBranchData(input, inputType) {
|
||||
|
||||
var client_branch_id = $(input).val();
|
||||
if (inputType == 1 ) {
|
||||
var client_branch_id = $(input).val();
|
||||
} else {
|
||||
client_branch_id = input;
|
||||
}
|
||||
|
||||
if (client_branch_id) {
|
||||
|
||||
@ -600,9 +668,29 @@
|
||||
$('#pan').val(res.data.pan);
|
||||
$('#branch_name').val(res.data.branch_name);
|
||||
$('#branch_code').val(res.data.branch_code);
|
||||
$('#contact_person_name').val(res?.contact?.name || '');
|
||||
$('#contact_person_mobile').val(res?.contact?.mobile || '');
|
||||
$('#contact_person_email').val(res?.contact?.email || '');
|
||||
allContacts = res.contact;
|
||||
$('#contact_person_summary').empty();
|
||||
$('#contact_person_summary').append($('<option>', {
|
||||
value: "",
|
||||
text: "Select a Contact"
|
||||
}));
|
||||
|
||||
res.contact.forEach((value, key) => {
|
||||
|
||||
if (value.name && value.email) {
|
||||
|
||||
let display_value = `${value.name} - ${value.email} - ${value.mobile}`;
|
||||
|
||||
$('#contact_person_summary').append($('<option>', {
|
||||
value: key, // index or key in array/object
|
||||
text: display_value
|
||||
}));
|
||||
}
|
||||
|
||||
});
|
||||
// $('#contact_person_name').val(res?.contact?.name || '');
|
||||
// $('#contact_person_mobile').val(res?.contact?.mobile || '');
|
||||
// $('#contact_person_email').val(res?.contact?.email || '');
|
||||
|
||||
|
||||
$('#pan').prop('readOnly', true);
|
||||
@ -1562,7 +1650,14 @@
|
||||
$('.freshFields').hide();
|
||||
|
||||
$('.renewalFields').show();
|
||||
$('.renewalFields').find('select, input').attr('required', 'required');
|
||||
|
||||
if (value != 3) {
|
||||
$('.renewalFields').find('select, input').attr('required', 'required');
|
||||
$("#source_policy_id").removeAttr("required");
|
||||
$("#source_policy_start_date").removeAttr("required");
|
||||
$("#source_policy_end_date").removeAttr("required");
|
||||
|
||||
}
|
||||
|
||||
// $('.proposed_div').show().find('select, input').attr('required', 'required');
|
||||
|
||||
|
||||
@ -231,6 +231,16 @@ if (isset($selected_lead_type)) {
|
||||
$('#client_id').change(function() {
|
||||
|
||||
let client_id = $(this).val();
|
||||
|
||||
|
||||
if (client_id == 'add_client') {
|
||||
// alert("Hello");
|
||||
var myModal = new bootstrap.Modal(document.getElementById('upload_enrollment_model'));
|
||||
myModal.show();
|
||||
// $('#upload_enrollment_model').modal('toggle');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("client_id", client_id)
|
||||
let client_type = $('#client_id option:selected').data('ct');
|
||||
|
||||
@ -258,6 +268,17 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
})
|
||||
|
||||
$("#contact_person_summary").change(function () {
|
||||
let selectedKey = $(this).val();
|
||||
|
||||
if (allContacts[selectedKey]) {
|
||||
$('#contact_person_name').val(allContacts[selectedKey].name || '');
|
||||
$('#contact_person_mobile').val(allContacts[selectedKey].mobile || '');
|
||||
$('#contact_person_email').val(allContacts[selectedKey].email || '');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#client_branch_id').change(function() {
|
||||
|
||||
let client_branch_id = $(this).val();
|
||||
@ -589,6 +610,39 @@ if (isset($selected_lead_type)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (lead_type == 3) {
|
||||
|
||||
$('#client_id').prepend($('<option>', {
|
||||
value: 'add_client',
|
||||
text: '+ Add Client'
|
||||
}));
|
||||
|
||||
console.log("trying to remove required ");
|
||||
$("#source_policy_id").prop("required",false);
|
||||
$("#source_policy_id").closest("div") .find("label .text-danger").remove();
|
||||
|
||||
|
||||
} else if (lead_type != 3) {
|
||||
$("#source_policy_id").prop("required",true);
|
||||
$("#source_policy_id").prop("required", true);
|
||||
|
||||
// Check if the asterisk doesn't already exist, then add it
|
||||
let $label = $("#source_policy_id")
|
||||
.closest("div")
|
||||
.find("label");
|
||||
|
||||
if ($label.find(".text-danger").length === 0) {
|
||||
$label.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
|
||||
var addOption = $('#client_id option[value="add_client"]');
|
||||
if (addOption.length > 0) {
|
||||
addOption.remove();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
hide_list_show_add();
|
||||
|
||||
$('#page_title').text('Edit Lead');
|
||||
@ -763,6 +817,42 @@ if (isset($selected_lead_type)) {
|
||||
referenceDiv.innerHTML = '';
|
||||
referenceDiv.insertAdjacentHTML('beforeend', data.claims_details_html);
|
||||
|
||||
console.log("wdesfgefwregfefwregffeegf",data.lead_type);
|
||||
var lead_type_value = data.lead_type;
|
||||
// alert(lead_type);
|
||||
if (lead_type_value == 3) {
|
||||
|
||||
$('#client_id').prepend($('<option>', {
|
||||
value: 'add_client',
|
||||
text: '+ Add Client'
|
||||
}));
|
||||
|
||||
console.log("trying to remove required ");
|
||||
$("#source_policy_id").prop("required",false);
|
||||
$("#source_policy_id").closest("div") .find("label .text-danger").remove();
|
||||
|
||||
|
||||
} else if (lead_type_value != 3) {
|
||||
$("#source_policy_id").prop("required",true);
|
||||
$("#source_policy_id").prop("required", true);
|
||||
|
||||
// Check if the asterisk doesn't already exist, then add it
|
||||
let $label = $("#source_policy_id")
|
||||
.closest("div")
|
||||
.find("label");
|
||||
|
||||
if ($label.find(".text-danger").length === 0) {
|
||||
$label.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
|
||||
var addOption = $('#client_id option[value="add_client"]');
|
||||
if (addOption.length > 0) {
|
||||
addOption.remove();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in dynamicLeadsDataForEdit function:', error);
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@
|
||||
<div class="form-group col-md-3 renewalFields" style="display: none;">
|
||||
<label for="client_branch_id">Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_branch_id" name="client_branch_id"
|
||||
onchange="getBranchData(this)">
|
||||
onchange="getBranchData(this,1)">
|
||||
<option value="">Select Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -198,6 +198,14 @@
|
||||
placeholder="Enter Branch Code" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="contact_person_summary">Contact Person's</label>
|
||||
<select class="form-control" name="contact_person_summary" id="contact_person_summary">
|
||||
<option value="">Select a Person</option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="client_branch">Contact Person Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="contact_person_name" name="contact_person_name"
|
||||
@ -359,10 +367,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include("newClientModal.php") ?>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
|
||||
var today = new Date();
|
||||
|
||||
var policy_start_datePicker = flatpickr("#policy_start_date", {
|
||||
@ -559,6 +571,40 @@
|
||||
|
||||
$('#lead_type').change(function() {
|
||||
let value = $(this).val()
|
||||
// alert(value);
|
||||
if (value == 3) {
|
||||
// alert("Function Called");
|
||||
|
||||
$('#client_id').prepend($('<option>', {
|
||||
value: 'add_client',
|
||||
text: '+ Add Client'
|
||||
}));
|
||||
|
||||
$("#source_policy_id").prop("required",false);
|
||||
$("#source_policy_id").closest("div") .find("label .text-danger").remove();
|
||||
|
||||
|
||||
} else if (value != 3) {
|
||||
$("#source_policy_id").prop("required",true);
|
||||
$("#source_policy_id").prop("required", true);
|
||||
|
||||
// Check if the asterisk doesn't already exist, then add it
|
||||
let $label = $("#source_policy_id")
|
||||
.closest("div")
|
||||
.find("label");
|
||||
|
||||
if ($label.find(".text-danger").length === 0) {
|
||||
$label.append(' <span class="text-danger">*</span>');
|
||||
}
|
||||
|
||||
var addOption = $('#client_id option[value="add_client"]');
|
||||
if (addOption.length > 0) {
|
||||
addOption.remove();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
leadTypeBsedHideAndShow(value, true)
|
||||
})
|
||||
|
||||
@ -636,10 +682,16 @@
|
||||
}
|
||||
|
||||
}
|
||||
var allContacts = "";
|
||||
function getBranchData(input,inputType) {
|
||||
|
||||
function getBranchData(input) {
|
||||
// alert("get branch Function called");
|
||||
|
||||
var client_branch_id = $(input).val();
|
||||
if (inputType == 1 ) {
|
||||
var client_branch_id = $(input).val();
|
||||
} else {
|
||||
client_branch_id = input;
|
||||
}
|
||||
|
||||
if (client_branch_id) {
|
||||
|
||||
@ -660,9 +712,30 @@
|
||||
$('#pan').val(res.data.pan);
|
||||
$('#branch_name').val(res.data.branch_name);
|
||||
$('#branch_code').val(res.data.branch_code);
|
||||
$('#contact_person_name').val(res?.contact?.name || '');
|
||||
$('#contact_person_mobile').val(res?.contact?.mobile || '');
|
||||
$('#contact_person_email').val(res?.contact?.email || '');
|
||||
|
||||
allContacts = res.contact;
|
||||
$('#contact_person_summary').empty();
|
||||
$('#contact_person_summary').append($('<option>', {
|
||||
value: "",
|
||||
text: "Select a Contact"
|
||||
}));
|
||||
|
||||
res.contact.forEach((value, key) => {
|
||||
|
||||
if (value.name && value.email) {
|
||||
|
||||
let display_value = `${value.name} - ${value.email} - ${value.mobile}`;
|
||||
|
||||
$('#contact_person_summary').append($('<option>', {
|
||||
value: key, // index or key in array/object
|
||||
text: display_value
|
||||
}));
|
||||
}
|
||||
|
||||
});
|
||||
// $('#contact_person_name').val(res?.contact?.name || '');
|
||||
// $('#contact_person_mobile').val(res?.contact?.mobile || '');
|
||||
// $('#contact_person_email').val(res?.contact?.email || '');
|
||||
|
||||
|
||||
$('#pan').prop('readOnly', true);
|
||||
|
||||
218
app/Views/newClientModal.php
Normal file
218
app/Views/newClientModal.php
Normal file
@ -0,0 +1,218 @@
|
||||
<!-- Client form content modal-->
|
||||
<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">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">Add New Client</h4>
|
||||
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body" style="overflow-y: auto;height: 90vh;">
|
||||
<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>
|
||||
<input type="text" class="form-control" id="client_name" name="client_name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="short_name">Client Short name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="short_name" name="short_name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="cost_center">PAN</label>
|
||||
<input type="text" class="form-control" id="pan" placeholder="Enter PAN No" name="pan" onchange="validateInput(this, 'clients', 'pan')">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- Client Type -->
|
||||
<div class="form-row clienttypediv" style="display: none;">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="dob">Date of Birth<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="dob" placeholder="DD/MM/YYYY" name="dob" >
|
||||
</div>
|
||||
|
||||
<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)" onchange="validateInput(this, 'clients', 'phone')">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="email2">Email<span class="text-danger">*</span></label>
|
||||
<input type="email" class="form-control" id="email2" placeholder="Enter Email" name="email2">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="aadhar">Aadhar</label>
|
||||
<input type="text" class="form-control" id="aadhar" placeholder="Enter Aadher No" name="aadhar" maxlength="12" onchange="validateInput(this, 'clients', 'aadhar')">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- branch -->
|
||||
<div class="form-row branchdiv">
|
||||
|
||||
<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_for_client" name="entity_type_id">
|
||||
<option value="" selected>Select Entity</option>
|
||||
<?php
|
||||
if (isset($entity) && count($entity)) {
|
||||
foreach ($entity as $key => $value) {
|
||||
echo "<option value=" . $value['id'] . ">" . $value['name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="client_name">Branch Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_name" name="branch_name">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branch_code">Branch Code<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_code" name="branch_code">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branch_code">Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="name" name="name">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branch_code">Mobile<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="mobile" maxlength="10" name="mobile" onkeypress="return onlyNumbers(event)">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="email">Email<span class="text-danger">*</span></label>
|
||||
<input type="email" class="form-control" id="email" placeholder="Enter Email" name="email" required>
|
||||
</div>
|
||||
|
||||
<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" 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>
|
||||
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$("#client_form").submit(function(event) {
|
||||
// alert("Function Called from Modal")
|
||||
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();
|
||||
|
||||
|
||||
$('#aadhar').attr('data-parsley-required', 'false');
|
||||
$('#aadhar').removeAttr('required');
|
||||
|
||||
|
||||
isClientFormSubmitting = true;
|
||||
var isValid = $('#client_form').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return ;
|
||||
}
|
||||
|
||||
form_action = '<?= base_url("util/createClientWithMinimalData"); ?>';
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var client_type = $('#client_type').val() || $('#Owner_type').val() || 1;
|
||||
console.log('client_type:', client_type);
|
||||
|
||||
//FORM Data
|
||||
var formData = new FormData($('#client_form')[0]);
|
||||
formData.append('client_type', client_type);
|
||||
console.log("formData : ",formData);
|
||||
// return
|
||||
$.ajax({
|
||||
data:formData,
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
console.log('create_Client_With_Minimal_Data', res)
|
||||
|
||||
if(res.status == true){
|
||||
getClientAndBranchAndPolicy(res.client_id, res.branch_id);
|
||||
|
||||
if(form_type != 1){
|
||||
|
||||
setTimeout(function(){
|
||||
$('#client_id').val(res.client_id).change();
|
||||
setTimeout(function(){
|
||||
$('#client_branch_id').val(res.branch_id).change();
|
||||
// try {
|
||||
// setTimeout(function () {(res.branch_id)},1000);
|
||||
// }catch (e) {
|
||||
// console.error('Error calling getBranchData:', e); // optional logging
|
||||
// }
|
||||
}, 1000)
|
||||
}, 2000)
|
||||
|
||||
}else{
|
||||
|
||||
toastr.error("Couldn't Add Client","Error");
|
||||
}
|
||||
|
||||
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) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -129,6 +129,18 @@
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.info-icon {
|
||||
color: #007bff;
|
||||
font-size: 15px;
|
||||
transition: 0.3s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.info-icon:hover {
|
||||
color: #0056b3;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="tab-pane fade active show" id="form">
|
||||
@ -525,7 +537,9 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="installment_data">Installment Data</label>
|
||||
<label for="installment_data">
|
||||
Installment Data <i id="infoIcon" class="fas fa-info-circle info-icon" title="Click for Installment details" style="margin-left: 5px;"></i>
|
||||
</label>
|
||||
<input id="installment_data" class="form-control" name="installment_data">
|
||||
</div>
|
||||
|
||||
@ -795,115 +809,7 @@
|
||||
</div>
|
||||
<!-- end form row -->
|
||||
|
||||
<!-- Client form content modal-->
|
||||
<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">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">Add New Client</h4>
|
||||
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body" style="overflow-y: auto;height: 90vh;">
|
||||
<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>
|
||||
<input type="text" class="form-control" id="client_name" name="client_name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="short_name">Client Short name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="short_name" name="short_name" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="cost_center">PAN</label>
|
||||
<input type="text" class="form-control" id="pan" placeholder="Enter PAN No" name="pan" onchange="validateInput(this, 'clients', 'pan')">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- Client Type -->
|
||||
<div class="form-row clienttypediv" style="display: none;">
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="dob">Date of Birth<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="dob" placeholder="DD/MM/YYYY" name="dob" >
|
||||
</div>
|
||||
|
||||
<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)" onchange="validateInput(this, 'clients', 'phone')">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="cost_center">Email<span class="text-danger">*</span></label>
|
||||
<input type="email" class="form-control" id="email" placeholder="Enter Email" name="email">
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="aadhar">Aadhar</label>
|
||||
<input type="text" class="form-control" id="aadhar" placeholder="Enter Aadher No" name="aadhar" maxlength="12" onchange="validateInput(this, 'clients', 'aadhar')">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- branch -->
|
||||
<div class="form-row branchdiv">
|
||||
|
||||
<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_for_client" name="entity_type_id">
|
||||
<option value="" selected>Select Entity</option>
|
||||
<?php
|
||||
if (isset($entity) && count($entity)) {
|
||||
foreach ($entity as $key => $value) {
|
||||
echo "<option value=" . $value['id'] . ">" . $value['name'] . "</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="client_name">Branch Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_name" name="branch_name">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branch_code">Branch Code<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_code" name="branch_code">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branch_code">Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="name" name="name">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branch_code">Mobile<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="mobile" maxlength="10" name="mobile" onkeypress="return onlyNumbers(event)">
|
||||
</div>
|
||||
|
||||
<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" 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>
|
||||
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
<?php include("newClientModal.php") ?>
|
||||
|
||||
<!-- Vehicle form content modal-->
|
||||
<div class="modal fade" id="vehicle_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" data-backdrop="static">
|
||||
@ -1041,8 +947,220 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Info Modal -->
|
||||
<div class="modal fade" id="moreInfoModal" tabindex="-1" role="dialog" aria-labelledby="fullWidthModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-xl" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="fullWidthModalLabel">More Information</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="installmentForm">
|
||||
<div id="dynamicDivFillInfo"></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
$("#infoIcon").click(function() {
|
||||
var policyTransactionPK = $('#policy_tranction_primarykey').val();
|
||||
getDataForInfo(policyTransactionPK, function(data) {
|
||||
console.log("data: ", data);
|
||||
if (data && Object.keys(data).length) {
|
||||
// openModal();
|
||||
var myModal = new bootstrap.Modal(document.getElementById('moreInfoModal'));
|
||||
myModal.show();
|
||||
|
||||
appendHtmlToModal(data.bds_data);
|
||||
} else {
|
||||
// toastr.warning("Data not Found");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function getDataForInfo (policyTransactionPK,callback) {
|
||||
// alert(policyTransactionPK)
|
||||
$.ajax({
|
||||
url: "<?= base_url('policy_tranction/getMoreInfo') ?>",
|
||||
type: "POST",
|
||||
data: {
|
||||
pt_id: policyTransactionPK
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.status) {
|
||||
console.log("Info Response: ", response);
|
||||
callback(response.data); // pass data to the callback
|
||||
} else {
|
||||
toastr.warning("No Data Found");
|
||||
callback(null);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
callback(null);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function appendHtmlToModal(data) {
|
||||
|
||||
const items = Array.isArray(data) ? data : data?.bds_data || [];
|
||||
|
||||
const container = document.getElementById('dynamicDivFillInfo');
|
||||
container.innerHTML = '';
|
||||
|
||||
if (!Array.isArray(items) || items.length === 0) {
|
||||
container.innerHTML = '<p>No data available.</p>';
|
||||
return;
|
||||
}
|
||||
|
||||
items.forEach(function(item, index) {
|
||||
// Create .row container
|
||||
const row = document.createElement('div');
|
||||
row.className = 'row mb-3';
|
||||
|
||||
// Hidden input for ID
|
||||
const hiddenId = document.createElement('input');
|
||||
hiddenId.type = 'hidden';
|
||||
hiddenId.name = `installments[${index}][id]`;
|
||||
hiddenId.value = item.id;
|
||||
row.appendChild(hiddenId);
|
||||
|
||||
// Payment Date
|
||||
const paymentCol = document.createElement('div');
|
||||
paymentCol.className = 'col-md-3';
|
||||
|
||||
// Use type="text" for flatpickr
|
||||
const paymentGroup = createEditableInputGroup('Payment Date', 'payment_date', index, '', 'text');
|
||||
paymentCol.appendChild(paymentGroup);
|
||||
row.appendChild(paymentCol);
|
||||
|
||||
// Flatpickr target
|
||||
const paymentInput = paymentGroup.querySelector('input');
|
||||
|
||||
// Convert DB date to d-m-Y (Flatpickr display format)
|
||||
if (item.payment_date) {
|
||||
|
||||
flatpickr(paymentInput, {
|
||||
dateFormat: "d-m-Y",
|
||||
defaultDate: item.payment_date,
|
||||
allowInput: true
|
||||
});
|
||||
}
|
||||
|
||||
// Installment Amount
|
||||
const amountCol = document.createElement('div');
|
||||
amountCol.className = 'col-md-3';
|
||||
amountCol.appendChild(createEditableInputGroup('Installment Amount', 'installment_amount', index, item.installment_amount, 'number'));
|
||||
row.appendChild(amountCol);
|
||||
|
||||
// UTR Number
|
||||
const utrCol = document.createElement('div');
|
||||
utrCol.className = 'col-md-3';
|
||||
utrCol.appendChild(createEditableInputGroup('UTR Number', 'utr_no', index, item.utr_no, 'text'));
|
||||
row.appendChild(utrCol);
|
||||
|
||||
container.appendChild(row);
|
||||
});
|
||||
|
||||
// Add submit button at the end
|
||||
const submitRow = document.createElement('div');
|
||||
submitRow.className = 'row';
|
||||
|
||||
const submitCol = document.createElement('div');
|
||||
submitCol.className = 'col-md-12 text-end d-flex align-items-center justify-content-end';
|
||||
|
||||
const submitBtn = document.createElement('button');
|
||||
submitBtn.type = 'submit';
|
||||
submitBtn.id = 'submitInstallments';
|
||||
submitBtn.className = 'btn btn-primary';
|
||||
submitBtn.innerText = 'Save Installments';
|
||||
|
||||
submitCol.appendChild(submitBtn);
|
||||
submitRow.appendChild(submitCol);
|
||||
container.appendChild(submitRow);
|
||||
}
|
||||
|
||||
$(document).on('click', '#submitInstallments', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const installments = [];
|
||||
|
||||
$('#dynamicDivFillInfo .row').each(function () {
|
||||
const row = $(this);
|
||||
const installment = {};
|
||||
|
||||
const id = row.find('input[name*="[id]"]').val();
|
||||
const payment_date = row.find('input[name*="[payment_date]"]').val();
|
||||
const installment_amount = row.find('input[name*="[installment_amount]"]').val();
|
||||
const utr_no = row.find('input[name*="[utr_no]"]').val();
|
||||
|
||||
// Ignore empty rows
|
||||
if (payment_date && installment_amount && utr_no) {
|
||||
installment.id = id;
|
||||
installment.payment_date = payment_date;
|
||||
installment.installment_amount = installment_amount;
|
||||
installment.utr_no = utr_no;
|
||||
installments.push(installment);
|
||||
}
|
||||
});
|
||||
|
||||
if (installments.length === 0) {
|
||||
toastr.warning("No valid installment data to save.");
|
||||
return;
|
||||
}
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: "<?= base_url('policy_tranction/saveInstallment') ?>",
|
||||
type: "POST",
|
||||
data: { installments },
|
||||
success: function (response) {
|
||||
if (response.status) {
|
||||
toastr.success("Installments saved successfully!");
|
||||
$('#moreInfoModal').modal('hide');
|
||||
} else {
|
||||
toastr.error(response.message || "Save failed.");
|
||||
}
|
||||
},
|
||||
error: function (xhr) {
|
||||
console.error(xhr.responseText);
|
||||
toastr.error("Server error.");
|
||||
}
|
||||
});
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
});
|
||||
|
||||
function createEditableInputGroup(labelText, fieldName, index, value, type) {
|
||||
var group = document.createElement('div');
|
||||
group.className = 'form-group mb-2';
|
||||
|
||||
var label = document.createElement('label');
|
||||
label.innerText = labelText;
|
||||
|
||||
var input = document.createElement('input');
|
||||
input.type = type;
|
||||
input.className = 'form-control';
|
||||
input.name = `installments[${index}][${fieldName}]`;
|
||||
input.value = value;
|
||||
|
||||
group.appendChild(label);
|
||||
group.appendChild(input);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
|
||||
var team_id = [];
|
||||
let isClientFormSubmitting = false;
|
||||
var insurer_count_array = [];
|
||||
@ -3155,108 +3273,108 @@ $("#inception_form_id").submit(function(event) {
|
||||
});
|
||||
});
|
||||
|
||||
$("#client_form").submit(function(event) {
|
||||
// $("#client_form").submit(function(event) {
|
||||
|
||||
let form_type = $(this).data('id') || 0;
|
||||
// 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());
|
||||
// console.log('onsubmit event', this)
|
||||
// console.log('onsubmit event get data value',form_type)
|
||||
// console.log('client_type', $('#client_type').val());
|
||||
|
||||
event.preventDefault();
|
||||
// event.preventDefault();
|
||||
|
||||
|
||||
$('#aadhar').attr('data-parsley-required', 'false');
|
||||
$('#aadhar').removeAttr('required');
|
||||
// $('#aadhar').attr('data-parsley-required', 'false');
|
||||
// $('#aadhar').removeAttr('required');
|
||||
|
||||
|
||||
isClientFormSubmitting = true;
|
||||
var isValid = $('#client_form').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return ;
|
||||
}
|
||||
// isClientFormSubmitting = true;
|
||||
// var isValid = $('#client_form').parsley().validate();
|
||||
// if (!isValid) {
|
||||
// console.log('Form is Empty', 'Warning');
|
||||
// return ;
|
||||
// }
|
||||
|
||||
form_action = '<?= base_url("util/createClientWithMinimalData"); ?>';
|
||||
// form_action = '<?= base_url("util/createClientWithMinimalData"); ?>';
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
// $('.loader').fadeIn();
|
||||
// $('.loader-mask').fadeIn();
|
||||
|
||||
var client_type = $('#client_type').val() || $('#Owner_type').val();
|
||||
console.log('client_type:', client_type);
|
||||
// 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);
|
||||
// //FORM Data
|
||||
// var formData = new FormData($('#client_form')[0]);
|
||||
// formData.append('client_type', client_type);
|
||||
|
||||
$.ajax({
|
||||
data:formData,
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
// $.ajax({
|
||||
// data:formData,
|
||||
// url: form_action,
|
||||
// type: "POST",
|
||||
// dataType: 'json',
|
||||
// processData: false,
|
||||
// contentType: false,
|
||||
// success: function(res) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
console.log('create_Client_With_Minimal_Data', res)
|
||||
// console.log('create_Client_With_Minimal_Data', res)
|
||||
|
||||
if(res.status == true){
|
||||
getClientAndBranchAndPolicy(res.client_id, res.branch_id);
|
||||
// if(res.status == true){
|
||||
// getClientAndBranchAndPolicy(res.client_id, res.branch_id);
|
||||
|
||||
if(form_type != 1){
|
||||
// if(form_type != 1){
|
||||
|
||||
setTimeout(function(){
|
||||
$('#client_id').val(res.client_id).change();
|
||||
setTimeout(function(){
|
||||
$('#client_branch_id').val(res.branch_id).change();
|
||||
}, 1000)
|
||||
}, 2000)
|
||||
// setTimeout(function(){
|
||||
// $('#client_id').val(res.client_id).change();
|
||||
// setTimeout(function(){
|
||||
// $('#client_branch_id').val(res.branch_id).change();
|
||||
// }, 1000)
|
||||
// }, 2000)
|
||||
|
||||
}else{
|
||||
// }else{
|
||||
|
||||
setTimeout(function(){
|
||||
$('#owner').val(res.client_id).change();
|
||||
$('#owner_branch').val(res.branch_id).change();
|
||||
// setTimeout(function(){
|
||||
// $('#owner').val(res.client_id).change();
|
||||
// $('#owner_branch').val(res.branch_id).change();
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
}, 2000)
|
||||
}
|
||||
// }, 2000)
|
||||
// }
|
||||
|
||||
toastr.success(res.message, 'Success');
|
||||
// toastr.success(res.message, 'Success');
|
||||
|
||||
}else{
|
||||
toastr.error(res.message, 'Error');
|
||||
}
|
||||
// }else{
|
||||
// toastr.error(res.message, 'Error');
|
||||
// }
|
||||
|
||||
$('#client_form')[0].reset();
|
||||
$('.close').click();
|
||||
// $('#client_form')[0].reset();
|
||||
// $('.close').click();
|
||||
|
||||
if(form_type == 1){
|
||||
// if(form_type == 1){
|
||||
|
||||
var myModal = new bootstrap.Modal(document.getElementById('vehicle_modal'));
|
||||
myModal.show();
|
||||
// var myModal = new bootstrap.Modal(document.getElementById('vehicle_modal'));
|
||||
// myModal.show();
|
||||
|
||||
$('#client_form').removeAttr('data-id');
|
||||
// $('#client_form').removeAttr('data-id');
|
||||
|
||||
// Load form data into #vehicle_form from localStorage
|
||||
setFormDataFromLocalStorage("#vehicle_form", "vehicleFormData");
|
||||
}
|
||||
// // Load form data into #vehicle_form from localStorage
|
||||
// setFormDataFromLocalStorage("#vehicle_form", "vehicleFormData");
|
||||
// }
|
||||
|
||||
isClientFormSubmitting = false;
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
// isClientFormSubmitting = false;
|
||||
// },
|
||||
// error: function (xhr, status, error) {
|
||||
// console.error(xhr.responseText);
|
||||
// console.error(status, error);
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(350).fadeOut('slow');
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
$("#vehicle_form").submit(function(event) {
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user