stand_2026_10_08
This commit is contained in:
1 parent
266f8c3b4f
commit
05f4390392
7 files changed
+149
-3
No files matched your search
@@ -64,7 +64,13 @@ export const Sites = {
|
|||||||
name:"Units",
|
name:"Units",
|
||||||
new:{url: `/rk2/units//edit/new`, name:"Neue Unit" }
|
new:{url: `/rk2/units//edit/new`, name:"Neue Unit" }
|
||||||
},
|
},
|
||||||
signals: { url: `/rk2/signale`, name:"Signale" },
|
signals: {
|
||||||
|
url: `/rk2/signals`, name:"EA's" ,
|
||||||
|
import:{
|
||||||
|
url:`/rk2/signals/import`, name:"Import" ,
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
ios: { url: `/rk2/ios`, name:"IO " },
|
ios: { url: `/rk2/ios`, name:"IO " },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,3 +110,24 @@ export async function api_signals_update(id:string,data: SignalCreate): Promise<
|
|||||||
return { success: true, data:resultData };
|
return { success: true, data:resultData };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//--- Upload EA Excel File
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
export async function api_signals_excel_upload(formData:any): Promise<ActionResult<any>> {
|
||||||
|
|
||||||
|
const result = await fetch(`${url_signals}/upload`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: formData,
|
||||||
|
})
|
||||||
|
|
||||||
|
const resultData = await result.json();
|
||||||
|
|
||||||
|
if (!result.ok) {
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
errors: resultData.message, // kommt aus NestJS
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return { success: true, data:resultData };
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
|
import { Sites } from "@/_config/sites";
|
||||||
import { api_anlage_getSelected } from "@/actions/rk/api-anlage";
|
import { api_anlage_getSelected } from "@/actions/rk/api-anlage";
|
||||||
import { Anlage } from "@/types/rk";
|
import { Anlage } from "@/types/rk";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
@@ -41,6 +42,9 @@ export default function AnlageLayout({ children }: Props) {
|
|||||||
<li>
|
<li>
|
||||||
<a href="/rk2/units">Units</a>
|
<a href="/rk2/units">Units</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href={Sites.rk2.signals.url}>{Sites.rk2.signals.name}</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import { Sites } from "@/_config/sites";
|
||||||
|
import { api_units } from "@/actions/rk2/api-units";
|
||||||
|
|
||||||
|
import { api_anlage_getSelected } from "@/actions/rk/api-anlage";
|
||||||
|
|
||||||
|
|
||||||
|
import Link from "next/link";
|
||||||
|
import { List, ListItem, ListItemAction } from "@/components/ui/list";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import Breadcrumbs from "@/components/ui/navigation/breadcrumbs";
|
||||||
|
import SignalExcelUpload from "@/components/rk2/signals/signalExcelUpload";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default async function PageImport() {
|
||||||
|
|
||||||
|
const currentAnlage = await api_anlage_getSelected();
|
||||||
|
const units = await api_units();
|
||||||
|
const breadcrumb = [{ label: "RK", href: "/" },{ label: `${Sites.rk2.signals.name}`, href:`${Sites.rk2.signals.url}` },{ label: `${Sites.rk2.signals.import.name}` },{ label: `${currentAnlage.anlageNr+" "+currentAnlage.name}` }]
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* Main-Nav */}
|
||||||
|
<Breadcrumbs items={breadcrumb}/>
|
||||||
|
|
||||||
|
<div className="flex flex-col m-4 w-170 ">
|
||||||
|
<SignalExcelUpload />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import { Sites } from "@/_config/sites";
|
||||||
|
import { api_units } from "@/actions/rk2/api-units";
|
||||||
|
|
||||||
|
import { api_anlage_getSelected } from "@/actions/rk/api-anlage";
|
||||||
|
|
||||||
|
|
||||||
|
import Link from "next/link";
|
||||||
|
import { List, ListItem, ListItemAction } from "@/components/ui/list";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import Breadcrumbs from "@/components/ui/navigation/breadcrumbs";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default async function PageSignale() {
|
||||||
|
|
||||||
|
const currentAnlage = await api_anlage_getSelected();
|
||||||
|
const units = await api_units();
|
||||||
|
const breadcrumb = [{ label: "RK", href: "/" },{ label: "Signale" },{ label: `${currentAnlage.anlageNr+" "+currentAnlage.name}` }]
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* Main-Nav */}
|
||||||
|
<Breadcrumbs items={breadcrumb}/>
|
||||||
|
|
||||||
|
<div className="flex flex-col m-4 w-170 ">
|
||||||
|
<List variant={"default"} size={"lg"} >
|
||||||
|
<ListItem hover={true} >
|
||||||
|
<a href={Sites.rk2.signals.import.url}>{Sites.rk2.signals.import.name}</a>
|
||||||
|
</ListItem>
|
||||||
|
</List>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -15,8 +15,8 @@ export default async function PageShowDraw() {
|
|||||||
return (
|
return (
|
||||||
<div className="bg-gray-200">
|
<div className="bg-gray-200">
|
||||||
<svg
|
<svg
|
||||||
width="180%"
|
width="100%"
|
||||||
height="180%"
|
height="100%"
|
||||||
viewBox={`${0} ${0} ${1820} ${1120}`}
|
viewBox={`${0} ${0} ${1820} ${1120}`}
|
||||||
>
|
>
|
||||||
<rect x1={1} y1={0} width={1750} height={1500} fill="#fee0fe" stroke="#000" strokeWidth={1} />
|
<rect x1={1} y1={0} width={1750} height={1500} fill="#fee0fe" stroke="#000" strokeWidth={1} />
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { api_signals_excel_upload } from "@/actions/rk2/api-signals";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
interface Props{
|
||||||
|
onLoadData?:any
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function SignalExcelUpload() {
|
||||||
|
|
||||||
|
const [file, setFile] = useState<File | null>(null);
|
||||||
|
const [data, setData] = useState<any>();
|
||||||
|
|
||||||
|
const uploadExcel = async () => {
|
||||||
|
if (!file) return;
|
||||||
|
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("file", file);
|
||||||
|
|
||||||
|
const response = await api_signals_excel_upload(formData)
|
||||||
|
|
||||||
|
if (!response.success) {
|
||||||
|
throw new Error("Upload fehlgeschlagen");
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await response.data;
|
||||||
|
setData(result)
|
||||||
|
console.log(result);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<input
|
||||||
|
type="file"
|
||||||
|
accept=".xlsx,.xls"
|
||||||
|
onChange={(e) =>
|
||||||
|
setFile(e.target.files?.[0] ?? null)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<button onClick={uploadExcel}>
|
||||||
|
Excel hochladen
|
||||||
|
</button>
|
||||||
|
{data && <div>{JSON.stringify(data,null,2)}</div>}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user