import ngModule from '../module'; import './style.scss'; class Controller { constructor($stateParams, $scope, vnToken, $http, vnApp, $translate) { this.$stateParams = $stateParams; this.$ = $scope; this.accessToken = vnToken.token; this.$http = $http; this.vnApp = vnApp; this.$translate = $translate; this.filter = { include: { relation: 'dms', scope: { fields: ['dmsTypeFk', 'workerFk', 'file', 'created', 'description', 'reference', 'hardCopyNumber'], 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(dmsId) { this.selectedDms = dmsId; this.$.confirm.show(); } deleteDms(response) { if (response === 'ACCEPT') { let dmsId = this.selectedDms; let query = `/client/api/ClientDms/removes`; this.$http.post(query, {dmsId}).then(() => { this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.$.model.refresh(); }); } } } Controller.$inject = ['$stateParams', '$scope', 'vnToken', '$http', 'vnApp', '$translate']; ngModule.component('vnClientDms', { template: require('./index.html'), controller: Controller, });