2019-11-22 09:42:05 +00:00
|
|
|
import ngModule from '../../module';
|
2019-11-22 12:46:38 +00:00
|
|
|
import Component from 'core/lib/component';
|
2019-11-22 09:42:05 +00:00
|
|
|
import './style.scss';
|
|
|
|
|
2019-11-22 12:46:38 +00:00
|
|
|
class Controller extends Component {
|
2020-06-12 12:28:29 +00:00
|
|
|
constructor($element, $, vnFile) {
|
2019-11-22 12:46:38 +00:00
|
|
|
super($element, $);
|
2020-06-12 12:28:29 +00:00
|
|
|
this.vnFile = vnFile;
|
2024-04-08 12:46:35 +00:00
|
|
|
this.filter = {
|
|
|
|
include: {
|
|
|
|
relation: 'dms',
|
|
|
|
scope: {
|
|
|
|
fields: [
|
|
|
|
'dmsTypeFk',
|
|
|
|
'reference',
|
|
|
|
'hardCopyNumber',
|
|
|
|
'workerFk',
|
|
|
|
'description',
|
|
|
|
'hasFile',
|
|
|
|
'file',
|
|
|
|
'created',
|
|
|
|
'companyFk',
|
|
|
|
'warehouseFk',
|
|
|
|
],
|
|
|
|
include: [
|
|
|
|
{
|
|
|
|
relation: 'dmsType',
|
|
|
|
scope: {
|
|
|
|
fields: ['name'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
relation: 'worker',
|
|
|
|
scope: {
|
|
|
|
fields: ['id'],
|
|
|
|
include: {
|
|
|
|
relation: 'user',
|
|
|
|
scope: {
|
|
|
|
fields: ['name'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2019-11-22 09:42:05 +00:00
|
|
|
}
|
|
|
|
|
2020-04-28 12:26:02 +00:00
|
|
|
deleteDms(index) {
|
|
|
|
const workerDmsId = this.workerDms[index].dmsFk;
|
|
|
|
return this.$http.post(`WorkerDms/${workerDmsId}/removeFile`)
|
|
|
|
.then(() => {
|
|
|
|
this.$.model.remove(index);
|
|
|
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
2019-11-22 09:42:05 +00:00
|
|
|
});
|
|
|
|
}
|
2020-06-12 12:28:29 +00:00
|
|
|
|
2023-05-29 13:21:37 +00:00
|
|
|
downloadFile(dmsId, isDocuware) {
|
|
|
|
if (isDocuware) return this.vnFile.download(`api/workerDms/${dmsId}/docuwareDownload`);
|
2020-06-12 12:28:29 +00:00
|
|
|
this.vnFile.download(`api/workerDms/${dmsId}/downloadFile`);
|
|
|
|
}
|
2023-05-31 09:32:37 +00:00
|
|
|
|
|
|
|
async openDocuware() {
|
|
|
|
const url = await this.vnApp.getUrl(`WebClient`, 'docuware');
|
|
|
|
if (url) window.open(url).focus();
|
|
|
|
}
|
2019-11-22 09:42:05 +00:00
|
|
|
}
|
|
|
|
|
2020-06-12 12:28:29 +00:00
|
|
|
Controller.$inject = ['$element', '$scope', 'vnFile'];
|
|
|
|
|
2020-07-24 12:22:30 +00:00
|
|
|
ngModule.vnComponent('vnWorkerDmsIndex', {
|
2019-11-22 09:42:05 +00:00
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
});
|