ptechcore_ui 1.0.47 → 1.0.48

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.
Files changed (3) hide show
  1. package/dist/index.cjs +1114 -1091
  2. package/dist/index.js +1323 -1299
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -4824,7 +4824,7 @@ var Pagination = ({
4824
4824
  };
4825
4825
 
4826
4826
  // src/components/common/FormVendor.tsx
4827
- var import_react11 = require("react");
4827
+ var import_react20 = require("react");
4828
4828
 
4829
4829
  // src/components/common/CommonSelect.tsx
4830
4830
  var import_react10 = require("react");
@@ -5856,919 +5856,363 @@ var SelectClient = ({
5856
5856
  ] });
5857
5857
  };
5858
5858
 
5859
- // src/components/common/FormVendor.tsx
5860
- var import_lucide_react8 = require("lucide-react");
5859
+ // src/components/common/FileManager/FileManager.tsx
5860
+ var import_react17 = require("react");
5861
+ var import_lucide_react15 = require("lucide-react");
5862
+
5863
+ // src/components/common/FileManager/FileManagerContext.tsx
5864
+ var import_react11 = require("react");
5861
5865
  var import_jsx_runtime15 = require("react/jsx-runtime");
5862
- var FormVendor = ({
5863
- isOpen,
5864
- onClose,
5865
- object,
5866
- from = "procurement",
5867
- refresh = () => {
5866
+ var defaultTexts = {
5867
+ createFolder: "Cr\xE9er un dossier",
5868
+ uploadFiles: "Uploader des fichiers",
5869
+ rename: "Renommer",
5870
+ delete: "Supprimer",
5871
+ download: "T\xE9l\xE9charger",
5872
+ open: "Ouvrir",
5873
+ deselectAll: "Tout d\xE9s\xE9lectionner",
5874
+ newFolderName: "Nom du dossier",
5875
+ confirmDelete: "Voulez-vous vraiment supprimer",
5876
+ noFiles: "Aucun fichier",
5877
+ dropFilesHere: "D\xE9posez vos fichiers ici",
5878
+ cancel: "Annuler",
5879
+ confirm: "Confirmer"
5880
+ };
5881
+ var FileManagerContext = (0, import_react11.createContext)(null);
5882
+ var useFileManager = () => {
5883
+ const context = (0, import_react11.useContext)(FileManagerContext);
5884
+ if (!context) {
5885
+ throw new Error("useFileManager must be used within a FileManagerProvider");
5868
5886
  }
5887
+ return context;
5888
+ };
5889
+ var FileManagerProvider = ({
5890
+ children,
5891
+ data,
5892
+ rootName = "Fichiers",
5893
+ viewMode: initialViewMode = "grid",
5894
+ allowMultiSelect = true,
5895
+ allowUpload = true,
5896
+ allowCreateFolder = true,
5897
+ allowRename = true,
5898
+ allowDelete = true,
5899
+ allowDownload = true,
5900
+ texts: customTexts = {},
5901
+ onCreateFolder,
5902
+ onUploadFiles,
5903
+ onRename,
5904
+ onDelete,
5905
+ onDownload,
5906
+ onOpen,
5907
+ onSelect
5869
5908
  }) => {
5870
- const [formData, setFormData] = (0, import_react11.useState)(object || {
5871
- from_module: from ?? null,
5872
- legal_name: "",
5873
- trading_name: "",
5874
- phone: "",
5875
- email: "",
5876
- logo: "",
5877
- year_founded: "",
5878
- activity_sector: "",
5879
- description: "",
5880
- accounting_account_number: "",
5881
- account: null,
5882
- capital: null,
5883
- annual_turnover: null,
5884
- payment_delay: null,
5885
- country: "",
5886
- city: "",
5887
- address: "",
5888
- legal_form: "",
5889
- tax_regime: "",
5890
- tax_account: "",
5891
- rccm: "",
5892
- legal_representative_name: "",
5893
- legal_representative_address: "",
5894
- legal_representative_phone: "",
5895
- legal_representative_email: "",
5896
- legal_representative_id_document: "",
5897
- legal_representative_id_number: "",
5898
- legal_representative_fonction: "",
5899
- bank_name: "",
5900
- bank_address: "",
5901
- bank_email: "",
5902
- bank_phone: "",
5903
- iban: "",
5904
- rib: "",
5905
- vendor_number: ""
5909
+ const rootFolder = (0, import_react11.useMemo)(
5910
+ () => ({
5911
+ id: "__root__",
5912
+ name: rootName,
5913
+ type: "folder",
5914
+ path: "/",
5915
+ children: data
5916
+ }),
5917
+ [data, rootName]
5918
+ );
5919
+ const [currentFolder, setCurrentFolder] = (0, import_react11.useState)(rootFolder);
5920
+ const [pathHistory, setPathHistory] = (0, import_react11.useState)([rootFolder]);
5921
+ const [selectedItems, setSelectedItems] = (0, import_react11.useState)([]);
5922
+ const [viewMode, setViewMode] = (0, import_react11.useState)(initialViewMode);
5923
+ const [renamingItem, setRenamingItem] = (0, import_react11.useState)(null);
5924
+ const [contextMenu, setContextMenu] = (0, import_react11.useState)({
5925
+ visible: false,
5926
+ position: { x: 0, y: 0 },
5927
+ item: null
5906
5928
  });
5907
- const [errors, setErrors] = (0, import_react11.useState)({});
5908
- const [activeTab, setActiveTab] = (0, import_react11.useState)("general");
5909
- const [loading, setLoading] = (0, import_react11.useState)(false);
5910
- const { token } = useSession();
5911
- const { success, error: showError } = useToast();
5912
- const handleInputChange = (e) => {
5913
- const { name, value } = e.target;
5914
- setFormData((prev) => ({ ...prev, [name]: value }));
5915
- if (errors[name]) {
5916
- setErrors((prev) => ({ ...prev, [name]: void 0 }));
5917
- }
5918
- };
5919
- const handleTextareaChange = (e) => {
5920
- const { name, value } = e.target;
5921
- setFormData((prev) => ({ ...prev, [name]: value }));
5922
- };
5923
- const validateForm = () => {
5924
- const newErrors = {};
5925
- if (!formData.legal_name?.trim()) {
5926
- newErrors.legal_name = "La raison sociale est obligatoire";
5927
- }
5928
- if (formData.email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(formData.email)) {
5929
- newErrors.email = "Format d'email invalide";
5930
- }
5931
- if (formData.iban && formData.iban.length > 0 && formData.iban.length < 15) {
5932
- newErrors.iban = "Format IBAN invalide";
5933
- }
5934
- setErrors(newErrors);
5935
- return Object.keys(newErrors).length === 0;
5936
- };
5937
- const handleSaveVendor = async (entityData) => {
5938
- try {
5939
- if (object && object.id) {
5940
- await VendorServices.update(object.id, entityData);
5941
- success("Fournisseur modifi\xE9 avec succ\xE8s !");
5929
+ const texts = (0, import_react11.useMemo)(() => ({ ...defaultTexts, ...customTexts }), [customTexts]);
5930
+ const currentFolderContents = (0, import_react11.useMemo)(() => {
5931
+ return currentFolder?.children || [];
5932
+ }, [currentFolder]);
5933
+ const navigateToFolder = (0, import_react11.useCallback)(
5934
+ (folder) => {
5935
+ if (!folder) {
5936
+ setCurrentFolder(rootFolder);
5937
+ setPathHistory([rootFolder]);
5942
5938
  } else {
5943
- await VendorServices.create(entityData);
5944
- success("Fournisseur cr\xE9\xE9 avec succ\xE8s !");
5939
+ setCurrentFolder(folder);
5940
+ setPathHistory((prev) => [...prev, folder]);
5945
5941
  }
5946
- refresh();
5947
- onClose();
5948
- } catch (error) {
5949
- console.error(error);
5950
- showError("Erreur lors de l'enregistrement du fournisseur");
5942
+ setSelectedItems([]);
5943
+ setContextMenu({ visible: false, position: { x: 0, y: 0 }, item: null });
5944
+ },
5945
+ [rootFolder]
5946
+ );
5947
+ const navigateBack = (0, import_react11.useCallback)(() => {
5948
+ if (pathHistory.length > 1) {
5949
+ const newHistory = [...pathHistory];
5950
+ newHistory.pop();
5951
+ const previousFolder = newHistory[newHistory.length - 1];
5952
+ setCurrentFolder(previousFolder);
5953
+ setPathHistory(newHistory);
5954
+ setSelectedItems([]);
5951
5955
  }
5952
- };
5953
- const handleSubmit = async (e) => {
5954
- e.preventDefault();
5955
- if (!validateForm()) return;
5956
- setLoading(true);
5957
- try {
5958
- await handleSaveVendor(formData);
5959
- } finally {
5960
- setLoading(false);
5956
+ }, [pathHistory]);
5957
+ const navigateToPath = (0, import_react11.useCallback)(
5958
+ (index) => {
5959
+ if (index < pathHistory.length - 1) {
5960
+ const newHistory = pathHistory.slice(0, index + 1);
5961
+ setCurrentFolder(newHistory[newHistory.length - 1]);
5962
+ setPathHistory(newHistory);
5963
+ setSelectedItems([]);
5964
+ }
5965
+ },
5966
+ [pathHistory]
5967
+ );
5968
+ const selectItem = (0, import_react11.useCallback)(
5969
+ (item, multiSelect = false) => {
5970
+ setSelectedItems((prev) => {
5971
+ if (multiSelect && allowMultiSelect) {
5972
+ const isSelected = prev.some((i) => i.id === item.id);
5973
+ if (isSelected) {
5974
+ return prev.filter((i) => i.id !== item.id);
5975
+ }
5976
+ return [...prev, item];
5977
+ }
5978
+ return [item];
5979
+ });
5980
+ if (onSelect) {
5981
+ const newSelection = allowMultiSelect && multiSelect ? selectedItems.some((i) => i.id === item.id) ? selectedItems.filter((i) => i.id !== item.id) : [...selectedItems, item] : [item];
5982
+ onSelect(newSelection);
5983
+ }
5984
+ },
5985
+ [allowMultiSelect, onSelect, selectedItems]
5986
+ );
5987
+ const deselectAll = (0, import_react11.useCallback)(() => {
5988
+ setSelectedItems([]);
5989
+ if (onSelect) {
5990
+ onSelect([]);
5961
5991
  }
5962
- };
5963
- const tabs = [
5964
- { id: "general", label: "G\xE9n\xE9ral", icon: import_lucide_react8.Building2 },
5965
- { id: "contacts", label: "Adresses & Contacts", icon: import_lucide_react8.MapPin },
5966
- { id: "representative", label: "Repr\xE9sentant", icon: import_lucide_react8.FileText },
5967
- { id: "accounting", label: "Comptabilit\xE9", icon: import_lucide_react8.FileText },
5968
- { id: "banking", label: "Bancaire", icon: import_lucide_react8.CreditCard }
5969
- ];
5970
- const renderTabContent = () => {
5971
- switch (activeTab) {
5972
- case "general":
5973
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-4", children: [
5974
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5975
- TextInput,
5976
- {
5977
- label: "Raison sociale",
5978
- name: "legal_name",
5979
- value: formData.legal_name || "",
5980
- placeholder: "Nom l\\u00e9gal de l'entit\\u00e9",
5981
- required: true,
5982
- error: errors.legal_name,
5983
- onChange: handleInputChange
5984
- }
5985
- ),
5986
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5987
- TextInput,
5988
- {
5989
- label: "Nom commercial",
5990
- name: "trading_name",
5991
- value: formData.trading_name || "",
5992
- placeholder: "Nom commercial (optionnel)",
5993
- onChange: handleInputChange
5994
- }
5995
- ),
5996
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
5997
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5998
- TextInput,
5999
- {
6000
- label: "Num\\u00e9ro d'identification fiscale (NCC)",
6001
- name: "tax_account",
6002
- value: formData.tax_account || "",
6003
- placeholder: "Num\\u00e9ro d'identification fiscale",
6004
- onChange: handleInputChange
6005
- }
6006
- ),
6007
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6008
- TextInput,
6009
- {
6010
- label: "RCCM",
6011
- name: "rccm",
6012
- value: formData.rccm || "",
6013
- placeholder: "Registre du Commerce et du Cr\\u00e9dit Mobilier",
6014
- onChange: handleInputChange
6015
- }
6016
- ),
6017
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6018
- TextInput,
6019
- {
6020
- label: "Forme juridique",
6021
- name: "legal_form",
6022
- value: formData.legal_form || "",
6023
- placeholder: "SARL, SA, SAS, etc.",
6024
- onChange: handleInputChange
6025
- }
6026
- ),
6027
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6028
- TextInput,
6029
- {
6030
- label: "R\\u00e9gime fiscal",
6031
- name: "tax_regime",
6032
- value: formData.tax_regime || "",
6033
- placeholder: "R\\u00e9gime fiscal",
6034
- onChange: handleInputChange
6035
- }
6036
- ),
6037
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6038
- TextInput,
6039
- {
6040
- label: "Ann\\u00e9e de fondation",
6041
- name: "year_founded",
6042
- value: formData.year_founded || "",
6043
- placeholder: "2020",
6044
- onChange: handleInputChange
6045
- }
6046
- ),
6047
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6048
- TextInput,
6049
- {
6050
- label: "Secteur d'activit\\u00e9",
6051
- name: "activity_sector",
6052
- value: formData.activity_sector || "",
6053
- placeholder: "Informatique, Commerce, etc.",
6054
- onChange: handleInputChange
6055
- }
6056
- )
6057
- ] }),
6058
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
6059
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Description" }),
6060
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6061
- "textarea",
6062
- {
6063
- name: "description",
6064
- value: formData.description || "",
6065
- onChange: handleTextareaChange,
6066
- rows: 3,
6067
- className: "w-full px-4 py-3 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#6B7C92] focus:border-transparent placeholder-gray-400",
6068
- placeholder: "Description de l'activit\\u00e9 de l'entit\\u00e9"
6069
- }
6070
- )
6071
- ] })
6072
- ] });
6073
- case "contacts":
6074
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-4", children: [
6075
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
6076
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6077
- InputField,
6078
- {
6079
- label: "T\\u00e9l\\u00e9phone",
6080
- name: "phone",
6081
- type: "tel",
6082
- value: formData.phone || "",
6083
- placeholder: "+225 XX XX XX XX XX",
6084
- onChange: handleInputChange
6085
- }
6086
- ),
6087
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6088
- InputField,
6089
- {
6090
- label: "Email",
6091
- name: "email",
6092
- type: "email",
6093
- value: formData.email || "",
6094
- placeholder: "contact@entite.com",
6095
- error: errors.email,
6096
- onChange: handleInputChange
6097
- }
6098
- )
6099
- ] }),
6100
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
6101
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6102
- TextInput,
6103
- {
6104
- label: "Pays",
6105
- name: "country",
6106
- value: formData.country || "",
6107
- placeholder: "C\\u00f4te d'Ivoire",
6108
- onChange: handleInputChange
6109
- }
6110
- ),
6111
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6112
- TextInput,
6113
- {
6114
- label: "Ville",
6115
- name: "city",
6116
- value: formData.city || "",
6117
- placeholder: "Abidjan",
6118
- onChange: handleInputChange
6119
- }
6120
- )
6121
- ] }),
6122
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
6123
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Adresse compl\\u00e8te" }),
6124
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6125
- "textarea",
6126
- {
6127
- name: "address",
6128
- value: formData.address || "",
6129
- onChange: handleTextareaChange,
6130
- rows: 3,
6131
- className: "w-full px-4 py-3 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#6B7C92] focus:border-transparent placeholder-gray-400",
6132
- placeholder: "Adresse compl\\u00e8te de l'entit\\u00e9"
6133
- }
6134
- )
6135
- ] })
6136
- ] });
6137
- case "representative":
6138
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-4", children: [
6139
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6140
- TextInput,
5992
+ }, [onSelect]);
5993
+ const showContextMenu = (0, import_react11.useCallback)((item, position) => {
5994
+ setContextMenu({
5995
+ visible: true,
5996
+ position,
5997
+ item
5998
+ });
5999
+ }, []);
6000
+ const hideContextMenu = (0, import_react11.useCallback)(() => {
6001
+ setContextMenu((prev) => ({ ...prev, visible: false }));
6002
+ }, []);
6003
+ const startRenaming = (0, import_react11.useCallback)((item) => {
6004
+ setRenamingItem(item);
6005
+ hideContextMenu();
6006
+ }, [hideContextMenu]);
6007
+ const stopRenaming = (0, import_react11.useCallback)(() => {
6008
+ setRenamingItem(null);
6009
+ }, []);
6010
+ const contextValue = (0, import_react11.useMemo)(
6011
+ () => ({
6012
+ data,
6013
+ currentFolder,
6014
+ currentFolderContents,
6015
+ pathHistory,
6016
+ selectedItems,
6017
+ viewMode,
6018
+ contextMenu,
6019
+ renamingItem,
6020
+ navigateToFolder,
6021
+ navigateBack,
6022
+ navigateToPath,
6023
+ selectItem,
6024
+ deselectAll,
6025
+ setViewMode,
6026
+ showContextMenu,
6027
+ hideContextMenu,
6028
+ startRenaming,
6029
+ stopRenaming,
6030
+ onCreateFolder,
6031
+ onUploadFiles,
6032
+ onRename,
6033
+ onDelete,
6034
+ onDownload,
6035
+ onOpen,
6036
+ allowUpload,
6037
+ allowCreateFolder,
6038
+ allowRename,
6039
+ allowDelete,
6040
+ allowDownload,
6041
+ allowMultiSelect,
6042
+ texts
6043
+ }),
6044
+ [
6045
+ data,
6046
+ currentFolder,
6047
+ currentFolderContents,
6048
+ pathHistory,
6049
+ selectedItems,
6050
+ viewMode,
6051
+ contextMenu,
6052
+ renamingItem,
6053
+ navigateToFolder,
6054
+ navigateBack,
6055
+ navigateToPath,
6056
+ selectItem,
6057
+ deselectAll,
6058
+ showContextMenu,
6059
+ hideContextMenu,
6060
+ startRenaming,
6061
+ stopRenaming,
6062
+ onCreateFolder,
6063
+ onUploadFiles,
6064
+ onRename,
6065
+ onDelete,
6066
+ onDownload,
6067
+ onOpen,
6068
+ allowUpload,
6069
+ allowCreateFolder,
6070
+ allowRename,
6071
+ allowDelete,
6072
+ allowDownload,
6073
+ allowMultiSelect,
6074
+ texts
6075
+ ]
6076
+ );
6077
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FileManagerContext.Provider, { value: contextValue, children });
6078
+ };
6079
+
6080
+ // src/components/common/FileManager/components/FolderTree.tsx
6081
+ var import_react12 = require("react");
6082
+ var import_lucide_react8 = require("lucide-react");
6083
+ var import_jsx_runtime16 = require("react/jsx-runtime");
6084
+ var FolderTreeItem = ({ item, level }) => {
6085
+ const { currentFolder, navigateToFolder, pathHistory } = useFileManager();
6086
+ const [isExpanded, setIsExpanded] = (0, import_react12.useState)(
6087
+ pathHistory.some((f) => f.id === item.id) || level === 0
6088
+ );
6089
+ const isSelected = currentFolder?.id === item.id;
6090
+ const hasChildren = item.children?.some((child) => child.type === "folder");
6091
+ const folderChildren = item.children?.filter((child) => child.type === "folder") || [];
6092
+ const handleToggle = (e) => {
6093
+ e.stopPropagation();
6094
+ setIsExpanded(!isExpanded);
6095
+ };
6096
+ const handleClick = () => {
6097
+ navigateToFolder(item);
6098
+ if (!isExpanded) {
6099
+ setIsExpanded(true);
6100
+ }
6101
+ };
6102
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
6103
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
6104
+ "div",
6105
+ {
6106
+ className: cn(
6107
+ "flex items-center gap-1 py-1.5 px-2 rounded-lg cursor-pointer transition-colors",
6108
+ "hover:bg-gray-100 dark:hover:bg-gray-800",
6109
+ isSelected && "bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300"
6110
+ ),
6111
+ style: { paddingLeft: `${level * 12 + 8}px` },
6112
+ onClick: handleClick,
6113
+ children: [
6114
+ hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6115
+ "button",
6141
6116
  {
6142
- label: "Nom du repr\\u00e9sentant l\\u00e9gal",
6143
- name: "legal_representative_name",
6144
- value: formData.legal_representative_name || "",
6145
- placeholder: "Nom et pr\\u00e9nom du repr\\u00e9sentant",
6146
- onChange: handleInputChange
6117
+ onClick: handleToggle,
6118
+ className: "p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",
6119
+ children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react8.ChevronDown, { className: "w-4 h-4 text-gray-500 dark:text-gray-400" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react8.ChevronRight, { className: "w-4 h-4 text-gray-500 dark:text-gray-400" })
6147
6120
  }
6148
- ),
6149
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6150
- TextInput,
6121
+ ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-5" }),
6122
+ isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react8.FolderOpen, { className: "w-4 h-4 text-yellow-500 flex-shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react8.Folder, { className: "w-4 h-4 text-yellow-500 flex-shrink-0" }),
6123
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6124
+ "span",
6151
6125
  {
6152
- label: "Fonction du repr\\u00e9sentant",
6153
- name: "legal_representative_fonction",
6154
- value: formData.legal_representative_fonction || "",
6155
- placeholder: "Directeur G\\u00e9n\\u00e9ral, G\\u00e9rant, etc.",
6156
- onChange: handleInputChange
6126
+ className: cn(
6127
+ "text-sm truncate",
6128
+ isSelected ? "font-medium" : "text-gray-700 dark:text-gray-300"
6129
+ ),
6130
+ children: item.name
6157
6131
  }
6158
- ),
6159
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
6160
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6161
- InputField,
6162
- {
6163
- label: "T\\u00e9l\\u00e9phone du repr\\u00e9sentant",
6164
- name: "legal_representative_phone",
6165
- type: "tel",
6166
- value: formData.legal_representative_phone || "",
6167
- placeholder: "+225 XX XX XX XX XX",
6168
- onChange: handleInputChange
6169
- }
6170
- ),
6171
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6172
- InputField,
6173
- {
6174
- label: "Email du repr\\u00e9sentant",
6175
- name: "legal_representative_email",
6176
- type: "email",
6177
- value: formData.legal_representative_email || "",
6178
- placeholder: "representant@entite.com",
6179
- onChange: handleInputChange
6180
- }
6181
- ),
6182
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6183
- TextInput,
6184
- {
6185
- label: "Type de document d'identit\\u00e9",
6186
- name: "legal_representative_id_document",
6187
- value: formData.legal_representative_id_document || "",
6188
- placeholder: "CNI, Passeport, etc.",
6189
- onChange: handleInputChange
6190
- }
6191
- ),
6192
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6193
- TextInput,
6194
- {
6195
- label: "Num\\u00e9ro de document d'identit\\u00e9",
6196
- name: "legal_representative_id_number",
6197
- value: formData.legal_representative_id_number || "",
6198
- placeholder: "Num\\u00e9ro du document",
6199
- onChange: handleInputChange
6200
- }
6201
- )
6202
- ] }),
6203
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
6204
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Adresse du repr\\u00e9sentant" }),
6205
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6206
- "textarea",
6207
- {
6208
- name: "legal_representative_address",
6209
- value: formData.legal_representative_address || "",
6210
- onChange: handleTextareaChange,
6211
- rows: 3,
6212
- className: "w-full px-4 py-3 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#6B7C92] focus:border-transparent placeholder-gray-400",
6213
- placeholder: "Adresse du repr\\u00e9sentant l\\u00e9gal"
6214
- }
6215
- )
6216
- ] })
6217
- ] });
6218
- case "accounting":
6219
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-4", children: [
6220
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6221
- SelectAccount,
6222
- {
6223
- value: formData.account,
6224
- filterClass: "4",
6225
- onSelect: (option) => {
6226
- setFormData((prev) => ({
6227
- ...prev,
6228
- account: option.value,
6229
- accounting_account_number: option.object?.account_number || ""
6230
- }));
6231
- }
6232
- }
6233
- ),
6234
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
6235
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6236
- TextInput,
6237
- {
6238
- label: "Numero de compte (manuel)",
6239
- name: "accounting_account_number",
6240
- value: formData.accounting_account_number || "",
6241
- placeholder: "Numero de compte comptable",
6242
- onChange: handleInputChange
6243
- }
6244
- ),
6245
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6246
- TextInput,
6247
- {
6248
- label: "Capital",
6249
- name: "capital",
6250
- value: formData.capital?.toString() || "",
6251
- placeholder: "Capital social",
6252
- onChange: handleInputChange
6253
- }
6254
- ),
6255
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6256
- TextInput,
6257
- {
6258
- label: "Chiffre d'affaires annuel",
6259
- name: "annual_turnover",
6260
- value: formData.annual_turnover?.toString() || "",
6261
- placeholder: "Chiffre d'affaires",
6262
- onChange: handleInputChange
6263
- }
6264
- ),
6265
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6266
- TextInput,
6267
- {
6268
- label: "Delai de paiement (jours)",
6269
- name: "payment_delay",
6270
- value: formData.payment_delay?.toString() || "",
6271
- placeholder: "30",
6272
- onChange: handleInputChange
6273
- }
6274
- )
6275
- ] })
6276
- ] });
6277
- case "banking":
6278
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-4", children: [
6279
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
6280
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6281
- TextInput,
6282
- {
6283
- label: "RIB",
6284
- name: "rib",
6285
- value: formData.rib || "",
6286
- placeholder: "Relev\\u00e9 d'Identit\\u00e9 Bancaire",
6287
- onChange: handleInputChange
6288
- }
6289
- ),
6290
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6291
- TextInput,
6292
- {
6293
- label: "IBAN",
6294
- name: "iban",
6295
- value: formData.iban || "",
6296
- placeholder: "CI93 1234 5678 9012 3456 789",
6297
- error: errors.iban,
6298
- onChange: handleInputChange
6299
- }
6300
- )
6301
- ] }),
6302
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6303
- TextInput,
6304
- {
6305
- label: "Nom de la banque",
6306
- name: "bank_name",
6307
- value: formData.bank_name || "",
6308
- placeholder: "Nom de la banque",
6309
- onChange: handleInputChange
6310
- }
6311
- ),
6312
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
6313
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6314
- InputField,
6315
- {
6316
- label: "Email de la banque",
6317
- name: "bank_email",
6318
- type: "email",
6319
- value: formData.bank_email || "",
6320
- placeholder: "contact@banque.com",
6321
- onChange: handleInputChange
6322
- }
6323
- ),
6324
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6325
- InputField,
6326
- {
6327
- label: "T\\u00e9l\\u00e9phone de la banque",
6328
- name: "bank_phone",
6329
- type: "tel",
6330
- value: formData.bank_phone || "",
6331
- placeholder: "+225 XX XX XX XX XX",
6332
- onChange: handleInputChange
6333
- }
6334
- )
6335
- ] }),
6336
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
6337
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Adresse de la banque" }),
6338
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6339
- "textarea",
6340
- {
6341
- name: "bank_address",
6342
- value: formData.bank_address || "",
6343
- onChange: handleTextareaChange,
6344
- rows: 2,
6345
- className: "w-full px-4 py-3 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#6B7C92] focus:border-transparent placeholder-gray-400",
6346
- placeholder: "Adresse de la banque"
6347
- }
6348
- )
6349
- ] })
6350
- ] });
6351
- default:
6352
- return null;
6353
- }
6132
+ )
6133
+ ]
6134
+ }
6135
+ ),
6136
+ isExpanded && folderChildren.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { children: folderChildren.map((child) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FolderTreeItem, { item: child, level: level + 1 }, child.id)) })
6137
+ ] });
6138
+ };
6139
+ var FolderTree = () => {
6140
+ const { data, currentFolder, navigateToFolder } = useFileManager();
6141
+ const rootItem = {
6142
+ id: "__root__",
6143
+ name: "Fichiers",
6144
+ type: "folder",
6145
+ path: "/",
6146
+ children: data
6354
6147
  };
6355
- if (!isOpen) return null;
6356
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
6357
- Modals_default,
6358
- {
6359
- title: object ? "Modifier le fournisseur" : "Ajouter un fournisseur",
6360
- width: "w-[100%]",
6361
- description: "",
6362
- open: isOpen,
6363
- onClose,
6364
- children: [
6365
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "border-b border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("nav", { className: "flex space-x-8 px-6", children: tabs.map((tab) => {
6366
- const Icon = tab.icon;
6367
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
6368
- "button",
6369
- {
6370
- type: "button",
6371
- onClick: () => setActiveTab(tab.id),
6372
- className: `
6373
- flex items-center space-x-2 py-4 px-2 text-sm font-medium border-b-2 transition-colors
6374
- ${activeTab === tab.id ? "border-[#6A8A82] text-[#6A8A82]" : "border-transparent text-[#767676] hover:text-[#6A8A82] hover:border-[#6A8A82]/30"}
6375
- `,
6376
- children: [
6377
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, { className: "w-4 h-4 inline mr-2" }),
6378
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: tab.label })
6379
- ]
6380
- },
6381
- tab.id
6382
- );
6383
- }) }) }),
6384
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("form", { onSubmit: handleSubmit, className: "p-6", children: [
6385
- renderTabContent(),
6386
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex justify-between pt-6 border-t border-gray-200 mt-8", children: [
6387
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6388
- "button",
6389
- {
6390
- type: "button",
6391
- onClick: onClose,
6392
- className: "px-6 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors",
6393
- children: "Annuler"
6394
- }
6395
- ),
6396
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6397
- Buttons_default,
6398
- {
6399
- type: "submit",
6400
- disabled: loading,
6401
- children: loading ? "Chargement..." : object ? "Modifier" : "Enregistrer le fournisseur"
6402
- }
6403
- )
6404
- ] })
6405
- ] })
6406
- ]
6407
- }
6408
- );
6148
+ const isRootSelected = currentFolder?.id === "__root__";
6149
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "h-full overflow-y-auto py-2", children: [
6150
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
6151
+ "div",
6152
+ {
6153
+ className: cn(
6154
+ "flex items-center gap-2 py-1.5 px-3 rounded-lg cursor-pointer transition-colors mb-1",
6155
+ "hover:bg-gray-100 dark:hover:bg-gray-800",
6156
+ isRootSelected && "bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300"
6157
+ ),
6158
+ onClick: () => navigateToFolder(rootItem),
6159
+ children: [
6160
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react8.Folder, { className: "w-4 h-4 text-yellow-500" }),
6161
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: cn("text-sm", isRootSelected && "font-medium"), children: rootItem.name })
6162
+ ]
6163
+ }
6164
+ ),
6165
+ data.filter((item) => item.type === "folder").map((folder) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FolderTreeItem, { item: folder, level: 1 }, folder.id))
6166
+ ] });
6409
6167
  };
6410
- var MinimalVendorForm = FormVendor;
6411
6168
 
6412
- // src/components/common/FormClient.tsx
6413
- var import_react21 = require("react");
6169
+ // src/components/common/FileManager/components/FileGrid.tsx
6170
+ var import_lucide_react10 = require("lucide-react");
6414
6171
 
6415
- // src/components/common/FileManager/FileManager.tsx
6416
- var import_react18 = require("react");
6417
- var import_lucide_react16 = require("lucide-react");
6172
+ // src/components/common/FileManager/components/FileCard.tsx
6173
+ var import_react13 = require("react");
6418
6174
 
6419
- // src/components/common/FileManager/FileManagerContext.tsx
6420
- var import_react12 = require("react");
6421
- var import_jsx_runtime16 = require("react/jsx-runtime");
6422
- var defaultTexts = {
6423
- createFolder: "Cr\xE9er un dossier",
6424
- uploadFiles: "Uploader des fichiers",
6425
- rename: "Renommer",
6426
- delete: "Supprimer",
6427
- download: "T\xE9l\xE9charger",
6428
- open: "Ouvrir",
6429
- deselectAll: "Tout d\xE9s\xE9lectionner",
6430
- newFolderName: "Nom du dossier",
6431
- confirmDelete: "Voulez-vous vraiment supprimer",
6432
- noFiles: "Aucun fichier",
6433
- dropFilesHere: "D\xE9posez vos fichiers ici",
6434
- cancel: "Annuler",
6435
- confirm: "Confirmer"
6436
- };
6437
- var FileManagerContext = (0, import_react12.createContext)(null);
6438
- var useFileManager = () => {
6439
- const context = (0, import_react12.useContext)(FileManagerContext);
6440
- if (!context) {
6441
- throw new Error("useFileManager must be used within a FileManagerProvider");
6442
- }
6443
- return context;
6444
- };
6445
- var FileManagerProvider = ({
6446
- children,
6447
- data,
6448
- rootName = "Fichiers",
6449
- viewMode: initialViewMode = "grid",
6450
- allowMultiSelect = true,
6451
- allowUpload = true,
6452
- allowCreateFolder = true,
6453
- allowRename = true,
6454
- allowDelete = true,
6455
- allowDownload = true,
6456
- texts: customTexts = {},
6457
- onCreateFolder,
6458
- onUploadFiles,
6459
- onRename,
6460
- onDelete,
6461
- onDownload,
6462
- onOpen,
6463
- onSelect
6464
- }) => {
6465
- const rootFolder = (0, import_react12.useMemo)(
6466
- () => ({
6467
- id: "__root__",
6468
- name: rootName,
6469
- type: "folder",
6470
- path: "/",
6471
- children: data
6472
- }),
6473
- [data, rootName]
6474
- );
6475
- const [currentFolder, setCurrentFolder] = (0, import_react12.useState)(rootFolder);
6476
- const [pathHistory, setPathHistory] = (0, import_react12.useState)([rootFolder]);
6477
- const [selectedItems, setSelectedItems] = (0, import_react12.useState)([]);
6478
- const [viewMode, setViewMode] = (0, import_react12.useState)(initialViewMode);
6479
- const [renamingItem, setRenamingItem] = (0, import_react12.useState)(null);
6480
- const [contextMenu, setContextMenu] = (0, import_react12.useState)({
6481
- visible: false,
6482
- position: { x: 0, y: 0 },
6483
- item: null
6484
- });
6485
- const texts = (0, import_react12.useMemo)(() => ({ ...defaultTexts, ...customTexts }), [customTexts]);
6486
- const currentFolderContents = (0, import_react12.useMemo)(() => {
6487
- return currentFolder?.children || [];
6488
- }, [currentFolder]);
6489
- const navigateToFolder = (0, import_react12.useCallback)(
6490
- (folder) => {
6491
- if (!folder) {
6492
- setCurrentFolder(rootFolder);
6493
- setPathHistory([rootFolder]);
6494
- } else {
6495
- setCurrentFolder(folder);
6496
- setPathHistory((prev) => [...prev, folder]);
6497
- }
6498
- setSelectedItems([]);
6499
- setContextMenu({ visible: false, position: { x: 0, y: 0 }, item: null });
6500
- },
6501
- [rootFolder]
6502
- );
6503
- const navigateBack = (0, import_react12.useCallback)(() => {
6504
- if (pathHistory.length > 1) {
6505
- const newHistory = [...pathHistory];
6506
- newHistory.pop();
6507
- const previousFolder = newHistory[newHistory.length - 1];
6508
- setCurrentFolder(previousFolder);
6509
- setPathHistory(newHistory);
6510
- setSelectedItems([]);
6511
- }
6512
- }, [pathHistory]);
6513
- const navigateToPath = (0, import_react12.useCallback)(
6514
- (index) => {
6515
- if (index < pathHistory.length - 1) {
6516
- const newHistory = pathHistory.slice(0, index + 1);
6517
- setCurrentFolder(newHistory[newHistory.length - 1]);
6518
- setPathHistory(newHistory);
6519
- setSelectedItems([]);
6520
- }
6521
- },
6522
- [pathHistory]
6523
- );
6524
- const selectItem = (0, import_react12.useCallback)(
6525
- (item, multiSelect = false) => {
6526
- setSelectedItems((prev) => {
6527
- if (multiSelect && allowMultiSelect) {
6528
- const isSelected = prev.some((i) => i.id === item.id);
6529
- if (isSelected) {
6530
- return prev.filter((i) => i.id !== item.id);
6531
- }
6532
- return [...prev, item];
6533
- }
6534
- return [item];
6535
- });
6536
- if (onSelect) {
6537
- const newSelection = allowMultiSelect && multiSelect ? selectedItems.some((i) => i.id === item.id) ? selectedItems.filter((i) => i.id !== item.id) : [...selectedItems, item] : [item];
6538
- onSelect(newSelection);
6539
- }
6540
- },
6541
- [allowMultiSelect, onSelect, selectedItems]
6542
- );
6543
- const deselectAll = (0, import_react12.useCallback)(() => {
6544
- setSelectedItems([]);
6545
- if (onSelect) {
6546
- onSelect([]);
6547
- }
6548
- }, [onSelect]);
6549
- const showContextMenu = (0, import_react12.useCallback)((item, position) => {
6550
- setContextMenu({
6551
- visible: true,
6552
- position,
6553
- item
6554
- });
6555
- }, []);
6556
- const hideContextMenu = (0, import_react12.useCallback)(() => {
6557
- setContextMenu((prev) => ({ ...prev, visible: false }));
6558
- }, []);
6559
- const startRenaming = (0, import_react12.useCallback)((item) => {
6560
- setRenamingItem(item);
6561
- hideContextMenu();
6562
- }, [hideContextMenu]);
6563
- const stopRenaming = (0, import_react12.useCallback)(() => {
6564
- setRenamingItem(null);
6565
- }, []);
6566
- const contextValue = (0, import_react12.useMemo)(
6567
- () => ({
6568
- data,
6569
- currentFolder,
6570
- currentFolderContents,
6571
- pathHistory,
6572
- selectedItems,
6573
- viewMode,
6574
- contextMenu,
6575
- renamingItem,
6576
- navigateToFolder,
6577
- navigateBack,
6578
- navigateToPath,
6579
- selectItem,
6580
- deselectAll,
6581
- setViewMode,
6582
- showContextMenu,
6583
- hideContextMenu,
6584
- startRenaming,
6585
- stopRenaming,
6586
- onCreateFolder,
6587
- onUploadFiles,
6588
- onRename,
6589
- onDelete,
6590
- onDownload,
6591
- onOpen,
6592
- allowUpload,
6593
- allowCreateFolder,
6594
- allowRename,
6595
- allowDelete,
6596
- allowDownload,
6597
- allowMultiSelect,
6598
- texts
6599
- }),
6600
- [
6601
- data,
6602
- currentFolder,
6603
- currentFolderContents,
6604
- pathHistory,
6605
- selectedItems,
6606
- viewMode,
6607
- contextMenu,
6608
- renamingItem,
6609
- navigateToFolder,
6610
- navigateBack,
6611
- navigateToPath,
6612
- selectItem,
6613
- deselectAll,
6614
- showContextMenu,
6615
- hideContextMenu,
6616
- startRenaming,
6617
- stopRenaming,
6618
- onCreateFolder,
6619
- onUploadFiles,
6620
- onRename,
6621
- onDelete,
6622
- onDownload,
6623
- onOpen,
6624
- allowUpload,
6625
- allowCreateFolder,
6626
- allowRename,
6627
- allowDelete,
6628
- allowDownload,
6629
- allowMultiSelect,
6630
- texts
6631
- ]
6632
- );
6633
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FileManagerContext.Provider, { value: contextValue, children });
6634
- };
6635
-
6636
- // src/components/common/FileManager/components/FolderTree.tsx
6637
- var import_react13 = require("react");
6638
- var import_lucide_react9 = require("lucide-react");
6639
- var import_jsx_runtime17 = require("react/jsx-runtime");
6640
- var FolderTreeItem = ({ item, level }) => {
6641
- const { currentFolder, navigateToFolder, pathHistory } = useFileManager();
6642
- const [isExpanded, setIsExpanded] = (0, import_react13.useState)(
6643
- pathHistory.some((f) => f.id === item.id) || level === 0
6644
- );
6645
- const isSelected = currentFolder?.id === item.id;
6646
- const hasChildren = item.children?.some((child) => child.type === "folder");
6647
- const folderChildren = item.children?.filter((child) => child.type === "folder") || [];
6648
- const handleToggle = (e) => {
6649
- e.stopPropagation();
6650
- setIsExpanded(!isExpanded);
6651
- };
6652
- const handleClick = () => {
6653
- navigateToFolder(item);
6654
- if (!isExpanded) {
6655
- setIsExpanded(true);
6656
- }
6657
- };
6658
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
6659
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6660
- "div",
6661
- {
6662
- className: cn(
6663
- "flex items-center gap-1 py-1.5 px-2 rounded-lg cursor-pointer transition-colors",
6664
- "hover:bg-gray-100 dark:hover:bg-gray-800",
6665
- isSelected && "bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300"
6666
- ),
6667
- style: { paddingLeft: `${level * 12 + 8}px` },
6668
- onClick: handleClick,
6669
- children: [
6670
- hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6671
- "button",
6672
- {
6673
- onClick: handleToggle,
6674
- className: "p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",
6675
- children: isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react9.ChevronDown, { className: "w-4 h-4 text-gray-500 dark:text-gray-400" }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react9.ChevronRight, { className: "w-4 h-4 text-gray-500 dark:text-gray-400" })
6676
- }
6677
- ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "w-5" }),
6678
- isExpanded ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react9.FolderOpen, { className: "w-4 h-4 text-yellow-500 flex-shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react9.Folder, { className: "w-4 h-4 text-yellow-500 flex-shrink-0" }),
6679
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6680
- "span",
6681
- {
6682
- className: cn(
6683
- "text-sm truncate",
6684
- isSelected ? "font-medium" : "text-gray-700 dark:text-gray-300"
6685
- ),
6686
- children: item.name
6687
- }
6688
- )
6689
- ]
6690
- }
6691
- ),
6692
- isExpanded && folderChildren.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: folderChildren.map((child) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FolderTreeItem, { item: child, level: level + 1 }, child.id)) })
6693
- ] });
6694
- };
6695
- var FolderTree = () => {
6696
- const { data, currentFolder, navigateToFolder } = useFileManager();
6697
- const rootItem = {
6698
- id: "__root__",
6699
- name: "Fichiers",
6700
- type: "folder",
6701
- path: "/",
6702
- children: data
6703
- };
6704
- const isRootSelected = currentFolder?.id === "__root__";
6705
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "h-full overflow-y-auto py-2", children: [
6706
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6707
- "div",
6708
- {
6709
- className: cn(
6710
- "flex items-center gap-2 py-1.5 px-3 rounded-lg cursor-pointer transition-colors mb-1",
6711
- "hover:bg-gray-100 dark:hover:bg-gray-800",
6712
- isRootSelected && "bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300"
6713
- ),
6714
- onClick: () => navigateToFolder(rootItem),
6715
- children: [
6716
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react9.Folder, { className: "w-4 h-4 text-yellow-500" }),
6717
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: cn("text-sm", isRootSelected && "font-medium"), children: rootItem.name })
6718
- ]
6719
- }
6720
- ),
6721
- data.filter((item) => item.type === "folder").map((folder) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FolderTreeItem, { item: folder, level: 1 }, folder.id))
6722
- ] });
6723
- };
6724
-
6725
- // src/components/common/FileManager/components/FileGrid.tsx
6726
- var import_lucide_react11 = require("lucide-react");
6727
-
6728
- // src/components/common/FileManager/components/FileCard.tsx
6729
- var import_react14 = require("react");
6730
-
6731
- // src/components/common/FileManager/utils.ts
6732
- var import_lucide_react10 = require("lucide-react");
6733
- var getFileIcon = (mimeType, isFolder, isOpen) => {
6734
- if (isFolder) {
6735
- return isOpen ? import_lucide_react10.FolderOpen : import_lucide_react10.Folder;
6175
+ // src/components/common/FileManager/utils.ts
6176
+ var import_lucide_react9 = require("lucide-react");
6177
+ var getFileIcon = (mimeType, isFolder, isOpen) => {
6178
+ if (isFolder) {
6179
+ return isOpen ? import_lucide_react9.FolderOpen : import_lucide_react9.Folder;
6736
6180
  }
6737
6181
  if (!mimeType) {
6738
- return import_lucide_react10.File;
6182
+ return import_lucide_react9.File;
6739
6183
  }
6740
6184
  const type = mimeType.toLowerCase();
6741
6185
  if (type.startsWith("image/")) {
6742
- return import_lucide_react10.FileImage;
6186
+ return import_lucide_react9.FileImage;
6743
6187
  }
6744
6188
  if (type === "application/pdf") {
6745
- return import_lucide_react10.FileText;
6189
+ return import_lucide_react9.FileText;
6746
6190
  }
6747
6191
  if (type === "application/msword" || type === "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || type.includes("word")) {
6748
- return import_lucide_react10.FileType;
6192
+ return import_lucide_react9.FileType;
6749
6193
  }
6750
6194
  if (type === "application/vnd.ms-excel" || type === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || type.includes("excel") || type.includes("spreadsheet")) {
6751
- return import_lucide_react10.FileSpreadsheet;
6195
+ return import_lucide_react9.FileSpreadsheet;
6752
6196
  }
6753
6197
  if (type === "application/vnd.ms-powerpoint" || type === "application/vnd.openxmlformats-officedocument.presentationml.presentation" || type.includes("powerpoint") || type.includes("presentation")) {
6754
- return import_lucide_react10.FileType;
6198
+ return import_lucide_react9.FileType;
6755
6199
  }
6756
6200
  if (type === "application/zip" || type === "application/x-rar-compressed" || type === "application/x-7z-compressed" || type === "application/gzip" || type.includes("archive") || type.includes("compressed")) {
6757
- return import_lucide_react10.FileArchive;
6201
+ return import_lucide_react9.FileArchive;
6758
6202
  }
6759
6203
  if (type.startsWith("video/")) {
6760
- return import_lucide_react10.FileVideo;
6204
+ return import_lucide_react9.FileVideo;
6761
6205
  }
6762
6206
  if (type.startsWith("audio/")) {
6763
- return import_lucide_react10.FileAudio;
6207
+ return import_lucide_react9.FileAudio;
6764
6208
  }
6765
6209
  if (type.includes("javascript") || type.includes("typescript") || type.includes("json") || type.includes("xml") || type.includes("html") || type.includes("css")) {
6766
- return import_lucide_react10.FileCode;
6210
+ return import_lucide_react9.FileCode;
6767
6211
  }
6768
6212
  if (type.startsWith("text/")) {
6769
- return import_lucide_react10.FileText;
6213
+ return import_lucide_react9.FileText;
6770
6214
  }
6771
- return import_lucide_react10.File;
6215
+ return import_lucide_react9.File;
6772
6216
  };
6773
6217
  var formatFileSize = (bytes) => {
6774
6218
  if (bytes === void 0 || bytes === null) {
@@ -6798,7 +6242,7 @@ var formatDate = (date) => {
6798
6242
  };
6799
6243
 
6800
6244
  // src/components/common/FileManager/components/FileCard.tsx
6801
- var import_jsx_runtime18 = require("react/jsx-runtime");
6245
+ var import_jsx_runtime17 = require("react/jsx-runtime");
6802
6246
  var FileCard = ({ item, variant = "grid" }) => {
6803
6247
  const {
6804
6248
  selectedItems,
@@ -6812,19 +6256,19 @@ var FileCard = ({ item, variant = "grid" }) => {
6812
6256
  onDownload,
6813
6257
  allowRename
6814
6258
  } = useFileManager();
6815
- const [renameValue, setRenameValue] = (0, import_react14.useState)(item.name);
6816
- const inputRef = (0, import_react14.useRef)(null);
6259
+ const [renameValue, setRenameValue] = (0, import_react13.useState)(item.name);
6260
+ const inputRef = (0, import_react13.useRef)(null);
6817
6261
  const isSelected = selectedItems.some((i) => i.id === item.id);
6818
6262
  const isRenaming = renamingItem?.id === item.id;
6819
6263
  const isFolder = item.type === "folder";
6820
6264
  const Icon = getFileIcon(item.mimeType, isFolder);
6821
- (0, import_react14.useEffect)(() => {
6265
+ (0, import_react13.useEffect)(() => {
6822
6266
  if (isRenaming && inputRef.current) {
6823
6267
  inputRef.current.focus();
6824
6268
  inputRef.current.select();
6825
6269
  }
6826
6270
  }, [isRenaming]);
6827
- (0, import_react14.useEffect)(() => {
6271
+ (0, import_react13.useEffect)(() => {
6828
6272
  setRenameValue(item.name);
6829
6273
  }, [item.name]);
6830
6274
  const handleClick = (e) => {
@@ -6869,7 +6313,7 @@ var FileCard = ({ item, variant = "grid" }) => {
6869
6313
  }
6870
6314
  };
6871
6315
  if (variant === "list") {
6872
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
6316
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6873
6317
  "div",
6874
6318
  {
6875
6319
  className: cn(
@@ -6881,7 +6325,7 @@ var FileCard = ({ item, variant = "grid" }) => {
6881
6325
  onDoubleClick: handleDoubleClick,
6882
6326
  onContextMenu: handleContextMenu,
6883
6327
  children: [
6884
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6328
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6885
6329
  Icon,
6886
6330
  {
6887
6331
  className: cn(
@@ -6890,7 +6334,7 @@ var FileCard = ({ item, variant = "grid" }) => {
6890
6334
  )
6891
6335
  }
6892
6336
  ),
6893
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1 min-w-0", children: isRenaming ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6337
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex-1 min-w-0", children: isRenaming ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6894
6338
  "input",
6895
6339
  {
6896
6340
  ref: inputRef,
@@ -6902,14 +6346,14 @@ var FileCard = ({ item, variant = "grid" }) => {
6902
6346
  className: "w-full px-2 py-0.5 text-sm border border-blue-500 rounded outline-none bg-white dark:bg-gray-900",
6903
6347
  onClick: (e) => e.stopPropagation()
6904
6348
  }
6905
- ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "block truncate text-sm text-gray-900 dark:text-gray-100", children: item.name }) }),
6906
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-xs text-gray-500 dark:text-gray-400 w-20 text-right", children: !isFolder && formatFileSize(item.size) }),
6907
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-xs text-gray-500 dark:text-gray-400 w-24 text-right", children: formatDate(item.updatedAt || item.createdAt) })
6349
+ ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "block truncate text-sm text-gray-900 dark:text-gray-100", children: item.name }) }),
6350
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-xs text-gray-500 dark:text-gray-400 w-20 text-right", children: !isFolder && formatFileSize(item.size) }),
6351
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-xs text-gray-500 dark:text-gray-400 w-24 text-right", children: formatDate(item.updatedAt || item.createdAt) })
6908
6352
  ]
6909
6353
  }
6910
6354
  );
6911
6355
  }
6912
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
6356
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6913
6357
  "div",
6914
6358
  {
6915
6359
  className: cn(
@@ -6921,7 +6365,7 @@ var FileCard = ({ item, variant = "grid" }) => {
6921
6365
  onDoubleClick: handleDoubleClick,
6922
6366
  onContextMenu: handleContextMenu,
6923
6367
  children: [
6924
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-16 h-16 flex items-center justify-center mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6368
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w-16 h-16 flex items-center justify-center mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6925
6369
  Icon,
6926
6370
  {
6927
6371
  className: cn(
@@ -6930,7 +6374,7 @@ var FileCard = ({ item, variant = "grid" }) => {
6930
6374
  )
6931
6375
  }
6932
6376
  ) }),
6933
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-full text-center", children: isRenaming ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6377
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w-full text-center", children: isRenaming ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6934
6378
  "input",
6935
6379
  {
6936
6380
  ref: inputRef,
@@ -6942,15 +6386,15 @@ var FileCard = ({ item, variant = "grid" }) => {
6942
6386
  className: "w-full px-2 py-0.5 text-xs border border-blue-500 rounded outline-none text-center bg-white dark:bg-gray-900",
6943
6387
  onClick: (e) => e.stopPropagation()
6944
6388
  }
6945
- ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "block text-xs text-gray-900 dark:text-gray-100 truncate px-1", children: item.name }) }),
6946
- !isFolder && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-[10px] text-gray-500 dark:text-gray-400 mt-1", children: formatFileSize(item.size) })
6389
+ ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "block text-xs text-gray-900 dark:text-gray-100 truncate px-1", children: item.name }) }),
6390
+ !isFolder && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-[10px] text-gray-500 dark:text-gray-400 mt-1", children: formatFileSize(item.size) })
6947
6391
  ]
6948
6392
  }
6949
6393
  );
6950
6394
  };
6951
6395
 
6952
6396
  // src/components/common/FileManager/components/FileGrid.tsx
6953
- var import_jsx_runtime19 = require("react/jsx-runtime");
6397
+ var import_jsx_runtime18 = require("react/jsx-runtime");
6954
6398
  var FileGrid = () => {
6955
6399
  const { currentFolderContents, texts, deselectAll, hideContextMenu } = useFileManager();
6956
6400
  const sortedItems = [...currentFolderContents].sort((a, b) => {
@@ -6963,32 +6407,32 @@ var FileGrid = () => {
6963
6407
  hideContextMenu();
6964
6408
  };
6965
6409
  if (sortedItems.length === 0) {
6966
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
6410
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
6967
6411
  "div",
6968
6412
  {
6969
6413
  className: "flex-1 flex flex-col items-center justify-center text-gray-500 dark:text-gray-400 p-8",
6970
6414
  onClick: handleContainerClick,
6971
6415
  children: [
6972
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react11.FolderPlus, { className: "w-16 h-16 mb-4 opacity-50" }),
6973
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-lg", children: texts.noFiles }),
6974
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-sm mt-2", children: texts.dropFilesHere })
6416
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react10.FolderPlus, { className: "w-16 h-16 mb-4 opacity-50" }),
6417
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-lg", children: texts.noFiles }),
6418
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm mt-2", children: texts.dropFilesHere })
6975
6419
  ]
6976
6420
  }
6977
6421
  );
6978
6422
  }
6979
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
6423
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6980
6424
  "div",
6981
6425
  {
6982
6426
  className: "flex-1 overflow-y-auto p-4",
6983
6427
  onClick: handleContainerClick,
6984
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-2", children: sortedItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(FileCard, { item, variant: "grid" }, item.id)) })
6428
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-2", children: sortedItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FileCard, { item, variant: "grid" }, item.id)) })
6985
6429
  }
6986
6430
  );
6987
6431
  };
6988
6432
 
6989
6433
  // src/components/common/FileManager/components/FileList.tsx
6990
- var import_lucide_react12 = require("lucide-react");
6991
- var import_jsx_runtime20 = require("react/jsx-runtime");
6434
+ var import_lucide_react11 = require("lucide-react");
6435
+ var import_jsx_runtime19 = require("react/jsx-runtime");
6992
6436
  var FileList = () => {
6993
6437
  const { currentFolderContents, texts, deselectAll, hideContextMenu } = useFileManager();
6994
6438
  const sortedItems = [...currentFolderContents].sort((a, b) => {
@@ -7001,46 +6445,46 @@ var FileList = () => {
7001
6445
  hideContextMenu();
7002
6446
  };
7003
6447
  if (sortedItems.length === 0) {
7004
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
6448
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
7005
6449
  "div",
7006
6450
  {
7007
6451
  className: "flex-1 flex flex-col items-center justify-center text-gray-500 dark:text-gray-400 p-8",
7008
6452
  onClick: handleContainerClick,
7009
6453
  children: [
7010
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react12.FolderPlus, { className: "w-16 h-16 mb-4 opacity-50" }),
7011
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-lg", children: texts.noFiles }),
7012
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm mt-2", children: texts.dropFilesHere })
6454
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react11.FolderPlus, { className: "w-16 h-16 mb-4 opacity-50" }),
6455
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-lg", children: texts.noFiles }),
6456
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-sm mt-2", children: texts.dropFilesHere })
7013
6457
  ]
7014
6458
  }
7015
6459
  );
7016
6460
  }
7017
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
6461
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
7018
6462
  "div",
7019
6463
  {
7020
6464
  className: "flex-1 overflow-y-auto p-4",
7021
6465
  onClick: handleContainerClick,
7022
6466
  children: [
7023
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-3 px-3 py-2 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider border-b border-gray-200 dark:border-gray-700 mb-2", children: [
7024
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-5" }),
6467
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-3 px-3 py-2 text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider border-b border-gray-200 dark:border-gray-700 mb-2", children: [
6468
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-5" }),
7025
6469
  " ",
7026
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex-1", children: "Nom" }),
7027
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-20 text-right", children: "Taille" }),
7028
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-24 text-right", children: "Modifi\xE9" })
6470
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "flex-1", children: "Nom" }),
6471
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-20 text-right", children: "Taille" }),
6472
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "w-24 text-right", children: "Modifi\xE9" })
7029
6473
  ] }),
7030
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "space-y-1", children: sortedItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(FileCard, { item, variant: "list" }, item.id)) })
6474
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "space-y-1", children: sortedItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(FileCard, { item, variant: "list" }, item.id)) })
7031
6475
  ]
7032
6476
  }
7033
6477
  );
7034
6478
  };
7035
6479
 
7036
6480
  // src/components/common/FileManager/components/Breadcrumb.tsx
7037
- var import_react15 = __toESM(require("react"), 1);
7038
- var import_lucide_react13 = require("lucide-react");
7039
- var import_jsx_runtime21 = require("react/jsx-runtime");
6481
+ var import_react14 = __toESM(require("react"), 1);
6482
+ var import_lucide_react12 = require("lucide-react");
6483
+ var import_jsx_runtime20 = require("react/jsx-runtime");
7040
6484
  var Breadcrumb = () => {
7041
6485
  const { pathHistory, navigateBack, navigateToPath } = useFileManager();
7042
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1 px-2 py-2 bg-gray-50 dark:bg-gray-800/50 rounded-lg", children: [
7043
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
6486
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1 px-2 py-2 bg-gray-50 dark:bg-gray-800/50 rounded-lg", children: [
6487
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7044
6488
  "button",
7045
6489
  {
7046
6490
  onClick: navigateBack,
@@ -7050,12 +6494,12 @@ var Breadcrumb = () => {
7050
6494
  pathHistory.length > 1 ? "hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300" : "text-gray-400 dark:text-gray-600 cursor-not-allowed"
7051
6495
  ),
7052
6496
  title: "Retour",
7053
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react13.ChevronLeft, { className: "w-4 h-4" })
6497
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react12.ChevronLeft, { className: "w-4 h-4" })
7054
6498
  }
7055
6499
  ),
7056
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex items-center gap-1 overflow-x-auto scrollbar-thin", children: pathHistory.map((folder, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react15.default.Fragment, { children: [
7057
- index > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react13.ChevronRight, { className: "w-4 h-4 text-gray-400 dark:text-gray-600 flex-shrink-0" }),
7058
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
6500
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex items-center gap-1 overflow-x-auto scrollbar-thin", children: pathHistory.map((folder, index) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react14.default.Fragment, { children: [
6501
+ index > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react12.ChevronRight, { className: "w-4 h-4 text-gray-400 dark:text-gray-600 flex-shrink-0" }),
6502
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7059
6503
  "button",
7060
6504
  {
7061
6505
  onClick: () => navigateToPath(index),
@@ -7071,18 +6515,18 @@ var Breadcrumb = () => {
7071
6515
  };
7072
6516
 
7073
6517
  // src/components/common/FileManager/components/Toolbar.tsx
7074
- var import_react16 = __toESM(require("react"), 1);
7075
- var import_lucide_react14 = require("lucide-react");
7076
- var import_jsx_runtime22 = require("react/jsx-runtime");
6518
+ var import_react15 = __toESM(require("react"), 1);
6519
+ var import_lucide_react13 = require("lucide-react");
6520
+ var import_jsx_runtime21 = require("react/jsx-runtime");
7077
6521
  var CreateFolderModal = ({
7078
6522
  isOpen,
7079
6523
  onClose,
7080
6524
  onSubmit,
7081
6525
  texts
7082
6526
  }) => {
7083
- const [folderName, setFolderName] = (0, import_react16.useState)("");
7084
- const inputRef = (0, import_react16.useRef)(null);
7085
- import_react16.default.useEffect(() => {
6527
+ const [folderName, setFolderName] = (0, import_react15.useState)("");
6528
+ const inputRef = (0, import_react15.useRef)(null);
6529
+ import_react15.default.useEffect(() => {
7086
6530
  if (isOpen && inputRef.current) {
7087
6531
  inputRef.current.focus();
7088
6532
  }
@@ -7099,21 +6543,21 @@ var CreateFolderModal = ({
7099
6543
  }
7100
6544
  };
7101
6545
  if (!isOpen) return null;
7102
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "bg-white dark:bg-gray-900 rounded-xl shadow-xl p-6 w-full max-w-md mx-4", children: [
7103
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [
7104
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h3", { className: "text-lg font-semibold text-gray-900 dark:text-gray-100", children: texts.createFolder }),
7105
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
6546
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "bg-white dark:bg-gray-900 rounded-xl shadow-xl p-6 w-full max-w-md mx-4", children: [
6547
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [
6548
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h3", { className: "text-lg font-semibold text-gray-900 dark:text-gray-100", children: texts.createFolder }),
6549
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7106
6550
  "button",
7107
6551
  {
7108
6552
  onClick: onClose,
7109
6553
  className: "p-1 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",
7110
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.X, { className: "w-5 h-5 text-gray-500" })
6554
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react13.X, { className: "w-5 h-5 text-gray-500" })
7111
6555
  }
7112
6556
  )
7113
6557
  ] }),
7114
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("form", { onSubmit: handleSubmit, children: [
7115
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2", children: texts.newFolderName }),
7116
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
6558
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("form", { onSubmit: handleSubmit, children: [
6559
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2", children: texts.newFolderName }),
6560
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7117
6561
  "input",
7118
6562
  {
7119
6563
  ref: inputRef,
@@ -7124,8 +6568,8 @@ var CreateFolderModal = ({
7124
6568
  placeholder: "Nouveau dossier"
7125
6569
  }
7126
6570
  ),
7127
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex justify-end gap-3 mt-6", children: [
7128
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
6571
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex justify-end gap-3 mt-6", children: [
6572
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7129
6573
  "button",
7130
6574
  {
7131
6575
  type: "button",
@@ -7134,7 +6578,7 @@ var CreateFolderModal = ({
7134
6578
  children: texts.cancel
7135
6579
  }
7136
6580
  ),
7137
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
6581
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7138
6582
  "button",
7139
6583
  {
7140
6584
  type: "submit",
@@ -7163,8 +6607,8 @@ var Toolbar = () => {
7163
6607
  allowUpload,
7164
6608
  texts
7165
6609
  } = useFileManager();
7166
- const [showCreateModal, setShowCreateModal] = (0, import_react16.useState)(false);
7167
- const fileInputRef = (0, import_react16.useRef)(null);
6610
+ const [showCreateModal, setShowCreateModal] = (0, import_react15.useState)(false);
6611
+ const fileInputRef = (0, import_react15.useRef)(null);
7168
6612
  const handleCreateFolder = async (name) => {
7169
6613
  if (onCreateFolder && currentFolder) {
7170
6614
  try {
@@ -7190,10 +6634,10 @@ var Toolbar = () => {
7190
6634
  fileInputRef.current.value = "";
7191
6635
  }
7192
6636
  };
7193
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
7194
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between gap-4 flex-wrap", children: [
7195
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
7196
- allowCreateFolder && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
6637
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
6638
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between gap-4 flex-wrap", children: [
6639
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
6640
+ allowCreateFolder && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
7197
6641
  "button",
7198
6642
  {
7199
6643
  onClick: () => setShowCreateModal(true),
@@ -7203,13 +6647,13 @@ var Toolbar = () => {
7203
6647
  "hover:bg-gray-200 dark:hover:bg-gray-700"
7204
6648
  ),
7205
6649
  children: [
7206
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.FolderPlus, { className: "w-4 h-4" }),
7207
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "hidden sm:inline", children: texts.createFolder })
6650
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react13.FolderPlus, { className: "w-4 h-4" }),
6651
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "hidden sm:inline", children: texts.createFolder })
7208
6652
  ]
7209
6653
  }
7210
6654
  ),
7211
- allowUpload && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
7212
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
6655
+ allowUpload && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
6656
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
7213
6657
  "button",
7214
6658
  {
7215
6659
  onClick: handleUploadClick,
@@ -7218,12 +6662,12 @@ var Toolbar = () => {
7218
6662
  "bg-blue-600 text-white hover:bg-blue-700"
7219
6663
  ),
7220
6664
  children: [
7221
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.Upload, { className: "w-4 h-4" }),
7222
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "hidden sm:inline", children: texts.uploadFiles })
6665
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react13.Upload, { className: "w-4 h-4" }),
6666
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "hidden sm:inline", children: texts.uploadFiles })
7223
6667
  ]
7224
6668
  }
7225
6669
  ),
7226
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
6670
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7227
6671
  "input",
7228
6672
  {
7229
6673
  ref: fileInputRef,
@@ -7236,14 +6680,14 @@ var Toolbar = () => {
7236
6680
  )
7237
6681
  ] })
7238
6682
  ] }),
7239
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
7240
- selectedItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
6683
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2", children: [
6684
+ selectedItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
7241
6685
  "button",
7242
6686
  {
7243
6687
  onClick: deselectAll,
7244
6688
  className: "flex items-center gap-2 px-3 py-2 text-sm text-gray-600 dark:text-gray-400\r\n hover:text-gray-900 dark:hover:text-gray-100 transition-colors",
7245
6689
  children: [
7246
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.X, { className: "w-4 h-4" }),
6690
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react13.X, { className: "w-4 h-4" }),
7247
6691
  texts.deselectAll,
7248
6692
  " (",
7249
6693
  selectedItems.length,
@@ -7251,8 +6695,8 @@ var Toolbar = () => {
7251
6695
  ]
7252
6696
  }
7253
6697
  ),
7254
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center bg-gray-100 dark:bg-gray-800 rounded-lg p-1", children: [
7255
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
6698
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center bg-gray-100 dark:bg-gray-800 rounded-lg p-1", children: [
6699
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7256
6700
  "button",
7257
6701
  {
7258
6702
  onClick: () => setViewMode("grid"),
@@ -7261,10 +6705,10 @@ var Toolbar = () => {
7261
6705
  viewMode === "grid" ? "bg-white dark:bg-gray-700 shadow-sm text-gray-900 dark:text-gray-100" : "text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"
7262
6706
  ),
7263
6707
  title: "Vue grille",
7264
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.Grid, { className: "w-4 h-4" })
6708
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react13.Grid, { className: "w-4 h-4" })
7265
6709
  }
7266
6710
  ),
7267
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
6711
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7268
6712
  "button",
7269
6713
  {
7270
6714
  onClick: () => setViewMode("list"),
@@ -7273,13 +6717,13 @@ var Toolbar = () => {
7273
6717
  viewMode === "list" ? "bg-white dark:bg-gray-700 shadow-sm text-gray-900 dark:text-gray-100" : "text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"
7274
6718
  ),
7275
6719
  title: "Vue liste",
7276
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.List, { className: "w-4 h-4" })
6720
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react13.List, { className: "w-4 h-4" })
7277
6721
  }
7278
6722
  )
7279
6723
  ] })
7280
6724
  ] })
7281
6725
  ] }),
7282
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
6726
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7283
6727
  CreateFolderModal,
7284
6728
  {
7285
6729
  isOpen: showCreateModal,
@@ -7292,9 +6736,9 @@ var Toolbar = () => {
7292
6736
  };
7293
6737
 
7294
6738
  // src/components/common/FileManager/components/ContextMenu.tsx
7295
- var import_react17 = require("react");
7296
- var import_lucide_react15 = require("lucide-react");
7297
- var import_jsx_runtime23 = require("react/jsx-runtime");
6739
+ var import_react16 = require("react");
6740
+ var import_lucide_react14 = require("lucide-react");
6741
+ var import_jsx_runtime22 = require("react/jsx-runtime");
7298
6742
  var ContextMenu = () => {
7299
6743
  const {
7300
6744
  contextMenu,
@@ -7309,8 +6753,8 @@ var ContextMenu = () => {
7309
6753
  allowDownload,
7310
6754
  texts
7311
6755
  } = useFileManager();
7312
- const menuRef = (0, import_react17.useRef)(null);
7313
- (0, import_react17.useEffect)(() => {
6756
+ const menuRef = (0, import_react16.useRef)(null);
6757
+ (0, import_react16.useEffect)(() => {
7314
6758
  const handleClickOutside = (e) => {
7315
6759
  if (menuRef.current && !menuRef.current.contains(e.target)) {
7316
6760
  hideContextMenu();
@@ -7380,14 +6824,14 @@ var ContextMenu = () => {
7380
6824
  menuStyle.top = position.y - menuHeight;
7381
6825
  }
7382
6826
  }
7383
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
6827
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
7384
6828
  "div",
7385
6829
  {
7386
6830
  ref: menuRef,
7387
6831
  style: menuStyle,
7388
6832
  className: "bg-white dark:bg-gray-900 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 py-1 min-w-[160px]",
7389
6833
  children: [
7390
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
6834
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
7391
6835
  "button",
7392
6836
  {
7393
6837
  onClick: handleOpen,
@@ -7396,12 +6840,12 @@ var ContextMenu = () => {
7396
6840
  "text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"
7397
6841
  ),
7398
6842
  children: [
7399
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react15.FolderOpen, { className: "w-4 h-4" }),
6843
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.FolderOpen, { className: "w-4 h-4" }),
7400
6844
  texts.open
7401
6845
  ]
7402
6846
  }
7403
6847
  ),
7404
- allowRename && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
6848
+ allowRename && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
7405
6849
  "button",
7406
6850
  {
7407
6851
  onClick: handleRename,
@@ -7410,12 +6854,12 @@ var ContextMenu = () => {
7410
6854
  "text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"
7411
6855
  ),
7412
6856
  children: [
7413
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react15.Edit3, { className: "w-4 h-4" }),
6857
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.Edit3, { className: "w-4 h-4" }),
7414
6858
  texts.rename
7415
6859
  ]
7416
6860
  }
7417
6861
  ),
7418
- allowDownload && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
6862
+ allowDownload && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
7419
6863
  "button",
7420
6864
  {
7421
6865
  onClick: handleDownload,
@@ -7424,14 +6868,14 @@ var ContextMenu = () => {
7424
6868
  "text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"
7425
6869
  ),
7426
6870
  children: [
7427
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react15.Download, { className: "w-4 h-4" }),
6871
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.Download, { className: "w-4 h-4" }),
7428
6872
  texts.download
7429
6873
  ]
7430
6874
  }
7431
6875
  ),
7432
- allowDelete && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
7433
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "border-t border-gray-200 dark:border-gray-700 my-1" }),
7434
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
6876
+ allowDelete && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
6877
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "border-t border-gray-200 dark:border-gray-700 my-1" }),
6878
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
7435
6879
  "button",
7436
6880
  {
7437
6881
  onClick: handleDelete,
@@ -7440,7 +6884,7 @@ var ContextMenu = () => {
7440
6884
  "text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors"
7441
6885
  ),
7442
6886
  children: [
7443
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react15.Trash2, { className: "w-4 h-4" }),
6887
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react14.Trash2, { className: "w-4 h-4" }),
7444
6888
  texts.delete
7445
6889
  ]
7446
6890
  }
@@ -7452,14 +6896,14 @@ var ContextMenu = () => {
7452
6896
  };
7453
6897
 
7454
6898
  // src/components/common/FileManager/FileManager.tsx
7455
- var import_jsx_runtime24 = require("react/jsx-runtime");
6899
+ var import_jsx_runtime23 = require("react/jsx-runtime");
7456
6900
  var FileManagerContent = ({ className }) => {
7457
6901
  const { viewMode, hideContextMenu } = useFileManager();
7458
- const [sidebarOpen, setSidebarOpen] = (0, import_react18.useState)(false);
6902
+ const [sidebarOpen, setSidebarOpen] = (0, import_react17.useState)(false);
7459
6903
  const handleMainClick = () => {
7460
6904
  hideContextMenu();
7461
6905
  };
7462
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
6906
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
7463
6907
  "div",
7464
6908
  {
7465
6909
  className: cn(
@@ -7468,7 +6912,7 @@ var FileManagerContent = ({ className }) => {
7468
6912
  ),
7469
6913
  onClick: handleMainClick,
7470
6914
  children: [
7471
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
6915
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7472
6916
  "button",
7473
6917
  {
7474
6918
  onClick: (e) => {
@@ -7476,17 +6920,17 @@ var FileManagerContent = ({ className }) => {
7476
6920
  setSidebarOpen(!sidebarOpen);
7477
6921
  },
7478
6922
  className: "md:hidden fixed bottom-4 left-4 z-50 p-3 bg-blue-600 text-white rounded-full shadow-lg hover:bg-blue-700 transition-colors",
7479
- children: sidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react16.X, { className: "w-6 h-6" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react16.Menu, { className: "w-6 h-6" })
6923
+ children: sidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react15.X, { className: "w-6 h-6" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react15.Menu, { className: "w-6 h-6" })
7480
6924
  }
7481
6925
  ),
7482
- sidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
6926
+ sidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7483
6927
  "div",
7484
6928
  {
7485
6929
  className: "md:hidden fixed inset-0 bg-black/50 z-40",
7486
6930
  onClick: () => setSidebarOpen(false)
7487
6931
  }
7488
6932
  ),
7489
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
6933
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
7490
6934
  "aside",
7491
6935
  {
7492
6936
  className: cn(
@@ -7496,33 +6940,33 @@ var FileManagerContent = ({ className }) => {
7496
6940
  sidebarOpen ? "translate-x-0" : "-translate-x-full md:translate-x-0"
7497
6941
  ),
7498
6942
  children: [
7499
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "p-3 border-b border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: "Dossiers" }) }),
7500
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FolderTree, {})
6943
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "p-3 border-b border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h2", { className: "text-sm font-semibold text-gray-900 dark:text-gray-100", children: "Dossiers" }) }),
6944
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FolderTree, {})
7501
6945
  ]
7502
6946
  }
7503
6947
  ),
7504
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("main", { className: "flex-1 flex flex-col min-w-0", children: [
7505
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("header", { className: "p-4 border-b border-gray-200 dark:border-gray-800 space-y-3", children: [
7506
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Toolbar, {}),
7507
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Breadcrumb, {})
6948
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("main", { className: "flex-1 flex flex-col min-w-0", children: [
6949
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("header", { className: "p-4 border-b border-gray-200 dark:border-gray-800 space-y-3", children: [
6950
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Toolbar, {}),
6951
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Breadcrumb, {})
7508
6952
  ] }),
7509
- viewMode === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FileGrid, {}) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FileList, {})
6953
+ viewMode === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FileGrid, {}) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FileList, {})
7510
6954
  ] }),
7511
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ContextMenu, {})
6955
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ContextMenu, {})
7512
6956
  ]
7513
6957
  }
7514
6958
  );
7515
6959
  };
7516
6960
  var FileManager = (props) => {
7517
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FileManagerProvider, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FileManagerContent, { className: props.className }) });
6961
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FileManagerProvider, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FileManagerContent, { className: props.className }) });
7518
6962
  };
7519
6963
 
7520
6964
  // src/components/common/FileManager/components/EntityFileManager.tsx
7521
- var import_react20 = __toESM(require("react"), 1);
7522
- var import_lucide_react17 = require("lucide-react");
6965
+ var import_react19 = __toESM(require("react"), 1);
6966
+ var import_lucide_react16 = require("lucide-react");
7523
6967
 
7524
6968
  // src/components/common/FileManager/hooks/useFileManagerApi.ts
7525
- var import_react19 = require("react");
6969
+ var import_react18 = require("react");
7526
6970
 
7527
6971
  // src/components/common/FileManager/services/fileManagerApi.ts
7528
6972
  var API_BASE = "/api/files_manager";
@@ -7747,11 +7191,11 @@ function extractRootChildren(entityFolder) {
7747
7191
  return entityFolder.children || [];
7748
7192
  }
7749
7193
  function useFileManagerApi(entityType, entityId, businessEntityId) {
7750
- const [data, setData] = (0, import_react19.useState)([]);
7751
- const [loading, setLoading] = (0, import_react19.useState)(true);
7752
- const [error, setError] = (0, import_react19.useState)(null);
7753
- const [rootFolderCode, setRootFolderCode] = (0, import_react19.useState)(null);
7754
- const loadEntityFolders = (0, import_react19.useCallback)(async () => {
7194
+ const [data, setData] = (0, import_react18.useState)([]);
7195
+ const [loading, setLoading] = (0, import_react18.useState)(true);
7196
+ const [error, setError] = (0, import_react18.useState)(null);
7197
+ const [rootFolderCode, setRootFolderCode] = (0, import_react18.useState)(null);
7198
+ const loadEntityFolders = (0, import_react18.useCallback)(async () => {
7755
7199
  setLoading(true);
7756
7200
  setError(null);
7757
7201
  try {
@@ -7784,13 +7228,13 @@ function useFileManagerApi(entityType, entityId, businessEntityId) {
7784
7228
  setLoading(false);
7785
7229
  }
7786
7230
  }, [entityType, entityId]);
7787
- const refresh = (0, import_react19.useCallback)(async () => {
7231
+ const refresh = (0, import_react18.useCallback)(async () => {
7788
7232
  await loadEntityFolders();
7789
7233
  }, [loadEntityFolders]);
7790
- (0, import_react19.useEffect)(() => {
7234
+ (0, import_react18.useEffect)(() => {
7791
7235
  loadEntityFolders();
7792
7236
  }, [loadEntityFolders]);
7793
- const handleCreateFolder = (0, import_react19.useCallback)(
7237
+ const handleCreateFolder = (0, import_react18.useCallback)(
7794
7238
  async (name, parentId) => {
7795
7239
  try {
7796
7240
  const created = await fileManagerApi.createFolder(
@@ -7808,7 +7252,7 @@ function useFileManagerApi(entityType, entityId, businessEntityId) {
7808
7252
  },
7809
7253
  [businessEntityId, refresh]
7810
7254
  );
7811
- const handleUploadFiles = (0, import_react19.useCallback)(
7255
+ const handleUploadFiles = (0, import_react18.useCallback)(
7812
7256
  async (files, parentId) => {
7813
7257
  try {
7814
7258
  const uploaded = await fileManagerApi.uploadFiles(files, parentId);
@@ -7822,7 +7266,7 @@ function useFileManagerApi(entityType, entityId, businessEntityId) {
7822
7266
  },
7823
7267
  [refresh]
7824
7268
  );
7825
- const handleRename = (0, import_react19.useCallback)(
7269
+ const handleRename = (0, import_react18.useCallback)(
7826
7270
  async (item, newName) => {
7827
7271
  try {
7828
7272
  if (item.type === "folder") {
@@ -7839,7 +7283,7 @@ function useFileManagerApi(entityType, entityId, businessEntityId) {
7839
7283
  },
7840
7284
  [refresh]
7841
7285
  );
7842
- const handleDelete = (0, import_react19.useCallback)(
7286
+ const handleDelete = (0, import_react18.useCallback)(
7843
7287
  async (item) => {
7844
7288
  try {
7845
7289
  if (item.metadata?.isSystemFolder) {
@@ -7859,7 +7303,7 @@ function useFileManagerApi(entityType, entityId, businessEntityId) {
7859
7303
  },
7860
7304
  [refresh]
7861
7305
  );
7862
- const handleDownload = (0, import_react19.useCallback)((item) => {
7306
+ const handleDownload = (0, import_react18.useCallback)((item) => {
7863
7307
  if (item.type === "file") {
7864
7308
  const url = item.url || fileManagerApi.getDownloadUrl(item.id);
7865
7309
  window.open(url, "_blank");
@@ -7882,7 +7326,7 @@ function useFileManagerApi(entityType, entityId, businessEntityId) {
7882
7326
  }
7883
7327
 
7884
7328
  // src/components/common/FileManager/components/EntityFileManager.tsx
7885
- var import_jsx_runtime25 = require("react/jsx-runtime");
7329
+ var import_jsx_runtime24 = require("react/jsx-runtime");
7886
7330
  function getRootName(entityType) {
7887
7331
  const names = {
7888
7332
  CLIENT: "Documents Client",
@@ -7893,118 +7337,697 @@ function getRootName(entityType) {
7893
7337
  };
7894
7338
  return names[entityType] || "Documents";
7895
7339
  }
7896
- var LoadingState = ({ height = "400px" }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
7340
+ var LoadingState = ({ height = "400px" }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
7897
7341
  "div",
7898
7342
  {
7899
7343
  className: "flex flex-col items-center justify-center bg-gray-50 dark:bg-gray-900 rounded-xl border border-gray-200 dark:border-gray-800",
7900
7344
  style: { height },
7901
7345
  children: [
7902
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react17.Loader2, { className: "w-10 h-10 text-blue-500 animate-spin mb-4" }),
7903
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-gray-600 dark:text-gray-400 text-sm", children: "Chargement des documents..." })
7346
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react16.Loader2, { className: "w-10 h-10 text-blue-500 animate-spin mb-4" }),
7347
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-gray-600 dark:text-gray-400 text-sm", children: "Chargement des documents..." })
7904
7348
  ]
7905
7349
  }
7906
7350
  );
7907
- var ErrorState = ({ error, onRetry, height = "400px" }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
7351
+ var ErrorState = ({ error, onRetry, height = "400px" }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
7908
7352
  "div",
7909
7353
  {
7910
7354
  className: "flex flex-col items-center justify-center bg-red-50 dark:bg-red-900/20 rounded-xl border border-red-200 dark:border-red-800",
7911
7355
  style: { height },
7912
7356
  children: [
7913
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react17.AlertCircle, { className: "w-10 h-10 text-red-500 mb-4" }),
7914
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-red-600 dark:text-red-400 text-sm font-medium mb-2", children: "Erreur lors du chargement" }),
7915
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-red-500 dark:text-red-400 text-xs mb-4 max-w-md text-center px-4", children: error.message }),
7916
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
7357
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react16.AlertCircle, { className: "w-10 h-10 text-red-500 mb-4" }),
7358
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-red-600 dark:text-red-400 text-sm font-medium mb-2", children: "Erreur lors du chargement" }),
7359
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-red-500 dark:text-red-400 text-xs mb-4 max-w-md text-center px-4", children: error.message }),
7360
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
7917
7361
  "button",
7918
7362
  {
7919
7363
  onClick: onRetry,
7920
7364
  className: "flex items-center gap-2 px-4 py-2 bg-red-100 dark:bg-red-900/40 text-red-700 dark:text-red-300 rounded-lg hover:bg-red-200 dark:hover:bg-red-900/60 transition-colors text-sm",
7921
7365
  children: [
7922
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react17.RefreshCw, { className: "w-4 h-4" }),
7366
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react16.RefreshCw, { className: "w-4 h-4" }),
7923
7367
  "R\xE9essayer"
7924
7368
  ]
7925
7369
  }
7926
- )
7927
- ]
7928
- }
7929
- );
7930
- var EmptyState = ({ height = "400px" }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
7931
- "div",
7932
- {
7933
- className: "flex flex-col items-center justify-center bg-gray-50 dark:bg-gray-900 rounded-xl border border-gray-200 dark:border-gray-800",
7934
- style: { height },
7935
- children: [
7936
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react17.FolderX, { className: "w-10 h-10 text-gray-400 mb-4" }),
7937
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-gray-600 dark:text-gray-400 text-sm font-medium mb-1", children: "Aucun document trouv\xE9" }),
7938
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-gray-500 dark:text-gray-500 text-xs", children: "La structure de dossiers n'a pas encore \xE9t\xE9 cr\xE9\xE9e pour cette entit\xE9." })
7939
- ]
7940
- }
7941
- );
7942
- var EntityFileManager = ({
7943
- entityType,
7944
- entityId,
7945
- businessEntityId,
7946
- className,
7947
- height = "600px",
7948
- // Permissions (défaut: tout autorisé)
7949
- allowUpload = true,
7950
- allowCreateFolder = true,
7951
- allowRename = true,
7952
- allowDelete = true,
7953
- allowDownload = true,
7954
- // Callbacks
7955
- onFileSelect,
7956
- onFileOpen,
7957
- onUploadSuccess,
7958
- onError
7959
- }) => {
7960
- const { data, loading, error, refresh, handlers } = useFileManagerApi(
7961
- entityType,
7962
- entityId,
7963
- businessEntityId
7964
- );
7965
- import_react20.default.useEffect(() => {
7966
- if (error && onError) {
7967
- onError(error);
7968
- }
7969
- }, [error, onError]);
7970
- if (loading) {
7971
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LoadingState, { height });
7972
- }
7973
- if (error) {
7974
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ErrorState, { error, onRetry: refresh, height });
7975
- }
7976
- if (!data || data.length === 0) {
7977
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(EmptyState, { height });
7978
- }
7979
- const handleUploadFiles = async (files, parentId) => {
7980
- const result = await handlers.onUploadFiles(files, parentId);
7981
- if (result && onUploadSuccess) {
7982
- onUploadSuccess(result);
7370
+ )
7371
+ ]
7372
+ }
7373
+ );
7374
+ var EmptyState = ({ height = "400px" }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
7375
+ "div",
7376
+ {
7377
+ className: "flex flex-col items-center justify-center bg-gray-50 dark:bg-gray-900 rounded-xl border border-gray-200 dark:border-gray-800",
7378
+ style: { height },
7379
+ children: [
7380
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react16.FolderX, { className: "w-10 h-10 text-gray-400 mb-4" }),
7381
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-gray-600 dark:text-gray-400 text-sm font-medium mb-1", children: "Aucun document trouv\xE9" }),
7382
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-gray-500 dark:text-gray-500 text-xs", children: "La structure de dossiers n'a pas encore \xE9t\xE9 cr\xE9\xE9e pour cette entit\xE9." })
7383
+ ]
7384
+ }
7385
+ );
7386
+ var EntityFileManager = ({
7387
+ entityType,
7388
+ entityId,
7389
+ businessEntityId,
7390
+ className,
7391
+ height = "600px",
7392
+ // Permissions (défaut: tout autorisé)
7393
+ allowUpload = true,
7394
+ allowCreateFolder = true,
7395
+ allowRename = true,
7396
+ allowDelete = true,
7397
+ allowDownload = true,
7398
+ // Callbacks
7399
+ onFileSelect,
7400
+ onFileOpen,
7401
+ onUploadSuccess,
7402
+ onError
7403
+ }) => {
7404
+ const { data, loading, error, refresh, handlers } = useFileManagerApi(
7405
+ entityType,
7406
+ entityId,
7407
+ businessEntityId
7408
+ );
7409
+ import_react19.default.useEffect(() => {
7410
+ if (error && onError) {
7411
+ onError(error);
7412
+ }
7413
+ }, [error, onError]);
7414
+ if (loading) {
7415
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(LoadingState, { height });
7416
+ }
7417
+ if (error) {
7418
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ErrorState, { error, onRetry: refresh, height });
7419
+ }
7420
+ if (!data || data.length === 0) {
7421
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(EmptyState, { height });
7422
+ }
7423
+ const handleUploadFiles = async (files, parentId) => {
7424
+ const result = await handlers.onUploadFiles(files, parentId);
7425
+ if (result && onUploadSuccess) {
7426
+ onUploadSuccess(result);
7427
+ }
7428
+ return result;
7429
+ };
7430
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("relative", className), style: { height }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
7431
+ FileManager,
7432
+ {
7433
+ data,
7434
+ rootName: getRootName(entityType),
7435
+ onCreateFolder: handlers.onCreateFolder,
7436
+ onUploadFiles: handleUploadFiles,
7437
+ onRename: handlers.onRename,
7438
+ onDelete: handlers.onDelete,
7439
+ onDownload: handlers.onDownload,
7440
+ onSelect: onFileSelect,
7441
+ onOpen: onFileOpen,
7442
+ allowUpload,
7443
+ allowCreateFolder,
7444
+ allowRename,
7445
+ allowDelete,
7446
+ allowDownload,
7447
+ allowMultiSelect: true,
7448
+ className: "h-full"
7449
+ }
7450
+ ) });
7451
+ };
7452
+
7453
+ // src/components/common/FormVendor.tsx
7454
+ var import_lucide_react17 = require("lucide-react");
7455
+ var import_jsx_runtime25 = require("react/jsx-runtime");
7456
+ var FormVendor = ({
7457
+ isOpen,
7458
+ onClose,
7459
+ object,
7460
+ from = "procurement",
7461
+ refresh = () => {
7462
+ }
7463
+ }) => {
7464
+ const [formData, setFormData] = (0, import_react20.useState)(object || {
7465
+ from_module: from ?? null,
7466
+ legal_name: "",
7467
+ trading_name: "",
7468
+ phone: "",
7469
+ email: "",
7470
+ logo: "",
7471
+ year_founded: "",
7472
+ activity_sector: "",
7473
+ description: "",
7474
+ accounting_account_number: "",
7475
+ account: null,
7476
+ capital: null,
7477
+ annual_turnover: null,
7478
+ payment_delay: null,
7479
+ country: "",
7480
+ city: "",
7481
+ address: "",
7482
+ legal_form: "",
7483
+ tax_regime: "",
7484
+ tax_account: "",
7485
+ rccm: "",
7486
+ legal_representative_name: "",
7487
+ legal_representative_address: "",
7488
+ legal_representative_phone: "",
7489
+ legal_representative_email: "",
7490
+ legal_representative_id_document: "",
7491
+ legal_representative_id_number: "",
7492
+ legal_representative_fonction: "",
7493
+ bank_name: "",
7494
+ bank_address: "",
7495
+ bank_email: "",
7496
+ bank_phone: "",
7497
+ iban: "",
7498
+ rib: "",
7499
+ vendor_number: ""
7500
+ });
7501
+ const [errors, setErrors] = (0, import_react20.useState)({});
7502
+ const [activeTab, setActiveTab] = (0, import_react20.useState)("general");
7503
+ const [loading, setLoading] = (0, import_react20.useState)(false);
7504
+ const { token, activeBusinessEntity } = useSession();
7505
+ const { success, error: showError } = useToast();
7506
+ const handleInputChange = (e) => {
7507
+ const { name, value } = e.target;
7508
+ setFormData((prev) => ({ ...prev, [name]: value }));
7509
+ if (errors[name]) {
7510
+ setErrors((prev) => ({ ...prev, [name]: void 0 }));
7511
+ }
7512
+ };
7513
+ const handleTextareaChange = (e) => {
7514
+ const { name, value } = e.target;
7515
+ setFormData((prev) => ({ ...prev, [name]: value }));
7516
+ };
7517
+ const validateForm = () => {
7518
+ const newErrors = {};
7519
+ if (!formData.legal_name?.trim()) {
7520
+ newErrors.legal_name = "La raison sociale est obligatoire";
7521
+ }
7522
+ if (formData.email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(formData.email)) {
7523
+ newErrors.email = "Format d'email invalide";
7524
+ }
7525
+ if (formData.iban && formData.iban.length > 0 && formData.iban.length < 15) {
7526
+ newErrors.iban = "Format IBAN invalide";
7527
+ }
7528
+ setErrors(newErrors);
7529
+ return Object.keys(newErrors).length === 0;
7530
+ };
7531
+ const handleSaveVendor = async (entityData) => {
7532
+ try {
7533
+ if (object && object.id) {
7534
+ await VendorServices.update(object.id, entityData);
7535
+ success("Fournisseur modifi\xE9 avec succ\xE8s !");
7536
+ } else {
7537
+ await VendorServices.create(entityData);
7538
+ success("Fournisseur cr\xE9\xE9 avec succ\xE8s !");
7539
+ }
7540
+ refresh();
7541
+ onClose();
7542
+ } catch (error) {
7543
+ console.error(error);
7544
+ showError("Erreur lors de l'enregistrement du fournisseur");
7545
+ }
7546
+ };
7547
+ const handleSubmit = async (e) => {
7548
+ e.preventDefault();
7549
+ if (!validateForm()) return;
7550
+ setLoading(true);
7551
+ try {
7552
+ await handleSaveVendor(formData);
7553
+ } finally {
7554
+ setLoading(false);
7555
+ }
7556
+ };
7557
+ const tabs = [
7558
+ { id: "general", label: "G\xE9n\xE9ral", icon: import_lucide_react17.Building2 },
7559
+ { id: "contacts", label: "Adresses & Contacts", icon: import_lucide_react17.MapPin },
7560
+ { id: "representative", label: "Repr\xE9sentant", icon: import_lucide_react17.FileText },
7561
+ { id: "accounting", label: "Comptabilit\xE9", icon: import_lucide_react17.FileText },
7562
+ { id: "banking", label: "Bancaire", icon: import_lucide_react17.CreditCard },
7563
+ { id: "attachment", label: "Fichiers", icon: import_lucide_react17.File }
7564
+ ];
7565
+ const renderTabContent = () => {
7566
+ switch (activeTab) {
7567
+ case "general":
7568
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-4", children: [
7569
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7570
+ TextInput,
7571
+ {
7572
+ label: "Raison sociale",
7573
+ name: "legal_name",
7574
+ value: formData.legal_name || "",
7575
+ placeholder: "Nom l\\u00e9gal de l'entit\\u00e9",
7576
+ required: true,
7577
+ error: errors.legal_name,
7578
+ onChange: handleInputChange
7579
+ }
7580
+ ),
7581
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7582
+ TextInput,
7583
+ {
7584
+ label: "Nom commercial",
7585
+ name: "trading_name",
7586
+ value: formData.trading_name || "",
7587
+ placeholder: "Nom commercial (optionnel)",
7588
+ onChange: handleInputChange
7589
+ }
7590
+ ),
7591
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
7592
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7593
+ TextInput,
7594
+ {
7595
+ label: "Num\\u00e9ro d'identification fiscale (NCC)",
7596
+ name: "tax_account",
7597
+ value: formData.tax_account || "",
7598
+ placeholder: "Num\\u00e9ro d'identification fiscale",
7599
+ onChange: handleInputChange
7600
+ }
7601
+ ),
7602
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7603
+ TextInput,
7604
+ {
7605
+ label: "RCCM",
7606
+ name: "rccm",
7607
+ value: formData.rccm || "",
7608
+ placeholder: "Registre du Commerce et du Cr\\u00e9dit Mobilier",
7609
+ onChange: handleInputChange
7610
+ }
7611
+ ),
7612
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7613
+ TextInput,
7614
+ {
7615
+ label: "Forme juridique",
7616
+ name: "legal_form",
7617
+ value: formData.legal_form || "",
7618
+ placeholder: "SARL, SA, SAS, etc.",
7619
+ onChange: handleInputChange
7620
+ }
7621
+ ),
7622
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7623
+ TextInput,
7624
+ {
7625
+ label: "R\\u00e9gime fiscal",
7626
+ name: "tax_regime",
7627
+ value: formData.tax_regime || "",
7628
+ placeholder: "R\\u00e9gime fiscal",
7629
+ onChange: handleInputChange
7630
+ }
7631
+ ),
7632
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7633
+ TextInput,
7634
+ {
7635
+ label: "Ann\\u00e9e de fondation",
7636
+ name: "year_founded",
7637
+ value: formData.year_founded || "",
7638
+ placeholder: "2020",
7639
+ onChange: handleInputChange
7640
+ }
7641
+ ),
7642
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7643
+ TextInput,
7644
+ {
7645
+ label: "Secteur d'activit\\u00e9",
7646
+ name: "activity_sector",
7647
+ value: formData.activity_sector || "",
7648
+ placeholder: "Informatique, Commerce, etc.",
7649
+ onChange: handleInputChange
7650
+ }
7651
+ )
7652
+ ] }),
7653
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
7654
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Description" }),
7655
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7656
+ "textarea",
7657
+ {
7658
+ name: "description",
7659
+ value: formData.description || "",
7660
+ onChange: handleTextareaChange,
7661
+ rows: 3,
7662
+ className: "w-full px-4 py-3 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#6B7C92] focus:border-transparent placeholder-gray-400",
7663
+ placeholder: "Description de l'activit\\u00e9 de l'entit\\u00e9"
7664
+ }
7665
+ )
7666
+ ] })
7667
+ ] });
7668
+ case "contacts":
7669
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-4", children: [
7670
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
7671
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7672
+ InputField,
7673
+ {
7674
+ label: "T\\u00e9l\\u00e9phone",
7675
+ name: "phone",
7676
+ type: "tel",
7677
+ value: formData.phone || "",
7678
+ placeholder: "+225 XX XX XX XX XX",
7679
+ onChange: handleInputChange
7680
+ }
7681
+ ),
7682
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7683
+ InputField,
7684
+ {
7685
+ label: "Email",
7686
+ name: "email",
7687
+ type: "email",
7688
+ value: formData.email || "",
7689
+ placeholder: "contact@entite.com",
7690
+ error: errors.email,
7691
+ onChange: handleInputChange
7692
+ }
7693
+ )
7694
+ ] }),
7695
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
7696
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7697
+ TextInput,
7698
+ {
7699
+ label: "Pays",
7700
+ name: "country",
7701
+ value: formData.country || "",
7702
+ placeholder: "C\\u00f4te d'Ivoire",
7703
+ onChange: handleInputChange
7704
+ }
7705
+ ),
7706
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7707
+ TextInput,
7708
+ {
7709
+ label: "Ville",
7710
+ name: "city",
7711
+ value: formData.city || "",
7712
+ placeholder: "Abidjan",
7713
+ onChange: handleInputChange
7714
+ }
7715
+ )
7716
+ ] }),
7717
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
7718
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Adresse compl\\u00e8te" }),
7719
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7720
+ "textarea",
7721
+ {
7722
+ name: "address",
7723
+ value: formData.address || "",
7724
+ onChange: handleTextareaChange,
7725
+ rows: 3,
7726
+ className: "w-full px-4 py-3 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#6B7C92] focus:border-transparent placeholder-gray-400",
7727
+ placeholder: "Adresse compl\\u00e8te de l'entit\\u00e9"
7728
+ }
7729
+ )
7730
+ ] })
7731
+ ] });
7732
+ case "representative":
7733
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-4", children: [
7734
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7735
+ TextInput,
7736
+ {
7737
+ label: "Nom du repr\\u00e9sentant l\\u00e9gal",
7738
+ name: "legal_representative_name",
7739
+ value: formData.legal_representative_name || "",
7740
+ placeholder: "Nom et pr\\u00e9nom du repr\\u00e9sentant",
7741
+ onChange: handleInputChange
7742
+ }
7743
+ ),
7744
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7745
+ TextInput,
7746
+ {
7747
+ label: "Fonction du repr\\u00e9sentant",
7748
+ name: "legal_representative_fonction",
7749
+ value: formData.legal_representative_fonction || "",
7750
+ placeholder: "Directeur G\\u00e9n\\u00e9ral, G\\u00e9rant, etc.",
7751
+ onChange: handleInputChange
7752
+ }
7753
+ ),
7754
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
7755
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7756
+ InputField,
7757
+ {
7758
+ label: "T\\u00e9l\\u00e9phone du repr\\u00e9sentant",
7759
+ name: "legal_representative_phone",
7760
+ type: "tel",
7761
+ value: formData.legal_representative_phone || "",
7762
+ placeholder: "+225 XX XX XX XX XX",
7763
+ onChange: handleInputChange
7764
+ }
7765
+ ),
7766
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7767
+ InputField,
7768
+ {
7769
+ label: "Email du repr\\u00e9sentant",
7770
+ name: "legal_representative_email",
7771
+ type: "email",
7772
+ value: formData.legal_representative_email || "",
7773
+ placeholder: "representant@entite.com",
7774
+ onChange: handleInputChange
7775
+ }
7776
+ ),
7777
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7778
+ TextInput,
7779
+ {
7780
+ label: "Type de document d'identit\\u00e9",
7781
+ name: "legal_representative_id_document",
7782
+ value: formData.legal_representative_id_document || "",
7783
+ placeholder: "CNI, Passeport, etc.",
7784
+ onChange: handleInputChange
7785
+ }
7786
+ ),
7787
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7788
+ TextInput,
7789
+ {
7790
+ label: "Num\\u00e9ro de document d'identit\\u00e9",
7791
+ name: "legal_representative_id_number",
7792
+ value: formData.legal_representative_id_number || "",
7793
+ placeholder: "Num\\u00e9ro du document",
7794
+ onChange: handleInputChange
7795
+ }
7796
+ )
7797
+ ] }),
7798
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
7799
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Adresse du repr\\u00e9sentant" }),
7800
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7801
+ "textarea",
7802
+ {
7803
+ name: "legal_representative_address",
7804
+ value: formData.legal_representative_address || "",
7805
+ onChange: handleTextareaChange,
7806
+ rows: 3,
7807
+ className: "w-full px-4 py-3 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#6B7C92] focus:border-transparent placeholder-gray-400",
7808
+ placeholder: "Adresse du repr\\u00e9sentant l\\u00e9gal"
7809
+ }
7810
+ )
7811
+ ] })
7812
+ ] });
7813
+ case "accounting":
7814
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-4", children: [
7815
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7816
+ SelectAccount,
7817
+ {
7818
+ value: formData.account,
7819
+ filterClass: "4",
7820
+ onSelect: (option) => {
7821
+ setFormData((prev) => ({
7822
+ ...prev,
7823
+ account: option.value,
7824
+ accounting_account_number: option.object?.account_number || ""
7825
+ }));
7826
+ }
7827
+ }
7828
+ ),
7829
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
7830
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7831
+ TextInput,
7832
+ {
7833
+ label: "Numero de compte (manuel)",
7834
+ name: "accounting_account_number",
7835
+ value: formData.accounting_account_number || "",
7836
+ placeholder: "Numero de compte comptable",
7837
+ onChange: handleInputChange
7838
+ }
7839
+ ),
7840
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7841
+ TextInput,
7842
+ {
7843
+ label: "Capital",
7844
+ name: "capital",
7845
+ value: formData.capital?.toString() || "",
7846
+ placeholder: "Capital social",
7847
+ onChange: handleInputChange
7848
+ }
7849
+ ),
7850
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7851
+ TextInput,
7852
+ {
7853
+ label: "Chiffre d'affaires annuel",
7854
+ name: "annual_turnover",
7855
+ value: formData.annual_turnover?.toString() || "",
7856
+ placeholder: "Chiffre d'affaires",
7857
+ onChange: handleInputChange
7858
+ }
7859
+ ),
7860
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7861
+ TextInput,
7862
+ {
7863
+ label: "Delai de paiement (jours)",
7864
+ name: "payment_delay",
7865
+ value: formData.payment_delay?.toString() || "",
7866
+ placeholder: "30",
7867
+ onChange: handleInputChange
7868
+ }
7869
+ )
7870
+ ] })
7871
+ ] });
7872
+ case "banking":
7873
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-4", children: [
7874
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
7875
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7876
+ TextInput,
7877
+ {
7878
+ label: "RIB",
7879
+ name: "rib",
7880
+ value: formData.rib || "",
7881
+ placeholder: "Relev\\u00e9 d'Identit\\u00e9 Bancaire",
7882
+ onChange: handleInputChange
7883
+ }
7884
+ ),
7885
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7886
+ TextInput,
7887
+ {
7888
+ label: "IBAN",
7889
+ name: "iban",
7890
+ value: formData.iban || "",
7891
+ placeholder: "CI93 1234 5678 9012 3456 789",
7892
+ error: errors.iban,
7893
+ onChange: handleInputChange
7894
+ }
7895
+ )
7896
+ ] }),
7897
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7898
+ TextInput,
7899
+ {
7900
+ label: "Nom de la banque",
7901
+ name: "bank_name",
7902
+ value: formData.bank_name || "",
7903
+ placeholder: "Nom de la banque",
7904
+ onChange: handleInputChange
7905
+ }
7906
+ ),
7907
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
7908
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7909
+ InputField,
7910
+ {
7911
+ label: "Email de la banque",
7912
+ name: "bank_email",
7913
+ type: "email",
7914
+ value: formData.bank_email || "",
7915
+ placeholder: "contact@banque.com",
7916
+ onChange: handleInputChange
7917
+ }
7918
+ ),
7919
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7920
+ InputField,
7921
+ {
7922
+ label: "T\\u00e9l\\u00e9phone de la banque",
7923
+ name: "bank_phone",
7924
+ type: "tel",
7925
+ value: formData.bank_phone || "",
7926
+ placeholder: "+225 XX XX XX XX XX",
7927
+ onChange: handleInputChange
7928
+ }
7929
+ )
7930
+ ] }),
7931
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
7932
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Adresse de la banque" }),
7933
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7934
+ "textarea",
7935
+ {
7936
+ name: "bank_address",
7937
+ value: formData.bank_address || "",
7938
+ onChange: handleTextareaChange,
7939
+ rows: 2,
7940
+ className: "w-full px-4 py-3 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#6B7C92] focus:border-transparent placeholder-gray-400",
7941
+ placeholder: "Adresse de la banque"
7942
+ }
7943
+ )
7944
+ ] })
7945
+ ] });
7946
+ case "attachment":
7947
+ if (!object?.id) {
7948
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col items-center justify-center py-12 text-gray-500", children: [
7949
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react17.File, { className: "w-12 h-12 mb-4 text-gray-400" }),
7950
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-lg font-medium", children: "Fichiers non disponibles" }),
7951
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm mt-2", children: "Enregistrez d'abord le fournisseur pour pouvoir ajouter des fichiers." })
7952
+ ] });
7953
+ }
7954
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-[500px]", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7955
+ EntityFileManager,
7956
+ {
7957
+ entityType: "VENDOR",
7958
+ entityId: object.id,
7959
+ businessEntityId: activeBusinessEntity?.id || 0,
7960
+ height: "100%",
7961
+ allowUpload: true,
7962
+ allowCreateFolder: true,
7963
+ allowRename: true,
7964
+ allowDelete: true,
7965
+ allowDownload: true
7966
+ }
7967
+ ) });
7968
+ default:
7969
+ return null;
7983
7970
  }
7984
- return result;
7985
7971
  };
7986
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: cn("relative", className), style: { height }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
7987
- FileManager,
7972
+ if (!isOpen) return null;
7973
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
7974
+ Modals_default,
7988
7975
  {
7989
- data,
7990
- rootName: getRootName(entityType),
7991
- onCreateFolder: handlers.onCreateFolder,
7992
- onUploadFiles: handleUploadFiles,
7993
- onRename: handlers.onRename,
7994
- onDelete: handlers.onDelete,
7995
- onDownload: handlers.onDownload,
7996
- onSelect: onFileSelect,
7997
- onOpen: onFileOpen,
7998
- allowUpload,
7999
- allowCreateFolder,
8000
- allowRename,
8001
- allowDelete,
8002
- allowDownload,
8003
- allowMultiSelect: true,
8004
- className: "h-full"
7976
+ title: object ? "Modifier le fournisseur" : "Ajouter un fournisseur",
7977
+ width: "w-[100%]",
7978
+ description: "",
7979
+ open: isOpen,
7980
+ onClose,
7981
+ children: [
7982
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "border-b border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("nav", { className: "flex space-x-8 px-6", children: tabs.map((tab) => {
7983
+ const Icon = tab.icon;
7984
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
7985
+ "button",
7986
+ {
7987
+ type: "button",
7988
+ onClick: () => setActiveTab(tab.id),
7989
+ className: `
7990
+ flex items-center space-x-2 py-4 px-2 text-sm font-medium border-b-2 transition-colors
7991
+ ${activeTab === tab.id ? "border-[#6A8A82] text-[#6A8A82]" : "border-transparent text-[#767676] hover:text-[#6A8A82] hover:border-[#6A8A82]/30"}
7992
+ `,
7993
+ children: [
7994
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon, { className: "w-4 h-4 inline mr-2" }),
7995
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: tab.label })
7996
+ ]
7997
+ },
7998
+ tab.id
7999
+ );
8000
+ }) }) }),
8001
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("form", { onSubmit: handleSubmit, className: "p-6", children: [
8002
+ renderTabContent(),
8003
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex justify-between pt-6 border-t border-gray-200 mt-8", children: [
8004
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
8005
+ "button",
8006
+ {
8007
+ type: "button",
8008
+ onClick: onClose,
8009
+ className: "px-6 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors",
8010
+ children: "Annuler"
8011
+ }
8012
+ ),
8013
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
8014
+ Buttons_default,
8015
+ {
8016
+ type: "submit",
8017
+ disabled: loading,
8018
+ children: loading ? "Chargement..." : object ? "Modifier" : "Enregistrer le fournisseur"
8019
+ }
8020
+ )
8021
+ ] })
8022
+ ] })
8023
+ ]
8005
8024
  }
8006
- ) });
8025
+ );
8007
8026
  };
8027
+ var MinimalVendorForm = FormVendor;
8028
+
8029
+ // src/components/common/FormClient.tsx
8030
+ var import_react21 = require("react");
8008
8031
 
8009
8032
  // src/models/Client.ts
8010
8033
  var TEMPLATE_FNE_CHOICES = [