From 3736dcf792df3983175a4d1223c3bc5c81603466 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 10 Mar 2020 15:01:33 +0100 Subject: [PATCH] Added ticket sms options --- front/core/components/popover/index.js | 5 +++- modules/ticket/front/descriptor/index.js | 28 ++++++++++++++----- modules/ticket/front/descriptor/locale/en.yml | 5 ++-- modules/ticket/front/descriptor/locale/es.yml | 7 +++-- modules/ticket/front/index/locale/es.yml | 3 +- 5 files changed, 34 insertions(+), 14 deletions(-) diff --git a/front/core/components/popover/index.js b/front/core/components/popover/index.js index 7c54ce494..96f1914f5 100644 --- a/front/core/components/popover/index.js +++ b/front/core/components/popover/index.js @@ -85,7 +85,10 @@ export default class Popover extends Popup { let maxWith = maxRight - margin; let maxHeight = maxBottom - margin - arrowHeight; - let width = clamp(popoverRect.width, parentRect.width, maxWith); + const scrollbarWidth = (popoverRect.width); + const innerEl = this.windowEl.querySelector('.content > *'); + console.log(innerEl); + let width = clamp(popoverRect.width, parentRect.width, maxWith) + 20; let height = popoverRect.height; let left = parentRect.left + parentRect.width / 2 - width / 2; diff --git a/modules/ticket/front/descriptor/index.js b/modules/ticket/front/descriptor/index.js index c633dd3c1..478c1bd22 100644 --- a/modules/ticket/front/descriptor/index.js +++ b/modules/ticket/front/descriptor/index.js @@ -16,7 +16,8 @@ class Controller extends Component { {name: 'Send Delivery Note', callback: this.confirmDeliveryNote}, {name: 'Delete ticket', callback: this.showDeleteTicketDialog}, {name: 'Change shipped hour', callback: this.showChangeShipped}, - {name: 'Send SMS', callback: this.showSMSDialog}, + {name: 'SMS: Pending payment', callback: this.sendPaymentSms}, + {name: 'SMS: Minimum import', callback: this.sendImportSms}, { name: 'Add stowaway', callback: this.showAddStowaway, @@ -240,17 +241,30 @@ class Controller extends Component { ); } + sendImportSms() { + const params = { + ticketId: this.ticket.id, + created: this.ticket.created + }; + const message = this.$params.message || this.$translate.instant('Minimum is needed', params); + this.newSMS = {message}; + this.showSMSDialog(); + } + + sendPaymentSms() { + const message = this.$params.message || this.$translate.instant('Make a payment'); + this.newSMS = {message}; + this.showSMSDialog(); + } + showSMSDialog() { const address = this.ticket.address; const client = this.ticket.client; const phone = this.$params.phone || address.mobile || address.phone || client.mobile || client.phone; - const message = this.$params.message || this.$translate.instant('SMSPayment'); - this.newSMS = { - destinationFk: this.ticket.clientFk, - destination: phone, - message: message - }; + + this.newSMS.destinationFk = this.ticket.clientFk; + this.newSMS.destination = phone; this.$.sms.open(); } diff --git a/modules/ticket/front/descriptor/locale/en.yml b/modules/ticket/front/descriptor/locale/en.yml index 4dca75a51..64075c7ef 100644 --- a/modules/ticket/front/descriptor/locale/en.yml +++ b/modules/ticket/front/descriptor/locale/en.yml @@ -1,3 +1,2 @@ -SMSPayment: >- - Verdnatura communicates: Your order is pending of payment. - Please, enter the web page and make the payment with card. Thank you. \ No newline at end of file +Make a payment: "Verdnatura communicates:\rYour order is pending of payment.\rPlease, enter the web page and make the payment with card.\rThank you." +Minimum is needed: "Verdnatura communicates:\rA minimum import of 50€ (Without BAT) is needed for your order {{ticketId}} from date {{created | date: 'dd/MM/yyyy'}} to receive it with no extra fees." diff --git a/modules/ticket/front/descriptor/locale/es.yml b/modules/ticket/front/descriptor/locale/es.yml index 3df39fe28..e2ea2f9af 100644 --- a/modules/ticket/front/descriptor/locale/es.yml +++ b/modules/ticket/front/descriptor/locale/es.yml @@ -13,7 +13,8 @@ Send Delivery Note: Enviar albarán Show pallet report: Ver hoja de pallet Change shipped hour: Cambiar hora de envío Shipped hour: Hora de envío -SMSPayment: "Verdnatura le comunica:\rSu pedido está pendiente de pago.\rPor favor, entre en la página web y efectue el pago con tarjeta.\rMuchas gracias." +Make a payment: "Verdnatura le comunica:\rSu pedido está pendiente de pago.\rPor favor, entre en la página web y efectue el pago con tarjeta.\rMuchas gracias." +Minimum is needed: "Verdnatura le recuerda:\rEs necesario llegar a un importe mínimo de 50€ (Sin IVA) en su pedido {{ticketId}} del día {{created | date: 'dd/MM/yyyy'}} para recibirlo sin portes adicionales." Ticket invoiced: Ticket facturado Make invoice: Crear factura Regenerate invoice: Regenerar factura @@ -25,4 +26,6 @@ Invoice sent for a regeneration, will be available in a few minutes: La factura Shipped hour updated: Hora de envio modificada Deleted ticket: Ticket eliminado Recalculate components: Recalcular componentes -Are you sure you want to recalculate the components?: ¿Seguro que quieres recalcular los componentes? \ No newline at end of file +Are you sure you want to recalculate the components?: ¿Seguro que quieres recalcular los componentes? +SMS: Minimum import: 'SMS: Importe minimo' +SMS: Pending payment: 'SMS: Pago pendiente' \ No newline at end of file diff --git a/modules/ticket/front/index/locale/es.yml b/modules/ticket/front/index/locale/es.yml index b29c7399d..dea55b199 100644 --- a/modules/ticket/front/index/locale/es.yml +++ b/modules/ticket/front/index/locale/es.yml @@ -2,4 +2,5 @@ Weekly tickets: Tickets programados Go to lines: Ir a lineas Not available: No disponible Payment on account...: Pago a cuenta... -Closure: Cierre \ No newline at end of file +Closure: Cierre +You cannot make a payment on account from multiple clients: No puedes realizar un pago a cuenta de clientes diferentes \ No newline at end of file