CHANGE_CLIENT_SHORT_NAME_IN_EVERY_PLACE : RV

This commit is contained in:
VENKATESHWARAN 2025-07-18 14:30:32 +05:30
parent f81bbd4635
commit 0a475ffb14
4 changed files with 53 additions and 24 deletions

View File

@ -207,7 +207,7 @@
<div class="form-group col-md-3 freshFields"> <div class="form-group col-md-3 freshFields">
<label for="client_short_name">Client Short Name<span class="text-danger">*</span></label> <label for="client_short_name">Client Short Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="client_short_name" name="client_short_name" <input type="text" class="form-control" id="client_short_name" name="client_short_name"
placeholder="Enter Client Short Name" required> placeholder="Enter Client Short Name" onkeyup="validateInput(this, 'clients', 'short_name')" required>
</div> </div>
<div class="form-group col-md-3 renewalFields" style="display: none;"> <div class="form-group col-md-3 renewalFields" style="display: none;">
@ -344,7 +344,7 @@
<div class="form-group text-right m-b-0" id="submitButton"> <div class="form-group text-right m-b-0" id="submitButton">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" <button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
id="btnSubmit">Submit</button> id="lead_form_submit_btn" >Submit</button>
</div> </div>
</form> </form>

View File

@ -438,24 +438,39 @@ if (isset($selected_lead_type)) {
$('#salse_person_id').trigger('change'); $('#salse_person_id').trigger('change');
} }
// function validateInput(input, table, field){ function validateInput(input, table, field){
// let value = $(input).val(); let client_type = $('#client_type').val();
// let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
// let message = "Value is duplicate!"; if(client_type == 2){
// if(label){ return;
// message = label + " already exists!"; }
// }
// checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) { if(client_type == ""){
// if (isDuplicate) { toastr.warning('Please select the client type', 'WARNING');
// toastr.warning(message, 'WARNING'); $('#client_short_name').val('')
return;
}
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('') // $(input).val('')
// } $('#lead_form_submit_btn').prop('disabled', true);
// }); } else{
$('#lead_form_submit_btn').prop('disabled', false);
}
});
// } }
// -------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------

View File

@ -161,7 +161,7 @@
<div class="form-group col-md-3 freshFields"> <div class="form-group col-md-3 freshFields">
<label for="client_short_name">Client Short Name<span class="text-danger">*</span></label> <label for="client_short_name">Client Short Name<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="client_short_name" name="client_short_name" <input type="text" class="form-control" id="client_short_name" name="client_short_name"
placeholder="Enter Client Short Name" required> placeholder="Enter Client Short Name" onkeyup="validateInput(this, 'clients', 'short_name')" required>
</div> </div>
<div class="form-group col-md-3 renewalFields" style="display: none;"> <div class="form-group col-md-3 renewalFields" style="display: none;">
@ -369,7 +369,7 @@
</div> </div>
<div class="form-group text-right m-b-0"> <div class="form-group text-right m-b-0">
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">Submit</button> <button type="submit" id="lead_form_submit_btn" class="btn btn-primary waves-effect waves-light mr-1">Submit</button>
</div> </div>
</form> </form>

View File

@ -17,7 +17,7 @@
</div> </div>
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label for="short_name">Client Short name<span class="text-danger">*</span></label> <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> <input type="text" class="form-control" id="short_name" name="short_name" onkeyup="validateInputForClient(this, 'clients', 'short_name')" required>
</div> </div>
<div class="form-group col-md-12"> <div class="form-group col-md-12">
@ -104,7 +104,7 @@
</div> </div>
<div class="form-group text-right m-b-0" id="hide_smbt_btn"> <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> <button type="submit" id="client_add_modal_submit_btn" class="btn btn-primary waves-effect waves-light mr-1">Submit</button>
</div> </div>
</form> </form>
</div> </div>
@ -117,6 +117,17 @@
let isGSTValid = false; let isGSTValid = false;
function validateInputForClient(input, table, field) { function validateInputForClient(input, table, field) {
let owner_type = $('#Owner_type').val();
let client_type = $('#client_type').val();
console.log('owner_type', owner_type);
console.log('client_type', client_type);
if((client_type == 2 || owner_type == 2) && field == 'short_name'){
return;
}
let value = $(input).val(); let value = $(input).val();
if (!value) return; if (!value) return;
@ -132,12 +143,15 @@
isGSTValidating = false; isGSTValidating = false;
if (isDuplicate) { if (isDuplicate) {
toastr.warning(message, 'WARNING'); toastr.warning(message, 'WARNING');
$(input).val(''); // $(input).val('');
isGSTValid = false; isGSTValid = false;
$('#client_add_modal_submit_btn').prop('disabled', true);
} else { } else {
isGSTValid = true; isGSTValid = true;
$('#client_add_modal_submit_btn').prop('disabled', false);
} }
}); });
$('#hide_smbt_btn button').prop('disabled', false); $('#hide_smbt_btn button').prop('disabled', false);
} }