@devalok/shilp-sutra-karm 0.8.2 → 0.9.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.
Files changed (68) hide show
  1. package/dist/_chunks/chat-panel.js +376 -0
  2. package/dist/_chunks/daily-brief.js +177 -0
  3. package/dist/_chunks/kanban-board.js +597 -0
  4. package/dist/_chunks/project-card.js +121 -0
  5. package/dist/_chunks/render-adjustment-type.js +3596 -0
  6. package/dist/{tasks → _chunks}/task-constants.js +3 -3
  7. package/dist/_chunks/task-detail-panel.js +1305 -0
  8. package/dist/_chunks/use-composed-ref.js +12 -0
  9. package/dist/_chunks/vendor.js +11491 -0
  10. package/dist/admin/index.js +37 -60
  11. package/dist/board/index.js +3 -5
  12. package/dist/chat/index.js +6 -10
  13. package/dist/client/index.js +4 -6
  14. package/dist/dashboard/index.js +3 -4
  15. package/dist/index.js +189 -103
  16. package/dist/tasks/index.js +8 -14
  17. package/package.json +78 -80
  18. package/dist/admin/adjustments/approved-adjustments.js +0 -43
  19. package/dist/admin/break/break-admin-skeleton.js +0 -59
  20. package/dist/admin/break/break-admin.js +0 -373
  21. package/dist/admin/break/break-balance.js +0 -42
  22. package/dist/admin/break/breaks.js +0 -91
  23. package/dist/admin/break/delete-break.js +0 -55
  24. package/dist/admin/break/edit-break-balance.js +0 -113
  25. package/dist/admin/break/edit-break.js +0 -453
  26. package/dist/admin/break/header.js +0 -231
  27. package/dist/admin/break/leave-request.js +0 -162
  28. package/dist/admin/break/use-break-date-picker.js +0 -43
  29. package/dist/admin/dashboard/admin-dashboard.js +0 -337
  30. package/dist/admin/dashboard/associate-detail.js +0 -259
  31. package/dist/admin/dashboard/attendance-overview.js +0 -136
  32. package/dist/admin/dashboard/break-request.js +0 -176
  33. package/dist/admin/dashboard/calendar.js +0 -141
  34. package/dist/admin/dashboard/correction-list.js +0 -102
  35. package/dist/admin/dashboard/dashboard-header.js +0 -155
  36. package/dist/admin/dashboard/dashboard-skeleton.js +0 -109
  37. package/dist/admin/dashboard/leave-requests.js +0 -201
  38. package/dist/admin/dashboard/render-date.js +0 -144
  39. package/dist/admin/dashboard/use-calendar-navigation.js +0 -169
  40. package/dist/admin/dashboard/use-leave-request-interaction.js +0 -34
  41. package/dist/admin/utils/date-range-utils.js +0 -37
  42. package/dist/admin/utils/date-utils.js +0 -119
  43. package/dist/admin/utils/emoji-utils.js +0 -17
  44. package/dist/admin/utils/render-adjustment-type.js +0 -20
  45. package/dist/admin/utils/render-status.js +0 -22
  46. package/dist/board/board-column.js +0 -236
  47. package/dist/board/kanban-board.js +0 -218
  48. package/dist/board/task-card.js +0 -168
  49. package/dist/chat/chat-input.js +0 -54
  50. package/dist/chat/chat-panel.js +0 -151
  51. package/dist/chat/conversation-list.js +0 -99
  52. package/dist/chat/markdown-components.js +0 -35
  53. package/dist/chat/message-list.js +0 -59
  54. package/dist/chat/streaming-text.js +0 -17
  55. package/dist/client/accent-provider.js +0 -22
  56. package/dist/client/client-portal-header.js +0 -48
  57. package/dist/client/project-card.js +0 -60
  58. package/dist/dashboard/attendance-cta.js +0 -115
  59. package/dist/dashboard/daily-brief.js +0 -68
  60. package/dist/page-skeletons.js +0 -130
  61. package/dist/tasks/activity-tab.js +0 -185
  62. package/dist/tasks/conversation-tab.js +0 -138
  63. package/dist/tasks/files-tab.js +0 -186
  64. package/dist/tasks/review-tab.js +0 -170
  65. package/dist/tasks/subtasks-tab.js +0 -154
  66. package/dist/tasks/task-detail-panel.js +0 -210
  67. package/dist/tasks/task-properties.js +0 -324
  68. package/dist/utils/use-composed-ref.js +0 -12
@@ -1,259 +0,0 @@
1
- "use client";
2
- import { jsxs as l, jsx as i, Fragment as y } from "react/jsx-runtime";
3
- import * as H from "react";
4
- import { useState as E } from "react";
5
- import { Dialog as q, DialogTrigger as z, DialogContent as G, DialogHeader as $, DialogFooter as V, DialogClose as W } from "@devalok/shilp-sutra/ui/dialog";
6
- import { Button as _ } from "@devalok/shilp-sutra/ui/button";
7
- import { IconButton as L } from "@devalok/shilp-sutra/ui/icon-button";
8
- import { cn as O } from "@devalok/shilp-sutra/ui/lib/utils";
9
- import { isSameDay as Y } from "../utils/date-utils.js";
10
- import { BreakRequestCard as R } from "./break-request.js";
11
- import { isBefore as F, startOfDay as J, format as Q } from "date-fns";
12
- import { IconPencil as X, IconSend as Z, IconGripVertical as T, IconSquareCheck as e, IconSquare as A, IconPlus as U } from "@tabler/icons-react";
13
- function ii({
14
- selectedUserAttendance: s
15
- }) {
16
- const m = (s == null ? void 0 : s.status) || "ABSENT", o = m === "Not_Marked" ? "ABSENT" : m, r = o.charAt(0).toUpperCase() + o.slice(1).toLowerCase(), u = s != null && s.timeIn ? new Date(s.timeIn).toLocaleTimeString() : null;
17
- return /* @__PURE__ */ l("div", { className: "flex w-full flex-col items-center justify-center px-ds-05 py-ds-07 sm:px-ds-05 sm:py-ds-06 md:px-ds-06 md:py-ds-05 md:pr-0", children: [
18
- /* @__PURE__ */ i("p", { className: "text-ds-sm font-semibold uppercase tracking-wider mb-ds-06 text-text-tertiary", children: "Attendance status" }),
19
- /* @__PURE__ */ l("div", { className: "mb-ds-04 flex w-full items-center justify-center gap-ds-03 rounded-ds-3xl border border-border-subtle px-ds-05 py-ds-04 text-center", children: [
20
- /* @__PURE__ */ i("span", { className: "font-semibold text-interactive", children: r }),
21
- r === "Absent" && /* @__PURE__ */ i("div", { className: "w-px h-5 opacity-[0.5] bg-border-strong" }),
22
- !u && m !== "HOLIDAY" && m !== "WEEKEND" && /* @__PURE__ */ i("span", { className: "text-ds-md text-text-tertiary", children: "Not marked" }),
23
- !!u && m === "ABSENT" && /* @__PURE__ */ i("span", { className: "text-ds-md text-text-tertiary", children: "Removed" })
24
- ] }),
25
- u && /* @__PURE__ */ l("p", { className: "text-ds-md m-0 text-center text-text-disabled", children: [
26
- "Marked at ",
27
- u
28
- ] })
29
- ] });
30
- }
31
- function ri({
32
- selectedAssociate: s,
33
- selectedDate: m,
34
- selectedUserAttendance: o,
35
- onUpdateAttendanceStatus: r
36
- }) {
37
- return /* @__PURE__ */ l(G, { className: "sm:max-w-md", children: [
38
- /* @__PURE__ */ i($, { children: /* @__PURE__ */ l("div", { className: "text-ds-md text-text-tertiary", children: [
39
- "Edit attendance of",
40
- " ",
41
- /* @__PURE__ */ i("span", { className: "text-ds-md font-semibold text-interactive", children: s.name })
42
- ] }) }),
43
- /* @__PURE__ */ l("div", { className: "flex flex-col items-center justify-start", children: [
44
- /* @__PURE__ */ i("div", { className: "text-ds-lg mb-ds-05 text-interactive", children: Q(new Date(m), "dd MMMM ''yy") }),
45
- /* @__PURE__ */ i("div", { className: "mb-ds-04 flex w-full items-center justify-center gap-ds-03 rounded-ds-3xl border border-border-subtle px-ds-05 py-ds-04 text-center font-semibold text-interactive", children: (o == null ? void 0 : o.status) === "PRESENT" ? "PRESENT " : "ABSENT" })
46
- ] }),
47
- /* @__PURE__ */ i(V, { className: "sm:justify-start", children: /* @__PURE__ */ i(W, { asChild: !0, children: /* @__PURE__ */ i(
48
- _,
49
- {
50
- variant: "solid",
51
- fullWidth: !0,
52
- onClick: () => {
53
- const u = (o == null ? void 0 : o.status) !== "PRESENT";
54
- r == null || r({
55
- userId: s.id,
56
- date: m,
57
- isPresent: u
58
- });
59
- },
60
- children: `Mark as ${(o == null ? void 0 : o.status) === "PRESENT" ? "absent" : "present"}`
61
- }
62
- ) }) })
63
- ] });
64
- }
65
- const ai = H.forwardRef(
66
- function({
67
- selectedAssociate: m,
68
- selectedDate: o,
69
- selectedUserAttendance: r,
70
- userTasks: u,
71
- selectedBreakRequest: v,
72
- isFutureDate: n,
73
- assetsBaseUrl: w,
74
- onUpdateAttendanceStatus: x,
75
- onToggleTaskStatus: h,
76
- onAddTask: d,
77
- onReorderTasks: g,
78
- onCancelBreak: D,
79
- onRefreshSelectedUserAttendance: c,
80
- onRefreshAttendanceData: I
81
- }, j) {
82
- const [b, M] = E(""), [p, C] = E(null), [B, N] = E(null), P = async (a) => {
83
- a.preventDefault(), !(!b.trim() || !m) && (await (d == null ? void 0 : d(b, m.id)), M(""));
84
- }, S = (a, t) => {
85
- C(t), a.target.classList.add("dragging");
86
- }, k = async (a, t) => {
87
- if (a.preventDefault(), p !== null && p !== t) {
88
- const f = u[p], K = u[t];
89
- await (g == null ? void 0 : g(f.id, K.id));
90
- }
91
- C(null), N(null);
92
- };
93
- return /* @__PURE__ */ l("div", { ref: j, className: "relative flex items-center justify-between md:items-stretch", children: [
94
- !n && (r == null ? void 0 : r.status) !== "BREAK" && /* @__PURE__ */ l(q, { children: [
95
- /* @__PURE__ */ i(z, { asChild: !0, children: /* @__PURE__ */ i(
96
- L,
97
- {
98
- icon: /* @__PURE__ */ i(X, {}),
99
- size: "sm",
100
- "aria-label": "Edit",
101
- className: "absolute right-2 top-2"
102
- }
103
- ) }),
104
- /* @__PURE__ */ i(
105
- ri,
106
- {
107
- selectedAssociate: m,
108
- selectedDate: o,
109
- selectedUserAttendance: r,
110
- onUpdateAttendanceStatus: x
111
- }
112
- )
113
- ] }),
114
- n ? /* @__PURE__ */ i(y, { children: (r == null ? void 0 : r.status) === "BREAK" ? /* @__PURE__ */ i(
115
- R,
116
- {
117
- selectedDate: o,
118
- userId: m.id,
119
- breakRequest: v,
120
- assetsBaseUrl: w,
121
- onCancelBreak: D,
122
- onRefreshAttendance: c,
123
- onRefreshGroupedAttendance: I
124
- }
125
- ) : /* @__PURE__ */ i("div", { className: "min-h-28" }) }) : (r == null ? void 0 : r.status) === "BREAK" ? /* @__PURE__ */ i(
126
- R,
127
- {
128
- selectedDate: o,
129
- userId: m.id,
130
- breakRequest: v,
131
- assetsBaseUrl: w,
132
- onCancelBreak: D,
133
- onRefreshAttendance: c,
134
- onRefreshGroupedAttendance: I
135
- }
136
- ) : (r == null ? void 0 : r.status) === "ABSENT" || (r == null ? void 0 : r.status) === "Not_Marked" && F(
137
- new Date(o),
138
- J(/* @__PURE__ */ new Date())
139
- ) ? /* @__PURE__ */ l("div", { className: "flex w-full flex-col items-center justify-center p-ds-06", children: [
140
- /* @__PURE__ */ i("p", { className: "text-ds-sm font-semibold uppercase tracking-wider mb-ds-05 text-text-tertiary", children: "COMMENT" }),
141
- /* @__PURE__ */ l("div", { className: "flex w-full items-center justify-between rounded-ds-lg border border-border bg-layer-01 px-ds-05 max-md:h-ds-lg", children: [
142
- /* @__PURE__ */ i(
143
- "input",
144
- {
145
- className: "text-ds-md flex-1 border-none py-ds-03 text-text-primary outline-none",
146
- defaultValue: "Don't miss next time :)"
147
- }
148
- ),
149
- /* @__PURE__ */ i(
150
- L,
151
- {
152
- icon: /* @__PURE__ */ i(Z, {}),
153
- size: "sm",
154
- "aria-label": "Update status",
155
- onClick: () => {
156
- const a = (r == null ? void 0 : r.status) !== "PRESENT";
157
- x == null || x({
158
- userId: m.id,
159
- date: o,
160
- isPresent: a
161
- });
162
- }
163
- }
164
- )
165
- ] })
166
- ] }) : /* @__PURE__ */ l("div", { className: "mb-auto flex w-full flex-col md:pr-ds-06", children: [
167
- /* @__PURE__ */ i("p", { className: "text-ds-sm font-semibold uppercase tracking-wider mb-ds-06 text-interactive", children: "Tasks for the day" }),
168
- u && /* @__PURE__ */ l(y, { children: [
169
- /* @__PURE__ */ i("div", { className: "no-scrollbar mb-ds-03 flex max-h-[250px] flex-col gap-ds-03 overflow-y-auto", children: u.map((a, t) => (
170
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
171
- /* @__PURE__ */ l(
172
- "div",
173
- {
174
- className: O("task-item mb-ds-03 flex items-center gap-ds-02", p === t ? "dragging" : ""),
175
- draggable: !0,
176
- onDragStart: (f) => S(f, t),
177
- onDragOver: (f) => f.preventDefault(),
178
- onDrop: (f) => k(f, t),
179
- onDragEnter: () => N(t),
180
- onDragLeave: () => N(null),
181
- onDragEnd: (f) => {
182
- f.target instanceof HTMLElement && f.target.classList.remove("dragging");
183
- },
184
- children: [
185
- B === t && /* @__PURE__ */ i("div", { className: "drop-indicator" }),
186
- a.status === "COMPLETED" ? /* @__PURE__ */ i(T, { className: "" }) : /* @__PURE__ */ i(T, {}),
187
- /* @__PURE__ */ i(
188
- "button",
189
- {
190
- type: "button",
191
- onClick: () => {
192
- h == null || h(
193
- a.id,
194
- a.status === "COMPLETED" ? "TODO" : "COMPLETED"
195
- );
196
- },
197
- "aria-label": a.status === "COMPLETED" ? `Mark "${a.title}" as incomplete` : `Mark "${a.title}" as complete`,
198
- className: "cursor-pointer",
199
- children: a.status === "COMPLETED" ? /* @__PURE__ */ i(e, { className: "text-interactive-hover" }) : /* @__PURE__ */ i(A, {})
200
- }
201
- ),
202
- /* @__PURE__ */ i(
203
- "p",
204
- {
205
- className: O("text-ds-md flex-1 overflow-hidden hyphens-auto break-all pr-ds-05 break-words min-w-0", a.status === "COMPLETED" ? "text-text-disabled line-through" : "text-text-secondary"),
206
- children: a.title
207
- }
208
- )
209
- ]
210
- },
211
- a.id
212
- )
213
- )) }),
214
- Y(new Date(o), /* @__PURE__ */ new Date()) && /* @__PURE__ */ l(
215
- "form",
216
- {
217
- className: "flex items-center gap-ds-02 pb-ds-05",
218
- onSubmit: P,
219
- children: [
220
- /* @__PURE__ */ i("div", { className: "w-ds-06" }),
221
- /* @__PURE__ */ i("button", { type: "submit", className: "appearance-none", children: /* @__PURE__ */ i(U, {}) }),
222
- /* @__PURE__ */ i(
223
- "textarea",
224
- {
225
- className: "text-ds-md flex w-full resize-none items-center border-none bg-transparent !leading-6 text-text-secondary outline-none placeholder:leading-6",
226
- placeholder: "Add a task",
227
- value: b,
228
- onChange: (a) => M(a.target.value),
229
- onKeyDown: (a) => {
230
- a.key === "Enter" && !a.shiftKey && (a.preventDefault(), P(a));
231
- },
232
- rows: 1,
233
- style: {
234
- minHeight: "24px",
235
- height: "auto",
236
- overflow: "hidden"
237
- },
238
- onInput: (a) => {
239
- const t = a.target;
240
- t.style.height = "auto", t.style.height = t.scrollHeight + "px";
241
- }
242
- }
243
- )
244
- ]
245
- }
246
- )
247
- ] })
248
- ] }),
249
- !n && (r == null ? void 0 : r.status) !== "BREAK" && /* @__PURE__ */ l(y, { children: [
250
- /* @__PURE__ */ i("div", { className: "block h-full w-[2px] bg-border-subtle" }),
251
- /* @__PURE__ */ i(ii, { selectedUserAttendance: r })
252
- ] })
253
- ] });
254
- }
255
- );
256
- ai.displayName = "AssociateDetail";
257
- export {
258
- ai as AssociateDetail
259
- };
@@ -1,136 +0,0 @@
1
- "use client";
2
- import { jsx as s, jsxs as x } from "react/jsx-runtime";
3
- import * as k from "react";
4
- import { useRef as N, useCallback as O, useState as g } from "react";
5
- import { cn as j } from "@devalok/shilp-sutra/ui/lib/utils";
6
- import { AvatarGroup as w } from "@devalok/shilp-sutra/composed/avatar-group";
7
- function A(l, u, m) {
8
- const c = [];
9
- if (!(l != null && l.length)) return { onBreak: c };
10
- const d = new Date(m), f = new Date(d);
11
- f.setHours(0, 0, 0, 0);
12
- const a = new Date(d);
13
- a.setHours(23, 59, 59, 999);
14
- const n = /* @__PURE__ */ new Map();
15
- return u.forEach((r) => {
16
- const p = new Date(r.date);
17
- p >= f && p <= a && n.set(r.userId, r.status);
18
- }), l.forEach((r) => {
19
- n.get(r.id) === "BREAK" && c.push(r);
20
- }), { onBreak: c };
21
- }
22
- const B = k.forwardRef(
23
- function({
24
- isFutureDate: u,
25
- users: m,
26
- groupedAttendance: c,
27
- userImages: d,
28
- selectedDate: f
29
- }, a) {
30
- var v;
31
- const n = N(null), r = O((t) => {
32
- n.current = t, typeof a == "function" ? a(t) : a && (a.current = t);
33
- }, [a]), [p, h] = g(!1), [M, b] = g(0), [y, D] = g(0);
34
- return (
35
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions -- drag-to-scroll UX enhancement on scrollable container
36
- /* @__PURE__ */ s(
37
- "div",
38
- {
39
- ref: r,
40
- className: "hide-scrollbar w-full cursor-grab overflow-x-auto active:cursor-grabbing max-md:pb-ds-05",
41
- onMouseDown: (t) => {
42
- var o, e;
43
- h(!0), b(t.pageX - (((o = n.current) == null ? void 0 : o.offsetLeft) || 0)), D(((e = n.current) == null ? void 0 : e.scrollLeft) || 0);
44
- },
45
- onMouseMove: (t) => {
46
- var i;
47
- if (!p) return;
48
- t.preventDefault();
49
- const e = (t.pageX - (((i = n.current) == null ? void 0 : i.offsetLeft) || 0) - M) * 2;
50
- n.current && (n.current.scrollLeft = y - e);
51
- },
52
- onMouseUp: () => {
53
- h(!1);
54
- },
55
- onMouseLeave: () => {
56
- h(!1);
57
- },
58
- style: {
59
- scrollbarWidth: "none",
60
- msOverflowStyle: "none"
61
- },
62
- children: /* @__PURE__ */ s(
63
- "div",
64
- {
65
- className: "flex items-start justify-start gap-ds-04 px-0 pt-ds-03 md:gap-0 md:px-ds-06 min-w-max",
66
- children: u ? /* @__PURE__ */ s("div", { className: "min-h-28", children: m && ((v = Object.entries(
67
- A(
68
- m,
69
- [],
70
- f
71
- )
72
- )) == null ? void 0 : v.map(([t, o]) => {
73
- const e = o;
74
- return /* @__PURE__ */ x(
75
- "div",
76
- {
77
- className: "flex w-full flex-col gap-ds-04 rounded-ds-md bg-layer-02 p-ds-06 md:rounded-ds-lg",
78
- children: [
79
- (e == null ? void 0 : e.length) > 0 && /* @__PURE__ */ s("h2", { className: "text-ds-sm font-semibold uppercase tracking-wider capitalize text-text-tertiary", children: `On Break (${(e == null ? void 0 : e.length) || 0})` }),
80
- /* @__PURE__ */ s("div", { className: "flex w-full flex-wrap items-center", children: (e == null ? void 0 : e.length) > 0 && /* @__PURE__ */ s(
81
- w,
82
- {
83
- users: e == null ? void 0 : e.map((i) => ({
84
- image: d[i.id],
85
- name: i.name || "User"
86
- })),
87
- max: 4,
88
- showTooltip: !1
89
- }
90
- ) })
91
- ]
92
- },
93
- t
94
- );
95
- })) }) : Object.entries(c || {}).map(
96
- ([t, o]) => /* @__PURE__ */ x(
97
- "div",
98
- {
99
- className: j("flex w-full flex-col gap-ds-04 rounded-ds-md bg-layer-02 p-ds-06 md:rounded-ds-lg md:p-ds-05", t !== "yetToMark" ? "border-r border-border" : "", "max-md:border-0 max-md:p-ds-05", "min-w-[200px]"),
100
- children: [
101
- /* @__PURE__ */ x("h2", { className: "text-ds-sm font-semibold uppercase tracking-wider capitalize text-text-tertiary", children: [
102
- t === "yetToMark" ? "Yet to Mark" : t.replace(/([A-Z])/g, " $1").toLowerCase(),
103
- " ",
104
- "(",
105
- o.length,
106
- ")"
107
- ] }),
108
- /* @__PURE__ */ s("div", { className: "flex cursor-pointer flex-wrap items-center", children: /* @__PURE__ */ s(
109
- w,
110
- {
111
- users: o.map(
112
- ({ user: e }) => ({
113
- image: d[e.id],
114
- name: e.name
115
- })
116
- ),
117
- max: 4,
118
- showTooltip: !1
119
- }
120
- ) })
121
- ]
122
- },
123
- t
124
- )
125
- )
126
- }
127
- )
128
- }
129
- )
130
- );
131
- }
132
- );
133
- B.displayName = "AttendanceOverview";
134
- export {
135
- B as AttendanceOverview
136
- };
@@ -1,176 +0,0 @@
1
- "use client";
2
- import { jsxs as l, jsx as e, Fragment as f } from "react/jsx-runtime";
3
- import * as F from "react";
4
- import { useState as v, useEffect as M } from "react";
5
- import { Button as h } from "@devalok/shilp-sutra/ui/button";
6
- import { Checkbox as D } from "@devalok/shilp-sutra/ui/checkbox";
7
- import { Dialog as w, DialogTrigger as C, DialogContent as j, DialogHeader as E, DialogFooter as k, DialogClose as S } from "@devalok/shilp-sutra/ui/dialog";
8
- import { cn as T } from "@devalok/shilp-sutra/ui/lib/utils";
9
- import { formatDate as B, getDaySuffix as p } from "../utils/date-utils.js";
10
- import { removeAllEmojis as W } from "../utils/emoji-utils.js";
11
- import { renderStatus as $ } from "../utils/render-status.js";
12
- import { format as I, startOfDay as O, isSameDay as J, isAfter as L } from "date-fns";
13
- import { IconX as V } from "@tabler/icons-react";
14
- const z = F.forwardRef(
15
- function({
16
- selectedDate: i,
17
- userId: P,
18
- breakRequest: t,
19
- assetsBaseUrl: u = "",
20
- onCancelBreak: a,
21
- onRefreshAttendance: n,
22
- onRefreshGroupedAttendance: c
23
- }, Y) {
24
- const [o, g] = v(!0), [d, r] = v(!1);
25
- M(() => {
26
- r(!1);
27
- }, [i]);
28
- const y = t && t.numberOfDays === 1, m = () => {
29
- if (!t) return !1;
30
- const s = O(/* @__PURE__ */ new Date()), N = O(new Date(t.endDate));
31
- return J(N, s) || L(N, s);
32
- }, x = async () => {
33
- !t || !a || (await a({
34
- requestId: t.id,
35
- deleteSingleDay: o,
36
- dateToCancel: i,
37
- userId: P
38
- }), r(!1), n == null || n(), c == null || c());
39
- }, b = (s) => I(new Date(s), "dd/MM/yyyy");
40
- return !t || t.status === "CANCELLED" ? null : /* @__PURE__ */ l("div", { ref: Y, className: "relative flex w-full flex-col gap-ds-06 rounded-ds-lg bg-layer-accent-subtle", children: [
41
- u && /* @__PURE__ */ e(
42
- "img",
43
- {
44
- src: `${u}/break-background.svg`,
45
- alt: "Break Background",
46
- className: "absolute bottom-0 z-0 h-full min-h-[236px] rounded-ds-lg object-cover"
47
- }
48
- ),
49
- /* @__PURE__ */ l("div", { className: "relative flex min-h-[236px] flex-col items-center justify-between rounded-ds-lg md:flex-row", children: [
50
- d && y ? /* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col items-center justify-center px-ds-04 pt-[17px]", children: /* @__PURE__ */ l("div", { className: "w-full gap-ds-05 rounded-ds-md bg-layer-01 shadow-01 px-ds-06 py-ds-07 md:hidden", children: [
51
- /* @__PURE__ */ l("div", { className: "flex flex-col items-center gap-ds-04", children: [
52
- /* @__PURE__ */ e("div", { className: "text-ds-lg font-semibold text-center text-text-primary", children: "Cancel this break?" }),
53
- /* @__PURE__ */ l("div", { className: "text-ds-base max-w-[240px] text-center text-text-tertiary max-md:leading-[100%]", children: [
54
- "You're about to cancel the break scheduled for",
55
- " ",
56
- /* @__PURE__ */ e("span", { className: "font-semibold text-text-secondary", children: b(t.startDate) })
57
- ] })
58
- ] }),
59
- /* @__PURE__ */ e("div", { className: "mt-ds-05 flex w-full flex-col gap-ds-04", children: /* @__PURE__ */ e(h, { variant: "solid", className: "w-full rounded-ds-full", onClick: x, children: "Yes, cancel" }) }),
60
- /* @__PURE__ */ e(
61
- "button",
62
- {
63
- "aria-label": "Close cancel form",
64
- className: "absolute right-ds-05 top-ds-05 rounded-ds-sm p-ds-04 text-icon-secondary transition-colors hover:text-icon-primary hover:bg-field focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus disabled:pointer-events-none",
65
- onClick: () => r(!1),
66
- children: /* @__PURE__ */ e(V, { className: "h-ico-lg w-ico-lg" })
67
- }
68
- )
69
- ] }) }) : /* @__PURE__ */ l("div", { className: "flex h-full w-full flex-col items-center justify-center gap-ds-06 p-ds-06 px-ds-06 py-ds-07 md:w-1/2 md:p-ds-07", children: [
70
- /* @__PURE__ */ l("div", { className: "flex flex-col items-center justify-end gap-ds-05", children: [
71
- /* @__PURE__ */ e("div", { className: "text-ds-sm font-semibold uppercase tracking-wider text-text-tertiary", children: "Reason" }),
72
- /* @__PURE__ */ e("div", { className: "text-ds-lg font-semibold text-text-primary", children: W((t == null ? void 0 : t.reason) || " ") })
73
- ] }),
74
- /* @__PURE__ */ l("div", { className: "flex flex-col items-center justify-end gap-ds-05", children: [
75
- /* @__PURE__ */ e("div", { className: "text-ds-sm font-semibold uppercase tracking-wider text-text-tertiary", children: "Break Period" }),
76
- /* @__PURE__ */ l("div", { className: "text-ds-lg font-semibold text-text-primary", children: [
77
- B(new Date(t.startDate)),
78
- " ",
79
- t.numberOfDays > 1 && /* @__PURE__ */ l(f, { children: [
80
- "- ",
81
- B(new Date(t.endDate)),
82
- " "
83
- ] }),
84
- /* @__PURE__ */ e("span", { className: "text-ds-lg text-text-placeholder", children: `(${t.numberOfDays} day${t.numberOfDays > 1 ? "s" : ""})` })
85
- ] })
86
- ] })
87
- ] }),
88
- !d && /* @__PURE__ */ l(f, { children: [
89
- /* @__PURE__ */ e("div", { className: "h-[1px] w-[329px] bg-border-subtle md:hidden max-md:w-[90%]" }),
90
- /* @__PURE__ */ e("div", { className: "hidden h-[170px] w-[2px] bg-border-subtle md:block" })
91
- ] }),
92
- /* @__PURE__ */ l(
93
- "div",
94
- {
95
- className: T("flex w-full flex-col items-center justify-center px-ds-05", d || t.status === "APPROVED" || t.status === "REJECTED" ? "pb-ds-06 pt-[9px]" : "py-ds-06", "md:w-1/2 md:px-ds-06 md:py-ds-05 max-md:pt-[34px]"),
96
- children: [
97
- /* @__PURE__ */ e("p", { className: "text-ds-sm font-semibold uppercase tracking-wider mb-ds-06 text-text-tertiary max-md:mb-ds-05", children: "Break Status" }),
98
- /* @__PURE__ */ l("div", { className: "mb-ds-04 flex w-full flex-col items-center justify-start gap-ds-04 rounded-ds-2xl border border-border-subtle bg-layer-01 shadow-01 px-ds-05 py-ds-04 text-center font-semibold text-text-primary", children: [
99
- $(t.status, !1),
100
- t.status === "APPROVED" && t.adminComment,
101
- t.status === "REJECTED" && t.adminComment
102
- ] }),
103
- y ? /* @__PURE__ */ l(f, { children: [
104
- m() && a && /* @__PURE__ */ e(
105
- "button",
106
- {
107
- className: "text-ds-sm cursor-pointer border-none bg-transparent text-interactive-hover underline md:hidden",
108
- onClick: () => r(!d),
109
- children: "Want to cancel this break?"
110
- }
111
- ),
112
- /* @__PURE__ */ l(w, { children: [
113
- m() && a && /* @__PURE__ */ e(C, { asChild: !0, children: /* @__PURE__ */ e("button", { className: "text-ds-sm hidden cursor-pointer border-none bg-transparent text-interactive-hover underline md:block", children: "Want to cancel this break?" }) }),
114
- /* @__PURE__ */ l(j, { className: "max-w-[329px] gap-ds-04 rounded-ds-xl", children: [
115
- /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e("div", { className: "text-ds-lg font-semibold text-center text-text-primary", children: "Cancel this break?" }) }),
116
- /* @__PURE__ */ e("div", { className: "flex flex-col items-center justify-start", children: /* @__PURE__ */ l("div", { className: "text-ds-base max-w-[241px] text-center text-text-tertiary", children: [
117
- "You're about to cancel the break scheduled for",
118
- " ",
119
- /* @__PURE__ */ e("span", { className: "font-semibold text-text-secondary", children: b(t.startDate) })
120
- ] }) }),
121
- /* @__PURE__ */ e(k, { className: "mt-ds-04 sm:justify-start", children: /* @__PURE__ */ e(S, { asChild: !0, children: /* @__PURE__ */ e(h, { variant: "solid", className: "w-full rounded-ds-full", onClick: x, children: "Yes, cancel" }) }) })
122
- ] })
123
- ] })
124
- ] }) : /* @__PURE__ */ l(w, { children: [
125
- m() && a && /* @__PURE__ */ e(C, { asChild: !0, children: /* @__PURE__ */ e("button", { className: "text-ds-sm cursor-pointer border-none bg-transparent text-interactive-hover underline", children: "Want to cancel this break?" }) }),
126
- /* @__PURE__ */ l(j, { className: "max-w-[329px] gap-ds-04 rounded-ds-xl", children: [
127
- /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e("div", { className: "text-ds-lg font-semibold flex text-center text-text-primary", children: "Cancel your break" }) }),
128
- /* @__PURE__ */ e("div", { className: "flex flex-col items-center justify-start", children: /* @__PURE__ */ l("div", { className: "flex w-full flex-col items-start", children: [
129
- /* @__PURE__ */ l("label", { className: "breakRequest-checkbox flex items-center space-x-ds-03", children: [
130
- /* @__PURE__ */ e(
131
- D,
132
- {
133
- checked: o,
134
- onCheckedChange: (s) => g(s === !0)
135
- }
136
- ),
137
- /* @__PURE__ */ l("span", { className: "text-text-secondary", children: [
138
- p(new Date(i).getDate()),
139
- " break only"
140
- ] })
141
- ] }),
142
- /* @__PURE__ */ l("label", { className: "breakRequest-checkbox mt-ds-03 flex items-center space-x-ds-03", children: [
143
- /* @__PURE__ */ e(
144
- D,
145
- {
146
- checked: !o,
147
- onCheckedChange: (s) => g(s !== !0)
148
- }
149
- ),
150
- /* @__PURE__ */ l("span", { className: "text-text-secondary", children: [
151
- p(
152
- new Date(t.startDate).getDate()
153
- ),
154
- " ",
155
- "to",
156
- " ",
157
- p(new Date(t.endDate).getDate()),
158
- " ",
159
- "breaks"
160
- ] })
161
- ] })
162
- ] }) }),
163
- /* @__PURE__ */ e(k, { className: "mt-ds-04 sm:justify-start", children: /* @__PURE__ */ e(S, { asChild: !0, children: /* @__PURE__ */ e(h, { variant: "solid", className: "w-full rounded-ds-full", onClick: x, children: "Yes, cancel" }) }) })
164
- ] })
165
- ] })
166
- ]
167
- }
168
- )
169
- ] })
170
- ] });
171
- }
172
- );
173
- z.displayName = "BreakRequestCard";
174
- export {
175
- z as BreakRequestCard
176
- };