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

65 lines
1.9 KiB
JavaScript
Raw Normal View History

import ngModule from '../../module';
2020-03-17 10:17:50 +00:00
import Section from 'salix/components/section';
import './style.scss';
2020-03-17 10:17:50 +00:00
class Controller extends Section {
2020-06-12 12:28:29 +00:00
constructor($element, $, vnFile) {
super($element, $, vnFile);
this.vnFile = vnFile;
this.filter = {
include: {
relation: 'dms',
scope: {
fields: [
'dmsTypeFk',
'reference',
2019-07-19 06:13:52 +00:00
'hardCopyNumber',
'workerFk',
'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.clientDms[index].dmsFk;
return this.$http.post(`ClientDms/${dmsFk}/removeFile`)
.then(() => {
this.$.model.remove(index);
this.vnApp.showSuccess(this.$t('Data saved!'));
});
}
2020-06-12 12:28:29 +00:00
downloadFile(dmsId) {
this.vnFile.download(`api/dms/${dmsId}/downloadFile`);
}
}
2020-06-12 12:28:29 +00:00
Controller.$inject = ['$element', '$scope', 'vnFile'];
ngModule.vnComponent('vnClientDmsIndex', {
template: require('./index.html'),
controller: Controller,
});