2019-06-06 11:59:11 +00:00
|
|
|
import ngModule from '../../module';
|
2019-05-28 09:26:54 +00:00
|
|
|
import './style.scss';
|
|
|
|
|
|
|
|
class Controller {
|
2019-06-06 11:59:11 +00:00
|
|
|
constructor($stateParams, $scope, $http, $translate, vnToken, vnApp) {
|
2019-05-28 09:26:54 +00:00
|
|
|
this.$stateParams = $stateParams;
|
|
|
|
this.$ = $scope;
|
|
|
|
this.$http = $http;
|
|
|
|
this.$translate = $translate;
|
2019-06-06 11:59:11 +00:00
|
|
|
this.accessToken = vnToken.token;
|
|
|
|
this.vnApp = vnApp;
|
2019-05-28 09:26:54 +00:00
|
|
|
this.filter = {
|
|
|
|
include: {
|
|
|
|
relation: 'dms',
|
|
|
|
scope: {
|
2019-06-06 11:59:11 +00:00
|
|
|
fields: [
|
|
|
|
'dmsTypeFk',
|
|
|
|
'workerFk',
|
2019-07-19 06:13:52 +00:00
|
|
|
'hardCopyNumber',
|
2019-06-06 11:59:11 +00:00
|
|
|
'reference',
|
|
|
|
'description',
|
|
|
|
'hasFile',
|
|
|
|
'file',
|
|
|
|
'created',
|
|
|
|
],
|
2019-05-28 09:26:54 +00:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2019-06-06 11:59:11 +00:00
|
|
|
showDeleteConfirm(index) {
|
|
|
|
this.dmsIndex = index;
|
2019-05-28 09:26:54 +00:00
|
|
|
this.$.confirm.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
deleteDms(response) {
|
|
|
|
if (response === 'ACCEPT') {
|
2019-06-06 11:59:11 +00:00
|
|
|
const dmsFk = this.ticketDms[this.dmsIndex].dmsFk;
|
2019-10-24 22:53:53 +00:00
|
|
|
const query = `ticketDms/${dmsFk}/removeFile`;
|
2019-06-06 11:59:11 +00:00
|
|
|
this.$http.post(query).then(() => {
|
|
|
|
this.$.model.remove(this.dmsIndex);
|
2019-05-28 09:26:54 +00:00
|
|
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-06 11:59:11 +00:00
|
|
|
Controller.$inject = ['$stateParams', '$scope', '$http', '$translate', 'vnToken', 'vnApp'];
|
2019-05-28 09:26:54 +00:00
|
|
|
|
2019-06-06 11:59:11 +00:00
|
|
|
ngModule.component('vnTicketDmsIndex', {
|
2019-05-28 09:26:54 +00:00
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
});
|