FIX_ISSUES

This commit is contained in:
VENKATESHWARAN 2026-06-01 14:18:59 +05:30
parent 47efb8b69e
commit 6359106685
4 changed files with 102 additions and 18 deletions

View File

@ -181,7 +181,7 @@
} }
</style> </style>
<script src="<?= base_url('public/assets/js/pages/policy_transaction_endorsement_form_validation.js') ?>"></script> <script src="<?= base_url('public/assets/js/pages/policy_transaction_endorsement_form_validation.js') ?>?v=20260529"></script>
<div class="tab-pane fade active show" id="form"> <div class="tab-pane fade active show" id="form">
<div class="row" id="endorsement_form"> <div class="row" id="endorsement_form">
@ -297,7 +297,7 @@
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="addon_policy">Policy No<span id="base_danger"class="text-danger"></span></label> <label for="addon_policy">Policy No<span id="base_danger"class="text-danger"></span></label>
<input type="text" class="form-control" id="policy_no" name="policy_no"placeholder="Enter Policy No" readonly> <input type="text" class="form-control" id="policy_no" name="policy_no" placeholder="Enter Policy No" readonly data-parsley-validate="false" data-parsley-exclude-charset="true">
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
@ -326,7 +326,7 @@
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="addon_policy">Endorsement No<span id="base_danger" class="text-danger"></span></label> <label for="addon_policy">Endorsement No<span id="base_danger" class="text-danger"></span></label>
<input type="text" class="form-control" id="endorsement_no" name="endorsement_no" placeholder="Enter Endorsement No" onchange="validateInput(this, 'policy_transaction', 'endorsement_no')"> <input type="text" class="form-control" id="endorsement_no" name="endorsement_no" placeholder="Enter Endorsement No" data-parsley-validate="false" data-parsley-exclude-charset="true">
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
@ -757,6 +757,9 @@
// console.log('tpa',tpa); // console.log('tpa',tpa);
$('#policy_no').val(policy_no); $('#policy_no').val(policy_no);
if (typeof window.clearEndorsementExcludedFieldsValidation === 'function') {
window.clearEndorsementExcludedFieldsValidation('#endorsement_form_id');
}
$('#insurer_id').val(insurer); $('#insurer_id').val(insurer);
$('#tpa').val(tpa).change(); $('#tpa').val(tpa).change();
// $('#cd_ac_no').val(cd_ac_no); // $('#cd_ac_no').val(cd_ac_no);
@ -1206,6 +1209,9 @@
$('#policy_no').val(res.data.policy_no); $('#policy_no').val(res.data.policy_no);
$('#action_type').val(res.data.action_type); $('#action_type').val(res.data.action_type);
$('#endorsement_no').val(res.data.endorsement_no); $('#endorsement_no').val(res.data.endorsement_no);
if (typeof window.clearEndorsementExcludedFieldsValidation === 'function') {
window.clearEndorsementExcludedFieldsValidation('#endorsement_form_id');
}
$('#data_received_date').val(res.data.data_received_date); $('#data_received_date').val(res.data.data_received_date);
$('#policy_issue_date').val(res.data.policy_issue_date); $('#policy_issue_date').val(res.data.policy_issue_date);
$('#emp_count').val(res.data.emp_count); $('#emp_count').val(res.data.emp_count);

View File

@ -195,7 +195,7 @@
} }
</style> </style>
<script src="<?= base_url('public/assets/js/pages/policy_transaction_endorsement_form_validation.js') ?>"></script> <script src="<?= base_url('public/assets/js/pages/policy_transaction_endorsement_form_validation.js') ?>?v=20260529"></script>
<div class="row" id="endorsement_form" style="display: none;"> <div class="row" id="endorsement_form" style="display: none;">
<div class="col-12"> <div class="col-12">
@ -310,7 +310,7 @@
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="addon_policy">Policy No<span id="base_danger"class="text-danger"></span></label> <label for="addon_policy">Policy No<span id="base_danger"class="text-danger"></span></label>
<input type="text" class="form-control" id="policy_no" name="policy_no"placeholder="Enter Policy No" readonly> <input type="text" class="form-control" id="policy_no" name="policy_no" placeholder="Enter Policy No" readonly data-parsley-validate="false" data-parsley-exclude-charset="true">
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
@ -339,7 +339,7 @@
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="addon_policy">Endorsement No<span id="base_danger" class="text-danger"></span></label> <label for="addon_policy">Endorsement No<span id="base_danger" class="text-danger"></span></label>
<input type="text" class="form-control" id="endorsement_no" name="endorsement_no" placeholder="Enter Endorsement No" onchange="validateInput(this, 'policy_transaction', 'endorsement_no')"> <input type="text" class="form-control" id="endorsement_no" name="endorsement_no" placeholder="Enter Endorsement No" data-parsley-validate="false" data-parsley-exclude-charset="true">
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
@ -613,6 +613,9 @@
// console.log('tpa',tpa); // console.log('tpa',tpa);
$('#policy_no').val(policy_no); $('#policy_no').val(policy_no);
if (typeof window.clearEndorsementExcludedFieldsValidation === 'function') {
window.clearEndorsementExcludedFieldsValidation('#endorsement_form_id');
}
$('#insurer_id').val(insurer); $('#insurer_id').val(insurer);
$('#tpa').val(tpa).change(); $('#tpa').val(tpa).change();
// $('#cd_ac_no').val(cd_ac_no); // $('#cd_ac_no').val(cd_ac_no);
@ -1037,6 +1040,9 @@
$('#policy_no').val(res.data.policy_no); $('#policy_no').val(res.data.policy_no);
$('#action_type').val(res.data.action_type); $('#action_type').val(res.data.action_type);
$('#endorsement_no').val(res.data.endorsement_no); $('#endorsement_no').val(res.data.endorsement_no);
if (typeof window.clearEndorsementExcludedFieldsValidation === 'function') {
window.clearEndorsementExcludedFieldsValidation('#endorsement_form_id');
}
$('#data_received_date').val(res.data.data_received_date); $('#data_received_date').val(res.data.data_received_date);
$('#policy_issue_date').val(res.data.policy_issue_date); $('#policy_issue_date').val(res.data.policy_issue_date);
$('#emp_count').val(res.data.emp_count); $('#emp_count').val(res.data.emp_count);

View File

@ -901,7 +901,7 @@ async function viewDetail(id) {
function renderCard(opps) { function renderCard(opps) {
const opp_cont = document.getElementById('opportunitiesContainer'); const opp_cont = document.getElementById('opportunitiesContainer');
opp_cont.innerHTML = opps.length ? opps.map(o => { opp_cont.innerHTML = opps.length ? opps.map(o => {
let lead_type = o.lead_type == 1 ? 'EB' : 'Non-EB'; let lead_type = o.lead_form_type == 1 ? 'EB' : 'Non-EB';
let status = o.status?.toLowerCase(); let status = o.status?.toLowerCase();
let statusClass = { let statusClass = {
won: 'status-text-won', won: 'status-text-won',

View File

@ -47,12 +47,61 @@
return true; return true;
} }
function isExcludedCharsetField(el) {
if (!el) {
return false;
}
if ($(el).attr('data-parsley-exclude-charset') === 'true') {
return true;
}
var id = (el.id || '').toLowerCase();
var name = (el.name || '').toLowerCase();
return id === 'policy_no' || id === 'endorsement_no' ||
name === 'policy_no' || name === 'endorsement_no';
}
function clearExcludedFieldValidation($form) {
if (!$form || !$form.length) {
return;
}
$form.find('input, textarea, select').each(function () {
var el = this;
if (!isExcludedCharsetField(el)) {
return;
}
var $el = $(el);
$el.removeAttr('data-parsley-endorsementcharset');
$el.attr('data-parsley-validate', 'false');
$el.removeClass('parsley-error parsley-success');
$el.siblings('ul.parsley-errors-list').remove();
$el.closest('.form-group').find('ul.parsley-errors-list').remove();
if (typeof $el.parsley === 'function') {
try {
var fieldInstance = $el.parsley();
if (fieldInstance && typeof fieldInstance.reset === 'function') {
fieldInstance.reset();
}
if (fieldInstance && typeof fieldInstance.destroy === 'function') {
fieldInstance.destroy();
}
} catch (e) {
// no-op
}
}
});
refreshParsley($form);
}
function registerValidator() { function registerValidator() {
if (!isParsleyReady() || window.Parsley.__endorsementFormValidatorRegistered) { if (!isParsleyReady() || window.Parsley.__endorsementFormValidatorRegistered) {
return; return;
} }
window.Parsley.addValidator('endorsementcharset', { window.Parsley.addValidator('endorsementcharset', {
validateString: function (value) { validateString: function (value) {
var el = this.$element && this.$element.length ? this.$element[0] : null;
if (isExcludedCharsetField(el)) {
return true;
}
if (!value || String(value).trim() === '') { if (!value || String(value).trim() === '') {
return true; return true;
} }
@ -85,6 +134,12 @@
return; return;
} }
if (isExcludedCharsetField(el)) {
$el.removeAttr('data-parsley-endorsementcharset');
$el.attr('data-parsley-validate', 'false');
return;
}
if (isCharsetCandidate(el) || isDocumentNameField(el)) { if (isCharsetCandidate(el) || isDocumentNameField(el)) {
if (!$el.attr('data-parsley-endorsementcharset')) { if (!$el.attr('data-parsley-endorsementcharset')) {
$el.attr('data-parsley-endorsementcharset', 'true'); $el.attr('data-parsley-endorsementcharset', 'true');
@ -144,7 +199,7 @@
} }
function validateField(field) { function validateField(field) {
if (!field || isSkippableField(field) || !isParsleyReady()) { if (!field || isSkippableField(field) || isExcludedCharsetField(field) || !isParsleyReady()) {
return; return;
} }
var $field = $(field); var $field = $(field);
@ -181,6 +236,7 @@
registerValidator(); registerValidator();
applyConstraints($form); applyConstraints($form);
clearExcludedFieldValidation($form);
refreshParsley($form); refreshParsley($form);
stripParsleyFormSubmitHandlers($form); stripParsleyFormSubmitHandlers($form);
@ -237,18 +293,14 @@
initWithRetry(40); initWithRetry(40);
}); });
$(window).on('load', function () { window.clearEndorsementExcludedFieldsValidation = function (formSelector) {
if (!isParsleyReady()) { var sel = formSelector || '#endorsement_form_id';
var $form = $(sel);
if (!$form.length || !isParsleyReady()) {
return; return;
} }
FORM_SELECTORS.forEach(function (selector) { clearExcludedFieldValidation($form);
var $f = $(selector); };
if ($f.length) {
refreshParsley($f);
stripParsleyFormSubmitHandlers($f);
}
});
});
window.refreshEndorsementFormValidation = function (formSelector) { window.refreshEndorsementFormValidation = function (formSelector) {
if (!formSelector || !isParsleyReady()) { if (!formSelector || !isParsleyReady()) {
@ -271,12 +323,32 @@
stripOrphanParsleyUi($form); stripOrphanParsleyUi($form);
$form.removeData(LIVE_VALIDATE_DATA); $form.removeData(LIVE_VALIDATE_DATA);
try { try {
clearExcludedFieldValidation($form);
refreshParsley($form); refreshParsley($form);
stripParsleyFormSubmitHandlers($form); stripParsleyFormSubmitHandlers($form);
} catch (e2) { } catch (e2) {
// no-op // no-op
} }
}; };
// form-validation.init.js binds all .parsley-examples after this script loads
$(window).on('load', function () {
window.setTimeout(function () {
if (!isParsleyReady()) {
return;
}
FORM_SELECTORS.forEach(function (selector) {
var $f = $(selector);
if (!$f.length) {
return;
}
applyConstraints($f);
clearExcludedFieldValidation($f);
refreshParsley($f);
stripParsleyFormSubmitHandlers($f);
});
}, 0);
});
})(function () { })(function () {
return window.jQuery; return window.jQuery;
}); });