@7365admin1/core 3.32.2-staging.32 → 3.32.2-staging.34
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 +5 -3
- package/dist/index.js +144 -88
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +297 -240
- 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>;
|
|
@@ -6873,6 +6873,7 @@ declare function useRedDotPaymentController(): {
|
|
|
6873
6873
|
redirectPaymentTransaction: (req: Request, res: Response) => Promise<Response<any, Record<string, any>>>;
|
|
6874
6874
|
enquirePaymentTransaction: (req: Request, res: Response) => Promise<Response<any, Record<string, any>>>;
|
|
6875
6875
|
createPayment: (req: Request, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
|
|
6876
|
+
updateStatus: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
6876
6877
|
};
|
|
6877
6878
|
|
|
6878
6879
|
interface IDirectPayment extends IBaseModel {
|
|
@@ -6933,11 +6934,12 @@ type TBillingPayments = {
|
|
|
6933
6934
|
|
|
6934
6935
|
declare const useRedDotPaymentRepo: () => {
|
|
6935
6936
|
paySingleUnitBill: (refId: string, payload: Partial<TUnitBilling>) => Promise<mongodb.WithId<bson.Document> | null>;
|
|
6936
|
-
createPayment: (type: string, payload: Partial<TBillingPayments>, session?: ClientSession) => Promise<
|
|
6937
|
+
createPayment: (type: string, payload: Partial<TBillingPayments>, session?: ClientSession) => Promise<string | undefined>;
|
|
6937
6938
|
payMultipleUnitBill: (refId: string[], payload: Partial<TUnitBilling>) => Promise<{
|
|
6938
6939
|
message: string;
|
|
6939
6940
|
remainingBalance: number;
|
|
6940
6941
|
}>;
|
|
6942
|
+
updateStatus: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
6941
6943
|
};
|
|
6942
6944
|
|
|
6943
6945
|
declare enum VerificationType {
|
package/dist/index.js
CHANGED
|
@@ -536,13 +536,13 @@ var require_logger = __commonJS({
|
|
|
536
536
|
"use strict";
|
|
537
537
|
exports.__esModule = true;
|
|
538
538
|
var _utils = require_utils();
|
|
539
|
-
var
|
|
539
|
+
var logger203 = {
|
|
540
540
|
methodMap: ["debug", "info", "warn", "error"],
|
|
541
541
|
level: "info",
|
|
542
542
|
// Maps a given level value to the `methodMap` indexes above.
|
|
543
543
|
lookupLevel: function lookupLevel(level) {
|
|
544
544
|
if (typeof level === "string") {
|
|
545
|
-
var levelMap = _utils.indexOf(
|
|
545
|
+
var levelMap = _utils.indexOf(logger203.methodMap, level.toLowerCase());
|
|
546
546
|
if (levelMap >= 0) {
|
|
547
547
|
level = levelMap;
|
|
548
548
|
} else {
|
|
@@ -553,9 +553,9 @@ var require_logger = __commonJS({
|
|
|
553
553
|
},
|
|
554
554
|
// Can be overridden in the host environment
|
|
555
555
|
log: function log(level) {
|
|
556
|
-
level =
|
|
557
|
-
if (typeof console !== "undefined" &&
|
|
558
|
-
var method =
|
|
556
|
+
level = logger203.lookupLevel(level);
|
|
557
|
+
if (typeof console !== "undefined" && logger203.lookupLevel(logger203.level) <= level) {
|
|
558
|
+
var method = logger203.methodMap[level];
|
|
559
559
|
if (!console[method]) {
|
|
560
560
|
method = "log";
|
|
561
561
|
}
|
|
@@ -566,7 +566,7 @@ var require_logger = __commonJS({
|
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
568
|
};
|
|
569
|
-
exports["default"] =
|
|
569
|
+
exports["default"] = logger203;
|
|
570
570
|
module2.exports = exports["default"];
|
|
571
571
|
}
|
|
572
572
|
});
|
|
@@ -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;
|
|
@@ -59142,7 +59142,7 @@ function useNfcPatrolLogController() {
|
|
|
59142
59142
|
// src/repositories/new-dashboard.repo.ts
|
|
59143
59143
|
var import_node_server_utils201 = require("@7365admin1/node-server-utils");
|
|
59144
59144
|
var import_mongodb122 = require("mongodb");
|
|
59145
|
-
var
|
|
59145
|
+
var import_moment = __toESM(require("moment"));
|
|
59146
59146
|
var Period = /* @__PURE__ */ ((Period2) => {
|
|
59147
59147
|
Period2["TODAY"] = "today";
|
|
59148
59148
|
Period2["THIS_WEEK"] = "thisWeek";
|
|
@@ -59179,7 +59179,7 @@ function useNewDashboardRepo() {
|
|
|
59179
59179
|
const dateWithoutTimezone = date.replace(/\s*\+\d{2}:\d{2}$/, "");
|
|
59180
59180
|
date = new Date(dateWithoutTimezone);
|
|
59181
59181
|
}
|
|
59182
|
-
const singaporeMoment =
|
|
59182
|
+
const singaporeMoment = import_moment.default.tz(date, "Asia/Singapore");
|
|
59183
59183
|
singaporeMoment.set({
|
|
59184
59184
|
hour: 23,
|
|
59185
59185
|
minute: 59,
|
|
@@ -59189,7 +59189,7 @@ function useNewDashboardRepo() {
|
|
|
59189
59189
|
return singaporeMoment.toDate();
|
|
59190
59190
|
}
|
|
59191
59191
|
function getDateRange(p) {
|
|
59192
|
-
const now = (0,
|
|
59192
|
+
const now = (0, import_moment.default)().tz("Asia/Singapore");
|
|
59193
59193
|
if (p === "thisWeek" /* THIS_WEEK */) {
|
|
59194
59194
|
return {
|
|
59195
59195
|
$gte: now.clone().startOf("isoWeek").toDate(),
|
|
@@ -59218,7 +59218,7 @@ function useNewDashboardRepo() {
|
|
|
59218
59218
|
return getDateRange("today" /* TODAY */);
|
|
59219
59219
|
}
|
|
59220
59220
|
}
|
|
59221
|
-
function getSiteDayRange(date =
|
|
59221
|
+
function getSiteDayRange(date = import_moment.default.tz("Asia/Singapore")) {
|
|
59222
59222
|
return {
|
|
59223
59223
|
$gte: date.clone().startOf("day").toDate(),
|
|
59224
59224
|
$lte: date.clone().endOf("day").toDate()
|
|
@@ -59523,8 +59523,8 @@ function useNewDashboardRepo() {
|
|
|
59523
59523
|
activePatrolLogs.map(async (log) => {
|
|
59524
59524
|
const person = await getPatrolLogPerson(log);
|
|
59525
59525
|
const status = getPatrolLogStatus(log);
|
|
59526
|
-
const logTime = (0,
|
|
59527
|
-
const logDate = (0,
|
|
59526
|
+
const logTime = (0, import_moment.default)(log.createdAt).tz("Asia/Singapore").format("HH:mm");
|
|
59527
|
+
const logDate = (0, import_moment.default)(log.createdAt).tz("Asia/Singapore").format("DD/MM/YYYY");
|
|
59528
59528
|
return {
|
|
59529
59529
|
id: log._id.toString(),
|
|
59530
59530
|
title: log.name,
|
|
@@ -59575,11 +59575,11 @@ function useNewDashboardRepo() {
|
|
|
59575
59575
|
}
|
|
59576
59576
|
async function getPropertyManagementDashboard(siteId, period = "today" /* TODAY */, type, facility) {
|
|
59577
59577
|
const siteIdObj = (0, import_node_server_utils201.toObjectId)(siteId);
|
|
59578
|
-
const startOfToday =
|
|
59579
|
-
const endOfToday =
|
|
59578
|
+
const startOfToday = import_moment.default.tz("Asia/Singapore").startOf("day").toDate();
|
|
59579
|
+
const endOfToday = import_moment.default.tz("Asia/Singapore").endOf("day").toDate();
|
|
59580
59580
|
const facilityTodayRange = getSiteDayRange();
|
|
59581
59581
|
const facilityYesterdayRange = getSiteDayRange(
|
|
59582
|
-
|
|
59582
|
+
import_moment.default.tz("Asia/Singapore").subtract(1, "day")
|
|
59583
59583
|
);
|
|
59584
59584
|
const facilityTodayStart = facilityTodayRange.$gte;
|
|
59585
59585
|
const facilityTodayEnd = facilityTodayRange.$lte;
|
|
@@ -59591,13 +59591,13 @@ function useNewDashboardRepo() {
|
|
|
59591
59591
|
};
|
|
59592
59592
|
if (period === "thisWeek" /* THIS_WEEK */) {
|
|
59593
59593
|
facilityPeriodRange = {
|
|
59594
|
-
$gte:
|
|
59595
|
-
$lte:
|
|
59594
|
+
$gte: import_moment.default.tz("Asia/Singapore").startOf("isoWeek").toDate(),
|
|
59595
|
+
$lte: import_moment.default.tz("Asia/Singapore").endOf("isoWeek").toDate()
|
|
59596
59596
|
};
|
|
59597
59597
|
} else if (period === "thisMonth" /* THIS_MONTH */) {
|
|
59598
59598
|
facilityPeriodRange = {
|
|
59599
|
-
$gte:
|
|
59600
|
-
$lte:
|
|
59599
|
+
$gte: import_moment.default.tz("Asia/Singapore").startOf("month").toDate(),
|
|
59600
|
+
$lte: import_moment.default.tz("Asia/Singapore").endOf("month").toDate()
|
|
59601
59601
|
};
|
|
59602
59602
|
}
|
|
59603
59603
|
const upcomingEvents = await db.collection(events_namespace_collection).find({
|
|
@@ -60229,28 +60229,28 @@ function useNewDashboardRepo() {
|
|
|
60229
60229
|
let labels = [];
|
|
60230
60230
|
let getIntervalIndex;
|
|
60231
60231
|
if (period === "today" /* TODAY */) {
|
|
60232
|
-
rangeStart =
|
|
60233
|
-
rangeEnd =
|
|
60232
|
+
rangeStart = import_moment.default.tz("Asia/Singapore").startOf("day").toDate();
|
|
60233
|
+
rangeEnd = import_moment.default.tz("Asia/Singapore").endOf("day").toDate();
|
|
60234
60234
|
labels = ["12 AM", "4 AM", "8 AM", "12 PM", "4 PM", "8 PM"];
|
|
60235
60235
|
getIntervalIndex = (date) => {
|
|
60236
|
-
const hour = (0,
|
|
60236
|
+
const hour = (0, import_moment.default)(date).tz("Asia/Singapore").hour();
|
|
60237
60237
|
return Math.floor(hour / 4);
|
|
60238
60238
|
};
|
|
60239
60239
|
} else if (period === "thisWeek" /* THIS_WEEK */) {
|
|
60240
|
-
rangeStart =
|
|
60241
|
-
rangeEnd =
|
|
60240
|
+
rangeStart = import_moment.default.tz("Asia/Singapore").startOf("isoWeek").toDate();
|
|
60241
|
+
rangeEnd = import_moment.default.tz("Asia/Singapore").endOf("isoWeek").toDate();
|
|
60242
60242
|
labels = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
60243
60243
|
getIntervalIndex = (date) => {
|
|
60244
|
-
const day = (0,
|
|
60244
|
+
const day = (0, import_moment.default)(date).tz("Asia/Singapore").isoWeekday();
|
|
60245
60245
|
return day - 1;
|
|
60246
60246
|
};
|
|
60247
60247
|
} else if (period === "thisMonth" /* THIS_MONTH */) {
|
|
60248
|
-
rangeStart =
|
|
60249
|
-
rangeEnd =
|
|
60250
|
-
const daysInMonth =
|
|
60248
|
+
rangeStart = import_moment.default.tz("Asia/Singapore").startOf("month").toDate();
|
|
60249
|
+
rangeEnd = import_moment.default.tz("Asia/Singapore").endOf("month").toDate();
|
|
60250
|
+
const daysInMonth = import_moment.default.tz("Asia/Singapore").daysInMonth();
|
|
60251
60251
|
labels = Array.from({ length: daysInMonth }, (_, i) => String(i + 1));
|
|
60252
60252
|
getIntervalIndex = (date) => {
|
|
60253
|
-
return (0,
|
|
60253
|
+
return (0, import_moment.default)(date).tz("Asia/Singapore").date() - 1;
|
|
60254
60254
|
};
|
|
60255
60255
|
} else {
|
|
60256
60256
|
throw new import_node_server_utils201.BadRequestError("Invalid period.");
|
|
@@ -60888,7 +60888,7 @@ var import_node_server_utils203 = require("@7365admin1/node-server-utils");
|
|
|
60888
60888
|
|
|
60889
60889
|
// src/utils/hrmlabs-attendance.util.ts
|
|
60890
60890
|
var import_axios2 = __toESM(require("axios"));
|
|
60891
|
-
var
|
|
60891
|
+
var import_moment_timezone3 = __toESM(require("moment-timezone"));
|
|
60892
60892
|
var default_early_checkIn = 4;
|
|
60893
60893
|
async function hrmLabsAuthentication({
|
|
60894
60894
|
authUrl,
|
|
@@ -60960,13 +60960,13 @@ function filterByShiftTime(attendance, shiftData, timezone, format2) {
|
|
|
60960
60960
|
return attendance.filter((item) => {
|
|
60961
60961
|
if (!item.checkIn)
|
|
60962
60962
|
return false;
|
|
60963
|
-
const checkInLocal = (0,
|
|
60963
|
+
const checkInLocal = (0, import_moment_timezone3.default)(item.checkIn, format2);
|
|
60964
60964
|
if (!checkInLocal.isValid())
|
|
60965
60965
|
return false;
|
|
60966
60966
|
const [startHour, startMinute] = shiftData.checkIn.split(":").map(Number);
|
|
60967
60967
|
const [endHour, endMinute] = shiftData.checkOut.split(":").map(Number);
|
|
60968
|
-
const shiftStart = (0,
|
|
60969
|
-
const shiftEnd = (0,
|
|
60968
|
+
const shiftStart = (0, import_moment_timezone3.default)(checkInLocal).set({ hour: startHour, minute: startMinute, second: 0, millisecond: 0 }).subtract(default_early_checkIn, "hour");
|
|
60969
|
+
const shiftEnd = (0, import_moment_timezone3.default)(checkInLocal).set({
|
|
60970
60970
|
hour: endHour,
|
|
60971
60971
|
minute: endMinute,
|
|
60972
60972
|
second: 0,
|
|
@@ -61058,18 +61058,18 @@ function totalCountPerShift(attendance, shiftData, timezone, format2) {
|
|
|
61058
61058
|
data = uniqueAttendanceData.filter((item) => {
|
|
61059
61059
|
if (!item.checkIn)
|
|
61060
61060
|
return false;
|
|
61061
|
-
const checkInLocal = (0,
|
|
61061
|
+
const checkInLocal = (0, import_moment_timezone3.default)(item.checkIn, format2);
|
|
61062
61062
|
if (!checkInLocal.isValid())
|
|
61063
61063
|
return false;
|
|
61064
61064
|
const [startHour, startMinute] = shift.checkIn.split(":").map(Number);
|
|
61065
61065
|
const [endHour, endMinute] = shift.checkOut.split(":").map(Number);
|
|
61066
|
-
const shiftStart = (0,
|
|
61066
|
+
const shiftStart = (0, import_moment_timezone3.default)(checkInLocal).set({
|
|
61067
61067
|
hour: startHour,
|
|
61068
61068
|
minute: startMinute,
|
|
61069
61069
|
second: 0,
|
|
61070
61070
|
millisecond: 0
|
|
61071
61071
|
}).subtract(default_early_checkIn, "hour");
|
|
61072
|
-
const shiftEnd = (0,
|
|
61072
|
+
const shiftEnd = (0, import_moment_timezone3.default)(checkInLocal).set({
|
|
61073
61073
|
hour: endHour,
|
|
61074
61074
|
minute: endMinute,
|
|
61075
61075
|
second: 0,
|
|
@@ -61099,11 +61099,11 @@ function filterByStatus(attendance, shiftData, timezone, format2, status) {
|
|
|
61099
61099
|
return attendance.filter((item) => {
|
|
61100
61100
|
if (!item.checkIn)
|
|
61101
61101
|
return false;
|
|
61102
|
-
const checkInLocal = (0,
|
|
61102
|
+
const checkInLocal = (0, import_moment_timezone3.default)(item.checkIn, format2);
|
|
61103
61103
|
if (!checkInLocal.isValid())
|
|
61104
61104
|
return false;
|
|
61105
61105
|
const [lateHour, lateMinute] = shiftData.lateCheckInAlert.split(":").map(Number);
|
|
61106
|
-
const lateLoginTime = (0,
|
|
61106
|
+
const lateLoginTime = (0, import_moment_timezone3.default)(checkInLocal).set({
|
|
61107
61107
|
hour: lateHour,
|
|
61108
61108
|
minute: lateMinute,
|
|
61109
61109
|
second: 0,
|
|
@@ -61175,14 +61175,14 @@ async function totalCountPerStatus(attendance, shiftName, shiftData, timezone, f
|
|
|
61175
61175
|
} = item;
|
|
61176
61176
|
if (!checkInStr || seenGlobal.has(identificationNumber))
|
|
61177
61177
|
continue;
|
|
61178
|
-
const checkIn = (0,
|
|
61179
|
-
const checkOut = checkOutStr ? (0,
|
|
61180
|
-
const checkOutChecker = checkOut ? (0,
|
|
61178
|
+
const checkIn = (0, import_moment_timezone3.default)(checkInStr, format2);
|
|
61179
|
+
const checkOut = checkOutStr ? (0, import_moment_timezone3.default)(checkOutStr, format2) : null;
|
|
61180
|
+
const checkOutChecker = checkOut ? (0, import_moment_timezone3.default)(checkOutStr, format2) : checkIn;
|
|
61181
61181
|
if (!checkIn.isValid())
|
|
61182
61182
|
continue;
|
|
61183
|
-
const shiftStart = (0,
|
|
61184
|
-
const shiftEnd = (0,
|
|
61185
|
-
const lateCheckIn = (0,
|
|
61183
|
+
const shiftStart = (0, import_moment_timezone3.default)(checkIn).set({ ...shiftStartTime, second: 59, millisecond: 59 }).subtract(default_early_checkIn, "hour");
|
|
61184
|
+
const shiftEnd = (0, import_moment_timezone3.default)(checkOutChecker).set({ ...shiftEndTime, second: 0, millisecond: 0 }).subtract(default_early_checkIn, "hour");
|
|
61185
|
+
const lateCheckIn = (0, import_moment_timezone3.default)(checkIn).set({
|
|
61186
61186
|
...lateTime,
|
|
61187
61187
|
second: 59,
|
|
61188
61188
|
millisecond: 59
|
|
@@ -61220,8 +61220,8 @@ async function chartCountData(attendance, shiftData, timezone, format2, totalShi
|
|
|
61220
61220
|
const [hour, minute] = timeStr.split(":").map(Number);
|
|
61221
61221
|
return { hour, minute };
|
|
61222
61222
|
};
|
|
61223
|
-
const startDate = (0,
|
|
61224
|
-
const endDate = (0,
|
|
61223
|
+
const startDate = (0, import_moment_timezone3.default)(startDateStr, "DD-MM-YYYY");
|
|
61224
|
+
const endDate = (0, import_moment_timezone3.default)(endDateStr, "DD-MM-YYYY");
|
|
61225
61225
|
const daysInRange = [];
|
|
61226
61226
|
for (let day = startDate.clone(); day.isSameOrBefore(endDate); day.add(1, "day")) {
|
|
61227
61227
|
daysInRange.push(day.format("DD-MM-YYYY"));
|
|
@@ -61292,7 +61292,7 @@ async function chartCountData(attendance, shiftData, timezone, format2, totalShi
|
|
|
61292
61292
|
} = item;
|
|
61293
61293
|
if (!checkInStr)
|
|
61294
61294
|
continue;
|
|
61295
|
-
const checkIn = (0,
|
|
61295
|
+
const checkIn = (0, import_moment_timezone3.default)(checkInStr, format2);
|
|
61296
61296
|
if (!checkIn.isValid())
|
|
61297
61297
|
continue;
|
|
61298
61298
|
const dayKey = `${identificationNumber}-${checkIn.format(
|
|
@@ -61301,10 +61301,10 @@ async function chartCountData(attendance, shiftData, timezone, format2, totalShi
|
|
|
61301
61301
|
if (seenPerDay.has(dayKey))
|
|
61302
61302
|
continue;
|
|
61303
61303
|
seenPerDay.add(dayKey);
|
|
61304
|
-
const checkOut = checkOutStr ? (0,
|
|
61305
|
-
const shiftStart = (0,
|
|
61306
|
-
const shiftEnd = (0,
|
|
61307
|
-
const lateCheckIn = (0,
|
|
61304
|
+
const checkOut = checkOutStr ? (0, import_moment_timezone3.default)(checkOutStr, format2) : checkIn;
|
|
61305
|
+
const shiftStart = (0, import_moment_timezone3.default)(checkIn).set({ ...shiftStartTime, second: 59, millisecond: 59 }).subtract(default_early_checkIn, "hour");
|
|
61306
|
+
const shiftEnd = (0, import_moment_timezone3.default)(checkOut).set({ ...shiftEndTime, second: 0, millisecond: 0 }).subtract(default_early_checkIn, "hour");
|
|
61307
|
+
const lateCheckIn = (0, import_moment_timezone3.default)(checkIn).set({
|
|
61308
61308
|
...lateTime,
|
|
61309
61309
|
second: 59,
|
|
61310
61310
|
millisecond: 59
|
|
@@ -61598,7 +61598,7 @@ var MManpowerRemarks = class {
|
|
|
61598
61598
|
|
|
61599
61599
|
// src/repositories/manpower-remarks.repo.ts
|
|
61600
61600
|
var import_mongodb126 = require("mongodb");
|
|
61601
|
-
var
|
|
61601
|
+
var import_moment_timezone4 = __toESM(require("moment-timezone"));
|
|
61602
61602
|
function useManpowerRemarksRepo() {
|
|
61603
61603
|
const db = import_node_server_utils204.useAtlas.getDb();
|
|
61604
61604
|
if (!db) {
|
|
@@ -61652,7 +61652,7 @@ function useManpowerRemarksRepo() {
|
|
|
61652
61652
|
page = page ? page - 1 : 0;
|
|
61653
61653
|
limit = limit || 10;
|
|
61654
61654
|
const searchQuery = {};
|
|
61655
|
-
const nowSGT = (0,
|
|
61655
|
+
const nowSGT = (0, import_moment_timezone4.default)().tz("Asia/Singapore");
|
|
61656
61656
|
searchQuery.serviceProviderId = new import_mongodb126.ObjectId(serviceProviderId);
|
|
61657
61657
|
if (search != "") {
|
|
61658
61658
|
searchQuery.siteName = { $regex: search, $options: "i" };
|
|
@@ -61755,7 +61755,7 @@ function useManpowerRemarksRepo() {
|
|
|
61755
61755
|
}
|
|
61756
61756
|
|
|
61757
61757
|
// src/services/manpower-monitoring.service.ts
|
|
61758
|
-
var
|
|
61758
|
+
var import_moment_timezone5 = __toESM(require("moment-timezone"));
|
|
61759
61759
|
function useManpowerMonitoringSrvc() {
|
|
61760
61760
|
const {
|
|
61761
61761
|
createManpowerMonitoringSettings: _createManpowerMonitoringSettings
|
|
@@ -61773,10 +61773,10 @@ function useManpowerMonitoringSrvc() {
|
|
|
61773
61773
|
const morningAlertFrequencyMins = payload?.shifts?.[payload.shiftType][0]?.alertFrequencyMins;
|
|
61774
61774
|
const afternoonAlertFrequencyMins = payload.shiftType == "3-shifts" ? payload?.shifts?.[payload.shiftType][1]?.alertFrequencyMins : null;
|
|
61775
61775
|
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,
|
|
61776
|
+
const morningAlertTime = import_moment_timezone5.default.tz(morningCheckInTime, "HH:mm", "Asia/Singapore").add(morningAlertFrequencyMins, "minutes").format("HH:mm");
|
|
61777
|
+
const afternoonAlertTime = afternoonCheckInTime ? import_moment_timezone5.default.tz(afternoonCheckInTime, "HH:mm", "Asia/Singapore").add(afternoonAlertFrequencyMins, "minutes").format("HH:mm") : "";
|
|
61778
|
+
const nightAlertTime = import_moment_timezone5.default.tz(nightCheckInTime, "HH:mm", "Asia/Singapore").add(nightAlertFrequencyMins, "minutes").format("HH:mm");
|
|
61779
|
+
const nowSGT = (0, import_moment_timezone5.default)().tz("Asia/Singapore");
|
|
61780
61780
|
try {
|
|
61781
61781
|
const remarksPayload = {
|
|
61782
61782
|
siteId: payload.siteId,
|
|
@@ -64060,7 +64060,7 @@ function useManpowerSitesCtrl() {
|
|
|
64060
64060
|
// src/utils/cron.util.ts
|
|
64061
64061
|
var import_node_server_utils221 = require("@7365admin1/node-server-utils");
|
|
64062
64062
|
var import_mongodb131 = require("mongodb");
|
|
64063
|
-
var
|
|
64063
|
+
var import_moment_timezone6 = __toESM(require("moment-timezone"));
|
|
64064
64064
|
var createManpowerRemarksDaily = async () => {
|
|
64065
64065
|
const db = import_node_server_utils221.useAtlas.getDb();
|
|
64066
64066
|
if (!db) {
|
|
@@ -64071,9 +64071,9 @@ var createManpowerRemarksDaily = async () => {
|
|
|
64071
64071
|
const remarks = db.collection("manpower-remarks");
|
|
64072
64072
|
const serviceProviders = db.collection("site.service-providers");
|
|
64073
64073
|
const items = [];
|
|
64074
|
-
const yesterday = (0,
|
|
64074
|
+
const yesterday = (0, import_moment_timezone6.default)().tz("Asia/Singapore").subtract(1, "days").format("DD-MM-YYYY");
|
|
64075
64075
|
try {
|
|
64076
|
-
const nowSGT = (0,
|
|
64076
|
+
const nowSGT = (0, import_moment_timezone6.default)().tz("Asia/Singapore");
|
|
64077
64077
|
const servideProvider = await serviceProviders.findOne({
|
|
64078
64078
|
name: { $regex: process.env.HRMLABS_DOMAIN, $options: "i" }
|
|
64079
64079
|
});
|
|
@@ -64111,9 +64111,9 @@ var createManpowerRemarksDaily = async () => {
|
|
|
64111
64111
|
const morningAlertFrequencyMins = setting?.shifts?.[shiftType][0]?.alertFrequencyMins;
|
|
64112
64112
|
const afternoonAlertFrequencyMins = shiftType == "3-shifts" ? setting?.shifts?.[shiftType][1]?.alertFrequencyMins : null;
|
|
64113
64113
|
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 =
|
|
64114
|
+
const morningAlertTime = import_moment_timezone6.default.tz(morningCheckInTime, "HH:mm", "Asia/Singapore").add(morningAlertFrequencyMins, "minutes").format("HH:mm");
|
|
64115
|
+
const afternoonAlertTime = afternoonCheckInTime ? import_moment_timezone6.default.tz(afternoonCheckInTime, "HH:mm", "Asia/Singapore").add(afternoonAlertFrequencyMins, "minutes").format("HH:mm") : "";
|
|
64116
|
+
const nightAlertTime = import_moment_timezone6.default.tz(nightCheckInTime, "HH:mm", "Asia/Singapore").add(nightAlertFrequencyMins, "minutes").format("HH:mm");
|
|
64117
64117
|
const remark2 = {
|
|
64118
64118
|
siteId: site.siteId,
|
|
64119
64119
|
siteName: site.siteName,
|
|
@@ -64170,14 +64170,14 @@ var createManpowerRemarksDaily = async () => {
|
|
|
64170
64170
|
};
|
|
64171
64171
|
var updateRemarksisAcknowledged = async () => {
|
|
64172
64172
|
const { getAttendanceDataCount: _getAttendanceDataCount } = useHrmLabsAttendanceSrvc();
|
|
64173
|
-
const nowSGT = (0,
|
|
64173
|
+
const nowSGT = (0, import_moment_timezone6.default)().tz("Asia/Singapore").format("DD-MM-YYYY");
|
|
64174
64174
|
const db = import_node_server_utils221.useAtlas.getDb();
|
|
64175
64175
|
if (!db) {
|
|
64176
64176
|
throw new Error("Unable to connect to server.");
|
|
64177
64177
|
}
|
|
64178
64178
|
const namespace_collection = "manpower-remarks";
|
|
64179
64179
|
const remarks = db.collection(namespace_collection);
|
|
64180
|
-
const timeNow = (0,
|
|
64180
|
+
const timeNow = (0, import_moment_timezone6.default)().tz("Asia/Singapore").format("HH:mm");
|
|
64181
64181
|
const settings = db.collection("manpower-settings");
|
|
64182
64182
|
try {
|
|
64183
64183
|
const matchingDocs = await remarks.find({
|
|
@@ -64305,9 +64305,9 @@ var updateRemarksStatusEod = async () => {
|
|
|
64305
64305
|
}
|
|
64306
64306
|
const remarks = db.collection("manpower-remarks");
|
|
64307
64307
|
const settings = db.collection("manpower-settings");
|
|
64308
|
-
const nowSGT = (0,
|
|
64309
|
-
const yesterdaySGT = (0,
|
|
64310
|
-
const timeNow = (0,
|
|
64308
|
+
const nowSGT = (0, import_moment_timezone6.default)().tz("Asia/Singapore").format("DD-MM-YYYY");
|
|
64309
|
+
const yesterdaySGT = (0, import_moment_timezone6.default)().tz("Asia/Singapore").subtract(1, "days").format("DD-MM-YYYY");
|
|
64310
|
+
const timeNow = (0, import_moment_timezone6.default)().tz("Asia/Singapore").format("HH:mm");
|
|
64311
64311
|
const docs = await remarks.find({
|
|
64312
64312
|
$or: [
|
|
64313
64313
|
// Morning & Afternoon from today
|
|
@@ -64443,7 +64443,7 @@ var isWithinHour = (alertTime, timeNow) => {
|
|
|
64443
64443
|
// src/events/manpower.event.ts
|
|
64444
64444
|
var import_node_server_utils222 = require("@7365admin1/node-server-utils");
|
|
64445
64445
|
var import_mongodb132 = require("mongodb");
|
|
64446
|
-
var
|
|
64446
|
+
var import_moment_timezone7 = __toESM(require("moment-timezone"));
|
|
64447
64447
|
async function manpowerEvents(io) {
|
|
64448
64448
|
let intervalId = null;
|
|
64449
64449
|
let activeConnections = 0;
|
|
@@ -64455,9 +64455,9 @@ async function manpowerEvents(io) {
|
|
|
64455
64455
|
}
|
|
64456
64456
|
const remarks = db.collection("manpower-remarks");
|
|
64457
64457
|
const settings = db.collection("manpower-settings");
|
|
64458
|
-
const selectedDateMoment =
|
|
64458
|
+
const selectedDateMoment = import_moment_timezone7.default.tz(date, "DD-MM-YYYY", "Asia/Singapore");
|
|
64459
64459
|
const selectedDateSGT = selectedDateMoment.format("DD-MM-YYYY");
|
|
64460
|
-
const currentSGT = (0,
|
|
64460
|
+
const currentSGT = (0, import_moment_timezone7.default)().tz("Asia/Singapore");
|
|
64461
64461
|
const docs = await remarks.find({
|
|
64462
64462
|
createdAtSGT: selectedDateSGT,
|
|
64463
64463
|
$or: [
|
|
@@ -64479,7 +64479,7 @@ async function manpowerEvents(io) {
|
|
|
64479
64479
|
}
|
|
64480
64480
|
if (currentSGT.isSame(selectedDateMoment, "day")) {
|
|
64481
64481
|
if (currentSGT.isSameOrAfter(
|
|
64482
|
-
|
|
64482
|
+
import_moment_timezone7.default.tz("19:55", "HH:mm", "Asia/Singapore")
|
|
64483
64483
|
)) {
|
|
64484
64484
|
shiftsToCheck.push({ index: 2, key: "nightShift" });
|
|
64485
64485
|
}
|
|
@@ -64621,6 +64621,13 @@ var import_mongodb134 = require("mongodb");
|
|
|
64621
64621
|
var import_node_server_utils223 = require("@7365admin1/node-server-utils");
|
|
64622
64622
|
var import_mongodb133 = require("mongodb");
|
|
64623
64623
|
var import_joi126 = __toESM(require("joi"));
|
|
64624
|
+
var BillingPaymentStatus = /* @__PURE__ */ ((BillingPaymentStatus2) => {
|
|
64625
|
+
BillingPaymentStatus2["PENDING"] = "pending";
|
|
64626
|
+
BillingPaymentStatus2["SUCCESS"] = "success";
|
|
64627
|
+
BillingPaymentStatus2["FAILED"] = "failed";
|
|
64628
|
+
BillingPaymentStatus2["PARTIAL"] = "partial";
|
|
64629
|
+
return BillingPaymentStatus2;
|
|
64630
|
+
})(BillingPaymentStatus || {});
|
|
64624
64631
|
var schemaBillingItems = import_joi126.default.object({
|
|
64625
64632
|
_id: import_joi126.default.string().hex().optional(),
|
|
64626
64633
|
name: import_joi126.default.string().optional().allow(null, "")
|
|
@@ -64734,8 +64741,8 @@ var useRedDotPaymentRepo = () => {
|
|
|
64734
64741
|
if (type == "single") {
|
|
64735
64742
|
try {
|
|
64736
64743
|
payload = MBillingItems(payload);
|
|
64737
|
-
|
|
64738
|
-
return
|
|
64744
|
+
await paymentCollection().insertOne(payload, { session });
|
|
64745
|
+
return payload.referenceNumber;
|
|
64739
64746
|
} catch (error) {
|
|
64740
64747
|
import_node_server_utils224.logger.log({
|
|
64741
64748
|
level: "error",
|
|
@@ -64764,7 +64771,7 @@ var useRedDotPaymentRepo = () => {
|
|
|
64764
64771
|
{ $set: { referenceNumber } },
|
|
64765
64772
|
{ session }
|
|
64766
64773
|
);
|
|
64767
|
-
return
|
|
64774
|
+
return referenceNumber;
|
|
64768
64775
|
} catch (error) {
|
|
64769
64776
|
import_node_server_utils224.logger.log({
|
|
64770
64777
|
level: "error",
|
|
@@ -64944,6 +64951,29 @@ var useRedDotPaymentRepo = () => {
|
|
|
64944
64951
|
session?.endSession();
|
|
64945
64952
|
}
|
|
64946
64953
|
}
|
|
64954
|
+
async function updateStatus(_id, status, session) {
|
|
64955
|
+
try {
|
|
64956
|
+
_id = new import_mongodb134.ObjectId(_id);
|
|
64957
|
+
} catch {
|
|
64958
|
+
throw new import_node_server_utils224.BadRequestError("Invalid payment ID format.");
|
|
64959
|
+
}
|
|
64960
|
+
try {
|
|
64961
|
+
const res = await paymentCollection().updateOne(
|
|
64962
|
+
{ _id },
|
|
64963
|
+
{ $set: { status, updatedAt: (/* @__PURE__ */ new Date()).toISOString() } },
|
|
64964
|
+
{ session }
|
|
64965
|
+
);
|
|
64966
|
+
if (res.matchedCount === 0) {
|
|
64967
|
+
throw new import_node_server_utils224.NotFoundError("Payment not found.");
|
|
64968
|
+
}
|
|
64969
|
+
return res;
|
|
64970
|
+
} catch (error) {
|
|
64971
|
+
if (error instanceof import_node_server_utils224.AppError) {
|
|
64972
|
+
throw error;
|
|
64973
|
+
}
|
|
64974
|
+
throw new import_node_server_utils224.InternalServerError("Failed to update payment status.");
|
|
64975
|
+
}
|
|
64976
|
+
}
|
|
64947
64977
|
function formatDateString(today) {
|
|
64948
64978
|
today = typeof today === "string" ? new Date(today) : today;
|
|
64949
64979
|
let month = today.getMonth() + 1;
|
|
@@ -64952,7 +64982,7 @@ var useRedDotPaymentRepo = () => {
|
|
|
64952
64982
|
const formattedDate = `${month.toString().padStart(2, "0")}${day.toString().padStart(2, "0")}${year}`;
|
|
64953
64983
|
return formattedDate;
|
|
64954
64984
|
}
|
|
64955
|
-
return { paySingleUnitBill, createPayment, payMultipleUnitBill };
|
|
64985
|
+
return { paySingleUnitBill, createPayment, payMultipleUnitBill, updateStatus };
|
|
64956
64986
|
};
|
|
64957
64987
|
|
|
64958
64988
|
// src/services/reddot-payment.service.ts
|
|
@@ -65096,7 +65126,7 @@ var useRedDotPaymentSvc = () => {
|
|
|
65096
65126
|
var import_joi127 = __toESM(require("joi"));
|
|
65097
65127
|
var import_node_server_utils226 = require("@7365admin1/node-server-utils");
|
|
65098
65128
|
function useRedDotPaymentController() {
|
|
65099
|
-
const { createPayment: _createPayment } = useRedDotPaymentRepo();
|
|
65129
|
+
const { createPayment: _createPayment, updateStatus: _updateStatus } = useRedDotPaymentRepo();
|
|
65100
65130
|
const redirectPaymentTransaction = async (req, res) => {
|
|
65101
65131
|
try {
|
|
65102
65132
|
const data = req.body;
|
|
@@ -65160,17 +65190,43 @@ function useRedDotPaymentController() {
|
|
|
65160
65190
|
try {
|
|
65161
65191
|
const payment = await _createPayment(type, value);
|
|
65162
65192
|
res.status(201).json({
|
|
65163
|
-
message: "
|
|
65193
|
+
message: "success",
|
|
65164
65194
|
data: payment
|
|
65165
65195
|
});
|
|
65166
65196
|
} catch (error) {
|
|
65167
|
-
|
|
65197
|
+
const status = error?.statusCode ?? 500;
|
|
65198
|
+
res.status(status).json({ message: "failed" });
|
|
65199
|
+
}
|
|
65200
|
+
}
|
|
65201
|
+
async function updateStatus(req, res, next) {
|
|
65202
|
+
const schema2 = import_joi127.default.object({
|
|
65203
|
+
_id: import_joi127.default.string().hex().length(24).required(),
|
|
65204
|
+
status: import_joi127.default.string().valid(...Object.values(BillingPaymentStatus)).required()
|
|
65205
|
+
});
|
|
65206
|
+
const { error, value } = schema2.validate({
|
|
65207
|
+
_id: req.params.id,
|
|
65208
|
+
status: req.body.status
|
|
65209
|
+
});
|
|
65210
|
+
if (error) {
|
|
65211
|
+
import_node_server_utils226.logger.log({ level: "error", message: error.message });
|
|
65212
|
+
next(new import_node_server_utils226.BadRequestError(error.message));
|
|
65213
|
+
return;
|
|
65214
|
+
}
|
|
65215
|
+
try {
|
|
65216
|
+
const data = await _updateStatus(value._id, value.status);
|
|
65217
|
+
res.status(200).json({ message: "success", data });
|
|
65218
|
+
return;
|
|
65219
|
+
} catch (error2) {
|
|
65220
|
+
import_node_server_utils226.logger.log({ level: "error", message: error2.message });
|
|
65221
|
+
next(error2);
|
|
65222
|
+
return;
|
|
65168
65223
|
}
|
|
65169
65224
|
}
|
|
65170
65225
|
return {
|
|
65171
65226
|
redirectPaymentTransaction,
|
|
65172
65227
|
enquirePaymentTransaction,
|
|
65173
|
-
createPayment
|
|
65228
|
+
createPayment,
|
|
65229
|
+
updateStatus
|
|
65174
65230
|
};
|
|
65175
65231
|
}
|
|
65176
65232
|
|