hino / app / services / inbox-outstanding.js
inbox-outstanding.js
Raw
import RSVP from 'rsvp';
import Service, { inject as service } from '@ember/service';

export default Service.extend({
	store: service(),
	model: null,

	outstandingTransactionDMS: null,
	outstandingApprovalDMS: null,
	outstandingApprovalHOYU: null,

	setModel(data) {
		this.set("model", data);
	},

	loadOutstandingTransactionDMS() {
		return new RSVP.Promise((resolve, reject) => {
			return this.store.queryRecord('inboxDocumentCounter', {
				me: true
			}).then(content => {
				this.set('outstandingTransactionDMS', content);
				resolve();
			}, reject);
		});
	},

	loadOutstandingApprovalDMS() {
		return new RSVP.Promise((resolve, reject) => {
			return this.store.query('approvalInboxCounter', {
				dataSource: 'DMS'
			}).then((content) => {
				this.set('outstandingApprovalDMS', content);
				resolve();
			}, reject);
		});
	},

	loadOutstandingApprovalHOYU() {
		return new RSVP.Promise((resolve, reject) => {
			return this.store.queryRecord('approvalInboxCounter', {
				dataSource: 'HOYU'
			}).then(content => {
				this.set('outstandingApprovalHOYU', content);
				resolve();
			}, reject);
		});
	}
});