74 lines
2.2 KiB
JavaScript
74 lines
2.2 KiB
JavaScript
import ngModule from '../../module';
|
|
import Component from 'core/lib/component';
|
|
import './style.scss';
|
|
|
|
class Controller extends Component {
|
|
constructor($element, $) {
|
|
super($element, $);
|
|
this.filter = {
|
|
include: {
|
|
relation: 'dms',
|
|
scope: {
|
|
fields: [
|
|
'dmsTypeFk',
|
|
'reference',
|
|
'hardCopyNumber',
|
|
'workerFk',
|
|
'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) {
|
|
if (response === 'accept') {
|
|
const workerDmsId = this.workerDms[this.dmsIndex].id;
|
|
const query = `WorkerDms/${workerDmsId}/removeFile`;
|
|
this.$http.post(query).then(() => {
|
|
this.$.model.remove(this.dmsIndex);
|
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
ngModule.component('vnWorkerDmsIndex', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
});
|