36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
import BaseRoute from '../base';
|
|
import EmberObject, { computed } from '@ember/object';
|
|
import RSVP from 'rsvp';
|
|
|
|
export default BaseRoute.extend({
|
|
breadcrumbs: [{route: 'customer-application.list', params: 1, text: 'Customer Application'},
|
|
{text: 'Create Customer Application'}],
|
|
modelClass: EmberObject.extend({
|
|
hasImage: computed('images.@each.file', function() {
|
|
return this.get('images').filter(image => image.file).length > 0;
|
|
})
|
|
}),
|
|
model() {
|
|
return RSVP.hash({
|
|
enabled: true,
|
|
images: [{}],
|
|
attachments: [{}],
|
|
users: this.get('store').ajaxGet('user/list-for-select')
|
|
});
|
|
},
|
|
actions: {
|
|
addImage() {
|
|
this.get('controller.model.images').pushObject({});
|
|
},
|
|
removeImage(image) {
|
|
this.get('controller.model.images').removeObject(image);
|
|
},
|
|
addAttachment() {
|
|
this.get('controller.model.attachments').pushObject({});
|
|
},
|
|
removeAttachment(attachment) {
|
|
this.get('controller.model.attachments').removeObject(attachment);
|
|
}
|
|
}
|
|
});
|