@asumano/worklip-typeorm-db 1.1.61 → 1.1.62
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.
- package/dist/entities/BillingUsageSnapshot.d.ts +2 -2
- package/dist/entities/BillingUsageSnapshot.js +4 -4
- package/dist/entities/EmailLog.d.ts +2 -0
- package/dist/entities/EmailLog.js +11 -1
- package/dist/entities/ServiceOrder.d.ts +4 -0
- package/dist/entities/ServiceOrder.js +10 -0
- package/dist/entities/WhatsappLog.d.ts +2 -0
- package/dist/entities/WhatsappLog.js +11 -1
- package/dist/visit.summary.d.ts +4 -0
- package/dist/visit.summary.js +18 -1
- package/package.json +1 -1
|
@@ -74,18 +74,18 @@ __decorate([
|
|
|
74
74
|
(0, typeorm_1.Column)({
|
|
75
75
|
type: "int",
|
|
76
76
|
default: 0,
|
|
77
|
-
comment: "Cuántos usuarios
|
|
77
|
+
comment: "Cuántos usuarios (associate) NO eliminados tenía la empresa para el mes y año.",
|
|
78
78
|
}),
|
|
79
79
|
__metadata("design:type", Number)
|
|
80
|
-
], BillingUsageSnapshot.prototype, "
|
|
80
|
+
], BillingUsageSnapshot.prototype, "users_count", void 0);
|
|
81
81
|
__decorate([
|
|
82
82
|
(0, typeorm_1.Column)({
|
|
83
83
|
type: "int",
|
|
84
84
|
default: 0,
|
|
85
|
-
comment: "Cuántos talleres/concesionarios
|
|
85
|
+
comment: "Cuántos talleres/concesionarios (workshop) NO eliminados tenía la empresa para el mes y año.",
|
|
86
86
|
}),
|
|
87
87
|
__metadata("design:type", Number)
|
|
88
|
-
], BillingUsageSnapshot.prototype, "
|
|
88
|
+
], BillingUsageSnapshot.prototype, "workshops_count", void 0);
|
|
89
89
|
__decorate([
|
|
90
90
|
(0, typeorm_1.Column)({
|
|
91
91
|
type: "datetime",
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Company } from "./Company";
|
|
2
|
+
import { ServiceOrder } from "./ServiceOrder";
|
|
2
3
|
import { Workshop } from "./Workshop";
|
|
3
4
|
export declare class EmailLog {
|
|
4
5
|
id: number;
|
|
5
6
|
company: Company;
|
|
6
7
|
workshop: Workshop | null;
|
|
8
|
+
service_order: ServiceOrder | null;
|
|
7
9
|
recipient_email: string;
|
|
8
10
|
subject: string;
|
|
9
11
|
email_type: number;
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.EmailLog = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const Company_1 = require("./Company");
|
|
15
|
+
const ServiceOrder_1 = require("./ServiceOrder");
|
|
15
16
|
const Workshop_1 = require("./Workshop");
|
|
16
17
|
let EmailLog = class EmailLog {
|
|
17
18
|
};
|
|
@@ -40,6 +41,15 @@ __decorate([
|
|
|
40
41
|
(0, typeorm_1.JoinColumn)({ name: "workshop" }),
|
|
41
42
|
__metadata("design:type", Object)
|
|
42
43
|
], EmailLog.prototype, "workshop", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrder_1.ServiceOrder, (serviceOrder) => serviceOrder.email_logs, {
|
|
46
|
+
onDelete: "SET NULL",
|
|
47
|
+
onUpdate: "NO ACTION",
|
|
48
|
+
nullable: true,
|
|
49
|
+
}),
|
|
50
|
+
(0, typeorm_1.JoinColumn)({ name: "service_order" }),
|
|
51
|
+
__metadata("design:type", Object)
|
|
52
|
+
], EmailLog.prototype, "service_order", void 0);
|
|
43
53
|
__decorate([
|
|
44
54
|
(0, typeorm_1.Column)({
|
|
45
55
|
length: 255,
|
|
@@ -59,7 +69,7 @@ __decorate([
|
|
|
59
69
|
__decorate([
|
|
60
70
|
(0, typeorm_1.Column)({
|
|
61
71
|
type: "int",
|
|
62
|
-
comment: "Tipo de correo que se le envía al cliente:\r\n1: Visita/Entrada/Servicio.\r\n2: Recordatorio.",
|
|
72
|
+
comment: "Tipo de correo que se le envía al cliente:\r\n1: Visita/Entrada/Servicio.\r\n2: Recordatorio.\r\n3: Cotización.\r\n4: Visita finalizada.\r\n5: Resumen de avance.",
|
|
63
73
|
}),
|
|
64
74
|
__metadata("design:type", Number)
|
|
65
75
|
], EmailLog.prototype, "email_type", void 0);
|
|
@@ -6,6 +6,8 @@ import { ServiceOrderHistory } from "./ServiceOrderHistory";
|
|
|
6
6
|
import { MediaFile } from "./MediaFile";
|
|
7
7
|
import { Reminder } from "./Reminder";
|
|
8
8
|
import { ServiceOrderApproval } from "./ServiceOrderApproval";
|
|
9
|
+
import { WhatsappLog } from "./WhatsappLog";
|
|
10
|
+
import { EmailLog } from "./EmailLog";
|
|
9
11
|
export declare class ServiceOrder {
|
|
10
12
|
id: number;
|
|
11
13
|
code: string;
|
|
@@ -27,4 +29,6 @@ export declare class ServiceOrder {
|
|
|
27
29
|
media_files: MediaFile[];
|
|
28
30
|
reminders: Reminder[];
|
|
29
31
|
service_order_approvals: ServiceOrderApproval[];
|
|
32
|
+
whatsapp_logs: WhatsappLog[];
|
|
33
|
+
email_logs: EmailLog[];
|
|
30
34
|
}
|
|
@@ -19,6 +19,8 @@ const ServiceOrderHistory_1 = require("./ServiceOrderHistory");
|
|
|
19
19
|
const MediaFile_1 = require("./MediaFile");
|
|
20
20
|
const Reminder_1 = require("./Reminder");
|
|
21
21
|
const ServiceOrderApproval_1 = require("./ServiceOrderApproval");
|
|
22
|
+
const WhatsappLog_1 = require("./WhatsappLog");
|
|
23
|
+
const EmailLog_1 = require("./EmailLog");
|
|
22
24
|
// DOC: El consecutivo es único por taller y año. Es la garantía de que dos visitas
|
|
23
25
|
// del mismo taller nunca compartan número, incluso si se crean a la vez.
|
|
24
26
|
let ServiceOrder = class ServiceOrder {
|
|
@@ -179,6 +181,14 @@ __decorate([
|
|
|
179
181
|
(0, typeorm_1.OneToMany)(() => ServiceOrderApproval_1.ServiceOrderApproval, (serviceOrderApproval) => serviceOrderApproval.service_order),
|
|
180
182
|
__metadata("design:type", Array)
|
|
181
183
|
], ServiceOrder.prototype, "service_order_approvals", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
(0, typeorm_1.OneToMany)(() => WhatsappLog_1.WhatsappLog, (whatsappLog) => whatsappLog.service_order),
|
|
186
|
+
__metadata("design:type", Array)
|
|
187
|
+
], ServiceOrder.prototype, "whatsapp_logs", void 0);
|
|
188
|
+
__decorate([
|
|
189
|
+
(0, typeorm_1.OneToMany)(() => EmailLog_1.EmailLog, (emailLog) => emailLog.service_order),
|
|
190
|
+
__metadata("design:type", Array)
|
|
191
|
+
], ServiceOrder.prototype, "email_logs", void 0);
|
|
182
192
|
exports.ServiceOrder = ServiceOrder = __decorate([
|
|
183
193
|
(0, typeorm_1.Index)("UQ_service_order_visit_sequence", ["workshop", "visit_year", "visit_sequence"], { unique: true })
|
|
184
194
|
// DOC: Para buscar/ordenar por el número dentro de un taller sin escanear la tabla.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Company } from "./Company";
|
|
2
|
+
import { ServiceOrder } from "./ServiceOrder";
|
|
2
3
|
import { Workshop } from "./Workshop";
|
|
3
4
|
export declare class WhatsappLog {
|
|
4
5
|
id: number;
|
|
5
6
|
company: Company;
|
|
6
7
|
workshop: Workshop | null;
|
|
8
|
+
service_order: ServiceOrder | null;
|
|
7
9
|
phone: string;
|
|
8
10
|
template_name: string;
|
|
9
11
|
message_type: number;
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.WhatsappLog = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const Company_1 = require("./Company");
|
|
15
|
+
const ServiceOrder_1 = require("./ServiceOrder");
|
|
15
16
|
const Workshop_1 = require("./Workshop");
|
|
16
17
|
let WhatsappLog = class WhatsappLog {
|
|
17
18
|
};
|
|
@@ -40,6 +41,15 @@ __decorate([
|
|
|
40
41
|
(0, typeorm_1.JoinColumn)({ name: "workshop" }),
|
|
41
42
|
__metadata("design:type", Object)
|
|
42
43
|
], WhatsappLog.prototype, "workshop", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrder_1.ServiceOrder, (serviceOrder) => serviceOrder.whatsapp_logs, {
|
|
46
|
+
onDelete: "SET NULL",
|
|
47
|
+
onUpdate: "NO ACTION",
|
|
48
|
+
nullable: true,
|
|
49
|
+
}),
|
|
50
|
+
(0, typeorm_1.JoinColumn)({ name: "service_order" }),
|
|
51
|
+
__metadata("design:type", Object)
|
|
52
|
+
], WhatsappLog.prototype, "service_order", void 0);
|
|
43
53
|
__decorate([
|
|
44
54
|
(0, typeorm_1.Column)({
|
|
45
55
|
length: 20,
|
|
@@ -59,7 +69,7 @@ __decorate([
|
|
|
59
69
|
__decorate([
|
|
60
70
|
(0, typeorm_1.Column)({
|
|
61
71
|
type: "int",
|
|
62
|
-
comment: "Tipo de mensaje que se le envía al cliente:\r\n1: Visita/Entrada/Servicio.\r\n2: Recordatorio.",
|
|
72
|
+
comment: "Tipo de mensaje que se le envía al cliente:\r\n1: Visita/Entrada/Servicio.\r\n2: Recordatorio.\r\n3: Cotización.\r\n4: Visita finalizada.\r\n5: Resumen de avance.",
|
|
63
73
|
}),
|
|
64
74
|
__metadata("design:type", Number)
|
|
65
75
|
], WhatsappLog.prototype, "message_type", void 0);
|
package/dist/visit.summary.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export interface IVisitSection {
|
|
|
38
38
|
name: string;
|
|
39
39
|
order: number;
|
|
40
40
|
items: IVisitItem[];
|
|
41
|
+
custom_section?: boolean;
|
|
41
42
|
}
|
|
42
43
|
export interface IVisitData {
|
|
43
44
|
sections: IVisitSection[];
|
|
@@ -79,6 +80,9 @@ export interface IPropsBuildVisitSummary {
|
|
|
79
80
|
taxPercentage: number;
|
|
80
81
|
isTaxIncluded: boolean;
|
|
81
82
|
}
|
|
83
|
+
export declare const isItemAnsweredByClient: (costs: {
|
|
84
|
+
approval?: TCostApproval | null;
|
|
85
|
+
} | null | undefined) => boolean;
|
|
82
86
|
export declare const buildVisitSummary: (data: IVisitData | null | undefined, { servicePrice, taxPercentage, isTaxIncluded }: IPropsBuildVisitSummary) => IVisitSummary;
|
|
83
87
|
export declare const getTaxConfig: (companyDetails: any) => {
|
|
84
88
|
taxPercentage: number;
|
package/dist/visit.summary.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
//
|
|
11
11
|
// Es una función pura sobre el JSON: no toca la base de datos ni depende de TypeORM.
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.preserveClientApprovals = exports.getVisitTaxConfig = exports.getTaxConfig = exports.buildVisitSummary = void 0;
|
|
13
|
+
exports.preserveClientApprovals = exports.getVisitTaxConfig = exports.getTaxConfig = exports.buildVisitSummary = exports.isItemAnsweredByClient = void 0;
|
|
14
14
|
// DOC: Peso de cada estado para la "salud del vehículo". NOT_APPLICABLE y los
|
|
15
15
|
// ítems sin marcar quedan fuera del promedio.
|
|
16
16
|
const HEALTH_WEIGHT = {
|
|
@@ -23,6 +23,23 @@ const round2 = (value) => Math.round(value * 100) / 100;
|
|
|
23
23
|
// sin tarifa no hay con qué calcular, así que ni "taxed" puede inventarse un impuesto.
|
|
24
24
|
// Ausente = "inherit" = lo que haga la empresa.
|
|
25
25
|
const isConceptTaxed = (mode, rate) => rate > 0 && (mode ?? "inherit") !== "exempt";
|
|
26
|
+
// DOC: ¿El cliente ya respondió la cotización de este ítem? Aprobado y rechazado cuentan;
|
|
27
|
+
// pendiente, o sin costo, no. Un costo sin `approval` es anterior al campo y se lee como
|
|
28
|
+
// pendiente.
|
|
29
|
+
//
|
|
30
|
+
// Es la condición que impide OCULTAR (y más adelante eliminar) el ítem: buildVisitSummary
|
|
31
|
+
// descarta los invisibles ANTES de sumar, así que ocultarlo movería un total que el cliente
|
|
32
|
+
// ya respondió y encima desaparecería del informe que él vio.
|
|
33
|
+
//
|
|
34
|
+
// Vive acá y no en cada lado por la misma razón que preserveClientApprovals: la pantalla
|
|
35
|
+
// decide qué habilitar con esta función y el API revalida con ESTA misma, así que no pueden
|
|
36
|
+
// desviarse.
|
|
37
|
+
const isItemAnsweredByClient = (costs) => {
|
|
38
|
+
if (!costs)
|
|
39
|
+
return false;
|
|
40
|
+
return (costs.approval ?? "PENDING") !== "PENDING";
|
|
41
|
+
};
|
|
42
|
+
exports.isItemAnsweredByClient = isItemAnsweredByClient;
|
|
26
43
|
const buildVisitSummary = (data, { servicePrice, taxPercentage, isTaxIncluded }) => {
|
|
27
44
|
const statusCounts = {
|
|
28
45
|
GOOD: 0,
|