@7365admin1/core 3.25.0 → 3.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.d.ts +20 -1
- package/dist/index.js +160 -92
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +160 -92
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -476,11 +476,12 @@ declare function useVerificationService(): {
|
|
|
476
476
|
metadata: TKeyValuePair;
|
|
477
477
|
}) => Promise<bson.ObjectId>;
|
|
478
478
|
createForgetPassword: (email: string) => Promise<string>;
|
|
479
|
-
createServiceProviderInvite: ({ email, orgId, siteId, siteName, inviteType, }: {
|
|
479
|
+
createServiceProviderInvite: ({ email, orgId, siteId, siteName, app, inviteType, }: {
|
|
480
480
|
email: string;
|
|
481
481
|
orgId: string;
|
|
482
482
|
siteId: string;
|
|
483
483
|
siteName: string;
|
|
484
|
+
app: string;
|
|
484
485
|
inviteType: "create-org" | "organization-invite";
|
|
485
486
|
}) => Promise<bson.ObjectId>;
|
|
486
487
|
getById: (id: string) => Promise<TVerification>;
|
|
@@ -2923,6 +2924,13 @@ declare function MVisitorTransaction(value: TVisitorTransaction): {
|
|
|
2923
2924
|
} | null;
|
|
2924
2925
|
arrivalTime: string | null | undefined;
|
|
2925
2926
|
duration: number | null | undefined;
|
|
2927
|
+
members: {
|
|
2928
|
+
name: string;
|
|
2929
|
+
nric: string;
|
|
2930
|
+
visitorPass?: TKeyRef[] | null | undefined;
|
|
2931
|
+
passKeys?: TKeyRef[] | null | undefined;
|
|
2932
|
+
contact: string;
|
|
2933
|
+
}[] | undefined;
|
|
2926
2934
|
};
|
|
2927
2935
|
|
|
2928
2936
|
declare const visitors_namespace_collection = "visitor.transactions";
|
|
@@ -6099,6 +6107,17 @@ declare function useNewDashboardRepo(): {
|
|
|
6099
6107
|
count: any;
|
|
6100
6108
|
ongoing: any;
|
|
6101
6109
|
waitingApproval: any;
|
|
6110
|
+
byStatus: {
|
|
6111
|
+
Pending: number;
|
|
6112
|
+
Approved: number;
|
|
6113
|
+
Ongoing: number;
|
|
6114
|
+
"For Review": number;
|
|
6115
|
+
"With Balance": number;
|
|
6116
|
+
"With Refund": number;
|
|
6117
|
+
Completed: number;
|
|
6118
|
+
Rejected: number;
|
|
6119
|
+
Cancelled: number;
|
|
6120
|
+
};
|
|
6102
6121
|
percentage: number;
|
|
6103
6122
|
};
|
|
6104
6123
|
workOrderStatus: {
|
package/dist/index.js
CHANGED
|
@@ -12520,19 +12520,22 @@ function useVerificationService() {
|
|
|
12520
12520
|
orgId,
|
|
12521
12521
|
siteId,
|
|
12522
12522
|
siteName,
|
|
12523
|
+
app,
|
|
12523
12524
|
inviteType
|
|
12524
12525
|
}) {
|
|
12525
12526
|
const schema2 = import_joi11.default.object({
|
|
12526
12527
|
email: import_joi11.default.string().email().lowercase().required(),
|
|
12527
12528
|
orgId: import_joi11.default.string().hex().length(24).required(),
|
|
12528
12529
|
siteId: import_joi11.default.string().hex().length(24).required(),
|
|
12529
|
-
siteName: import_joi11.default.string().required()
|
|
12530
|
+
siteName: import_joi11.default.string().required(),
|
|
12531
|
+
app: import_joi11.default.string().required()
|
|
12530
12532
|
});
|
|
12531
12533
|
const { error } = schema2.validate({
|
|
12532
12534
|
email,
|
|
12533
12535
|
orgId,
|
|
12534
12536
|
siteId,
|
|
12535
|
-
siteName
|
|
12537
|
+
siteName,
|
|
12538
|
+
app
|
|
12536
12539
|
});
|
|
12537
12540
|
if (error) {
|
|
12538
12541
|
const messages = error.details.map((d) => d.message).join(", ");
|
|
@@ -12547,7 +12550,8 @@ function useVerificationService() {
|
|
|
12547
12550
|
metadata: {
|
|
12548
12551
|
siteId,
|
|
12549
12552
|
siteName,
|
|
12550
|
-
org: orgId
|
|
12553
|
+
org: orgId,
|
|
12554
|
+
app
|
|
12551
12555
|
},
|
|
12552
12556
|
expireAt: new Date(
|
|
12553
12557
|
(/* @__PURE__ */ new Date()).getTime() + 72 * 60 * 60 * 1e3
|
|
@@ -12567,7 +12571,7 @@ function useVerificationService() {
|
|
|
12567
12571
|
const res = await _add(value);
|
|
12568
12572
|
const dir = __dirname;
|
|
12569
12573
|
const filePath = (0, import_node_server_utils21.getDirectory)(dir, `./public/handlebars/${value.type}`);
|
|
12570
|
-
const link = `${APP_MAIN}/verify/${
|
|
12574
|
+
const link = `${APP_MAIN}/verify/service-provider-invite/${res}`;
|
|
12571
12575
|
const emailContent = (0, import_node_server_utils21.compileHandlebar)({
|
|
12572
12576
|
context: {
|
|
12573
12577
|
email,
|
|
@@ -15136,6 +15140,7 @@ function useVerificationController() {
|
|
|
15136
15140
|
orgId: import_joi16.default.string().hex().required(),
|
|
15137
15141
|
siteId: import_joi16.default.string().hex().required(),
|
|
15138
15142
|
siteName: import_joi16.default.string().required(),
|
|
15143
|
+
app: import_joi16.default.string().required(),
|
|
15139
15144
|
inviteType: import_joi16.default.string().valid("create-org", "organization-invite").required()
|
|
15140
15145
|
});
|
|
15141
15146
|
const { error } = validation.validate(payload);
|
|
@@ -15152,6 +15157,7 @@ function useVerificationController() {
|
|
|
15152
15157
|
orgId,
|
|
15153
15158
|
siteId,
|
|
15154
15159
|
siteName,
|
|
15160
|
+
app,
|
|
15155
15161
|
inviteType
|
|
15156
15162
|
} = payload;
|
|
15157
15163
|
try {
|
|
@@ -15160,6 +15166,7 @@ function useVerificationController() {
|
|
|
15160
15166
|
orgId,
|
|
15161
15167
|
siteId,
|
|
15162
15168
|
siteName,
|
|
15169
|
+
app,
|
|
15163
15170
|
inviteType
|
|
15164
15171
|
});
|
|
15165
15172
|
const cookieOptions = {
|
|
@@ -21515,7 +21522,8 @@ function MVisitorTransaction(value) {
|
|
|
21515
21522
|
updatedBy: value.inviterId ?? ""
|
|
21516
21523
|
} : null,
|
|
21517
21524
|
arrivalTime: value.arrivalTime,
|
|
21518
|
-
duration: value.duration
|
|
21525
|
+
duration: value.duration,
|
|
21526
|
+
members: value.members
|
|
21519
21527
|
};
|
|
21520
21528
|
}
|
|
21521
21529
|
|
|
@@ -34452,7 +34460,7 @@ var KeyRepo = class {
|
|
|
34452
34460
|
findOptions
|
|
34453
34461
|
);
|
|
34454
34462
|
console.log("visitorId", visitorId.toString());
|
|
34455
|
-
console.log("latestHistory.visitorId", latestHistory?.visitorId
|
|
34463
|
+
console.log("latestHistory.visitorId", latestHistory?.visitorId?.toString());
|
|
34456
34464
|
if (latestHistory?.visitorId && latestHistory.visitorId?.toString() !== visitorId.toString()) {
|
|
34457
34465
|
console.log("Not updating keyId", keyId);
|
|
34458
34466
|
return;
|
|
@@ -34525,70 +34533,59 @@ var KeyRepo = class {
|
|
|
34525
34533
|
return Promise.reject("Failed to delete key");
|
|
34526
34534
|
}
|
|
34527
34535
|
}
|
|
34528
|
-
static async getById2(id) {
|
|
34529
|
-
return this.collection().aggregate(
|
|
34530
|
-
|
|
34531
|
-
|
|
34532
|
-
|
|
34533
|
-
|
|
34534
|
-
|
|
34535
|
-
|
|
34536
|
-
|
|
34537
|
-
|
|
34538
|
-
|
|
34539
|
-
|
|
34540
|
-
|
|
34541
|
-
|
|
34542
|
-
|
|
34543
|
-
|
|
34544
|
-
|
|
34545
|
-
|
|
34546
|
-
|
|
34547
|
-
|
|
34548
|
-
|
|
34549
|
-
|
|
34550
|
-
|
|
34551
|
-
|
|
34552
|
-
|
|
34553
|
-
|
|
34554
|
-
|
|
34555
|
-
|
|
34556
|
-
|
|
34557
|
-
|
|
34558
|
-
|
|
34559
|
-
|
|
34560
|
-
|
|
34561
|
-
|
|
34562
|
-
|
|
34536
|
+
static async getById2(id, session) {
|
|
34537
|
+
return this.collection().aggregate(
|
|
34538
|
+
[
|
|
34539
|
+
{ $match: { _id: new import_mongodb62.ObjectId(id) } },
|
|
34540
|
+
{
|
|
34541
|
+
$lookup: {
|
|
34542
|
+
from: "qr-code-templates",
|
|
34543
|
+
localField: "template",
|
|
34544
|
+
foreignField: "_id",
|
|
34545
|
+
as: "QRTemplateInfo"
|
|
34546
|
+
}
|
|
34547
|
+
},
|
|
34548
|
+
{
|
|
34549
|
+
$unwind: {
|
|
34550
|
+
path: "$QRTemplateInfo",
|
|
34551
|
+
preserveNullAndEmptyArrays: true
|
|
34552
|
+
}
|
|
34553
|
+
},
|
|
34554
|
+
{
|
|
34555
|
+
$addFields: {
|
|
34556
|
+
prefixPass: { $toUpper: "$QRTemplateInfo.prefixPass" },
|
|
34557
|
+
prefixKey: { $toUpper: "$QRTemplateInfo.prefixKey" },
|
|
34558
|
+
templateName: "$QRTemplateInfo.name"
|
|
34559
|
+
}
|
|
34560
|
+
},
|
|
34561
|
+
{
|
|
34562
|
+
$addFields: {
|
|
34563
|
+
prefixAndName: {
|
|
34564
|
+
$cond: {
|
|
34565
|
+
if: { $or: [{ $not: "$prefixPass" }, { $not: "$prefixKey" }] },
|
|
34566
|
+
then: "$name",
|
|
34567
|
+
else: {
|
|
34568
|
+
$cond: {
|
|
34569
|
+
if: { $eq: ["$passType", "pass-key"] },
|
|
34570
|
+
then: { $concat: ["$prefixKey", "$name"] },
|
|
34571
|
+
else: { $concat: ["$prefixPass", "$name"] }
|
|
34572
|
+
}
|
|
34563
34573
|
}
|
|
34564
34574
|
}
|
|
34565
34575
|
}
|
|
34566
34576
|
}
|
|
34567
34577
|
}
|
|
34568
|
-
|
|
34569
|
-
|
|
34578
|
+
],
|
|
34579
|
+
{ session }
|
|
34580
|
+
).toArray().then((results) => results.length ? results[0] : null);
|
|
34570
34581
|
}
|
|
34571
|
-
static async
|
|
34572
|
-
|
|
34573
|
-
|
|
34574
|
-
|
|
34575
|
-
|
|
34576
|
-
|
|
34577
|
-
|
|
34578
|
-
if (getPass?.status && getPass?.status.toLowerCase() != "Available".toLowerCase())
|
|
34579
|
-
throw new Error(`Pass ${getPass?.prefixAndName} is ${getPass?.status}`);
|
|
34580
|
-
}
|
|
34581
|
-
}
|
|
34582
|
-
if (Array.isArray(passKeys) && passKeys.length > 0) {
|
|
34583
|
-
for (let i = 0; i < passKeys.length; i++) {
|
|
34584
|
-
let key = await convertObjectIdUtil2(passKeys[i].keyId, "Key ID");
|
|
34585
|
-
const getPass = await this.getById2(key);
|
|
34586
|
-
if (!getPass)
|
|
34587
|
-
throw new Error(`Key not found`);
|
|
34588
|
-
if (getPass?.status && getPass?.status.toLowerCase() != "Available".toLowerCase())
|
|
34589
|
-
throw new Error(`Pass ${getPass?.prefixAndName} is ${getPass?.status}`);
|
|
34590
|
-
}
|
|
34591
|
-
}
|
|
34582
|
+
static async checkPassOrKeyAvailability(passOrKeyId, type, session) {
|
|
34583
|
+
let passOrKeyObjectId = await convertObjectIdUtil2(passOrKeyId, `${type} Id`);
|
|
34584
|
+
const getPassOrKey = await this.getById2(passOrKeyObjectId, session);
|
|
34585
|
+
if (!getPassOrKey)
|
|
34586
|
+
throw new Error(`${type} not found`);
|
|
34587
|
+
if (getPassOrKey?.status && getPassOrKey?.status.toLowerCase() != "Available".toLowerCase())
|
|
34588
|
+
throw new Error(`${type} ${getPassOrKey?.prefixAndName} is ${getPassOrKey?.status}`);
|
|
34592
34589
|
}
|
|
34593
34590
|
};
|
|
34594
34591
|
|
|
@@ -34953,9 +34950,6 @@ function useVisitorTransactionService() {
|
|
|
34953
34950
|
} = value;
|
|
34954
34951
|
for (let i = 0; i < value.members.length; i += chunkSize) {
|
|
34955
34952
|
const chunk = value.members.slice(i, i + chunkSize);
|
|
34956
|
-
for (const member of chunk) {
|
|
34957
|
-
await KeyRepo.checkPassKeyAvailability(member.visitorPass, member.passKeys);
|
|
34958
|
-
}
|
|
34959
34953
|
await Promise.all(
|
|
34960
34954
|
chunk.map(async (member) => {
|
|
34961
34955
|
const clonedMember = structuredClone(member);
|
|
@@ -34996,6 +34990,7 @@ function useVisitorTransactionService() {
|
|
|
34996
34990
|
);
|
|
34997
34991
|
console.log("visitorId service", visitorId);
|
|
34998
34992
|
for (const item of preparedVisitorPass) {
|
|
34993
|
+
await KeyRepo.checkPassOrKeyAvailability(item.keyId, "Pass", session);
|
|
34999
34994
|
await KeyRepo.updateKeyById(
|
|
35000
34995
|
item.keyId,
|
|
35001
34996
|
{
|
|
@@ -35011,6 +35006,7 @@ function useVisitorTransactionService() {
|
|
|
35011
35006
|
);
|
|
35012
35007
|
}
|
|
35013
35008
|
for (const item of preparedPassKeys) {
|
|
35009
|
+
await KeyRepo.checkPassOrKeyAvailability(item.keyId, "Key", session);
|
|
35014
35010
|
await KeyRepo.updateKeyById(
|
|
35015
35011
|
item.keyId,
|
|
35016
35012
|
{
|
|
@@ -35053,7 +35049,6 @@ function useVisitorTransactionService() {
|
|
|
35053
35049
|
if (found === 1)
|
|
35054
35050
|
throw new import_node_server_utils107.BadRequestError("This plate number is blocklisted");
|
|
35055
35051
|
}
|
|
35056
|
-
await KeyRepo.checkPassKeyAvailability(value.visitorPass, value.passKeys);
|
|
35057
35052
|
if (Array.isArray(value.visitorPass)) {
|
|
35058
35053
|
for (const item of value.visitorPass) {
|
|
35059
35054
|
item.receivedDate = /* @__PURE__ */ new Date();
|
|
@@ -35073,6 +35068,7 @@ function useVisitorTransactionService() {
|
|
|
35073
35068
|
const result = await _add(value, session);
|
|
35074
35069
|
if (Array.isArray(value.visitorPass)) {
|
|
35075
35070
|
for (const item of value.visitorPass) {
|
|
35071
|
+
await KeyRepo.checkPassOrKeyAvailability(item.keyId, "Pass", session);
|
|
35076
35072
|
await KeyRepo.updateKeyById(
|
|
35077
35073
|
item.keyId,
|
|
35078
35074
|
{ status: "In Use" /* IN_USE */, updatedBy: value.createdBy },
|
|
@@ -35087,6 +35083,7 @@ function useVisitorTransactionService() {
|
|
|
35087
35083
|
}
|
|
35088
35084
|
if (Array.isArray(value.passKeys)) {
|
|
35089
35085
|
for (const item of value.passKeys) {
|
|
35086
|
+
await KeyRepo.checkPassOrKeyAvailability(item.keyId, "Key", session);
|
|
35090
35087
|
await KeyRepo.updateKeyById(
|
|
35091
35088
|
item.keyId,
|
|
35092
35089
|
{ status: "In Use" /* IN_USE */, updatedBy: value.createdBy },
|
|
@@ -35183,6 +35180,12 @@ function useVisitorTransactionService() {
|
|
|
35183
35180
|
if (value.site) {
|
|
35184
35181
|
value.site = typeof value.site === "string" ? new import_mongodb63.ObjectId(value.site) : value.site;
|
|
35185
35182
|
}
|
|
35183
|
+
if (value?.block) {
|
|
35184
|
+
value.block = await convertObjectIdUtil2(value.block, "block Id");
|
|
35185
|
+
}
|
|
35186
|
+
if (value?.level) {
|
|
35187
|
+
value.level = await convertObjectIdUtil2(value.level, "level Id");
|
|
35188
|
+
}
|
|
35186
35189
|
if (value.unit) {
|
|
35187
35190
|
value.unit = typeof value.unit === "string" ? new import_mongodb63.ObjectId(value.unit) : value.unit;
|
|
35188
35191
|
const unit = await _getUnitById(value.unit);
|
|
@@ -35194,6 +35197,7 @@ function useVisitorTransactionService() {
|
|
|
35194
35197
|
if (Array.isArray(value.visitorPass)) {
|
|
35195
35198
|
for (const item of value.visitorPass) {
|
|
35196
35199
|
if (item.add) {
|
|
35200
|
+
await KeyRepo.checkPassOrKeyAvailability(item.keyId, "Pass", session);
|
|
35197
35201
|
await KeyRepo.updateKeyById(
|
|
35198
35202
|
item.keyId,
|
|
35199
35203
|
{
|
|
@@ -35242,6 +35246,7 @@ function useVisitorTransactionService() {
|
|
|
35242
35246
|
if (Array.isArray(value.passKeys)) {
|
|
35243
35247
|
for (const item of value.passKeys) {
|
|
35244
35248
|
if (item.add) {
|
|
35249
|
+
await KeyRepo.checkPassOrKeyAvailability(item.keyId, "Key", session);
|
|
35245
35250
|
await KeyRepo.updateKeyById(
|
|
35246
35251
|
item.keyId,
|
|
35247
35252
|
{
|
|
@@ -57814,12 +57819,9 @@ function useNewDashboardRepo() {
|
|
|
57814
57819
|
function getDateRange(p) {
|
|
57815
57820
|
const now = (0, import_moment.default)().tz("Asia/Singapore");
|
|
57816
57821
|
if (p === "thisWeek" /* THIS_WEEK */) {
|
|
57817
|
-
const rollingStart = now.clone().subtract(6, "days").startOf("day");
|
|
57818
|
-
const monthStart = now.clone().startOf("month");
|
|
57819
|
-
const start = import_moment.default.max(rollingStart, monthStart);
|
|
57820
57822
|
return {
|
|
57821
|
-
$gte:
|
|
57822
|
-
$lte: now.clone().endOf("
|
|
57823
|
+
$gte: now.clone().startOf("isoWeek").toDate(),
|
|
57824
|
+
$lte: now.clone().endOf("isoWeek").toDate()
|
|
57823
57825
|
};
|
|
57824
57826
|
}
|
|
57825
57827
|
if (p === "thisMonth" /* THIS_MONTH */) {
|
|
@@ -57833,6 +57835,12 @@ function useNewDashboardRepo() {
|
|
|
57833
57835
|
$lte: now.clone().endOf("day").toDate()
|
|
57834
57836
|
};
|
|
57835
57837
|
}
|
|
57838
|
+
function getSiteDayRange(date = import_moment.default.tz("Asia/Singapore")) {
|
|
57839
|
+
return {
|
|
57840
|
+
$gte: date.clone().startOf("day").toDate(),
|
|
57841
|
+
$lte: date.clone().endOf("day").toDate()
|
|
57842
|
+
};
|
|
57843
|
+
}
|
|
57836
57844
|
const calculatePercentageChange = (currentCount, previousCount) => {
|
|
57837
57845
|
if (previousCount === 0) {
|
|
57838
57846
|
return currentCount > 0 ? 100 : 0;
|
|
@@ -58259,24 +58267,27 @@ function useNewDashboardRepo() {
|
|
|
58259
58267
|
const siteIdObj = (0, import_node_server_utils201.toObjectId)(siteId);
|
|
58260
58268
|
const startOfToday = import_moment.default.tz("Asia/Singapore").startOf("day").toDate();
|
|
58261
58269
|
const endOfToday = import_moment.default.tz("Asia/Singapore").endOf("day").toDate();
|
|
58262
|
-
const
|
|
58263
|
-
const
|
|
58264
|
-
|
|
58265
|
-
|
|
58266
|
-
const
|
|
58267
|
-
const
|
|
58268
|
-
|
|
58270
|
+
const facilityTodayRange = getSiteDayRange();
|
|
58271
|
+
const facilityYesterdayRange = getSiteDayRange(
|
|
58272
|
+
import_moment.default.tz("Asia/Singapore").subtract(1, "day")
|
|
58273
|
+
);
|
|
58274
|
+
const facilityTodayStart = facilityTodayRange.$gte;
|
|
58275
|
+
const facilityTodayEnd = facilityTodayRange.$lte;
|
|
58276
|
+
const facilityYesterdayStart = facilityYesterdayRange.$gte;
|
|
58277
|
+
const facilityYesterdayEnd = facilityYesterdayRange.$lte;
|
|
58278
|
+
let facilityPeriodRange = {
|
|
58279
|
+
$gte: facilityTodayStart,
|
|
58280
|
+
$lte: facilityTodayEnd
|
|
58281
|
+
};
|
|
58269
58282
|
if (period === "thisWeek" /* THIS_WEEK */) {
|
|
58270
|
-
const startStr = import_moment.default.tz("Asia/Singapore").subtract(7, "days").format("YYYY-MM-DD");
|
|
58271
58283
|
facilityPeriodRange = {
|
|
58272
|
-
$gte: import_moment.default.
|
|
58273
|
-
$lte:
|
|
58284
|
+
$gte: import_moment.default.tz("Asia/Singapore").startOf("isoWeek").toDate(),
|
|
58285
|
+
$lte: import_moment.default.tz("Asia/Singapore").endOf("isoWeek").toDate()
|
|
58274
58286
|
};
|
|
58275
58287
|
} else if (period === "thisMonth" /* THIS_MONTH */) {
|
|
58276
|
-
const startStr = import_moment.default.tz("Asia/Singapore").subtract(30, "days").format("YYYY-MM-DD");
|
|
58277
58288
|
facilityPeriodRange = {
|
|
58278
|
-
$gte: import_moment.default.
|
|
58279
|
-
$lte:
|
|
58289
|
+
$gte: import_moment.default.tz("Asia/Singapore").startOf("month").toDate(),
|
|
58290
|
+
$lte: import_moment.default.tz("Asia/Singapore").endOf("month").toDate()
|
|
58280
58291
|
};
|
|
58281
58292
|
}
|
|
58282
58293
|
const upcomingEvents = await db.collection(events_namespace_collection).find({
|
|
@@ -58360,6 +58371,18 @@ function useNewDashboardRepo() {
|
|
|
58360
58371
|
const facilityCollection = db.collection(
|
|
58361
58372
|
facility_bookings_namespace_collection2
|
|
58362
58373
|
);
|
|
58374
|
+
const facilityBookingStatuses = [
|
|
58375
|
+
"Pending",
|
|
58376
|
+
"Approved",
|
|
58377
|
+
"Ongoing",
|
|
58378
|
+
"For Review",
|
|
58379
|
+
"With Balance",
|
|
58380
|
+
"For Refund",
|
|
58381
|
+
"With Refund",
|
|
58382
|
+
"Completed",
|
|
58383
|
+
"Rejected",
|
|
58384
|
+
"Cancelled"
|
|
58385
|
+
];
|
|
58363
58386
|
const [
|
|
58364
58387
|
workOrderReport,
|
|
58365
58388
|
yesterdayWorkOrderReport,
|
|
@@ -58510,7 +58533,7 @@ function useNewDashboardRepo() {
|
|
|
58510
58533
|
}
|
|
58511
58534
|
}
|
|
58512
58535
|
],
|
|
58513
|
-
status: { $
|
|
58536
|
+
status: { $in: facilityBookingStatuses }
|
|
58514
58537
|
}
|
|
58515
58538
|
},
|
|
58516
58539
|
{
|
|
@@ -58535,6 +58558,25 @@ function useNewDashboardRepo() {
|
|
|
58535
58558
|
}
|
|
58536
58559
|
},
|
|
58537
58560
|
{ $count: "count" }
|
|
58561
|
+
],
|
|
58562
|
+
byStatus: [
|
|
58563
|
+
{
|
|
58564
|
+
$match: {
|
|
58565
|
+
status: { $in: facilityBookingStatuses }
|
|
58566
|
+
}
|
|
58567
|
+
},
|
|
58568
|
+
{
|
|
58569
|
+
$group: {
|
|
58570
|
+
_id: {
|
|
58571
|
+
$cond: [
|
|
58572
|
+
{ $eq: ["$status", "For Refund"] },
|
|
58573
|
+
"With Refund",
|
|
58574
|
+
"$status"
|
|
58575
|
+
]
|
|
58576
|
+
},
|
|
58577
|
+
count: { $sum: 1 }
|
|
58578
|
+
}
|
|
58579
|
+
}
|
|
58538
58580
|
]
|
|
58539
58581
|
}
|
|
58540
58582
|
}
|
|
@@ -58545,7 +58587,12 @@ function useNewDashboardRepo() {
|
|
|
58545
58587
|
site: { $in: [siteIdObj, siteId] },
|
|
58546
58588
|
...facilityMatchObj,
|
|
58547
58589
|
$or: [
|
|
58548
|
-
{
|
|
58590
|
+
{
|
|
58591
|
+
date: {
|
|
58592
|
+
$gte: facilityYesterdayStart,
|
|
58593
|
+
$lte: facilityYesterdayEnd
|
|
58594
|
+
}
|
|
58595
|
+
},
|
|
58549
58596
|
{
|
|
58550
58597
|
date: {
|
|
58551
58598
|
$gte: facilityYesterdayStart.toISOString(),
|
|
@@ -58553,7 +58600,7 @@ function useNewDashboardRepo() {
|
|
|
58553
58600
|
}
|
|
58554
58601
|
}
|
|
58555
58602
|
],
|
|
58556
|
-
status: { $
|
|
58603
|
+
status: { $in: facilityBookingStatuses }
|
|
58557
58604
|
}
|
|
58558
58605
|
},
|
|
58559
58606
|
{ $count: "count" }
|
|
@@ -58572,7 +58619,7 @@ function useNewDashboardRepo() {
|
|
|
58572
58619
|
}
|
|
58573
58620
|
}
|
|
58574
58621
|
],
|
|
58575
|
-
status: { $
|
|
58622
|
+
status: { $in: facilityBookingStatuses }
|
|
58576
58623
|
}
|
|
58577
58624
|
},
|
|
58578
58625
|
{ $count: "count" }
|
|
@@ -58596,8 +58643,25 @@ function useNewDashboardRepo() {
|
|
|
58596
58643
|
const fFacet = facilityReport[0] ?? {
|
|
58597
58644
|
total: [],
|
|
58598
58645
|
ongoing: [],
|
|
58599
|
-
waitingApproval: []
|
|
58646
|
+
waitingApproval: [],
|
|
58647
|
+
byStatus: []
|
|
58648
|
+
};
|
|
58649
|
+
const facilityBookingStatusCounts = {
|
|
58650
|
+
Pending: 0,
|
|
58651
|
+
Approved: 0,
|
|
58652
|
+
Ongoing: 0,
|
|
58653
|
+
"For Review": 0,
|
|
58654
|
+
"With Balance": 0,
|
|
58655
|
+
"With Refund": 0,
|
|
58656
|
+
Completed: 0,
|
|
58657
|
+
Rejected: 0,
|
|
58658
|
+
Cancelled: 0
|
|
58600
58659
|
};
|
|
58660
|
+
for (const item of fFacet.byStatus ?? []) {
|
|
58661
|
+
if (typeof item?._id === "string" && item._id in facilityBookingStatusCounts) {
|
|
58662
|
+
facilityBookingStatusCounts[item._id] = item.count ?? 0;
|
|
58663
|
+
}
|
|
58664
|
+
}
|
|
58601
58665
|
const workOrderStatus = {
|
|
58602
58666
|
pending: 0,
|
|
58603
58667
|
inProgress: 0,
|
|
@@ -58644,6 +58708,7 @@ function useNewDashboardRepo() {
|
|
|
58644
58708
|
count: fFacet.total[0]?.count ?? 0,
|
|
58645
58709
|
ongoing: fFacet.ongoing[0]?.count ?? 0,
|
|
58646
58710
|
waitingApproval: fFacet.waitingApproval[0]?.count ?? 0,
|
|
58711
|
+
byStatus: facilityBookingStatusCounts,
|
|
58647
58712
|
percentage: calculatePercentageChange(
|
|
58648
58713
|
todayFacilityReport[0]?.count ?? 0,
|
|
58649
58714
|
yesterdayFacilityReport[0]?.count ?? 0
|
|
@@ -63374,9 +63439,12 @@ var useRedDotPaymentRepo = () => {
|
|
|
63374
63439
|
}
|
|
63375
63440
|
const now = /* @__PURE__ */ new Date();
|
|
63376
63441
|
const unitUpdate = {
|
|
63442
|
+
method: payload.method,
|
|
63443
|
+
message: payload.message,
|
|
63377
63444
|
updatedAt: now.toISOString(),
|
|
63378
63445
|
paymentStatus: payload.paymentStatus,
|
|
63379
|
-
transaction_id: payload.transaction_id
|
|
63446
|
+
transaction_id: payload.transaction_id,
|
|
63447
|
+
paidBy: paymentInfo.paidBy
|
|
63380
63448
|
};
|
|
63381
63449
|
const paymentUpdate = {
|
|
63382
63450
|
updatedAt: now.toISOString(),
|