DC (GLIPIQ Rx Tracker) metric code
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m3s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m3s
Details
This commit is contained in:
parent
3ba6b86bb0
commit
3414677342
|
|
@ -247,18 +247,48 @@
|
|||
$('#report-form').append('<input type="hidden" class="dynamic-hidden" name="'+ $('#field-glipiq_dose').val() +'" value="1">')
|
||||
})*/
|
||||
|
||||
$('#field-glipiq_dose').on('change', function () {
|
||||
$('#report-form input.dynamic-hidden').remove();
|
||||
|
||||
let fieldName = $('#field-glipiq_dose').val().replace(/\./g, '_');
|
||||
const penOnlyValues = ["1.7 mg", "2.4 mg"];
|
||||
|
||||
function updateDoseOptions() {
|
||||
const isPen = $("#field-glipiq_formulation").val() === "Pen";
|
||||
|
||||
$("#field-glipiq_dose option").each(function () {
|
||||
if (penOnlyValues.includes($(this).val())) {
|
||||
$(this).prop("hidden", !isPen).prop("disabled", !isPen);
|
||||
}
|
||||
});
|
||||
|
||||
if (!isPen && penOnlyValues.includes($("#field-glipiq_dose").val())) {
|
||||
$("#field-glipiq_dose").val("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
updateDoseOptions();
|
||||
|
||||
|
||||
$("#field-glipiq_formulation").on("change", updateDoseOptions);
|
||||
|
||||
|
||||
$('#report-form').append(
|
||||
'<input type="hidden" class="dynamic-hidden" name="' + fieldName + '" value="1">'
|
||||
);
|
||||
});
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
const rawDose = $('#field-glipiq_dose').val() || '';
|
||||
const doseSlug = rawDose.toString().toLowerCase().trim().replace(/[.\s]+/g, '_').replace(/[^a-z0-9_]/g, '');
|
||||
|
||||
if($('#field-glipiq_formulation').val()==='Vial'){
|
||||
$('#report-form').append('<input type="hidden" name="'+doseSlug+'" value="'+$("#field-count_of_rx").val()+'" />');
|
||||
}
|
||||
else if($('#field-glipiq_formulation').val()==='Pen'){
|
||||
$('#report-form').append('<input type="hidden" name="'+doseSlug+'" value="'+$("#field-count_of_rx").val()+'" />');
|
||||
|
||||
}
|
||||
else{
|
||||
$('#report-form').append('<input type="hidden" name="'+doseSlug+'" value="0" />');
|
||||
|
||||
}
|
||||
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
|
|
@ -298,22 +328,22 @@
|
|||
|
||||
var plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.addEventListener('change', function () {
|
||||
var today = new Date().toISOString().split('T')[0];
|
||||
plandateField.addEventListener('change', function () {
|
||||
var today = new Date().toISOString().split('T')[0];
|
||||
|
||||
if (this.value > today) {
|
||||
var field = this;
|
||||
if (this.value > today) {
|
||||
var field = this;
|
||||
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Invalid Date',
|
||||
text: 'Future dates are not allowed',
|
||||
}).then(() => {
|
||||
field.value = today; // reset AFTER swal closes
|
||||
field.blur(); // force UI refresh (important for mobile)
|
||||
});
|
||||
}
|
||||
});
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Invalid Date',
|
||||
text: 'Future dates are not allowed',
|
||||
}).then(() => {
|
||||
field.value = today; // reset AFTER swal closes
|
||||
field.blur(); // force UI refresh (important for mobile)
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue