@7365admin1/core 3.32.2-staging.33 → 3.32.2-staging.35
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/index.d.ts +2 -2
- package/dist/index.js +85 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2627,8 +2627,8 @@ type TGetAttendancesQuery = {
|
|
|
2627
2627
|
page?: number;
|
|
2628
2628
|
limit?: number;
|
|
2629
2629
|
search?: string;
|
|
2630
|
-
startDate?: string;
|
|
2631
|
-
endDate?: string;
|
|
2630
|
+
startDate?: string | Date;
|
|
2631
|
+
endDate?: string | Date;
|
|
2632
2632
|
} & Pick<TAttendance, "site" | "serviceType">;
|
|
2633
2633
|
type TGetAttendancesByUserQuery = Pick<TGetAttendancesQuery, "page" | "limit" | "search" | "site" | "serviceType" | "startDate" | "endDate"> & Pick<TAttendance, "user">;
|
|
2634
2634
|
declare const attendanceSchema: Joi.ObjectSchema<any>;
|
package/dist/index.js
CHANGED
|
@@ -25328,9 +25328,9 @@ function usePersonRepo() {
|
|
|
25328
25328
|
{ email: { $regex: search, $options: "i" } },
|
|
25329
25329
|
{ nric: { $regex: search, $options: "i" } },
|
|
25330
25330
|
{ "plates.plateNumber": { $regex: search, $options: "i" } },
|
|
25331
|
-
{ contact: { $regex: makeContainsRegex(
|
|
25332
|
-
{ contacts: { $regex: makeContainsRegex(
|
|
25333
|
-
{ plateNumbers: { $regex: makeContainsRegex(
|
|
25331
|
+
{ contact: { $regex: makeContainsRegex(search) } },
|
|
25332
|
+
{ contacts: { $regex: makeContainsRegex(search) } },
|
|
25333
|
+
{ plateNumbers: { $regex: makeContainsRegex(search) } }
|
|
25334
25334
|
]
|
|
25335
25335
|
},
|
|
25336
25336
|
...import_mongodb45.ObjectId.isValid(org) && { org: new import_mongodb45.ObjectId(org) },
|
|
@@ -33099,7 +33099,7 @@ function MAttendance(value) {
|
|
|
33099
33099
|
|
|
33100
33100
|
// src/repositories/attendance.repository.ts
|
|
33101
33101
|
var import_mongodb60 = require("mongodb");
|
|
33102
|
-
var
|
|
33102
|
+
var import_moment_timezone2 = __toESM(require("moment-timezone"));
|
|
33103
33103
|
var import_node_server_utils103 = require("@7365admin1/node-server-utils");
|
|
33104
33104
|
function useAttendanceRepository() {
|
|
33105
33105
|
const db = import_node_server_utils103.useAtlas.getDb();
|
|
@@ -33269,11 +33269,11 @@ function useAttendanceRepository() {
|
|
|
33269
33269
|
cacheOptions.search = search;
|
|
33270
33270
|
}
|
|
33271
33271
|
const singaporeTz = "Asia/Singapore";
|
|
33272
|
-
const normalizedStartDate = typeof startDate === "string" ? startDate : (0,
|
|
33273
|
-
const normalizedEndDate = typeof endDate === "string" ? endDate : (0,
|
|
33272
|
+
const normalizedStartDate = typeof startDate === "string" ? startDate : (0, import_moment_timezone2.default)(startDate).tz(singaporeTz).format("YYYY-MM-DD");
|
|
33273
|
+
const normalizedEndDate = typeof endDate === "string" ? endDate : (0, import_moment_timezone2.default)(endDate).tz(singaporeTz).format("YYYY-MM-DD");
|
|
33274
33274
|
if (startDate && endDate) {
|
|
33275
|
-
const startOfDay =
|
|
33276
|
-
const endOfDay =
|
|
33275
|
+
const startOfDay = import_moment_timezone2.default.tz(normalizedStartDate, "YYYY-MM-DD", singaporeTz).startOf("day").toDate();
|
|
33276
|
+
const endOfDay = import_moment_timezone2.default.tz(normalizedEndDate, "YYYY-MM-DD", singaporeTz).endOf("day").toDate();
|
|
33277
33277
|
query.$expr = {
|
|
33278
33278
|
$and: [
|
|
33279
33279
|
{ $gte: [{ $toDate: "$checkIn.timestamp" }, startOfDay] },
|
|
@@ -33286,7 +33286,7 @@ function useAttendanceRepository() {
|
|
|
33286
33286
|
query.$expr = {
|
|
33287
33287
|
$gte: [
|
|
33288
33288
|
{ $toDate: "$checkIn.timestamp" },
|
|
33289
|
-
|
|
33289
|
+
import_moment_timezone2.default.tz(normalizedStartDate, "YYYY-MM-DD", singaporeTz).startOf("day").toDate()
|
|
33290
33290
|
]
|
|
33291
33291
|
};
|
|
33292
33292
|
cacheOptions.startDate = normalizedStartDate;
|
|
@@ -33294,7 +33294,7 @@ function useAttendanceRepository() {
|
|
|
33294
33294
|
query.$expr = {
|
|
33295
33295
|
$lte: [
|
|
33296
33296
|
{ $toDate: "$checkIn.timestamp" },
|
|
33297
|
-
|
|
33297
|
+
import_moment_timezone2.default.tz(normalizedEndDate, "YYYY-MM-DD", singaporeTz).endOf("day").toDate()
|
|
33298
33298
|
]
|
|
33299
33299
|
};
|
|
33300
33300
|
cacheOptions.endDate = normalizedEndDate;
|
|
@@ -35702,7 +35702,7 @@ function useVisitorTransactionService() {
|
|
|
35702
35702
|
value.unitName = unit?.name;
|
|
35703
35703
|
}
|
|
35704
35704
|
const { nric = "", name = "", contact = "", plateNumber = "", email = "", site = "", type = "guest", company, createdBy } = value;
|
|
35705
|
-
if (/^(guest|walk-in|contractor|delivery)$/.test(type)) {
|
|
35705
|
+
if (/^(guest|walk-in|contractor|delivery)$/.test(type) && site) {
|
|
35706
35706
|
await addUpdateFromVisitor({
|
|
35707
35707
|
nric,
|
|
35708
35708
|
name,
|
|
@@ -35933,7 +35933,7 @@ function useVisitorTransactionService() {
|
|
|
35933
35933
|
value.checkIn = isNaN(parsed.getTime()) ? null : parsed;
|
|
35934
35934
|
}
|
|
35935
35935
|
const { nric = "", name = "", contact = "", plateNumber = "", email = "", site = "", type = "guest", company, createdBy } = value;
|
|
35936
|
-
if (/^(guest|walk-in|contractor|delivery)$/.test(type) &&
|
|
35936
|
+
if (/^(guest|walk-in|contractor|delivery)$/.test(type) && site) {
|
|
35937
35937
|
await addUpdateFromVisitor({
|
|
35938
35938
|
nric,
|
|
35939
35939
|
name,
|
|
@@ -36117,7 +36117,9 @@ function useVisitorTransactionService() {
|
|
|
36117
36117
|
value.site,
|
|
36118
36118
|
session,
|
|
36119
36119
|
void 0,
|
|
36120
|
-
id
|
|
36120
|
+
id,
|
|
36121
|
+
void 0,
|
|
36122
|
+
true
|
|
36121
36123
|
);
|
|
36122
36124
|
item.receivedDate = /* @__PURE__ */ new Date();
|
|
36123
36125
|
item.status = "Not Returned" /* NOT_RETURNED */;
|
|
@@ -36166,7 +36168,9 @@ function useVisitorTransactionService() {
|
|
|
36166
36168
|
value.site,
|
|
36167
36169
|
session,
|
|
36168
36170
|
void 0,
|
|
36169
|
-
id
|
|
36171
|
+
id,
|
|
36172
|
+
void 0,
|
|
36173
|
+
true
|
|
36170
36174
|
);
|
|
36171
36175
|
item.receivedDate = /* @__PURE__ */ new Date();
|
|
36172
36176
|
item.status = "Not Returned" /* NOT_RETURNED */;
|
|
@@ -59142,7 +59146,7 @@ function useNfcPatrolLogController() {
|
|
|
59142
59146
|
// src/repositories/new-dashboard.repo.ts
|
|
59143
59147
|
var import_node_server_utils201 = require("@7365admin1/node-server-utils");
|
|
59144
59148
|
var import_mongodb122 = require("mongodb");
|
|
59145
|
-
var
|
|
59149
|
+
var import_moment = __toESM(require("moment"));
|
|
59146
59150
|
var Period = /* @__PURE__ */ ((Period2) => {
|
|
59147
59151
|
Period2["TODAY"] = "today";
|
|
59148
59152
|
Period2["THIS_WEEK"] = "thisWeek";
|
|
@@ -59179,7 +59183,7 @@ function useNewDashboardRepo() {
|
|
|
59179
59183
|
const dateWithoutTimezone = date.replace(/\s*\+\d{2}:\d{2}$/, "");
|
|
59180
59184
|
date = new Date(dateWithoutTimezone);
|
|
59181
59185
|
}
|
|
59182
|
-
const singaporeMoment =
|
|
59186
|
+
const singaporeMoment = import_moment.default.tz(date, "Asia/Singapore");
|
|
59183
59187
|
singaporeMoment.set({
|
|
59184
59188
|
hour: 23,
|
|
59185
59189
|
minute: 59,
|
|
@@ -59189,7 +59193,7 @@ function useNewDashboardRepo() {
|
|
|
59189
59193
|
return singaporeMoment.toDate();
|
|
59190
59194
|
}
|
|
59191
59195
|
function getDateRange(p) {
|
|
59192
|
-
const now = (0,
|
|
59196
|
+
const now = (0, import_moment.default)().tz("Asia/Singapore");
|
|
59193
59197
|
if (p === "thisWeek" /* THIS_WEEK */) {
|
|
59194
59198
|
return {
|
|
59195
59199
|
$gte: now.clone().startOf("isoWeek").toDate(),
|
|
@@ -59218,7 +59222,7 @@ function useNewDashboardRepo() {
|
|
|
59218
59222
|
return getDateRange("today" /* TODAY */);
|
|
59219
59223
|
}
|
|
59220
59224
|
}
|
|
59221
|
-
function getSiteDayRange(date =
|
|
59225
|
+
function getSiteDayRange(date = import_moment.default.tz("Asia/Singapore")) {
|
|
59222
59226
|
return {
|
|
59223
59227
|
$gte: date.clone().startOf("day").toDate(),
|
|
59224
59228
|
$lte: date.clone().endOf("day").toDate()
|
|
@@ -59523,8 +59527,8 @@ function useNewDashboardRepo() {
|
|
|
59523
59527
|
activePatrolLogs.map(async (log) => {
|
|
59524
59528
|
const person = await getPatrolLogPerson(log);
|
|
59525
59529
|
const status = getPatrolLogStatus(log);
|
|
59526
|
-
const logTime = (0,
|
|
59527
|
-
const logDate = (0,
|
|
59530
|
+
const logTime = (0, import_moment.default)(log.createdAt).tz("Asia/Singapore").format("HH:mm");
|
|
59531
|
+
const logDate = (0, import_moment.default)(log.createdAt).tz("Asia/Singapore").format("DD/MM/YYYY");
|
|
59528
59532
|
return {
|
|
59529
59533
|
id: log._id.toString(),
|
|
59530
59534
|
title: log.name,
|
|
@@ -59575,11 +59579,11 @@ function useNewDashboardRepo() {
|
|
|
59575
59579
|
}
|
|
59576
59580
|
async function getPropertyManagementDashboard(siteId, period = "today" /* TODAY */, type, facility) {
|
|
59577
59581
|
const siteIdObj = (0, import_node_server_utils201.toObjectId)(siteId);
|
|
59578
|
-
const startOfToday =
|
|
59579
|
-
const endOfToday =
|
|
59582
|
+
const startOfToday = import_moment.default.tz("Asia/Singapore").startOf("day").toDate();
|
|
59583
|
+
const endOfToday = import_moment.default.tz("Asia/Singapore").endOf("day").toDate();
|
|
59580
59584
|
const facilityTodayRange = getSiteDayRange();
|
|
59581
59585
|
const facilityYesterdayRange = getSiteDayRange(
|
|
59582
|
-
|
|
59586
|
+
import_moment.default.tz("Asia/Singapore").subtract(1, "day")
|
|
59583
59587
|
);
|
|
59584
59588
|
const facilityTodayStart = facilityTodayRange.$gte;
|
|
59585
59589
|
const facilityTodayEnd = facilityTodayRange.$lte;
|
|
@@ -59591,13 +59595,13 @@ function useNewDashboardRepo() {
|
|
|
59591
59595
|
};
|
|
59592
59596
|
if (period === "thisWeek" /* THIS_WEEK */) {
|
|
59593
59597
|
facilityPeriodRange = {
|
|
59594
|
-
$gte:
|
|
59595
|
-
$lte:
|
|
59598
|
+
$gte: import_moment.default.tz("Asia/Singapore").startOf("isoWeek").toDate(),
|
|
59599
|
+
$lte: import_moment.default.tz("Asia/Singapore").endOf("isoWeek").toDate()
|
|
59596
59600
|
};
|
|
59597
59601
|
} else if (period === "thisMonth" /* THIS_MONTH */) {
|
|
59598
59602
|
facilityPeriodRange = {
|
|
59599
|
-
$gte:
|
|
59600
|
-
$lte:
|
|
59603
|
+
$gte: import_moment.default.tz("Asia/Singapore").startOf("month").toDate(),
|
|
59604
|
+
$lte: import_moment.default.tz("Asia/Singapore").endOf("month").toDate()
|
|
59601
59605
|
};
|
|
59602
59606
|
}
|
|
59603
59607
|
const upcomingEvents = await db.collection(events_namespace_collection).find({
|
|
@@ -60229,28 +60233,28 @@ function useNewDashboardRepo() {
|
|
|
60229
60233
|
let labels = [];
|
|
60230
60234
|
let getIntervalIndex;
|
|
60231
60235
|
if (period === "today" /* TODAY */) {
|
|
60232
|
-
rangeStart =
|
|
60233
|
-
rangeEnd =
|
|
60236
|
+
rangeStart = import_moment.default.tz("Asia/Singapore").startOf("day").toDate();
|
|
60237
|
+
rangeEnd = import_moment.default.tz("Asia/Singapore").endOf("day").toDate();
|
|
60234
60238
|
labels = ["12 AM", "4 AM", "8 AM", "12 PM", "4 PM", "8 PM"];
|
|
60235
60239
|
getIntervalIndex = (date) => {
|
|
60236
|
-
const hour = (0,
|
|
60240
|
+
const hour = (0, import_moment.default)(date).tz("Asia/Singapore").hour();
|
|
60237
60241
|
return Math.floor(hour / 4);
|
|
60238
60242
|
};
|
|
60239
60243
|
} else if (period === "thisWeek" /* THIS_WEEK */) {
|
|
60240
|
-
rangeStart =
|
|
60241
|
-
rangeEnd =
|
|
60244
|
+
rangeStart = import_moment.default.tz("Asia/Singapore").startOf("isoWeek").toDate();
|
|
60245
|
+
rangeEnd = import_moment.default.tz("Asia/Singapore").endOf("isoWeek").toDate();
|
|
60242
60246
|
labels = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
60243
60247
|
getIntervalIndex = (date) => {
|
|
60244
|
-
const day = (0,
|
|
60248
|
+
const day = (0, import_moment.default)(date).tz("Asia/Singapore").isoWeekday();
|
|
60245
60249
|
return day - 1;
|
|
60246
60250
|
};
|
|
60247
60251
|
} else if (period === "thisMonth" /* THIS_MONTH */) {
|
|
60248
|
-
rangeStart =
|
|
60249
|
-
rangeEnd =
|
|
60250
|
-
const daysInMonth =
|
|
60252
|
+
rangeStart = import_moment.default.tz("Asia/Singapore").startOf("month").toDate();
|
|
60253
|
+
rangeEnd = import_moment.default.tz("Asia/Singapore").endOf("month").toDate();
|
|
60254
|
+
const daysInMonth = import_moment.default.tz("Asia/Singapore").daysInMonth();
|
|
60251
60255
|
labels = Array.from({ length: daysInMonth }, (_, i) => String(i + 1));
|
|
60252
60256
|
getIntervalIndex = (date) => {
|
|
60253
|
-
return (0,
|
|
60257
|
+
return (0, import_moment.default)(date).tz("Asia/Singapore").date() - 1;
|
|
60254
60258
|
};
|
|
60255
60259
|
} else {
|
|
60256
60260
|
throw new import_node_server_utils201.BadRequestError("Invalid period.");
|
|
@@ -60888,7 +60892,7 @@ var import_node_server_utils203 = require("@7365admin1/node-server-utils");
|
|
|
60888
60892
|
|
|
60889
60893
|
// src/utils/hrmlabs-attendance.util.ts
|
|
60890
60894
|
var import_axios2 = __toESM(require("axios"));
|
|
60891
|
-
var
|
|
60895
|
+
var import_moment_timezone3 = __toESM(require("moment-timezone"));
|
|
60892
60896
|
var default_early_checkIn = 4;
|
|
60893
60897
|
async function hrmLabsAuthentication({
|
|
60894
60898
|
authUrl,
|
|
@@ -60960,13 +60964,13 @@ function filterByShiftTime(attendance, shiftData, timezone, format2) {
|
|
|
60960
60964
|
return attendance.filter((item) => {
|
|
60961
60965
|
if (!item.checkIn)
|
|
60962
60966
|
return false;
|
|
60963
|
-
const checkInLocal = (0,
|
|
60967
|
+
const checkInLocal = (0, import_moment_timezone3.default)(item.checkIn, format2);
|
|
60964
60968
|
if (!checkInLocal.isValid())
|
|
60965
60969
|
return false;
|
|
60966
60970
|
const [startHour, startMinute] = shiftData.checkIn.split(":").map(Number);
|
|
60967
60971
|
const [endHour, endMinute] = shiftData.checkOut.split(":").map(Number);
|
|
60968
|
-
const shiftStart = (0,
|
|
60969
|
-
const shiftEnd = (0,
|
|
60972
|
+
const shiftStart = (0, import_moment_timezone3.default)(checkInLocal).set({ hour: startHour, minute: startMinute, second: 0, millisecond: 0 }).subtract(default_early_checkIn, "hour");
|
|
60973
|
+
const shiftEnd = (0, import_moment_timezone3.default)(checkInLocal).set({
|
|
60970
60974
|
hour: endHour,
|
|
60971
60975
|
minute: endMinute,
|
|
60972
60976
|
second: 0,
|
|
@@ -61058,18 +61062,18 @@ function totalCountPerShift(attendance, shiftData, timezone, format2) {
|
|
|
61058
61062
|
data = uniqueAttendanceData.filter((item) => {
|
|
61059
61063
|
if (!item.checkIn)
|
|
61060
61064
|
return false;
|
|
61061
|
-
const checkInLocal = (0,
|
|
61065
|
+
const checkInLocal = (0, import_moment_timezone3.default)(item.checkIn, format2);
|
|
61062
61066
|
if (!checkInLocal.isValid())
|
|
61063
61067
|
return false;
|
|
61064
61068
|
const [startHour, startMinute] = shift.checkIn.split(":").map(Number);
|
|
61065
61069
|
const [endHour, endMinute] = shift.checkOut.split(":").map(Number);
|
|
61066
|
-
const shiftStart = (0,
|
|
61070
|
+
const shiftStart = (0, import_moment_timezone3.default)(checkInLocal).set({
|
|
61067
61071
|
hour: startHour,
|
|
61068
61072
|
minute: startMinute,
|
|
61069
61073
|
second: 0,
|
|
61070
61074
|
millisecond: 0
|
|
61071
61075
|
}).subtract(default_early_checkIn, "hour");
|
|
61072
|
-
const shiftEnd = (0,
|
|
61076
|
+
const shiftEnd = (0, import_moment_timezone3.default)(checkInLocal).set({
|
|
61073
61077
|
hour: endHour,
|
|
61074
61078
|
minute: endMinute,
|
|
61075
61079
|
second: 0,
|
|
@@ -61099,11 +61103,11 @@ function filterByStatus(attendance, shiftData, timezone, format2, status) {
|
|
|
61099
61103
|
return attendance.filter((item) => {
|
|
61100
61104
|
if (!item.checkIn)
|
|
61101
61105
|
return false;
|
|
61102
|
-
const checkInLocal = (0,
|
|
61106
|
+
const checkInLocal = (0, import_moment_timezone3.default)(item.checkIn, format2);
|
|
61103
61107
|
if (!checkInLocal.isValid())
|
|
61104
61108
|
return false;
|
|
61105
61109
|
const [lateHour, lateMinute] = shiftData.lateCheckInAlert.split(":").map(Number);
|
|
61106
|
-
const lateLoginTime = (0,
|
|
61110
|
+
const lateLoginTime = (0, import_moment_timezone3.default)(checkInLocal).set({
|
|
61107
61111
|
hour: lateHour,
|
|
61108
61112
|
minute: lateMinute,
|
|
61109
61113
|
second: 0,
|
|
@@ -61175,14 +61179,14 @@ async function totalCountPerStatus(attendance, shiftName, shiftData, timezone, f
|
|
|
61175
61179
|
} = item;
|
|
61176
61180
|
if (!checkInStr || seenGlobal.has(identificationNumber))
|
|
61177
61181
|
continue;
|
|
61178
|
-
const checkIn = (0,
|
|
61179
|
-
const checkOut = checkOutStr ? (0,
|
|
61180
|
-
const checkOutChecker = checkOut ? (0,
|
|
61182
|
+
const checkIn = (0, import_moment_timezone3.default)(checkInStr, format2);
|
|
61183
|
+
const checkOut = checkOutStr ? (0, import_moment_timezone3.default)(checkOutStr, format2) : null;
|
|
61184
|
+
const checkOutChecker = checkOut ? (0, import_moment_timezone3.default)(checkOutStr, format2) : checkIn;
|
|
61181
61185
|
if (!checkIn.isValid())
|
|
61182
61186
|
continue;
|
|
61183
|
-
const shiftStart = (0,
|
|
61184
|
-
const shiftEnd = (0,
|
|
61185
|
-
const lateCheckIn = (0,
|
|
61187
|
+
const shiftStart = (0, import_moment_timezone3.default)(checkIn).set({ ...shiftStartTime, second: 59, millisecond: 59 }).subtract(default_early_checkIn, "hour");
|
|
61188
|
+
const shiftEnd = (0, import_moment_timezone3.default)(checkOutChecker).set({ ...shiftEndTime, second: 0, millisecond: 0 }).subtract(default_early_checkIn, "hour");
|
|
61189
|
+
const lateCheckIn = (0, import_moment_timezone3.default)(checkIn).set({
|
|
61186
61190
|
...lateTime,
|
|
61187
61191
|
second: 59,
|
|
61188
61192
|
millisecond: 59
|
|
@@ -61220,8 +61224,8 @@ async function chartCountData(attendance, shiftData, timezone, format2, totalShi
|
|
|
61220
61224
|
const [hour, minute] = timeStr.split(":").map(Number);
|
|
61221
61225
|
return { hour, minute };
|
|
61222
61226
|
};
|
|
61223
|
-
const startDate = (0,
|
|
61224
|
-
const endDate = (0,
|
|
61227
|
+
const startDate = (0, import_moment_timezone3.default)(startDateStr, "DD-MM-YYYY");
|
|
61228
|
+
const endDate = (0, import_moment_timezone3.default)(endDateStr, "DD-MM-YYYY");
|
|
61225
61229
|
const daysInRange = [];
|
|
61226
61230
|
for (let day = startDate.clone(); day.isSameOrBefore(endDate); day.add(1, "day")) {
|
|
61227
61231
|
daysInRange.push(day.format("DD-MM-YYYY"));
|
|
@@ -61292,7 +61296,7 @@ async function chartCountData(attendance, shiftData, timezone, format2, totalShi
|
|
|
61292
61296
|
} = item;
|
|
61293
61297
|
if (!checkInStr)
|
|
61294
61298
|
continue;
|
|
61295
|
-
const checkIn = (0,
|
|
61299
|
+
const checkIn = (0, import_moment_timezone3.default)(checkInStr, format2);
|
|
61296
61300
|
if (!checkIn.isValid())
|
|
61297
61301
|
continue;
|
|
61298
61302
|
const dayKey = `${identificationNumber}-${checkIn.format(
|
|
@@ -61301,10 +61305,10 @@ async function chartCountData(attendance, shiftData, timezone, format2, totalShi
|
|
|
61301
61305
|
if (seenPerDay.has(dayKey))
|
|
61302
61306
|
continue;
|
|
61303
61307
|
seenPerDay.add(dayKey);
|
|
61304
|
-
const checkOut = checkOutStr ? (0,
|
|
61305
|
-
const shiftStart = (0,
|
|
61306
|
-
const shiftEnd = (0,
|
|
61307
|
-
const lateCheckIn = (0,
|
|
61308
|
+
const checkOut = checkOutStr ? (0, import_moment_timezone3.default)(checkOutStr, format2) : checkIn;
|
|
61309
|
+
const shiftStart = (0, import_moment_timezone3.default)(checkIn).set({ ...shiftStartTime, second: 59, millisecond: 59 }).subtract(default_early_checkIn, "hour");
|
|
61310
|
+
const shiftEnd = (0, import_moment_timezone3.default)(checkOut).set({ ...shiftEndTime, second: 0, millisecond: 0 }).subtract(default_early_checkIn, "hour");
|
|
61311
|
+
const lateCheckIn = (0, import_moment_timezone3.default)(checkIn).set({
|
|
61308
61312
|
...lateTime,
|
|
61309
61313
|
second: 59,
|
|
61310
61314
|
millisecond: 59
|
|
@@ -61598,7 +61602,7 @@ var MManpowerRemarks = class {
|
|
|
61598
61602
|
|
|
61599
61603
|
// src/repositories/manpower-remarks.repo.ts
|
|
61600
61604
|
var import_mongodb126 = require("mongodb");
|
|
61601
|
-
var
|
|
61605
|
+
var import_moment_timezone4 = __toESM(require("moment-timezone"));
|
|
61602
61606
|
function useManpowerRemarksRepo() {
|
|
61603
61607
|
const db = import_node_server_utils204.useAtlas.getDb();
|
|
61604
61608
|
if (!db) {
|
|
@@ -61652,7 +61656,7 @@ function useManpowerRemarksRepo() {
|
|
|
61652
61656
|
page = page ? page - 1 : 0;
|
|
61653
61657
|
limit = limit || 10;
|
|
61654
61658
|
const searchQuery = {};
|
|
61655
|
-
const nowSGT = (0,
|
|
61659
|
+
const nowSGT = (0, import_moment_timezone4.default)().tz("Asia/Singapore");
|
|
61656
61660
|
searchQuery.serviceProviderId = new import_mongodb126.ObjectId(serviceProviderId);
|
|
61657
61661
|
if (search != "") {
|
|
61658
61662
|
searchQuery.siteName = { $regex: search, $options: "i" };
|
|
@@ -61755,7 +61759,7 @@ function useManpowerRemarksRepo() {
|
|
|
61755
61759
|
}
|
|
61756
61760
|
|
|
61757
61761
|
// src/services/manpower-monitoring.service.ts
|
|
61758
|
-
var
|
|
61762
|
+
var import_moment_timezone5 = __toESM(require("moment-timezone"));
|
|
61759
61763
|
function useManpowerMonitoringSrvc() {
|
|
61760
61764
|
const {
|
|
61761
61765
|
createManpowerMonitoringSettings: _createManpowerMonitoringSettings
|
|
@@ -61773,10 +61777,10 @@ function useManpowerMonitoringSrvc() {
|
|
|
61773
61777
|
const morningAlertFrequencyMins = payload?.shifts?.[payload.shiftType][0]?.alertFrequencyMins;
|
|
61774
61778
|
const afternoonAlertFrequencyMins = payload.shiftType == "3-shifts" ? payload?.shifts?.[payload.shiftType][1]?.alertFrequencyMins : null;
|
|
61775
61779
|
const nightAlertFrequencyMins = payload.shiftType == "3-shifts" ? payload?.shifts?.[payload.shiftType][2]?.alertFrequencyMins : payload?.shifts?.[payload.shiftType][1]?.alertFrequencyMins;
|
|
61776
|
-
const morningAlertTime =
|
|
61777
|
-
const afternoonAlertTime = afternoonCheckInTime ?
|
|
61778
|
-
const nightAlertTime =
|
|
61779
|
-
const nowSGT = (0,
|
|
61780
|
+
const morningAlertTime = import_moment_timezone5.default.tz(morningCheckInTime, "HH:mm", "Asia/Singapore").add(morningAlertFrequencyMins, "minutes").format("HH:mm");
|
|
61781
|
+
const afternoonAlertTime = afternoonCheckInTime ? import_moment_timezone5.default.tz(afternoonCheckInTime, "HH:mm", "Asia/Singapore").add(afternoonAlertFrequencyMins, "minutes").format("HH:mm") : "";
|
|
61782
|
+
const nightAlertTime = import_moment_timezone5.default.tz(nightCheckInTime, "HH:mm", "Asia/Singapore").add(nightAlertFrequencyMins, "minutes").format("HH:mm");
|
|
61783
|
+
const nowSGT = (0, import_moment_timezone5.default)().tz("Asia/Singapore");
|
|
61780
61784
|
try {
|
|
61781
61785
|
const remarksPayload = {
|
|
61782
61786
|
siteId: payload.siteId,
|
|
@@ -64060,7 +64064,7 @@ function useManpowerSitesCtrl() {
|
|
|
64060
64064
|
// src/utils/cron.util.ts
|
|
64061
64065
|
var import_node_server_utils221 = require("@7365admin1/node-server-utils");
|
|
64062
64066
|
var import_mongodb131 = require("mongodb");
|
|
64063
|
-
var
|
|
64067
|
+
var import_moment_timezone6 = __toESM(require("moment-timezone"));
|
|
64064
64068
|
var createManpowerRemarksDaily = async () => {
|
|
64065
64069
|
const db = import_node_server_utils221.useAtlas.getDb();
|
|
64066
64070
|
if (!db) {
|
|
@@ -64071,9 +64075,9 @@ var createManpowerRemarksDaily = async () => {
|
|
|
64071
64075
|
const remarks = db.collection("manpower-remarks");
|
|
64072
64076
|
const serviceProviders = db.collection("site.service-providers");
|
|
64073
64077
|
const items = [];
|
|
64074
|
-
const yesterday = (0,
|
|
64078
|
+
const yesterday = (0, import_moment_timezone6.default)().tz("Asia/Singapore").subtract(1, "days").format("DD-MM-YYYY");
|
|
64075
64079
|
try {
|
|
64076
|
-
const nowSGT = (0,
|
|
64080
|
+
const nowSGT = (0, import_moment_timezone6.default)().tz("Asia/Singapore");
|
|
64077
64081
|
const servideProvider = await serviceProviders.findOne({
|
|
64078
64082
|
name: { $regex: process.env.HRMLABS_DOMAIN, $options: "i" }
|
|
64079
64083
|
});
|
|
@@ -64111,9 +64115,9 @@ var createManpowerRemarksDaily = async () => {
|
|
|
64111
64115
|
const morningAlertFrequencyMins = setting?.shifts?.[shiftType][0]?.alertFrequencyMins;
|
|
64112
64116
|
const afternoonAlertFrequencyMins = shiftType == "3-shifts" ? setting?.shifts?.[shiftType][1]?.alertFrequencyMins : null;
|
|
64113
64117
|
const nightAlertFrequencyMins = shiftType == "3-shifts" ? setting?.shifts?.[shiftType][2]?.alertFrequencyMins : setting?.shifts?.[shiftType][1]?.alertFrequencyMins;
|
|
64114
|
-
const morningAlertTime =
|
|
64115
|
-
const afternoonAlertTime = afternoonCheckInTime ?
|
|
64116
|
-
const nightAlertTime =
|
|
64118
|
+
const morningAlertTime = import_moment_timezone6.default.tz(morningCheckInTime, "HH:mm", "Asia/Singapore").add(morningAlertFrequencyMins, "minutes").format("HH:mm");
|
|
64119
|
+
const afternoonAlertTime = afternoonCheckInTime ? import_moment_timezone6.default.tz(afternoonCheckInTime, "HH:mm", "Asia/Singapore").add(afternoonAlertFrequencyMins, "minutes").format("HH:mm") : "";
|
|
64120
|
+
const nightAlertTime = import_moment_timezone6.default.tz(nightCheckInTime, "HH:mm", "Asia/Singapore").add(nightAlertFrequencyMins, "minutes").format("HH:mm");
|
|
64117
64121
|
const remark2 = {
|
|
64118
64122
|
siteId: site.siteId,
|
|
64119
64123
|
siteName: site.siteName,
|
|
@@ -64170,14 +64174,14 @@ var createManpowerRemarksDaily = async () => {
|
|
|
64170
64174
|
};
|
|
64171
64175
|
var updateRemarksisAcknowledged = async () => {
|
|
64172
64176
|
const { getAttendanceDataCount: _getAttendanceDataCount } = useHrmLabsAttendanceSrvc();
|
|
64173
|
-
const nowSGT = (0,
|
|
64177
|
+
const nowSGT = (0, import_moment_timezone6.default)().tz("Asia/Singapore").format("DD-MM-YYYY");
|
|
64174
64178
|
const db = import_node_server_utils221.useAtlas.getDb();
|
|
64175
64179
|
if (!db) {
|
|
64176
64180
|
throw new Error("Unable to connect to server.");
|
|
64177
64181
|
}
|
|
64178
64182
|
const namespace_collection = "manpower-remarks";
|
|
64179
64183
|
const remarks = db.collection(namespace_collection);
|
|
64180
|
-
const timeNow = (0,
|
|
64184
|
+
const timeNow = (0, import_moment_timezone6.default)().tz("Asia/Singapore").format("HH:mm");
|
|
64181
64185
|
const settings = db.collection("manpower-settings");
|
|
64182
64186
|
try {
|
|
64183
64187
|
const matchingDocs = await remarks.find({
|
|
@@ -64305,9 +64309,9 @@ var updateRemarksStatusEod = async () => {
|
|
|
64305
64309
|
}
|
|
64306
64310
|
const remarks = db.collection("manpower-remarks");
|
|
64307
64311
|
const settings = db.collection("manpower-settings");
|
|
64308
|
-
const nowSGT = (0,
|
|
64309
|
-
const yesterdaySGT = (0,
|
|
64310
|
-
const timeNow = (0,
|
|
64312
|
+
const nowSGT = (0, import_moment_timezone6.default)().tz("Asia/Singapore").format("DD-MM-YYYY");
|
|
64313
|
+
const yesterdaySGT = (0, import_moment_timezone6.default)().tz("Asia/Singapore").subtract(1, "days").format("DD-MM-YYYY");
|
|
64314
|
+
const timeNow = (0, import_moment_timezone6.default)().tz("Asia/Singapore").format("HH:mm");
|
|
64311
64315
|
const docs = await remarks.find({
|
|
64312
64316
|
$or: [
|
|
64313
64317
|
// Morning & Afternoon from today
|
|
@@ -64443,7 +64447,7 @@ var isWithinHour = (alertTime, timeNow) => {
|
|
|
64443
64447
|
// src/events/manpower.event.ts
|
|
64444
64448
|
var import_node_server_utils222 = require("@7365admin1/node-server-utils");
|
|
64445
64449
|
var import_mongodb132 = require("mongodb");
|
|
64446
|
-
var
|
|
64450
|
+
var import_moment_timezone7 = __toESM(require("moment-timezone"));
|
|
64447
64451
|
async function manpowerEvents(io) {
|
|
64448
64452
|
let intervalId = null;
|
|
64449
64453
|
let activeConnections = 0;
|
|
@@ -64455,9 +64459,9 @@ async function manpowerEvents(io) {
|
|
|
64455
64459
|
}
|
|
64456
64460
|
const remarks = db.collection("manpower-remarks");
|
|
64457
64461
|
const settings = db.collection("manpower-settings");
|
|
64458
|
-
const selectedDateMoment =
|
|
64462
|
+
const selectedDateMoment = import_moment_timezone7.default.tz(date, "DD-MM-YYYY", "Asia/Singapore");
|
|
64459
64463
|
const selectedDateSGT = selectedDateMoment.format("DD-MM-YYYY");
|
|
64460
|
-
const currentSGT = (0,
|
|
64464
|
+
const currentSGT = (0, import_moment_timezone7.default)().tz("Asia/Singapore");
|
|
64461
64465
|
const docs = await remarks.find({
|
|
64462
64466
|
createdAtSGT: selectedDateSGT,
|
|
64463
64467
|
$or: [
|
|
@@ -64479,7 +64483,7 @@ async function manpowerEvents(io) {
|
|
|
64479
64483
|
}
|
|
64480
64484
|
if (currentSGT.isSame(selectedDateMoment, "day")) {
|
|
64481
64485
|
if (currentSGT.isSameOrAfter(
|
|
64482
|
-
|
|
64486
|
+
import_moment_timezone7.default.tz("19:55", "HH:mm", "Asia/Singapore")
|
|
64483
64487
|
)) {
|
|
64484
64488
|
shiftsToCheck.push({ index: 2, key: "nightShift" });
|
|
64485
64489
|
}
|