FIX_ADD_CLIENT : RV
This commit is contained in:
parent
65b405d3e4
commit
d5e6037c0e
@ -171,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();
|
||||
@ -229,7 +245,7 @@
|
||||
|
||||
}else{
|
||||
|
||||
toastr.error("Couldn't Add Client","Error");
|
||||
console.log("Couldn't Add Client","Error");
|
||||
}
|
||||
|
||||
toastr.success(res.message, 'Success');
|
||||
@ -249,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;
|
||||
|
||||
@ -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);
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user