feat(lstv2 move): moved lstv2 into this app to keep them combined and easier to maintain

This commit is contained in:
2025-09-19 22:22:05 -05:00
parent caf2315191
commit e4477402ad
847 changed files with 165801 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import BGPage from "@/components/logistics/barcodeGenerator/BGPage";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/(logistics)/barcodegen/")({
component: RouteComponent,
});
function RouteComponent() {
return (
<div>
<BGPage />
</div>
);
}

View File

@@ -0,0 +1,28 @@
import DmPage from "@/components/logistics/dm/dmPage";
import { createFileRoute, redirect } from "@tanstack/react-router";
export const Route = createFileRoute("/(logistics)/dm/")({
component: RouteComponent,
beforeLoad: async () => {
const auth = localStorage.getItem("auth_token");
if (!auth) {
throw redirect({
to: "/login",
search: {
// Use the current location to power a redirect after login
// (Do not use `router.state.resolvedLocation` as it can
// potentially lag behind the actual current location)
redirect: location.pathname + location.search,
},
});
}
},
});
function RouteComponent() {
return (
<div>
<DmPage />
</div>
);
}

View File

@@ -0,0 +1,28 @@
import HelperPage from "@/components/logistics/helperCommands/helperPage";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/(logistics)/helperCommands/")({
component: RouteComponent,
// beforeLoad: async () => {
// const auth = localStorage.getItem("auth_token");
// if (!auth) {
// throw redirect({
// to: "/login",
// search: {
// // Use the current location to power a redirect after login
// // (Do not use `router.state.resolvedLocation` as it can
// // potentially lag behind the actual current location)
// redirect: location.pathname + location.search,
// },
// });
// }
// },
});
function RouteComponent() {
return (
<div>
<HelperPage />
</div>
);
}

View File

@@ -0,0 +1,42 @@
import ConsumeMaterial from "@/components/logistics/materialHelper/consumption/ConsumeMaterial";
import PreformReturn from "@/components/logistics/materialHelper/consumption/MaterialReturn";
import TransferToNextLot from "@/components/logistics/materialHelper/consumption/TransferToNextLot";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute(
"/(logistics)/materialHelper/consumption/"
)({
component: RouteComponent,
head: () => ({
meta: [
{
name: "description",
content: "My App is a web application",
},
{
title: "LST - Logistics",
},
],
}),
});
function RouteComponent() {
const url: string = window.location.host.split(":")[0];
const auth = localStorage.getItem("auth_token");
return (
<div className="flex flex-wrap">
{auth ? (
<>
<ConsumeMaterial />
{url === "localhost" && <PreformReturn />}
<TransferToNextLot />
</>
) : (
<>
<ConsumeMaterial />
<TransferToNextLot />
</>
)}
</div>
);
}

View File

@@ -0,0 +1,25 @@
import MaterialHelperPage from "@/components/logistics/materialHelper/materialHelperPage";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/(logistics)/materialHelper/")({
component: RouteComponent,
head: () => ({
meta: [
{
name: "description",
content: "My App is a web application",
},
{
title: "LST - Logistics",
},
],
}),
});
function RouteComponent() {
return (
<div>
<MaterialHelperPage />
</div>
);
}

View File

@@ -0,0 +1,9 @@
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/(logistics)/materialHelper/siloLink/')({
component: RouteComponent,
})
function RouteComponent() {
return <div>Hello "/(logistics)/materialHelper/siloLink/"!</div>
}

View File

@@ -0,0 +1,14 @@
import OpenOrders from "@/components/logistics/warehouse/openOrders";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/(logistics)/openOrders/")({
component: RouteComponent,
});
function RouteComponent() {
return (
<div className="m-5 w-11/12 h-9/10">
<OpenOrders />
</div>
);
}

View File

@@ -0,0 +1,32 @@
import HistoricalData from "@/components/logistics/siloAdjustments/HistoricalData";
import { createFileRoute, redirect } from "@tanstack/react-router";
export const Route = createFileRoute("/(logistics)/siloAdjustments/$hist")({
component: RouteComponent,
beforeLoad: async () => {
const auth = localStorage.getItem("auth_token");
if (!auth) {
throw redirect({
to: "/login",
search: {
// Use the current location to power a redirect after login
// (Do not use `router.state.resolvedLocation` as it can
// potentially lag behind the actual current location)
redirect: location.pathname + location.search,
},
});
}
},
// In a loader
loader: ({ params }) => params.hist,
// Or in a component
});
function RouteComponent() {
const { hist } = Route.useParams();
return (
<div>
<HistoricalData laneId={hist} />
</div>
);
}

View File

@@ -0,0 +1,34 @@
import Comment from "@/components/logistics/siloAdjustments/Comment";
import { createFileRoute, redirect } from "@tanstack/react-router";
export const Route = createFileRoute(
"/(logistics)/siloAdjustments/comment/$comment"
)({
beforeLoad: async () => {
const auth = localStorage.getItem("auth_token");
if (!auth) {
throw redirect({
to: "/login",
search: {
// Use the current location to power a redirect after login
// (Do not use `router.state.resolvedLocation` as it can
// potentially lag behind the actual current location)
redirect: location.pathname + location.search,
},
});
}
},
// In a loader
loader: ({ params }) => params.comment,
// Or in a component
component: RouteComponent,
});
function RouteComponent() {
const { comment } = Route.useParams();
return (
<div className="ml-20 mt-20">
<Comment id={comment} />
</div>
);
}

View File

@@ -0,0 +1,28 @@
import SiloPage from "@/components/logistics/siloAdjustments/SiloPage";
import { createFileRoute, redirect } from "@tanstack/react-router";
export const Route = createFileRoute("/(logistics)/siloAdjustments/")({
component: RouteComponent,
beforeLoad: async () => {
const auth = localStorage.getItem("auth_token");
if (!auth) {
throw redirect({
to: "/login",
search: {
// Use the current location to power a redirect after login
// (Do not use `router.state.resolvedLocation` as it can
// potentially lag behind the actual current location)
redirect: location.pathname + location.search,
},
});
}
},
});
function RouteComponent() {
return (
<div>
<SiloPage />
</div>
);
}

View File

@@ -0,0 +1,14 @@
import OcmeCycleCount from "@/components/ocme/ocmeCycleCount";
import {createFileRoute} from "@tanstack/react-router";
export const Route = createFileRoute("/(ocme)/cyclecount/")({
component: RouteComponent,
});
function RouteComponent() {
return (
<div className="m-2">
<OcmeCycleCount />
</div>
);
}

View File

@@ -0,0 +1,28 @@
import PasswordChange from "@/components/user/PasswordChange";
import { createFileRoute, redirect } from "@tanstack/react-router";
export const Route = createFileRoute("/(user)/passwordChange")({
component: RouteComponent,
beforeLoad: async () => {
const auth = localStorage.getItem("auth_token");
if (!auth) {
throw redirect({
to: "/login",
search: {
// Use the current location to power a redirect after login
// (Do not use `router.state.resolvedLocation` as it can
// potentially lag behind the actual current location)
redirect: location.pathname + location.search,
},
});
}
},
});
function RouteComponent() {
return (
<div>
<PasswordChange />
</div>
);
}

View File

@@ -0,0 +1,142 @@
import {
createRootRoute,
Link,
Outlet,
useLocation,
} from "@tanstack/react-router";
//import {TanStackRouterDevtools} from "@tanstack/router-devtools";
import Cookies from "js-cookie";
import { SidebarProvider } from "../components/ui/sidebar";
import { ThemeProvider } from "../components/layout/theme-provider";
import { ModeToggle } from "../components/layout/mode-toggle";
import { AppSidebar } from "../components/layout/lst-sidebar";
import { Avatar, AvatarFallback, AvatarImage } from "../components/ui/avatar";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "../components/ui/dropdown-menu";
import { SessionProvider } from "../components/providers/Providers";
import { Toaster } from "sonner";
//import { Button } from "../components/ui/button";
import { useSessionStore } from "../lib/store/sessionStore";
import { useSession } from "@/hooks/useSession";
import { useLogout } from "@/hooks/useLogout";
import ExportInventoryData from "@/components/logistics/warehouse/ExportInventoryData";
import { AddCards } from "@/components/dashboard/AddCards";
import DMButtons from "@/components/logistics/dm/DMButtons";
import { useSettingStore } from "@/lib/store/useSettings";
//import { AddCards } from "@/components/dashboard/AddCards";
// same as the layout
export const Route = createRootRoute({
component: () => {
const sidebarState = Cookies.get("sidebar_state") === "true";
const { session } = useSession();
const { user } = useSessionStore();
const logout = useLogout();
const location = useLocation();
const { settings } = useSettingStore();
const server = settings.filter((n: any) => n.name === "dbServer");
return (
<div className="overflow-hidden">
<SessionProvider>
<ThemeProvider>
<nav className="flex justify-end w-full shadow ">
<div className="m-2 flex flex-row">
{/* Inventory section */}
{location.pathname === "/" && (
<div className="m-auto pr-2 flex flex-row gap-2">
<ExportInventoryData />
<AddCards />
</div>
)}
{/* Demand mgt section this should also include plant token stuff */}
{location.pathname === "/dm" && (
<div className="m-auto pr-2 flex flex-row gap-2">
<DMButtons />
</div>
)}
<div className="m-1">
<ModeToggle />
</div>
<div className="mr-1 ml-1">
{settings.length > 0 && (
<a
href={`https://${server[0].value}.alpla.net/lst/d`}
target="_blank"
>
LST - Docs
</a>
)}
</div>
{session ? (
<div className="m-1">
<DropdownMenu>
<DropdownMenuTrigger>
<Avatar>
<AvatarImage
src="https://github.com/shadcn.png"
alt="@shadcn"
/>
<AvatarFallback>
CN
</AvatarFallback>
</Avatar>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuLabel>
Hello {user?.username}
</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuItem>
<Link to="/passwordChange">
Password Change
</Link>
</DropdownMenuItem>
{/* <DropdownMenuItem>Billing</DropdownMenuItem>
<DropdownMenuItem>Team</DropdownMenuItem>
<DropdownMenuItem>Subscription</DropdownMenuItem> */}
<hr className="solid"></hr>
<DropdownMenuItem>
<div className="m-auto">
<button
onClick={() =>
logout()
}
>
Logout
</button>
</div>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
) : (
<div>
<Link to="/login">Login</Link>
</div>
)}
</div>
</nav>
<main>
<SidebarProvider defaultOpen={sidebarState}>
<AppSidebar />
<Toaster expand={true} richColors closeButton />
<Outlet />
</SidebarProvider>
</main>
</ThemeProvider>
</SessionProvider>
{/* <TanStackRouterDevtools position="bottom-right" /> */}
</div>
);
},
});

View File

@@ -0,0 +1,19 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
// src/routes/_authenticated.tsx
export const Route = createFileRoute("/_admin")({
beforeLoad: async () => {
const auth = localStorage.getItem("auth_token");
if (!auth) {
throw redirect({
to: "/login",
search: {
// Use the current location to power a redirect after login
// (Do not use `router.state.resolvedLocation` as it can
// potentially lag behind the actual current location)
redirect: location.pathname + location.search,
},
});
}
},
});

View File

@@ -0,0 +1,14 @@
import ModulesPage from "@/components/admin/modules/ModulePage";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/_admin/modules")({
component: RouteComponent,
});
function RouteComponent() {
return (
<div>
<ModulesPage />
</div>
);
}

View File

@@ -0,0 +1,14 @@
import NotificationMGT from "@/components/admin/notificationMGT/NotificationMGT";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/_admin/notificationMGT")({
component: RouteComponent,
});
function RouteComponent() {
return (
<div>
<NotificationMGT />
</div>
);
}

View File

@@ -0,0 +1,14 @@
import ProdUserCard from "@/components/admin/prodUser/ProdUserCard";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/_admin/prodUsers")({
component: RouteComponent,
});
function RouteComponent() {
return (
<div>
<ProdUserCard />
</div>
);
}

View File

@@ -0,0 +1,14 @@
import ServerPage from "@/components/admin/servers/ServerPage";
import {createFileRoute} from "@tanstack/react-router";
export const Route = createFileRoute("/_admin/servers")({
component: RouteComponent,
});
function RouteComponent() {
return (
<div>
<ServerPage />
</div>
);
}

View File

@@ -0,0 +1,14 @@
import SettingsPage from "@/components/admin/settings/SettingsPage";
import {createFileRoute} from "@tanstack/react-router";
export const Route = createFileRoute("/_admin/settings")({
component: RouteComponent,
});
function RouteComponent() {
return (
<div>
<SettingsPage />
</div>
);
}

View File

@@ -0,0 +1,14 @@
import SubModulePage from "@/components/admin/supModules/SubModulePage";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/_admin/subModules")({
component: RouteComponent,
});
function RouteComponent() {
return (
<div>
<SubModulePage />
</div>
);
}

View File

@@ -0,0 +1,10 @@
import UserPage from "@/components/admin/user/UserPage";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/_admin/users")({
component: RouteComponent,
});
function RouteComponent() {
return <UserPage />;
}

View File

@@ -0,0 +1,19 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
// src/routes/_authenticated.tsx
export const Route = createFileRoute("/_auth")({
beforeLoad: async () => {
const auth = localStorage.getItem("auth_token");
if (!auth) {
throw redirect({
to: "/login",
search: {
// Use the current location to power a redirect after login
// (Do not use `router.state.resolvedLocation` as it can
// potentially lag behind the actual current location)
redirect: location.href,
},
});
}
},
});

View File

@@ -0,0 +1,9 @@
import {createFileRoute} from "@tanstack/react-router";
export const Route = createFileRoute("/_auth/profile")({
component: RouteComponent,
});
function RouteComponent() {
return <div>Hello "/profile"!</div>;
}

View File

@@ -0,0 +1,13 @@
import {createFileRoute, redirect} from "@tanstack/react-router";
export const Route = createFileRoute("/_eom")({
//component: RouteComponent,
beforeLoad: async () => {
const auth = localStorage.getItem("auth_token");
if (!auth) {
throw redirect({
to: "/login",
});
}
},
});

View File

@@ -0,0 +1,125 @@
import {LstCard} from "@/components/extendedUI/LstCard";
import {CardFooter, CardHeader} from "@/components/ui/card";
import {Input} from "@/components/ui/input";
import {Label} from "@radix-ui/react-dropdown-menu";
import {createFileRoute} from "@tanstack/react-router";
export const Route = createFileRoute("/_eom/article/$av")({
component: RouteComponent,
loader: () => {
return [{id: 1}, {id: 2}, {id: 3}, {id: 4}, {id: 5}];
},
});
function RouteComponent() {
const {av} = Route.useParams();
const loaded = Route.useLoaderData();
console.log(loaded, av);
return (
<div className="w-full m-2">
<form className="w-1/2">
<div>
<h1>AV - Description</h1>
</div>
<hr className="w-48"></hr>
<LstCard className="m-2">
<CardHeader className="place-content-center">
<h3>Inventory Data</h3>
</CardHeader>
<div className="flex flex-row">
<div className="w-96 m-2">
<Label>Starting Inv</Label>
<Input></Input>
</div>
<div className="w-96 m-2">
<Label>At The Line</Label>
<Input></Input>
</div>
<div className="w-96 m-2">
<Label>Inhouse endinging</Label>
<Input></Input>
</div>
<div className="w-96 m-2">
<Label>In transit</Label>
<Input></Input>
</div>
<div className="w-96 m-2">
<Label>Comments</Label>
<Input></Input>
</div>
</div>
<CardFooter>
<div className="flex justify-end">
<Label>Total Inv</Label>
</div>
</CardFooter>
</LstCard>
<LstCard className="m-2">
<CardHeader className="place-content-center">
<h3>Purchasing</h3>
</CardHeader>
<div className="flex flex-row">
<div className="w-96 m-2">
<Label>Purchased</Label>
<Input></Input>
</div>
<div className="w-96 m-2">
<Label>Recived in GP</Label>
<Input></Input>
</div>
<div className="w-96 m-2">
<Label>Varation</Label>
<Input></Input>
</div>
<div className="w-96 m-2">
<Label>Comments</Label>
<Input></Input>
</div>
</div>
</LstCard>
<LstCard className="m-2">
<CardHeader className="place-content-center">
<h3>Transfers</h3>
</CardHeader>
<div className="flex flex-row">
<div className="w-96 m-2">
<Label>Transfered in</Label>
<Input></Input>
</div>
<div className="w-96 m-2">
<Label>Transfered out</Label>
<Input></Input>
</div>
<div className="w-96 m-2">
<Label>Comments</Label>
<Input></Input>
</div>
</div>
</LstCard>
<LstCard className="m-2">
<CardHeader className="place-content-center">
<h3>Calculations</h3>
</CardHeader>
<div className="flex flex-row">
<div className="w-96 m-2 flex flex-col">
<Label>Actual Consumption: 1452541</Label>
<Label>Production Consumption: 146854</Label>
</div>
<div className="w-96 m-2 flex flex-col">
<Label>Difference: -2541</Label>
<Label>Waste: -5%</Label>
</div>
<div className="w-96 m-2 flex flex-col">
<Label>Price/Kg: $2.20</Label>
<Label>$Loss/$Gain: $35.00</Label>
</div>
</div>
</LstCard>
</form>
</div>
);
}

View File

@@ -0,0 +1,14 @@
import EomPage from "@/components/eom/EomPage";
import {createFileRoute} from "@tanstack/react-router";
export const Route = createFileRoute("/_eom/eom")({
component: RouteComponent,
});
function RouteComponent() {
return (
<div>
<EomPage />
</div>
);
}

View File

@@ -0,0 +1,13 @@
import {createFileRoute} from "@tanstack/react-router";
export const Route = createFileRoute("/about")({
component: About,
});
function About() {
return (
<div className="m-auto">
<h2>About page to come.</h2>
</div>
);
}

View File

@@ -0,0 +1,14 @@
import Changelog from "@/components/changelog/ChangeLog";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/changelog")({
component: RouteComponent,
});
function RouteComponent() {
return (
<div>
<Changelog />
</div>
);
}

View File

@@ -0,0 +1,17 @@
import { createFileRoute } from "@tanstack/react-router";
//import GridLayout from "react-grid-layout";
import "../../node_modules/react-grid-layout/css/styles.css";
import "../../node_modules/react-resizable/css/styles.css";
import DashBoard from "@/components/dashboard/DashBoard";
export const Route = createFileRoute("/")({
component: Index,
});
function Index() {
return (
<div className="h-dvh w-dvw">
<DashBoard />
</div>
);
}

View File

@@ -0,0 +1,27 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
import LoginForm from "@/components/auth/LoginForm";
import { z } from "zod";
export const Route = createFileRoute("/login")({
component: RouteComponent,
beforeLoad: () => {
const isLoggedIn = localStorage.getItem("auth_token");
if (isLoggedIn) {
throw redirect({
to: "/",
});
}
},
validateSearch: z.object({
redirect: z.string().optional(),
}),
});
function RouteComponent() {
return (
<div className="ml-[25%]">
<LoginForm />
</div>
);
}

View File

@@ -0,0 +1,14 @@
import OCPPage from "@/components/production/ocp/OcpPage";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/ocp/")({
component: RouteComponent,
});
function RouteComponent() {
return (
<div className="h-dvh w-dvw">
<OCPPage />
</div>
);
}

View File

@@ -0,0 +1,105 @@
import RegisterForm from "@/components/auth/Register";
import { LstCard } from "@/components/extendedUI/LstCard";
import { CardContent, CardHeader } from "@/components/ui/card";
import { createFileRoute, redirect } from "@tanstack/react-router";
export const Route = createFileRoute("/register")({
component: RouteComponent,
beforeLoad: () => {
const isLoggedIn = localStorage.getItem("auth_token");
if (isLoggedIn) {
throw redirect({
to: "/",
});
}
},
});
function RouteComponent() {
return (
<div className="flex flex-row w-5/6 justify-between gap-2">
<RegisterForm />
<div>
<LstCard>
<CardHeader>
<h2 className="text-2xl font-bold mb-4">
Disclaimer and User Agreement
</h2>
</CardHeader>
<CardContent>
<div className="max-w-2xl mx-auto p-6 rounded-2xl shadow-md">
<ul className="list-decimal list-inside space-y-3">
<li>
<span className="font-bold">
Authentication Notice:
</span>
<span>
The username, email, and password are
only for LST you <em>DO NOT</em>Need to
use Windows username if you do not wish
to.
</span>
</li>
{/* <li>
<span className="font-bold">
Password Privacy and Security:
</span>
This application{" "}
<span className="font-semibold">
does not store, sync, or transmit
</span>{" "}
your Windows password in any form.
Authentication is handled securely, and your
credentials are never logged or accessible
to the developers or third parties.
</li> */}
<li>
<span className="font-bold">
Data Handling:
</span>
All data accessed through the Alpla prod
remains the property of Alpla. The app
functions as a secure interface for
accessing and updating this information
where permitted by your role.
</li>
<li>
<span className="font-bold">
User Responsibility:
</span>
You are responsible for any actions
performed using your account. Please ensure
you do not share your credentials with
others and always log out of the application
when not in use.
</li>
<li>
<span className="font-bold">
No Warranty:
</span>
This application is provided "
<span className="italic">as is</span>"
without any warranty of any kind, either
expressed or implied. While every effort is
made to ensure functionality and data
accuracy, the app is subject to ongoing
development and may contain bugs or require
updates.
</li>
<li>
<span className="font-bold">
Consent Required:
</span>
By signing up or continuing to use this
application, you agree to the above terms
and acknowledge that you understand how your
login information is used.
</li>
</ul>
</div>
</CardContent>
</LstCard>
</div>
</div>
);
}

View File

@@ -0,0 +1,14 @@
import RfidPage from "@/components/rfid/RfidPage";
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/rfid/")({
component: RouteComponent,
});
function RouteComponent() {
return (
<div>
<RfidPage />
</div>
);
}