ptechcore_ui 1.0.13 → 1.0.14
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.cjs +249 -89
- package/dist/index.d.cts +43 -2
- package/dist/index.d.ts +43 -2
- package/dist/index.js +252 -96
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -29,12 +29,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// src/index.ts
|
|
30
30
|
var index_exports = {};
|
|
31
31
|
__export(index_exports, {
|
|
32
|
+
Alert: () => Alert_default,
|
|
33
|
+
AlertProvider: () => AlertProvider,
|
|
32
34
|
ApprovalAnswerModal: () => ApprovalAnswerModal,
|
|
33
35
|
ApprovalAnswerPage: () => ApprovalAnswerPage,
|
|
34
36
|
ApprovalPreviewAnswer: () => ApprovalPreviewAnswer_default,
|
|
35
37
|
ApprovalWorkflow: () => ApprovalWorkflow_default,
|
|
36
38
|
DateInput: () => DateInput,
|
|
37
39
|
FDrawer: () => FDrawer,
|
|
40
|
+
FetchApi: () => FetchApi,
|
|
38
41
|
FileInput: () => FileInput,
|
|
39
42
|
InputField: () => InputField,
|
|
40
43
|
Modal: () => Modals_default,
|
|
@@ -50,6 +53,7 @@ __export(index_exports, {
|
|
|
50
53
|
ToastContainer: () => Toast_default,
|
|
51
54
|
ToastProvider: () => ToastProvider,
|
|
52
55
|
UserServices: () => UserServices,
|
|
56
|
+
useAlert: () => useAlert,
|
|
53
57
|
useSession: () => useSession,
|
|
54
58
|
useToast: () => useToast
|
|
55
59
|
});
|
|
@@ -108,7 +112,7 @@ var Modal = ({ title, description, width, open, onClose, children }) => {
|
|
|
108
112
|
}
|
|
109
113
|
)
|
|
110
114
|
] }),
|
|
111
|
-
children
|
|
115
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "w-full max-h-[80vh] overflow-y-auto mb-4", children })
|
|
112
116
|
] }) });
|
|
113
117
|
};
|
|
114
118
|
var Modals_default = Modal;
|
|
@@ -2730,7 +2734,8 @@ var ApprovalWorkflow = ({
|
|
|
2730
2734
|
process,
|
|
2731
2735
|
object_id,
|
|
2732
2736
|
title = "Validation t\xE2che",
|
|
2733
|
-
readOnly = false
|
|
2737
|
+
readOnly = false,
|
|
2738
|
+
CustomBtn
|
|
2734
2739
|
}) => {
|
|
2735
2740
|
const { token, loggedUser } = useSession();
|
|
2736
2741
|
const { error: showError, success: showSuccess } = useToast();
|
|
@@ -2740,7 +2745,7 @@ var ApprovalWorkflow = ({
|
|
|
2740
2745
|
const [history, setHistory] = (0, import_react10.useState)([]);
|
|
2741
2746
|
const [loadingHistory, setLoadingHistory] = (0, import_react10.useState)(false);
|
|
2742
2747
|
const [formData, setFormData] = (0, import_react10.useState)({
|
|
2743
|
-
title
|
|
2748
|
+
title,
|
|
2744
2749
|
file: null,
|
|
2745
2750
|
description: "",
|
|
2746
2751
|
status: "not-send" /* NOT_SEND */
|
|
@@ -2753,6 +2758,9 @@ var ApprovalWorkflow = ({
|
|
|
2753
2758
|
const [restarting, setRestarting] = (0, import_react10.useState)(false);
|
|
2754
2759
|
const [verification, setVerification] = (0, import_react10.useState)([]);
|
|
2755
2760
|
const [validation, setValidation] = (0, import_react10.useState)([]);
|
|
2761
|
+
const [isOpen, setIsOpen] = (0, import_react10.useState)(false);
|
|
2762
|
+
const open_modal = () => setIsOpen(true);
|
|
2763
|
+
const close_modal = () => setIsOpen(false);
|
|
2756
2764
|
(0, import_react10.useEffect)(() => {
|
|
2757
2765
|
loadData();
|
|
2758
2766
|
}, [process, object_id]);
|
|
@@ -3178,7 +3186,99 @@ var ApprovalWorkflow = ({
|
|
|
3178
3186
|
return null;
|
|
3179
3187
|
}
|
|
3180
3188
|
};
|
|
3181
|
-
|
|
3189
|
+
const formulaire = () => {
|
|
3190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
3191
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: [
|
|
3192
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "md:col-span-1", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3193
|
+
TextInput,
|
|
3194
|
+
{
|
|
3195
|
+
label: "Titre:",
|
|
3196
|
+
name: "title",
|
|
3197
|
+
value: formData.title,
|
|
3198
|
+
onChange: handleInputChange,
|
|
3199
|
+
disabled: readOnly
|
|
3200
|
+
}
|
|
3201
|
+
) }),
|
|
3202
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "md:col-span-1", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3203
|
+
FileInput,
|
|
3204
|
+
{
|
|
3205
|
+
label: "Joindre un fichier:",
|
|
3206
|
+
name: "file",
|
|
3207
|
+
onChange: handleFileChange,
|
|
3208
|
+
disabled: readOnly
|
|
3209
|
+
}
|
|
3210
|
+
) }),
|
|
3211
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "md:col-span-1", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3212
|
+
TextInput,
|
|
3213
|
+
{
|
|
3214
|
+
label: "Statut:",
|
|
3215
|
+
name: "status",
|
|
3216
|
+
value: formData.status,
|
|
3217
|
+
onChange: handleInputChange,
|
|
3218
|
+
disabled: true
|
|
3219
|
+
}
|
|
3220
|
+
) })
|
|
3221
|
+
] }),
|
|
3222
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
3223
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "block text-[#191919] text-sm font-medium mb-2", children: "Description:" }),
|
|
3224
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3225
|
+
"textarea",
|
|
3226
|
+
{
|
|
3227
|
+
name: "description",
|
|
3228
|
+
value: formData.description,
|
|
3229
|
+
onChange: handleInputChange,
|
|
3230
|
+
rows: 5,
|
|
3231
|
+
disabled: readOnly,
|
|
3232
|
+
className: "w-full px-3 py-2 border border-[#D9D9D9] rounded-lg focus:ring-2 focus:ring-[#6A8A82] focus:border-transparent resize-none disabled:bg-gray-100",
|
|
3233
|
+
placeholder: "Ajouter une description..."
|
|
3234
|
+
}
|
|
3235
|
+
)
|
|
3236
|
+
] }),
|
|
3237
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "border-b border-[#D9D9D9] mb-6", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("nav", { className: "flex gap-1", children: [
|
|
3238
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3239
|
+
"button",
|
|
3240
|
+
{
|
|
3241
|
+
onClick: () => setActiveTab("workflow"),
|
|
3242
|
+
className: `px-4 py-3 text-sm font-medium transition-colors flex items-center gap-2 ${activeTab === "workflow" ? "border-b-2 border-[#6A8A82] text-[#6A8A82]" : "text-[#767676] hover:text-[#191919]"}`,
|
|
3243
|
+
children: [
|
|
3244
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.FileText, { className: "w-4 h-4" }),
|
|
3245
|
+
"Workflow"
|
|
3246
|
+
]
|
|
3247
|
+
}
|
|
3248
|
+
),
|
|
3249
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3250
|
+
"button",
|
|
3251
|
+
{
|
|
3252
|
+
onClick: () => setActiveTab("preview"),
|
|
3253
|
+
className: `px-4 py-3 text-sm font-medium transition-colors flex items-center gap-2 ${activeTab === "preview" ? "border-b-2 border-[#6A8A82] text-[#6A8A82]" : "text-[#767676] hover:text-[#191919]"}`,
|
|
3254
|
+
children: [
|
|
3255
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Eye, { className: "w-4 h-4" }),
|
|
3256
|
+
"Aper\xE7u"
|
|
3257
|
+
]
|
|
3258
|
+
}
|
|
3259
|
+
),
|
|
3260
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3261
|
+
"button",
|
|
3262
|
+
{
|
|
3263
|
+
onClick: () => setActiveTab("history"),
|
|
3264
|
+
className: `px-4 py-3 text-sm font-medium transition-colors flex items-center gap-2 ${activeTab === "history" ? "border-b-2 border-[#6A8A82] text-[#6A8A82]" : "text-[#767676] hover:text-[#191919]"}`,
|
|
3265
|
+
children: [
|
|
3266
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.History, { className: "w-4 h-4" }),
|
|
3267
|
+
"Historique"
|
|
3268
|
+
]
|
|
3269
|
+
}
|
|
3270
|
+
)
|
|
3271
|
+
] }) }),
|
|
3272
|
+
renderTabContent()
|
|
3273
|
+
] });
|
|
3274
|
+
};
|
|
3275
|
+
if (CustomBtn) {
|
|
3276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
3277
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CustomBtn, { onClick: open_modal }),
|
|
3278
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Modals_default, { open: isOpen, onClose: close_modal, title, children: formulaire() })
|
|
3279
|
+
] });
|
|
3280
|
+
}
|
|
3281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3182
3282
|
RewiseBasicCard,
|
|
3183
3283
|
{
|
|
3184
3284
|
title: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
|
|
@@ -3192,92 +3292,9 @@ var ApprovalWorkflow = ({
|
|
|
3192
3292
|
}
|
|
3193
3293
|
)
|
|
3194
3294
|
] }),
|
|
3195
|
-
children:
|
|
3196
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: [
|
|
3197
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "md:col-span-1", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3198
|
-
TextInput,
|
|
3199
|
-
{
|
|
3200
|
-
label: "Titre:",
|
|
3201
|
-
name: "title",
|
|
3202
|
-
value: formData.title,
|
|
3203
|
-
onChange: handleInputChange,
|
|
3204
|
-
disabled: readOnly
|
|
3205
|
-
}
|
|
3206
|
-
) }),
|
|
3207
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "md:col-span-1", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3208
|
-
FileInput,
|
|
3209
|
-
{
|
|
3210
|
-
label: "Joindre un fichier:",
|
|
3211
|
-
name: "file",
|
|
3212
|
-
onChange: handleFileChange,
|
|
3213
|
-
disabled: readOnly
|
|
3214
|
-
}
|
|
3215
|
-
) }),
|
|
3216
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "md:col-span-1", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3217
|
-
TextInput,
|
|
3218
|
-
{
|
|
3219
|
-
label: "Statut:",
|
|
3220
|
-
name: "status",
|
|
3221
|
-
value: formData.status,
|
|
3222
|
-
onChange: handleInputChange,
|
|
3223
|
-
disabled: true
|
|
3224
|
-
}
|
|
3225
|
-
) })
|
|
3226
|
-
] }),
|
|
3227
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
3228
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "block text-[#191919] text-sm font-medium mb-2", children: "Description:" }),
|
|
3229
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3230
|
-
"textarea",
|
|
3231
|
-
{
|
|
3232
|
-
name: "description",
|
|
3233
|
-
value: formData.description,
|
|
3234
|
-
onChange: handleInputChange,
|
|
3235
|
-
rows: 3,
|
|
3236
|
-
disabled: readOnly,
|
|
3237
|
-
className: "w-full px-3 py-2 border border-[#D9D9D9] rounded-lg focus:ring-2 focus:ring-[#6A8A82] focus:border-transparent resize-none disabled:bg-gray-100",
|
|
3238
|
-
placeholder: "Ajouter une description..."
|
|
3239
|
-
}
|
|
3240
|
-
)
|
|
3241
|
-
] }),
|
|
3242
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "border-b border-[#D9D9D9] mb-6", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("nav", { className: "flex gap-1", children: [
|
|
3243
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3244
|
-
"button",
|
|
3245
|
-
{
|
|
3246
|
-
onClick: () => setActiveTab("workflow"),
|
|
3247
|
-
className: `px-4 py-3 text-sm font-medium transition-colors flex items-center gap-2 ${activeTab === "workflow" ? "border-b-2 border-[#6A8A82] text-[#6A8A82]" : "text-[#767676] hover:text-[#191919]"}`,
|
|
3248
|
-
children: [
|
|
3249
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.FileText, { className: "w-4 h-4" }),
|
|
3250
|
-
"Workflow"
|
|
3251
|
-
]
|
|
3252
|
-
}
|
|
3253
|
-
),
|
|
3254
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3255
|
-
"button",
|
|
3256
|
-
{
|
|
3257
|
-
onClick: () => setActiveTab("preview"),
|
|
3258
|
-
className: `px-4 py-3 text-sm font-medium transition-colors flex items-center gap-2 ${activeTab === "preview" ? "border-b-2 border-[#6A8A82] text-[#6A8A82]" : "text-[#767676] hover:text-[#191919]"}`,
|
|
3259
|
-
children: [
|
|
3260
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.Eye, { className: "w-4 h-4" }),
|
|
3261
|
-
"Aper\xE7u"
|
|
3262
|
-
]
|
|
3263
|
-
}
|
|
3264
|
-
),
|
|
3265
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3266
|
-
"button",
|
|
3267
|
-
{
|
|
3268
|
-
onClick: () => setActiveTab("history"),
|
|
3269
|
-
className: `px-4 py-3 text-sm font-medium transition-colors flex items-center gap-2 ${activeTab === "history" ? "border-b-2 border-[#6A8A82] text-[#6A8A82]" : "text-[#767676] hover:text-[#191919]"}`,
|
|
3270
|
-
children: [
|
|
3271
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react7.History, { className: "w-4 h-4" }),
|
|
3272
|
-
"Historique"
|
|
3273
|
-
]
|
|
3274
|
-
}
|
|
3275
|
-
)
|
|
3276
|
-
] }) }),
|
|
3277
|
-
renderTabContent()
|
|
3278
|
-
]
|
|
3295
|
+
children: formulaire()
|
|
3279
3296
|
}
|
|
3280
|
-
);
|
|
3297
|
+
) });
|
|
3281
3298
|
};
|
|
3282
3299
|
var StageRow = ({
|
|
3283
3300
|
stage,
|
|
@@ -3551,14 +3568,156 @@ var AddStageButton = ({
|
|
|
3551
3568
|
] });
|
|
3552
3569
|
};
|
|
3553
3570
|
var ApprovalWorkflow_default = ApprovalWorkflow;
|
|
3571
|
+
|
|
3572
|
+
// src/contexts/AlertContext.tsx
|
|
3573
|
+
var import_react11 = require("react");
|
|
3574
|
+
|
|
3575
|
+
// src/components/common/Alert.tsx
|
|
3576
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3577
|
+
var Alert = ({
|
|
3578
|
+
title,
|
|
3579
|
+
description,
|
|
3580
|
+
variant = "warning",
|
|
3581
|
+
open,
|
|
3582
|
+
onConfirm,
|
|
3583
|
+
onCancel,
|
|
3584
|
+
confirmText = "Oui",
|
|
3585
|
+
cancelText = "Non",
|
|
3586
|
+
confirmButtonVariant = "danger"
|
|
3587
|
+
}) => {
|
|
3588
|
+
if (!open) return null;
|
|
3589
|
+
const getIcon = () => {
|
|
3590
|
+
switch (variant) {
|
|
3591
|
+
case "danger":
|
|
3592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-red-100", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { className: "h-6 w-6 text-red-600", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z" }) }) });
|
|
3593
|
+
case "warning":
|
|
3594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-yellow-100", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { className: "h-6 w-6 text-yellow-600", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z" }) }) });
|
|
3595
|
+
case "info":
|
|
3596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-blue-100", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { className: "h-6 w-6 text-blue-600", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" }) }) });
|
|
3597
|
+
case "success":
|
|
3598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { className: "h-6 w-6 text-green-600", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }) });
|
|
3599
|
+
}
|
|
3600
|
+
};
|
|
3601
|
+
const getConfirmButtonStyles = () => {
|
|
3602
|
+
switch (confirmButtonVariant) {
|
|
3603
|
+
case "danger":
|
|
3604
|
+
return "bg-red-600 text-white hover:bg-red-700 focus:ring-red-500";
|
|
3605
|
+
case "success":
|
|
3606
|
+
return "bg-green-600 text-white hover:bg-green-700 focus:ring-green-500";
|
|
3607
|
+
case "primary":
|
|
3608
|
+
return "bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500";
|
|
3609
|
+
default:
|
|
3610
|
+
return "bg-red-600 text-white hover:bg-red-700 focus:ring-red-500";
|
|
3611
|
+
}
|
|
3612
|
+
};
|
|
3613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "bg-white rounded-lg p-6 mx-4 w-full max-w-md shadow-xl", children: [
|
|
3614
|
+
getIcon(),
|
|
3615
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "mt-4 text-center", children: [
|
|
3616
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h3", { className: "text-lg font-semibold text-gray-900", children: title }),
|
|
3617
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "mt-2 text-sm text-gray-600", children: description })
|
|
3618
|
+
] }),
|
|
3619
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "mt-6 flex flex-col-reverse sm:flex-row gap-3 sm:gap-4", children: [
|
|
3620
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3621
|
+
"button",
|
|
3622
|
+
{
|
|
3623
|
+
type: "button",
|
|
3624
|
+
onClick: onCancel,
|
|
3625
|
+
className: "w-full sm:w-1/2 px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 transition-colors",
|
|
3626
|
+
children: cancelText
|
|
3627
|
+
}
|
|
3628
|
+
),
|
|
3629
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3630
|
+
"button",
|
|
3631
|
+
{
|
|
3632
|
+
type: "button",
|
|
3633
|
+
onClick: onConfirm,
|
|
3634
|
+
className: `w-full sm:w-1/2 px-4 py-2 text-sm font-medium rounded-lg focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors ${getConfirmButtonStyles()}`,
|
|
3635
|
+
children: confirmText
|
|
3636
|
+
}
|
|
3637
|
+
)
|
|
3638
|
+
] })
|
|
3639
|
+
] }) });
|
|
3640
|
+
};
|
|
3641
|
+
var Alert_default = Alert;
|
|
3642
|
+
|
|
3643
|
+
// src/contexts/AlertContext.tsx
|
|
3644
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3645
|
+
var AlertContext = (0, import_react11.createContext)(void 0);
|
|
3646
|
+
var AlertProvider = ({ children }) => {
|
|
3647
|
+
const [alertState, setAlertState] = (0, import_react11.useState)({
|
|
3648
|
+
open: false,
|
|
3649
|
+
title: "",
|
|
3650
|
+
variant: "warning"
|
|
3651
|
+
});
|
|
3652
|
+
const showConfirmation = (0, import_react11.useCallback)((options) => {
|
|
3653
|
+
return new Promise((resolve) => {
|
|
3654
|
+
setAlertState({
|
|
3655
|
+
...options,
|
|
3656
|
+
open: true,
|
|
3657
|
+
resolve
|
|
3658
|
+
});
|
|
3659
|
+
});
|
|
3660
|
+
}, []);
|
|
3661
|
+
const showAlert = (0, import_react11.useCallback)(
|
|
3662
|
+
(title, confirmText = "Oui", cancelText = "Annuler", description, variant = "warning") => {
|
|
3663
|
+
return showConfirmation({
|
|
3664
|
+
title,
|
|
3665
|
+
description,
|
|
3666
|
+
confirmText,
|
|
3667
|
+
cancelText,
|
|
3668
|
+
variant
|
|
3669
|
+
});
|
|
3670
|
+
},
|
|
3671
|
+
[showConfirmation]
|
|
3672
|
+
);
|
|
3673
|
+
const handleConfirm = (0, import_react11.useCallback)(() => {
|
|
3674
|
+
if (alertState.resolve) {
|
|
3675
|
+
alertState.resolve(true);
|
|
3676
|
+
}
|
|
3677
|
+
setAlertState((prev) => ({ ...prev, open: false }));
|
|
3678
|
+
}, [alertState.resolve]);
|
|
3679
|
+
const handleCancel = (0, import_react11.useCallback)(() => {
|
|
3680
|
+
if (alertState.resolve) {
|
|
3681
|
+
alertState.resolve(false);
|
|
3682
|
+
}
|
|
3683
|
+
setAlertState((prev) => ({ ...prev, open: false }));
|
|
3684
|
+
}, [alertState.resolve]);
|
|
3685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(AlertContext.Provider, { value: { showConfirmation, showAlert }, children: [
|
|
3686
|
+
children,
|
|
3687
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3688
|
+
Alert_default,
|
|
3689
|
+
{
|
|
3690
|
+
open: alertState.open,
|
|
3691
|
+
title: alertState.title,
|
|
3692
|
+
description: alertState.description,
|
|
3693
|
+
variant: alertState.variant || "warning",
|
|
3694
|
+
confirmText: alertState.confirmText,
|
|
3695
|
+
cancelText: alertState.cancelText,
|
|
3696
|
+
confirmButtonVariant: alertState.confirmButtonVariant,
|
|
3697
|
+
onConfirm: handleConfirm,
|
|
3698
|
+
onCancel: handleCancel
|
|
3699
|
+
}
|
|
3700
|
+
)
|
|
3701
|
+
] });
|
|
3702
|
+
};
|
|
3703
|
+
var useAlert = () => {
|
|
3704
|
+
const context = (0, import_react11.useContext)(AlertContext);
|
|
3705
|
+
if (!context) {
|
|
3706
|
+
throw new Error("useAlert must be used within an AlertProvider");
|
|
3707
|
+
}
|
|
3708
|
+
return context;
|
|
3709
|
+
};
|
|
3554
3710
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3555
3711
|
0 && (module.exports = {
|
|
3712
|
+
Alert,
|
|
3713
|
+
AlertProvider,
|
|
3556
3714
|
ApprovalAnswerModal,
|
|
3557
3715
|
ApprovalAnswerPage,
|
|
3558
3716
|
ApprovalPreviewAnswer,
|
|
3559
3717
|
ApprovalWorkflow,
|
|
3560
3718
|
DateInput,
|
|
3561
3719
|
FDrawer,
|
|
3720
|
+
FetchApi,
|
|
3562
3721
|
FileInput,
|
|
3563
3722
|
InputField,
|
|
3564
3723
|
Modal,
|
|
@@ -3574,6 +3733,7 @@ var ApprovalWorkflow_default = ApprovalWorkflow;
|
|
|
3574
3733
|
ToastContainer,
|
|
3575
3734
|
ToastProvider,
|
|
3576
3735
|
UserServices,
|
|
3736
|
+
useAlert,
|
|
3577
3737
|
useSession,
|
|
3578
3738
|
useToast
|
|
3579
3739
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -182,7 +182,7 @@ interface PagesProps {
|
|
|
182
182
|
description?: string;
|
|
183
183
|
sideAction?: React.ReactNode;
|
|
184
184
|
sidebar?: React.ReactNode;
|
|
185
|
-
tabs
|
|
185
|
+
tabs?: React.ReactNode;
|
|
186
186
|
children?: React.ReactNode;
|
|
187
187
|
}
|
|
188
188
|
declare const Pages: React.FC<PagesProps>;
|
|
@@ -234,6 +234,9 @@ interface ApprovalWorkflowProps {
|
|
|
234
234
|
object_id: number;
|
|
235
235
|
title?: string;
|
|
236
236
|
readOnly?: boolean;
|
|
237
|
+
CustomBtn?: React.ComponentType<{
|
|
238
|
+
onClick?: () => void;
|
|
239
|
+
}>;
|
|
237
240
|
}
|
|
238
241
|
declare const ApprovalWorkflow: React.FC<ApprovalWorkflowProps>;
|
|
239
242
|
|
|
@@ -300,4 +303,42 @@ declare const ApprovalPreviewAnswer: React.FC<{
|
|
|
300
303
|
caseData: ApprovalCase | null;
|
|
301
304
|
}>;
|
|
302
305
|
|
|
303
|
-
|
|
306
|
+
declare class FetchApi {
|
|
307
|
+
static post<T>(url: string, payload?: any, token?: string): Promise<T>;
|
|
308
|
+
static get<T>(url: string, token?: string): Promise<T>;
|
|
309
|
+
static put<T>(url: string, payload?: any, token?: string): Promise<T>;
|
|
310
|
+
static delete<T>(url: string, token?: string): Promise<T>;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
type AlertVariant = 'danger' | 'warning' | 'info' | 'success';
|
|
314
|
+
interface AlertProps {
|
|
315
|
+
title: string;
|
|
316
|
+
description?: string;
|
|
317
|
+
variant?: AlertVariant;
|
|
318
|
+
open: boolean;
|
|
319
|
+
onConfirm: () => void;
|
|
320
|
+
onCancel: () => void;
|
|
321
|
+
confirmText?: string;
|
|
322
|
+
cancelText?: string;
|
|
323
|
+
confirmButtonVariant?: 'danger' | 'primary' | 'success';
|
|
324
|
+
}
|
|
325
|
+
declare const Alert: React.FC<AlertProps>;
|
|
326
|
+
|
|
327
|
+
interface AlertOptions {
|
|
328
|
+
title: string;
|
|
329
|
+
description?: string;
|
|
330
|
+
variant?: AlertVariant;
|
|
331
|
+
confirmText?: string;
|
|
332
|
+
cancelText?: string;
|
|
333
|
+
confirmButtonVariant?: 'danger' | 'primary' | 'success';
|
|
334
|
+
}
|
|
335
|
+
interface AlertContextType {
|
|
336
|
+
showConfirmation: (options: AlertOptions) => Promise<boolean>;
|
|
337
|
+
showAlert: (title: string, confirmText?: string, cancelText?: string, description?: string, variant?: AlertVariant) => Promise<boolean>;
|
|
338
|
+
}
|
|
339
|
+
declare const AlertProvider: React.FC<{
|
|
340
|
+
children: ReactNode;
|
|
341
|
+
}>;
|
|
342
|
+
declare const useAlert: () => AlertContextType;
|
|
343
|
+
|
|
344
|
+
export { Alert, AlertProvider, ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalWorkflow, DateInput, FDrawer, FetchApi, FileInput, InputField, type MenuItem, Modal, NumberInput, Pages, PrimaryButton, RewiseLayout, SecondaryButton, SelectInput, SessionProvider, TextInput, ThemeProvider, ToastContainer, ToastProvider, type User, UserServices, useAlert, useSession, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -182,7 +182,7 @@ interface PagesProps {
|
|
|
182
182
|
description?: string;
|
|
183
183
|
sideAction?: React.ReactNode;
|
|
184
184
|
sidebar?: React.ReactNode;
|
|
185
|
-
tabs
|
|
185
|
+
tabs?: React.ReactNode;
|
|
186
186
|
children?: React.ReactNode;
|
|
187
187
|
}
|
|
188
188
|
declare const Pages: React.FC<PagesProps>;
|
|
@@ -234,6 +234,9 @@ interface ApprovalWorkflowProps {
|
|
|
234
234
|
object_id: number;
|
|
235
235
|
title?: string;
|
|
236
236
|
readOnly?: boolean;
|
|
237
|
+
CustomBtn?: React.ComponentType<{
|
|
238
|
+
onClick?: () => void;
|
|
239
|
+
}>;
|
|
237
240
|
}
|
|
238
241
|
declare const ApprovalWorkflow: React.FC<ApprovalWorkflowProps>;
|
|
239
242
|
|
|
@@ -300,4 +303,42 @@ declare const ApprovalPreviewAnswer: React.FC<{
|
|
|
300
303
|
caseData: ApprovalCase | null;
|
|
301
304
|
}>;
|
|
302
305
|
|
|
303
|
-
|
|
306
|
+
declare class FetchApi {
|
|
307
|
+
static post<T>(url: string, payload?: any, token?: string): Promise<T>;
|
|
308
|
+
static get<T>(url: string, token?: string): Promise<T>;
|
|
309
|
+
static put<T>(url: string, payload?: any, token?: string): Promise<T>;
|
|
310
|
+
static delete<T>(url: string, token?: string): Promise<T>;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
type AlertVariant = 'danger' | 'warning' | 'info' | 'success';
|
|
314
|
+
interface AlertProps {
|
|
315
|
+
title: string;
|
|
316
|
+
description?: string;
|
|
317
|
+
variant?: AlertVariant;
|
|
318
|
+
open: boolean;
|
|
319
|
+
onConfirm: () => void;
|
|
320
|
+
onCancel: () => void;
|
|
321
|
+
confirmText?: string;
|
|
322
|
+
cancelText?: string;
|
|
323
|
+
confirmButtonVariant?: 'danger' | 'primary' | 'success';
|
|
324
|
+
}
|
|
325
|
+
declare const Alert: React.FC<AlertProps>;
|
|
326
|
+
|
|
327
|
+
interface AlertOptions {
|
|
328
|
+
title: string;
|
|
329
|
+
description?: string;
|
|
330
|
+
variant?: AlertVariant;
|
|
331
|
+
confirmText?: string;
|
|
332
|
+
cancelText?: string;
|
|
333
|
+
confirmButtonVariant?: 'danger' | 'primary' | 'success';
|
|
334
|
+
}
|
|
335
|
+
interface AlertContextType {
|
|
336
|
+
showConfirmation: (options: AlertOptions) => Promise<boolean>;
|
|
337
|
+
showAlert: (title: string, confirmText?: string, cancelText?: string, description?: string, variant?: AlertVariant) => Promise<boolean>;
|
|
338
|
+
}
|
|
339
|
+
declare const AlertProvider: React.FC<{
|
|
340
|
+
children: ReactNode;
|
|
341
|
+
}>;
|
|
342
|
+
declare const useAlert: () => AlertContextType;
|
|
343
|
+
|
|
344
|
+
export { Alert, AlertProvider, ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalWorkflow, DateInput, FDrawer, FetchApi, FileInput, InputField, type MenuItem, Modal, NumberInput, Pages, PrimaryButton, RewiseLayout, SecondaryButton, SelectInput, SessionProvider, TextInput, ThemeProvider, ToastContainer, ToastProvider, type User, UserServices, useAlert, useSession, useToast };
|
package/dist/index.js
CHANGED
|
@@ -51,7 +51,7 @@ var Modal = ({ title, description, width, open, onClose, children }) => {
|
|
|
51
51
|
}
|
|
52
52
|
)
|
|
53
53
|
] }),
|
|
54
|
-
children
|
|
54
|
+
/* @__PURE__ */ jsx2("div", { className: "w-full max-h-[80vh] overflow-y-auto mb-4", children })
|
|
55
55
|
] }) });
|
|
56
56
|
};
|
|
57
57
|
var Modals_default = Modal;
|
|
@@ -2681,13 +2681,14 @@ var SearchableSelect = ({
|
|
|
2681
2681
|
};
|
|
2682
2682
|
|
|
2683
2683
|
// src/components/common/ApprovalWorkflow.tsx
|
|
2684
|
-
import { X as X5, Plus
|
|
2684
|
+
import { X as X5, Plus, Trash2, Users, Loader as Loader2, RotateCcw, Ban, Eye as Eye2, FileText as FileText2, History } from "lucide-react";
|
|
2685
2685
|
import { Fragment as Fragment6, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2686
2686
|
var ApprovalWorkflow = ({
|
|
2687
2687
|
process,
|
|
2688
2688
|
object_id,
|
|
2689
2689
|
title = "Validation t\xE2che",
|
|
2690
|
-
readOnly = false
|
|
2690
|
+
readOnly = false,
|
|
2691
|
+
CustomBtn
|
|
2691
2692
|
}) => {
|
|
2692
2693
|
const { token, loggedUser } = useSession();
|
|
2693
2694
|
const { error: showError, success: showSuccess } = useToast();
|
|
@@ -2697,7 +2698,7 @@ var ApprovalWorkflow = ({
|
|
|
2697
2698
|
const [history, setHistory] = useState10([]);
|
|
2698
2699
|
const [loadingHistory, setLoadingHistory] = useState10(false);
|
|
2699
2700
|
const [formData, setFormData] = useState10({
|
|
2700
|
-
title
|
|
2701
|
+
title,
|
|
2701
2702
|
file: null,
|
|
2702
2703
|
description: "",
|
|
2703
2704
|
status: "not-send" /* NOT_SEND */
|
|
@@ -2710,6 +2711,9 @@ var ApprovalWorkflow = ({
|
|
|
2710
2711
|
const [restarting, setRestarting] = useState10(false);
|
|
2711
2712
|
const [verification, setVerification] = useState10([]);
|
|
2712
2713
|
const [validation, setValidation] = useState10([]);
|
|
2714
|
+
const [isOpen, setIsOpen] = useState10(false);
|
|
2715
|
+
const open_modal = () => setIsOpen(true);
|
|
2716
|
+
const close_modal = () => setIsOpen(false);
|
|
2713
2717
|
useEffect8(() => {
|
|
2714
2718
|
loadData();
|
|
2715
2719
|
}, [process, object_id]);
|
|
@@ -2981,7 +2985,7 @@ var ApprovalWorkflow = ({
|
|
|
2981
2985
|
)
|
|
2982
2986
|
] }),
|
|
2983
2987
|
/* @__PURE__ */ jsx14("div", { className: "overflow-x-auto", children: stages.length === 0 ? /* @__PURE__ */ jsxs10("div", { className: "text-center py-6 border-2 border-dashed border-[#D9D9D9] rounded-lg bg-[#FAFAFA]", children: [
|
|
2984
|
-
/* @__PURE__ */ jsx14(
|
|
2988
|
+
/* @__PURE__ */ jsx14(Users, { className: "w-8 h-8 text-[#767676] mx-auto mb-4" }),
|
|
2985
2989
|
/* @__PURE__ */ jsx14("h3", { className: "text-lg font-medium text-[#191919] mb-2", children: "Aucune personne ajout\xE9e" }),
|
|
2986
2990
|
/* @__PURE__ */ jsx14("p", { className: "text-[#767676] mb-4", children: 'Cliquez sur le bouton "Ajouter une personne" pour commencer' })
|
|
2987
2991
|
] }) : /* @__PURE__ */ jsxs10("table", { className: "w-full border-collapse", children: [
|
|
@@ -3040,7 +3044,7 @@ var ApprovalWorkflow = ({
|
|
|
3040
3044
|
type: "button",
|
|
3041
3045
|
classname: "flex items-center gap-2",
|
|
3042
3046
|
children: [
|
|
3043
|
-
/* @__PURE__ */ jsx14(
|
|
3047
|
+
/* @__PURE__ */ jsx14(Ban, { className: "w-4 h-4" }),
|
|
3044
3048
|
canceling ? "Annulation..." : "Annuler la demande"
|
|
3045
3049
|
]
|
|
3046
3050
|
}
|
|
@@ -3053,7 +3057,7 @@ var ApprovalWorkflow = ({
|
|
|
3053
3057
|
type: "button",
|
|
3054
3058
|
classname: "flex items-center gap-2",
|
|
3055
3059
|
children: [
|
|
3056
|
-
/* @__PURE__ */ jsx14(
|
|
3060
|
+
/* @__PURE__ */ jsx14(RotateCcw, { className: "w-4 h-4" }),
|
|
3057
3061
|
restarting ? "Red\xE9marrage..." : "Recommencer"
|
|
3058
3062
|
]
|
|
3059
3063
|
}
|
|
@@ -3100,7 +3104,7 @@ var ApprovalWorkflow = ({
|
|
|
3100
3104
|
return /* @__PURE__ */ jsxs10("div", { className: "space-y-6", children: [
|
|
3101
3105
|
/* @__PURE__ */ jsx14("h3", { className: "text-lg font-semibold text-[#191919]", children: "Historique des versions" }),
|
|
3102
3106
|
loadingHistory ? /* @__PURE__ */ jsx14("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ jsx14(Loader2, { className: "w-8 h-8 animate-spin text-[#6A8A82]" }) }) : history.length === 0 ? /* @__PURE__ */ jsxs10("div", { className: "text-center py-12 border-2 border-dashed border-[#D9D9D9] rounded-lg bg-[#FAFAFA]", children: [
|
|
3103
|
-
/* @__PURE__ */ jsx14(
|
|
3107
|
+
/* @__PURE__ */ jsx14(History, { className: "w-12 h-12 text-[#767676] mx-auto mb-4" }),
|
|
3104
3108
|
/* @__PURE__ */ jsx14("p", { className: "text-[#767676]", children: "Aucun historique disponible" })
|
|
3105
3109
|
] }) : /* @__PURE__ */ jsx14("div", { className: "space-y-4", children: history.map((item, index) => /* @__PURE__ */ jsx14("div", { className: "border border-[#D9D9D9] rounded-lg p-4 bg-white hover:shadow-md transition-shadow", children: /* @__PURE__ */ jsx14("div", { className: "flex items-start justify-between", children: /* @__PURE__ */ jsxs10("div", { className: "flex-1", children: [
|
|
3106
3110
|
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-3 mb-2", children: [
|
|
@@ -3135,7 +3139,99 @@ var ApprovalWorkflow = ({
|
|
|
3135
3139
|
return null;
|
|
3136
3140
|
}
|
|
3137
3141
|
};
|
|
3138
|
-
|
|
3142
|
+
const formulaire = () => {
|
|
3143
|
+
return /* @__PURE__ */ jsxs10("div", { children: [
|
|
3144
|
+
/* @__PURE__ */ jsxs10("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: [
|
|
3145
|
+
/* @__PURE__ */ jsx14("div", { className: "md:col-span-1", children: /* @__PURE__ */ jsx14(
|
|
3146
|
+
TextInput,
|
|
3147
|
+
{
|
|
3148
|
+
label: "Titre:",
|
|
3149
|
+
name: "title",
|
|
3150
|
+
value: formData.title,
|
|
3151
|
+
onChange: handleInputChange,
|
|
3152
|
+
disabled: readOnly
|
|
3153
|
+
}
|
|
3154
|
+
) }),
|
|
3155
|
+
/* @__PURE__ */ jsx14("div", { className: "md:col-span-1", children: /* @__PURE__ */ jsx14(
|
|
3156
|
+
FileInput,
|
|
3157
|
+
{
|
|
3158
|
+
label: "Joindre un fichier:",
|
|
3159
|
+
name: "file",
|
|
3160
|
+
onChange: handleFileChange,
|
|
3161
|
+
disabled: readOnly
|
|
3162
|
+
}
|
|
3163
|
+
) }),
|
|
3164
|
+
/* @__PURE__ */ jsx14("div", { className: "md:col-span-1", children: /* @__PURE__ */ jsx14(
|
|
3165
|
+
TextInput,
|
|
3166
|
+
{
|
|
3167
|
+
label: "Statut:",
|
|
3168
|
+
name: "status",
|
|
3169
|
+
value: formData.status,
|
|
3170
|
+
onChange: handleInputChange,
|
|
3171
|
+
disabled: true
|
|
3172
|
+
}
|
|
3173
|
+
) })
|
|
3174
|
+
] }),
|
|
3175
|
+
/* @__PURE__ */ jsxs10("div", { children: [
|
|
3176
|
+
/* @__PURE__ */ jsx14("label", { className: "block text-[#191919] text-sm font-medium mb-2", children: "Description:" }),
|
|
3177
|
+
/* @__PURE__ */ jsx14(
|
|
3178
|
+
"textarea",
|
|
3179
|
+
{
|
|
3180
|
+
name: "description",
|
|
3181
|
+
value: formData.description,
|
|
3182
|
+
onChange: handleInputChange,
|
|
3183
|
+
rows: 5,
|
|
3184
|
+
disabled: readOnly,
|
|
3185
|
+
className: "w-full px-3 py-2 border border-[#D9D9D9] rounded-lg focus:ring-2 focus:ring-[#6A8A82] focus:border-transparent resize-none disabled:bg-gray-100",
|
|
3186
|
+
placeholder: "Ajouter une description..."
|
|
3187
|
+
}
|
|
3188
|
+
)
|
|
3189
|
+
] }),
|
|
3190
|
+
/* @__PURE__ */ jsx14("div", { className: "border-b border-[#D9D9D9] mb-6", children: /* @__PURE__ */ jsxs10("nav", { className: "flex gap-1", children: [
|
|
3191
|
+
/* @__PURE__ */ jsxs10(
|
|
3192
|
+
"button",
|
|
3193
|
+
{
|
|
3194
|
+
onClick: () => setActiveTab("workflow"),
|
|
3195
|
+
className: `px-4 py-3 text-sm font-medium transition-colors flex items-center gap-2 ${activeTab === "workflow" ? "border-b-2 border-[#6A8A82] text-[#6A8A82]" : "text-[#767676] hover:text-[#191919]"}`,
|
|
3196
|
+
children: [
|
|
3197
|
+
/* @__PURE__ */ jsx14(FileText2, { className: "w-4 h-4" }),
|
|
3198
|
+
"Workflow"
|
|
3199
|
+
]
|
|
3200
|
+
}
|
|
3201
|
+
),
|
|
3202
|
+
/* @__PURE__ */ jsxs10(
|
|
3203
|
+
"button",
|
|
3204
|
+
{
|
|
3205
|
+
onClick: () => setActiveTab("preview"),
|
|
3206
|
+
className: `px-4 py-3 text-sm font-medium transition-colors flex items-center gap-2 ${activeTab === "preview" ? "border-b-2 border-[#6A8A82] text-[#6A8A82]" : "text-[#767676] hover:text-[#191919]"}`,
|
|
3207
|
+
children: [
|
|
3208
|
+
/* @__PURE__ */ jsx14(Eye2, { className: "w-4 h-4" }),
|
|
3209
|
+
"Aper\xE7u"
|
|
3210
|
+
]
|
|
3211
|
+
}
|
|
3212
|
+
),
|
|
3213
|
+
/* @__PURE__ */ jsxs10(
|
|
3214
|
+
"button",
|
|
3215
|
+
{
|
|
3216
|
+
onClick: () => setActiveTab("history"),
|
|
3217
|
+
className: `px-4 py-3 text-sm font-medium transition-colors flex items-center gap-2 ${activeTab === "history" ? "border-b-2 border-[#6A8A82] text-[#6A8A82]" : "text-[#767676] hover:text-[#191919]"}`,
|
|
3218
|
+
children: [
|
|
3219
|
+
/* @__PURE__ */ jsx14(History, { className: "w-4 h-4" }),
|
|
3220
|
+
"Historique"
|
|
3221
|
+
]
|
|
3222
|
+
}
|
|
3223
|
+
)
|
|
3224
|
+
] }) }),
|
|
3225
|
+
renderTabContent()
|
|
3226
|
+
] });
|
|
3227
|
+
};
|
|
3228
|
+
if (CustomBtn) {
|
|
3229
|
+
return /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
3230
|
+
/* @__PURE__ */ jsx14(CustomBtn, { onClick: open_modal }),
|
|
3231
|
+
/* @__PURE__ */ jsx14(Modals_default, { open: isOpen, onClose: close_modal, title, children: formulaire() })
|
|
3232
|
+
] });
|
|
3233
|
+
}
|
|
3234
|
+
return /* @__PURE__ */ jsx14(Fragment6, { children: /* @__PURE__ */ jsx14(
|
|
3139
3235
|
RewiseBasicCard,
|
|
3140
3236
|
{
|
|
3141
3237
|
title: /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between w-full", children: [
|
|
@@ -3149,92 +3245,9 @@ var ApprovalWorkflow = ({
|
|
|
3149
3245
|
}
|
|
3150
3246
|
)
|
|
3151
3247
|
] }),
|
|
3152
|
-
children:
|
|
3153
|
-
/* @__PURE__ */ jsxs10("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: [
|
|
3154
|
-
/* @__PURE__ */ jsx14("div", { className: "md:col-span-1", children: /* @__PURE__ */ jsx14(
|
|
3155
|
-
TextInput,
|
|
3156
|
-
{
|
|
3157
|
-
label: "Titre:",
|
|
3158
|
-
name: "title",
|
|
3159
|
-
value: formData.title,
|
|
3160
|
-
onChange: handleInputChange,
|
|
3161
|
-
disabled: readOnly
|
|
3162
|
-
}
|
|
3163
|
-
) }),
|
|
3164
|
-
/* @__PURE__ */ jsx14("div", { className: "md:col-span-1", children: /* @__PURE__ */ jsx14(
|
|
3165
|
-
FileInput,
|
|
3166
|
-
{
|
|
3167
|
-
label: "Joindre un fichier:",
|
|
3168
|
-
name: "file",
|
|
3169
|
-
onChange: handleFileChange,
|
|
3170
|
-
disabled: readOnly
|
|
3171
|
-
}
|
|
3172
|
-
) }),
|
|
3173
|
-
/* @__PURE__ */ jsx14("div", { className: "md:col-span-1", children: /* @__PURE__ */ jsx14(
|
|
3174
|
-
TextInput,
|
|
3175
|
-
{
|
|
3176
|
-
label: "Statut:",
|
|
3177
|
-
name: "status",
|
|
3178
|
-
value: formData.status,
|
|
3179
|
-
onChange: handleInputChange,
|
|
3180
|
-
disabled: true
|
|
3181
|
-
}
|
|
3182
|
-
) })
|
|
3183
|
-
] }),
|
|
3184
|
-
/* @__PURE__ */ jsxs10("div", { children: [
|
|
3185
|
-
/* @__PURE__ */ jsx14("label", { className: "block text-[#191919] text-sm font-medium mb-2", children: "Description:" }),
|
|
3186
|
-
/* @__PURE__ */ jsx14(
|
|
3187
|
-
"textarea",
|
|
3188
|
-
{
|
|
3189
|
-
name: "description",
|
|
3190
|
-
value: formData.description,
|
|
3191
|
-
onChange: handleInputChange,
|
|
3192
|
-
rows: 3,
|
|
3193
|
-
disabled: readOnly,
|
|
3194
|
-
className: "w-full px-3 py-2 border border-[#D9D9D9] rounded-lg focus:ring-2 focus:ring-[#6A8A82] focus:border-transparent resize-none disabled:bg-gray-100",
|
|
3195
|
-
placeholder: "Ajouter une description..."
|
|
3196
|
-
}
|
|
3197
|
-
)
|
|
3198
|
-
] }),
|
|
3199
|
-
/* @__PURE__ */ jsx14("div", { className: "border-b border-[#D9D9D9] mb-6", children: /* @__PURE__ */ jsxs10("nav", { className: "flex gap-1", children: [
|
|
3200
|
-
/* @__PURE__ */ jsxs10(
|
|
3201
|
-
"button",
|
|
3202
|
-
{
|
|
3203
|
-
onClick: () => setActiveTab("workflow"),
|
|
3204
|
-
className: `px-4 py-3 text-sm font-medium transition-colors flex items-center gap-2 ${activeTab === "workflow" ? "border-b-2 border-[#6A8A82] text-[#6A8A82]" : "text-[#767676] hover:text-[#191919]"}`,
|
|
3205
|
-
children: [
|
|
3206
|
-
/* @__PURE__ */ jsx14(FileText2, { className: "w-4 h-4" }),
|
|
3207
|
-
"Workflow"
|
|
3208
|
-
]
|
|
3209
|
-
}
|
|
3210
|
-
),
|
|
3211
|
-
/* @__PURE__ */ jsxs10(
|
|
3212
|
-
"button",
|
|
3213
|
-
{
|
|
3214
|
-
onClick: () => setActiveTab("preview"),
|
|
3215
|
-
className: `px-4 py-3 text-sm font-medium transition-colors flex items-center gap-2 ${activeTab === "preview" ? "border-b-2 border-[#6A8A82] text-[#6A8A82]" : "text-[#767676] hover:text-[#191919]"}`,
|
|
3216
|
-
children: [
|
|
3217
|
-
/* @__PURE__ */ jsx14(Eye2, { className: "w-4 h-4" }),
|
|
3218
|
-
"Aper\xE7u"
|
|
3219
|
-
]
|
|
3220
|
-
}
|
|
3221
|
-
),
|
|
3222
|
-
/* @__PURE__ */ jsxs10(
|
|
3223
|
-
"button",
|
|
3224
|
-
{
|
|
3225
|
-
onClick: () => setActiveTab("history"),
|
|
3226
|
-
className: `px-4 py-3 text-sm font-medium transition-colors flex items-center gap-2 ${activeTab === "history" ? "border-b-2 border-[#6A8A82] text-[#6A8A82]" : "text-[#767676] hover:text-[#191919]"}`,
|
|
3227
|
-
children: [
|
|
3228
|
-
/* @__PURE__ */ jsx14(History2, { className: "w-4 h-4" }),
|
|
3229
|
-
"Historique"
|
|
3230
|
-
]
|
|
3231
|
-
}
|
|
3232
|
-
)
|
|
3233
|
-
] }) }),
|
|
3234
|
-
renderTabContent()
|
|
3235
|
-
]
|
|
3248
|
+
children: formulaire()
|
|
3236
3249
|
}
|
|
3237
|
-
);
|
|
3250
|
+
) });
|
|
3238
3251
|
};
|
|
3239
3252
|
var StageRow = ({
|
|
3240
3253
|
stage,
|
|
@@ -3283,7 +3296,7 @@ var StageRow = ({
|
|
|
3283
3296
|
onClick: onRemove,
|
|
3284
3297
|
className: "text-[#B85450] hover:text-red-700 transition-colors",
|
|
3285
3298
|
title: "Supprimer",
|
|
3286
|
-
children: /* @__PURE__ */ jsx14(
|
|
3299
|
+
children: /* @__PURE__ */ jsx14(Trash2, { className: "w-4 h-4" })
|
|
3287
3300
|
}
|
|
3288
3301
|
) }),
|
|
3289
3302
|
/* @__PURE__ */ jsx14("td", { className: "border border-gray-300 px-4 py-2 text-center", children: index + 1 }),
|
|
@@ -3405,7 +3418,7 @@ var AddStageButton = ({
|
|
|
3405
3418
|
onClick: () => setShowModal(true),
|
|
3406
3419
|
classname: "gap-2",
|
|
3407
3420
|
children: [
|
|
3408
|
-
/* @__PURE__ */ jsx14(
|
|
3421
|
+
/* @__PURE__ */ jsx14(Plus, { className: "w-4 h-4" }),
|
|
3409
3422
|
/* @__PURE__ */ jsx14("span", { children: "Ajouter une personne" })
|
|
3410
3423
|
]
|
|
3411
3424
|
}
|
|
@@ -3508,13 +3521,155 @@ var AddStageButton = ({
|
|
|
3508
3521
|
] });
|
|
3509
3522
|
};
|
|
3510
3523
|
var ApprovalWorkflow_default = ApprovalWorkflow;
|
|
3524
|
+
|
|
3525
|
+
// src/contexts/AlertContext.tsx
|
|
3526
|
+
import { createContext as createContext4, useContext as useContext4, useState as useState11, useCallback as useCallback2 } from "react";
|
|
3527
|
+
|
|
3528
|
+
// src/components/common/Alert.tsx
|
|
3529
|
+
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3530
|
+
var Alert = ({
|
|
3531
|
+
title,
|
|
3532
|
+
description,
|
|
3533
|
+
variant = "warning",
|
|
3534
|
+
open,
|
|
3535
|
+
onConfirm,
|
|
3536
|
+
onCancel,
|
|
3537
|
+
confirmText = "Oui",
|
|
3538
|
+
cancelText = "Non",
|
|
3539
|
+
confirmButtonVariant = "danger"
|
|
3540
|
+
}) => {
|
|
3541
|
+
if (!open) return null;
|
|
3542
|
+
const getIcon = () => {
|
|
3543
|
+
switch (variant) {
|
|
3544
|
+
case "danger":
|
|
3545
|
+
return /* @__PURE__ */ jsx15("div", { className: "mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-red-100", children: /* @__PURE__ */ jsx15("svg", { className: "h-6 w-6 text-red-600", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", children: /* @__PURE__ */ jsx15("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z" }) }) });
|
|
3546
|
+
case "warning":
|
|
3547
|
+
return /* @__PURE__ */ jsx15("div", { className: "mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-yellow-100", children: /* @__PURE__ */ jsx15("svg", { className: "h-6 w-6 text-yellow-600", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", children: /* @__PURE__ */ jsx15("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z" }) }) });
|
|
3548
|
+
case "info":
|
|
3549
|
+
return /* @__PURE__ */ jsx15("div", { className: "mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-blue-100", children: /* @__PURE__ */ jsx15("svg", { className: "h-6 w-6 text-blue-600", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", children: /* @__PURE__ */ jsx15("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z" }) }) });
|
|
3550
|
+
case "success":
|
|
3551
|
+
return /* @__PURE__ */ jsx15("div", { className: "mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100", children: /* @__PURE__ */ jsx15("svg", { className: "h-6 w-6 text-green-600", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", children: /* @__PURE__ */ jsx15("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }) });
|
|
3552
|
+
}
|
|
3553
|
+
};
|
|
3554
|
+
const getConfirmButtonStyles = () => {
|
|
3555
|
+
switch (confirmButtonVariant) {
|
|
3556
|
+
case "danger":
|
|
3557
|
+
return "bg-red-600 text-white hover:bg-red-700 focus:ring-red-500";
|
|
3558
|
+
case "success":
|
|
3559
|
+
return "bg-green-600 text-white hover:bg-green-700 focus:ring-green-500";
|
|
3560
|
+
case "primary":
|
|
3561
|
+
return "bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500";
|
|
3562
|
+
default:
|
|
3563
|
+
return "bg-red-600 text-white hover:bg-red-700 focus:ring-red-500";
|
|
3564
|
+
}
|
|
3565
|
+
};
|
|
3566
|
+
return /* @__PURE__ */ jsx15("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ jsxs11("div", { className: "bg-white rounded-lg p-6 mx-4 w-full max-w-md shadow-xl", children: [
|
|
3567
|
+
getIcon(),
|
|
3568
|
+
/* @__PURE__ */ jsxs11("div", { className: "mt-4 text-center", children: [
|
|
3569
|
+
/* @__PURE__ */ jsx15("h3", { className: "text-lg font-semibold text-gray-900", children: title }),
|
|
3570
|
+
description && /* @__PURE__ */ jsx15("p", { className: "mt-2 text-sm text-gray-600", children: description })
|
|
3571
|
+
] }),
|
|
3572
|
+
/* @__PURE__ */ jsxs11("div", { className: "mt-6 flex flex-col-reverse sm:flex-row gap-3 sm:gap-4", children: [
|
|
3573
|
+
/* @__PURE__ */ jsx15(
|
|
3574
|
+
"button",
|
|
3575
|
+
{
|
|
3576
|
+
type: "button",
|
|
3577
|
+
onClick: onCancel,
|
|
3578
|
+
className: "w-full sm:w-1/2 px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 transition-colors",
|
|
3579
|
+
children: cancelText
|
|
3580
|
+
}
|
|
3581
|
+
),
|
|
3582
|
+
/* @__PURE__ */ jsx15(
|
|
3583
|
+
"button",
|
|
3584
|
+
{
|
|
3585
|
+
type: "button",
|
|
3586
|
+
onClick: onConfirm,
|
|
3587
|
+
className: `w-full sm:w-1/2 px-4 py-2 text-sm font-medium rounded-lg focus:outline-none focus:ring-2 focus:ring-offset-2 transition-colors ${getConfirmButtonStyles()}`,
|
|
3588
|
+
children: confirmText
|
|
3589
|
+
}
|
|
3590
|
+
)
|
|
3591
|
+
] })
|
|
3592
|
+
] }) });
|
|
3593
|
+
};
|
|
3594
|
+
var Alert_default = Alert;
|
|
3595
|
+
|
|
3596
|
+
// src/contexts/AlertContext.tsx
|
|
3597
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3598
|
+
var AlertContext = createContext4(void 0);
|
|
3599
|
+
var AlertProvider = ({ children }) => {
|
|
3600
|
+
const [alertState, setAlertState] = useState11({
|
|
3601
|
+
open: false,
|
|
3602
|
+
title: "",
|
|
3603
|
+
variant: "warning"
|
|
3604
|
+
});
|
|
3605
|
+
const showConfirmation = useCallback2((options) => {
|
|
3606
|
+
return new Promise((resolve) => {
|
|
3607
|
+
setAlertState({
|
|
3608
|
+
...options,
|
|
3609
|
+
open: true,
|
|
3610
|
+
resolve
|
|
3611
|
+
});
|
|
3612
|
+
});
|
|
3613
|
+
}, []);
|
|
3614
|
+
const showAlert = useCallback2(
|
|
3615
|
+
(title, confirmText = "Oui", cancelText = "Annuler", description, variant = "warning") => {
|
|
3616
|
+
return showConfirmation({
|
|
3617
|
+
title,
|
|
3618
|
+
description,
|
|
3619
|
+
confirmText,
|
|
3620
|
+
cancelText,
|
|
3621
|
+
variant
|
|
3622
|
+
});
|
|
3623
|
+
},
|
|
3624
|
+
[showConfirmation]
|
|
3625
|
+
);
|
|
3626
|
+
const handleConfirm = useCallback2(() => {
|
|
3627
|
+
if (alertState.resolve) {
|
|
3628
|
+
alertState.resolve(true);
|
|
3629
|
+
}
|
|
3630
|
+
setAlertState((prev) => ({ ...prev, open: false }));
|
|
3631
|
+
}, [alertState.resolve]);
|
|
3632
|
+
const handleCancel = useCallback2(() => {
|
|
3633
|
+
if (alertState.resolve) {
|
|
3634
|
+
alertState.resolve(false);
|
|
3635
|
+
}
|
|
3636
|
+
setAlertState((prev) => ({ ...prev, open: false }));
|
|
3637
|
+
}, [alertState.resolve]);
|
|
3638
|
+
return /* @__PURE__ */ jsxs12(AlertContext.Provider, { value: { showConfirmation, showAlert }, children: [
|
|
3639
|
+
children,
|
|
3640
|
+
/* @__PURE__ */ jsx16(
|
|
3641
|
+
Alert_default,
|
|
3642
|
+
{
|
|
3643
|
+
open: alertState.open,
|
|
3644
|
+
title: alertState.title,
|
|
3645
|
+
description: alertState.description,
|
|
3646
|
+
variant: alertState.variant || "warning",
|
|
3647
|
+
confirmText: alertState.confirmText,
|
|
3648
|
+
cancelText: alertState.cancelText,
|
|
3649
|
+
confirmButtonVariant: alertState.confirmButtonVariant,
|
|
3650
|
+
onConfirm: handleConfirm,
|
|
3651
|
+
onCancel: handleCancel
|
|
3652
|
+
}
|
|
3653
|
+
)
|
|
3654
|
+
] });
|
|
3655
|
+
};
|
|
3656
|
+
var useAlert = () => {
|
|
3657
|
+
const context = useContext4(AlertContext);
|
|
3658
|
+
if (!context) {
|
|
3659
|
+
throw new Error("useAlert must be used within an AlertProvider");
|
|
3660
|
+
}
|
|
3661
|
+
return context;
|
|
3662
|
+
};
|
|
3511
3663
|
export {
|
|
3664
|
+
Alert_default as Alert,
|
|
3665
|
+
AlertProvider,
|
|
3512
3666
|
ApprovalAnswerModal,
|
|
3513
3667
|
ApprovalAnswerPage,
|
|
3514
3668
|
ApprovalPreviewAnswer_default as ApprovalPreviewAnswer,
|
|
3515
3669
|
ApprovalWorkflow_default as ApprovalWorkflow,
|
|
3516
3670
|
DateInput,
|
|
3517
3671
|
FDrawer,
|
|
3672
|
+
FetchApi,
|
|
3518
3673
|
FileInput,
|
|
3519
3674
|
InputField,
|
|
3520
3675
|
Modals_default as Modal,
|
|
@@ -3530,6 +3685,7 @@ export {
|
|
|
3530
3685
|
Toast_default as ToastContainer,
|
|
3531
3686
|
ToastProvider,
|
|
3532
3687
|
UserServices,
|
|
3688
|
+
useAlert,
|
|
3533
3689
|
useSession,
|
|
3534
3690
|
useToast
|
|
3535
3691
|
};
|