import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; export default Controller.extend({ syncLog : service(), syncLogData : service(), session : service(), errors : service(), didValidate: false, rightActionInProgress: false, formConfig : { sourceSystemNo : { isEditable : true }, documentType : { isEditable : true }, tableName : { isEditable : true }, targetSync : { isEditable : true }, syncType : { isEditable : true }, syncStatus : { isEditable : true }, errorMessage : { isEditable : true }, documentLogId : { isEditable : true }, }, init() { this._super(...arguments); }, actions: { async saveSyncLog() { this.set("rightActionInProgress", true); this.get('model') .validate() .then(async ({ validations }) => { this.set('didValidate', true); if (validations.get('isValid')) { this.set('syncLog.model.isApprovalData', false); this.syncLogData.save(this.syncLog.model).then(response => { if (response != undefined) { this.transitionToRoute('sync-log.detail', response.id); } }) .catch((e) => { this.set("rightActionInProgress", false); this.set('errorMessages', this.errors.getErrorMessages(e)); }); } else { this.set("rightActionInProgress", false); } }); }, }, });