salix/modules/ticket/front/dms/index/index.js

74 lines
2.2 KiB
JavaScript
Raw Normal View History

import ngModule from '../../module';
2020-03-18 07:35:59 +00:00
import Section from 'salix/components/section';
import './style.scss';
2020-03-18 07:35:59 +00:00
class Controller extends Section {
constructor($element, $) {
super($element, $);
this.filter = {
include: {
relation: 'dms',
scope: {
fields: [
'dmsTypeFk',
'workerFk',
2019-07-19 06:13:52 +00:00
'hardCopyNumber',
'reference',
'description',
'hasFile',
'file',
'created',
],
include: [{
relation: 'dmsType',
scope: {
fields: ['name']
}
},
{
relation: 'worker',
scope: {
fields: ['userFk'],
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
},
}
}]
},
}
};
}
showWorkerDescriptor(event, workerFk) {
event.preventDefault();
event.stopImmediatePropagation();
this.$.workerDescriptor.parent = event.target;
this.$.workerDescriptor.workerFk = workerFk;
this.$.workerDescriptor.show();
}
showDeleteConfirm(index) {
this.dmsIndex = index;
this.$.confirm.show();
}
deleteDms(response) {
2019-10-30 15:57:14 +00:00
if (response === 'accept') {
const dmsFk = this.ticketDms[this.dmsIndex].dmsFk;
const query = `ticketDms/${dmsFk}/removeFile`;
this.$http.post(query).then(() => {
this.$.model.remove(this.dmsIndex);
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
});
}
}
}
ngModule.component('vnTicketDmsIndex', {
template: require('./index.html'),
controller: Controller,
});