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