@7365admin1/core 3.34.4-staging.15 → 3.34.4-staging.17

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 CHANGED
@@ -2763,6 +2763,7 @@ type TPerson = {
2763
2763
  deletedAt?: string | Date;
2764
2764
  plateNumbers?: string[];
2765
2765
  contacts?: string[];
2766
+ updatedBy?: string | ObjectId;
2766
2767
  };
2767
2768
  declare const PERSON_TYPES: readonly ["walk-in", "drop-off", "contractor", "delivery", "pick-up", "guest", "tenant", "resident"];
2768
2769
  type PersonType = (typeof PERSON_TYPES)[number];
@@ -2813,7 +2814,7 @@ type visitorPersonService = {
2813
2814
  type: visitorType;
2814
2815
  site: string | ObjectId;
2815
2816
  company?: string;
2816
- updatedBy?: string | ObjectId;
2817
+ updatedBy?: string | ObjectId | undefined;
2817
2818
  };
2818
2819
  type visitorPersonRepo = {
2819
2820
  nric: string;
@@ -2825,8 +2826,6 @@ type visitorPersonRepo = {
2825
2826
  site: string | ObjectId;
2826
2827
  companyName: string[];
2827
2828
  status: string;
2828
- createdAt: string | Date;
2829
- updatedAt: string | Date;
2830
2829
  createdBy?: string | ObjectId | undefined;
2831
2830
  updatedBy?: string | ObjectId | undefined;
2832
2831
  };
@@ -3155,7 +3154,7 @@ declare function usePersonRepo(): {
3155
3154
  getByUserId: (userId: string | ObjectId) => Promise<TPerson | null>;
3156
3155
  reviewResidentPerson: (_id: ObjectId | string, value: Partial<TPerson>, session?: ClientSession) => Promise<mongodb.UpdateResult<TPerson>>;
3157
3156
  addFromVisitor: (value: visitorPersonRepo, session?: ClientSession) => Promise<mongodb.InsertOneResult<TPerson>>;
3158
- findFirstOne: (query: Record<string, any>, session?: ClientSession) => Promise<mongodb.WithId<TPerson>[]>;
3157
+ findFirstTen: (query: Record<string, any>, session?: ClientSession) => Promise<mongodb.WithId<TPerson>[]>;
3159
3158
  };
3160
3159
 
3161
3160
  declare function usePersonController(): {
@@ -6181,7 +6180,14 @@ declare function useNewDashboardRepo(): {
6181
6180
  missed: any;
6182
6181
  percentage: number;
6183
6182
  };
6184
- activePatrolItems: any[];
6183
+ activePatrolItems: {
6184
+ id: string;
6185
+ title: any;
6186
+ subtitle: string;
6187
+ person: any;
6188
+ status: any;
6189
+ time: string;
6190
+ }[];
6185
6191
  }>;
6186
6192
  getPropertyManagementDashboard: (siteId: string, period?: Period, type?: string, facility?: string) => Promise<{
6187
6193
  openWorkOrder: {
package/dist/index.js CHANGED
@@ -25359,6 +25359,9 @@ function usePersonRepo() {
25359
25359
  throw new import_node_server_utils74.BadRequestError("Invalid person transaction ID format.");
25360
25360
  }
25361
25361
  value.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
25362
+ if (value.updatedBy) {
25363
+ value.updatedBy = await convertObjectIdUtil2(value.updatedBy, "updatedBy");
25364
+ }
25362
25365
  try {
25363
25366
  const result = await collection.updateOne(
25364
25367
  { _id },
@@ -25851,10 +25854,10 @@ function usePersonRepo() {
25851
25854
  throw error;
25852
25855
  }
25853
25856
  }
25854
- async function findFirstOne(query, session) {
25857
+ async function findFirstTen(query, session) {
25855
25858
  try {
25856
25859
  query.site = await convertObjectIdUtil2(query.site, "site");
25857
- const data = await collection.find(query, { session }).limit(1).toArray();
25860
+ const data = await collection.find(query, { session }).limit(10).toArray();
25858
25861
  return data;
25859
25862
  } catch (error) {
25860
25863
  throw new import_node_server_utils74.InternalServerError("Failed to find many persons.");
@@ -25862,7 +25865,17 @@ function usePersonRepo() {
25862
25865
  }
25863
25866
  async function addFromVisitor(value, session) {
25864
25867
  value.site = await convertObjectIdUtil2(value.site, "site");
25865
- const res = await collection.insertOne(value, { session });
25868
+ if (value.updatedBy) {
25869
+ value.updatedBy = await convertObjectIdUtil2(value.updatedBy, "updatedBy");
25870
+ }
25871
+ if (value.createdBy) {
25872
+ value.createdBy = await convertObjectIdUtil2(value.createdBy, "createdBy");
25873
+ }
25874
+ const res = await collection.insertOne({
25875
+ ...value,
25876
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
25877
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
25878
+ }, { session });
25866
25879
  console.log("person.repo addFromVisitor res", res);
25867
25880
  return res;
25868
25881
  }
@@ -25886,7 +25899,7 @@ function usePersonRepo() {
25886
25899
  getByUserId,
25887
25900
  reviewResidentPerson,
25888
25901
  addFromVisitor,
25889
- findFirstOne
25902
+ findFirstTen
25890
25903
  };
25891
25904
  }
25892
25905
 
@@ -33807,7 +33820,7 @@ function usePersonService() {
33807
33820
  getByUserId: _getByUserId,
33808
33821
  reviewResidentPerson: _reviewResidentPerson,
33809
33822
  addFromVisitor: _addFromVisitor,
33810
- findFirstOne
33823
+ findFirstTen
33811
33824
  } = usePersonRepo();
33812
33825
  const { addPlateNumber: _addPlateNumber } = useDahuaService();
33813
33826
  const {
@@ -34197,43 +34210,116 @@ function usePersonService() {
34197
34210
  }
34198
34211
  }
34199
34212
  async function addUpdateFromVisitor(value, session) {
34213
+ value.type = value.type == "walk-in" ? "guest" : value.type;
34200
34214
  let updateId = null;
34215
+ let add2 = true;
34201
34216
  let set = {};
34202
- if (value?.nric) {
34203
- const existingPerson = await findFirstOne({ nric: value.nric, site: value.site }, session);
34204
- if (Array.isArray(existingPerson) && existingPerson.length > 0) {
34205
- updateId = existingPerson[0]._id;
34206
- if (value.contact && Array.isArray(existingPerson[0].contacts) && !existingPerson[0].contacts.includes(value.contact)) {
34207
- set = { contacts: [...existingPerson[0].contacts, value.contact] };
34217
+ const cleanInput = (str) => str.replace(/\s+/g, "");
34218
+ const cleanPhone = (str) => str.replace(/\D/g, "");
34219
+ const escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
34220
+ const nric = value.nric ? cleanInput(value.nric) : "";
34221
+ const name = value.name?.trim();
34222
+ const contact = value.contact?.trim();
34223
+ const plateNumber = value.plateNumber ? cleanInput(value.plateNumber) : "";
34224
+ const email = value.email?.trim();
34225
+ const type = value.type?.trim();
34226
+ const company = value.company?.trim();
34227
+ const orConditions = [
34228
+ ...nric ? [{ nric: { $regex: `^${escapeRegex(nric)}$`, $options: "i" } }] : [],
34229
+ ...contact ? [{ contacts: { $regex: `^\\+?${cleanPhone(escapeRegex(contact))}$`, $options: "i" } }] : [],
34230
+ ...plateNumber ? [{ plateNumbers: { $regex: `^${escapeRegex(plateNumber)}$`, $options: "i" } }] : []
34231
+ ];
34232
+ const existingPerson2 = await findFirstTen(
34233
+ {
34234
+ type,
34235
+ site: value.site,
34236
+ ...orConditions.length > 0 && { $or: orConditions }
34237
+ },
34238
+ session
34239
+ );
34240
+ if (Array.isArray(existingPerson2) && existingPerson2.length > 0) {
34241
+ let matchedPerson = nric ? existingPerson2.find((person) => person.nric === nric) : null;
34242
+ if (matchedPerson) {
34243
+ add2 = false;
34244
+ updateId = matchedPerson._id;
34245
+ if (contact && Array.isArray(matchedPerson.contacts) && !matchedPerson.contacts.includes(contact)) {
34246
+ set = { contacts: [...matchedPerson.contacts, contact] };
34208
34247
  }
34209
- if (value.plateNumber && Array.isArray(existingPerson[0].plateNumbers) && !existingPerson[0].plateNumbers.includes(value.plateNumber)) {
34210
- set = { ...set, plateNumbers: [...existingPerson[0].plateNumbers, value.plateNumber] };
34248
+ if (plateNumber && Array.isArray(matchedPerson.plateNumbers) && !matchedPerson.plateNumbers.includes(plateNumber)) {
34249
+ set = { ...set, plateNumbers: [...matchedPerson.plateNumbers, plateNumber] };
34211
34250
  }
34212
- if (value.company && Array.isArray(existingPerson[0].companyName) && !existingPerson[0].companyName.includes(value.company)) {
34213
- set = { ...set, companyName: [...existingPerson[0].companyName, value.company] };
34251
+ if (company && Array.isArray(matchedPerson.companyName) && !matchedPerson.companyName.includes(company)) {
34252
+ set = { ...set, companyName: [...matchedPerson.companyName, company] };
34214
34253
  }
34254
+ if (name && name != matchedPerson.name) {
34255
+ set = { ...set, name };
34256
+ }
34257
+ if (email && email != matchedPerson.email) {
34258
+ set = { ...set, email };
34259
+ }
34260
+ } else {
34261
+ matchedPerson = contact ? existingPerson2.find((person) => Array.isArray(person.contacts) && person.contacts.includes(contact)) : null;
34215
34262
  }
34216
- } else {
34263
+ if (matchedPerson) {
34264
+ add2 = false;
34265
+ updateId = matchedPerson._id;
34266
+ if (nric && nric !== matchedPerson.nric) {
34267
+ set = { ...set, nric };
34268
+ }
34269
+ if (plateNumber && Array.isArray(matchedPerson.plateNumbers) && !matchedPerson.plateNumbers.includes(plateNumber)) {
34270
+ set = { ...set, plateNumbers: [...matchedPerson.plateNumbers, plateNumber] };
34271
+ }
34272
+ if (company && Array.isArray(matchedPerson.companyName) && !matchedPerson.companyName.includes(company)) {
34273
+ set = { ...set, companyName: [...matchedPerson.companyName, company] };
34274
+ }
34275
+ if (name && name !== matchedPerson.name) {
34276
+ set = { ...set, name };
34277
+ }
34278
+ if (email && email !== matchedPerson.email) {
34279
+ set = { ...set, email };
34280
+ }
34281
+ } else {
34282
+ matchedPerson = plateNumber ? existingPerson2.find((person) => Array.isArray(person.plateNumbers) && person.plateNumbers.includes(plateNumber)) : null;
34283
+ }
34284
+ if (matchedPerson && (contact && Array.isArray(matchedPerson.contacts) && !matchedPerson.contacts.includes(contact) && (nric && nric != matchedPerson.nric) || !nric && !contact)) {
34285
+ add2 = false;
34286
+ updateId = matchedPerson._id;
34287
+ if (nric && nric !== matchedPerson.nric) {
34288
+ set = { ...set, nric };
34289
+ }
34290
+ if (contact && Array.isArray(matchedPerson.contacts) && !matchedPerson.contacts.includes(contact)) {
34291
+ set = { contacts: [...matchedPerson.contacts, contact] };
34292
+ }
34293
+ if (company && Array.isArray(matchedPerson.companyName) && !matchedPerson.companyName.includes(company)) {
34294
+ set = { ...set, companyName: [...matchedPerson.companyName, company] };
34295
+ }
34296
+ if (name && name !== matchedPerson.name) {
34297
+ set = { ...set, name };
34298
+ }
34299
+ if (email && email !== matchedPerson.email) {
34300
+ set = { ...set, email };
34301
+ }
34302
+ }
34303
+ }
34304
+ if (add2) {
34217
34305
  const data = {
34218
34306
  nric: value.nric,
34219
34307
  name: value.name,
34220
34308
  contacts: value.contact ? [value.contact] : [],
34221
34309
  plateNumbers: value.plateNumber ? [value.plateNumber] : [],
34222
- type: value.type,
34310
+ type,
34223
34311
  email: value.email,
34224
34312
  site: value.site,
34225
34313
  status: "active",
34226
34314
  companyName: value.company ? [value.company] : [],
34227
34315
  createdBy: value.updatedBy,
34228
- updatedBy: value.updatedBy,
34229
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
34230
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
34316
+ updatedBy: value.updatedBy
34231
34317
  };
34232
- const res = await _addFromVisitor(data, session);
34318
+ const res_addFromVisitor = await _addFromVisitor(data, session);
34233
34319
  }
34234
34320
  if (updateId && Object.keys(set).length > 0) {
34235
34321
  set = { ...set, updatedBy: value.updatedBy, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
34236
- const updateRes = await _updateById(updateId, set, session);
34322
+ const res_updateById = await _updateById(updateId, set, session);
34237
34323
  }
34238
34324
  }
34239
34325
  return {
@@ -35533,8 +35619,9 @@ function useVisitorTransactionService() {
35533
35619
  value.unitName = unit?.name;
35534
35620
  }
35535
35621
  const { nric = "", name = "", contact = "", plateNumber = "", email = "", site = "", type = "guest", company, createdBy } = value;
35622
+ console.log("type", type);
35536
35623
  if (/^(guest|walk-in|contractor|delivery)$/.test(type)) {
35537
- const res = await addUpdateFromVisitor({
35624
+ await addUpdateFromVisitor({
35538
35625
  nric,
35539
35626
  name,
35540
35627
  contact,
@@ -58990,6 +59077,17 @@ function useNewDashboardRepo() {
58990
59077
  $lte: now.clone().endOf("day").toDate()
58991
59078
  };
58992
59079
  }
59080
+ function getActivePatrolDateRange(period) {
59081
+ switch (period) {
59082
+ case "thisWeek" /* THIS_WEEK */:
59083
+ return getDateRange("thisWeek" /* THIS_WEEK */);
59084
+ case "thisMonth" /* THIS_MONTH */:
59085
+ return getDateRange("thisMonth" /* THIS_MONTH */);
59086
+ case "today" /* TODAY */:
59087
+ default:
59088
+ return getDateRange("today" /* TODAY */);
59089
+ }
59090
+ }
58993
59091
  function getSiteDayRange(date = import_moment2.default.tz("Asia/Singapore")) {
58994
59092
  return {
58995
59093
  $gte: date.clone().startOf("day").toDate(),
@@ -59002,6 +59100,33 @@ function useNewDashboardRepo() {
59002
59100
  }
59003
59101
  return Math.round((currentCount - previousCount) / previousCount * 100 * 100) / 100;
59004
59102
  };
59103
+ async function getPatrolLogPerson(log) {
59104
+ if (!log) {
59105
+ return "Unassigned";
59106
+ }
59107
+ if (log.assignee && log.assignee.length > 0) {
59108
+ const userIds = log.assignee.map((id) => (0, import_node_server_utils201.toObjectId)(id));
59109
+ const userDocs = await db.collection("members").find({ _id: { $in: userIds } }).toArray();
59110
+ if (userDocs && userDocs.length > 0) {
59111
+ return userDocs.map((u) => u.name || u.email || "").filter(Boolean).join(", ");
59112
+ }
59113
+ }
59114
+ if (log.createdBy) {
59115
+ const userDoc = await db.collection("members").findOne({
59116
+ _id: (0, import_node_server_utils201.toObjectId)(log.createdBy)
59117
+ });
59118
+ if (userDoc && userDoc.name) {
59119
+ return userDoc.name;
59120
+ }
59121
+ }
59122
+ return "Unassigned";
59123
+ }
59124
+ function getPatrolLogStatus(log, defaultStatus = "completed") {
59125
+ if (!log?.status) {
59126
+ return defaultStatus;
59127
+ }
59128
+ return Array.isArray(log.status) ? log.status.join(", ") : log.status;
59129
+ }
59005
59130
  async function getSecurityDashboard({
59006
59131
  siteId = "",
59007
59132
  period = "today" /* TODAY */,
@@ -59176,11 +59301,11 @@ function useNewDashboardRepo() {
59176
59301
  $facet: {
59177
59302
  total: [{ $count: "count" }],
59178
59303
  completed: [
59179
- { $match: { "cameras.status": "Completed" } },
59304
+ { $match: { status: "complete" } },
59180
59305
  { $count: "count" }
59181
59306
  ],
59182
59307
  skipped: [
59183
- { $match: { "cameras.status": "Skipped" } },
59308
+ { $match: { status: "incomplete" } },
59184
59309
  { $count: "count" }
59185
59310
  ]
59186
59311
  }
@@ -59200,11 +59325,11 @@ function useNewDashboardRepo() {
59200
59325
  $facet: {
59201
59326
  total: [{ $count: "count" }],
59202
59327
  completed: [
59203
- { $match: { "cameras.status": "Completed" } },
59328
+ { $match: { status: "complete" } },
59204
59329
  { $count: "count" }
59205
59330
  ],
59206
59331
  skipped: [
59207
- { $match: { "cameras.status": "Skipped" } },
59332
+ { $match: { status: "incomplete" } },
59208
59333
  { $count: "count" }
59209
59334
  ]
59210
59335
  }
@@ -59224,11 +59349,11 @@ function useNewDashboardRepo() {
59224
59349
  $facet: {
59225
59350
  total: [{ $count: "count" }],
59226
59351
  completed: [
59227
- { $match: { "cameras.status": "Completed" } },
59352
+ { $match: { status: "complete" } },
59228
59353
  { $count: "count" }
59229
59354
  ],
59230
59355
  skipped: [
59231
- { $match: { "cameras.status": "Skipped" } },
59356
+ { $match: { status: "incomplete" } },
59232
59357
  { $count: "count" }
59233
59358
  ]
59234
59359
  }
@@ -59259,127 +59384,27 @@ function useNewDashboardRepo() {
59259
59384
  const tTotal = tPatrolFacet.total[0]?.count ?? 0;
59260
59385
  const tCompleted = tPatrolFacet.completed[0]?.count ?? 0;
59261
59386
  const todayCompliance = tTotal > 0 ? tCompleted / tTotal * 100 : 0;
59262
- let activePatrolItems = [];
59263
- if (period === "today" /* TODAY */) {
59264
- const todayString = import_moment2.default.tz("Asia/Singapore").format("YYYY-MM-DD");
59265
- const dayIndex = import_moment2.default.tz("Asia/Singapore").day();
59266
- const repeatDay = dayIndex === 0 ? 7 : dayIndex;
59267
- const routes = await db.collection("patrol.route").find({
59268
- site: { $in: [siteIdObj, siteId] },
59269
- repeat: { $in: [repeatDay, String(repeatDay)] },
59270
- status: { $ne: "deleted" }
59271
- }).toArray();
59272
- const expandedRoutes = [];
59273
- for (const route of routes) {
59274
- if (route.start) {
59275
- expandedRoutes.push({
59276
- route,
59277
- startTime: route.start,
59278
- itemIndex: 0
59279
- });
59280
- }
59281
- }
59282
- expandedRoutes.sort((a, b) => a.startTime.localeCompare(b.startTime));
59283
- const limitedRoutes = expandedRoutes.slice(0, 4);
59284
- limitedRoutes.forEach((item, idx) => {
59285
- item.itemIndex = idx + 1;
59286
- });
59287
- activePatrolItems = await Promise.all(
59288
- limitedRoutes.map(async ({ route, startTime, itemIndex }) => {
59289
- const log = await db.collection("patrol.logs").findOne({
59290
- site: { $in: [siteIdObj, siteId] },
59291
- route: { $in: [route._id, route._id.toString()] },
59292
- createdAt: { $gte: today, $lte: todayEnd }
59293
- });
59294
- let person = "Unassigned";
59295
- if (log && log.assignee && log.assignee.length > 0) {
59296
- const userIds = log.assignee.map((id) => (0, import_node_server_utils201.toObjectId)(id));
59297
- const userDocs = await db.collection("members").find({ _id: { $in: userIds } }).toArray();
59298
- if (userDocs && userDocs.length > 0) {
59299
- person = userDocs.map((u) => u.name || u.email || "").filter(Boolean).join(", ");
59300
- }
59301
- } else if (log && log.createdBy) {
59302
- const userDoc = await db.collection("members").findOne({
59303
- _id: (0, import_node_server_utils201.toObjectId)(log.createdBy)
59304
- });
59305
- if (userDoc && userDoc.name) {
59306
- person = userDoc.name;
59307
- }
59308
- }
59309
- let status = "pending";
59310
- if (log) {
59311
- if (log.status) {
59312
- status = Array.isArray(log.status) ? log.status.join(", ") : log.status;
59313
- } else {
59314
- status = "completed";
59315
- }
59316
- } else {
59317
- const routeTime = import_moment2.default.tz(
59318
- `${todayString} ${startTime}`,
59319
- "YYYY-MM-DD HH:mm",
59320
- "Asia/Singapore"
59321
- );
59322
- const nowSg = import_moment2.default.tz("Asia/Singapore");
59323
- const diffMinutes = nowSg.diff(routeTime, "minutes");
59324
- if (diffMinutes >= 0) {
59325
- if (diffMinutes <= 120) {
59326
- status = "on paused";
59327
- } else {
59328
- status = "incomplete";
59329
- }
59330
- } else {
59331
- status = "pending";
59332
- }
59333
- }
59334
- return {
59335
- id: `${route._id.toString()}_${startTime}`,
59336
- title: route.name,
59337
- subtitle: `ID${String(itemIndex).padStart(3, "0")}`,
59338
- person,
59339
- status,
59340
- time: startTime
59341
- };
59342
- })
59343
- );
59344
- } else {
59345
- const logs = await db.collection("patrol.logs").find({
59346
- site: { $in: [siteIdObj, siteId] },
59347
- createdAt: periodRange
59348
- }).sort({ createdAt: -1 }).limit(4).toArray();
59349
- activePatrolItems = await Promise.all(
59350
- logs.map(async (log) => {
59351
- let person = "Unassigned";
59352
- if (log.assignee && log.assignee.length > 0) {
59353
- const userIds = log.assignee.map((id) => (0, import_node_server_utils201.toObjectId)(id));
59354
- const userDocs = await db.collection("members").find({ _id: { $in: userIds } }).toArray();
59355
- if (userDocs && userDocs.length > 0) {
59356
- person = userDocs.map((u) => u.name || u.email || "").filter(Boolean).join(", ");
59357
- }
59358
- } else if (log.createdBy) {
59359
- const userDoc = await db.collection("members").findOne({
59360
- _id: (0, import_node_server_utils201.toObjectId)(log.createdBy)
59361
- });
59362
- if (userDoc && userDoc.name) {
59363
- person = userDoc.name;
59364
- }
59365
- }
59366
- let status = "completed";
59367
- if (log.status) {
59368
- status = Array.isArray(log.status) ? log.status.join(", ") : log.status;
59369
- }
59370
- const logTime = (0, import_moment2.default)(log.createdAt).tz("Asia/Singapore").format("HH:mm");
59371
- const logDate = (0, import_moment2.default)(log.createdAt).tz("Asia/Singapore").format("DD/MM/YYYY");
59372
- return {
59373
- id: log._id.toString(),
59374
- title: log.name,
59375
- subtitle: logDate,
59376
- person,
59377
- status,
59378
- time: logTime
59379
- };
59380
- })
59381
- );
59382
- }
59387
+ const activePatrolDateRange = getActivePatrolDateRange(period);
59388
+ const activePatrolLogs = await db.collection("patrol.logs").find({
59389
+ site: { $in: [siteIdObj, siteId] },
59390
+ createdAt: activePatrolDateRange
59391
+ }).sort({ createdAt: -1 }).limit(4).toArray();
59392
+ const activePatrolItems = await Promise.all(
59393
+ activePatrolLogs.map(async (log) => {
59394
+ const person = await getPatrolLogPerson(log);
59395
+ const status = getPatrolLogStatus(log);
59396
+ const logTime = (0, import_moment2.default)(log.createdAt).tz("Asia/Singapore").format("HH:mm");
59397
+ const logDate = (0, import_moment2.default)(log.createdAt).tz("Asia/Singapore").format("DD/MM/YYYY");
59398
+ return {
59399
+ id: log._id.toString(),
59400
+ title: log.name,
59401
+ subtitle: logDate,
59402
+ person,
59403
+ status,
59404
+ time: logTime
59405
+ };
59406
+ })
59407
+ );
59383
59408
  const data = {
59384
59409
  openWorkOrder: {
59385
59410
  count: wFacet.total[0]?.count ?? 0,