From a523e323735587a8192c4814b646440f5a93a5e7 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 3 Nov 2023 07:57:53 +0100 Subject: [PATCH] refs #6335 style(ticketAdvance): fix with split-progress --- e2e/helpers/selectors.js | 2 +- loopback/locale/en.json | 5 ++-- .../back/methods/ticket/componentUpdate.js | 2 -- .../ticket/specs/componentUpdate.spec.js | 2 +- modules/ticket/front/advance/index.html | 10 ++------ modules/ticket/front/advance/index.js | 12 ++++----- modules/ticket/front/advance/index.spec.js | 25 ------------------- modules/ticket/front/advance/locale/es.yml | 2 ++ modules/ticket/front/advance/style.scss | 9 +++++++ .../ticket/front/basic-data/step-two/index.js | 1 - 10 files changed, 23 insertions(+), 47 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index cec0545a0..b5dbd42ac 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -722,7 +722,7 @@ export default { isFullMovable: 'vn-check[ng-model="filter.isFullMovable"]', warehouseFk: 'vn-autocomplete[label="Warehouse"]', tableButtonSearch: 'vn-button[vn-tooltip="Search"]', - moveButton: 'vn-button[vn-tooltip="Advance tickets"]', + moveButton: 'vn-button[vn-tooltip="Advance tickets with negatives"]', acceptButton: '.vn-confirm.shown button[response="accept"]', firstCheck: 'tbody > tr:nth-child(2) > td > vn-check', tableId: 'vn-textfield[name="id"]', diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 26650175d..9305c7f09 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -196,6 +196,7 @@ "Negative basis of tickets: 23": "Negative basis of tickets: 23", "Booking completed": "Booking complete", "The ticket is in preparation": "The ticket [{{ticketId}}]({{{ticketUrl}}}) of the sales person {{salesPersonId}} is in preparation", - "You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets" + "You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets", + "newTicket": "New ticket", + "keepPrice": "Keep prices" } - diff --git a/modules/ticket/back/methods/ticket/componentUpdate.js b/modules/ticket/back/methods/ticket/componentUpdate.js index 1b02fd201..d8d1163da 100644 --- a/modules/ticket/back/methods/ticket/componentUpdate.js +++ b/modules/ticket/back/methods/ticket/componentUpdate.js @@ -111,7 +111,6 @@ module.exports = Self => { Self.componentUpdate = async(ctx, options) => { const args = ctx.args; - const originalTicketId = args.id; const myOptions = {userId: ctx.req.accessToken.userId}; let tx; @@ -284,7 +283,6 @@ module.exports = Self => { } response.id = args.id; - console.log(originalTicketId, args.newTicket ? ` TRANSFER TO → ` : ` CREATE NEW TICKET → `, args.id); if (tx) await tx.commit(); return response; diff --git a/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js b/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js index e124999c9..40be4161c 100644 --- a/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js +++ b/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js @@ -210,7 +210,7 @@ describe('ticket componentUpdate()', () => { } }); - describe('ticket componentUpdate()', () => { + describe('componentUpdate() keepPrice', () => { it('should change shipped and keep price', async() => { const tx = await models.Ticket.beginTransaction({}); diff --git a/modules/ticket/front/advance/index.html b/modules/ticket/front/advance/index.html index 395fe7078..ca4d994d0 100644 --- a/modules/ticket/front/advance/index.html +++ b/modules/ticket/front/advance/index.html @@ -156,13 +156,7 @@ {{::ticket.futureLiters | dashIfEmpty}} {{::ticket.futureZoneName | dashIfEmpty}} - - - {{::ticket.notMovableLines | dashIfEmpty}} - - + {{::ticket.notMovableLines | dashIfEmpty}} {{::ticket.futureLines | dashIfEmpty}} - + diff --git a/modules/ticket/front/advance/index.js b/modules/ticket/front/advance/index.js index 5e41f0f23..5ab663256 100644 --- a/modules/ticket/front/advance/index.js +++ b/modules/ticket/front/advance/index.js @@ -153,11 +153,10 @@ export default class Controller extends Section { return this.$http.get(query, {params}).then(res => { if (res.data) return res.data; - else { - return this.vnApp.showError( - this.$t(`No delivery zone available for this landing date`) - ); - } + + return this.vnApp.showError( + this.$t(`No delivery zone available for this landing date`) + ); }); } @@ -201,7 +200,6 @@ export default class Controller extends Section { async requestComponentUpdate(ticket, isWithoutNegatives) { const query = `tickets/${ticket.futureId}/componentUpdate`; if (!ticket.landed) { - console.log(ticket); const newLanded = await this.getLanded({ shipped: this.$.model.userParams.dateToAdvance, addressFk: ticket.addressFk, @@ -229,7 +227,7 @@ export default class Controller extends Section { newTicket: ticket.id ?? undefined, keepPrice: true }; - console.log(params); + return {query, params}; } diff --git a/modules/ticket/front/advance/index.spec.js b/modules/ticket/front/advance/index.spec.js index da8614ca5..883993c1c 100644 --- a/modules/ticket/front/advance/index.spec.js +++ b/modules/ticket/front/advance/index.spec.js @@ -24,31 +24,6 @@ describe('Component vnTicketAdvance', () => { }]; })); - describe('compareDate()', () => { - it('should return warning when the date is the present', () => { - let today = Date.vnNew(); - let result = controller.compareDate(today); - - expect(result).toEqual('warning'); - }); - - it('should return sucess when the date is in the future', () => { - let futureDate = Date.vnNew(); - futureDate = futureDate.setDate(futureDate.getDate() + 10); - let result = controller.compareDate(futureDate); - - expect(result).toEqual('success'); - }); - - it('should return undefined when the date is in the past', () => { - let pastDate = Date.vnNew(); - pastDate = pastDate.setDate(pastDate.getDate() - 10); - let result = controller.compareDate(pastDate); - - expect(result).toEqual(undefined); - }); - }); - describe('checked()', () => { it('should return an array of checked tickets', () => { const result = controller.checked; diff --git a/modules/ticket/front/advance/locale/es.yml b/modules/ticket/front/advance/locale/es.yml index 520e82009..e42e65b6e 100644 --- a/modules/ticket/front/advance/locale/es.yml +++ b/modules/ticket/front/advance/locale/es.yml @@ -1,4 +1,6 @@ Advance tickets: Adelantar tickets +Advance tickets with negatives: Adelantar tickets con negativos +Advance tickets without negatives: Adelantar tickets sin negativos Search advance tickets by date: Busca tickets para adelantar por fecha Advance confirmation: ¿Desea adelantar {{checked}} tickets? Success: "{{tickets}} Tickets movidos correctamente" diff --git a/modules/ticket/front/advance/style.scss b/modules/ticket/front/advance/style.scss index 8fa9de438..82ae901cd 100644 --- a/modules/ticket/front/advance/style.scss +++ b/modules/ticket/front/advance/style.scss @@ -5,3 +5,12 @@ vn-ticket-advance{ color: #f7931e } } +.split-progress { + width: 40em; +} + +@media screen and (max-width: 600px) { + .split-progress { + width: 100%; + } +} diff --git a/modules/ticket/front/basic-data/step-two/index.js b/modules/ticket/front/basic-data/step-two/index.js index 8ca9f053d..8c8a3a079 100644 --- a/modules/ticket/front/basic-data/step-two/index.js +++ b/modules/ticket/front/basic-data/step-two/index.js @@ -115,7 +115,6 @@ class Controller extends Component { option: parseInt(this.ticket.option), isWithoutNegatives: this.ticket.withoutNegatives, withWarningAccept: this.ticket.withWarningAccept, - newTicket: null, keepPrice: false };