ptechcore_ui 1.0.75 → 1.0.77
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 +29 -75
- package/dist/index.js +30 -76
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5486,7 +5486,7 @@ var Pagination = ({
|
|
|
5486
5486
|
"select",
|
|
5487
5487
|
{
|
|
5488
5488
|
id: "page-select",
|
|
5489
|
-
value: current_page,
|
|
5489
|
+
value: current_page ?? "",
|
|
5490
5490
|
onChange: (e) => setFilters({ ...filtersValue, page: Number(e.target.value) }),
|
|
5491
5491
|
style: { height: "27px", color: "#72939D", border: "0.05rem solid #f2f2f2", background: "#ffffff" },
|
|
5492
5492
|
children: Array.from({ length: total_pages }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: index + 1, children: index + 1 }, index + 1))
|
|
@@ -9694,13 +9694,12 @@ var FormVendor = ({
|
|
|
9694
9694
|
}
|
|
9695
9695
|
),
|
|
9696
9696
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
9697
|
-
|
|
9697
|
+
SelectLegalForm,
|
|
9698
9698
|
{
|
|
9699
|
-
label: "Forme juridique",
|
|
9700
|
-
name: "legal_form",
|
|
9701
9699
|
value: formData.legal_form || "",
|
|
9702
|
-
|
|
9703
|
-
|
|
9700
|
+
onSelect: (option) => setFormData((prev) => ({ ...prev, legal_form: String(option.value) })),
|
|
9701
|
+
allowClear: true,
|
|
9702
|
+
onRemove: () => setFormData((prev) => ({ ...prev, legal_form: "" }))
|
|
9704
9703
|
}
|
|
9705
9704
|
),
|
|
9706
9705
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
@@ -10293,13 +10292,12 @@ var FormClient = ({
|
|
|
10293
10292
|
}
|
|
10294
10293
|
),
|
|
10295
10294
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
10296
|
-
|
|
10295
|
+
SelectLegalForm,
|
|
10297
10296
|
{
|
|
10298
|
-
label: "Forme juridique",
|
|
10299
|
-
name: "legal_form",
|
|
10300
10297
|
value: formData.legal_form || "",
|
|
10301
|
-
|
|
10302
|
-
|
|
10298
|
+
onSelect: (option) => setFormData((prev) => ({ ...prev, legal_form: String(option.value) })),
|
|
10299
|
+
allowClear: true,
|
|
10300
|
+
onRemove: () => setFormData((prev) => ({ ...prev, legal_form: "" }))
|
|
10303
10301
|
}
|
|
10304
10302
|
),
|
|
10305
10303
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
@@ -10817,6 +10815,7 @@ var ApprovalWorkflow = ({
|
|
|
10817
10815
|
if (!token) return;
|
|
10818
10816
|
try {
|
|
10819
10817
|
const response = await ApprovalServices.getDetails(process, object_id, token);
|
|
10818
|
+
console.log("Response case details:", response.success && response.data);
|
|
10820
10819
|
if (response.success && response.data) {
|
|
10821
10820
|
const caseInfo = response.data;
|
|
10822
10821
|
setCaseData(caseInfo);
|
|
@@ -11095,52 +11094,18 @@ var ApprovalWorkflow = ({
|
|
|
11095
11094
|
renderStageSection("Verification", verification, setVerification, "verification"),
|
|
11096
11095
|
renderStageSection("Validation", validation, setValidation, "validation"),
|
|
11097
11096
|
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between pt-4 border-t border-[#D9D9D9]", children: [
|
|
11097
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex gap-3" }),
|
|
11098
11098
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-3", children: [
|
|
11099
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.
|
|
11100
|
-
SecondaryButton,
|
|
11101
|
-
{
|
|
11102
|
-
onClick: () => window.history.back(),
|
|
11103
|
-
type: "button",
|
|
11104
|
-
children: "Retour"
|
|
11105
|
-
}
|
|
11106
|
-
),
|
|
11107
|
-
caseData?.id && formData.status !== "not-send" /* NOT_SEND */ && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
11108
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
11109
|
-
SecondaryButton,
|
|
11110
|
-
{
|
|
11111
|
-
onClick: handleCancel,
|
|
11112
|
-
disabled: canceling,
|
|
11113
|
-
type: "button",
|
|
11114
|
-
classname: "flex items-center gap-2",
|
|
11115
|
-
children: [
|
|
11116
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react21.Ban, { className: "w-4 h-4" }),
|
|
11117
|
-
canceling ? "Annulation..." : "Annuler la demande"
|
|
11118
|
-
]
|
|
11119
|
-
}
|
|
11120
|
-
),
|
|
11121
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
11122
|
-
SecondaryButton,
|
|
11123
|
-
{
|
|
11124
|
-
onClick: handleRestart,
|
|
11125
|
-
disabled: restarting,
|
|
11126
|
-
type: "button",
|
|
11127
|
-
classname: "flex items-center gap-2",
|
|
11128
|
-
children: [
|
|
11129
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react21.RotateCcw, { className: "w-4 h-4" }),
|
|
11130
|
-
restarting ? "Red\xE9marrage..." : "Recommencer"
|
|
11131
|
-
]
|
|
11132
|
-
}
|
|
11133
|
-
)
|
|
11134
|
-
] })
|
|
11135
|
-
] }),
|
|
11136
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-3", children: [
|
|
11137
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
11099
|
+
formData.status == "not-send" /* NOT_SEND */ && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
11138
11100
|
Buttons_default,
|
|
11139
11101
|
{
|
|
11140
11102
|
onClick: handleSave,
|
|
11141
11103
|
disabled: saving,
|
|
11142
11104
|
type: "button",
|
|
11143
|
-
children:
|
|
11105
|
+
children: [
|
|
11106
|
+
" ",
|
|
11107
|
+
saving ? "Enregistrement..." : "Enregistrer"
|
|
11108
|
+
]
|
|
11144
11109
|
}
|
|
11145
11110
|
),
|
|
11146
11111
|
formData.status === "not-send" /* NOT_SEND */ && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
@@ -11965,7 +11930,10 @@ var statusMap = {
|
|
|
11965
11930
|
};
|
|
11966
11931
|
var getStatus = (answer) => statusMap[answer] || statusMap["not-send" /* NOT_SEND */];
|
|
11967
11932
|
var getName = (a) => a.user_detail ? `${a.user_detail.first_name} ${a.user_detail.last_name}`.trim() : a.full_name || "-";
|
|
11968
|
-
var getRole = (a, center_id) =>
|
|
11933
|
+
var getRole = (a, center_id) => {
|
|
11934
|
+
console.log(a.user_detail, center_id);
|
|
11935
|
+
return a.user_detail?.centers_access?.find((c) => c.id === center_id)?.fonction ?? "";
|
|
11936
|
+
};
|
|
11969
11937
|
var formatDate2 = (date) => date ? formatDateFR(date) : "-";
|
|
11970
11938
|
var borderStyle = { borderColor: "var(--color-border)" };
|
|
11971
11939
|
var cellClass = "border px-2 py-1";
|
|
@@ -11995,14 +11963,7 @@ var ApprovalRecap = ({ process, object_id }) => {
|
|
|
11995
11963
|
if (items.length === 0) return null;
|
|
11996
11964
|
const status = getStatus(items[0].answer);
|
|
11997
11965
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
11998
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.
|
|
11999
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle, rowSpan: items.length + 1, children: label }),
|
|
12000
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle }),
|
|
12001
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle }),
|
|
12002
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle }),
|
|
12003
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle }),
|
|
12004
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle })
|
|
12005
|
-
] }),
|
|
11966
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle, rowSpan: items.length + 1, children: label }) }),
|
|
12006
11967
|
items.map((item, i) => {
|
|
12007
11968
|
const s = getStatus(item.answer);
|
|
12008
11969
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("tr", { children: [
|
|
@@ -12028,7 +11989,7 @@ var ApprovalRecap = ({ process, object_id }) => {
|
|
|
12028
11989
|
requester && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("tr", { children: [
|
|
12029
11990
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle, children: "Demand\xE9 par" }),
|
|
12030
11991
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: `${cellClass} uppercase`, style: { ...borderStyle, color: "var(--color-text)" }, children: `${requester.first_name} ${requester.last_name}`.trim() }),
|
|
12031
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: `${cellClass} uppercase`, style: { ...borderStyle, color: "var(--color-text)" }, children: requester?.
|
|
11992
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: `${cellClass} uppercase`, style: { ...borderStyle, color: "var(--color-text)" }, children: requester?.centers_access?.find((c) => c.id === activeBusinessEntity?.id)?.fonction ?? "" }),
|
|
12032
11993
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle, children: formatDate2(caseData.created_at) }),
|
|
12033
11994
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "inline-flex items-center gap-1", style: { color: "var(--color-primary)" }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react23.CheckCircle, { className: "w-3.5 h-3.5" }) }) }),
|
|
12034
11995
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("td", { className: cellClass, style: borderStyle })
|
|
@@ -18546,7 +18507,7 @@ var TaskPilot = () => {
|
|
|
18546
18507
|
};
|
|
18547
18508
|
var TaskPilot_default = TaskPilot;
|
|
18548
18509
|
|
|
18549
|
-
// src/components/purchase-request/
|
|
18510
|
+
// src/components/purchase-request/ProcuLink.tsx
|
|
18550
18511
|
var import_react43 = require("react");
|
|
18551
18512
|
var import_lucide_react35 = require("lucide-react");
|
|
18552
18513
|
|
|
@@ -19113,7 +19074,7 @@ var FormPurchaseRequest = ({
|
|
|
19113
19074
|
const { success, error: showError } = useToast();
|
|
19114
19075
|
const [showCatalogueSelector, setShowCatalogueSelector] = (0, import_react42.useState)(false);
|
|
19115
19076
|
const [budgetInfo, setBudgetInfo] = (0, import_react42.useState)({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
|
|
19116
|
-
const readonly = false;
|
|
19077
|
+
const readonly = object ? object.status !== "draft" : false;
|
|
19117
19078
|
const fetchDepartmentBudget = async (departmentId) => {
|
|
19118
19079
|
if (!departmentId) {
|
|
19119
19080
|
setBudgetInfo({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
|
|
@@ -19686,7 +19647,7 @@ var FormPurchaseRequest = ({
|
|
|
19686
19647
|
PrimaryButton,
|
|
19687
19648
|
{
|
|
19688
19649
|
type: "submit",
|
|
19689
|
-
disabled: loading,
|
|
19650
|
+
disabled: loading || readonly,
|
|
19690
19651
|
children: loading ? "chargement..." : "Enregistrer"
|
|
19691
19652
|
}
|
|
19692
19653
|
)
|
|
@@ -19881,14 +19842,7 @@ var PrintablePurchaseRequest = ({
|
|
|
19881
19842
|
data.vendor_info.phone && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "text-gray-600", children: data.vendor_info.phone })
|
|
19882
19843
|
] })
|
|
19883
19844
|
] }),
|
|
19884
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.
|
|
19885
|
-
ApprovalRecap_default,
|
|
19886
|
-
{
|
|
19887
|
-
process: "PCR-PR",
|
|
19888
|
-
object_id: data.id
|
|
19889
|
-
}
|
|
19890
|
-
) }),
|
|
19891
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "grid grid-cols-2 gap-8 mt-12 pt-4", children: [
|
|
19845
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex justify-between gap-8 mt-12 pt-4", children: [
|
|
19892
19846
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { children: [
|
|
19893
19847
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "text-xs text-gray-600 mb-1", children: "Date d'impression:" }),
|
|
19894
19848
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "border-b border-gray-400 w-32 mb-4 text-xs", children: currentDate }),
|
|
@@ -19908,7 +19862,7 @@ var PrintablePurchaseRequest = ({
|
|
|
19908
19862
|
] });
|
|
19909
19863
|
};
|
|
19910
19864
|
|
|
19911
|
-
// src/components/purchase-request/
|
|
19865
|
+
// src/components/purchase-request/ProcuLink.tsx
|
|
19912
19866
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
19913
19867
|
var PurchaseRequestsPage = () => {
|
|
19914
19868
|
const [refreshToggle, setRefreshToggle] = (0, import_react43.useState)(false);
|
|
@@ -19916,7 +19870,7 @@ var PurchaseRequestsPage = () => {
|
|
|
19916
19870
|
const [showPrintPreview, setShowPrintPreview] = (0, import_react43.useState)(false);
|
|
19917
19871
|
const [selectedPurchaseRequest, setSelectedPurchaseRequest] = (0, import_react43.useState)(null);
|
|
19918
19872
|
const { success, error: showError, confirm: confirm2 } = useToast();
|
|
19919
|
-
const { activeBusinessEntity } = useSession();
|
|
19873
|
+
const { activeBusinessEntity, loggedUser } = useSession();
|
|
19920
19874
|
(0, import_react43.useEffect)(() => {
|
|
19921
19875
|
}, []);
|
|
19922
19876
|
const loadPurchaseRequests = async () => {
|
|
@@ -20028,7 +19982,7 @@ var PurchaseRequestsPage = () => {
|
|
|
20028
19982
|
process: "PCR-PR",
|
|
20029
19983
|
object_id: item.id,
|
|
20030
19984
|
CustomBtn: (props) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Buttons_default, { className: "rounded-[6px] bg-gray-500 p-1 text-white", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_lucide_react35.ClipboardCheck, {}) }),
|
|
20031
|
-
readOnly:
|
|
19985
|
+
readOnly: loggedUser?.id !== item.created_by
|
|
20032
19986
|
}
|
|
20033
19987
|
);
|
|
20034
19988
|
}
|
package/dist/index.js
CHANGED
|
@@ -5293,7 +5293,7 @@ var Pagination = ({
|
|
|
5293
5293
|
"select",
|
|
5294
5294
|
{
|
|
5295
5295
|
id: "page-select",
|
|
5296
|
-
value: current_page,
|
|
5296
|
+
value: current_page ?? "",
|
|
5297
5297
|
onChange: (e) => setFilters({ ...filtersValue, page: Number(e.target.value) }),
|
|
5298
5298
|
style: { height: "27px", color: "#72939D", border: "0.05rem solid #f2f2f2", background: "#ffffff" },
|
|
5299
5299
|
children: Array.from({ length: total_pages }, (_, index) => /* @__PURE__ */ jsx16("option", { value: index + 1, children: index + 1 }, index + 1))
|
|
@@ -9542,13 +9542,12 @@ var FormVendor = ({
|
|
|
9542
9542
|
}
|
|
9543
9543
|
),
|
|
9544
9544
|
/* @__PURE__ */ jsx30(
|
|
9545
|
-
|
|
9545
|
+
SelectLegalForm,
|
|
9546
9546
|
{
|
|
9547
|
-
label: "Forme juridique",
|
|
9548
|
-
name: "legal_form",
|
|
9549
9547
|
value: formData.legal_form || "",
|
|
9550
|
-
|
|
9551
|
-
|
|
9548
|
+
onSelect: (option) => setFormData((prev) => ({ ...prev, legal_form: String(option.value) })),
|
|
9549
|
+
allowClear: true,
|
|
9550
|
+
onRemove: () => setFormData((prev) => ({ ...prev, legal_form: "" }))
|
|
9552
9551
|
}
|
|
9553
9552
|
),
|
|
9554
9553
|
/* @__PURE__ */ jsx30(
|
|
@@ -10148,13 +10147,12 @@ var FormClient = ({
|
|
|
10148
10147
|
}
|
|
10149
10148
|
),
|
|
10150
10149
|
/* @__PURE__ */ jsx31(
|
|
10151
|
-
|
|
10150
|
+
SelectLegalForm,
|
|
10152
10151
|
{
|
|
10153
|
-
label: "Forme juridique",
|
|
10154
|
-
name: "legal_form",
|
|
10155
10152
|
value: formData.legal_form || "",
|
|
10156
|
-
|
|
10157
|
-
|
|
10153
|
+
onSelect: (option) => setFormData((prev) => ({ ...prev, legal_form: String(option.value) })),
|
|
10154
|
+
allowClear: true,
|
|
10155
|
+
onRemove: () => setFormData((prev) => ({ ...prev, legal_form: "" }))
|
|
10158
10156
|
}
|
|
10159
10157
|
),
|
|
10160
10158
|
/* @__PURE__ */ jsx31(
|
|
@@ -10599,7 +10597,7 @@ var FormClient = ({
|
|
|
10599
10597
|
|
|
10600
10598
|
// src/components/common/ApprovalWorkflow.tsx
|
|
10601
10599
|
import { useState as useState22, useEffect as useEffect15 } from "react";
|
|
10602
|
-
import { X as X10, Plus as Plus3, Trash2 as Trash25, Users, Loader as Loader3,
|
|
10600
|
+
import { X as X10, Plus as Plus3, Trash2 as Trash25, Users, Loader as Loader3, Eye as Eye4, FileText as FileText6, History } from "lucide-react";
|
|
10603
10601
|
import { Fragment as Fragment9, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
10604
10602
|
var ApprovalWorkflow = ({
|
|
10605
10603
|
process,
|
|
@@ -10672,6 +10670,7 @@ var ApprovalWorkflow = ({
|
|
|
10672
10670
|
if (!token) return;
|
|
10673
10671
|
try {
|
|
10674
10672
|
const response = await ApprovalServices.getDetails(process, object_id, token);
|
|
10673
|
+
console.log("Response case details:", response.success && response.data);
|
|
10675
10674
|
if (response.success && response.data) {
|
|
10676
10675
|
const caseInfo = response.data;
|
|
10677
10676
|
setCaseData(caseInfo);
|
|
@@ -10950,52 +10949,18 @@ var ApprovalWorkflow = ({
|
|
|
10950
10949
|
renderStageSection("Verification", verification, setVerification, "verification"),
|
|
10951
10950
|
renderStageSection("Validation", validation, setValidation, "validation"),
|
|
10952
10951
|
!readOnly && /* @__PURE__ */ jsxs26("div", { className: "flex justify-between pt-4 border-t border-[#D9D9D9]", children: [
|
|
10952
|
+
/* @__PURE__ */ jsx32("div", { className: "flex gap-3" }),
|
|
10953
10953
|
/* @__PURE__ */ jsxs26("div", { className: "flex gap-3", children: [
|
|
10954
|
-
/* @__PURE__ */
|
|
10955
|
-
SecondaryButton,
|
|
10956
|
-
{
|
|
10957
|
-
onClick: () => window.history.back(),
|
|
10958
|
-
type: "button",
|
|
10959
|
-
children: "Retour"
|
|
10960
|
-
}
|
|
10961
|
-
),
|
|
10962
|
-
caseData?.id && formData.status !== "not-send" /* NOT_SEND */ && /* @__PURE__ */ jsxs26(Fragment9, { children: [
|
|
10963
|
-
/* @__PURE__ */ jsxs26(
|
|
10964
|
-
SecondaryButton,
|
|
10965
|
-
{
|
|
10966
|
-
onClick: handleCancel,
|
|
10967
|
-
disabled: canceling,
|
|
10968
|
-
type: "button",
|
|
10969
|
-
classname: "flex items-center gap-2",
|
|
10970
|
-
children: [
|
|
10971
|
-
/* @__PURE__ */ jsx32(Ban, { className: "w-4 h-4" }),
|
|
10972
|
-
canceling ? "Annulation..." : "Annuler la demande"
|
|
10973
|
-
]
|
|
10974
|
-
}
|
|
10975
|
-
),
|
|
10976
|
-
/* @__PURE__ */ jsxs26(
|
|
10977
|
-
SecondaryButton,
|
|
10978
|
-
{
|
|
10979
|
-
onClick: handleRestart,
|
|
10980
|
-
disabled: restarting,
|
|
10981
|
-
type: "button",
|
|
10982
|
-
classname: "flex items-center gap-2",
|
|
10983
|
-
children: [
|
|
10984
|
-
/* @__PURE__ */ jsx32(RotateCcw, { className: "w-4 h-4" }),
|
|
10985
|
-
restarting ? "Red\xE9marrage..." : "Recommencer"
|
|
10986
|
-
]
|
|
10987
|
-
}
|
|
10988
|
-
)
|
|
10989
|
-
] })
|
|
10990
|
-
] }),
|
|
10991
|
-
/* @__PURE__ */ jsxs26("div", { className: "flex gap-3", children: [
|
|
10992
|
-
/* @__PURE__ */ jsx32(
|
|
10954
|
+
formData.status == "not-send" /* NOT_SEND */ && /* @__PURE__ */ jsxs26(
|
|
10993
10955
|
Buttons_default,
|
|
10994
10956
|
{
|
|
10995
10957
|
onClick: handleSave,
|
|
10996
10958
|
disabled: saving,
|
|
10997
10959
|
type: "button",
|
|
10998
|
-
children:
|
|
10960
|
+
children: [
|
|
10961
|
+
" ",
|
|
10962
|
+
saving ? "Enregistrement..." : "Enregistrer"
|
|
10963
|
+
]
|
|
10999
10964
|
}
|
|
11000
10965
|
),
|
|
11001
10966
|
formData.status === "not-send" /* NOT_SEND */ && /* @__PURE__ */ jsx32(
|
|
@@ -11820,7 +11785,10 @@ var statusMap = {
|
|
|
11820
11785
|
};
|
|
11821
11786
|
var getStatus = (answer) => statusMap[answer] || statusMap["not-send" /* NOT_SEND */];
|
|
11822
11787
|
var getName = (a) => a.user_detail ? `${a.user_detail.first_name} ${a.user_detail.last_name}`.trim() : a.full_name || "-";
|
|
11823
|
-
var getRole = (a, center_id) =>
|
|
11788
|
+
var getRole = (a, center_id) => {
|
|
11789
|
+
console.log(a.user_detail, center_id);
|
|
11790
|
+
return a.user_detail?.centers_access?.find((c) => c.id === center_id)?.fonction ?? "";
|
|
11791
|
+
};
|
|
11824
11792
|
var formatDate2 = (date) => date ? formatDateFR(date) : "-";
|
|
11825
11793
|
var borderStyle = { borderColor: "var(--color-border)" };
|
|
11826
11794
|
var cellClass = "border px-2 py-1";
|
|
@@ -11850,14 +11818,7 @@ var ApprovalRecap = ({ process, object_id }) => {
|
|
|
11850
11818
|
if (items.length === 0) return null;
|
|
11851
11819
|
const status = getStatus(items[0].answer);
|
|
11852
11820
|
return /* @__PURE__ */ jsxs28(Fragment10, { children: [
|
|
11853
|
-
/* @__PURE__ */
|
|
11854
|
-
/* @__PURE__ */ jsx34("td", { className: cellClass, style: borderStyle, rowSpan: items.length + 1, children: label }),
|
|
11855
|
-
/* @__PURE__ */ jsx34("td", { className: cellClass, style: borderStyle }),
|
|
11856
|
-
/* @__PURE__ */ jsx34("td", { className: cellClass, style: borderStyle }),
|
|
11857
|
-
/* @__PURE__ */ jsx34("td", { className: cellClass, style: borderStyle }),
|
|
11858
|
-
/* @__PURE__ */ jsx34("td", { className: cellClass, style: borderStyle }),
|
|
11859
|
-
/* @__PURE__ */ jsx34("td", { className: cellClass, style: borderStyle })
|
|
11860
|
-
] }),
|
|
11821
|
+
/* @__PURE__ */ jsx34("tr", { children: /* @__PURE__ */ jsx34("td", { className: cellClass, style: borderStyle, rowSpan: items.length + 1, children: label }) }),
|
|
11861
11822
|
items.map((item, i) => {
|
|
11862
11823
|
const s = getStatus(item.answer);
|
|
11863
11824
|
return /* @__PURE__ */ jsxs28("tr", { children: [
|
|
@@ -11883,7 +11844,7 @@ var ApprovalRecap = ({ process, object_id }) => {
|
|
|
11883
11844
|
requester && /* @__PURE__ */ jsxs28("tr", { children: [
|
|
11884
11845
|
/* @__PURE__ */ jsx34("td", { className: cellClass, style: borderStyle, children: "Demand\xE9 par" }),
|
|
11885
11846
|
/* @__PURE__ */ jsx34("td", { className: `${cellClass} uppercase`, style: { ...borderStyle, color: "var(--color-text)" }, children: `${requester.first_name} ${requester.last_name}`.trim() }),
|
|
11886
|
-
/* @__PURE__ */ jsx34("td", { className: `${cellClass} uppercase`, style: { ...borderStyle, color: "var(--color-text)" }, children: requester?.
|
|
11847
|
+
/* @__PURE__ */ jsx34("td", { className: `${cellClass} uppercase`, style: { ...borderStyle, color: "var(--color-text)" }, children: requester?.centers_access?.find((c) => c.id === activeBusinessEntity?.id)?.fonction ?? "" }),
|
|
11887
11848
|
/* @__PURE__ */ jsx34("td", { className: cellClass, style: borderStyle, children: formatDate2(caseData.created_at) }),
|
|
11888
11849
|
/* @__PURE__ */ jsx34("td", { className: cellClass, style: borderStyle, children: /* @__PURE__ */ jsx34("span", { className: "inline-flex items-center gap-1", style: { color: "var(--color-primary)" }, children: /* @__PURE__ */ jsx34(CheckCircle3, { className: "w-3.5 h-3.5" }) }) }),
|
|
11889
11850
|
/* @__PURE__ */ jsx34("td", { className: cellClass, style: borderStyle })
|
|
@@ -18459,7 +18420,7 @@ var TaskPilot = () => {
|
|
|
18459
18420
|
};
|
|
18460
18421
|
var TaskPilot_default = TaskPilot;
|
|
18461
18422
|
|
|
18462
|
-
// src/components/purchase-request/
|
|
18423
|
+
// src/components/purchase-request/ProcuLink.tsx
|
|
18463
18424
|
import { useEffect as useEffect29, useState as useState37 } from "react";
|
|
18464
18425
|
import { ClipboardCheck, Plus as Plus9 } from "lucide-react";
|
|
18465
18426
|
|
|
@@ -19042,7 +19003,7 @@ var FormPurchaseRequest = ({
|
|
|
19042
19003
|
const { success, error: showError } = useToast();
|
|
19043
19004
|
const [showCatalogueSelector, setShowCatalogueSelector] = useState36(false);
|
|
19044
19005
|
const [budgetInfo, setBudgetInfo] = useState36({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
|
|
19045
|
-
const readonly = false;
|
|
19006
|
+
const readonly = object ? object.status !== "draft" : false;
|
|
19046
19007
|
const fetchDepartmentBudget = async (departmentId) => {
|
|
19047
19008
|
if (!departmentId) {
|
|
19048
19009
|
setBudgetInfo({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
|
|
@@ -19615,7 +19576,7 @@ var FormPurchaseRequest = ({
|
|
|
19615
19576
|
PrimaryButton,
|
|
19616
19577
|
{
|
|
19617
19578
|
type: "submit",
|
|
19618
|
-
disabled: loading,
|
|
19579
|
+
disabled: loading || readonly,
|
|
19619
19580
|
children: loading ? "chargement..." : "Enregistrer"
|
|
19620
19581
|
}
|
|
19621
19582
|
)
|
|
@@ -19810,14 +19771,7 @@ var PrintablePurchaseRequest = ({
|
|
|
19810
19771
|
data.vendor_info.phone && /* @__PURE__ */ jsx59("p", { className: "text-gray-600", children: data.vendor_info.phone })
|
|
19811
19772
|
] })
|
|
19812
19773
|
] }),
|
|
19813
|
-
/* @__PURE__ */
|
|
19814
|
-
ApprovalRecap_default,
|
|
19815
|
-
{
|
|
19816
|
-
process: "PCR-PR",
|
|
19817
|
-
object_id: data.id
|
|
19818
|
-
}
|
|
19819
|
-
) }),
|
|
19820
|
-
/* @__PURE__ */ jsxs52("div", { className: "grid grid-cols-2 gap-8 mt-12 pt-4", children: [
|
|
19774
|
+
/* @__PURE__ */ jsxs52("div", { className: "flex justify-between gap-8 mt-12 pt-4", children: [
|
|
19821
19775
|
/* @__PURE__ */ jsxs52("div", { children: [
|
|
19822
19776
|
/* @__PURE__ */ jsx59("p", { className: "text-xs text-gray-600 mb-1", children: "Date d'impression:" }),
|
|
19823
19777
|
/* @__PURE__ */ jsx59("div", { className: "border-b border-gray-400 w-32 mb-4 text-xs", children: currentDate }),
|
|
@@ -19837,7 +19791,7 @@ var PrintablePurchaseRequest = ({
|
|
|
19837
19791
|
] });
|
|
19838
19792
|
};
|
|
19839
19793
|
|
|
19840
|
-
// src/components/purchase-request/
|
|
19794
|
+
// src/components/purchase-request/ProcuLink.tsx
|
|
19841
19795
|
import { jsx as jsx60, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
19842
19796
|
var PurchaseRequestsPage = () => {
|
|
19843
19797
|
const [refreshToggle, setRefreshToggle] = useState37(false);
|
|
@@ -19845,7 +19799,7 @@ var PurchaseRequestsPage = () => {
|
|
|
19845
19799
|
const [showPrintPreview, setShowPrintPreview] = useState37(false);
|
|
19846
19800
|
const [selectedPurchaseRequest, setSelectedPurchaseRequest] = useState37(null);
|
|
19847
19801
|
const { success, error: showError, confirm: confirm2 } = useToast();
|
|
19848
|
-
const { activeBusinessEntity } = useSession();
|
|
19802
|
+
const { activeBusinessEntity, loggedUser } = useSession();
|
|
19849
19803
|
useEffect29(() => {
|
|
19850
19804
|
}, []);
|
|
19851
19805
|
const loadPurchaseRequests = async () => {
|
|
@@ -19957,7 +19911,7 @@ var PurchaseRequestsPage = () => {
|
|
|
19957
19911
|
process: "PCR-PR",
|
|
19958
19912
|
object_id: item.id,
|
|
19959
19913
|
CustomBtn: (props) => /* @__PURE__ */ jsx60(Buttons_default, { className: "rounded-[6px] bg-gray-500 p-1 text-white", ...props, children: /* @__PURE__ */ jsx60(ClipboardCheck, {}) }),
|
|
19960
|
-
readOnly:
|
|
19914
|
+
readOnly: loggedUser?.id !== item.created_by
|
|
19961
19915
|
}
|
|
19962
19916
|
);
|
|
19963
19917
|
}
|