import { createFileRoute } from "@tanstack/react-router";
import ConsumeMaterial from "../../../-components/logistics/materialHelper/consumption/ConsumeMaterial";
import PreformReturn from "../../../-components/logistics/materialHelper/consumption/MaterialReturn";
import TransferToNextLot from "../../../-components/logistics/materialHelper/consumption/TransferToNextLot";

export const Route = createFileRoute(
	"/_old/old/(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>
	);
}
