ptechcore_ui 1.0.47 → 1.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1114 -1091
- package/dist/index.js +1323 -1299
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4721,7 +4721,7 @@ var Pagination = ({
|
|
|
4721
4721
|
};
|
|
4722
4722
|
|
|
4723
4723
|
// src/components/common/FormVendor.tsx
|
|
4724
|
-
import { useState as
|
|
4724
|
+
import { useState as useState17 } from "react";
|
|
4725
4725
|
|
|
4726
4726
|
// src/components/common/CommonSelect.tsx
|
|
4727
4727
|
import { useEffect as useEffect8, useState as useState10 } from "react";
|
|
@@ -5753,1208 +5753,647 @@ var SelectClient = ({
|
|
|
5753
5753
|
] });
|
|
5754
5754
|
};
|
|
5755
5755
|
|
|
5756
|
-
// src/components/common/
|
|
5757
|
-
import {
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
} from "
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
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");
|
|
5770
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
|
|
5771
5805
|
}) => {
|
|
5772
|
-
const
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
tax_regime: "",
|
|
5792
|
-
tax_account: "",
|
|
5793
|
-
rccm: "",
|
|
5794
|
-
legal_representative_name: "",
|
|
5795
|
-
legal_representative_address: "",
|
|
5796
|
-
legal_representative_phone: "",
|
|
5797
|
-
legal_representative_email: "",
|
|
5798
|
-
legal_representative_id_document: "",
|
|
5799
|
-
legal_representative_id_number: "",
|
|
5800
|
-
legal_representative_fonction: "",
|
|
5801
|
-
bank_name: "",
|
|
5802
|
-
bank_address: "",
|
|
5803
|
-
bank_email: "",
|
|
5804
|
-
bank_phone: "",
|
|
5805
|
-
iban: "",
|
|
5806
|
-
rib: "",
|
|
5807
|
-
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
|
|
5808
5825
|
});
|
|
5809
|
-
const
|
|
5810
|
-
const
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
const
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
setErrors((prev) => ({ ...prev, [name]: void 0 }));
|
|
5819
|
-
}
|
|
5820
|
-
};
|
|
5821
|
-
const handleTextareaChange = (e) => {
|
|
5822
|
-
const { name, value } = e.target;
|
|
5823
|
-
setFormData((prev) => ({ ...prev, [name]: value }));
|
|
5824
|
-
};
|
|
5825
|
-
const validateForm = () => {
|
|
5826
|
-
const newErrors = {};
|
|
5827
|
-
if (!formData.legal_name?.trim()) {
|
|
5828
|
-
newErrors.legal_name = "La raison sociale est obligatoire";
|
|
5829
|
-
}
|
|
5830
|
-
if (formData.email && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(formData.email)) {
|
|
5831
|
-
newErrors.email = "Format d'email invalide";
|
|
5832
|
-
}
|
|
5833
|
-
if (formData.iban && formData.iban.length > 0 && formData.iban.length < 15) {
|
|
5834
|
-
newErrors.iban = "Format IBAN invalide";
|
|
5835
|
-
}
|
|
5836
|
-
setErrors(newErrors);
|
|
5837
|
-
return Object.keys(newErrors).length === 0;
|
|
5838
|
-
};
|
|
5839
|
-
const handleSaveVendor = async (entityData) => {
|
|
5840
|
-
try {
|
|
5841
|
-
if (object && object.id) {
|
|
5842
|
-
await VendorServices.update(object.id, entityData);
|
|
5843
|
-
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]);
|
|
5844
5835
|
} else {
|
|
5845
|
-
|
|
5846
|
-
|
|
5836
|
+
setCurrentFolder(folder);
|
|
5837
|
+
setPathHistory((prev) => [...prev, folder]);
|
|
5847
5838
|
}
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
}
|
|
5851
|
-
|
|
5852
|
-
|
|
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([]);
|
|
5853
5852
|
}
|
|
5854
|
-
};
|
|
5855
|
-
const
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
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([]);
|
|
5863
5888
|
}
|
|
5864
|
-
};
|
|
5865
|
-
const
|
|
5866
|
-
{
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
];
|
|
5872
|
-
const
|
|
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
|
-
|
|
5988
|
-
),
|
|
5989
|
-
/* @__PURE__ */ jsx15(
|
|
5990
|
-
InputField,
|
|
5991
|
-
{
|
|
5992
|
-
label: "Email",
|
|
5993
|
-
name: "email",
|
|
5994
|
-
type: "email",
|
|
5995
|
-
value: formData.email || "",
|
|
5996
|
-
placeholder: "contact@entite.com",
|
|
5997
|
-
error: errors.email,
|
|
5998
|
-
onChange: handleInputChange
|
|
5999
|
-
}
|
|
6000
|
-
)
|
|
6001
|
-
] }),
|
|
6002
|
-
/* @__PURE__ */ jsxs12("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
6003
|
-
/* @__PURE__ */ jsx15(
|
|
6004
|
-
TextInput,
|
|
6005
|
-
{
|
|
6006
|
-
label: "Pays",
|
|
6007
|
-
name: "country",
|
|
6008
|
-
value: formData.country || "",
|
|
6009
|
-
placeholder: "C\\u00f4te d'Ivoire",
|
|
6010
|
-
onChange: handleInputChange
|
|
6011
|
-
}
|
|
6012
|
-
),
|
|
6013
|
-
/* @__PURE__ */ jsx15(
|
|
6014
|
-
TextInput,
|
|
6015
|
-
{
|
|
6016
|
-
label: "Ville",
|
|
6017
|
-
name: "city",
|
|
6018
|
-
value: formData.city || "",
|
|
6019
|
-
placeholder: "Abidjan",
|
|
6020
|
-
onChange: handleInputChange
|
|
6021
|
-
}
|
|
6022
|
-
)
|
|
6023
|
-
] }),
|
|
6024
|
-
/* @__PURE__ */ jsxs12("div", { children: [
|
|
6025
|
-
/* @__PURE__ */ jsx15("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Adresse compl\\u00e8te" }),
|
|
6026
|
-
/* @__PURE__ */ jsx15(
|
|
6027
|
-
"textarea",
|
|
6028
|
-
{
|
|
6029
|
-
name: "address",
|
|
6030
|
-
value: formData.address || "",
|
|
6031
|
-
onChange: handleTextareaChange,
|
|
6032
|
-
rows: 3,
|
|
6033
|
-
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",
|
|
6034
|
-
placeholder: "Adresse compl\\u00e8te de l'entit\\u00e9"
|
|
6035
|
-
}
|
|
6036
|
-
)
|
|
6037
|
-
] })
|
|
6038
|
-
] });
|
|
6039
|
-
case "representative":
|
|
6040
|
-
return /* @__PURE__ */ jsxs12("div", { className: "space-y-4", children: [
|
|
6041
|
-
/* @__PURE__ */ jsx15(
|
|
6042
|
-
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",
|
|
6043
6013
|
{
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
placeholder: "Nom et pr\\u00e9nom du repr\\u00e9sentant",
|
|
6048
|
-
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" })
|
|
6049
6017
|
}
|
|
6050
|
-
),
|
|
6051
|
-
/* @__PURE__ */
|
|
6052
|
-
|
|
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",
|
|
6053
6022
|
{
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6023
|
+
className: cn(
|
|
6024
|
+
"text-sm truncate",
|
|
6025
|
+
isSelected ? "font-medium" : "text-gray-700 dark:text-gray-300"
|
|
6026
|
+
),
|
|
6027
|
+
children: item.name
|
|
6059
6028
|
}
|
|
6060
|
-
)
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
{
|
|
6076
|
-
label: "Email du repr\\u00e9sentant",
|
|
6077
|
-
name: "legal_representative_email",
|
|
6078
|
-
type: "email",
|
|
6079
|
-
value: formData.legal_representative_email || "",
|
|
6080
|
-
placeholder: "representant@entite.com",
|
|
6081
|
-
onChange: handleInputChange
|
|
6082
|
-
}
|
|
6083
|
-
),
|
|
6084
|
-
/* @__PURE__ */ jsx15(
|
|
6085
|
-
TextInput,
|
|
6086
|
-
{
|
|
6087
|
-
label: "Type de document d'identit\\u00e9",
|
|
6088
|
-
name: "legal_representative_id_document",
|
|
6089
|
-
value: formData.legal_representative_id_document || "",
|
|
6090
|
-
placeholder: "CNI, Passeport, etc.",
|
|
6091
|
-
onChange: handleInputChange
|
|
6092
|
-
}
|
|
6093
|
-
),
|
|
6094
|
-
/* @__PURE__ */ jsx15(
|
|
6095
|
-
TextInput,
|
|
6096
|
-
{
|
|
6097
|
-
label: "Num\\u00e9ro de document d'identit\\u00e9",
|
|
6098
|
-
name: "legal_representative_id_number",
|
|
6099
|
-
value: formData.legal_representative_id_number || "",
|
|
6100
|
-
placeholder: "Num\\u00e9ro du document",
|
|
6101
|
-
onChange: handleInputChange
|
|
6102
|
-
}
|
|
6103
|
-
)
|
|
6104
|
-
] }),
|
|
6105
|
-
/* @__PURE__ */ jsxs12("div", { children: [
|
|
6106
|
-
/* @__PURE__ */ jsx15("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Adresse du repr\\u00e9sentant" }),
|
|
6107
|
-
/* @__PURE__ */ jsx15(
|
|
6108
|
-
"textarea",
|
|
6109
|
-
{
|
|
6110
|
-
name: "legal_representative_address",
|
|
6111
|
-
value: formData.legal_representative_address || "",
|
|
6112
|
-
onChange: handleTextareaChange,
|
|
6113
|
-
rows: 3,
|
|
6114
|
-
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",
|
|
6115
|
-
placeholder: "Adresse du repr\\u00e9sentant l\\u00e9gal"
|
|
6116
|
-
}
|
|
6117
|
-
)
|
|
6118
|
-
] })
|
|
6119
|
-
] });
|
|
6120
|
-
case "accounting":
|
|
6121
|
-
return /* @__PURE__ */ jsxs12("div", { className: "space-y-4", children: [
|
|
6122
|
-
/* @__PURE__ */ jsx15(
|
|
6123
|
-
SelectAccount,
|
|
6124
|
-
{
|
|
6125
|
-
value: formData.account,
|
|
6126
|
-
filterClass: "4",
|
|
6127
|
-
onSelect: (option) => {
|
|
6128
|
-
setFormData((prev) => ({
|
|
6129
|
-
...prev,
|
|
6130
|
-
account: option.value,
|
|
6131
|
-
accounting_account_number: option.object?.account_number || ""
|
|
6132
|
-
}));
|
|
6133
|
-
}
|
|
6134
|
-
}
|
|
6135
|
-
),
|
|
6136
|
-
/* @__PURE__ */ jsxs12("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
6137
|
-
/* @__PURE__ */ jsx15(
|
|
6138
|
-
TextInput,
|
|
6139
|
-
{
|
|
6140
|
-
label: "Numero de compte (manuel)",
|
|
6141
|
-
name: "accounting_account_number",
|
|
6142
|
-
value: formData.accounting_account_number || "",
|
|
6143
|
-
placeholder: "Numero de compte comptable",
|
|
6144
|
-
onChange: handleInputChange
|
|
6145
|
-
}
|
|
6146
|
-
),
|
|
6147
|
-
/* @__PURE__ */ jsx15(
|
|
6148
|
-
TextInput,
|
|
6149
|
-
{
|
|
6150
|
-
label: "Capital",
|
|
6151
|
-
name: "capital",
|
|
6152
|
-
value: formData.capital?.toString() || "",
|
|
6153
|
-
placeholder: "Capital social",
|
|
6154
|
-
onChange: handleInputChange
|
|
6155
|
-
}
|
|
6156
|
-
),
|
|
6157
|
-
/* @__PURE__ */ jsx15(
|
|
6158
|
-
TextInput,
|
|
6159
|
-
{
|
|
6160
|
-
label: "Chiffre d'affaires annuel",
|
|
6161
|
-
name: "annual_turnover",
|
|
6162
|
-
value: formData.annual_turnover?.toString() || "",
|
|
6163
|
-
placeholder: "Chiffre d'affaires",
|
|
6164
|
-
onChange: handleInputChange
|
|
6165
|
-
}
|
|
6166
|
-
),
|
|
6167
|
-
/* @__PURE__ */ jsx15(
|
|
6168
|
-
TextInput,
|
|
6169
|
-
{
|
|
6170
|
-
label: "Delai de paiement (jours)",
|
|
6171
|
-
name: "payment_delay",
|
|
6172
|
-
value: formData.payment_delay?.toString() || "",
|
|
6173
|
-
placeholder: "30",
|
|
6174
|
-
onChange: handleInputChange
|
|
6175
|
-
}
|
|
6176
|
-
)
|
|
6177
|
-
] })
|
|
6178
|
-
] });
|
|
6179
|
-
case "banking":
|
|
6180
|
-
return /* @__PURE__ */ jsxs12("div", { className: "space-y-4", children: [
|
|
6181
|
-
/* @__PURE__ */ jsxs12("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
6182
|
-
/* @__PURE__ */ jsx15(
|
|
6183
|
-
TextInput,
|
|
6184
|
-
{
|
|
6185
|
-
label: "RIB",
|
|
6186
|
-
name: "rib",
|
|
6187
|
-
value: formData.rib || "",
|
|
6188
|
-
placeholder: "Relev\\u00e9 d'Identit\\u00e9 Bancaire",
|
|
6189
|
-
onChange: handleInputChange
|
|
6190
|
-
}
|
|
6191
|
-
),
|
|
6192
|
-
/* @__PURE__ */ jsx15(
|
|
6193
|
-
TextInput,
|
|
6194
|
-
{
|
|
6195
|
-
label: "IBAN",
|
|
6196
|
-
name: "iban",
|
|
6197
|
-
value: formData.iban || "",
|
|
6198
|
-
placeholder: "CI93 1234 5678 9012 3456 789",
|
|
6199
|
-
error: errors.iban,
|
|
6200
|
-
onChange: handleInputChange
|
|
6201
|
-
}
|
|
6202
|
-
)
|
|
6203
|
-
] }),
|
|
6204
|
-
/* @__PURE__ */ jsx15(
|
|
6205
|
-
TextInput,
|
|
6206
|
-
{
|
|
6207
|
-
label: "Nom de la banque",
|
|
6208
|
-
name: "bank_name",
|
|
6209
|
-
value: formData.bank_name || "",
|
|
6210
|
-
placeholder: "Nom de la banque",
|
|
6211
|
-
onChange: handleInputChange
|
|
6212
|
-
}
|
|
6213
|
-
),
|
|
6214
|
-
/* @__PURE__ */ jsxs12("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
6215
|
-
/* @__PURE__ */ jsx15(
|
|
6216
|
-
InputField,
|
|
6217
|
-
{
|
|
6218
|
-
label: "Email de la banque",
|
|
6219
|
-
name: "bank_email",
|
|
6220
|
-
type: "email",
|
|
6221
|
-
value: formData.bank_email || "",
|
|
6222
|
-
placeholder: "contact@banque.com",
|
|
6223
|
-
onChange: handleInputChange
|
|
6224
|
-
}
|
|
6225
|
-
),
|
|
6226
|
-
/* @__PURE__ */ jsx15(
|
|
6227
|
-
InputField,
|
|
6228
|
-
{
|
|
6229
|
-
label: "T\\u00e9l\\u00e9phone de la banque",
|
|
6230
|
-
name: "bank_phone",
|
|
6231
|
-
type: "tel",
|
|
6232
|
-
value: formData.bank_phone || "",
|
|
6233
|
-
placeholder: "+225 XX XX XX XX XX",
|
|
6234
|
-
onChange: handleInputChange
|
|
6235
|
-
}
|
|
6236
|
-
)
|
|
6237
|
-
] }),
|
|
6238
|
-
/* @__PURE__ */ jsxs12("div", { children: [
|
|
6239
|
-
/* @__PURE__ */ jsx15("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Adresse de la banque" }),
|
|
6240
|
-
/* @__PURE__ */ jsx15(
|
|
6241
|
-
"textarea",
|
|
6242
|
-
{
|
|
6243
|
-
name: "bank_address",
|
|
6244
|
-
value: formData.bank_address || "",
|
|
6245
|
-
onChange: handleTextareaChange,
|
|
6246
|
-
rows: 2,
|
|
6247
|
-
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",
|
|
6248
|
-
placeholder: "Adresse de la banque"
|
|
6249
|
-
}
|
|
6250
|
-
)
|
|
6251
|
-
] })
|
|
6252
|
-
] });
|
|
6253
|
-
default:
|
|
6254
|
-
return null;
|
|
6255
|
-
}
|
|
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
|
|
6256
6044
|
};
|
|
6257
|
-
|
|
6258
|
-
return /* @__PURE__ */ jsxs12(
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
${activeTab === tab.id ? "border-[#6A8A82] text-[#6A8A82]" : "border-transparent text-[#767676] hover:text-[#6A8A82] hover:border-[#6A8A82]/30"}
|
|
6277
|
-
`,
|
|
6278
|
-
children: [
|
|
6279
|
-
/* @__PURE__ */ jsx15(Icon, { className: "w-4 h-4 inline mr-2" }),
|
|
6280
|
-
/* @__PURE__ */ jsx15("span", { children: tab.label })
|
|
6281
|
-
]
|
|
6282
|
-
},
|
|
6283
|
-
tab.id
|
|
6284
|
-
);
|
|
6285
|
-
}) }) }),
|
|
6286
|
-
/* @__PURE__ */ jsxs12("form", { onSubmit: handleSubmit, className: "p-6", children: [
|
|
6287
|
-
renderTabContent(),
|
|
6288
|
-
/* @__PURE__ */ jsxs12("div", { className: "flex justify-between pt-6 border-t border-gray-200 mt-8", children: [
|
|
6289
|
-
/* @__PURE__ */ jsx15(
|
|
6290
|
-
"button",
|
|
6291
|
-
{
|
|
6292
|
-
type: "button",
|
|
6293
|
-
onClick: onClose,
|
|
6294
|
-
className: "px-6 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors",
|
|
6295
|
-
children: "Annuler"
|
|
6296
|
-
}
|
|
6297
|
-
),
|
|
6298
|
-
/* @__PURE__ */ jsx15(
|
|
6299
|
-
Buttons_default,
|
|
6300
|
-
{
|
|
6301
|
-
type: "submit",
|
|
6302
|
-
disabled: loading,
|
|
6303
|
-
children: loading ? "Chargement..." : object ? "Modifier" : "Enregistrer le fournisseur"
|
|
6304
|
-
}
|
|
6305
|
-
)
|
|
6306
|
-
] })
|
|
6307
|
-
] })
|
|
6308
|
-
]
|
|
6309
|
-
}
|
|
6310
|
-
);
|
|
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
|
+
] });
|
|
6311
6064
|
};
|
|
6312
|
-
var MinimalVendorForm = FormVendor;
|
|
6313
6065
|
|
|
6314
|
-
// src/components/common/
|
|
6315
|
-
import {
|
|
6066
|
+
// src/components/common/FileManager/components/FileGrid.tsx
|
|
6067
|
+
import { FolderPlus } from "lucide-react";
|
|
6316
6068
|
|
|
6317
|
-
// src/components/common/FileManager/
|
|
6318
|
-
import { useState as
|
|
6319
|
-
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";
|
|
6320
6071
|
|
|
6321
|
-
// src/components/common/FileManager/
|
|
6322
|
-
import {
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
};
|
|
6339
|
-
var FileManagerContext = createContext4(null);
|
|
6340
|
-
var useFileManager = () => {
|
|
6341
|
-
const context = useContext4(FileManagerContext);
|
|
6342
|
-
if (!context) {
|
|
6343
|
-
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;
|
|
6344
6089
|
}
|
|
6345
|
-
|
|
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;
|
|
6346
6125
|
};
|
|
6347
|
-
var
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
}
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
type: "folder",
|
|
6372
|
-
path: "/",
|
|
6373
|
-
children: data
|
|
6374
|
-
}),
|
|
6375
|
-
[data, rootName]
|
|
6376
|
-
);
|
|
6377
|
-
const [currentFolder, setCurrentFolder] = useState12(rootFolder);
|
|
6378
|
-
const [pathHistory, setPathHistory] = useState12([rootFolder]);
|
|
6379
|
-
const [selectedItems, setSelectedItems] = useState12([]);
|
|
6380
|
-
const [viewMode, setViewMode] = useState12(initialViewMode);
|
|
6381
|
-
const [renamingItem, setRenamingItem] = useState12(null);
|
|
6382
|
-
const [contextMenu, setContextMenu] = useState12({
|
|
6383
|
-
visible: false,
|
|
6384
|
-
position: { x: 0, y: 0 },
|
|
6385
|
-
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"
|
|
6386
6150
|
});
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
);
|
|
6405
|
-
const
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
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();
|
|
6413
6178
|
}
|
|
6414
|
-
}, [
|
|
6415
|
-
|
|
6416
|
-
(
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
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);
|
|
6422
6196
|
}
|
|
6423
|
-
}
|
|
6424
|
-
|
|
6425
|
-
)
|
|
6426
|
-
|
|
6427
|
-
(
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
return [item];
|
|
6437
|
-
});
|
|
6438
|
-
if (onSelect) {
|
|
6439
|
-
const newSelection = allowMultiSelect && multiSelect ? selectedItems.some((i) => i.id === item.id) ? selectedItems.filter((i) => i.id !== item.id) : [...selectedItems, item] : [item];
|
|
6440
|
-
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);
|
|
6441
6210
|
}
|
|
6442
|
-
}
|
|
6443
|
-
|
|
6444
|
-
);
|
|
6445
|
-
const deselectAll = useCallback2(() => {
|
|
6446
|
-
setSelectedItems([]);
|
|
6447
|
-
if (onSelect) {
|
|
6448
|
-
onSelect([]);
|
|
6211
|
+
} else {
|
|
6212
|
+
setRenameValue(item.name);
|
|
6449
6213
|
}
|
|
6450
|
-
|
|
6451
|
-
const showContextMenu = useCallback2((item, position) => {
|
|
6452
|
-
setContextMenu({
|
|
6453
|
-
visible: true,
|
|
6454
|
-
position,
|
|
6455
|
-
item
|
|
6456
|
-
});
|
|
6457
|
-
}, []);
|
|
6458
|
-
const hideContextMenu = useCallback2(() => {
|
|
6459
|
-
setContextMenu((prev) => ({ ...prev, visible: false }));
|
|
6460
|
-
}, []);
|
|
6461
|
-
const startRenaming = useCallback2((item) => {
|
|
6462
|
-
setRenamingItem(item);
|
|
6463
|
-
hideContextMenu();
|
|
6464
|
-
}, [hideContextMenu]);
|
|
6465
|
-
const stopRenaming = useCallback2(() => {
|
|
6466
|
-
setRenamingItem(null);
|
|
6467
|
-
}, []);
|
|
6468
|
-
const contextValue = useMemo(
|
|
6469
|
-
() => ({
|
|
6470
|
-
data,
|
|
6471
|
-
currentFolder,
|
|
6472
|
-
currentFolderContents,
|
|
6473
|
-
pathHistory,
|
|
6474
|
-
selectedItems,
|
|
6475
|
-
viewMode,
|
|
6476
|
-
contextMenu,
|
|
6477
|
-
renamingItem,
|
|
6478
|
-
navigateToFolder,
|
|
6479
|
-
navigateBack,
|
|
6480
|
-
navigateToPath,
|
|
6481
|
-
selectItem,
|
|
6482
|
-
deselectAll,
|
|
6483
|
-
setViewMode,
|
|
6484
|
-
showContextMenu,
|
|
6485
|
-
hideContextMenu,
|
|
6486
|
-
startRenaming,
|
|
6487
|
-
stopRenaming,
|
|
6488
|
-
onCreateFolder,
|
|
6489
|
-
onUploadFiles,
|
|
6490
|
-
onRename,
|
|
6491
|
-
onDelete,
|
|
6492
|
-
onDownload,
|
|
6493
|
-
onOpen,
|
|
6494
|
-
allowUpload,
|
|
6495
|
-
allowCreateFolder,
|
|
6496
|
-
allowRename,
|
|
6497
|
-
allowDelete,
|
|
6498
|
-
allowDownload,
|
|
6499
|
-
allowMultiSelect,
|
|
6500
|
-
texts
|
|
6501
|
-
}),
|
|
6502
|
-
[
|
|
6503
|
-
data,
|
|
6504
|
-
currentFolder,
|
|
6505
|
-
currentFolderContents,
|
|
6506
|
-
pathHistory,
|
|
6507
|
-
selectedItems,
|
|
6508
|
-
viewMode,
|
|
6509
|
-
contextMenu,
|
|
6510
|
-
renamingItem,
|
|
6511
|
-
navigateToFolder,
|
|
6512
|
-
navigateBack,
|
|
6513
|
-
navigateToPath,
|
|
6514
|
-
selectItem,
|
|
6515
|
-
deselectAll,
|
|
6516
|
-
showContextMenu,
|
|
6517
|
-
hideContextMenu,
|
|
6518
|
-
startRenaming,
|
|
6519
|
-
stopRenaming,
|
|
6520
|
-
onCreateFolder,
|
|
6521
|
-
onUploadFiles,
|
|
6522
|
-
onRename,
|
|
6523
|
-
onDelete,
|
|
6524
|
-
onDownload,
|
|
6525
|
-
onOpen,
|
|
6526
|
-
allowUpload,
|
|
6527
|
-
allowCreateFolder,
|
|
6528
|
-
allowRename,
|
|
6529
|
-
allowDelete,
|
|
6530
|
-
allowDownload,
|
|
6531
|
-
allowMultiSelect,
|
|
6532
|
-
texts
|
|
6533
|
-
]
|
|
6534
|
-
);
|
|
6535
|
-
return /* @__PURE__ */ jsx16(FileManagerContext.Provider, { value: contextValue, children });
|
|
6536
|
-
};
|
|
6537
|
-
|
|
6538
|
-
// src/components/common/FileManager/components/FolderTree.tsx
|
|
6539
|
-
import { useState as useState13 } from "react";
|
|
6540
|
-
import { ChevronRight as ChevronRight2, ChevronDown as ChevronDown3, Folder, FolderOpen } from "lucide-react";
|
|
6541
|
-
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6542
|
-
var FolderTreeItem = ({ item, level }) => {
|
|
6543
|
-
const { currentFolder, navigateToFolder, pathHistory } = useFileManager();
|
|
6544
|
-
const [isExpanded, setIsExpanded] = useState13(
|
|
6545
|
-
pathHistory.some((f) => f.id === item.id) || level === 0
|
|
6546
|
-
);
|
|
6547
|
-
const isSelected = currentFolder?.id === item.id;
|
|
6548
|
-
const hasChildren = item.children?.some((child) => child.type === "folder");
|
|
6549
|
-
const folderChildren = item.children?.filter((child) => child.type === "folder") || [];
|
|
6550
|
-
const handleToggle = (e) => {
|
|
6551
|
-
e.stopPropagation();
|
|
6552
|
-
setIsExpanded(!isExpanded);
|
|
6214
|
+
stopRenaming();
|
|
6553
6215
|
};
|
|
6554
|
-
const
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6216
|
+
const handleRenameKeyDown = (e) => {
|
|
6217
|
+
if (e.key === "Enter") {
|
|
6218
|
+
handleRenameSubmit();
|
|
6219
|
+
} else if (e.key === "Escape") {
|
|
6220
|
+
setRenameValue(item.name);
|
|
6221
|
+
stopRenaming();
|
|
6558
6222
|
}
|
|
6559
6223
|
};
|
|
6560
|
-
|
|
6561
|
-
/* @__PURE__ */ jsxs13(
|
|
6224
|
+
if (variant === "list") {
|
|
6225
|
+
return /* @__PURE__ */ jsxs13(
|
|
6562
6226
|
"div",
|
|
6563
6227
|
{
|
|
6564
6228
|
className: cn(
|
|
6565
|
-
"flex items-center gap-
|
|
6229
|
+
"flex items-center gap-3 px-3 py-2 rounded-lg cursor-pointer transition-all duration-200",
|
|
6566
6230
|
"hover:bg-gray-100 dark:hover:bg-gray-800",
|
|
6567
|
-
isSelected && "bg-blue-50 dark:bg-blue-900/30
|
|
6231
|
+
isSelected && "bg-blue-50 dark:bg-blue-900/30 ring-1 ring-blue-500"
|
|
6568
6232
|
),
|
|
6569
|
-
style: { paddingLeft: `${level * 12 + 8}px` },
|
|
6570
6233
|
onClick: handleClick,
|
|
6234
|
+
onDoubleClick: handleDoubleClick,
|
|
6235
|
+
onContextMenu: handleContextMenu,
|
|
6571
6236
|
children: [
|
|
6572
|
-
hasChildren ? /* @__PURE__ */ jsx17(
|
|
6573
|
-
"button",
|
|
6574
|
-
{
|
|
6575
|
-
onClick: handleToggle,
|
|
6576
|
-
className: "p-0.5 hover:bg-gray-200 dark:hover:bg-gray-700 rounded",
|
|
6577
|
-
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" })
|
|
6578
|
-
}
|
|
6579
|
-
) : /* @__PURE__ */ jsx17("span", { className: "w-5" }),
|
|
6580
|
-
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" }),
|
|
6581
6237
|
/* @__PURE__ */ jsx17(
|
|
6582
|
-
|
|
6238
|
+
Icon,
|
|
6583
6239
|
{
|
|
6584
6240
|
className: cn(
|
|
6585
|
-
"
|
|
6586
|
-
|
|
6587
|
-
)
|
|
6588
|
-
children: item.name
|
|
6241
|
+
"w-5 h-5 flex-shrink-0",
|
|
6242
|
+
isFolder ? "text-yellow-500" : "text-gray-500 dark:text-gray-400"
|
|
6243
|
+
)
|
|
6589
6244
|
}
|
|
6590
|
-
)
|
|
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) })
|
|
6591
6261
|
]
|
|
6592
6262
|
}
|
|
6593
|
-
)
|
|
6594
|
-
|
|
6595
|
-
|
|
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
|
+
);
|
|
6596
6303
|
};
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
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();
|
|
6605
6317
|
};
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
/* @__PURE__ */ jsxs13(
|
|
6318
|
+
if (sortedItems.length === 0) {
|
|
6319
|
+
return /* @__PURE__ */ jsxs14(
|
|
6609
6320
|
"div",
|
|
6610
6321
|
{
|
|
6611
|
-
className:
|
|
6612
|
-
|
|
6613
|
-
"hover:bg-gray-100 dark:hover:bg-gray-800",
|
|
6614
|
-
isRootSelected && "bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300"
|
|
6615
|
-
),
|
|
6616
|
-
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,
|
|
6617
6324
|
children: [
|
|
6618
|
-
/* @__PURE__ */
|
|
6619
|
-
/* @__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 })
|
|
6620
6328
|
]
|
|
6621
6329
|
}
|
|
6622
|
-
)
|
|
6623
|
-
|
|
6624
|
-
|
|
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
|
+
);
|
|
6625
6340
|
};
|
|
6626
6341
|
|
|
6627
|
-
// src/components/common/FileManager/components/
|
|
6628
|
-
import { FolderPlus } from "lucide-react";
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
const type = mimeType.toLowerCase();
|
|
6655
|
-
if (type.startsWith("image/")) {
|
|
6656
|
-
return FileImage;
|
|
6657
|
-
}
|
|
6658
|
-
if (type === "application/pdf") {
|
|
6659
|
-
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
|
+
);
|
|
6660
6369
|
}
|
|
6661
|
-
|
|
6662
|
-
return FileType;
|
|
6663
|
-
}
|
|
6664
|
-
if (type === "application/vnd.ms-excel" || type === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" || type.includes("excel") || type.includes("spreadsheet")) {
|
|
6665
|
-
return FileSpreadsheet2;
|
|
6666
|
-
}
|
|
6667
|
-
if (type === "application/vnd.ms-powerpoint" || type === "application/vnd.openxmlformats-officedocument.presentationml.presentation" || type.includes("powerpoint") || type.includes("presentation")) {
|
|
6668
|
-
return FileType;
|
|
6669
|
-
}
|
|
6670
|
-
if (type === "application/zip" || type === "application/x-rar-compressed" || type === "application/x-7z-compressed" || type === "application/gzip" || type.includes("archive") || type.includes("compressed")) {
|
|
6671
|
-
return FileArchive;
|
|
6672
|
-
}
|
|
6673
|
-
if (type.startsWith("video/")) {
|
|
6674
|
-
return FileVideo;
|
|
6675
|
-
}
|
|
6676
|
-
if (type.startsWith("audio/")) {
|
|
6677
|
-
return FileAudio;
|
|
6678
|
-
}
|
|
6679
|
-
if (type.includes("javascript") || type.includes("typescript") || type.includes("json") || type.includes("xml") || type.includes("html") || type.includes("css")) {
|
|
6680
|
-
return FileCode;
|
|
6681
|
-
}
|
|
6682
|
-
if (type.startsWith("text/")) {
|
|
6683
|
-
return FileText3;
|
|
6684
|
-
}
|
|
6685
|
-
return File;
|
|
6686
|
-
};
|
|
6687
|
-
var formatFileSize = (bytes) => {
|
|
6688
|
-
if (bytes === void 0 || bytes === null) {
|
|
6689
|
-
return "-";
|
|
6690
|
-
}
|
|
6691
|
-
if (bytes === 0) {
|
|
6692
|
-
return "0 B";
|
|
6693
|
-
}
|
|
6694
|
-
const units = ["B", "KB", "MB", "GB", "TB"];
|
|
6695
|
-
const k = 1024;
|
|
6696
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
6697
|
-
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${units[i]}`;
|
|
6698
|
-
};
|
|
6699
|
-
var formatDate = (date) => {
|
|
6700
|
-
if (!date) {
|
|
6701
|
-
return "-";
|
|
6702
|
-
}
|
|
6703
|
-
const d = typeof date === "string" ? new Date(date) : date;
|
|
6704
|
-
if (isNaN(d.getTime())) {
|
|
6705
|
-
return "-";
|
|
6706
|
-
}
|
|
6707
|
-
return d.toLocaleDateString("fr-FR", {
|
|
6708
|
-
day: "2-digit",
|
|
6709
|
-
month: "2-digit",
|
|
6710
|
-
year: "numeric"
|
|
6711
|
-
});
|
|
6712
|
-
};
|
|
6713
|
-
|
|
6714
|
-
// src/components/common/FileManager/components/FileCard.tsx
|
|
6715
|
-
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
6716
|
-
var FileCard = ({ item, variant = "grid" }) => {
|
|
6717
|
-
const {
|
|
6718
|
-
selectedItems,
|
|
6719
|
-
selectItem,
|
|
6720
|
-
navigateToFolder,
|
|
6721
|
-
showContextMenu,
|
|
6722
|
-
renamingItem,
|
|
6723
|
-
stopRenaming,
|
|
6724
|
-
onRename,
|
|
6725
|
-
onOpen,
|
|
6726
|
-
onDownload,
|
|
6727
|
-
allowRename
|
|
6728
|
-
} = useFileManager();
|
|
6729
|
-
const [renameValue, setRenameValue] = useState14(item.name);
|
|
6730
|
-
const inputRef = useRef3(null);
|
|
6731
|
-
const isSelected = selectedItems.some((i) => i.id === item.id);
|
|
6732
|
-
const isRenaming = renamingItem?.id === item.id;
|
|
6733
|
-
const isFolder = item.type === "folder";
|
|
6734
|
-
const Icon = getFileIcon(item.mimeType, isFolder);
|
|
6735
|
-
useEffect9(() => {
|
|
6736
|
-
if (isRenaming && inputRef.current) {
|
|
6737
|
-
inputRef.current.focus();
|
|
6738
|
-
inputRef.current.select();
|
|
6739
|
-
}
|
|
6740
|
-
}, [isRenaming]);
|
|
6741
|
-
useEffect9(() => {
|
|
6742
|
-
setRenameValue(item.name);
|
|
6743
|
-
}, [item.name]);
|
|
6744
|
-
const handleClick = (e) => {
|
|
6745
|
-
e.stopPropagation();
|
|
6746
|
-
selectItem(item, e.ctrlKey || e.metaKey);
|
|
6747
|
-
};
|
|
6748
|
-
const handleDoubleClick = (e) => {
|
|
6749
|
-
e.stopPropagation();
|
|
6750
|
-
if (isFolder) {
|
|
6751
|
-
navigateToFolder(item);
|
|
6752
|
-
} else {
|
|
6753
|
-
if (onOpen) {
|
|
6754
|
-
onOpen(item);
|
|
6755
|
-
} else if (onDownload) {
|
|
6756
|
-
onDownload(item);
|
|
6757
|
-
}
|
|
6758
|
-
}
|
|
6759
|
-
};
|
|
6760
|
-
const handleContextMenu = (e) => {
|
|
6761
|
-
e.preventDefault();
|
|
6762
|
-
e.stopPropagation();
|
|
6763
|
-
showContextMenu(item, { x: e.clientX, y: e.clientY });
|
|
6764
|
-
};
|
|
6765
|
-
const handleRenameSubmit = async () => {
|
|
6766
|
-
if (renameValue.trim() && renameValue !== item.name && onRename && allowRename) {
|
|
6767
|
-
try {
|
|
6768
|
-
await onRename(item, renameValue.trim());
|
|
6769
|
-
} catch (error) {
|
|
6770
|
-
setRenameValue(item.name);
|
|
6771
|
-
}
|
|
6772
|
-
} else {
|
|
6773
|
-
setRenameValue(item.name);
|
|
6774
|
-
}
|
|
6775
|
-
stopRenaming();
|
|
6776
|
-
};
|
|
6777
|
-
const handleRenameKeyDown = (e) => {
|
|
6778
|
-
if (e.key === "Enter") {
|
|
6779
|
-
handleRenameSubmit();
|
|
6780
|
-
} else if (e.key === "Escape") {
|
|
6781
|
-
setRenameValue(item.name);
|
|
6782
|
-
stopRenaming();
|
|
6783
|
-
}
|
|
6784
|
-
};
|
|
6785
|
-
if (variant === "list") {
|
|
6786
|
-
return /* @__PURE__ */ jsxs14(
|
|
6787
|
-
"div",
|
|
6788
|
-
{
|
|
6789
|
-
className: cn(
|
|
6790
|
-
"flex items-center gap-3 px-3 py-2 rounded-lg cursor-pointer transition-all duration-200",
|
|
6791
|
-
"hover:bg-gray-100 dark:hover:bg-gray-800",
|
|
6792
|
-
isSelected && "bg-blue-50 dark:bg-blue-900/30 ring-1 ring-blue-500"
|
|
6793
|
-
),
|
|
6794
|
-
onClick: handleClick,
|
|
6795
|
-
onDoubleClick: handleDoubleClick,
|
|
6796
|
-
onContextMenu: handleContextMenu,
|
|
6797
|
-
children: [
|
|
6798
|
-
/* @__PURE__ */ jsx18(
|
|
6799
|
-
Icon,
|
|
6800
|
-
{
|
|
6801
|
-
className: cn(
|
|
6802
|
-
"w-5 h-5 flex-shrink-0",
|
|
6803
|
-
isFolder ? "text-yellow-500" : "text-gray-500 dark:text-gray-400"
|
|
6804
|
-
)
|
|
6805
|
-
}
|
|
6806
|
-
),
|
|
6807
|
-
/* @__PURE__ */ jsx18("div", { className: "flex-1 min-w-0", children: isRenaming ? /* @__PURE__ */ jsx18(
|
|
6808
|
-
"input",
|
|
6809
|
-
{
|
|
6810
|
-
ref: inputRef,
|
|
6811
|
-
type: "text",
|
|
6812
|
-
value: renameValue,
|
|
6813
|
-
onChange: (e) => setRenameValue(e.target.value),
|
|
6814
|
-
onBlur: handleRenameSubmit,
|
|
6815
|
-
onKeyDown: handleRenameKeyDown,
|
|
6816
|
-
className: "w-full px-2 py-0.5 text-sm border border-blue-500 rounded outline-none bg-white dark:bg-gray-900",
|
|
6817
|
-
onClick: (e) => e.stopPropagation()
|
|
6818
|
-
}
|
|
6819
|
-
) : /* @__PURE__ */ jsx18("span", { className: "block truncate text-sm text-gray-900 dark:text-gray-100", children: item.name }) }),
|
|
6820
|
-
/* @__PURE__ */ jsx18("span", { className: "text-xs text-gray-500 dark:text-gray-400 w-20 text-right", children: !isFolder && formatFileSize(item.size) }),
|
|
6821
|
-
/* @__PURE__ */ jsx18("span", { className: "text-xs text-gray-500 dark:text-gray-400 w-24 text-right", children: formatDate(item.updatedAt || item.createdAt) })
|
|
6822
|
-
]
|
|
6823
|
-
}
|
|
6824
|
-
);
|
|
6825
|
-
}
|
|
6826
|
-
return /* @__PURE__ */ jsxs14(
|
|
6827
|
-
"div",
|
|
6828
|
-
{
|
|
6829
|
-
className: cn(
|
|
6830
|
-
"flex flex-col items-center p-3 rounded-xl cursor-pointer transition-all duration-200",
|
|
6831
|
-
"hover:bg-gray-100 dark:hover:bg-gray-800",
|
|
6832
|
-
isSelected && "bg-blue-50 dark:bg-blue-900/30 ring-2 ring-blue-500"
|
|
6833
|
-
),
|
|
6834
|
-
onClick: handleClick,
|
|
6835
|
-
onDoubleClick: handleDoubleClick,
|
|
6836
|
-
onContextMenu: handleContextMenu,
|
|
6837
|
-
children: [
|
|
6838
|
-
/* @__PURE__ */ jsx18("div", { className: "w-16 h-16 flex items-center justify-center mb-2", children: /* @__PURE__ */ jsx18(
|
|
6839
|
-
Icon,
|
|
6840
|
-
{
|
|
6841
|
-
className: cn(
|
|
6842
|
-
"w-12 h-12",
|
|
6843
|
-
isFolder ? "text-yellow-500" : "text-gray-500 dark:text-gray-400"
|
|
6844
|
-
)
|
|
6845
|
-
}
|
|
6846
|
-
) }),
|
|
6847
|
-
/* @__PURE__ */ jsx18("div", { className: "w-full text-center", children: isRenaming ? /* @__PURE__ */ jsx18(
|
|
6848
|
-
"input",
|
|
6849
|
-
{
|
|
6850
|
-
ref: inputRef,
|
|
6851
|
-
type: "text",
|
|
6852
|
-
value: renameValue,
|
|
6853
|
-
onChange: (e) => setRenameValue(e.target.value),
|
|
6854
|
-
onBlur: handleRenameSubmit,
|
|
6855
|
-
onKeyDown: handleRenameKeyDown,
|
|
6856
|
-
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",
|
|
6857
|
-
onClick: (e) => e.stopPropagation()
|
|
6858
|
-
}
|
|
6859
|
-
) : /* @__PURE__ */ jsx18("span", { className: "block text-xs text-gray-900 dark:text-gray-100 truncate px-1", children: item.name }) }),
|
|
6860
|
-
!isFolder && /* @__PURE__ */ jsx18("span", { className: "text-[10px] text-gray-500 dark:text-gray-400 mt-1", children: formatFileSize(item.size) })
|
|
6861
|
-
]
|
|
6862
|
-
}
|
|
6863
|
-
);
|
|
6864
|
-
};
|
|
6865
|
-
|
|
6866
|
-
// src/components/common/FileManager/components/FileGrid.tsx
|
|
6867
|
-
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
6868
|
-
var FileGrid = () => {
|
|
6869
|
-
const { currentFolderContents, texts, deselectAll, hideContextMenu } = useFileManager();
|
|
6870
|
-
const sortedItems = [...currentFolderContents].sort((a, b) => {
|
|
6871
|
-
if (a.type === "folder" && b.type !== "folder") return -1;
|
|
6872
|
-
if (a.type !== "folder" && b.type === "folder") return 1;
|
|
6873
|
-
return a.name.localeCompare(b.name);
|
|
6874
|
-
});
|
|
6875
|
-
const handleContainerClick = () => {
|
|
6876
|
-
deselectAll();
|
|
6877
|
-
hideContextMenu();
|
|
6878
|
-
};
|
|
6879
|
-
if (sortedItems.length === 0) {
|
|
6880
|
-
return /* @__PURE__ */ jsxs15(
|
|
6881
|
-
"div",
|
|
6882
|
-
{
|
|
6883
|
-
className: "flex-1 flex flex-col items-center justify-center text-gray-500 dark:text-gray-400 p-8",
|
|
6884
|
-
onClick: handleContainerClick,
|
|
6885
|
-
children: [
|
|
6886
|
-
/* @__PURE__ */ jsx19(FolderPlus, { className: "w-16 h-16 mb-4 opacity-50" }),
|
|
6887
|
-
/* @__PURE__ */ jsx19("p", { className: "text-lg", children: texts.noFiles }),
|
|
6888
|
-
/* @__PURE__ */ jsx19("p", { className: "text-sm mt-2", children: texts.dropFilesHere })
|
|
6889
|
-
]
|
|
6890
|
-
}
|
|
6891
|
-
);
|
|
6892
|
-
}
|
|
6893
|
-
return /* @__PURE__ */ jsx19(
|
|
6894
|
-
"div",
|
|
6895
|
-
{
|
|
6896
|
-
className: "flex-1 overflow-y-auto p-4",
|
|
6897
|
-
onClick: handleContainerClick,
|
|
6898
|
-
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)) })
|
|
6899
|
-
}
|
|
6900
|
-
);
|
|
6901
|
-
};
|
|
6902
|
-
|
|
6903
|
-
// src/components/common/FileManager/components/FileList.tsx
|
|
6904
|
-
import { FolderPlus as FolderPlus2 } from "lucide-react";
|
|
6905
|
-
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6906
|
-
var FileList = () => {
|
|
6907
|
-
const { currentFolderContents, texts, deselectAll, hideContextMenu } = useFileManager();
|
|
6908
|
-
const sortedItems = [...currentFolderContents].sort((a, b) => {
|
|
6909
|
-
if (a.type === "folder" && b.type !== "folder") return -1;
|
|
6910
|
-
if (a.type !== "folder" && b.type === "folder") return 1;
|
|
6911
|
-
return a.name.localeCompare(b.name);
|
|
6912
|
-
});
|
|
6913
|
-
const handleContainerClick = () => {
|
|
6914
|
-
deselectAll();
|
|
6915
|
-
hideContextMenu();
|
|
6916
|
-
};
|
|
6917
|
-
if (sortedItems.length === 0) {
|
|
6918
|
-
return /* @__PURE__ */ jsxs16(
|
|
6919
|
-
"div",
|
|
6920
|
-
{
|
|
6921
|
-
className: "flex-1 flex flex-col items-center justify-center text-gray-500 dark:text-gray-400 p-8",
|
|
6922
|
-
onClick: handleContainerClick,
|
|
6923
|
-
children: [
|
|
6924
|
-
/* @__PURE__ */ jsx20(FolderPlus2, { className: "w-16 h-16 mb-4 opacity-50" }),
|
|
6925
|
-
/* @__PURE__ */ jsx20("p", { className: "text-lg", children: texts.noFiles }),
|
|
6926
|
-
/* @__PURE__ */ jsx20("p", { className: "text-sm mt-2", children: texts.dropFilesHere })
|
|
6927
|
-
]
|
|
6928
|
-
}
|
|
6929
|
-
);
|
|
6930
|
-
}
|
|
6931
|
-
return /* @__PURE__ */ jsxs16(
|
|
6370
|
+
return /* @__PURE__ */ jsxs15(
|
|
6932
6371
|
"div",
|
|
6933
6372
|
{
|
|
6934
6373
|
className: "flex-1 overflow-y-auto p-4",
|
|
6935
6374
|
onClick: handleContainerClick,
|
|
6936
6375
|
children: [
|
|
6937
|
-
/* @__PURE__ */
|
|
6938
|
-
/* @__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" }),
|
|
6939
6378
|
" ",
|
|
6940
|
-
/* @__PURE__ */
|
|
6941
|
-
/* @__PURE__ */
|
|
6942
|
-
/* @__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" })
|
|
6943
6382
|
] }),
|
|
6944
|
-
/* @__PURE__ */
|
|
6383
|
+
/* @__PURE__ */ jsx19("div", { className: "space-y-1", children: sortedItems.map((item) => /* @__PURE__ */ jsx19(FileCard, { item, variant: "list" }, item.id)) })
|
|
6945
6384
|
]
|
|
6946
6385
|
}
|
|
6947
6386
|
);
|
|
6948
6387
|
};
|
|
6949
6388
|
|
|
6950
6389
|
// src/components/common/FileManager/components/Breadcrumb.tsx
|
|
6951
|
-
import
|
|
6390
|
+
import React12 from "react";
|
|
6952
6391
|
import { ChevronRight as ChevronRight3, ChevronLeft as ChevronLeft3 } from "lucide-react";
|
|
6953
|
-
import { jsx as
|
|
6392
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6954
6393
|
var Breadcrumb = () => {
|
|
6955
6394
|
const { pathHistory, navigateBack, navigateToPath } = useFileManager();
|
|
6956
|
-
return /* @__PURE__ */
|
|
6957
|
-
/* @__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(
|
|
6958
6397
|
"button",
|
|
6959
6398
|
{
|
|
6960
6399
|
onClick: navigateBack,
|
|
@@ -6964,12 +6403,12 @@ var Breadcrumb = () => {
|
|
|
6964
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"
|
|
6965
6404
|
),
|
|
6966
6405
|
title: "Retour",
|
|
6967
|
-
children: /* @__PURE__ */
|
|
6406
|
+
children: /* @__PURE__ */ jsx20(ChevronLeft3, { className: "w-4 h-4" })
|
|
6968
6407
|
}
|
|
6969
6408
|
),
|
|
6970
|
-
/* @__PURE__ */
|
|
6971
|
-
index > 0 && /* @__PURE__ */
|
|
6972
|
-
/* @__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(
|
|
6973
6412
|
"button",
|
|
6974
6413
|
{
|
|
6975
6414
|
onClick: () => navigateToPath(index),
|
|
@@ -6985,18 +6424,18 @@ var Breadcrumb = () => {
|
|
|
6985
6424
|
};
|
|
6986
6425
|
|
|
6987
6426
|
// src/components/common/FileManager/components/Toolbar.tsx
|
|
6988
|
-
import
|
|
6427
|
+
import React13, { useRef as useRef4, useState as useState14 } from "react";
|
|
6989
6428
|
import { FolderPlus as FolderPlus3, Upload as Upload2, Grid, List, X as X7 } from "lucide-react";
|
|
6990
|
-
import { Fragment as Fragment6, jsx as
|
|
6429
|
+
import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6991
6430
|
var CreateFolderModal = ({
|
|
6992
6431
|
isOpen,
|
|
6993
6432
|
onClose,
|
|
6994
6433
|
onSubmit,
|
|
6995
6434
|
texts
|
|
6996
6435
|
}) => {
|
|
6997
|
-
const [folderName, setFolderName] =
|
|
6436
|
+
const [folderName, setFolderName] = useState14("");
|
|
6998
6437
|
const inputRef = useRef4(null);
|
|
6999
|
-
|
|
6438
|
+
React13.useEffect(() => {
|
|
7000
6439
|
if (isOpen && inputRef.current) {
|
|
7001
6440
|
inputRef.current.focus();
|
|
7002
6441
|
}
|
|
@@ -7013,21 +6452,21 @@ var CreateFolderModal = ({
|
|
|
7013
6452
|
}
|
|
7014
6453
|
};
|
|
7015
6454
|
if (!isOpen) return null;
|
|
7016
|
-
return /* @__PURE__ */
|
|
7017
|
-
/* @__PURE__ */
|
|
7018
|
-
/* @__PURE__ */
|
|
7019
|
-
/* @__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(
|
|
7020
6459
|
"button",
|
|
7021
6460
|
{
|
|
7022
6461
|
onClick: onClose,
|
|
7023
6462
|
className: "p-1 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",
|
|
7024
|
-
children: /* @__PURE__ */
|
|
6463
|
+
children: /* @__PURE__ */ jsx21(X7, { className: "w-5 h-5 text-gray-500" })
|
|
7025
6464
|
}
|
|
7026
6465
|
)
|
|
7027
6466
|
] }),
|
|
7028
|
-
/* @__PURE__ */
|
|
7029
|
-
/* @__PURE__ */
|
|
7030
|
-
/* @__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(
|
|
7031
6470
|
"input",
|
|
7032
6471
|
{
|
|
7033
6472
|
ref: inputRef,
|
|
@@ -7038,8 +6477,8 @@ var CreateFolderModal = ({
|
|
|
7038
6477
|
placeholder: "Nouveau dossier"
|
|
7039
6478
|
}
|
|
7040
6479
|
),
|
|
7041
|
-
/* @__PURE__ */
|
|
7042
|
-
/* @__PURE__ */
|
|
6480
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex justify-end gap-3 mt-6", children: [
|
|
6481
|
+
/* @__PURE__ */ jsx21(
|
|
7043
6482
|
"button",
|
|
7044
6483
|
{
|
|
7045
6484
|
type: "button",
|
|
@@ -7048,7 +6487,7 @@ var CreateFolderModal = ({
|
|
|
7048
6487
|
children: texts.cancel
|
|
7049
6488
|
}
|
|
7050
6489
|
),
|
|
7051
|
-
/* @__PURE__ */
|
|
6490
|
+
/* @__PURE__ */ jsx21(
|
|
7052
6491
|
"button",
|
|
7053
6492
|
{
|
|
7054
6493
|
type: "submit",
|
|
@@ -7077,7 +6516,7 @@ var Toolbar = () => {
|
|
|
7077
6516
|
allowUpload,
|
|
7078
6517
|
texts
|
|
7079
6518
|
} = useFileManager();
|
|
7080
|
-
const [showCreateModal, setShowCreateModal] =
|
|
6519
|
+
const [showCreateModal, setShowCreateModal] = useState14(false);
|
|
7081
6520
|
const fileInputRef = useRef4(null);
|
|
7082
6521
|
const handleCreateFolder = async (name) => {
|
|
7083
6522
|
if (onCreateFolder && currentFolder) {
|
|
@@ -7104,10 +6543,10 @@ var Toolbar = () => {
|
|
|
7104
6543
|
fileInputRef.current.value = "";
|
|
7105
6544
|
}
|
|
7106
6545
|
};
|
|
7107
|
-
return /* @__PURE__ */
|
|
7108
|
-
/* @__PURE__ */
|
|
7109
|
-
/* @__PURE__ */
|
|
7110
|
-
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(
|
|
7111
6550
|
"button",
|
|
7112
6551
|
{
|
|
7113
6552
|
onClick: () => setShowCreateModal(true),
|
|
@@ -7117,13 +6556,13 @@ var Toolbar = () => {
|
|
|
7117
6556
|
"hover:bg-gray-200 dark:hover:bg-gray-700"
|
|
7118
6557
|
),
|
|
7119
6558
|
children: [
|
|
7120
|
-
/* @__PURE__ */
|
|
7121
|
-
/* @__PURE__ */
|
|
6559
|
+
/* @__PURE__ */ jsx21(FolderPlus3, { className: "w-4 h-4" }),
|
|
6560
|
+
/* @__PURE__ */ jsx21("span", { className: "hidden sm:inline", children: texts.createFolder })
|
|
7122
6561
|
]
|
|
7123
6562
|
}
|
|
7124
6563
|
),
|
|
7125
|
-
allowUpload && /* @__PURE__ */
|
|
7126
|
-
/* @__PURE__ */
|
|
6564
|
+
allowUpload && /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
6565
|
+
/* @__PURE__ */ jsxs17(
|
|
7127
6566
|
"button",
|
|
7128
6567
|
{
|
|
7129
6568
|
onClick: handleUploadClick,
|
|
@@ -7132,12 +6571,12 @@ var Toolbar = () => {
|
|
|
7132
6571
|
"bg-blue-600 text-white hover:bg-blue-700"
|
|
7133
6572
|
),
|
|
7134
6573
|
children: [
|
|
7135
|
-
/* @__PURE__ */
|
|
7136
|
-
/* @__PURE__ */
|
|
6574
|
+
/* @__PURE__ */ jsx21(Upload2, { className: "w-4 h-4" }),
|
|
6575
|
+
/* @__PURE__ */ jsx21("span", { className: "hidden sm:inline", children: texts.uploadFiles })
|
|
7137
6576
|
]
|
|
7138
6577
|
}
|
|
7139
6578
|
),
|
|
7140
|
-
/* @__PURE__ */
|
|
6579
|
+
/* @__PURE__ */ jsx21(
|
|
7141
6580
|
"input",
|
|
7142
6581
|
{
|
|
7143
6582
|
ref: fileInputRef,
|
|
@@ -7150,14 +6589,14 @@ var Toolbar = () => {
|
|
|
7150
6589
|
)
|
|
7151
6590
|
] })
|
|
7152
6591
|
] }),
|
|
7153
|
-
/* @__PURE__ */
|
|
7154
|
-
selectedItems.length > 0 && /* @__PURE__ */
|
|
6592
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
6593
|
+
selectedItems.length > 0 && /* @__PURE__ */ jsxs17(
|
|
7155
6594
|
"button",
|
|
7156
6595
|
{
|
|
7157
6596
|
onClick: deselectAll,
|
|
7158
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",
|
|
7159
6598
|
children: [
|
|
7160
|
-
/* @__PURE__ */
|
|
6599
|
+
/* @__PURE__ */ jsx21(X7, { className: "w-4 h-4" }),
|
|
7161
6600
|
texts.deselectAll,
|
|
7162
6601
|
" (",
|
|
7163
6602
|
selectedItems.length,
|
|
@@ -7165,8 +6604,8 @@ var Toolbar = () => {
|
|
|
7165
6604
|
]
|
|
7166
6605
|
}
|
|
7167
6606
|
),
|
|
7168
|
-
/* @__PURE__ */
|
|
7169
|
-
/* @__PURE__ */
|
|
6607
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center bg-gray-100 dark:bg-gray-800 rounded-lg p-1", children: [
|
|
6608
|
+
/* @__PURE__ */ jsx21(
|
|
7170
6609
|
"button",
|
|
7171
6610
|
{
|
|
7172
6611
|
onClick: () => setViewMode("grid"),
|
|
@@ -7175,10 +6614,10 @@ var Toolbar = () => {
|
|
|
7175
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"
|
|
7176
6615
|
),
|
|
7177
6616
|
title: "Vue grille",
|
|
7178
|
-
children: /* @__PURE__ */
|
|
6617
|
+
children: /* @__PURE__ */ jsx21(Grid, { className: "w-4 h-4" })
|
|
7179
6618
|
}
|
|
7180
6619
|
),
|
|
7181
|
-
/* @__PURE__ */
|
|
6620
|
+
/* @__PURE__ */ jsx21(
|
|
7182
6621
|
"button",
|
|
7183
6622
|
{
|
|
7184
6623
|
onClick: () => setViewMode("list"),
|
|
@@ -7187,13 +6626,13 @@ var Toolbar = () => {
|
|
|
7187
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"
|
|
7188
6627
|
),
|
|
7189
6628
|
title: "Vue liste",
|
|
7190
|
-
children: /* @__PURE__ */
|
|
6629
|
+
children: /* @__PURE__ */ jsx21(List, { className: "w-4 h-4" })
|
|
7191
6630
|
}
|
|
7192
6631
|
)
|
|
7193
6632
|
] })
|
|
7194
6633
|
] })
|
|
7195
6634
|
] }),
|
|
7196
|
-
/* @__PURE__ */
|
|
6635
|
+
/* @__PURE__ */ jsx21(
|
|
7197
6636
|
CreateFolderModal,
|
|
7198
6637
|
{
|
|
7199
6638
|
isOpen: showCreateModal,
|
|
@@ -7208,7 +6647,7 @@ var Toolbar = () => {
|
|
|
7208
6647
|
// src/components/common/FileManager/components/ContextMenu.tsx
|
|
7209
6648
|
import { useEffect as useEffect10, useRef as useRef5 } from "react";
|
|
7210
6649
|
import { FolderOpen as FolderOpen3, Edit3 as Edit32, Download as Download3, Trash2 as Trash23 } from "lucide-react";
|
|
7211
|
-
import { Fragment as Fragment7, jsx as
|
|
6650
|
+
import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7212
6651
|
var ContextMenu = () => {
|
|
7213
6652
|
const {
|
|
7214
6653
|
contextMenu,
|
|
@@ -7294,14 +6733,14 @@ var ContextMenu = () => {
|
|
|
7294
6733
|
menuStyle.top = position.y - menuHeight;
|
|
7295
6734
|
}
|
|
7296
6735
|
}
|
|
7297
|
-
return /* @__PURE__ */
|
|
6736
|
+
return /* @__PURE__ */ jsxs18(
|
|
7298
6737
|
"div",
|
|
7299
6738
|
{
|
|
7300
6739
|
ref: menuRef,
|
|
7301
6740
|
style: menuStyle,
|
|
7302
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]",
|
|
7303
6742
|
children: [
|
|
7304
|
-
/* @__PURE__ */
|
|
6743
|
+
/* @__PURE__ */ jsxs18(
|
|
7305
6744
|
"button",
|
|
7306
6745
|
{
|
|
7307
6746
|
onClick: handleOpen,
|
|
@@ -7310,12 +6749,12 @@ var ContextMenu = () => {
|
|
|
7310
6749
|
"text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"
|
|
7311
6750
|
),
|
|
7312
6751
|
children: [
|
|
7313
|
-
/* @__PURE__ */
|
|
6752
|
+
/* @__PURE__ */ jsx22(FolderOpen3, { className: "w-4 h-4" }),
|
|
7314
6753
|
texts.open
|
|
7315
6754
|
]
|
|
7316
6755
|
}
|
|
7317
6756
|
),
|
|
7318
|
-
allowRename && /* @__PURE__ */
|
|
6757
|
+
allowRename && /* @__PURE__ */ jsxs18(
|
|
7319
6758
|
"button",
|
|
7320
6759
|
{
|
|
7321
6760
|
onClick: handleRename,
|
|
@@ -7324,12 +6763,12 @@ var ContextMenu = () => {
|
|
|
7324
6763
|
"text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"
|
|
7325
6764
|
),
|
|
7326
6765
|
children: [
|
|
7327
|
-
/* @__PURE__ */
|
|
6766
|
+
/* @__PURE__ */ jsx22(Edit32, { className: "w-4 h-4" }),
|
|
7328
6767
|
texts.rename
|
|
7329
6768
|
]
|
|
7330
6769
|
}
|
|
7331
6770
|
),
|
|
7332
|
-
allowDownload && /* @__PURE__ */
|
|
6771
|
+
allowDownload && /* @__PURE__ */ jsxs18(
|
|
7333
6772
|
"button",
|
|
7334
6773
|
{
|
|
7335
6774
|
onClick: handleDownload,
|
|
@@ -7338,14 +6777,14 @@ var ContextMenu = () => {
|
|
|
7338
6777
|
"text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"
|
|
7339
6778
|
),
|
|
7340
6779
|
children: [
|
|
7341
|
-
/* @__PURE__ */
|
|
6780
|
+
/* @__PURE__ */ jsx22(Download3, { className: "w-4 h-4" }),
|
|
7342
6781
|
texts.download
|
|
7343
6782
|
]
|
|
7344
6783
|
}
|
|
7345
6784
|
),
|
|
7346
|
-
allowDelete && /* @__PURE__ */
|
|
7347
|
-
/* @__PURE__ */
|
|
7348
|
-
/* @__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(
|
|
7349
6788
|
"button",
|
|
7350
6789
|
{
|
|
7351
6790
|
onClick: handleDelete,
|
|
@@ -7354,7 +6793,7 @@ var ContextMenu = () => {
|
|
|
7354
6793
|
"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors"
|
|
7355
6794
|
),
|
|
7356
6795
|
children: [
|
|
7357
|
-
/* @__PURE__ */
|
|
6796
|
+
/* @__PURE__ */ jsx22(Trash23, { className: "w-4 h-4" }),
|
|
7358
6797
|
texts.delete
|
|
7359
6798
|
]
|
|
7360
6799
|
}
|
|
@@ -7366,14 +6805,14 @@ var ContextMenu = () => {
|
|
|
7366
6805
|
};
|
|
7367
6806
|
|
|
7368
6807
|
// src/components/common/FileManager/FileManager.tsx
|
|
7369
|
-
import { jsx as
|
|
6808
|
+
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7370
6809
|
var FileManagerContent = ({ className }) => {
|
|
7371
6810
|
const { viewMode, hideContextMenu } = useFileManager();
|
|
7372
|
-
const [sidebarOpen, setSidebarOpen] =
|
|
6811
|
+
const [sidebarOpen, setSidebarOpen] = useState15(false);
|
|
7373
6812
|
const handleMainClick = () => {
|
|
7374
6813
|
hideContextMenu();
|
|
7375
6814
|
};
|
|
7376
|
-
return /* @__PURE__ */
|
|
6815
|
+
return /* @__PURE__ */ jsxs19(
|
|
7377
6816
|
"div",
|
|
7378
6817
|
{
|
|
7379
6818
|
className: cn(
|
|
@@ -7382,7 +6821,7 @@ var FileManagerContent = ({ className }) => {
|
|
|
7382
6821
|
),
|
|
7383
6822
|
onClick: handleMainClick,
|
|
7384
6823
|
children: [
|
|
7385
|
-
/* @__PURE__ */
|
|
6824
|
+
/* @__PURE__ */ jsx23(
|
|
7386
6825
|
"button",
|
|
7387
6826
|
{
|
|
7388
6827
|
onClick: (e) => {
|
|
@@ -7390,17 +6829,17 @@ var FileManagerContent = ({ className }) => {
|
|
|
7390
6829
|
setSidebarOpen(!sidebarOpen);
|
|
7391
6830
|
},
|
|
7392
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",
|
|
7393
|
-
children: sidebarOpen ? /* @__PURE__ */
|
|
6832
|
+
children: sidebarOpen ? /* @__PURE__ */ jsx23(X8, { className: "w-6 h-6" }) : /* @__PURE__ */ jsx23(Menu3, { className: "w-6 h-6" })
|
|
7394
6833
|
}
|
|
7395
6834
|
),
|
|
7396
|
-
sidebarOpen && /* @__PURE__ */
|
|
6835
|
+
sidebarOpen && /* @__PURE__ */ jsx23(
|
|
7397
6836
|
"div",
|
|
7398
6837
|
{
|
|
7399
6838
|
className: "md:hidden fixed inset-0 bg-black/50 z-40",
|
|
7400
6839
|
onClick: () => setSidebarOpen(false)
|
|
7401
6840
|
}
|
|
7402
6841
|
),
|
|
7403
|
-
/* @__PURE__ */
|
|
6842
|
+
/* @__PURE__ */ jsxs19(
|
|
7404
6843
|
"aside",
|
|
7405
6844
|
{
|
|
7406
6845
|
className: cn(
|
|
@@ -7410,33 +6849,33 @@ var FileManagerContent = ({ className }) => {
|
|
|
7410
6849
|
sidebarOpen ? "translate-x-0" : "-translate-x-full md:translate-x-0"
|
|
7411
6850
|
),
|
|
7412
6851
|
children: [
|
|
7413
|
-
/* @__PURE__ */
|
|
7414
|
-
/* @__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, {})
|
|
7415
6854
|
]
|
|
7416
6855
|
}
|
|
7417
6856
|
),
|
|
7418
|
-
/* @__PURE__ */
|
|
7419
|
-
/* @__PURE__ */
|
|
7420
|
-
/* @__PURE__ */
|
|
7421
|
-
/* @__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, {})
|
|
7422
6861
|
] }),
|
|
7423
|
-
viewMode === "grid" ? /* @__PURE__ */
|
|
6862
|
+
viewMode === "grid" ? /* @__PURE__ */ jsx23(FileGrid, {}) : /* @__PURE__ */ jsx23(FileList, {})
|
|
7424
6863
|
] }),
|
|
7425
|
-
/* @__PURE__ */
|
|
6864
|
+
/* @__PURE__ */ jsx23(ContextMenu, {})
|
|
7426
6865
|
]
|
|
7427
6866
|
}
|
|
7428
6867
|
);
|
|
7429
6868
|
};
|
|
7430
6869
|
var FileManager = (props) => {
|
|
7431
|
-
return /* @__PURE__ */
|
|
6870
|
+
return /* @__PURE__ */ jsx23(FileManagerProvider, { ...props, children: /* @__PURE__ */ jsx23(FileManagerContent, { className: props.className }) });
|
|
7432
6871
|
};
|
|
7433
6872
|
|
|
7434
6873
|
// src/components/common/FileManager/components/EntityFileManager.tsx
|
|
7435
|
-
import
|
|
6874
|
+
import React16 from "react";
|
|
7436
6875
|
import { Loader2 as Loader22, FolderX, AlertCircle as AlertCircle4, RefreshCw as RefreshCw3 } from "lucide-react";
|
|
7437
6876
|
|
|
7438
6877
|
// src/components/common/FileManager/hooks/useFileManagerApi.ts
|
|
7439
|
-
import { useState as
|
|
6878
|
+
import { useState as useState16, useEffect as useEffect11, useCallback as useCallback3 } from "react";
|
|
7440
6879
|
|
|
7441
6880
|
// src/components/common/FileManager/services/fileManagerApi.ts
|
|
7442
6881
|
var API_BASE = "/api/files_manager";
|
|
@@ -7661,10 +7100,10 @@ function extractRootChildren(entityFolder) {
|
|
|
7661
7100
|
return entityFolder.children || [];
|
|
7662
7101
|
}
|
|
7663
7102
|
function useFileManagerApi(entityType, entityId, businessEntityId) {
|
|
7664
|
-
const [data, setData] =
|
|
7665
|
-
const [loading, setLoading] =
|
|
7666
|
-
const [error, setError] =
|
|
7667
|
-
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);
|
|
7668
7107
|
const loadEntityFolders = useCallback3(async () => {
|
|
7669
7108
|
setLoading(true);
|
|
7670
7109
|
setError(null);
|
|
@@ -7796,7 +7235,7 @@ function useFileManagerApi(entityType, entityId, businessEntityId) {
|
|
|
7796
7235
|
}
|
|
7797
7236
|
|
|
7798
7237
|
// src/components/common/FileManager/components/EntityFileManager.tsx
|
|
7799
|
-
import { jsx as
|
|
7238
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7800
7239
|
function getRootName(entityType) {
|
|
7801
7240
|
const names = {
|
|
7802
7241
|
CLIENT: "Documents Client",
|
|
@@ -7807,118 +7246,703 @@ function getRootName(entityType) {
|
|
|
7807
7246
|
};
|
|
7808
7247
|
return names[entityType] || "Documents";
|
|
7809
7248
|
}
|
|
7810
|
-
var LoadingState = ({ height = "400px" }) => /* @__PURE__ */
|
|
7249
|
+
var LoadingState = ({ height = "400px" }) => /* @__PURE__ */ jsxs20(
|
|
7811
7250
|
"div",
|
|
7812
7251
|
{
|
|
7813
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",
|
|
7814
7253
|
style: { height },
|
|
7815
7254
|
children: [
|
|
7816
|
-
/* @__PURE__ */
|
|
7817
|
-
/* @__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..." })
|
|
7818
7257
|
]
|
|
7819
7258
|
}
|
|
7820
7259
|
);
|
|
7821
|
-
var ErrorState = ({ error, onRetry, height = "400px" }) => /* @__PURE__ */
|
|
7260
|
+
var ErrorState = ({ error, onRetry, height = "400px" }) => /* @__PURE__ */ jsxs20(
|
|
7822
7261
|
"div",
|
|
7823
7262
|
{
|
|
7824
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",
|
|
7825
7264
|
style: { height },
|
|
7826
7265
|
children: [
|
|
7827
|
-
/* @__PURE__ */
|
|
7828
|
-
/* @__PURE__ */
|
|
7829
|
-
/* @__PURE__ */
|
|
7830
|
-
/* @__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(
|
|
7831
7270
|
"button",
|
|
7832
7271
|
{
|
|
7833
7272
|
onClick: onRetry,
|
|
7834
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",
|
|
7835
7274
|
children: [
|
|
7836
|
-
/* @__PURE__ */
|
|
7275
|
+
/* @__PURE__ */ jsx24(RefreshCw3, { className: "w-4 h-4" }),
|
|
7837
7276
|
"R\xE9essayer"
|
|
7838
7277
|
]
|
|
7839
7278
|
}
|
|
7840
|
-
)
|
|
7841
|
-
]
|
|
7842
|
-
}
|
|
7843
|
-
);
|
|
7844
|
-
var EmptyState = ({ height = "400px" }) => /* @__PURE__ */
|
|
7845
|
-
"div",
|
|
7846
|
-
{
|
|
7847
|
-
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",
|
|
7848
|
-
style: { height },
|
|
7849
|
-
children: [
|
|
7850
|
-
/* @__PURE__ */
|
|
7851
|
-
/* @__PURE__ */
|
|
7852
|
-
/* @__PURE__ */
|
|
7853
|
-
]
|
|
7854
|
-
}
|
|
7855
|
-
);
|
|
7856
|
-
var EntityFileManager = ({
|
|
7857
|
-
entityType,
|
|
7858
|
-
entityId,
|
|
7859
|
-
businessEntityId,
|
|
7860
|
-
className,
|
|
7861
|
-
height = "600px",
|
|
7862
|
-
// Permissions (défaut: tout autorisé)
|
|
7863
|
-
allowUpload = true,
|
|
7864
|
-
allowCreateFolder = true,
|
|
7865
|
-
allowRename = true,
|
|
7866
|
-
allowDelete = true,
|
|
7867
|
-
allowDownload = true,
|
|
7868
|
-
// Callbacks
|
|
7869
|
-
onFileSelect,
|
|
7870
|
-
onFileOpen,
|
|
7871
|
-
onUploadSuccess,
|
|
7872
|
-
onError
|
|
7873
|
-
}) => {
|
|
7874
|
-
const { data, loading, error, refresh, handlers } = useFileManagerApi(
|
|
7875
|
-
entityType,
|
|
7876
|
-
entityId,
|
|
7877
|
-
businessEntityId
|
|
7878
|
-
);
|
|
7879
|
-
|
|
7880
|
-
if (error && onError) {
|
|
7881
|
-
onError(error);
|
|
7882
|
-
}
|
|
7883
|
-
}, [error, onError]);
|
|
7884
|
-
if (loading) {
|
|
7885
|
-
return /* @__PURE__ */
|
|
7886
|
-
}
|
|
7887
|
-
if (error) {
|
|
7888
|
-
return /* @__PURE__ */
|
|
7889
|
-
}
|
|
7890
|
-
if (!data || data.length === 0) {
|
|
7891
|
-
return /* @__PURE__ */
|
|
7892
|
-
}
|
|
7893
|
-
const handleUploadFiles = async (files, parentId) => {
|
|
7894
|
-
const result = await handlers.onUploadFiles(files, parentId);
|
|
7895
|
-
if (result && onUploadSuccess) {
|
|
7896
|
-
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;
|
|
7897
7885
|
}
|
|
7898
|
-
return result;
|
|
7899
7886
|
};
|
|
7900
|
-
|
|
7901
|
-
|
|
7887
|
+
if (!isOpen) return null;
|
|
7888
|
+
return /* @__PURE__ */ jsxs21(
|
|
7889
|
+
Modals_default,
|
|
7902
7890
|
{
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
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
|
+
]
|
|
7919
7939
|
}
|
|
7920
|
-
)
|
|
7940
|
+
);
|
|
7921
7941
|
};
|
|
7942
|
+
var MinimalVendorForm = FormVendor;
|
|
7943
|
+
|
|
7944
|
+
// src/components/common/FormClient.tsx
|
|
7945
|
+
import { useState as useState18 } from "react";
|
|
7922
7946
|
|
|
7923
7947
|
// src/models/Client.ts
|
|
7924
7948
|
var TEMPLATE_FNE_CHOICES = [
|