Commit III
This commit is contained in:
parent
809c908000
commit
47430e6310
6 changed files with 35 additions and 5 deletions
|
|
@ -107,7 +107,7 @@ export function templateRecibido3(data: TemplateRecibidoHorarioData): string {
|
|||
|
||||
export interface TemplateEntregadoData {
|
||||
nombreCliente: string;
|
||||
whatsappCliente: string;
|
||||
telefonoCliente: string;
|
||||
codigoCompleto: string;
|
||||
nombreSucursal: string;
|
||||
montoCobrar: number;
|
||||
|
|
@ -123,9 +123,11 @@ export function templateEntregado(data: TemplateEntregadoData): string {
|
|||
|
||||
return `${e.paquete} PAQUETE ENTREGADO
|
||||
|
||||
${e.saludo} Tu paquete *${data.codigoCompleto}* ha sido recogido por ${data.whatsappCliente} en "${data.nombreSucursal}".
|
||||
${e.saludo} Paquete *${data.codigoCompleto}* del cliente *${data.nombreCliente}* (${data.telefonoCliente}) ha sido entregado en *${data.nombreSucursal}*.
|
||||
|
||||
${e.aviso} !Gracias por confiar en nosotros!`;
|
||||
${e.dinero} Monto: *${data.montoCobrar} Bs.*
|
||||
|
||||
${e.aviso} ¡Gracias por confiar en nosotros!`;
|
||||
}
|
||||
|
||||
// ─── NOTIFICACION_EMPRENDEDOR (lote de paquetes recibidos) ──────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -289,7 +289,35 @@ export class PaqueteService {
|
|||
sessionId: sucursal.sessionId,
|
||||
});
|
||||
|
||||
return { paquete: paqueteGuardado, mensaje };
|
||||
// 11. Notificar al emprendedor si tiene idEmprendimiento
|
||||
let mensajeEmprendedor = null;
|
||||
if (dto.idEmprendimiento) {
|
||||
const emprendimiento = await this.emprendimientoRepo.findOne({
|
||||
where: { idEmprendimiento: dto.idEmprendimiento },
|
||||
});
|
||||
|
||||
if (emprendimiento) {
|
||||
const textoEmprendedor = templateRecibidoEmprendedor({
|
||||
nombreEmprendimiento: emprendimiento.emprendimiento,
|
||||
nombreSucursal: sucursal.nombre,
|
||||
paquetes: [{
|
||||
codigoCompleto: paqueteGuardado.codigoCompleto,
|
||||
nombreCliente: dto.nombreCliente,
|
||||
whatsappCliente: `${dto.codigoPaisCliente}${dto.whatsappCliente}`,
|
||||
}],
|
||||
});
|
||||
|
||||
mensajeEmprendedor = await this.mensajeService.create({
|
||||
idPaquete: paqueteGuardado.idPaquete,
|
||||
telefonoDestino: `${emprendimiento.codigoPais}${emprendimiento.whatsapp}`,
|
||||
tipo: 'NOTIFICACION_EMPRENDEDOR',
|
||||
mensaje1: textoEmprendedor,
|
||||
sessionId: sucursal.sessionId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return { paquete: paqueteGuardado, mensaje, mensajeEmprendedor };
|
||||
}
|
||||
|
||||
async createLote(dto: CrearLoteDto, idUsuarioRecepcion: string) {
|
||||
|
|
@ -512,7 +540,7 @@ export class PaqueteService {
|
|||
if (emprendimiento) {
|
||||
const textoMensaje = templateEntregado({
|
||||
nombreCliente: paquete.nombreCliente,
|
||||
whatsappCliente: emprendimiento.whatsapp,
|
||||
telefonoCliente: `${paquete.codigoPaisCliente}${paquete.whatsappCliente}`,
|
||||
codigoCompleto: paquete.codigoCompleto,
|
||||
nombreSucursal: sucursal.nombre,
|
||||
montoCobrar: Number(paquete.montoCobrarPaquete),
|
||||
|
|
|
|||
BIN
uploads/paquetes/767c8baf-9f7c-4074-94d3-0c9b376a224d.jpg
Normal file
BIN
uploads/paquetes/767c8baf-9f7c-4074-94d3-0c9b376a224d.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 254 KiB |
BIN
uploads/paquetes/cf6a0970-8abc-4206-8d8b-654f1f732e78.jpg
Normal file
BIN
uploads/paquetes/cf6a0970-8abc-4206-8d8b-654f1f732e78.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 230 KiB |
BIN
uploads/qr/6fccd9f3-a37e-4dac-9595-47ba4269aec1.png
Normal file
BIN
uploads/qr/6fccd9f3-a37e-4dac-9595-47ba4269aec1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 470 KiB |
BIN
uploads/qr/bfd4f319-6edc-4450-83a3-0683f075c0a2.png
Normal file
BIN
uploads/qr/bfd4f319-6edc-4450-83a3-0683f075c0a2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 470 KiB |
Loading…
Add table
Reference in a new issue