@asumano/worklip-typeorm-db 1.1.113 → 1.1.114
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/Associate.d.ts +1 -0
- package/dist/entities/Associate.js +8 -0
- package/dist/entities/AssociatePushSubscription.d.ts +12 -0
- package/dist/entities/AssociatePushSubscription.js +61 -0
- package/dist/entities/ServiceOrderIncident.d.ts +23 -0
- package/dist/entities/ServiceOrderIncident.js +147 -0
- package/dist/entities/ServiceOrderIncidentAssociate.d.ts +7 -0
- package/dist/entities/ServiceOrderIncidentAssociate.js +47 -0
- package/dist/entities/ServiceOrderMessage.d.ts +13 -0
- package/dist/entities/ServiceOrderMessage.js +64 -0
- package/dist/entities/ServiceOrderMessageRead.d.ts +8 -0
- package/dist/entities/ServiceOrderMessageRead.js +41 -0
- package/dist/entities/ServiceOrderPart.d.ts +5 -0
- package/dist/entities/ServiceOrderPart.js +29 -1
- package/dist/entities/ServiceOrderStageReopen.d.ts +14 -0
- package/dist/entities/ServiceOrderStageReopen.js +69 -0
- package/dist/entities/Vehicle.d.ts +2 -0
- package/dist/entities/Vehicle.js +6 -0
- package/dist/entities/WorkboardEvent.js +1 -1
- package/dist/entities.index.d.ts +6 -0
- package/dist/entities.index.js +14 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/rules/associate.profile.rules.d.ts +7 -0
- package/dist/rules/associate.profile.rules.js +8 -1
- package/dist/rules/dashboard.rules.d.ts +2 -0
- package/dist/rules/dashboard.rules.js +5 -0
- package/dist/rules/incident.rules.d.ts +30 -0
- package/dist/rules/incident.rules.js +25 -0
- package/dist/rules/parts.rules.d.ts +12 -0
- package/dist/rules/parts.rules.js +11 -1
- package/dist/rules/visit.summary.d.ts +12 -0
- package/dist/rules/visit.summary.js +12 -1
- package/dist/rules/workboard.rules.d.ts +1 -0
- package/dist/rules/workboard.rules.js +2 -0
- package/package.json +1 -1
|
@@ -159,6 +159,14 @@ __decorate([
|
|
|
159
159
|
}),
|
|
160
160
|
__metadata("design:type", Object)
|
|
161
161
|
], Associate.prototype, "blood_type", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, typeorm_1.Column)({
|
|
164
|
+
type: "int",
|
|
165
|
+
default: 1,
|
|
166
|
+
comment: "Tipo de vinculación:\r\n1: Empleado (directo).\r\n2: Contratista (independiente).",
|
|
167
|
+
}),
|
|
168
|
+
__metadata("design:type", Number)
|
|
169
|
+
], Associate.prototype, "employment_type", void 0);
|
|
162
170
|
__decorate([
|
|
163
171
|
(0, typeorm_1.ManyToOne)(() => JobTitle_1.JobTitle, {
|
|
164
172
|
nullable: true,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Associate } from "./Associate";
|
|
2
|
+
export declare class AssociatePushSubscription {
|
|
3
|
+
id: number;
|
|
4
|
+
associate: Associate;
|
|
5
|
+
endpoint: string;
|
|
6
|
+
endpoint_hash: string;
|
|
7
|
+
p256dh: string;
|
|
8
|
+
auth: string;
|
|
9
|
+
user_agent: string | null;
|
|
10
|
+
created: Date;
|
|
11
|
+
last_success: Date | null;
|
|
12
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AssociatePushSubscription = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Associate_1 = require("./Associate");
|
|
15
|
+
// DOC: Un dispositivo (navegador / PWA instalada) del empleado que aceptó los avisos Web Push (sql/107).
|
|
16
|
+
// Un empleado puede tener varios. Si el navegador la invalida (404/410) se borra.
|
|
17
|
+
let AssociatePushSubscription = class AssociatePushSubscription {
|
|
18
|
+
};
|
|
19
|
+
exports.AssociatePushSubscription = AssociatePushSubscription;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", comment: "Número de identificación (ID) único de cada registro." }),
|
|
22
|
+
__metadata("design:type", Number)
|
|
23
|
+
], AssociatePushSubscription.prototype, "id", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
26
|
+
(0, typeorm_1.JoinColumn)({ name: "associate" }),
|
|
27
|
+
__metadata("design:type", Associate_1.Associate)
|
|
28
|
+
], AssociatePushSubscription.prototype, "associate", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 1000, comment: "URL del servicio de push del navegador." }),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], AssociatePushSubscription.prototype, "endpoint", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.Column)({ type: "char", length: 64, comment: "SHA-256 del endpoint (para que sea único sin indexar la URL)." }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], AssociatePushSubscription.prototype, "endpoint_hash", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 255, comment: "Llave pública del navegador (p256dh)." }),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], AssociatePushSubscription.prototype, "p256dh", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 255, comment: "Secreto de autenticación del navegador." }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], AssociatePushSubscription.prototype, "auth", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 255, nullable: true, default: null, comment: "Navegador / dispositivo." }),
|
|
47
|
+
__metadata("design:type", Object)
|
|
48
|
+
], AssociatePushSubscription.prototype, "user_agent", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.Column)({ type: "datetime", default: () => "CURRENT_TIMESTAMP", comment: "Fecha de creación del registro." }),
|
|
51
|
+
__metadata("design:type", Date)
|
|
52
|
+
], AssociatePushSubscription.prototype, "created", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Último envío que el servicio aceptó." }),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], AssociatePushSubscription.prototype, "last_success", void 0);
|
|
57
|
+
exports.AssociatePushSubscription = AssociatePushSubscription = __decorate([
|
|
58
|
+
(0, typeorm_1.Index)("UQ_associate_push_endpoint", ["endpoint_hash"], { unique: true }),
|
|
59
|
+
(0, typeorm_1.Index)("IDX_associate_push_associate", ["associate"]),
|
|
60
|
+
(0, typeorm_1.Entity)("associate_push_subscription", { comment: "Suscripciones Web Push de los empleados (PWA)." })
|
|
61
|
+
], AssociatePushSubscription);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Associate } from "./Associate";
|
|
2
|
+
import { ServiceOrder } from "./ServiceOrder";
|
|
3
|
+
import { ServiceOrderIncidentAssociate } from "./ServiceOrderIncidentAssociate";
|
|
4
|
+
import type { IIncidentQuoteItem, IIncidentSection } from "../rules/incident.rules";
|
|
5
|
+
export declare class ServiceOrderIncident {
|
|
6
|
+
id: number;
|
|
7
|
+
service_order: ServiceOrder;
|
|
8
|
+
name: string;
|
|
9
|
+
caused_by: Associate;
|
|
10
|
+
observations: string | null;
|
|
11
|
+
rework_sections: IIncidentSection[] | null;
|
|
12
|
+
quote: IIncidentQuoteItem[] | null;
|
|
13
|
+
quote_total: string;
|
|
14
|
+
state: number;
|
|
15
|
+
resolved_at: Date | null;
|
|
16
|
+
resolved_by: Associate | null;
|
|
17
|
+
associates: ServiceOrderIncidentAssociate[];
|
|
18
|
+
created: Date;
|
|
19
|
+
created_by: Associate;
|
|
20
|
+
updated: Date | null;
|
|
21
|
+
updated_by: Associate | null;
|
|
22
|
+
status: number;
|
|
23
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ServiceOrderIncident = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Associate_1 = require("./Associate");
|
|
15
|
+
const ServiceOrder_1 = require("./ServiceOrder");
|
|
16
|
+
const ServiceOrderIncidentAssociate_1 = require("./ServiceOrderIncidentAssociate");
|
|
17
|
+
// DOC: Un imprevisto de la visita (sql/100): qué pasó, quién lo causó, qué secciones rehacer, quiénes
|
|
18
|
+
// lo resuelven y cuánto le cuesta AL TALLER. Es interno: el cliente no lo ve.
|
|
19
|
+
let ServiceOrderIncident = class ServiceOrderIncident {
|
|
20
|
+
};
|
|
21
|
+
exports.ServiceOrderIncident = ServiceOrderIncident;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
24
|
+
type: "int",
|
|
25
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
26
|
+
}),
|
|
27
|
+
__metadata("design:type", Number)
|
|
28
|
+
], ServiceOrderIncident.prototype, "id", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrder_1.ServiceOrder, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
31
|
+
(0, typeorm_1.JoinColumn)({ name: "service_order" }),
|
|
32
|
+
__metadata("design:type", ServiceOrder_1.ServiceOrder)
|
|
33
|
+
], ServiceOrderIncident.prototype, "service_order", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 150, comment: "Nombre corto del imprevisto." }),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], ServiceOrderIncident.prototype, "name", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION" }),
|
|
40
|
+
(0, typeorm_1.JoinColumn)({ name: "caused_by" }),
|
|
41
|
+
__metadata("design:type", Associate_1.Associate)
|
|
42
|
+
], ServiceOrderIncident.prototype, "caused_by", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({
|
|
45
|
+
type: "varchar",
|
|
46
|
+
length: 2000,
|
|
47
|
+
nullable: true,
|
|
48
|
+
default: null,
|
|
49
|
+
comment: "Observaciones (escritas o dictadas).",
|
|
50
|
+
}),
|
|
51
|
+
__metadata("design:type", Object)
|
|
52
|
+
], ServiceOrderIncident.prototype, "observations", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({
|
|
55
|
+
type: "json",
|
|
56
|
+
nullable: true,
|
|
57
|
+
default: null,
|
|
58
|
+
comment: "Secciones de la visita a rehacer: [{ id, name }]. Solo registro; no reabre nada.",
|
|
59
|
+
}),
|
|
60
|
+
__metadata("design:type", Object)
|
|
61
|
+
], ServiceOrderIncident.prototype, "rework_sections", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, typeorm_1.Column)({
|
|
64
|
+
type: "json",
|
|
65
|
+
nullable: true,
|
|
66
|
+
default: null,
|
|
67
|
+
comment: "Costo interno del taller: [{ description, amount }]. El cliente nunca lo ve.",
|
|
68
|
+
}),
|
|
69
|
+
__metadata("design:type", Object)
|
|
70
|
+
], ServiceOrderIncident.prototype, "quote", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, typeorm_1.Column)({
|
|
73
|
+
type: "decimal",
|
|
74
|
+
precision: 14,
|
|
75
|
+
scale: 2,
|
|
76
|
+
default: 0,
|
|
77
|
+
comment: "Suma de quote (para reportes sin leer el JSON).",
|
|
78
|
+
}),
|
|
79
|
+
__metadata("design:type", String)
|
|
80
|
+
], ServiceOrderIncident.prototype, "quote_total", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, typeorm_1.Column)({
|
|
83
|
+
type: "int",
|
|
84
|
+
width: 1,
|
|
85
|
+
default: 1,
|
|
86
|
+
comment: "Estado del imprevisto:\r\n1: Abierto.\r\n2: Resuelto.",
|
|
87
|
+
}),
|
|
88
|
+
__metadata("design:type", Number)
|
|
89
|
+
], ServiceOrderIncident.prototype, "state", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Cuándo se marcó como resuelto." }),
|
|
92
|
+
__metadata("design:type", Object)
|
|
93
|
+
], ServiceOrderIncident.prototype, "resolved_at", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION", nullable: true }),
|
|
96
|
+
(0, typeorm_1.JoinColumn)({ name: "resolved_by" }),
|
|
97
|
+
__metadata("design:type", Object)
|
|
98
|
+
], ServiceOrderIncident.prototype, "resolved_by", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, typeorm_1.OneToMany)(() => ServiceOrderIncidentAssociate_1.ServiceOrderIncidentAssociate, (row) => row.incident),
|
|
101
|
+
__metadata("design:type", Array)
|
|
102
|
+
], ServiceOrderIncident.prototype, "associates", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, typeorm_1.Column)({
|
|
105
|
+
type: "datetime",
|
|
106
|
+
comment: "Fecha de creación del registro.",
|
|
107
|
+
default: () => "CURRENT_TIMESTAMP",
|
|
108
|
+
}),
|
|
109
|
+
__metadata("design:type", Date)
|
|
110
|
+
], ServiceOrderIncident.prototype, "created", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION" }),
|
|
113
|
+
(0, typeorm_1.JoinColumn)({ name: "created_by" }),
|
|
114
|
+
__metadata("design:type", Associate_1.Associate)
|
|
115
|
+
], ServiceOrderIncident.prototype, "created_by", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, typeorm_1.Column)({
|
|
118
|
+
type: "datetime",
|
|
119
|
+
nullable: true,
|
|
120
|
+
default: null,
|
|
121
|
+
comment: "Fecha de actualización del registro.",
|
|
122
|
+
onUpdate: "CURRENT_TIMESTAMP",
|
|
123
|
+
}),
|
|
124
|
+
__metadata("design:type", Object)
|
|
125
|
+
], ServiceOrderIncident.prototype, "updated", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION", nullable: true }),
|
|
128
|
+
(0, typeorm_1.JoinColumn)({ name: "updated_by" }),
|
|
129
|
+
__metadata("design:type", Object)
|
|
130
|
+
], ServiceOrderIncident.prototype, "updated_by", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
(0, typeorm_1.Column)({
|
|
133
|
+
default: 1,
|
|
134
|
+
type: "int",
|
|
135
|
+
width: 1,
|
|
136
|
+
comment: "Estado del registro:\r\n1. Activo.\r\n0. Eliminado (cargado por error).",
|
|
137
|
+
}),
|
|
138
|
+
__metadata("design:type", Number)
|
|
139
|
+
], ServiceOrderIncident.prototype, "status", void 0);
|
|
140
|
+
exports.ServiceOrderIncident = ServiceOrderIncident = __decorate([
|
|
141
|
+
(0, typeorm_1.Index)("IDX_service_order_incident_order", ["service_order", "status"]),
|
|
142
|
+
(0, typeorm_1.Index)("IDX_service_order_incident_caused_by", ["caused_by"]),
|
|
143
|
+
(0, typeorm_1.Index)("IDX_service_order_incident_created", ["status", "created"]),
|
|
144
|
+
(0, typeorm_1.Entity)("service_order_incident", {
|
|
145
|
+
comment: "Imprevistos de una visita: causante, reprocesos y costo interno del taller.",
|
|
146
|
+
})
|
|
147
|
+
], ServiceOrderIncident);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ServiceOrderIncidentAssociate = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Associate_1 = require("./Associate");
|
|
15
|
+
const ServiceOrderIncident_1 = require("./ServiceOrderIncident");
|
|
16
|
+
// DOC: Empleados que hacen el reproceso de un imprevisto (sql/100). Tabla y no JSON: así se puede
|
|
17
|
+
// buscar «imprevistos en los que trabajé».
|
|
18
|
+
let ServiceOrderIncidentAssociate = class ServiceOrderIncidentAssociate {
|
|
19
|
+
};
|
|
20
|
+
exports.ServiceOrderIncidentAssociate = ServiceOrderIncidentAssociate;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
23
|
+
type: "int",
|
|
24
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
25
|
+
}),
|
|
26
|
+
__metadata("design:type", Number)
|
|
27
|
+
], ServiceOrderIncidentAssociate.prototype, "id", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrderIncident_1.ServiceOrderIncident, (incident) => incident.associates, {
|
|
30
|
+
onDelete: "CASCADE",
|
|
31
|
+
onUpdate: "NO ACTION",
|
|
32
|
+
}),
|
|
33
|
+
(0, typeorm_1.JoinColumn)({ name: "incident" }),
|
|
34
|
+
__metadata("design:type", ServiceOrderIncident_1.ServiceOrderIncident)
|
|
35
|
+
], ServiceOrderIncidentAssociate.prototype, "incident", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
38
|
+
(0, typeorm_1.JoinColumn)({ name: "associate" }),
|
|
39
|
+
__metadata("design:type", Associate_1.Associate)
|
|
40
|
+
], ServiceOrderIncidentAssociate.prototype, "associate", void 0);
|
|
41
|
+
exports.ServiceOrderIncidentAssociate = ServiceOrderIncidentAssociate = __decorate([
|
|
42
|
+
(0, typeorm_1.Index)("UQ_service_order_incident_associate", ["incident", "associate"], { unique: true }),
|
|
43
|
+
(0, typeorm_1.Index)("IDX_service_order_incident_associate_associate", ["associate"]),
|
|
44
|
+
(0, typeorm_1.Entity)("service_order_incident_associate", {
|
|
45
|
+
comment: "Empleados asignados al reproceso de un imprevisto.",
|
|
46
|
+
})
|
|
47
|
+
], ServiceOrderIncidentAssociate);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Associate } from "./Associate";
|
|
2
|
+
import { ServiceOrder } from "./ServiceOrder";
|
|
3
|
+
export declare class ServiceOrderMessage {
|
|
4
|
+
id: number;
|
|
5
|
+
service_order: ServiceOrder;
|
|
6
|
+
associate: Associate;
|
|
7
|
+
body: string;
|
|
8
|
+
mentions: number[] | null;
|
|
9
|
+
source: number;
|
|
10
|
+
created: Date;
|
|
11
|
+
edited: Date | null;
|
|
12
|
+
status: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ServiceOrderMessage = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Associate_1 = require("./Associate");
|
|
15
|
+
const ServiceOrder_1 = require("./ServiceOrder");
|
|
16
|
+
// DOC: Un mensaje del CHAT INTERNO de la visita (sql/107): como un grupo de WhatsApp por visita, solo
|
|
17
|
+
// del taller. `mentions` son los empleados mencionados (@): a ellos les llega el aviso.
|
|
18
|
+
let ServiceOrderMessage = class ServiceOrderMessage {
|
|
19
|
+
};
|
|
20
|
+
exports.ServiceOrderMessage = ServiceOrderMessage;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", comment: "Número de identificación (ID) único de cada registro." }),
|
|
23
|
+
__metadata("design:type", Number)
|
|
24
|
+
], ServiceOrderMessage.prototype, "id", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrder_1.ServiceOrder, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
27
|
+
(0, typeorm_1.JoinColumn)({ name: "service_order" }),
|
|
28
|
+
__metadata("design:type", ServiceOrder_1.ServiceOrder)
|
|
29
|
+
], ServiceOrderMessage.prototype, "service_order", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION" }),
|
|
32
|
+
(0, typeorm_1.JoinColumn)({ name: "associate" }),
|
|
33
|
+
__metadata("design:type", Associate_1.Associate)
|
|
34
|
+
], ServiceOrderMessage.prototype, "associate", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 2000, comment: "Texto del mensaje (escrito o dictado)." }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], ServiceOrderMessage.prototype, "body", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.Column)({ type: "json", nullable: true, default: null, comment: "Ids de los empleados mencionados (@)." }),
|
|
41
|
+
__metadata("design:type", Object)
|
|
42
|
+
], ServiceOrderMessage.prototype, "mentions", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({ type: "int", width: 1, default: 1, comment: "Cómo se escribió:\r\n1: Escrito.\r\n2: Dictado (audio transcrito)." }),
|
|
45
|
+
__metadata("design:type", Number)
|
|
46
|
+
], ServiceOrderMessage.prototype, "source", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.Column)({ type: "datetime", default: () => "CURRENT_TIMESTAMP", comment: "Fecha de creación del registro." }),
|
|
49
|
+
__metadata("design:type", Date)
|
|
50
|
+
], ServiceOrderMessage.prototype, "created", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Cuándo se editó por última vez." }),
|
|
53
|
+
__metadata("design:type", Object)
|
|
54
|
+
], ServiceOrderMessage.prototype, "edited", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typeorm_1.Column)({ type: "int", width: 1, default: 1, comment: "Estado del registro:\r\n1. Activo.\r\n0. Eliminado por su autor." }),
|
|
57
|
+
__metadata("design:type", Number)
|
|
58
|
+
], ServiceOrderMessage.prototype, "status", void 0);
|
|
59
|
+
exports.ServiceOrderMessage = ServiceOrderMessage = __decorate([
|
|
60
|
+
(0, typeorm_1.Index)("IDX_service_order_message_order", ["service_order", "id"]),
|
|
61
|
+
(0, typeorm_1.Entity)("service_order_message", {
|
|
62
|
+
comment: "Chat interno del taller por visita (comentarios con menciones). El cliente no lo ve.",
|
|
63
|
+
})
|
|
64
|
+
], ServiceOrderMessage);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ServiceOrderMessageRead = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Associate_1 = require("./Associate");
|
|
15
|
+
const ServiceOrder_1 = require("./ServiceOrder");
|
|
16
|
+
// DOC: Hasta qué mensaje leyó cada empleado el chat de una visita (sql/107): da el contador de no leídos.
|
|
17
|
+
let ServiceOrderMessageRead = class ServiceOrderMessageRead {
|
|
18
|
+
};
|
|
19
|
+
exports.ServiceOrderMessageRead = ServiceOrderMessageRead;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", comment: "Número de identificación (ID) único de cada registro." }),
|
|
22
|
+
__metadata("design:type", Number)
|
|
23
|
+
], ServiceOrderMessageRead.prototype, "id", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrder_1.ServiceOrder, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
26
|
+
(0, typeorm_1.JoinColumn)({ name: "service_order" }),
|
|
27
|
+
__metadata("design:type", ServiceOrder_1.ServiceOrder)
|
|
28
|
+
], ServiceOrderMessageRead.prototype, "service_order", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
31
|
+
(0, typeorm_1.JoinColumn)({ name: "associate" }),
|
|
32
|
+
__metadata("design:type", Associate_1.Associate)
|
|
33
|
+
], ServiceOrderMessageRead.prototype, "associate", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)({ type: "int", default: 0, comment: "Id del último mensaje leído." }),
|
|
36
|
+
__metadata("design:type", Number)
|
|
37
|
+
], ServiceOrderMessageRead.prototype, "last_read", void 0);
|
|
38
|
+
exports.ServiceOrderMessageRead = ServiceOrderMessageRead = __decorate([
|
|
39
|
+
(0, typeorm_1.Unique)("UQ_service_order_message_read", ["service_order", "associate"]),
|
|
40
|
+
(0, typeorm_1.Entity)("service_order_message_read", { comment: "Último mensaje leído del chat de la visita, por empleado." })
|
|
41
|
+
], ServiceOrderMessageRead);
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { ServiceOrder } from "./ServiceOrder";
|
|
2
2
|
import { Associate } from "./Associate";
|
|
3
|
+
import { ServiceOrderIncident } from "./ServiceOrderIncident";
|
|
4
|
+
import type { IPartDeliveryFile } from "../rules/parts.rules";
|
|
3
5
|
export declare class ServiceOrderPart {
|
|
4
6
|
id: number;
|
|
5
7
|
service_order: ServiceOrder;
|
|
6
8
|
item_id: string | null;
|
|
9
|
+
visibility: number;
|
|
10
|
+
incident: ServiceOrderIncident | null;
|
|
7
11
|
name: string;
|
|
8
12
|
reference: string | null;
|
|
9
13
|
quantity: string;
|
|
@@ -12,6 +16,7 @@ export declare class ServiceOrderPart {
|
|
|
12
16
|
ordered_at: Date | null;
|
|
13
17
|
received_at: Date | null;
|
|
14
18
|
received_by: Associate | null;
|
|
19
|
+
delivery_files: IPartDeliveryFile[] | null;
|
|
15
20
|
note: string | null;
|
|
16
21
|
notified_at: Date | null;
|
|
17
22
|
created: Date;
|
|
@@ -13,6 +13,7 @@ exports.ServiceOrderPart = void 0;
|
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const ServiceOrder_1 = require("./ServiceOrder");
|
|
15
15
|
const Associate_1 = require("./Associate");
|
|
16
|
+
const ServiceOrderIncident_1 = require("./ServiceOrderIncident");
|
|
16
17
|
// DOC: Un repuesto de la visita y en qué va (por aprobar, pedido, recibido, no se usa). Tabla y no
|
|
17
18
|
// JSON de la visita: el tablero y el televisor cuentan «3/5» de muchas visitas a la vez.
|
|
18
19
|
let ServiceOrderPart = class ServiceOrderPart {
|
|
@@ -43,11 +44,29 @@ __decorate([
|
|
|
43
44
|
}),
|
|
44
45
|
__metadata("design:type", Object)
|
|
45
46
|
], ServiceOrderPart.prototype, "item_id", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.Column)({
|
|
49
|
+
type: "int",
|
|
50
|
+
width: 1,
|
|
51
|
+
default: 1,
|
|
52
|
+
comment: "Quién lo ve:\r\n1: Visible al cliente.\r\n2: Interno del taller (imprevisto).",
|
|
53
|
+
}),
|
|
54
|
+
__metadata("design:type", Number)
|
|
55
|
+
], ServiceOrderPart.prototype, "visibility", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrderIncident_1.ServiceOrderIncident, {
|
|
58
|
+
onDelete: "SET NULL",
|
|
59
|
+
onUpdate: "NO ACTION",
|
|
60
|
+
nullable: true,
|
|
61
|
+
}),
|
|
62
|
+
(0, typeorm_1.JoinColumn)({ name: "incident" }),
|
|
63
|
+
__metadata("design:type", Object)
|
|
64
|
+
], ServiceOrderPart.prototype, "incident", void 0);
|
|
46
65
|
__decorate([
|
|
47
66
|
(0, typeorm_1.Column)({
|
|
48
67
|
type: "varchar",
|
|
49
68
|
length: 150,
|
|
50
|
-
comment: "Nombre del repuesto. Lo ve el cliente.",
|
|
69
|
+
comment: "Nombre del repuesto. Lo ve el cliente si es visible.",
|
|
51
70
|
}),
|
|
52
71
|
__metadata("design:type", String)
|
|
53
72
|
], ServiceOrderPart.prototype, "name", void 0);
|
|
@@ -116,6 +135,15 @@ __decorate([
|
|
|
116
135
|
(0, typeorm_1.JoinColumn)({ name: "received_by" }),
|
|
117
136
|
__metadata("design:type", Object)
|
|
118
137
|
], ServiceOrderPart.prototype, "received_by", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, typeorm_1.Column)({
|
|
140
|
+
type: "json",
|
|
141
|
+
nullable: true,
|
|
142
|
+
default: null,
|
|
143
|
+
comment: "Fotos y videos de la entrega: [{ key, type, preview_key, created, created_by }]. Interno.",
|
|
144
|
+
}),
|
|
145
|
+
__metadata("design:type", Object)
|
|
146
|
+
], ServiceOrderPart.prototype, "delivery_files", void 0);
|
|
119
147
|
__decorate([
|
|
120
148
|
(0, typeorm_1.Column)({
|
|
121
149
|
type: "varchar",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Associate } from "./Associate";
|
|
2
|
+
import { ServiceOrder } from "./ServiceOrder";
|
|
3
|
+
import { ServiceOrderStage } from "./ServiceOrderStage";
|
|
4
|
+
export declare class ServiceOrderStageReopen {
|
|
5
|
+
id: number;
|
|
6
|
+
service_order: ServiceOrder;
|
|
7
|
+
stage: ServiceOrderStage;
|
|
8
|
+
reason: string;
|
|
9
|
+
previous_finished: Date | null;
|
|
10
|
+
reopened_at: Date;
|
|
11
|
+
reopened_by: Associate;
|
|
12
|
+
closed_at: Date | null;
|
|
13
|
+
closed_by: Associate | null;
|
|
14
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ServiceOrderStageReopen = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Associate_1 = require("./Associate");
|
|
15
|
+
const ServiceOrder_1 = require("./ServiceOrder");
|
|
16
|
+
const ServiceOrderStage_1 = require("./ServiceOrderStage");
|
|
17
|
+
// DOC: Cada vez que se REABRE una sección ya terminada (sql/105): cuándo, quién, por qué y cuándo se
|
|
18
|
+
// volvió a terminar. `closed_at` NULL = sigue reabierta. Con esto se mide cuánto duró abierta.
|
|
19
|
+
let ServiceOrderStageReopen = class ServiceOrderStageReopen {
|
|
20
|
+
};
|
|
21
|
+
exports.ServiceOrderStageReopen = ServiceOrderStageReopen;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", comment: "Número de identificación (ID) único de cada registro." }),
|
|
24
|
+
__metadata("design:type", Number)
|
|
25
|
+
], ServiceOrderStageReopen.prototype, "id", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrder_1.ServiceOrder, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
28
|
+
(0, typeorm_1.JoinColumn)({ name: "service_order" }),
|
|
29
|
+
__metadata("design:type", ServiceOrder_1.ServiceOrder)
|
|
30
|
+
], ServiceOrderStageReopen.prototype, "service_order", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrderStage_1.ServiceOrderStage, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
33
|
+
(0, typeorm_1.JoinColumn)({ name: "stage" }),
|
|
34
|
+
__metadata("design:type", ServiceOrderStage_1.ServiceOrderStage)
|
|
35
|
+
], ServiceOrderStageReopen.prototype, "stage", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 255, comment: "Por qué se reabrió (obligatorio)." }),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], ServiceOrderStageReopen.prototype, "reason", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Cuándo se había terminado antes de reabrirla." }),
|
|
42
|
+
__metadata("design:type", Object)
|
|
43
|
+
], ServiceOrderStageReopen.prototype, "previous_finished", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.Column)({ type: "datetime", default: () => "CURRENT_TIMESTAMP", comment: "Cuándo se reabrió." }),
|
|
46
|
+
__metadata("design:type", Date)
|
|
47
|
+
], ServiceOrderStageReopen.prototype, "reopened_at", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION" }),
|
|
50
|
+
(0, typeorm_1.JoinColumn)({ name: "reopened_by" }),
|
|
51
|
+
__metadata("design:type", Associate_1.Associate)
|
|
52
|
+
], ServiceOrderStageReopen.prototype, "reopened_by", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Cuándo se volvió a terminar. NULL: sigue reabierta." }),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], ServiceOrderStageReopen.prototype, "closed_at", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION", nullable: true }),
|
|
59
|
+
(0, typeorm_1.JoinColumn)({ name: "closed_by" }),
|
|
60
|
+
__metadata("design:type", Object)
|
|
61
|
+
], ServiceOrderStageReopen.prototype, "closed_by", void 0);
|
|
62
|
+
exports.ServiceOrderStageReopen = ServiceOrderStageReopen = __decorate([
|
|
63
|
+
(0, typeorm_1.Index)("IDX_service_order_stage_reopen_stage", ["stage", "closed_at"]),
|
|
64
|
+
(0, typeorm_1.Index)("IDX_service_order_stage_reopen_order", ["service_order"]),
|
|
65
|
+
(0, typeorm_1.Index)("IDX_service_order_stage_reopen_day", ["reopened_at"]),
|
|
66
|
+
(0, typeorm_1.Entity)("service_order_stage_reopen", {
|
|
67
|
+
comment: "Reaperturas de secciones (etapas) terminadas y cuánto duraron abiertas.",
|
|
68
|
+
})
|
|
69
|
+
], ServiceOrderStageReopen);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Insurer } from "./Insurer";
|
|
1
2
|
import { Brand } from "./Brand";
|
|
2
3
|
import { Company } from "./Company";
|
|
3
4
|
import { ServiceOrder } from "./ServiceOrder";
|
|
@@ -13,6 +14,7 @@ export declare class Vehicle {
|
|
|
13
14
|
serial: string | null;
|
|
14
15
|
vin: string | null;
|
|
15
16
|
brand: Brand;
|
|
17
|
+
insurer: Insurer | null;
|
|
16
18
|
company: Company | null;
|
|
17
19
|
created_by: Associate | null;
|
|
18
20
|
mileage: number | null;
|
package/dist/entities/Vehicle.js
CHANGED
|
@@ -10,6 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Vehicle = void 0;
|
|
13
|
+
const Insurer_1 = require("./Insurer");
|
|
13
14
|
const typeorm_1 = require("typeorm");
|
|
14
15
|
const Brand_1 = require("./Brand");
|
|
15
16
|
const Company_1 = require("./Company");
|
|
@@ -78,6 +79,11 @@ __decorate([
|
|
|
78
79
|
(0, typeorm_1.JoinColumn)({ name: "brand" }),
|
|
79
80
|
__metadata("design:type", Brand_1.Brand)
|
|
80
81
|
], Vehicle.prototype, "brand", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, typeorm_1.ManyToOne)(() => Insurer_1.Insurer, { nullable: true, onDelete: "SET NULL", onUpdate: "NO ACTION" }),
|
|
84
|
+
(0, typeorm_1.JoinColumn)({ name: "insurer" }),
|
|
85
|
+
__metadata("design:type", Object)
|
|
86
|
+
], Vehicle.prototype, "insurer", void 0);
|
|
81
87
|
__decorate([
|
|
82
88
|
(0, typeorm_1.ManyToOne)(() => Company_1.Company, (company) => company.vehicles, {
|
|
83
89
|
onDelete: "SET NULL",
|
|
@@ -65,7 +65,7 @@ __decorate([
|
|
|
65
65
|
(0, typeorm_1.Column)({
|
|
66
66
|
type: "int",
|
|
67
67
|
width: 1,
|
|
68
|
-
comment: "Qué pasó:\r\n1: Cambió el estado de la visita.\r\n2: Se tomó la etapa.\r\n3: Se terminó la etapa.\r\n4: Se bloqueó.\r\n5: Se desbloqueó.\r\n6: Cambió el responsable.\r\n7: Se retrocedió o se saltó una etapa.\r\n8: Se abrió una etapa en paralelo.",
|
|
68
|
+
comment: "Qué pasó:\r\n1: Cambió el estado de la visita.\r\n2: Se tomó la etapa.\r\n3: Se terminó la etapa.\r\n4: Se bloqueó.\r\n5: Se desbloqueó.\r\n6: Cambió el responsable.\r\n7: Se retrocedió o se saltó una etapa.\r\n8: Se abrió una etapa en paralelo.\r\n9: Se reabrió una sección terminada.",
|
|
69
69
|
}),
|
|
70
70
|
__metadata("design:type", Number)
|
|
71
71
|
], WorkboardEvent.prototype, "event_type", void 0);
|
package/dist/entities.index.d.ts
CHANGED
|
@@ -84,6 +84,12 @@ export { ReminderTypeCompanyType } from "./entities/ReminderTypeCompanyType";
|
|
|
84
84
|
export { VisitResult } from "./entities/VisitResult";
|
|
85
85
|
export { ServiceOrderObservation } from "./entities/ServiceOrderObservation";
|
|
86
86
|
export { ServiceOrderPart } from "./entities/ServiceOrderPart";
|
|
87
|
+
export { ServiceOrderIncident } from "./entities/ServiceOrderIncident";
|
|
88
|
+
export { ServiceOrderIncidentAssociate } from "./entities/ServiceOrderIncidentAssociate";
|
|
89
|
+
export { ServiceOrderStageReopen } from "./entities/ServiceOrderStageReopen";
|
|
90
|
+
export { ServiceOrderMessage } from "./entities/ServiceOrderMessage";
|
|
91
|
+
export { ServiceOrderMessageRead } from "./entities/ServiceOrderMessageRead";
|
|
92
|
+
export { AssociatePushSubscription } from "./entities/AssociatePushSubscription";
|
|
87
93
|
export { ServiceOrderOuting } from "./entities/ServiceOrderOuting";
|
|
88
94
|
export { WorkshopOutingRecipient } from "./entities/WorkshopOutingRecipient";
|
|
89
95
|
export { OfferedService } from "./entities/OfferedService";
|
package/dist/entities.index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AssociateSection = exports.AssociatePermission = exports.AssociateRole = exports.AssociatePlatform = exports.ClientSubscription = exports.ClientPlanLimit = exports.ClientPlan = exports.ClientDocumentDispute = exports.ReviewTaskEvent = exports.ReviewTask = exports.MasterNotification = exports.ClientSession = exports.ClientNotification = exports.ClientIdentity = exports.PypRuleVote = exports.PypRule = exports.VehicleVerification = exports.ClientVehicleInvite = exports.ClientVehicle = exports.CompanyVehicle = exports.CompanyClient = exports.Appointment = exports.DocumentType = exports.ReminderType = exports.Reminder = exports.ServiceOrderHistory = exports.ServiceOrder = exports.TemplateSection = exports.SectionItem = exports.Section = exports.Template = exports.Workshop = exports.GlobalTemplateSection = exports.GlobalSectionItem = exports.GlobalSection = exports.GlobalTemplate = exports.AssociateNotification = exports.AssociateSession = exports.MasterSession = exports.Associate = exports.Client = exports.Master = exports.VehicleReport = exports.Vehicle = exports.Brand = exports.Company = exports.City = exports.Region = exports.WhatsappLine = exports.Country = void 0;
|
|
4
|
-
exports.
|
|
5
|
-
exports.PayrollMonthDays = exports.AssociatePayRate = exports.AssociateFace = exports.JobTitle = exports.WorkshopUnknownDevice = exports.WorkshopReportInbox = exports.ObdCode = exports.VehicleMeasurement = exports.WorkshopEquipment = exports.EquipmentType = exports.CompanyAiUsage = exports.CompanyQuotaAdjustment = exports.VisitSearchHistory = exports.VisitAiAnalysis = exports.VisitSearchPerson = exports.VisitItemSearch = exports.GlobalSectionItems = exports.GlobalSections = exports.GlobalTemplates = exports.SubscriptionAddonTemplates = exports.SubscriptionPlans = exports.Masters = exports.Companies = exports.WorkshopsByAssociate = exports.Workshops = exports.SectionItems = exports.Sections = exports.Templates = exports.Reminders = exports.Vehicles = exports.Clients = exports.ServicesOrderLite = exports.ServicesOrder = exports.Associates = exports.AssociateSectionFeature = exports.AttendanceMark = exports.WorkshopReader = exports.AssociateTag = exports.WorkshopTag = exports.MetricEvent = exports.StageMetric = void 0;
|
|
4
|
+
exports.DiscountCode = exports.WorkshopDisplay = exports.WorkshopInsurer = exports.WorkshopOfferedService = exports.Insurer = exports.OfferedService = exports.WorkshopOutingRecipient = exports.ServiceOrderOuting = exports.AssociatePushSubscription = exports.ServiceOrderMessageRead = exports.ServiceOrderMessage = exports.ServiceOrderStageReopen = exports.ServiceOrderIncidentAssociate = exports.ServiceOrderIncident = exports.ServiceOrderPart = exports.ServiceOrderObservation = exports.VisitResult = exports.ReminderTypeCompanyType = exports.PlanCompanyType = exports.WorkshopCompanyType = exports.CompanyCompanyType = exports.CompanyType = exports.PlanFeature = exports.CompanyFeature = exports.Feature = exports.UsageAlert = exports.SubscriptionAddonTemplate = exports.PaymentTransaction = exports.BillingInvoice = exports.EmailSuppression = exports.EmailLog = exports.WhatsappLog = exports.ServiceOrderApproval = exports.MediaFile = exports.BillingUsageSnapshot = exports.PaymentMethod = exports.SubscriptionAddon = exports.CompanySubscription = exports.SubscriptionPlan = exports.CountryHoliday = exports.CompanyVehicleType = exports.BrandVehicleType = exports.CompanyBrand = exports.VehicleType = exports.MasterSection = exports.MasterPermission = exports.MasterRole = exports.MasterPlatform = exports.MasterPasswordReset = exports.AssociatePasswordReset = void 0;
|
|
5
|
+
exports.PayrollMonthDays = exports.AssociatePayRate = exports.AssociateFace = exports.JobTitle = exports.WorkshopUnknownDevice = exports.WorkshopReportInbox = exports.ObdCode = exports.VehicleMeasurement = exports.WorkshopEquipment = exports.EquipmentType = exports.CompanyAiUsage = exports.CompanyQuotaAdjustment = exports.VisitSearchHistory = exports.VisitAiAnalysis = exports.VisitSearchPerson = exports.VisitItemSearch = exports.GlobalSectionItems = exports.GlobalSections = exports.GlobalTemplates = exports.SubscriptionAddonTemplates = exports.SubscriptionPlans = exports.Masters = exports.Companies = exports.WorkshopsByAssociate = exports.Workshops = exports.SectionItems = exports.Sections = exports.Templates = exports.Reminders = exports.Vehicles = exports.Clients = exports.ServicesOrderLite = exports.ServicesOrder = exports.Associates = exports.AssociateSectionFeature = exports.AttendanceMark = exports.WorkshopReader = exports.AssociateTag = exports.WorkshopTag = exports.MetricEvent = exports.StageMetric = exports.AssociateDailyStats = exports.WorkshopDailyStats = exports.WorkboardEvent = exports.ServiceOrderStage = exports.WorkboardStatus = exports.CompanyDiscount = void 0;
|
|
6
6
|
var Country_1 = require("./entities/Country");
|
|
7
7
|
Object.defineProperty(exports, "Country", { enumerable: true, get: function () { return Country_1.Country; } });
|
|
8
8
|
var WhatsappLine_1 = require("./entities/WhatsappLine");
|
|
@@ -188,6 +188,18 @@ var ServiceOrderObservation_1 = require("./entities/ServiceOrderObservation");
|
|
|
188
188
|
Object.defineProperty(exports, "ServiceOrderObservation", { enumerable: true, get: function () { return ServiceOrderObservation_1.ServiceOrderObservation; } });
|
|
189
189
|
var ServiceOrderPart_1 = require("./entities/ServiceOrderPart");
|
|
190
190
|
Object.defineProperty(exports, "ServiceOrderPart", { enumerable: true, get: function () { return ServiceOrderPart_1.ServiceOrderPart; } });
|
|
191
|
+
var ServiceOrderIncident_1 = require("./entities/ServiceOrderIncident");
|
|
192
|
+
Object.defineProperty(exports, "ServiceOrderIncident", { enumerable: true, get: function () { return ServiceOrderIncident_1.ServiceOrderIncident; } });
|
|
193
|
+
var ServiceOrderIncidentAssociate_1 = require("./entities/ServiceOrderIncidentAssociate");
|
|
194
|
+
Object.defineProperty(exports, "ServiceOrderIncidentAssociate", { enumerable: true, get: function () { return ServiceOrderIncidentAssociate_1.ServiceOrderIncidentAssociate; } });
|
|
195
|
+
var ServiceOrderStageReopen_1 = require("./entities/ServiceOrderStageReopen");
|
|
196
|
+
Object.defineProperty(exports, "ServiceOrderStageReopen", { enumerable: true, get: function () { return ServiceOrderStageReopen_1.ServiceOrderStageReopen; } });
|
|
197
|
+
var ServiceOrderMessage_1 = require("./entities/ServiceOrderMessage");
|
|
198
|
+
Object.defineProperty(exports, "ServiceOrderMessage", { enumerable: true, get: function () { return ServiceOrderMessage_1.ServiceOrderMessage; } });
|
|
199
|
+
var ServiceOrderMessageRead_1 = require("./entities/ServiceOrderMessageRead");
|
|
200
|
+
Object.defineProperty(exports, "ServiceOrderMessageRead", { enumerable: true, get: function () { return ServiceOrderMessageRead_1.ServiceOrderMessageRead; } });
|
|
201
|
+
var AssociatePushSubscription_1 = require("./entities/AssociatePushSubscription");
|
|
202
|
+
Object.defineProperty(exports, "AssociatePushSubscription", { enumerable: true, get: function () { return AssociatePushSubscription_1.AssociatePushSubscription; } });
|
|
191
203
|
var ServiceOrderOuting_1 = require("./entities/ServiceOrderOuting");
|
|
192
204
|
Object.defineProperty(exports, "ServiceOrderOuting", { enumerable: true, get: function () { return ServiceOrderOuting_1.ServiceOrderOuting; } });
|
|
193
205
|
var WorkshopOutingRecipient_1 = require("./entities/WorkshopOutingRecipient");
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export * from "./rules/dashboard.rules";
|
|
|
21
21
|
export * from "./rules/company.type.rules";
|
|
22
22
|
export * from "./rules/inspection.rules";
|
|
23
23
|
export * from "./rules/parts.rules";
|
|
24
|
+
export * from "./rules/incident.rules";
|
|
24
25
|
export * from "./rules/offered.service.rules";
|
|
25
26
|
export * from "./rules/visit.history.rules";
|
|
26
27
|
export * from "./rules/equipment.rules";
|
package/dist/index.js
CHANGED
|
@@ -118,6 +118,8 @@ __exportStar(require("./rules/company.type.rules"), exports);
|
|
|
118
118
|
__exportStar(require("./rules/inspection.rules"), exports);
|
|
119
119
|
// DOC: Repuestos de la visita: estados y el «3 de 5 recibidos» que cuentan el API y los fronts.
|
|
120
120
|
__exportStar(require("./rules/parts.rules"), exports);
|
|
121
|
+
// DOC: Imprevistos de la visita (sql/100): estados, topes y el total del costo interno.
|
|
122
|
+
__exportStar(require("./rules/incident.rules"), exports);
|
|
121
123
|
// DOC: Servicios que ofrece la sede y aseguradoras con convenio (catálogos del panel, por país).
|
|
122
124
|
__exportStar(require("./rules/offered.service.rules"), exports);
|
|
123
125
|
// DOC: Historial inteligente (sql/69): índice de ítems, equivalencias, garantía y clasificación.
|
|
@@ -13,6 +13,13 @@ export type TBloodType = (typeof BLOOD_TYPE)[keyof typeof BLOOD_TYPE];
|
|
|
13
13
|
export declare const BLOOD_TYPE_LABEL: Record<TBloodType, string>;
|
|
14
14
|
export declare const isBloodType: (value: unknown) => value is TBloodType;
|
|
15
15
|
export declare const bloodTypeLabel: (value: unknown) => string | null;
|
|
16
|
+
/** DOC: `associate.employment_type` (sql/103): cómo está vinculado. Por defecto, empleado directo. */
|
|
17
|
+
export declare const EMPLOYMENT_TYPE: {
|
|
18
|
+
readonly DIRECT: 1;
|
|
19
|
+
readonly CONTRACTOR: 2;
|
|
20
|
+
};
|
|
21
|
+
export type TEmploymentType = (typeof EMPLOYMENT_TYPE)[keyof typeof EMPLOYMENT_TYPE];
|
|
22
|
+
export declare const isEmploymentType: (value: unknown) => value is TEmploymentType;
|
|
16
23
|
export declare const JOB_TITLE_STATUS: {
|
|
17
24
|
readonly INACTIVE: 0;
|
|
18
25
|
readonly ACTIVE: 1;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// DOC: Foto, tipo de sangre y cargo del empleado (sql/85). Módulo PURO: el API valida y los fronts pintan.
|
|
3
3
|
// import { BLOOD_TYPE } from "@asumano/worklip-typeorm-db/dist/rules/associate.profile.rules";
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.associateInitials = exports.isAssociatePhotoKey = exports.associatePhotoPrefix = exports.ASSOCIATE_PHOTO_MAX_BYTES = exports.ASSOCIATE_PHOTO_SIZE = exports.normalizeJobTitleName = exports.SUGGESTED_JOB_TITLES = exports.JOB_TITLE_NAME_MAX = exports.JOB_TITLE_STATUS = exports.bloodTypeLabel = exports.isBloodType = exports.BLOOD_TYPE_LABEL = exports.BLOOD_TYPE = void 0;
|
|
5
|
+
exports.associateInitials = exports.isAssociatePhotoKey = exports.associatePhotoPrefix = exports.ASSOCIATE_PHOTO_MAX_BYTES = exports.ASSOCIATE_PHOTO_SIZE = exports.normalizeJobTitleName = exports.SUGGESTED_JOB_TITLES = exports.JOB_TITLE_NAME_MAX = exports.JOB_TITLE_STATUS = exports.isEmploymentType = exports.EMPLOYMENT_TYPE = exports.bloodTypeLabel = exports.isBloodType = exports.BLOOD_TYPE_LABEL = exports.BLOOD_TYPE = void 0;
|
|
6
6
|
/** DOC: `associate.blood_type`. Dato sensible: solo lo ven el empleado y quien administra usuarios. */
|
|
7
7
|
exports.BLOOD_TYPE = {
|
|
8
8
|
O_POS: 1,
|
|
@@ -28,6 +28,13 @@ const isBloodType = (value) => Number.isInteger(value) && Number(value) >= 1 &&
|
|
|
28
28
|
exports.isBloodType = isBloodType;
|
|
29
29
|
const bloodTypeLabel = (value) => (0, exports.isBloodType)(value) ? exports.BLOOD_TYPE_LABEL[value] : null;
|
|
30
30
|
exports.bloodTypeLabel = bloodTypeLabel;
|
|
31
|
+
/** DOC: `associate.employment_type` (sql/103): cómo está vinculado. Por defecto, empleado directo. */
|
|
32
|
+
exports.EMPLOYMENT_TYPE = {
|
|
33
|
+
DIRECT: 1,
|
|
34
|
+
CONTRACTOR: 2,
|
|
35
|
+
};
|
|
36
|
+
const isEmploymentType = (value) => Number(value) === exports.EMPLOYMENT_TYPE.DIRECT || Number(value) === exports.EMPLOYMENT_TYPE.CONTRACTOR;
|
|
37
|
+
exports.isEmploymentType = isEmploymentType;
|
|
31
38
|
exports.JOB_TITLE_STATUS = { INACTIVE: 0, ACTIVE: 1 };
|
|
32
39
|
exports.JOB_TITLE_NAME_MAX = 60;
|
|
33
40
|
/** DOC: Lo que ofrece «Agregar sugeridos» en una empresa que todavía no tiene cargos. */
|
|
@@ -16,6 +16,7 @@ export declare const REPORT_PERMISSION: {
|
|
|
16
16
|
readonly CHATBOT: "VIEW_REPORT_CHATBOT";
|
|
17
17
|
readonly WORKBOARD: "VIEW_REPORT_WORKBOARD";
|
|
18
18
|
readonly NFC: "VIEW_REPORT_NFC";
|
|
19
|
+
readonly INCIDENTS: "VIEW_REPORT_INCIDENTS";
|
|
19
20
|
readonly ALL_WORKSHOPS: "VIEW_REPORT_ALL_WORKSHOPS";
|
|
20
21
|
};
|
|
21
22
|
export type TReportPermission = (typeof REPORT_PERMISSION)[keyof typeof REPORT_PERMISSION];
|
|
@@ -25,6 +26,7 @@ export declare const REPORT_KEY: {
|
|
|
25
26
|
readonly PROMISED: "promised";
|
|
26
27
|
readonly SATISFACTION: "satisfaction";
|
|
27
28
|
readonly OUTING: "outing";
|
|
29
|
+
readonly INCIDENTS: "incidents";
|
|
28
30
|
readonly REMINDERS: "reminders";
|
|
29
31
|
readonly CLIENTS: "clients";
|
|
30
32
|
readonly MONEY: "money";
|
|
@@ -23,6 +23,8 @@ exports.REPORT_PERMISSION = {
|
|
|
23
23
|
CHATBOT: "VIEW_REPORT_CHATBOT",
|
|
24
24
|
WORKBOARD: "VIEW_REPORT_WORKBOARD",
|
|
25
25
|
NFC: "VIEW_REPORT_NFC",
|
|
26
|
+
// DOC: Imprevistos y reprocesos (sql/102): lleva costos internos, por eso va aparte.
|
|
27
|
+
INCIDENTS: "VIEW_REPORT_INCIDENTS",
|
|
26
28
|
// DOC: Ver la empresa entera y comparar talleres. Aparte porque cruza sedes.
|
|
27
29
|
ALL_WORKSHOPS: "VIEW_REPORT_ALL_WORKSHOPS",
|
|
28
30
|
};
|
|
@@ -33,6 +35,8 @@ exports.REPORT_KEY = {
|
|
|
33
35
|
SATISFACTION: "satisfaction",
|
|
34
36
|
// DOC: Salida temporal y demora de repuestos (sql/84). Para todos los planes.
|
|
35
37
|
OUTING: "outing",
|
|
38
|
+
// DOC: Imprevistos de las visitas (sql/100): cuántos, quién los causó, secciones y costo interno.
|
|
39
|
+
INCIDENTS: "incidents",
|
|
36
40
|
REMINDERS: "reminders",
|
|
37
41
|
CLIENTS: "clients",
|
|
38
42
|
MONEY: "money",
|
|
@@ -50,6 +54,7 @@ exports.REPORT_CATALOG = {
|
|
|
50
54
|
promised: { permission: exports.REPORT_PERMISSION.VISITS, feature: null },
|
|
51
55
|
satisfaction: { permission: exports.REPORT_PERMISSION.VISITS, feature: null },
|
|
52
56
|
outing: { permission: exports.REPORT_PERMISSION.VISITS, feature: null },
|
|
57
|
+
incidents: { permission: exports.REPORT_PERMISSION.INCIDENTS, feature: null },
|
|
53
58
|
reminders: { permission: exports.REPORT_PERMISSION.VISITS, feature: null },
|
|
54
59
|
clients: { permission: exports.REPORT_PERMISSION.VISITS, feature: null },
|
|
55
60
|
money: { permission: exports.REPORT_PERMISSION.MONEY, feature: null },
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const INCIDENT_STATE: {
|
|
2
|
+
readonly OPEN: 1;
|
|
3
|
+
readonly RESOLVED: 2;
|
|
4
|
+
};
|
|
5
|
+
export type TIncidentState = (typeof INCIDENT_STATE)[keyof typeof INCIDENT_STATE];
|
|
6
|
+
export declare const isValidIncidentState: (value: unknown) => value is TIncidentState;
|
|
7
|
+
export declare const INCIDENT_LIMITS: {
|
|
8
|
+
readonly NAME: 150;
|
|
9
|
+
readonly OBSERVATIONS: 2000;
|
|
10
|
+
readonly QUOTE_DESCRIPTION: 150;
|
|
11
|
+
readonly MAX_QUOTE_ITEMS: 30;
|
|
12
|
+
readonly MAX_AMOUNT: 999999999;
|
|
13
|
+
readonly MAX_SECTIONS: 50;
|
|
14
|
+
readonly MAX_ASSOCIATES: 30;
|
|
15
|
+
readonly MAX_PARTS: 30;
|
|
16
|
+
readonly MAX_PER_VISIT: 100;
|
|
17
|
+
};
|
|
18
|
+
/** Un renglón del costo interno del imprevisto. */
|
|
19
|
+
export interface IIncidentQuoteItem {
|
|
20
|
+
description: string;
|
|
21
|
+
amount: number;
|
|
22
|
+
}
|
|
23
|
+
/** Sección de la visita que hay que rehacer, con el nombre COPIADO del día del imprevisto. */
|
|
24
|
+
export interface IIncidentSection {
|
|
25
|
+
id: number;
|
|
26
|
+
name: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const incidentQuoteTotal: (items: readonly {
|
|
29
|
+
amount: number;
|
|
30
|
+
}[] | null | undefined) => number;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// DOC: Imprevistos de la visita (`service_order_incident`, sql/100). Todo es INTERNO del taller:
|
|
3
|
+
// ni el imprevisto, ni su costo, ni sus repuestos llegan al cliente.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.incidentQuoteTotal = exports.INCIDENT_LIMITS = exports.isValidIncidentState = exports.INCIDENT_STATE = void 0;
|
|
6
|
+
exports.INCIDENT_STATE = {
|
|
7
|
+
OPEN: 1,
|
|
8
|
+
RESOLVED: 2,
|
|
9
|
+
};
|
|
10
|
+
const isValidIncidentState = (value) => Number(value) === exports.INCIDENT_STATE.OPEN || Number(value) === exports.INCIDENT_STATE.RESOLVED;
|
|
11
|
+
exports.isValidIncidentState = isValidIncidentState;
|
|
12
|
+
exports.INCIDENT_LIMITS = {
|
|
13
|
+
NAME: 150,
|
|
14
|
+
OBSERVATIONS: 2000,
|
|
15
|
+
QUOTE_DESCRIPTION: 150,
|
|
16
|
+
MAX_QUOTE_ITEMS: 30,
|
|
17
|
+
MAX_AMOUNT: 999999999,
|
|
18
|
+
MAX_SECTIONS: 50,
|
|
19
|
+
MAX_ASSOCIATES: 30,
|
|
20
|
+
// DOC: Repuestos por imprevisto; el tope de la visita (PART_LIMITS.MAX_PER_VISIT) sigue valiendo.
|
|
21
|
+
MAX_PARTS: 30,
|
|
22
|
+
MAX_PER_VISIT: 100,
|
|
23
|
+
};
|
|
24
|
+
const incidentQuoteTotal = (items) => Math.round((items ?? []).reduce((sum, item) => sum + (Number(item.amount) || 0), 0) * 100) / 100;
|
|
25
|
+
exports.incidentQuoteTotal = incidentQuoteTotal;
|
|
@@ -11,13 +11,25 @@ export declare const PART_STATE: {
|
|
|
11
11
|
export type TPartState = (typeof PART_STATE)[keyof typeof PART_STATE];
|
|
12
12
|
export declare const PART_STATES: readonly TPartState[];
|
|
13
13
|
export declare const isValidPartState: (value: unknown) => value is TPartState;
|
|
14
|
+
export declare const PART_VISIBILITY: {
|
|
15
|
+
readonly CLIENT: 1;
|
|
16
|
+
readonly INTERNAL: 2;
|
|
17
|
+
};
|
|
14
18
|
export declare const PART_LIMITS: {
|
|
15
19
|
readonly NAME: 150;
|
|
16
20
|
readonly REFERENCE: 100;
|
|
17
21
|
readonly NOTE: 500;
|
|
18
22
|
readonly MAX_QUANTITY: 9999;
|
|
19
23
|
readonly MAX_PER_VISIT: 200;
|
|
24
|
+
readonly MAX_DELIVERY_FILES: 10;
|
|
20
25
|
};
|
|
26
|
+
export interface IPartDeliveryFile {
|
|
27
|
+
key: string;
|
|
28
|
+
type: "image" | "video";
|
|
29
|
+
preview_key: string | null;
|
|
30
|
+
created: string;
|
|
31
|
+
created_by: number;
|
|
32
|
+
}
|
|
21
33
|
export interface IPartsProgress {
|
|
22
34
|
received: number;
|
|
23
35
|
/** Los que cuentan: todos menos «No se usa». */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.quotePartCandidates = exports.allPartsReceived = exports.partsProgress = exports.PART_LIMITS = exports.isValidPartState = exports.PART_STATES = exports.PART_STATE = void 0;
|
|
3
|
+
exports.quotePartCandidates = exports.allPartsReceived = exports.partsProgress = exports.PART_LIMITS = exports.PART_VISIBILITY = exports.isValidPartState = exports.PART_STATES = exports.PART_STATE = void 0;
|
|
4
4
|
exports.PART_STATE = {
|
|
5
5
|
/** Esperando que la aseguradora (o el cliente) lo apruebe. */
|
|
6
6
|
PENDING_APPROVAL: 1,
|
|
@@ -13,6 +13,12 @@ exports.PART_STATE = {
|
|
|
13
13
|
exports.PART_STATES = [1, 2, 3, 4];
|
|
14
14
|
const isValidPartState = (value) => exports.PART_STATES.includes(Number(value));
|
|
15
15
|
exports.isValidPartState = isValidPartState;
|
|
16
|
+
// DOC: Quién ve el repuesto (sql/100). Los del botón «Repuestos» los ve el cliente; los de un
|
|
17
|
+
// imprevisto son del taller y no salen en el informe, la app, el PDF ni los avisos.
|
|
18
|
+
exports.PART_VISIBILITY = {
|
|
19
|
+
CLIENT: 1,
|
|
20
|
+
INTERNAL: 2,
|
|
21
|
+
};
|
|
16
22
|
exports.PART_LIMITS = {
|
|
17
23
|
NAME: 150,
|
|
18
24
|
REFERENCE: 100,
|
|
@@ -20,6 +26,8 @@ exports.PART_LIMITS = {
|
|
|
20
26
|
MAX_QUANTITY: 9999,
|
|
21
27
|
// DOC: Tope por visita: una lista de 200 repuestos es un error de carga, no una visita.
|
|
22
28
|
MAX_PER_VISIT: 200,
|
|
29
|
+
// DOC: Fotos y videos de la entrega por repuesto (sql/101).
|
|
30
|
+
MAX_DELIVERY_FILES: 10,
|
|
23
31
|
};
|
|
24
32
|
// DOC: «No se usa» no cuenta ni arriba ni abajo: si la aseguradora negó uno, la visita no queda
|
|
25
33
|
// esperándolo para siempre.
|
|
@@ -43,6 +51,8 @@ const quotePartCandidates = (data, alreadyLinked = []) => {
|
|
|
43
51
|
const linked = new Set(alreadyLinked.filter(Boolean));
|
|
44
52
|
const out = [];
|
|
45
53
|
for (const section of data?.sections ?? []) {
|
|
54
|
+
if (section.hidden_from_client === true)
|
|
55
|
+
continue;
|
|
46
56
|
for (const item of section.items ?? []) {
|
|
47
57
|
if (item.visible === false || !item.costs)
|
|
48
58
|
continue;
|
|
@@ -92,6 +92,12 @@ export interface IVisitSection {
|
|
|
92
92
|
* la plantilla: cambiar la bandera después no reescribe el porcentaje de una visita cerrada.
|
|
93
93
|
*/
|
|
94
94
|
no_checklist?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* DOC: SECCIÓN OCULTA AL CLIENTE (pedido 2026-11-10, permiso HIDE_SECTION_VISIT). No sale en el
|
|
97
|
+
* informe, el PDF ni la app, y cuenta como si todos sus ítems estuvieran ocultos: no pide
|
|
98
|
+
* revisión ni se cotiza. La cambia SOLO el endpoint de visibilidad; el guardado la conserva.
|
|
99
|
+
*/
|
|
100
|
+
hidden_from_client?: boolean;
|
|
95
101
|
/**
|
|
96
102
|
* DOC: Esta sección es la COPIA que agregó una salida temporal (sql/84): «Salida temporal N» o
|
|
97
103
|
* «Reingreso N». La pone el API, nunca el navegador. `role` es OUTING_ROLE (1 ingreso, 2
|
|
@@ -240,3 +246,9 @@ export interface IAuthorizedGap {
|
|
|
240
246
|
}
|
|
241
247
|
export declare const insurerAuthorizedGap: (quotation: Parameters<typeof splitTotalByPayer>[0], authorized: number | string | null | undefined) => IAuthorizedGap | null;
|
|
242
248
|
export declare const compareAuthorizedAmount: (approved: number, authorized: number | string | null | undefined) => IAuthorizedGap | null;
|
|
249
|
+
export declare const clientVisibleSections: <T extends {
|
|
250
|
+
hidden_from_client?: boolean;
|
|
251
|
+
}>(sections: readonly T[] | null | undefined) => T[];
|
|
252
|
+
export declare const clientVisibleData: <T extends {
|
|
253
|
+
sections?: any[];
|
|
254
|
+
} | null | undefined>(data: T) => T;
|
|
@@ -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.compareAuthorizedAmount = exports.insurerAuthorizedGap = exports.normalizeAuthorizedAmount = exports.splitTotalByPayer = exports.deductibleAmount = exports.normalizeDeductible = exports.readDeductible = exports.DEDUCTIBLE_TYPE = exports.isVisitEmpty = exports.preserveClientApprovals = exports.getVisitTaxConfig = exports.getTaxConfig = exports.buildVisitSummary = exports.isItemAnsweredByClient = exports.APPROVAL_SOURCE = void 0;
|
|
13
|
+
exports.clientVisibleData = exports.clientVisibleSections = exports.compareAuthorizedAmount = exports.insurerAuthorizedGap = exports.normalizeAuthorizedAmount = exports.splitTotalByPayer = exports.deductibleAmount = exports.normalizeDeductible = exports.readDeductible = exports.DEDUCTIBLE_TYPE = exports.isVisitEmpty = exports.preserveClientApprovals = exports.getVisitTaxConfig = exports.getTaxConfig = exports.buildVisitSummary = exports.isItemAnsweredByClient = exports.APPROVAL_SOURCE = void 0;
|
|
14
14
|
exports.APPROVAL_SOURCE = { CLIENT: 1, INSURER: 2 };
|
|
15
15
|
// DOC: Peso de cada estado para la "salud del vehículo". NOT_APPLICABLE y los
|
|
16
16
|
// ítems sin marcar quedan fuera del promedio.
|
|
@@ -102,6 +102,9 @@ data, { servicePrice, taxPercentage, isTaxIncluded }) => {
|
|
|
102
102
|
// a todo lo demás: sus fotos cuentan como evidencia y sus costos entran en la cotización.
|
|
103
103
|
// Pintar un carro se cobra igual que revisarlo.
|
|
104
104
|
const counts = section.no_checklist !== true;
|
|
105
|
+
// DOC: Oculta al cliente = todos sus ítems ocultos (no pide revisión ni se cotiza).
|
|
106
|
+
if (section.hidden_from_client === true)
|
|
107
|
+
continue;
|
|
105
108
|
for (const item of section.items ?? []) {
|
|
106
109
|
// DOC: Un ítem oculto no va en el informe del cliente, así que no pide
|
|
107
110
|
// revisión ni se le cotiza nada.
|
|
@@ -453,3 +456,11 @@ const compareAuthorizedAmount = (approved, authorized) => {
|
|
|
453
456
|
return { approved: round2(Number(approved) || 0), authorized: round2(value), gap, matches: Math.abs(gap) < 1 };
|
|
454
457
|
};
|
|
455
458
|
exports.compareAuthorizedAmount = compareAuthorizedAmount;
|
|
459
|
+
// DOC: Las secciones que ve el CLIENTE (informe, PDF, app, cotización): sin las ocultas.
|
|
460
|
+
const clientVisibleSections = (sections) => (sections ?? []).filter((section) => section?.hidden_from_client !== true);
|
|
461
|
+
exports.clientVisibleSections = clientVisibleSections;
|
|
462
|
+
// DOC: La visita como la ve el cliente: el mismo `data` sin las secciones ocultas.
|
|
463
|
+
const clientVisibleData = (data) => data && Array.isArray(data.sections)
|
|
464
|
+
? { ...data, sections: (0, exports.clientVisibleSections)(data.sections) }
|
|
465
|
+
: data;
|
|
466
|
+
exports.clientVisibleData = clientVisibleData;
|
|
@@ -79,6 +79,7 @@ export declare const WORKBOARD_EVENT_TYPE: {
|
|
|
79
79
|
readonly ASSIGNEE_CHANGED: 6;
|
|
80
80
|
readonly STAGE_MOVED_BACK: 7;
|
|
81
81
|
readonly STAGE_OPENED_PARALLEL: 8;
|
|
82
|
+
readonly STAGE_REOPENED: 9;
|
|
82
83
|
};
|
|
83
84
|
export type TWorkboardEventType = (typeof WORKBOARD_EVENT_TYPE)[keyof typeof WORKBOARD_EVENT_TYPE];
|
|
84
85
|
/**
|
|
@@ -105,6 +105,8 @@ exports.WORKBOARD_EVENT_TYPE = {
|
|
|
105
105
|
ASSIGNEE_CHANGED: 6,
|
|
106
106
|
STAGE_MOVED_BACK: 7,
|
|
107
107
|
STAGE_OPENED_PARALLEL: 8,
|
|
108
|
+
// DOC: Se reabrió una sección ya terminada (sql/105) para corregir algo.
|
|
109
|
+
STAGE_REOPENED: 9,
|
|
108
110
|
};
|
|
109
111
|
/**
|
|
110
112
|
* DOC: De dónde vino el cambio (`workboard_event.data.source`).
|