ptechcore_ui 1.0.36 → 1.0.38

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
@@ -1757,8 +1757,8 @@ var getModuleUrls = (token) => {
1757
1757
  var MODULE_CODE_MAP = {
1758
1758
  "CRM": "WiseConnect",
1759
1759
  "MARKETING": "WiseReach",
1760
- "FACILITY": "WiseOps",
1761
- "SECURITY": "WiseGuard",
1760
+ "FACILITY": "WiseFm",
1761
+ "SECURITY": "WiseHSC",
1762
1762
  "THRIVE": "WiseThrive",
1763
1763
  "BI": "WiseView",
1764
1764
  "SOP": "WiseProcess",
@@ -2130,6 +2130,9 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2130
2130
  setSecondaryCollapsed(true);
2131
2131
  } else {
2132
2132
  setSelectedModule(item.id);
2133
+ if (secondaryMenuItems[item.id] && secondaryMenuItems[item.id].length > 0) {
2134
+ setSecondaryCollapsed(false);
2135
+ }
2133
2136
  }
2134
2137
  },
2135
2138
  className: cn(
@@ -2636,7 +2639,7 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2636
2639
  "button",
2637
2640
  {
2638
2641
  onClick: () => {
2639
- navigate("/settings");
2642
+ window.location.href = "https://core.rewise.praedium-tech.com/parameters/profit-cost-centers/";
2640
2643
  setShowUserMenu(false);
2641
2644
  },
2642
2645
  className: "w-full flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-[var(--color-surface-hover)] transition-colors",
@@ -2751,8 +2754,8 @@ var RewiseLayout = ({ children, module_name = "Rewise", module_description = "De
2751
2754
  /* @__PURE__ */ jsx9("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-3", children: [
2752
2755
  { name: "WiseConnect", icon: crm_blue_default, iconWhite: crmwhite_default, url: moduleUrls.wiseConnect },
2753
2756
  { 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 }
2757
+ { name: "WiseFm", icon: facilityblue_default, iconWhite: facilityblanc_default, url: moduleUrls.wiseOps },
2758
+ { name: "WiseHSE", icon: security_managementblue_default, iconWhite: security_managementblanc_default, url: moduleUrls.wiseGuard }
2756
2759
  ].map((module) => /* @__PURE__ */ jsx9(
2757
2760
  "button",
2758
2761
  {
@@ -4721,6 +4724,7 @@ import { useEffect as useEffect8, useState as useState10 } from "react";
4721
4724
 
4722
4725
  // src/components/common/SearchableSelect.tsx
4723
4726
  import { useState as useState9, useRef as useRef2, useEffect as useEffect7 } from "react";
4727
+ import { createPortal as createPortal2 } from "react-dom";
4724
4728
  import { Search as Search3, ChevronDown as ChevronDown2, X as X6, RefreshCw as RefreshCw2, Plus as Plus2 } from "lucide-react";
4725
4729
  import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
4726
4730
  var SearchableSelect = ({
@@ -4738,7 +4742,9 @@ var SearchableSelect = ({
4738
4742
  }) => {
4739
4743
  const [isOpen, setIsOpen] = useState9(false);
4740
4744
  const [searchTerm, setSearchTerm] = useState9("");
4745
+ const [dropdownPosition, setDropdownPosition] = useState9({ top: 0, left: 0, width: 0 });
4741
4746
  const dropdownRef = useRef2(null);
4747
+ const dropdownMenuRef = useRef2(null);
4742
4748
  const inputRef = useRef2(null);
4743
4749
  const selectedOption = options.find((option) => option.value === value);
4744
4750
  const defaultFilter = (option, searchTerm2) => {
@@ -4747,9 +4753,22 @@ var SearchableSelect = ({
4747
4753
  const filteredOptions = options.filter(
4748
4754
  (option) => filterFunction ? filterFunction(option, searchTerm) : defaultFilter(option, searchTerm)
4749
4755
  );
4756
+ useEffect7(() => {
4757
+ if (isOpen && dropdownRef.current) {
4758
+ const rect = dropdownRef.current.getBoundingClientRect();
4759
+ setDropdownPosition({
4760
+ top: rect.bottom + window.scrollY,
4761
+ left: rect.left + window.scrollX,
4762
+ width: rect.width
4763
+ });
4764
+ }
4765
+ }, [isOpen]);
4750
4766
  useEffect7(() => {
4751
4767
  const handleClickOutside = (event) => {
4752
- if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
4768
+ const target = event.target;
4769
+ const isOutsideTrigger = dropdownRef.current && !dropdownRef.current.contains(target);
4770
+ const isOutsideMenu = dropdownMenuRef.current && !dropdownMenuRef.current.contains(target);
4771
+ if (isOutsideTrigger && isOutsideMenu) {
4753
4772
  setIsOpen(false);
4754
4773
  setSearchTerm("");
4755
4774
  }
@@ -4788,17 +4807,17 @@ var SearchableSelect = ({
4788
4807
  ${isOpen ? "ring-2 ring-[#6B7C92] border-transparent" : ""}
4789
4808
  `,
4790
4809
  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: [
4810
+ /* @__PURE__ */ jsx13("div", { className: "flex items-center space-x-2 flex-1 min-w-0", children: selectedOption ? /* @__PURE__ */ jsxs10(Fragment5, { children: [
4792
4811
  selectedOption.image && /* @__PURE__ */ jsx13(
4793
4812
  "img",
4794
4813
  {
4795
4814
  src: selectedOption.image,
4796
4815
  alt: selectedOption.label,
4797
- className: "w-6 h-6 rounded-full object-cover"
4816
+ className: "w-6 h-6 rounded-full object-cover flex-shrink-0"
4798
4817
  }
4799
4818
  ),
4800
- selectedOption.content || /* @__PURE__ */ jsx13("span", { className: "text-gray-900", children: selectedOption.label })
4801
- ] }) : /* @__PURE__ */ jsx13("span", { className: "text-gray-400", children: placeholder }) }),
4819
+ selectedOption.content || /* @__PURE__ */ jsx13("span", { className: "text-gray-900 truncate", children: selectedOption.label })
4820
+ ] }) : /* @__PURE__ */ jsx13("span", { className: "text-gray-400 truncate", children: placeholder }) }),
4802
4821
  /* @__PURE__ */ jsxs10("div", { className: "flex items-center space-x-2", children: [
4803
4822
  allowClear && selectedOption && /* @__PURE__ */ jsx13(
4804
4823
  "button",
@@ -4820,64 +4839,80 @@ var SearchableSelect = ({
4820
4839
  ] })
4821
4840
  }
4822
4841
  ),
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(
4842
+ isOpen && createPortal2(
4843
+ /* @__PURE__ */ jsxs10(
4862
4844
  "div",
4863
4845
  {
4864
- onClick: () => handleSelect(option),
4865
- className: "px-4 py-3 hover:bg-gray-50 cursor-pointer flex items-center space-x-3",
4846
+ ref: dropdownMenuRef,
4847
+ className: "fixed bg-white border border-gray-200 rounded-lg shadow-lg",
4848
+ style: {
4849
+ top: dropdownPosition.top,
4850
+ left: dropdownPosition.left,
4851
+ width: dropdownPosition.width,
4852
+ zIndex: 9999
4853
+ },
4866
4854
  children: [
4867
- option.image && /* @__PURE__ */ jsx13(
4868
- "img",
4855
+ /* @__PURE__ */ jsxs10("div", { className: "p-3 border-b border-gray-200 flex", children: [
4856
+ /* @__PURE__ */ jsxs10("div", { className: "relative w-full", children: [
4857
+ /* @__PURE__ */ jsx13(Search3, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4" }),
4858
+ /* @__PURE__ */ jsx13(
4859
+ "input",
4860
+ {
4861
+ ref: inputRef,
4862
+ type: "text",
4863
+ placeholder: searchPlaceholder,
4864
+ value: searchTerm,
4865
+ onChange: (e) => setSearchTerm(e.target.value),
4866
+ className: "w-full pl-10 pr-4 py-2 border border-gray-200 rounded-lg focus:ring-2 focus:ring-[#6B7C92] focus:border-transparent"
4867
+ }
4868
+ )
4869
+ ] }),
4870
+ /* @__PURE__ */ jsx13(
4871
+ "button",
4872
+ {
4873
+ type: "button",
4874
+ onClick: refresh,
4875
+ disabled,
4876
+ 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",
4877
+ title: "Rafra\xEEchir la liste",
4878
+ children: /* @__PURE__ */ jsx13(RefreshCw2, { className: `w-4 h-4 ${disabled ? "animate-spin" : ""}` })
4879
+ }
4880
+ ),
4881
+ addElement && /* @__PURE__ */ jsx13(
4882
+ "button",
4883
+ {
4884
+ type: "button",
4885
+ onClick: addElement,
4886
+ 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",
4887
+ title: "Ajouter un \xE9l\xE9ment",
4888
+ children: /* @__PURE__ */ jsx13(Plus2, { className: "w-4 h-4" })
4889
+ }
4890
+ )
4891
+ ] }),
4892
+ /* @__PURE__ */ jsx13("div", { className: "max-h-60 overflow-y-auto", children: filteredOptions.length > 0 ? filteredOptions.map((option) => /* @__PURE__ */ jsxs10(
4893
+ "div",
4869
4894
  {
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 })
4895
+ onClick: () => handleSelect(option),
4896
+ className: "px-4 py-3 hover:bg-gray-50 cursor-pointer flex items-center space-x-3",
4897
+ children: [
4898
+ option.image && /* @__PURE__ */ jsx13(
4899
+ "img",
4900
+ {
4901
+ src: option.image,
4902
+ alt: option.label,
4903
+ className: "w-8 h-8 rounded-full object-cover"
4904
+ }
4905
+ ),
4906
+ option.content || /* @__PURE__ */ jsx13("span", { className: "text-gray-900", children: option.label })
4907
+ ]
4908
+ },
4909
+ option.value
4910
+ )) : /* @__PURE__ */ jsx13("div", { className: "px-4 py-3 text-gray-500 text-center", children: "Aucun r\xE9sultat trouv\xE9" }) })
4876
4911
  ]
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
- ] })
4912
+ }
4913
+ ),
4914
+ document.body
4915
+ )
4881
4916
  ] });
4882
4917
  };
4883
4918
 
@@ -4945,7 +4980,10 @@ var PROFIT_URI = `${API_URL}/accounting/profit-center/`;
4945
4980
  import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
4946
4981
  var SelectVendor = ({
4947
4982
  value,
4948
- onSelect
4983
+ onSelect,
4984
+ allowClear,
4985
+ onRemove,
4986
+ label = "Ajouter un fournisseur"
4949
4987
  }) => {
4950
4988
  const [showModal, setShowModal] = useState10(false);
4951
4989
  const [selectedVendor, setSelectedVendor] = useState10(null);
@@ -4995,7 +5033,7 @@ var SelectVendor = ({
4995
5033
  loadVendors();
4996
5034
  };
4997
5035
  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" }) }),
5036
+ 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
5037
  /* @__PURE__ */ jsx14(
5000
5038
  SearchableSelect,
5001
5039
  {
@@ -5008,7 +5046,9 @@ var SelectVendor = ({
5008
5046
  refresh: handleRefresh,
5009
5047
  addElement: () => {
5010
5048
  setShowModal(true);
5011
- }
5049
+ },
5050
+ allowClear,
5051
+ onRemove
5012
5052
  },
5013
5053
  "fourni" + value
5014
5054
  ),
@@ -5027,7 +5067,10 @@ var SelectVendor = ({
5027
5067
  };
5028
5068
  var SelectUser = ({
5029
5069
  value,
5030
- onSelect
5070
+ onSelect,
5071
+ allowClear,
5072
+ onRemove,
5073
+ label = "S\xE9lectionner un utilisateur"
5031
5074
  }) => {
5032
5075
  const { token, activeBusinessEntity } = useSession();
5033
5076
  const [users, setUsers] = useState10(() => {
@@ -5083,7 +5126,7 @@ var SelectUser = ({
5083
5126
  }));
5084
5127
  };
5085
5128
  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" }) }),
5129
+ 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
5130
  /* @__PURE__ */ jsx14(
5088
5131
  SearchableSelect,
5089
5132
  {
@@ -5093,7 +5136,9 @@ var SelectUser = ({
5093
5136
  searchPlaceholder: "Rechercher...",
5094
5137
  onSelect,
5095
5138
  disabled: loading,
5096
- refresh: handleRefresh
5139
+ refresh: handleRefresh,
5140
+ allowClear,
5141
+ onRemove
5097
5142
  },
5098
5143
  "user" + value
5099
5144
  ),
@@ -5102,7 +5147,10 @@ var SelectUser = ({
5102
5147
  };
5103
5148
  var SelectDepartment = ({
5104
5149
  value,
5105
- onSelect
5150
+ onSelect,
5151
+ allowClear,
5152
+ onRemove,
5153
+ label = "S\xE9lectionner un d\xE9partement"
5106
5154
  }) => {
5107
5155
  const { token, activeBusinessEntity } = useSession();
5108
5156
  const [departments, setDepartments] = useState10(() => {
@@ -5148,7 +5196,7 @@ var SelectDepartment = ({
5148
5196
  }));
5149
5197
  };
5150
5198
  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" }) }),
5199
+ 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
5200
  /* @__PURE__ */ jsx14(
5153
5201
  SearchableSelect,
5154
5202
  {
@@ -5158,7 +5206,9 @@ var SelectDepartment = ({
5158
5206
  searchPlaceholder: "Rechercher...",
5159
5207
  onSelect,
5160
5208
  disabled: loading,
5161
- refresh: handleRefresh
5209
+ refresh: handleRefresh,
5210
+ allowClear,
5211
+ onRemove
5162
5212
  },
5163
5213
  "dept" + value
5164
5214
  ),
@@ -5167,7 +5217,10 @@ var SelectDepartment = ({
5167
5217
  };
5168
5218
  var SelectCostCenter = ({
5169
5219
  value,
5170
- onSelect
5220
+ onSelect,
5221
+ allowClear,
5222
+ onRemove,
5223
+ label = "S\xE9lectionner un centre de co\xFBt"
5171
5224
  }) => {
5172
5225
  const { token, activeBusinessEntity } = useSession();
5173
5226
  const [costCenters, setCostCenters] = useState10(() => {
@@ -5220,7 +5273,7 @@ var SelectCostCenter = ({
5220
5273
  }));
5221
5274
  };
5222
5275
  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" }) }),
5276
+ 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
5277
  /* @__PURE__ */ jsx14(
5225
5278
  SearchableSelect,
5226
5279
  {
@@ -5230,7 +5283,9 @@ var SelectCostCenter = ({
5230
5283
  searchPlaceholder: "Rechercher...",
5231
5284
  onSelect,
5232
5285
  disabled: loading,
5233
- refresh: handleRefresh
5286
+ refresh: handleRefresh,
5287
+ allowClear,
5288
+ onRemove
5234
5289
  },
5235
5290
  "cost" + value
5236
5291
  ),
@@ -5239,7 +5294,10 @@ var SelectCostCenter = ({
5239
5294
  };
5240
5295
  var SelectUnit = ({
5241
5296
  value,
5242
- onSelect
5297
+ onSelect,
5298
+ allowClear,
5299
+ onRemove,
5300
+ label = "S\xE9lectionner une unit\xE9"
5243
5301
  }) => {
5244
5302
  const { token, activeBusinessEntity } = useSession();
5245
5303
  const [units, setUnits] = useState10(() => {
@@ -5294,7 +5352,7 @@ var SelectUnit = ({
5294
5352
  }));
5295
5353
  };
5296
5354
  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" }) }),
5355
+ 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
5356
  /* @__PURE__ */ jsx14(
5299
5357
  SearchableSelect,
5300
5358
  {
@@ -5304,7 +5362,9 @@ var SelectUnit = ({
5304
5362
  searchPlaceholder: "Rechercher...",
5305
5363
  onSelect,
5306
5364
  disabled: loading,
5307
- refresh: handleRefresh
5365
+ refresh: handleRefresh,
5366
+ allowClear,
5367
+ onRemove
5308
5368
  },
5309
5369
  "unit" + value
5310
5370
  ),
@@ -5335,7 +5395,9 @@ var SelectAccount = ({
5335
5395
  filterClass,
5336
5396
  filterType,
5337
5397
  showInactive = false,
5338
- label = "Selectionner un compte"
5398
+ label = "Selectionner un compte",
5399
+ allowClear,
5400
+ onRemove
5339
5401
  }) => {
5340
5402
  const { token, activeBusinessEntity } = useSession();
5341
5403
  const [accounts, setAccounts] = useState10(() => {
@@ -5502,7 +5564,9 @@ var SelectAccount = ({
5502
5564
  onSelect,
5503
5565
  disabled: loading,
5504
5566
  refresh: handleRefresh,
5505
- addElement: handleOpenModal
5567
+ addElement: handleOpenModal,
5568
+ allowClear,
5569
+ onRemove
5506
5570
  },
5507
5571
  "account" + value
5508
5572
  ),
@@ -5612,7 +5676,10 @@ var SelectAccount = ({
5612
5676
  };
5613
5677
  var SelectClient = ({
5614
5678
  value,
5615
- onSelect
5679
+ onSelect,
5680
+ allowClear,
5681
+ onRemove,
5682
+ label = "S\xE9lectionner un client"
5616
5683
  }) => {
5617
5684
  const { token, activeBusinessEntity } = useSession();
5618
5685
  const [clients, setClients] = useState10(() => {
@@ -5662,7 +5729,7 @@ var SelectClient = ({
5662
5729
  loadClients();
5663
5730
  };
5664
5731
  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" }) }),
5732
+ 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
5733
  /* @__PURE__ */ jsx14(
5667
5734
  SearchableSelect,
5668
5735
  {
@@ -5672,7 +5739,9 @@ var SelectClient = ({
5672
5739
  searchPlaceholder: "Rechercher...",
5673
5740
  onSelect,
5674
5741
  disabled: loading,
5675
- refresh: handleRefresh
5742
+ refresh: handleRefresh,
5743
+ allowClear,
5744
+ onRemove
5676
5745
  },
5677
5746
  "client" + value
5678
5747
  ),
@@ -10261,9 +10330,1528 @@ var formatCurrency = (amount, currency = "XOF", showDecimals = false) => {
10261
10330
  maximumFractionDigits: showDecimals ? 2 : 0
10262
10331
  }) + (currency ? ` ${currency}` : "");
10263
10332
  };
10333
+
10334
+ // src/components/common/ModernCard.tsx
10335
+ import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
10336
+ var ModernCard = ({
10337
+ children,
10338
+ className,
10339
+ hoverable = false,
10340
+ bordered = true,
10341
+ elevated = false,
10342
+ gradient = false,
10343
+ onClick
10344
+ }) => {
10345
+ return /* @__PURE__ */ jsx32(
10346
+ "div",
10347
+ {
10348
+ onClick,
10349
+ className: cn(
10350
+ "bg-[var(--color-surface)] rounded-xl transition-all duration-300",
10351
+ bordered && "border border-[var(--color-border)]",
10352
+ elevated && "shadow-[var(--shadow-md)]",
10353
+ hoverable && "hover:shadow-[var(--shadow-lg)] hover:-translate-y-1 cursor-pointer",
10354
+ gradient && "bg-gradient-to-br from-[var(--color-surface)] to-[var(--color-surface-hover)]",
10355
+ onClick && "cursor-pointer",
10356
+ className
10357
+ ),
10358
+ children
10359
+ }
10360
+ );
10361
+ };
10362
+ var CardHeader = ({
10363
+ title,
10364
+ subtitle,
10365
+ icon: Icon,
10366
+ action,
10367
+ className,
10368
+ children
10369
+ }) => {
10370
+ 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: [
10371
+ /* @__PURE__ */ jsxs27("div", { className: "flex items-start gap-4", children: [
10372
+ 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)]" }) }),
10373
+ /* @__PURE__ */ jsxs27("div", { children: [
10374
+ /* @__PURE__ */ jsx32("h3", { className: "text-lg font-semibold text-[var(--color-text-primary)]", children: title }),
10375
+ subtitle && /* @__PURE__ */ jsx32("p", { className: "mt-1 text-sm text-[var(--color-text-secondary)]", children: subtitle })
10376
+ ] })
10377
+ ] }),
10378
+ action && /* @__PURE__ */ jsx32("div", { children: action }),
10379
+ children
10380
+ ] }) });
10381
+ };
10382
+ var CardBody = ({
10383
+ children,
10384
+ className,
10385
+ noPadding = false
10386
+ }) => {
10387
+ return /* @__PURE__ */ jsx32("div", { className: cn(!noPadding && "p-4", className), children });
10388
+ };
10389
+ var StatCard = ({
10390
+ title,
10391
+ value,
10392
+ change,
10393
+ icon: Icon,
10394
+ color = "primary",
10395
+ className
10396
+ }) => {
10397
+ const colorClasses = {
10398
+ primary: "bg-[var(--color-primary-light)] text-[var(--color-primary)]",
10399
+ success: "bg-[var(--color-success-light)] text-[var(--color-success)]",
10400
+ warning: "bg-[var(--color-warning-light)] text-[var(--color-warning)]",
10401
+ error: "bg-[var(--color-error-light)] text-[var(--color-error)]",
10402
+ info: "bg-[var(--color-info-light)] text-[var(--color-info)]"
10403
+ };
10404
+ return /* @__PURE__ */ jsx32(ModernCard, { className: cn("p-4", className), hoverable: true, children: /* @__PURE__ */ jsxs27("div", { className: "flex items-start justify-between", children: [
10405
+ /* @__PURE__ */ jsxs27("div", { className: "flex-1", children: [
10406
+ /* @__PURE__ */ jsx32("p", { className: "text-sm font-medium text-[var(--color-text-secondary)]", children: title }),
10407
+ /* @__PURE__ */ jsx32("p", { className: "mt-2 text-3xl font-bold text-[var(--color-text-primary)]", children: value }),
10408
+ change && /* @__PURE__ */ jsxs27("div", { className: "mt-3 flex items-center gap-2", children: [
10409
+ /* @__PURE__ */ jsxs27("span", { className: cn(
10410
+ "text-sm font-medium",
10411
+ change.type === "increase" ? "text-[var(--color-success)]" : "text-[var(--color-error)]"
10412
+ ), children: [
10413
+ change.type === "increase" ? "\u2191" : "\u2193",
10414
+ " ",
10415
+ Math.abs(change.value),
10416
+ "%"
10417
+ ] }),
10418
+ /* @__PURE__ */ jsx32("span", { className: "text-xs text-[var(--color-text-tertiary)]", children: "vs p\xE9riode pr\xE9c\xE9dente" })
10419
+ ] })
10420
+ ] }),
10421
+ Icon && /* @__PURE__ */ jsx32("div", { className: cn("p-2.5 rounded-lg", colorClasses[color]), children: /* @__PURE__ */ jsx32(Icon, { className: "w-5 h-5" }) })
10422
+ ] }) });
10423
+ };
10424
+
10425
+ // src/services/WorkspaceServices.ts
10426
+ var WorkspaceServices = {
10427
+ /**
10428
+ * Récupère les données du workspace Procurement (Achats)
10429
+ */
10430
+ getProcurementWorkspace: async (businessEntityId) => {
10431
+ const params = new URLSearchParams();
10432
+ if (businessEntityId) {
10433
+ params.append("business_entity", businessEntityId);
10434
+ }
10435
+ const queryString = params.toString();
10436
+ const url = `${API_URL}/core/workspaces/procurement/${queryString ? `?${queryString}` : ""}`;
10437
+ const response = await FetchApi.get(url);
10438
+ if (!response.success) {
10439
+ throw new Error(response.message || "Erreur lors de la r\xE9cup\xE9ration des donn\xE9es du workspace");
10440
+ }
10441
+ return response.data;
10442
+ }
10443
+ };
10444
+
10445
+ // src/pages/workspaces/WorkSpace.tsx
10446
+ import { useState as useState25, useEffect as useEffect17, useMemo as useMemo2 } from "react";
10447
+ import {
10448
+ ShoppingCart as ShoppingCart2,
10449
+ Calculator as Calculator2,
10450
+ Users as Users5,
10451
+ Building2 as Building25,
10452
+ RefreshCw as RefreshCw8,
10453
+ ChevronDown as ChevronDown4,
10454
+ LayoutDashboard
10455
+ } from "lucide-react";
10456
+
10457
+ // src/pages/workspaces/PurchaseWorkspace.tsx
10458
+ import { useState as useState21, useEffect as useEffect13 } from "react";
10459
+ import {
10460
+ FileText as FileText7,
10461
+ ShoppingCart,
10462
+ Package,
10463
+ Clock as Clock2,
10464
+ Banknote,
10465
+ Users as Users2,
10466
+ Send as Send2,
10467
+ ArrowRight,
10468
+ RefreshCw as RefreshCw4,
10469
+ AlertTriangle as AlertTriangle3,
10470
+ FileCheck,
10471
+ Truck,
10472
+ ClipboardList
10473
+ } from "lucide-react";
10474
+ import { jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
10475
+ var formatCurrency2 = (amount) => {
10476
+ return new Intl.NumberFormat("fr-FR", {
10477
+ style: "decimal",
10478
+ minimumFractionDigits: 0,
10479
+ maximumFractionDigits: 0
10480
+ }).format(amount) + " FCFA";
10481
+ };
10482
+ var formatCurrencyShort = (amount) => {
10483
+ if (amount >= 1e6) {
10484
+ return `${(amount / 1e6).toFixed(1)}M FCFA`;
10485
+ } else if (amount >= 1e3) {
10486
+ return `${(amount / 1e3).toFixed(0)}k FCFA`;
10487
+ }
10488
+ return formatCurrency2(amount);
10489
+ };
10490
+ var formatRelativeTime = (timestamp) => {
10491
+ if (!timestamp) return "";
10492
+ const date = new Date(timestamp);
10493
+ const now = /* @__PURE__ */ new Date();
10494
+ const diffMs = now.getTime() - date.getTime();
10495
+ const diffMins = Math.floor(diffMs / 6e4);
10496
+ const diffHours = Math.floor(diffMs / 36e5);
10497
+ const diffDays = Math.floor(diffMs / 864e5);
10498
+ if (diffMins < 1) return "A l'instant";
10499
+ if (diffMins < 60) return `Il y a ${diffMins} min`;
10500
+ if (diffHours < 24) return `Il y a ${diffHours}h`;
10501
+ if (diffDays === 1) return "Hier";
10502
+ if (diffDays < 7) return `Il y a ${diffDays} jours`;
10503
+ return date.toLocaleDateString("fr-FR");
10504
+ };
10505
+ var PurchaseWorkspace = () => {
10506
+ const [stats, setStats] = useState21(null);
10507
+ const [recentActivities, setRecentActivities] = useState21([]);
10508
+ const [pendingTasks, setPendingTasks] = useState21([]);
10509
+ const [loading, setLoading] = useState21(true);
10510
+ const [error, setError] = useState21(null);
10511
+ useEffect13(() => {
10512
+ loadWorkspaceData();
10513
+ }, []);
10514
+ const loadWorkspaceData = async () => {
10515
+ setLoading(true);
10516
+ setError(null);
10517
+ try {
10518
+ const businessEntityId = localStorage.getItem("active_center_id") || void 0;
10519
+ const data = await WorkspaceServices.getProcurementWorkspace(businessEntityId);
10520
+ setStats(data);
10521
+ setRecentActivities(data.recent_activities || []);
10522
+ setPendingTasks(data.pending_tasks || []);
10523
+ } catch (err) {
10524
+ console.error("Erreur lors du chargement du workspace:", err);
10525
+ setError("Impossible de charger les donnees du workspace. Veuillez reessayer.");
10526
+ setStats({
10527
+ purchase_requests: {
10528
+ total: 0,
10529
+ draft: 0,
10530
+ pending_approval: 0,
10531
+ approved: 0,
10532
+ in_sourcing: 0,
10533
+ completed: 0,
10534
+ rejected: 0,
10535
+ trend: 0
10536
+ },
10537
+ rfqs: {
10538
+ total: 0,
10539
+ draft: 0,
10540
+ open: 0,
10541
+ pending_evaluation: 0,
10542
+ closed: 0
10543
+ },
10544
+ purchase_orders: {
10545
+ total: 0,
10546
+ pending_delivery: 0,
10547
+ delivered: 0,
10548
+ total_value: 0,
10549
+ trend: 0
10550
+ },
10551
+ receipts: {
10552
+ total: 0,
10553
+ pending_validation: 0,
10554
+ validated: 0
10555
+ },
10556
+ vendors: {
10557
+ total: 0,
10558
+ active: 0
10559
+ },
10560
+ alerts: {
10561
+ overdue_deliveries: 0,
10562
+ expiring_contracts: 0,
10563
+ pending_approvals: 0
10564
+ },
10565
+ recent_activities: [],
10566
+ pending_tasks: []
10567
+ });
10568
+ } finally {
10569
+ setLoading(false);
10570
+ }
10571
+ };
10572
+ const getPriorityColor = (priority) => {
10573
+ const colors = {
10574
+ low: "bg-[var(--color-border-light)] text-[var(--color-text-secondary)]",
10575
+ medium: "bg-[var(--color-info-light)] text-[var(--color-info)]",
10576
+ high: "bg-[var(--color-warning-light)] text-[var(--color-warning)]",
10577
+ critical: "bg-[var(--color-error-light)] text-[var(--color-error)]"
10578
+ };
10579
+ return colors[priority] || colors.medium;
10580
+ };
10581
+ const getActivityIcon = (type) => {
10582
+ const icons = {
10583
+ pr_created: /* @__PURE__ */ jsx33(FileText7, { className: "w-4 h-4" }),
10584
+ rfq_sent: /* @__PURE__ */ jsx33(Send2, { className: "w-4 h-4" }),
10585
+ quote_received: /* @__PURE__ */ jsx33(FileCheck, { className: "w-4 h-4" }),
10586
+ po_issued: /* @__PURE__ */ jsx33(ShoppingCart, { className: "w-4 h-4" }),
10587
+ receipt_created: /* @__PURE__ */ jsx33(Package, { className: "w-4 h-4" }),
10588
+ approval_pending: /* @__PURE__ */ jsx33(Clock2, { className: "w-4 h-4" })
10589
+ };
10590
+ return icons[type] || /* @__PURE__ */ jsx33(FileText7, { className: "w-4 h-4" });
10591
+ };
10592
+ const getActivityStatusColor = (status) => {
10593
+ const colors = {
10594
+ info: "bg-[var(--color-info-light)] text-[var(--color-info)]",
10595
+ success: "bg-[var(--color-success-light)] text-[var(--color-success)]",
10596
+ warning: "bg-[var(--color-warning-light)] text-[var(--color-warning)]",
10597
+ error: "bg-[var(--color-error-light)] text-[var(--color-error)]"
10598
+ };
10599
+ return colors[status] || colors.info;
10600
+ };
10601
+ if (loading) {
10602
+ return /* @__PURE__ */ jsx33("div", { className: "flex items-center justify-center h-96", children: /* @__PURE__ */ jsxs28("div", { className: "text-center", children: [
10603
+ /* @__PURE__ */ jsx33(RefreshCw4, { className: "w-12 h-12 text-[var(--color-primary)] animate-spin mx-auto mb-4" }),
10604
+ /* @__PURE__ */ jsx33("p", { className: "text-[var(--color-text-secondary)]", children: "Chargement du workspace Achats..." })
10605
+ ] }) });
10606
+ }
10607
+ if (!stats) return null;
10608
+ 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: [
10609
+ /* @__PURE__ */ jsx33(AlertTriangle3, { className: "w-5 h-5 text-[var(--color-error)]" }),
10610
+ /* @__PURE__ */ jsx33("div", { className: "flex-1", children: /* @__PURE__ */ jsx33("p", { className: "text-sm text-[var(--color-error)]", children: error }) }),
10611
+ /* @__PURE__ */ jsx33(
10612
+ "button",
10613
+ {
10614
+ onClick: loadWorkspaceData,
10615
+ className: "text-sm text-[var(--color-error)] hover:underline font-medium",
10616
+ children: "Reessayer"
10617
+ }
10618
+ )
10619
+ ] }) }) : null;
10620
+ return /* @__PURE__ */ jsxs28("div", { className: "space-y-6", children: [
10621
+ ErrorBanner,
10622
+ (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: [
10623
+ /* @__PURE__ */ jsx33(AlertTriangle3, { className: "w-5 h-5 text-[var(--color-warning)] mt-0.5" }),
10624
+ /* @__PURE__ */ jsxs28("div", { className: "flex-1", children: [
10625
+ /* @__PURE__ */ jsx33("h3", { className: "font-semibold text-[var(--color-text-primary)]", children: "Alertes necessitant votre attention" }),
10626
+ /* @__PURE__ */ jsxs28("div", { className: "mt-2 flex flex-wrap gap-4", children: [
10627
+ stats.alerts.overdue_deliveries > 0 && /* @__PURE__ */ jsxs28("span", { className: "text-sm text-[var(--color-warning)]", children: [
10628
+ /* @__PURE__ */ jsx33("strong", { children: stats.alerts.overdue_deliveries }),
10629
+ " livraisons en retard"
10630
+ ] }),
10631
+ stats.alerts.expiring_contracts > 0 && /* @__PURE__ */ jsxs28("span", { className: "text-sm text-[var(--color-warning)]", children: [
10632
+ /* @__PURE__ */ jsx33("strong", { children: stats.alerts.expiring_contracts }),
10633
+ " contrats expirant bientot"
10634
+ ] }),
10635
+ stats.alerts.pending_approvals > 0 && /* @__PURE__ */ jsxs28("span", { className: "text-sm text-[var(--color-warning)]", children: [
10636
+ /* @__PURE__ */ jsx33("strong", { children: stats.alerts.pending_approvals }),
10637
+ " approbations en attente"
10638
+ ] })
10639
+ ] })
10640
+ ] })
10641
+ ] }) }),
10642
+ /* @__PURE__ */ jsxs28("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6", children: [
10643
+ /* @__PURE__ */ jsx33(
10644
+ StatCard,
10645
+ {
10646
+ title: "Demandes d'achat",
10647
+ value: stats.purchase_requests.total,
10648
+ icon: FileText7,
10649
+ color: "primary",
10650
+ change: stats.purchase_requests.trend !== 0 ? {
10651
+ value: stats.purchase_requests.trend,
10652
+ type: stats.purchase_requests.trend > 0 ? "increase" : "decrease"
10653
+ } : void 0
10654
+ }
10655
+ ),
10656
+ /* @__PURE__ */ jsx33(
10657
+ StatCard,
10658
+ {
10659
+ title: "Appels d'offres actifs",
10660
+ value: stats.rfqs.open,
10661
+ icon: ClipboardList,
10662
+ color: "info"
10663
+ }
10664
+ ),
10665
+ /* @__PURE__ */ jsx33(
10666
+ StatCard,
10667
+ {
10668
+ title: "Commandes en cours",
10669
+ value: stats.purchase_orders.pending_delivery,
10670
+ icon: Truck,
10671
+ color: "warning"
10672
+ }
10673
+ ),
10674
+ /* @__PURE__ */ jsx33(
10675
+ StatCard,
10676
+ {
10677
+ title: "Budget engage",
10678
+ value: formatCurrencyShort(stats.purchase_orders.total_value),
10679
+ icon: Banknote,
10680
+ color: "success",
10681
+ change: stats.purchase_orders.trend !== 0 ? {
10682
+ value: stats.purchase_orders.trend,
10683
+ type: stats.purchase_orders.trend > 0 ? "increase" : "decrease"
10684
+ } : void 0
10685
+ }
10686
+ )
10687
+ ] }),
10688
+ /* @__PURE__ */ jsxs28("div", { className: "grid grid-cols-1 lg:grid-cols-3 gap-6", children: [
10689
+ /* @__PURE__ */ jsxs28("div", { className: "lg:col-span-2 space-y-6", children: [
10690
+ /* @__PURE__ */ jsxs28(ModernCard, { children: [
10691
+ /* @__PURE__ */ jsx33(
10692
+ CardHeader,
10693
+ {
10694
+ title: "Taches en attente",
10695
+ icon: Clock2,
10696
+ action: /* @__PURE__ */ jsxs28("button", { className: "text-sm text-[var(--color-primary)] hover:underline flex items-center", children: [
10697
+ "Voir tout ",
10698
+ /* @__PURE__ */ jsx33(ArrowRight, { className: "w-4 h-4 ml-1" })
10699
+ ] })
10700
+ }
10701
+ ),
10702
+ /* @__PURE__ */ jsx33(CardBody, { noPadding: true, children: /* @__PURE__ */ jsx33("div", { className: "divide-y divide-[var(--color-border-light)]", children: pendingTasks.map((task) => /* @__PURE__ */ jsxs28(
10703
+ "div",
10704
+ {
10705
+ className: "p-4 hover:bg-[var(--color-surface-hover)] transition-colors cursor-pointer flex items-center justify-between",
10706
+ children: [
10707
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-3", children: [
10708
+ /* @__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" }),
10709
+ /* @__PURE__ */ jsxs28("div", { children: [
10710
+ /* @__PURE__ */ jsx33("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: task.title }),
10711
+ /* @__PURE__ */ jsxs28("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: [
10712
+ "Echeance: ",
10713
+ task.dueDate
10714
+ ] })
10715
+ ] })
10716
+ ] }),
10717
+ /* @__PURE__ */ jsx33(ArrowRight, { className: "w-4 h-4 text-[var(--color-text-tertiary)]" })
10718
+ ]
10719
+ },
10720
+ task.id
10721
+ )) }) })
10722
+ ] }),
10723
+ /* @__PURE__ */ jsxs28("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
10724
+ /* @__PURE__ */ jsxs28(ModernCard, { children: [
10725
+ /* @__PURE__ */ jsx33(CardHeader, { title: "Demandes d'achat", icon: FileText7 }),
10726
+ /* @__PURE__ */ jsx33(CardBody, { children: /* @__PURE__ */ jsxs28("div", { className: "space-y-3", children: [
10727
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between p-3 bg-[var(--color-surface-hover)] rounded-lg", children: [
10728
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-2", children: [
10729
+ /* @__PURE__ */ jsx33("div", { className: "w-2 h-2 bg-[var(--color-text-tertiary)] rounded-full" }),
10730
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Brouillons" })
10731
+ ] }),
10732
+ /* @__PURE__ */ jsx33("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.purchase_requests.draft })
10733
+ ] }),
10734
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between p-3 bg-[var(--color-warning-light)] rounded-lg", children: [
10735
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-2", children: [
10736
+ /* @__PURE__ */ jsx33("div", { className: "w-2 h-2 bg-[var(--color-warning)] rounded-full" }),
10737
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-primary)]", children: "En attente d'approbation" })
10738
+ ] }),
10739
+ /* @__PURE__ */ jsx33("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.purchase_requests.pending_approval })
10740
+ ] }),
10741
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between p-3 bg-[var(--color-success-light)] rounded-lg", children: [
10742
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-2", children: [
10743
+ /* @__PURE__ */ jsx33("div", { className: "w-2 h-2 bg-[var(--color-success)] rounded-full" }),
10744
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Approuvees" })
10745
+ ] }),
10746
+ /* @__PURE__ */ jsx33("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.purchase_requests.approved })
10747
+ ] }),
10748
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between p-3 bg-[var(--color-info-light)] rounded-lg", children: [
10749
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-2", children: [
10750
+ /* @__PURE__ */ jsx33("div", { className: "w-2 h-2 bg-[var(--color-info)] rounded-full" }),
10751
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-primary)]", children: "En sourcing" })
10752
+ ] }),
10753
+ /* @__PURE__ */ jsx33("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.purchase_requests.in_sourcing })
10754
+ ] })
10755
+ ] }) })
10756
+ ] }),
10757
+ /* @__PURE__ */ jsxs28(ModernCard, { children: [
10758
+ /* @__PURE__ */ jsx33(CardHeader, { title: "Appels d'offres (RFQ)", icon: ClipboardList }),
10759
+ /* @__PURE__ */ jsx33(CardBody, { children: /* @__PURE__ */ jsxs28("div", { className: "space-y-3", children: [
10760
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between p-3 bg-[var(--color-info-light)] rounded-lg", children: [
10761
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-2", children: [
10762
+ /* @__PURE__ */ jsx33("div", { className: "w-2 h-2 bg-[var(--color-info)] rounded-full" }),
10763
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Ouverts" })
10764
+ ] }),
10765
+ /* @__PURE__ */ jsx33("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.rfqs.open })
10766
+ ] }),
10767
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between p-3 bg-[var(--color-secondary)] bg-opacity-10 rounded-lg", children: [
10768
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-2", children: [
10769
+ /* @__PURE__ */ jsx33("div", { className: "w-2 h-2 bg-[var(--color-secondary)] rounded-full" }),
10770
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-primary)]", children: "En evaluation" })
10771
+ ] }),
10772
+ /* @__PURE__ */ jsx33("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.rfqs.pending_evaluation })
10773
+ ] }),
10774
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between p-3 bg-[var(--color-success-light)] rounded-lg", children: [
10775
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center space-x-2", children: [
10776
+ /* @__PURE__ */ jsx33("div", { className: "w-2 h-2 bg-[var(--color-success)] rounded-full" }),
10777
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Clotures" })
10778
+ ] }),
10779
+ /* @__PURE__ */ jsx33("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.rfqs.closed })
10780
+ ] })
10781
+ ] }) })
10782
+ ] })
10783
+ ] })
10784
+ ] }),
10785
+ /* @__PURE__ */ jsxs28("div", { className: "space-y-6", children: [
10786
+ /* @__PURE__ */ jsxs28(ModernCard, { children: [
10787
+ /* @__PURE__ */ jsx33(
10788
+ CardHeader,
10789
+ {
10790
+ title: "Activites recentes",
10791
+ icon: Clock2,
10792
+ action: /* @__PURE__ */ jsx33("button", { className: "text-sm text-[var(--color-primary)] hover:underline", children: "Historique" })
10793
+ }
10794
+ ),
10795
+ /* @__PURE__ */ jsx33(CardBody, { noPadding: true, children: /* @__PURE__ */ jsx33("div", { className: "divide-y divide-[var(--color-border-light)]", children: recentActivities.map((activity) => /* @__PURE__ */ jsx33(
10796
+ "div",
10797
+ {
10798
+ className: "p-4 hover:bg-[var(--color-surface-hover)] transition-colors",
10799
+ children: /* @__PURE__ */ jsxs28("div", { className: "flex items-start space-x-3", children: [
10800
+ /* @__PURE__ */ jsx33("div", { className: `p-2 rounded-lg ${getActivityStatusColor(activity.status)}`, children: getActivityIcon(activity.type) }),
10801
+ /* @__PURE__ */ jsxs28("div", { className: "flex-1 min-w-0", children: [
10802
+ /* @__PURE__ */ jsx33("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: activity.title }),
10803
+ /* @__PURE__ */ jsx33("p", { className: "text-xs text-[var(--color-text-secondary)] truncate", children: activity.description }),
10804
+ /* @__PURE__ */ jsx33("p", { className: "text-xs text-[var(--color-text-tertiary)] mt-1", children: formatRelativeTime(activity.timestamp) })
10805
+ ] })
10806
+ ] })
10807
+ },
10808
+ activity.id
10809
+ )) }) })
10810
+ ] }),
10811
+ /* @__PURE__ */ jsxs28(ModernCard, { children: [
10812
+ /* @__PURE__ */ jsx33(CardHeader, { title: "Fournisseurs", icon: Users2 }),
10813
+ /* @__PURE__ */ jsx33(CardBody, { children: /* @__PURE__ */ jsxs28("div", { className: "text-center py-4", children: [
10814
+ /* @__PURE__ */ jsx33("p", { className: "text-4xl font-bold text-[var(--color-text-primary)]", children: stats.vendors.total }),
10815
+ /* @__PURE__ */ jsx33("p", { className: "text-sm text-[var(--color-text-secondary)] mt-1", children: "fournisseurs references" }),
10816
+ /* @__PURE__ */ jsxs28("div", { className: "mt-4 flex justify-center space-x-6", children: [
10817
+ /* @__PURE__ */ jsxs28("div", { children: [
10818
+ /* @__PURE__ */ jsx33("p", { className: "text-lg font-semibold text-[var(--color-success)]", children: stats.vendors.active }),
10819
+ /* @__PURE__ */ jsx33("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "Actifs" })
10820
+ ] }),
10821
+ /* @__PURE__ */ jsxs28("div", { children: [
10822
+ /* @__PURE__ */ jsx33("p", { className: "text-lg font-semibold text-[var(--color-text-tertiary)]", children: stats.vendors.total - stats.vendors.active }),
10823
+ /* @__PURE__ */ jsx33("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "Inactifs" })
10824
+ ] })
10825
+ ] })
10826
+ ] }) })
10827
+ ] }),
10828
+ /* @__PURE__ */ jsxs28(ModernCard, { children: [
10829
+ /* @__PURE__ */ jsx33(CardHeader, { title: "Receptions", icon: Package }),
10830
+ /* @__PURE__ */ jsx33(CardBody, { children: /* @__PURE__ */ jsxs28("div", { className: "space-y-3", children: [
10831
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
10832
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "En attente de validation" }),
10833
+ /* @__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 })
10834
+ ] }),
10835
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center justify-between", children: [
10836
+ /* @__PURE__ */ jsx33("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Validees ce mois" }),
10837
+ /* @__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 })
10838
+ ] })
10839
+ ] }) })
10840
+ ] })
10841
+ ] })
10842
+ ] })
10843
+ ] });
10844
+ };
10845
+ var PurchaseWorkspace_default = PurchaseWorkspace;
10846
+
10847
+ // src/pages/workspaces/AccountingWorkspace.tsx
10848
+ import { useState as useState22, useEffect as useEffect14 } from "react";
10849
+ import {
10850
+ TrendingUp,
10851
+ TrendingDown,
10852
+ Banknote as Banknote2,
10853
+ ArrowRight as ArrowRight2,
10854
+ RefreshCw as RefreshCw5,
10855
+ AlertTriangle as AlertTriangle4,
10856
+ BookOpen,
10857
+ Receipt,
10858
+ PiggyBank,
10859
+ CreditCard as CreditCard3
10860
+ } from "lucide-react";
10861
+ import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
10862
+ var formatCurrency3 = (amount) => {
10863
+ return new Intl.NumberFormat("fr-FR", {
10864
+ style: "decimal",
10865
+ minimumFractionDigits: 0,
10866
+ maximumFractionDigits: 0
10867
+ }).format(amount) + " FCFA";
10868
+ };
10869
+ var formatCurrencyShort2 = (amount) => {
10870
+ if (amount >= 1e6) {
10871
+ return `${(amount / 1e6).toFixed(1)}M FCFA`;
10872
+ } else if (amount >= 1e3) {
10873
+ return `${(amount / 1e3).toFixed(0)}k FCFA`;
10874
+ }
10875
+ return formatCurrency3(amount);
10876
+ };
10877
+ var AccountingWorkspace = () => {
10878
+ const [stats, setStats] = useState22(null);
10879
+ const [loading, setLoading] = useState22(true);
10880
+ const [error, setError] = useState22(null);
10881
+ useEffect14(() => {
10882
+ loadWorkspaceData();
10883
+ }, []);
10884
+ const loadWorkspaceData = async () => {
10885
+ setLoading(true);
10886
+ setError(null);
10887
+ try {
10888
+ await new Promise((resolve) => setTimeout(resolve, 500));
10889
+ setStats({
10890
+ journal_entries: {
10891
+ total: 0,
10892
+ draft: 0,
10893
+ pending_validation: 0,
10894
+ validated: 0,
10895
+ trend: 0
10896
+ },
10897
+ invoices: {
10898
+ receivable: 0,
10899
+ payable: 0,
10900
+ overdue_receivable: 0,
10901
+ overdue_payable: 0
10902
+ },
10903
+ cash_flow: {
10904
+ inflow: 0,
10905
+ outflow: 0,
10906
+ balance: 0
10907
+ },
10908
+ bank_reconciliation: {
10909
+ pending: 0,
10910
+ reconciled: 0
10911
+ },
10912
+ alerts: {
10913
+ unbalanced_entries: 0,
10914
+ overdue_invoices: 0,
10915
+ pending_approvals: 0
10916
+ }
10917
+ });
10918
+ } catch (err) {
10919
+ console.error("Erreur lors du chargement du workspace:", err);
10920
+ setError("Impossible de charger les donnees du workspace comptabilite.");
10921
+ } finally {
10922
+ setLoading(false);
10923
+ }
10924
+ };
10925
+ if (loading) {
10926
+ return /* @__PURE__ */ jsx34("div", { className: "flex items-center justify-center h-96", children: /* @__PURE__ */ jsxs29("div", { className: "text-center", children: [
10927
+ /* @__PURE__ */ jsx34(RefreshCw5, { className: "w-12 h-12 text-[var(--color-primary)] animate-spin mx-auto mb-4" }),
10928
+ /* @__PURE__ */ jsx34("p", { className: "text-[var(--color-text-secondary)]", children: "Chargement du workspace Comptabilite..." })
10929
+ ] }) });
10930
+ }
10931
+ if (!stats) return null;
10932
+ 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: [
10933
+ /* @__PURE__ */ jsx34(AlertTriangle4, { className: "w-5 h-5 text-[var(--color-error)]" }),
10934
+ /* @__PURE__ */ jsx34("div", { className: "flex-1", children: /* @__PURE__ */ jsx34("p", { className: "text-sm text-[var(--color-error)]", children: error }) }),
10935
+ /* @__PURE__ */ jsx34(
10936
+ "button",
10937
+ {
10938
+ onClick: loadWorkspaceData,
10939
+ className: "text-sm text-[var(--color-error)] hover:underline font-medium",
10940
+ children: "Reessayer"
10941
+ }
10942
+ )
10943
+ ] }) }) : null;
10944
+ return /* @__PURE__ */ jsxs29("div", { className: "space-y-6", children: [
10945
+ ErrorBanner,
10946
+ (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: [
10947
+ /* @__PURE__ */ jsx34(AlertTriangle4, { className: "w-5 h-5 text-[var(--color-warning)] mt-0.5" }),
10948
+ /* @__PURE__ */ jsxs29("div", { className: "flex-1", children: [
10949
+ /* @__PURE__ */ jsx34("h3", { className: "font-semibold text-[var(--color-text-primary)]", children: "Alertes comptables" }),
10950
+ /* @__PURE__ */ jsxs29("div", { className: "mt-2 flex flex-wrap gap-4", children: [
10951
+ stats.alerts.unbalanced_entries > 0 && /* @__PURE__ */ jsxs29("span", { className: "text-sm text-[var(--color-warning)]", children: [
10952
+ /* @__PURE__ */ jsx34("strong", { children: stats.alerts.unbalanced_entries }),
10953
+ " ecritures non equilibrees"
10954
+ ] }),
10955
+ stats.alerts.overdue_invoices > 0 && /* @__PURE__ */ jsxs29("span", { className: "text-sm text-[var(--color-warning)]", children: [
10956
+ /* @__PURE__ */ jsx34("strong", { children: stats.alerts.overdue_invoices }),
10957
+ " factures en retard"
10958
+ ] }),
10959
+ stats.alerts.pending_approvals > 0 && /* @__PURE__ */ jsxs29("span", { className: "text-sm text-[var(--color-warning)]", children: [
10960
+ /* @__PURE__ */ jsx34("strong", { children: stats.alerts.pending_approvals }),
10961
+ " validations en attente"
10962
+ ] })
10963
+ ] })
10964
+ ] })
10965
+ ] }) }),
10966
+ /* @__PURE__ */ jsxs29("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6", children: [
10967
+ /* @__PURE__ */ jsx34(
10968
+ StatCard,
10969
+ {
10970
+ title: "Ecritures comptables",
10971
+ value: stats.journal_entries.total,
10972
+ icon: BookOpen,
10973
+ color: "primary",
10974
+ change: stats.journal_entries.trend !== 0 ? {
10975
+ value: stats.journal_entries.trend,
10976
+ type: stats.journal_entries.trend > 0 ? "increase" : "decrease"
10977
+ } : void 0
10978
+ }
10979
+ ),
10980
+ /* @__PURE__ */ jsx34(
10981
+ StatCard,
10982
+ {
10983
+ title: "Creances clients",
10984
+ value: formatCurrencyShort2(stats.invoices.receivable),
10985
+ icon: TrendingUp,
10986
+ color: "success"
10987
+ }
10988
+ ),
10989
+ /* @__PURE__ */ jsx34(
10990
+ StatCard,
10991
+ {
10992
+ title: "Dettes fournisseurs",
10993
+ value: formatCurrencyShort2(stats.invoices.payable),
10994
+ icon: TrendingDown,
10995
+ color: "warning"
10996
+ }
10997
+ ),
10998
+ /* @__PURE__ */ jsx34(
10999
+ StatCard,
11000
+ {
11001
+ title: "Solde tresorerie",
11002
+ value: formatCurrencyShort2(stats.cash_flow.balance),
11003
+ icon: PiggyBank,
11004
+ color: "info"
11005
+ }
11006
+ )
11007
+ ] }),
11008
+ /* @__PURE__ */ jsxs29("div", { className: "grid grid-cols-1 lg:grid-cols-3 gap-6", children: [
11009
+ /* @__PURE__ */ jsxs29("div", { className: "lg:col-span-2 space-y-6", children: [
11010
+ /* @__PURE__ */ jsxs29(ModernCard, { children: [
11011
+ /* @__PURE__ */ jsx34(
11012
+ CardHeader,
11013
+ {
11014
+ title: "Ecritures comptables",
11015
+ icon: BookOpen,
11016
+ action: /* @__PURE__ */ jsxs29("button", { className: "text-sm text-[var(--color-primary)] hover:underline flex items-center", children: [
11017
+ "Voir tout ",
11018
+ /* @__PURE__ */ jsx34(ArrowRight2, { className: "w-4 h-4 ml-1" })
11019
+ ] })
11020
+ }
11021
+ ),
11022
+ /* @__PURE__ */ jsx34(CardBody, { children: /* @__PURE__ */ jsxs29("div", { className: "grid grid-cols-3 gap-4", children: [
11023
+ /* @__PURE__ */ jsxs29("div", { className: "p-4 bg-[var(--color-surface-hover)] rounded-lg text-center", children: [
11024
+ /* @__PURE__ */ jsx34("p", { className: "text-2xl font-bold text-[var(--color-text-tertiary)]", children: stats.journal_entries.draft }),
11025
+ /* @__PURE__ */ jsx34("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Brouillons" })
11026
+ ] }),
11027
+ /* @__PURE__ */ jsxs29("div", { className: "p-4 bg-[var(--color-warning-light)] rounded-lg text-center", children: [
11028
+ /* @__PURE__ */ jsx34("p", { className: "text-2xl font-bold text-[var(--color-warning)]", children: stats.journal_entries.pending_validation }),
11029
+ /* @__PURE__ */ jsx34("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "A valider" })
11030
+ ] }),
11031
+ /* @__PURE__ */ jsxs29("div", { className: "p-4 bg-[var(--color-success-light)] rounded-lg text-center", children: [
11032
+ /* @__PURE__ */ jsx34("p", { className: "text-2xl font-bold text-[var(--color-success)]", children: stats.journal_entries.validated }),
11033
+ /* @__PURE__ */ jsx34("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Validees" })
11034
+ ] })
11035
+ ] }) })
11036
+ ] }),
11037
+ /* @__PURE__ */ jsxs29(ModernCard, { children: [
11038
+ /* @__PURE__ */ jsx34(CardHeader, { title: "Flux de tresorerie (ce mois)", icon: Banknote2 }),
11039
+ /* @__PURE__ */ jsx34(CardBody, { children: /* @__PURE__ */ jsxs29("div", { className: "grid grid-cols-3 gap-4", children: [
11040
+ /* @__PURE__ */ jsxs29("div", { className: "p-4 bg-[var(--color-success-light)] rounded-lg", children: [
11041
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center space-x-2 mb-2", children: [
11042
+ /* @__PURE__ */ jsx34(TrendingUp, { className: "w-5 h-5 text-[var(--color-success)]" }),
11043
+ /* @__PURE__ */ jsx34("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Entrees" })
11044
+ ] }),
11045
+ /* @__PURE__ */ jsx34("p", { className: "text-xl font-bold text-[var(--color-success)]", children: formatCurrencyShort2(stats.cash_flow.inflow) })
11046
+ ] }),
11047
+ /* @__PURE__ */ jsxs29("div", { className: "p-4 bg-[var(--color-error-light)] rounded-lg", children: [
11048
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center space-x-2 mb-2", children: [
11049
+ /* @__PURE__ */ jsx34(TrendingDown, { className: "w-5 h-5 text-[var(--color-error)]" }),
11050
+ /* @__PURE__ */ jsx34("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Sorties" })
11051
+ ] }),
11052
+ /* @__PURE__ */ jsx34("p", { className: "text-xl font-bold text-[var(--color-error)]", children: formatCurrencyShort2(stats.cash_flow.outflow) })
11053
+ ] }),
11054
+ /* @__PURE__ */ jsxs29("div", { className: "p-4 bg-[var(--color-info-light)] rounded-lg", children: [
11055
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center space-x-2 mb-2", children: [
11056
+ /* @__PURE__ */ jsx34(PiggyBank, { className: "w-5 h-5 text-[var(--color-info)]" }),
11057
+ /* @__PURE__ */ jsx34("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Solde" })
11058
+ ] }),
11059
+ /* @__PURE__ */ jsx34("p", { className: "text-xl font-bold text-[var(--color-info)]", children: formatCurrencyShort2(stats.cash_flow.balance) })
11060
+ ] })
11061
+ ] }) })
11062
+ ] })
11063
+ ] }),
11064
+ /* @__PURE__ */ jsxs29("div", { className: "space-y-6", children: [
11065
+ /* @__PURE__ */ jsxs29(ModernCard, { children: [
11066
+ /* @__PURE__ */ jsx34(CardHeader, { title: "Factures en cours", icon: Receipt }),
11067
+ /* @__PURE__ */ jsx34(CardBody, { children: /* @__PURE__ */ jsxs29("div", { className: "space-y-4", children: [
11068
+ /* @__PURE__ */ jsxs29("div", { children: [
11069
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between mb-2", children: [
11070
+ /* @__PURE__ */ jsx34("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Creances clients" }),
11071
+ /* @__PURE__ */ jsx34("span", { className: "font-semibold text-[var(--color-success)]", children: formatCurrencyShort2(stats.invoices.receivable) })
11072
+ ] }),
11073
+ stats.invoices.overdue_receivable > 0 && /* @__PURE__ */ jsxs29("div", { className: "text-xs text-[var(--color-error)] flex items-center space-x-1", children: [
11074
+ /* @__PURE__ */ jsx34(AlertTriangle4, { className: "w-3 h-3" }),
11075
+ /* @__PURE__ */ jsxs29("span", { children: [
11076
+ "Dont ",
11077
+ formatCurrencyShort2(stats.invoices.overdue_receivable),
11078
+ " en retard"
11079
+ ] })
11080
+ ] })
11081
+ ] }),
11082
+ /* @__PURE__ */ jsxs29("div", { className: "border-t border-[var(--color-border-light)] pt-4", children: [
11083
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between mb-2", children: [
11084
+ /* @__PURE__ */ jsx34("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Dettes fournisseurs" }),
11085
+ /* @__PURE__ */ jsx34("span", { className: "font-semibold text-[var(--color-warning)]", children: formatCurrencyShort2(stats.invoices.payable) })
11086
+ ] }),
11087
+ stats.invoices.overdue_payable > 0 && /* @__PURE__ */ jsxs29("div", { className: "text-xs text-[var(--color-error)] flex items-center space-x-1", children: [
11088
+ /* @__PURE__ */ jsx34(AlertTriangle4, { className: "w-3 h-3" }),
11089
+ /* @__PURE__ */ jsxs29("span", { children: [
11090
+ "Dont ",
11091
+ formatCurrencyShort2(stats.invoices.overdue_payable),
11092
+ " en retard"
11093
+ ] })
11094
+ ] })
11095
+ ] })
11096
+ ] }) })
11097
+ ] }),
11098
+ /* @__PURE__ */ jsxs29(ModernCard, { children: [
11099
+ /* @__PURE__ */ jsx34(CardHeader, { title: "Rapprochement bancaire", icon: CreditCard3 }),
11100
+ /* @__PURE__ */ jsx34(CardBody, { children: /* @__PURE__ */ jsxs29("div", { className: "space-y-3", children: [
11101
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between", children: [
11102
+ /* @__PURE__ */ jsx34("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Operations a pointer" }),
11103
+ /* @__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 })
11104
+ ] }),
11105
+ /* @__PURE__ */ jsxs29("div", { className: "flex items-center justify-between", children: [
11106
+ /* @__PURE__ */ jsx34("span", { className: "text-sm text-[var(--color-text-secondary)]", children: "Operations pointees" }),
11107
+ /* @__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 })
11108
+ ] })
11109
+ ] }) })
11110
+ ] })
11111
+ ] })
11112
+ ] })
11113
+ ] });
11114
+ };
11115
+ var AccountingWorkspace_default = AccountingWorkspace;
11116
+
11117
+ // src/pages/workspaces/CrmWorkspace.tsx
11118
+ import { useState as useState23, useEffect as useEffect15 } from "react";
11119
+ import {
11120
+ Users as Users3,
11121
+ UserPlus,
11122
+ Target as Target2,
11123
+ TrendingUp as TrendingUp2,
11124
+ Banknote as Banknote3,
11125
+ ArrowRight as ArrowRight3,
11126
+ RefreshCw as RefreshCw6,
11127
+ AlertTriangle as AlertTriangle5,
11128
+ Phone as Phone2,
11129
+ Mail as Mail2,
11130
+ Calendar as Calendar2,
11131
+ Activity
11132
+ } from "lucide-react";
11133
+ import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
11134
+ var formatCurrencyShort3 = (amount) => {
11135
+ if (amount >= 1e6) {
11136
+ return `${(amount / 1e6).toFixed(1)}M FCFA`;
11137
+ } else if (amount >= 1e3) {
11138
+ return `${(amount / 1e3).toFixed(0)}k FCFA`;
11139
+ }
11140
+ return `${amount.toLocaleString("fr-FR")} FCFA`;
11141
+ };
11142
+ var CrmWorkspace = () => {
11143
+ const [stats, setStats] = useState23(null);
11144
+ const [recentContacts, setRecentContacts] = useState23([]);
11145
+ const [loading, setLoading] = useState23(true);
11146
+ const [error, setError] = useState23(null);
11147
+ useEffect15(() => {
11148
+ loadWorkspaceData();
11149
+ }, []);
11150
+ const loadWorkspaceData = async () => {
11151
+ setLoading(true);
11152
+ setError(null);
11153
+ try {
11154
+ await new Promise((resolve) => setTimeout(resolve, 500));
11155
+ setStats({
11156
+ clients: {
11157
+ total: 0,
11158
+ active: 0,
11159
+ new_this_month: 0,
11160
+ trend: 0
11161
+ },
11162
+ opportunities: {
11163
+ total: 0,
11164
+ qualified: 0,
11165
+ negotiation: 0,
11166
+ won: 0,
11167
+ lost: 0,
11168
+ total_value: 0
11169
+ },
11170
+ activities: {
11171
+ pending_calls: 0,
11172
+ pending_meetings: 0,
11173
+ pending_emails: 0,
11174
+ overdue: 0
11175
+ },
11176
+ revenue: {
11177
+ monthly: 0,
11178
+ quarterly: 0,
11179
+ trend: 0
11180
+ },
11181
+ alerts: {
11182
+ overdue_activities: 0,
11183
+ expiring_opportunities: 0,
11184
+ inactive_clients: 0
11185
+ }
11186
+ });
11187
+ setRecentContacts([]);
11188
+ } catch (err) {
11189
+ console.error("Erreur lors du chargement du workspace:", err);
11190
+ setError("Impossible de charger les donnees du workspace CRM.");
11191
+ } finally {
11192
+ setLoading(false);
11193
+ }
11194
+ };
11195
+ const getStatusColor = (status) => {
11196
+ const colors = {
11197
+ hot: "bg-[var(--color-error-light)] text-[var(--color-error)]",
11198
+ warm: "bg-[var(--color-warning-light)] text-[var(--color-warning)]",
11199
+ cold: "bg-[var(--color-info-light)] text-[var(--color-info)]"
11200
+ };
11201
+ return colors[status] || colors.cold;
11202
+ };
11203
+ const getStatusLabel = (status) => {
11204
+ const labels = { hot: "Chaud", warm: "Tiede", cold: "Froid" };
11205
+ return labels[status] || status;
11206
+ };
11207
+ if (loading) {
11208
+ return /* @__PURE__ */ jsx35("div", { className: "flex items-center justify-center h-96", children: /* @__PURE__ */ jsxs30("div", { className: "text-center", children: [
11209
+ /* @__PURE__ */ jsx35(RefreshCw6, { className: "w-12 h-12 text-[var(--color-primary)] animate-spin mx-auto mb-4" }),
11210
+ /* @__PURE__ */ jsx35("p", { className: "text-[var(--color-text-secondary)]", children: "Chargement du workspace CRM..." })
11211
+ ] }) });
11212
+ }
11213
+ if (!stats) return null;
11214
+ 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: [
11215
+ /* @__PURE__ */ jsx35(AlertTriangle5, { className: "w-5 h-5 text-[var(--color-error)]" }),
11216
+ /* @__PURE__ */ jsx35("div", { className: "flex-1", children: /* @__PURE__ */ jsx35("p", { className: "text-sm text-[var(--color-error)]", children: error }) }),
11217
+ /* @__PURE__ */ jsx35(
11218
+ "button",
11219
+ {
11220
+ onClick: loadWorkspaceData,
11221
+ className: "text-sm text-[var(--color-error)] hover:underline font-medium",
11222
+ children: "Reessayer"
11223
+ }
11224
+ )
11225
+ ] }) }) : null;
11226
+ return /* @__PURE__ */ jsxs30("div", { className: "space-y-6", children: [
11227
+ ErrorBanner,
11228
+ (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: [
11229
+ /* @__PURE__ */ jsx35(AlertTriangle5, { className: "w-5 h-5 text-[var(--color-warning)] mt-0.5" }),
11230
+ /* @__PURE__ */ jsxs30("div", { className: "flex-1", children: [
11231
+ /* @__PURE__ */ jsx35("h3", { className: "font-semibold text-[var(--color-text-primary)]", children: "Alertes CRM" }),
11232
+ /* @__PURE__ */ jsxs30("div", { className: "mt-2 flex flex-wrap gap-4", children: [
11233
+ stats.alerts.overdue_activities > 0 && /* @__PURE__ */ jsxs30("span", { className: "text-sm text-[var(--color-warning)]", children: [
11234
+ /* @__PURE__ */ jsx35("strong", { children: stats.alerts.overdue_activities }),
11235
+ " activites en retard"
11236
+ ] }),
11237
+ stats.alerts.expiring_opportunities > 0 && /* @__PURE__ */ jsxs30("span", { className: "text-sm text-[var(--color-warning)]", children: [
11238
+ /* @__PURE__ */ jsx35("strong", { children: stats.alerts.expiring_opportunities }),
11239
+ " opportunites a relancer"
11240
+ ] }),
11241
+ stats.alerts.inactive_clients > 0 && /* @__PURE__ */ jsxs30("span", { className: "text-sm text-[var(--color-warning)]", children: [
11242
+ /* @__PURE__ */ jsx35("strong", { children: stats.alerts.inactive_clients }),
11243
+ " clients inactifs"
11244
+ ] })
11245
+ ] })
11246
+ ] })
11247
+ ] }) }),
11248
+ /* @__PURE__ */ jsxs30("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6", children: [
11249
+ /* @__PURE__ */ jsx35(
11250
+ StatCard,
11251
+ {
11252
+ title: "Clients actifs",
11253
+ value: stats.clients.active,
11254
+ icon: Users3,
11255
+ color: "primary",
11256
+ change: stats.clients.trend !== 0 ? {
11257
+ value: stats.clients.trend,
11258
+ type: stats.clients.trend > 0 ? "increase" : "decrease"
11259
+ } : void 0
11260
+ }
11261
+ ),
11262
+ /* @__PURE__ */ jsx35(
11263
+ StatCard,
11264
+ {
11265
+ title: "Opportunites",
11266
+ value: stats.opportunities.total,
11267
+ icon: Target2,
11268
+ color: "info"
11269
+ }
11270
+ ),
11271
+ /* @__PURE__ */ jsx35(
11272
+ StatCard,
11273
+ {
11274
+ title: "Pipeline",
11275
+ value: formatCurrencyShort3(stats.opportunities.total_value),
11276
+ icon: TrendingUp2,
11277
+ color: "success"
11278
+ }
11279
+ ),
11280
+ /* @__PURE__ */ jsx35(
11281
+ StatCard,
11282
+ {
11283
+ title: "CA mensuel",
11284
+ value: formatCurrencyShort3(stats.revenue.monthly),
11285
+ icon: Banknote3,
11286
+ color: "warning",
11287
+ change: stats.revenue.trend !== 0 ? {
11288
+ value: stats.revenue.trend,
11289
+ type: stats.revenue.trend > 0 ? "increase" : "decrease"
11290
+ } : void 0
11291
+ }
11292
+ )
11293
+ ] }),
11294
+ /* @__PURE__ */ jsxs30("div", { className: "grid grid-cols-1 lg:grid-cols-3 gap-6", children: [
11295
+ /* @__PURE__ */ jsxs30("div", { className: "lg:col-span-2 space-y-6", children: [
11296
+ /* @__PURE__ */ jsxs30(ModernCard, { children: [
11297
+ /* @__PURE__ */ jsx35(
11298
+ CardHeader,
11299
+ {
11300
+ title: "Pipeline commercial",
11301
+ icon: Target2,
11302
+ action: /* @__PURE__ */ jsxs30("button", { className: "text-sm text-[var(--color-primary)] hover:underline flex items-center", children: [
11303
+ "Voir tout ",
11304
+ /* @__PURE__ */ jsx35(ArrowRight3, { className: "w-4 h-4 ml-1" })
11305
+ ] })
11306
+ }
11307
+ ),
11308
+ /* @__PURE__ */ jsx35(CardBody, { children: /* @__PURE__ */ jsxs30("div", { className: "grid grid-cols-4 gap-4", children: [
11309
+ /* @__PURE__ */ jsxs30("div", { className: "p-4 bg-[var(--color-info-light)] rounded-lg text-center", children: [
11310
+ /* @__PURE__ */ jsx35("p", { className: "text-2xl font-bold text-[var(--color-info)]", children: stats.opportunities.qualified }),
11311
+ /* @__PURE__ */ jsx35("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Qualifiees" })
11312
+ ] }),
11313
+ /* @__PURE__ */ jsxs30("div", { className: "p-4 bg-[var(--color-warning-light)] rounded-lg text-center", children: [
11314
+ /* @__PURE__ */ jsx35("p", { className: "text-2xl font-bold text-[var(--color-warning)]", children: stats.opportunities.negotiation }),
11315
+ /* @__PURE__ */ jsx35("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Negociation" })
11316
+ ] }),
11317
+ /* @__PURE__ */ jsxs30("div", { className: "p-4 bg-[var(--color-success-light)] rounded-lg text-center", children: [
11318
+ /* @__PURE__ */ jsx35("p", { className: "text-2xl font-bold text-[var(--color-success)]", children: stats.opportunities.won }),
11319
+ /* @__PURE__ */ jsx35("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Gagnees" })
11320
+ ] }),
11321
+ /* @__PURE__ */ jsxs30("div", { className: "p-4 bg-[var(--color-error-light)] rounded-lg text-center", children: [
11322
+ /* @__PURE__ */ jsx35("p", { className: "text-2xl font-bold text-[var(--color-error)]", children: stats.opportunities.lost }),
11323
+ /* @__PURE__ */ jsx35("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Perdues" })
11324
+ ] })
11325
+ ] }) })
11326
+ ] }),
11327
+ /* @__PURE__ */ jsxs30(ModernCard, { children: [
11328
+ /* @__PURE__ */ jsx35(
11329
+ CardHeader,
11330
+ {
11331
+ title: "Contacts recents",
11332
+ icon: Users3,
11333
+ action: /* @__PURE__ */ jsxs30("button", { className: "text-sm text-[var(--color-primary)] hover:underline flex items-center", children: [
11334
+ "Voir tout ",
11335
+ /* @__PURE__ */ jsx35(ArrowRight3, { className: "w-4 h-4 ml-1" })
11336
+ ] })
11337
+ }
11338
+ ),
11339
+ /* @__PURE__ */ jsx35(CardBody, { noPadding: true, children: /* @__PURE__ */ jsx35("div", { className: "divide-y divide-[var(--color-border-light)]", children: recentContacts.map((contact) => /* @__PURE__ */ jsxs30(
11340
+ "div",
11341
+ {
11342
+ className: "p-4 hover:bg-[var(--color-surface-hover)] transition-colors cursor-pointer flex items-center justify-between",
11343
+ children: [
11344
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center space-x-3", children: [
11345
+ /* @__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("") }) }),
11346
+ /* @__PURE__ */ jsxs30("div", { children: [
11347
+ /* @__PURE__ */ jsx35("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: contact.name }),
11348
+ /* @__PURE__ */ jsx35("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: contact.company })
11349
+ ] })
11350
+ ] }),
11351
+ /* @__PURE__ */ jsx35("span", { className: `px-2 py-1 text-xs font-medium rounded-full ${getStatusColor(contact.status)}`, children: getStatusLabel(contact.status) })
11352
+ ]
11353
+ },
11354
+ contact.id
11355
+ )) }) })
11356
+ ] })
11357
+ ] }),
11358
+ /* @__PURE__ */ jsxs30("div", { className: "space-y-6", children: [
11359
+ /* @__PURE__ */ jsxs30(ModernCard, { children: [
11360
+ /* @__PURE__ */ jsx35(CardHeader, { title: "Activites a faire", icon: Activity }),
11361
+ /* @__PURE__ */ jsx35(CardBody, { children: /* @__PURE__ */ jsxs30("div", { className: "space-y-3", children: [
11362
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between p-3 bg-[var(--color-surface-hover)] rounded-lg", children: [
11363
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center space-x-2", children: [
11364
+ /* @__PURE__ */ jsx35(Phone2, { className: "w-4 h-4 text-[var(--color-info)]" }),
11365
+ /* @__PURE__ */ jsx35("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Appels" })
11366
+ ] }),
11367
+ /* @__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 })
11368
+ ] }),
11369
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between p-3 bg-[var(--color-surface-hover)] rounded-lg", children: [
11370
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center space-x-2", children: [
11371
+ /* @__PURE__ */ jsx35(Calendar2, { className: "w-4 h-4 text-[var(--color-warning)]" }),
11372
+ /* @__PURE__ */ jsx35("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Reunions" })
11373
+ ] }),
11374
+ /* @__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 })
11375
+ ] }),
11376
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between p-3 bg-[var(--color-surface-hover)] rounded-lg", children: [
11377
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center space-x-2", children: [
11378
+ /* @__PURE__ */ jsx35(Mail2, { className: "w-4 h-4 text-[var(--color-success)]" }),
11379
+ /* @__PURE__ */ jsx35("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Emails" })
11380
+ ] }),
11381
+ /* @__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 })
11382
+ ] }),
11383
+ stats.activities.overdue > 0 && /* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between p-3 bg-[var(--color-error-light)] rounded-lg", children: [
11384
+ /* @__PURE__ */ jsxs30("div", { className: "flex items-center space-x-2", children: [
11385
+ /* @__PURE__ */ jsx35(AlertTriangle5, { className: "w-4 h-4 text-[var(--color-error)]" }),
11386
+ /* @__PURE__ */ jsx35("span", { className: "text-sm text-[var(--color-text-primary)]", children: "En retard" })
11387
+ ] }),
11388
+ /* @__PURE__ */ jsx35("span", { className: "px-2 py-1 text-xs font-medium bg-[var(--color-error)] text-white rounded-full", children: stats.activities.overdue })
11389
+ ] })
11390
+ ] }) })
11391
+ ] }),
11392
+ /* @__PURE__ */ jsxs30(ModernCard, { children: [
11393
+ /* @__PURE__ */ jsx35(CardHeader, { title: "Nouveaux clients", icon: UserPlus }),
11394
+ /* @__PURE__ */ jsx35(CardBody, { children: /* @__PURE__ */ jsxs30("div", { className: "text-center py-4", children: [
11395
+ /* @__PURE__ */ jsxs30("p", { className: "text-4xl font-bold text-[var(--color-success)]", children: [
11396
+ "+",
11397
+ stats.clients.new_this_month
11398
+ ] }),
11399
+ /* @__PURE__ */ jsx35("p", { className: "text-sm text-[var(--color-text-secondary)] mt-1", children: "ce mois-ci" }),
11400
+ /* @__PURE__ */ jsxs30("div", { className: "mt-4 pt-4 border-t border-[var(--color-border-light)]", children: [
11401
+ /* @__PURE__ */ jsx35("p", { className: "text-2xl font-bold text-[var(--color-text-primary)]", children: stats.clients.total }),
11402
+ /* @__PURE__ */ jsx35("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "clients au total" })
11403
+ ] })
11404
+ ] }) })
11405
+ ] })
11406
+ ] })
11407
+ ] })
11408
+ ] });
11409
+ };
11410
+ var CrmWorkspace_default = CrmWorkspace;
11411
+
11412
+ // src/pages/workspaces/FacilityWorkspace.tsx
11413
+ import { useState as useState24, useEffect as useEffect16 } from "react";
11414
+ import {
11415
+ Building2 as Building24,
11416
+ Wrench,
11417
+ AlertTriangle as AlertTriangle6,
11418
+ CheckCircle as CheckCircle4,
11419
+ ArrowRight as ArrowRight4,
11420
+ RefreshCw as RefreshCw7,
11421
+ Calendar as Calendar3,
11422
+ MapPin as MapPin3,
11423
+ Shield as Shield2
11424
+ } from "lucide-react";
11425
+ import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
11426
+ var FacilityWorkspace = () => {
11427
+ const [stats, setStats] = useState24(null);
11428
+ const [maintenanceTasks, setMaintenanceTasks] = useState24([]);
11429
+ const [loading, setLoading] = useState24(true);
11430
+ const [error, setError] = useState24(null);
11431
+ useEffect16(() => {
11432
+ loadWorkspaceData();
11433
+ }, []);
11434
+ const loadWorkspaceData = async () => {
11435
+ setLoading(true);
11436
+ setError(null);
11437
+ try {
11438
+ await new Promise((resolve) => setTimeout(resolve, 500));
11439
+ setStats({
11440
+ sites: {
11441
+ total: 0,
11442
+ active: 0
11443
+ },
11444
+ maintenance: {
11445
+ scheduled: 0,
11446
+ in_progress: 0,
11447
+ completed: 0,
11448
+ overdue: 0
11449
+ },
11450
+ incidents: {
11451
+ open: 0,
11452
+ in_progress: 0,
11453
+ resolved: 0,
11454
+ critical: 0
11455
+ },
11456
+ equipment: {
11457
+ total: 0,
11458
+ operational: 0,
11459
+ under_maintenance: 0,
11460
+ out_of_service: 0
11461
+ },
11462
+ alerts: {
11463
+ critical_incidents: 0,
11464
+ overdue_maintenance: 0,
11465
+ expiring_contracts: 0
11466
+ }
11467
+ });
11468
+ setMaintenanceTasks([]);
11469
+ } catch (err) {
11470
+ console.error("Erreur lors du chargement du workspace:", err);
11471
+ setError("Impossible de charger les donnees du workspace Facility.");
11472
+ } finally {
11473
+ setLoading(false);
11474
+ }
11475
+ };
11476
+ const getPriorityColor = (priority) => {
11477
+ const colors = {
11478
+ low: "bg-[var(--color-border-light)] text-[var(--color-text-secondary)]",
11479
+ medium: "bg-[var(--color-info-light)] text-[var(--color-info)]",
11480
+ high: "bg-[var(--color-warning-light)] text-[var(--color-warning)]",
11481
+ critical: "bg-[var(--color-error-light)] text-[var(--color-error)]"
11482
+ };
11483
+ return colors[priority] || colors.medium;
11484
+ };
11485
+ const getPriorityLabel = (priority) => {
11486
+ const labels = { low: "Basse", medium: "Moyenne", high: "Haute", critical: "Critique" };
11487
+ return labels[priority] || priority;
11488
+ };
11489
+ const getTypeColor = (type) => {
11490
+ return type === "corrective" ? "bg-[var(--color-error-light)] text-[var(--color-error)]" : "bg-[var(--color-info-light)] text-[var(--color-info)]";
11491
+ };
11492
+ if (loading) {
11493
+ return /* @__PURE__ */ jsx36("div", { className: "flex items-center justify-center h-96", children: /* @__PURE__ */ jsxs31("div", { className: "text-center", children: [
11494
+ /* @__PURE__ */ jsx36(RefreshCw7, { className: "w-12 h-12 text-[var(--color-primary)] animate-spin mx-auto mb-4" }),
11495
+ /* @__PURE__ */ jsx36("p", { className: "text-[var(--color-text-secondary)]", children: "Chargement du workspace Facility..." })
11496
+ ] }) });
11497
+ }
11498
+ if (!stats) return null;
11499
+ 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: [
11500
+ /* @__PURE__ */ jsx36(AlertTriangle6, { className: "w-5 h-5 text-[var(--color-error)]" }),
11501
+ /* @__PURE__ */ jsx36("div", { className: "flex-1", children: /* @__PURE__ */ jsx36("p", { className: "text-sm text-[var(--color-error)]", children: error }) }),
11502
+ /* @__PURE__ */ jsx36(
11503
+ "button",
11504
+ {
11505
+ onClick: loadWorkspaceData,
11506
+ className: "text-sm text-[var(--color-error)] hover:underline font-medium",
11507
+ children: "Reessayer"
11508
+ }
11509
+ )
11510
+ ] }) }) : null;
11511
+ return /* @__PURE__ */ jsxs31("div", { className: "space-y-6", children: [
11512
+ ErrorBanner,
11513
+ (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: [
11514
+ /* @__PURE__ */ jsx36(AlertTriangle6, { className: "w-5 h-5 text-[var(--color-error)] mt-0.5" }),
11515
+ /* @__PURE__ */ jsxs31("div", { className: "flex-1", children: [
11516
+ /* @__PURE__ */ jsx36("h3", { className: "font-semibold text-[var(--color-text-primary)]", children: "Alertes critiques" }),
11517
+ /* @__PURE__ */ jsxs31("div", { className: "mt-2 flex flex-wrap gap-4", children: [
11518
+ stats.alerts.critical_incidents > 0 && /* @__PURE__ */ jsxs31("span", { className: "text-sm text-[var(--color-error)]", children: [
11519
+ /* @__PURE__ */ jsx36("strong", { children: stats.alerts.critical_incidents }),
11520
+ " incident(s) critique(s)"
11521
+ ] }),
11522
+ stats.alerts.overdue_maintenance > 0 && /* @__PURE__ */ jsxs31("span", { className: "text-sm text-[var(--color-error)]", children: [
11523
+ /* @__PURE__ */ jsx36("strong", { children: stats.alerts.overdue_maintenance }),
11524
+ " maintenance(s) en retard"
11525
+ ] }),
11526
+ stats.alerts.expiring_contracts > 0 && /* @__PURE__ */ jsxs31("span", { className: "text-sm text-[var(--color-warning)]", children: [
11527
+ /* @__PURE__ */ jsx36("strong", { children: stats.alerts.expiring_contracts }),
11528
+ " contrat(s) expirant bientot"
11529
+ ] })
11530
+ ] })
11531
+ ] })
11532
+ ] }) }),
11533
+ /* @__PURE__ */ jsxs31("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6", children: [
11534
+ /* @__PURE__ */ jsx36(
11535
+ StatCard,
11536
+ {
11537
+ title: "Sites actifs",
11538
+ value: stats.sites.active,
11539
+ icon: Building24,
11540
+ color: "primary"
11541
+ }
11542
+ ),
11543
+ /* @__PURE__ */ jsx36(
11544
+ StatCard,
11545
+ {
11546
+ title: "Maintenances planifiees",
11547
+ value: stats.maintenance.scheduled,
11548
+ icon: Wrench,
11549
+ color: "info"
11550
+ }
11551
+ ),
11552
+ /* @__PURE__ */ jsx36(
11553
+ StatCard,
11554
+ {
11555
+ title: "Incidents ouverts",
11556
+ value: stats.incidents.open,
11557
+ icon: AlertTriangle6,
11558
+ color: "warning"
11559
+ }
11560
+ ),
11561
+ /* @__PURE__ */ jsx36(
11562
+ StatCard,
11563
+ {
11564
+ title: "Equipements operationnels",
11565
+ value: stats.equipment.total > 0 ? `${Math.round(stats.equipment.operational / stats.equipment.total * 100)}%` : "0%",
11566
+ icon: CheckCircle4,
11567
+ color: "success"
11568
+ }
11569
+ )
11570
+ ] }),
11571
+ /* @__PURE__ */ jsxs31("div", { className: "grid grid-cols-1 lg:grid-cols-3 gap-6", children: [
11572
+ /* @__PURE__ */ jsxs31("div", { className: "lg:col-span-2 space-y-6", children: [
11573
+ /* @__PURE__ */ jsxs31(ModernCard, { children: [
11574
+ /* @__PURE__ */ jsx36(
11575
+ CardHeader,
11576
+ {
11577
+ title: "Maintenances a venir",
11578
+ icon: Wrench,
11579
+ action: /* @__PURE__ */ jsxs31("button", { className: "text-sm text-[var(--color-primary)] hover:underline flex items-center", children: [
11580
+ "Voir tout ",
11581
+ /* @__PURE__ */ jsx36(ArrowRight4, { className: "w-4 h-4 ml-1" })
11582
+ ] })
11583
+ }
11584
+ ),
11585
+ /* @__PURE__ */ jsx36(CardBody, { noPadding: true, children: /* @__PURE__ */ jsx36("div", { className: "divide-y divide-[var(--color-border-light)]", children: maintenanceTasks.map((task) => /* @__PURE__ */ jsx36(
11586
+ "div",
11587
+ {
11588
+ className: "p-4 hover:bg-[var(--color-surface-hover)] transition-colors cursor-pointer",
11589
+ children: /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between", children: [
11590
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center space-x-3", children: [
11591
+ /* @__PURE__ */ jsx36("span", { className: `px-2 py-1 text-xs font-medium rounded-full ${getPriorityColor(task.priority)}`, children: getPriorityLabel(task.priority) }),
11592
+ /* @__PURE__ */ jsxs31("div", { children: [
11593
+ /* @__PURE__ */ jsx36("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: task.title }),
11594
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center space-x-2 mt-1", children: [
11595
+ /* @__PURE__ */ jsx36(MapPin3, { className: "w-3 h-3 text-[var(--color-text-tertiary)]" }),
11596
+ /* @__PURE__ */ jsx36("span", { className: "text-xs text-[var(--color-text-tertiary)]", children: task.site })
11597
+ ] })
11598
+ ] })
11599
+ ] }),
11600
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center space-x-3", children: [
11601
+ /* @__PURE__ */ jsx36("span", { className: `px-2 py-1 text-xs rounded ${getTypeColor(task.type)}`, children: task.type === "preventive" ? "Preventive" : "Corrective" }),
11602
+ /* @__PURE__ */ jsxs31("div", { className: "text-right", children: [
11603
+ /* @__PURE__ */ jsx36("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "Echeance" }),
11604
+ /* @__PURE__ */ jsx36("p", { className: "text-sm font-medium text-[var(--color-text-primary)]", children: new Date(task.dueDate).toLocaleDateString("fr-FR") })
11605
+ ] })
11606
+ ] })
11607
+ ] })
11608
+ },
11609
+ task.id
11610
+ )) }) })
11611
+ ] }),
11612
+ /* @__PURE__ */ jsxs31(ModernCard, { children: [
11613
+ /* @__PURE__ */ jsx36(CardHeader, { title: "Etat des maintenances", icon: Calendar3 }),
11614
+ /* @__PURE__ */ jsx36(CardBody, { children: /* @__PURE__ */ jsxs31("div", { className: "grid grid-cols-4 gap-4", children: [
11615
+ /* @__PURE__ */ jsxs31("div", { className: "p-4 bg-[var(--color-info-light)] rounded-lg text-center", children: [
11616
+ /* @__PURE__ */ jsx36("p", { className: "text-2xl font-bold text-[var(--color-info)]", children: stats.maintenance.scheduled }),
11617
+ /* @__PURE__ */ jsx36("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Planifiees" })
11618
+ ] }),
11619
+ /* @__PURE__ */ jsxs31("div", { className: "p-4 bg-[var(--color-warning-light)] rounded-lg text-center", children: [
11620
+ /* @__PURE__ */ jsx36("p", { className: "text-2xl font-bold text-[var(--color-warning)]", children: stats.maintenance.in_progress }),
11621
+ /* @__PURE__ */ jsx36("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "En cours" })
11622
+ ] }),
11623
+ /* @__PURE__ */ jsxs31("div", { className: "p-4 bg-[var(--color-success-light)] rounded-lg text-center", children: [
11624
+ /* @__PURE__ */ jsx36("p", { className: "text-2xl font-bold text-[var(--color-success)]", children: stats.maintenance.completed }),
11625
+ /* @__PURE__ */ jsx36("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "Terminees" })
11626
+ ] }),
11627
+ /* @__PURE__ */ jsxs31("div", { className: "p-4 bg-[var(--color-error-light)] rounded-lg text-center", children: [
11628
+ /* @__PURE__ */ jsx36("p", { className: "text-2xl font-bold text-[var(--color-error)]", children: stats.maintenance.overdue }),
11629
+ /* @__PURE__ */ jsx36("p", { className: "text-sm text-[var(--color-text-secondary)]", children: "En retard" })
11630
+ ] })
11631
+ ] }) })
11632
+ ] })
11633
+ ] }),
11634
+ /* @__PURE__ */ jsxs31("div", { className: "space-y-6", children: [
11635
+ /* @__PURE__ */ jsxs31(ModernCard, { children: [
11636
+ /* @__PURE__ */ jsx36(CardHeader, { title: "Incidents", icon: AlertTriangle6 }),
11637
+ /* @__PURE__ */ jsx36(CardBody, { children: /* @__PURE__ */ jsxs31("div", { className: "space-y-3", children: [
11638
+ stats.incidents.critical > 0 && /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between p-3 bg-[var(--color-error-light)] rounded-lg", children: [
11639
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center space-x-2", children: [
11640
+ /* @__PURE__ */ jsx36("div", { className: "w-2 h-2 bg-[var(--color-error)] rounded-full animate-pulse" }),
11641
+ /* @__PURE__ */ jsx36("span", { className: "text-sm font-medium text-[var(--color-error)]", children: "Critiques" })
11642
+ ] }),
11643
+ /* @__PURE__ */ jsx36("span", { className: "font-bold text-[var(--color-error)]", children: stats.incidents.critical })
11644
+ ] }),
11645
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between p-3 bg-[var(--color-warning-light)] rounded-lg", children: [
11646
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center space-x-2", children: [
11647
+ /* @__PURE__ */ jsx36("div", { className: "w-2 h-2 bg-[var(--color-warning)] rounded-full" }),
11648
+ /* @__PURE__ */ jsx36("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Ouverts" })
11649
+ ] }),
11650
+ /* @__PURE__ */ jsx36("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.incidents.open })
11651
+ ] }),
11652
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between p-3 bg-[var(--color-info-light)] rounded-lg", children: [
11653
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center space-x-2", children: [
11654
+ /* @__PURE__ */ jsx36("div", { className: "w-2 h-2 bg-[var(--color-info)] rounded-full" }),
11655
+ /* @__PURE__ */ jsx36("span", { className: "text-sm text-[var(--color-text-primary)]", children: "En cours" })
11656
+ ] }),
11657
+ /* @__PURE__ */ jsx36("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.incidents.in_progress })
11658
+ ] }),
11659
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between p-3 bg-[var(--color-success-light)] rounded-lg", children: [
11660
+ /* @__PURE__ */ jsxs31("div", { className: "flex items-center space-x-2", children: [
11661
+ /* @__PURE__ */ jsx36("div", { className: "w-2 h-2 bg-[var(--color-success)] rounded-full" }),
11662
+ /* @__PURE__ */ jsx36("span", { className: "text-sm text-[var(--color-text-primary)]", children: "Resolus" })
11663
+ ] }),
11664
+ /* @__PURE__ */ jsx36("span", { className: "font-semibold text-[var(--color-text-primary)]", children: stats.incidents.resolved })
11665
+ ] })
11666
+ ] }) })
11667
+ ] }),
11668
+ /* @__PURE__ */ jsxs31(ModernCard, { children: [
11669
+ /* @__PURE__ */ jsx36(CardHeader, { title: "Equipements", icon: Shield2 }),
11670
+ /* @__PURE__ */ jsx36(CardBody, { children: /* @__PURE__ */ jsxs31("div", { className: "text-center py-4", children: [
11671
+ /* @__PURE__ */ jsx36("p", { className: "text-4xl font-bold text-[var(--color-text-primary)]", children: stats.equipment.total }),
11672
+ /* @__PURE__ */ jsx36("p", { className: "text-sm text-[var(--color-text-secondary)] mt-1", children: "equipements references" }),
11673
+ /* @__PURE__ */ jsxs31("div", { className: "mt-4 grid grid-cols-3 gap-2", children: [
11674
+ /* @__PURE__ */ jsxs31("div", { className: "p-2 bg-[var(--color-success-light)] rounded", children: [
11675
+ /* @__PURE__ */ jsx36("p", { className: "text-lg font-semibold text-[var(--color-success)]", children: stats.equipment.operational }),
11676
+ /* @__PURE__ */ jsx36("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "OK" })
11677
+ ] }),
11678
+ /* @__PURE__ */ jsxs31("div", { className: "p-2 bg-[var(--color-warning-light)] rounded", children: [
11679
+ /* @__PURE__ */ jsx36("p", { className: "text-lg font-semibold text-[var(--color-warning)]", children: stats.equipment.under_maintenance }),
11680
+ /* @__PURE__ */ jsx36("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "Maint." })
11681
+ ] }),
11682
+ /* @__PURE__ */ jsxs31("div", { className: "p-2 bg-[var(--color-error-light)] rounded", children: [
11683
+ /* @__PURE__ */ jsx36("p", { className: "text-lg font-semibold text-[var(--color-error)]", children: stats.equipment.out_of_service }),
11684
+ /* @__PURE__ */ jsx36("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: "HS" })
11685
+ ] })
11686
+ ] })
11687
+ ] }) })
11688
+ ] })
11689
+ ] })
11690
+ ] })
11691
+ ] });
11692
+ };
11693
+ var FacilityWorkspace_default = FacilityWorkspace;
11694
+
11695
+ // src/pages/workspaces/WorkSpace.tsx
11696
+ import { Fragment as Fragment9, jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
11697
+ var MODULES_CONFIG = [
11698
+ {
11699
+ id: "purchase",
11700
+ label: "Achats",
11701
+ description: "Gestion des achats et approvisionnements",
11702
+ icon: ShoppingCart2,
11703
+ color: "text-blue-600",
11704
+ bgColor: "bg-blue-50",
11705
+ component: PurchaseWorkspace_default
11706
+ },
11707
+ {
11708
+ id: "accounting",
11709
+ label: "Comptabilite",
11710
+ description: "Gestion comptable et financiere",
11711
+ icon: Calculator2,
11712
+ color: "text-green-600",
11713
+ bgColor: "bg-green-50",
11714
+ component: AccountingWorkspace_default
11715
+ },
11716
+ {
11717
+ id: "crm",
11718
+ label: "CRM",
11719
+ description: "Gestion de la relation client",
11720
+ icon: Users5,
11721
+ color: "text-purple-600",
11722
+ bgColor: "bg-purple-50",
11723
+ component: CrmWorkspace_default
11724
+ },
11725
+ {
11726
+ id: "facility",
11727
+ label: "Facility",
11728
+ description: "Gestion des installations et maintenances",
11729
+ icon: Building25,
11730
+ color: "text-orange-600",
11731
+ bgColor: "bg-orange-50",
11732
+ component: FacilityWorkspace_default
11733
+ }
11734
+ ];
11735
+ var WorkSpace = () => {
11736
+ const [activeModule, setActiveModule] = useState25(null);
11737
+ const [availableModules, setAvailableModules] = useState25([]);
11738
+ const [loading, setLoading] = useState25(true);
11739
+ const [showModuleSelector, setShowModuleSelector] = useState25(false);
11740
+ useEffect17(() => {
11741
+ loadAvailableModules();
11742
+ }, []);
11743
+ const loadAvailableModules = async () => {
11744
+ setLoading(true);
11745
+ try {
11746
+ await new Promise((resolve) => setTimeout(resolve, 300));
11747
+ const userModules = ["purchase", "accounting", "crm", "facility"];
11748
+ setAvailableModules(userModules);
11749
+ if (userModules.length > 0 && !activeModule) {
11750
+ setActiveModule(userModules[0]);
11751
+ }
11752
+ } catch (error) {
11753
+ console.error("Erreur lors du chargement des modules:", error);
11754
+ setAvailableModules(["purchase"]);
11755
+ setActiveModule("purchase");
11756
+ } finally {
11757
+ setLoading(false);
11758
+ }
11759
+ };
11760
+ const filteredModules = useMemo2(() => {
11761
+ return MODULES_CONFIG.filter((m) => availableModules.includes(m.id));
11762
+ }, [availableModules]);
11763
+ const currentModule = useMemo2(() => {
11764
+ return MODULES_CONFIG.find((m) => m.id === activeModule);
11765
+ }, [activeModule]);
11766
+ const ActiveWorkspaceComponent = currentModule?.component;
11767
+ if (loading) {
11768
+ return /* @__PURE__ */ jsx37("div", { className: "flex items-center justify-center h-screen bg-[var(--color-background)]", children: /* @__PURE__ */ jsxs32("div", { className: "text-center", children: [
11769
+ /* @__PURE__ */ jsx37(RefreshCw8, { className: "w-12 h-12 text-[var(--color-primary)] animate-spin mx-auto mb-4" }),
11770
+ /* @__PURE__ */ jsx37("p", { className: "text-[var(--color-text-secondary)]", children: "Chargement des workspaces..." })
11771
+ ] }) });
11772
+ }
11773
+ if (filteredModules.length === 0) {
11774
+ return /* @__PURE__ */ jsx37("div", { className: "flex items-center justify-center h-screen bg-[var(--color-background)]", children: /* @__PURE__ */ jsxs32("div", { className: "text-center", children: [
11775
+ /* @__PURE__ */ jsx37(LayoutDashboard, { className: "w-16 h-16 text-[var(--color-text-tertiary)] mx-auto mb-4" }),
11776
+ /* @__PURE__ */ jsx37("h2", { className: "text-xl font-semibold text-[var(--color-text-primary)] mb-2", children: "Aucun workspace disponible" }),
11777
+ /* @__PURE__ */ jsx37("p", { className: "text-[var(--color-text-secondary)]", children: "Contactez votre administrateur pour obtenir l'acces aux modules." })
11778
+ ] }) });
11779
+ }
11780
+ return /* @__PURE__ */ jsxs32("div", { className: "min-h-screen bg-[var(--color-background)]", children: [
11781
+ /* @__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: [
11782
+ /* @__PURE__ */ jsxs32("div", { className: "flex items-center space-x-4", children: [
11783
+ currentModule && /* @__PURE__ */ jsx37("div", { className: `p-2 rounded-lg ${currentModule.bgColor}`, children: /* @__PURE__ */ jsx37(currentModule.icon, { className: `w-6 h-6 ${currentModule.color}` }) }),
11784
+ /* @__PURE__ */ jsxs32("div", { className: "relative", children: [
11785
+ /* @__PURE__ */ jsxs32(
11786
+ "button",
11787
+ {
11788
+ onClick: () => setShowModuleSelector(!showModuleSelector),
11789
+ className: "flex items-center space-x-2 hover:bg-[var(--color-surface-hover)] px-3 py-2 rounded-lg transition-colors",
11790
+ children: [
11791
+ /* @__PURE__ */ jsxs32("div", { children: [
11792
+ /* @__PURE__ */ jsxs32("h1", { className: "text-xl font-bold text-[var(--color-text-primary)]", children: [
11793
+ "Workspace - ",
11794
+ currentModule?.label
11795
+ ] }),
11796
+ /* @__PURE__ */ jsx37("p", { className: "text-sm text-[var(--color-text-secondary)]", children: currentModule?.description })
11797
+ ] }),
11798
+ filteredModules.length > 1 && /* @__PURE__ */ jsx37(ChevronDown4, { className: `w-5 h-5 text-[var(--color-text-tertiary)] transition-transform ${showModuleSelector ? "rotate-180" : ""}` })
11799
+ ]
11800
+ }
11801
+ ),
11802
+ showModuleSelector && filteredModules.length > 1 && /* @__PURE__ */ jsxs32(Fragment9, { children: [
11803
+ /* @__PURE__ */ jsx37(
11804
+ "div",
11805
+ {
11806
+ className: "fixed inset-0 z-10",
11807
+ onClick: () => setShowModuleSelector(false)
11808
+ }
11809
+ ),
11810
+ /* @__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: [
11811
+ /* @__PURE__ */ jsx37("p", { className: "text-xs font-semibold text-[var(--color-text-tertiary)] uppercase tracking-wide px-3 py-2", children: "Changer de workspace" }),
11812
+ filteredModules.map((module) => /* @__PURE__ */ jsxs32(
11813
+ "button",
11814
+ {
11815
+ onClick: () => {
11816
+ setActiveModule(module.id);
11817
+ setShowModuleSelector(false);
11818
+ },
11819
+ className: `
11820
+ w-full flex items-center space-x-3 px-3 py-3 rounded-lg transition-colors
11821
+ ${activeModule === module.id ? "bg-[var(--color-primary-light)]" : "hover:bg-[var(--color-surface-hover)]"}
11822
+ `,
11823
+ children: [
11824
+ /* @__PURE__ */ jsx37("div", { className: `p-2 rounded-lg ${module.bgColor}`, children: /* @__PURE__ */ jsx37(module.icon, { className: `w-5 h-5 ${module.color}` }) }),
11825
+ /* @__PURE__ */ jsxs32("div", { className: "text-left", children: [
11826
+ /* @__PURE__ */ jsx37("p", { className: `font-medium ${activeModule === module.id ? "text-[var(--color-primary)]" : "text-[var(--color-text-primary)]"}`, children: module.label }),
11827
+ /* @__PURE__ */ jsx37("p", { className: "text-xs text-[var(--color-text-tertiary)]", children: module.description })
11828
+ ] })
11829
+ ]
11830
+ },
11831
+ module.id
11832
+ ))
11833
+ ] }) })
11834
+ ] })
11835
+ ] })
11836
+ ] }),
11837
+ /* @__PURE__ */ jsx37(
11838
+ "button",
11839
+ {
11840
+ onClick: loadAvailableModules,
11841
+ className: "p-2 hover:bg-[var(--color-surface-hover)] rounded-lg transition-colors",
11842
+ title: "Actualiser",
11843
+ children: /* @__PURE__ */ jsx37(RefreshCw8, { className: "w-5 h-5 text-[var(--color-text-tertiary)]" })
11844
+ }
11845
+ )
11846
+ ] }) }) }),
11847
+ /* @__PURE__ */ jsx37("div", { className: "p-6", children: ActiveWorkspaceComponent && /* @__PURE__ */ jsx37(ActiveWorkspaceComponent, {}) })
11848
+ ] });
11849
+ };
11850
+ var WorkSpace_default = WorkSpace;
10264
11851
  export {
10265
11852
  ACCOUNT_TYPE_LABELS,
10266
11853
  AccountServices,
11854
+ AccountingWorkspace_default as AccountingWorkspace,
10267
11855
  Alert_default as Alert,
10268
11856
  AlertProvider,
10269
11857
  ApprovalAnswerModal,
@@ -10274,8 +11862,11 @@ export {
10274
11862
  AuthServices,
10275
11863
  BALANCE_TYPE_LABELS,
10276
11864
  Choices_default as CHOICES,
11865
+ CardBody,
11866
+ CardHeader,
10277
11867
  ClientServices,
10278
11868
  CountrySelector,
11869
+ CrmWorkspace_default as CrmWorkspace,
10279
11870
  DataTable,
10280
11871
  DateInput,
10281
11872
  DocumentFooter,
@@ -10283,6 +11874,7 @@ export {
10283
11874
  EntityFileManager,
10284
11875
  FDrawer,
10285
11876
  FROM_MODULE_CHOICES,
11877
+ FacilityWorkspace_default as FacilityWorkspace,
10286
11878
  FetchApi,
10287
11879
  FileInput,
10288
11880
  FileManager,
@@ -10296,6 +11888,7 @@ export {
10296
11888
  LegalFormSelector,
10297
11889
  MinimalVendorForm,
10298
11890
  Modals_default as Modal,
11891
+ ModernCard,
10299
11892
  NumberInput,
10300
11893
  PRINT_GREEN,
10301
11894
  Pages_default as Pages,
@@ -10303,6 +11896,7 @@ export {
10303
11896
  Buttons_default as PrimaryButton,
10304
11897
  PrintPreview,
10305
11898
  PrintableDocument,
11899
+ PurchaseWorkspace_default as PurchaseWorkspace,
10306
11900
  ModernDoubleSidebarLayout_default as RewiseLayout,
10307
11901
  SYSCOHADA_CLASSES,
10308
11902
  SecondaryButton,
@@ -10316,6 +11910,7 @@ export {
10316
11910
  SelectVendor,
10317
11911
  SessionProvider,
10318
11912
  SignatureSection,
11913
+ StatCard,
10319
11914
  TEMPLATE_FNE_CHOICES,
10320
11915
  TaxSelector,
10321
11916
  TemplateFNESelector,
@@ -10327,6 +11922,8 @@ export {
10327
11922
  UnitServices,
10328
11923
  UserServices,
10329
11924
  VendorServices,
11925
+ WorkSpace_default as WorkSpace,
11926
+ WorkspaceServices,
10330
11927
  fileManagerApi,
10331
11928
  formatCurrency,
10332
11929
  formatDate,