import ngModule from '../../module'; import Section from 'salix/components/section'; import './style.scss'; class Controller extends Section { constructor($element, $, vnFile) { super($element, $); this.vnFile = vnFile; this.filter = { include: { relation: 'dms', scope: { fields: [ 'dmsTypeFk', 'workerFk', 'hardCopyNumber', 'reference', 'description', 'hasFile', 'file', 'created', ], include: [{ relation: 'dmsType', scope: { fields: ['name'] } }, { relation: 'worker', scope: { fields: ['userFk'], include: { relation: 'user', scope: { fields: ['nickname'] } }, } }] }, } }; } deleteDms(index) { const dmsFk = this.ticketDms[index].dmsFk; this.$http.post(`ticketDms/${dmsFk}/removeFile`) .then(() => { this.$.model.remove(index); this.vnApp.showSuccess(this.$t('Data saved!')); }); } downloadFile(dmsId) { this.vnFile.download(`api/dms/${dmsId}/downloadFile`); } } Controller.$inject = ['$element', '$scope', 'vnFile']; ngModule.component('vnTicketDmsIndex', { template: require('./index.html'), controller: Controller, });