This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added additional criteria to appointment search
Resolves #71
- Loading branch information
Showing
6 changed files
with
178 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,55 @@ | ||
import AppointmentIndexController from 'hospitalrun/appointments/index/controller'; | ||
import AppointmentStatuses from 'hospitalrun/mixins/appointment-statuses'; | ||
import Ember from 'ember'; | ||
export default AppointmentIndexController.extend({ | ||
import VisitTypes from 'hospitalrun/mixins/visit-types'; | ||
export default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes, { | ||
needs: 'appointments', | ||
appointmentType: null, | ||
physicianList: Ember.computed.alias('controllers.appointments.physicianList'), | ||
provider: null, | ||
queryParams: ['appointmentType', 'provider', 'status', 'startKey', 'startDate'], | ||
searchFields: ['selectedAppointmentType', 'selectedProvider', 'selectedStatus', 'selectedStartDate'], | ||
selectedProvider: null, | ||
selectedStartingDate: new Date(), | ||
selectedStatus: null, | ||
sortProperties: null, | ||
startKey: [], | ||
startingDate: null, | ||
_setup: function() { | ||
this.set('startingDate', new Date()); | ||
}.on('init'), | ||
status: null, | ||
visitTypesList: Ember.computed.alias('controllers.appointments.visitTypeList'), | ||
|
||
startingDateChanged: function() { | ||
var startingDate = this.get('startingDate'); | ||
this.set('previousStartKey'); | ||
this.set('previousStartKeys',[]); | ||
if (!Ember.isEmpty(startingDate)) { | ||
this.set('startKey', [startingDate.getTime(),null,null]); | ||
actions: { | ||
search: function() { | ||
var appointmentType = this.get('selectedAppointmentType'), | ||
fieldsToSet = { | ||
startKey: [], | ||
previousStartKey: null, | ||
previousStartKeys: [] | ||
}, | ||
provider = this.get('selectedProvider'), | ||
status = this.get('selectedStatus'), | ||
startDate = this.get('selectedStartingDate'); | ||
|
||
if (Ember.isEmpty(appointmentType)) { | ||
fieldsToSet.appointmentType = null; | ||
} else { | ||
fieldsToSet.appointmentType = appointmentType; | ||
} | ||
if (Ember.isEmpty(provider)) { | ||
fieldsToSet.provider = null; | ||
} else { | ||
fieldsToSet.provider = provider; | ||
} | ||
if (Ember.isEmpty(status)) { | ||
fieldsToSet.status = null; | ||
} else { | ||
fieldsToSet.status = status; | ||
} | ||
if (!Ember.isEmpty(startDate)) { | ||
fieldsToSet.startDate = startDate.getTime(); | ||
} | ||
if (!Ember.isEmpty(fieldsToSet)) { | ||
this.setProperties(fieldsToSet); | ||
} | ||
} | ||
}.observes('startingDate') | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Ember from "ember"; | ||
export default Ember.Mixin.create({ | ||
appointmentStatuses: [ | ||
'Scheduled', | ||
'Canceled' | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters