From a9caa92f5cbdab4fab548a56d90a33d9af7f50bd Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 21 Apr 2023 12:46:01 +0200 Subject: [PATCH 01/33] refs #4764 boton abonar --- modules/ticket/front/services/index.html | 7 +++++++ modules/ticket/front/services/locale/es.yml | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index bb5505ce6..592fc62c1 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -23,7 +23,14 @@ data="$ctrl.services">
+ + + + + Date: Mon, 24 Apr 2023 12:22:43 +0200 Subject: [PATCH 02/33] refs #4764 boton abonar y datos --- loopback/locale/es.json | 9 +++++---- modules/ticket/front/services/index.html | 6 +++++- modules/ticket/front/services/locale/es.yml | 3 ++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index d52eacff6..c47a44b2e 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -275,7 +275,8 @@ "Collection does not exist": "La colección no existe", "Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo", "Insert a date range": "Inserte un rango de fechas", - "Added observation": "{{user}} añadió esta observacion: {{text}}", - "Comment added to client": "Observación añadida al cliente {{clientFk}}", - "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen" -} + "Added observation": "{{user}} añadió esta observacion: {{text}}", + "Comment added to client": "Observación añadida al cliente {{clientFk}}", + "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen", + "The price can't be negative": "The price can't be negative" +} \ No newline at end of file diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index 592fc62c1..9f5f9b3f5 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -30,8 +30,11 @@ disabled="!watcher.dataChanged()" label="Pay"> - +
+ + diff --git a/modules/ticket/front/services/locale/es.yml b/modules/ticket/front/services/locale/es.yml index da91fa51a..08e6c968c 100644 --- a/modules/ticket/front/services/locale/es.yml +++ b/modules/ticket/front/services/locale/es.yml @@ -3,4 +3,5 @@ Tax class: Tipo IVA Add service: Añadir servicio Remove service: Quitar servicio New service type: Nuevo tipo de servicio -Pay: Abonar \ No newline at end of file +Pay: Abonar +To create services with negative amounts mark the service on the source ticket and press the pay button.: Para crear sevicios con cantidades negativas marcar servicio en el ticket origen y apretar el boton abonar. \ No newline at end of file From 10884223609bef1dde20c25cf1fcc9050bf3bdc7 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 24 Apr 2023 13:14:38 +0200 Subject: [PATCH 03/33] refs #4764 boton abonar y datos --- loopback/locale/es.json | 9 +++++---- modules/ticket/front/services/index.html | 6 +++++- modules/ticket/front/services/locale/es.yml | 3 ++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index d52eacff6..c47a44b2e 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -275,7 +275,8 @@ "Collection does not exist": "La colección no existe", "Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo", "Insert a date range": "Inserte un rango de fechas", - "Added observation": "{{user}} añadió esta observacion: {{text}}", - "Comment added to client": "Observación añadida al cliente {{clientFk}}", - "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen" -} + "Added observation": "{{user}} añadió esta observacion: {{text}}", + "Comment added to client": "Observación añadida al cliente {{clientFk}}", + "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen", + "The price can't be negative": "The price can't be negative" +} \ No newline at end of file diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index 592fc62c1..9f5f9b3f5 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -30,8 +30,11 @@ disabled="!watcher.dataChanged()" label="Pay"> - +
+ + diff --git a/modules/ticket/front/services/locale/es.yml b/modules/ticket/front/services/locale/es.yml index da91fa51a..08e6c968c 100644 --- a/modules/ticket/front/services/locale/es.yml +++ b/modules/ticket/front/services/locale/es.yml @@ -3,4 +3,5 @@ Tax class: Tipo IVA Add service: Añadir servicio Remove service: Quitar servicio New service type: Nuevo tipo de servicio -Pay: Abonar \ No newline at end of file +Pay: Abonar +To create services with negative amounts mark the service on the source ticket and press the pay button.: Para crear sevicios con cantidades negativas marcar servicio en el ticket origen y apretar el boton abonar. \ No newline at end of file From 80ee73a59b908a3addeed075a968205762686012 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 5 May 2023 10:01:15 +0200 Subject: [PATCH 04/33] =?UTF-8?q?refs=20#4764=20creacion=20de=20m=C3=A9tod?= =?UTF-8?q?os=20y=20back?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- loopback/locale/es.json | 315 ++---------------- .../ticket/back/methods/services/refund.js | 138 ++++++++ modules/ticket/front/routes.json | 3 +- modules/ticket/front/services/index.html | 5 +- modules/ticket/front/services/index.js | 36 ++ 5 files changed, 200 insertions(+), 297 deletions(-) create mode 100644 modules/ticket/back/methods/services/refund.js diff --git a/loopback/locale/es.json b/loopback/locale/es.json index ca8085508..7b34285f6 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -1,298 +1,23 @@ { - "Phone format is invalid": "El formato del teléfono no es correcto", - "You are not allowed to change the credit": "No tienes privilegios para modificar el crédito", - "Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia", - "The default consignee can not be unchecked": "No se puede desmarcar el consignatario predeterminado", - "Unable to default a disabled consignee": "No se puede poner predeterminado un consignatario desactivado", - "Can't be blank": "No puede estar en blanco", - "Invalid TIN": "NIF/CIF invalido", - "TIN must be unique": "El NIF/CIF debe ser único", - "A client with that Web User name already exists": "Ya existe un cliente con ese Usuario Web", - "Is invalid": "Is invalid", - "Quantity cannot be zero": "La cantidad no puede ser cero", - "Enter an integer different to zero": "Introduce un entero distinto de cero", - "Package cannot be blank": "El embalaje no puede estar en blanco", - "The company name must be unique": "La razón social debe ser única", - "Invalid email": "Correo electrónico inválido", - "The IBAN does not have the correct format": "El IBAN no tiene el formato correcto", - "That payment method requires an IBAN": "El método de pago seleccionado requiere un IBAN", - "That payment method requires a BIC": "El método de pago seleccionado requiere un BIC", - "State cannot be blank": "El estado no puede estar en blanco", - "Worker cannot be blank": "El trabajador no puede estar en blanco", - "Cannot change the payment method if no salesperson": "No se puede cambiar la forma de pago si no hay comercial asignado", - "can't be blank": "El campo no puede estar vacío", - "Observation type must be unique": "El tipo de observación no puede repetirse", + "Name cannot be blank": "Name cannot be blank", + "Swift / BIC cannot be empty": "Swift / BIC cannot be empty", + "Street cannot be empty": "Street cannot be empty", + "City cannot be empty": "City cannot be empty", + "Invalid email": "Invalid email", + "Phone cannot be blank": "Phone cannot be blank", "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero", - "The grade must be similar to the last one": "El grade debe ser similar al último", - "Only manager can change the credit": "Solo el gerente puede cambiar el credito de este cliente", - "Name cannot be blank": "El nombre no puede estar en blanco", - "Phone cannot be blank": "El teléfono no puede estar en blanco", - "Period cannot be blank": "El periodo no puede estar en blanco", - "Choose a company": "Selecciona una empresa", - "Se debe rellenar el campo de texto": "Se debe rellenar el campo de texto", - "Description should have maximum of 45 characters": "La descripción debe tener maximo 45 caracteres", - "Cannot be blank": "El campo no puede estar en blanco", - "The grade must be an integer greater than or equal to zero": "El grade debe ser un entero mayor o igual a cero", - "Sample type cannot be blank": "El tipo de plantilla no puede quedar en blanco", - "Description cannot be blank": "Se debe rellenar el campo de texto", - "The new quantity should be smaller than the old one": "La nueva cantidad debe de ser menor que la anterior", - "The value should not be greater than 100%": "El valor no debe de ser mayor de 100%", - "The value should be a number": "El valor debe ser un numero", - "This order is not editable": "Esta orden no se puede modificar", - "You can't create an order for a frozen client": "No puedes crear una orden para un cliente congelado", - "You can't create an order for a client that has a debt": "No puedes crear una orden para un cliente con deuda", - "is not a valid date": "No es una fecha valida", - "Barcode must be unique": "El código de barras debe ser único", - "The warehouse can't be repeated": "El almacén no puede repetirse", - "The tag or priority can't be repeated for an item": "El tag o prioridad no puede repetirse para un item", - "The observation type can't be repeated": "El tipo de observación no puede repetirse", - "A claim with that sale already exists": "Ya existe una reclamación para esta línea", - "You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo", - "Warehouse cannot be blank": "El almacén no puede quedar en blanco", - "Agency cannot be blank": "La agencia no puede quedar en blanco", - "Not enough privileges to edit a client with verified data": "No tienes permisos para hacer cambios en un cliente con datos comprobados", - "This address doesn't exist": "Este consignatario no existe", - "You must delete the claim id %d first": "Antes debes borrar la reclamación %d", - "You don't have enough privileges": "No tienes suficientes permisos", - "Cannot check Equalization Tax in this NIF/CIF": "No se puede marcar RE en este NIF/CIF", - "You can't make changes on the basic data of an confirmed order or with rows": "No puedes cambiar los datos basicos de una orden con artículos", - "INVALID_USER_NAME": "El nombre de usuario solo debe contener letras minúsculas o, a partir del segundo carácter, números o subguiones, no esta permitido el uso de la letra ñ", - "You can't create a ticket for a frozen client": "No puedes crear un ticket para un cliente congelado", - "You can't create a ticket for a inactive client": "No puedes crear un ticket para un cliente inactivo", - "Tag value cannot be blank": "El valor del tag no puede quedar en blanco", - "ORDER_EMPTY": "Cesta vacía", - "You don't have enough privileges to do that": "No tienes permisos para cambiar esto", - "NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT", - "Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido", - "Street cannot be empty": "Dirección no puede estar en blanco", - "City cannot be empty": "Cuidad no puede estar en blanco", - "Code cannot be blank": "Código no puede estar en blanco", - "You cannot remove this department": "No puedes eliminar este departamento", - "The extension must be unique": "La extensión debe ser unica", - "The secret can't be blank": "La contraseña no puede estar en blanco", - "We weren't able to send this SMS": "No hemos podido enviar el SMS", - "This client can't be invoiced": "Este cliente no puede ser facturado", - "This ticket can't be invoiced": "Este ticket no puede ser facturado", - "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado", - "This ticket can not be modified": "Este ticket no puede ser modificado", - "The introduced hour already exists": "Esta hora ya ha sido introducida", - "INFINITE_LOOP": "Existe una dependencia entre dos Jefes", - "The sales of the current ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas", - "The sales of the receiver ticket can't be modified": "Las lineas del ticket al que envias no pueden ser modificadas", - "NO_AGENCY_AVAILABLE": "No hay una zona de reparto disponible con estos parámetros", - "ERROR_PAST_SHIPMENT": "No puedes seleccionar una fecha de envío en pasado", - "The current ticket can't be modified": "El ticket actual no puede ser modificado", - "The current claim can't be modified": "La reclamación actual no puede ser modificada", - "The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas", - "Please select at least one sale": "Por favor selecciona al menos una linea", - "All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket", - "NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", - "This item doesn't exists": "El artículo no existe", - "NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", - "Extension format is invalid": "El formato de la extensión es inválido", - "Invalid parameters to create a new ticket": "Parámetros inválidos para crear un nuevo ticket", - "This item is not available": "Este artículo no está disponible", - "This postcode already exists": "Este código postal ya existe", - "Concept cannot be blank": "El concepto no puede quedar en blanco", - "File doesn't exists": "El archivo no existe", - "You don't have privileges to change the zone": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias", - "This ticket is already on weekly tickets": "Este ticket ya está en tickets programados", - "Ticket id cannot be blank": "El id de ticket no puede quedar en blanco", - "Weekday cannot be blank": "El día de la semana no puede quedar en blanco", - "You can't delete a confirmed order": "No puedes borrar un pedido confirmado", - "The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto", - "Invalid quantity": "Cantidad invalida", - "This postal code is not valid": "This postal code is not valid", - "is invalid": "is invalid", - "The postcode doesn't exist. Please enter a correct one": "El código postal no existe. Por favor, introduce uno correcto", - "The department name can't be repeated": "El nombre del departamento no puede repetirse", - "This phone already exists": "Este teléfono ya existe", - "You cannot move a parent to its own sons": "No puedes mover un elemento padre a uno de sus hijos", - "You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado", - "You cannot delete a ticket that part of it is being prepared": "No puedes eliminar un ticket en el que una parte que está siendo preparada", - "You must delete all the buy requests first": "Debes eliminar todas las peticiones de compra primero", - "You should specify a date": "Debes especificar una fecha", - "You should specify at least a start or end date": "Debes especificar al menos una fecha de inicio o de fín", - "Start date should be lower than end date": "La fecha de inicio debe ser menor que la fecha de fín", - "You should mark at least one week day": "Debes marcar al menos un día de la semana", - "Swift / BIC can't be empty": "Swift / BIC no puede estar vacío", - "Customs agent is required for a non UEE member": "El agente de aduanas es requerido para los clientes extracomunitarios", - "Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios", - "Deleted sales from ticket": "He eliminado las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}", - "Added sale to ticket": "He añadido la siguiente linea al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}", - "Changed sale discount": "He cambiado el descuento de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Created claim": "He creado la reclamación [{{claimId}}]({{{claimUrl}}}) de las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Changed sale price": "He cambiado el precio de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* del ticket [{{ticketId}}]({{{ticketUrl}}})", - "Changed sale quantity": "He cambiado la cantidad de [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* del ticket [{{ticketId}}]({{{ticketUrl}}})", - "State": "Estado", - "regular": "normal", - "reserved": "reservado", - "Changed sale reserved state": "He cambiado el estado reservado de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Bought units from buy request": "Se ha comprado {{quantity}} unidades de [{{itemId}} {{concept}}]({{{urlItem}}}) para el ticket id [{{ticketId}}]({{{url}}})", - "Deny buy request": "Se ha rechazado la petición de compra para el ticket id [{{ticketId}}]({{{url}}}). Motivo: {{observation}}", - "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*", - "Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})", - "Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})", - "Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}", - "Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*", - "Claim state has changed to incomplete": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *incompleta*", - "Claim state has changed to canceled": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *anulado*", - "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}", - "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto", - "Distance must be lesser than 1000": "La distancia debe ser inferior a 1000", - "This ticket is deleted": "Este ticket está eliminado", - "Unable to clone this travel": "No ha sido posible clonar este travel", - "This thermograph id already exists": "La id del termógrafo ya existe", - "Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante", - "ORDER_ALREADY_CONFIRMED": "ORDER_ALREADY_CONFIRMED", - "Invalid password": "Invalid password", - "Password does not meet requirements": "La contraseña no cumple los requisitos", - "Role already assigned": "Role already assigned", - "Invalid role name": "Invalid role name", - "Role name must be written in camelCase": "Role name must be written in camelCase", - "Email already exists": "Email already exists", - "User already exists": "User already exists", - "Absence change notification on the labour calendar": "Notificacion de cambio de ausencia en el calendario laboral", - "Record of hours week": "Registro de horas semana {{week}} año {{year}} ", - "Created absence": "El empleado {{author}} ha añadido una ausencia de tipo '{{absenceType}}' a {{employee}} para el día {{dated}}.", - "Deleted absence": "El empleado {{author}} ha eliminado una ausencia de tipo '{{absenceType}}' a {{employee}} del día {{dated}}.", - "I have deleted the ticket id": "He eliminado el ticket id [{{id}}]({{{url}}})", - "I have restored the ticket id": "He restaurado el ticket id [{{id}}]({{{url}}})", - "You can only restore a ticket within the first hour after deletion": "Únicamente puedes restaurar el ticket dentro de la primera hora después de su eliminación", - "Changed this data from the ticket": "He cambiado estos datos del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "agencyModeFk": "Agencia", - "clientFk": "Cliente", - "zoneFk": "Zona", - "warehouseFk": "Almacén", - "shipped": "F. envío", - "landed": "F. entrega", - "addressFk": "Consignatario", - "companyFk": "Empresa", - "The social name cannot be empty": "La razón social no puede quedar en blanco", - "The nif cannot be empty": "El NIF no puede quedar en blanco", - "You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados", - "ASSIGN_ZONE_FIRST": "Asigna una zona primero", - "Amount cannot be zero": "El importe no puede ser cero", - "Company has to be official": "Empresa inválida", - "You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria", - "Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas", - "The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta", - "Sorts whole route": "Reordena ruta entera", - "New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*", - "New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*", - "Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío", - "This BIC already exist.": "Este BIC ya existe.", - "That item doesn't exists": "Ese artículo no existe", - "There's a new urgent ticket:": "Hay un nuevo ticket urgente:", - "Invalid account": "Cuenta inválida", - "Compensation account is empty": "La cuenta para compensar está vacia", - "This genus already exist": "Este genus ya existe", - "This specie already exist": "Esta especie ya existe", - "Client assignment has changed": "He cambiado el comercial ~*\"<{{previousWorkerName}}>\"*~ por *\"<{{currentWorkerName}}>\"* del cliente [{{clientName}} ({{clientId}})]({{{url}}})", - "None": "Ninguno", - "The contract was not active during the selected date": "El contrato no estaba activo durante la fecha seleccionada", - "Cannot add more than one '1/2 day vacation'": "No puedes añadir más de un 'Vacaciones 1/2 dia'", - "This document already exists on this ticket": "Este documento ya existe en el ticket", - "Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables", - "You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes", - "nickname": "nickname", - "INACTIVE_PROVIDER": "Proveedor inactivo", - "This client is not invoiceable": "Este cliente no es facturable", - "serial non editable": "Esta serie no permite asignar la referencia", - "Max shipped required": "La fecha límite es requerida", - "Can't invoice to future": "No se puede facturar a futuro", - "Can't invoice to past": "No se puede facturar a pasado", - "This ticket is already invoiced": "Este ticket ya está facturado", - "A ticket with an amount of zero can't be invoiced": "No se puede facturar un ticket con importe cero", - "A ticket with a negative base can't be invoiced": "No se puede facturar un ticket con una base negativa", - "Global invoicing failed": "[Facturación global] No se han podido facturar algunos clientes", - "Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes", - "Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio", - "You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito", - "You can't change the credit set to zero from a financialBoss": "No puedes cambiar el cŕedito establecido a cero por un jefe de finanzas", - "Amounts do not match": "Las cantidades no coinciden", - "The PDF document does not exists": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'", - "The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos", - "You can't create a claim from a ticket delivered more than seven days ago": "No puedes crear una reclamación de un ticket entregado hace más de siete días", - "The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día", - "The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día", - "You can not modify is pay method checked": "No se puede modificar el campo método de pago validado", - "Can't transfer claimed sales": "No puedes transferir lineas reclamadas", - "You don't have privileges to create refund": "No tienes permisos para crear un abono", - "The item is required": "El artículo es requerido", - "The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo", - "date in the future": "Fecha en el futuro", - "reference duplicated": "Referencia duplicada", - "This ticket is already a refund": "Este ticket ya es un abono", - "isWithoutNegatives": "isWithoutNegatives", - "routeFk": "routeFk", - "Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador", - "No hay un contrato en vigor": "No hay un contrato en vigor", - "No se permite fichar a futuro": "No se permite fichar a futuro", - "No está permitido trabajar": "No está permitido trabajar", - "Fichadas impares": "Fichadas impares", - "Descanso diario 12h.": "Descanso diario 12h.", - "Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.", - "Dirección incorrecta": "Dirección incorrecta", - "Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador", - "Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador", - "Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente", - "This route does not exists": "Esta ruta no existe", - "Claim pickup order sent": "Reclamación Orden de recogida enviada [{{claimId}}]({{{claimUrl}}}) al cliente *{{clientName}}*", - "You don't have grant privilege": "No tienes privilegios para dar privilegios", - "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario", - "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) fusionado con [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})", - "Already has this status": "Ya tiene este estado", - "There aren't records for this week": "No existen registros para esta semana", - "Empty data source": "Origen de datos vacio", - "App locked": "Aplicación bloqueada por el usuario {{userId}}", - "Email verify": "Correo de verificación", - "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment", - "Receipt's bank was not found": "No se encontró el banco del recibo", - "This receipt was not compensated": "Este recibo no ha sido compensado", - "Client's email was not found": "No se encontró el email del cliente", - "Negative basis": "Base negativa", - "This worker code already exists": "Este codigo de trabajador ya existe", - "This personal mail already exists": "Este correo personal ya existe", - "This worker already exists": "Este trabajador ya existe", - "App name does not exist": "El nombre de aplicación no es válido", - "Try again": "Vuelve a intentarlo", - "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9", - "Failed to upload file": "Error al subir archivo", - "The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe", - "It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar", - "It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo", - "It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas", - "A supplier with the same name already exists. Change the country.": "Un proveedor con el mismo nombre ya existe. Cambie el país.", - "There is no assigned email for this client": "No hay correo asignado para este cliente", - "Exists an invoice with a previous date": "Existe una factura con fecha anterior", - "Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite", - "Warehouse inventory not set": "El almacén inventario no está establecido", - "This locker has already been assigned": "Esta taquilla ya ha sido asignada", - "Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº {{id}}", - "Not exist this branch": "La rama no existe", - "This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado", - "Collection does not exist": "La colección no existe", - "Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo", - "Insert a date range": "Inserte un rango de fechas", - "Added observation": "{{user}} añadió esta observacion: {{text}}", - "Comment added to client": "Observación añadida al cliente {{clientFk}}", - "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen", -<<<<<<< HEAD - "The price can't be negative": "The price can't be negative" -======= - "company": "Compañía", - "country": "País", - "clientId": "Id cliente", - "clientSocialName": "Cliente", - "amount": "Importe", - "taxableBase": "Base", - "ticketFk": "Id ticket", - "isActive": "Activo", - "hasToInvoice": "Facturar", - "isTaxDataChecked": "Datos comprobados", - "comercialId": "Id comercial", - "comercialName": "Comercial", - "Invalid NIF for VIES": "Invalid NIF for VIES" ->>>>>>> 8578e3ca49718752ec5780aec74fc0a1ca7e7330 + "The grade must be an integer greater than or equal to zero": "The grade must be an integer greater than or equal to zero", + "Description should have maximum of 45 characters": "Description should have maximum of 45 characters", + "Amount cannot be zero": "Amount cannot be zero", + "Period cannot be blank": "Period cannot be blank", + "Sample type cannot be blank": "Sample type cannot be blank", + "Cannot be blank": "Cannot be blank", + "The social name cannot be empty": "The social name cannot be empty", + "Concept cannot be blank": "Concept cannot be blank", + "Enter an integer different to zero": "Enter an integer different to zero", + "Package cannot be blank": "Package cannot be blank", + "State cannot be blank": "State cannot be blank", + "Worker cannot be blank": "Worker cannot be blank", + "Description cannot be blank": "Description cannot be blank", + "Agency cannot be blank": "Agency cannot be blank" } \ No newline at end of file diff --git a/modules/ticket/back/methods/services/refund.js b/modules/ticket/back/methods/services/refund.js new file mode 100644 index 000000000..af58a6286 --- /dev/null +++ b/modules/ticket/back/methods/services/refund.js @@ -0,0 +1,138 @@ +module.exports = Self => { + Self.remoteMethod('refund', { + description: 'Create refund tickets with sales and services if provided', + accessType: 'WRITE', + accepts: [ + { + arg: 'salesIds', + type: ['number'], + required: true + }, + { + arg: 'servicesIds', + type: ['number'] + } + ], + returns: { + type: ['number'], + root: true + }, + http: { + path: `/refund`, + verb: 'post' + } + }); + + Self.refund = async(salesIds, servicesIds, options) => { + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const refundAgencyMode = await models.AgencyMode.findOne({ + include: { + relation: 'zones', + scope: { + limit: 1, + field: ['id', 'name'] + } + }, + where: {code: 'refund'} + }, myOptions); + + const refoundZoneId = refundAgencyMode.zones()[0].id; + + const salesFilter = { + where: {id: {inq: salesIds}}, + include: { + relation: 'components', + scope: { + fields: ['saleFk', 'componentFk', 'value'] + } + } + }; + const sales = await models.Sale.find(salesFilter, myOptions); + const ticketsIds = [...new Set(sales.map(sale => sale.ticketFk))]; + + const now = Date.vnNew(); + const [firstTicketId] = ticketsIds; + + const refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, myOptions); + + for (const sale of sales) { + const createdSale = await models.Sale.create({ + ticketFk: refundTicket.id, + itemFk: sale.itemFk, + quantity: - sale.quantity, + concept: sale.concept, + price: sale.price, + discount: sale.discount, + }, myOptions); + + const components = sale.components(); + for (const component of components) + component.saleFk = createdSale.id; + + await models.SaleComponent.create(components, myOptions); + } + + if (servicesIds && servicesIds.length > 0) { + const servicesFilter = { + where: {id: {inq: servicesIds}} + }; + const services = await models.TicketService.find(servicesFilter, myOptions); + for (const service of services) { + await models.TicketService.create({ + description: service.description, + quantity: - service.quantity, + price: service.price, + taxClassFk: service.taxClassFk, + ticketFk: refundTicket.id, + ticketServiceTypeFk: service.ticketServiceTypeFk, + }, myOptions); + } + } + + if (tx) await tx.commit(); + + return refundTicket; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; + + async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, myOptions) { + const models = Self.app.models; + + const filter = {include: {relation: 'address'}}; + const ticket = await models.Ticket.findById(ticketId, filter, myOptions); + + const refundTicket = await models.Ticket.create({ + clientFk: ticket.clientFk, + shipped: now, + addressFk: ticket.address().id, + agencyModeFk: refundAgencyMode.id, + nickname: ticket.address().nickname, + warehouseFk: ticket.warehouseFk, + companyFk: ticket.companyFk, + landed: now, + zoneFk: refoundZoneId + }, myOptions); + + await models.TicketRefund.create({ + refundTicketFk: refundTicket.id, + originalTicketFk: ticket.id, + }, myOptions); + + return refundTicket; + } +}; diff --git a/modules/ticket/front/routes.json b/modules/ticket/front/routes.json index c86b3a1ef..868824d0d 100644 --- a/modules/ticket/front/routes.json +++ b/modules/ticket/front/routes.json @@ -26,7 +26,8 @@ {"state": "ticket.card.components", "icon": "icon-components"}, {"state": "ticket.card.saleTracking", "icon": "assignment"}, {"state": "ticket.card.dms.index", "icon": "cloud_download"}, - {"state": "ticket.card.boxing", "icon": "science"} + {"state": "ticket.card.boxing", "icon": "science"}, + {"state": "ticket.card.service", "icon": "icon-lines"} ] }, "keybindings": [ diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index 9f5f9b3f5..6fa45b8d1 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -28,7 +28,10 @@ + label="Pay" + ng-click="$ctrl.createRefund()" + vn-acl="invoicing, claimManager, salesAssistant" + vn-acl-action="remove">
diff --git a/modules/ticket/front/services/index.js b/modules/ticket/front/services/index.js index 4866fd8bb..eb4fc3f50 100644 --- a/modules/ticket/front/services/index.js +++ b/modules/ticket/front/services/index.js @@ -49,6 +49,42 @@ class Controller extends Section { .then(() => this.$.model.refresh()) .then(() => this.$.watcher.notifySaved()); } + + selectedServices() { + if (!this.services) return; + + return this.services.filter(service => { + return service.checked; + }); + } + + selectedValidServices() { + if (!this.services) return; + + const selectedServices = this.selectedServices(); + return selectedServices.filter(service => { + return service.id != undefined; + }); + } + + createRefund() { + const services = this.selectedValidServices(); + if (!services) return; + + const servicesIds = services.map(service => service.id); + + const params = {servicesIds: servicesIds}; + const query = 'Services/refund'; + this.$http.post(query, params).then(res => { + const refundTicket = res.data; + this.vnApp.showSuccess(this.$t('The following refund ticket have been created', { + ticketId: refundTicket.id + })); + this.$state.go('ticket.card.service', {id: refundTicket.id}); + + this.resetChanges(); + }); + } } ngModule.vnComponent('vnTicketService', { From c0e13d3339bca00c5e6352e57ab8d497eb2e2d52 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 5 May 2023 12:00:37 +0200 Subject: [PATCH 05/33] refs #4754 del ticket.card.service --- modules/ticket/front/routes.json | 3 +-- modules/ticket/front/services/index.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/ticket/front/routes.json b/modules/ticket/front/routes.json index 868824d0d..c86b3a1ef 100644 --- a/modules/ticket/front/routes.json +++ b/modules/ticket/front/routes.json @@ -26,8 +26,7 @@ {"state": "ticket.card.components", "icon": "icon-components"}, {"state": "ticket.card.saleTracking", "icon": "assignment"}, {"state": "ticket.card.dms.index", "icon": "cloud_download"}, - {"state": "ticket.card.boxing", "icon": "science"}, - {"state": "ticket.card.service", "icon": "icon-lines"} + {"state": "ticket.card.boxing", "icon": "science"} ] }, "keybindings": [ diff --git a/modules/ticket/front/services/index.js b/modules/ticket/front/services/index.js index eb4fc3f50..ab57b7b13 100644 --- a/modules/ticket/front/services/index.js +++ b/modules/ticket/front/services/index.js @@ -74,7 +74,7 @@ class Controller extends Section { const servicesIds = services.map(service => service.id); const params = {servicesIds: servicesIds}; - const query = 'Services/refund'; + const query = 'Service/refund'; this.$http.post(query, params).then(res => { const refundTicket = res.data; this.vnApp.showSuccess(this.$t('The following refund ticket have been created', { From 3d195bddb965bef0a3d21fc6846333f69708d057 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 5 May 2023 14:39:46 +0200 Subject: [PATCH 06/33] refs #4764 mod model post --- modules/ticket/back/methods/services/refund.js | 2 +- modules/ticket/back/models/ticket-methods.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/services/refund.js b/modules/ticket/back/methods/services/refund.js index af58a6286..ba9c898e3 100644 --- a/modules/ticket/back/methods/services/refund.js +++ b/modules/ticket/back/methods/services/refund.js @@ -18,7 +18,7 @@ module.exports = Self => { root: true }, http: { - path: `/refund`, + path: `Tickets/refund`, verb: 'post' } }); diff --git a/modules/ticket/back/models/ticket-methods.js b/modules/ticket/back/models/ticket-methods.js index 3992e7307..1084cd17a 100644 --- a/modules/ticket/back/models/ticket-methods.js +++ b/modules/ticket/back/models/ticket-methods.js @@ -40,4 +40,5 @@ module.exports = function(Self) { require('../methods/ticket/collectionLabel')(Self); require('../methods/ticket/expeditionPalletLabel')(Self); require('../methods/ticket/saveSign')(Self); + require('../methods/services/refund')(Self); }; From b43f1dacf2761a37864aafa6c9b8b4b06384845d Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 8 May 2023 08:50:19 +0200 Subject: [PATCH 07/33] refs #4764 es --- loopback/locale/es.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 7b34285f6..ed21d1153 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -19,5 +19,7 @@ "State cannot be blank": "State cannot be blank", "Worker cannot be blank": "Worker cannot be blank", "Description cannot be blank": "Description cannot be blank", - "Agency cannot be blank": "Agency cannot be blank" + "Agency cannot be blank": "Agency cannot be blank", + "routeFk": "routeFk", + "Changed this data from the ticket": "Changed this data from the ticket" } \ No newline at end of file From 202544565ea1be0dfa4a4abf72573183bf83df22 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 8 May 2023 11:36:52 +0200 Subject: [PATCH 08/33] refs #4764 mod query post --- loopback/locale/es.json | 311 ++++++++++++++++-- .../ticket/back/methods/services/refund.js | 2 +- modules/ticket/front/services/index.js | 2 +- 3 files changed, 292 insertions(+), 23 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index ed21d1153..45993bdd5 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -1,25 +1,294 @@ { - "Name cannot be blank": "Name cannot be blank", - "Swift / BIC cannot be empty": "Swift / BIC cannot be empty", - "Street cannot be empty": "Street cannot be empty", - "City cannot be empty": "City cannot be empty", - "Invalid email": "Invalid email", - "Phone cannot be blank": "Phone cannot be blank", + "Phone format is invalid": "El formato del teléfono no es correcto", + "You are not allowed to change the credit": "No tienes privilegios para modificar el crédito", + "Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia", + "The default consignee can not be unchecked": "No se puede desmarcar el consignatario predeterminado", + "Unable to default a disabled consignee": "No se puede poner predeterminado un consignatario desactivado", + "Can't be blank": "No puede estar en blanco", + "Invalid TIN": "NIF/CIF invalido", + "TIN must be unique": "El NIF/CIF debe ser único", + "A client with that Web User name already exists": "Ya existe un cliente con ese Usuario Web", + "Is invalid": "Is invalid", + "Quantity cannot be zero": "La cantidad no puede ser cero", + "Enter an integer different to zero": "Introduce un entero distinto de cero", + "Package cannot be blank": "El embalaje no puede estar en blanco", + "The company name must be unique": "La razón social debe ser única", + "Invalid email": "Correo electrónico inválido", + "The IBAN does not have the correct format": "El IBAN no tiene el formato correcto", + "That payment method requires an IBAN": "El método de pago seleccionado requiere un IBAN", + "That payment method requires a BIC": "El método de pago seleccionado requiere un BIC", + "State cannot be blank": "El estado no puede estar en blanco", + "Worker cannot be blank": "El trabajador no puede estar en blanco", + "Cannot change the payment method if no salesperson": "No se puede cambiar la forma de pago si no hay comercial asignado", + "can't be blank": "El campo no puede estar vacío", + "Observation type must be unique": "El tipo de observación no puede repetirse", "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero", - "The grade must be an integer greater than or equal to zero": "The grade must be an integer greater than or equal to zero", - "Description should have maximum of 45 characters": "Description should have maximum of 45 characters", - "Amount cannot be zero": "Amount cannot be zero", - "Period cannot be blank": "Period cannot be blank", - "Sample type cannot be blank": "Sample type cannot be blank", - "Cannot be blank": "Cannot be blank", - "The social name cannot be empty": "The social name cannot be empty", - "Concept cannot be blank": "Concept cannot be blank", - "Enter an integer different to zero": "Enter an integer different to zero", - "Package cannot be blank": "Package cannot be blank", - "State cannot be blank": "State cannot be blank", - "Worker cannot be blank": "Worker cannot be blank", - "Description cannot be blank": "Description cannot be blank", - "Agency cannot be blank": "Agency cannot be blank", + "The grade must be similar to the last one": "El grade debe ser similar al último", + "Only manager can change the credit": "Solo el gerente puede cambiar el credito de este cliente", + "Name cannot be blank": "El nombre no puede estar en blanco", + "Phone cannot be blank": "El teléfono no puede estar en blanco", + "Period cannot be blank": "El periodo no puede estar en blanco", + "Choose a company": "Selecciona una empresa", + "Se debe rellenar el campo de texto": "Se debe rellenar el campo de texto", + "Description should have maximum of 45 characters": "La descripción debe tener maximo 45 caracteres", + "Cannot be blank": "El campo no puede estar en blanco", + "The grade must be an integer greater than or equal to zero": "El grade debe ser un entero mayor o igual a cero", + "Sample type cannot be blank": "El tipo de plantilla no puede quedar en blanco", + "Description cannot be blank": "Se debe rellenar el campo de texto", + "The new quantity should be smaller than the old one": "La nueva cantidad debe de ser menor que la anterior", + "The value should not be greater than 100%": "El valor no debe de ser mayor de 100%", + "The value should be a number": "El valor debe ser un numero", + "This order is not editable": "Esta orden no se puede modificar", + "You can't create an order for a frozen client": "No puedes crear una orden para un cliente congelado", + "You can't create an order for a client that has a debt": "No puedes crear una orden para un cliente con deuda", + "is not a valid date": "No es una fecha valida", + "Barcode must be unique": "El código de barras debe ser único", + "The warehouse can't be repeated": "El almacén no puede repetirse", + "The tag or priority can't be repeated for an item": "El tag o prioridad no puede repetirse para un item", + "The observation type can't be repeated": "El tipo de observación no puede repetirse", + "A claim with that sale already exists": "Ya existe una reclamación para esta línea", + "You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo", + "Warehouse cannot be blank": "El almacén no puede quedar en blanco", + "Agency cannot be blank": "La agencia no puede quedar en blanco", + "Not enough privileges to edit a client with verified data": "No tienes permisos para hacer cambios en un cliente con datos comprobados", + "This address doesn't exist": "Este consignatario no existe", + "You must delete the claim id %d first": "Antes debes borrar la reclamación %d", + "You don't have enough privileges": "No tienes suficientes permisos", + "Cannot check Equalization Tax in this NIF/CIF": "No se puede marcar RE en este NIF/CIF", + "You can't make changes on the basic data of an confirmed order or with rows": "No puedes cambiar los datos basicos de una orden con artículos", + "INVALID_USER_NAME": "El nombre de usuario solo debe contener letras minúsculas o, a partir del segundo carácter, números o subguiones, no esta permitido el uso de la letra ñ", + "You can't create a ticket for a frozen client": "No puedes crear un ticket para un cliente congelado", + "You can't create a ticket for a inactive client": "No puedes crear un ticket para un cliente inactivo", + "Tag value cannot be blank": "El valor del tag no puede quedar en blanco", + "ORDER_EMPTY": "Cesta vacía", + "You don't have enough privileges to do that": "No tienes permisos para cambiar esto", + "NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT", + "Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido", + "Street cannot be empty": "Dirección no puede estar en blanco", + "City cannot be empty": "Cuidad no puede estar en blanco", + "Code cannot be blank": "Código no puede estar en blanco", + "You cannot remove this department": "No puedes eliminar este departamento", + "The extension must be unique": "La extensión debe ser unica", + "The secret can't be blank": "La contraseña no puede estar en blanco", + "We weren't able to send this SMS": "No hemos podido enviar el SMS", + "This client can't be invoiced": "Este cliente no puede ser facturado", + "This ticket can't be invoiced": "Este ticket no puede ser facturado", + "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado", + "This ticket can not be modified": "Este ticket no puede ser modificado", + "The introduced hour already exists": "Esta hora ya ha sido introducida", + "INFINITE_LOOP": "Existe una dependencia entre dos Jefes", + "The sales of the current ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas", + "The sales of the receiver ticket can't be modified": "Las lineas del ticket al que envias no pueden ser modificadas", + "NO_AGENCY_AVAILABLE": "No hay una zona de reparto disponible con estos parámetros", + "ERROR_PAST_SHIPMENT": "No puedes seleccionar una fecha de envío en pasado", + "The current ticket can't be modified": "El ticket actual no puede ser modificado", + "The current claim can't be modified": "La reclamación actual no puede ser modificada", + "The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas", + "Please select at least one sale": "Por favor selecciona al menos una linea", + "All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket", + "NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", + "This item doesn't exists": "El artículo no existe", + "NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", + "Extension format is invalid": "El formato de la extensión es inválido", + "Invalid parameters to create a new ticket": "Parámetros inválidos para crear un nuevo ticket", + "This item is not available": "Este artículo no está disponible", + "This postcode already exists": "Este código postal ya existe", + "Concept cannot be blank": "El concepto no puede quedar en blanco", + "File doesn't exists": "El archivo no existe", + "You don't have privileges to change the zone": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias", + "This ticket is already on weekly tickets": "Este ticket ya está en tickets programados", + "Ticket id cannot be blank": "El id de ticket no puede quedar en blanco", + "Weekday cannot be blank": "El día de la semana no puede quedar en blanco", + "You can't delete a confirmed order": "No puedes borrar un pedido confirmado", + "The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto", + "Invalid quantity": "Cantidad invalida", + "This postal code is not valid": "This postal code is not valid", + "is invalid": "is invalid", + "The postcode doesn't exist. Please enter a correct one": "El código postal no existe. Por favor, introduce uno correcto", + "The department name can't be repeated": "El nombre del departamento no puede repetirse", + "This phone already exists": "Este teléfono ya existe", + "You cannot move a parent to its own sons": "No puedes mover un elemento padre a uno de sus hijos", + "You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado", + "You cannot delete a ticket that part of it is being prepared": "No puedes eliminar un ticket en el que una parte que está siendo preparada", + "You must delete all the buy requests first": "Debes eliminar todas las peticiones de compra primero", + "You should specify a date": "Debes especificar una fecha", + "You should specify at least a start or end date": "Debes especificar al menos una fecha de inicio o de fín", + "Start date should be lower than end date": "La fecha de inicio debe ser menor que la fecha de fín", + "You should mark at least one week day": "Debes marcar al menos un día de la semana", + "Swift / BIC can't be empty": "Swift / BIC no puede estar vacío", + "Customs agent is required for a non UEE member": "El agente de aduanas es requerido para los clientes extracomunitarios", + "Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios", + "Deleted sales from ticket": "He eliminado las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}", + "Added sale to ticket": "He añadido la siguiente linea al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}", + "Changed sale discount": "He cambiado el descuento de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "Created claim": "He creado la reclamación [{{claimId}}]({{{claimUrl}}}) de las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "Changed sale price": "He cambiado el precio de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* del ticket [{{ticketId}}]({{{ticketUrl}}})", + "Changed sale quantity": "He cambiado la cantidad de [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* del ticket [{{ticketId}}]({{{ticketUrl}}})", + "State": "Estado", + "regular": "normal", + "reserved": "reservado", + "Changed sale reserved state": "He cambiado el estado reservado de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "Bought units from buy request": "Se ha comprado {{quantity}} unidades de [{{itemId}} {{concept}}]({{{urlItem}}}) para el ticket id [{{ticketId}}]({{{url}}})", + "Deny buy request": "Se ha rechazado la petición de compra para el ticket id [{{ticketId}}]({{{url}}}). Motivo: {{observation}}", + "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*", + "Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})", + "Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})", + "Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}", + "Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*", + "Claim state has changed to incomplete": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *incompleta*", + "Claim state has changed to canceled": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *anulado*", + "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}", + "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto", + "Distance must be lesser than 1000": "La distancia debe ser inferior a 1000", + "This ticket is deleted": "Este ticket está eliminado", + "Unable to clone this travel": "No ha sido posible clonar este travel", + "This thermograph id already exists": "La id del termógrafo ya existe", + "Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante", + "ORDER_ALREADY_CONFIRMED": "ORDER_ALREADY_CONFIRMED", + "Invalid password": "Invalid password", + "Password does not meet requirements": "La contraseña no cumple los requisitos", + "Role already assigned": "Role already assigned", + "Invalid role name": "Invalid role name", + "Role name must be written in camelCase": "Role name must be written in camelCase", + "Email already exists": "Email already exists", + "User already exists": "User already exists", + "Absence change notification on the labour calendar": "Notificacion de cambio de ausencia en el calendario laboral", + "Record of hours week": "Registro de horas semana {{week}} año {{year}} ", + "Created absence": "El empleado {{author}} ha añadido una ausencia de tipo '{{absenceType}}' a {{employee}} para el día {{dated}}.", + "Deleted absence": "El empleado {{author}} ha eliminado una ausencia de tipo '{{absenceType}}' a {{employee}} del día {{dated}}.", + "I have deleted the ticket id": "He eliminado el ticket id [{{id}}]({{{url}}})", + "I have restored the ticket id": "He restaurado el ticket id [{{id}}]({{{url}}})", + "You can only restore a ticket within the first hour after deletion": "Únicamente puedes restaurar el ticket dentro de la primera hora después de su eliminación", + "Changed this data from the ticket": "He cambiado estos datos del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "agencyModeFk": "Agencia", + "clientFk": "Cliente", + "zoneFk": "Zona", + "warehouseFk": "Almacén", + "shipped": "F. envío", + "landed": "F. entrega", + "addressFk": "Consignatario", + "companyFk": "Empresa", + "The social name cannot be empty": "La razón social no puede quedar en blanco", + "The nif cannot be empty": "El NIF no puede quedar en blanco", + "You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados", + "ASSIGN_ZONE_FIRST": "Asigna una zona primero", + "Amount cannot be zero": "El importe no puede ser cero", + "Company has to be official": "Empresa inválida", + "You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria", + "Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas", + "The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta", + "Sorts whole route": "Reordena ruta entera", + "New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*", + "New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*", + "Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío", + "This BIC already exist.": "Este BIC ya existe.", + "That item doesn't exists": "Ese artículo no existe", + "There's a new urgent ticket:": "Hay un nuevo ticket urgente:", + "Invalid account": "Cuenta inválida", + "Compensation account is empty": "La cuenta para compensar está vacia", + "This genus already exist": "Este genus ya existe", + "This specie already exist": "Esta especie ya existe", + "Client assignment has changed": "He cambiado el comercial ~*\"<{{previousWorkerName}}>\"*~ por *\"<{{currentWorkerName}}>\"* del cliente [{{clientName}} ({{clientId}})]({{{url}}})", + "None": "Ninguno", + "The contract was not active during the selected date": "El contrato no estaba activo durante la fecha seleccionada", + "Cannot add more than one '1/2 day vacation'": "No puedes añadir más de un 'Vacaciones 1/2 dia'", + "This document already exists on this ticket": "Este documento ya existe en el ticket", + "Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables", + "You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes", + "nickname": "nickname", + "INACTIVE_PROVIDER": "Proveedor inactivo", + "This client is not invoiceable": "Este cliente no es facturable", + "serial non editable": "Esta serie no permite asignar la referencia", + "Max shipped required": "La fecha límite es requerida", + "Can't invoice to future": "No se puede facturar a futuro", + "Can't invoice to past": "No se puede facturar a pasado", + "This ticket is already invoiced": "Este ticket ya está facturado", + "A ticket with an amount of zero can't be invoiced": "No se puede facturar un ticket con importe cero", + "A ticket with a negative base can't be invoiced": "No se puede facturar un ticket con una base negativa", + "Global invoicing failed": "[Facturación global] No se han podido facturar algunos clientes", + "Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes", + "Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio", + "You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito", + "You can't change the credit set to zero from a financialBoss": "No puedes cambiar el cŕedito establecido a cero por un jefe de finanzas", + "Amounts do not match": "Las cantidades no coinciden", + "The PDF document does not exists": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'", + "The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos", + "You can't create a claim from a ticket delivered more than seven days ago": "No puedes crear una reclamación de un ticket entregado hace más de siete días", + "The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día", + "The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día", + "You can not modify is pay method checked": "No se puede modificar el campo método de pago validado", + "Can't transfer claimed sales": "No puedes transferir lineas reclamadas", + "You don't have privileges to create refund": "No tienes permisos para crear un abono", + "The item is required": "El artículo es requerido", + "The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo", + "date in the future": "Fecha en el futuro", + "reference duplicated": "Referencia duplicada", + "This ticket is already a refund": "Este ticket ya es un abono", + "isWithoutNegatives": "isWithoutNegatives", "routeFk": "routeFk", - "Changed this data from the ticket": "Changed this data from the ticket" + "Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador", + "No hay un contrato en vigor": "No hay un contrato en vigor", + "No se permite fichar a futuro": "No se permite fichar a futuro", + "No está permitido trabajar": "No está permitido trabajar", + "Fichadas impares": "Fichadas impares", + "Descanso diario 12h.": "Descanso diario 12h.", + "Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.", + "Dirección incorrecta": "Dirección incorrecta", + "Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador", + "Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador", + "Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente", + "This route does not exists": "Esta ruta no existe", + "Claim pickup order sent": "Reclamación Orden de recogida enviada [{{claimId}}]({{{claimUrl}}}) al cliente *{{clientName}}*", + "You don't have grant privilege": "No tienes privilegios para dar privilegios", + "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario", + "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) fusionado con [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})", + "Already has this status": "Ya tiene este estado", + "There aren't records for this week": "No existen registros para esta semana", + "Empty data source": "Origen de datos vacio", + "App locked": "Aplicación bloqueada por el usuario {{userId}}", + "Email verify": "Correo de verificación", + "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment", + "Receipt's bank was not found": "No se encontró el banco del recibo", + "This receipt was not compensated": "Este recibo no ha sido compensado", + "Client's email was not found": "No se encontró el email del cliente", + "Negative basis": "Base negativa", + "This worker code already exists": "Este codigo de trabajador ya existe", + "This personal mail already exists": "Este correo personal ya existe", + "This worker already exists": "Este trabajador ya existe", + "App name does not exist": "El nombre de aplicación no es válido", + "Try again": "Vuelve a intentarlo", + "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9", + "Failed to upload file": "Error al subir archivo", + "The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe", + "It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar", + "It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo", + "It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas", + "A supplier with the same name already exists. Change the country.": "Un proveedor con el mismo nombre ya existe. Cambie el país.", + "There is no assigned email for this client": "No hay correo asignado para este cliente", + "Exists an invoice with a previous date": "Existe una factura con fecha anterior", + "Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite", + "Warehouse inventory not set": "El almacén inventario no está establecido", + "This locker has already been assigned": "Esta taquilla ya ha sido asignada", + "Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº {{id}}", + "Not exist this branch": "La rama no existe", + "This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado", + "Collection does not exist": "La colección no existe", + "Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo", + "Insert a date range": "Inserte un rango de fechas", + "Added observation": "{{user}} añadió esta observacion: {{text}}", + "Comment added to client": "Observación añadida al cliente {{clientFk}}", + "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen", + "company": "Compañía", + "country": "País", + "clientId": "Id cliente", + "clientSocialName": "Cliente", + "amount": "Importe", + "taxableBase": "Base", + "ticketFk": "Id ticket", + "isActive": "Activo", + "hasToInvoice": "Facturar", + "isTaxDataChecked": "Datos comprobados", + "comercialId": "Id comercial", + "comercialName": "Comercial", + "Invalid NIF for VIES": "Invalid NIF for VIES" } \ No newline at end of file diff --git a/modules/ticket/back/methods/services/refund.js b/modules/ticket/back/methods/services/refund.js index ba9c898e3..af58a6286 100644 --- a/modules/ticket/back/methods/services/refund.js +++ b/modules/ticket/back/methods/services/refund.js @@ -18,7 +18,7 @@ module.exports = Self => { root: true }, http: { - path: `Tickets/refund`, + path: `/refund`, verb: 'post' } }); diff --git a/modules/ticket/front/services/index.js b/modules/ticket/front/services/index.js index ab57b7b13..f6f21edbd 100644 --- a/modules/ticket/front/services/index.js +++ b/modules/ticket/front/services/index.js @@ -74,7 +74,7 @@ class Controller extends Section { const servicesIds = services.map(service => service.id); const params = {servicesIds: servicesIds}; - const query = 'Service/refund'; + const query = 'Tickets/refund'; this.$http.post(query, params).then(res => { const refundTicket = res.data; this.vnApp.showSuccess(this.$t('The following refund ticket have been created', { From 78f337c6d4c21d1f5ad28898a5f5919176fba486 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 9 May 2023 14:56:32 +0200 Subject: [PATCH 09/33] refs 4764 quit index --- modules/ticket/front/services/index.html | 4 ++-- modules/ticket/front/services/index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index 6fa45b8d1..26212be66 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -34,9 +34,9 @@ vn-acl-action="remove">
- + + ng-model="service.checked"> service.id); From aa96f1eb97e69af9fc589ce80f62f61cd920b502 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 9 May 2023 19:42:25 +0200 Subject: [PATCH 10/33] refs #4764 without checkbox --- modules/ticket/front/services/index.html | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index 26212be66..c60eacfa9 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -33,12 +33,7 @@ vn-acl="invoicing, claimManager, salesAssistant" vn-acl-action="remove"> -
- - - - Date: Tue, 9 May 2023 19:43:55 +0200 Subject: [PATCH 11/33] refs #4764 check selectedvalidservices --- modules/ticket/front/services/index.html | 7 ++++++- modules/ticket/front/services/index.js | 9 --------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index c60eacfa9..26212be66 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -33,7 +33,12 @@ vn-acl="invoicing, claimManager, salesAssistant" vn-acl-action="remove"> - +
+ + + + { - return service.id != undefined; - }); - } - createRefund() { const services = this.selectedServices(); if (!services) return; From 65646d3b659be0e7df991e6370031daccd0ed925 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 9 May 2023 19:49:16 +0200 Subject: [PATCH 12/33] refs #4764 validServices --- modules/ticket/front/services/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/ticket/front/services/index.js b/modules/ticket/front/services/index.js index b55005e97..ae27a19ac 100644 --- a/modules/ticket/front/services/index.js +++ b/modules/ticket/front/services/index.js @@ -58,6 +58,15 @@ class Controller extends Section { }); } + selectedValidServices() { + if (!this.services) return; + + const selectedServices = this.selectedServices(); + return selectedServices.filter(service => { + return service.id != undefined; + }); + } + createRefund() { const services = this.selectedServices(); if (!services) return; From ce62b51b29e5ab7a9d437e7ae1ded5981e4e0e83 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 12 May 2023 15:08:04 +0200 Subject: [PATCH 13/33] refs #4764 remove br --- modules/ticket/front/services/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index 26212be66..749d179a3 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -33,7 +33,7 @@ vn-acl="invoicing, claimManager, salesAssistant" vn-acl-action="remove"> -
+ From 8a6881bf73d0075ed44aa8732105bed597240a85 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 12 May 2023 15:50:32 +0200 Subject: [PATCH 14/33] refs #4764 mod tabindex --- modules/ticket/front/services/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index 749d179a3..88f614ac5 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -33,9 +33,9 @@ vn-acl="invoicing, claimManager, salesAssistant" vn-acl-action="remove"> - + - Date: Wed, 7 Jun 2023 14:12:04 +0200 Subject: [PATCH 15/33] refs #4764 refundTicket --- modules/ticket/back/methods/sale/refund.js | 74 ++++++---- .../ticket/back/methods/services/refund.js | 138 ------------------ modules/ticket/back/models/ticket-methods.js | 1 - modules/ticket/front/services/index.js | 6 +- 4 files changed, 48 insertions(+), 171 deletions(-) delete mode 100644 modules/ticket/back/methods/services/refund.js diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index 18ccee976..461bb1f3b 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -5,8 +5,7 @@ module.exports = Self => { accepts: [ { arg: 'salesIds', - type: ['number'], - required: true + type: ['number'] }, { arg: 'servicesIds', @@ -36,6 +35,7 @@ module.exports = Self => { myOptions.transaction = tx; } + let refundTicket = null; try { const refundAgencyMode = await models.AgencyMode.findOne({ include: { @@ -50,38 +50,54 @@ module.exports = Self => { const refoundZoneId = refundAgencyMode.zones()[0].id; - const salesFilter = { - where: {id: {inq: salesIds}}, - include: { - relation: 'components', - scope: { - fields: ['saleFk', 'componentFk', 'value'] + if (salesIds) { + const salesFilter = { + where: {id: {inq: salesIds}}, + include: { + relation: 'components', + scope: { + fields: ['saleFk', 'componentFk', 'value'] + } } + }; + const sales = await models.Sale.find(salesFilter, myOptions); + const ticketsIds = [...new Set(sales.map(sale => sale.ticketFk))]; + + const now = Date.vnNew(); + const [firstTicketId] = ticketsIds; + + refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, myOptions); + + for (const sale of sales) { + const createdSale = await models.Sale.create({ + ticketFk: refundTicket.id, + itemFk: sale.itemFk, + quantity: - sale.quantity, + concept: sale.concept, + price: sale.price, + discount: sale.discount, + }, myOptions); + + const components = sale.components(); + for (const component of components) + component.saleFk = createdSale.id; + + await models.SaleComponent.create(components, myOptions); } - }; - const sales = await models.Sale.find(salesFilter, myOptions); - const ticketsIds = [...new Set(sales.map(sale => sale.ticketFk))]; + } - const now = Date.vnNew(); - const [firstTicketId] = ticketsIds; + if (!refundTicket) { + const servicesFilter = { + where: {id: {inq: servicesIds}} + }; + const services = await models.TicketService.find(servicesFilter, myOptions); + const ticketsIds = [...new Set(services.map(service => service.ticketFk))]; - const refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, myOptions); + const now = Date.vnNew(); + const [firstTicketId] = ticketsIds; - for (const sale of sales) { - const createdSale = await models.Sale.create({ - ticketFk: refundTicket.id, - itemFk: sale.itemFk, - quantity: - sale.quantity, - concept: sale.concept, - price: sale.price, - discount: sale.discount, - }, myOptions); - - const components = sale.components(); - for (const component of components) - component.saleFk = createdSale.id; - - await models.SaleComponent.create(components, myOptions); + refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, myOptions); + return refundTicket; } if (servicesIds && servicesIds.length > 0) { diff --git a/modules/ticket/back/methods/services/refund.js b/modules/ticket/back/methods/services/refund.js deleted file mode 100644 index af58a6286..000000000 --- a/modules/ticket/back/methods/services/refund.js +++ /dev/null @@ -1,138 +0,0 @@ -module.exports = Self => { - Self.remoteMethod('refund', { - description: 'Create refund tickets with sales and services if provided', - accessType: 'WRITE', - accepts: [ - { - arg: 'salesIds', - type: ['number'], - required: true - }, - { - arg: 'servicesIds', - type: ['number'] - } - ], - returns: { - type: ['number'], - root: true - }, - http: { - path: `/refund`, - verb: 'post' - } - }); - - Self.refund = async(salesIds, servicesIds, options) => { - const models = Self.app.models; - const myOptions = {}; - let tx; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } - - try { - const refundAgencyMode = await models.AgencyMode.findOne({ - include: { - relation: 'zones', - scope: { - limit: 1, - field: ['id', 'name'] - } - }, - where: {code: 'refund'} - }, myOptions); - - const refoundZoneId = refundAgencyMode.zones()[0].id; - - const salesFilter = { - where: {id: {inq: salesIds}}, - include: { - relation: 'components', - scope: { - fields: ['saleFk', 'componentFk', 'value'] - } - } - }; - const sales = await models.Sale.find(salesFilter, myOptions); - const ticketsIds = [...new Set(sales.map(sale => sale.ticketFk))]; - - const now = Date.vnNew(); - const [firstTicketId] = ticketsIds; - - const refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, myOptions); - - for (const sale of sales) { - const createdSale = await models.Sale.create({ - ticketFk: refundTicket.id, - itemFk: sale.itemFk, - quantity: - sale.quantity, - concept: sale.concept, - price: sale.price, - discount: sale.discount, - }, myOptions); - - const components = sale.components(); - for (const component of components) - component.saleFk = createdSale.id; - - await models.SaleComponent.create(components, myOptions); - } - - if (servicesIds && servicesIds.length > 0) { - const servicesFilter = { - where: {id: {inq: servicesIds}} - }; - const services = await models.TicketService.find(servicesFilter, myOptions); - for (const service of services) { - await models.TicketService.create({ - description: service.description, - quantity: - service.quantity, - price: service.price, - taxClassFk: service.taxClassFk, - ticketFk: refundTicket.id, - ticketServiceTypeFk: service.ticketServiceTypeFk, - }, myOptions); - } - } - - if (tx) await tx.commit(); - - return refundTicket; - } catch (e) { - if (tx) await tx.rollback(); - throw e; - } - }; - - async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, myOptions) { - const models = Self.app.models; - - const filter = {include: {relation: 'address'}}; - const ticket = await models.Ticket.findById(ticketId, filter, myOptions); - - const refundTicket = await models.Ticket.create({ - clientFk: ticket.clientFk, - shipped: now, - addressFk: ticket.address().id, - agencyModeFk: refundAgencyMode.id, - nickname: ticket.address().nickname, - warehouseFk: ticket.warehouseFk, - companyFk: ticket.companyFk, - landed: now, - zoneFk: refoundZoneId - }, myOptions); - - await models.TicketRefund.create({ - refundTicketFk: refundTicket.id, - originalTicketFk: ticket.id, - }, myOptions); - - return refundTicket; - } -}; diff --git a/modules/ticket/back/models/ticket-methods.js b/modules/ticket/back/models/ticket-methods.js index 4acaaea86..e5a8e8d94 100644 --- a/modules/ticket/back/models/ticket-methods.js +++ b/modules/ticket/back/models/ticket-methods.js @@ -39,5 +39,4 @@ module.exports = function(Self) { require('../methods/ticket/collectionLabel')(Self); require('../methods/ticket/expeditionPalletLabel')(Self); require('../methods/ticket/saveSign')(Self); - require('../methods/services/refund')(Self); }; diff --git a/modules/ticket/front/services/index.js b/modules/ticket/front/services/index.js index ae27a19ac..a6f91a110 100644 --- a/modules/ticket/front/services/index.js +++ b/modules/ticket/front/services/index.js @@ -68,19 +68,19 @@ class Controller extends Section { } createRefund() { - const services = this.selectedServices(); + const services = this.selectedValidServices(); if (!services) return; const servicesIds = services.map(service => service.id); const params = {servicesIds: servicesIds}; - const query = 'Tickets/refund'; + const query = 'Sales/refund'; this.$http.post(query, params).then(res => { const refundTicket = res.data; this.vnApp.showSuccess(this.$t('The following refund ticket have been created', { ticketId: refundTicket.id })); - this.$state.go('ticket.card.service', {id: refundTicket.id}); + this.$state.go('ticket.card.sale', {id: refundTicket.id}); this.resetChanges(); }); From 61d9e2dcd320e8a20202784bcc83b2e5f6921145 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 9 Jun 2023 14:19:17 +0200 Subject: [PATCH 16/33] refs #4764 remake refund, back front --- modules/ticket/back/methods/sale/refund.js | 2 +- modules/ticket/front/services/index.html | 18 +++++------ modules/ticket/front/services/index.js | 35 ++++++++++++---------- 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index 461bb1f3b..38a6c19ec 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -97,7 +97,6 @@ module.exports = Self => { const [firstTicketId] = ticketsIds; refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, myOptions); - return refundTicket; } if (servicesIds && servicesIds.length > 0) { @@ -130,6 +129,7 @@ module.exports = Self => { }; async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, myOptions) { + console.log(ticketId, now, refundAgencyMode, refoundZoneId); const models = Self.app.models; const filter = {include: {relation: 'address'}}; diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index 88f614ac5..eeb1661c0 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -1,4 +1,4 @@ - - + - - + - + - - \ No newline at end of file + diff --git a/modules/ticket/front/services/index.js b/modules/ticket/front/services/index.js index a6f91a110..0b0c28cbe 100644 --- a/modules/ticket/front/services/index.js +++ b/modules/ticket/front/services/index.js @@ -67,23 +67,28 @@ class Controller extends Section { }); } + hasSelectedServices() { + const selected = this.selectedServices() || []; + return selected.length > 0; + } + createRefund() { - const services = this.selectedValidServices(); - if (!services) return; + this.$.model.save() + .then(() => { + const services = this.selectedValidServices(); + if (!services) return; + const servicesIds = services.map(service => service.id); - const servicesIds = services.map(service => service.id); - - const params = {servicesIds: servicesIds}; - const query = 'Sales/refund'; - this.$http.post(query, params).then(res => { - const refundTicket = res.data; - this.vnApp.showSuccess(this.$t('The following refund ticket have been created', { - ticketId: refundTicket.id - })); - this.$state.go('ticket.card.sale', {id: refundTicket.id}); - - this.resetChanges(); - }); + const params = {servicesIds: servicesIds}; + const query = 'Sales/refund'; + this.$http.post(query, params).then(res => { + const refundTicket = res.data; + this.vnApp.showSuccess(this.$t('The following refund ticket have been created', { + ticketId: refundTicket.id + })); + this.$state.go('ticket.card.sale', {id: refundTicket.id}); + }); + }); } } From 06d1334e1fc633e2b2ecf79e092790e3e29f2401 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 9 Jun 2023 14:30:46 +0200 Subject: [PATCH 17/33] refs #4764 withWarehouse --- modules/ticket/back/methods/sale/refund.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index 18935699a..86e2a4570 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -71,7 +71,8 @@ module.exports = Self => { const now = Date.vnNew(); const [firstTicketId] = ticketsIds; - refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, myOptions); + // eslint-disable-next-line max-len + refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, withWarehouse, refoundZoneId, myOptions); for (const sale of sales) { const createdSale = await models.Sale.create({ @@ -101,7 +102,8 @@ module.exports = Self => { const now = Date.vnNew(); const [firstTicketId] = ticketsIds; - refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, myOptions); + // eslint-disable-next-line max-len + refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, withWarehouse, refoundZoneId, myOptions); } if (servicesIds && servicesIds.length > 0) { From 58bcad7b2d6a2853688cae8214a32e81b354241d Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 12 Jun 2023 12:42:30 +0200 Subject: [PATCH 18/33] refs #4764 validator create --- front/core/lib/validator.js | 7 +++++-- front/core/locale/es.yml | 1 + modules/ticket/back/methods/sale/refund.js | 16 +++++----------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/front/core/lib/validator.js b/front/core/lib/validator.js index b0b8f7389..51134f30a 100644 --- a/front/core/lib/validator.js +++ b/front/core/lib/validator.js @@ -5,6 +5,10 @@ export const validators = { if (validator.isEmpty(value ? String(value) : '')) throw new Error(_($translate, `Value can't be empty`)); }, + negative: $translate => { + if (validator < 0) + throw new Error(_($translate, `Negative numbers are not allowed. Please enter a valid number.`)); + }, absence: ($translate, value) => { if (!validator.isEmpty(value)) throw new Error(_($translate, `Value should be empty`)); @@ -104,9 +108,8 @@ export function checkNull($translate, value, conf) { export function _($translate, text, params = []) { text = $translate.instant(text); - for (let i = 0; i < params.length; i++) { + for (let i = 0; i < params.length; i++) text = text.replace('%s', params[i]); - } return text; } diff --git a/front/core/locale/es.yml b/front/core/locale/es.yml index f654c61cf..5bd507083 100644 --- a/front/core/locale/es.yml +++ b/front/core/locale/es.yml @@ -16,6 +16,7 @@ Value can't be empty: El valor no puede estar vacío Value should be empty: El valor debe estar vacío Value should be integer: El valor debe ser entero Value should be a number: El valor debe ser numérico +Negative numbers are not allowed. Please enter a valid number: No se permiten números negativos. Por favor, ingrese un número válido Invalid value: Valor incorrecto Value can't be blank: El valor no puede estar en blanco Value can't be null: El valor no puede ser nulo diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index 86e2a4570..d3e9257ce 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -10,11 +10,6 @@ module.exports = Self => { { arg: 'servicesIds', type: ['number'] - }, - { - arg: 'withWarehouse', - type: 'boolean', - required: true } ], returns: { @@ -27,7 +22,7 @@ module.exports = Self => { } }); - Self.refund = async(salesIds, servicesIds, withWarehouse, options) => { + Self.refund = async(salesIds, servicesIds, options) => { const models = Self.app.models; const myOptions = {}; let tx; @@ -72,7 +67,7 @@ module.exports = Self => { const [firstTicketId] = ticketsIds; // eslint-disable-next-line max-len - refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, withWarehouse, refoundZoneId, myOptions); + refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, myOptions); for (const sale of sales) { const createdSale = await models.Sale.create({ @@ -103,7 +98,7 @@ module.exports = Self => { const [firstTicketId] = ticketsIds; // eslint-disable-next-line max-len - refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, withWarehouse, refoundZoneId, myOptions); + refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, myOptions); } if (servicesIds && servicesIds.length > 0) { @@ -114,8 +109,8 @@ module.exports = Self => { for (const service of services) { await models.TicketService.create({ description: service.description, - quantity: - service.quantity, - price: service.price, + quantity: service.quantity, + price: - service.price, taxClassFk: service.taxClassFk, ticketFk: refundTicket.id, ticketServiceTypeFk: service.ticketServiceTypeFk, @@ -147,7 +142,6 @@ module.exports = Self => { addressFk: ticket.address().id, agencyModeFk: refundAgencyMode.id, nickname: ticket.address().nickname, - warehouseFk: withWarehouse ? ticket.warehouseFk : null, companyFk: ticket.companyFk, landed: now, zoneFk: refoundZoneId From fbe4441edae4182474215ee18bb31730280359af Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 16 Jun 2023 09:06:25 +0200 Subject: [PATCH 19/33] refs #4764 e2e solve --- e2e/helpers/selectors.js | 4 ++-- e2e/paths/05-ticket/13_services.spec.js | 2 +- modules/ticket/back/methods/sale/refund.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index b8eaa99a1..ed5fe52c2 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -682,8 +682,8 @@ export default { firstAddServiceTypeButton: 'vn-ticket-service vn-icon-button[vn-tooltip="New service type"]', firstServiceType: 'vn-ticket-service vn-autocomplete[ng-model="service.ticketServiceTypeFk"]', firstQuantity: 'vn-ticket-service vn-input-number[ng-model="service.quantity"]', - firstPrice: 'vn-ticket-service vn-horizontal:nth-child(1) vn-input-number[ng-model="service.price"]', - fistDeleteServiceButton: 'vn-ticket-service form vn-horizontal:nth-child(1) vn-icon-button[icon="delete"]', + firstPrice: 'vn-ticket-service vn-horizontal:nth-child(2) vn-input-number[ng-model="service.price"]', + fistDeleteServiceButton: 'vn-ticket-service form vn-horizontal:nth-child(2) vn-icon-button[icon="delete"]', newServiceTypeName: '.vn-dialog.shown vn-textfield[ng-model="newServiceType.name"]', serviceLine: 'vn-ticket-service > form > vn-card > vn-one:nth-child(2) > vn-horizontal', saveServiceButton: 'button[type=submit]', diff --git a/e2e/paths/05-ticket/13_services.spec.js b/e2e/paths/05-ticket/13_services.spec.js index 50df23582..c7bb1648e 100644 --- a/e2e/paths/05-ticket/13_services.spec.js +++ b/e2e/paths/05-ticket/13_services.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -describe('Ticket services path', () => { +fdescribe('Ticket services path', () => { let browser; let page; const invoicedTicketId = '1'; diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index f3395645c..1b18467b9 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -22,7 +22,7 @@ module.exports = Self => { } }); - Self.refund = async(salesIds, servicesIds, options) => { + Self.refund = async(ctx, salesIds, servicesIds, options) => { const models = Self.app.models; const myOptions = {userId: ctx.req.accessToken.userId}; let tx; From 8dd360bf1eaebb5650fd6aab0e203a4b7697b4b3 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 19 Jun 2023 08:46:15 +0200 Subject: [PATCH 20/33] refs #4764 e2e solve --- e2e/paths/05-ticket/13_services.spec.js | 2 +- modules/ticket/back/methods/sale/refund.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/e2e/paths/05-ticket/13_services.spec.js b/e2e/paths/05-ticket/13_services.spec.js index c7bb1648e..50df23582 100644 --- a/e2e/paths/05-ticket/13_services.spec.js +++ b/e2e/paths/05-ticket/13_services.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -fdescribe('Ticket services path', () => { +describe('Ticket services path', () => { let browser; let page; const invoicedTicketId = '1'; diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index 1b18467b9..ff41091a4 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -10,6 +10,11 @@ module.exports = Self => { { arg: 'servicesIds', type: ['number'] + }, + { + arg: 'withWarehouse', + type: 'boolean', + required: true } ], returns: { @@ -22,7 +27,7 @@ module.exports = Self => { } }); - Self.refund = async(ctx, salesIds, servicesIds, options) => { + Self.refund = async(ctx, salesIds, servicesIds, withWarehouse, options) => { const models = Self.app.models; const myOptions = {userId: ctx.req.accessToken.userId}; let tx; @@ -67,7 +72,7 @@ module.exports = Self => { const [firstTicketId] = ticketsIds; // eslint-disable-next-line max-len - refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, myOptions); + refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, withWarehouse, myOptions); for (const sale of sales) { const createdSale = await models.Sale.create({ @@ -130,7 +135,7 @@ module.exports = Self => { } }; - async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, myOptions) { + async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, withWarehouse, myOptions) { const models = Self.app.models; const filter = {include: {relation: 'address'}}; @@ -142,6 +147,7 @@ module.exports = Self => { addressFk: ticket.address().id, agencyModeFk: refundAgencyMode.id, nickname: ticket.address().nickname, + warehouseFk: withWarehouse ? ticket.warehouseFk : null, companyFk: ticket.companyFk, landed: now, zoneFk: refoundZoneId From 454cf30de7b81a049487ce50417a5935d80a811a Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 29 Jun 2023 08:27:20 +0200 Subject: [PATCH 21/33] refs #4764 boton save --- loopback/locale/en.json | 7 ++++--- modules/ticket/front/services/index.html | 5 +++-- modules/ticket/front/services/index.js | 6 +++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 40df9a712..09069bc5e 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -175,6 +175,7 @@ "Pass expired": "The password has expired, change it from Salix", "Can't transfer claimed sales": "Can't transfer claimed sales", "Invalid quantity": "Invalid quantity", - "Failed to upload delivery note": "Error to upload delivery note {{id}}", - "Mail not sent": "There has been an error sending the invoice to the client [{{clientId}}]({{{clientUrl}}}), please check the email address" -} + "Failed to upload delivery note": "Error to upload delivery note {{id}}", + "Mail not sent": "There has been an error sending the invoice to the client [{{clientId}}]({{{clientUrl}}}), please check the email address", + "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº 3": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº 3" +} \ No newline at end of file diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index eeb1661c0..b443398a0 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -27,7 +27,7 @@ + rule="TicketService" + min="0"> this.$.model.refresh()) - .then(() => this.$.watcher.notifySaved()); + .then(() => this.$.watcher.notifySaved()) + .then(() => { + this.isDataSaved = true; + }); } selectedServices() { From 3b81198a05e0902e085cc644adeb6814c71a75de Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 4 Jul 2023 13:57:52 +0200 Subject: [PATCH 22/33] refs #4764 mod button --- modules/ticket/front/services/index.html | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index b443398a0..932b41fd6 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -23,21 +23,20 @@ data="$ctrl.services"> - + - - - + --> --> - Date: Wed, 5 Jul 2023 07:36:01 +0200 Subject: [PATCH 23/33] refs #4764 service ant --- modules/ticket/front/services/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index 932b41fd6..9c4ec0ce4 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -24,19 +24,19 @@
- - + Date: Thu, 27 Jul 2023 15:15:55 +0200 Subject: [PATCH 24/33] refs #4764 service --- loopback/locale/es.json | 3 +- modules/ticket/front/services/index.html | 17 +++---- modules/ticket/front/services/index.js | 59 ++++++++---------------- 3 files changed, 27 insertions(+), 52 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index ac62d62e1..e26153caa 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -311,5 +311,6 @@ "You don't have enough privileges.": "No tienes suficientes permisos.", "This ticket is locked.": "Este ticket está bloqueado.", "This ticket is not editable.": "Este ticket no es editable.", - "The ticket doesn't exist.": "No existe el ticket." + "The ticket doesn't exist.": "No existe el ticket.", + "There is no zone for these parameters": "There is no zone for these parameters" } \ No newline at end of file diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index 9c4ec0ce4..53c02b304 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -26,16 +26,19 @@ + {{ watcher.dataChanged() }} - + - - + this.$.model.refresh()) - .then(() => this.$.watcher.notifySaved()) - .then(() => { - this.isDataSaved = true; - }); - } - - selectedServices() { - if (!this.services) return; - - return this.services.filter(service => { - return service.checked; - }); - } - - selectedValidServices() { - if (!this.services) return; - - const selectedServices = this.selectedServices(); - return selectedServices.filter(service => { - return service.id != undefined; - }); - } - - hasSelectedServices() { - const selected = this.selectedServices() || []; - return selected.length > 0; + .then(() => this.$.watcher.notifySaved()); } createRefund() { - this.$.model.save() - .then(() => { - const services = this.selectedValidServices(); - if (!services) return; - const servicesIds = services.map(service => service.id); + const services = this.services; + if (!services) return; + const servicesIds = services.map(service => service.id); - const params = {servicesIds: servicesIds}; - const query = 'Sales/refund'; - this.$http.post(query, params).then(res => { - const refundTicket = res.data; - this.vnApp.showSuccess(this.$t('The following refund ticket have been created', { - ticketId: refundTicket.id - })); - this.$state.go('ticket.card.sale', {id: refundTicket.id}); - }); - }); + const params = {servicesIds: servicesIds, withWarehouse: false}; + const query = 'Sales/refund'; + this.$http.post(query, params).then(res => { + const refundTicket = res.data; + this.vnApp.showSuccess(this.$t('The following refund ticket have been created', { + ticketId: refundTicket.id + })); + this.$state.go('ticket.card.sale', {id: refundTicket.id}); + }); + } + + addChecked(id) { + this.checkeds.push(id); } } From 12acda0b1ca5e901bfb69503ade0e13c4b34ab56 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 31 Jul 2023 11:06:19 +0200 Subject: [PATCH 25/33] refs #4764 ticketSerivce refund add --- modules/ticket/back/methods/sale/refund.js | 2 +- modules/ticket/front/services/index.html | 2 +- modules/ticket/front/services/index.js | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index f74dea5e4..3c41aab1e 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -103,7 +103,7 @@ module.exports = Self => { const [firstTicketId] = ticketsIds; // eslint-disable-next-line max-len - refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, myOptions); + refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, withWarehouse, myOptions); } if (servicesIds && servicesIds.length > 0) { diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index 53c02b304..244170d3e 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -32,7 +32,7 @@ vn-acl="invoicing, claimManager, salesAssistant" vn-acl-action="remove"> - {{ watcher.dataChanged() }} + {{ $ctrl.checkeds }} service.id); + if (!this.checkeds.length) return; - const params = {servicesIds: servicesIds, withWarehouse: false}; + const params = {servicesIds: this.checkeds, withWarehouse: false}; const query = 'Sales/refund'; this.$http.post(query, params).then(res => { const refundTicket = res.data; @@ -69,6 +67,8 @@ class Controller extends Section { } addChecked(id) { + if (this.checkeds.includes(id)) + return this.checkeds = this.checkeds.filter(check => check != id); this.checkeds.push(id); } } From 79d88facc30d3b5d68563c591f99bf3df997726d Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 1 Aug 2023 12:33:56 +0200 Subject: [PATCH 26/33] refs #4764 add test front --- modules/ticket/front/services/index.html | 1 - modules/ticket/front/services/index.spec.js | 33 +++++++++++++++------ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index 244170d3e..bc288a8a2 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -32,7 +32,6 @@ vn-acl="invoicing, claimManager, salesAssistant" vn-acl-action="remove"> - {{ $ctrl.checkeds }} { describe('getDefaultTaxClass', () => { it('should set the default tax class in the controller', () => { - $httpBackend.whenRoute('GET', `TaxClasses/findOne`) - .respond({ - id: 4000, - name: 'Whatever', - code: 'GG' - }); + $httpBackend.whenRoute('GET', `TaxClasses/findOne`).respond({ + id: 4000, + name: 'Whatever', + code: 'GG', + }); controller.getDefaultTaxClass(); $httpBackend.flush(); @@ -49,15 +48,15 @@ describe('Ticket component vnTicketService', () => { it('should set the description of the selected service upon service type creation', () => { const service = { id: 1, - quantity: 10 + quantity: 10, }; $scope.newServiceType = { - name: 'Totally new stuff' + name: 'Totally new stuff', }; $httpBackend.when('POST', 'TicketServiceTypes').respond({ id: 4001, - name: 'Totally new stuff' + name: 'Totally new stuff', }); controller.onNewServiceTypeAccept(service); $httpBackend.flush(); @@ -65,4 +64,20 @@ describe('Ticket component vnTicketService', () => { expect(service.ticketServiceTypeFk).toEqual(4001); }); }); + + describe('addChecked', () => { + it('should add an item to the checkeds array', () => { + controller.checkeds = []; + controller.addChecked(1); + + expect(controller.checkeds).toEqual([1]); + }); + + it('should remove an item if it is already in the checkeds array', () => { + controller.checkeds = [1, 2, 3]; + controller.addChecked(2); + + expect(controller.checkeds).toEqual([1, 3]); + }); + }); }); From eb6917c10d19929c9ff4869e32096879b0d291e8 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 4 Sep 2023 13:08:01 +0200 Subject: [PATCH 27/33] refs #6194 change link --- print/templates/email/printer-setup/locale/es.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/print/templates/email/printer-setup/locale/es.yml b/print/templates/email/printer-setup/locale/es.yml index b96d6d5f4..1884493ca 100644 --- a/print/templates/email/printer-setup/locale/es.yml +++ b/print/templates/email/printer-setup/locale/es.yml @@ -8,8 +8,8 @@ description: https://www.youtube.com/watch?v=qhb0kgQF3o8. También necesitarás el GoLabel, el programa para imprimir las cintas. - downloadFrom: Puedes descargarlo desde este enlace https://godex.s3-accelerate.amazonaws.com/_6f5glRrVhQAEBGhdUsqJA.file?v01 + downloadFrom: Puedes descargarlo desde este enlace https://godex.s3-accelerate.amazonaws.com/bF8ttaXcClv24092,4vQCQ.file?v01 downloadDriver: En este enlace puedes descargar el driver de la impresora https://es.seagullscientific.com/support/downloads/drivers/godex/download/ sections: @@ -40,4 +40,4 @@ help: Cualquier duda que te surja, no dudes en consultarla, ¡estamos pa atenderte! salesPersonName: Soy tu comercial y mi nombre es salesPersonPhone: Teléfono y whatsapp -salesPersonEmail: Dirección de e-mail \ No newline at end of file +salesPersonEmail: Dirección de e-mail From 2711ed579cca76ef9d8ebb7d142cbe80c0c9151c Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 4 Sep 2023 13:26:08 +0200 Subject: [PATCH 28/33] refs #6194 generical url --- print/templates/email/printer-setup/locale/es.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/print/templates/email/printer-setup/locale/es.yml b/print/templates/email/printer-setup/locale/es.yml index 1884493ca..b07b88ffc 100644 --- a/print/templates/email/printer-setup/locale/es.yml +++ b/print/templates/email/printer-setup/locale/es.yml @@ -8,8 +8,8 @@ description: https://www.youtube.com/watch?v=qhb0kgQF3o8. También necesitarás el GoLabel, el programa para imprimir las cintas. - downloadFrom: Puedes descargarlo desde este enlace https://godex.s3-accelerate.amazonaws.com/bF8ttaXcClv24092,4vQCQ.file?v01 + downloadFrom: Puedes descargarlo desde este enlace, una vez dentro, abajo a la derecha podrás encontrar la sección de "Downloads", donde pulsando el icono de descarga, se iniciará la descarga automáticamente https://www.godexintl.com/product/16681379086423723?locale=en downloadDriver: En este enlace puedes descargar el driver de la impresora https://es.seagullscientific.com/support/downloads/drivers/godex/download/ sections: From b81dd1a9e81656dbae31e8401a0d5a1c8677e080 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 4 Sep 2023 14:01:36 +0200 Subject: [PATCH 29/33] refs #6194 new url verdnatura --- print/templates/email/printer-setup/locale/es.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/print/templates/email/printer-setup/locale/es.yml b/print/templates/email/printer-setup/locale/es.yml index b07b88ffc..00795b34b 100644 --- a/print/templates/email/printer-setup/locale/es.yml +++ b/print/templates/email/printer-setup/locale/es.yml @@ -8,8 +8,8 @@ description: https://www.youtube.com/watch?v=qhb0kgQF3o8. También necesitarás el GoLabel, el programa para imprimir las cintas. - downloadFrom: Puedes descargarlo desde este enlace, una vez dentro, abajo a la derecha podrás encontrar la sección de "Downloads", donde pulsando el icono de descarga, se iniciará la descarga automáticamente https://www.godexintl.com/product/16681379086423723?locale=en + downloadFrom: Puedes descargarlo desde este enlace https://cdn.verdnatura.es/public/GoLabel_II.zip downloadDriver: En este enlace puedes descargar el driver de la impresora https://es.seagullscientific.com/support/downloads/drivers/godex/download/ sections: From 8141cd7834c0dbb503ea9579d2c0a3b98976573e Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 4 Sep 2023 14:08:17 +0200 Subject: [PATCH 30/33] refs #6194 url verdnatura --- print/templates/email/printer-setup/locale/es.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/print/templates/email/printer-setup/locale/es.yml b/print/templates/email/printer-setup/locale/es.yml index 00795b34b..39e83b1a8 100644 --- a/print/templates/email/printer-setup/locale/es.yml +++ b/print/templates/email/printer-setup/locale/es.yml @@ -8,8 +8,8 @@ description: https://www.youtube.com/watch?v=qhb0kgQF3o8. También necesitarás el GoLabel, el programa para imprimir las cintas. - downloadFrom: Puedes descargarlo desde este enlace https://cdn.verdnatura.es/public/GoLabel_II.zip + downloadFrom: Puedes descargarlo desde este enlace https://cdn.verdnatura.es/public/GoLabel.zip downloadDriver: En este enlace puedes descargar el driver de la impresora https://es.seagullscientific.com/support/downloads/drivers/godex/download/ sections: From da9182783d1a5f0a584a0826cc379e951addac97 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 7 Sep 2023 11:02:47 +0200 Subject: [PATCH 31/33] refs #5881 changes --- db/changes/233601/00-createClaimReader.sql | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/db/changes/233601/00-createClaimReader.sql b/db/changes/233601/00-createClaimReader.sql index 666bf232e..e913c0ed9 100644 --- a/db/changes/233601/00-createClaimReader.sql +++ b/db/changes/233601/00-createClaimReader.sql @@ -1,4 +1,4 @@ -INSERT INTO `account`.`role` (`id`, `name`, `description`, `hasLogin`) +INSERT INTO `account`.`role` (`name`, `description`, `hasLogin`) VALUES ('claimViewer','Trabajadores que consulta las reclamaciones ',1); INSERT INTO `account`.`roleInherit` (`role`,`inheritsFrom`) @@ -10,7 +10,7 @@ INSERT INTO `account`.`roleInherit` (`role`,`inheritsFrom`) 'buyer', 'deliveryBoss', 'handmadeBoss' - ) + ); DELETE FROM `salix`.`ACL` WHERE `model`= 'claim' @@ -28,5 +28,4 @@ INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`princip INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`) VALUES ('Claim','findById','READ','ALLOW','ROLE','claimViewer'); INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalid`) - VALUES ('Claim','getSummary','READ','ALLOW','ROLE','claimViewer'); - + VALUES ('Claim','getSummary','READ','ALLOW','ROLE','claimViewer'); \ No newline at end of file From 2d2d6b77dbae2e93d14cef41ad23bac8cd156d1f Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 7 Sep 2023 13:38:51 +0200 Subject: [PATCH 32/33] refs #4764 changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dbc270b9..acb5d7457 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [2338.01] - 2023-09-21 ### Added - +- (Ticket -> Servicios) Se pueden abonar servicios ### Changed - (Trabajadores -> Calendario) Icono de check arreglado cuando pulsas un tipo de dia From b9dd4428417531492279349178660fbab83e1827 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 11 Sep 2023 10:52:16 +0200 Subject: [PATCH 33/33] refs #4764 edit package-log --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 7c4aacb1a..10b5e6b02 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "salix-back", - "version": "23.24.01", + "version": "23.26.01", "license": "GPL-3.0", "dependencies": { "axios": "^1.2.2",