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.
Merge branch 'master' into greenkeeper/ember-cli-eslint-3.0.1
- Loading branch information
Showing
167 changed files
with
4,249 additions
and
992 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
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,25 +1,31 @@ | ||
import AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route'; | ||
import Ember from 'ember'; | ||
import { translationMacro as t } from 'ember-i18n'; | ||
import UnauthorizedError from 'hospitalrun/utils/unauthorized-error'; | ||
|
||
export default AbstractEditRoute.extend({ | ||
hideNewButton: true, | ||
newTitle: t('admin.address.newTitle'), | ||
editTitle: t('admin.address.editTitle'), | ||
model() { | ||
return new Ember.RSVP.Promise(function(resolve) { | ||
this.get('store').find('option', 'address_options').then(function(addressOptions) { | ||
return new Ember.RSVP.Promise((resolve, reject) => { | ||
this.get('store').find('option', 'address_options').then((addressOptions) => { | ||
resolve(addressOptions); | ||
}, function() { | ||
let store = this.get('store'); | ||
let newConfig = store.push(store.normalize('option', { | ||
id: 'address_options', | ||
value: { | ||
address1Label: this.get('i18n').t('admin.address.addressLabel'), | ||
address1Include: true | ||
} | ||
})); | ||
resolve(newConfig); | ||
}.bind(this)); | ||
}.bind(this)); | ||
}, (err) => { | ||
if (err instanceof UnauthorizedError) { | ||
reject(err); | ||
} else { | ||
let store = this.get('store'); | ||
let newConfig = store.push(store.normalize('option', { | ||
id: 'address_options', | ||
value: { | ||
address1Label: this.get('i18n').t('admin.address.addressLabel'), | ||
address1Include: true | ||
} | ||
})); | ||
resolve(newConfig); | ||
} | ||
}); | ||
}); | ||
} | ||
}); |
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
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,112 @@ | ||
import AppointmentIndexController from 'hospitalrun/appointments/index/controller'; | ||
import AppointmentStatuses from 'hospitalrun/mixins/appointment-statuses'; | ||
import moment from 'moment'; | ||
import VisitTypes from 'hospitalrun/mixins/visit-types'; | ||
import SelectValues from 'hospitalrun/utils/select-values'; | ||
import Ember from 'ember'; | ||
|
||
const { | ||
computed, | ||
computed: { | ||
alias | ||
}, | ||
get, | ||
inject, | ||
isEmpty, | ||
set | ||
} = Ember; | ||
|
||
export default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes, { | ||
appointmentType: null, | ||
endDate: null, | ||
location: null, | ||
provider: null, | ||
queryParams: ['appointmentType', 'endDate', 'provider', 'status', 'startDate', 'location', 'viewType'], | ||
startDate: null, | ||
status: null, | ||
viewType: 'agendaWeek', | ||
|
||
appointmentsController: inject.controller('appointments'), | ||
locations: alias('appointmentsController.locationList.value'), | ||
physicians: alias('appointmentsController.physicianList.value'), | ||
|
||
calendarDate: computed('startDate', function() { | ||
let startDate = get(this, 'startDate'); | ||
if (!isEmpty(startDate)) { | ||
return moment(parseInt(startDate)); | ||
} | ||
}), | ||
|
||
locationList: computed('locations', function() { | ||
return SelectValues.selectValues(get(this, 'locations'), true); | ||
}), | ||
|
||
physicianList: computed('physicians', function() { | ||
return SelectValues.selectValues(get(this, 'physicians'), true); | ||
}), | ||
|
||
_getSelectedFilteringCriteria() { | ||
let rawCriteria = { | ||
status: get(this, 'model.selectedStatus'), | ||
type: get(this, 'model.selectedAppointmentType'), | ||
provider: get(this, 'model.selectedProvider'), | ||
location: get(this, 'model.selectedLocation') | ||
}; | ||
|
||
return { | ||
status: isEmpty(rawCriteria.status) ? null : rawCriteria.status, | ||
type: isEmpty(rawCriteria.type) ? null : rawCriteria.type, | ||
provider: isEmpty(rawCriteria.provider) ? null : rawCriteria.provider, | ||
location: isEmpty(rawCriteria.location) ? null : rawCriteria.location | ||
}; | ||
}, | ||
|
||
actions: { | ||
clearFilteringCriteria() { | ||
set(this, 'model.selectedStatus', null); | ||
set(this, 'model.selectedAppointmentType', null); | ||
set(this, 'model.selectedProvider', null); | ||
set(this, 'model.selectedLocation', null); | ||
this.send('filter'); | ||
}, | ||
|
||
createNewAppointment(dateClicked) { | ||
let newAppointment = this.store.createRecord('appointment', { | ||
appointmentType: 'Admission', | ||
allDay: false, | ||
selectPatient: true, | ||
startDate: dateClicked.local().toDate() | ||
}); | ||
this.send('editAppointment', newAppointment); | ||
}, | ||
|
||
filter() { | ||
let criteria = this._getSelectedFilteringCriteria(); | ||
this.setProperties({ | ||
appointmentType: criteria.type, | ||
provider: criteria.provider, | ||
status: criteria.status, | ||
location: criteria.location | ||
}); | ||
}, | ||
|
||
handleVisualConfigurationChanged(newConfiguration) { | ||
this.setProperties(newConfiguration); | ||
}, | ||
|
||
navigateToAppointment(calendarEvent) { | ||
this.send('editAppointment', calendarEvent.referencedAppointment); | ||
}, | ||
|
||
updateAppointment(calendarEvent) { | ||
let appointmentToUpdate = calendarEvent.referencedAppointment; | ||
let newEnd = calendarEvent.end.local().toDate(); | ||
let newStart = calendarEvent.start.local().toDate(); | ||
set(appointmentToUpdate, 'startDate', newStart); | ||
set(appointmentToUpdate, 'endDate', newEnd); | ||
appointmentToUpdate.save().catch((error) => { | ||
this.send('error', error, 'appointments.calendar'); | ||
}); | ||
} | ||
} | ||
}); |
Oops, something went wrong.