Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
This commit is contained in:
commit
9a65cafe19
|
@ -1,7 +1,5 @@
|
||||||
vn-item-descriptor-popover {
|
body > .vn-popover vn-item-descriptor {
|
||||||
vn-item-descriptor {
|
display: block;
|
||||||
display: block;
|
width: 16em;
|
||||||
width: 16em;
|
min-height: 28em;
|
||||||
min-height: 28em;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -55,11 +55,6 @@ module.exports = Self => {
|
||||||
type: 'Boolean',
|
type: 'Boolean',
|
||||||
description: 'Ticket is deleted',
|
description: 'Ticket is deleted',
|
||||||
required: true
|
required: true
|
||||||
}, {
|
|
||||||
arg: 'hasToBeUnrouted',
|
|
||||||
type: 'Boolean',
|
|
||||||
description: 'Ticket should be removed from ticket',
|
|
||||||
required: true
|
|
||||||
}, {
|
}, {
|
||||||
arg: 'option',
|
arg: 'option',
|
||||||
type: 'Number',
|
type: 'Number',
|
||||||
|
@ -77,7 +72,7 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.componentUpdate = async(ctx, id, clientId, agencyModeId, addressId, zoneId, warehouseId,
|
Self.componentUpdate = async(ctx, id, clientId, agencyModeId, addressId, zoneId, warehouseId,
|
||||||
companyId, shipped, landed, isDeleted, hasToBeUnrouted, option) => {
|
companyId, shipped, landed, isDeleted, option) => {
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const isEditable = await models.Ticket.isEditable(ctx, id);
|
const isEditable = await models.Ticket.isEditable(ctx, id);
|
||||||
|
@ -85,10 +80,6 @@ module.exports = Self => {
|
||||||
if (!isEditable)
|
if (!isEditable)
|
||||||
throw new UserError(`The sales of this ticket can't be modified`);
|
throw new UserError(`The sales of this ticket can't be modified`);
|
||||||
|
|
||||||
const hasDeliveryRole = await models.Account.hasRole(userId, 'delivery');
|
|
||||||
if (!hasDeliveryRole)
|
|
||||||
hasToBeUnrouted = true;
|
|
||||||
|
|
||||||
const isProductionBoss = await models.Account.hasRole(userId, 'productionBoss');
|
const isProductionBoss = await models.Account.hasRole(userId, 'productionBoss');
|
||||||
if (!isProductionBoss) {
|
if (!isProductionBoss) {
|
||||||
const zoneShipped = await models.Agency.getShipped(landed, addressId, agencyModeId, warehouseId);
|
const zoneShipped = await models.Agency.getShipped(landed, addressId, agencyModeId, warehouseId);
|
||||||
|
@ -97,6 +88,8 @@ module.exports = Self => {
|
||||||
throw new UserError(`You don't have privileges to change the zone`);
|
throw new UserError(`You don't have privileges to change the zone`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Force unroute
|
||||||
|
const hasToBeUnrouted = true;
|
||||||
let query = 'CALL vn.ticket_componentMakeUpdate(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
|
let query = 'CALL vn.ticket_componentMakeUpdate(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
|
||||||
let res = await Self.rawSql(query, [
|
let res = await Self.rawSql(query, [
|
||||||
id,
|
id,
|
||||||
|
|
|
@ -37,13 +37,12 @@ describe('ticket componentUpdate()', () => {
|
||||||
const companyId = 442;
|
const companyId = 442;
|
||||||
const isDeleted = false;
|
const isDeleted = false;
|
||||||
const landed = tomorrow;
|
const landed = tomorrow;
|
||||||
const hasToBeUnrouted = false;
|
|
||||||
const option = 1;
|
const option = 1;
|
||||||
|
|
||||||
let ctx = {req: {accessToken: {userId: 101}}};
|
let ctx = {req: {accessToken: {userId: 101}}};
|
||||||
|
|
||||||
await app.models.Ticket.componentUpdate(ctx, ticketId, clientId, agencyModeId, addressId,
|
await app.models.Ticket.componentUpdate(ctx, ticketId, clientId, agencyModeId, addressId,
|
||||||
zoneId, warehouseId, companyId, shipped, landed, isDeleted, hasToBeUnrouted, option);
|
zoneId, warehouseId, companyId, shipped, landed, isDeleted, option);
|
||||||
|
|
||||||
[componentValue] = await app.models.SaleComponent.rawSql(componentOfSaleSeven);
|
[componentValue] = await app.models.SaleComponent.rawSql(componentOfSaleSeven);
|
||||||
let firstvalueAfterChange = componentValue.value;
|
let firstvalueAfterChange = componentValue.value;
|
||||||
|
@ -65,12 +64,11 @@ describe('ticket componentUpdate()', () => {
|
||||||
const companyId = 442;
|
const companyId = 442;
|
||||||
const isDeleted = false;
|
const isDeleted = false;
|
||||||
const landed = tomorrow;
|
const landed = tomorrow;
|
||||||
const hasToBeUnrouted = false;
|
|
||||||
const option = 1;
|
const option = 1;
|
||||||
|
|
||||||
let ctx = {req: {accessToken: {userId: 101}}};
|
let ctx = {req: {accessToken: {userId: 101}}};
|
||||||
await app.models.Ticket.componentUpdate(ctx, ticketId, clientId, agencyModeId, addressId,
|
await app.models.Ticket.componentUpdate(ctx, ticketId, clientId, agencyModeId, addressId,
|
||||||
zoneId, warehouseId, companyId, shipped, landed, isDeleted, hasToBeUnrouted, option);
|
zoneId, warehouseId, companyId, shipped, landed, isDeleted, option);
|
||||||
|
|
||||||
[componentValue] = await app.models.SaleComponent.rawSql(componentOfSaleSeven);
|
[componentValue] = await app.models.SaleComponent.rawSql(componentOfSaleSeven);
|
||||||
let firstvalueAfterChange = componentValue.value;
|
let firstvalueAfterChange = componentValue.value;
|
||||||
|
|
|
@ -10,12 +10,5 @@
|
||||||
initial-data="$ctrl.ticket.option">
|
initial-data="$ctrl.ticket.option">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
|
||||||
<vn-check
|
|
||||||
vn-one label="Remove from route"
|
|
||||||
ng-model="$ctrl.ticket.hasToBeUnrouted"
|
|
||||||
vn-acl="delivery">
|
|
||||||
</vn-check>
|
|
||||||
</vn-horizontal>
|
|
||||||
</vn-card>
|
</vn-card>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -15,7 +15,6 @@ class Controller {
|
||||||
|
|
||||||
$onChanges() {
|
$onChanges() {
|
||||||
this.ticket.option = 1;
|
this.ticket.option = 1;
|
||||||
this.ticket.hasToBeUnrouted = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onStepChange(state) {
|
onStepChange(state) {
|
||||||
|
@ -40,15 +39,15 @@ class Controller {
|
||||||
shipped: this.ticket.shipped,
|
shipped: this.ticket.shipped,
|
||||||
landed: this.ticket.landed,
|
landed: this.ticket.landed,
|
||||||
isDeleted: this.ticket.isDeleted,
|
isDeleted: this.ticket.isDeleted,
|
||||||
hasToBeUnrouted: this.ticket.hasToBeUnrouted,
|
|
||||||
option: this.ticket.option
|
option: this.ticket.option
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$http.post(query, params).then(res => {
|
this.$http.post(query, params).then(res => {
|
||||||
if (res.data) {
|
this.vnApp.showMessage(
|
||||||
this.$state.go('ticket.card.summary', {id: this.$state.params.id});
|
this.$translate.instant(`The ticket has been unrouted`)
|
||||||
this.card.reload();
|
);
|
||||||
}
|
this.card.reload();
|
||||||
|
this.$state.go('ticket.card.summary', {id: this.$state.params.id});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ describe('ticket', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should perform a post query correctly then call two functions()', () => {
|
it('should perform a post query correctly then call two functions()', () => {
|
||||||
|
spyOn(controller.vnApp, 'showMessage');
|
||||||
controller.card = {reload: () => {}};
|
controller.card = {reload: () => {}};
|
||||||
spyOn(controller.card, 'reload');
|
spyOn(controller.card, 'reload');
|
||||||
|
|
||||||
|
@ -60,8 +61,9 @@ describe('ticket', () => {
|
||||||
controller.onSubmit();
|
controller.onSubmit();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.$state.go).toHaveBeenCalledWith('ticket.card.summary', jasmine.any(Object));
|
expect(controller.vnApp.showMessage).toHaveBeenCalledWith('The ticket has been unrouted');
|
||||||
expect(controller.card.reload).toHaveBeenCalledWith();
|
expect(controller.card.reload).toHaveBeenCalledWith();
|
||||||
|
expect(controller.$state.go).toHaveBeenCalledWith('ticket.card.summary', jasmine.any(Object));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Charge: Cargo
|
Charge: Cargo
|
||||||
Choose an option: Selecciona una opción
|
Choose an option: Selecciona una opción
|
||||||
Charge difference to: Diferencia a cargo de
|
Charge difference to: Diferencia a cargo de
|
||||||
Remove from route: Sacar de la ruta
|
The ticket has been unrouted: El ticket ha sido desenrutado
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="header vn-pa-md">
|
<section class="header vn-pa-md">
|
||||||
<h5>MANÁ: {{$ctrl.mana | currency: 'EUR':0}}</h5>
|
<h5>MANÁ: {{$ctrl.mana | currency: 'EUR':0}}</h5>
|
||||||
</div>
|
</section>
|
||||||
<div class="vn-pa-md">
|
<div class="vn-pa-md">
|
||||||
<vn-input-number
|
<vn-input-number
|
||||||
vn-focus
|
vn-focus
|
||||||
|
|
|
@ -218,9 +218,9 @@
|
||||||
enable="true">
|
enable="true">
|
||||||
</vn-spinner>
|
</vn-spinner>
|
||||||
<div ng-if="$ctrl.mana != null">
|
<div ng-if="$ctrl.mana != null">
|
||||||
<div class="header vn-pa-md">
|
<section class="header vn-pa-md">
|
||||||
<h5>MANÁ: {{$ctrl.mana | currency: 'EUR':0}}</h5>
|
<h5>MANÁ: {{$ctrl.mana | currency: 'EUR':0}}</h5>
|
||||||
</div>
|
</section>
|
||||||
<div class="vn-pa-md">
|
<div class="vn-pa-md">
|
||||||
<vn-input-number
|
<vn-input-number
|
||||||
vn-focus
|
vn-focus
|
||||||
|
|
|
@ -89,17 +89,19 @@ vn-ticket-sale {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.edit-price {
|
.edit-price {
|
||||||
width: 200px;
|
min-width: 200px;
|
||||||
|
|
||||||
.header {
|
section.header {
|
||||||
background-color: $color-main;
|
background-color: $color-main;
|
||||||
color: $color-font-dark;
|
color: $color-font-dark;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
h5 {
|
h5 {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p.simulatorTitle {
|
p.simulatorTitle {
|
||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|
Loading…
Reference in New Issue