|
@@ -142,6 +142,7 @@
|
|
|
newProUid: '',
|
|
|
reloading: false,
|
|
|
comment: '',
|
|
|
+ preparing: false,
|
|
|
|
|
|
// debounced auto-saver
|
|
|
<?php for ($i=0; $i<count($categories); $i++) { ?>
|
|
@@ -186,23 +187,69 @@
|
|
|
},
|
|
|
methods: {
|
|
|
|
|
|
- erxShowPopup: function(_item) {
|
|
|
- this.erxPopupMode = _item ? 'edit' : 'add';
|
|
|
- this.erxPopupItem = _item ? JSON.parse(JSON.stringify(_item)) : JSON.parse(JSON.stringify(this.erxModel));
|
|
|
- this.erxPopupItem.assigned_pro_uid = '';
|
|
|
- this.erxPopupItem.ordering_pro_uid = '';
|
|
|
- if(!this.erxPopupItem.comments) this.erxPopupItem.comments = [];
|
|
|
+ // common show popup
|
|
|
+ preparePopup: function(_type, _item) {
|
|
|
+ this.preparing = true;
|
|
|
+ this[_type + 'PopupMode'] = _item ? 'edit' : 'add';
|
|
|
+ this[_type + 'PopupItem'] = _item ? JSON.parse(JSON.stringify(_item)) : JSON.parse(JSON.stringify(this[_type + 'Model']));
|
|
|
+ this[_type + 'PopupItem'].assigned_pro_uid = '';
|
|
|
+ this[_type + 'PopupItem'].ordering_pro_uid = '';
|
|
|
+ if(!this[_type + 'PopupItem'].data.comments) {
|
|
|
+ this[_type + 'PopupItem'].data.comments = [];
|
|
|
+ }
|
|
|
+ else if(this[_type + 'PopupItem'].data.comments.length === 1 && !this[_type + 'PopupItem'].data.comments[0].pro_id) {
|
|
|
+ this[_type + 'PopupItem'].data.comments = [];
|
|
|
+ }
|
|
|
this.comment = '';
|
|
|
- showStagPopup('erx-popup', true);
|
|
|
+ this.preparing = false;
|
|
|
+ },
|
|
|
+ reinitProSuggest: function() {
|
|
|
+ $('#ticketsApp [pro-suggest-initialized]').removeAttr('pro-suggest-initialized');
|
|
|
+ initProSuggest();
|
|
|
+ },
|
|
|
+ postShowPopup: function(_type, _item) {
|
|
|
+ if (_item) {
|
|
|
+ this.currentCategory = _type;
|
|
|
+ this.currentItemUid = _item.uid;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // category specific show popup
|
|
|
+ erxShowPopup: function(_item) {
|
|
|
+ this.preparePopup('erx', _item);
|
|
|
Vue.nextTick(() => {
|
|
|
- $('#ticketsApp [pro-suggest-initialized]').removeAttr('pro-suggest-initialized');
|
|
|
- initProSuggest();
|
|
|
- if (_item) {
|
|
|
- this.currentCategory = 'erx';
|
|
|
- this.currentItemUid = _item.uid;
|
|
|
- }
|
|
|
+ showStagPopup('erx-popup', true);
|
|
|
+ this.reinitProSuggest();
|
|
|
+ this.postShowPopup('erx', _item);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ labShowPopup: function(_item) {
|
|
|
+ this.preparePopup('lab', _item);
|
|
|
+ Vue.nextTick(() => {
|
|
|
+ showStagPopup('lab-popup', true);
|
|
|
+ this.reinitProSuggest();
|
|
|
+ this.labInitICDAutoSuggest();
|
|
|
+ this.postShowPopup('lab', _item);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ imagingShowPopup: function(_item) {
|
|
|
+ this.preparePopup('imaging', _item);
|
|
|
+ Vue.nextTick(() => {
|
|
|
+ showStagPopup('imaging-popup', true);
|
|
|
+ this.reinitProSuggest();
|
|
|
+ this.imagingInitICDAutoSuggest();
|
|
|
+ this.postShowPopup('imaging', _item);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ equipmentShowPopup: function(_item) {
|
|
|
+ this.preparePopup('equipment', _item);
|
|
|
+ Vue.nextTick(() => {
|
|
|
+ showStagPopup('equipment-popup', true);
|
|
|
+ this.reinitProSuggest();
|
|
|
+ this.postShowPopup('equipment', _item);
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
erxSavePopupItem: function(_autoSave = false) {
|
|
|
let form = $('#ticketsApp [stag-popup-key="erx-popup"] form').first();
|
|
|
if(!_autoSave) {
|
|
@@ -254,24 +301,7 @@
|
|
|
this.erxPopupItem.data.comments.push(comment);
|
|
|
this.erxSavePopupItem(true);
|
|
|
},
|
|
|
- labShowPopup: function(_item) {
|
|
|
- this.labPopupMode = _item ? 'edit' : 'add';
|
|
|
- this.labPopupItem = _item ? JSON.parse(JSON.stringify(_item)) : JSON.parse(JSON.stringify(this.labModel));
|
|
|
- this.labPopupItem.assigned_pro_uid = '';
|
|
|
- this.labPopupItem.ordering_pro_uid = '';
|
|
|
- if(!this.labPopupItem.comments) this.labPopupItem.comments = [];
|
|
|
- this.comment = '';
|
|
|
- showStagPopup('lab-popup', true);
|
|
|
- Vue.nextTick(() => {
|
|
|
- $('#ticketsApp [pro-suggest-initialized]').removeAttr('pro-suggest-initialized');
|
|
|
- initProSuggest();
|
|
|
- this.labInitICDAutoSuggest();
|
|
|
- if (_item) {
|
|
|
- this.currentCategory = 'lab';
|
|
|
- this.currentItemUid = _item.uid;
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
+
|
|
|
labSavePopupItem: function(_autoSave = false) {
|
|
|
let form = $('#ticketsApp [stag-popup-key="lab-popup"] form').first();
|
|
|
if(!_autoSave) {
|
|
@@ -323,24 +353,7 @@
|
|
|
this.labPopupItem.data.comments.push(comment);
|
|
|
this.labSavePopupItem(true);
|
|
|
},
|
|
|
- imagingShowPopup: function(_item) {
|
|
|
- this.imagingPopupMode = _item ? 'edit' : 'add';
|
|
|
- this.imagingPopupItem = _item ? JSON.parse(JSON.stringify(_item)) : JSON.parse(JSON.stringify(this.imagingModel));
|
|
|
- this.imagingPopupItem.assigned_pro_uid = '';
|
|
|
- this.imagingPopupItem.ordering_pro_uid = '';
|
|
|
- if(!this.imagingPopupItem.comments) this.imagingPopupItem.comments = [];
|
|
|
- this.comment = '';
|
|
|
- showStagPopup('imaging-popup', true);
|
|
|
- Vue.nextTick(() => {
|
|
|
- $('#ticketsApp [pro-suggest-initialized]').removeAttr('pro-suggest-initialized');
|
|
|
- initProSuggest();
|
|
|
- this.imagingInitICDAutoSuggest();
|
|
|
- if (_item) {
|
|
|
- this.currentCategory = 'imaging';
|
|
|
- this.currentItemUid = _item.uid;
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
+
|
|
|
imagingSavePopupItem: function(_autoSave = false) {
|
|
|
let form = $('#ticketsApp [stag-popup-key="imaging-popup"] form').first();
|
|
|
if(!_autoSave) {
|
|
@@ -392,23 +405,7 @@
|
|
|
this.imagingPopupItem.data.comments.push(comment);
|
|
|
this.imagingSavePopupItem(true);
|
|
|
},
|
|
|
- equipmentShowPopup: function(_item) {
|
|
|
- this.equipmentPopupMode = _item ? 'edit' : 'add';
|
|
|
- this.equipmentPopupItem = _item ? JSON.parse(JSON.stringify(_item)) : JSON.parse(JSON.stringify(this.equipmentModel));
|
|
|
- this.equipmentPopupItem.assigned_pro_uid = '';
|
|
|
- this.equipmentPopupItem.ordering_pro_uid = '';
|
|
|
- if(!this.equipmentPopupItem.comments) this.equipmentPopupItem.comments = [];
|
|
|
- this.comment = '';
|
|
|
- showStagPopup('equipment-popup', true);
|
|
|
- Vue.nextTick(() => {
|
|
|
- $('#ticketsApp [pro-suggest-initialized]').removeAttr('pro-suggest-initialized');
|
|
|
- initProSuggest();
|
|
|
- if (_item) {
|
|
|
- this.currentCategory = 'equipment';
|
|
|
- this.currentItemUid = _item.uid;
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
+
|
|
|
equipmentSavePopupItem: function(_autoSave = false) {
|
|
|
let form = $('#ticketsApp [stag-popup-key="equipment-popup"] form').first();
|
|
|
if(!_autoSave) {
|