Commit III

This commit is contained in:
DillusDev001 2026-09-19 14:18:05 -04:00
parent 809c908000
commit 47430e6310
6 changed files with 35 additions and 5 deletions

View file

@ -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) ──────────────────────────────────

View file

@ -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),

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 KiB