@asumano/worklip-typeorm-db 1.1.83 → 1.1.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,5 +19,7 @@ export declare class Sections {
19
19
  associates: {
20
20
  id: number;
21
21
  name: string;
22
+ surname: string;
23
+ document: string;
22
24
  }[];
23
25
  }
@@ -61,6 +61,27 @@ export interface IVisitSection {
61
61
  order: number;
62
62
  items: IVisitItem[];
63
63
  custom_section?: boolean;
64
+ /**
65
+ * DOC: ESTA SECCIÓN NO LLEVA CHEQUEO: sus ítems no cuentan en el avance de la revisión.
66
+ *
67
+ * Existe porque no toda sección es una lista de verificación. «Inventario» y «Cotización»
68
+ * sí: alguien va marcando Bueno / Regular / Malo. Pero «Pintura» y «Latonería» son trabajo
69
+ * FÍSICO — ahí no hay nada que inspeccionar, hay que pintar el carro—, y si traen ítems que
70
+ * nadie marca nunca, esos ítems se quedan en Pendiente para siempre.
71
+ *
72
+ * El daño no es cosmético y no es del taller: el informe PÚBLICO le muestra al CLIENTE «la
73
+ * revisión va en 20%» de un carro que ya se entregó terminado.
74
+ *
75
+ * ⚠️ La sección SIGUE SALIENDO en el informe, con sus fotos y sus ítems. Lo único que
76
+ * cambia es que no cuenta en el porcentaje. Es la diferencia con esconder los ítems uno por
77
+ * uno (`item.visible = false`), que es lo único que se podía hacer antes y que los borra de
78
+ * la vista del cliente: el dueño del carro quiere ver las fotos de su pintura aunque detrás
79
+ * no haya un chequeo.
80
+ *
81
+ * Se copia de la sección del catálogo al crear la visita y se CONGELA ahí, como el resto de
82
+ * la plantilla: cambiar la bandera después no reescribe el porcentaje de una visita cerrada.
83
+ */
84
+ no_checklist?: boolean;
64
85
  }
65
86
  export interface IVisitSignature {
66
87
  image: string;
@@ -91,16 +91,22 @@ data, { servicePrice, taxPercentage, isTaxIncluded }) => {
91
91
  conceptsExempt++;
92
92
  };
93
93
  for (const section of data?.sections ?? []) {
94
+ // DOC: Una sección «sin chequeo» no aporta al AVANCE ni a la salud del vehículo, pero sí
95
+ // a todo lo demás: sus fotos cuentan como evidencia y sus costos entran en la cotización.
96
+ // Pintar un carro se cobra igual que revisarlo.
97
+ const counts = section.no_checklist !== true;
94
98
  for (const item of section.items ?? []) {
95
99
  // DOC: Un ítem oculto no va en el informe del cliente, así que no pide
96
100
  // revisión ni se le cotiza nada.
97
101
  if (item.visible === false)
98
102
  continue;
99
- itemsTotal++;
100
- statusCounts[item.status ?? "PENDING"]++;
101
- if (item.status && item.status in HEALTH_WEIGHT) {
102
- healthSum += HEALTH_WEIGHT[item.status];
103
- healthCount++;
103
+ if (counts) {
104
+ itemsTotal++;
105
+ statusCounts[item.status ?? "PENDING"]++;
106
+ if (item.status && item.status in HEALTH_WEIGHT) {
107
+ healthSum += HEALTH_WEIGHT[item.status];
108
+ healthCount++;
109
+ }
104
110
  }
105
111
  evidenceCount += (item.evidence ?? []).filter((file) => file.visible !== false).length;
106
112
  if (!item.costs)
@@ -253,8 +259,12 @@ const preserveClientApprovals = (storedData, incomingData) => {
253
259
  // configuración.)
254
260
  const hasChanged = (Number(item.costs.total) || 0) !== (Number(stored.total) || 0) ||
255
261
  (item.costs.tax_mode ?? "inherit") !== (stored.tax_mode ?? "inherit");
256
- item.costs.approval = hasChanged ? "PENDING" : (stored.approval ?? "PENDING");
257
- item.costs.responded_at = hasChanged ? null : (stored.responded_at ?? null);
262
+ item.costs.approval = hasChanged
263
+ ? "PENDING"
264
+ : (stored.approval ?? "PENDING");
265
+ item.costs.responded_at = hasChanged
266
+ ? null
267
+ : (stored.responded_at ?? null);
258
268
  }
259
269
  }
260
270
  return incomingData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asumano/worklip-typeorm-db",
3
- "version": "1.1.83",
3
+ "version": "1.1.85",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },