Skip to content

Commit

Permalink
refactor(visits); uses yes-no radios in search modal
Browse files Browse the repository at this point in the history
Improves the search modal by using the yes-no-radios to ensure that no
default case is assumed.

Closes #7815.
  • Loading branch information
jniles committed Nov 26, 2024
1 parent 936ac2c commit d3b4d0f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
31 changes: 16 additions & 15 deletions client/src/modules/patients/visits/modals/search.modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,24 @@
<uib-tabset>
<uib-tab index="0" heading="{{ 'FORM.LABELS.SEARCH_QUERIES' | translate }}" data-custom-filter-tab>
<div class="tab-body">
<!-- refered -->
<div class="checkbox">
<label>
<input type="checkbox" ng-true-value="1" ng-false-value=0 ng-model="$ctrl.searchQueries.is_refered">
<span translate>PATIENT_RECORDS.VISITS.IS_REFERED</span>
</label>
<bh-clear on-clear="$ctrl.clear('is_refered')"></bh-clear>
</div>

<!-- pregnant -->
<div class="checkbox">
<label>
<input type="checkbox" ng-true-value="1" ng-false-value=0 ng-model="$ctrl.searchQueries.is_pregnant">
<span translate>PATIENT_RECORDS.VISITS.IS_PREGNANT</span>
</label>
<!-- determine if patients are referred or not -->
<bh-yes-no-radios
label="PATIENT_RECORDS.VISITS.IS_REFERED"
value="$ctrl.searchQueries.is_refered"
name="is_refered"
on-change-callback="$ctrl.onReferralChange(value)">
<bh-clear on-clear="$ctrl.clear('is_refered')"></bh-clear>
</bh-yes-no-radios>

<!-- determine if patients are pregnant or not -->
<bh-yes-no-radios
label="PATIENT_RECORDS.VISITS.IS_PREGNANT"
value="$ctrl.searchQueries.is_pregnant"
name="is_pregnant"
on-change-callback="$ctrl.onPregnantChange(value)">
<bh-clear on-clear="$ctrl.clear('is_pregnant')"></bh-clear>
</div>
</bh-yes-no-radios>

<!-- hospitalized -->
<div>
Expand Down
9 changes: 8 additions & 1 deletion client/src/modules/patients/visits/modals/search.modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ function AdmissionRegistryModalController(ModalInstance, filters, Store, util, P

vm.today = new Date();
vm.defaultQueries = {};
vm.searchQueries = {};

// assign default limit filter
if (filters.limit) {
Expand Down Expand Up @@ -59,6 +58,14 @@ function AdmissionRegistryModalController(ModalInstance, filters, Store, util, P
displayValues.service_uuid = service.name;
};

vm.onReferralChange = value => {
vm.searchQueries.is_refered = value;
};

vm.onPregnantChange = value => {
vm.searchQueries.is_pregnant = value;
};

// default filter limit - directly write to changes list
vm.onSelectLimit = function onSelectLimit(val) {
// input is type value, this will only be defined for a valid number
Expand Down

0 comments on commit d3b4d0f

Please sign in to comment.