|
@@ -170,7 +170,7 @@ parentSegment.find('[name="additionReasonCategory"]')
|
|
|
.off('change')
|
|
|
.on('change', function () {
|
|
|
let form = $(this).closest('form');
|
|
|
- form.find('[if-addition-on-intake-or-during-visit], [if-addition-on-intake], [if-addition-during-visit], [if-active-and-pre-existing-or-not-active], [if-active-and-not-pre-existing]').addClass('d-none');
|
|
|
+ form.find('[if-addition-on-intake-or-during-visit], [if-addition-on-intake], [if-addition-during-visit], [if-active-and-pre-existing-or-not-active], [if-active-and-not-pre-existing], [if-entry-type-not-empty]').addClass('d-none');
|
|
|
if(form.find('[name="additionReasonCategory"]:checked').length) form.find('[if-addition-on-intake-or-during-visit]').removeClass('d-none');
|
|
|
form.find('[if-addition-or-removal-on-intake-or-during-visit]').addClass('d-none');
|
|
|
if(form.find('[name="additionReasonCategory"]:checked').length || form.find('[name="removalReasonCategory"]:checked').length) {
|
|
@@ -192,6 +192,9 @@ parentSegment.find('[name="additionReasonCategory"]')
|
|
|
if(form.find('[name="isRemoved"]:checked').val() === '0' && form.find('[name="additionReasonCategory"]:checked').val() !== 'ON_INTAKE') {
|
|
|
form.find('[if-active-and-not-pre-existing]').removeClass('d-none');
|
|
|
}
|
|
|
+ if(form.find('[name="additionReasonCategory"]:checked').length || form.find('[name="removalReasonCategory"]:checked').length) {
|
|
|
+ form.find('[if-entry-type-not-empty]').removeClass('d-none');
|
|
|
+ }
|
|
|
return false;
|
|
|
})
|
|
|
.trigger('change');
|
|
@@ -200,7 +203,7 @@ parentSegment.find('[name="removalReasonCategory"]')
|
|
|
.off('change')
|
|
|
.on('change', function () {
|
|
|
let form = $(this).closest('form');
|
|
|
- form.find('[if-removal-on-intake-or-during-visit], [if-removal-on-intake], [if-removal-during-visit]').addClass('d-none');
|
|
|
+ form.find('[if-removal-on-intake-or-during-visit], [if-removal-on-intake], [if-removal-during-visit], [if-entry-type-not-empty]').addClass('d-none');
|
|
|
if(form.find('[name="removalReasonCategory"]:checked').length) form.find('[if-removal-on-intake-or-during-visit]').removeClass('d-none');
|
|
|
form.find('[if-addition-or-removal-on-intake-or-during-visit]').addClass('d-none');
|
|
|
if(form.find('[name="additionReasonCategory"]:checked').length || form.find('[name="removalReasonCategory"]:checked').length) {
|
|
@@ -220,6 +223,9 @@ parentSegment.find('[name="removalReasonCategory"]')
|
|
|
form.find('[name="removalEffectiveDate"]').val('{{$patient->core_note_id !== $note->id ? $note->effective_dateest : date("Y-m-d")}}');
|
|
|
form.find('[name="removalReasonMemo"]').val('{{$patient->core_note_id !== $note->id ? ($note->hcpPro ? $note->hcpPro->displayName() : "") : ""}}');
|
|
|
}
|
|
|
+ if(form.find('[name="additionReasonCategory"]:checked').length || form.find('[name="removalReasonCategory"]:checked').length) {
|
|
|
+ form.find('[if-entry-type-not-empty]').removeClass('d-none');
|
|
|
+ }
|
|
|
return false;
|
|
|
})
|
|
|
.trigger('change');
|
|
@@ -260,6 +266,12 @@ parentSegment.find('#frm-add-{{$label}}')
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // ensure an entry-type is selected
|
|
|
+ if(!form.find('[name="additionReasonCategory"]:checked').length && !form.find('[name="removalReasonCategory"]:checked').length) {
|
|
|
+ toastr.error('Entry type not selected.')
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
if (!form[0].checkValidity()) {
|
|
|
form[0].reportValidity();
|
|
|
return false;
|
|
@@ -730,7 +742,9 @@ parentSegment.find('.btn-entry-type')
|
|
|
|
|
|
return false;
|
|
|
});
|
|
|
-parentSegment.find('.btn-entry-type[data-entry-type="Pre-Existing"]').trigger('click');
|
|
|
+
|
|
|
+// do not default to Pre-Existing
|
|
|
+// parentSegment.find('.btn-entry-type[data-entry-type="Pre-Existing"]').trigger('click');
|
|
|
|
|
|
const debounce = (func, wait) => {
|
|
|
let timeout;
|