diff --git a/modules/worker/front/pda/index.html b/modules/worker/front/pda/index.html
deleted file mode 100644
index c6d31dc85..000000000
--- a/modules/worker/front/pda/index.html
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
diff --git a/modules/worker/front/pda/index.js b/modules/worker/front/pda/index.js
index 885261e5c..b1f8dcac2 100644
--- a/modules/worker/front/pda/index.js
+++ b/modules/worker/front/pda/index.js
@@ -1,53 +1,21 @@
import ngModule from '../module';
import Section from 'salix/components/section';
-import './style.scss';
class Controller extends Section {
constructor($element, $) {
super($element, $);
- const filter = {
- where: {userFk: this.$params.id},
- include: {relation: 'deviceProduction'}
- };
- this.$http.get('DeviceProductionUsers', {filter}).
- then(res => {
- if (res.data && res.data.length > 0)
- this.setCurrentPDA(res.data[0]);
- });
}
- deallocatePDA() {
- this.$http.post(`Workers/${this.$params.id}/deallocatePDA`, {pda: this.currentPDA.deviceProductionFk})
- .then(() => {
- this.vnApp.showSuccess(this.$t('PDA deallocated'));
- delete this.currentPDA;
- });
- }
-
- allocatePDA() {
- this.$http.post(`Workers/${this.$params.id}/allocatePDA`, {pda: this.newPDA})
- .then(res => {
- if (res.data)
- this.setCurrentPDA(res.data);
-
- this.vnApp.showSuccess(this.$t('PDA allocated'));
- delete this.newPDA;
- });
- }
-
- setCurrentPDA(data) {
- this.currentPDA = data;
- this.currentPDA.description = [];
- this.currentPDA.description.push(`ID: ${this.currentPDA.deviceProductionFk}`);
- this.currentPDA.description.push(`${this.$t('Model')}: ${this.currentPDA.deviceProduction.modelFk}`);
- this.currentPDA.description.push(`${this.$t('Serial Number')}: ${this.currentPDA.deviceProduction.serialNumber}`);
- this.currentPDA.description = this.currentPDA.description.join(' ');
+ async $onInit() {
+ const url = await this.vnApp.getUrl(`worker/${this.$params.id}/pda`);
+ console.log('url: ', url);
+ window.location.href = url;
}
}
-Controller.$inject = ['$element', '$scope'];
-
-ngModule.vnComponent('vnWorkerPda', {
- template: require('./index.html'),
+ngModule.vnComponent('vnClaimPhotos', {
controller: Controller,
+ bindings: {
+ claim: '<'
+ }
});
diff --git a/modules/worker/front/pda/index.spec.js b/modules/worker/front/pda/index.spec.js
deleted file mode 100644
index a0540af45..000000000
--- a/modules/worker/front/pda/index.spec.js
+++ /dev/null
@@ -1,72 +0,0 @@
-import './index';
-
-describe('Worker', () => {
- describe('Component vnWorkerPda', () => {
- let $httpBackend;
- let $scope;
- let $element;
- let controller;
-
- beforeEach(ngModule('worker'));
-
- beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
- $httpBackend = _$httpBackend_;
- $scope = $rootScope.$new();
- $element = angular.element('');
- controller = $componentController('vnWorkerPda', {$element, $scope});
- $httpBackend.expectGET(`DeviceProductionUsers`).respond();
- }));
-
- describe('deallocatePDA()', () => {
- it('should make an HTTP Post query to deallocatePDA', () => {
- jest.spyOn(controller.vnApp, 'showSuccess');
- controller.currentPDA = {deviceProductionFk: 1};
- controller.$params.id = 1;
-
- $httpBackend
- .expectPOST(`Workers/${controller.$params.id}/deallocatePDA`,
- {pda: controller.currentPDA.deviceProductionFk})
- .respond();
- controller.deallocatePDA();
- $httpBackend.flush();
-
- expect(controller.vnApp.showSuccess).toHaveBeenCalled();
- expect(controller.currentPDA).toBeUndefined();
- });
- });
-
- describe('allocatePDA()', () => {
- it('should make an HTTP Post query to allocatePDA', () => {
- jest.spyOn(controller.vnApp, 'showSuccess');
- controller.newPDA = 4;
- controller.$params.id = 1;
-
- $httpBackend
- .expectPOST(`Workers/${controller.$params.id}/allocatePDA`,
- {pda: controller.newPDA})
- .respond();
- controller.allocatePDA();
- $httpBackend.flush();
-
- expect(controller.vnApp.showSuccess).toHaveBeenCalled();
- expect(controller.newPDA).toBeUndefined();
- });
- });
-
- describe('setCurrentPDA()', () => {
- it('should set CurrentPDA', () => {
- const data = {
- deviceProductionFk: 1,
- deviceProduction: {
- modelFk: 1,
- serialNumber: 1
- }
- };
- controller.setCurrentPDA(data);
-
- expect(controller.currentPDA).toBeDefined();
- expect(controller.currentPDA.description).toBeDefined();
- });
- });
- });
-});
diff --git a/modules/worker/front/pda/style.scss b/modules/worker/front/pda/style.scss
deleted file mode 100644
index c55c9d218..000000000
--- a/modules/worker/front/pda/style.scss
+++ /dev/null
@@ -1,6 +0,0 @@
-@import "./variables";
-
-.text-grey {
- color: $color-font-light;
-}
-