@asumano/worklip-typeorm-db 1.1.106 → 1.1.108
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/Appointment.d.ts +2 -0
- package/dist/entities/Appointment.js +10 -0
- package/dist/entities/Associate.d.ts +4 -0
- package/dist/entities/Associate.js +29 -0
- package/dist/entities/GlobalTemplateSection.d.ts +1 -0
- package/dist/entities/GlobalTemplateSection.js +8 -0
- package/dist/entities/JobTitle.d.ts +11 -0
- package/dist/entities/JobTitle.js +84 -0
- package/dist/entities/ServiceOrder.d.ts +9 -0
- package/dist/entities/ServiceOrder.js +94 -1
- package/dist/entities/ServiceOrderApproval.d.ts +7 -0
- package/dist/entities/ServiceOrderApproval.js +63 -0
- package/dist/entities/ServiceOrderOuting.d.ts +41 -0
- package/dist/entities/ServiceOrderOuting.js +184 -0
- package/dist/entities/ServiceOrderPart.d.ts +1 -0
- package/dist/entities/ServiceOrderPart.js +9 -0
- package/dist/entities/ServiceOrderStage.d.ts +1 -0
- package/dist/entities/ServiceOrderStage.js +9 -0
- package/dist/entities/TemplateSection.d.ts +1 -0
- package/dist/entities/TemplateSection.js +8 -0
- package/dist/entities/VisitItemSearch.js +1 -1
- package/dist/entities/WorkboardStatus.js +1 -1
- package/dist/entities/WorkshopOutingRecipient.d.ts +9 -0
- package/dist/entities/WorkshopOutingRecipient.js +50 -0
- package/dist/entities.index.d.ts +3 -0
- package/dist/entities.index.js +8 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -0
- package/dist/rules/associate.profile.rules.d.ts +31 -0
- package/dist/rules/associate.profile.rules.js +71 -0
- package/dist/rules/badge.card.rules.d.ts +74 -0
- package/dist/rules/badge.card.rules.js +125 -0
- package/dist/rules/dashboard.rules.d.ts +1 -0
- package/dist/rules/dashboard.rules.js +3 -0
- package/dist/rules/estimate.time.rules.d.ts +24 -0
- package/dist/rules/estimate.time.rules.js +56 -0
- package/dist/rules/outing.rules.d.ts +49 -0
- package/dist/rules/outing.rules.js +76 -0
- package/dist/rules/template.settings.d.ts +11 -1
- package/dist/rules/template.settings.js +52 -15
- package/dist/rules/visit.history.rules.d.ts +1 -0
- package/dist/rules/visit.history.rules.js +3 -1
- package/dist/rules/visit.summary.d.ts +81 -1
- package/dist/rules/visit.summary.js +128 -4
- package/dist/rules/workboard.rules.d.ts +11 -0
- package/dist/rules/workboard.rules.js +14 -1
- package/dist/views/ServicesOrder.d.ts +1 -0
- package/dist/views/ServicesOrder.js +4 -0
- package/dist/views/ServicesOrderLite.d.ts +1 -0
- package/dist/views/ServicesOrderLite.js +4 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import { Associate } from "./Associate";
|
|
|
2
2
|
import { Client } from "./Client";
|
|
3
3
|
import { Reminder } from "./Reminder";
|
|
4
4
|
import { ServiceOrder } from "./ServiceOrder";
|
|
5
|
+
import { ServiceOrderOuting } from "./ServiceOrderOuting";
|
|
5
6
|
import { Template } from "./Template";
|
|
6
7
|
import { Vehicle } from "./Vehicle";
|
|
7
8
|
import { Workshop } from "./Workshop";
|
|
@@ -25,6 +26,7 @@ export declare class Appointment {
|
|
|
25
26
|
template: Template | null;
|
|
26
27
|
reminder: Reminder | null;
|
|
27
28
|
service_order: ServiceOrder | null;
|
|
29
|
+
outing: ServiceOrderOuting | null;
|
|
28
30
|
appointment_date: string;
|
|
29
31
|
slot: number;
|
|
30
32
|
status: number;
|
|
@@ -15,6 +15,7 @@ const Associate_1 = require("./Associate");
|
|
|
15
15
|
const Client_1 = require("./Client");
|
|
16
16
|
const Reminder_1 = require("./Reminder");
|
|
17
17
|
const ServiceOrder_1 = require("./ServiceOrder");
|
|
18
|
+
const ServiceOrderOuting_1 = require("./ServiceOrderOuting");
|
|
18
19
|
const Template_1 = require("./Template");
|
|
19
20
|
const Vehicle_1 = require("./Vehicle");
|
|
20
21
|
const Workshop_1 = require("./Workshop");
|
|
@@ -102,6 +103,15 @@ __decorate([
|
|
|
102
103
|
(0, typeorm_1.JoinColumn)({ name: "service_order" }),
|
|
103
104
|
__metadata("design:type", Object)
|
|
104
105
|
], Appointment.prototype, "service_order", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrderOuting_1.ServiceOrderOuting, {
|
|
108
|
+
onDelete: "SET NULL",
|
|
109
|
+
onUpdate: "NO ACTION",
|
|
110
|
+
nullable: true,
|
|
111
|
+
}),
|
|
112
|
+
(0, typeorm_1.JoinColumn)({ name: "outing" }),
|
|
113
|
+
__metadata("design:type", Object)
|
|
114
|
+
], Appointment.prototype, "outing", void 0);
|
|
105
115
|
__decorate([
|
|
106
116
|
(0, typeorm_1.Column)({
|
|
107
117
|
type: "date",
|
|
@@ -2,6 +2,7 @@ import { AssociatePasswordReset, AssociatePermission, Region } from "../entities
|
|
|
2
2
|
import { AssociateSession } from "./AssociateSession";
|
|
3
3
|
import { City } from "./City";
|
|
4
4
|
import { Company } from "./Company";
|
|
5
|
+
import { JobTitle } from "./JobTitle";
|
|
5
6
|
import { Reminder } from "./Reminder";
|
|
6
7
|
import { ServiceOrderHistory } from "./ServiceOrderHistory";
|
|
7
8
|
import { Workshop } from "./Workshop";
|
|
@@ -17,6 +18,9 @@ export declare class Associate {
|
|
|
17
18
|
region: Region | null;
|
|
18
19
|
city: City | null;
|
|
19
20
|
address: string | null;
|
|
21
|
+
photo: string | null;
|
|
22
|
+
blood_type: number | null;
|
|
23
|
+
job_title: JobTitle | null;
|
|
20
24
|
password: string;
|
|
21
25
|
details: any | null;
|
|
22
26
|
created: Date;
|
|
@@ -15,6 +15,7 @@ const entities_views_routes_1 = require("../entities.views.routes");
|
|
|
15
15
|
const AssociateSession_1 = require("./AssociateSession");
|
|
16
16
|
const City_1 = require("./City");
|
|
17
17
|
const Company_1 = require("./Company");
|
|
18
|
+
const JobTitle_1 = require("./JobTitle");
|
|
18
19
|
const Reminder_1 = require("./Reminder");
|
|
19
20
|
const ServiceOrderHistory_1 = require("./ServiceOrderHistory");
|
|
20
21
|
const Workshop_1 = require("./Workshop");
|
|
@@ -112,6 +113,34 @@ __decorate([
|
|
|
112
113
|
}),
|
|
113
114
|
__metadata("design:type", Object)
|
|
114
115
|
], Associate.prototype, "address", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, typeorm_1.Column)({
|
|
118
|
+
nullable: true,
|
|
119
|
+
default: null,
|
|
120
|
+
type: "varchar",
|
|
121
|
+
length: 255,
|
|
122
|
+
comment: "Llave en R2 de la foto sin fondo (PNG). NULL: sin foto, se muestran las iniciales.",
|
|
123
|
+
}),
|
|
124
|
+
__metadata("design:type", Object)
|
|
125
|
+
], Associate.prototype, "photo", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, typeorm_1.Column)({
|
|
128
|
+
nullable: true,
|
|
129
|
+
default: null,
|
|
130
|
+
type: "int",
|
|
131
|
+
comment: "Tipo de sangre (dato sensible). 1: O+, 2: O-, 3: A+, 4: A-, 5: B+, 6: B-, 7: AB+, 8: AB-. NULL: sin dato.",
|
|
132
|
+
}),
|
|
133
|
+
__metadata("design:type", Object)
|
|
134
|
+
], Associate.prototype, "blood_type", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
(0, typeorm_1.ManyToOne)(() => JobTitle_1.JobTitle, {
|
|
137
|
+
nullable: true,
|
|
138
|
+
onDelete: "SET NULL",
|
|
139
|
+
onUpdate: "NO ACTION",
|
|
140
|
+
}),
|
|
141
|
+
(0, typeorm_1.JoinColumn)({ name: "job_title" }),
|
|
142
|
+
__metadata("design:type", Object)
|
|
143
|
+
], Associate.prototype, "job_title", void 0);
|
|
115
144
|
__decorate([
|
|
116
145
|
(0, typeorm_1.Column)({
|
|
117
146
|
type: "varchar",
|
|
@@ -94,6 +94,14 @@ __decorate([
|
|
|
94
94
|
}),
|
|
95
95
|
__metadata("design:type", Number)
|
|
96
96
|
], GlobalTemplateSection.prototype, "status", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, typeorm_1.Column)({
|
|
99
|
+
default: 0,
|
|
100
|
+
type: "int",
|
|
101
|
+
comment: "Papel de la sección en la salida temporal DENTRO de esta plantilla global.\n0: Ninguno.\n1: Ingreso (su copia es el reingreso).\n2: Salida (su copia es la salida temporal).",
|
|
102
|
+
}),
|
|
103
|
+
__metadata("design:type", Number)
|
|
104
|
+
], GlobalTemplateSection.prototype, "outing_role", void 0);
|
|
97
105
|
exports.GlobalTemplateSection = GlobalTemplateSection = __decorate([
|
|
98
106
|
(0, typeorm_1.Entity)({
|
|
99
107
|
comment: "Enlace entre plantilla global y sección global.",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Associate } from "./Associate";
|
|
2
|
+
import { Company } from "./Company";
|
|
3
|
+
export declare class JobTitle {
|
|
4
|
+
id: number;
|
|
5
|
+
company: Company;
|
|
6
|
+
name: string;
|
|
7
|
+
status: number;
|
|
8
|
+
created_by: Associate | null;
|
|
9
|
+
created: Date;
|
|
10
|
+
updated: Date | null;
|
|
11
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
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.JobTitle = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Associate_1 = require("./Associate");
|
|
15
|
+
const Company_1 = require("./Company");
|
|
16
|
+
// DOC: Cargos de los empleados (sql/85). Por empresa y distintos de los roles de permisos.
|
|
17
|
+
let JobTitle = class JobTitle {
|
|
18
|
+
};
|
|
19
|
+
exports.JobTitle = JobTitle;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
22
|
+
type: "int",
|
|
23
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
24
|
+
}),
|
|
25
|
+
__metadata("design:type", Number)
|
|
26
|
+
], JobTitle.prototype, "id", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.ManyToOne)(() => Company_1.Company, {
|
|
29
|
+
onDelete: "CASCADE",
|
|
30
|
+
onUpdate: "NO ACTION",
|
|
31
|
+
}),
|
|
32
|
+
(0, typeorm_1.JoinColumn)({ name: "company" }),
|
|
33
|
+
__metadata("design:type", Company_1.Company)
|
|
34
|
+
], JobTitle.prototype, "company", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)({
|
|
37
|
+
type: "varchar",
|
|
38
|
+
length: 60,
|
|
39
|
+
comment: "Nombre del cargo (Mecánico, Pintor...).",
|
|
40
|
+
}),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], JobTitle.prototype, "name", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({
|
|
45
|
+
default: 1,
|
|
46
|
+
type: "int",
|
|
47
|
+
comment: "1: activo, 0: inactivo (no se ofrece al editar usuarios).",
|
|
48
|
+
}),
|
|
49
|
+
__metadata("design:type", Number)
|
|
50
|
+
], JobTitle.prototype, "status", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, {
|
|
53
|
+
nullable: true,
|
|
54
|
+
onDelete: "SET NULL",
|
|
55
|
+
onUpdate: "NO ACTION",
|
|
56
|
+
}),
|
|
57
|
+
(0, typeorm_1.JoinColumn)({ name: "created_by" }),
|
|
58
|
+
__metadata("design:type", Object)
|
|
59
|
+
], JobTitle.prototype, "created_by", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)({
|
|
62
|
+
type: "datetime",
|
|
63
|
+
comment: "Fecha de creación del registro.",
|
|
64
|
+
default: () => "CURRENT_TIMESTAMP",
|
|
65
|
+
}),
|
|
66
|
+
__metadata("design:type", Date)
|
|
67
|
+
], JobTitle.prototype, "created", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, typeorm_1.Column)({
|
|
70
|
+
type: "datetime",
|
|
71
|
+
nullable: true,
|
|
72
|
+
default: null,
|
|
73
|
+
comment: "Fecha de actualización del registro.",
|
|
74
|
+
onUpdate: "CURRENT_TIMESTAMP",
|
|
75
|
+
}),
|
|
76
|
+
__metadata("design:type", Object)
|
|
77
|
+
], JobTitle.prototype, "updated", void 0);
|
|
78
|
+
exports.JobTitle = JobTitle = __decorate([
|
|
79
|
+
(0, typeorm_1.Unique)("UQ_job_title_company_name", ["company", "name"]),
|
|
80
|
+
(0, typeorm_1.Index)("IDX_job_title_company_status", ["company", "status"]),
|
|
81
|
+
(0, typeorm_1.Entity)("job_title", {
|
|
82
|
+
comment: "Cargos de los empleados, por empresa.",
|
|
83
|
+
})
|
|
84
|
+
], JobTitle);
|
|
@@ -39,6 +39,10 @@ export declare class ServiceOrder {
|
|
|
39
39
|
workboard_status: WorkboardStatus | null;
|
|
40
40
|
workboard_changed: Date | null;
|
|
41
41
|
promised_date: Date | null;
|
|
42
|
+
estimated_hours: number | null;
|
|
43
|
+
estimated_unit: number | null;
|
|
44
|
+
initial_estimated_hours: number | null;
|
|
45
|
+
initial_estimated_unit: number | null;
|
|
42
46
|
/**
|
|
43
47
|
* DOC: LA CALIFICACIÓN DEL CLIENTE. La deja él mismo desde su informe público, cuando ya
|
|
44
48
|
* recibió el vehículo, y solo si la plantilla de la visita la pide
|
|
@@ -60,6 +64,11 @@ export declare class ServiceOrder {
|
|
|
60
64
|
reinspection_of: ServiceOrder | null;
|
|
61
65
|
insurer: Insurer | null;
|
|
62
66
|
claim_number: string | null;
|
|
67
|
+
deductible_type: number;
|
|
68
|
+
deductible_percent: number | null;
|
|
69
|
+
deductible_amount: number | null;
|
|
70
|
+
insurer_authorized_amount: number | null;
|
|
71
|
+
outside_since: Date | null;
|
|
63
72
|
stages: ServiceOrderStage[];
|
|
64
73
|
workboard_events: WorkboardEvent[];
|
|
65
74
|
service_order_history: ServiceOrderHistory[];
|
|
@@ -245,6 +245,46 @@ __decorate([
|
|
|
245
245
|
}),
|
|
246
246
|
__metadata("design:type", Object)
|
|
247
247
|
], ServiceOrder.prototype, "promised_date", void 0);
|
|
248
|
+
__decorate([
|
|
249
|
+
(0, typeorm_1.Column)({
|
|
250
|
+
type: "decimal",
|
|
251
|
+
precision: 8,
|
|
252
|
+
scale: 2,
|
|
253
|
+
default: null,
|
|
254
|
+
nullable: true,
|
|
255
|
+
comment: "Horas hábiles de trabajo estimadas para el vehículo. NULL: sin estimar.",
|
|
256
|
+
}),
|
|
257
|
+
__metadata("design:type", Object)
|
|
258
|
+
], ServiceOrder.prototype, "estimated_hours", void 0);
|
|
259
|
+
__decorate([
|
|
260
|
+
(0, typeorm_1.Column)({
|
|
261
|
+
type: "int",
|
|
262
|
+
default: null,
|
|
263
|
+
nullable: true,
|
|
264
|
+
comment: "Unidad en que se escribió el tiempo estimado: 2 horas, 3 días, 4 semanas (TIME_UNIT).",
|
|
265
|
+
}),
|
|
266
|
+
__metadata("design:type", Object)
|
|
267
|
+
], ServiceOrder.prototype, "estimated_unit", void 0);
|
|
268
|
+
__decorate([
|
|
269
|
+
(0, typeorm_1.Column)({
|
|
270
|
+
type: "decimal",
|
|
271
|
+
precision: 8,
|
|
272
|
+
scale: 2,
|
|
273
|
+
default: null,
|
|
274
|
+
nullable: true,
|
|
275
|
+
comment: "Horas hábiles estimadas AL CREAR la visita. No cambia al editar el estimado. NULL: se creó sin estimar.",
|
|
276
|
+
}),
|
|
277
|
+
__metadata("design:type", Object)
|
|
278
|
+
], ServiceOrder.prototype, "initial_estimated_hours", void 0);
|
|
279
|
+
__decorate([
|
|
280
|
+
(0, typeorm_1.Column)({
|
|
281
|
+
type: "int",
|
|
282
|
+
default: null,
|
|
283
|
+
nullable: true,
|
|
284
|
+
comment: "Unidad del estimado inicial: 2 horas, 3 días, 4 semanas (TIME_UNIT).",
|
|
285
|
+
}),
|
|
286
|
+
__metadata("design:type", Object)
|
|
287
|
+
], ServiceOrder.prototype, "initial_estimated_unit", void 0);
|
|
248
288
|
__decorate([
|
|
249
289
|
(0, typeorm_1.Column)({
|
|
250
290
|
type: "tinyint",
|
|
@@ -320,6 +360,56 @@ __decorate([
|
|
|
320
360
|
}),
|
|
321
361
|
__metadata("design:type", Object)
|
|
322
362
|
], ServiceOrder.prototype, "claim_number", void 0);
|
|
363
|
+
__decorate([
|
|
364
|
+
(0, typeorm_1.Column)({
|
|
365
|
+
type: "int",
|
|
366
|
+
default: 0,
|
|
367
|
+
comment: "Deducible de la aseguradora.\n0: Sin deducible.\n1: Porcentaje de lo aprobado con un mínimo.\n2: Valor fijo.",
|
|
368
|
+
}),
|
|
369
|
+
__metadata("design:type", Number)
|
|
370
|
+
], ServiceOrder.prototype, "deductible_type", void 0);
|
|
371
|
+
__decorate([
|
|
372
|
+
(0, typeorm_1.Column)({
|
|
373
|
+
type: "decimal",
|
|
374
|
+
precision: 5,
|
|
375
|
+
scale: 2,
|
|
376
|
+
default: null,
|
|
377
|
+
nullable: true,
|
|
378
|
+
comment: "Porcentaje del deducible (0-100) sobre lo aprobado por la aseguradora con IVA. Solo con deductible_type 1.",
|
|
379
|
+
}),
|
|
380
|
+
__metadata("design:type", Object)
|
|
381
|
+
], ServiceOrder.prototype, "deductible_percent", void 0);
|
|
382
|
+
__decorate([
|
|
383
|
+
(0, typeorm_1.Column)({
|
|
384
|
+
type: "decimal",
|
|
385
|
+
precision: 14,
|
|
386
|
+
scale: 2,
|
|
387
|
+
default: null,
|
|
388
|
+
nullable: true,
|
|
389
|
+
comment: "Con deductible_type 1: el mínimo. Con 2: el valor fijo. En la moneda de la visita.",
|
|
390
|
+
}),
|
|
391
|
+
__metadata("design:type", Object)
|
|
392
|
+
], ServiceOrder.prototype, "deductible_amount", void 0);
|
|
393
|
+
__decorate([
|
|
394
|
+
(0, typeorm_1.Column)({
|
|
395
|
+
type: "decimal",
|
|
396
|
+
precision: 14,
|
|
397
|
+
scale: 2,
|
|
398
|
+
default: null,
|
|
399
|
+
nullable: true,
|
|
400
|
+
comment: "Valor autorizado en la carta de la aseguradora, con IVA. Opcional: solo se compara con los ítems aprobados por ella; no cambia el total.",
|
|
401
|
+
}),
|
|
402
|
+
__metadata("design:type", Object)
|
|
403
|
+
], ServiceOrder.prototype, "insurer_authorized_amount", void 0);
|
|
404
|
+
__decorate([
|
|
405
|
+
(0, typeorm_1.Column)({
|
|
406
|
+
type: "datetime",
|
|
407
|
+
nullable: true,
|
|
408
|
+
default: null,
|
|
409
|
+
comment: "Desde cuándo está el vehículo fuera del taller (salida temporal abierta). NULL: está en el taller.",
|
|
410
|
+
}),
|
|
411
|
+
__metadata("design:type", Object)
|
|
412
|
+
], ServiceOrder.prototype, "outside_since", void 0);
|
|
323
413
|
__decorate([
|
|
324
414
|
(0, typeorm_1.OneToMany)(() => ServiceOrderStage_1.ServiceOrderStage, (stage) => stage.service_order),
|
|
325
415
|
__metadata("design:type", Array)
|
|
@@ -356,7 +446,10 @@ exports.ServiceOrder = ServiceOrder = __decorate([
|
|
|
356
446
|
(0, typeorm_1.Index)("UQ_service_order_visit_sequence", ["workshop", "visit_year", "visit_sequence"], { unique: true })
|
|
357
447
|
// DOC: Para buscar/ordenar por el número dentro de un taller sin escanear la tabla.
|
|
358
448
|
,
|
|
359
|
-
(0, typeorm_1.Index)("IDX_service_order_visit_number", ["workshop", "visit_number"])
|
|
449
|
+
(0, typeorm_1.Index)("IDX_service_order_visit_number", ["workshop", "visit_number"])
|
|
450
|
+
// DOC: «Los vehículos fuera del taller de esta sede», para la tabla, el aviso y las métricas.
|
|
451
|
+
,
|
|
452
|
+
(0, typeorm_1.Index)("IDX_service_order_outside", ["workshop", "outside_since"]),
|
|
360
453
|
(0, typeorm_1.Entity)({
|
|
361
454
|
comment: "Órdenes de servicio del concesionario/taller.",
|
|
362
455
|
name: "service_order",
|
|
@@ -19,5 +19,12 @@ export declare class ServiceOrderApproval {
|
|
|
19
19
|
client_role: string | null;
|
|
20
20
|
ip: string | null;
|
|
21
21
|
user_agent: string | null;
|
|
22
|
+
source: number;
|
|
23
|
+
insurer: number | null;
|
|
24
|
+
associate: number | null;
|
|
25
|
+
verification: number;
|
|
26
|
+
registered_method: number | null;
|
|
27
|
+
evidence: string | null;
|
|
28
|
+
note: string | null;
|
|
22
29
|
created: Date;
|
|
23
30
|
}
|
|
@@ -171,6 +171,69 @@ __decorate([
|
|
|
171
171
|
}),
|
|
172
172
|
__metadata("design:type", Object)
|
|
173
173
|
], ServiceOrderApproval.prototype, "user_agent", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
(0, typeorm_1.Column)({
|
|
176
|
+
type: "int",
|
|
177
|
+
default: 1,
|
|
178
|
+
comment: "Quién aprobó: 1 el cliente, 2 la aseguradora (lo marcó el taller).",
|
|
179
|
+
}),
|
|
180
|
+
__metadata("design:type", Number)
|
|
181
|
+
], ServiceOrderApproval.prototype, "source", void 0);
|
|
182
|
+
__decorate([
|
|
183
|
+
(0, typeorm_1.Column)({
|
|
184
|
+
type: "int",
|
|
185
|
+
default: null,
|
|
186
|
+
nullable: true,
|
|
187
|
+
comment: "Aseguradora que aprobó (solo source = 2).",
|
|
188
|
+
}),
|
|
189
|
+
__metadata("design:type", Object)
|
|
190
|
+
], ServiceOrderApproval.prototype, "insurer", void 0);
|
|
191
|
+
__decorate([
|
|
192
|
+
(0, typeorm_1.Column)({
|
|
193
|
+
type: "int",
|
|
194
|
+
default: null,
|
|
195
|
+
nullable: true,
|
|
196
|
+
comment: "Empleado que marcó la aprobación: de la aseguradora (source = 2) o la registrada por el taller (verification = 5).",
|
|
197
|
+
}),
|
|
198
|
+
__metadata("design:type", Object)
|
|
199
|
+
], ServiceOrderApproval.prototype, "associate", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
(0, typeorm_1.Column)({
|
|
202
|
+
type: "int",
|
|
203
|
+
default: 0,
|
|
204
|
+
comment: "Cómo confirmó el cliente la aprobación:\n0: Sin verificación (rechazo, aseguradora o antes de sql/91).\n1: Documento.\n2: Código por correo.\n3: Sesión de la app (sin documento).\n4: Número de WhatsApp (verificado por Meta).\n5: Registrada por el taller (con evidencia y nota).",
|
|
205
|
+
}),
|
|
206
|
+
__metadata("design:type", Number)
|
|
207
|
+
], ServiceOrderApproval.prototype, "verification", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
(0, typeorm_1.Column)({
|
|
210
|
+
type: "int",
|
|
211
|
+
default: null,
|
|
212
|
+
nullable: true,
|
|
213
|
+
comment: "Cómo aprobó el cliente cuando lo registra el taller (verification = 5):\n1: Por llamada.\n2: En persona.\n3: Otro.\nNULL: no la registró el taller.",
|
|
214
|
+
}),
|
|
215
|
+
__metadata("design:type", Object)
|
|
216
|
+
], ServiceOrderApproval.prototype, "registered_method", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
(0, typeorm_1.Column)({
|
|
219
|
+
type: "varchar",
|
|
220
|
+
length: 255,
|
|
221
|
+
default: null,
|
|
222
|
+
nullable: true,
|
|
223
|
+
comment: "Llave en R2 de la evidencia (foto, audio, PDF o la firma en pantalla) de la aprobación registrada por el taller.",
|
|
224
|
+
}),
|
|
225
|
+
__metadata("design:type", Object)
|
|
226
|
+
], ServiceOrderApproval.prototype, "evidence", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
(0, typeorm_1.Column)({
|
|
229
|
+
type: "varchar",
|
|
230
|
+
length: 500,
|
|
231
|
+
default: null,
|
|
232
|
+
nullable: true,
|
|
233
|
+
comment: "Nota obligatoria del empleado al registrar la aprobación del cliente.",
|
|
234
|
+
}),
|
|
235
|
+
__metadata("design:type", Object)
|
|
236
|
+
], ServiceOrderApproval.prototype, "note", void 0);
|
|
174
237
|
__decorate([
|
|
175
238
|
(0, typeorm_1.Column)({
|
|
176
239
|
type: "datetime",
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Associate } from "./Associate";
|
|
2
|
+
import { Client } from "./Client";
|
|
3
|
+
import { ServiceOrder } from "./ServiceOrder";
|
|
4
|
+
import { WorkboardStatus } from "./WorkboardStatus";
|
|
5
|
+
import { Workshop } from "./Workshop";
|
|
6
|
+
/**
|
|
7
|
+
* DOC: UNA SALIDA TEMPORAL del vehículo con la visita abierta, y su reingreso (sql/84).
|
|
8
|
+
*
|
|
9
|
+
* Lo que se llena (inventario, fotos, firma) va en las COPIAS de las secciones de ingreso y salida
|
|
10
|
+
* dentro de `service_order.data`; esta fila es el registro corto para filtrar, contar y medir sin
|
|
11
|
+
* leer ese JSON. `returned_at` NULL = el vehículo sigue afuera, y `service_order.outside_since` lo
|
|
12
|
+
* repite para la tabla de visitas.
|
|
13
|
+
*
|
|
14
|
+
* Quien se lo lleva o lo trae se guarda COPIADO (nombre y documento) aunque se escoja de la lista
|
|
15
|
+
* de clientes: es la constancia de ese día, y la ficha del cliente puede cambiar después.
|
|
16
|
+
*/
|
|
17
|
+
export declare class ServiceOrderOuting {
|
|
18
|
+
id: number;
|
|
19
|
+
service_order: ServiceOrder;
|
|
20
|
+
workshop: Workshop;
|
|
21
|
+
left_at: Date;
|
|
22
|
+
left_by: Associate;
|
|
23
|
+
left_mileage: number | null;
|
|
24
|
+
left_client: Client | null;
|
|
25
|
+
left_person_name: string;
|
|
26
|
+
left_person_document_type: string | null;
|
|
27
|
+
left_person_document: string | null;
|
|
28
|
+
left_section: string | null;
|
|
29
|
+
left_workboard_status: WorkboardStatus | null;
|
|
30
|
+
note: string | null;
|
|
31
|
+
returned_at: Date | null;
|
|
32
|
+
returned_by: Associate | null;
|
|
33
|
+
returned_mileage: number | null;
|
|
34
|
+
returned_client: Client | null;
|
|
35
|
+
returned_person_name: string | null;
|
|
36
|
+
returned_person_document_type: string | null;
|
|
37
|
+
returned_person_document: string | null;
|
|
38
|
+
returned_section: string | null;
|
|
39
|
+
created: Date;
|
|
40
|
+
updated: Date | null;
|
|
41
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
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.ServiceOrderOuting = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Associate_1 = require("./Associate");
|
|
15
|
+
const Client_1 = require("./Client");
|
|
16
|
+
const ServiceOrder_1 = require("./ServiceOrder");
|
|
17
|
+
const WorkboardStatus_1 = require("./WorkboardStatus");
|
|
18
|
+
const Workshop_1 = require("./Workshop");
|
|
19
|
+
/**
|
|
20
|
+
* DOC: UNA SALIDA TEMPORAL del vehículo con la visita abierta, y su reingreso (sql/84).
|
|
21
|
+
*
|
|
22
|
+
* Lo que se llena (inventario, fotos, firma) va en las COPIAS de las secciones de ingreso y salida
|
|
23
|
+
* dentro de `service_order.data`; esta fila es el registro corto para filtrar, contar y medir sin
|
|
24
|
+
* leer ese JSON. `returned_at` NULL = el vehículo sigue afuera, y `service_order.outside_since` lo
|
|
25
|
+
* repite para la tabla de visitas.
|
|
26
|
+
*
|
|
27
|
+
* Quien se lo lleva o lo trae se guarda COPIADO (nombre y documento) aunque se escoja de la lista
|
|
28
|
+
* de clientes: es la constancia de ese día, y la ficha del cliente puede cambiar después.
|
|
29
|
+
*/
|
|
30
|
+
let ServiceOrderOuting = class ServiceOrderOuting {
|
|
31
|
+
};
|
|
32
|
+
exports.ServiceOrderOuting = ServiceOrderOuting;
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", comment: "Número de identificación (ID) único de cada registro." }),
|
|
35
|
+
__metadata("design:type", Number)
|
|
36
|
+
], ServiceOrderOuting.prototype, "id", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.ManyToOne)(() => ServiceOrder_1.ServiceOrder, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
39
|
+
(0, typeorm_1.JoinColumn)({ name: "service_order" }),
|
|
40
|
+
__metadata("design:type", ServiceOrder_1.ServiceOrder)
|
|
41
|
+
], ServiceOrderOuting.prototype, "service_order", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.ManyToOne)(() => Workshop_1.Workshop, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
|
|
44
|
+
(0, typeorm_1.JoinColumn)({ name: "workshop" }),
|
|
45
|
+
__metadata("design:type", Workshop_1.Workshop)
|
|
46
|
+
], ServiceOrderOuting.prototype, "workshop", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.Column)({ type: "datetime", default: () => "CURRENT_TIMESTAMP", comment: "Cuándo salió el vehículo del taller." }),
|
|
49
|
+
__metadata("design:type", Date)
|
|
50
|
+
], ServiceOrderOuting.prototype, "left_at", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION" }),
|
|
53
|
+
(0, typeorm_1.JoinColumn)({ name: "left_by" }),
|
|
54
|
+
__metadata("design:type", Associate_1.Associate)
|
|
55
|
+
], ServiceOrderOuting.prototype, "left_by", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.Column)({ type: "int", nullable: true, default: null, comment: "Kilometraje al salir." }),
|
|
58
|
+
__metadata("design:type", Object)
|
|
59
|
+
], ServiceOrderOuting.prototype, "left_mileage", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.ManyToOne)(() => Client_1.Client, { onDelete: "SET NULL", onUpdate: "NO ACTION", nullable: true }),
|
|
62
|
+
(0, typeorm_1.JoinColumn)({ name: "left_client" }),
|
|
63
|
+
__metadata("design:type", Object)
|
|
64
|
+
], ServiceOrderOuting.prototype, "left_client", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, typeorm_1.Column)({
|
|
67
|
+
type: "varchar",
|
|
68
|
+
length: 150,
|
|
69
|
+
comment: "Nombre de quien se lo llevó (copiado del cliente si se escogió de la lista).",
|
|
70
|
+
}),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], ServiceOrderOuting.prototype, "left_person_name", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, typeorm_1.Column)({
|
|
75
|
+
type: "varchar",
|
|
76
|
+
length: 10,
|
|
77
|
+
nullable: true,
|
|
78
|
+
default: null,
|
|
79
|
+
comment: "Tipo de documento de quien se lo llevó (C.C, PASAPORTE...), como client.document_type.",
|
|
80
|
+
}),
|
|
81
|
+
__metadata("design:type", Object)
|
|
82
|
+
], ServiceOrderOuting.prototype, "left_person_document_type", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 30, nullable: true, default: null, comment: "Documento de quien se lo llevó." }),
|
|
85
|
+
__metadata("design:type", Object)
|
|
86
|
+
], ServiceOrderOuting.prototype, "left_person_document", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, typeorm_1.Column)({
|
|
89
|
+
type: "varchar",
|
|
90
|
+
length: 120,
|
|
91
|
+
nullable: true,
|
|
92
|
+
default: null,
|
|
93
|
+
comment: "Id de la copia de la sección de salida dentro de service_order.data.",
|
|
94
|
+
}),
|
|
95
|
+
__metadata("design:type", Object)
|
|
96
|
+
], ServiceOrderOuting.prototype, "left_section", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, typeorm_1.ManyToOne)(() => WorkboardStatus_1.WorkboardStatus, { onDelete: "SET NULL", onUpdate: "NO ACTION", nullable: true }),
|
|
99
|
+
(0, typeorm_1.JoinColumn)({ name: "left_workboard_status" }),
|
|
100
|
+
__metadata("design:type", Object)
|
|
101
|
+
], ServiceOrderOuting.prototype, "left_workboard_status", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, typeorm_1.Column)({
|
|
104
|
+
type: "varchar",
|
|
105
|
+
length: 500,
|
|
106
|
+
nullable: true,
|
|
107
|
+
default: null,
|
|
108
|
+
comment: "Motivo u observación de la salida (p. ej. esperando repuestos).",
|
|
109
|
+
}),
|
|
110
|
+
__metadata("design:type", Object)
|
|
111
|
+
], ServiceOrderOuting.prototype, "note", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
(0, typeorm_1.Column)({
|
|
114
|
+
type: "datetime",
|
|
115
|
+
nullable: true,
|
|
116
|
+
default: null,
|
|
117
|
+
comment: "Cuándo volvió. NULL: el vehículo sigue fuera del taller.",
|
|
118
|
+
}),
|
|
119
|
+
__metadata("design:type", Object)
|
|
120
|
+
], ServiceOrderOuting.prototype, "returned_at", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "RESTRICT", onUpdate: "NO ACTION", nullable: true }),
|
|
123
|
+
(0, typeorm_1.JoinColumn)({ name: "returned_by" }),
|
|
124
|
+
__metadata("design:type", Object)
|
|
125
|
+
], ServiceOrderOuting.prototype, "returned_by", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, typeorm_1.Column)({ type: "int", nullable: true, default: null, comment: "Kilometraje al volver." }),
|
|
128
|
+
__metadata("design:type", Object)
|
|
129
|
+
], ServiceOrderOuting.prototype, "returned_mileage", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, typeorm_1.ManyToOne)(() => Client_1.Client, { onDelete: "SET NULL", onUpdate: "NO ACTION", nullable: true }),
|
|
132
|
+
(0, typeorm_1.JoinColumn)({ name: "returned_client" }),
|
|
133
|
+
__metadata("design:type", Object)
|
|
134
|
+
], ServiceOrderOuting.prototype, "returned_client", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 150, nullable: true, default: null, comment: "Nombre de quien lo trajo." }),
|
|
137
|
+
__metadata("design:type", Object)
|
|
138
|
+
], ServiceOrderOuting.prototype, "returned_person_name", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
(0, typeorm_1.Column)({
|
|
141
|
+
type: "varchar",
|
|
142
|
+
length: 10,
|
|
143
|
+
nullable: true,
|
|
144
|
+
default: null,
|
|
145
|
+
comment: "Tipo de documento de quien lo trajo.",
|
|
146
|
+
}),
|
|
147
|
+
__metadata("design:type", Object)
|
|
148
|
+
], ServiceOrderOuting.prototype, "returned_person_document_type", void 0);
|
|
149
|
+
__decorate([
|
|
150
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 30, nullable: true, default: null, comment: "Documento de quien lo trajo." }),
|
|
151
|
+
__metadata("design:type", Object)
|
|
152
|
+
], ServiceOrderOuting.prototype, "returned_person_document", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
(0, typeorm_1.Column)({
|
|
155
|
+
type: "varchar",
|
|
156
|
+
length: 120,
|
|
157
|
+
nullable: true,
|
|
158
|
+
default: null,
|
|
159
|
+
comment: "Id de la copia de la sección de ingreso dentro de service_order.data.",
|
|
160
|
+
}),
|
|
161
|
+
__metadata("design:type", Object)
|
|
162
|
+
], ServiceOrderOuting.prototype, "returned_section", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
(0, typeorm_1.Column)({ type: "datetime", default: () => "CURRENT_TIMESTAMP", comment: "Fecha de creación del registro." }),
|
|
165
|
+
__metadata("design:type", Date)
|
|
166
|
+
], ServiceOrderOuting.prototype, "created", void 0);
|
|
167
|
+
__decorate([
|
|
168
|
+
(0, typeorm_1.Column)({
|
|
169
|
+
type: "datetime",
|
|
170
|
+
nullable: true,
|
|
171
|
+
default: null,
|
|
172
|
+
onUpdate: "CURRENT_TIMESTAMP",
|
|
173
|
+
comment: "Fecha de actualización del registro.",
|
|
174
|
+
}),
|
|
175
|
+
__metadata("design:type", Object)
|
|
176
|
+
], ServiceOrderOuting.prototype, "updated", void 0);
|
|
177
|
+
exports.ServiceOrderOuting = ServiceOrderOuting = __decorate([
|
|
178
|
+
(0, typeorm_1.Index)("IDX_service_order_outing_order", ["service_order", "returned_at"]),
|
|
179
|
+
(0, typeorm_1.Index)("IDX_service_order_outing_workshop", ["workshop", "returned_at"]),
|
|
180
|
+
(0, typeorm_1.Entity)({
|
|
181
|
+
comment: "Salidas temporales del vehículo con la visita abierta (en pausa) y su reingreso.",
|
|
182
|
+
name: "service_order_outing",
|
|
183
|
+
})
|
|
184
|
+
], ServiceOrderOuting);
|