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-03-18 11:55:22 +00:00
|
|
|
constructor($element, $) {
|
2019-11-22 12:46:38 +00:00
|
|
|
super($element, $);
|
2019-11-22 09:42:05 +00:00
|
|
|
this.filter = {
|
|
|
|
include: {
|
|
|
|
relation: 'dms',
|
|
|
|
scope: {
|
|
|
|
fields: [
|
|
|
|
'dmsTypeFk',
|
|
|
|
'reference',
|
|
|
|
'hardCopyNumber',
|
|
|
|
'workerFk',
|
|
|
|
'description',
|
|
|
|
'hasFile',
|
|
|
|
'file',
|
|
|
|
'created',
|
|
|
|
],
|
2020-04-28 12:26:02 +00:00
|
|
|
include: [
|
|
|
|
{
|
|
|
|
relation: 'dmsType',
|
|
|
|
scope: {
|
|
|
|
fields: ['name']
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
relation: 'worker',
|
|
|
|
scope: {
|
|
|
|
fields: ['userFk'],
|
|
|
|
include: {
|
|
|
|
relation: 'user',
|
|
|
|
scope: {
|
|
|
|
fields: ['nickname']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
2019-11-22 09:42:05 +00:00
|
|
|
}
|
2020-04-28 12:26:02 +00:00
|
|
|
]
|
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
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ngModule.component('vnWorkerDmsIndex', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
});
|