hino / app / components / app-button-approval.js
app-button-approval.js
Raw
import Component from '@ember/component';
import {computed} from '@ember/object';

export default Component.extend({
	model : "approve",
	inboxModel: null,
    config : null,
	submitAction: "",
	isShowReloadButton: false,
    init() {
        this._super(...arguments);
	},

	showApprovalButton: computed('inboxModel', function(){
		let inbox = this.get('inboxModel');
		let statusId = this.get('inboxModel.statusId');
		let syncStatus = this.get('inboxModel.syncStatus');

		if(inbox == null) return false;
		if(statusId != "1") return false;
		if(syncStatus == null || syncStatus == '' || syncStatus == 'FAILED') return true;
		return false;
	}),

	checkConfig: computed('inboxModel', function() {
		return this.get('config');
	}),

    actions : {
        submitButtonAction() {
            if (this.submitAction != "") {
                this.attrs.submitAction();
            }
		},
		reloadButtonAction() {
            if (this.reloadAction != "") {
                this.attrs.reloadAction();
            }
        }
    }
});