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">')
|
$('#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();
|
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);
|
||||||
|
|
||||||
let fieldName = $('#field-glipiq_dose').val().replace(/\./g, '_');
|
|
||||||
|
|
||||||
$('#report-form').append(
|
|
||||||
'<input type="hidden" class="dynamic-hidden" name="' + fieldName + '" value="1">'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#report-form').on('submit', function(event){
|
$('#report-form').on('submit', function(event){
|
||||||
event.preventDefault();
|
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();
|
$("#pageloader").fadeIn();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
|
@ -298,22 +328,22 @@
|
||||||
|
|
||||||
var plandateField = document.getElementById('field-record_date');
|
var plandateField = document.getElementById('field-record_date');
|
||||||
|
|
||||||
plandateField.addEventListener('change', function () {
|
plandateField.addEventListener('change', function () {
|
||||||
var today = new Date().toISOString().split('T')[0];
|
var today = new Date().toISOString().split('T')[0];
|
||||||
|
|
||||||
if (this.value > today) {
|
if (this.value > today) {
|
||||||
var field = this;
|
var field = this;
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: 'error',
|
icon: 'error',
|
||||||
title: 'Invalid Date',
|
title: 'Invalid Date',
|
||||||
text: 'Future dates are not allowed',
|
text: 'Future dates are not allowed',
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
field.value = today; // reset AFTER swal closes
|
field.value = today; // reset AFTER swal closes
|
||||||
field.blur(); // force UI refresh (important for mobile)
|
field.blur(); // force UI refresh (important for mobile)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue