FIX_ADD_CLIENT : RV
This commit is contained in:
parent
65b405d3e4
commit
d5e6037c0e
@ -171,14 +171,30 @@
|
|||||||
$('#aadhar').attr('data-parsley-required', 'false');
|
$('#aadhar').attr('data-parsley-required', 'false');
|
||||||
$('#aadhar').removeAttr('required');
|
$('#aadhar').removeAttr('required');
|
||||||
|
|
||||||
|
if($('#Owner_type').val() == 2){
|
||||||
|
$('#gst').removeAttr('required');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
isClientFormSubmitting = true;
|
isClientFormSubmitting = true;
|
||||||
var isValid = $('#client_form').parsley().validate();
|
var isValid = $('#client_form').parsley().validate();
|
||||||
|
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
console.log('Form is Empty', 'Warning');
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
form_action = '<?= base_url("util/createClientWithMinimalData"); ?>';
|
form_action = '<?= base_url("util/createClientWithMinimalData"); ?>';
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
@ -229,7 +245,7 @@
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
toastr.error("Couldn't Add Client","Error");
|
console.log("Couldn't Add Client","Error");
|
||||||
}
|
}
|
||||||
|
|
||||||
toastr.success(res.message, 'Success');
|
toastr.success(res.message, 'Success');
|
||||||
@ -249,7 +265,16 @@
|
|||||||
$('#client_form').removeAttr('data-id');
|
$('#client_form').removeAttr('data-id');
|
||||||
|
|
||||||
// Load form data into #vehicle_form from localStorage
|
// 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;
|
isClientFormSubmitting = false;
|
||||||
|
|||||||
@ -1315,10 +1315,12 @@ $(document).ready(function(){
|
|||||||
$('#name').prop('required', false);
|
$('#name').prop('required', false);
|
||||||
$('#mobile').prop('required', false);
|
$('#mobile').prop('required', false);
|
||||||
$('#gst').prop('required', false);
|
$('#gst').prop('required', false);
|
||||||
|
$('#email').prop('required', false);
|
||||||
|
|
||||||
|
|
||||||
$('#dob').prop('required', true);
|
$('#dob').prop('required', true);
|
||||||
$('#phone').prop('required', true);
|
$('#phone').prop('required', true);
|
||||||
$('#email').prop('required', true);
|
$('#email2').prop('required', true);
|
||||||
$('#aadhar').prop('required', true);
|
$('#aadhar').prop('required', true);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -1332,10 +1334,11 @@ $(document).ready(function(){
|
|||||||
$('#name').prop('required', true);
|
$('#name').prop('required', true);
|
||||||
$('#mobile').prop('required', true);
|
$('#mobile').prop('required', true);
|
||||||
$('#gst').prop('required', true);
|
$('#gst').prop('required', true);
|
||||||
|
$('#email').prop('required', true);
|
||||||
|
|
||||||
$('#dob').prop('required', false);
|
$('#dob').prop('required', false);
|
||||||
$('#phone').prop('required', false);
|
$('#phone').prop('required', false);
|
||||||
$('#email').prop('required', false);
|
$('#email2').prop('required', false);
|
||||||
$('#aadhar').prop('required', false);
|
$('#aadhar').prop('required', false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user