ptechcore_ui 1.0.36 → 1.0.39

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.js CHANGED
@@ -987,6 +987,7 @@ var SessionProvider = ({ children }) => {
987
987
  setActiveBusinessEntity(result.data.user.centers_access.find((item) => parseInt(item.id) === parseInt(saved_center_id)) || result.data.user.centers_access[0] || null);
988
988
  } else {
989
989
  setLoggedUser(null);
990
+ localStorage.removeItem("token");
990
991
  }
991
992
  }).catch(() => setLoggedUser(null));
992
993
  } else {
@@ -1757,8 +1758,8 @@ var getModuleUrls = (token) => {
1757
1758
  var MODULE_CODE_MAP = {
1758
1759
  "CRM": "WiseConnect",
1759
1760
  "MARKETING": "WiseReach",
1760
- "FACILITY": "WiseOps",
1761
- "SECURITY": "WiseGuard",
1761
+ "FACILITY": "WiseFm",
1762
+ "SECURITY": "WiseHSC",
1762
1763
  "THRIVE": "WiseThrive",
1763
1764
  "BI": "WiseView",
1764
1765
  "SOP": "WiseProcess",
@@ -1770,7 +1771,7 @@ var MODULE_CODE_MAP = {
1770
1771
  "PURCHASE": "WiseProcure",
1771
1772
  "HR": "WiseHR"
1772
1773
  };
1773
- var RewiseLayout = ({ children, module_name = "Rewise", module_description = "Description du module", primaryMenuItems, secondaryMenuItems }) => {
1774
+ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "", primaryMenuItems, secondaryMenuItems }) => {
1774
1775
  const location = useLocation();
1775
1776
  const navigate = useNavigate();
1776
1777
  const { theme, themeType, setTheme } = useTheme();
@@ -1918,7 +1919,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
1918
1919
  const isModuleActive = (moduleId) => selectedModule === moduleId;
1919
1920
  const getBreadcrumbs = () => {
1920
1921
  const paths = location.pathname.split("/").filter(Boolean);
1921
- const breadcrumbs = [{ label: "Accueil", path: "/" }];
1922
+ const breadcrumbs = [{ label: "Accueil", path: "/workspace/" }];
1922
1923
  paths.forEach((path, index) => {
1923
1924
  const fullPath = "/" + paths.slice(0, index + 1).join("/");
1924
1925
  const module = primaryMenuItems.find((m) => m.id === path);
@@ -2130,6 +2131,9 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2130
2131
  setSecondaryCollapsed(true);
2131
2132
  } else {
2132
2133
  setSelectedModule(item.id);
2134
+ if (secondaryMenuItems[item.id] && secondaryMenuItems[item.id].length > 0) {
2135
+ setSecondaryCollapsed(false);
2136
+ }
2133
2137
  }
2134
2138
  },
2135
2139
  className: cn(
@@ -2636,7 +2640,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2636
2640
  "button",
2637
2641
  {
2638
2642
  onClick: () => {
2639
- navigate("/settings");
2643
+ window.location.href = "https://core.rewise.praedium-tech.com/parameters/profit-cost-centers/";
2640
2644
  setShowUserMenu(false);
2641
2645
  },
2642
2646
  className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
@@ -2751,8 +2755,8 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2751
2755
  /* @__PURE__ */ jsx9("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-3", children: [
2752
2756
  { name: "WiseConnect", icon: crm_blue_default, iconWhite: crmwhite_default, url: moduleUrls.wiseConnect },
2753
2757
  { name: "WiseReach", icon: marketingblue_default, iconWhite: marketingblanc_default, url: moduleUrls.wiseReach },
2754
- { name: "WiseOps", icon: facilityblue_default, iconWhite: facilityblanc_default, url: moduleUrls.wiseOps },
2755
- { name: "WiseGuard", icon: security_managementblue_default, iconWhite: security_managementblanc_default, url: moduleUrls.wiseGuard }
2758
+ { name: "WiseFm", icon: facilityblue_default, iconWhite: facilityblanc_default, url: moduleUrls.wiseOps },
2759
+ { name: "WiseHSE", icon: security_managementblue_default, iconWhite: security_managementblanc_default, url: moduleUrls.wiseGuard }
2756
2760
  ].map((module) => /* @__PURE__ */ jsx9(
2757
2761
  "button",
2758
2762
  {
@@ -4721,6 +4725,7 @@ import { useEffect as useEffect8, useState as useState10 } from "react";
4721
4725
 
4722
4726
  // src/components/common/SearchableSelect.tsx
4723
4727
  import { useState as useState9, useRef as useRef2, useEffect as useEffect7 } from "react";
4728
+ import { createPortal as createPortal2 } from "react-dom";
4724
4729
  import { Search as Search3, ChevronDown as ChevronDown2, X as X6, RefreshCw as RefreshCw2, Plus as Plus2 } from "lucide-react";
4725
4730
  import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
4726
4731
  var SearchableSelect = ({
@@ -4738,7 +4743,9 @@ var SearchableSelect = ({
4738
4743
  }) => {
4739
4744
  const [isOpen, setIsOpen] = useState9(false);
4740
4745
  const [searchTerm, setSearchTerm] = useState9("");
4746
+ const [dropdownPosition, setDropdownPosition] = useState9({ top: 0, left: 0, width: 0 });
4741
4747
  const dropdownRef = useRef2(null);
4748
+ const dropdownMenuRef = useRef2(null);
4742
4749
  const inputRef = useRef2(null);
4743
4750
  const selectedOption = options.find((option) => option.value === value);
4744
4751
  const defaultFilter = (option, searchTerm2) => {
@@ -4747,9 +4754,22 @@ var SearchableSelect = ({
4747
4754
  const filteredOptions = options.filter(
4748
4755
  (option) => filterFunction ? filterFunction(option, searchTerm) : defaultFilter(option, searchTerm)
4749
4756
  );
4757
+ useEffect7(() => {
4758
+ if (isOpen && dropdownRef.current) {
4759
+ const rect = dropdownRef.current.getBoundingClientRect();
4760
+ setDropdownPosition({
4761
+ top: rect.bottom + window.scrollY,
4762
+ left: rect.left + window.scrollX,
4763
+ width: rect.width
4764
+ });
4765
+ }
4766
+ }, [isOpen]);
4750
4767
  useEffect7(() => {
4751
4768
  const handleClickOutside = (event) => {
4752
- if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
4769
+ const target = event.target;
4770
+ const isOutsideTrigger = dropdownRef.current && !dropdownRef.current.contains(target);
4771
+ const isOutsideMenu = dropdownMenuRef.current && !dropdownMenuRef.current.contains(target);
4772
+ if (isOutsideTrigger && isOutsideMenu) {
4753
4773
  setIsOpen(false);
4754
4774
  setSearchTerm("");
4755
4775
  }
@@ -4788,17 +4808,17 @@ var SearchableSelect = ({
4788
4808
  ${isOpen ? "ring-2 ring-[#6B7C92] border-transparent" : ""}
4789
4809
  `,
4790
4810
  children: /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between", children: [
4791
- /* @__PURE__ */ jsx13("div", { className: "flex items-center space-x-2 flex-1", children: selectedOption ? /* @__PURE__ */ jsxs10(Fragment5, { children: [
4811
+ /* @__PURE__ */ jsx13("div", { className: "flex items-center space-x-2 flex-1 min-w-0", children: selectedOption ? /* @__PURE__ */ jsxs10(Fragment5, { children: [
4792
4812
  selectedOption.image && /* @__PURE__ */ jsx13(
4793
4813
  "img",
4794
4814
  {
4795
4815
  src: selectedOption.image,
4796
4816
  alt: selectedOption.label,
4797
- className: "w-6 h-6 rounded-full object-cover"
4817
+ className: "w-6 h-6 rounded-full object-cover flex-shrink-0"
4798
4818
  }
4799
4819
  ),
4800
- selectedOption.content || /* @__PURE__ */ jsx13("span", { className: "text-gray-900", children: selectedOption.label })
4801
- ] }) : /* @__PURE__ */ jsx13("span", { className: "text-gray-400", children: placeholder }) }),
4820
+ selectedOption.content || /* @__PURE__ */ jsx13("span", { className: "text-gray-900 truncate", children: selectedOption.label })
4821
+ ] }) : /* @__PURE__ */ jsx13("span", { className: "text-gray-400 truncate", children: placeholder }) }),
4802
4822
  /* @__PURE__ */ jsxs10("div", { className: "flex items-center space-x-2", children: [
4803
4823
  allowClear && selectedOption && /* @__PURE__ */ jsx13(
4804
4824
  "button",
@@ -4820,64 +4840,80 @@ var SearchableSelect = ({
4820
4840
  ] })
4821
4841
  }
4822
4842
  ),
4823
- isOpen && /* @__PURE__ */ jsxs10("div", { className: "absolute z-50 w-full mt-1 bg-white border border-gray-200 rounded-lg shadow-lg", children: [
4824
- /* @__PURE__ */ jsxs10("div", { className: "p-3 border-b border-gray-200 flex", children: [
4825
- /* @__PURE__ */ jsxs10("div", { className: "relative w-full", children: [
4826
- /* @__PURE__ */ jsx13(Search3, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4" }),
4827
- /* @__PURE__ */ jsx13(
4828
- "input",
4829
- {
4830
- ref: inputRef,
4831
- type: "text",
4832
- placeholder: searchPlaceholder,
4833
- value: searchTerm,
4834
- onChange: (e) => setSearchTerm(e.target.value),
4835
- className: "w-full pl-10 pr-4 py-2 border border-gray-200 rounded-lg focus:ring-2 focus:ring-[#6B7C92] focus:border-transparent"
4836
- }
4837
- )
4838
- ] }),
4839
- /* @__PURE__ */ jsx13(
4840
- "button",
4841
- {
4842
- type: "button",
4843
- onClick: refresh,
4844
- disabled,
4845
- className: "px-3 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
4846
- title: "Rafra\xEEchir la liste",
4847
- children: /* @__PURE__ */ jsx13(RefreshCw2, { className: `w-4 h-4 ${disabled ? "animate-spin" : ""}` })
4848
- }
4849
- ),
4850
- addElement && /* @__PURE__ */ jsx13(
4851
- "button",
4852
- {
4853
- type: "button",
4854
- onClick: addElement,
4855
- className: "px-3 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
4856
- title: "Rafra\xEEchir la liste",
4857
- children: /* @__PURE__ */ jsx13(Plus2, { className: "w-4 h-4" })
4858
- }
4859
- )
4860
- ] }),
4861
- /* @__PURE__ */ jsx13("div", { className: "max-h-60 overflow-y-auto", children: filteredOptions.length > 0 ? filteredOptions.map((option) => /* @__PURE__ */ jsxs10(
4843
+ isOpen && createPortal2(
4844
+ /* @__PURE__ */ jsxs10(
4862
4845
  "div",
4863
4846
  {
4864
- onClick: () => handleSelect(option),
4865
- className: "px-4 py-3 hover:bg-gray-50 cursor-pointer flex items-center space-x-3",
4847
+ ref: dropdownMenuRef,
4848
+ className: "fixed bg-white border border-gray-200 rounded-lg shadow-lg",
4849
+ style: {
4850
+ top: dropdownPosition.top,
4851
+ left: dropdownPosition.left,
4852
+ width: dropdownPosition.width,
4853
+ zIndex: 9999
4854
+ },
4866
4855
  children: [
4867
- option.image && /* @__PURE__ */ jsx13(
4868
- "img",
4856
+ /* @__PURE__ */ jsxs10("div", { className: "p-3 border-b border-gray-200 flex", children: [
4857
+ /* @__PURE__ */ jsxs10("div", { className: "relative w-full", children: [
4858
+ /* @__PURE__ */ jsx13(Search3, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4" }),
4859
+ /* @__PURE__ */ jsx13(
4860
+ "input",
4861
+ {
4862
+ ref: inputRef,
4863
+ type: "text",
4864
+ placeholder: searchPlaceholder,
4865
+ value: searchTerm,
4866
+ onChange: (e) => setSearchTerm(e.target.value),
4867
+ className: "w-full pl-10 pr-4 py-2 border border-gray-200 rounded-lg focus:ring-2 focus:ring-[#6B7C92] focus:border-transparent"
4868
+ }
4869
+ )
4870
+ ] }),
4871
+ /* @__PURE__ */ jsx13(
4872
+ "button",
4873
+ {
4874
+ type: "button",
4875
+ onClick: refresh,
4876
+ disabled,
4877
+ className: "px-3 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
4878
+ title: "Rafra\xEEchir la liste",
4879
+ children: /* @__PURE__ */ jsx13(RefreshCw2, { className: `w-4 h-4 ${disabled ? "animate-spin" : ""}` })
4880
+ }
4881
+ ),
4882
+ addElement && /* @__PURE__ */ jsx13(
4883
+ "button",
4884
+ {
4885
+ type: "button",
4886
+ onClick: addElement,
4887
+ className: "px-3 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",
4888
+ title: "Ajouter un \xE9l\xE9ment",
4889
+ children: /* @__PURE__ */ jsx13(Plus2, { className: "w-4 h-4" })
4890
+ }
4891
+ )
4892
+ ] }),
4893
+ /* @__PURE__ */ jsx13("div", { className: "max-h-60 overflow-y-auto", children: filteredOptions.length > 0 ? filteredOptions.map((option) => /* @__PURE__ */ jsxs10(
4894
+ "div",
4869
4895
  {
4870
- src: option.image,
4871
- alt: option.label,
4872
- className: "w-8 h-8 rounded-full object-cover"
4873
- }
4874
- ),
4875
- option.content || /* @__PURE__ */ jsx13("span", { className: "text-gray-900", children: option.label })
4896
+ onClick: () => handleSelect(option),
4897
+ className: "px-4 py-3 hover:bg-gray-50 cursor-pointer flex items-center space-x-3",
4898
+ children: [
4899
+ option.image && /* @__PURE__ */ jsx13(
4900
+ "img",
4901
+ {
4902
+ src: option.image,
4903
+ alt: option.label,
4904
+ className: "w-8 h-8 rounded-full object-cover"
4905
+ }
4906
+ ),
4907
+ option.content || /* @__PURE__ */ jsx13("span", { className: "text-gray-900", children: option.label })
4908
+ ]
4909
+ },
4910
+ option.value
4911
+ )) : /* @__PURE__ */ jsx13("div", { className: "px-4 py-3 text-gray-500 text-center", children: "Aucun r\xE9sultat trouv\xE9" }) })
4876
4912
  ]
4877
- },
4878
- option.value
4879
- )) : /* @__PURE__ */ jsx13("div", { className: "px-4 py-3 text-gray-500 text-center", children: "Aucun r\xE9sultat trouv\xE9" }) })
4880
- ] })
4913
+ }
4914
+ ),
4915
+ document.body
4916
+ )
4881
4917
  ] });
4882
4918
  };
4883
4919
 
@@ -4945,7 +4981,10 @@ var PROFIT_URI = `${API_URL}/accounting/profit-center/`;
4945
4981
  import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
4946
4982
  var SelectVendor = ({
4947
4983
  value,
4948
- onSelect
4984
+ onSelect,
4985
+ allowClear,
4986
+ onRemove,
4987
+ label = "Ajouter un fournisseur"
4949
4988
  }) => {
4950
4989
  const [showModal, setShowModal] = useState10(false);
4951
4990
  const [selectedVendor, setSelectedVendor] = useState10(null);
@@ -4995,7 +5034,7 @@ var SelectVendor = ({
4995
5034
  loadVendors();
4996
5035
  };
4997
5036
  return /* @__PURE__ */ jsxs11("div", { children: [
4998
- /* @__PURE__ */ jsx14("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx14("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Ajouter un fournisseur" }) }),
5037
+ label && /* @__PURE__ */ jsx14("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx14("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: label }) }),
4999
5038
  /* @__PURE__ */ jsx14(
5000
5039
  SearchableSelect,
5001
5040
  {
@@ -5008,7 +5047,9 @@ var SelectVendor = ({
5008
5047
  refresh: handleRefresh,
5009
5048
  addElement: () => {
5010
5049
  setShowModal(true);
5011
- }
5050
+ },
5051
+ allowClear,
5052
+ onRemove
5012
5053
  },
5013
5054
  "fourni" + value
5014
5055
  ),
@@ -5027,7 +5068,10 @@ var SelectVendor = ({
5027
5068
  };
5028
5069
  var SelectUser = ({
5029
5070
  value,
5030
- onSelect
5071
+ onSelect,
5072
+ allowClear,
5073
+ onRemove,
5074
+ label = "S\xE9lectionner un utilisateur"
5031
5075
  }) => {
5032
5076
  const { token, activeBusinessEntity } = useSession();
5033
5077
  const [users, setUsers] = useState10(() => {
@@ -5083,7 +5127,7 @@ var SelectUser = ({
5083
5127
  }));
5084
5128
  };
5085
5129
  return /* @__PURE__ */ jsxs11("div", { children: [
5086
- /* @__PURE__ */ jsx14("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx14("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un utilisateur" }) }),
5130
+ label && /* @__PURE__ */ jsx14("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx14("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: label }) }),
5087
5131
  /* @__PURE__ */ jsx14(
5088
5132
  SearchableSelect,
5089
5133
  {
@@ -5093,7 +5137,9 @@ var SelectUser = ({
5093
5137
  searchPlaceholder: "Rechercher...",
5094
5138
  onSelect,
5095
5139
  disabled: loading,
5096
- refresh: handleRefresh
5140
+ refresh: handleRefresh,
5141
+ allowClear,
5142
+ onRemove
5097
5143
  },
5098
5144
  "user" + value
5099
5145
  ),
@@ -5102,7 +5148,10 @@ var SelectUser = ({
5102
5148
  };
5103
5149
  var SelectDepartment = ({
5104
5150
  value,
5105
- onSelect
5151
+ onSelect,
5152
+ allowClear,
5153
+ onRemove,
5154
+ label = "S\xE9lectionner un d\xE9partement"
5106
5155
  }) => {
5107
5156
  const { token, activeBusinessEntity } = useSession();
5108
5157
  const [departments, setDepartments] = useState10(() => {
@@ -5148,7 +5197,7 @@ var SelectDepartment = ({
5148
5197
  }));
5149
5198
  };
5150
5199
  return /* @__PURE__ */ jsxs11("div", { children: [
5151
- /* @__PURE__ */ jsx14("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx14("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un d\xE9partement" }) }),
5200
+ label && /* @__PURE__ */ jsx14("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx14("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: label }) }),
5152
5201
  /* @__PURE__ */ jsx14(
5153
5202
  SearchableSelect,
5154
5203
  {
@@ -5158,7 +5207,9 @@ var SelectDepartment = ({
5158
5207
  searchPlaceholder: "Rechercher...",
5159
5208
  onSelect,
5160
5209
  disabled: loading,
5161
- refresh: handleRefresh
5210
+ refresh: handleRefresh,
5211
+ allowClear,
5212
+ onRemove
5162
5213
  },
5163
5214
  "dept" + value
5164
5215
  ),
@@ -5167,7 +5218,10 @@ var SelectDepartment = ({
5167
5218
  };
5168
5219
  var SelectCostCenter = ({
5169
5220
  value,
5170
- onSelect
5221
+ onSelect,
5222
+ allowClear,
5223
+ onRemove,
5224
+ label = "S\xE9lectionner un centre de co\xFBt"
5171
5225
  }) => {
5172
5226
  const { token, activeBusinessEntity } = useSession();
5173
5227
  const [costCenters, setCostCenters] = useState10(() => {
@@ -5220,7 +5274,7 @@ var SelectCostCenter = ({
5220
5274
  }));
5221
5275
  };
5222
5276
  return /* @__PURE__ */ jsxs11("div", { children: [
5223
- /* @__PURE__ */ jsx14("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx14("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un centre de co\xFBt" }) }),
5277
+ label && /* @__PURE__ */ jsx14("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx14("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: label }) }),
5224
5278
  /* @__PURE__ */ jsx14(
5225
5279
  SearchableSelect,
5226
5280
  {
@@ -5230,7 +5284,9 @@ var SelectCostCenter = ({
5230
5284
  searchPlaceholder: "Rechercher...",
5231
5285
  onSelect,
5232
5286
  disabled: loading,
5233
- refresh: handleRefresh
5287
+ refresh: handleRefresh,
5288
+ allowClear,
5289
+ onRemove
5234
5290
  },
5235
5291
  "cost" + value
5236
5292
  ),
@@ -5239,7 +5295,10 @@ var SelectCostCenter = ({
5239
5295
  };
5240
5296
  var SelectUnit = ({
5241
5297
  value,
5242
- onSelect
5298
+ onSelect,
5299
+ allowClear,
5300
+ onRemove,
5301
+ label = "S\xE9lectionner une unit\xE9"
5243
5302
  }) => {
5244
5303
  const { token, activeBusinessEntity } = useSession();
5245
5304
  const [units, setUnits] = useState10(() => {
@@ -5294,7 +5353,7 @@ var SelectUnit = ({
5294
5353
  }));
5295
5354
  };
5296
5355
  return /* @__PURE__ */ jsxs11("div", { children: [
5297
- /* @__PURE__ */ jsx14("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx14("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner une unit\xE9" }) }),
5356
+ label && /* @__PURE__ */ jsx14("div", { className: "flex justify-between ", children: /* @__PURE__ */ jsx14("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: label }) }),
5298
5357
  /* @__PURE__ */ jsx14(
5299
5358
  SearchableSelect,
5300
5359
  {
@@ -5304,7 +5363,9 @@ var SelectUnit = ({
5304
5363
  searchPlaceholder: "Rechercher...",
5305
5364
  onSelect,
5306
5365
  disabled: loading,
5307
- refresh: handleRefresh
5366
+ refresh: handleRefresh,
5367
+ allowClear,
5368
+ onRemove
5308
5369
  },
5309
5370
  "unit" + value
5310
5371
  ),
@@ -5335,7 +5396,9 @@ var SelectAccount = ({
5335
5396
  filterClass,
5336
5397
  filterType,
5337
5398
  showInactive = false,
5338
- label = "Selectionner un compte"
5399
+ label = "Selectionner un compte",
5400
+ allowClear,
5401
+ onRemove
5339
5402
  }) => {
5340
5403
  const { token, activeBusinessEntity } = useSession();
5341
5404
  const [accounts, setAccounts] = useState10(() => {
@@ -5502,7 +5565,9 @@ var SelectAccount = ({
5502
5565
  onSelect,
5503
5566
  disabled: loading,
5504
5567
  refresh: handleRefresh,
5505
- addElement: handleOpenModal
5568
+ addElement: handleOpenModal,
5569
+ allowClear,
5570
+ onRemove
5506
5571
  },
5507
5572
  "account" + value
5508
5573
  ),
@@ -5612,7 +5677,10 @@ var SelectAccount = ({
5612
5677
  };
5613
5678
  var SelectClient = ({
5614
5679
  value,
5615
- onSelect
5680
+ onSelect,
5681
+ allowClear,
5682
+ onRemove,
5683
+ label = "S\xE9lectionner un client"
5616
5684
  }) => {
5617
5685
  const { token, activeBusinessEntity } = useSession();
5618
5686
  const [clients, setClients] = useState10(() => {
@@ -5662,7 +5730,7 @@ var SelectClient = ({
5662
5730
  loadClients();
5663
5731
  };
5664
5732
  return /* @__PURE__ */ jsxs11("div", { children: [
5665
- /* @__PURE__ */ jsx14("div", { className: "flex justify-between", children: /* @__PURE__ */ jsx14("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "S\xE9lectionner un client" }) }),
5733
+ label && /* @__PURE__ */ jsx14("div", { className: "flex justify-between", children: /* @__PURE__ */ jsx14("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: label }) }),
5666
5734
  /* @__PURE__ */ jsx14(
5667
5735
  SearchableSelect,
5668
5736
  {
@@ -5672,7 +5740,9 @@ var SelectClient = ({
5672
5740
  searchPlaceholder: "Rechercher...",
5673
5741
  onSelect,
5674
5742
  disabled: loading,
5675
- refresh: handleRefresh
5743
+ refresh: handleRefresh,
5744
+ allowClear,
5745
+ onRemove
5676
5746
  },
5677
5747
  "client" + value
5678
5748
  ),
@@ -10261,9 +10331,3839 @@ var formatCurrency = (amount, currency = "XOF", showDecimals = false) => {
10261
10331
  maximumFractionDigits: showDecimals ? 2 : 0
10262
10332
  }) + (currency ? ` ${currency}` : "");
10263
10333
  };
10334
+
10335
+ // src/components/common/ModernCard.tsx
10336
+ import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
10337
+ var ModernCard = ({
10338
+ children,
10339
+ className,
10340
+ hoverable = false,
10341
+ bordered = true,
10342
+ elevated = false,
10343
+ gradient = false,
10344
+ onClick
10345
+ }) => {
10346
+ return /* @__PURE__ */ jsx32(
10347
+ "div",
10348
+ {
10349
+ onClick,
10350
+ className: cn(
10351
+ "bg-[var(--color-surface)] rounded-xl transition-all duration-300",
10352
+ bordered && "border border-[var(--color-border)]",
10353
+ elevated && "shadow-[var(--shadow-md)]",
10354
+ hoverable && "hover:shadow-[var(--shadow-lg)] hover:-translate-y-1 cursor-pointer",
10355
+ gradient && "bg-gradient-to-br from-[var(--color-surface)] to-[var(--color-surface-hover)]",
10356
+ onClick && "cursor-pointer",
10357
+ className
10358
+ ),
10359
+ children
10360
+ }
10361
+ );
10362
+ };
10363
+ var CardHeader = ({
10364
+ title,
10365
+ subtitle,
10366
+ icon: Icon,
10367
+ action,
10368
+ className,
10369
+ children
10370
+ }) => {
10371
+ return /* @__PURE__ */ jsx32("div", { className: cn("p-4 border-b border-[var(--color-border-light)]", className), children: /* @__PURE__ */ jsxs27("div", { className: "flex items-start justify-between", children: [
10372
+ /* @__PURE__ */ jsxs27("div", { className: "flex items-start gap-4", children: [
10373
+ Icon && /* @__PURE__ */ jsx32("div", { className: "p-2 bg-[var(--color-primary-light)] rounded-lg", children: /* @__PURE__ */ jsx32(Icon, { className: "w-4 h-4 text-[var(--color-primary)]" }) }),
10374
+ /* @__PURE__ */ jsxs27("div", { children: [
10375
+ /* @__PURE__ */ jsx32("h3", { className: "text-lg font-semibold text-[var(--color-text-primary)]", children: title }),
10376
+ subtitle && /* @__PURE__ */ jsx32("p", { className: "mt-1 text-sm text-[var(--color-text-secondary)]", children: subtitle })
10377
+ ] })
10378
+ ] }),
10379
+ action && /* @__PURE__ */ jsx32("div", { children: action }),
10380
+ children
10381
+ ] }) });
10382
+ };
10383
+ var CardBody = ({
10384
+ children,
10385
+ className,
10386
+ noPadding = false
10387
+ }) => {
10388
+ return /* @__PURE__ */ jsx32("div", { className: cn(!noPadding && "p-4", className), children });
10389
+ };
10390
+ var StatCard = ({
10391
+ title,
10392
+ value,
10393
+ change,
10394
+ icon: Icon,
10395
+ color = "primary",
10396
+ className
10397
+ }) => {
10398
+ const colorClasses = {
10399
+ primary: "bg-[var(--color-primary-light)] text-[var(--color-primary)]",
10400
+ success: "bg-[var(--color-success-light)] text-[var(--color-success)]",
10401
+ warning: "bg-[var(--color-warning-light)] text-[var(--color-warning)]",
10402
+ error: "bg-[var(--color-error-light)] text-[var(--color-error)]",
10403
+ info: "bg-[var(--color-info-light)] text-[var(--color-info)]"
10404
+ };
10405
+ return /* @__PURE__ */ jsx32(ModernCard, { className: cn("p-4", className), hoverable: true, children: /* @__PURE__ */ jsxs27("div", { className: "flex items-start justify-between", children: [
10406
+ /* @__PURE__ */ jsxs27("div", { className: "flex-1", children: [
10407
+ /* @__PURE__ */ jsx32("p", { className: "text-sm font-medium text-[var(--color-text-secondary)]", children: title }),
10408
+ /* @__PURE__ */ jsx32("p", { className: "mt-2 text-3xl font-bold text-[var(--color-text-primary)]", children: value }),
10409
+ change && /* @__PURE__ */ jsxs27("div", { className: "mt-3 flex items-center gap-2", children: [
10410
+ /* @__PURE__ */ jsxs27("span", { className: cn(
10411
+ "text-sm font-medium",
10412
+ change.type === "increase" ? "text-[var(--color-success)]" : "text-[var(--color-error)]"
10413
+ ), children: [
10414
+ change.type === "increase" ? "\u2191" : "\u2193",
10415
+ " ",
10416
+ Math.abs(change.value),
10417
+ "%"
10418
+ ] }),
10419
+ /* @__PURE__ */ jsx32("span", { className: "text-xs text-[var(--color-text-tertiary)]", children: "vs p\xE9riode pr\xE9c\xE9dente" })
10420
+ ] })
10421
+ ] }),
10422
+ Icon && /* @__PURE__ */ jsx32("div", { className: cn("p-2.5 rounded-lg", colorClasses[color]), children: /* @__PURE__ */ jsx32(Icon, { className: "w-5 h-5" }) })
10423
+ ] }) });
10424
+ };
10425
+
10426
+ // src/services/WorkspaceServices.ts
10427
+ var WorkspaceServices = {
10428
+ /**
10429
+ * Récupère les données du workspace Procurement (Achats)
10430
+ */
10431
+ getProcurementWorkspace: async (businessEntityId) => {
10432
+ const params = new URLSearchParams();
10433
+ if (businessEntityId) {
10434
+ params.append("business_entity", businessEntityId);
10435
+ }
10436
+ const queryString = params.toString();
10437
+ const url = `${API_URL}/core/workspaces/procurement/${queryString ? `?${queryString}` : ""}`;
10438
+ const response = await FetchApi.get(url);
10439
+ if (!response.success) {
10440
+ throw new Error(response.message || "Erreur lors de la r\xE9cup\xE9ration des donn\xE9es du workspace");
10441
+ }
10442
+ return response.data;
10443
+ }
10444
+ };
10445
+
10446
+ // src/pages/workspaces/WorkSpace.tsx
10447
+ import { useState as useState25, useEffect as useEffect17, useMemo as useMemo2 } from "react";
10448
+ import {
10449
+ ShoppingCart as ShoppingCart2,
10450
+ Calculator as Calculator2,
10451
+ Users as Users5,
10452
+ Building2 as Building25,
10453
+ RefreshCw as RefreshCw8,
10454
+ ChevronDown as ChevronDown4,
10455
+ LayoutDashboard
10456
+ } from "lucide-react";
10457
+
10458
+ // src/pages/workspaces/PurchaseWorkspace.tsx
10459
+ import { useState as useState21, useEffect as useEffect13 } from "react";
10460
+ import {
10461
+ FileText as FileText7,
10462
+ ShoppingCart,
10463
+ Package,
10464
+ Clock as Clock2,
10465
+ Banknote,
10466
+ Users as Users2,
10467
+ Send as Send2,
10468
+ ArrowRight,
10469
+ RefreshCw as RefreshCw4,
10470
+ AlertTriangle as AlertTriangle3,
10471
+ FileCheck,
10472
+ Truck,
10473
+ ClipboardList
10474
+ } from "lucide-react";
10475
+ import { jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
10476
+ var formatCurrency2 = (amount) => {
10477
+ return new Intl.NumberFormat("fr-FR", {
10478
+ style: "decimal",
10479
+ minimumFractionDigits: 0,
10480
+ maximumFractionDigits: 0
10481
+ }).format(amount) + " FCFA";
10482
+ };
10483
+ var formatCurrencyShort = (amount) => {
10484
+ if (amount >= 1e6) {
10485
+ return `${(amount / 1e6).toFixed(1)}M FCFA`;
10486
+ } else if (amount >= 1e3) {
10487
+ return `${(amount / 1e3).toFixed(0)}k FCFA`;
10488
+ }
10489
+ return formatCurrency2(amount);
10490
+ };
10491
+ var formatRelativeTime = (timestamp) => {
10492
+ if (!timestamp) return "";
10493
+ const date = new Date(timestamp);
10494
+ const now = /* @__PURE__ */ new Date();
10495
+ const diffMs = now.getTime() - date.getTime();
10496
+ const diffMins = Math.floor(diffMs / 6e4);
10497
+ const diffHours = Math.floor(diffMs / 36e5);
10498
+ const diffDays = Math.floor(diffMs / 864e5);
10499
+ if (diffMins < 1) return "A l'instant";
10500
+ if (diffMins < 60) return `Il y a ${diffMins} min`;
10501
+ if (diffHours < 24) return `Il y a ${diffHours}h`;
10502
+ if (diffDays === 1) return "Hier";
10503
+ if (diffDays < 7) return `Il y a ${diffDays} jours`;
10504
+ return date.toLocaleDateString("fr-FR");
10505
+ };
10506
+ var PurchaseWorkspace = () => {
10507
+ const [stats, setStats] = useState21(null);
10508
+ const [recentActivities, setRecentActivities] = useState21([]);
10509
+ const [pendingTasks, setPendingTasks] = useState21([]);
10510
+ const [loading, setLoading] = useState21(true);
10511
+ const [error, setError] = useState21(null);
10512
+ useEffect13(() => {
10513
+ loadWorkspaceData();
10514
+ }, []);
10515
+ const loadWorkspaceData = async () => {
10516
+ setLoading(true);
10517
+ setError(null);
10518
+ try {
10519
+ const businessEntityId = localStorage.getItem("active_center_id") || void 0;
10520
+ const data = await WorkspaceServices.getProcurementWorkspace(businessEntityId);
10521
+ setStats(data);
10522
+ setRecentActivities(data.recent_activities || []);
10523
+ setPendingTasks(data.pending_tasks || []);
10524
+ } catch (err) {
10525
+ console.error("Erreur lors du chargement du workspace:", err);
10526
+ setError("Impossible de charger les donnees du workspace. Veuillez reessayer.");
10527
+ setStats({
10528
+ purchase_requests: {
10529
+ total: 0,
10530
+ draft: 0,
10531
+ pending_approval: 0,
10532
+ approved: 0,
10533
+ in_sourcing: 0,
10534
+ completed: 0,
10535
+ rejected: 0,
10536
+ trend: 0
10537
+ },
10538
+ rfqs: {
10539
+ total: 0,
10540
+ draft: 0,
10541
+ open: 0,
10542
+ pending_evaluation: 0,
10543
+ closed: 0
10544
+ },
10545
+ purchase_orders: {
10546
+ total: 0,
10547
+ pending_delivery: 0,
10548
+ delivered: 0,
10549
+ total_value: 0,
10550
+ trend: 0
10551
+ },
10552
+ receipts: {
10553
+ total: 0,
10554
+ pending_validation: 0,
10555
+ validated: 0
10556
+ },
10557
+ vendors: {
10558
+ total: 0,
10559
+ active: 0
10560
+ },
10561
+ alerts: {
10562
+ overdue_deliveries: 0,
10563
+ expiring_contracts: 0,
10564
+ pending_approvals: 0
10565
+ },
10566
+ recent_activities: [],
10567
+ pending_tasks: []
10568
+ });
10569
+ } finally {
10570
+ setLoading(false);
10571
+ }
10572
+ };
10573
+ const getPriorityColor = (priority) => {
10574
+ const colors = {
10575
+ low: "bg-[var(--color-border-light)] text-[var(--color-text-secondary)]",
10576
+ medium: "bg-[var(--color-info-light)] text-[var(--color-info)]",
10577
+ high: "bg-[var(--color-warning-light)] text-[var(--color-warning)]",
10578
+ critical: "bg-[var(--color-error-light)] text-[var(--color-error)]"
10579
+ };
10580
+ return colors[priority] || colors.medium;
10581
+ };
10582
+ const getActivityIcon = (type) => {
10583
+ const icons = {
10584
+ pr_created: /* @__PURE__ */ jsx33(FileText7, { className: "w-4 h-4" }),
10585
+ rfq_sent: /* @__PURE__ */ jsx33(Send2, { className: "w-4 h-4" }),
10586
+ quote_received: /* @__PURE__ */ jsx33(FileCheck, { className: "w-4 h-4" }),
10587
+ po_issued: /* @__PURE__ */ jsx33(ShoppingCart, { className: "w-4 h-4" }),
10588
+ receipt_created: /* @__PURE__ */ jsx33(Package, { className: "w-4 h-4" }),
10589
+ approval_pending: /* @__PURE__ */ jsx33(Clock2, { className: "w-4 h-4" })
10590
+ };
10591
+ return icons[type] || /* @__PURE__ */ jsx33(FileText7, { className: "w-4 h-4" });
10592
+ };
10593
+ const getActivityStatusColor = (status) => {
10594
+ const colors = {
10595
+ info: "bg-[var(--color-info-light)] text-[var(--color-info)]",
10596
+ success: "bg-[var(--color-success-light)] text-[var(--color-success)]",
10597
+ warning: "bg-[var(--color-warning-light)] text-[var(--color-warning)]",
10598
+ error: "bg-[var(--color-error-light)] text-[var(--color-error)]"
10599
+ };
10600
+ return colors[status] || colors.info;
10601
+ };
10602
+ if (loading) {
10603
+ return /* @__PURE__ */ jsx33("div", { className: "flex items-center justify-center h-96", children: /* @__PURE__ */ jsxs28("div", { className: "text-center", children: [
10604
+ /* @__PURE__ */ jsx33(RefreshCw4, { className: "w-12 h-12 text-[var(--color-primary)] animate-spin mx-auto mb-4" }),
10605
+ /* @__PURE__ */ jsx33("p", { className: "text-[var(--color-text-secondary)]", children: "Chargement du workspace Achats..." })
10606
+ ] }) });
10607
+ }
10608
+ if (!stats) return null;
10609
+ const ErrorBanner = error ? /* @__PURE__ */ jsx33("div", { className: "bg-[var(--color-error-light)] border border-[var(--color-error)] rounded-xl p-4 mb-6", children: /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-3", children: [
10610
+ /* @__PURE__ */ jsx33(AlertTriangle3, { className: "w-5 h-5 text-[var(--color-error)]" }),
10611
+ /* @__PURE__ */ jsx33("div", { className: "flex-1", children: /* @__PURE__ */ jsx33("p", { className: "text-sm text-[var(--color-error)]", children: error }) }),
10612
+ /* @__PURE__ */ jsx33(
10613
+ "button",
10614
+ {
10615
+ onClick: loadWorkspaceData,
10616
+ className: "text-sm text-[var(--color-error)] hover:underline font-medium",
10617
+ children: "Reessayer"
10618
+ }
10619
+ )
10620
+ ] }) }) : null;
10621
+ return /* @__PURE__ */ jsxs28("div", { className: "space-y-6", children: [
10622
+ ErrorBanner,
10623
+ (stats.alerts.overdue_deliveries > 0 || stats.alerts.expiring_contracts > 0 || stats.alerts.pending_approvals > 0) && /* @__PURE__ */ jsx33("div", { className: "bg-[var(--color-warning-light)] border border-[var(--color-warning)] rounded-xl p-4", children: /* @__PURE__ */ jsxs28("div", { className: "flex items-start space-x-3", children: [
10624
+ /* @__PURE__ */ jsx33(AlertTriangle3, { className: "w-5 h-5 text-[var(--color-warning)] mt-0.5" }),
10625
+ /* @__PURE__ */ jsxs28("div", { className: "flex-1", children: [
10626
+ /* @__PURE__ */ jsx33("h3", { className: "font-semibold text-[var(--color-text-primary)]", children: "Alertes necessitant votre attention" }),
10627
+ /* @__PURE__ */ jsxs28("div", { className: "mt-2 flex flex-wrap gap-4", children: [
10628
+ stats.alerts.overdue_deliveries > 0 && /* @__PURE__ */ jsxs28("span", { className: "text-sm text-[var(--color-warning)]", children: [
10629
+ /* @__PURE__ */ jsx33("strong", { children: stats.alerts.overdue_deliveries }),
10630
+ " livraisons en retard"
10631
+ ] }),
10632
+ stats.alerts.expiring_contracts > 0 && /* @__PURE__ */ jsxs28("span", { className: "text-sm text-[var(--color-warning)]", children: [
10633
+ /* @__PURE__ */ jsx33("strong", { children: stats.alerts.expiring_contracts }),
10634
+ " contrats expirant bientot"
10635
+ ] }),
10636
+ stats.alerts.pending_approvals > 0 && /* @__PURE__ */ jsxs28("span", { className: "text-sm text-[var(--color-warning)]", children: [
10637
+ /* @__PURE__ */ jsx33("strong", { children: stats.alerts.pending_approvals }),
10638
+ " approbations en attente"
10639
+ ] })
10640
+ ] })
10641
+ ] })
10642
+ ] }) }),
10643
+ /* @__PURE__ */ jsxs28("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6", children: [
10644
+ /* @__PURE__ */ jsx33(
10645
+ StatCard,
10646
+ {
10647
+ title: "Demandes d'achat",
10648
+ value: stats.purchase_requests.total,
10649
+ icon: FileText7,
10650
+ color: "primary",
10651
+ change: stats.purchase_requests.trend !== 0 ? {
10652
+ value: stats.purchase_requests.trend,
10653
+ type: stats.purchase_requests.trend > 0 ? "increase" : "decrease"
10654
+ } : void 0
10655
+ }
10656
+ ),
10657
+ /* @__PURE__ */ jsx33(
10658
+ StatCard,
10659
+ {
10660
+ title: "Appels d'offres actifs",
10661
+ value: stats.rfqs.open,
10662
+ icon: ClipboardList,
10663
+ color: "info"
10664
+ }
10665
+ ),
10666
+ /* @__PURE__ */ jsx33(
10667
+ StatCard,
10668
+ {
10669
+ title: "Commandes en cours",
10670
+ value: stats.purchase_orders.pending_delivery,
10671
+ icon: Truck,
10672
+ color: "warning"
10673
+ }
10674
+ ),
10675
+ /* @__PURE__ */ jsx33(
10676
+ StatCard,
10677
+ {
10678
+ title: "Budget engage",
10679
+ value: formatCurrencyShort(stats.purchase_orders.total_value),
10680
+ icon: Banknote,
10681
+ color: "success",
10682
+ change: stats.purchase_orders.trend !== 0 ? {
10683
+ value: stats.purchase_orders.trend,
10684
+ type: stats.purchase_orders.trend > 0 ? "increase" : "decrease"
10685
+ } : void 0
10686
+ }
10687
+ )
10688
+ ] }),
10689
+ /* @__PURE__ */ jsxs28("div", { className: "grid grid-cols-1 lg:grid-cols-3 gap-6", children: [
10690
+ /* @__PURE__ */ jsxs28("div", { className: "lg:col-span-2 space-y-6", children: [
10691
+ /* @__PURE__ */ jsxs28(ModernCard, { children: [
10692
+ /* @__PURE__ */ jsx33(
10693
+ CardHeader,
10694
+ {
10695
+ title: "Taches en attente",
10696
+ icon: Clock2,
10697
+ action: /* @__PURE__ */ jsxs28("button", { className: "text-sm text-[var(--color-primary)] hover:underline flex items-center", children: [
10698
+ "Voir tout ",
10699
+ /* @__PURE__ */ jsx33(ArrowRight, { className: "w-4 h-4 ml-1" })
10700
+ ] })
10701
+ }
10702
+ ),
10703
+ /* @__PURE__ */ jsx33(CardBody, { noPadding: true, children: /* @__PURE__ */ jsx33("div", { className: "divide-y divide-[var(--color-border-light)]", children: pendingTasks.map((task) => /* @__PURE__ */ jsxs28(
10704
+ "div",
10705
+ {
10706
+ className: "p-4 hover:bg-[var(--color-surface-hover)] transition-colors cursor-pointer flex items-center justify-between",
10707
+ children: [
10708
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-3", children: [
10709
+ /* @__PURE__ */ jsx33("span", { className: `px-2 py-1 text-xs font-medium rounded-full ${getPriorityColor(task.priority)}`, children: task.priority === "critical" ? "Critique" : task.priority === "high" ? "Haute" : task.priority === "medium" ? "Moyenne" : "Basse" }),
10710
+ /* @__PURE__ */ jsxs28("div", { children: [
10711
+ /* @__PURE__ */ jsx33("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: task.title }),
10712
+ /* @__PURE__ */ jsxs28("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: [
10713
+ "Echeance: ",
10714
+ task.dueDate
10715
+ ] })
10716
+ ] })
10717
+ ] }),
10718
+ /* @__PURE__ */ jsx33(ArrowRight, { className: "w-4 h-4 text-[var(--color-text-tertiary)]" })
10719
+ ]
10720
+ },
10721
+ task.id
10722
+ )) }) })
10723
+ ] }),
10724
+ /* @__PURE__ */ jsxs28("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
10725
+ /* @__PURE__ */ jsxs28(ModernCard, { children: [
10726
+ /* @__PURE__ */ jsx33(CardHeader, { title: "Demandes d'achat", icon: FileText7 }),
10727
+ /* @__PURE__ */ jsx33(CardBody, { children: /* @__PURE__ */ jsxs28("div", { className: "space-y-3", children: [
10728
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between p-3 bg-[var(--color-surface-hover)] rounded-lg", children: [
10729
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-2", children: [
10730
+ /* @__PURE__ */ jsx33("div", { className: "w-2 h-2 bg-[var(--color-text-tertiary)] rounded-full" }),
10731
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Brouillons" })
10732
+ ] }),
10733
+ /* @__PURE__ */ jsx33("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.purchase_requests.draft })
10734
+ ] }),
10735
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between p-3 bg-[var(--color-warning-light)] rounded-lg", children: [
10736
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-2", children: [
10737
+ /* @__PURE__ */ jsx33("div", { className: "w-2 h-2 bg-[var(--color-warning)] rounded-full" }),
10738
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-primary)]", children: "En attente d'approbation" })
10739
+ ] }),
10740
+ /* @__PURE__ */ jsx33("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.purchase_requests.pending_approval })
10741
+ ] }),
10742
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between p-3 bg-[var(--color-success-light)] rounded-lg", children: [
10743
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-2", children: [
10744
+ /* @__PURE__ */ jsx33("div", { className: "w-2 h-2 bg-[var(--color-success)] rounded-full" }),
10745
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Approuvees" })
10746
+ ] }),
10747
+ /* @__PURE__ */ jsx33("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.purchase_requests.approved })
10748
+ ] }),
10749
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between p-3 bg-[var(--color-info-light)] rounded-lg", children: [
10750
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-2", children: [
10751
+ /* @__PURE__ */ jsx33("div", { className: "w-2 h-2 bg-[var(--color-info)] rounded-full" }),
10752
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-primary)]", children: "En sourcing" })
10753
+ ] }),
10754
+ /* @__PURE__ */ jsx33("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.purchase_requests.in_sourcing })
10755
+ ] })
10756
+ ] }) })
10757
+ ] }),
10758
+ /* @__PURE__ */ jsxs28(ModernCard, { children: [
10759
+ /* @__PURE__ */ jsx33(CardHeader, { title: "Appels d'offres (RFQ)", icon: ClipboardList }),
10760
+ /* @__PURE__ */ jsx33(CardBody, { children: /* @__PURE__ */ jsxs28("div", { className: "space-y-3", children: [
10761
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between p-3 bg-[var(--color-info-light)] rounded-lg", children: [
10762
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-2", children: [
10763
+ /* @__PURE__ */ jsx33("div", { className: "w-2 h-2 bg-[var(--color-info)] rounded-full" }),
10764
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Ouverts" })
10765
+ ] }),
10766
+ /* @__PURE__ */ jsx33("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.rfqs.open })
10767
+ ] }),
10768
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between p-3 bg-[var(--color-secondary)] bg-opacity-10 rounded-lg", children: [
10769
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-2", children: [
10770
+ /* @__PURE__ */ jsx33("div", { className: "w-2 h-2 bg-[var(--color-secondary)] rounded-full" }),
10771
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-primary)]", children: "En evaluation" })
10772
+ ] }),
10773
+ /* @__PURE__ */ jsx33("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.rfqs.pending_evaluation })
10774
+ ] }),
10775
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between p-3 bg-[var(--color-success-light)] rounded-lg", children: [
10776
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-2", children: [
10777
+ /* @__PURE__ */ jsx33("div", { className: "w-2 h-2 bg-[var(--color-success)] rounded-full" }),
10778
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Clotures" })
10779
+ ] }),
10780
+ /* @__PURE__ */ jsx33("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.rfqs.closed })
10781
+ ] })
10782
+ ] }) })
10783
+ ] })
10784
+ ] })
10785
+ ] }),
10786
+ /* @__PURE__ */ jsxs28("div", { className: "space-y-6", children: [
10787
+ /* @__PURE__ */ jsxs28(ModernCard, { children: [
10788
+ /* @__PURE__ */ jsx33(
10789
+ CardHeader,
10790
+ {
10791
+ title: "Activites recentes",
10792
+ icon: Clock2,
10793
+ action: /* @__PURE__ */ jsx33("button", { className: "text-sm text-[var(--color-primary)] hover:underline", children: "Historique" })
10794
+ }
10795
+ ),
10796
+ /* @__PURE__ */ jsx33(CardBody, { noPadding: true, children: /* @__PURE__ */ jsx33("div", { className: "divide-y divide-[var(--color-border-light)]", children: recentActivities.map((activity) => /* @__PURE__ */ jsx33(
10797
+ "div",
10798
+ {
10799
+ className: "p-4 hover:bg-[var(--color-surface-hover)] transition-colors",
10800
+ children: /* @__PURE__ */ jsxs28("div", { className: "flex items-start space-x-3", children: [
10801
+ /* @__PURE__ */ jsx33("div", { className: `p-2 rounded-lg ${getActivityStatusColor(activity.status)}`, children: getActivityIcon(activity.type) }),
10802
+ /* @__PURE__ */ jsxs28("div", { className: "flex-1 min-w-0", children: [
10803
+ /* @__PURE__ */ jsx33("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: activity.title }),
10804
+ /* @__PURE__ */ jsx33("p", { className: "text-xs text-[var(--color-text-secondary)] truncate", children: activity.description }),
10805
+ /* @__PURE__ */ jsx33("p", { className: "text-xs text-[var(--color-text-tertiary)] mt-1", children: formatRelativeTime(activity.timestamp) })
10806
+ ] })
10807
+ ] })
10808
+ },
10809
+ activity.id
10810
+ )) }) })
10811
+ ] }),
10812
+ /* @__PURE__ */ jsxs28(ModernCard, { children: [
10813
+ /* @__PURE__ */ jsx33(CardHeader, { title: "Fournisseurs", icon: Users2 }),
10814
+ /* @__PURE__ */ jsx33(CardBody, { children: /* @__PURE__ */ jsxs28("div", { className: "text-center py-4", children: [
10815
+ /* @__PURE__ */ jsx33("p", { className: "text-4xl font-bold text-[var(--color-text-primary)]", children: stats.vendors.total }),
10816
+ /* @__PURE__ */ jsx33("p", { className: "text-sm text-[var(--color-text-secondary)] mt-1", children: "fournisseurs references" }),
10817
+ /* @__PURE__ */ jsxs28("div", { className: "mt-4 flex justify-center space-x-6", children: [
10818
+ /* @__PURE__ */ jsxs28("div", { children: [
10819
+ /* @__PURE__ */ jsx33("p", { className: "text-lg font-semibold text-[var(--color-success)]", children: stats.vendors.active }),
10820
+ /* @__PURE__ */ jsx33("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "Actifs" })
10821
+ ] }),
10822
+ /* @__PURE__ */ jsxs28("div", { children: [
10823
+ /* @__PURE__ */ jsx33("p", { className: "text-lg font-semibold text-[var(--color-text-tertiary)]", children: stats.vendors.total - stats.vendors.active }),
10824
+ /* @__PURE__ */ jsx33("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "Inactifs" })
10825
+ ] })
10826
+ ] })
10827
+ ] }) })
10828
+ ] }),
10829
+ /* @__PURE__ */ jsxs28(ModernCard, { children: [
10830
+ /* @__PURE__ */ jsx33(CardHeader, { title: "Receptions", icon: Package }),
10831
+ /* @__PURE__ */ jsx33(CardBody, { children: /* @__PURE__ */ jsxs28("div", { className: "space-y-3", children: [
10832
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
10833
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "En attente de validation" }),
10834
+ /* @__PURE__ */ jsx33("span", { className: "px-2 py-1 text-xs font-medium bg-[var(--color-warning-light)] text-[var(--color-warning)] rounded-full", children: stats.receipts.pending_validation })
10835
+ ] }),
10836
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
10837
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Validees ce mois" }),
10838
+ /* @__PURE__ */ jsx33("span", { className: "px-2 py-1 text-xs font-medium bg-[var(--color-success-light)] text-[var(--color-success)] rounded-full", children: stats.receipts.validated })
10839
+ ] })
10840
+ ] }) })
10841
+ ] })
10842
+ ] })
10843
+ ] })
10844
+ ] });
10845
+ };
10846
+ var PurchaseWorkspace_default = PurchaseWorkspace;
10847
+
10848
+ // src/pages/workspaces/AccountingWorkspace.tsx
10849
+ import { useState as useState22, useEffect as useEffect14 } from "react";
10850
+ import {
10851
+ TrendingUp,
10852
+ TrendingDown,
10853
+ Banknote as Banknote2,
10854
+ ArrowRight as ArrowRight2,
10855
+ RefreshCw as RefreshCw5,
10856
+ AlertTriangle as AlertTriangle4,
10857
+ BookOpen,
10858
+ Receipt,
10859
+ PiggyBank,
10860
+ CreditCard as CreditCard3
10861
+ } from "lucide-react";
10862
+ import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
10863
+ var formatCurrency3 = (amount) => {
10864
+ return new Intl.NumberFormat("fr-FR", {
10865
+ style: "decimal",
10866
+ minimumFractionDigits: 0,
10867
+ maximumFractionDigits: 0
10868
+ }).format(amount) + " FCFA";
10869
+ };
10870
+ var formatCurrencyShort2 = (amount) => {
10871
+ if (amount >= 1e6) {
10872
+ return `${(amount / 1e6).toFixed(1)}M FCFA`;
10873
+ } else if (amount >= 1e3) {
10874
+ return `${(amount / 1e3).toFixed(0)}k FCFA`;
10875
+ }
10876
+ return formatCurrency3(amount);
10877
+ };
10878
+ var AccountingWorkspace = () => {
10879
+ const [stats, setStats] = useState22(null);
10880
+ const [loading, setLoading] = useState22(true);
10881
+ const [error, setError] = useState22(null);
10882
+ useEffect14(() => {
10883
+ loadWorkspaceData();
10884
+ }, []);
10885
+ const loadWorkspaceData = async () => {
10886
+ setLoading(true);
10887
+ setError(null);
10888
+ try {
10889
+ await new Promise((resolve) => setTimeout(resolve, 500));
10890
+ setStats({
10891
+ journal_entries: {
10892
+ total: 0,
10893
+ draft: 0,
10894
+ pending_validation: 0,
10895
+ validated: 0,
10896
+ trend: 0
10897
+ },
10898
+ invoices: {
10899
+ receivable: 0,
10900
+ payable: 0,
10901
+ overdue_receivable: 0,
10902
+ overdue_payable: 0
10903
+ },
10904
+ cash_flow: {
10905
+ inflow: 0,
10906
+ outflow: 0,
10907
+ balance: 0
10908
+ },
10909
+ bank_reconciliation: {
10910
+ pending: 0,
10911
+ reconciled: 0
10912
+ },
10913
+ alerts: {
10914
+ unbalanced_entries: 0,
10915
+ overdue_invoices: 0,
10916
+ pending_approvals: 0
10917
+ }
10918
+ });
10919
+ } catch (err) {
10920
+ console.error("Erreur lors du chargement du workspace:", err);
10921
+ setError("Impossible de charger les donnees du workspace comptabilite.");
10922
+ } finally {
10923
+ setLoading(false);
10924
+ }
10925
+ };
10926
+ if (loading) {
10927
+ return /* @__PURE__ */ jsx34("div", { className: "flex items-center justify-center h-96", children: /* @__PURE__ */ jsxs29("div", { className: "text-center", children: [
10928
+ /* @__PURE__ */ jsx34(RefreshCw5, { className: "w-12 h-12 text-[var(--color-primary)] animate-spin mx-auto mb-4" }),
10929
+ /* @__PURE__ */ jsx34("p", { className: "text-[var(--color-text-secondary)]", children: "Chargement du workspace Comptabilite..." })
10930
+ ] }) });
10931
+ }
10932
+ if (!stats) return null;
10933
+ const ErrorBanner = error ? /* @__PURE__ */ jsx34("div", { className: "bg-[var(--color-error-light)] border border-[var(--color-error)] rounded-xl p-4 mb-6", children: /* @__PURE__ */ jsxs29("div", { className: "flex items-center space-x-3", children: [
10934
+ /* @__PURE__ */ jsx34(AlertTriangle4, { className: "w-5 h-5 text-[var(--color-error)]" }),
10935
+ /* @__PURE__ */ jsx34("div", { className: "flex-1", children: /* @__PURE__ */ jsx34("p", { className: "text-sm text-[var(--color-error)]", children: error }) }),
10936
+ /* @__PURE__ */ jsx34(
10937
+ "button",
10938
+ {
10939
+ onClick: loadWorkspaceData,
10940
+ className: "text-sm text-[var(--color-error)] hover:underline font-medium",
10941
+ children: "Reessayer"
10942
+ }
10943
+ )
10944
+ ] }) }) : null;
10945
+ return /* @__PURE__ */ jsxs29("div", { className: "space-y-6", children: [
10946
+ ErrorBanner,
10947
+ (stats.alerts.unbalanced_entries > 0 || stats.alerts.overdue_invoices > 0 || stats.alerts.pending_approvals > 0) && /* @__PURE__ */ jsx34("div", { className: "bg-[var(--color-warning-light)] border border-[var(--color-warning)] rounded-xl p-4", children: /* @__PURE__ */ jsxs29("div", { className: "flex items-start space-x-3", children: [
10948
+ /* @__PURE__ */ jsx34(AlertTriangle4, { className: "w-5 h-5 text-[var(--color-warning)] mt-0.5" }),
10949
+ /* @__PURE__ */ jsxs29("div", { className: "flex-1", children: [
10950
+ /* @__PURE__ */ jsx34("h3", { className: "font-semibold text-[var(--color-text-primary)]", children: "Alertes comptables" }),
10951
+ /* @__PURE__ */ jsxs29("div", { className: "mt-2 flex flex-wrap gap-4", children: [
10952
+ stats.alerts.unbalanced_entries > 0 && /* @__PURE__ */ jsxs29("span", { className: "text-sm text-[var(--color-warning)]", children: [
10953
+ /* @__PURE__ */ jsx34("strong", { children: stats.alerts.unbalanced_entries }),
10954
+ " ecritures non equilibrees"
10955
+ ] }),
10956
+ stats.alerts.overdue_invoices > 0 && /* @__PURE__ */ jsxs29("span", { className: "text-sm text-[var(--color-warning)]", children: [
10957
+ /* @__PURE__ */ jsx34("strong", { children: stats.alerts.overdue_invoices }),
10958
+ " factures en retard"
10959
+ ] }),
10960
+ stats.alerts.pending_approvals > 0 && /* @__PURE__ */ jsxs29("span", { className: "text-sm text-[var(--color-warning)]", children: [
10961
+ /* @__PURE__ */ jsx34("strong", { children: stats.alerts.pending_approvals }),
10962
+ " validations en attente"
10963
+ ] })
10964
+ ] })
10965
+ ] })
10966
+ ] }) }),
10967
+ /* @__PURE__ */ jsxs29("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6", children: [
10968
+ /* @__PURE__ */ jsx34(
10969
+ StatCard,
10970
+ {
10971
+ title: "Ecritures comptables",
10972
+ value: stats.journal_entries.total,
10973
+ icon: BookOpen,
10974
+ color: "primary",
10975
+ change: stats.journal_entries.trend !== 0 ? {
10976
+ value: stats.journal_entries.trend,
10977
+ type: stats.journal_entries.trend > 0 ? "increase" : "decrease"
10978
+ } : void 0
10979
+ }
10980
+ ),
10981
+ /* @__PURE__ */ jsx34(
10982
+ StatCard,
10983
+ {
10984
+ title: "Creances clients",
10985
+ value: formatCurrencyShort2(stats.invoices.receivable),
10986
+ icon: TrendingUp,
10987
+ color: "success"
10988
+ }
10989
+ ),
10990
+ /* @__PURE__ */ jsx34(
10991
+ StatCard,
10992
+ {
10993
+ title: "Dettes fournisseurs",
10994
+ value: formatCurrencyShort2(stats.invoices.payable),
10995
+ icon: TrendingDown,
10996
+ color: "warning"
10997
+ }
10998
+ ),
10999
+ /* @__PURE__ */ jsx34(
11000
+ StatCard,
11001
+ {
11002
+ title: "Solde tresorerie",
11003
+ value: formatCurrencyShort2(stats.cash_flow.balance),
11004
+ icon: PiggyBank,
11005
+ color: "info"
11006
+ }
11007
+ )
11008
+ ] }),
11009
+ /* @__PURE__ */ jsxs29("div", { className: "grid grid-cols-1 lg:grid-cols-3 gap-6", children: [
11010
+ /* @__PURE__ */ jsxs29("div", { className: "lg:col-span-2 space-y-6", children: [
11011
+ /* @__PURE__ */ jsxs29(ModernCard, { children: [
11012
+ /* @__PURE__ */ jsx34(
11013
+ CardHeader,
11014
+ {
11015
+ title: "Ecritures comptables",
11016
+ icon: BookOpen,
11017
+ action: /* @__PURE__ */ jsxs29("button", { className: "text-sm text-[var(--color-primary)] hover:underline flex items-center", children: [
11018
+ "Voir tout ",
11019
+ /* @__PURE__ */ jsx34(ArrowRight2, { className: "w-4 h-4 ml-1" })
11020
+ ] })
11021
+ }
11022
+ ),
11023
+ /* @__PURE__ */ jsx34(CardBody, { children: /* @__PURE__ */ jsxs29("div", { className: "grid grid-cols-3 gap-4", children: [
11024
+ /* @__PURE__ */ jsxs29("div", { className: "p-4 bg-[var(--color-surface-hover)] rounded-lg text-center", children: [
11025
+ /* @__PURE__ */ jsx34("p", { className: "text-2xl font-bold text-[var(--color-text-tertiary)]", children: stats.journal_entries.draft }),
11026
+ /* @__PURE__ */ jsx34("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Brouillons" })
11027
+ ] }),
11028
+ /* @__PURE__ */ jsxs29("div", { className: "p-4 bg-[var(--color-warning-light)] rounded-lg text-center", children: [
11029
+ /* @__PURE__ */ jsx34("p", { className: "text-2xl font-bold text-[var(--color-warning)]", children: stats.journal_entries.pending_validation }),
11030
+ /* @__PURE__ */ jsx34("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "A valider" })
11031
+ ] }),
11032
+ /* @__PURE__ */ jsxs29("div", { className: "p-4 bg-[var(--color-success-light)] rounded-lg text-center", children: [
11033
+ /* @__PURE__ */ jsx34("p", { className: "text-2xl font-bold text-[var(--color-success)]", children: stats.journal_entries.validated }),
11034
+ /* @__PURE__ */ jsx34("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Validees" })
11035
+ ] })
11036
+ ] }) })
11037
+ ] }),
11038
+ /* @__PURE__ */ jsxs29(ModernCard, { children: [
11039
+ /* @__PURE__ */ jsx34(CardHeader, { title: "Flux de tresorerie (ce mois)", icon: Banknote2 }),
11040
+ /* @__PURE__ */ jsx34(CardBody, { children: /* @__PURE__ */ jsxs29("div", { className: "grid grid-cols-3 gap-4", children: [
11041
+ /* @__PURE__ */ jsxs29("div", { className: "p-4 bg-[var(--color-success-light)] rounded-lg", children: [
11042
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center space-x-2 mb-2", children: [
11043
+ /* @__PURE__ */ jsx34(TrendingUp, { className: "w-5 h-5 text-[var(--color-success)]" }),
11044
+ /* @__PURE__ */ jsx34("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Entrees" })
11045
+ ] }),
11046
+ /* @__PURE__ */ jsx34("p", { className: "text-xl font-bold text-[var(--color-success)]", children: formatCurrencyShort2(stats.cash_flow.inflow) })
11047
+ ] }),
11048
+ /* @__PURE__ */ jsxs29("div", { className: "p-4 bg-[var(--color-error-light)] rounded-lg", children: [
11049
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center space-x-2 mb-2", children: [
11050
+ /* @__PURE__ */ jsx34(TrendingDown, { className: "w-5 h-5 text-[var(--color-error)]" }),
11051
+ /* @__PURE__ */ jsx34("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Sorties" })
11052
+ ] }),
11053
+ /* @__PURE__ */ jsx34("p", { className: "text-xl font-bold text-[var(--color-error)]", children: formatCurrencyShort2(stats.cash_flow.outflow) })
11054
+ ] }),
11055
+ /* @__PURE__ */ jsxs29("div", { className: "p-4 bg-[var(--color-info-light)] rounded-lg", children: [
11056
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center space-x-2 mb-2", children: [
11057
+ /* @__PURE__ */ jsx34(PiggyBank, { className: "w-5 h-5 text-[var(--color-info)]" }),
11058
+ /* @__PURE__ */ jsx34("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Solde" })
11059
+ ] }),
11060
+ /* @__PURE__ */ jsx34("p", { className: "text-xl font-bold text-[var(--color-info)]", children: formatCurrencyShort2(stats.cash_flow.balance) })
11061
+ ] })
11062
+ ] }) })
11063
+ ] })
11064
+ ] }),
11065
+ /* @__PURE__ */ jsxs29("div", { className: "space-y-6", children: [
11066
+ /* @__PURE__ */ jsxs29(ModernCard, { children: [
11067
+ /* @__PURE__ */ jsx34(CardHeader, { title: "Factures en cours", icon: Receipt }),
11068
+ /* @__PURE__ */ jsx34(CardBody, { children: /* @__PURE__ */ jsxs29("div", { className: "space-y-4", children: [
11069
+ /* @__PURE__ */ jsxs29("div", { children: [
11070
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between mb-2", children: [
11071
+ /* @__PURE__ */ jsx34("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Creances clients" }),
11072
+ /* @__PURE__ */ jsx34("span", { className: "font-semibold text-[var(--color-success)]", children: formatCurrencyShort2(stats.invoices.receivable) })
11073
+ ] }),
11074
+ stats.invoices.overdue_receivable > 0 && /* @__PURE__ */ jsxs29("div", { className: "text-xs text-[var(--color-error)] flex items-center space-x-1", children: [
11075
+ /* @__PURE__ */ jsx34(AlertTriangle4, { className: "w-3 h-3" }),
11076
+ /* @__PURE__ */ jsxs29("span", { children: [
11077
+ "Dont ",
11078
+ formatCurrencyShort2(stats.invoices.overdue_receivable),
11079
+ " en retard"
11080
+ ] })
11081
+ ] })
11082
+ ] }),
11083
+ /* @__PURE__ */ jsxs29("div", { className: "border-t border-[var(--color-border-light)] pt-4", children: [
11084
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between mb-2", children: [
11085
+ /* @__PURE__ */ jsx34("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Dettes fournisseurs" }),
11086
+ /* @__PURE__ */ jsx34("span", { className: "font-semibold text-[var(--color-warning)]", children: formatCurrencyShort2(stats.invoices.payable) })
11087
+ ] }),
11088
+ stats.invoices.overdue_payable > 0 && /* @__PURE__ */ jsxs29("div", { className: "text-xs text-[var(--color-error)] flex items-center space-x-1", children: [
11089
+ /* @__PURE__ */ jsx34(AlertTriangle4, { className: "w-3 h-3" }),
11090
+ /* @__PURE__ */ jsxs29("span", { children: [
11091
+ "Dont ",
11092
+ formatCurrencyShort2(stats.invoices.overdue_payable),
11093
+ " en retard"
11094
+ ] })
11095
+ ] })
11096
+ ] })
11097
+ ] }) })
11098
+ ] }),
11099
+ /* @__PURE__ */ jsxs29(ModernCard, { children: [
11100
+ /* @__PURE__ */ jsx34(CardHeader, { title: "Rapprochement bancaire", icon: CreditCard3 }),
11101
+ /* @__PURE__ */ jsx34(CardBody, { children: /* @__PURE__ */ jsxs29("div", { className: "space-y-3", children: [
11102
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between", children: [
11103
+ /* @__PURE__ */ jsx34("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Operations a pointer" }),
11104
+ /* @__PURE__ */ jsx34("span", { className: "px-2 py-1 text-xs font-medium bg-[var(--color-warning-light)] text-[var(--color-warning)] rounded-full", children: stats.bank_reconciliation.pending })
11105
+ ] }),
11106
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between", children: [
11107
+ /* @__PURE__ */ jsx34("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Operations pointees" }),
11108
+ /* @__PURE__ */ jsx34("span", { className: "px-2 py-1 text-xs font-medium bg-[var(--color-success-light)] text-[var(--color-success)] rounded-full", children: stats.bank_reconciliation.reconciled })
11109
+ ] })
11110
+ ] }) })
11111
+ ] })
11112
+ ] })
11113
+ ] })
11114
+ ] });
11115
+ };
11116
+ var AccountingWorkspace_default = AccountingWorkspace;
11117
+
11118
+ // src/pages/workspaces/CrmWorkspace.tsx
11119
+ import { useState as useState23, useEffect as useEffect15 } from "react";
11120
+ import {
11121
+ Users as Users3,
11122
+ UserPlus,
11123
+ Target as Target2,
11124
+ TrendingUp as TrendingUp2,
11125
+ Banknote as Banknote3,
11126
+ ArrowRight as ArrowRight3,
11127
+ RefreshCw as RefreshCw6,
11128
+ AlertTriangle as AlertTriangle5,
11129
+ Phone as Phone2,
11130
+ Mail as Mail2,
11131
+ Calendar as Calendar2,
11132
+ Activity
11133
+ } from "lucide-react";
11134
+ import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
11135
+ var formatCurrencyShort3 = (amount) => {
11136
+ if (amount >= 1e6) {
11137
+ return `${(amount / 1e6).toFixed(1)}M FCFA`;
11138
+ } else if (amount >= 1e3) {
11139
+ return `${(amount / 1e3).toFixed(0)}k FCFA`;
11140
+ }
11141
+ return `${amount.toLocaleString("fr-FR")} FCFA`;
11142
+ };
11143
+ var CrmWorkspace = () => {
11144
+ const [stats, setStats] = useState23(null);
11145
+ const [recentContacts, setRecentContacts] = useState23([]);
11146
+ const [loading, setLoading] = useState23(true);
11147
+ const [error, setError] = useState23(null);
11148
+ useEffect15(() => {
11149
+ loadWorkspaceData();
11150
+ }, []);
11151
+ const loadWorkspaceData = async () => {
11152
+ setLoading(true);
11153
+ setError(null);
11154
+ try {
11155
+ await new Promise((resolve) => setTimeout(resolve, 500));
11156
+ setStats({
11157
+ clients: {
11158
+ total: 0,
11159
+ active: 0,
11160
+ new_this_month: 0,
11161
+ trend: 0
11162
+ },
11163
+ opportunities: {
11164
+ total: 0,
11165
+ qualified: 0,
11166
+ negotiation: 0,
11167
+ won: 0,
11168
+ lost: 0,
11169
+ total_value: 0
11170
+ },
11171
+ activities: {
11172
+ pending_calls: 0,
11173
+ pending_meetings: 0,
11174
+ pending_emails: 0,
11175
+ overdue: 0
11176
+ },
11177
+ revenue: {
11178
+ monthly: 0,
11179
+ quarterly: 0,
11180
+ trend: 0
11181
+ },
11182
+ alerts: {
11183
+ overdue_activities: 0,
11184
+ expiring_opportunities: 0,
11185
+ inactive_clients: 0
11186
+ }
11187
+ });
11188
+ setRecentContacts([]);
11189
+ } catch (err) {
11190
+ console.error("Erreur lors du chargement du workspace:", err);
11191
+ setError("Impossible de charger les donnees du workspace CRM.");
11192
+ } finally {
11193
+ setLoading(false);
11194
+ }
11195
+ };
11196
+ const getStatusColor = (status) => {
11197
+ const colors = {
11198
+ hot: "bg-[var(--color-error-light)] text-[var(--color-error)]",
11199
+ warm: "bg-[var(--color-warning-light)] text-[var(--color-warning)]",
11200
+ cold: "bg-[var(--color-info-light)] text-[var(--color-info)]"
11201
+ };
11202
+ return colors[status] || colors.cold;
11203
+ };
11204
+ const getStatusLabel = (status) => {
11205
+ const labels = { hot: "Chaud", warm: "Tiede", cold: "Froid" };
11206
+ return labels[status] || status;
11207
+ };
11208
+ if (loading) {
11209
+ return /* @__PURE__ */ jsx35("div", { className: "flex items-center justify-center h-96", children: /* @__PURE__ */ jsxs30("div", { className: "text-center", children: [
11210
+ /* @__PURE__ */ jsx35(RefreshCw6, { className: "w-12 h-12 text-[var(--color-primary)] animate-spin mx-auto mb-4" }),
11211
+ /* @__PURE__ */ jsx35("p", { className: "text-[var(--color-text-secondary)]", children: "Chargement du workspace CRM..." })
11212
+ ] }) });
11213
+ }
11214
+ if (!stats) return null;
11215
+ const ErrorBanner = error ? /* @__PURE__ */ jsx35("div", { className: "bg-[var(--color-error-light)] border border-[var(--color-error)] rounded-xl p-4 mb-6", children: /* @__PURE__ */ jsxs30("div", { className: "flex items-center space-x-3", children: [
11216
+ /* @__PURE__ */ jsx35(AlertTriangle5, { className: "w-5 h-5 text-[var(--color-error)]" }),
11217
+ /* @__PURE__ */ jsx35("div", { className: "flex-1", children: /* @__PURE__ */ jsx35("p", { className: "text-sm text-[var(--color-error)]", children: error }) }),
11218
+ /* @__PURE__ */ jsx35(
11219
+ "button",
11220
+ {
11221
+ onClick: loadWorkspaceData,
11222
+ className: "text-sm text-[var(--color-error)] hover:underline font-medium",
11223
+ children: "Reessayer"
11224
+ }
11225
+ )
11226
+ ] }) }) : null;
11227
+ return /* @__PURE__ */ jsxs30("div", { className: "space-y-6", children: [
11228
+ ErrorBanner,
11229
+ (stats.alerts.overdue_activities > 0 || stats.alerts.expiring_opportunities > 0) && /* @__PURE__ */ jsx35("div", { className: "bg-[var(--color-warning-light)] border border-[var(--color-warning)] rounded-xl p-4", children: /* @__PURE__ */ jsxs30("div", { className: "flex items-start space-x-3", children: [
11230
+ /* @__PURE__ */ jsx35(AlertTriangle5, { className: "w-5 h-5 text-[var(--color-warning)] mt-0.5" }),
11231
+ /* @__PURE__ */ jsxs30("div", { className: "flex-1", children: [
11232
+ /* @__PURE__ */ jsx35("h3", { className: "font-semibold text-[var(--color-text-primary)]", children: "Alertes CRM" }),
11233
+ /* @__PURE__ */ jsxs30("div", { className: "mt-2 flex flex-wrap gap-4", children: [
11234
+ stats.alerts.overdue_activities > 0 && /* @__PURE__ */ jsxs30("span", { className: "text-sm text-[var(--color-warning)]", children: [
11235
+ /* @__PURE__ */ jsx35("strong", { children: stats.alerts.overdue_activities }),
11236
+ " activites en retard"
11237
+ ] }),
11238
+ stats.alerts.expiring_opportunities > 0 && /* @__PURE__ */ jsxs30("span", { className: "text-sm text-[var(--color-warning)]", children: [
11239
+ /* @__PURE__ */ jsx35("strong", { children: stats.alerts.expiring_opportunities }),
11240
+ " opportunites a relancer"
11241
+ ] }),
11242
+ stats.alerts.inactive_clients > 0 && /* @__PURE__ */ jsxs30("span", { className: "text-sm text-[var(--color-warning)]", children: [
11243
+ /* @__PURE__ */ jsx35("strong", { children: stats.alerts.inactive_clients }),
11244
+ " clients inactifs"
11245
+ ] })
11246
+ ] })
11247
+ ] })
11248
+ ] }) }),
11249
+ /* @__PURE__ */ jsxs30("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6", children: [
11250
+ /* @__PURE__ */ jsx35(
11251
+ StatCard,
11252
+ {
11253
+ title: "Clients actifs",
11254
+ value: stats.clients.active,
11255
+ icon: Users3,
11256
+ color: "primary",
11257
+ change: stats.clients.trend !== 0 ? {
11258
+ value: stats.clients.trend,
11259
+ type: stats.clients.trend > 0 ? "increase" : "decrease"
11260
+ } : void 0
11261
+ }
11262
+ ),
11263
+ /* @__PURE__ */ jsx35(
11264
+ StatCard,
11265
+ {
11266
+ title: "Opportunites",
11267
+ value: stats.opportunities.total,
11268
+ icon: Target2,
11269
+ color: "info"
11270
+ }
11271
+ ),
11272
+ /* @__PURE__ */ jsx35(
11273
+ StatCard,
11274
+ {
11275
+ title: "Pipeline",
11276
+ value: formatCurrencyShort3(stats.opportunities.total_value),
11277
+ icon: TrendingUp2,
11278
+ color: "success"
11279
+ }
11280
+ ),
11281
+ /* @__PURE__ */ jsx35(
11282
+ StatCard,
11283
+ {
11284
+ title: "CA mensuel",
11285
+ value: formatCurrencyShort3(stats.revenue.monthly),
11286
+ icon: Banknote3,
11287
+ color: "warning",
11288
+ change: stats.revenue.trend !== 0 ? {
11289
+ value: stats.revenue.trend,
11290
+ type: stats.revenue.trend > 0 ? "increase" : "decrease"
11291
+ } : void 0
11292
+ }
11293
+ )
11294
+ ] }),
11295
+ /* @__PURE__ */ jsxs30("div", { className: "grid grid-cols-1 lg:grid-cols-3 gap-6", children: [
11296
+ /* @__PURE__ */ jsxs30("div", { className: "lg:col-span-2 space-y-6", children: [
11297
+ /* @__PURE__ */ jsxs30(ModernCard, { children: [
11298
+ /* @__PURE__ */ jsx35(
11299
+ CardHeader,
11300
+ {
11301
+ title: "Pipeline commercial",
11302
+ icon: Target2,
11303
+ action: /* @__PURE__ */ jsxs30("button", { className: "text-sm text-[var(--color-primary)] hover:underline flex items-center", children: [
11304
+ "Voir tout ",
11305
+ /* @__PURE__ */ jsx35(ArrowRight3, { className: "w-4 h-4 ml-1" })
11306
+ ] })
11307
+ }
11308
+ ),
11309
+ /* @__PURE__ */ jsx35(CardBody, { children: /* @__PURE__ */ jsxs30("div", { className: "grid grid-cols-4 gap-4", children: [
11310
+ /* @__PURE__ */ jsxs30("div", { className: "p-4 bg-[var(--color-info-light)] rounded-lg text-center", children: [
11311
+ /* @__PURE__ */ jsx35("p", { className: "text-2xl font-bold text-[var(--color-info)]", children: stats.opportunities.qualified }),
11312
+ /* @__PURE__ */ jsx35("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Qualifiees" })
11313
+ ] }),
11314
+ /* @__PURE__ */ jsxs30("div", { className: "p-4 bg-[var(--color-warning-light)] rounded-lg text-center", children: [
11315
+ /* @__PURE__ */ jsx35("p", { className: "text-2xl font-bold text-[var(--color-warning)]", children: stats.opportunities.negotiation }),
11316
+ /* @__PURE__ */ jsx35("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Negociation" })
11317
+ ] }),
11318
+ /* @__PURE__ */ jsxs30("div", { className: "p-4 bg-[var(--color-success-light)] rounded-lg text-center", children: [
11319
+ /* @__PURE__ */ jsx35("p", { className: "text-2xl font-bold text-[var(--color-success)]", children: stats.opportunities.won }),
11320
+ /* @__PURE__ */ jsx35("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Gagnees" })
11321
+ ] }),
11322
+ /* @__PURE__ */ jsxs30("div", { className: "p-4 bg-[var(--color-error-light)] rounded-lg text-center", children: [
11323
+ /* @__PURE__ */ jsx35("p", { className: "text-2xl font-bold text-[var(--color-error)]", children: stats.opportunities.lost }),
11324
+ /* @__PURE__ */ jsx35("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Perdues" })
11325
+ ] })
11326
+ ] }) })
11327
+ ] }),
11328
+ /* @__PURE__ */ jsxs30(ModernCard, { children: [
11329
+ /* @__PURE__ */ jsx35(
11330
+ CardHeader,
11331
+ {
11332
+ title: "Contacts recents",
11333
+ icon: Users3,
11334
+ action: /* @__PURE__ */ jsxs30("button", { className: "text-sm text-[var(--color-primary)] hover:underline flex items-center", children: [
11335
+ "Voir tout ",
11336
+ /* @__PURE__ */ jsx35(ArrowRight3, { className: "w-4 h-4 ml-1" })
11337
+ ] })
11338
+ }
11339
+ ),
11340
+ /* @__PURE__ */ jsx35(CardBody, { noPadding: true, children: /* @__PURE__ */ jsx35("div", { className: "divide-y divide-[var(--color-border-light)]", children: recentContacts.map((contact) => /* @__PURE__ */ jsxs30(
11341
+ "div",
11342
+ {
11343
+ className: "p-4 hover:bg-[var(--color-surface-hover)] transition-colors cursor-pointer flex items-center justify-between",
11344
+ children: [
11345
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center space-x-3", children: [
11346
+ /* @__PURE__ */ jsx35("div", { className: "w-10 h-10 bg-[var(--color-primary-light)] rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx35("span", { className: "text-sm font-semibold text-[var(--color-primary)]", children: contact.name.split(" ").map((n) => n[0]).join("") }) }),
11347
+ /* @__PURE__ */ jsxs30("div", { children: [
11348
+ /* @__PURE__ */ jsx35("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: contact.name }),
11349
+ /* @__PURE__ */ jsx35("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: contact.company })
11350
+ ] })
11351
+ ] }),
11352
+ /* @__PURE__ */ jsx35("span", { className: `px-2 py-1 text-xs font-medium rounded-full ${getStatusColor(contact.status)}`, children: getStatusLabel(contact.status) })
11353
+ ]
11354
+ },
11355
+ contact.id
11356
+ )) }) })
11357
+ ] })
11358
+ ] }),
11359
+ /* @__PURE__ */ jsxs30("div", { className: "space-y-6", children: [
11360
+ /* @__PURE__ */ jsxs30(ModernCard, { children: [
11361
+ /* @__PURE__ */ jsx35(CardHeader, { title: "Activites a faire", icon: Activity }),
11362
+ /* @__PURE__ */ jsx35(CardBody, { children: /* @__PURE__ */ jsxs30("div", { className: "space-y-3", children: [
11363
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between p-3 bg-[var(--color-surface-hover)] rounded-lg", children: [
11364
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center space-x-2", children: [
11365
+ /* @__PURE__ */ jsx35(Phone2, { className: "w-4 h-4 text-[var(--color-info)]" }),
11366
+ /* @__PURE__ */ jsx35("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Appels" })
11367
+ ] }),
11368
+ /* @__PURE__ */ jsx35("span", { className: "px-2 py-1 text-xs font-medium bg-[var(--color-info-light)] text-[var(--color-info)] rounded-full", children: stats.activities.pending_calls })
11369
+ ] }),
11370
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between p-3 bg-[var(--color-surface-hover)] rounded-lg", children: [
11371
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center space-x-2", children: [
11372
+ /* @__PURE__ */ jsx35(Calendar2, { className: "w-4 h-4 text-[var(--color-warning)]" }),
11373
+ /* @__PURE__ */ jsx35("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Reunions" })
11374
+ ] }),
11375
+ /* @__PURE__ */ jsx35("span", { className: "px-2 py-1 text-xs font-medium bg-[var(--color-warning-light)] text-[var(--color-warning)] rounded-full", children: stats.activities.pending_meetings })
11376
+ ] }),
11377
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between p-3 bg-[var(--color-surface-hover)] rounded-lg", children: [
11378
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center space-x-2", children: [
11379
+ /* @__PURE__ */ jsx35(Mail2, { className: "w-4 h-4 text-[var(--color-success)]" }),
11380
+ /* @__PURE__ */ jsx35("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Emails" })
11381
+ ] }),
11382
+ /* @__PURE__ */ jsx35("span", { className: "px-2 py-1 text-xs font-medium bg-[var(--color-success-light)] text-[var(--color-success)] rounded-full", children: stats.activities.pending_emails })
11383
+ ] }),
11384
+ stats.activities.overdue > 0 && /* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between p-3 bg-[var(--color-error-light)] rounded-lg", children: [
11385
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center space-x-2", children: [
11386
+ /* @__PURE__ */ jsx35(AlertTriangle5, { className: "w-4 h-4 text-[var(--color-error)]" }),
11387
+ /* @__PURE__ */ jsx35("span", { className: "text-sm text-[var(--color-text-primary)]", children: "En retard" })
11388
+ ] }),
11389
+ /* @__PURE__ */ jsx35("span", { className: "px-2 py-1 text-xs font-medium bg-[var(--color-error)] text-white rounded-full", children: stats.activities.overdue })
11390
+ ] })
11391
+ ] }) })
11392
+ ] }),
11393
+ /* @__PURE__ */ jsxs30(ModernCard, { children: [
11394
+ /* @__PURE__ */ jsx35(CardHeader, { title: "Nouveaux clients", icon: UserPlus }),
11395
+ /* @__PURE__ */ jsx35(CardBody, { children: /* @__PURE__ */ jsxs30("div", { className: "text-center py-4", children: [
11396
+ /* @__PURE__ */ jsxs30("p", { className: "text-4xl font-bold text-[var(--color-success)]", children: [
11397
+ "+",
11398
+ stats.clients.new_this_month
11399
+ ] }),
11400
+ /* @__PURE__ */ jsx35("p", { className: "text-sm text-[var(--color-text-secondary)] mt-1", children: "ce mois-ci" }),
11401
+ /* @__PURE__ */ jsxs30("div", { className: "mt-4 pt-4 border-t border-[var(--color-border-light)]", children: [
11402
+ /* @__PURE__ */ jsx35("p", { className: "text-2xl font-bold text-[var(--color-text-primary)]", children: stats.clients.total }),
11403
+ /* @__PURE__ */ jsx35("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "clients au total" })
11404
+ ] })
11405
+ ] }) })
11406
+ ] })
11407
+ ] })
11408
+ ] })
11409
+ ] });
11410
+ };
11411
+ var CrmWorkspace_default = CrmWorkspace;
11412
+
11413
+ // src/pages/workspaces/FacilityWorkspace.tsx
11414
+ import { useState as useState24, useEffect as useEffect16 } from "react";
11415
+ import {
11416
+ Building2 as Building24,
11417
+ Wrench,
11418
+ AlertTriangle as AlertTriangle6,
11419
+ CheckCircle as CheckCircle4,
11420
+ ArrowRight as ArrowRight4,
11421
+ RefreshCw as RefreshCw7,
11422
+ Calendar as Calendar3,
11423
+ MapPin as MapPin3,
11424
+ Shield as Shield2
11425
+ } from "lucide-react";
11426
+ import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
11427
+ var FacilityWorkspace = () => {
11428
+ const [stats, setStats] = useState24(null);
11429
+ const [maintenanceTasks, setMaintenanceTasks] = useState24([]);
11430
+ const [loading, setLoading] = useState24(true);
11431
+ const [error, setError] = useState24(null);
11432
+ useEffect16(() => {
11433
+ loadWorkspaceData();
11434
+ }, []);
11435
+ const loadWorkspaceData = async () => {
11436
+ setLoading(true);
11437
+ setError(null);
11438
+ try {
11439
+ await new Promise((resolve) => setTimeout(resolve, 500));
11440
+ setStats({
11441
+ sites: {
11442
+ total: 0,
11443
+ active: 0
11444
+ },
11445
+ maintenance: {
11446
+ scheduled: 0,
11447
+ in_progress: 0,
11448
+ completed: 0,
11449
+ overdue: 0
11450
+ },
11451
+ incidents: {
11452
+ open: 0,
11453
+ in_progress: 0,
11454
+ resolved: 0,
11455
+ critical: 0
11456
+ },
11457
+ equipment: {
11458
+ total: 0,
11459
+ operational: 0,
11460
+ under_maintenance: 0,
11461
+ out_of_service: 0
11462
+ },
11463
+ alerts: {
11464
+ critical_incidents: 0,
11465
+ overdue_maintenance: 0,
11466
+ expiring_contracts: 0
11467
+ }
11468
+ });
11469
+ setMaintenanceTasks([]);
11470
+ } catch (err) {
11471
+ console.error("Erreur lors du chargement du workspace:", err);
11472
+ setError("Impossible de charger les donnees du workspace Facility.");
11473
+ } finally {
11474
+ setLoading(false);
11475
+ }
11476
+ };
11477
+ const getPriorityColor = (priority) => {
11478
+ const colors = {
11479
+ low: "bg-[var(--color-border-light)] text-[var(--color-text-secondary)]",
11480
+ medium: "bg-[var(--color-info-light)] text-[var(--color-info)]",
11481
+ high: "bg-[var(--color-warning-light)] text-[var(--color-warning)]",
11482
+ critical: "bg-[var(--color-error-light)] text-[var(--color-error)]"
11483
+ };
11484
+ return colors[priority] || colors.medium;
11485
+ };
11486
+ const getPriorityLabel = (priority) => {
11487
+ const labels = { low: "Basse", medium: "Moyenne", high: "Haute", critical: "Critique" };
11488
+ return labels[priority] || priority;
11489
+ };
11490
+ const getTypeColor = (type) => {
11491
+ return type === "corrective" ? "bg-[var(--color-error-light)] text-[var(--color-error)]" : "bg-[var(--color-info-light)] text-[var(--color-info)]";
11492
+ };
11493
+ if (loading) {
11494
+ return /* @__PURE__ */ jsx36("div", { className: "flex items-center justify-center h-96", children: /* @__PURE__ */ jsxs31("div", { className: "text-center", children: [
11495
+ /* @__PURE__ */ jsx36(RefreshCw7, { className: "w-12 h-12 text-[var(--color-primary)] animate-spin mx-auto mb-4" }),
11496
+ /* @__PURE__ */ jsx36("p", { className: "text-[var(--color-text-secondary)]", children: "Chargement du workspace Facility..." })
11497
+ ] }) });
11498
+ }
11499
+ if (!stats) return null;
11500
+ const ErrorBanner = error ? /* @__PURE__ */ jsx36("div", { className: "bg-[var(--color-error-light)] border border-[var(--color-error)] rounded-xl p-4 mb-6", children: /* @__PURE__ */ jsxs31("div", { className: "flex items-center space-x-3", children: [
11501
+ /* @__PURE__ */ jsx36(AlertTriangle6, { className: "w-5 h-5 text-[var(--color-error)]" }),
11502
+ /* @__PURE__ */ jsx36("div", { className: "flex-1", children: /* @__PURE__ */ jsx36("p", { className: "text-sm text-[var(--color-error)]", children: error }) }),
11503
+ /* @__PURE__ */ jsx36(
11504
+ "button",
11505
+ {
11506
+ onClick: loadWorkspaceData,
11507
+ className: "text-sm text-[var(--color-error)] hover:underline font-medium",
11508
+ children: "Reessayer"
11509
+ }
11510
+ )
11511
+ ] }) }) : null;
11512
+ return /* @__PURE__ */ jsxs31("div", { className: "space-y-6", children: [
11513
+ ErrorBanner,
11514
+ (stats.alerts.critical_incidents > 0 || stats.alerts.overdue_maintenance > 0) && /* @__PURE__ */ jsx36("div", { className: "bg-[var(--color-error-light)] border border-[var(--color-error)] rounded-xl p-4", children: /* @__PURE__ */ jsxs31("div", { className: "flex items-start space-x-3", children: [
11515
+ /* @__PURE__ */ jsx36(AlertTriangle6, { className: "w-5 h-5 text-[var(--color-error)] mt-0.5" }),
11516
+ /* @__PURE__ */ jsxs31("div", { className: "flex-1", children: [
11517
+ /* @__PURE__ */ jsx36("h3", { className: "font-semibold text-[var(--color-text-primary)]", children: "Alertes critiques" }),
11518
+ /* @__PURE__ */ jsxs31("div", { className: "mt-2 flex flex-wrap gap-4", children: [
11519
+ stats.alerts.critical_incidents > 0 && /* @__PURE__ */ jsxs31("span", { className: "text-sm text-[var(--color-error)]", children: [
11520
+ /* @__PURE__ */ jsx36("strong", { children: stats.alerts.critical_incidents }),
11521
+ " incident(s) critique(s)"
11522
+ ] }),
11523
+ stats.alerts.overdue_maintenance > 0 && /* @__PURE__ */ jsxs31("span", { className: "text-sm text-[var(--color-error)]", children: [
11524
+ /* @__PURE__ */ jsx36("strong", { children: stats.alerts.overdue_maintenance }),
11525
+ " maintenance(s) en retard"
11526
+ ] }),
11527
+ stats.alerts.expiring_contracts > 0 && /* @__PURE__ */ jsxs31("span", { className: "text-sm text-[var(--color-warning)]", children: [
11528
+ /* @__PURE__ */ jsx36("strong", { children: stats.alerts.expiring_contracts }),
11529
+ " contrat(s) expirant bientot"
11530
+ ] })
11531
+ ] })
11532
+ ] })
11533
+ ] }) }),
11534
+ /* @__PURE__ */ jsxs31("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6", children: [
11535
+ /* @__PURE__ */ jsx36(
11536
+ StatCard,
11537
+ {
11538
+ title: "Sites actifs",
11539
+ value: stats.sites.active,
11540
+ icon: Building24,
11541
+ color: "primary"
11542
+ }
11543
+ ),
11544
+ /* @__PURE__ */ jsx36(
11545
+ StatCard,
11546
+ {
11547
+ title: "Maintenances planifiees",
11548
+ value: stats.maintenance.scheduled,
11549
+ icon: Wrench,
11550
+ color: "info"
11551
+ }
11552
+ ),
11553
+ /* @__PURE__ */ jsx36(
11554
+ StatCard,
11555
+ {
11556
+ title: "Incidents ouverts",
11557
+ value: stats.incidents.open,
11558
+ icon: AlertTriangle6,
11559
+ color: "warning"
11560
+ }
11561
+ ),
11562
+ /* @__PURE__ */ jsx36(
11563
+ StatCard,
11564
+ {
11565
+ title: "Equipements operationnels",
11566
+ value: stats.equipment.total > 0 ? `${Math.round(stats.equipment.operational / stats.equipment.total * 100)}%` : "0%",
11567
+ icon: CheckCircle4,
11568
+ color: "success"
11569
+ }
11570
+ )
11571
+ ] }),
11572
+ /* @__PURE__ */ jsxs31("div", { className: "grid grid-cols-1 lg:grid-cols-3 gap-6", children: [
11573
+ /* @__PURE__ */ jsxs31("div", { className: "lg:col-span-2 space-y-6", children: [
11574
+ /* @__PURE__ */ jsxs31(ModernCard, { children: [
11575
+ /* @__PURE__ */ jsx36(
11576
+ CardHeader,
11577
+ {
11578
+ title: "Maintenances a venir",
11579
+ icon: Wrench,
11580
+ action: /* @__PURE__ */ jsxs31("button", { className: "text-sm text-[var(--color-primary)] hover:underline flex items-center", children: [
11581
+ "Voir tout ",
11582
+ /* @__PURE__ */ jsx36(ArrowRight4, { className: "w-4 h-4 ml-1" })
11583
+ ] })
11584
+ }
11585
+ ),
11586
+ /* @__PURE__ */ jsx36(CardBody, { noPadding: true, children: /* @__PURE__ */ jsx36("div", { className: "divide-y divide-[var(--color-border-light)]", children: maintenanceTasks.map((task) => /* @__PURE__ */ jsx36(
11587
+ "div",
11588
+ {
11589
+ className: "p-4 hover:bg-[var(--color-surface-hover)] transition-colors cursor-pointer",
11590
+ children: /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between", children: [
11591
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center space-x-3", children: [
11592
+ /* @__PURE__ */ jsx36("span", { className: `px-2 py-1 text-xs font-medium rounded-full ${getPriorityColor(task.priority)}`, children: getPriorityLabel(task.priority) }),
11593
+ /* @__PURE__ */ jsxs31("div", { children: [
11594
+ /* @__PURE__ */ jsx36("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: task.title }),
11595
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center space-x-2 mt-1", children: [
11596
+ /* @__PURE__ */ jsx36(MapPin3, { className: "w-3 h-3 text-[var(--color-text-tertiary)]" }),
11597
+ /* @__PURE__ */ jsx36("span", { className: "text-xs text-[var(--color-text-tertiary)]", children: task.site })
11598
+ ] })
11599
+ ] })
11600
+ ] }),
11601
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center space-x-3", children: [
11602
+ /* @__PURE__ */ jsx36("span", { className: `px-2 py-1 text-xs rounded ${getTypeColor(task.type)}`, children: task.type === "preventive" ? "Preventive" : "Corrective" }),
11603
+ /* @__PURE__ */ jsxs31("div", { className: "text-right", children: [
11604
+ /* @__PURE__ */ jsx36("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "Echeance" }),
11605
+ /* @__PURE__ */ jsx36("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: new Date(task.dueDate).toLocaleDateString("fr-FR") })
11606
+ ] })
11607
+ ] })
11608
+ ] })
11609
+ },
11610
+ task.id
11611
+ )) }) })
11612
+ ] }),
11613
+ /* @__PURE__ */ jsxs31(ModernCard, { children: [
11614
+ /* @__PURE__ */ jsx36(CardHeader, { title: "Etat des maintenances", icon: Calendar3 }),
11615
+ /* @__PURE__ */ jsx36(CardBody, { children: /* @__PURE__ */ jsxs31("div", { className: "grid grid-cols-4 gap-4", children: [
11616
+ /* @__PURE__ */ jsxs31("div", { className: "p-4 bg-[var(--color-info-light)] rounded-lg text-center", children: [
11617
+ /* @__PURE__ */ jsx36("p", { className: "text-2xl font-bold text-[var(--color-info)]", children: stats.maintenance.scheduled }),
11618
+ /* @__PURE__ */ jsx36("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Planifiees" })
11619
+ ] }),
11620
+ /* @__PURE__ */ jsxs31("div", { className: "p-4 bg-[var(--color-warning-light)] rounded-lg text-center", children: [
11621
+ /* @__PURE__ */ jsx36("p", { className: "text-2xl font-bold text-[var(--color-warning)]", children: stats.maintenance.in_progress }),
11622
+ /* @__PURE__ */ jsx36("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "En cours" })
11623
+ ] }),
11624
+ /* @__PURE__ */ jsxs31("div", { className: "p-4 bg-[var(--color-success-light)] rounded-lg text-center", children: [
11625
+ /* @__PURE__ */ jsx36("p", { className: "text-2xl font-bold text-[var(--color-success)]", children: stats.maintenance.completed }),
11626
+ /* @__PURE__ */ jsx36("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Terminees" })
11627
+ ] }),
11628
+ /* @__PURE__ */ jsxs31("div", { className: "p-4 bg-[var(--color-error-light)] rounded-lg text-center", children: [
11629
+ /* @__PURE__ */ jsx36("p", { className: "text-2xl font-bold text-[var(--color-error)]", children: stats.maintenance.overdue }),
11630
+ /* @__PURE__ */ jsx36("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "En retard" })
11631
+ ] })
11632
+ ] }) })
11633
+ ] })
11634
+ ] }),
11635
+ /* @__PURE__ */ jsxs31("div", { className: "space-y-6", children: [
11636
+ /* @__PURE__ */ jsxs31(ModernCard, { children: [
11637
+ /* @__PURE__ */ jsx36(CardHeader, { title: "Incidents", icon: AlertTriangle6 }),
11638
+ /* @__PURE__ */ jsx36(CardBody, { children: /* @__PURE__ */ jsxs31("div", { className: "space-y-3", children: [
11639
+ stats.incidents.critical > 0 && /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between p-3 bg-[var(--color-error-light)] rounded-lg", children: [
11640
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center space-x-2", children: [
11641
+ /* @__PURE__ */ jsx36("div", { className: "w-2 h-2 bg-[var(--color-error)] rounded-full animate-pulse" }),
11642
+ /* @__PURE__ */ jsx36("span", { className: "text-sm font-medium text-[var(--color-error)]", children: "Critiques" })
11643
+ ] }),
11644
+ /* @__PURE__ */ jsx36("span", { className: "font-bold text-[var(--color-error)]", children: stats.incidents.critical })
11645
+ ] }),
11646
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between p-3 bg-[var(--color-warning-light)] rounded-lg", children: [
11647
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center space-x-2", children: [
11648
+ /* @__PURE__ */ jsx36("div", { className: "w-2 h-2 bg-[var(--color-warning)] rounded-full" }),
11649
+ /* @__PURE__ */ jsx36("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Ouverts" })
11650
+ ] }),
11651
+ /* @__PURE__ */ jsx36("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.incidents.open })
11652
+ ] }),
11653
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between p-3 bg-[var(--color-info-light)] rounded-lg", children: [
11654
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center space-x-2", children: [
11655
+ /* @__PURE__ */ jsx36("div", { className: "w-2 h-2 bg-[var(--color-info)] rounded-full" }),
11656
+ /* @__PURE__ */ jsx36("span", { className: "text-sm text-[var(--color-text-primary)]", children: "En cours" })
11657
+ ] }),
11658
+ /* @__PURE__ */ jsx36("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.incidents.in_progress })
11659
+ ] }),
11660
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between p-3 bg-[var(--color-success-light)] rounded-lg", children: [
11661
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center space-x-2", children: [
11662
+ /* @__PURE__ */ jsx36("div", { className: "w-2 h-2 bg-[var(--color-success)] rounded-full" }),
11663
+ /* @__PURE__ */ jsx36("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Resolus" })
11664
+ ] }),
11665
+ /* @__PURE__ */ jsx36("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.incidents.resolved })
11666
+ ] })
11667
+ ] }) })
11668
+ ] }),
11669
+ /* @__PURE__ */ jsxs31(ModernCard, { children: [
11670
+ /* @__PURE__ */ jsx36(CardHeader, { title: "Equipements", icon: Shield2 }),
11671
+ /* @__PURE__ */ jsx36(CardBody, { children: /* @__PURE__ */ jsxs31("div", { className: "text-center py-4", children: [
11672
+ /* @__PURE__ */ jsx36("p", { className: "text-4xl font-bold text-[var(--color-text-primary)]", children: stats.equipment.total }),
11673
+ /* @__PURE__ */ jsx36("p", { className: "text-sm text-[var(--color-text-secondary)] mt-1", children: "equipements references" }),
11674
+ /* @__PURE__ */ jsxs31("div", { className: "mt-4 grid grid-cols-3 gap-2", children: [
11675
+ /* @__PURE__ */ jsxs31("div", { className: "p-2 bg-[var(--color-success-light)] rounded", children: [
11676
+ /* @__PURE__ */ jsx36("p", { className: "text-lg font-semibold text-[var(--color-success)]", children: stats.equipment.operational }),
11677
+ /* @__PURE__ */ jsx36("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "OK" })
11678
+ ] }),
11679
+ /* @__PURE__ */ jsxs31("div", { className: "p-2 bg-[var(--color-warning-light)] rounded", children: [
11680
+ /* @__PURE__ */ jsx36("p", { className: "text-lg font-semibold text-[var(--color-warning)]", children: stats.equipment.under_maintenance }),
11681
+ /* @__PURE__ */ jsx36("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "Maint." })
11682
+ ] }),
11683
+ /* @__PURE__ */ jsxs31("div", { className: "p-2 bg-[var(--color-error-light)] rounded", children: [
11684
+ /* @__PURE__ */ jsx36("p", { className: "text-lg font-semibold text-[var(--color-error)]", children: stats.equipment.out_of_service }),
11685
+ /* @__PURE__ */ jsx36("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "HS" })
11686
+ ] })
11687
+ ] })
11688
+ ] }) })
11689
+ ] })
11690
+ ] })
11691
+ ] })
11692
+ ] });
11693
+ };
11694
+ var FacilityWorkspace_default = FacilityWorkspace;
11695
+
11696
+ // src/pages/workspaces/WorkSpace.tsx
11697
+ import { Fragment as Fragment9, jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
11698
+ var MODULES_CONFIG = [
11699
+ {
11700
+ id: "purchase",
11701
+ label: "Achats",
11702
+ description: "Gestion des achats et approvisionnements",
11703
+ icon: ShoppingCart2,
11704
+ color: "text-blue-600",
11705
+ bgColor: "bg-blue-50",
11706
+ component: PurchaseWorkspace_default
11707
+ },
11708
+ {
11709
+ id: "accounting",
11710
+ label: "Comptabilite",
11711
+ description: "Gestion comptable et financiere",
11712
+ icon: Calculator2,
11713
+ color: "text-green-600",
11714
+ bgColor: "bg-green-50",
11715
+ component: AccountingWorkspace_default
11716
+ },
11717
+ {
11718
+ id: "crm",
11719
+ label: "CRM",
11720
+ description: "Gestion de la relation client",
11721
+ icon: Users5,
11722
+ color: "text-purple-600",
11723
+ bgColor: "bg-purple-50",
11724
+ component: CrmWorkspace_default
11725
+ },
11726
+ {
11727
+ id: "facility",
11728
+ label: "Facility",
11729
+ description: "Gestion des installations et maintenances",
11730
+ icon: Building25,
11731
+ color: "text-orange-600",
11732
+ bgColor: "bg-orange-50",
11733
+ component: FacilityWorkspace_default
11734
+ }
11735
+ ];
11736
+ var WorkSpace = () => {
11737
+ const [activeModule, setActiveModule] = useState25(null);
11738
+ const [availableModules, setAvailableModules] = useState25([]);
11739
+ const [loading, setLoading] = useState25(true);
11740
+ const [showModuleSelector, setShowModuleSelector] = useState25(false);
11741
+ useEffect17(() => {
11742
+ loadAvailableModules();
11743
+ }, []);
11744
+ const loadAvailableModules = async () => {
11745
+ setLoading(true);
11746
+ try {
11747
+ await new Promise((resolve) => setTimeout(resolve, 300));
11748
+ const userModules = ["purchase", "accounting", "crm", "facility"];
11749
+ setAvailableModules(userModules);
11750
+ if (userModules.length > 0 && !activeModule) {
11751
+ setActiveModule(userModules[0]);
11752
+ }
11753
+ } catch (error) {
11754
+ console.error("Erreur lors du chargement des modules:", error);
11755
+ setAvailableModules(["purchase"]);
11756
+ setActiveModule("purchase");
11757
+ } finally {
11758
+ setLoading(false);
11759
+ }
11760
+ };
11761
+ const filteredModules = useMemo2(() => {
11762
+ return MODULES_CONFIG.filter((m) => availableModules.includes(m.id));
11763
+ }, [availableModules]);
11764
+ const currentModule = useMemo2(() => {
11765
+ return MODULES_CONFIG.find((m) => m.id === activeModule);
11766
+ }, [activeModule]);
11767
+ const ActiveWorkspaceComponent = currentModule?.component;
11768
+ if (loading) {
11769
+ return /* @__PURE__ */ jsx37("div", { className: "flex items-center justify-center h-screen bg-[var(--color-background)]", children: /* @__PURE__ */ jsxs32("div", { className: "text-center", children: [
11770
+ /* @__PURE__ */ jsx37(RefreshCw8, { className: "w-12 h-12 text-[var(--color-primary)] animate-spin mx-auto mb-4" }),
11771
+ /* @__PURE__ */ jsx37("p", { className: "text-[var(--color-text-secondary)]", children: "Chargement des workspaces..." })
11772
+ ] }) });
11773
+ }
11774
+ if (filteredModules.length === 0) {
11775
+ return /* @__PURE__ */ jsx37("div", { className: "flex items-center justify-center h-screen bg-[var(--color-background)]", children: /* @__PURE__ */ jsxs32("div", { className: "text-center", children: [
11776
+ /* @__PURE__ */ jsx37(LayoutDashboard, { className: "w-16 h-16 text-[var(--color-text-tertiary)] mx-auto mb-4" }),
11777
+ /* @__PURE__ */ jsx37("h2", { className: "text-xl font-semibold text-[var(--color-text-primary)] mb-2", children: "Aucun workspace disponible" }),
11778
+ /* @__PURE__ */ jsx37("p", { className: "text-[var(--color-text-secondary)]", children: "Contactez votre administrateur pour obtenir l'acces aux modules." })
11779
+ ] }) });
11780
+ }
11781
+ return /* @__PURE__ */ jsxs32("div", { className: "min-h-screen bg-[var(--color-background)]", children: [
11782
+ /* @__PURE__ */ jsx37("div", { className: "sticky top-0 z-40 bg-[var(--color-surface)] border-b border-[var(--color-border-light)] shadow-sm", children: /* @__PURE__ */ jsx37("div", { className: "px-6 py-4", children: /* @__PURE__ */ jsxs32("div", { className: "flex items-center justify-between", children: [
11783
+ /* @__PURE__ */ jsxs32("div", { className: "flex items-center space-x-4", children: [
11784
+ currentModule && /* @__PURE__ */ jsx37("div", { className: `p-2 rounded-lg ${currentModule.bgColor}`, children: /* @__PURE__ */ jsx37(currentModule.icon, { className: `w-6 h-6 ${currentModule.color}` }) }),
11785
+ /* @__PURE__ */ jsxs32("div", { className: "relative", children: [
11786
+ /* @__PURE__ */ jsxs32(
11787
+ "button",
11788
+ {
11789
+ onClick: () => setShowModuleSelector(!showModuleSelector),
11790
+ className: "flex items-center space-x-2 hover:bg-[var(--color-surface-hover)] px-3 py-2 rounded-lg transition-colors",
11791
+ children: [
11792
+ /* @__PURE__ */ jsxs32("div", { children: [
11793
+ /* @__PURE__ */ jsxs32("h1", { className: "text-xl font-bold text-[var(--color-text-primary)]", children: [
11794
+ "Workspace - ",
11795
+ currentModule?.label
11796
+ ] }),
11797
+ /* @__PURE__ */ jsx37("p", { className: "text-sm text-[var(--color-text-secondary)]", children: currentModule?.description })
11798
+ ] }),
11799
+ filteredModules.length > 1 && /* @__PURE__ */ jsx37(ChevronDown4, { className: `w-5 h-5 text-[var(--color-text-tertiary)] transition-transform ${showModuleSelector ? "rotate-180" : ""}` })
11800
+ ]
11801
+ }
11802
+ ),
11803
+ showModuleSelector && filteredModules.length > 1 && /* @__PURE__ */ jsxs32(Fragment9, { children: [
11804
+ /* @__PURE__ */ jsx37(
11805
+ "div",
11806
+ {
11807
+ className: "fixed inset-0 z-10",
11808
+ onClick: () => setShowModuleSelector(false)
11809
+ }
11810
+ ),
11811
+ /* @__PURE__ */ jsx37("div", { className: "absolute top-full left-0 mt-2 w-72 bg-[var(--color-surface)] rounded-xl shadow-xl border border-[var(--color-border-light)] z-20 overflow-hidden", children: /* @__PURE__ */ jsxs32("div", { className: "p-2", children: [
11812
+ /* @__PURE__ */ jsx37("p", { className: "text-xs font-semibold text-[var(--color-text-tertiary)] uppercase tracking-wide px-3 py-2", children: "Changer de workspace" }),
11813
+ filteredModules.map((module) => /* @__PURE__ */ jsxs32(
11814
+ "button",
11815
+ {
11816
+ onClick: () => {
11817
+ setActiveModule(module.id);
11818
+ setShowModuleSelector(false);
11819
+ },
11820
+ className: `
11821
+ w-full flex items-center space-x-3 px-3 py-3 rounded-lg transition-colors
11822
+ ${activeModule === module.id ? "bg-[var(--color-primary-light)]" : "hover:bg-[var(--color-surface-hover)]"}
11823
+ `,
11824
+ children: [
11825
+ /* @__PURE__ */ jsx37("div", { className: `p-2 rounded-lg ${module.bgColor}`, children: /* @__PURE__ */ jsx37(module.icon, { className: `w-5 h-5 ${module.color}` }) }),
11826
+ /* @__PURE__ */ jsxs32("div", { className: "text-left", children: [
11827
+ /* @__PURE__ */ jsx37("p", { className: `font-medium ${activeModule === module.id ? "text-[var(--color-primary)]" : "text-[var(--color-text-primary)]"}`, children: module.label }),
11828
+ /* @__PURE__ */ jsx37("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: module.description })
11829
+ ] })
11830
+ ]
11831
+ },
11832
+ module.id
11833
+ ))
11834
+ ] }) })
11835
+ ] })
11836
+ ] })
11837
+ ] }),
11838
+ /* @__PURE__ */ jsx37(
11839
+ "button",
11840
+ {
11841
+ onClick: loadAvailableModules,
11842
+ className: "p-2 hover:bg-[var(--color-surface-hover)] rounded-lg transition-colors",
11843
+ title: "Actualiser",
11844
+ children: /* @__PURE__ */ jsx37(RefreshCw8, { className: "w-5 h-5 text-[var(--color-text-tertiary)]" })
11845
+ }
11846
+ )
11847
+ ] }) }) }),
11848
+ /* @__PURE__ */ jsx37("div", { className: "p-6", children: ActiveWorkspaceComponent && /* @__PURE__ */ jsx37(ActiveWorkspaceComponent, {}) })
11849
+ ] });
11850
+ };
11851
+ var WorkSpace_default = WorkSpace;
11852
+
11853
+ // src/pages/workspaces/HRConnectPage.tsx
11854
+ import { UserCog, Users as Users6, FileText as FileText9, Calendar as Calendar4, Award, TrendingUp as TrendingUp3 } from "lucide-react";
11855
+ import { jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
11856
+ var HRConnectPage = () => {
11857
+ return /* @__PURE__ */ jsxs33("div", { className: "h-full flex flex-col", children: [
11858
+ /* @__PURE__ */ jsx38("div", { className: "bg-[var(--color-surface)] border-b border-[var(--color-border)] px-6 py-4", children: /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-3", children: [
11859
+ /* @__PURE__ */ jsx38("div", { className: "p-2 bg-purple-100 rounded-lg", children: /* @__PURE__ */ jsx38(UserCog, { className: "w-6 h-6 text-purple-600" }) }),
11860
+ /* @__PURE__ */ jsxs33("div", { children: [
11861
+ /* @__PURE__ */ jsx38("h1", { className: "text-xl font-semibold text-[var(--color-text-primary)]", children: "HR Connect" }),
11862
+ /* @__PURE__ */ jsx38("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Gestion des ressources humaines" })
11863
+ ] })
11864
+ ] }) }),
11865
+ /* @__PURE__ */ jsx38("div", { className: "flex-1 p-6 bg-[var(--color-background)]", children: /* @__PURE__ */ jsxs33("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6", children: [
11866
+ /* @__PURE__ */ jsxs33("div", { className: "bg-[var(--color-surface)] rounded-xl p-6 border border-[var(--color-border-light)] hover:shadow-md transition-shadow", children: [
11867
+ /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-3 mb-4", children: [
11868
+ /* @__PURE__ */ jsx38("div", { className: "p-2 bg-blue-100 rounded-lg", children: /* @__PURE__ */ jsx38(Users6, { className: "w-5 h-5 text-blue-600" }) }),
11869
+ /* @__PURE__ */ jsx38("h3", { className: "font-medium text-[var(--color-text-primary)]", children: "Employ\xE9s" })
11870
+ ] }),
11871
+ /* @__PURE__ */ jsx38("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "G\xE9rer les profils et informations des employ\xE9s" })
11872
+ ] }),
11873
+ /* @__PURE__ */ jsxs33("div", { className: "bg-[var(--color-surface)] rounded-xl p-6 border border-[var(--color-border-light)] hover:shadow-md transition-shadow", children: [
11874
+ /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-3 mb-4", children: [
11875
+ /* @__PURE__ */ jsx38("div", { className: "p-2 bg-green-100 rounded-lg", children: /* @__PURE__ */ jsx38(Calendar4, { className: "w-5 h-5 text-green-600" }) }),
11876
+ /* @__PURE__ */ jsx38("h3", { className: "font-medium text-[var(--color-text-primary)]", children: "Cong\xE9s" })
11877
+ ] }),
11878
+ /* @__PURE__ */ jsx38("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Suivi des demandes de cong\xE9s et absences" })
11879
+ ] }),
11880
+ /* @__PURE__ */ jsxs33("div", { className: "bg-[var(--color-surface)] rounded-xl p-6 border border-[var(--color-border-light)] hover:shadow-md transition-shadow", children: [
11881
+ /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-3 mb-4", children: [
11882
+ /* @__PURE__ */ jsx38("div", { className: "p-2 bg-orange-100 rounded-lg", children: /* @__PURE__ */ jsx38(FileText9, { className: "w-5 h-5 text-orange-600" }) }),
11883
+ /* @__PURE__ */ jsx38("h3", { className: "font-medium text-[var(--color-text-primary)]", children: "Documents" })
11884
+ ] }),
11885
+ /* @__PURE__ */ jsx38("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Gestion des documents RH et contrats" })
11886
+ ] }),
11887
+ /* @__PURE__ */ jsxs33("div", { className: "bg-[var(--color-surface)] rounded-xl p-6 border border-[var(--color-border-light)] hover:shadow-md transition-shadow", children: [
11888
+ /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-3 mb-4", children: [
11889
+ /* @__PURE__ */ jsx38("div", { className: "p-2 bg-indigo-100 rounded-lg", children: /* @__PURE__ */ jsx38(TrendingUp3, { className: "w-5 h-5 text-indigo-600" }) }),
11890
+ /* @__PURE__ */ jsx38("h3", { className: "font-medium text-[var(--color-text-primary)]", children: "Performance" })
11891
+ ] }),
11892
+ /* @__PURE__ */ jsx38("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "\xC9valuations et objectifs des employ\xE9s" })
11893
+ ] }),
11894
+ /* @__PURE__ */ jsxs33("div", { className: "bg-[var(--color-surface)] rounded-xl p-6 border border-[var(--color-border-light)] hover:shadow-md transition-shadow", children: [
11895
+ /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-3 mb-4", children: [
11896
+ /* @__PURE__ */ jsx38("div", { className: "p-2 bg-pink-100 rounded-lg", children: /* @__PURE__ */ jsx38(Award, { className: "w-5 h-5 text-pink-600" }) }),
11897
+ /* @__PURE__ */ jsx38("h3", { className: "font-medium text-[var(--color-text-primary)]", children: "Formations" })
11898
+ ] }),
11899
+ /* @__PURE__ */ jsx38("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Programmes de formation et d\xE9veloppement" })
11900
+ ] })
11901
+ ] }) })
11902
+ ] });
11903
+ };
11904
+ var HRConnectPage_default = HRConnectPage;
11905
+
11906
+ // src/pages/workspaces/MeetingHubPage.tsx
11907
+ import { Calendar as Calendar5, Video, Users as Users7, Clock as Clock6, MapPin as MapPin4, Plus as Plus5 } from "lucide-react";
11908
+ import { jsx as jsx39, jsxs as jsxs34 } from "react/jsx-runtime";
11909
+ var MeetingHubPage = () => {
11910
+ return /* @__PURE__ */ jsxs34("div", { className: "h-full flex flex-col", children: [
11911
+ /* @__PURE__ */ jsx39("div", { className: "bg-[var(--color-surface)] border-b border-[var(--color-border)] px-6 py-4", children: /* @__PURE__ */ jsxs34("div", { className: "flex items-center justify-between", children: [
11912
+ /* @__PURE__ */ jsxs34("div", { className: "flex items-center gap-3", children: [
11913
+ /* @__PURE__ */ jsx39("div", { className: "p-2 bg-blue-100 rounded-lg", children: /* @__PURE__ */ jsx39(Calendar5, { className: "w-6 h-6 text-blue-600" }) }),
11914
+ /* @__PURE__ */ jsxs34("div", { children: [
11915
+ /* @__PURE__ */ jsx39("h1", { className: "text-xl font-semibold text-[var(--color-text-primary)]", children: "Meeting Hub" }),
11916
+ /* @__PURE__ */ jsx39("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Planification et gestion des r\xE9unions" })
11917
+ ] })
11918
+ ] }),
11919
+ /* @__PURE__ */ jsxs34(Buttons_default, { children: [
11920
+ /* @__PURE__ */ jsx39(Plus5, { className: "w-4 h-4 mr-2" }),
11921
+ "Nouvelle r\xE9union"
11922
+ ] })
11923
+ ] }) }),
11924
+ /* @__PURE__ */ jsx39("div", { className: "flex-1 p-6 bg-[var(--color-background)]", children: /* @__PURE__ */ jsxs34("div", { className: "grid grid-cols-1 lg:grid-cols-3 gap-6", children: [
11925
+ /* @__PURE__ */ jsxs34("div", { className: "lg:col-span-2 bg-[var(--color-surface)] rounded-xl border border-[var(--color-border-light)]", children: [
11926
+ /* @__PURE__ */ jsx39("div", { className: "p-4 border-b border-[var(--color-border-light)]", children: /* @__PURE__ */ jsx39("h2", { className: "font-semibold text-[var(--color-text-primary)]", children: "R\xE9unions du jour" }) }),
11927
+ /* @__PURE__ */ jsxs34("div", { className: "p-4 space-y-4", children: [
11928
+ /* @__PURE__ */ jsxs34("div", { className: "flex items-start gap-4 p-4 bg-[var(--color-background)] rounded-lg", children: [
11929
+ /* @__PURE__ */ jsx39("div", { className: "p-2 bg-blue-100 rounded-lg", children: /* @__PURE__ */ jsx39(Video, { className: "w-5 h-5 text-blue-600" }) }),
11930
+ /* @__PURE__ */ jsxs34("div", { className: "flex-1", children: [
11931
+ /* @__PURE__ */ jsx39("h3", { className: "font-medium text-[var(--color-text-primary)]", children: "Stand-up quotidien" }),
11932
+ /* @__PURE__ */ jsxs34("div", { className: "flex items-center gap-4 mt-2 text-sm text-[var(--color-text-secondary)]", children: [
11933
+ /* @__PURE__ */ jsxs34("span", { className: "flex items-center gap-1", children: [
11934
+ /* @__PURE__ */ jsx39(Clock6, { className: "w-4 h-4" }),
11935
+ "09:00 - 09:30"
11936
+ ] }),
11937
+ /* @__PURE__ */ jsxs34("span", { className: "flex items-center gap-1", children: [
11938
+ /* @__PURE__ */ jsx39(Users7, { className: "w-4 h-4" }),
11939
+ "8 participants"
11940
+ ] })
11941
+ ] })
11942
+ ] })
11943
+ ] }),
11944
+ /* @__PURE__ */ jsxs34("div", { className: "flex items-start gap-4 p-4 bg-[var(--color-background)] rounded-lg", children: [
11945
+ /* @__PURE__ */ jsx39("div", { className: "p-2 bg-green-100 rounded-lg", children: /* @__PURE__ */ jsx39(MapPin4, { className: "w-5 h-5 text-green-600" }) }),
11946
+ /* @__PURE__ */ jsxs34("div", { className: "flex-1", children: [
11947
+ /* @__PURE__ */ jsx39("h3", { className: "font-medium text-[var(--color-text-primary)]", children: "Revue de sprint" }),
11948
+ /* @__PURE__ */ jsxs34("div", { className: "flex items-center gap-4 mt-2 text-sm text-[var(--color-text-secondary)]", children: [
11949
+ /* @__PURE__ */ jsxs34("span", { className: "flex items-center gap-1", children: [
11950
+ /* @__PURE__ */ jsx39(Clock6, { className: "w-4 h-4" }),
11951
+ "14:00 - 15:30"
11952
+ ] }),
11953
+ /* @__PURE__ */ jsxs34("span", { className: "flex items-center gap-1", children: [
11954
+ /* @__PURE__ */ jsx39(Users7, { className: "w-4 h-4" }),
11955
+ "12 participants"
11956
+ ] })
11957
+ ] })
11958
+ ] })
11959
+ ] }),
11960
+ /* @__PURE__ */ jsx39("p", { className: "text-center text-sm text-[var(--color-text-tertiary)] py-4", children: "Aucune autre r\xE9union pr\xE9vue aujourd'hui" })
11961
+ ] })
11962
+ ] }),
11963
+ /* @__PURE__ */ jsxs34("div", { className: "space-y-6", children: [
11964
+ /* @__PURE__ */ jsxs34("div", { className: "bg-[var(--color-surface)] rounded-xl p-6 border border-[var(--color-border-light)]", children: [
11965
+ /* @__PURE__ */ jsx39("h3", { className: "font-medium text-[var(--color-text-primary)] mb-4", children: "Cette semaine" }),
11966
+ /* @__PURE__ */ jsxs34("div", { className: "space-y-3", children: [
11967
+ /* @__PURE__ */ jsxs34("div", { className: "flex justify-between", children: [
11968
+ /* @__PURE__ */ jsx39("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "R\xE9unions planifi\xE9es" }),
11969
+ /* @__PURE__ */ jsx39("span", { className: "font-semibold text-[var(--color-text-primary)]", children: "12" })
11970
+ ] }),
11971
+ /* @__PURE__ */ jsxs34("div", { className: "flex justify-between", children: [
11972
+ /* @__PURE__ */ jsx39("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Heures de r\xE9union" }),
11973
+ /* @__PURE__ */ jsx39("span", { className: "font-semibold text-[var(--color-text-primary)]", children: "8h" })
11974
+ ] }),
11975
+ /* @__PURE__ */ jsxs34("div", { className: "flex justify-between", children: [
11976
+ /* @__PURE__ */ jsx39("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Participants uniques" }),
11977
+ /* @__PURE__ */ jsx39("span", { className: "font-semibold text-[var(--color-text-primary)]", children: "24" })
11978
+ ] })
11979
+ ] })
11980
+ ] }),
11981
+ /* @__PURE__ */ jsxs34("div", { className: "bg-[var(--color-surface)] rounded-xl p-6 border border-[var(--color-border-light)]", children: [
11982
+ /* @__PURE__ */ jsx39("h3", { className: "font-medium text-[var(--color-text-primary)] mb-4", children: "Salles disponibles" }),
11983
+ /* @__PURE__ */ jsxs34("div", { className: "space-y-2", children: [
11984
+ /* @__PURE__ */ jsxs34("div", { className: "flex items-center justify-between p-2 bg-green-50 rounded-lg", children: [
11985
+ /* @__PURE__ */ jsx39("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Salle A" }),
11986
+ /* @__PURE__ */ jsx39("span", { className: "text-xs px-2 py-1 bg-green-100 text-green-700 rounded", children: "Libre" })
11987
+ ] }),
11988
+ /* @__PURE__ */ jsxs34("div", { className: "flex items-center justify-between p-2 bg-red-50 rounded-lg", children: [
11989
+ /* @__PURE__ */ jsx39("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Salle B" }),
11990
+ /* @__PURE__ */ jsx39("span", { className: "text-xs px-2 py-1 bg-red-100 text-red-700 rounded", children: "Occup\xE9e" })
11991
+ ] }),
11992
+ /* @__PURE__ */ jsxs34("div", { className: "flex items-center justify-between p-2 bg-green-50 rounded-lg", children: [
11993
+ /* @__PURE__ */ jsx39("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Salle C" }),
11994
+ /* @__PURE__ */ jsx39("span", { className: "text-xs px-2 py-1 bg-green-100 text-green-700 rounded", children: "Libre" })
11995
+ ] })
11996
+ ] })
11997
+ ] })
11998
+ ] })
11999
+ ] }) })
12000
+ ] });
12001
+ };
12002
+ var MeetingHubPage_default = MeetingHubPage;
12003
+
12004
+ // src/pages/workspaces/BudgetPage.tsx
12005
+ import { CircleDollarSign, TrendingUp as TrendingUp4, TrendingDown as TrendingDown2, PieChart, BarChart3 as BarChart32, FileText as FileText10 } from "lucide-react";
12006
+ import { jsx as jsx40, jsxs as jsxs35 } from "react/jsx-runtime";
12007
+ var BudgetPage = () => {
12008
+ return /* @__PURE__ */ jsxs35("div", { className: "h-full flex flex-col", children: [
12009
+ /* @__PURE__ */ jsx40("div", { className: "bg-[var(--color-surface)] border-b border-[var(--color-border)] px-6 py-4", children: /* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-3", children: [
12010
+ /* @__PURE__ */ jsx40("div", { className: "p-2 bg-emerald-100 rounded-lg", children: /* @__PURE__ */ jsx40(CircleDollarSign, { className: "w-6 h-6 text-emerald-600" }) }),
12011
+ /* @__PURE__ */ jsxs35("div", { children: [
12012
+ /* @__PURE__ */ jsx40("h1", { className: "text-xl font-semibold text-[var(--color-text-primary)]", children: "Budget" }),
12013
+ /* @__PURE__ */ jsx40("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Gestion budg\xE9taire et suivi financier" })
12014
+ ] })
12015
+ ] }) }),
12016
+ /* @__PURE__ */ jsxs35("div", { className: "flex-1 p-6 bg-[var(--color-background)]", children: [
12017
+ /* @__PURE__ */ jsxs35("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-6 mb-6", children: [
12018
+ /* @__PURE__ */ jsxs35("div", { className: "bg-[var(--color-surface)] rounded-xl p-6 border border-[var(--color-border-light)]", children: [
12019
+ /* @__PURE__ */ jsxs35("div", { className: "flex items-center justify-between mb-4", children: [
12020
+ /* @__PURE__ */ jsx40("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Budget Total" }),
12021
+ /* @__PURE__ */ jsx40("div", { className: "p-2 bg-blue-100 rounded-lg", children: /* @__PURE__ */ jsx40(CircleDollarSign, { className: "w-5 h-5 text-blue-600" }) })
12022
+ ] }),
12023
+ /* @__PURE__ */ jsx40("p", { className: "text-2xl font-bold text-[var(--color-text-primary)]", children: "1,250,000 \u20AC" }),
12024
+ /* @__PURE__ */ jsxs35("p", { className: "text-sm text-green-600 mt-2 flex items-center gap-1", children: [
12025
+ /* @__PURE__ */ jsx40(TrendingUp4, { className: "w-4 h-4" }),
12026
+ "+12% vs ann\xE9e pr\xE9c\xE9dente"
12027
+ ] })
12028
+ ] }),
12029
+ /* @__PURE__ */ jsxs35("div", { className: "bg-[var(--color-surface)] rounded-xl p-6 border border-[var(--color-border-light)]", children: [
12030
+ /* @__PURE__ */ jsxs35("div", { className: "flex items-center justify-between mb-4", children: [
12031
+ /* @__PURE__ */ jsx40("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "D\xE9penses YTD" }),
12032
+ /* @__PURE__ */ jsx40("div", { className: "p-2 bg-orange-100 rounded-lg", children: /* @__PURE__ */ jsx40(TrendingDown2, { className: "w-5 h-5 text-orange-600" }) })
12033
+ ] }),
12034
+ /* @__PURE__ */ jsx40("p", { className: "text-2xl font-bold text-[var(--color-text-primary)]", children: "875,000 \u20AC" }),
12035
+ /* @__PURE__ */ jsx40("p", { className: "text-sm text-[var(--color-text-secondary)] mt-2", children: "70% du budget utilis\xE9" })
12036
+ ] }),
12037
+ /* @__PURE__ */ jsxs35("div", { className: "bg-[var(--color-surface)] rounded-xl p-6 border border-[var(--color-border-light)]", children: [
12038
+ /* @__PURE__ */ jsxs35("div", { className: "flex items-center justify-between mb-4", children: [
12039
+ /* @__PURE__ */ jsx40("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Disponible" }),
12040
+ /* @__PURE__ */ jsx40("div", { className: "p-2 bg-green-100 rounded-lg", children: /* @__PURE__ */ jsx40(PieChart, { className: "w-5 h-5 text-green-600" }) })
12041
+ ] }),
12042
+ /* @__PURE__ */ jsx40("p", { className: "text-2xl font-bold text-green-600", children: "375,000 \u20AC" }),
12043
+ /* @__PURE__ */ jsx40("p", { className: "text-sm text-[var(--color-text-secondary)] mt-2", children: "30% restant" })
12044
+ ] })
12045
+ ] }),
12046
+ /* @__PURE__ */ jsxs35("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-6", children: [
12047
+ /* @__PURE__ */ jsxs35("div", { className: "bg-[var(--color-surface)] rounded-xl border border-[var(--color-border-light)]", children: [
12048
+ /* @__PURE__ */ jsxs35("div", { className: "p-4 border-b border-[var(--color-border-light)] flex items-center gap-2", children: [
12049
+ /* @__PURE__ */ jsx40(BarChart32, { className: "w-5 h-5 text-[var(--color-text-secondary)]" }),
12050
+ /* @__PURE__ */ jsx40("h2", { className: "font-semibold text-[var(--color-text-primary)]", children: "OPEX - D\xE9penses Op\xE9rationnelles" })
12051
+ ] }),
12052
+ /* @__PURE__ */ jsxs35("div", { className: "p-4 space-y-4", children: [
12053
+ /* @__PURE__ */ jsxs35("div", { children: [
12054
+ /* @__PURE__ */ jsxs35("div", { className: "flex justify-between text-sm mb-1", children: [
12055
+ /* @__PURE__ */ jsx40("span", { className: "text-[var(--color-text-secondary)]", children: "Salaires" }),
12056
+ /* @__PURE__ */ jsx40("span", { className: "text-[var(--color-text-primary)]", children: "450,000 \u20AC" })
12057
+ ] }),
12058
+ /* @__PURE__ */ jsx40("div", { className: "w-full bg-[var(--color-border)] rounded-full h-2", children: /* @__PURE__ */ jsx40("div", { className: "bg-blue-600 h-2 rounded-full", style: { width: "75%" } }) })
12059
+ ] }),
12060
+ /* @__PURE__ */ jsxs35("div", { children: [
12061
+ /* @__PURE__ */ jsxs35("div", { className: "flex justify-between text-sm mb-1", children: [
12062
+ /* @__PURE__ */ jsx40("span", { className: "text-[var(--color-text-secondary)]", children: "Fournitures" }),
12063
+ /* @__PURE__ */ jsx40("span", { className: "text-[var(--color-text-primary)]", children: "125,000 \u20AC" })
12064
+ ] }),
12065
+ /* @__PURE__ */ jsx40("div", { className: "w-full bg-[var(--color-border)] rounded-full h-2", children: /* @__PURE__ */ jsx40("div", { className: "bg-green-600 h-2 rounded-full", style: { width: "60%" } }) })
12066
+ ] }),
12067
+ /* @__PURE__ */ jsxs35("div", { children: [
12068
+ /* @__PURE__ */ jsxs35("div", { className: "flex justify-between text-sm mb-1", children: [
12069
+ /* @__PURE__ */ jsx40("span", { className: "text-[var(--color-text-secondary)]", children: "Services" }),
12070
+ /* @__PURE__ */ jsx40("span", { className: "text-[var(--color-text-primary)]", children: "200,000 \u20AC" })
12071
+ ] }),
12072
+ /* @__PURE__ */ jsx40("div", { className: "w-full bg-[var(--color-border)] rounded-full h-2", children: /* @__PURE__ */ jsx40("div", { className: "bg-purple-600 h-2 rounded-full", style: { width: "80%" } }) })
12073
+ ] })
12074
+ ] })
12075
+ ] }),
12076
+ /* @__PURE__ */ jsxs35("div", { className: "bg-[var(--color-surface)] rounded-xl border border-[var(--color-border-light)]", children: [
12077
+ /* @__PURE__ */ jsxs35("div", { className: "p-4 border-b border-[var(--color-border-light)] flex items-center gap-2", children: [
12078
+ /* @__PURE__ */ jsx40(FileText10, { className: "w-5 h-5 text-[var(--color-text-secondary)]" }),
12079
+ /* @__PURE__ */ jsx40("h2", { className: "font-semibold text-[var(--color-text-primary)]", children: "CAPEX - Investissements" })
12080
+ ] }),
12081
+ /* @__PURE__ */ jsxs35("div", { className: "p-4 space-y-4", children: [
12082
+ /* @__PURE__ */ jsxs35("div", { children: [
12083
+ /* @__PURE__ */ jsxs35("div", { className: "flex justify-between text-sm mb-1", children: [
12084
+ /* @__PURE__ */ jsx40("span", { className: "text-[var(--color-text-secondary)]", children: "\xC9quipements IT" }),
12085
+ /* @__PURE__ */ jsx40("span", { className: "text-[var(--color-text-primary)]", children: "75,000 \u20AC" })
12086
+ ] }),
12087
+ /* @__PURE__ */ jsx40("div", { className: "w-full bg-[var(--color-border)] rounded-full h-2", children: /* @__PURE__ */ jsx40("div", { className: "bg-indigo-600 h-2 rounded-full", style: { width: "50%" } }) })
12088
+ ] }),
12089
+ /* @__PURE__ */ jsxs35("div", { children: [
12090
+ /* @__PURE__ */ jsxs35("div", { className: "flex justify-between text-sm mb-1", children: [
12091
+ /* @__PURE__ */ jsx40("span", { className: "text-[var(--color-text-secondary)]", children: "Mobilier" }),
12092
+ /* @__PURE__ */ jsx40("span", { className: "text-[var(--color-text-primary)]", children: "25,000 \u20AC" })
12093
+ ] }),
12094
+ /* @__PURE__ */ jsx40("div", { className: "w-full bg-[var(--color-border)] rounded-full h-2", children: /* @__PURE__ */ jsx40("div", { className: "bg-pink-600 h-2 rounded-full", style: { width: "30%" } }) })
12095
+ ] }),
12096
+ /* @__PURE__ */ jsxs35("div", { children: [
12097
+ /* @__PURE__ */ jsxs35("div", { className: "flex justify-between text-sm mb-1", children: [
12098
+ /* @__PURE__ */ jsx40("span", { className: "text-[var(--color-text-secondary)]", children: "V\xE9hicules" }),
12099
+ /* @__PURE__ */ jsx40("span", { className: "text-[var(--color-text-primary)]", children: "0 \u20AC" })
12100
+ ] }),
12101
+ /* @__PURE__ */ jsx40("div", { className: "w-full bg-[var(--color-border)] rounded-full h-2", children: /* @__PURE__ */ jsx40("div", { className: "bg-orange-600 h-2 rounded-full", style: { width: "0%" } }) })
12102
+ ] })
12103
+ ] })
12104
+ ] })
12105
+ ] })
12106
+ ] })
12107
+ ] });
12108
+ };
12109
+ var BudgetPage_default = BudgetPage;
12110
+
12111
+ // src/pages/workspaces/ChatEquipePage.tsx
12112
+ import { useState as useState26 } from "react";
12113
+ import { MessageCircle, Send as Send3, Search as Search4, Users as Users8, Plus as Plus6, Phone as Phone3, Video as Video2, MoreVertical as MoreVertical2 } from "lucide-react";
12114
+ import { jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
12115
+ var ChatEquipePage = () => {
12116
+ const [message, setMessage] = useState26("");
12117
+ return /* @__PURE__ */ jsxs36("div", { className: "h-full flex flex-col", children: [
12118
+ /* @__PURE__ */ jsx41("div", { className: "bg-[var(--color-surface)] border-b border-[var(--color-border)] px-6 py-4", children: /* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-3", children: [
12119
+ /* @__PURE__ */ jsx41("div", { className: "p-2 bg-indigo-100 rounded-lg", children: /* @__PURE__ */ jsx41(MessageCircle, { className: "w-6 h-6 text-indigo-600" }) }),
12120
+ /* @__PURE__ */ jsxs36("div", { children: [
12121
+ /* @__PURE__ */ jsx41("h1", { className: "text-xl font-semibold text-[var(--color-text-primary)]", children: "Chat \xC9quipe" }),
12122
+ /* @__PURE__ */ jsx41("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Communication interne et messagerie" })
12123
+ ] })
12124
+ ] }) }),
12125
+ /* @__PURE__ */ jsxs36("div", { className: "flex-1 flex overflow-hidden bg-[var(--color-background)]", children: [
12126
+ /* @__PURE__ */ jsxs36("div", { className: "w-80 border-r border-[var(--color-border)] bg-[var(--color-surface)] flex flex-col", children: [
12127
+ /* @__PURE__ */ jsx41("div", { className: "p-4 border-b border-[var(--color-border-light)]", children: /* @__PURE__ */ jsxs36("div", { className: "relative", children: [
12128
+ /* @__PURE__ */ jsx41(Search4, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-tertiary)]" }),
12129
+ /* @__PURE__ */ jsx41(
12130
+ "input",
12131
+ {
12132
+ type: "text",
12133
+ placeholder: "Rechercher...",
12134
+ className: "w-full pl-9 pr-4 py-2 text-sm border border-[var(--color-border)] rounded-lg\r\n focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]/20 focus:border-[var(--color-primary)]\r\n bg-[var(--color-background)] text-[var(--color-text-primary)]"
12135
+ }
12136
+ )
12137
+ ] }) }),
12138
+ /* @__PURE__ */ jsxs36("div", { className: "flex-1 overflow-y-auto", children: [
12139
+ /* @__PURE__ */ jsxs36("div", { className: "p-2", children: [
12140
+ /* @__PURE__ */ jsxs36("div", { className: "flex items-center justify-between px-3 py-2", children: [
12141
+ /* @__PURE__ */ jsx41("span", { className: "text-xs font-semibold text-[var(--color-text-tertiary)] uppercase", children: "Canaux" }),
12142
+ /* @__PURE__ */ jsx41("button", { className: "p-1 hover:bg-[var(--color-surface-hover)] rounded", children: /* @__PURE__ */ jsx41(Plus6, { className: "w-4 h-4 text-[var(--color-text-tertiary)]" }) })
12143
+ ] }),
12144
+ /* @__PURE__ */ jsxs36("button", { className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg bg-[var(--color-primary-light)] text-[var(--color-primary)]", children: [
12145
+ /* @__PURE__ */ jsx41("span", { className: "text-lg", children: "#" }),
12146
+ /* @__PURE__ */ jsx41("span", { className: "text-sm font-medium", children: "g\xE9n\xE9ral" }),
12147
+ /* @__PURE__ */ jsx41("span", { className: "ml-auto text-xs bg-[var(--color-primary)] text-white px-2 py-0.5 rounded-full", children: "3" })
12148
+ ] }),
12149
+ /* @__PURE__ */ jsxs36("button", { className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] text-[var(--color-text-primary)]", children: [
12150
+ /* @__PURE__ */ jsx41("span", { className: "text-lg", children: "#" }),
12151
+ /* @__PURE__ */ jsx41("span", { className: "text-sm", children: "projets" })
12152
+ ] }),
12153
+ /* @__PURE__ */ jsxs36("button", { className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] text-[var(--color-text-primary)]", children: [
12154
+ /* @__PURE__ */ jsx41("span", { className: "text-lg", children: "#" }),
12155
+ /* @__PURE__ */ jsx41("span", { className: "text-sm", children: "annonces" })
12156
+ ] })
12157
+ ] }),
12158
+ /* @__PURE__ */ jsxs36("div", { className: "p-2 mt-2", children: [
12159
+ /* @__PURE__ */ jsx41("div", { className: "flex items-center justify-between px-3 py-2", children: /* @__PURE__ */ jsx41("span", { className: "text-xs font-semibold text-[var(--color-text-tertiary)] uppercase", children: "Messages Directs" }) }),
12160
+ /* @__PURE__ */ jsxs36("button", { className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)]", children: [
12161
+ /* @__PURE__ */ jsx41("div", { className: "w-8 h-8 bg-blue-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx41("span", { className: "text-xs font-medium text-blue-600", children: "JD" }) }),
12162
+ /* @__PURE__ */ jsxs36("div", { className: "flex-1 text-left", children: [
12163
+ /* @__PURE__ */ jsx41("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Jean Dupont" }),
12164
+ /* @__PURE__ */ jsx41("p", { className: "text-xs text-[var(--color-text-tertiary)] truncate", children: "D'accord, merci!" })
12165
+ ] })
12166
+ ] }),
12167
+ /* @__PURE__ */ jsxs36("button", { className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)]", children: [
12168
+ /* @__PURE__ */ jsx41("div", { className: "w-8 h-8 bg-green-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx41("span", { className: "text-xs font-medium text-green-600", children: "ML" }) }),
12169
+ /* @__PURE__ */ jsxs36("div", { className: "flex-1 text-left", children: [
12170
+ /* @__PURE__ */ jsx41("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Marie Lambert" }),
12171
+ /* @__PURE__ */ jsx41("p", { className: "text-xs text-[var(--color-text-tertiary)] truncate", children: "Le rapport est pr\xEAt" })
12172
+ ] })
12173
+ ] })
12174
+ ] })
12175
+ ] })
12176
+ ] }),
12177
+ /* @__PURE__ */ jsxs36("div", { className: "flex-1 flex flex-col", children: [
12178
+ /* @__PURE__ */ jsxs36("div", { className: "bg-[var(--color-surface)] border-b border-[var(--color-border-light)] px-6 py-3 flex items-center justify-between", children: [
12179
+ /* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-3", children: [
12180
+ /* @__PURE__ */ jsx41("span", { className: "text-lg font-medium text-[var(--color-text-primary)]", children: "# g\xE9n\xE9ral" }),
12181
+ /* @__PURE__ */ jsx41("span", { className: "text-sm text-[var(--color-text-tertiary)]", children: "|" }),
12182
+ /* @__PURE__ */ jsx41("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Canal de discussion g\xE9n\xE9rale" })
12183
+ ] }),
12184
+ /* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2", children: [
12185
+ /* @__PURE__ */ jsx41("button", { className: "p-2 hover:bg-[var(--color-surface-hover)] rounded-lg", children: /* @__PURE__ */ jsx41(Users8, { className: "w-5 h-5 text-[var(--color-text-tertiary)]" }) }),
12186
+ /* @__PURE__ */ jsx41("button", { className: "p-2 hover:bg-[var(--color-surface-hover)] rounded-lg", children: /* @__PURE__ */ jsx41(Phone3, { className: "w-5 h-5 text-[var(--color-text-tertiary)]" }) }),
12187
+ /* @__PURE__ */ jsx41("button", { className: "p-2 hover:bg-[var(--color-surface-hover)] rounded-lg", children: /* @__PURE__ */ jsx41(Video2, { className: "w-5 h-5 text-[var(--color-text-tertiary)]" }) }),
12188
+ /* @__PURE__ */ jsx41("button", { className: "p-2 hover:bg-[var(--color-surface-hover)] rounded-lg", children: /* @__PURE__ */ jsx41(MoreVertical2, { className: "w-5 h-5 text-[var(--color-text-tertiary)]" }) })
12189
+ ] })
12190
+ ] }),
12191
+ /* @__PURE__ */ jsxs36("div", { className: "flex-1 overflow-y-auto p-6 space-y-4", children: [
12192
+ /* @__PURE__ */ jsxs36("div", { className: "flex gap-3", children: [
12193
+ /* @__PURE__ */ jsx41("div", { className: "w-10 h-10 bg-blue-100 rounded-full flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx41("span", { className: "text-sm font-medium text-blue-600", children: "JD" }) }),
12194
+ /* @__PURE__ */ jsxs36("div", { children: [
12195
+ /* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2", children: [
12196
+ /* @__PURE__ */ jsx41("span", { className: "font-medium text-[var(--color-text-primary)]", children: "Jean Dupont" }),
12197
+ /* @__PURE__ */ jsx41("span", { className: "text-xs text-[var(--color-text-tertiary)]", children: "10:30" })
12198
+ ] }),
12199
+ /* @__PURE__ */ jsx41("p", { className: "text-sm text-[var(--color-text-primary)] mt-1", children: "Bonjour \xE0 tous ! La r\xE9union de ce matin est report\xE9e \xE0 14h." })
12200
+ ] })
12201
+ ] }),
12202
+ /* @__PURE__ */ jsxs36("div", { className: "flex gap-3", children: [
12203
+ /* @__PURE__ */ jsx41("div", { className: "w-10 h-10 bg-green-100 rounded-full flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx41("span", { className: "text-sm font-medium text-green-600", children: "ML" }) }),
12204
+ /* @__PURE__ */ jsxs36("div", { children: [
12205
+ /* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2", children: [
12206
+ /* @__PURE__ */ jsx41("span", { className: "font-medium text-[var(--color-text-primary)]", children: "Marie Lambert" }),
12207
+ /* @__PURE__ */ jsx41("span", { className: "text-xs text-[var(--color-text-tertiary)]", children: "10:32" })
12208
+ ] }),
12209
+ /* @__PURE__ */ jsx41("p", { className: "text-sm text-[var(--color-text-primary)] mt-1", children: "Bien not\xE9, merci pour l'info !" })
12210
+ ] })
12211
+ ] })
12212
+ ] }),
12213
+ /* @__PURE__ */ jsx41("div", { className: "bg-[var(--color-surface)] border-t border-[var(--color-border-light)] p-4", children: /* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-3", children: [
12214
+ /* @__PURE__ */ jsx41(
12215
+ "input",
12216
+ {
12217
+ type: "text",
12218
+ placeholder: "\xC9crire un message...",
12219
+ value: message,
12220
+ onChange: (e) => setMessage(e.target.value),
12221
+ className: "flex-1 px-4 py-2 border border-[var(--color-border)] rounded-lg\r\n focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]/20 focus:border-[var(--color-primary)]\r\n bg-[var(--color-background)] text-[var(--color-text-primary)]"
12222
+ }
12223
+ ),
12224
+ /* @__PURE__ */ jsx41("button", { className: "p-2 bg-[var(--color-primary)] text-white rounded-lg hover:bg-[var(--color-primary-dark)] transition-colors", children: /* @__PURE__ */ jsx41(Send3, { className: "w-5 h-5" }) })
12225
+ ] }) })
12226
+ ] })
12227
+ ] })
12228
+ ] });
12229
+ };
12230
+ var ChatEquipePage_default = ChatEquipePage;
12231
+
12232
+ // src/pages/workspaces/ActifsPage.tsx
12233
+ import { Building2 as Building26, Package as Package2, Truck as Truck2, Laptop, Wrench as Wrench2, MapPin as MapPin5, Search as Search5, Plus as Plus7, Filter as Filter2 } from "lucide-react";
12234
+ import { jsx as jsx42, jsxs as jsxs37 } from "react/jsx-runtime";
12235
+ var ActifsPage = () => {
12236
+ return /* @__PURE__ */ jsxs37("div", { className: "h-full flex flex-col", children: [
12237
+ /* @__PURE__ */ jsx42("div", { className: "bg-[var(--color-surface)] border-b border-[var(--color-border)] px-6 py-4", children: /* @__PURE__ */ jsxs37("div", { className: "flex items-center justify-between", children: [
12238
+ /* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-3", children: [
12239
+ /* @__PURE__ */ jsx42("div", { className: "p-2 bg-orange-100 rounded-lg", children: /* @__PURE__ */ jsx42(Building26, { className: "w-6 h-6 text-orange-600" }) }),
12240
+ /* @__PURE__ */ jsxs37("div", { children: [
12241
+ /* @__PURE__ */ jsx42("h1", { className: "text-xl font-semibold text-[var(--color-text-primary)]", children: "Actifs" }),
12242
+ /* @__PURE__ */ jsx42("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Gestion des immobilisations et \xE9quipements" })
12243
+ ] })
12244
+ ] }),
12245
+ /* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-3", children: [
12246
+ /* @__PURE__ */ jsxs37(SecondaryButton, { variant: "outline", children: [
12247
+ /* @__PURE__ */ jsx42(Filter2, { className: "w-4 h-4 mr-2" }),
12248
+ "Filtrer"
12249
+ ] }),
12250
+ /* @__PURE__ */ jsxs37(Buttons_default, { children: [
12251
+ /* @__PURE__ */ jsx42(Plus7, { className: "w-4 h-4 mr-2" }),
12252
+ "Nouvel actif"
12253
+ ] })
12254
+ ] })
12255
+ ] }) }),
12256
+ /* @__PURE__ */ jsxs37("div", { className: "flex-1 p-6 bg-[var(--color-background)]", children: [
12257
+ /* @__PURE__ */ jsx42("div", { className: "mb-6", children: /* @__PURE__ */ jsxs37("div", { className: "relative max-w-md", children: [
12258
+ /* @__PURE__ */ jsx42(Search5, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-tertiary)]" }),
12259
+ /* @__PURE__ */ jsx42(
12260
+ "input",
12261
+ {
12262
+ type: "text",
12263
+ placeholder: "Rechercher un actif...",
12264
+ className: "w-full pl-9 pr-4 py-2 text-sm border border-[var(--color-border)] rounded-lg\r\n focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]/20 focus:border-[var(--color-primary)]\r\n bg-[var(--color-surface)] text-[var(--color-text-primary)]"
12265
+ }
12266
+ )
12267
+ ] }) }),
12268
+ /* @__PURE__ */ jsxs37("div", { className: "grid grid-cols-1 md:grid-cols-4 gap-4 mb-6", children: [
12269
+ /* @__PURE__ */ jsx42("div", { className: "bg-[var(--color-surface)] rounded-xl p-4 border border-[var(--color-border-light)]", children: /* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-3", children: [
12270
+ /* @__PURE__ */ jsx42("div", { className: "p-2 bg-blue-100 rounded-lg", children: /* @__PURE__ */ jsx42(Laptop, { className: "w-5 h-5 text-blue-600" }) }),
12271
+ /* @__PURE__ */ jsxs37("div", { children: [
12272
+ /* @__PURE__ */ jsx42("p", { className: "text-2xl font-bold text-[var(--color-text-primary)]", children: "156" }),
12273
+ /* @__PURE__ */ jsx42("p", { className: "text-xs text-[var(--color-text-secondary)]", children: "\xC9quipements IT" })
12274
+ ] })
12275
+ ] }) }),
12276
+ /* @__PURE__ */ jsx42("div", { className: "bg-[var(--color-surface)] rounded-xl p-4 border border-[var(--color-border-light)]", children: /* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-3", children: [
12277
+ /* @__PURE__ */ jsx42("div", { className: "p-2 bg-green-100 rounded-lg", children: /* @__PURE__ */ jsx42(Truck2, { className: "w-5 h-5 text-green-600" }) }),
12278
+ /* @__PURE__ */ jsxs37("div", { children: [
12279
+ /* @__PURE__ */ jsx42("p", { className: "text-2xl font-bold text-[var(--color-text-primary)]", children: "24" }),
12280
+ /* @__PURE__ */ jsx42("p", { className: "text-xs text-[var(--color-text-secondary)]", children: "V\xE9hicules" })
12281
+ ] })
12282
+ ] }) }),
12283
+ /* @__PURE__ */ jsx42("div", { className: "bg-[var(--color-surface)] rounded-xl p-4 border border-[var(--color-border-light)]", children: /* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-3", children: [
12284
+ /* @__PURE__ */ jsx42("div", { className: "p-2 bg-purple-100 rounded-lg", children: /* @__PURE__ */ jsx42(Package2, { className: "w-5 h-5 text-purple-600" }) }),
12285
+ /* @__PURE__ */ jsxs37("div", { children: [
12286
+ /* @__PURE__ */ jsx42("p", { className: "text-2xl font-bold text-[var(--color-text-primary)]", children: "89" }),
12287
+ /* @__PURE__ */ jsx42("p", { className: "text-xs text-[var(--color-text-secondary)]", children: "Mobilier" })
12288
+ ] })
12289
+ ] }) }),
12290
+ /* @__PURE__ */ jsx42("div", { className: "bg-[var(--color-surface)] rounded-xl p-4 border border-[var(--color-border-light)]", children: /* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-3", children: [
12291
+ /* @__PURE__ */ jsx42("div", { className: "p-2 bg-orange-100 rounded-lg", children: /* @__PURE__ */ jsx42(Wrench2, { className: "w-5 h-5 text-orange-600" }) }),
12292
+ /* @__PURE__ */ jsxs37("div", { children: [
12293
+ /* @__PURE__ */ jsx42("p", { className: "text-2xl font-bold text-[var(--color-text-primary)]", children: "12" }),
12294
+ /* @__PURE__ */ jsx42("p", { className: "text-xs text-[var(--color-text-secondary)]", children: "En maintenance" })
12295
+ ] })
12296
+ ] }) })
12297
+ ] }),
12298
+ /* @__PURE__ */ jsx42("div", { className: "bg-[var(--color-surface)] rounded-xl border border-[var(--color-border-light)] overflow-hidden", children: /* @__PURE__ */ jsx42("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs37("table", { className: "w-full", children: [
12299
+ /* @__PURE__ */ jsx42("thead", { className: "bg-[var(--color-background)]", children: /* @__PURE__ */ jsxs37("tr", { children: [
12300
+ /* @__PURE__ */ jsx42("th", { className: "px-6 py-3 text-left text-xs font-semibold text-[var(--color-text-secondary)] uppercase", children: "Code" }),
12301
+ /* @__PURE__ */ jsx42("th", { className: "px-6 py-3 text-left text-xs font-semibold text-[var(--color-text-secondary)] uppercase", children: "D\xE9signation" }),
12302
+ /* @__PURE__ */ jsx42("th", { className: "px-6 py-3 text-left text-xs font-semibold text-[var(--color-text-secondary)] uppercase", children: "Cat\xE9gorie" }),
12303
+ /* @__PURE__ */ jsx42("th", { className: "px-6 py-3 text-left text-xs font-semibold text-[var(--color-text-secondary)] uppercase", children: "Localisation" }),
12304
+ /* @__PURE__ */ jsx42("th", { className: "px-6 py-3 text-left text-xs font-semibold text-[var(--color-text-secondary)] uppercase", children: "\xC9tat" }),
12305
+ /* @__PURE__ */ jsx42("th", { className: "px-6 py-3 text-left text-xs font-semibold text-[var(--color-text-secondary)] uppercase", children: "Valeur" })
12306
+ ] }) }),
12307
+ /* @__PURE__ */ jsxs37("tbody", { className: "divide-y divide-[var(--color-border-light)]", children: [
12308
+ /* @__PURE__ */ jsxs37("tr", { className: "hover:bg-[var(--color-surface-hover)]", children: [
12309
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4 text-sm font-medium text-[var(--color-primary)]", children: "ACT-001" }),
12310
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4 text-sm text-[var(--color-text-primary)]", children: 'MacBook Pro 16"' }),
12311
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4", children: /* @__PURE__ */ jsxs37("span", { className: "inline-flex items-center gap-1 px-2 py-1 text-xs bg-blue-100 text-blue-700 rounded", children: [
12312
+ /* @__PURE__ */ jsx42(Laptop, { className: "w-3 h-3" }),
12313
+ "IT"
12314
+ ] }) }),
12315
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4 text-sm text-[var(--color-text-secondary)]", children: /* @__PURE__ */ jsxs37("span", { className: "flex items-center gap-1", children: [
12316
+ /* @__PURE__ */ jsx42(MapPin5, { className: "w-3 h-3" }),
12317
+ "Bureau A-201"
12318
+ ] }) }),
12319
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4", children: /* @__PURE__ */ jsx42("span", { className: "px-2 py-1 text-xs bg-green-100 text-green-700 rounded", children: "Actif" }) }),
12320
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4 text-sm text-[var(--color-text-primary)]", children: "2,499 \u20AC" })
12321
+ ] }),
12322
+ /* @__PURE__ */ jsxs37("tr", { className: "hover:bg-[var(--color-surface-hover)]", children: [
12323
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4 text-sm font-medium text-[var(--color-primary)]", children: "ACT-002" }),
12324
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4 text-sm text-[var(--color-text-primary)]", children: "Bureau ergonomique" }),
12325
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4", children: /* @__PURE__ */ jsxs37("span", { className: "inline-flex items-center gap-1 px-2 py-1 text-xs bg-purple-100 text-purple-700 rounded", children: [
12326
+ /* @__PURE__ */ jsx42(Package2, { className: "w-3 h-3" }),
12327
+ "Mobilier"
12328
+ ] }) }),
12329
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4 text-sm text-[var(--color-text-secondary)]", children: /* @__PURE__ */ jsxs37("span", { className: "flex items-center gap-1", children: [
12330
+ /* @__PURE__ */ jsx42(MapPin5, { className: "w-3 h-3" }),
12331
+ "Bureau A-201"
12332
+ ] }) }),
12333
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4", children: /* @__PURE__ */ jsx42("span", { className: "px-2 py-1 text-xs bg-green-100 text-green-700 rounded", children: "Actif" }) }),
12334
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4 text-sm text-[var(--color-text-primary)]", children: "890 \u20AC" })
12335
+ ] }),
12336
+ /* @__PURE__ */ jsxs37("tr", { className: "hover:bg-[var(--color-surface-hover)]", children: [
12337
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4 text-sm font-medium text-[var(--color-primary)]", children: "ACT-003" }),
12338
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4 text-sm text-[var(--color-text-primary)]", children: "Renault Kangoo" }),
12339
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4", children: /* @__PURE__ */ jsxs37("span", { className: "inline-flex items-center gap-1 px-2 py-1 text-xs bg-green-100 text-green-700 rounded", children: [
12340
+ /* @__PURE__ */ jsx42(Truck2, { className: "w-3 h-3" }),
12341
+ "V\xE9hicule"
12342
+ ] }) }),
12343
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4 text-sm text-[var(--color-text-secondary)]", children: /* @__PURE__ */ jsxs37("span", { className: "flex items-center gap-1", children: [
12344
+ /* @__PURE__ */ jsx42(MapPin5, { className: "w-3 h-3" }),
12345
+ "Parking B"
12346
+ ] }) }),
12347
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4", children: /* @__PURE__ */ jsx42("span", { className: "px-2 py-1 text-xs bg-orange-100 text-orange-700 rounded", children: "Maintenance" }) }),
12348
+ /* @__PURE__ */ jsx42("td", { className: "px-6 py-4 text-sm text-[var(--color-text-primary)]", children: "18,500 \u20AC" })
12349
+ ] })
12350
+ ] })
12351
+ ] }) }) })
12352
+ ] })
12353
+ ] });
12354
+ };
12355
+ var ActifsPage_default = ActifsPage;
12356
+
12357
+ // src/pages/workspaces/PlanningPage.tsx
12358
+ import { useState as useState27 } from "react";
12359
+ import { CalendarClock, ChevronLeft as ChevronLeft4, ChevronRight as ChevronRight4, Plus as Plus8, Users as Users9, Clock as Clock7 } from "lucide-react";
12360
+ import { Fragment as Fragment10, jsx as jsx43, jsxs as jsxs38 } from "react/jsx-runtime";
12361
+ var DAYS = ["Lun", "Mar", "Mer", "Jeu", "Ven", "Sam", "Dim"];
12362
+ var MONTHS = ["Janvier", "F\xE9vrier", "Mars", "Avril", "Mai", "Juin", "Juillet", "Ao\xFBt", "Septembre", "Octobre", "Novembre", "D\xE9cembre"];
12363
+ var PlanningPage = () => {
12364
+ const [currentDate] = useState27(/* @__PURE__ */ new Date());
12365
+ const currentMonth = MONTHS[currentDate.getMonth()];
12366
+ const currentYear = currentDate.getFullYear();
12367
+ return /* @__PURE__ */ jsxs38("div", { className: "h-full flex flex-col", children: [
12368
+ /* @__PURE__ */ jsx43("div", { className: "bg-[var(--color-surface)] border-b border-[var(--color-border)] px-6 py-4", children: /* @__PURE__ */ jsxs38("div", { className: "flex items-center justify-between", children: [
12369
+ /* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-3", children: [
12370
+ /* @__PURE__ */ jsx43("div", { className: "p-2 bg-teal-100 rounded-lg", children: /* @__PURE__ */ jsx43(CalendarClock, { className: "w-6 h-6 text-teal-600" }) }),
12371
+ /* @__PURE__ */ jsxs38("div", { children: [
12372
+ /* @__PURE__ */ jsx43("h1", { className: "text-xl font-semibold text-[var(--color-text-primary)]", children: "Planning" }),
12373
+ /* @__PURE__ */ jsx43("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Planification des ressources et emploi du temps" })
12374
+ ] })
12375
+ ] }),
12376
+ /* @__PURE__ */ jsxs38(Buttons_default, { children: [
12377
+ /* @__PURE__ */ jsx43(Plus8, { className: "w-4 h-4 mr-2" }),
12378
+ "Nouveau planning"
12379
+ ] })
12380
+ ] }) }),
12381
+ /* @__PURE__ */ jsx43("div", { className: "flex-1 p-6 bg-[var(--color-background)]", children: /* @__PURE__ */ jsxs38("div", { className: "grid grid-cols-1 lg:grid-cols-4 gap-6", children: [
12382
+ /* @__PURE__ */ jsxs38("div", { className: "lg:col-span-3 bg-[var(--color-surface)] rounded-xl border border-[var(--color-border-light)]", children: [
12383
+ /* @__PURE__ */ jsxs38("div", { className: "flex items-center justify-between p-4 border-b border-[var(--color-border-light)]", children: [
12384
+ /* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-4", children: [
12385
+ /* @__PURE__ */ jsx43("button", { className: "p-2 hover:bg-[var(--color-surface-hover)] rounded-lg", children: /* @__PURE__ */ jsx43(ChevronLeft4, { className: "w-5 h-5 text-[var(--color-text-secondary)]" }) }),
12386
+ /* @__PURE__ */ jsxs38("h2", { className: "text-lg font-semibold text-[var(--color-text-primary)]", children: [
12387
+ currentMonth,
12388
+ " ",
12389
+ currentYear
12390
+ ] }),
12391
+ /* @__PURE__ */ jsx43("button", { className: "p-2 hover:bg-[var(--color-surface-hover)] rounded-lg", children: /* @__PURE__ */ jsx43(ChevronRight4, { className: "w-5 h-5 text-[var(--color-text-secondary)]" }) })
12392
+ ] }),
12393
+ /* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-2", children: [
12394
+ /* @__PURE__ */ jsx43("button", { className: "px-3 py-1.5 text-sm bg-[var(--color-primary)] text-white rounded-lg", children: "Aujourd'hui" }),
12395
+ /* @__PURE__ */ jsx43("button", { className: "px-3 py-1.5 text-sm border border-[var(--color-border)] rounded-lg hover:bg-[var(--color-surface-hover)]", children: "Semaine" }),
12396
+ /* @__PURE__ */ jsx43("button", { className: "px-3 py-1.5 text-sm border border-[var(--color-border)] rounded-lg hover:bg-[var(--color-surface-hover)]", children: "Mois" })
12397
+ ] })
12398
+ ] }),
12399
+ /* @__PURE__ */ jsxs38("div", { className: "p-4", children: [
12400
+ /* @__PURE__ */ jsx43("div", { className: "grid grid-cols-7 gap-2 mb-2", children: DAYS.map((day) => /* @__PURE__ */ jsx43("div", { className: "text-center text-xs font-semibold text-[var(--color-text-tertiary)] py-2", children: day }, day)) }),
12401
+ /* @__PURE__ */ jsx43("div", { className: "grid grid-cols-7 gap-2", children: Array.from({ length: 35 }, (_, i) => {
12402
+ const dayNum = i - 3;
12403
+ const isCurrentMonth = dayNum >= 0 && dayNum < 31;
12404
+ const isToday = dayNum + 1 === currentDate.getDate();
12405
+ return /* @__PURE__ */ jsx43(
12406
+ "div",
12407
+ {
12408
+ className: `
12409
+ min-h-[80px] p-2 rounded-lg border transition-colors cursor-pointer
12410
+ ${isCurrentMonth ? "border-[var(--color-border-light)] hover:border-[var(--color-primary)]" : "border-transparent"}
12411
+ ${isToday ? "bg-[var(--color-primary-light)] border-[var(--color-primary)]" : ""}
12412
+ `,
12413
+ children: isCurrentMonth && /* @__PURE__ */ jsxs38(Fragment10, { children: [
12414
+ /* @__PURE__ */ jsx43("span", { className: `text-sm ${isToday ? "font-bold text-[var(--color-primary)]" : "text-[var(--color-text-primary)]"}`, children: dayNum + 1 }),
12415
+ dayNum === 4 && /* @__PURE__ */ jsx43("div", { className: "mt-1 px-1.5 py-0.5 bg-blue-100 text-blue-700 text-xs rounded truncate", children: "R\xE9union \xE9quipe" }),
12416
+ dayNum === 10 && /* @__PURE__ */ jsx43("div", { className: "mt-1 px-1.5 py-0.5 bg-green-100 text-green-700 text-xs rounded truncate", children: "Formation" }),
12417
+ dayNum === 15 && /* @__PURE__ */ jsx43("div", { className: "mt-1 px-1.5 py-0.5 bg-purple-100 text-purple-700 text-xs rounded truncate", children: "Deadline projet" })
12418
+ ] })
12419
+ },
12420
+ i
12421
+ );
12422
+ }) })
12423
+ ] })
12424
+ ] }),
12425
+ /* @__PURE__ */ jsxs38("div", { className: "space-y-6", children: [
12426
+ /* @__PURE__ */ jsxs38("div", { className: "bg-[var(--color-surface)] rounded-xl border border-[var(--color-border-light)]", children: [
12427
+ /* @__PURE__ */ jsx43("div", { className: "p-4 border-b border-[var(--color-border-light)]", children: /* @__PURE__ */ jsx43("h3", { className: "font-semibold text-[var(--color-text-primary)]", children: "\xC9v\xE9nements \xE0 venir" }) }),
12428
+ /* @__PURE__ */ jsxs38("div", { className: "p-4 space-y-3", children: [
12429
+ /* @__PURE__ */ jsxs38("div", { className: "flex items-start gap-3 p-3 bg-blue-50 rounded-lg", children: [
12430
+ /* @__PURE__ */ jsx43("div", { className: "p-1.5 bg-blue-100 rounded", children: /* @__PURE__ */ jsx43(Clock7, { className: "w-4 h-4 text-blue-600" }) }),
12431
+ /* @__PURE__ */ jsxs38("div", { children: [
12432
+ /* @__PURE__ */ jsx43("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: "R\xE9union \xE9quipe" }),
12433
+ /* @__PURE__ */ jsx43("p", { className: "text-xs text-[var(--color-text-secondary)]", children: "Demain, 09:00" })
12434
+ ] })
12435
+ ] }),
12436
+ /* @__PURE__ */ jsxs38("div", { className: "flex items-start gap-3 p-3 bg-green-50 rounded-lg", children: [
12437
+ /* @__PURE__ */ jsx43("div", { className: "p-1.5 bg-green-100 rounded", children: /* @__PURE__ */ jsx43(Users9, { className: "w-4 h-4 text-green-600" }) }),
12438
+ /* @__PURE__ */ jsxs38("div", { children: [
12439
+ /* @__PURE__ */ jsx43("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: "Formation" }),
12440
+ /* @__PURE__ */ jsx43("p", { className: "text-xs text-[var(--color-text-secondary)]", children: "15 D\xE9c, 14:00" })
12441
+ ] })
12442
+ ] }),
12443
+ /* @__PURE__ */ jsxs38("div", { className: "flex items-start gap-3 p-3 bg-purple-50 rounded-lg", children: [
12444
+ /* @__PURE__ */ jsx43("div", { className: "p-1.5 bg-purple-100 rounded", children: /* @__PURE__ */ jsx43(CalendarClock, { className: "w-4 h-4 text-purple-600" }) }),
12445
+ /* @__PURE__ */ jsxs38("div", { children: [
12446
+ /* @__PURE__ */ jsx43("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: "Deadline projet" }),
12447
+ /* @__PURE__ */ jsx43("p", { className: "text-xs text-[var(--color-text-secondary)]", children: "20 D\xE9c, 18:00" })
12448
+ ] })
12449
+ ] })
12450
+ ] })
12451
+ ] }),
12452
+ /* @__PURE__ */ jsxs38("div", { className: "bg-[var(--color-surface)] rounded-xl p-4 border border-[var(--color-border-light)]", children: [
12453
+ /* @__PURE__ */ jsx43("h3", { className: "font-semibold text-[var(--color-text-primary)] mb-4", children: "Cette semaine" }),
12454
+ /* @__PURE__ */ jsxs38("div", { className: "space-y-3", children: [
12455
+ /* @__PURE__ */ jsxs38("div", { className: "flex justify-between items-center", children: [
12456
+ /* @__PURE__ */ jsx43("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "R\xE9unions" }),
12457
+ /* @__PURE__ */ jsx43("span", { className: "font-semibold text-[var(--color-text-primary)]", children: "8" })
12458
+ ] }),
12459
+ /* @__PURE__ */ jsxs38("div", { className: "flex justify-between items-center", children: [
12460
+ /* @__PURE__ */ jsx43("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "T\xE2ches planifi\xE9es" }),
12461
+ /* @__PURE__ */ jsx43("span", { className: "font-semibold text-[var(--color-text-primary)]", children: "15" })
12462
+ ] }),
12463
+ /* @__PURE__ */ jsxs38("div", { className: "flex justify-between items-center", children: [
12464
+ /* @__PURE__ */ jsx43("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Heures occup\xE9es" }),
12465
+ /* @__PURE__ */ jsx43("span", { className: "font-semibold text-[var(--color-text-primary)]", children: "32h" })
12466
+ ] })
12467
+ ] })
12468
+ ] })
12469
+ ] })
12470
+ ] }) })
12471
+ ] });
12472
+ };
12473
+ var PlanningPage_default = PlanningPage;
12474
+
12475
+ // src/pages/workspaces/TaskPilot.tsx
12476
+ import { useState as useState29, useEffect as useEffect19, useCallback as useCallback5 } from "react";
12477
+ import {
12478
+ Plus as Plus9,
12479
+ MoreVertical as MoreVertical3,
12480
+ MessageSquare,
12481
+ Paperclip,
12482
+ Search as Search6,
12483
+ Filter as Filter3,
12484
+ Calendar as Calendar6,
12485
+ GripVertical,
12486
+ Loader2 as Loader24,
12487
+ Trash2 as Trash25,
12488
+ Edit3 as Edit33
12489
+ } from "lucide-react";
12490
+
12491
+ // src/models/Task.ts
12492
+ var TASK_STATUS_OPTIONS = [
12493
+ { value: "new", label: "\xC0 faire" },
12494
+ { value: "in_progress", label: "En cours" },
12495
+ { value: "in_review", label: "En r\xE9vision" },
12496
+ { value: "done", label: "Termin\xE9" }
12497
+ ];
12498
+ var TASK_PRIORITY_OPTIONS = [
12499
+ { value: "high", label: "Haute", color: "bg-red-100 text-red-700" },
12500
+ { value: "medium", label: "Moyenne", color: "bg-yellow-100 text-yellow-700" },
12501
+ { value: "minimum", label: "Basse", color: "bg-green-100 text-green-700" }
12502
+ ];
12503
+
12504
+ // src/services/TaskServices.ts
12505
+ var URI5 = `${API_URL}/workspace/tasks/`;
12506
+ var TaskServices = {
12507
+ create: (data) => FetchApi.post(`${URI5}`, data),
12508
+ get: (id) => FetchApi.get(`${URI5}${id}/`),
12509
+ list: (params) => FetchApi.get(`${URI5}?${new URLSearchParams(params).toString()}`),
12510
+ update: (id, data) => FetchApi.put(`${URI5}${id}/`, data),
12511
+ patch: (id, data) => FetchApi.patch(`${URI5}${id}/`, data),
12512
+ delete: (id) => FetchApi.delete(`${URI5}${id}/`),
12513
+ updateStatus: (id, status) => FetchApi.patch(`${URI5}${id}/`, { status })
12514
+ };
12515
+
12516
+ // src/pages/workspaces/FormTask.tsx
12517
+ import { useState as useState28, useEffect as useEffect18 } from "react";
12518
+ import { Loader2 as Loader23 } from "lucide-react";
12519
+ import { jsx as jsx44, jsxs as jsxs39 } from "react/jsx-runtime";
12520
+ var FormTask = ({ open, onClose, task, defaultStatus = "new", onSuccess }) => {
12521
+ const { addToast } = useToast();
12522
+ const [loading, setLoading] = useState28(false);
12523
+ const [formData, setFormData] = useState28({
12524
+ title: "",
12525
+ description: "",
12526
+ status: defaultStatus,
12527
+ priority: "medium",
12528
+ start_date: "",
12529
+ end_date: ""
12530
+ });
12531
+ useEffect18(() => {
12532
+ if (task) {
12533
+ setFormData({
12534
+ title: task.title || "",
12535
+ description: task.description || "",
12536
+ status: task.status || defaultStatus,
12537
+ priority: task.priority || "medium",
12538
+ start_date: task.start_date ? task.start_date.split("T")[0] : "",
12539
+ end_date: task.end_date ? task.end_date.split("T")[0] : ""
12540
+ });
12541
+ } else {
12542
+ setFormData({
12543
+ title: "",
12544
+ description: "",
12545
+ status: defaultStatus,
12546
+ priority: "medium",
12547
+ start_date: "",
12548
+ end_date: ""
12549
+ });
12550
+ }
12551
+ }, [task, defaultStatus, open]);
12552
+ const handleInputChange = (e) => {
12553
+ const { name, value } = e.target;
12554
+ setFormData((prev) => ({ ...prev, [name]: value }));
12555
+ };
12556
+ const handleSelectChange = (e) => {
12557
+ const { name, value } = e.target;
12558
+ setFormData((prev) => ({ ...prev, [name]: value }));
12559
+ };
12560
+ const handleTextAreaChange = (e) => {
12561
+ const { name, value } = e.target;
12562
+ setFormData((prev) => ({ ...prev, [name]: value }));
12563
+ };
12564
+ const handleSubmit = async (e) => {
12565
+ e.preventDefault();
12566
+ if (!formData.title.trim()) {
12567
+ addToast({ type: "error", message: "Le titre est obligatoire" });
12568
+ return;
12569
+ }
12570
+ setLoading(true);
12571
+ try {
12572
+ const payload = {
12573
+ ...formData,
12574
+ start_date: formData.start_date || null,
12575
+ end_date: formData.end_date || null
12576
+ };
12577
+ if (task?.id) {
12578
+ await TaskServices.update(task.id, payload);
12579
+ addToast({ type: "success", message: "T\xE2che mise \xE0 jour avec succ\xE8s" });
12580
+ } else {
12581
+ await TaskServices.create(payload);
12582
+ addToast({ type: "success", message: "T\xE2che cr\xE9\xE9e avec succ\xE8s" });
12583
+ }
12584
+ onSuccess?.();
12585
+ onClose();
12586
+ } catch (error) {
12587
+ console.error("Error saving task:", error);
12588
+ addToast({ type: "error", message: "Erreur lors de la sauvegarde" });
12589
+ } finally {
12590
+ setLoading(false);
12591
+ }
12592
+ };
12593
+ return /* @__PURE__ */ jsx44(
12594
+ Modals_default,
12595
+ {
12596
+ open,
12597
+ onClose,
12598
+ title: task ? "Modifier la t\xE2che" : "Nouvelle t\xE2che",
12599
+ description: task ? "Modifiez les d\xE9tails de la t\xE2che" : "Cr\xE9ez une nouvelle t\xE2che",
12600
+ width: "max-w-lg",
12601
+ children: /* @__PURE__ */ jsxs39("form", { onSubmit: handleSubmit, className: "space-y-5", children: [
12602
+ /* @__PURE__ */ jsx44(
12603
+ TextInput,
12604
+ {
12605
+ label: "Titre",
12606
+ name: "title",
12607
+ value: formData.title,
12608
+ onChange: handleInputChange,
12609
+ placeholder: "Entrez le titre de la t\xE2che",
12610
+ required: true
12611
+ }
12612
+ ),
12613
+ /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1 w-full", children: [
12614
+ /* @__PURE__ */ jsx44("label", { className: "block text-[var(--color-text-secondary)] text-sm font-medium mb-2", children: "Description" }),
12615
+ /* @__PURE__ */ jsx44(
12616
+ "textarea",
12617
+ {
12618
+ name: "description",
12619
+ value: formData.description,
12620
+ onChange: handleTextAreaChange,
12621
+ placeholder: "D\xE9crivez la t\xE2che...",
12622
+ rows: 3,
12623
+ className: "w-full px-3 py-2 border border-[var(--color-border)] rounded-lg\r\n focus:ring-2 focus:ring-[var(--color-primary)]/20 focus:border-[var(--color-primary)]\r\n text-sm resize-none bg-[var(--color-surface)] text-[var(--color-text-primary)]"
12624
+ }
12625
+ )
12626
+ ] }),
12627
+ /* @__PURE__ */ jsxs39("div", { className: "grid grid-cols-2 gap-4", children: [
12628
+ /* @__PURE__ */ jsx44(
12629
+ SelectInput,
12630
+ {
12631
+ label: "Statut",
12632
+ name: "status",
12633
+ value: formData.status,
12634
+ onChange: handleSelectChange,
12635
+ options: TASK_STATUS_OPTIONS.map((opt) => ({ label: opt.label, value: opt.value }))
12636
+ }
12637
+ ),
12638
+ /* @__PURE__ */ jsx44(
12639
+ SelectInput,
12640
+ {
12641
+ label: "Priorit\xE9",
12642
+ name: "priority",
12643
+ value: formData.priority,
12644
+ onChange: handleSelectChange,
12645
+ options: TASK_PRIORITY_OPTIONS.map((opt) => ({ label: opt.label, value: opt.value }))
12646
+ }
12647
+ )
12648
+ ] }),
12649
+ /* @__PURE__ */ jsxs39("div", { className: "grid grid-cols-2 gap-4", children: [
12650
+ /* @__PURE__ */ jsx44(
12651
+ DateInput,
12652
+ {
12653
+ label: "Date de d\xE9but",
12654
+ name: "start_date",
12655
+ value: formData.start_date,
12656
+ onChange: handleInputChange
12657
+ }
12658
+ ),
12659
+ /* @__PURE__ */ jsx44(
12660
+ DateInput,
12661
+ {
12662
+ label: "Date de fin",
12663
+ name: "end_date",
12664
+ value: formData.end_date,
12665
+ onChange: handleInputChange
12666
+ }
12667
+ )
12668
+ ] }),
12669
+ /* @__PURE__ */ jsxs39("div", { className: "flex justify-end gap-3 pt-4 border-t border-[var(--color-border)]", children: [
12670
+ /* @__PURE__ */ jsx44(
12671
+ SecondaryButton,
12672
+ {
12673
+ type: "button",
12674
+ onClick: onClose,
12675
+ disabled: loading,
12676
+ variant: "outline",
12677
+ children: "Annuler"
12678
+ }
12679
+ ),
12680
+ /* @__PURE__ */ jsxs39(
12681
+ Buttons_default,
12682
+ {
12683
+ type: "submit",
12684
+ disabled: loading,
12685
+ children: [
12686
+ loading && /* @__PURE__ */ jsx44(Loader23, { className: "w-4 h-4 animate-spin mr-2" }),
12687
+ task ? "Mettre \xE0 jour" : "Cr\xE9er"
12688
+ ]
12689
+ }
12690
+ )
12691
+ ] })
12692
+ ] })
12693
+ }
12694
+ );
12695
+ };
12696
+ var FormTask_default = FormTask;
12697
+
12698
+ // src/pages/workspaces/TaskPilot.tsx
12699
+ import { jsx as jsx45, jsxs as jsxs40 } from "react/jsx-runtime";
12700
+ var COLUMNS = [
12701
+ { id: "new", title: "\xC0 faire", color: "bg-[var(--color-surface)]" },
12702
+ { id: "in_progress", title: "En cours", color: "bg-[var(--color-info-light)]" },
12703
+ { id: "in_review", title: "En r\xE9vision", color: "bg-[var(--color-warning-light)]" },
12704
+ { id: "done", title: "Termin\xE9", color: "bg-[var(--color-success-light)]" }
12705
+ ];
12706
+ var PriorityBadge = ({ priority }) => {
12707
+ const option = TASK_PRIORITY_OPTIONS.find((p) => p.value === priority);
12708
+ if (!option) return null;
12709
+ return /* @__PURE__ */ jsx45("span", { className: `px-2 py-0.5 text-xs font-medium rounded ${option.color}`, children: option.label });
12710
+ };
12711
+ var TaskCard = ({ task, isDragging, onDragStart, onDragEnd, onEdit, onDelete }) => {
12712
+ const [showMenu, setShowMenu] = useState29(false);
12713
+ return /* @__PURE__ */ jsxs40(
12714
+ "div",
12715
+ {
12716
+ draggable: true,
12717
+ onDragStart: (e) => onDragStart(e, task),
12718
+ onDragEnd,
12719
+ className: `
12720
+ bg-[var(--color-surface)] rounded-lg p-4 shadow-sm border border-[var(--color-border-light)]
12721
+ hover:shadow-md transition-all cursor-grab active:cursor-grabbing
12722
+ ${isDragging ? "opacity-50 scale-105 shadow-lg ring-2 ring-[var(--color-primary)]" : ""}
12723
+ `,
12724
+ children: [
12725
+ /* @__PURE__ */ jsxs40("div", { className: "flex items-start justify-between mb-3", children: [
12726
+ /* @__PURE__ */ jsx45("div", { className: "flex flex-wrap gap-1.5", children: /* @__PURE__ */ jsx45(PriorityBadge, { priority: task.priority }) }),
12727
+ /* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-1 relative", children: [
12728
+ /* @__PURE__ */ jsx45(GripVertical, { className: "w-4 h-4 text-[var(--color-text-tertiary)]" }),
12729
+ /* @__PURE__ */ jsx45(
12730
+ "button",
12731
+ {
12732
+ onClick: (e) => {
12733
+ e.stopPropagation();
12734
+ setShowMenu(!showMenu);
12735
+ },
12736
+ className: "p-1 hover:bg-[var(--color-surface-hover)] rounded transition-colors",
12737
+ children: /* @__PURE__ */ jsx45(MoreVertical3, { className: "w-4 h-4 text-[var(--color-text-tertiary)]" })
12738
+ }
12739
+ ),
12740
+ showMenu && /* @__PURE__ */ jsxs40("div", { className: "absolute right-0 top-8 bg-[var(--color-surface)] border border-[var(--color-border)] rounded-lg shadow-lg py-1 z-10 min-w-[120px]", children: [
12741
+ /* @__PURE__ */ jsxs40(
12742
+ "button",
12743
+ {
12744
+ onClick: (e) => {
12745
+ e.stopPropagation();
12746
+ onEdit(task);
12747
+ setShowMenu(false);
12748
+ },
12749
+ className: "w-full px-3 py-2 text-left text-sm text-[var(--color-text-primary)] hover:bg-[var(--color-surface-hover)] flex items-center gap-2",
12750
+ children: [
12751
+ /* @__PURE__ */ jsx45(Edit33, { className: "w-4 h-4" }),
12752
+ "Modifier"
12753
+ ]
12754
+ }
12755
+ ),
12756
+ /* @__PURE__ */ jsxs40(
12757
+ "button",
12758
+ {
12759
+ onClick: (e) => {
12760
+ e.stopPropagation();
12761
+ onDelete(task);
12762
+ setShowMenu(false);
12763
+ },
12764
+ className: "w-full px-3 py-2 text-left text-sm text-[var(--color-error)] hover:bg-[var(--color-error-light)] flex items-center gap-2",
12765
+ children: [
12766
+ /* @__PURE__ */ jsx45(Trash25, { className: "w-4 h-4" }),
12767
+ "Supprimer"
12768
+ ]
12769
+ }
12770
+ )
12771
+ ] })
12772
+ ] })
12773
+ ] }),
12774
+ /* @__PURE__ */ jsx45("h3", { className: "font-medium text-[var(--color-text-primary)] text-sm mb-1", children: task.title }),
12775
+ task.description && /* @__PURE__ */ jsx45("p", { className: "text-xs text-[var(--color-text-secondary)] mb-4 line-clamp-2", children: task.description }),
12776
+ /* @__PURE__ */ jsxs40("div", { className: "flex items-center justify-between pt-2 text-xs text-[var(--color-text-tertiary)]", children: [
12777
+ task.end_date && /* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-1", children: [
12778
+ /* @__PURE__ */ jsx45(Calendar6, { className: "w-3.5 h-3.5" }),
12779
+ /* @__PURE__ */ jsx45("span", { children: new Date(task.end_date).toLocaleDateString("fr-FR") })
12780
+ ] }),
12781
+ /* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-3", children: [
12782
+ task.comment && /* @__PURE__ */ jsx45("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsx45(MessageSquare, { className: "w-3.5 h-3.5" }) }),
12783
+ task.file && /* @__PURE__ */ jsx45("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsx45(Paperclip, { className: "w-3.5 h-3.5" }) })
12784
+ ] })
12785
+ ] })
12786
+ ]
12787
+ }
12788
+ );
12789
+ };
12790
+ var KanbanColumn = ({ column, tasks, onAddTask, draggedTask, onDragStart, onDragEnd, onDragOver, onDrop, isDropTarget, onEditTask, onDeleteTask }) => {
12791
+ return /* @__PURE__ */ jsxs40(
12792
+ "div",
12793
+ {
12794
+ onDragOver,
12795
+ onDrop: (e) => onDrop(e, column.id),
12796
+ className: `
12797
+ flex flex-col rounded-xl min-w-[300px] max-w-[300px] transition-all duration-200
12798
+ ${column.color}
12799
+ ${isDropTarget ? "ring-2 ring-[var(--color-primary)] ring-dashed bg-[var(--color-primary-light)]" : ""}
12800
+ `,
12801
+ children: [
12802
+ /* @__PURE__ */ jsxs40("div", { className: "flex items-center justify-between p-4 pb-3", children: [
12803
+ /* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-2", children: [
12804
+ /* @__PURE__ */ jsx45("h2", { className: "font-semibold text-[var(--color-text-primary)] text-sm", children: column.title }),
12805
+ /* @__PURE__ */ jsx45("span", { className: "px-2 py-0.5 text-xs font-medium bg-[var(--color-border)] text-[var(--color-text-secondary)] rounded-full", children: tasks.length })
12806
+ ] }),
12807
+ /* @__PURE__ */ jsx45(
12808
+ "button",
12809
+ {
12810
+ onClick: () => onAddTask(column.id),
12811
+ className: "p-1 hover:bg-[var(--color-surface-hover)] rounded transition-colors",
12812
+ children: /* @__PURE__ */ jsx45(Plus9, { className: "w-4 h-4 text-[var(--color-text-secondary)]" })
12813
+ }
12814
+ )
12815
+ ] }),
12816
+ /* @__PURE__ */ jsxs40("div", { className: "flex-1 p-2 pt-0 space-y-3 overflow-y-auto max-h-[calc(100vh-250px)]", children: [
12817
+ tasks.map((task) => /* @__PURE__ */ jsx45(
12818
+ TaskCard,
12819
+ {
12820
+ task,
12821
+ isDragging: draggedTask?.id === task.id,
12822
+ onDragStart,
12823
+ onDragEnd,
12824
+ onEdit: onEditTask,
12825
+ onDelete: onDeleteTask
12826
+ },
12827
+ task.id
12828
+ )),
12829
+ tasks.length === 0 && /* @__PURE__ */ jsx45("div", { className: `
12830
+ border-2 border-dashed rounded-lg p-8 text-center transition-colors
12831
+ ${isDropTarget ? "border-[var(--color-primary)] bg-[var(--color-primary-light)]" : "border-[var(--color-border)]"}
12832
+ `, children: /* @__PURE__ */ jsx45("p", { className: "text-sm text-[var(--color-text-tertiary)]", children: "D\xE9posez une t\xE2che ici" }) })
12833
+ ] })
12834
+ ]
12835
+ }
12836
+ );
12837
+ };
12838
+ var TaskPilot = () => {
12839
+ const { success: showSuccess, error: showError, warning: showWarning, info: showInfo, confirm: confirm2 } = useToast();
12840
+ const [tasks, setTasks] = useState29([]);
12841
+ const [loading, setLoading] = useState29(true);
12842
+ const [searchQuery, setSearchQuery] = useState29("");
12843
+ const [draggedTask, setDraggedTask] = useState29(null);
12844
+ const [dropTargetColumn, setDropTargetColumn] = useState29(null);
12845
+ const [isFormOpen, setIsFormOpen] = useState29(false);
12846
+ const [editingTask, setEditingTask] = useState29(null);
12847
+ const [defaultStatus, setDefaultStatus] = useState29("new");
12848
+ const loadTasks = useCallback5(async () => {
12849
+ try {
12850
+ setLoading(true);
12851
+ const response = await TaskServices.list();
12852
+ const data = response;
12853
+ if (Array.isArray(data)) {
12854
+ setTasks(data);
12855
+ } else if (data.results) {
12856
+ setTasks(data.results);
12857
+ } else if (data.data) {
12858
+ setTasks(data.data);
12859
+ }
12860
+ } catch (error) {
12861
+ console.error("Error loading tasks:", error);
12862
+ showError("Erreur lors du chargement des t\xE2ches");
12863
+ } finally {
12864
+ setLoading(false);
12865
+ }
12866
+ }, [showError]);
12867
+ useEffect19(() => {
12868
+ loadTasks();
12869
+ }, [loadTasks]);
12870
+ const getTasksByStatus = (status) => {
12871
+ return tasks.filter((task) => task.status === status).filter(
12872
+ (task) => searchQuery === "" || task.title?.toLowerCase().includes(searchQuery.toLowerCase()) || task.description?.toLowerCase().includes(searchQuery.toLowerCase())
12873
+ );
12874
+ };
12875
+ const handleDragStart = (e, task) => {
12876
+ setDraggedTask(task);
12877
+ e.dataTransfer.effectAllowed = "move";
12878
+ e.dataTransfer.setData("text/plain", String(task.id));
12879
+ };
12880
+ const handleDragEnd = () => {
12881
+ setDraggedTask(null);
12882
+ setDropTargetColumn(null);
12883
+ };
12884
+ const handleDragOver = (e) => {
12885
+ e.preventDefault();
12886
+ e.dataTransfer.dropEffect = "move";
12887
+ };
12888
+ const handleDrop = async (e, columnId) => {
12889
+ e.preventDefault();
12890
+ if (draggedTask && draggedTask.status !== columnId) {
12891
+ setTasks(
12892
+ (prevTasks) => prevTasks.map(
12893
+ (task) => task.id === draggedTask.id ? { ...task, status: columnId } : task
12894
+ )
12895
+ );
12896
+ try {
12897
+ await TaskServices.updateStatus(draggedTask.id, columnId);
12898
+ showSuccess("Statut mis \xE0 jour");
12899
+ } catch (error) {
12900
+ console.error("Error updating status:", error);
12901
+ setTasks(
12902
+ (prevTasks) => prevTasks.map(
12903
+ (task) => task.id === draggedTask.id ? { ...task, status: draggedTask.status } : task
12904
+ )
12905
+ );
12906
+ showError("Erreur lors de la mise \xE0 jour");
12907
+ }
12908
+ }
12909
+ setDraggedTask(null);
12910
+ setDropTargetColumn(null);
12911
+ };
12912
+ const handleColumnDragEnter = (columnId) => {
12913
+ if (draggedTask && draggedTask.status !== columnId) {
12914
+ setDropTargetColumn(columnId);
12915
+ }
12916
+ };
12917
+ const handleColumnDragLeave = () => {
12918
+ setDropTargetColumn(null);
12919
+ };
12920
+ const handleAddTask = (status) => {
12921
+ setEditingTask(null);
12922
+ setDefaultStatus(status);
12923
+ setIsFormOpen(true);
12924
+ };
12925
+ const handleEditTask = (task) => {
12926
+ setEditingTask(task);
12927
+ setDefaultStatus(task.status);
12928
+ setIsFormOpen(true);
12929
+ };
12930
+ const handleDeleteTask = async (task) => {
12931
+ const confirmed = await confirm2("\xCAtes-vous s\xFBr de vouloir supprimer cette t\xE2che ?");
12932
+ if (!confirmed) return;
12933
+ try {
12934
+ await TaskServices.delete(task.id);
12935
+ setTasks((prev) => prev.filter((t) => t.id !== task.id));
12936
+ showSuccess("T\xE2che supprim\xE9e");
12937
+ } catch (error) {
12938
+ console.error("Error deleting task:", error);
12939
+ showError("Erreur lors de la suppression");
12940
+ }
12941
+ };
12942
+ const handleFormSuccess = () => {
12943
+ loadTasks();
12944
+ };
12945
+ if (loading) {
12946
+ return /* @__PURE__ */ jsx45("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ jsx45(Loader24, { className: "w-8 h-8 animate-spin text-[var(--color-primary)]" }) });
12947
+ }
12948
+ return /* @__PURE__ */ jsxs40("div", { className: "h-full flex flex-col", children: [
12949
+ /* @__PURE__ */ jsx45("div", { className: "bg-[var(--color-surface)] border-b border-[var(--color-border)] px-6 py-4", children: /* @__PURE__ */ jsxs40("div", { className: "flex items-center justify-between flex-wrap gap-4", children: [
12950
+ /* @__PURE__ */ jsx45("h1", { className: "text-xl font-semibold text-[var(--color-text-primary)]", children: "Task Pilot" }),
12951
+ /* @__PURE__ */ jsxs40("div", { className: "flex items-center gap-3 flex-wrap", children: [
12952
+ /* @__PURE__ */ jsxs40("div", { className: "relative", children: [
12953
+ /* @__PURE__ */ jsx45(Search6, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--color-text-tertiary)]" }),
12954
+ /* @__PURE__ */ jsx45(
12955
+ "input",
12956
+ {
12957
+ type: "text",
12958
+ placeholder: "Rechercher...",
12959
+ value: searchQuery,
12960
+ onChange: (e) => setSearchQuery(e.target.value),
12961
+ className: "pl-9 pr-4 py-2 text-sm border border-[var(--color-border)] rounded-lg\r\n focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]/20 focus:border-[var(--color-primary)]\r\n w-64 bg-[var(--color-surface)] text-[var(--color-text-primary)]"
12962
+ }
12963
+ )
12964
+ ] }),
12965
+ /* @__PURE__ */ jsxs40(SecondaryButton, { variant: "outline", children: [
12966
+ /* @__PURE__ */ jsx45(Filter3, { className: "w-4 h-4 mr-2" }),
12967
+ "Filtrer"
12968
+ ] }),
12969
+ /* @__PURE__ */ jsxs40(Buttons_default, { onClick: () => handleAddTask("new"), children: [
12970
+ /* @__PURE__ */ jsx45(Plus9, { className: "w-4 h-4 mr-2" }),
12971
+ "Nouvelle t\xE2che"
12972
+ ] })
12973
+ ] })
12974
+ ] }) }),
12975
+ /* @__PURE__ */ jsx45("div", { className: "flex-1 overflow-x-auto p-6 bg-[var(--color-background)]", children: /* @__PURE__ */ jsx45("div", { className: "flex gap-4 h-full", children: COLUMNS.map((column) => /* @__PURE__ */ jsx45(
12976
+ "div",
12977
+ {
12978
+ onDragEnter: () => handleColumnDragEnter(column.id),
12979
+ onDragLeave: handleColumnDragLeave,
12980
+ children: /* @__PURE__ */ jsx45(
12981
+ KanbanColumn,
12982
+ {
12983
+ column,
12984
+ tasks: getTasksByStatus(column.id),
12985
+ onAddTask: handleAddTask,
12986
+ draggedTask,
12987
+ onDragStart: handleDragStart,
12988
+ onDragEnd: handleDragEnd,
12989
+ onDragOver: handleDragOver,
12990
+ onDrop: handleDrop,
12991
+ isDropTarget: dropTargetColumn === column.id,
12992
+ onEditTask: handleEditTask,
12993
+ onDeleteTask: handleDeleteTask
12994
+ }
12995
+ )
12996
+ },
12997
+ column.id
12998
+ )) }) }),
12999
+ draggedTask && /* @__PURE__ */ jsxs40("div", { className: "fixed bottom-4 left-1/2 -translate-x-1/2 bg-[var(--color-primary)] text-[var(--color-text-inverse)] px-4 py-2 rounded-lg shadow-lg text-sm font-medium animate-pulse", children: [
13000
+ 'D\xE9placez "',
13001
+ draggedTask.title?.substring(0, 30),
13002
+ '..." vers une colonne'
13003
+ ] }),
13004
+ /* @__PURE__ */ jsx45(
13005
+ FormTask_default,
13006
+ {
13007
+ open: isFormOpen,
13008
+ onClose: () => setIsFormOpen(false),
13009
+ task: editingTask,
13010
+ defaultStatus,
13011
+ onSuccess: handleFormSuccess
13012
+ }
13013
+ )
13014
+ ] });
13015
+ };
13016
+ var TaskPilot_default = TaskPilot;
13017
+
13018
+ // src/pages/workspaces/PurchaseRequestsPage.tsx
13019
+ import { useEffect as useEffect21, useState as useState31 } from "react";
13020
+ import { ClipboardCheck, Plus as Plus11 } from "lucide-react";
13021
+
13022
+ // src/pages/workspaces/FormPurchaseRequest.tsx
13023
+ import { useState as useState30, useEffect as useEffect20 } from "react";
13024
+ import {
13025
+ Building2 as Building27,
13026
+ Trash2 as Trash26,
13027
+ Plus as Plus10,
13028
+ CreditCard as CreditCard4,
13029
+ FileText as FileText11
13030
+ } from "lucide-react";
13031
+
13032
+ // src/services/PurchaseRequestServices.ts
13033
+ var VENDORS_API_URL2 = `${API_URL}/procurement/purchase-requests/`;
13034
+ var PurchaseRequestServices = {
13035
+ createPurchaseRequest: (data, token) => FetchApi.post(`${VENDORS_API_URL2}`, data, token),
13036
+ getPurchaseRequest: (id, token) => FetchApi.get(`${VENDORS_API_URL2}${id}/`, token),
13037
+ getPurchaseRequests: (token) => FetchApi.get(`${VENDORS_API_URL2}`, token),
13038
+ updatePurchaseRequest: (id, data, token) => FetchApi.put(`${VENDORS_API_URL2}${id}/`, data, token),
13039
+ deletePurchaseRequest: (id, token) => FetchApi.delete(`${VENDORS_API_URL2}${id}/`, token)
13040
+ };
13041
+
13042
+ // src/globals.ts
13043
+ var UNITS = [
13044
+ "Pi\xE8ce",
13045
+ "Unit\xE9",
13046
+ "Lot",
13047
+ "Kg",
13048
+ "Gramme",
13049
+ "Tonne",
13050
+ "Litre",
13051
+ "M\xB2",
13052
+ "M\xB3",
13053
+ "M\xE8tre",
13054
+ "Cm",
13055
+ "Heure",
13056
+ "Jour",
13057
+ "Mois"
13058
+ ];
13059
+
13060
+ // src/pages/workspaces/FormPurchaseRequest.tsx
13061
+ import { Fragment as Fragment11, jsx as jsx46, jsxs as jsxs41 } from "react/jsx-runtime";
13062
+ var FormPurchaseRequest = ({
13063
+ isOpen,
13064
+ onClose,
13065
+ object,
13066
+ refresh = () => {
13067
+ }
13068
+ }) => {
13069
+ const [formData, setFormData] = useState30(object || {
13070
+ request_number: "",
13071
+ title: "",
13072
+ description: "",
13073
+ category: "",
13074
+ requester: null,
13075
+ department: null,
13076
+ cost_center: null,
13077
+ estimated_amount: 0,
13078
+ currency: "",
13079
+ budget_available: false,
13080
+ urgency: "low",
13081
+ needed_date: "",
13082
+ delivery_address: "",
13083
+ delivery_contact: "",
13084
+ delivery_phone: "",
13085
+ status: "draft",
13086
+ approval_date: null,
13087
+ approved_by: null,
13088
+ created_at: "",
13089
+ updated_at: "",
13090
+ comments: null,
13091
+ vendor: null,
13092
+ evaluation_score: null,
13093
+ evaluation_notes: null,
13094
+ evaluated_by: null,
13095
+ evaluated_at: null,
13096
+ assigned_buyer: null,
13097
+ budget_approval_requested_at: null,
13098
+ items: [
13099
+ { description: "", specifications: "", quantity: 1, unit: "", unit_price: 0, total_price: 0, comments: "" }
13100
+ ]
13101
+ });
13102
+ const [errors, setErrors] = useState30({});
13103
+ const [activeTab, setActiveTab] = useState30("general");
13104
+ const [loading, setLoading] = useState30(false);
13105
+ const { loggedUser, token } = useSession();
13106
+ const { success, error: showError } = useToast();
13107
+ const [budgetInfo, setBudgetInfo] = useState30({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
13108
+ const readonly = false;
13109
+ const fetchDepartmentBudget = async (departmentId) => {
13110
+ if (!departmentId) {
13111
+ setBudgetInfo({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
13112
+ return;
13113
+ }
13114
+ setBudgetInfo((prev) => ({ ...prev, loading: true }));
13115
+ try {
13116
+ const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
13117
+ const response = await fetch(
13118
+ `${API_URL}/core/departments/${departmentId}/budget-and-actual/?year=${currentYear}&category=expenses`,
13119
+ {
13120
+ headers: {
13121
+ "Authorization": `Token ${localStorage.getItem("token")}`
13122
+ }
13123
+ }
13124
+ );
13125
+ if (response.ok) {
13126
+ const data = await response.json();
13127
+ const available = (data.totals?.budget || 0) - (data.totals?.actual || 0);
13128
+ setBudgetInfo({
13129
+ totalBudget: data.totals?.budget || 0,
13130
+ totalActual: data.totals?.actual || 0,
13131
+ available,
13132
+ loading: false
13133
+ });
13134
+ } else {
13135
+ setBudgetInfo({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
13136
+ }
13137
+ } catch (error) {
13138
+ console.error("Erreur lors de la r\xE9cup\xE9ration du budget:", error);
13139
+ setBudgetInfo({ totalBudget: 0, totalActual: 0, available: 0, loading: false });
13140
+ }
13141
+ };
13142
+ useEffect20(() => {
13143
+ if (formData.department) {
13144
+ fetchDepartmentBudget(formData.department);
13145
+ }
13146
+ }, [formData.department]);
13147
+ const handleInputChange = (e) => {
13148
+ const { name, value } = e.target;
13149
+ setFormData((prev) => ({ ...prev, [name]: value }));
13150
+ if (errors[name]) {
13151
+ setErrors((prev) => {
13152
+ const next = { ...prev };
13153
+ delete next[name];
13154
+ return next;
13155
+ });
13156
+ }
13157
+ };
13158
+ const selectDept = (option) => {
13159
+ setFormData({ ...formData, department: option.value });
13160
+ };
13161
+ const selectCostCenter = (option) => {
13162
+ setFormData({ ...formData, cost_center: option.value });
13163
+ };
13164
+ const handleSelectChange = (e) => {
13165
+ const { name, value } = e.target;
13166
+ setFormData((prev) => ({ ...prev, [name]: value }));
13167
+ };
13168
+ const handleTextareaChange = (e) => {
13169
+ const { name, value } = e.target;
13170
+ setFormData((prev) => ({ ...prev, [name]: value }));
13171
+ };
13172
+ const validateForm = () => {
13173
+ const newErrors = {};
13174
+ if (!formData.title?.trim()) {
13175
+ newErrors.title = "Le titre est obligatoire";
13176
+ }
13177
+ if (!formData.category?.trim()) {
13178
+ newErrors.category = "La cat\xE9gorie est obligatoire";
13179
+ }
13180
+ if (!formData.estimated_amount || formData.estimated_amount <= 0) {
13181
+ newErrors.estimated_amount = "Le montant estim\xE9 doit \xEAtre sup\xE9rieur \xE0 0";
13182
+ }
13183
+ setErrors(newErrors);
13184
+ return Object.keys(newErrors).length === 0;
13185
+ };
13186
+ const handleSavePurchaseRequest = async (entityData) => {
13187
+ try {
13188
+ if (object && object.id) {
13189
+ await PurchaseRequestServices.updatePurchaseRequest(object.id, entityData, token);
13190
+ success("Entit\xE9 modifi\xE9e avec succ\xE8s !");
13191
+ } else {
13192
+ await PurchaseRequestServices.createPurchaseRequest({ ...entityData, requester: loggedUser?.id }, token);
13193
+ success("Entit\xE9 cr\xE9\xE9e avec succ\xE8s !");
13194
+ }
13195
+ refresh();
13196
+ onClose();
13197
+ } catch (error) {
13198
+ console.error(error);
13199
+ showError("Erreur lors de l'enregistrement de l'entit\xE9");
13200
+ }
13201
+ };
13202
+ const selectVendor = (option) => {
13203
+ setFormData({ ...formData, suggered_vendor: Number(option.value) });
13204
+ };
13205
+ const handleSubmit = async (e) => {
13206
+ e.preventDefault();
13207
+ if (!validateForm()) return;
13208
+ setLoading(true);
13209
+ try {
13210
+ await handleSavePurchaseRequest(formData);
13211
+ } finally {
13212
+ setLoading(false);
13213
+ }
13214
+ };
13215
+ const tabs = [
13216
+ { id: "general", label: "G\xE9n\xE9ral", icon: Building27 },
13217
+ { id: "items", label: "Articles", icon: FileText11 },
13218
+ { id: "vendors", label: "Fournisseurs et Budgets", icon: CreditCard4 }
13219
+ // { id: 'delivery', label: 'Livraison', icon: MapPin },
13220
+ ];
13221
+ const ajouterLigneAchat = () => {
13222
+ setFormData({ ...formData, items: [...formData.items ?? [], { description: "", specifications: "", quantity: 1, unit: "", unit_price: 0, total_price: 0, comments: "" }] });
13223
+ };
13224
+ const renderTabContent = () => {
13225
+ switch (activeTab) {
13226
+ case "general":
13227
+ return /* @__PURE__ */ jsxs41("div", { className: "space-y-4", children: [
13228
+ /* @__PURE__ */ jsx46(
13229
+ TextInput,
13230
+ {
13231
+ label: "Num\xE9ro de demande",
13232
+ name: "request_number",
13233
+ value: formData.request_number || "",
13234
+ placeholder: "Num\xE9ro automatique",
13235
+ onChange: handleInputChange,
13236
+ disabled: true
13237
+ }
13238
+ ),
13239
+ /* @__PURE__ */ jsx46(
13240
+ TextInput,
13241
+ {
13242
+ label: "Titre",
13243
+ name: "title",
13244
+ value: formData.title || "",
13245
+ placeholder: "Titre de la demande d'achat",
13246
+ required: true,
13247
+ error: errors.title,
13248
+ onChange: handleInputChange
13249
+ }
13250
+ ),
13251
+ /* @__PURE__ */ jsxs41("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
13252
+ /* @__PURE__ */ jsx46(
13253
+ TextInput,
13254
+ {
13255
+ label: "Cat\xE9gorie",
13256
+ name: "category",
13257
+ value: formData.category || "",
13258
+ placeholder: "Cat\xE9gorie de produits/services",
13259
+ required: true,
13260
+ error: errors.category,
13261
+ onChange: handleInputChange
13262
+ }
13263
+ ),
13264
+ /* @__PURE__ */ jsx46(SelectDepartment, { value: formData.department, onSelect: selectDept }),
13265
+ /* @__PURE__ */ jsx46(
13266
+ TextInput,
13267
+ {
13268
+ label: "Montant estim\xE9",
13269
+ name: "estimated_amount",
13270
+ value: formData.estimated_amount || "",
13271
+ placeholder: "Montant en devise",
13272
+ error: errors.estimated_amount,
13273
+ onChange: handleInputChange
13274
+ }
13275
+ ),
13276
+ /* @__PURE__ */ jsxs41("div", { children: [
13277
+ /* @__PURE__ */ jsx46("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Urgence" }),
13278
+ /* @__PURE__ */ jsxs41(
13279
+ "select",
13280
+ {
13281
+ name: "urgency",
13282
+ value: formData.urgency || "low",
13283
+ onChange: handleSelectChange,
13284
+ className: "w-full px-4 py-3 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#6B7C92] focus:border-transparent",
13285
+ children: [
13286
+ /* @__PURE__ */ jsx46("option", { value: "low", children: "Faible" }),
13287
+ /* @__PURE__ */ jsx46("option", { value: "medium", children: "Moyenne" }),
13288
+ /* @__PURE__ */ jsx46("option", { value: "high", children: "\xC9lev\xE9e" }),
13289
+ /* @__PURE__ */ jsx46("option", { value: "critical", children: "Critique" })
13290
+ ]
13291
+ }
13292
+ )
13293
+ ] }),
13294
+ /* @__PURE__ */ jsx46(
13295
+ InputField,
13296
+ {
13297
+ label: "Date de besoin",
13298
+ name: "needed_date",
13299
+ type: "date",
13300
+ min: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
13301
+ value: formData.needed_date || "",
13302
+ onChange: handleInputChange
13303
+ }
13304
+ )
13305
+ ] }),
13306
+ /* @__PURE__ */ jsxs41("div", { children: [
13307
+ /* @__PURE__ */ jsx46("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Description" }),
13308
+ /* @__PURE__ */ jsx46(
13309
+ "textarea",
13310
+ {
13311
+ name: "description",
13312
+ value: formData.description || "",
13313
+ onChange: handleTextareaChange,
13314
+ rows: 3,
13315
+ className: "w-full px-4 py-3 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#6B7C92] focus:border-transparent placeholder-gray-400",
13316
+ placeholder: "Description d\xE9taill\xE9e de la demande"
13317
+ }
13318
+ )
13319
+ ] }),
13320
+ /* @__PURE__ */ jsxs41("div", { children: [
13321
+ /* @__PURE__ */ jsx46("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Commentaires" }),
13322
+ /* @__PURE__ */ jsx46(
13323
+ "textarea",
13324
+ {
13325
+ name: "comments",
13326
+ value: formData.comments || "",
13327
+ onChange: handleTextareaChange,
13328
+ rows: 2,
13329
+ className: "w-full px-4 py-3 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#6B7C92] focus:border-transparent placeholder-gray-400",
13330
+ placeholder: "Commentaires additionnels"
13331
+ }
13332
+ )
13333
+ ] })
13334
+ ] });
13335
+ case "delivery":
13336
+ return /* @__PURE__ */ jsxs41("div", { className: "space-y-4", children: [
13337
+ /* @__PURE__ */ jsxs41("div", { children: [
13338
+ /* @__PURE__ */ jsx46("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Adresse de livraison" }),
13339
+ /* @__PURE__ */ jsx46(
13340
+ "textarea",
13341
+ {
13342
+ name: "delivery_address",
13343
+ value: formData.delivery_address || "",
13344
+ onChange: handleTextareaChange,
13345
+ rows: 3,
13346
+ className: "w-full px-4 py-3 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#6B7C92] focus:border-transparent placeholder-gray-400",
13347
+ placeholder: "Adresse compl\xE8te de livraison"
13348
+ }
13349
+ )
13350
+ ] }),
13351
+ /* @__PURE__ */ jsxs41("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
13352
+ /* @__PURE__ */ jsx46(
13353
+ TextInput,
13354
+ {
13355
+ label: "Contact de livraison",
13356
+ name: "delivery_contact",
13357
+ value: formData.delivery_contact || "",
13358
+ placeholder: "Nom du contact",
13359
+ onChange: handleInputChange
13360
+ }
13361
+ ),
13362
+ /* @__PURE__ */ jsx46(
13363
+ InputField,
13364
+ {
13365
+ label: "T\xE9l\xE9phone de livraison",
13366
+ name: "delivery_phone",
13367
+ type: "tel",
13368
+ value: formData.delivery_phone || "",
13369
+ placeholder: "+33 1 23 45 67 89",
13370
+ onChange: handleInputChange
13371
+ }
13372
+ )
13373
+ ] })
13374
+ ] });
13375
+ case "vendors":
13376
+ return /* @__PURE__ */ jsxs41("div", { className: "space-y-4", children: [
13377
+ (formData?.items?.reduce((sum, item) => sum + (Number(item?.total_price) || 0), 0) ?? 0) < 3e5 ? /* @__PURE__ */ jsx46(Fragment11, { children: /* @__PURE__ */ jsx46(SelectVendor, { value: formData.suggered_vendor, onSelect: selectVendor }) }) : /* @__PURE__ */ jsx46(Fragment11, {}),
13378
+ /* @__PURE__ */ jsx46("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: /* @__PURE__ */ jsx46(SelectCostCenter, { value: formData.cost_center, onSelect: selectCostCenter }) }),
13379
+ object && (formData.approval_date || formData.approved_by || formData.evaluation_score) && /* @__PURE__ */ jsxs41("div", { className: "mt-6 p-4 bg-gray-50 rounded-lg", children: [
13380
+ /* @__PURE__ */ jsx46("h4", { className: "text-sm font-medium text-gray-700 mb-3", children: "Informations syst\xE8me (lecture seule)" }),
13381
+ /* @__PURE__ */ jsxs41("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
13382
+ formData.approval_date && /* @__PURE__ */ jsxs41("div", { children: [
13383
+ /* @__PURE__ */ jsx46("span", { className: "text-xs text-gray-500", children: "Date d'approbation:" }),
13384
+ /* @__PURE__ */ jsx46("p", { className: "text-sm", children: formData.approval_date })
13385
+ ] }),
13386
+ formData.approved_by && /* @__PURE__ */ jsxs41("div", { children: [
13387
+ /* @__PURE__ */ jsx46("span", { className: "text-xs text-gray-500", children: "Approuv\xE9 par:" }),
13388
+ /* @__PURE__ */ jsx46("p", { className: "text-sm", children: formData.approved_by })
13389
+ ] }),
13390
+ formData.evaluation_score && /* @__PURE__ */ jsxs41("div", { children: [
13391
+ /* @__PURE__ */ jsx46("span", { className: "text-xs text-gray-500", children: "Note d'\xE9valuation:" }),
13392
+ /* @__PURE__ */ jsx46("p", { className: "text-sm", children: formData.evaluation_score })
13393
+ ] }),
13394
+ formData.evaluated_at && /* @__PURE__ */ jsxs41("div", { children: [
13395
+ /* @__PURE__ */ jsx46("span", { className: "text-xs text-gray-500", children: "Date d'\xE9valuation:" }),
13396
+ /* @__PURE__ */ jsx46("p", { className: "text-sm", children: formData.evaluated_at })
13397
+ ] })
13398
+ ] }),
13399
+ formData.evaluation_notes && /* @__PURE__ */ jsxs41("div", { className: "mt-3", children: [
13400
+ /* @__PURE__ */ jsx46("span", { className: "text-xs text-gray-500", children: "Notes d'\xE9valuation:" }),
13401
+ /* @__PURE__ */ jsx46("p", { className: "text-sm", children: formData.evaluation_notes })
13402
+ ] })
13403
+ ] })
13404
+ ] });
13405
+ case "items":
13406
+ return /* @__PURE__ */ jsxs41("div", { className: "space-y-4", children: [
13407
+ /* @__PURE__ */ jsxs41("div", { className: "flex justify-between items-center", children: [
13408
+ /* @__PURE__ */ jsx46("h3", { className: "text-lg font-medium text-gray-900", children: "Articles demand\xE9s" }),
13409
+ /* @__PURE__ */ jsxs41(
13410
+ Buttons_default,
13411
+ {
13412
+ type: "button",
13413
+ onClick: ajouterLigneAchat,
13414
+ children: [
13415
+ /* @__PURE__ */ jsx46(Plus10, { className: "w-4 h-4 mr-2" }),
13416
+ "Ajouter ligne"
13417
+ ]
13418
+ }
13419
+ )
13420
+ ] }),
13421
+ /* @__PURE__ */ jsx46("div", { className: "border border-gray-200 rounded-lg p-4", children: /* @__PURE__ */ jsxs41("table", { className: "w-full", children: [
13422
+ /* @__PURE__ */ jsx46("thead", { className: "bg-[#e8eaec]", children: /* @__PURE__ */ jsxs41("tr", { children: [
13423
+ /* @__PURE__ */ jsx46("th", { className: "border border-[#d1d7de] px-2 py-2 text-left text-xs font-semibold text-[#283042] uppercase", children: "D\xE9signation" }),
13424
+ /* @__PURE__ */ jsx46("th", { className: "border border-[#d1d7de] px-2 py-2 text-left text-xs font-semibold text-[#283042] uppercase", children: "Unit\xE9" }),
13425
+ /* @__PURE__ */ jsx46("th", { className: "border border-[#d1d7de] px-2 py-2 text-right text-xs font-semibold text-[#283042] uppercase", children: "Qt\xE9" }),
13426
+ /* @__PURE__ */ jsx46("th", { className: "border border-[#d1d7de] px-2 py-2 text-right text-xs font-semibold text-[#283042] uppercase", children: "Prix U. HT" }),
13427
+ /* @__PURE__ */ jsx46("th", { className: "border border-[#d1d7de] px-2 py-2 text-right text-xs font-semibold text-[#283042] uppercase", children: "Mont. HT" }),
13428
+ /* @__PURE__ */ jsx46("th", { className: "border border-[#d1d7de] px-2 py-2 text-left text-xs font-semibold text-[#283042] uppercase", children: "Commentaires" }),
13429
+ /* @__PURE__ */ jsx46("th", { className: "border border-[#d1d7de] px-2 py-2 text-center text-xs font-semibold text-[#283042] uppercase print:hidden", children: "Actions" })
13430
+ ] }) }),
13431
+ /* @__PURE__ */ jsx46("tbody", { className: "divide-y divide-[#E8E8E8]", children: formData?.items?.map((line, index) => /* @__PURE__ */ jsxs41("tr", { className: index % 2 === 0 ? "bg-white" : "bg-gray-50", children: [
13432
+ /* @__PURE__ */ jsx46("td", { className: "border border-[#d1d7de] px-2 py-2", children: !readonly ? /* @__PURE__ */ jsx46(
13433
+ "textarea",
13434
+ {
13435
+ value: line.description,
13436
+ onChange: (e) => {
13437
+ const newLignes = [...formData.items ?? []];
13438
+ newLignes[index].description = e.target.value;
13439
+ setFormData({ ...formData, items: newLignes });
13440
+ },
13441
+ rows: 2,
13442
+ className: `w-full px-1 py-1 border rounded text-xs resize-none ${errors[`line_${index}_designation`] ? "border-red-500" : "border-[#d1d7de]"}`,
13443
+ placeholder: "Description d\xE9taill\xE9e *"
13444
+ }
13445
+ ) : /* @__PURE__ */ jsx46("div", { className: "text-xs", children: line.description }) }),
13446
+ /* @__PURE__ */ jsx46("td", { className: "border border-[#d1d7de] px-2 py-2", children: !readonly ? /* @__PURE__ */ jsx46(
13447
+ "select",
13448
+ {
13449
+ value: line.unit,
13450
+ onChange: (e) => {
13451
+ const newLignes = [...formData.items ?? []];
13452
+ newLignes[index].unit = e.target.value;
13453
+ setFormData({ ...formData, items: newLignes });
13454
+ },
13455
+ className: "w-full px-1 py-1 border border-[#d1d7de] rounded text-xs",
13456
+ children: UNITS.map((unit) => /* @__PURE__ */ jsx46("option", { value: unit, children: unit }, unit))
13457
+ }
13458
+ ) : /* @__PURE__ */ jsx46("div", { className: "text-xs", children: line.unit }) }),
13459
+ /* @__PURE__ */ jsx46("td", { className: "border border-[#d1d7de] px-2 py-2 text-right", children: !readonly ? /* @__PURE__ */ jsx46(
13460
+ "input",
13461
+ {
13462
+ type: "number",
13463
+ min: "0",
13464
+ value: line.quantity,
13465
+ onChange: (e) => {
13466
+ const newLignes = [...formData.items ?? []];
13467
+ const quantity = parseFloat(e.target.value) || 0;
13468
+ newLignes[index].quantity = quantity;
13469
+ newLignes[index].total_price = quantity * (newLignes[index].unit_price || 0);
13470
+ setFormData({ ...formData, items: newLignes });
13471
+ },
13472
+ className: `w-full px-1 py-1 border rounded text-xs text-right ${errors[`line_${index}_quantity`] ? "border-red-500" : "border-[#d1d7de]"}`
13473
+ }
13474
+ ) : /* @__PURE__ */ jsx46("div", { className: "text-xs font-medium", children: line.quantity.toLocaleString("fr-FR") }) }),
13475
+ /* @__PURE__ */ jsx46("td", { className: "border border-[#d1d7de] px-2 py-2 text-right", children: !readonly ? /* @__PURE__ */ jsx46(
13476
+ "input",
13477
+ {
13478
+ type: "number",
13479
+ min: "0",
13480
+ value: line.unit_price,
13481
+ onChange: (e) => {
13482
+ const newLignes = [...formData.items ?? []];
13483
+ const unitPrice = parseFloat(e.target.value) || 0;
13484
+ newLignes[index].unit_price = unitPrice;
13485
+ newLignes[index].total_price = (newLignes[index].quantity || 0) * unitPrice;
13486
+ setFormData({ ...formData, items: newLignes });
13487
+ },
13488
+ className: `w-full px-1 py-1 border rounded text-xs text-right ${errors[`line_${index}_price`] ? "border-red-500" : "border-[#d1d7de]"}`
13489
+ }
13490
+ ) : /* @__PURE__ */ jsxs41("div", { className: "text-xs", children: [
13491
+ line.unit_price?.toFixed(2),
13492
+ " FCFA"
13493
+ ] }) }),
13494
+ /* @__PURE__ */ jsx46("td", { className: "border border-[#d1d7de] px-2 py-2 text-right font-medium", children: /* @__PURE__ */ jsxs41("div", { className: "text-xs", children: [
13495
+ ((line.quantity || 0) * (line.unit_price || 0)).toFixed(2),
13496
+ " FCFA"
13497
+ ] }) }),
13498
+ /* @__PURE__ */ jsx46("td", { className: "border border-[#d1d7de] px-2 py-2", children: !readonly ? /* @__PURE__ */ jsx46(
13499
+ "textarea",
13500
+ {
13501
+ value: line.comments || "",
13502
+ onChange: (e) => {
13503
+ const newLignes = [...formData.items ?? []];
13504
+ newLignes[index].comments = e.target.value;
13505
+ setFormData({ ...formData, items: newLignes });
13506
+ },
13507
+ rows: 1,
13508
+ className: "w-full px-1 py-1 border border-[#d1d7de] rounded text-xs resize-none",
13509
+ placeholder: "Commentaires"
13510
+ }
13511
+ ) : /* @__PURE__ */ jsx46("div", { className: "text-xs", children: line.comments || "-" }) }),
13512
+ !readonly && /* @__PURE__ */ jsx46("td", { className: "border border-[#d1d7de] px-2 py-2 text-center print:hidden", children: /* @__PURE__ */ jsx46(
13513
+ Buttons_default,
13514
+ {
13515
+ onClick: () => {
13516
+ const newItems = (formData.items ?? []).filter((_, i) => i !== index);
13517
+ setFormData({ ...formData, items: newItems });
13518
+ },
13519
+ children: /* @__PURE__ */ jsx46(Trash26, { className: "w-3 h-3" })
13520
+ }
13521
+ ) })
13522
+ ] }, line.id)) })
13523
+ ] }) })
13524
+ ] });
13525
+ default:
13526
+ return null;
13527
+ }
13528
+ };
13529
+ if (!isOpen) return null;
13530
+ return /* @__PURE__ */ jsxs41(
13531
+ Modals_default,
13532
+ {
13533
+ title: "Demande d'achat",
13534
+ width: "max-w-4xl",
13535
+ minContentHeight: "450px",
13536
+ description: ``,
13537
+ open: isOpen,
13538
+ onClose,
13539
+ children: [
13540
+ /* @__PURE__ */ jsx46("div", { className: "border-b border-gray-200", children: /* @__PURE__ */ jsx46("nav", { className: "flex space-x-8 px-6", children: tabs.map((tab) => {
13541
+ const Icon = tab.icon;
13542
+ return /* @__PURE__ */ jsxs41(
13543
+ "button",
13544
+ {
13545
+ type: "button",
13546
+ onClick: () => setActiveTab(tab.id),
13547
+ className: `
13548
+ flex items-center space-x-2 py-4 px-2 text-sm font-medium border-b-2 transition-colors
13549
+ ${activeTab === tab.id ? "border-[#6A8A82] text-[#6A8A82]" : "border-transparent text-[#767676] hover:text-[#6A8A82] hover:border-[#6A8A82]/30"}
13550
+ `,
13551
+ children: [
13552
+ /* @__PURE__ */ jsx46(Icon, { className: "w-4 h-4 inline mr-2" }),
13553
+ /* @__PURE__ */ jsx46("span", { children: tab.label })
13554
+ ]
13555
+ },
13556
+ tab.id
13557
+ );
13558
+ }) }) }),
13559
+ /* @__PURE__ */ jsxs41("form", { onSubmit: handleSubmit, className: "p-6", children: [
13560
+ renderTabContent(),
13561
+ /* @__PURE__ */ jsxs41("div", { className: "flex justify-between pt-6 border-t border-gray-200 mt-8", children: [
13562
+ /* @__PURE__ */ jsx46(
13563
+ "button",
13564
+ {
13565
+ type: "button",
13566
+ onClick: onClose,
13567
+ className: "px-6 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors",
13568
+ children: "Annuler"
13569
+ }
13570
+ ),
13571
+ /* @__PURE__ */ jsx46(
13572
+ Buttons_default,
13573
+ {
13574
+ type: "submit",
13575
+ disabled: loading,
13576
+ children: loading ? "chargement..." : "Enregistrer l'entit\xE9"
13577
+ }
13578
+ )
13579
+ ] })
13580
+ ] })
13581
+ ]
13582
+ }
13583
+ );
13584
+ };
13585
+
13586
+ // src/pages/workspaces/PurchaseRequestsPage.tsx
13587
+ import { jsx as jsx47, jsxs as jsxs42 } from "react/jsx-runtime";
13588
+ var PurchaseRequestsPage = () => {
13589
+ const [purchaseRequests, setPurchaseRequests] = useState31([]);
13590
+ const [loading, setLoading] = useState31(true);
13591
+ const [refreshToggle, setRefreshToggle] = useState31(false);
13592
+ const [showModal, setShowModal] = useState31(false);
13593
+ const [showModalRFQ, setShowModalRFQ] = useState31(false);
13594
+ const [showModalSourcing, setShowModalSourcing] = useState31(false);
13595
+ const [selectedPurchaseRequest, setSelectedPurchaseRequest] = useState31(null);
13596
+ const { token } = useSession();
13597
+ useEffect21(() => {
13598
+ }, []);
13599
+ const loadPurchaseRequests = async () => {
13600
+ setRefreshToggle((prev) => !prev);
13601
+ };
13602
+ const tabs = [
13603
+ { id: "purchase_requests", label: "Demande d'achat", icon: ClipboardCheck },
13604
+ { id: "my_gr_se", label: "My GR-SE", icon: ClipboardCheck }
13605
+ ];
13606
+ const [activeTab, setActiveTab] = useState31("purchase_requests");
13607
+ return /* @__PURE__ */ jsxs42(
13608
+ Pages_default,
13609
+ {
13610
+ title: "Proculink",
13611
+ description: "G\xE9rez vos demandes d'achat",
13612
+ sideAction: /* @__PURE__ */ jsxs42(Buttons_default, { onClick: () => {
13613
+ setShowModal(true);
13614
+ setSelectedPurchaseRequest(null);
13615
+ }, children: [
13616
+ /* @__PURE__ */ jsx47(Plus11, { className: "h-4 w-4 mr-2" }),
13617
+ " Nouvelle demande"
13618
+ ] }),
13619
+ tabs: /* @__PURE__ */ jsx47("nav", { className: "flex space-x-1 mt-4 overflow-x-auto", children: tabs.map((tab) => {
13620
+ const Icon = tab.icon;
13621
+ return /* @__PURE__ */ jsxs42(
13622
+ "button",
13623
+ {
13624
+ onClick: () => setActiveTab(tab.id),
13625
+ className: `px-4 py-2 text-sm rounded-lg transition-all whitespace-nowrap ${activeTab === tab.id ? "bg-[var(--color-primary)] text-white shadow-md" : "text-gray-600 hover:bg-gray-100"}`,
13626
+ children: [
13627
+ /* @__PURE__ */ jsx47(Icon, { className: "w-4 h-4 inline mr-2" }),
13628
+ tab.label
13629
+ ]
13630
+ },
13631
+ tab.id
13632
+ );
13633
+ }) }),
13634
+ children: [
13635
+ activeTab === "purchase_requests" && /* @__PURE__ */ jsx47(
13636
+ FDrawer,
13637
+ {
13638
+ apiEndpoint: `/procurement/purchase-requests/myself/`,
13639
+ toggle: refreshToggle,
13640
+ columns: [
13641
+ { key: "request_number", label: "N\xB0 DA", type: "text", filterable: true, sortable: true, search_name: "request_number" },
13642
+ { key: "requested_by_user", label: "Demandeur", type: "text", filterable: true, sortable: false, search_name: "requester__last_name" },
13643
+ { key: "title", label: "Titre", type: "text", filterable: true, sortable: true, search_name: "title" },
13644
+ { key: "amount", label: "Montant", type: "number", filterable: true, sortable: true, search_name: "amount" },
13645
+ { key: "vendor", label: "Fournisseur", type: "text", filterable: true, sortable: true, search_name: "vendor", formule: (item) => item.vendor_info?.legal_name ?? "" },
13646
+ { key: "created_at", label: "Date de cr\xE9ation", type: "date", filterable: true, sortable: true, search_name: "created_at" },
13647
+ { key: "status", label: "Statut", type: "text", filterable: true, sortable: true, search_name: "status" },
13648
+ {
13649
+ key: "sourcing_id",
13650
+ label: "Sourcing",
13651
+ type: "text",
13652
+ filterable: true,
13653
+ sortable: false,
13654
+ search_name: "sourcing_id",
13655
+ formule: (item) => {
13656
+ if (item.sourcing_id) {
13657
+ return /* @__PURE__ */ jsx47("span", { className: "bg-secondary text-[13px] text-primary px-4 py-1 rounded-[4px]", onClick: () => {
13658
+ }, children: "SSJ" });
13659
+ }
13660
+ if (item.rfq) {
13661
+ return /* @__PURE__ */ jsx47(
13662
+ "span",
13663
+ {
13664
+ className: "bg-secondary text-[13px] text-primary px-4 py-1 rounded-[4px]",
13665
+ onClick: () => {
13666
+ setSelectedPurchaseRequest(item);
13667
+ setShowModalRFQ(true);
13668
+ },
13669
+ children: "appel d'offre"
13670
+ }
13671
+ );
13672
+ }
13673
+ return "N/A";
13674
+ }
13675
+ },
13676
+ {
13677
+ key: "approval_status",
13678
+ label: "",
13679
+ type: "custom",
13680
+ filterable: true,
13681
+ sortable: false,
13682
+ search_name: "approval_status",
13683
+ formule: (item) => {
13684
+ return /* @__PURE__ */ jsx47(
13685
+ ApprovalWorkflow_default,
13686
+ {
13687
+ title: `Approbation de la demande d'achat ${item.request_number} ${item.title}`,
13688
+ process: "PCR-PR",
13689
+ object_id: item.id,
13690
+ CustomBtn: (props) => /* @__PURE__ */ jsx47(Buttons_default, { className: "rounded-[6px] bg-gray-500 p-1 text-white", ...props, children: /* @__PURE__ */ jsx47(ClipboardCheck, {}) }),
13691
+ readOnly: false
13692
+ }
13693
+ );
13694
+ }
13695
+ }
13696
+ ],
13697
+ actions: [
13698
+ {
13699
+ label: "Modifier",
13700
+ permission: "edit_user",
13701
+ onclick: (item) => {
13702
+ setSelectedPurchaseRequest(item);
13703
+ setShowModal(true);
13704
+ }
13705
+ },
13706
+ { label: "Supprimer", permission: "delete_user", onclick: (item) => {
13707
+ } }
13708
+ ],
13709
+ ordering: "title"
13710
+ }
13711
+ ),
13712
+ activeTab === "my_gr_se" && /* @__PURE__ */ jsx47(
13713
+ FDrawer,
13714
+ {
13715
+ apiEndpoint: `/procurement/receipts/search/`,
13716
+ columns: [
13717
+ { key: "created_at", label: "Date de cr\xE9ation", type: "date", filterable: true, sortable: true, search_name: "created_at" },
13718
+ { key: "receipt_number", label: "N\xB0 R\xE9ception", type: "text", filterable: true, sortable: false, search_name: "receipt_number" },
13719
+ { key: "type_of_receipt", label: "Type", type: "text", filterable: true, sortable: false, search_name: "type_of_receipt" },
13720
+ {
13721
+ key: "purchase_order",
13722
+ label: "N\xB0 Commande",
13723
+ type: "text",
13724
+ filterable: true,
13725
+ sortable: false,
13726
+ search_name: "purchase_order__quote_number",
13727
+ formule: (item) => item.purchase_order_info?.quote_number ?? "-"
13728
+ },
13729
+ {
13730
+ key: "vendor",
13731
+ label: "Fournisseur",
13732
+ type: "text",
13733
+ filterable: true,
13734
+ sortable: false,
13735
+ search_name: "purchase_order__vendor__legal_name",
13736
+ formule: (item) => item.purchase_order_info?.vendor_info?.legal_name ?? "-"
13737
+ },
13738
+ { key: "received_at", label: "Date de r\xE9ception", type: "date", filterable: true, sortable: true, search_name: "received_at" },
13739
+ { key: "receipt_address", label: "Lieu", type: "text", filterable: true, sortable: false, search_name: "receipt_address" },
13740
+ {
13741
+ key: "approval_status",
13742
+ label: "",
13743
+ type: "custom",
13744
+ filterable: true,
13745
+ sortable: false,
13746
+ search_name: "approval_status",
13747
+ formule: (item) => {
13748
+ return /* @__PURE__ */ jsx47(
13749
+ ApprovalWorkflow_default,
13750
+ {
13751
+ title: `Approbation de la reception ${item.receipt_number} ${item.purchase_order_info.quote_number}`,
13752
+ process: "PCR-RCPT",
13753
+ object_id: item.id,
13754
+ CustomBtn: (props) => /* @__PURE__ */ jsx47(Buttons_default, { className: "rounded-[6px] bg-gray-500 p-1 text-white", ...props, children: /* @__PURE__ */ jsx47(ClipboardCheck, {}) }),
13755
+ readOnly: false
13756
+ }
13757
+ );
13758
+ }
13759
+ },
13760
+ { key: "status", label: "Statut", type: "text", filterable: true, sortable: false, search_name: "status" }
13761
+ ],
13762
+ actions: [],
13763
+ ordering: "received_at"
13764
+ }
13765
+ ),
13766
+ /* @__PURE__ */ jsx47(
13767
+ FormPurchaseRequest,
13768
+ {
13769
+ isOpen: showModal,
13770
+ onClose: () => setShowModal(false),
13771
+ refresh: loadPurchaseRequests,
13772
+ object: selectedPurchaseRequest
13773
+ },
13774
+ `PRFORM-${selectedPurchaseRequest?.id}`
13775
+ )
13776
+ ]
13777
+ }
13778
+ );
13779
+ };
13780
+
13781
+ // src/App.tsx
13782
+ import { Routes, Route, BrowserRouter } from "react-router-dom";
13783
+
13784
+ // src/pages/Home.tsx
13785
+ import { useState as useState32 } from "react";
13786
+ import { useNavigate as useNavigate3 } from "react-router-dom";
13787
+ import {
13788
+ Zap as Zap2,
13789
+ Users as Users10,
13790
+ ArrowRight as ArrowRight5,
13791
+ Sparkles,
13792
+ TrendingUp as TrendingUp5,
13793
+ LogIn,
13794
+ UserPlus as UserPlus2,
13795
+ Play,
13796
+ Star as Star2,
13797
+ Quote,
13798
+ Monitor,
13799
+ Smartphone,
13800
+ Cloud,
13801
+ Lock as Lock2,
13802
+ RefreshCw as RefreshCw9,
13803
+ Headphones,
13804
+ Check as Check3,
13805
+ Mail as Mail3,
13806
+ Phone as Phone4,
13807
+ MapPin as MapPin6,
13808
+ Linkedin,
13809
+ Twitter,
13810
+ Github,
13811
+ ChevronDown as ChevronDown5
13812
+ } from "lucide-react";
13813
+ import { jsx as jsx48, jsxs as jsxs43 } from "react/jsx-runtime";
13814
+
13815
+ // src/pages/auth/Login.tsx
13816
+ import { useState as useState33 } from "react";
13817
+ import { Eye as Eye5, EyeOff as EyeOff3 } from "lucide-react";
13818
+ import { useNavigate as useNavigate4 } from "react-router-dom";
13819
+ import { jsx as jsx49, jsxs as jsxs44 } from "react/jsx-runtime";
13820
+
13821
+ // src/pages/auth/Register.tsx
13822
+ import { useState as useState34 } from "react";
13823
+ import { Eye as Eye6, EyeOff as EyeOff4 } from "lucide-react";
13824
+ import { useNavigate as useNavigate5 } from "react-router-dom";
13825
+ import { jsx as jsx50, jsxs as jsxs45 } from "react/jsx-runtime";
13826
+
13827
+ // src/pages/Dashboard.tsx
13828
+ import { useEffect as useEffect22 } from "react";
13829
+ import { useNavigate as useNavigate6 } from "react-router-dom";
13830
+ import {
13831
+ FileText as FileText12,
13832
+ CheckCircle as CheckCircle5,
13833
+ Receipt as Receipt2,
13834
+ Users as Users11,
13835
+ TrendingUp as TrendingUp6,
13836
+ TrendingDown as TrendingDown3,
13837
+ Clock as Clock8,
13838
+ ArrowRight as ArrowRight6,
13839
+ ShoppingCart as ShoppingCart3,
13840
+ Calculator as Calculator3,
13841
+ Briefcase as Briefcase2,
13842
+ UserCheck
13843
+ } from "lucide-react";
13844
+ import { jsx as jsx51, jsxs as jsxs46 } from "react/jsx-runtime";
13845
+
13846
+ // src/pages/Analytics.tsx
13847
+ import { BarChart3 as BarChart33, TrendingUp as TrendingUp7, Users as Users12, Clock as Clock9 } from "lucide-react";
13848
+ import { jsx as jsx52, jsxs as jsxs47 } from "react/jsx-runtime";
13849
+
13850
+ // src/pages/Team.tsx
13851
+ import { useState as useState35 } from "react";
13852
+ import { Plus as Plus12, Search as Search7, Filter as Filter4, MoreVertical as MoreVertical4, Mail as Mail4, Phone as Phone5, MapPin as MapPin7 } from "lucide-react";
13853
+ import { jsx as jsx53, jsxs as jsxs48 } from "react/jsx-runtime";
13854
+
13855
+ // src/pages/Profile.tsx
13856
+ import { useState as useState36, useEffect as useEffect23 } from "react";
13857
+ import { Camera as Camera2, Mail as Mail5, Phone as Phone6, Calendar as Calendar7, Edit3 as Edit34, Save as Save2, X as X11, User as UserIcon2 } from "lucide-react";
13858
+ import { jsx as jsx54, jsxs as jsxs49 } from "react/jsx-runtime";
13859
+
13860
+ // src/pages/Settings.tsx
13861
+ import { useState as useState37 } from "react";
13862
+ import {
13863
+ Bell as Bell2,
13864
+ Shield as Shield3,
13865
+ Palette as Palette2,
13866
+ Monitor as Monitor2,
13867
+ Moon,
13868
+ Sun,
13869
+ Eye as Eye7,
13870
+ Key,
13871
+ Trash2 as Trash27,
13872
+ Save as Save3,
13873
+ AlertTriangle as AlertTriangle7
13874
+ } from "lucide-react";
13875
+ import { jsx as jsx55, jsxs as jsxs50 } from "react/jsx-runtime";
13876
+
13877
+ // src/pages/CreateOrganization.tsx
13878
+ import { useEffect as useEffect24, useState as useState38 } from "react";
13879
+ import { useNavigate as useNavigate7, useParams as useParams2 } from "react-router-dom";
13880
+ import { ArrowLeft, Loader2 as Loader25 } from "lucide-react";
13881
+
13882
+ // src/services/OrganizationServices.ts
13883
+ var ORGANIZATIONS_API_URL = `${API_URL}/core/organizations/`;
13884
+ var ENTITIES_API_URL = `${API_URL}/core/entities/`;
13885
+
13886
+ // src/pages/CreateOrganization.tsx
13887
+ import { jsx as jsx56, jsxs as jsxs51 } from "react/jsx-runtime";
13888
+
13889
+ // src/pages/organizations/ListOrganizations.tsx
13890
+ import { useState as useState39, useEffect as useEffect25 } from "react";
13891
+ import { useNavigate as useNavigate8 } from "react-router-dom";
13892
+ import {
13893
+ Building2 as Building28,
13894
+ Plus as Plus13,
13895
+ Search as Search8,
13896
+ MoreVertical as MoreVertical5,
13897
+ Edit as Edit2,
13898
+ Trash2 as Trash28,
13899
+ Eye as Eye8,
13900
+ Phone as Phone7,
13901
+ Mail as Mail6,
13902
+ MapPin as MapPin9,
13903
+ Calendar as Calendar8
13904
+ } from "lucide-react";
13905
+ import { jsx as jsx57, jsxs as jsxs52 } from "react/jsx-runtime";
13906
+
13907
+ // src/pages/organizations/DetailOrganizations.tsx
13908
+ import { useState as useState41, useEffect as useEffect27 } from "react";
13909
+ import { useParams as useParams3, useNavigate as useNavigate10 } from "react-router-dom";
13910
+ import {
13911
+ ArrowLeft as ArrowLeft2,
13912
+ Building2 as Building29,
13913
+ Edit as Edit4,
13914
+ Trash2 as Trash29,
13915
+ Plus as Plus14,
13916
+ MapPin as MapPin10,
13917
+ Eye as Eye9,
13918
+ CreditCard as CreditCard5,
13919
+ FileText as FileText13,
13920
+ MoreVertical as MoreVertical6,
13921
+ X as X13,
13922
+ Save as Save4,
13923
+ Loader2 as Loader26
13924
+ } from "lucide-react";
13925
+
13926
+ // src/pages/pricings/ListPricing.tsx
13927
+ import { useState as useState40 } from "react";
13928
+ import { useNavigate as useNavigate9 } from "react-router-dom";
13929
+ import {
13930
+ Check as Check4,
13931
+ X as X12
13932
+ } from "lucide-react";
13933
+ import { Fragment as Fragment12, jsx as jsx58, jsxs as jsxs53 } from "react/jsx-runtime";
13934
+
13935
+ // src/services/PlanSubscriptionServices.tsx
13936
+ var MODULES_API_URL = `${API_URL}/core/modules/`;
13937
+ var PLANS_API_URL = `${API_URL}/core/plans/`;
13938
+
13939
+ // src/pages/organizations/DetailOrganizations.tsx
13940
+ import { Fragment as Fragment13, jsx as jsx59, jsxs as jsxs54 } from "react/jsx-runtime";
13941
+
13942
+ // src/pages/organizations/DetailEntity.tsx
13943
+ import { useState as useState43, useEffect as useEffect29 } from "react";
13944
+ import { useNavigate as useNavigate11, useParams as useParams4 } from "react-router-dom";
13945
+ import { Building2 as Building211, CreditCard as CreditCard6, FileText as FileText14, MapPin as MapPin11, User as UserIcon4 } from "lucide-react";
13946
+
13947
+ // src/forms/UserForm.tsx
13948
+ import { useState as useState42, useEffect as useEffect28 } from "react";
13949
+
13950
+ // src/services/AuthorizationService.ts
13951
+ var API_BASE_URL3 = `${API_URL}/core/permissions`;
13952
+
13953
+ // src/forms/UserForm.tsx
13954
+ import { Building2 as Building210, User as UserIcon3, X as X14 } from "lucide-react";
13955
+ import { Fragment as Fragment14, jsx as jsx60, jsxs as jsxs55 } from "react/jsx-runtime";
13956
+
13957
+ // src/pages/organizations/DetailEntity.tsx
13958
+ import { jsx as jsx61, jsxs as jsxs56 } from "react/jsx-runtime";
13959
+
13960
+ // src/pages/pricings/CartPlan.tsx
13961
+ import { useState as useState44, useEffect as useEffect30 } from "react";
13962
+ import { useNavigate as useNavigate12, useSearchParams as useSearchParams3 } from "react-router-dom";
13963
+ import {
13964
+ Check as Check5,
13965
+ Plus as Plus15,
13966
+ ArrowLeft as ArrowLeft3,
13967
+ CreditCard as CreditCard7,
13968
+ Shield as Shield5,
13969
+ Clock as Clock10,
13970
+ Users as Users13,
13971
+ Zap as Zap3,
13972
+ Trash2 as Trash210
13973
+ } from "lucide-react";
13974
+ import { Fragment as Fragment15, jsx as jsx62, jsxs as jsxs57 } from "react/jsx-runtime";
13975
+
13976
+ // src/App.tsx
13977
+ import {
13978
+ LayoutDashboard as LayoutDashboard2,
13979
+ FileText as FileText17,
13980
+ Users as Users17,
13981
+ TrendingUp as TrendingUp8,
13982
+ Calculator as Calculator4,
13983
+ Briefcase as Briefcase5,
13984
+ UserCheck as UserCheck3,
13985
+ Workflow,
13986
+ Eye as Eye11,
13987
+ HomeIcon,
13988
+ SettingsIcon,
13989
+ MessageCircle as MessageCircle2,
13990
+ CircleDollarSign as CircleDollarSign2,
13991
+ Calendar as Calendar10,
13992
+ UserCog as UserCog2,
13993
+ Building2 as Building220,
13994
+ CalendarClock as CalendarClock2
13995
+ } from "lucide-react";
13996
+
13997
+ // src/pages/auth/ForgotPassword.tsx
13998
+ import { useState as useState45 } from "react";
13999
+ import { useNavigate as useNavigate13 } from "react-router-dom";
14000
+ import { Mail as Mail7, CheckCircle as CheckCircle6 } from "lucide-react";
14001
+ import { jsx as jsx63, jsxs as jsxs58 } from "react/jsx-runtime";
14002
+
14003
+ // src/pages/auth/ResetPassword.tsx
14004
+ import { useState as useState46 } from "react";
14005
+ import { useNavigate as useNavigate14, useParams as useParams5 } from "react-router-dom";
14006
+ import { Lock as Lock4, CheckCircle as CheckCircle7 } from "lucide-react";
14007
+ import { jsx as jsx64, jsxs as jsxs59 } from "react/jsx-runtime";
14008
+
14009
+ // src/pages/auth/RespondInvitationEmail.tsx
14010
+ import { useState as useState47, useEffect as useEffect31 } from "react";
14011
+ import { useNavigate as useNavigate15, useSearchParams as useSearchParams4 } from "react-router-dom";
14012
+ import { Building2 as Building213, User as UserIcon5, Mail as Mail8, CheckCircle as CheckCircle8, XCircle as XCircle3 } from "lucide-react";
14013
+ import { jsx as jsx65, jsxs as jsxs60 } from "react/jsx-runtime";
14014
+
14015
+ // src/pages/parameters/ProfitCostCenterPage.tsx
14016
+ import { useState as useState48, useEffect as useEffect32 } from "react";
14017
+ import { useNavigate as useNavigate16 } from "react-router-dom";
14018
+ import {
14019
+ Plus as Plus16,
14020
+ Edit as Edit5,
14021
+ Trash2 as Trash211
14022
+ } from "lucide-react";
14023
+ import { Fragment as Fragment16, jsx as jsx66, jsxs as jsxs61 } from "react/jsx-runtime";
14024
+
14025
+ // src/pages/parameters/ParametersPage.tsx
14026
+ import { useNavigate as useNavigate17 } from "react-router-dom";
14027
+ import {
14028
+ Settings as Settings4,
14029
+ Building2 as Building215,
14030
+ Users as Users14,
14031
+ DollarSign as DollarSign2,
14032
+ FileText as FileText15,
14033
+ Shield as Shield6,
14034
+ Bell as Bell3,
14035
+ Palette as Palette3,
14036
+ Globe as Globe2,
14037
+ Database,
14038
+ ArrowRight as ArrowRight7,
14039
+ Briefcase as Briefcase3
14040
+ } from "lucide-react";
14041
+ import { jsx as jsx67, jsxs as jsxs62 } from "react/jsx-runtime";
14042
+
14043
+ // src/pages/users/UsersPage.tsx
14044
+ import { useState as useState49, useEffect as useEffect33 } from "react";
14045
+ import {
14046
+ Users as Users15,
14047
+ UserPlus as UserPlus3,
14048
+ Shield as Shield7,
14049
+ Key as Key2,
14050
+ Trash2 as Trash212,
14051
+ CheckCircle as CheckCircle9,
14052
+ XCircle as XCircle4,
14053
+ AlertTriangle as AlertTriangle8,
14054
+ Download as Download5,
14055
+ UserCheck as UserCheck2,
14056
+ UserX,
14057
+ Clock as Clock11,
14058
+ Activity as Activity2,
14059
+ Briefcase as Briefcase4,
14060
+ Plus as Plus17,
14061
+ Edit as Edit6,
14062
+ Loader2 as Loader27
14063
+ } from "lucide-react";
14064
+ import { Fragment as Fragment17, jsx as jsx68, jsxs as jsxs63 } from "react/jsx-runtime";
14065
+
14066
+ // src/pages/onboarding/OnboardingWizard.tsx
14067
+ import { useState as useState53, useEffect as useEffect35 } from "react";
14068
+ import { useNavigate as useNavigate18 } from "react-router-dom";
14069
+ import { X as X16 } from "lucide-react";
14070
+
14071
+ // src/pages/onboarding/components/StepIndicator.tsx
14072
+ import React46 from "react";
14073
+ import { Check as Check6 } from "lucide-react";
14074
+ import { jsx as jsx69, jsxs as jsxs64 } from "react/jsx-runtime";
14075
+
14076
+ // src/pages/onboarding/steps/WelcomeStep.tsx
14077
+ import { Building2 as Building216, Users as Users16, FileCheck as FileCheck2, ArrowRight as ArrowRight8 } from "lucide-react";
14078
+ import { jsx as jsx70, jsxs as jsxs65 } from "react/jsx-runtime";
14079
+
14080
+ // src/pages/onboarding/steps/OrganizationStep.tsx
14081
+ import { useState as useState50 } from "react";
14082
+ import { Building2 as Building217, ArrowLeft as ArrowLeft4, ArrowRight as ArrowRight9, Loader2 as Loader28 } from "lucide-react";
14083
+ import { Fragment as Fragment18, jsx as jsx71, jsxs as jsxs66 } from "react/jsx-runtime";
14084
+
14085
+ // src/pages/onboarding/steps/EntityStep.tsx
14086
+ import { useState as useState51 } from "react";
14087
+ import { Store, ArrowLeft as ArrowLeft5, ArrowRight as ArrowRight10, Loader2 as Loader29, MapPin as MapPin13 } from "lucide-react";
14088
+ import { Fragment as Fragment19, jsx as jsx72, jsxs as jsxs67 } from "react/jsx-runtime";
14089
+
14090
+ // src/pages/onboarding/steps/ConfirmationStep.tsx
14091
+ import { useEffect as useEffect34, useState as useState52 } from "react";
14092
+ import { CheckCircle as CheckCircle10, Building2 as Building218, Store as Store2, ArrowRight as ArrowRight11, Sparkles as Sparkles3 } from "lucide-react";
14093
+ import { jsx as jsx73, jsxs as jsxs68 } from "react/jsx-runtime";
14094
+
14095
+ // src/pages/onboarding/OnboardingWizard.tsx
14096
+ import { jsx as jsx74, jsxs as jsxs69 } from "react/jsx-runtime";
14097
+
14098
+ // src/pages/parameters/CrmParametersPage.tsx
14099
+ import { useState as useState54, useEffect as useEffect36 } from "react";
14100
+ import {
14101
+ Plus as Plus18,
14102
+ Edit as Edit7,
14103
+ Trash2 as Trash213
14104
+ } from "lucide-react";
14105
+
14106
+ // src/services/CrmServices.ts
14107
+ var TARGET_RETAILER_URI = `${API_URL}/crm/target-retailers/`;
14108
+ var DAS_URI = `${API_URL}/crm/das/`;
14109
+ var OTHER_COST_URI = `${API_URL}/crm/other-costs/`;
14110
+ var LEAD_NEED_URI = `${API_URL}/crm/lead-needs/`;
14111
+
14112
+ // src/pages/parameters/CrmParametersPage.tsx
14113
+ import { Fragment as Fragment20, jsx as jsx75, jsxs as jsxs70 } from "react/jsx-runtime";
14114
+
14115
+ // src/pages/organizations/EntitiesPage.tsx
14116
+ import { useState as useState55 } from "react";
14117
+ import {
14118
+ Building2 as Building219,
14119
+ Plus as Plus19,
14120
+ MapPin as MapPin14,
14121
+ CreditCard as CreditCard8,
14122
+ FileText as FileText16,
14123
+ Building
14124
+ } from "lucide-react";
14125
+ import { jsx as jsx76, jsxs as jsxs71 } from "react/jsx-runtime";
14126
+
14127
+ // src/App.tsx
14128
+ import { jsx as jsx77, jsxs as jsxs72 } from "react/jsx-runtime";
14129
+ var WorkSpaceRoutes = ({ module_name = "Rewise", module_description = "" }) => {
14130
+ const { showAuthModal, setShowAuthModal } = useSession();
14131
+ const primaryMenuItems = [
14132
+ { id: "home", label: "Home", path: "/workspace/", icon: /* @__PURE__ */ jsx77(HomeIcon, { className: "w-4 h-4" }) },
14133
+ { id: "task-pilot", label: "Task Pilot", path: "/workspace/task-pilot", icon: /* @__PURE__ */ jsx77(Workflow, { className: "w-4 h-4" }) },
14134
+ { id: "proculink", label: "ProcuLink", path: "/workspace/proculink", icon: /* @__PURE__ */ jsx77(TrendingUp8, { className: "w-4 h-4" }) },
14135
+ { id: "fixitnow", label: "Fix It Now", path: "/workspace/fix-it-now", icon: /* @__PURE__ */ jsx77(SettingsIcon, { className: "w-4 h-4" }) },
14136
+ { id: "hr-connect", label: "HR Connect", path: "/workspace/hr-connect", icon: /* @__PURE__ */ jsx77(UserCog2, { className: "w-4 h-4" }) },
14137
+ { id: "meeting-hub", label: "Meeting Hub", path: "/workspace/meeting-hub", icon: /* @__PURE__ */ jsx77(Calendar10, { className: "w-4 h-4" }) },
14138
+ { id: "budget", label: "Budget", icon: /* @__PURE__ */ jsx77(CircleDollarSign2, { className: "w-4 h-4" }) },
14139
+ { id: "chat-equipe", label: "Chat Equipe", path: "/workspace/chat-equipe", icon: /* @__PURE__ */ jsx77(MessageCircle2, { className: "w-4 h-4" }) },
14140
+ { id: "actifs", label: "Actifs", path: "/workspace/actifs", icon: /* @__PURE__ */ jsx77(Building220, { className: "w-4 h-4" }) },
14141
+ { id: "planning", label: "Planning", path: "/workspace/planning", icon: /* @__PURE__ */ jsx77(CalendarClock2, { className: "w-4 h-4" }) }
14142
+ ];
14143
+ const secondaryMenuItems = {
14144
+ budget: [
14145
+ { id: "opex", label: "OPEX", path: "budget/opex", icon: /* @__PURE__ */ jsx77(Eye11, { className: "w-4 h-4" }) },
14146
+ { id: "capex", label: "CAPEX", path: "budget/capex", icon: /* @__PURE__ */ jsx77(Eye11, { className: "w-4 h-4" }) },
14147
+ { id: "car", label: "CAR", path: "budget/car", icon: /* @__PURE__ */ jsx77(Eye11, { className: "w-4 h-4" }) }
14148
+ ]
14149
+ };
14150
+ return /* @__PURE__ */ jsx77(ModernDoubleSidebarLayout_default, { module_name, module_description, primaryMenuItems, secondaryMenuItems, children: /* @__PURE__ */ jsxs72(Routes, { children: [
14151
+ /* @__PURE__ */ jsx77(Route, { path: "workspace", element: /* @__PURE__ */ jsx77(WorkSpace_default, {}) }),
14152
+ /* @__PURE__ */ jsx77(Route, { path: "task-pilot", element: /* @__PURE__ */ jsx77(TaskPilot_default, {}) }),
14153
+ /* @__PURE__ */ jsx77(Route, { path: "proculink", element: /* @__PURE__ */ jsx77(PurchaseRequestsPage, {}) }),
14154
+ /* @__PURE__ */ jsx77(Route, { path: "hr-connect", element: /* @__PURE__ */ jsx77(HRConnectPage_default, {}) }),
14155
+ /* @__PURE__ */ jsx77(Route, { path: "meeting-hub", element: /* @__PURE__ */ jsx77(MeetingHubPage_default, {}) }),
14156
+ /* @__PURE__ */ jsx77(Route, { path: "budget/*", element: /* @__PURE__ */ jsx77(BudgetPage_default, {}) }),
14157
+ /* @__PURE__ */ jsx77(Route, { path: "chat-equipe", element: /* @__PURE__ */ jsx77(ChatEquipePage_default, {}) }),
14158
+ /* @__PURE__ */ jsx77(Route, { path: "actifs", element: /* @__PURE__ */ jsx77(ActifsPage_default, {}) }),
14159
+ /* @__PURE__ */ jsx77(Route, { path: "planning", element: /* @__PURE__ */ jsx77(PlanningPage_default, {}) })
14160
+ ] }) });
14161
+ };
10264
14162
  export {
10265
14163
  ACCOUNT_TYPE_LABELS,
10266
14164
  AccountServices,
14165
+ AccountingWorkspace_default as AccountingWorkspace,
14166
+ ActifsPage_default as ActifsPage,
10267
14167
  Alert_default as Alert,
10268
14168
  AlertProvider,
10269
14169
  ApprovalAnswerModal,
@@ -10273,9 +14173,14 @@ export {
10273
14173
  ApprovalWorkflow_default as ApprovalWorkflow,
10274
14174
  AuthServices,
10275
14175
  BALANCE_TYPE_LABELS,
14176
+ BudgetPage_default as BudgetPage,
10276
14177
  Choices_default as CHOICES,
14178
+ CardBody,
14179
+ CardHeader,
14180
+ ChatEquipePage_default as ChatEquipePage,
10277
14181
  ClientServices,
10278
14182
  CountrySelector,
14183
+ CrmWorkspace_default as CrmWorkspace,
10279
14184
  DataTable,
10280
14185
  DateInput,
10281
14186
  DocumentFooter,
@@ -10283,6 +14188,7 @@ export {
10283
14188
  EntityFileManager,
10284
14189
  FDrawer,
10285
14190
  FROM_MODULE_CHOICES,
14191
+ FacilityWorkspace_default as FacilityWorkspace,
10286
14192
  FetchApi,
10287
14193
  FileInput,
10288
14194
  FileManager,
@@ -10290,21 +14196,28 @@ export {
10290
14196
  ForeignCurrencySelector,
10291
14197
  FormClient,
10292
14198
  FormVendor,
14199
+ HRConnectPage_default as HRConnectPage,
10293
14200
  InfoBox,
10294
14201
  InputField,
10295
14202
  InvoiceTypeSelector,
10296
14203
  LegalFormSelector,
14204
+ MeetingHubPage_default as MeetingHubPage,
10297
14205
  MinimalVendorForm,
10298
14206
  Modals_default as Modal,
14207
+ ModernCard,
10299
14208
  NumberInput,
10300
14209
  PRINT_GREEN,
10301
14210
  Pages_default as Pages,
10302
14211
  PaymentMethodSelector,
14212
+ PlanningPage_default as PlanningPage,
10303
14213
  Buttons_default as PrimaryButton,
10304
14214
  PrintPreview,
10305
14215
  PrintableDocument,
14216
+ PurchaseRequestsPage,
14217
+ PurchaseWorkspace_default as PurchaseWorkspace,
10306
14218
  ModernDoubleSidebarLayout_default as RewiseLayout,
10307
14219
  SYSCOHADA_CLASSES,
14220
+ SearchableSelect,
10308
14221
  SecondaryButton,
10309
14222
  SelectAccount,
10310
14223
  SelectClient,
@@ -10316,7 +14229,9 @@ export {
10316
14229
  SelectVendor,
10317
14230
  SessionProvider,
10318
14231
  SignatureSection,
14232
+ StatCard,
10319
14233
  TEMPLATE_FNE_CHOICES,
14234
+ TaskPilot_default as TaskPilot,
10320
14235
  TaxSelector,
10321
14236
  TemplateFNESelector,
10322
14237
  TextInput,
@@ -10327,6 +14242,9 @@ export {
10327
14242
  UnitServices,
10328
14243
  UserServices,
10329
14244
  VendorServices,
14245
+ WorkSpace_default as WorkSpace,
14246
+ WorkSpaceRoutes,
14247
+ WorkspaceServices,
10330
14248
  fileManagerApi,
10331
14249
  formatCurrency,
10332
14250
  formatDate,