Compare commits

..

No commits in common. "c698e08f898376e7eb6fa262c6f2f9c9a56c1e92" and "963e1e0b3edd6df89febb8e51764591cfd88aba5" have entirely different histories.

1 changed files with 30 additions and 67 deletions

View File

@ -73,24 +73,13 @@
value="{{isset($question->value)?$question->value:''}}">
@break
@case('number')
<input
type="number"
min="0"
max="9999999999"
step="1"
oninput="this.value = this.value.replace(/[^0-9]/g, '')"
id="field-{{$question->code}}"
name="{{$question->code}}"
class="form-control"
{{$question->required == 'yes' ? 'required' : ''}}
{{ in_array($question->code, ['total_lobg_rx']) ? 'readonly' : '' }}
value="{{isset($question->value)?$question->value:0}}">
<input type="{{$question->type}}" min="0" max="9999999999" step="1"
id="field-{{$question->code}}"
name="{{$question->code}}"
class="form-control"
{{$question->required == 'yes'?'required':'' }}
value="{{isset($question->value)?$question->value:0}}"
{{ $question->code == 'total_lobg_rx' ? 'readonly' : '' }}>
@break
@case('textarea')
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
@ -295,67 +284,41 @@
$(document).on('change', '#field-contact_id', function () {
$("#field-contact_id").change(function(){
let selected = $(this).find('option:selected');
let selected = $('option:selected', this);
$('#field-msl_code').val(
selected.attr('msl_code') || ''
);
console.log(selected.attr('msl_code'));
console.log(selected.attr('speciality'));
$('#field-speciality').val(
selected.attr('speciality') || ''
);
$('#field-msl_code').val(selected.attr('msl_code'));
$('#field-speciality').val(selected.attr('speciality'));
});
});
// Auto populate Total LOBG Rx from LO-BG 0.5 mg Rx
// LOBG auto fill
function calculateTotalLOBGRx() {
function syncLOBGTotal() {
let loBgRx = parseFloat($('#field-lo_bg_05_mg_rx').val()) || 0;
let loBgRx = parseInt(
$('#field-lo_bg_05_mg_rx').val()
) || 0;
$('#field-total_lobg_rx').val(loBgRx);
}
// integer only
$('#field-lo_bg_05_mg_rx').val(loBgRx);
// Trigger on typing/change
$('#field-lo_bg_05_mg_rx').on('keyup change', function () {
calculateTotalLOBGRx();
});
// autofill total
$('#field-total_lobg_rx').val(loBgRx);
}
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0');
var yyyy = today.getFullYear();
today = yyyy + '-' + mm + '-' + dd;
var plandateField = document.getElementById('field-record_date');
// trigger while typing
$(document).on(
'input keyup change',
'#field-lo_bg_05_mg_rx',
function () {
this.value = this.value.replace(/[^0-9]/g, '');
syncLOBGTotal();
}
);
// prevent future dates
$('input[type="date"]').attr(
'max',
new Date().toISOString().split("T")[0]
);
// initial load sync
syncLOBGTotal();
plandateField.setAttribute('max', today);
});
</script>
</body>