|
|
|
@@ -1,10 +1,11 @@
|
|
|
|
|
import React from "react";
|
|
|
|
|
import { Sheet, WholeWord, Search, DatabaseZap } from "lucide-react";
|
|
|
|
|
import React, { useEffect } from "react";
|
|
|
|
|
import { Sheet, WholeWord, Search, DatabaseZap, FileDown } from "lucide-react";
|
|
|
|
|
import { useState } from "react";
|
|
|
|
|
import ImportGUI from "./ImportGUI";
|
|
|
|
|
import Cookies from "js-cookie";
|
|
|
|
|
import { removeSelection } from "../utils/tableActions";
|
|
|
|
|
import DangerZone from "./DangerZone";
|
|
|
|
|
import { myToast } from "../utils/toastify";
|
|
|
|
|
|
|
|
|
|
type SubHeaderAdminProps = {
|
|
|
|
|
setFiles: (files: File[]) => void;
|
|
|
|
@@ -22,6 +23,13 @@ const SubHeaderAdmin: React.FC<SubHeaderAdminProps> = ({
|
|
|
|
|
}) => {
|
|
|
|
|
const [showImport, setShowImport] = useState(false);
|
|
|
|
|
const [showDanger, setShowDanger] = useState(false);
|
|
|
|
|
const [exporting, setExporting] = useState(false);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (exporting) {
|
|
|
|
|
myToast("Export in Bearbeitung...", "info");
|
|
|
|
|
}
|
|
|
|
|
}, [exporting]);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
@@ -62,6 +70,17 @@ const SubHeaderAdmin: React.FC<SubHeaderAdminProps> = ({
|
|
|
|
|
/>
|
|
|
|
|
<span className="whitespace-nowrap">Losnummern importieren</span>
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => setExporting(true)}
|
|
|
|
|
type="button"
|
|
|
|
|
className="group inline-flex items-center gap-2 rounded-md border border-gray-300 bg-white px-3.5 py-2 text-sm font-medium text-gray-700 shadow-sm transition hover:bg-gray-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/60 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
|
|
|
|
|
>
|
|
|
|
|
<FileDown
|
|
|
|
|
className="h-4 w-4 shrink-0 text-gray-500 transition group-hover:text-gray-600"
|
|
|
|
|
strokeWidth={1.75}
|
|
|
|
|
/>
|
|
|
|
|
<span className="whitespace-nowrap">Losnummern exportieren</span>
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => {
|
|
|
|
|
removeSelection(Cookies.get("token") || "");
|
|
|
|
@@ -99,9 +118,7 @@ const SubHeaderAdmin: React.FC<SubHeaderAdminProps> = ({
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{showDanger && (
|
|
|
|
|
<DangerZone onClose={() => setShowDanger(false)} />
|
|
|
|
|
)}
|
|
|
|
|
{showDanger && <DangerZone onClose={() => setShowDanger(false)} />}
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|