37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
import { get, set } from '@ember/object';
|
|
import { inject as service } from '@ember/service';
|
|
import BaseEditRoute from '../base-edit';
|
|
|
|
export default BaseEditRoute.extend({
|
|
issueService: service('customer-issue/service'),
|
|
afterModel(model) {
|
|
let me = this;
|
|
me._super(...arguments);
|
|
|
|
me.set('breadcrumbs',
|
|
[{route: 'customer.list', params: 1, text: 'Customers'},
|
|
{text: 'Show Customer [' + model.id2 + ']'}]);
|
|
|
|
if (model.applications) {
|
|
let selected = model.applications.split(String.fromCharCode(0x1d));
|
|
model.applicationList.forEach(a => {
|
|
a.selected = selected.includes(a.id);
|
|
});
|
|
}
|
|
|
|
set(model, 'userAccounts', get(model, 'users').mapBy('account').join(', '));
|
|
},
|
|
actions: {
|
|
removeIssue(issue) {
|
|
let me = this;
|
|
me.get('dialog').confirm('Are you sure to remove customer comment?', () => {
|
|
set(issue, 'enabled', false);
|
|
me.get('issueService').update(issue).then(() => {
|
|
me.get('message').alert('Comment removed');
|
|
me.get('controller.model.issues').removeObject(issue);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
});
|