refs #5673 feat(claim_development): redirect to lilium
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2023-08-25 14:26:17 +02:00
parent 864ffd032f
commit 2ecc464046
5 changed files with 8 additions and 164 deletions

View File

@ -1,116 +1,2 @@
<vn-crud-model
vn-id="model"
url="ClaimDevelopments"
fields="['id', 'claimFk', 'claimReasonFk', 'claimResultFk', 'claimResponsibleFk', 'workerFk', 'claimRedeliveryFk']"
link="{claimFk: $ctrl.$params.id}"
filter="$ctrl.filter"
data="claimDevelopments"
auto-load="true">
</vn-crud-model>
<vn-crud-model
url="ClaimReasons"
data="claimReasons"
order="description"
auto-load="true">
</vn-crud-model>
<vn-crud-model
url="ClaimResults"
data="claimResults"
order="description"
auto-load="true">
</vn-crud-model>
<vn-crud-model
url="ClaimResponsibles"
data="claimResponsibles"
order="description"
auto-load="true">
</vn-crud-model>
<vn-crud-model
url="ClaimRedeliveries"
data="claimRedeliveries"
order="description"
auto-load="true">
</vn-crud-model>
<vn-watcher
vn-id="watcher"
data="claimDevelopments"
form="form">
</vn-watcher>
<vn-vertical class="vn-w-lg">
<vn-card class="vn-pa-lg">
<vn-vertical>
<form name="form">
<vn-horizontal ng-repeat="claimDevelopment in claimDevelopments">
<vn-autocomplete
vn-focus
label="Reason"
ng-model="claimDevelopment.claimReasonFk"
data="claimReasons"
fields="['id', 'description']"
show-field="description"
rule>
</vn-autocomplete>
<vn-autocomplete
label="Result"
ng-model="claimDevelopment.claimResultFk"
data="claimResults"
fields="['id', 'description']"
show-field="description"
rule>
</vn-autocomplete>
<vn-autocomplete
label="Responsible"
ng-model="claimDevelopment.claimResponsibleFk"
data="claimResponsibles"
fields="['id', 'description']"
show-field="description"
rule>
</vn-autocomplete>
<vn-worker-autocomplete
ng-model="claimDevelopment.workerFk"
show-field="nickname"
rule>
</vn-worker-autocomplete>
<vn-autocomplete
label="Redelivery"
ng-model="claimDevelopment.claimRedeliveryFk"
data="claimRedeliveries"
fields="['id', 'description']"
show-field="description"
rule>
</vn-autocomplete>
<vn-icon-button
vn-none
class="vn-my-md"
vn-tooltip="Remove sale"
icon="delete"
ng-click="model.remove($index)"
tabindex="-1">
</vn-icon-button>
</vn-horizontal>
</form>
<vn-one class="vn-pt-md">
<vn-icon-button
vn-bind="+"
vn-tooltip="Add sale"
icon="add_circle"
ng-click="model.insert()">
</vn-icon-button>
</vn-one>
</vn-vertical>
</vn-card>
<vn-button-bar>
<vn-submit
disabled="!watcher.dataChanged()"
ng-click="$ctrl.onSubmit()"
label="Save">
</vn-submit>
<!-- # #2680 Undo changes button bugs -->
<!-- <vn-button
class="cancel"
label="Undo changes"
disabled="!watcher.dataChanged()"
ng-click="watcher.loadOriginalData()">
</vn-button> -->
</vn-button-bar>
</vn-vertical>
<vn-card>
</vn-card>

View File

@ -1,17 +1,14 @@
import ngModule from '../module';
import Section from 'salix/components/section';
import './style.scss';
class Controller extends Section {
onSubmit() {
this.$.watcher.check();
this.$.model.save().then(() => {
this.$.watcher.notifySaved();
this.$.watcher.updateOriginalData();
constructor($element, $) {
super($element, $);
}
if (this.aclService.hasAny(['claimManager']))
this.$state.go('claim.card.action');
});
async $onInit() {
this.$state.go('claim.card.summary', {id: this.$params.id});
window.location.href = await this.vnApp.getUrl(`claim/${this.$params.id}/development`);
}
}

View File

@ -1,31 +0,0 @@
import './index.js';
import watcher from 'core/mocks/watcher';
import crudModel from 'core/mocks/crud-model';
describe('Claim', () => {
describe('Component vnClaimDevelopment', () => {
let controller;
let $scope;
beforeEach(ngModule('claim'));
beforeEach(inject(($componentController, $rootScope) => {
$scope = $rootScope.$new();
$scope.watcher = watcher;
$scope.model = crudModel;
const $element = angular.element('<vn-claim-development></vn-claim-development>');
controller = $componentController('vnClaimDevelopment', {$element, $scope});
}));
describe('onSubmit()', () => {
it(`should redirect to 'claim.card.action' state`, () => {
jest.spyOn(controller.aclService, 'hasAny').mockReturnValue(true);
jest.spyOn(controller.$state, 'go');
controller.onSubmit();
expect(controller.$state.go).toHaveBeenCalledWith('claim.card.action');
});
});
});
});

View File

@ -1,8 +0,0 @@
Destination: Destino
Development: Trazabilidad
Reason: Motivo
Result: Consecuencia
Responsible: Responsable
Worker: Trabajador
Redelivery: Devolución
Add line: Añadir Linea