FIX_POLICY_START_END_RANGE_AGREED_PERCENTAGE_DOT_AALOWED
This commit is contained in:
parent
4b8f7cb459
commit
29ac2e4087
@ -907,7 +907,7 @@
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="agreed_percentage">Agreed Percentage (%)</label>
|
||||
<input type="number" class="form-control" id="agreed_percentage" name="agreed_percentage" placeholder="Enter Agreed Percentage (%)" minlength="0" maxlength="100" step="0.01" value="<?= isset($lead_data['agreed_percentage']) ? $lead_data['agreed_percentage'] : "" ?>">
|
||||
<input type="text" class="form-control" id="agreed_percentage" name="agreed_percentage" placeholder="Enter Agreed Percentage (%)" inputmode="decimal" value="<?= isset($lead_data['agreed_percentage']) ? $lead_data['agreed_percentage'] : "" ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
@ -1345,6 +1345,12 @@
|
||||
var policy_start_date_datePicker = flatpickr("#policy_start_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false,
|
||||
onChange: function(selectedDates, dateStr, instance) {
|
||||
var endDate = new Date(selectedDates[0]);
|
||||
endDate.setFullYear(endDate.getFullYear() + 1);
|
||||
endDate.setDate(endDate.getDate() - 1);
|
||||
policy_end_date_datePicker.setDate(endDate);
|
||||
}
|
||||
});
|
||||
|
||||
var policy_end_date_datePicker = flatpickr("#policy_end_date", {
|
||||
@ -7838,8 +7844,32 @@ function appendMultiFileData(data) {
|
||||
}
|
||||
|
||||
$('#agreed_percentage').on('input', function () {
|
||||
let val = this.value.replace(/[^\d.]/g, '');
|
||||
const parts = val.split('.');
|
||||
if (parts.length > 2) {
|
||||
val = parts[0] + '.' + parts.slice(1).join('');
|
||||
}
|
||||
if (val !== '' && !val.endsWith('.')) {
|
||||
let v = parseFloat(val);
|
||||
if (!isNaN(v)) {
|
||||
if (v < 0) val = '0';
|
||||
else if (v > 100) val = '100';
|
||||
}
|
||||
}
|
||||
this.value = val;
|
||||
});
|
||||
|
||||
$('#agreed_percentage').on('blur', function () {
|
||||
if (this.value === '' || this.value === '.') {
|
||||
this.value = '';
|
||||
return;
|
||||
}
|
||||
let v = parseFloat(this.value);
|
||||
this.value = (v < 0) ? 0 : (v > 100 ? 100 : v);
|
||||
if (isNaN(v)) {
|
||||
this.value = '';
|
||||
} else {
|
||||
this.value = (v < 0) ? 0 : (v > 100 ? 100 : v);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user