@realtek/core-theme 0.0.231 → 0.0.233

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-lib/index.js CHANGED
@@ -253,11 +253,15 @@ function ro({ userIds: e = [], days: t = void 0, startDay: n = "Sun", renderDayC
253
253
  className: `calendar-card${c ? ` ${c}` : ""}`,
254
254
  title: /* @__PURE__ */ Z("div", {
255
255
  className: "calendar-header-title",
256
- children: [/* @__PURE__ */ X(Ur, {}), /* @__PURE__ */ X(Wa, {
257
- level: 5,
258
- style: { margin: 0 },
259
- children: re
260
- })]
256
+ children: [
257
+ /* @__PURE__ */ X(Ur, {}),
258
+ /* @__PURE__ */ X(Wa, {
259
+ level: 5,
260
+ style: { margin: 0 },
261
+ children: re
262
+ }),
263
+ a
264
+ ]
261
265
  }),
262
266
  extra: /* @__PURE__ */ Z("div", {
263
267
  className: "calendar-nav",
@@ -266,29 +270,25 @@ function ro({ userIds: e = [], days: t = void 0, startDay: n = "Sun", renderDayC
266
270
  alignItems: "center",
267
271
  gap: 6
268
272
  },
269
- children: [
270
- a,
271
- /* @__PURE__ */ X(q, {
272
- title: "Previous month",
273
- children: /* @__PURE__ */ X(z, {
274
- type: "text",
275
- icon: /* @__PURE__ */ X(Pi, {}),
276
- size: "small",
277
- onClick: M,
278
- disabled: m
279
- })
280
- }),
281
- /* @__PURE__ */ X(q, {
282
- title: "Next month",
283
- children: /* @__PURE__ */ X(z, {
284
- type: "text",
285
- icon: /* @__PURE__ */ X(ea, {}),
286
- size: "small",
287
- onClick: ee,
288
- disabled: h
289
- })
273
+ children: [/* @__PURE__ */ X(q, {
274
+ title: "Previous month",
275
+ children: /* @__PURE__ */ X(z, {
276
+ type: "text",
277
+ icon: /* @__PURE__ */ X(Pi, {}),
278
+ size: "small",
279
+ onClick: M,
280
+ disabled: m
290
281
  })
291
- ]
282
+ }), /* @__PURE__ */ X(q, {
283
+ title: "Next month",
284
+ children: /* @__PURE__ */ X(z, {
285
+ type: "text",
286
+ icon: /* @__PURE__ */ X(ea, {}),
287
+ size: "small",
288
+ onClick: ee,
289
+ disabled: h
290
+ })
291
+ })]
292
292
  }),
293
293
  children: /* @__PURE__ */ Z(Sr, {
294
294
  spinning: T,
@@ -378,7 +378,8 @@ function ro({ userIds: e = [], days: t = void 0, startDay: n = "Sun", renderDayC
378
378
  children: ne.map(({ label: e, color: t, icon: n }) => /* @__PURE__ */ Z("div", {
379
379
  className: "calendar-legend-item",
380
380
  children: [n ? /* @__PURE__ */ X("span", {
381
- className: "calendar-legend-icon",
381
+ className: "calendar-legend-badge",
382
+ style: { background: Xa(t) },
382
383
  children: n
383
384
  }) : /* @__PURE__ */ X("span", {
384
385
  className: "calendar-legend-dot",
@@ -642,11 +643,11 @@ async function jo(e, t) {
642
643
  async function Mo(e) {
643
644
  return uo(await a(o, `/submissions/vms-approve?submissionId=${encodeURIComponent(e)}`));
644
645
  }
645
- async function No(t, { submissionId: n = "", billRate: r, payRate: i, currency: o = "$", referralRate: s, vmsPercent: c = 0, documentIds: l = [], remarks: u = null } = {}) {
646
- let d = t ? `/workforce-engagements/${encodeURIComponent(t)}/cfo-approval/send` : `/submissions/${encodeURIComponent(n)}/cfo-approval/send`;
646
+ async function No(t, { submissionId: n = "", billRate: r, payRate: i, currency: o = "$", referralId: s, referralRate: c, referralType: l, referralEnabled: u, vmsPercent: d = 0, documentIds: f = [], remarks: p = null } = {}) {
647
+ let m = t ? `/workforce-engagements/${encodeURIComponent(t)}/cfo-approval/send` : `/submissions/${encodeURIComponent(n)}/cfo-approval/send`;
647
648
  if (!t && !n) throw Error("Submission is required to send for approval.");
648
- let f = typeof window < "u" ? window.location.origin : "", p = t || n;
649
- return uo(await a(e, d, {
649
+ let h = typeof window < "u" ? window.location.origin : "", g = t || n;
650
+ return uo(await a(e, m, {
650
651
  method: "POST",
651
652
  body: JSON.stringify({
652
653
  proposedRate: {
@@ -662,11 +663,14 @@ async function No(t, { submissionId: n = "", billRate: r, payRate: i, currency:
662
663
  candidateAcceptedPayUnit: "hr",
663
664
  candidateAcceptedRateNegotiable: !1
664
665
  },
665
- ...s == null ? {} : { referralRate: Number(s) || 0 },
666
- vmsPercent: Number(c) || 0,
667
- documentIds: l,
668
- remarks: u,
669
- approvalUrl: `${f}/cfo-approval/${encodeURIComponent(p)}`
666
+ ...s != null && s !== "" ? { referralId: s } : {},
667
+ ...c == null ? {} : { referralRate: Number(c) || 0 },
668
+ ...l != null && l !== "" ? { referralType: l } : {},
669
+ ...u == null ? {} : { referralEnabled: !!u },
670
+ vmsPercent: Number(d) || 0,
671
+ documentIds: f,
672
+ remarks: p,
673
+ approvalUrl: `${h}/cfo-approval/${encodeURIComponent(g)}`
670
674
  })
671
675
  }));
672
676
  }
@@ -15188,10 +15192,7 @@ function sy({ configKey: e = "timesheet", month: t, year: n }) {
15188
15192
  return t && n && La(`${n}-${t}-01`).isBefore(La().subtract(r.thresholdMonths, "month"), "month") ? /* @__PURE__ */ X(K, {
15189
15193
  color: r.pastColor,
15190
15194
  children: r.pastLabel
15191
- }) : /* @__PURE__ */ X(K, {
15192
- color: r.currentColor,
15193
- children: r.currentLabel
15194
- });
15195
+ }) : null;
15195
15196
  }
15196
15197
  var cy = {
15197
15198
  working: "timesheet-day-cell--working",
@@ -15399,16 +15400,17 @@ function xy({ open: e, day: t, saving: n = !1, onCancel: r, onSubmit: i, onDelet
15399
15400
  let f = () => ({ validator(e, t) {
15400
15401
  let n = ly(t);
15401
15402
  return n < 0 ? Promise.reject(/* @__PURE__ */ Error("Standard Hours cannot be negative.")) : n > _y ? Promise.reject(/* @__PURE__ */ Error("Standard Hours cannot exceed 8 hours.")) : Promise.resolve();
15402
- } }), p = ({ getFieldValue: e }) => ({ validator(t, n) {
15403
- if (ly(n) < 0) return Promise.reject(/* @__PURE__ */ Error("Leave Hours cannot be negative."));
15404
- let r = ly(e("ST")), i = ly(e("Leave"));
15405
- return Math.abs(r + i - _y) <= yy ? Promise.resolve() : Promise.reject(/* @__PURE__ */ Error("Standard Hours and Leave Hours together must equal 8 hours."));
15406
- } }), m = ({ getFieldValue: e }) => ({ validator(t, n) {
15407
- let r = ly(n);
15408
- if (r < 0) return Promise.reject(/* @__PURE__ */ Error("Overtime cannot be negative."));
15409
- if (r === 0) return Promise.resolve();
15410
- let i = ly(e("ST"));
15411
- return i < _y ? Promise.reject(/* @__PURE__ */ Error("Overtime can only be entered after completing 8 standard working hours.")) : ly(e("Leave")) > 0 ? Promise.reject(/* @__PURE__ */ Error("Overtime is not allowed when leave hours are recorded.")) : i + r > s ? Promise.reject(/* @__PURE__ */ Error("Total working hours exceed the maximum allowed daily limit.")) : Promise.resolve();
15403
+ } }), p = ({ getFieldValue: e }) => ({ validator(n, r) {
15404
+ if (ly(r) < 0) return Promise.reject(/* @__PURE__ */ Error("Leave Hours cannot be negative."));
15405
+ if (t?.isWeekOff) return Promise.resolve();
15406
+ let i = ly(e("ST")), a = ly(e("Leave"));
15407
+ return Math.abs(i + a - _y) <= yy ? Promise.resolve() : Promise.reject(/* @__PURE__ */ Error("Standard Hours and Leave Hours together must equal 8 hours."));
15408
+ } }), m = ({ getFieldValue: e }) => ({ validator(n, r) {
15409
+ let i = ly(r);
15410
+ if (i < 0) return Promise.reject(/* @__PURE__ */ Error("Overtime cannot be negative."));
15411
+ if (i === 0) return Promise.resolve();
15412
+ let a = ly(e("ST"));
15413
+ return !t?.isWeekOff && a < _y ? Promise.reject(/* @__PURE__ */ Error("Overtime can only be entered after completing 8 standard working hours.")) : ly(e("Leave")) > 0 ? Promise.reject(/* @__PURE__ */ Error("Overtime is not allowed when leave hours are recorded.")) : a + i > s ? Promise.reject(/* @__PURE__ */ Error("Total working hours exceed the maximum allowed daily limit.")) : Promise.resolve();
15412
15414
  } }), h = ({ getFieldValue: e }) => ({ validator(t, n) {
15413
15415
  let r = ly(n), i = ly(e("OT"));
15414
15416
  return r > 0 && i > 0 ? Promise.reject(/* @__PURE__ */ Error("Overtime is not allowed when leave hours are recorded.")) : Promise.resolve();
@@ -15419,7 +15421,7 @@ function xy({ open: e, day: t, saving: n = !1, onCancel: r, onSubmit: i, onDelet
15419
15421
  "Leave"
15420
15422
  ]).catch(() => {});
15421
15423
  }, _ = (e) => {
15422
- if ("ST" in e) {
15424
+ if ("ST" in e && !t?.isWeekOff) {
15423
15425
  let t = ly(e.ST), n = { Leave: by(_y - t, 0, _y) };
15424
15426
  t < _y && (n.OT = 0), c.setFieldsValue(n);
15425
15427
  }
@@ -15441,12 +15443,12 @@ function xy({ open: e, day: t, saving: n = !1, onCancel: r, onSubmit: i, onDelet
15441
15443
  isWeekOff: !!t?.isWeekOff,
15442
15444
  notes: ""
15443
15445
  });
15444
- }, y = t?.isHoliday || t?.isWeekOff, b = t?.date ? La(t.date).format("MMM DD, YYYY") : "Log time", x = ly(l), S = ly(u), C = ly(d), w = x < _y, T = x + S, E = x + S + C;
15446
+ }, y = t?.isHoliday, b = !!t?.isWeekOff && !y, x = t?.date ? La(t.date).format("MMM DD, YYYY") : "Log time", S = ly(l), C = ly(u), w = ly(d), T = !b && S < _y, E = S + C, D = S + C + w;
15445
15447
  return /* @__PURE__ */ Z(mr, {
15446
15448
  title: /* @__PURE__ */ Z(W, { children: [
15447
15449
  /* @__PURE__ */ X(iy, {
15448
15450
  strong: !0,
15449
- children: b
15451
+ children: x
15450
15452
  }),
15451
15453
  t?.isHoliday && /* @__PURE__ */ X(K, {
15452
15454
  color: "purple",
@@ -15509,140 +15511,150 @@ function xy({ open: e, day: t, saving: n = !1, onCancel: r, onSubmit: i, onDelet
15509
15511
  }), y ? /* @__PURE__ */ X(Xn, {
15510
15512
  type: "info",
15511
15513
  showIcon: !0,
15512
- message: t?.isHoliday ? "Holiday — no manual log required." : "Week off — no log required."
15513
- }) : /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ Z(V, {
15514
- form: c,
15515
- layout: "vertical",
15516
- className: "timesheet-log-form",
15517
- validateTrigger: ["onChange", "onBlur"],
15518
- onValuesChange: _,
15519
- children: [
15520
- /* @__PURE__ */ X(V.Item, {
15521
- name: "date",
15522
- label: "Date",
15523
- children: /* @__PURE__ */ X(ir, {
15524
- disabled: !0,
15525
- style: { width: "100%" }
15526
- })
15527
- }),
15528
- /* @__PURE__ */ X(V.Item, {
15529
- name: "ST",
15530
- label: /* @__PURE__ */ Z("span", {
15531
- style: {
15532
- color: "#1d4ed8",
15533
- fontWeight: 600
15534
- },
15535
- children: ["Standard ", /* @__PURE__ */ X("span", {
15536
- style: {
15537
- fontWeight: 400,
15538
- color: "#6b7280"
15539
- },
15540
- children: "hrs"
15541
- })]
15514
+ message: "Holiday — no manual log required."
15515
+ }) : /* @__PURE__ */ Z(Y, { children: [
15516
+ b && /* @__PURE__ */ X(Xn, {
15517
+ type: "info",
15518
+ showIcon: !0,
15519
+ message: "Weekend — logged as Overtime.",
15520
+ style: { marginBottom: 12 }
15521
+ }),
15522
+ /* @__PURE__ */ Z(V, {
15523
+ form: c,
15524
+ layout: "vertical",
15525
+ className: "timesheet-log-form",
15526
+ validateTrigger: ["onChange", "onBlur"],
15527
+ onValuesChange: _,
15528
+ children: [
15529
+ /* @__PURE__ */ X(V.Item, {
15530
+ name: "date",
15531
+ label: "Date",
15532
+ children: /* @__PURE__ */ X(ir, {
15533
+ disabled: !0,
15534
+ style: { width: "100%" }
15535
+ })
15542
15536
  }),
15543
- dependencies: ["Leave"],
15544
- rules: [f, p],
15545
- children: /* @__PURE__ */ X(ur, {
15546
- min: 0,
15547
- max: _y,
15548
- step: o,
15549
- style: { width: "100%" },
15550
- addonAfter: /* @__PURE__ */ X("span", {
15537
+ /* @__PURE__ */ X(V.Item, {
15538
+ name: "ST",
15539
+ label: /* @__PURE__ */ Z("span", {
15551
15540
  style: {
15552
15541
  color: "#1d4ed8",
15553
- fontWeight: 700
15542
+ fontWeight: 600
15554
15543
  },
15555
- children: "s"
15544
+ children: ["Standard ", /* @__PURE__ */ X("span", {
15545
+ style: {
15546
+ fontWeight: 400,
15547
+ color: "#6b7280"
15548
+ },
15549
+ children: "hrs"
15550
+ })]
15551
+ }),
15552
+ dependencies: ["Leave"],
15553
+ rules: [f, p],
15554
+ hidden: b,
15555
+ children: /* @__PURE__ */ X(ur, {
15556
+ min: 0,
15557
+ max: _y,
15558
+ step: o,
15559
+ style: { width: "100%" },
15560
+ addonAfter: /* @__PURE__ */ X("span", {
15561
+ style: {
15562
+ color: "#1d4ed8",
15563
+ fontWeight: 700
15564
+ },
15565
+ children: "s"
15566
+ })
15556
15567
  })
15557
- })
15558
- }),
15559
- /* @__PURE__ */ X(V.Item, {
15560
- name: "OT",
15561
- label: /* @__PURE__ */ Z("span", {
15562
- style: {
15563
- color: "#15803d",
15564
- fontWeight: 600
15565
- },
15566
- children: ["Overtime ", /* @__PURE__ */ X("span", {
15567
- style: {
15568
- fontWeight: 400,
15569
- color: "#6b7280"
15570
- },
15571
- children: "hrs"
15572
- })]
15573
15568
  }),
15574
- dependencies: ["ST", "Leave"],
15575
- rules: [m],
15576
- extra: w ? "Complete 8 standard hours to log overtime." : void 0,
15577
- children: /* @__PURE__ */ X(ur, {
15578
- min: 0,
15579
- max: s,
15580
- step: o,
15581
- style: { width: "100%" },
15582
- disabled: w,
15583
- addonAfter: /* @__PURE__ */ X("span", {
15569
+ /* @__PURE__ */ X(V.Item, {
15570
+ name: "OT",
15571
+ label: /* @__PURE__ */ Z("span", {
15584
15572
  style: {
15585
15573
  color: "#15803d",
15586
- fontWeight: 700
15574
+ fontWeight: 600
15587
15575
  },
15588
- children: "o"
15576
+ children: ["Overtime ", /* @__PURE__ */ X("span", {
15577
+ style: {
15578
+ fontWeight: 400,
15579
+ color: "#6b7280"
15580
+ },
15581
+ children: "hrs"
15582
+ })]
15583
+ }),
15584
+ dependencies: ["ST", "Leave"],
15585
+ rules: [m],
15586
+ extra: T ? "Complete 8 standard hours to log overtime." : void 0,
15587
+ children: /* @__PURE__ */ X(ur, {
15588
+ min: 0,
15589
+ max: s,
15590
+ step: o,
15591
+ style: { width: "100%" },
15592
+ disabled: T,
15593
+ addonAfter: /* @__PURE__ */ X("span", {
15594
+ style: {
15595
+ color: "#15803d",
15596
+ fontWeight: 700
15597
+ },
15598
+ children: "o"
15599
+ })
15589
15600
  })
15590
- })
15591
- }),
15592
- /* @__PURE__ */ X(V.Item, {
15593
- name: "Leave",
15594
- label: /* @__PURE__ */ Z("span", {
15595
- style: {
15596
- color: "#b45309",
15597
- fontWeight: 600
15598
- },
15599
- children: ["Leave ", /* @__PURE__ */ X("span", {
15600
- style: {
15601
- fontWeight: 400,
15602
- color: "#6b7280"
15603
- },
15604
- children: "hrs"
15605
- })]
15606
15601
  }),
15607
- dependencies: ["ST", "OT"],
15608
- rules: [p, h],
15609
- children: /* @__PURE__ */ X(ur, {
15610
- min: 0,
15611
- max: _y,
15612
- step: o,
15613
- style: { width: "100%" },
15614
- addonAfter: /* @__PURE__ */ X("span", {
15602
+ /* @__PURE__ */ X(V.Item, {
15603
+ name: "Leave",
15604
+ label: /* @__PURE__ */ Z("span", {
15615
15605
  style: {
15616
15606
  color: "#b45309",
15617
- fontWeight: 700
15607
+ fontWeight: 600
15618
15608
  },
15619
- children: "L"
15609
+ children: ["Leave ", /* @__PURE__ */ X("span", {
15610
+ style: {
15611
+ fontWeight: 400,
15612
+ color: "#6b7280"
15613
+ },
15614
+ children: "hrs"
15615
+ })]
15616
+ }),
15617
+ dependencies: ["ST", "OT"],
15618
+ rules: [p, h],
15619
+ children: /* @__PURE__ */ X(ur, {
15620
+ min: 0,
15621
+ max: _y,
15622
+ step: o,
15623
+ style: { width: "100%" },
15624
+ addonAfter: /* @__PURE__ */ X("span", {
15625
+ style: {
15626
+ color: "#b45309",
15627
+ fontWeight: 700
15628
+ },
15629
+ children: "L"
15630
+ })
15620
15631
  })
15621
15632
  })
15622
- })
15623
- ]
15624
- }), /* @__PURE__ */ Z("div", {
15625
- className: "timesheet-log-summary",
15626
- children: [/* @__PURE__ */ Z("div", {
15627
- className: "timesheet-log-summary__row",
15628
- children: [/* @__PURE__ */ X(iy, {
15629
- type: "secondary",
15630
- children: "Worked (Standard + Overtime)"
15631
- }), /* @__PURE__ */ X(iy, {
15632
- strong: !0,
15633
- children: uy(T)
15634
- })]
15635
- }), /* @__PURE__ */ Z("div", {
15636
- className: "timesheet-log-summary__row",
15637
- children: [/* @__PURE__ */ X(iy, {
15638
- type: "secondary",
15639
- children: "Day Total"
15640
- }), /* @__PURE__ */ X(iy, {
15641
- strong: !0,
15642
- children: uy(E)
15633
+ ]
15634
+ }),
15635
+ /* @__PURE__ */ Z("div", {
15636
+ className: "timesheet-log-summary",
15637
+ children: [/* @__PURE__ */ Z("div", {
15638
+ className: "timesheet-log-summary__row",
15639
+ children: [/* @__PURE__ */ X(iy, {
15640
+ type: "secondary",
15641
+ children: "Worked (Standard + Overtime)"
15642
+ }), /* @__PURE__ */ X(iy, {
15643
+ strong: !0,
15644
+ children: uy(E)
15645
+ })]
15646
+ }), /* @__PURE__ */ Z("div", {
15647
+ className: "timesheet-log-summary__row",
15648
+ children: [/* @__PURE__ */ X(iy, {
15649
+ type: "secondary",
15650
+ children: "Day Total"
15651
+ }), /* @__PURE__ */ X(iy, {
15652
+ strong: !0,
15653
+ children: uy(D)
15654
+ })]
15643
15655
  })]
15644
- })]
15645
- })] })]
15656
+ })
15657
+ ] })]
15646
15658
  });
15647
15659
  }
15648
15660
  function Sy({ count: e = 0, total: t = 0, hours: n = 8, loading: r = !1, onConfirm: i, onCancel: a, onSelectAll: o, onSelectNone: s }) {
@@ -16922,7 +16934,7 @@ vb.propTypes = {
16922
16934
  tone: Q.string
16923
16935
  };
16924
16936
  function yb({ type: e, record: t, lookups: n, identity: r, referralOptions: i, onReferralChange: a, onAddReferral: o, currentUserId: s, actions: c, onClose: l, variant: u }) {
16925
- let d = Hy(e), f = L(() => ob(t, n), [t, n]), p = Wy(d), [m, h] = R(f.proposedRate), [g, _] = R(t?.engagement?.financeApproval?.referralId ?? t?.referral?._id ?? null), [v, y] = R(t?.engagement?.financeApproval?.referralRate ?? t?.referral?.referalRate ?? 0), [b, x] = R(t?.engagement?.financeApproval?.referralType ?? t?.referral?.referralType ?? t?.referral?.referalType ?? "Recurring"), [S, C] = R(""), [w, T] = R(!1), [E, D] = R(""), [O, k] = R(!1), [A, j] = R(""), [M, ee] = R(!1), N = d.sections.referral ?? {}, [te, ne] = R(!!(t?.engagement?.financeApproval?.referralEnabled ?? t?.referralEnabled ?? (Number(v) > 0 || !!g))), re = N.toggle === !0, ie = !!g || Number(v) > 0, ae = N.show === !0 ? re ? te : !0 : N.show === "ifEnabled" ? te : N.show === "ifExists" ? ie : !1, oe = p && ae, se = d.rejection?.show ? Uy(d, t) : "", P = L(() => cb(f, {
16937
+ let d = Hy(e), f = L(() => ob(t, n), [t, n]), p = Wy(d), [m, h] = R(f.proposedRate), [g, _] = R(t?.engagement?.financeApproval?.referralId ?? t?.referral?._id ?? null), [v, y] = R(t?.engagement?.financeApproval?.referralRate ?? t?.referral?.referalRate ?? 0), [b, x] = R(t?.engagement?.financeApproval?.referralType ?? t?.referral?.referralType ?? t?.referral?.referalType ?? "Recurring"), [S, C] = R(""), [w, T] = R(!1), [E, D] = R(""), [O, k] = R(!1), [A, j] = R(""), [M, ee] = R(!1), N = d.sections.referral ?? {}, [te, ne] = R(!!(t?.engagement?.financeApproval?.referralEnabled ?? t?.referralEnabled ?? (Number(v) > 0 || !!g))), re = N.toggle === !0, ie = Number(v) > 0, ae = N.show === !0 ? re ? te : !0 : N.show === "ifEnabled" ? te : N.show === "ifExists" ? ie : !1, oe = p && ae, se = d.rejection?.show ? Uy(d, t) : "", P = L(() => cb(f, {
16926
16938
  proposedRate: d.sections.rateBreakdown?.proposed?.editable ? m : void 0,
16927
16939
  includeReferral: oe,
16928
16940
  referralRate: v
@@ -17702,13 +17714,10 @@ async function Ob(e, t = {}) {
17702
17714
  ...x.jobPayDetails ?? {},
17703
17715
  ...v.jobPayDetails ?? {}
17704
17716
  };
17705
- let w = (Array.isArray(_) ? _ : []).find((t) => $y(t.submissionId) === String(e)), T = w ? await Eb("workforceEngagements", $y(w)) : {}, E = {
17706
- ...w,
17707
- ...T
17708
- }, D = $y(E?.financeApproval?.referralId ?? E?.referralId ?? E?.referalId), O = D ? await Eb("referrals", D) : {}, k = $y(C.clientId) || $y(E?.clientId) || s, A = a.clientName ?? t.clientName ?? C.clientName, j = A ? m.filter((e) => bb(e.clientName) === bb(A)) : [], M = m.find(Cb(k)) ?? j[0] ?? {}, ee = await Eb("clients", $y(M._id ?? M.id) || k), N = {
17709
- ...M,
17710
- ...ee
17711
- }, te = h.find(Cb(l)) ?? {}, ne = g.find(Cb(d)) ?? g.find((e) => bb(e.name) === bb(d)) ?? {};
17717
+ let w = (Array.isArray(_) ? _ : []).find((t) => $y(t.submissionId) === String(e)), T = $y(C.clientId) || $y(w?.clientId) || s, E = a.clientName ?? t.clientName ?? C.clientName, D = E ? m.filter((e) => bb(e.clientName) === bb(E)) : [], O = m.find(Cb(T)) ?? D[0] ?? {}, k = await Eb("clients", $y(O._id ?? O.id) || T), A = {
17718
+ ...O,
17719
+ ...k
17720
+ }, j = h.find(Cb(l)) ?? {}, M = g.find(Cb(d)) ?? g.find((e) => bb(e.name) === bb(d)) ?? {};
17712
17721
  return {
17713
17722
  record: {
17714
17723
  submission: {
@@ -17717,29 +17726,27 @@ async function Ob(e, t = {}) {
17717
17726
  submission_current_employer: [o]
17718
17727
  },
17719
17728
  job: C,
17720
- client: N,
17721
- employer: te,
17722
- engagement: E,
17723
- referral: O
17729
+ client: A,
17730
+ employer: j
17724
17731
  },
17725
17732
  lookups: {
17726
- clientVmsFee: N.vmsFee ?? a.clientVmsFee ?? a.vmsFee,
17727
- locationTaxPercent: o.tax ?? ne.taxValue
17733
+ clientVmsFee: A.vmsFee ?? a.clientVmsFee ?? a.vmsFee,
17734
+ locationTaxPercent: o.tax ?? M.taxValue
17728
17735
  },
17729
17736
  display: {
17730
- clientName: a.clientName ?? N.clientName,
17737
+ clientName: a.clientName ?? A.clientName,
17731
17738
  jobTitle: a.jobTitle ?? C.jobTitle,
17732
17739
  reqId: i.jobClientRefrenceId ?? a.jobRefrenceId ?? i.jobRefrenceId ?? i.mspReqId,
17733
17740
  jobLocation: a.jobLocation ?? C.jobLocation,
17734
- employerName: te.empCompanyName,
17735
- employerLocation: ne.name ?? te.empCompanyLocation ?? d,
17741
+ employerName: j.empCompanyName,
17742
+ employerLocation: M.name ?? j.empCompanyLocation ?? d,
17736
17743
  submittedBy: Tb(y) || a.signatureEmail || a.recruiterName || a.submitSource,
17737
17744
  email: a.email,
17738
17745
  candidateName: [a.firstName, a.lastName].filter(Boolean).join(" ") || a.candidateFullName,
17739
17746
  createdAt: i.createdAt,
17740
- submissionId: i.submissionId,
17741
- workforceEngagementId: $y(E)
17747
+ submissionId: i.submissionId
17742
17748
  },
17749
+ engagement: w ?? null,
17743
17750
  meta: i
17744
17751
  };
17745
17752
  }