memoryPercent: function() { if (Ember.isEmpty(this.get('memoryCurrent')) || Ember.isEmpty(this.get('memoryMax'))) return null; return ((this.get('memoryCurrent') / this.get('memoryMax')) * 100).toFixed(0) + '%'; }.property('memoryCurrent', 'memoryMax'),
import Ember from 'ember'; import Base from 'ember-simple-auth/authorizers/base'; export default Base.extend({ session: Ember.inject.service(), authorize(session, setRequestHeader) { if (this.get('session.isAuthenticated') && !Ember.isEmpty(session.token) && !Ember.isEmpty(session.email)) { setRequestHeader('token', session.token); setRequestHeader('email', session.email); } } });
models[item.model] = models[item.model].filter((i) => { if (!Ember.isEmpty(i.get(item.children))) { return true; } });
finishUpdateDestinationCustomerDomainName() { var allowed = this.get('hasValidNewDestinationCustomerDomainName'); if (!allowed) { return false; } // TODO: Should we update more stuff? let destinationCustomerDomainName = this.get('newDestinationCustomerDomainName'); this.set('model.destinationCustomerDomainName', destinationCustomerDomainName); let sourceFullDomainName = this.get('model.sourceFullDomainName'); if (Ember.isEmpty(sourceFullDomainName)) { if (!Ember.isBlank(destinationCustomerDomainName)) { this.set('model.newSourceFullDomainName', destinationCustomerDomainName + '.com'); this.send('selectModelFromDomainName'); } } }, refreshAvailabilityCheck() { let store = this.get('store'); let record = this.get('model.destinationAvailabilityRecord'); store.query('availability', { id: record.get('id'), allowCache: false
authorize: function(jqXHR) { if (this.get('session.isAuthenticated') && !Ember.isEmpty(this.get('session.token'))) { jqXHR.setRequestHeader('Authorization', 'Bearer ' + this.get('session.token')); } }
return result; }, /** Transition to another state within the state machine. If the path is empty returns immediately. This method attempts to get a hash of the enter, exit and resolve states from the existing state cache. Processes the raw state information based on the passed in context. Creates a new transition object and triggers a new setupContext. @method transitionTo @param path @param context */ transitionTo(path) { // XXX When is transitionTo called with no path if (Ember.isEmpty(path)) { return; } // The ES6 signature of this function is `path, ...contexts` let currentState = get(this, 'currentState') || this; // First, get the enter, exit and resolve states for the current state // and specified path. If possible, use an existing cache. let hash = this.contextFreeTransition(currentState, path); // Next, process the raw state information for the contexts passed in. let transition = new Transition(hash); this.enterState(transition); this.triggerSetupContext(transition); },
quantityDiscrepency: function() { let locationQuantityTotal = this.get('locationQuantityTotal'); let quantity = this.get('model.quantity'); return (!Ember.isEmpty(locationQuantityTotal) && !Ember.isEmpty(quantity) && locationQuantityTotal !== quantity); }.property('locationQuantityTotal', 'model.quantity'),
disabled: Ember.computed('newTitle', function() { return Ember.isEmpty(this.get('newTitle')); })
iconUrl: '/assets/img/category-icons/' + e.codigoIcono + '.jpg', activo: true }); return emberObject; }); return categoriasIconos; }) }); }, setupController(controller, model) { this._super(controller, model); if (!Ember.isEmpty(model.obras)) { let currentObra = model.obras.objectAt(0); controller.set('currentObra', currentObra); controller.set('currentLatitude', currentObra.latitude); controller.set('currentLongitude', currentObra.longitude); } // Setup propiedades especiales de las obras model.obras.forEach((obra) => { obra.set( 'categoryObject', model.categoriasIconos.findBy('codigoIcono', obra.category) ); });
_generateLineItems: function(visit, visitChildren) { var endDate = visit.get('endDate'), imaging = visitChildren[0].value, labs = visitChildren[1].value, lineDetail, lineItem, lineItems = this.get('model.lineItems'), medication = visitChildren[2].value, procedures = visitChildren[3].value, startDate = visit.get('startDate'), visitCharges = visit.get('charges'); this.setProperties({ pharmacyCharges: [], supplyCharges: [], wardCharges: [] }); if (!Ember.isEmpty(endDate) && !Ember.isEmpty(startDate)) { endDate = moment(endDate); startDate = moment(startDate); var stayDays = endDate.diff(startDate, 'days'); if (stayDays > 1) { lineDetail = this.store.createRecord('line-item-detail', { id: PouchDB.utils.uuid(), name: 'Days', quantity: stayDays }); lineItem = this.store.createRecord('billing-line-item', { id: PouchDB.utils.uuid(), category: 'Hospital Charges', name: 'Room/Accomodation' }); lineItem.get('details').addObject(lineDetail); lineItems.addObject(lineItem); } } let pharmacyChargePromises = []; medication.forEach(function(medicationItem) { pharmacyChargePromises.push(this._addPharmacyCharge(medicationItem, 'inventoryItem')); }.bind(this)); this.set('wardCharges', visitCharges.map(this._mapWardCharge.bind(this))); procedures.forEach(function(procedure) { var charges = procedure.get('charges'); charges.forEach(function(charge) { if (charge.get('medicationCharge')) { pharmacyChargePromises.push(this._addPharmacyCharge(charge, 'medication')); } else { this._addSupplyCharge(charge, 'O.R.'); } }.bind(this)); }.bind(this)); labs.forEach(function(lab) { if (!Ember.isEmpty(imaging.get('labType'))) { this._addSupplyCharge(Ember.Object.create({ pricingItem: imaging.get('labType'), quantity: 1 }), 'Lab'); } lab.get('charges').forEach(function(charge) { this._addSupplyCharge(charge, 'Lab'); }.bind(this)); }.bind(this)); imaging.forEach(function(imaging) { if (!Ember.isEmpty(imaging.get('imagingType'))) { this._addSupplyCharge(Ember.Object.create({ pricingItem: imaging.get('imagingType'), quantity: 1 }), 'Imaging'); } imaging.get('charges').forEach(function(charge) { this._addSupplyCharge(charge, 'Imaging'); }.bind(this)); }.bind(this)); Ember.RSVP.all(pharmacyChargePromises).then(() => { lineItem = this.store.createRecord('billing-line-item', { id: PouchDB.utils.uuid(), name: 'Pharmacy', category: 'Hospital Charges' }); lineItem.get('details').addObjects(this.get('pharmacyCharges')); lineItems.addObject(lineItem); lineItem = this.store.createRecord('billing-line-item', { id: PouchDB.utils.uuid(), name: 'X-ray/Lab/Supplies', category: 'Hospital Charges' }); lineItem.get('details').addObjects(this.get('supplyCharges')); lineItems.addObject(lineItem); lineItem = this.store.createRecord('billing-line-item', { id: PouchDB.utils.uuid(), name: 'Ward Items', category: 'Hospital Charges' }); lineItem.get('details').addObjects(this.get('wardCharges')); lineItems.addObject(lineItem); lineItem = this.store.createRecord('billing-line-item', { id: PouchDB.utils.uuid(), name: 'Physical Therapy', category: 'Hospital Charges' }); lineItems.addObject(lineItem); lineItem = this.store.createRecord('billing-line-item', { id: PouchDB.utils.uuid(), name: 'Others/Misc', category: 'Hospital Charges' }); lineItems.addObject(lineItem); this.send('update', true); }); },
} else { let emptyResponse = {}; emptyResponse[type.modelName] = []; resolve(emptyResponse); } }); }, /** * @private * Look for nulls and maxvalues in start key because those keys can't be handled by the sort/list function */ _doesStartKeyContainSpecialCharacters(startkey) { let haveSpecialCharacters = false; let maxValue = this.get('maxValue'); if (!Ember.isEmpty(startkey) && Ember.isArray(startkey)) { startkey.forEach((keyvalue) => { if (keyvalue === null || keyvalue === maxValue) { haveSpecialCharacters = true; } }); } return haveSpecialCharacters; }, _startChangesToStoreListener: function() { let db = this.get('db'); if (db) { this.changes = db.changes({ since: 'now', live: true,
}, { name: 'eosf.navbar.support', href: serviceLinks.osfSupport }, { name: 'eosf.navbar.donate', href: 'https://cos.io/donate', type: 'donateToCOS' }, ], PREPRINTS: [ { name: 'eosf.navbar.addAPreprint', href: Ember.isEmpty(baseServiceUrl) ? serviceLinks.preprintsSubmit : baseServiceUrl + 'submit', type: 'addAPreprint' }, { name: 'eosf.navbar.search', href: Ember.isEmpty(baseServiceUrl) ? serviceLinks.preprintsDiscover : baseServiceUrl + 'discover', type: 'search' }, { name: 'eosf.navbar.support', href: serviceLinks.preprintsSupport }, { name: 'eosf.navbar.donate', href: 'https://cos.io/donate', type: 'donateToCOS'
function normalizeResponseHelper(serializer, store, modelClass, payload, id, requestType) { var normalizedResponse = serializer.normalizeResponse(store, modelClass, payload, id, requestType); var validationErrors = []; runInDebug(function () { validationErrors = validateDocumentStructure(normalizedResponse); }); assert('normalizeResponse must return a valid JSON API document:\n\t* ' + validationErrors.join('\n\t* '), Ember.isEmpty(validationErrors)); return normalizedResponse; }
contentionCurrent: function() { var contention = this.get('contention.system.llc.value'); if (Ember.isEmpty(contention)) contention = this.get('contention.llc.system.value'); if (Ember.isEmpty(contention) || contention < 0) return null; return contention.toFixed(2); }.property('contention.system.llc.value'),
var total = expenses.reduce(function(previousValue, expense) { if (!Ember.isEmpty(expense.cost)) { return previousValue + parseInt(expense.cost); } }, 0);
}, _handlePreview() { this._setHeight(); this.set('mode', 'previewing'); this.set('previewedOnce', true); this._fetchPreview(); }, _fetchPreview() { this.set('fetchingPreview', true); let markdown = this.get('input'); this.set('preview', ''); if (Ember.isEmpty(markdown)) { this.set('preview', this.get('nothingToPreviewMessage')); this.set('fetchingPreview', true); } else { let preview = this.get('store').createRecord('preview', { markdown: markdown }); preview.save().then((preview) => { this.get('mentionFetcher').fetchBodyWithMentions(preview, 'preview').then((body) => { this.set('preview', body); this.set('fetchingPreview', false); }); }); } }, _setHeight() { let height = this.$().css('height');
showPricingTypeTabs: function() { var pricingTypeList = this.get('pricingTypeList'); return (!Ember.isEmpty(pricingTypeList) && pricingTypeList.get('length') > 1); }.property('pricingTypeList'),
if (typeof this.legacySupport === 'function') { resourceHash = this.legacySupport(resourceHash); } return this._super(modelClass, resourceHash, prop); }, /* * implement encryption */ serializeAttribute(snapshot, json, key, attribute) { this._super(snapshot, json, key, attribute); // map includePlainOnCreate after serialization of attribute hash // but before encryption so we can just use the serialized hash if ( !Ember.isEmpty(attribute.options.includePlainOnCreate) && typeof attribute.options.includePlainOnCreate === 'string' ) { json[attribute.options.includePlainOnCreate] = json[key]; } // encrypt after serialization of attribute hash if ( attribute.options.encrypted !== false ) { json[key] = this.get('encryption').encrypt(json[key]); } } });
function() { return !Ember.isEmpty(this.get('model.email')) && !Ember.isEmpty(this.get('model.username')) && !Ember.isEmpty(this.get('model.password')) && !Ember.isEmpty(this.get('model.repassword')) && this.get('model.password') === this.get('model.repassword') && this.get('model.password').length >= 8 && this.get('model.email').indexOf("@") > 0; }),
saveAction:function(){ var self = this; var tpl = self.get("model.info.FormatTpl"); var result = []; for(var i=0;i<tpl.length;i++) { var result2 = {}; result2.Name = tpl[i].name; var data = []; if(tpl[i].data !== null && !Ember.isEmpty(tpl[i].data)){ var row = tpl[i].data; for(var j=0;j<row.length;j++) { var row2 = row[j]; if(row2.type === "select" && row2.data !== null && !Ember.isEmpty(row2.data)){ /* for(var k=0;k<row2.data.length;k++){ if(row2.data[k].checked === true){ tpl[i].data[j].default = row2.data[k].value; } } */ }else if(row2.type === "input"){ tpl[i].data[j].default = row2.tpl.replace(/<{##}>/,row2.input); } var result3 = {}; result3.Name = row2.name; result3.Value = tpl[i].data[j].default; data.pushObject(result3); } } result2.Data = data; result.pushObject(result2); } var data2 = JSON.stringify(result); var form = this.get("model.info"); form.Data = data2; form.IsSystemAdd = "Yes"; form.Tpl = JSON.stringify(tpl); form.Status = "Success"; //console.log(form); self.get("hardwareSrv").create(form).then(function(data) { if(data.Status==="success"){ Ember.$.notify({ message: "保存成功!" }, { animate: { enter: 'animated fadeInRight', exit: 'animated fadeOutRight' }, type: 'success' }); self.transitionToRoute('dashboard.company.hardware.list'); } else { Ember.$.notify({ title: "<strong>保存失败:</strong>", message: data.Message }, { animate: { enter: 'animated fadeInRight', exit: 'animated fadeOutRight' }, type: 'danger' }); } }); },
showTransactions: function() { let transactions = this.get('transactions'); return !Ember.isEmpty(transactions); }.property('transactions.[]'),
}).then(resp => { this.store.pushPayload(resp); var createdContribs = Ember.A(); resp.data.map((contrib) => { createdContribs.push(this.store.peekRecord('contributor', contrib.id)); }); return createdContribs; }); }, removeContributor(contributor) { return contributor.destroyRecord(); }, updateContributor(contributor, permissions, bibliographic) { if (!Ember.isEmpty(permissions)) contributor.set('permission', permissions); if (!Ember.isEmpty(bibliographic)) contributor.set('bibliographic', bibliographic); return contributor.save(); }, updateContributors(contributors, permissionsChanges, bibliographicChanges) { let payload = contributors .filter(contrib => contrib.id in permissionsChanges || contrib.id in bibliographicChanges) .map(contrib => { if (contrib.id in permissionsChanges) { contrib.set('permission', permissionsChanges[contrib.id]); } if (contrib.id in bibliographicChanges) {
return this.get('model.items').filter(function(item){ return Ember.isEmpty(item.get('parent_id')); });
haveAdditionalContacts: function() { var additionalContacts = this.get('model.additionalContacts'); return (!Ember.isEmpty(additionalContacts)); }.property('model.additionalContacts'),
init() { this.tokenPropertyName = Configuration.tokenPropertyName; this.authorizationHeaderName = Configuration.authorizationHeaderName; if (Configuration.authorizationPrefix || Configuration.authorizationPrefix === null) { this.authorizationPrefix = Configuration.authorizationPrefix; } }, /** Authorizes an XHR request by sending the `token` properties from the session in the `Authorization` header: ``` Authorization: Bearer <token> ``` @method authorize @param {object} data @param {function} block */ authorize(data = {}, block = () => {}) { const token = Ember.get(data, this.tokenPropertyName); const prefix = this.authorizationPrefix ? this.authorizationPrefix : ''; if (this.get('session.isAuthenticated') && !Ember.isEmpty(token)) { block(this.authorizationHeaderName, prefix + token); } } });
haveAddressOptions: function() { var addressOptions = this.get('addressOptions'); return (!Ember.isEmpty(addressOptions)); }.property('addressOptions'),
import Ember from 'ember'; export default AbstractModel.extend({ _attachments: DS.attr(), // Temporarily store file as attachment until it gets uploaded to the server coverImage: DS.attr('boolean'), fileName: DS.attr('string'), localFile: DS.attr('boolean'), patient: DS.belongsTo('patient', { async: false }), caption: DS.attr('string'), url: DS.attr('string'), downloadImageFromServer(imageRecord) { let me = this; let url = imageRecord.get('url'); let xhr = new XMLHttpRequest(); if (!Ember.isEmpty(url)) { // Make sure directory exists or is created before downloading. this.getPatientDirectory(imageRecord.get('patientId')); xhr.open('GET', url, true); xhr.responseType = 'blob'; xhr.onload = function() { let file = new Blob([xhr.response]); me.addImageToFileStore(file, null, imageRecord); }; xhr.send(); } } });
showExpenseTotal: function() { var expenses = this.get('model.expenses'); return (!Ember.isEmpty(expenses)); }.property('model.expenses.[]'),
'showMonthAfterYear', 'numberOfMonths', 'mainCalendar'].forEach(function(f) { if (!Em.isEmpty(that.get(f))) { pickerOptions[f] = that.get(f); } });
hasMemoryRange: function() { return !Ember.isEmpty(this.get('memoryCurrent')) && !Ember.isEmpty(this.get('memoryMax')); }.property('memoryCurrent', 'memoryMax'),