ptechcore_ui 1.0.76 → 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 CHANGED
@@ -9694,13 +9694,12 @@ var FormVendor = ({
9694
9694
  }
9695
9695
  ),
9696
9696
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
9697
- TextInput,
9697
+ SelectLegalForm,
9698
9698
  {
9699
- label: "Forme juridique",
9700
- name: "legal_form",
9701
9699
  value: formData.legal_form || "",
9702
- placeholder: "SARL, SA, SAS, etc.",
9703
- onChange: handleInputChange
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
- TextInput,
10295
+ SelectLegalForm,
10297
10296
  {
10298
- label: "Forme juridique",
10299
- name: "legal_form",
10300
10297
  value: formData.legal_form || "",
10301
- placeholder: "SARL, SA, SAS, etc.",
10302
- onChange: handleInputChange
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.jsx)(
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: saving ? "Enregistrement..." : "Enregistrer"
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)(
@@ -18542,7 +18507,7 @@ var TaskPilot = () => {
18542
18507
  };
18543
18508
  var TaskPilot_default = TaskPilot;
18544
18509
 
18545
- // src/components/purchase-request/PurchaseRequestsPage.tsx
18510
+ // src/components/purchase-request/ProcuLink.tsx
18546
18511
  var import_react43 = require("react");
18547
18512
  var import_lucide_react35 = require("lucide-react");
18548
18513
 
@@ -19109,7 +19074,7 @@ var FormPurchaseRequest = ({
19109
19074
  const { success, error: showError } = useToast();
19110
19075
  const [showCatalogueSelector, setShowCatalogueSelector] = (0, import_react42.useState)(false);
19111
19076
  const [budgetInfo, setBudgetInfo] = (0, import_react42.useState)({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
19112
- const readonly = false;
19077
+ const readonly = object ? object.status !== "draft" : false;
19113
19078
  const fetchDepartmentBudget = async (departmentId) => {
19114
19079
  if (!departmentId) {
19115
19080
  setBudgetInfo({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
@@ -19682,7 +19647,7 @@ var FormPurchaseRequest = ({
19682
19647
  PrimaryButton,
19683
19648
  {
19684
19649
  type: "submit",
19685
- disabled: loading,
19650
+ disabled: loading || readonly,
19686
19651
  children: loading ? "chargement..." : "Enregistrer"
19687
19652
  }
19688
19653
  )
@@ -19897,7 +19862,7 @@ var PrintablePurchaseRequest = ({
19897
19862
  ] });
19898
19863
  };
19899
19864
 
19900
- // src/components/purchase-request/PurchaseRequestsPage.tsx
19865
+ // src/components/purchase-request/ProcuLink.tsx
19901
19866
  var import_jsx_runtime60 = require("react/jsx-runtime");
19902
19867
  var PurchaseRequestsPage = () => {
19903
19868
  const [refreshToggle, setRefreshToggle] = (0, import_react43.useState)(false);
@@ -19905,7 +19870,7 @@ var PurchaseRequestsPage = () => {
19905
19870
  const [showPrintPreview, setShowPrintPreview] = (0, import_react43.useState)(false);
19906
19871
  const [selectedPurchaseRequest, setSelectedPurchaseRequest] = (0, import_react43.useState)(null);
19907
19872
  const { success, error: showError, confirm: confirm2 } = useToast();
19908
- const { activeBusinessEntity } = useSession();
19873
+ const { activeBusinessEntity, loggedUser } = useSession();
19909
19874
  (0, import_react43.useEffect)(() => {
19910
19875
  }, []);
19911
19876
  const loadPurchaseRequests = async () => {
@@ -20017,7 +19982,7 @@ var PurchaseRequestsPage = () => {
20017
19982
  process: "PCR-PR",
20018
19983
  object_id: item.id,
20019
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, {}) }),
20020
- readOnly: false
19985
+ readOnly: loggedUser?.id !== item.created_by
20021
19986
  }
20022
19987
  );
20023
19988
  }
package/dist/index.js CHANGED
@@ -9542,13 +9542,12 @@ var FormVendor = ({
9542
9542
  }
9543
9543
  ),
9544
9544
  /* @__PURE__ */ jsx30(
9545
- TextInput,
9545
+ SelectLegalForm,
9546
9546
  {
9547
- label: "Forme juridique",
9548
- name: "legal_form",
9549
9547
  value: formData.legal_form || "",
9550
- placeholder: "SARL, SA, SAS, etc.",
9551
- onChange: handleInputChange
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
- TextInput,
10150
+ SelectLegalForm,
10152
10151
  {
10153
- label: "Forme juridique",
10154
- name: "legal_form",
10155
10152
  value: formData.legal_form || "",
10156
- placeholder: "SARL, SA, SAS, etc.",
10157
- onChange: handleInputChange
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, RotateCcw, Ban, Eye as Eye4, FileText as FileText6, History } from "lucide-react";
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__ */ jsx32(
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: saving ? "Enregistrement..." : "Enregistrer"
10960
+ children: [
10961
+ " ",
10962
+ saving ? "Enregistrement..." : "Enregistrer"
10963
+ ]
10999
10964
  }
11000
10965
  ),
11001
10966
  formData.status === "not-send" /* NOT_SEND */ && /* @__PURE__ */ jsx32(
@@ -18455,7 +18420,7 @@ var TaskPilot = () => {
18455
18420
  };
18456
18421
  var TaskPilot_default = TaskPilot;
18457
18422
 
18458
- // src/components/purchase-request/PurchaseRequestsPage.tsx
18423
+ // src/components/purchase-request/ProcuLink.tsx
18459
18424
  import { useEffect as useEffect29, useState as useState37 } from "react";
18460
18425
  import { ClipboardCheck, Plus as Plus9 } from "lucide-react";
18461
18426
 
@@ -19038,7 +19003,7 @@ var FormPurchaseRequest = ({
19038
19003
  const { success, error: showError } = useToast();
19039
19004
  const [showCatalogueSelector, setShowCatalogueSelector] = useState36(false);
19040
19005
  const [budgetInfo, setBudgetInfo] = useState36({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
19041
- const readonly = false;
19006
+ const readonly = object ? object.status !== "draft" : false;
19042
19007
  const fetchDepartmentBudget = async (departmentId) => {
19043
19008
  if (!departmentId) {
19044
19009
  setBudgetInfo({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
@@ -19611,7 +19576,7 @@ var FormPurchaseRequest = ({
19611
19576
  PrimaryButton,
19612
19577
  {
19613
19578
  type: "submit",
19614
- disabled: loading,
19579
+ disabled: loading || readonly,
19615
19580
  children: loading ? "chargement..." : "Enregistrer"
19616
19581
  }
19617
19582
  )
@@ -19826,7 +19791,7 @@ var PrintablePurchaseRequest = ({
19826
19791
  ] });
19827
19792
  };
19828
19793
 
19829
- // src/components/purchase-request/PurchaseRequestsPage.tsx
19794
+ // src/components/purchase-request/ProcuLink.tsx
19830
19795
  import { jsx as jsx60, jsxs as jsxs53 } from "react/jsx-runtime";
19831
19796
  var PurchaseRequestsPage = () => {
19832
19797
  const [refreshToggle, setRefreshToggle] = useState37(false);
@@ -19834,7 +19799,7 @@ var PurchaseRequestsPage = () => {
19834
19799
  const [showPrintPreview, setShowPrintPreview] = useState37(false);
19835
19800
  const [selectedPurchaseRequest, setSelectedPurchaseRequest] = useState37(null);
19836
19801
  const { success, error: showError, confirm: confirm2 } = useToast();
19837
- const { activeBusinessEntity } = useSession();
19802
+ const { activeBusinessEntity, loggedUser } = useSession();
19838
19803
  useEffect29(() => {
19839
19804
  }, []);
19840
19805
  const loadPurchaseRequests = async () => {
@@ -19946,7 +19911,7 @@ var PurchaseRequestsPage = () => {
19946
19911
  process: "PCR-PR",
19947
19912
  object_id: item.id,
19948
19913
  CustomBtn: (props) => /* @__PURE__ */ jsx60(Buttons_default, { className: "rounded-[6px] bg-gray-500 p-1 text-white", ...props, children: /* @__PURE__ */ jsx60(ClipboardCheck, {}) }),
19949
- readOnly: false
19914
+ readOnly: loggedUser?.id !== item.created_by
19950
19915
  }
19951
19916
  );
19952
19917
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ptechcore_ui",
3
- "version": "1.0.76",
3
+ "version": "1.0.77",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",