@7365admin1/core 3.52.3-staging.246 → 3.52.3-staging.247
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/.changeset/csv-import-expiry-timezone.md +18 -0
- package/dist/index.js +84 -93
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +99 -108
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/test/vehicle-import-expiry.test.mjs +84 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@7365admin1/core": patch
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Read the season pass CSV/Excel expiry cell in the site's time zone
|
|
6
|
+
|
|
7
|
+
A spreadsheet cell carries a wall clock and no zone, but every step before the
|
|
8
|
+
import read it as UTC: `Joi.date().iso()` converted the text before the
|
|
9
|
+
controller saw it, ExcelJS turns a date-formatted cell into UTC midnight, and
|
|
10
|
+
`new Date()` on a UTC container did the same. A pass imported as `2026-12-05`
|
|
11
|
+
came back to a Singapore reader as 8am on the 5th, and `2026-12-05T18:45`
|
|
12
|
+
rolled over into the 6th.
|
|
13
|
+
|
|
14
|
+
`parseExpiryDate` now moves to `src/utils/vehicle-import.util.ts` and reads the
|
|
15
|
+
cell in `Asia/Singapore` before storing the instant — the same convention
|
|
16
|
+
`date-format.util.ts`, the patrol logs and the attendance reports already use
|
|
17
|
+
server-side, and the server-side equivalent of the `v-model:utc` binding the
|
|
18
|
+
season pass form uses in the browser.
|
package/dist/index.js
CHANGED
|
@@ -39835,6 +39835,29 @@ var deleteVehicleRequestSchema = import_joi55.default.object({
|
|
|
39835
39835
|
bypass: import_joi55.default.boolean().optional().default(false)
|
|
39836
39836
|
});
|
|
39837
39837
|
|
|
39838
|
+
// src/utils/vehicle-import.util.ts
|
|
39839
|
+
var import_moment_timezone2 = __toESM(require("moment-timezone"));
|
|
39840
|
+
var SITE_TIME_ZONE = "Asia/Singapore";
|
|
39841
|
+
var DEFAULT_YEARS = 10;
|
|
39842
|
+
var CELL_FORMATS = [
|
|
39843
|
+
"YYYY-MM-DDTHH:mm:ss.SSS",
|
|
39844
|
+
"YYYY-MM-DDTHH:mm:ss",
|
|
39845
|
+
"YYYY-MM-DDTHH:mm",
|
|
39846
|
+
"YYYY-MM-DD",
|
|
39847
|
+
"D-MMM-YY"
|
|
39848
|
+
];
|
|
39849
|
+
function parseExpiryDate(value) {
|
|
39850
|
+
if (!value) {
|
|
39851
|
+
return import_moment_timezone2.default.tz(SITE_TIME_ZONE).add(DEFAULT_YEARS, "years").toISOString();
|
|
39852
|
+
}
|
|
39853
|
+
const wallClock = value instanceof Date ? import_moment_timezone2.default.utc(value).format("YYYY-MM-DDTHH:mm:ss") : String(value).trim();
|
|
39854
|
+
if (!wallClock) {
|
|
39855
|
+
return import_moment_timezone2.default.tz(SITE_TIME_ZONE).add(DEFAULT_YEARS, "years").toISOString();
|
|
39856
|
+
}
|
|
39857
|
+
const parsed = import_moment_timezone2.default.tz(wallClock, CELL_FORMATS, SITE_TIME_ZONE);
|
|
39858
|
+
return parsed.isValid() ? parsed.toISOString() : void 0;
|
|
39859
|
+
}
|
|
39860
|
+
|
|
39838
39861
|
// src/controllers/vehicle.controller.ts
|
|
39839
39862
|
var import_exceljs2 = __toESM(require("exceljs"));
|
|
39840
39863
|
var import_csv_parser2 = __toESM(require("csv-parser"));
|
|
@@ -39898,38 +39921,6 @@ function useVehicleController() {
|
|
|
39898
39921
|
end: parseExpiryDate(cleanRow.subscriptionExpiry)
|
|
39899
39922
|
};
|
|
39900
39923
|
}
|
|
39901
|
-
function parseExpiryDate(value) {
|
|
39902
|
-
if (!value) {
|
|
39903
|
-
const today = /* @__PURE__ */ new Date();
|
|
39904
|
-
today.setFullYear(today.getFullYear() + 10);
|
|
39905
|
-
return today.toISOString();
|
|
39906
|
-
}
|
|
39907
|
-
const date = new Date(value);
|
|
39908
|
-
if (!isNaN(date.getTime())) {
|
|
39909
|
-
return date.toISOString();
|
|
39910
|
-
}
|
|
39911
|
-
const [day, monthStr, yearShort] = value.split("-");
|
|
39912
|
-
const months = {
|
|
39913
|
-
Jan: 0,
|
|
39914
|
-
Feb: 1,
|
|
39915
|
-
Mar: 2,
|
|
39916
|
-
Apr: 3,
|
|
39917
|
-
May: 4,
|
|
39918
|
-
Jun: 5,
|
|
39919
|
-
Jul: 6,
|
|
39920
|
-
Aug: 7,
|
|
39921
|
-
Sep: 8,
|
|
39922
|
-
Oct: 9,
|
|
39923
|
-
Nov: 10,
|
|
39924
|
-
Dec: 11
|
|
39925
|
-
};
|
|
39926
|
-
const month = months[monthStr];
|
|
39927
|
-
if (month === void 0)
|
|
39928
|
-
return void 0;
|
|
39929
|
-
const year = 2e3 + Number(yearShort);
|
|
39930
|
-
const fallbackDate = new Date(year, month, Number(day));
|
|
39931
|
-
return isNaN(fallbackDate.getTime()) ? void 0 : fallbackDate.toISOString();
|
|
39932
|
-
}
|
|
39933
39924
|
async function uploadSpreadsheetVehicles(req, res, next) {
|
|
39934
39925
|
try {
|
|
39935
39926
|
if (!req.file) {
|
|
@@ -42054,7 +42045,7 @@ function MAttendance(value) {
|
|
|
42054
42045
|
|
|
42055
42046
|
// src/repositories/attendance.repository.ts
|
|
42056
42047
|
var import_mongodb77 = require("mongodb");
|
|
42057
|
-
var
|
|
42048
|
+
var import_moment_timezone3 = __toESM(require("moment-timezone"));
|
|
42058
42049
|
var import_node_server_utils124 = require("@7365admin1/node-server-utils");
|
|
42059
42050
|
function useAttendanceRepository() {
|
|
42060
42051
|
const db2 = import_node_server_utils124.useAtlas.getDb();
|
|
@@ -42119,11 +42110,11 @@ function useAttendanceRepository() {
|
|
|
42119
42110
|
cacheOptions.search = search;
|
|
42120
42111
|
}
|
|
42121
42112
|
const singaporeTz = "Asia/Singapore";
|
|
42122
|
-
const normalizedStartDate = typeof startDate === "string" ? startDate : (0,
|
|
42123
|
-
const normalizedEndDate = typeof endDate === "string" ? endDate : (0,
|
|
42113
|
+
const normalizedStartDate = typeof startDate === "string" ? startDate : (0, import_moment_timezone3.default)(startDate).tz(singaporeTz).format("YYYY-MM-DD");
|
|
42114
|
+
const normalizedEndDate = typeof endDate === "string" ? endDate : (0, import_moment_timezone3.default)(endDate).tz(singaporeTz).format("YYYY-MM-DD");
|
|
42124
42115
|
if (startDate && endDate) {
|
|
42125
|
-
const startOfDay =
|
|
42126
|
-
const endOfDay =
|
|
42116
|
+
const startOfDay = import_moment_timezone3.default.tz(normalizedStartDate, "YYYY-MM-DD", singaporeTz).startOf("day").toDate();
|
|
42117
|
+
const endOfDay = import_moment_timezone3.default.tz(normalizedEndDate, "YYYY-MM-DD", singaporeTz).endOf("day").toDate();
|
|
42127
42118
|
query2.$expr = {
|
|
42128
42119
|
$and: [
|
|
42129
42120
|
{ $gte: [{ $toDate: "$checkIn.timestamp" }, startOfDay] },
|
|
@@ -42136,7 +42127,7 @@ function useAttendanceRepository() {
|
|
|
42136
42127
|
query2.$expr = {
|
|
42137
42128
|
$gte: [
|
|
42138
42129
|
{ $toDate: "$checkIn.timestamp" },
|
|
42139
|
-
|
|
42130
|
+
import_moment_timezone3.default.tz(normalizedStartDate, "YYYY-MM-DD", singaporeTz).startOf("day").toDate()
|
|
42140
42131
|
]
|
|
42141
42132
|
};
|
|
42142
42133
|
cacheOptions.startDate = normalizedStartDate;
|
|
@@ -42144,7 +42135,7 @@ function useAttendanceRepository() {
|
|
|
42144
42135
|
query2.$expr = {
|
|
42145
42136
|
$lte: [
|
|
42146
42137
|
{ $toDate: "$checkIn.timestamp" },
|
|
42147
|
-
|
|
42138
|
+
import_moment_timezone3.default.tz(normalizedEndDate, "YYYY-MM-DD", singaporeTz).endOf("day").toDate()
|
|
42148
42139
|
]
|
|
42149
42140
|
};
|
|
42150
42141
|
cacheOptions.endDate = normalizedEndDate;
|
|
@@ -42257,11 +42248,11 @@ function useAttendanceRepository() {
|
|
|
42257
42248
|
cacheOptions.search = search;
|
|
42258
42249
|
}
|
|
42259
42250
|
const singaporeTz = "Asia/Singapore";
|
|
42260
|
-
const normalizedStartDate = typeof startDate === "string" ? startDate : (0,
|
|
42261
|
-
const normalizedEndDate = typeof endDate === "string" ? endDate : (0,
|
|
42251
|
+
const normalizedStartDate = typeof startDate === "string" ? startDate : (0, import_moment_timezone3.default)(startDate).tz(singaporeTz).format("YYYY-MM-DD");
|
|
42252
|
+
const normalizedEndDate = typeof endDate === "string" ? endDate : (0, import_moment_timezone3.default)(endDate).tz(singaporeTz).format("YYYY-MM-DD");
|
|
42262
42253
|
if (startDate && endDate) {
|
|
42263
|
-
const startOfDay =
|
|
42264
|
-
const endOfDay =
|
|
42254
|
+
const startOfDay = import_moment_timezone3.default.tz(normalizedStartDate, "YYYY-MM-DD", singaporeTz).startOf("day").toDate();
|
|
42255
|
+
const endOfDay = import_moment_timezone3.default.tz(normalizedEndDate, "YYYY-MM-DD", singaporeTz).endOf("day").toDate();
|
|
42265
42256
|
query2.$expr = {
|
|
42266
42257
|
$and: [
|
|
42267
42258
|
{ $gte: [{ $toDate: "$checkIn.timestamp" }, startOfDay] },
|
|
@@ -42274,7 +42265,7 @@ function useAttendanceRepository() {
|
|
|
42274
42265
|
query2.$expr = {
|
|
42275
42266
|
$gte: [
|
|
42276
42267
|
{ $toDate: "$checkIn.timestamp" },
|
|
42277
|
-
|
|
42268
|
+
import_moment_timezone3.default.tz(normalizedStartDate, "YYYY-MM-DD", singaporeTz).startOf("day").toDate()
|
|
42278
42269
|
]
|
|
42279
42270
|
};
|
|
42280
42271
|
cacheOptions.startDate = normalizedStartDate;
|
|
@@ -42282,7 +42273,7 @@ function useAttendanceRepository() {
|
|
|
42282
42273
|
query2.$expr = {
|
|
42283
42274
|
$lte: [
|
|
42284
42275
|
{ $toDate: "$checkIn.timestamp" },
|
|
42285
|
-
|
|
42276
|
+
import_moment_timezone3.default.tz(normalizedEndDate, "YYYY-MM-DD", singaporeTz).endOf("day").toDate()
|
|
42286
42277
|
]
|
|
42287
42278
|
};
|
|
42288
42279
|
cacheOptions.endDate = normalizedEndDate;
|
|
@@ -52150,7 +52141,7 @@ function useVisitorTransactionService() {
|
|
|
52150
52141
|
|
|
52151
52142
|
// src/controllers/visitor-transaction.controller.ts
|
|
52152
52143
|
var import_joi67 = __toESM(require("joi"));
|
|
52153
|
-
var
|
|
52144
|
+
var import_moment_timezone4 = __toESM(require("moment-timezone"));
|
|
52154
52145
|
var import_mongodb88 = require("mongodb");
|
|
52155
52146
|
var import_node_server_utils137 = require("@7365admin1/node-server-utils");
|
|
52156
52147
|
|
|
@@ -56226,7 +56217,7 @@ async function sendSelfServicePassEmail(record, occasion, remarks) {
|
|
|
56226
56217
|
if (!to)
|
|
56227
56218
|
return;
|
|
56228
56219
|
const previewLink = `${APP_PROPERTY_MANAGEMENT}/public-view/visitor-onboarding/pass/${String(record._id ?? "")}`;
|
|
56229
|
-
const arrivalDate = record.expectedCheckIn ? (0,
|
|
56220
|
+
const arrivalDate = record.expectedCheckIn ? (0, import_moment_timezone4.default)(record.expectedCheckIn).format("DD/MM/YYYY") : "N/A";
|
|
56230
56221
|
const html = occasion === "rejected" ? compile_handlebars_default({
|
|
56231
56222
|
handlebar: "self-service-visitor-rejected",
|
|
56232
56223
|
context: {
|
|
@@ -77175,7 +77166,7 @@ var import_mongodb147 = require("mongodb");
|
|
|
77175
77166
|
var import_moment = __toESM(require("moment"));
|
|
77176
77167
|
|
|
77177
77168
|
// src/utils/dashboard-metrics.util.ts
|
|
77178
|
-
var
|
|
77169
|
+
var import_moment_timezone5 = __toESM(require("moment-timezone"));
|
|
77179
77170
|
var DASHBOARD_TIMEZONE = "Asia/Singapore";
|
|
77180
77171
|
var PERIOD_UNITS = {
|
|
77181
77172
|
thisWeek: { boundary: "isoWeek", step: "week" },
|
|
@@ -77186,7 +77177,7 @@ function unitsOf(period) {
|
|
|
77186
77177
|
return PERIOD_UNITS[period] ?? DAY_UNIT;
|
|
77187
77178
|
}
|
|
77188
77179
|
function at(now) {
|
|
77189
|
-
return now === void 0 || now === null ?
|
|
77180
|
+
return now === void 0 || now === null ? import_moment_timezone5.default.tz(DASHBOARD_TIMEZONE) : import_moment_timezone5.default.tz(now, DASHBOARD_TIMEZONE);
|
|
77190
77181
|
}
|
|
77191
77182
|
function getPeriodRange(period, now) {
|
|
77192
77183
|
const { boundary } = unitsOf(period);
|
|
@@ -78920,7 +78911,7 @@ var import_node_server_utils238 = require("@7365admin1/node-server-utils");
|
|
|
78920
78911
|
|
|
78921
78912
|
// src/utils/hrmlabs-attendance.util.ts
|
|
78922
78913
|
var import_axios3 = __toESM(require("axios"));
|
|
78923
|
-
var
|
|
78914
|
+
var import_moment_timezone6 = __toESM(require("moment-timezone"));
|
|
78924
78915
|
var default_early_checkIn = 4;
|
|
78925
78916
|
async function hrmLabsAuthentication({
|
|
78926
78917
|
authUrl,
|
|
@@ -78992,13 +78983,13 @@ function filterByShiftTime(attendance, shiftData, timezone, format2) {
|
|
|
78992
78983
|
return attendance.filter((item) => {
|
|
78993
78984
|
if (!item.checkIn)
|
|
78994
78985
|
return false;
|
|
78995
|
-
const checkInLocal = (0,
|
|
78986
|
+
const checkInLocal = (0, import_moment_timezone6.default)(item.checkIn, format2);
|
|
78996
78987
|
if (!checkInLocal.isValid())
|
|
78997
78988
|
return false;
|
|
78998
78989
|
const [startHour, startMinute] = shiftData.checkIn.split(":").map(Number);
|
|
78999
78990
|
const [endHour, endMinute] = shiftData.checkOut.split(":").map(Number);
|
|
79000
|
-
const shiftStart = (0,
|
|
79001
|
-
const shiftEnd = (0,
|
|
78991
|
+
const shiftStart = (0, import_moment_timezone6.default)(checkInLocal).set({ hour: startHour, minute: startMinute, second: 0, millisecond: 0 }).subtract(default_early_checkIn, "hour");
|
|
78992
|
+
const shiftEnd = (0, import_moment_timezone6.default)(checkInLocal).set({
|
|
79002
78993
|
hour: endHour,
|
|
79003
78994
|
minute: endMinute,
|
|
79004
78995
|
second: 0,
|
|
@@ -79090,18 +79081,18 @@ function totalCountPerShift(attendance, shiftData, timezone, format2) {
|
|
|
79090
79081
|
data = uniqueAttendanceData.filter((item) => {
|
|
79091
79082
|
if (!item.checkIn)
|
|
79092
79083
|
return false;
|
|
79093
|
-
const checkInLocal = (0,
|
|
79084
|
+
const checkInLocal = (0, import_moment_timezone6.default)(item.checkIn, format2);
|
|
79094
79085
|
if (!checkInLocal.isValid())
|
|
79095
79086
|
return false;
|
|
79096
79087
|
const [startHour, startMinute] = shift.checkIn.split(":").map(Number);
|
|
79097
79088
|
const [endHour, endMinute] = shift.checkOut.split(":").map(Number);
|
|
79098
|
-
const shiftStart = (0,
|
|
79089
|
+
const shiftStart = (0, import_moment_timezone6.default)(checkInLocal).set({
|
|
79099
79090
|
hour: startHour,
|
|
79100
79091
|
minute: startMinute,
|
|
79101
79092
|
second: 0,
|
|
79102
79093
|
millisecond: 0
|
|
79103
79094
|
}).subtract(default_early_checkIn, "hour");
|
|
79104
|
-
const shiftEnd = (0,
|
|
79095
|
+
const shiftEnd = (0, import_moment_timezone6.default)(checkInLocal).set({
|
|
79105
79096
|
hour: endHour,
|
|
79106
79097
|
minute: endMinute,
|
|
79107
79098
|
second: 0,
|
|
@@ -79131,11 +79122,11 @@ function filterByStatus(attendance, shiftData, timezone, format2, status) {
|
|
|
79131
79122
|
return attendance.filter((item) => {
|
|
79132
79123
|
if (!item.checkIn)
|
|
79133
79124
|
return false;
|
|
79134
|
-
const checkInLocal = (0,
|
|
79125
|
+
const checkInLocal = (0, import_moment_timezone6.default)(item.checkIn, format2);
|
|
79135
79126
|
if (!checkInLocal.isValid())
|
|
79136
79127
|
return false;
|
|
79137
79128
|
const [lateHour, lateMinute] = shiftData.lateCheckInAlert.split(":").map(Number);
|
|
79138
|
-
const lateLoginTime = (0,
|
|
79129
|
+
const lateLoginTime = (0, import_moment_timezone6.default)(checkInLocal).set({
|
|
79139
79130
|
hour: lateHour,
|
|
79140
79131
|
minute: lateMinute,
|
|
79141
79132
|
second: 0,
|
|
@@ -79207,14 +79198,14 @@ async function totalCountPerStatus(attendance, shiftName, shiftData, timezone, f
|
|
|
79207
79198
|
} = item;
|
|
79208
79199
|
if (!checkInStr || seenGlobal.has(identificationNumber))
|
|
79209
79200
|
continue;
|
|
79210
|
-
const checkIn = (0,
|
|
79211
|
-
const checkOut = checkOutStr ? (0,
|
|
79212
|
-
const checkOutChecker = checkOut ? (0,
|
|
79201
|
+
const checkIn = (0, import_moment_timezone6.default)(checkInStr, format2);
|
|
79202
|
+
const checkOut = checkOutStr ? (0, import_moment_timezone6.default)(checkOutStr, format2) : null;
|
|
79203
|
+
const checkOutChecker = checkOut ? (0, import_moment_timezone6.default)(checkOutStr, format2) : checkIn;
|
|
79213
79204
|
if (!checkIn.isValid())
|
|
79214
79205
|
continue;
|
|
79215
|
-
const shiftStart = (0,
|
|
79216
|
-
const shiftEnd = (0,
|
|
79217
|
-
const lateCheckIn = (0,
|
|
79206
|
+
const shiftStart = (0, import_moment_timezone6.default)(checkIn).set({ ...shiftStartTime, second: 59, millisecond: 59 }).subtract(default_early_checkIn, "hour");
|
|
79207
|
+
const shiftEnd = (0, import_moment_timezone6.default)(checkOutChecker).set({ ...shiftEndTime, second: 0, millisecond: 0 }).subtract(default_early_checkIn, "hour");
|
|
79208
|
+
const lateCheckIn = (0, import_moment_timezone6.default)(checkIn).set({
|
|
79218
79209
|
...lateTime,
|
|
79219
79210
|
second: 59,
|
|
79220
79211
|
millisecond: 59
|
|
@@ -79252,8 +79243,8 @@ async function chartCountData(attendance, shiftData, timezone, format2, totalShi
|
|
|
79252
79243
|
const [hour, minute] = timeStr.split(":").map(Number);
|
|
79253
79244
|
return { hour, minute };
|
|
79254
79245
|
};
|
|
79255
|
-
const startDate = (0,
|
|
79256
|
-
const endDate = (0,
|
|
79246
|
+
const startDate = (0, import_moment_timezone6.default)(startDateStr, "DD-MM-YYYY");
|
|
79247
|
+
const endDate = (0, import_moment_timezone6.default)(endDateStr, "DD-MM-YYYY");
|
|
79257
79248
|
const daysInRange = [];
|
|
79258
79249
|
for (let day = startDate.clone(); day.isSameOrBefore(endDate); day.add(1, "day")) {
|
|
79259
79250
|
daysInRange.push(day.format("DD-MM-YYYY"));
|
|
@@ -79324,7 +79315,7 @@ async function chartCountData(attendance, shiftData, timezone, format2, totalShi
|
|
|
79324
79315
|
} = item;
|
|
79325
79316
|
if (!checkInStr)
|
|
79326
79317
|
continue;
|
|
79327
|
-
const checkIn = (0,
|
|
79318
|
+
const checkIn = (0, import_moment_timezone6.default)(checkInStr, format2);
|
|
79328
79319
|
if (!checkIn.isValid())
|
|
79329
79320
|
continue;
|
|
79330
79321
|
const dayKey = `${identificationNumber}-${checkIn.format(
|
|
@@ -79333,10 +79324,10 @@ async function chartCountData(attendance, shiftData, timezone, format2, totalShi
|
|
|
79333
79324
|
if (seenPerDay.has(dayKey))
|
|
79334
79325
|
continue;
|
|
79335
79326
|
seenPerDay.add(dayKey);
|
|
79336
|
-
const checkOut = checkOutStr ? (0,
|
|
79337
|
-
const shiftStart = (0,
|
|
79338
|
-
const shiftEnd = (0,
|
|
79339
|
-
const lateCheckIn = (0,
|
|
79327
|
+
const checkOut = checkOutStr ? (0, import_moment_timezone6.default)(checkOutStr, format2) : checkIn;
|
|
79328
|
+
const shiftStart = (0, import_moment_timezone6.default)(checkIn).set({ ...shiftStartTime, second: 59, millisecond: 59 }).subtract(default_early_checkIn, "hour");
|
|
79329
|
+
const shiftEnd = (0, import_moment_timezone6.default)(checkOut).set({ ...shiftEndTime, second: 0, millisecond: 0 }).subtract(default_early_checkIn, "hour");
|
|
79330
|
+
const lateCheckIn = (0, import_moment_timezone6.default)(checkIn).set({
|
|
79340
79331
|
...lateTime,
|
|
79341
79332
|
second: 59,
|
|
79342
79333
|
millisecond: 59
|
|
@@ -79639,7 +79630,7 @@ var MManpowerRemarks = class {
|
|
|
79639
79630
|
|
|
79640
79631
|
// src/repositories/manpower-remarks.repo.ts
|
|
79641
79632
|
var import_mongodb151 = require("mongodb");
|
|
79642
|
-
var
|
|
79633
|
+
var import_moment_timezone7 = __toESM(require("moment-timezone"));
|
|
79643
79634
|
function useManpowerRemarksRepo() {
|
|
79644
79635
|
const db2 = import_node_server_utils239.useAtlas.getDb();
|
|
79645
79636
|
if (!db2) {
|
|
@@ -79693,7 +79684,7 @@ function useManpowerRemarksRepo() {
|
|
|
79693
79684
|
page = page ? page - 1 : 0;
|
|
79694
79685
|
limit = limit || 10;
|
|
79695
79686
|
const searchQuery = {};
|
|
79696
|
-
const nowSGT = (0,
|
|
79687
|
+
const nowSGT = (0, import_moment_timezone7.default)().tz("Asia/Singapore");
|
|
79697
79688
|
searchQuery.serviceProviderId = new import_mongodb151.ObjectId(serviceProviderId);
|
|
79698
79689
|
if (search != "") {
|
|
79699
79690
|
searchQuery.siteName = { $regex: search, $options: "i" };
|
|
@@ -79805,7 +79796,7 @@ function useManpowerRemarksRepo() {
|
|
|
79805
79796
|
}
|
|
79806
79797
|
|
|
79807
79798
|
// src/services/manpower-monitoring.service.ts
|
|
79808
|
-
var
|
|
79799
|
+
var import_moment_timezone8 = __toESM(require("moment-timezone"));
|
|
79809
79800
|
function useManpowerMonitoringSrvc() {
|
|
79810
79801
|
const {
|
|
79811
79802
|
createManpowerMonitoringSettings: _createManpowerMonitoringSettings
|
|
@@ -79823,10 +79814,10 @@ function useManpowerMonitoringSrvc() {
|
|
|
79823
79814
|
const morningAlertFrequencyMins = payload?.shifts?.[payload.shiftType][0]?.alertFrequencyMins;
|
|
79824
79815
|
const afternoonAlertFrequencyMins = payload.shiftType == "3-shifts" ? payload?.shifts?.[payload.shiftType][1]?.alertFrequencyMins : null;
|
|
79825
79816
|
const nightAlertFrequencyMins = payload.shiftType == "3-shifts" ? payload?.shifts?.[payload.shiftType][2]?.alertFrequencyMins : payload?.shifts?.[payload.shiftType][1]?.alertFrequencyMins;
|
|
79826
|
-
const morningAlertTime =
|
|
79827
|
-
const afternoonAlertTime = afternoonCheckInTime ?
|
|
79828
|
-
const nightAlertTime =
|
|
79829
|
-
const nowSGT = (0,
|
|
79817
|
+
const morningAlertTime = import_moment_timezone8.default.tz(morningCheckInTime, "HH:mm", "Asia/Singapore").add(morningAlertFrequencyMins, "minutes").format("HH:mm");
|
|
79818
|
+
const afternoonAlertTime = afternoonCheckInTime ? import_moment_timezone8.default.tz(afternoonCheckInTime, "HH:mm", "Asia/Singapore").add(afternoonAlertFrequencyMins, "minutes").format("HH:mm") : "";
|
|
79819
|
+
const nightAlertTime = import_moment_timezone8.default.tz(nightCheckInTime, "HH:mm", "Asia/Singapore").add(nightAlertFrequencyMins, "minutes").format("HH:mm");
|
|
79820
|
+
const nowSGT = (0, import_moment_timezone8.default)().tz("Asia/Singapore");
|
|
79830
79821
|
try {
|
|
79831
79822
|
const remarksPayload = {
|
|
79832
79823
|
siteId: payload.siteId,
|
|
@@ -82198,7 +82189,7 @@ function useManpowerSitesCtrl() {
|
|
|
82198
82189
|
// src/utils/cron.util.ts
|
|
82199
82190
|
var import_node_server_utils256 = require("@7365admin1/node-server-utils");
|
|
82200
82191
|
var import_mongodb156 = require("mongodb");
|
|
82201
|
-
var
|
|
82192
|
+
var import_moment_timezone9 = __toESM(require("moment-timezone"));
|
|
82202
82193
|
var createManpowerRemarksDaily = async () => {
|
|
82203
82194
|
const db2 = import_node_server_utils256.useAtlas.getDb();
|
|
82204
82195
|
if (!db2) {
|
|
@@ -82209,9 +82200,9 @@ var createManpowerRemarksDaily = async () => {
|
|
|
82209
82200
|
const remarks = db2.collection("manpower-remarks");
|
|
82210
82201
|
const serviceProviders = db2.collection("site.service-providers");
|
|
82211
82202
|
const items = [];
|
|
82212
|
-
const yesterday = (0,
|
|
82203
|
+
const yesterday = (0, import_moment_timezone9.default)().tz("Asia/Singapore").subtract(1, "days").format("DD-MM-YYYY");
|
|
82213
82204
|
try {
|
|
82214
|
-
const nowSGT = (0,
|
|
82205
|
+
const nowSGT = (0, import_moment_timezone9.default)().tz("Asia/Singapore");
|
|
82215
82206
|
const servideProvider = await serviceProviders.findOne({
|
|
82216
82207
|
name: { $regex: process.env.HRMLABS_DOMAIN, $options: "i" }
|
|
82217
82208
|
});
|
|
@@ -82249,9 +82240,9 @@ var createManpowerRemarksDaily = async () => {
|
|
|
82249
82240
|
const morningAlertFrequencyMins = setting?.shifts?.[shiftType][0]?.alertFrequencyMins;
|
|
82250
82241
|
const afternoonAlertFrequencyMins = shiftType == "3-shifts" ? setting?.shifts?.[shiftType][1]?.alertFrequencyMins : null;
|
|
82251
82242
|
const nightAlertFrequencyMins = shiftType == "3-shifts" ? setting?.shifts?.[shiftType][2]?.alertFrequencyMins : setting?.shifts?.[shiftType][1]?.alertFrequencyMins;
|
|
82252
|
-
const morningAlertTime =
|
|
82253
|
-
const afternoonAlertTime = afternoonCheckInTime ?
|
|
82254
|
-
const nightAlertTime =
|
|
82243
|
+
const morningAlertTime = import_moment_timezone9.default.tz(morningCheckInTime, "HH:mm", "Asia/Singapore").add(morningAlertFrequencyMins, "minutes").format("HH:mm");
|
|
82244
|
+
const afternoonAlertTime = afternoonCheckInTime ? import_moment_timezone9.default.tz(afternoonCheckInTime, "HH:mm", "Asia/Singapore").add(afternoonAlertFrequencyMins, "minutes").format("HH:mm") : "";
|
|
82245
|
+
const nightAlertTime = import_moment_timezone9.default.tz(nightCheckInTime, "HH:mm", "Asia/Singapore").add(nightAlertFrequencyMins, "minutes").format("HH:mm");
|
|
82255
82246
|
const remark2 = {
|
|
82256
82247
|
siteId: site.siteId,
|
|
82257
82248
|
siteName: site.siteName,
|
|
@@ -82308,14 +82299,14 @@ var createManpowerRemarksDaily = async () => {
|
|
|
82308
82299
|
};
|
|
82309
82300
|
var updateRemarksisAcknowledged = async () => {
|
|
82310
82301
|
const { getAttendanceDataCount: _getAttendanceDataCount } = useHrmLabsAttendanceSrvc();
|
|
82311
|
-
const nowSGT = (0,
|
|
82302
|
+
const nowSGT = (0, import_moment_timezone9.default)().tz("Asia/Singapore").format("DD-MM-YYYY");
|
|
82312
82303
|
const db2 = import_node_server_utils256.useAtlas.getDb();
|
|
82313
82304
|
if (!db2) {
|
|
82314
82305
|
throw new Error("Unable to connect to server.");
|
|
82315
82306
|
}
|
|
82316
82307
|
const namespace_collection = "manpower-remarks";
|
|
82317
82308
|
const remarks = db2.collection(namespace_collection);
|
|
82318
|
-
const timeNow = (0,
|
|
82309
|
+
const timeNow = (0, import_moment_timezone9.default)().tz("Asia/Singapore").format("HH:mm");
|
|
82319
82310
|
const settings = db2.collection("manpower-settings");
|
|
82320
82311
|
try {
|
|
82321
82312
|
const matchingDocs = await remarks.find({
|
|
@@ -82443,9 +82434,9 @@ var updateRemarksStatusEod = async () => {
|
|
|
82443
82434
|
}
|
|
82444
82435
|
const remarks = db2.collection("manpower-remarks");
|
|
82445
82436
|
const settings = db2.collection("manpower-settings");
|
|
82446
|
-
const nowSGT = (0,
|
|
82447
|
-
const yesterdaySGT = (0,
|
|
82448
|
-
const timeNow = (0,
|
|
82437
|
+
const nowSGT = (0, import_moment_timezone9.default)().tz("Asia/Singapore").format("DD-MM-YYYY");
|
|
82438
|
+
const yesterdaySGT = (0, import_moment_timezone9.default)().tz("Asia/Singapore").subtract(1, "days").format("DD-MM-YYYY");
|
|
82439
|
+
const timeNow = (0, import_moment_timezone9.default)().tz("Asia/Singapore").format("HH:mm");
|
|
82449
82440
|
const docs = await remarks.find({
|
|
82450
82441
|
$or: [
|
|
82451
82442
|
// Morning & Afternoon from today
|
|
@@ -82581,7 +82572,7 @@ var isWithinHour = (alertTime, timeNow) => {
|
|
|
82581
82572
|
// src/events/manpower.event.ts
|
|
82582
82573
|
var import_node_server_utils257 = require("@7365admin1/node-server-utils");
|
|
82583
82574
|
var import_mongodb157 = require("mongodb");
|
|
82584
|
-
var
|
|
82575
|
+
var import_moment_timezone10 = __toESM(require("moment-timezone"));
|
|
82585
82576
|
async function manpowerEvents(io) {
|
|
82586
82577
|
let intervalId = null;
|
|
82587
82578
|
let activeConnections = 0;
|
|
@@ -82593,9 +82584,9 @@ async function manpowerEvents(io) {
|
|
|
82593
82584
|
}
|
|
82594
82585
|
const remarks = db2.collection("manpower-remarks");
|
|
82595
82586
|
const settings = db2.collection("manpower-settings");
|
|
82596
|
-
const selectedDateMoment =
|
|
82587
|
+
const selectedDateMoment = import_moment_timezone10.default.tz(date, "DD-MM-YYYY", "Asia/Singapore");
|
|
82597
82588
|
const selectedDateSGT = selectedDateMoment.format("DD-MM-YYYY");
|
|
82598
|
-
const currentSGT = (0,
|
|
82589
|
+
const currentSGT = (0, import_moment_timezone10.default)().tz("Asia/Singapore");
|
|
82599
82590
|
const docs = await remarks.find({
|
|
82600
82591
|
createdAtSGT: selectedDateSGT,
|
|
82601
82592
|
$or: [
|
|
@@ -82617,7 +82608,7 @@ async function manpowerEvents(io) {
|
|
|
82617
82608
|
}
|
|
82618
82609
|
if (currentSGT.isSame(selectedDateMoment, "day")) {
|
|
82619
82610
|
if (currentSGT.isSameOrAfter(
|
|
82620
|
-
|
|
82611
|
+
import_moment_timezone10.default.tz("19:55", "HH:mm", "Asia/Singapore")
|
|
82621
82612
|
)) {
|
|
82622
82613
|
shiftsToCheck.push({ index: 2, key: "nightShift" });
|
|
82623
82614
|
}
|