@devalok/shilp-sutra-karm 0.2.1 → 0.3.1
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/README.md +65 -0
- package/dist/admin/adjustments/approved-adjustments.js +1 -0
- package/dist/admin/break/break-admin-skeleton.js +1 -0
- package/dist/admin/break/break-admin.js +48 -47
- package/dist/admin/break/break-balance.js +1 -0
- package/dist/admin/break/breaks.js +1 -0
- package/dist/admin/break/delete-break.js +15 -14
- package/dist/admin/break/edit-break-balance.js +20 -19
- package/dist/admin/break/edit-break.js +57 -56
- package/dist/admin/break/header.js +6 -5
- package/dist/admin/break/leave-request.js +2 -1
- package/dist/admin/break/use-break-date-picker.js +1 -0
- package/dist/admin/dashboard/admin-dashboard.js +1 -0
- package/dist/admin/dashboard/associate-detail.js +2 -1
- package/dist/admin/dashboard/attendance-overview.js +1 -0
- package/dist/admin/dashboard/break-request.js +16 -15
- package/dist/admin/dashboard/calendar.js +1 -0
- package/dist/admin/dashboard/correction-list.js +1 -0
- package/dist/admin/dashboard/dashboard-header.js +29 -28
- package/dist/admin/dashboard/dashboard-skeleton.js +1 -0
- package/dist/admin/dashboard/leave-requests.js +2 -1
- package/dist/admin/dashboard/render-date.js +1 -0
- package/dist/admin/dashboard/use-calendar-navigation.js +1 -0
- package/dist/admin/dashboard/use-leave-request-interaction.js +1 -0
- package/dist/admin/index.js +1 -0
- package/dist/admin/utils/date-range-utils.js +1 -0
- package/dist/admin/utils/date-utils.js +1 -0
- package/dist/admin/utils/emoji-utils.js +1 -0
- package/dist/admin/utils/render-adjustment-type.js +1 -0
- package/dist/admin/utils/render-status.js +18 -17
- package/dist/board/board-column.js +1 -0
- package/dist/board/index.js +1 -0
- package/dist/board/kanban-board.js +1 -0
- package/dist/board/task-card.js +2 -1
- package/dist/chat/chat-input.js +12 -11
- package/dist/chat/chat-panel.js +1 -0
- package/dist/chat/conversation-list.js +1 -0
- package/dist/chat/index.js +1 -0
- package/dist/chat/markdown-components.js +1 -0
- package/dist/chat/message-list.js +1 -0
- package/dist/chat/streaming-text.js +1 -0
- package/dist/client/accent-provider.js +1 -0
- package/dist/client/client-portal-header.js +1 -0
- package/dist/client/index.js +1 -0
- package/dist/client/project-card.js +1 -0
- package/dist/dashboard/attendance-cta.js +1 -0
- package/dist/dashboard/daily-brief.js +1 -0
- package/dist/dashboard/index.js +1 -0
- package/dist/index.js +1 -0
- package/dist/page-skeletons.js +1 -0
- package/dist/tasks/activity-tab.js +1 -0
- package/dist/tasks/conversation-tab.js +1 -0
- package/dist/tasks/files-tab.d.ts.map +1 -1
- package/dist/tasks/files-tab.js +30 -28
- package/dist/tasks/index.js +1 -0
- package/dist/tasks/review-tab.js +2 -1
- package/dist/tasks/subtasks-tab.js +1 -0
- package/dist/tasks/task-constants.d.ts +2 -2
- package/dist/tasks/task-constants.d.ts.map +1 -1
- package/dist/tasks/task-constants.js +7 -6
- package/dist/tasks/task-detail-panel.js +1 -0
- package/dist/tasks/task-properties.js +1 -0
- package/package.json +68 -68
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# @devalok/shilp-sutra-karm
|
|
2
|
+
|
|
3
|
+
Domain components for project management -- board, tasks, chat, dashboard, client portal, and admin.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@devalok/shilp-sutra-karm)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm add @devalok/shilp-sutra-karm @devalok/shilp-sutra
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Note:** `@devalok/shilp-sutra >=0.3.0` is a required peer dependency.
|
|
17
|
+
|
|
18
|
+
## Peer Dependencies
|
|
19
|
+
|
|
20
|
+
| Package | Version | Required |
|
|
21
|
+
|---------|---------|----------|
|
|
22
|
+
| `@devalok/shilp-sutra` | `>=0.3.0` | Yes |
|
|
23
|
+
| `react` | `^18 \|\| ^19` | Yes |
|
|
24
|
+
| `react-dom` | `^18 \|\| ^19` | Yes |
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
All Karm components are **client-only** (`"use client"` directives included).
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { KanbanBoard } from '@devalok/shilp-sutra-karm/board'
|
|
32
|
+
import { TaskDetailPanel } from '@devalok/shilp-sutra-karm/tasks'
|
|
33
|
+
import { ChatPanel } from '@devalok/shilp-sutra-karm/chat'
|
|
34
|
+
import { AttendanceCTA, DailyBrief } from '@devalok/shilp-sutra-karm/dashboard'
|
|
35
|
+
import { ClientHeader, ProjectCard } from '@devalok/shilp-sutra-karm/client'
|
|
36
|
+
import { AdminDashboard, BreakAdmin } from '@devalok/shilp-sutra-karm/admin'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Sub-path Exports
|
|
40
|
+
|
|
41
|
+
| Import path | Contents |
|
|
42
|
+
|-------------|----------|
|
|
43
|
+
| `@devalok/shilp-sutra-karm` | All domain components |
|
|
44
|
+
| `@devalok/shilp-sutra-karm/board` | Kanban board with drag-and-drop |
|
|
45
|
+
| `@devalok/shilp-sutra-karm/tasks` | Task detail panel, properties, tabs |
|
|
46
|
+
| `@devalok/shilp-sutra-karm/chat` | AI chat panel, message list, streaming |
|
|
47
|
+
| `@devalok/shilp-sutra-karm/dashboard` | Attendance CTA, daily brief |
|
|
48
|
+
| `@devalok/shilp-sutra-karm/client` | Client portal (accent provider, header, project card) |
|
|
49
|
+
| `@devalok/shilp-sutra-karm/admin` | Admin dashboard, break management, adjustments |
|
|
50
|
+
|
|
51
|
+
## Tailwind Content
|
|
52
|
+
|
|
53
|
+
Add Karm's dist to your Tailwind content array:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
// tailwind.config.ts
|
|
57
|
+
content: [
|
|
58
|
+
// ...your app files
|
|
59
|
+
'./node_modules/@devalok/shilp-sutra-karm/dist/**/*.js',
|
|
60
|
+
],
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT -- Copyright 2026 Devalok Design & Strategy Studios
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs as d, Fragment as q, jsx as e } from "react/jsx-runtime";
|
|
2
3
|
import * as B from "react";
|
|
3
4
|
import { useState as N, useMemo as re, useCallback as F, createContext as ie, useContext as ce } from "react";
|
|
4
5
|
import { cn as p } from "@devalok/shilp-sutra/ui";
|
|
5
|
-
import { useToast as le } from "@devalok/shilp-sutra/
|
|
6
|
+
import { useToast as le } from "@devalok/shilp-sutra/hooks";
|
|
6
7
|
import { BreakBalance as de } from "./break-balance.js";
|
|
7
8
|
import { LeaveRequest as me } from "./leave-request.js";
|
|
8
9
|
import { Breaks as ue } from "./breaks.js";
|
|
@@ -19,11 +20,11 @@ function w() {
|
|
|
19
20
|
}
|
|
20
21
|
const L = B.forwardRef(
|
|
21
22
|
function({
|
|
22
|
-
currentUser:
|
|
23
|
+
currentUser: n,
|
|
23
24
|
breaks: i,
|
|
24
25
|
pendingRequests: t,
|
|
25
26
|
cashoutRequests: o = [],
|
|
26
|
-
breakBalanceData:
|
|
27
|
+
breakBalanceData: s,
|
|
27
28
|
breakBalance: c,
|
|
28
29
|
userImages: l,
|
|
29
30
|
users: u,
|
|
@@ -31,7 +32,7 @@ const L = B.forwardRef(
|
|
|
31
32
|
isLoadingBreaks: g = !1,
|
|
32
33
|
isLoadingRequests: y = !1,
|
|
33
34
|
isLoadingBalance: O = !1,
|
|
34
|
-
existingBreaks:
|
|
35
|
+
existingBreaks: C,
|
|
35
36
|
filters: f,
|
|
36
37
|
onFilterChange: R,
|
|
37
38
|
onApproveRequest: P,
|
|
@@ -46,9 +47,9 @@ const L = B.forwardRef(
|
|
|
46
47
|
realtimeCallbacks: he,
|
|
47
48
|
children: ae
|
|
48
49
|
}, oe) {
|
|
49
|
-
const [U, V] = N("breaks"), [b,
|
|
50
|
+
const [U, V] = N("breaks"), [b, v] = N(!1), [G, E] = N(
|
|
50
51
|
null
|
|
51
|
-
), [J, T] = N(null), { toast: h } = le(),
|
|
52
|
+
), [J, T] = N(null), { toast: h } = le(), se = re(
|
|
52
53
|
() => ({
|
|
53
54
|
selectedAssociate: null,
|
|
54
55
|
dateFilterStart: null,
|
|
@@ -58,7 +59,7 @@ const L = B.forwardRef(
|
|
|
58
59
|
isOpen: !1
|
|
59
60
|
}),
|
|
60
61
|
[]
|
|
61
|
-
), W = f ||
|
|
62
|
+
), W = f || se, X = F(
|
|
62
63
|
(a) => {
|
|
63
64
|
R && R(a);
|
|
64
65
|
},
|
|
@@ -71,7 +72,7 @@ const L = B.forwardRef(
|
|
|
71
72
|
return;
|
|
72
73
|
}
|
|
73
74
|
try {
|
|
74
|
-
|
|
75
|
+
v(!0);
|
|
75
76
|
const r = t.find((K) => K.id === x);
|
|
76
77
|
if (!r)
|
|
77
78
|
throw new Error("Request not found");
|
|
@@ -83,17 +84,17 @@ const L = B.forwardRef(
|
|
|
83
84
|
] }),
|
|
84
85
|
/* @__PURE__ */ e("span", { className: "text-success-text", children: "approved successfully" })
|
|
85
86
|
] }),
|
|
86
|
-
|
|
87
|
+
color: "default",
|
|
87
88
|
style: { marginBottom: "var(--spacing-04)", border: "none" }
|
|
88
89
|
});
|
|
89
90
|
} catch (r) {
|
|
90
91
|
console.error("Error approving request:", r), h({
|
|
91
92
|
title: "Error",
|
|
92
93
|
description: r instanceof Error ? r.message : "Failed to approve request",
|
|
93
|
-
|
|
94
|
+
color: "error"
|
|
94
95
|
});
|
|
95
96
|
} finally {
|
|
96
|
-
|
|
97
|
+
v(!1);
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
},
|
|
@@ -106,7 +107,7 @@ const L = B.forwardRef(
|
|
|
106
107
|
return;
|
|
107
108
|
}
|
|
108
109
|
try {
|
|
109
|
-
|
|
110
|
+
v(!0);
|
|
110
111
|
const r = t.find((K) => K.id === x);
|
|
111
112
|
if (!r)
|
|
112
113
|
throw new Error("Request not found");
|
|
@@ -118,35 +119,35 @@ const L = B.forwardRef(
|
|
|
118
119
|
] }),
|
|
119
120
|
/* @__PURE__ */ e("span", { className: "text-error-text", children: "rejected" })
|
|
120
121
|
] }),
|
|
121
|
-
|
|
122
|
+
color: "default",
|
|
122
123
|
style: { marginBottom: "var(--spacing-04)", border: "none" }
|
|
123
124
|
});
|
|
124
125
|
} catch (r) {
|
|
125
126
|
console.error("Error rejecting request:", r), h({
|
|
126
127
|
title: "Error",
|
|
127
128
|
description: r instanceof Error ? r.message : "Failed to reject request",
|
|
128
|
-
|
|
129
|
+
color: "error"
|
|
129
130
|
});
|
|
130
131
|
} finally {
|
|
131
|
-
|
|
132
|
+
v(!1);
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
},
|
|
135
136
|
[b, t, j, h]
|
|
136
|
-
),
|
|
137
|
+
), ne = re(
|
|
137
138
|
() => ({
|
|
138
|
-
currentUser:
|
|
139
|
+
currentUser: n,
|
|
139
140
|
activeTab: U,
|
|
140
141
|
setActiveTab: V,
|
|
141
142
|
isProcessing: b,
|
|
142
143
|
breaks: i,
|
|
143
144
|
pendingRequests: t,
|
|
144
145
|
cashoutRequests: o,
|
|
145
|
-
breakBalanceData:
|
|
146
|
+
breakBalanceData: s,
|
|
146
147
|
breakBalance: c,
|
|
147
148
|
userImages: l,
|
|
148
149
|
users: u,
|
|
149
|
-
existingBreaks:
|
|
150
|
+
existingBreaks: C,
|
|
150
151
|
filters: W,
|
|
151
152
|
handleFilterChange: X,
|
|
152
153
|
handleApproveRequest: Z,
|
|
@@ -162,18 +163,18 @@ const L = B.forwardRef(
|
|
|
162
163
|
onFetchMonthBreaks: Q
|
|
163
164
|
}),
|
|
164
165
|
[
|
|
165
|
-
|
|
166
|
+
n,
|
|
166
167
|
U,
|
|
167
168
|
V,
|
|
168
169
|
b,
|
|
169
170
|
i,
|
|
170
171
|
t,
|
|
171
172
|
o,
|
|
172
|
-
|
|
173
|
+
s,
|
|
173
174
|
c,
|
|
174
175
|
l,
|
|
175
176
|
u,
|
|
176
|
-
|
|
177
|
+
C,
|
|
177
178
|
W,
|
|
178
179
|
X,
|
|
179
180
|
Z,
|
|
@@ -189,7 +190,7 @@ const L = B.forwardRef(
|
|
|
189
190
|
Q
|
|
190
191
|
]
|
|
191
192
|
);
|
|
192
|
-
return k ? /* @__PURE__ */ e(pe, {}) : /* @__PURE__ */ e(te.Provider, { value:
|
|
193
|
+
return k ? /* @__PURE__ */ e(pe, {}) : /* @__PURE__ */ e(te.Provider, { value: ne, children: /* @__PURE__ */ e(
|
|
193
194
|
"div",
|
|
194
195
|
{
|
|
195
196
|
ref: oe,
|
|
@@ -210,19 +211,19 @@ const L = B.forwardRef(
|
|
|
210
211
|
}
|
|
211
212
|
);
|
|
212
213
|
L.displayName = "BreakAdmin";
|
|
213
|
-
const S = B.forwardRef(function({ className:
|
|
214
|
+
const S = B.forwardRef(function({ className: n, ...i }, t) {
|
|
214
215
|
const {
|
|
215
216
|
filters: o,
|
|
216
|
-
handleFilterChange:
|
|
217
|
+
handleFilterChange: s,
|
|
217
218
|
breakBalance: c,
|
|
218
219
|
userImages: l,
|
|
219
220
|
users: u
|
|
220
221
|
} = w();
|
|
221
|
-
return /* @__PURE__ */ e("div", { ref: t, className: p(
|
|
222
|
+
return /* @__PURE__ */ e("div", { ref: t, className: p(n), ...i, children: /* @__PURE__ */ e(
|
|
222
223
|
fe,
|
|
223
224
|
{
|
|
224
225
|
filters: o,
|
|
225
|
-
onFilterChange:
|
|
226
|
+
onFilterChange: s,
|
|
226
227
|
breakBalance: c,
|
|
227
228
|
userImages: l,
|
|
228
229
|
users: u
|
|
@@ -230,15 +231,15 @@ const S = B.forwardRef(function({ className: s, ...i }, t) {
|
|
|
230
231
|
) });
|
|
231
232
|
});
|
|
232
233
|
S.displayName = "BreakAdmin.Header";
|
|
233
|
-
const M = B.forwardRef(function({ className:
|
|
234
|
-
const { activeTab: o, setActiveTab:
|
|
234
|
+
const M = B.forwardRef(function({ className: n, ...i }, t) {
|
|
235
|
+
const { activeTab: o, setActiveTab: s, pendingRequests: c, breakBalanceData: l } = w();
|
|
235
236
|
return /* @__PURE__ */ d(
|
|
236
237
|
"div",
|
|
237
238
|
{
|
|
238
239
|
ref: t,
|
|
239
240
|
className: p(
|
|
240
241
|
"flex w-full gap-ds-03 border-b-[1px] border-border px-ds-06 pt-ds-03 max-lg:min-w-[800px]",
|
|
241
|
-
|
|
242
|
+
n
|
|
242
243
|
),
|
|
243
244
|
...i,
|
|
244
245
|
children: [
|
|
@@ -246,7 +247,7 @@ const M = B.forwardRef(function({ className: s, ...i }, t) {
|
|
|
246
247
|
"button",
|
|
247
248
|
{
|
|
248
249
|
className: p("text-ds-sm font-semibold uppercase tracking-wider mb-[-1px] px-ds-03 py-ds-04", o === "breaks" ? "text-text-primary border-b-[1px] border-interactive-hover" : "text-text-tertiary"),
|
|
249
|
-
onClick: () =>
|
|
250
|
+
onClick: () => s("breaks"),
|
|
250
251
|
children: "BREAKS"
|
|
251
252
|
}
|
|
252
253
|
),
|
|
@@ -254,7 +255,7 @@ const M = B.forwardRef(function({ className: s, ...i }, t) {
|
|
|
254
255
|
"button",
|
|
255
256
|
{
|
|
256
257
|
className: p("text-ds-sm font-semibold uppercase tracking-wider mb-[-1px] flex items-center gap-ds-02 px-ds-03 py-ds-04", o === "requests" ? "border-b-[1px] border-interactive-hover text-text-primary" : "text-text-tertiary"),
|
|
257
|
-
onClick: () =>
|
|
258
|
+
onClick: () => s("requests"),
|
|
258
259
|
children: [
|
|
259
260
|
"REQUESTS",
|
|
260
261
|
" ",
|
|
@@ -266,7 +267,7 @@ const M = B.forwardRef(function({ className: s, ...i }, t) {
|
|
|
266
267
|
"button",
|
|
267
268
|
{
|
|
268
269
|
className: p("text-ds-sm font-semibold uppercase tracking-wider mb-[-1px] flex items-center gap-ds-02 px-ds-03 py-ds-04", o === "balance" ? "border-b-[1px] border-interactive-hover text-text-primary" : "text-text-tertiary"),
|
|
269
|
-
onClick: () =>
|
|
270
|
+
onClick: () => s("balance"),
|
|
270
271
|
children: [
|
|
271
272
|
"BALANCE",
|
|
272
273
|
" ",
|
|
@@ -279,10 +280,10 @@ const M = B.forwardRef(function({ className: s, ...i }, t) {
|
|
|
279
280
|
);
|
|
280
281
|
});
|
|
281
282
|
M.displayName = "BreakAdmin.TabBar";
|
|
282
|
-
const _ = B.forwardRef(function({ className:
|
|
283
|
+
const _ = B.forwardRef(function({ className: n, ...i }, t) {
|
|
283
284
|
const {
|
|
284
285
|
activeTab: o,
|
|
285
|
-
breaks:
|
|
286
|
+
breaks: s,
|
|
286
287
|
userImages: c,
|
|
287
288
|
existingBreaks: l,
|
|
288
289
|
onFetchMonthBreaks: u,
|
|
@@ -290,10 +291,10 @@ const _ = B.forwardRef(function({ className: s, ...i }, t) {
|
|
|
290
291
|
onDeleteBreak: g,
|
|
291
292
|
onRefresh: y
|
|
292
293
|
} = w();
|
|
293
|
-
return o !== "breaks" ? null : /* @__PURE__ */ e("div", { ref: t, className: p(
|
|
294
|
+
return o !== "breaks" ? null : /* @__PURE__ */ e("div", { ref: t, className: p(n), ...i, children: /* @__PURE__ */ e(
|
|
294
295
|
ue,
|
|
295
296
|
{
|
|
296
|
-
breaks:
|
|
297
|
+
breaks: s,
|
|
297
298
|
userImages: c,
|
|
298
299
|
existingBreaks: l,
|
|
299
300
|
onFetchMonthBreaks: u,
|
|
@@ -304,10 +305,10 @@ const _ = B.forwardRef(function({ className: s, ...i }, t) {
|
|
|
304
305
|
) });
|
|
305
306
|
});
|
|
306
307
|
_.displayName = "BreakAdmin.BreaksPanel";
|
|
307
|
-
const D = B.forwardRef(function({ className:
|
|
308
|
+
const D = B.forwardRef(function({ className: n, ...i }, t) {
|
|
308
309
|
const {
|
|
309
310
|
activeTab: o,
|
|
310
|
-
currentUser:
|
|
311
|
+
currentUser: s,
|
|
311
312
|
pendingRequests: c,
|
|
312
313
|
userImages: l,
|
|
313
314
|
handleApproveRequest: u,
|
|
@@ -315,7 +316,7 @@ const D = B.forwardRef(function({ className: s, ...i }, t) {
|
|
|
315
316
|
acceptedCommentBox: g,
|
|
316
317
|
rejectedCommentBox: y,
|
|
317
318
|
setAcceptedCommentBox: O,
|
|
318
|
-
setRejectedCommentBox:
|
|
319
|
+
setRejectedCommentBox: C
|
|
319
320
|
} = w();
|
|
320
321
|
return o !== "requests" ? null : /* @__PURE__ */ e(
|
|
321
322
|
"div",
|
|
@@ -324,7 +325,7 @@ const D = B.forwardRef(function({ className: s, ...i }, t) {
|
|
|
324
325
|
className: p(
|
|
325
326
|
/* intentional: h-[400px] is the fixed panel height for break tab content areas; mobile uses dvh for browser chrome */
|
|
326
327
|
"no-scrollbar flex h-[400px] flex-col gap-ds-02 overflow-y-auto border-t border-t-border px-ds-06 pb-ds-02 pt-ds-02 max-md:h-[calc(100dvh-317px)] max-md:border-0",
|
|
327
|
-
|
|
328
|
+
n
|
|
328
329
|
),
|
|
329
330
|
...i,
|
|
330
331
|
children: c.map((f) => /* @__PURE__ */ e(
|
|
@@ -336,10 +337,10 @@ const D = B.forwardRef(function({ className: s, ...i }, t) {
|
|
|
336
337
|
handleApproveRequest: u,
|
|
337
338
|
commentBoxOpen: g === f.id || y === f.id,
|
|
338
339
|
onCommentBoxClose: () => {
|
|
339
|
-
O(null),
|
|
340
|
+
O(null), C(null);
|
|
340
341
|
},
|
|
341
342
|
clickedAction: g === f.id ? "approve" : y === f.id ? "reject" : null,
|
|
342
|
-
userId:
|
|
343
|
+
userId: s.id
|
|
343
344
|
},
|
|
344
345
|
f.id
|
|
345
346
|
))
|
|
@@ -347,12 +348,12 @@ const D = B.forwardRef(function({ className: s, ...i }, t) {
|
|
|
347
348
|
);
|
|
348
349
|
});
|
|
349
350
|
D.displayName = "BreakAdmin.RequestsPanel";
|
|
350
|
-
const H = B.forwardRef(function({ className:
|
|
351
|
-
const { activeTab: o, breakBalanceData:
|
|
352
|
-
return o !== "balance" ? null : /* @__PURE__ */ e("div", { ref: t, className: p(
|
|
351
|
+
const H = B.forwardRef(function({ className: n, ...i }, t) {
|
|
352
|
+
const { activeTab: o, breakBalanceData: s, userImages: c, onSaveBalance: l } = w();
|
|
353
|
+
return o !== "balance" ? null : /* @__PURE__ */ e("div", { ref: t, className: p(n), ...i, children: /* @__PURE__ */ e(
|
|
353
354
|
de,
|
|
354
355
|
{
|
|
355
|
-
breakBalanceData:
|
|
356
|
+
breakBalanceData: s,
|
|
356
357
|
userImages: c,
|
|
357
358
|
onSaveBalance: l
|
|
358
359
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
3
|
import * as u from "react";
|
|
3
4
|
import { useState as d, useRef as p } from "react";
|
|
4
|
-
import { useToast as x } from "@devalok/shilp-sutra/
|
|
5
|
+
import { useToast as x } from "@devalok/shilp-sutra/hooks";
|
|
5
6
|
import { Dialog as h, DialogTrigger as g, DialogContent as b } from "@devalok/shilp-sutra/ui";
|
|
6
7
|
import { Button as D } from "@devalok/shilp-sutra/ui";
|
|
7
8
|
import { IconButton as k } from "@devalok/shilp-sutra/ui";
|
|
8
|
-
import { IconTrash as
|
|
9
|
-
const
|
|
10
|
-
const [c,
|
|
9
|
+
import { IconTrash as w } from "@tabler/icons-react";
|
|
10
|
+
const y = u.forwardRef(function({ id: B, userId: v, onDelete: l }, I) {
|
|
11
|
+
const [c, s] = d(!1), { toast: a } = x(), [m, o] = d(!1), i = p(null);
|
|
11
12
|
return /* @__PURE__ */ r(h, { open: m, onOpenChange: o, children: [
|
|
12
|
-
/* @__PURE__ */ t(g, { asChild: !0, children: /* @__PURE__ */ t(k, { icon: /* @__PURE__ */ t(
|
|
13
|
+
/* @__PURE__ */ t(g, { asChild: !0, children: /* @__PURE__ */ t(k, { icon: /* @__PURE__ */ t(w, {}), size: "md", "aria-label": "Delete break" }) }),
|
|
13
14
|
/* @__PURE__ */ r(b, { className: "flex w-[335px] flex-col items-center gap-ds-06 p-ds-06 max-md:w-[90%] max-md:rounded-ds-lg", children: [
|
|
14
15
|
/* @__PURE__ */ r("div", { className: "flex w-full max-w-[240px] flex-col items-center gap-ds-04 text-center", children: [
|
|
15
16
|
/* @__PURE__ */ t("p", { className: "text-ds-lg font-semibold text-center text-text-primary", children: "Delete this break?" }),
|
|
@@ -17,26 +18,26 @@ const w = u.forwardRef(function({ id: N, userId: B, onDelete: a }, I) {
|
|
|
17
18
|
] }),
|
|
18
19
|
/* @__PURE__ */ t("form", { ref: i, onSubmit: async (e) => {
|
|
19
20
|
var n;
|
|
20
|
-
e.preventDefault(), (n = e.stopPropagation) == null || n.call(e),
|
|
21
|
+
e.preventDefault(), (n = e.stopPropagation) == null || n.call(e), s(!0);
|
|
21
22
|
try {
|
|
22
|
-
|
|
23
|
+
l && l(), a({
|
|
23
24
|
description: "Break request deleted successfully",
|
|
24
|
-
|
|
25
|
+
color: "default"
|
|
25
26
|
}), o(!1);
|
|
26
27
|
} catch (f) {
|
|
27
|
-
console.error("Error deleting break request:", f),
|
|
28
|
+
console.error("Error deleting break request:", f), a({
|
|
28
29
|
title: "Error",
|
|
29
30
|
description: "Failed to delete break request",
|
|
30
|
-
|
|
31
|
+
color: "error"
|
|
31
32
|
});
|
|
32
33
|
} finally {
|
|
33
|
-
|
|
34
|
+
s(!1);
|
|
34
35
|
}
|
|
35
36
|
}, className: "w-full", children: /* @__PURE__ */ t(
|
|
36
37
|
D,
|
|
37
38
|
{
|
|
38
39
|
className: "w-full",
|
|
39
|
-
variant: "
|
|
40
|
+
variant: "solid",
|
|
40
41
|
onClick: () => {
|
|
41
42
|
var e;
|
|
42
43
|
return (e = i.current) == null ? void 0 : e.requestSubmit();
|
|
@@ -48,7 +49,7 @@ const w = u.forwardRef(function({ id: N, userId: B, onDelete: a }, I) {
|
|
|
48
49
|
] })
|
|
49
50
|
] });
|
|
50
51
|
});
|
|
51
|
-
|
|
52
|
+
y.displayName = "DeleteBreak";
|
|
52
53
|
export {
|
|
53
|
-
|
|
54
|
+
y as DeleteBreak
|
|
54
55
|
};
|
|
@@ -1,43 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
3
|
import * as y from "react";
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useToast as N } from "@devalok/shilp-sutra/
|
|
4
|
+
import { useState as o, useRef as w, useEffect as g } from "react";
|
|
5
|
+
import { useToast as N } from "@devalok/shilp-sutra/hooks";
|
|
5
6
|
import { Dialog as k, DialogTrigger as D, DialogContent as B, DialogHeader as C, DialogDescription as E } from "@devalok/shilp-sutra/ui";
|
|
6
7
|
import { Button as p } from "@devalok/shilp-sutra/ui";
|
|
7
8
|
import { NumberInput as j } from "@devalok/shilp-sutra/ui";
|
|
8
9
|
import { IconPencil as F } from "@tabler/icons-react";
|
|
9
10
|
const I = y.forwardRef(function({
|
|
10
11
|
selectedLeave: r,
|
|
11
|
-
onSave:
|
|
12
|
+
onSave: n
|
|
12
13
|
}, R) {
|
|
13
14
|
var e;
|
|
14
|
-
const [
|
|
15
|
+
const [s, l] = o(!1), [c, u] = o(
|
|
15
16
|
typeof (r == null ? void 0 : r.cashout) == "number" ? r.cashout : 0
|
|
16
|
-
), [
|
|
17
|
+
), [d, h] = o(
|
|
17
18
|
(r == null ? void 0 : r.carryForward) || 0
|
|
18
|
-
),
|
|
19
|
+
), m = w(null), { toast: f } = N();
|
|
19
20
|
g(() => {
|
|
20
|
-
|
|
21
|
+
u(
|
|
21
22
|
typeof (r == null ? void 0 : r.cashout) == "number" ? r.cashout : 0
|
|
22
23
|
), h((r == null ? void 0 : r.carryForward) || 0);
|
|
23
24
|
}, [r]);
|
|
24
25
|
const b = async (i) => {
|
|
25
26
|
i.preventDefault(), l(!0);
|
|
26
27
|
try {
|
|
27
|
-
|
|
28
|
+
n && n({
|
|
28
29
|
userId: r.userId,
|
|
29
30
|
cashOutDays: c,
|
|
30
|
-
carryForward:
|
|
31
|
+
carryForward: d,
|
|
31
32
|
year: (/* @__PURE__ */ new Date()).getFullYear()
|
|
32
33
|
}), f({
|
|
33
34
|
description: "Break balance updated successfully",
|
|
34
|
-
|
|
35
|
+
color: "default"
|
|
35
36
|
});
|
|
36
37
|
} catch (x) {
|
|
37
38
|
console.error("Error updating break balance:", x), f({
|
|
38
39
|
title: "Error",
|
|
39
40
|
description: "Failed to update break balance",
|
|
40
|
-
|
|
41
|
+
color: "error"
|
|
41
42
|
});
|
|
42
43
|
} finally {
|
|
43
44
|
l(!1);
|
|
@@ -47,7 +48,7 @@ const I = y.forwardRef(function({
|
|
|
47
48
|
/* @__PURE__ */ t(D, { asChild: !0, children: /* @__PURE__ */ a(
|
|
48
49
|
p,
|
|
49
50
|
{
|
|
50
|
-
variant: "
|
|
51
|
+
variant: "outline",
|
|
51
52
|
className: "text-ds-base border-border bg-layer-01 px-ds-05 py-ds-04 pr-ds-06 text-text-secondary shadow-02",
|
|
52
53
|
children: [
|
|
53
54
|
/* @__PURE__ */ t(F, {}),
|
|
@@ -64,7 +65,7 @@ const I = y.forwardRef(function({
|
|
|
64
65
|
/* @__PURE__ */ a(
|
|
65
66
|
"form",
|
|
66
67
|
{
|
|
67
|
-
ref:
|
|
68
|
+
ref: m,
|
|
68
69
|
onSubmit: b,
|
|
69
70
|
id: "updatebreakbalanceform",
|
|
70
71
|
className: "flex w-full flex-col gap-ds-05",
|
|
@@ -75,28 +76,28 @@ const I = y.forwardRef(function({
|
|
|
75
76
|
j,
|
|
76
77
|
{
|
|
77
78
|
value: c,
|
|
78
|
-
|
|
79
|
+
onValueChange: u,
|
|
79
80
|
min: 0,
|
|
80
81
|
max: 100,
|
|
81
82
|
step: 1,
|
|
82
|
-
disabled:
|
|
83
|
+
disabled: s
|
|
83
84
|
}
|
|
84
85
|
)
|
|
85
86
|
] }),
|
|
86
87
|
/* @__PURE__ */ a("div", { className: "flex w-full items-center justify-between", children: [
|
|
87
88
|
/* @__PURE__ */ t("div", { className: "text-ds-sm font-semibold uppercase tracking-wider text-text-placeholder", children: "Carry forward" }),
|
|
88
|
-
/* @__PURE__ */ t("div", { className: "flex w-[100px] items-center justify-center", children: /* @__PURE__ */ t("div", { className: "text-ds-base font-semibold text-text-secondary", children:
|
|
89
|
+
/* @__PURE__ */ t("div", { className: "flex w-[100px] items-center justify-center", children: /* @__PURE__ */ t("div", { className: "text-ds-base font-semibold text-text-secondary", children: d }) })
|
|
89
90
|
] }),
|
|
90
91
|
/* @__PURE__ */ t(
|
|
91
92
|
p,
|
|
92
93
|
{
|
|
93
|
-
variant: "
|
|
94
|
+
variant: "outline",
|
|
94
95
|
fullWidth: !0,
|
|
95
96
|
onClick: () => {
|
|
96
97
|
var i;
|
|
97
|
-
return (i =
|
|
98
|
+
return (i = m.current) == null ? void 0 : i.requestSubmit();
|
|
98
99
|
},
|
|
99
|
-
disabled:
|
|
100
|
+
disabled: s,
|
|
100
101
|
children: "Update"
|
|
101
102
|
}
|
|
102
103
|
)
|