import Route from '@ember/routing/route'; import { inject as service } from '@ember/service'; import BaseRoute from 'hino-hearts/routes/base'; export default BaseRoute.extend({ hoyuEventApproval : service(), hoyuEventApprovalData : service(), hoyuEventApprovalListData: service(), hoyuEventApprovalAttachmentData: service(), hoyuEventApprovalBudgetData: service(), store : service(), init() { this._super(...arguments); }, async model(params) { this.hoyuEventApproval.setModel(null); return await this.hoyuEventApprovalData.getData(params.id, { include: 'hoyu-event-approval-list,hoyu-event-approval-attachment,hoyu-event-approval-budget' }) .then(async response => { this.hoyuEventApproval.setModel(response); await this.hoyuEventApprovalListData.getList({include: 'hoyu-event-approval', filter:{"hoyuEventApproval" : {"id" : response.id}}}).then(responseDetail => { this.hoyuEventApproval.clearDetail("hoyuEventApprovalList"); responseDetail.forEach(item => { this.hoyuEventApproval.addRow(item, "hoyuEventApprovalList"); }); }); await this.hoyuEventApprovalAttachmentData.getList({include: 'attachment,hoyu-event-approval', filter:{"hoyuEventApproval" : {"id" : response.id}}}).then(responseDetail => { this.hoyuEventApproval.clearDetail("hoyuEventApprovalAttachment"); responseDetail.forEach(item => { this.hoyuEventApproval.addRow(item, "hoyuEventApprovalAttachment"); }); }); await this.hoyuEventApprovalBudgetData.getList({include: 'hoyu-event-approval', filter:{"hoyuEventApproval" : {"id" : response.id}}}).then(responseDetail => { this.hoyuEventApproval.clearDetail("hoyuEventApprovalBudget"); responseDetail.forEach(item => { this.hoyuEventApproval.addRow(item, "hoyuEventApprovalBudget"); }); }); return response; }); }, templateName : 'hoyu-event-approval/input'});