@asumano/worklip-typeorm-db 1.1.111 → 1.1.113
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 +2 -0
- package/dist/entities/Associate.js +18 -0
- package/dist/entities/AssociateFace.d.ts +9 -0
- package/dist/entities/AssociateFace.js +72 -0
- package/dist/entities/ServiceOrderStage.d.ts +1 -0
- package/dist/entities/ServiceOrderStage.js +11 -2
- package/dist/entities.index.d.ts +1 -0
- package/dist/entities.index.js +3 -1
- package/dist/rules/associate.face.rules.d.ts +19 -0
- package/dist/rules/associate.face.rules.js +28 -0
- package/dist/rules/attendance.rules.d.ts +1 -0
- package/dist/rules/attendance.rules.js +1 -0
- package/dist/rules/payroll.rules.d.ts +2 -1
- package/dist/rules/payroll.rules.js +6 -1
- package/package.json +1 -1
|
@@ -132,6 +132,24 @@ __decorate([
|
|
|
132
132
|
}),
|
|
133
133
|
__metadata("design:type", Object)
|
|
134
134
|
], Associate.prototype, "photo", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
(0, typeorm_1.Column)({
|
|
137
|
+
nullable: true,
|
|
138
|
+
default: null,
|
|
139
|
+
type: "int",
|
|
140
|
+
comment: "Reconocimiento facial. NULL: sin registrar, 1: autoriza (al registrarle las fotos), 2: retiró la autorización.",
|
|
141
|
+
}),
|
|
142
|
+
__metadata("design:type", Object)
|
|
143
|
+
], Associate.prototype, "face_consent", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
(0, typeorm_1.Column)({
|
|
146
|
+
nullable: true,
|
|
147
|
+
default: null,
|
|
148
|
+
type: "datetime",
|
|
149
|
+
comment: "Fecha en que autorizó o retiró el reconocimiento facial.",
|
|
150
|
+
}),
|
|
151
|
+
__metadata("design:type", Object)
|
|
152
|
+
], Associate.prototype, "face_consent_at", void 0);
|
|
135
153
|
__decorate([
|
|
136
154
|
(0, typeorm_1.Column)({
|
|
137
155
|
nullable: true,
|
|
@@ -0,0 +1,72 @@
|
|
|
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.AssociateFace = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Associate_1 = require("./Associate");
|
|
15
|
+
// DOC: Fotos del rostro del empleado para el reconocimiento facial (sql/99). Máximo 3 por empleado.
|
|
16
|
+
let AssociateFace = class AssociateFace {
|
|
17
|
+
};
|
|
18
|
+
exports.AssociateFace = AssociateFace;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typeorm_1.PrimaryGeneratedColumn)({
|
|
21
|
+
type: "int",
|
|
22
|
+
comment: "Número de identificación (ID) único de cada registro.",
|
|
23
|
+
}),
|
|
24
|
+
__metadata("design:type", Number)
|
|
25
|
+
], AssociateFace.prototype, "id", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, {
|
|
28
|
+
onDelete: "CASCADE",
|
|
29
|
+
onUpdate: "NO ACTION",
|
|
30
|
+
}),
|
|
31
|
+
(0, typeorm_1.JoinColumn)({ name: "associate" }),
|
|
32
|
+
__metadata("design:type", Associate_1.Associate)
|
|
33
|
+
], AssociateFace.prototype, "associate", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)({
|
|
36
|
+
type: "varchar",
|
|
37
|
+
length: 255,
|
|
38
|
+
comment: "Llave en R2 de la foto (WebP o JPG), en companies/<empresa>/associates-face/<empleado>/.",
|
|
39
|
+
}),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], AssociateFace.prototype, "image", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.Column)({
|
|
44
|
+
type: "int",
|
|
45
|
+
default: 1,
|
|
46
|
+
comment: "Dónde se tomó. 1: sistema (pantalla), 2: terminal.",
|
|
47
|
+
}),
|
|
48
|
+
__metadata("design:type", Number)
|
|
49
|
+
], AssociateFace.prototype, "source", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typeorm_1.ManyToOne)(() => Associate_1.Associate, {
|
|
52
|
+
nullable: true,
|
|
53
|
+
onDelete: "SET NULL",
|
|
54
|
+
onUpdate: "NO ACTION",
|
|
55
|
+
}),
|
|
56
|
+
(0, typeorm_1.JoinColumn)({ name: "created_by" }),
|
|
57
|
+
__metadata("design:type", Object)
|
|
58
|
+
], AssociateFace.prototype, "created_by", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typeorm_1.Column)({
|
|
61
|
+
type: "datetime",
|
|
62
|
+
comment: "Fecha de creación del registro.",
|
|
63
|
+
default: () => "CURRENT_TIMESTAMP",
|
|
64
|
+
}),
|
|
65
|
+
__metadata("design:type", Date)
|
|
66
|
+
], AssociateFace.prototype, "created", void 0);
|
|
67
|
+
exports.AssociateFace = AssociateFace = __decorate([
|
|
68
|
+
(0, typeorm_1.Index)("IDX_associate_face_associate", ["associate"]),
|
|
69
|
+
(0, typeorm_1.Entity)("associate_face", {
|
|
70
|
+
comment: "Fotos del rostro de los empleados para el reconocimiento facial de la terminal.",
|
|
71
|
+
})
|
|
72
|
+
], AssociateFace);
|
|
@@ -49,6 +49,7 @@ export declare class ServiceOrderStage {
|
|
|
49
49
|
pay_rate: string | null;
|
|
50
50
|
pay_amount: string | null;
|
|
51
51
|
income_hours: string | null;
|
|
52
|
+
income_unit: number | null;
|
|
52
53
|
income_rate: string | null;
|
|
53
54
|
income_amount: string | null;
|
|
54
55
|
payroll_updated_by: Associate | null;
|
|
@@ -241,10 +241,19 @@ __decorate([
|
|
|
241
241
|
scale: 2,
|
|
242
242
|
default: null,
|
|
243
243
|
nullable: true,
|
|
244
|
-
comment: "Horas que paga la aseguradora (
|
|
244
|
+
comment: "Horas o piezas que paga la aseguradora (según income_unit). NULL en particular: el ingreso se escribe directo.",
|
|
245
245
|
}),
|
|
246
246
|
__metadata("design:type", Object)
|
|
247
247
|
], ServiceOrderStage.prototype, "income_hours", void 0);
|
|
248
|
+
__decorate([
|
|
249
|
+
(0, typeorm_1.Column)({
|
|
250
|
+
type: "int",
|
|
251
|
+
default: null,
|
|
252
|
+
nullable: true,
|
|
253
|
+
comment: "Cómo paga la aseguradora la etapa.\n1: Por hora.\n3: Por pieza o trabajo.\nNULL: por hora (etapas de antes de sql/98).",
|
|
254
|
+
}),
|
|
255
|
+
__metadata("design:type", Object)
|
|
256
|
+
], ServiceOrderStage.prototype, "income_unit", void 0);
|
|
248
257
|
__decorate([
|
|
249
258
|
(0, typeorm_1.Column)({
|
|
250
259
|
type: "decimal",
|
|
@@ -252,7 +261,7 @@ __decorate([
|
|
|
252
261
|
scale: 2,
|
|
253
262
|
default: null,
|
|
254
263
|
nullable: true,
|
|
255
|
-
comment: "Valor hora de la aseguradora
|
|
264
|
+
comment: "Valor hora de la aseguradora (carrocería o pintura) o valor por pieza escrito a mano.",
|
|
256
265
|
}),
|
|
257
266
|
__metadata("design:type", Object)
|
|
258
267
|
], ServiceOrderStage.prototype, "income_rate", void 0);
|
package/dist/entities.index.d.ts
CHANGED
|
@@ -136,5 +136,6 @@ export { ObdCode } from "./entities/ObdCode";
|
|
|
136
136
|
export { WorkshopReportInbox } from "./entities/WorkshopReportInbox";
|
|
137
137
|
export { WorkshopUnknownDevice } from "./entities/WorkshopUnknownDevice";
|
|
138
138
|
export { JobTitle } from "./entities/JobTitle";
|
|
139
|
+
export { AssociateFace } from "./entities/AssociateFace";
|
|
139
140
|
export { AssociatePayRate } from "./entities/AssociatePayRate";
|
|
140
141
|
export { PayrollMonthDays } from "./entities/PayrollMonthDays";
|
package/dist/entities.index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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
4
|
exports.AssociateDailyStats = exports.WorkshopDailyStats = exports.WorkboardEvent = exports.ServiceOrderStage = exports.WorkboardStatus = exports.CompanyDiscount = exports.DiscountCode = exports.WorkshopDisplay = exports.WorkshopInsurer = exports.WorkshopOfferedService = exports.Insurer = exports.OfferedService = exports.WorkshopOutingRecipient = exports.ServiceOrderOuting = 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.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;
|
|
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;
|
|
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");
|
|
@@ -306,6 +306,8 @@ var WorkshopUnknownDevice_1 = require("./entities/WorkshopUnknownDevice");
|
|
|
306
306
|
Object.defineProperty(exports, "WorkshopUnknownDevice", { enumerable: true, get: function () { return WorkshopUnknownDevice_1.WorkshopUnknownDevice; } });
|
|
307
307
|
var JobTitle_1 = require("./entities/JobTitle");
|
|
308
308
|
Object.defineProperty(exports, "JobTitle", { enumerable: true, get: function () { return JobTitle_1.JobTitle; } });
|
|
309
|
+
var AssociateFace_1 = require("./entities/AssociateFace");
|
|
310
|
+
Object.defineProperty(exports, "AssociateFace", { enumerable: true, get: function () { return AssociateFace_1.AssociateFace; } });
|
|
309
311
|
var AssociatePayRate_1 = require("./entities/AssociatePayRate");
|
|
310
312
|
Object.defineProperty(exports, "AssociatePayRate", { enumerable: true, get: function () { return AssociatePayRate_1.AssociatePayRate; } });
|
|
311
313
|
var PayrollMonthDays_1 = require("./entities/PayrollMonthDays");
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** DOC: `associate.face_consent`. NULL = nunca registrado (se puede registrar). */
|
|
2
|
+
export declare const FACE_CONSENT: {
|
|
3
|
+
readonly GRANTED: 1;
|
|
4
|
+
readonly WITHDRAWN: 2;
|
|
5
|
+
};
|
|
6
|
+
/** DOC: `associate_face.source`: dónde se tomó la foto. */
|
|
7
|
+
export declare const FACE_SOURCE: {
|
|
8
|
+
readonly SYSTEM: 1;
|
|
9
|
+
readonly TERMINAL: 2;
|
|
10
|
+
};
|
|
11
|
+
export declare const FACE_MAX_PHOTOS = 3;
|
|
12
|
+
export declare const FACE_MAX_BYTES: number;
|
|
13
|
+
/** DOC: JPG o WebP; nunca PNG, para no confundirse con la foto del carné. */
|
|
14
|
+
export declare const FACE_IMAGE_TYPES: readonly string[];
|
|
15
|
+
/** DOC: Carpeta APARTE de la del carné (`associates/`): las URLs de esa se firman para cualquiera de la empresa. */
|
|
16
|
+
export declare const associateFacePrefix: (companyCode: string, associateCode: string) => string;
|
|
17
|
+
export declare const isAssociateFaceKey: (key: unknown, companyCode: string | null | undefined, associateCode: string | null | undefined) => key is string;
|
|
18
|
+
/** DOC: ¿Se le pueden subir fotos? Solo si no retiró la autorización. */
|
|
19
|
+
export declare const canRegisterFace: (consent: number | null | undefined) => boolean;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// DOC: Fotos del rostro para el reconocimiento facial de la terminal de asistencia (sql/99). Módulo PURO.
|
|
3
|
+
// import { FACE_CONSENT } from "@asumano/worklip-typeorm-db/dist/rules/associate.face.rules";
|
|
4
|
+
// Las registra SOLO quien tenga MANAGE_FACE_RECOGNITION (o el dueño). Registrarlas = el empleado autoriza;
|
|
5
|
+
// si la retira en su perfil, se borran y nadie le puede subir otras hasta que él la vuelva a dar.
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.canRegisterFace = exports.isAssociateFaceKey = exports.associateFacePrefix = exports.FACE_IMAGE_TYPES = exports.FACE_MAX_BYTES = exports.FACE_MAX_PHOTOS = exports.FACE_SOURCE = exports.FACE_CONSENT = void 0;
|
|
8
|
+
/** DOC: `associate.face_consent`. NULL = nunca registrado (se puede registrar). */
|
|
9
|
+
exports.FACE_CONSENT = { GRANTED: 1, WITHDRAWN: 2 };
|
|
10
|
+
/** DOC: `associate_face.source`: dónde se tomó la foto. */
|
|
11
|
+
exports.FACE_SOURCE = { SYSTEM: 1, TERMINAL: 2 };
|
|
12
|
+
exports.FACE_MAX_PHOTOS = 3;
|
|
13
|
+
exports.FACE_MAX_BYTES = 2 * 1024 * 1024;
|
|
14
|
+
/** DOC: JPG o WebP; nunca PNG, para no confundirse con la foto del carné. */
|
|
15
|
+
exports.FACE_IMAGE_TYPES = ["image/webp", "image/jpeg"];
|
|
16
|
+
/** DOC: Carpeta APARTE de la del carné (`associates/`): las URLs de esa se firman para cualquiera de la empresa. */
|
|
17
|
+
const associateFacePrefix = (companyCode, associateCode) => `companies/${companyCode}/associates-face/${associateCode}/`;
|
|
18
|
+
exports.associateFacePrefix = associateFacePrefix;
|
|
19
|
+
const isAssociateFaceKey = (key, companyCode, associateCode) => typeof key === "string" &&
|
|
20
|
+
!!companyCode &&
|
|
21
|
+
!!associateCode &&
|
|
22
|
+
!key.includes("..") &&
|
|
23
|
+
key.startsWith((0, exports.associateFacePrefix)(companyCode, associateCode)) &&
|
|
24
|
+
/\.(webp|jpg)$/i.test(key);
|
|
25
|
+
exports.isAssociateFaceKey = isAssociateFaceKey;
|
|
26
|
+
/** DOC: ¿Se le pueden subir fotos? Solo si no retiró la autorización. */
|
|
27
|
+
const canRegisterFace = (consent) => consent !== exports.FACE_CONSENT.WITHDRAWN;
|
|
28
|
+
exports.canRegisterFace = canRegisterFace;
|
|
@@ -54,6 +54,7 @@ export declare const ATTENDANCE_LIMITS: {
|
|
|
54
54
|
export interface ICompanyAttendanceSettings {
|
|
55
55
|
allow_document: boolean;
|
|
56
56
|
employees_see_own: boolean;
|
|
57
|
+
face_recognition: boolean;
|
|
57
58
|
}
|
|
58
59
|
export interface IWorkshopAttendanceSettings {
|
|
59
60
|
tolerance_minutes: number;
|
|
@@ -48,6 +48,7 @@ const clampTolerance = (value) => {
|
|
|
48
48
|
const normalizeCompanyAttendance = (raw) => ({
|
|
49
49
|
allow_document: raw?.allow_document === true,
|
|
50
50
|
employees_see_own: raw?.employees_see_own === true,
|
|
51
|
+
face_recognition: raw?.face_recognition === true,
|
|
51
52
|
});
|
|
52
53
|
exports.normalizeCompanyAttendance = normalizeCompanyAttendance;
|
|
53
54
|
const normalizeWorkshopAttendance = (raw) => {
|
|
@@ -47,13 +47,14 @@ export interface IStagePayValues {
|
|
|
47
47
|
*/
|
|
48
48
|
export declare const suggestStagePay: (rate: IAssociatePayRateShape | null | undefined, estimatedHours?: string | number | null | undefined) => IStagePayValues | null;
|
|
49
49
|
export interface IStagePayrollValues extends IStagePayValues {
|
|
50
|
+
income_unit: TPayUnit | null;
|
|
50
51
|
income_hours: number | null;
|
|
51
52
|
income_rate: number | null;
|
|
52
53
|
income_amount: number | null;
|
|
53
54
|
}
|
|
54
55
|
/**
|
|
55
56
|
* DOC: Valida y completa el pago y el ingreso de una etapa. Los totales los calcula siempre el servidor:
|
|
56
|
-
* pago = cantidad x valor; ingreso = horas x valor
|
|
57
|
+
* pago = cantidad x valor; ingreso = horas o piezas x valor o, sin cantidad (particular), el escrito a mano.
|
|
57
58
|
*/
|
|
58
59
|
export declare const resolveStagePayroll: (input: any) => IStagePayrollValues | {
|
|
59
60
|
error: "INVALID_PAYROLL";
|
|
@@ -99,14 +99,17 @@ const suggestStagePay = (rate, estimatedHours = null) => {
|
|
|
99
99
|
exports.suggestStagePay = suggestStagePay;
|
|
100
100
|
/**
|
|
101
101
|
* DOC: Valida y completa el pago y el ingreso de una etapa. Los totales los calcula siempre el servidor:
|
|
102
|
-
* pago = cantidad x valor; ingreso = horas x valor
|
|
102
|
+
* pago = cantidad x valor; ingreso = horas o piezas x valor o, sin cantidad (particular), el escrito a mano.
|
|
103
103
|
*/
|
|
104
104
|
const resolveStagePayroll = (input) => {
|
|
105
105
|
const invalid = { error: "INVALID_PAYROLL" };
|
|
106
106
|
const unitRaw = input?.pay_unit;
|
|
107
107
|
const hasUnit = !isEmpty(unitRaw);
|
|
108
|
+
const incomeUnitRaw = input?.income_unit;
|
|
108
109
|
if (hasUnit && !(0, exports.isPayUnit)(unitRaw, exports.STAGE_PAY_UNITS))
|
|
109
110
|
return invalid;
|
|
111
|
+
if (!isEmpty(incomeUnitRaw) && !(0, exports.isPayUnit)(incomeUnitRaw, exports.STAGE_PAY_UNITS))
|
|
112
|
+
return invalid;
|
|
110
113
|
const quantity = hasUnit ? (0, exports.normalizePayrollQuantity)(input?.pay_quantity) : null;
|
|
111
114
|
const rate = hasUnit ? (0, exports.normalizePayrollMoney)(input?.pay_rate) : null;
|
|
112
115
|
const incomeHours = (0, exports.normalizePayrollQuantity)(input?.income_hours);
|
|
@@ -120,6 +123,8 @@ const resolveStagePayroll = (input) => {
|
|
|
120
123
|
pay_quantity: quantity,
|
|
121
124
|
pay_rate: rate,
|
|
122
125
|
pay_amount: (0, exports.payrollLineAmount)(quantity, rate),
|
|
126
|
+
// DOC: Solo se guarda «por pieza»; por hora queda NULL, igual que las etapas de antes.
|
|
127
|
+
income_unit: Number(incomeUnitRaw) === exports.PAY_UNIT.PIECE ? exports.PAY_UNIT.PIECE : null,
|
|
123
128
|
income_hours: incomeHours,
|
|
124
129
|
income_rate: incomeRate,
|
|
125
130
|
income_amount: incomeByHours ?? incomeManual,
|