import Component from '@ember/component'; import { inject as service } from '@ember/service'; import { computed } from '@ember/object'; export default Component.extend({ session: service(), router: service(), leftRoute : "", leftAction : "", leftRouteArgs : "", leftRouteArgsHoyu : "", leftIcon : "bx-left-arrow-alt", rightRoute : "", rightAction : "", rightRouteArgs : "", rightIcon : "bxs-user-check", rightActionInProgress: false, currentRouteName : computed('router.currentRouteName', { get() { let currentRoute = this.get('router').get('currentRouteName'); let currentRouteArr = currentRoute.split("."); currentRoute = currentRouteArr[0]; return currentRoute; } }), init() { this._super(...arguments); }, actions: { leftButtonAction() { if (this.leftRoute == "vehicle-management.hoyu-faktur-approval"){ this.router.transitionTo(this.leftRoute,this.leftRouteArgs,this.leftRouteArgsHoyu); }else{ if (this.leftRoute != "") { if (this.leftRouteArgs != "") { if(this.get('setNullError')) { this.sendAction('setNullError',null); } this.router.transitionTo(this.leftRoute, this.leftRouteArgs); } else { if(this.get('setNullError')) { this.sendAction('setNullError',null); } this.router.transitionTo(this.leftRoute); } } else { if (this.leftAction != "") { this.attrs[this.leftAction](...arguments); } } } }, async rightButtonAction() { if (this.rightRoute != "") { if (this.rightRouteArgs != "") { this.router.transitionTo(this.rightRoute, this.rightRouteArgs); } else { this.router.transitionTo(this.rightRoute); } } else { if (!this.rightActionInProgress) { if (this.rightAction != "") { await this.attrs.rightAction(); } } } } } });