Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Incident reporting #987

Merged
merged 40 commits into from
Mar 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1056c54
Initial commit from OasisHospital/frontend
jkleinsc May 27, 2016
e48996d
Merge branch 'master' into incident-reporting
jkleinsc Oct 25, 2016
c91f442
Fixed missing translations for incident reporting.
jkleinsc Oct 26, 2016
b55368f
Fixed localization.
jkleinsc Oct 26, 2016
c0e68a1
Prod build for testing.
jkleinsc Oct 26, 2016
0ba28ea
Merge branch 'master' into incident-reporting
jkleinsc Feb 7, 2017
5b00793
Added date filter for sortable columns
jkleinsc Feb 10, 2017
b08ec9d
Fixed taking pictures with webcam
jkleinsc Feb 10, 2017
ddd4a22
Move incident feedback to incident notes
jkleinsc Feb 10, 2017
fcb3b07
Changed to use consistent logic to generate friendlyid
jkleinsc Feb 10, 2017
a9237a0
Added logic to override page limit
jkleinsc Feb 10, 2017
1c27526
Move common filtering/sorting functionality to mixin
jkleinsc Feb 10, 2017
8161072
Removed unneeded code
jkleinsc Feb 10, 2017
e9acce0
Changed completed listing to work like index listing.
jkleinsc Feb 10, 2017
6de08be
Fixed delete messages
jkleinsc Feb 10, 2017
5da4aeb
Updates to incident per latest requirements
jkleinsc Feb 10, 2017
8703513
Fixed error with Ember inspector loading on load db screen
jkleinsc Feb 13, 2017
a4872d6
Webrtc-adapter was pointing to wrong file
jkleinsc Feb 13, 2017
1dea5e1
Added attachments to incidents
jkleinsc Feb 14, 2017
494bb1c
Merge branch 'master' into incident-reporting
jkleinsc Feb 14, 2017
3731afd
Merge branch 'master' into incident-reporting
jkleinsc Feb 15, 2017
b79b86e
Change where incident attachments are saved.
jkleinsc Feb 16, 2017
255d786
Fix server uploading of images/attachments
jkleinsc Feb 16, 2017
09f47aa
Merge branch 'master' into incident-reporting
jkleinsc Feb 16, 2017
703ee67
Added custom forms to incident reporting.
jkleinsc Feb 17, 2017
f34b5dd
Merge branch 'master' into incident-reporting
jkleinsc Feb 23, 2017
162c340
Fix missed localization.
jkleinsc Feb 23, 2017
8d8e683
Cleaned up incident category
jkleinsc Feb 23, 2017
b3a969f
New lookup list service
jkleinsc Feb 23, 2017
3f79a93
Cleaned up code.
jkleinsc Feb 24, 2017
11bb6b2
Merge branch 'master' into incident-reporting
jkleinsc Mar 6, 2017
14e6d5d
Merge branch 'master' into incident-reporting
jkleinsc Mar 6, 2017
8f1b537
Fixes for tests that weren't passing.
jkleinsc Mar 7, 2017
9acaf32
Starting incident-reporting acceptance test
jkleinsc Mar 8, 2017
64618e7
Updated incident acceptance tests
jkleinsc Mar 11, 2017
fcf3b89
Refactored operative test to use its own fixture.
jkleinsc Mar 13, 2017
96201d7
Fixed issues with incident testing.
jkleinsc Mar 13, 2017
a2d6c14
Update test for changes to abstract-edit-controller.
jkleinsc Mar 13, 2017
f6b60c5
Merge branch 'master' into incident-reporting
jkleinsc Mar 13, 2017
f693eff
Moving operative test to its own fixture.
jkleinsc Mar 13, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/admin/custom-forms/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export default AbstractEditController.extend({
}),

formTypeValues: [
'incident',
'operativePlan',
'patient',
'socialwork',
Expand Down
21 changes: 16 additions & 5 deletions app/admin/lookup/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import VisitTypes from 'hospitalrun/mixins/visit-types';
import { EKMixin, keyDown } from 'ember-keyboard';

const {
computed, get
computed, get, inject
} = Ember;

export default Ember.Controller.extend(BillingCategories, EKMixin,
InventoryTypeList, ModalHelper, UnitTypes, VisitTypes, {
fileSystem: Ember.inject.service('filesystem'),
fileSystem: inject.service('filesystem'),
lookupLists: inject.service(),

canEditValues: computed('model.lookupType', function() {
let lookupType = this.get('model.lookupType');
Expand Down Expand Up @@ -95,6 +96,12 @@ export default Ember.Controller.extend(BillingCategories, EKMixin,
'locationsAffected' // Special use case that we need to handle
]
}
}, {
name: this.get('i18n').t('admin.lookup.incidentDepartments'),
value: 'incident_departments',
models: {
incident: 'department'
}
}, {
defaultValues: 'defaultInventoryTypes',
name: this.get('i18n').t('admin.lookup.inventoryTypes'),
Expand Down Expand Up @@ -309,6 +316,8 @@ export default Ember.Controller.extend(BillingCategories, EKMixin,
let message = i18n.t('admin.lookup.alertImportListSaveMessage');
let title = i18n.t('admin.lookup.alertImportListSaveTitle');
lookupTypeList.save().then(() => {
let lookupLists = get(this, 'lookupLists');
lookupLists.resetLookupList(get(lookupTypeList, 'id'));
this.displayAlert(title, message);
this.set('importFile');
this.set('model.importFileName');
Expand Down Expand Up @@ -373,12 +382,14 @@ export default Ember.Controller.extend(BillingCategories, EKMixin,
},
updateList() {
let lookupTypeList = this.get('lookupTypeList');
lookupTypeList.save().then(function() {
lookupTypeList.save().then(() => {
let lookupLists = get(this, 'lookupLists');
lookupLists.resetLookupList(get(lookupTypeList, 'id'));
this.displayAlert(
this.get('i18n').t('admin.lookup.alertImportListUpdateTitle'),
this.get('i18n').t('admin.lookup.alertImportListUpdateMessage')
);
}.bind(this));
});
},
updateValue(valueObject) {
let updateList = false;
Expand All @@ -399,7 +410,7 @@ export default Ember.Controller.extend(BillingCategories, EKMixin,
values.addObject(value);
values = values.sort(this._sortValues);
lookupTypeList.set('value', values);
lookupTypeList.save();
this.send('updateList');
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions app/admin/roles/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ export default AbstractEditController.extend(UserRoles, UserSession, {
'completeImaging',
'deleteImaging'
]
}, {
name: 'incident',
capabilities: [
'incident',
'addIncident',
'addIncidentCategory',
'deleteIncident',
'deleteIncidentCategory',
'manageIncidents',
'generateIncidentReport'
]
}, {
name: 'inventory',
capabilities: [
Expand Down
76 changes: 18 additions & 58 deletions app/components/custom-form-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,77 +2,37 @@ import Ember from 'ember';
import SelectValues from 'hospitalrun/utils/select-values';

const {
computed,
isEmpty
Component,
computed: {
alias
},
get,
inject
} = Ember;

export default Ember.Component.extend(SelectValues, {
customForms: Ember.inject.service(),
export default Component.extend(SelectValues, {
customForms: inject.service(),
formType: null,
formsForType: null,
model: null,
openModalAction: 'openModal',

formsForSelect: alias('customForms.formsForSelect'),
formsToDisplay: alias('customForms.formsToDisplay'),
showAddButton: alias('customForms.showAddButton'),

didReceiveAttrs(/* attrs */) {
this._super(...arguments);
let customForms = this.get('customForms');
let formType = this.get('formType');
customForms.getCustomForms([formType]).then((forms) => {
let isDestroyed = this.get('isDestroyed');
if (!isDestroyed) {
this.set('formsForType', forms);
}
});
let customForms = get(this, 'customForms');
let formType = get(this, 'formType');
let model = get(this, 'model');
customForms.setupForms(formType, model);
},

formsForSelect: computed('formsForType', 'usedForms', function() {
let formsForType = this.get('formsForType');
let usedForms = this.get('usedForms');
if (!isEmpty(formsForType)) {
let formsForSelect = formsForType.filter((customForm) => {
return (!usedForms.includes(customForm.get('id')));
});
formsForSelect = formsForSelect.map((customForm) => {
return {
id: customForm.get('id'),
value: customForm.get('name')
};
});
return formsForSelect;
}
}),

formsToDisplay: computed('formsForType', 'model.customForms', function() {
let formsForType = this.get('formsForType');
let modelForms = this.get('model.customForms');
if (!isEmpty(modelForms) && !isEmpty(formsForType)) {
return Object.keys(modelForms).map((formId) => {
return {
form: formsForType.findBy('id', formId),
propertyPrefix: `customForms.${formId}.`
};
});
}
}),

usedForms: computed('model.customForms', function() {
let modelForms = this.get('model.customForms');
if (isEmpty(modelForms)) {
return [];
} else {
return Object.keys(modelForms);
}
}),

showAddButton: computed('formsForSelect', function() {
let formsForSelect = this.get('formsForSelect');
return !isEmpty(formsForSelect);
}),

actions: {
addForm() {
let model = this.get('model');
let formsForSelect = this.get('formsForSelect');
let model = get(this, 'model');
let formsForSelect = get(this, 'formsForSelect');
this.sendAction('openModalAction', 'custom-form-add', Ember.Object.create({
modelToAddTo: model,
customForms: formsForSelect
Expand Down
19 changes: 19 additions & 0 deletions app/components/date-filter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Ember from 'ember';
import PikadayComponent from 'hospitalrun/mixins/pikaday-component';

const {
Component
} = Ember;

export default Component.extend(PikadayComponent, {
classNames: ['input-group'],
dateSetAction: 'filter',

actions: {
clearFilter() {
let $input = this.$('input');
$input.val('');
this.sendAction('dateSetAction');
}
}
});
41 changes: 2 additions & 39 deletions app/components/date-input.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Ember from 'ember';
import HtmlInput from 'ember-rapid-forms/components/html-input';
export default HtmlInput.extend({
_picker: null,

import PikadayComponent from 'hospitalrun/mixins/pikaday-component';
export default HtmlInput.extend(PikadayComponent, {
_shouldSetDate(currentDate, picker) {
return (picker && (Ember.isEmpty(currentDate)
|| Ember.isEmpty(picker.getDate())
Expand Down Expand Up @@ -48,34 +47,6 @@ export default HtmlInput.extend({
}
},

didInsertElement() {
let currentDate = this.get('currentDate');
let $input = this.$('input');
let picker = null;
let props = this.getProperties('format', 'yearRange', 'showTime');

props.onSelect = this.dateSet.bind(this);

if (!Ember.isEmpty(this.get('minDate'))) {
props.minDate = this.get('minDate');
if (props.minDate === 'now') {
props.minDate = new Date();
}
}
if (!Ember.isEmpty(this.get('maxDate'))) {
props.maxDate = this.get('maxDate');
if (props.maxDate === 'now') {
props.maxDate = new Date();
}
}
props.field = $input[0];
picker = new Pikaday(props);
Ember.run.next(this, function() {
picker.setDate(currentDate);
});
this.set('_picker', picker);
},

didReceiveAttrs(/* attrs */) {
this._super(...arguments);
let dateProperty = this.get('mainComponent.originalPropery');
Expand All @@ -87,14 +58,6 @@ export default HtmlInput.extend({
this.yearRange = Ember.computed.alias('mainComponent.yearRange');
this.addObserver(`mainComponent.model.${dateProperty}`, this, this.currentDateChangedValue);
Ember.Binding.from(`mainComponent.model.errors.${dateProperty}`).to(`mainComponent.model.errors.${displayPropertyName}`).connect(this);
},

willDestroyElement() {
let picker = this.get('_picker');
if (picker) {
picker.destroy();
}
this.set('_picker', null);
}

});
21 changes: 16 additions & 5 deletions app/components/image-upload.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import Ember from 'ember';
import InputComponent from 'ember-rapid-forms/components/em-input';

const { isEmpty } = Ember;

export default InputComponent.extend({
fileInputEl: null,
isImage: true,
resizeFile: true,
selectedFile: null,
type: 'file',
Expand All @@ -9,20 +14,26 @@ export default InputComponent.extend({
let inputEl = this.get('fileInputEl');
let resize = this.get('resizeFile');

if (resize) {
if (!isEmpty(inputEl.files[0]) && resize) {
// Derived from https://github.com/josefrichter/resize/blob/master/public/preprocess.js
window.URL = window.URL || window.webkitURL;
let blobURL = window.URL.createObjectURL(inputEl.files[0]); // and get it's URL
// helper Image object
let image = new Image();
image.src = blobURL;
image.onload = function() {
image.addEventListener('load', function() {
window.URL.revokeObjectURL(blobURL);
// have to wait till it's loaded
this.set('selectedFile', this._resizeImage(image)); // send it to canvas

}.bind(this);
this.set('isImage', true);
}.bind(this));
image.addEventListener('error', function() {
// if image load fails, file probably isn't an image, so don't resize
window.URL.revokeObjectURL(blobURL);
this.set('selectedFile', inputEl.files[0]);
this.set('isImage', false);
}.bind(this));
} else {
this.set('isImage', false);
this.set('selectedFile', inputEl.files[0]);
}
},
Expand Down
4 changes: 2 additions & 2 deletions app/components/select-or-typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default Ember.Component.extend({
return contentList;
}
}
}.property('list'),
}.property('list.value.[]'),

usePricingTypeAhead: function() {
return (this.get('typeAheadType') === 'pricing');
Expand All @@ -45,5 +45,5 @@ export default Ember.Component.extend({
} else {
return true;
}
}.property('list')
}.property('list.userCanAdd')
});
Loading