Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
6d4366e60a
@ -241,8 +241,12 @@ class LeadsController extends BaseController
|
||||
$form_file_name = "file_name_" . $index_plus_one;
|
||||
$form_docs_name = "docs_name_" . $index_plus_one;
|
||||
$leads_file_primary_key = $data['leads_file_id'] ?? [];
|
||||
$files = $this->request->getFileMultiple($form_file_name);
|
||||
$multi_file_data = $this->uploadMultiFiles($files, $data[$form_docs_name], $leads_file_primary_key);
|
||||
|
||||
$multi_file_data = [];
|
||||
if(isset($data[$form_docs_name])){
|
||||
$files = $this->request->getFileMultiple($form_file_name);
|
||||
$multi_file_data = $this->uploadMultiFiles($files, $data[$form_docs_name], $leads_file_primary_key);
|
||||
}
|
||||
|
||||
// Separate the insurer and insurer branch, handle missing or invalid data
|
||||
if (isset($data['insurer']) && strpos($data['insurer'], '-') !== false) {
|
||||
@ -677,7 +681,9 @@ class LeadsController extends BaseController
|
||||
|
||||
if ($lead_data['lead_type'] != 1) {
|
||||
$client_policy_data = $this->clientPolicyModel->where('is_active', 1)->where('id', $lead_data['source_policy_id'])->first();
|
||||
$data['policy_terms'] = $client_policy_data['policy_terms'];
|
||||
if (isset($client_policy_data)) {
|
||||
$data['policy_terms'] = $client_policy_data['policy_terms'];
|
||||
}
|
||||
}
|
||||
|
||||
$data['question_json'] = $lead_data['question_json'];
|
||||
@ -736,7 +742,10 @@ class LeadsController extends BaseController
|
||||
|
||||
if ($lead_data['lead_type'] != 1 && $data['rfq_count'] == 0) {
|
||||
$client_policy_data = $this->clientPolicyModel->where('is_active', 1)->where('id', $lead_data['source_policy_id'])->first();
|
||||
$data['rfq_data']['json'] = $client_policy_data['placement_json'];
|
||||
if (isset($client_policy_data)) {
|
||||
|
||||
$data['rfq_data']['json'] = $client_policy_data['placement_json'];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($data['question_json'])) {
|
||||
|
||||
@ -292,6 +292,7 @@ if (isset($selected_lead_type)) {
|
||||
} else {
|
||||
$('#source_policy_id').empty();
|
||||
|
||||
// let lead_type = data.lead_type || null;
|
||||
if (temp_branch_id == 0) {
|
||||
console.log("Step 1: temp_branch_id is 0 - No Policies Found for the selected branch");
|
||||
console.log('second client_branch_id', client_branch_id);
|
||||
@ -301,11 +302,17 @@ if (isset($selected_lead_type)) {
|
||||
} else {
|
||||
console.log("Step 3: v exists - Assigning temp_branch_id = client_branch_id");
|
||||
temp_branch_id = client_id;
|
||||
toastr.warning("No Policies Found for the selected Branch", 'Warning');
|
||||
if (lead_type != 3) {
|
||||
|
||||
toastr.warning("No Policies Found for the selected Branch", 'Warning');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log("Step 4: temp_branch_id is not 0 - Showing warning");
|
||||
toastr.warning("No Policies Found for the selected Branch", 'Warning');
|
||||
if (lead_type != 3) {
|
||||
|
||||
toastr.warning("No Policies Found for the selected Branch", 'Warning');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,24 +338,24 @@ if (isset($selected_lead_type)) {
|
||||
$('#salse_person_id').trigger('change');
|
||||
}
|
||||
|
||||
function validateInput(input, table, field){
|
||||
// function validateInput(input, table, field){
|
||||
|
||||
let value = $(input).val();
|
||||
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
|
||||
// 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!";
|
||||
}
|
||||
// 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('')
|
||||
}
|
||||
});
|
||||
// checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) {
|
||||
// if (isDuplicate) {
|
||||
// toastr.warning(message, 'WARNING');
|
||||
// $(input).val('')
|
||||
// }
|
||||
// });
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -485,6 +492,8 @@ if (isset($selected_lead_type)) {
|
||||
<?php if (isset($lead_edit_data)) { ?>
|
||||
<script>
|
||||
|
||||
var lead_type = "";
|
||||
|
||||
$(document).ready(async function () {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
@ -502,6 +511,7 @@ if (isset($selected_lead_type)) {
|
||||
});
|
||||
|
||||
function handleEbAndNonEbEdit(data){
|
||||
lead_type = data.lead_type || null;
|
||||
if(data.lead_form_type == 1){
|
||||
dynamicLeadsDataForEdit(data)
|
||||
}else{
|
||||
@ -610,38 +620,39 @@ if (isset($selected_lead_type)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (lead_type == 3) {
|
||||
// if (lead_type == 3) {
|
||||
|
||||
$('#client_id').prepend($('<option>', {
|
||||
value: 'add_client',
|
||||
text: '+ Add Client'
|
||||
}));
|
||||
// $('#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();
|
||||
// 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);
|
||||
// } 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");
|
||||
// // 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>');
|
||||
}
|
||||
// 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();
|
||||
}
|
||||
// var addOption = $('#client_id option[value="add_client"]');
|
||||
// if (addOption.length > 0) {
|
||||
// addOption.remove();
|
||||
// }
|
||||
|
||||
// console.log("rying to remove required and option removed from client")
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
hide_list_show_add();
|
||||
|
||||
@ -657,27 +668,33 @@ if (isset($selected_lead_type)) {
|
||||
$('#lead_status').val(data.status || '');
|
||||
$('#notes').val(data.notes || '');
|
||||
|
||||
setTimeout(() => {
|
||||
$('#client_id').val(data.client_id || '').change();
|
||||
setTimeout(() => {
|
||||
$('#client_branch_id').val(data.client_branch_id || '').change();
|
||||
setTimeout(() => {
|
||||
$('#source_policy_id').val(data.source_policy_id || '');
|
||||
$('#source_policy_end_date').val(data.source_policy_end_date || '');
|
||||
$('#source_policy_start_date').val(data.source_policy_start_date || '');
|
||||
$('#pan').val(data.pan || '');
|
||||
$('#gst').val(data.gst || '');
|
||||
$('#branch_name').val(data.branch_name || '');
|
||||
$('#branch_code').val(data.branch_code || '');
|
||||
$('#contact_person_name').val(data.contact_person_name || '');
|
||||
$('#contact_person_mobile').val(data.contact_person_mobile || '');
|
||||
$('#contact_person_email').val(data.contact_person_email || '');
|
||||
$('#policy_type_id_1').val(data.policy_type_id || '').select2();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 5000);
|
||||
// setTimeout(() => {
|
||||
// $('#client_id').val(data.client_id || '').change();
|
||||
// setTimeout(() => {
|
||||
// $('#client_branch_id').val(data.client_branch_id || '').change();
|
||||
// setTimeout(() => {
|
||||
// $('#source_policy_id').val(data.source_policy_id || '');
|
||||
// $('#source_policy_end_date').val(data.source_policy_end_date || '');
|
||||
// $('#source_policy_start_date').val(data.source_policy_start_date || '');
|
||||
// $('#pan').val(data.pan || '');
|
||||
// $('#gst').val(data.gst || '');
|
||||
// $('#branch_name').val(data.branch_name || '');
|
||||
// $('#branch_code').val(data.branch_code || '');
|
||||
// $('#contact_person_name').val(data.contact_person_name || '');
|
||||
// $('#contact_person_mobile').val(data.contact_person_mobile || '');
|
||||
// $('#contact_person_email').val(data.contact_person_email || '');
|
||||
// $('#policy_type_id_1').val(data.policy_type_id || '').select2();
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(350).fadeOut('slow');
|
||||
// }, 1000);
|
||||
// }, 1000);
|
||||
// }, 5000);
|
||||
|
||||
// setTimeout(() => {
|
||||
populateForm(data);
|
||||
|
||||
// },5000);
|
||||
|
||||
|
||||
let insurer = (data.insurer_branch_id && data.insurer_id)
|
||||
? `${data.insurer_branch_id}-${data.insurer_id}`
|
||||
@ -732,10 +749,10 @@ if (isset($selected_lead_type)) {
|
||||
}
|
||||
|
||||
if (data.multi_file_html) {
|
||||
console.log(data.multi_file_html);
|
||||
// console.log(data.multi_file_html);
|
||||
setTimeout(function(){
|
||||
$('#multiFileAppendArea_' + dataIncrement).append(data.multi_file_html);
|
||||
}, 2000)
|
||||
}, 1000)
|
||||
} else {
|
||||
console.warn('MULTI FILE HTML content missing in data.');
|
||||
}
|
||||
@ -764,30 +781,33 @@ if (isset($selected_lead_type)) {
|
||||
$('#lead_status').val(data.status || '');
|
||||
$('#notes').val(data.notes || '');
|
||||
|
||||
setTimeout(() => {
|
||||
$('#client_id').val(data.client_id || '').change();
|
||||
setTimeout(() => {
|
||||
$('#client_branch_id').val(data.client_branch_id || '').change();
|
||||
setTimeout(() => {
|
||||
$('#source_policy_id').val(data.source_policy_id || '');
|
||||
$('#pan').val(data.pan || '');
|
||||
$('#gst').val(data.gst || '');
|
||||
$('#branch_name').val(data.branch_name || '');
|
||||
$('#branch_code').val(data.branch_code || '');
|
||||
$('#contact_person_name').val(data.contact_person_name || '');
|
||||
$('#contact_person_mobile').val(data.contact_person_mobile || '');
|
||||
$('#contact_person_email').val(data.contact_person_email || '');
|
||||
$('#policy_type_id').val(data.policy_type_id || '').select2();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$(".loss_date").each(function () {
|
||||
flatpickr(this, {
|
||||
dateFormat: "d-m-Y",
|
||||
});
|
||||
});
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
}, 2000);
|
||||
// setTimeout(() => {
|
||||
// $('#client_id').val(data.client_id || '').change();
|
||||
// setTimeout(() => {
|
||||
// $('#client_branch_id').val(data.client_branch_id || '').change();
|
||||
// setTimeout(() => {
|
||||
// $('#source_policy_id').val(data.source_policy_id || '');
|
||||
// $('#pan').val(data.pan || '');
|
||||
// $('#gst').val(data.gst || '');
|
||||
// $('#branch_name').val(data.branch_name || '');
|
||||
// $('#branch_code').val(data.branch_code || '');
|
||||
// $('#contact_person_name').val(data.contact_person_name || '');
|
||||
// $('#contact_person_mobile').val(data.contact_person_mobile || '');
|
||||
// $('#contact_person_email').val(data.contact_person_email || '');
|
||||
// $('#policy_type_id').val(data.policy_type_id || '').select2();
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(350).fadeOut('slow');
|
||||
// $(".loss_date").each(function () {
|
||||
// flatpickr(this, {
|
||||
// dateFormat: "d-m-Y",
|
||||
// });
|
||||
// });
|
||||
// }, 1000);
|
||||
// }, 1000);
|
||||
// }, 2000);
|
||||
|
||||
populateForm(data);
|
||||
|
||||
|
||||
let insurer = (data.insurer_branch_id && data.insurer_id)
|
||||
? `${data.insurer_branch_id}-${data.insurer_id}`
|
||||
@ -819,8 +839,35 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
console.log("wdesfgefwregfefwregffeegf",data.lead_type);
|
||||
var lead_type_value = data.lead_type;
|
||||
// alert(lead_type);
|
||||
if (lead_type_value == 3) {
|
||||
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in dynamicLeadsDataForEdit function:', error);
|
||||
}
|
||||
}
|
||||
|
||||
function waitForDropdownValue(selector, value, callback, retries = 20) {
|
||||
const trySet = () => {
|
||||
const $el = $(selector);
|
||||
if ($el.find(`option[value="${value}"]`).length > 0) {
|
||||
$el.val(value).trigger('change');
|
||||
callback();
|
||||
} else if (retries > 0) {
|
||||
setTimeout(() => trySet(selector, value, callback, retries - 1), 300);
|
||||
} else {
|
||||
console.warn(`Value ${value} not found for ${selector}`);
|
||||
callback(); // Proceed anyway to avoid hanging
|
||||
}
|
||||
};
|
||||
trySet();
|
||||
}
|
||||
|
||||
function populateForm(data) {
|
||||
|
||||
let lead_type = data.lead_type || null;
|
||||
waitForDropdownValue('#client_id', data.client_id || '', () => {
|
||||
if (lead_type == 3) {
|
||||
|
||||
$('#client_id').prepend($('<option>', {
|
||||
value: 'add_client',
|
||||
@ -832,7 +879,7 @@ if (isset($selected_lead_type)) {
|
||||
$("#source_policy_id").closest("div") .find("label .text-danger").remove();
|
||||
|
||||
|
||||
} else if (lead_type_value != 3) {
|
||||
} else if (lead_type != 3) {
|
||||
$("#source_policy_id").prop("required",true);
|
||||
$("#source_policy_id").prop("required", true);
|
||||
|
||||
@ -850,13 +897,36 @@ if (isset($selected_lead_type)) {
|
||||
addOption.remove();
|
||||
}
|
||||
|
||||
console.log("rying to remove required and option removed from client")
|
||||
|
||||
}
|
||||
waitForDropdownValue('#client_branch_id', data.client_branch_id || '', () => {
|
||||
// Fill other fields once both dropdowns are ready
|
||||
$('#source_policy_id').val(data.source_policy_id || '');
|
||||
$('#source_policy_end_date').val(data.source_policy_end_date || '');
|
||||
$('#source_policy_start_date').val(data.source_policy_start_date || '');
|
||||
$('#pan').val(data.pan || '');
|
||||
$('#gst').val(data.gst || '');
|
||||
$('#branch_name').val(data.branch_name || '');
|
||||
$('#branch_code').val(data.branch_code || '');
|
||||
$('#contact_person_name').val(data.contact_person_name || '');
|
||||
$('#contact_person_mobile').val(data.contact_person_mobile || '');
|
||||
$('#contact_person_email').val(data.contact_person_email || '');
|
||||
$('#policy_type_id').val(data.policy_type_id || '').select2();
|
||||
$('#policy_type_id_1').val(data.policy_type_id || '').select2();
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error in dynamicLeadsDataForEdit function:', error);
|
||||
}
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$(".loss_date").each(function () {
|
||||
flatpickr(this, {
|
||||
dateFormat: "d-m-Y",
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
@ -661,6 +661,13 @@
|
||||
$('.renewalFields').show();
|
||||
$('.renewalFields').find('select, input').attr('required', 'required');
|
||||
|
||||
if (value == 3) {
|
||||
$("#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');
|
||||
|
||||
$('#policy_end_date').removeAttr('required');
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
<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')">
|
||||
<input type="text" class="form-control" id="pan" placeholder="Enter PAN No" name="pan" onchange="validateInputForClient(this, 'clients', 'pan')">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -39,7 +39,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)" onchange="validateInput(this, 'clients', 'phone')">
|
||||
onkeypress="return onlyNumbers(event)" onchange="validateInputForClient(this, 'clients', 'phone')">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
@ -48,7 +48,7 @@
|
||||
</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')">
|
||||
<input type="text" class="form-control" id="aadhar" placeholder="Enter Aadher No" name="aadhar" maxlength="12" onchange="validateInputForClient(this, 'clients', 'aadhar')">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -96,7 +96,7 @@
|
||||
|
||||
<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')"
|
||||
<input type="text" class="form-control" id="gst" placeholder="Enter GST Number" oninput="validateInputForClient(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>
|
||||
|
||||
@ -113,8 +113,52 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let isGSTValidating = false;
|
||||
let isGSTValid = false;
|
||||
|
||||
function validateInputForClient(input, table, field) {
|
||||
let value = $(input).val();
|
||||
if (!value) return;
|
||||
|
||||
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
|
||||
let message = label ? label + " already exists!" : "Value is duplicate!";
|
||||
|
||||
// Set validating state
|
||||
isGSTValidating = true;
|
||||
isGSTValid = false;
|
||||
$('#hide_smbt_btn button').prop('disabled', true);
|
||||
|
||||
checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) {
|
||||
isGSTValidating = false;
|
||||
if (isDuplicate) {
|
||||
toastr.warning(message, 'WARNING');
|
||||
$(input).val('');
|
||||
isGSTValid = false;
|
||||
} else {
|
||||
isGSTValid = true;
|
||||
}
|
||||
});
|
||||
$('#hide_smbt_btn button').prop('disabled', false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$("#client_form").submit(function(event) {
|
||||
// alert("Function Called from Modal")
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
// If GST is currently validating, wait for it to complete
|
||||
if (isGSTValidating) {
|
||||
toastr.info('Please wait while we validate your GST number...', 'Validating');
|
||||
return;
|
||||
}
|
||||
|
||||
// If GST validation failed, prevent submission
|
||||
if ($('#gst').val() && !isGSTValid) {
|
||||
toastr.warning('Please fix the GST number before submitting', 'Validation Error');
|
||||
return;
|
||||
}
|
||||
|
||||
let form_type = $(this).data('id') || 0;
|
||||
|
||||
console.log('onsubmit event', this)
|
||||
@ -127,14 +171,30 @@
|
||||
$('#aadhar').attr('data-parsley-required', 'false');
|
||||
$('#aadhar').removeAttr('required');
|
||||
|
||||
if($('#Owner_type').val() == 2){
|
||||
$('#gst').removeAttr('required');
|
||||
}
|
||||
|
||||
|
||||
isClientFormSubmitting = true;
|
||||
var isValid = $('#client_form').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return ;
|
||||
|
||||
if (!isValid) {
|
||||
var emptyFieldIds = [];
|
||||
|
||||
$('#client_form').parsley().fields.forEach(function(field) {
|
||||
if (!field.isValid()) {
|
||||
var elem = field.$element;
|
||||
var id = elem.attr('id') || elem.attr('name');
|
||||
emptyFieldIds.push(id);
|
||||
}
|
||||
});
|
||||
|
||||
console.log('Empty/Invalid Fields:', emptyFieldIds);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
form_action = '<?= base_url("util/createClientWithMinimalData"); ?>';
|
||||
|
||||
$('.loader').fadeIn();
|
||||
@ -169,6 +229,10 @@
|
||||
|
||||
setTimeout(function(){
|
||||
$('#client_id').val(res.client_id).change();
|
||||
$('#client_id').prepend($('<option>', {
|
||||
value: 'add_client',
|
||||
text: '+ Add Client'
|
||||
}));
|
||||
setTimeout(function(){
|
||||
$('#client_branch_id').val(res.branch_id).change();
|
||||
// try {
|
||||
@ -181,7 +245,7 @@
|
||||
|
||||
}else{
|
||||
|
||||
toastr.error("Couldn't Add Client","Error");
|
||||
console.log("Couldn't Add Client","Error");
|
||||
}
|
||||
|
||||
toastr.success(res.message, 'Success');
|
||||
@ -201,7 +265,16 @@
|
||||
$('#client_form').removeAttr('data-id');
|
||||
|
||||
// Load form data into #vehicle_form from localStorage
|
||||
setFormDataFromLocalStorage("#vehicle_form", "vehicleFormData");
|
||||
setFormDataFromLocalStorage("#vehicle_form", "vehicleFormData", res.client_id);
|
||||
|
||||
setTimeout(function(){
|
||||
$('#owner').val(res.client_id).change();
|
||||
$('#owner_branch').val(res.branch_id).change();
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
isClientFormSubmitting = false;
|
||||
|
||||
@ -446,7 +446,7 @@
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
|
||||
<label for="is_cd_reduce_from_bds" style="position: relative;top: 33px;left: 25px;"> Make Entry in CD <i class="fa fa-info-circle" data-toggle="tooltip" title="Enabling this will affect ( Credit/Debit ) the CD transaction. ( GMC, GPA, EDLI and GTLI, CD transaction from CRM )"></i>
|
||||
<label for="is_cd_reduce_from_bds" style="position: relative;top: 33px;left: 25px;"> Make Entry in CD <i class="fa fa-info-circle info-icon" data-toggle="tooltip" title="Enabling this will affect ( Credit/Debit ) the CD transaction. ( GMC, GPA, EDLI and GTLI, CD transaction from CRM )"></i>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@ -532,13 +532,13 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="installment">Installment</label>
|
||||
<label for="installment">Installment <i id="infoIcon" class="fas fa-info-circle info-icon" data-toggle="tooltip" title="Click for Installment details" style="margin-left: 5px;"></i></label>
|
||||
<input id="installment" value="" type="text" class="form-control" name="installment">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<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>
|
||||
Installment Data
|
||||
</label>
|
||||
<input id="installment_data" class="form-control" name="installment_data">
|
||||
</div>
|
||||
@ -1315,10 +1315,12 @@ $(document).ready(function(){
|
||||
$('#name').prop('required', false);
|
||||
$('#mobile').prop('required', false);
|
||||
$('#gst').prop('required', false);
|
||||
$('#email').prop('required', false);
|
||||
|
||||
|
||||
$('#dob').prop('required', true);
|
||||
$('#phone').prop('required', true);
|
||||
$('#email').prop('required', true);
|
||||
$('#email2').prop('required', true);
|
||||
$('#aadhar').prop('required', true);
|
||||
|
||||
} else {
|
||||
@ -1332,10 +1334,11 @@ $(document).ready(function(){
|
||||
$('#name').prop('required', true);
|
||||
$('#mobile').prop('required', true);
|
||||
$('#gst').prop('required', true);
|
||||
$('#email').prop('required', true);
|
||||
|
||||
$('#dob').prop('required', false);
|
||||
$('#phone').prop('required', false);
|
||||
$('#email').prop('required', false);
|
||||
$('#email2').prop('required', false);
|
||||
$('#aadhar').prop('required', false);
|
||||
|
||||
}
|
||||
|
||||
@ -1,50 +1,67 @@
|
||||
<?php
|
||||
$fileIndex = 1; // Initialize index
|
||||
$increment = 1; // Example increment value
|
||||
$fileIndex = 1;
|
||||
$increment = 1;
|
||||
?>
|
||||
|
||||
<?php if (isset($lead_edit_data) && isset($lead_edit_data["multi_file_data"]) && !empty($lead_edit_data["multi_file_data"])) {
|
||||
<?php if (isset($lead_edit_data) && isset($lead_edit_data["multi_file_data"]) && !empty($lead_edit_data["multi_file_data"])) {
|
||||
foreach ($lead_edit_data["multi_file_data"] as $index => $value) {
|
||||
$isFirstField = ($index === 0); // First file must be Demography
|
||||
$isFirstField = ($index === 0);
|
||||
$placeholder = $isFirstField ? 'First file must be Demography.' : '';
|
||||
$accept = $isFirstField ? '.xls,.xlsx' : '';
|
||||
$index = $index + 1;
|
||||
$displayIndex = $index + 1;
|
||||
?>
|
||||
|
||||
<div class="form-row d-flex align-items-end" id="fileField_<?= $index ?>">
|
||||
<div class="form-row d-flex align-items-end" id="fileField_<?= $displayIndex ?>">
|
||||
<input type="hidden" name="leads_file_id[]" value="<?= htmlspecialchars($value['id']) ?>" id="file_id_<?= $displayIndex ?>">
|
||||
|
||||
<input type="hidden" name="leads_file_id[]"
|
||||
value="<?= htmlspecialchars($value['id']) ?>" id="file_id_<?= $index ?>">
|
||||
|
||||
<!-- Document Name Input -->
|
||||
<div class="form-group col-md-5">
|
||||
<label>Document Name<span class="text-danger"></span></label>
|
||||
<label>Document Name</label>
|
||||
<input type="text" class="form-control" name="docs_name_<?= $increment ?>[]"
|
||||
placeholder="<?= $placeholder ?>"
|
||||
value="<?= htmlspecialchars($value['docs_name']) ?>" id="docs_name_<?= $index ?>">
|
||||
value="<?= htmlspecialchars($value['docs_name']) ?>" id="docs_name_<?= $displayIndex ?>">
|
||||
</div>
|
||||
|
||||
<!-- File Upload Input -->
|
||||
<div class="form-group col-md-5">
|
||||
<label>
|
||||
File Upload
|
||||
<span class="text-danger"></span><br>
|
||||
<small id="file_name_display_<?= $index ?>" class="text-muted">
|
||||
File Upload<br>
|
||||
<small id="file_name_display_<?= $displayIndex ?>" class="text-muted">
|
||||
<?= !empty($value['file_name']) ? htmlspecialchars($value['file_name']) : 'No file chosen' ?>
|
||||
</small>
|
||||
</label>
|
||||
|
||||
<input type="file" class="form-control" id="file_name_<?= $index ?>"
|
||||
<input type="file" class="form-control" id="file_name_<?= $displayIndex ?>"
|
||||
name="file_name_<?= $increment ?>[]" accept="<?= $accept ?>"
|
||||
onchange="showFileName(this, <?= $index ?>)">
|
||||
onchange="showFileName(this, <?= $displayIndex ?>)">
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Add/Remove Buttons -->
|
||||
<div class="col-md-2" style="position: relative; bottom: 16px;">
|
||||
<button type="button" class="btn btn-danger" onclick="removeFileField(<?= $index ?>, <?= htmlspecialchars($value['id']) ?>)">x</button>
|
||||
<button type="button" class="btn btn-danger" onclick="removeFileField(<?= $displayIndex ?>, <?= htmlspecialchars($value['id']) ?>)">x</button>
|
||||
<button type="button" class="btn btn-primary" onclick="addFileField(<?= $increment ?>)">+</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } } ?>
|
||||
<?php } } else { ?>
|
||||
<!-- Default field if no file data exists -->
|
||||
<div class="form-row d-flex align-items-end" id="fileField_1">
|
||||
<input type="hidden" name="leads_file_id[]" value="">
|
||||
|
||||
<div class="form-group col-md-5">
|
||||
<label>Document Name</label>
|
||||
<input type="text" class="form-control" name="docs_name_1[]"
|
||||
placeholder="First file must be Demography." id="docs_name_1">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-5">
|
||||
<label>
|
||||
File Upload<br>
|
||||
<small id="file_name_display_1" class="text-muted">No file chosen</small>
|
||||
</label>
|
||||
<input type="file" class="form-control" id="file_name_1"
|
||||
name="file_name_1[]" accept=".xls,.xlsx" onchange="showFileName(this, 1)">
|
||||
</div>
|
||||
|
||||
<div class="col-md-2" style="position: relative; bottom: 16px;">
|
||||
<button type="button" class="btn btn-danger" onclick="removeFileField(1, '')">x</button>
|
||||
<button type="button" class="btn btn-primary" onclick="addFileField(1)">+</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user