Updated blade file
This commit is contained in:
parent
73867e100d
commit
7ac38f903a
|
|
@ -73,13 +73,25 @@
|
||||||
value="{{isset($question->value)?$question->value:''}}">
|
value="{{isset($question->value)?$question->value:''}}">
|
||||||
@break
|
@break
|
||||||
@case('number')
|
@case('number')
|
||||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1"
|
|
||||||
id="field-{{$question->code}}"
|
<input
|
||||||
name="{{$question->code}}"
|
type="number"
|
||||||
class="form-control"
|
min="0"
|
||||||
{{$question->required == 'yes'?'required':'' }}
|
max="9999999999"
|
||||||
value="{{isset($question->value)?$question->value:0}}"
|
step="1"
|
||||||
{{ $question->code == 'total_lobg_rx' ? 'readonly' : '' }}>
|
|
||||||
|
oninput="this.value = this.value.replace(/[^0-9]/g, '')"
|
||||||
|
|
||||||
|
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
|
@break
|
||||||
@case('textarea')
|
@case('textarea')
|
||||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
<textarea id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||||
|
|
@ -300,16 +312,42 @@
|
||||||
|
|
||||||
function calculateTotalLOBGRx() {
|
function calculateTotalLOBGRx() {
|
||||||
|
|
||||||
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);
|
$('#field-total-lobg-rx').val(loBgRx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger on typing/change
|
$(document).on(
|
||||||
$('#field-lo_bg_05_mg_rx').on('keyup change', function () {
|
'input keyup change',
|
||||||
calculateTotalLOBGRx();
|
'#field-lo-bg-05-mg-rx',
|
||||||
});
|
function () {
|
||||||
|
|
||||||
|
this.value = this.value.replace(/[^0-9]/g, '');
|
||||||
|
|
||||||
|
calculateTotalLOBGRx();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$('#report-form').on('submit', function(event){
|
||||||
|
|
||||||
|
let loBgRx = parseInt(
|
||||||
|
$('#field-lo-bg-05-mg-rx').val()
|
||||||
|
) || 0;
|
||||||
|
|
||||||
|
let totalRx = parseInt(
|
||||||
|
$('#field-total-lobg-rx').val()
|
||||||
|
) || 0;
|
||||||
|
|
||||||
|
if (loBgRx !== totalRx) {
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
alert('Total LOBG Rx is mismatched.');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
var today = new Date();
|
var today = new Date();
|
||||||
var dd = String(today.getDate()).padStart(2, '0');
|
var dd = String(today.getDate()).padStart(2, '0');
|
||||||
var mm = String(today.getMonth() + 1).padStart(2, '0');
|
var mm = String(today.getMonth() + 1).padStart(2, '0');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue