@7365admin1/module-hygiene 4.31.0 → 4.32.0
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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +45 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/test/schedule-followups.test.mjs +24 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @7365admin1/module-hygiene
|
|
2
2
|
|
|
3
|
+
## 4.32.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8b89acd: Extra-visit sets now store `scheduleTaskId`, `scheduleTaskTitle` and `scheduleTaskTime`, returned by the area-checklist unit/set responses (null on older sets). The history PDF marks not-done items "Missed".
|
|
8
|
+
|
|
3
9
|
## 4.31.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -281,6 +281,8 @@ type TAreaChecklist = {
|
|
|
281
281
|
attachment?: string[];
|
|
282
282
|
isScheduleTask?: boolean;
|
|
283
283
|
scheduleTaskId?: string | ObjectId;
|
|
284
|
+
scheduleTaskTitle?: string;
|
|
285
|
+
scheduleTaskTime?: string;
|
|
284
286
|
};
|
|
285
287
|
type TAreaChecklistUnits = {
|
|
286
288
|
unit: string | ObjectId;
|
package/dist/index.js
CHANGED
|
@@ -3233,7 +3233,9 @@ var areaChecklistSchema = import_joi9.default.object({
|
|
|
3233
3233
|
}).required()
|
|
3234
3234
|
).min(1).required(),
|
|
3235
3235
|
isScheduleTask: import_joi9.default.boolean().optional().default(false),
|
|
3236
|
-
scheduleTaskId: import_joi9.default.string().hex().optional().allow(null)
|
|
3236
|
+
scheduleTaskId: import_joi9.default.string().hex().optional().allow(null),
|
|
3237
|
+
scheduleTaskTitle: import_joi9.default.string().optional().allow("", null),
|
|
3238
|
+
scheduleTaskTime: import_joi9.default.string().optional().allow("", null)
|
|
3237
3239
|
}).required()
|
|
3238
3240
|
).optional().default([])
|
|
3239
3241
|
});
|
|
@@ -3263,6 +3265,8 @@ function MAreaChecklist(value) {
|
|
|
3263
3265
|
set: checklistItem.set,
|
|
3264
3266
|
isScheduleTask: checklistItem.isScheduleTask ?? false,
|
|
3265
3267
|
scheduleTaskId: checklistItem.scheduleTaskId ?? void 0,
|
|
3268
|
+
scheduleTaskTitle: checklistItem.scheduleTaskTitle ?? void 0,
|
|
3269
|
+
scheduleTaskTime: checklistItem.scheduleTaskTime ?? void 0,
|
|
3266
3270
|
units: checklistItem.units.map((unit) => ({
|
|
3267
3271
|
unit: new import_mongodb8.ObjectId(unit.unit),
|
|
3268
3272
|
name: unit.name,
|
|
@@ -3745,6 +3749,9 @@ function useAreaChecklistRepo() {
|
|
|
3745
3749
|
isScheduleTask: {
|
|
3746
3750
|
$ifNull: ["$checklist.isScheduleTask", false]
|
|
3747
3751
|
},
|
|
3752
|
+
scheduleTaskId: { $ifNull: ["$checklist.scheduleTaskId", null] },
|
|
3753
|
+
scheduleTaskTitle: { $ifNull: ["$checklist.scheduleTaskTitle", null] },
|
|
3754
|
+
scheduleTaskTime: { $ifNull: ["$checklist.scheduleTaskTime", null] },
|
|
3748
3755
|
unit: "$checklist.units.unit",
|
|
3749
3756
|
name: "$checklist.units.name",
|
|
3750
3757
|
approve: "$checklist.units.approve",
|
|
@@ -3781,6 +3788,9 @@ function useAreaChecklistRepo() {
|
|
|
3781
3788
|
$group: {
|
|
3782
3789
|
_id: "$set",
|
|
3783
3790
|
isScheduleTask: { $first: "$isScheduleTask" },
|
|
3791
|
+
scheduleTaskId: { $first: "$scheduleTaskId" },
|
|
3792
|
+
scheduleTaskTitle: { $first: "$scheduleTaskTitle" },
|
|
3793
|
+
scheduleTaskTime: { $first: "$scheduleTaskTime" },
|
|
3784
3794
|
units: {
|
|
3785
3795
|
$push: {
|
|
3786
3796
|
unit: "$unit",
|
|
@@ -3801,6 +3811,9 @@ function useAreaChecklistRepo() {
|
|
|
3801
3811
|
_id: 0,
|
|
3802
3812
|
set: "$_id",
|
|
3803
3813
|
isScheduleTask: 1,
|
|
3814
|
+
scheduleTaskId: 1,
|
|
3815
|
+
scheduleTaskTitle: 1,
|
|
3816
|
+
scheduleTaskTime: 1,
|
|
3804
3817
|
units: 1
|
|
3805
3818
|
}
|
|
3806
3819
|
},
|
|
@@ -3932,6 +3945,8 @@ function useAreaChecklistRepo() {
|
|
|
3932
3945
|
isScheduleTask: {
|
|
3933
3946
|
$ifNull: ["$checklist.isScheduleTask", false]
|
|
3934
3947
|
},
|
|
3948
|
+
scheduleTaskTitle: { $ifNull: ["$checklist.scheduleTaskTitle", null] },
|
|
3949
|
+
scheduleTaskTime: { $ifNull: ["$checklist.scheduleTaskTime", null] },
|
|
3935
3950
|
scheduleTaskId: {
|
|
3936
3951
|
$ifNull: ["$checklist.scheduleTaskId", null]
|
|
3937
3952
|
},
|
|
@@ -3972,6 +3987,8 @@ function useAreaChecklistRepo() {
|
|
|
3972
3987
|
$group: {
|
|
3973
3988
|
_id: "$set",
|
|
3974
3989
|
isScheduleTask: { $first: "$isScheduleTask" },
|
|
3990
|
+
scheduleTaskTitle: { $first: "$scheduleTaskTitle" },
|
|
3991
|
+
scheduleTaskTime: { $first: "$scheduleTaskTime" },
|
|
3975
3992
|
scheduleTaskId: { $first: "$scheduleTaskId" },
|
|
3976
3993
|
remarks: { $first: "$remarks" },
|
|
3977
3994
|
attachment: { $first: "$attachment" },
|
|
@@ -3996,6 +4013,8 @@ function useAreaChecklistRepo() {
|
|
|
3996
4013
|
_id: 0,
|
|
3997
4014
|
set: "$_id",
|
|
3998
4015
|
isScheduleTask: 1,
|
|
4016
|
+
scheduleTaskTitle: 1,
|
|
4017
|
+
scheduleTaskTime: 1,
|
|
3999
4018
|
scheduleTaskId: 1,
|
|
4000
4019
|
remarks: "$remarks",
|
|
4001
4020
|
attachment: "$attachment",
|
|
@@ -4976,6 +4995,8 @@ var import_core11 = require("@7365admin1/core");
|
|
|
4976
4995
|
var import_puppeteer = require("puppeteer");
|
|
4977
4996
|
var import_node_server_utils19 = require("@7365admin1/node-server-utils");
|
|
4978
4997
|
var import_mongodb11 = require("mongodb");
|
|
4998
|
+
|
|
4999
|
+
// src/utils/checklist-pdf-html.util.ts
|
|
4979
5000
|
function escapeHtml(text) {
|
|
4980
5001
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
4981
5002
|
}
|
|
@@ -4988,7 +5009,7 @@ function buildChecklistHtml(areaChecklists) {
|
|
|
4988
5009
|
const unitRows = (setItem.units || []).map(
|
|
4989
5010
|
(unit) => `
|
|
4990
5011
|
<tr>
|
|
4991
|
-
<td class="unit-name">${escapeHtml(unit.name || "")}</td>
|
|
5012
|
+
<td class="unit-name">${escapeHtml(unit.name || "")}${unit.approve || unit.reject ? "" : ' <span class="missed-label">Missed</span>'}</td>
|
|
4992
5013
|
<td class="icon-cell">${unit.reject ? '<span class="reject-icon">✗</span>' : ""}</td>
|
|
4993
5014
|
<td class="icon-cell">${unit.approve ? '<span class="approve-icon">✓</span>' : ""}</td>
|
|
4994
5015
|
</tr>`
|
|
@@ -5125,6 +5146,12 @@ function buildChecklistHtml(areaChecklists) {
|
|
|
5125
5146
|
font-size: 16px;
|
|
5126
5147
|
font-weight: bold;
|
|
5127
5148
|
}
|
|
5149
|
+
.missed-label {
|
|
5150
|
+
color: #b3261e;
|
|
5151
|
+
font-size: 11px;
|
|
5152
|
+
font-weight: bold;
|
|
5153
|
+
margin-left: 6px;
|
|
5154
|
+
}
|
|
5128
5155
|
.reject-icon {
|
|
5129
5156
|
color: #e74c3c;
|
|
5130
5157
|
font-size: 16px;
|
|
@@ -5140,6 +5167,8 @@ function buildChecklistHtml(areaChecklists) {
|
|
|
5140
5167
|
</body>
|
|
5141
5168
|
</html>`;
|
|
5142
5169
|
}
|
|
5170
|
+
|
|
5171
|
+
// src/services/hygiene-checklist-pdf.service.ts
|
|
5143
5172
|
function useChecklistPdfService() {
|
|
5144
5173
|
async function generateChecklistPdf(scheduleId) {
|
|
5145
5174
|
const db = import_node_server_utils19.useAtlas.getDb();
|
|
@@ -7391,6 +7420,18 @@ function useScheduleTaskRepository() {
|
|
|
7391
7420
|
};
|
|
7392
7421
|
}
|
|
7393
7422
|
|
|
7423
|
+
// src/utils/schedule-task-set.util.ts
|
|
7424
|
+
function buildScheduleTaskSets(task, units, startSet, count) {
|
|
7425
|
+
return Array.from({ length: count }, (_, i) => ({
|
|
7426
|
+
set: startSet + i,
|
|
7427
|
+
units,
|
|
7428
|
+
isScheduleTask: true,
|
|
7429
|
+
scheduleTaskId: task._id,
|
|
7430
|
+
scheduleTaskTitle: task.title,
|
|
7431
|
+
scheduleTaskTime: task.time
|
|
7432
|
+
}));
|
|
7433
|
+
}
|
|
7434
|
+
|
|
7394
7435
|
// src/services/hygiene-schedule-task.service.ts
|
|
7395
7436
|
var import_mongodb20 = require("mongodb");
|
|
7396
7437
|
var import_node_server_utils34 = require("@7365admin1/node-server-utils");
|
|
@@ -7536,15 +7577,7 @@ function useScheduleTaskService() {
|
|
|
7536
7577
|
)
|
|
7537
7578
|
) : 0;
|
|
7538
7579
|
const startSetNumber = maxSetInChecklist + 1;
|
|
7539
|
-
const newSets =
|
|
7540
|
-
{ length: areaSetConfig },
|
|
7541
|
-
(_, index) => ({
|
|
7542
|
-
set: startSetNumber + index,
|
|
7543
|
-
units,
|
|
7544
|
-
isScheduleTask: true,
|
|
7545
|
-
scheduleTaskId: scheduleTask._id
|
|
7546
|
-
})
|
|
7547
|
-
);
|
|
7580
|
+
const newSets = buildScheduleTaskSets(scheduleTask, units, startSetNumber, areaSetConfig);
|
|
7548
7581
|
const modified = await pushScheduleTaskSets(
|
|
7549
7582
|
parentChecklistId.toString(),
|
|
7550
7583
|
serviceType,
|
|
@@ -7564,16 +7597,7 @@ function useScheduleTaskService() {
|
|
|
7564
7597
|
}
|
|
7565
7598
|
} else {
|
|
7566
7599
|
const areaSetConfig = Number(areaDetails.set) || 1;
|
|
7567
|
-
const
|
|
7568
|
-
const schedTaskSets = Array.from(
|
|
7569
|
-
{ length: areaSetConfig },
|
|
7570
|
-
(_, index) => ({
|
|
7571
|
-
set: index + 1,
|
|
7572
|
-
units,
|
|
7573
|
-
isScheduleTask: true,
|
|
7574
|
-
scheduleTaskId: schedTaskId
|
|
7575
|
-
})
|
|
7576
|
-
);
|
|
7600
|
+
const schedTaskSets = buildScheduleTaskSets(scheduleTask, units, 1, areaSetConfig);
|
|
7577
7601
|
const checklistData = {
|
|
7578
7602
|
schedule: parentChecklistId.toString(),
|
|
7579
7603
|
serviceType,
|