feat(migration): dashboard migrated over
This commit is contained in:
@@ -17,7 +17,7 @@ export default function Cards(card: any) {
|
||||
active: existing[0]?.active ?? false,
|
||||
},
|
||||
onSubmit: async ({ value }) => {
|
||||
console.log(value);
|
||||
//console.log(value);
|
||||
const testCard: any = cards.filter((i: any) => i.name === value.name);
|
||||
|
||||
if (value.active) {
|
||||
|
||||
@@ -2,24 +2,24 @@ import { queryOptions } from "@tanstack/react-query";
|
||||
import axios from "axios";
|
||||
|
||||
export function getinventoryCheck(data: any) {
|
||||
return queryOptions({
|
||||
queryKey: ["getInvCheck"],
|
||||
queryFn: () => fetchStockSilo(data),
|
||||
//enabled:
|
||||
staleTime: 1000,
|
||||
refetchInterval: 1000 * 60 * 15,
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
return queryOptions({
|
||||
queryKey: ["getInvCheck"],
|
||||
queryFn: () => fetchStockSilo(data),
|
||||
//enabled:
|
||||
staleTime: 1000,
|
||||
refetchInterval: 1000 * 60 * 15,
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
}
|
||||
|
||||
const fetchStockSilo = async (info: any) => {
|
||||
//console.log("What tpye of info:", info);
|
||||
const { data } = await axios.post(`/api/logistics/cyclecountcheck`, {
|
||||
age: info.age ? parseInt(info.age) : null,
|
||||
type: "",
|
||||
});
|
||||
//console.log("What tpye of info:", info);
|
||||
const { data } = await axios.post(`/lst/old/api/logistics/cyclecountcheck`, {
|
||||
age: info.age ? parseInt(info.age) : null,
|
||||
type: "",
|
||||
});
|
||||
|
||||
// if we are not localhost ignore the devDir setting.
|
||||
//const url: string = window.location.host.split(":")[0];
|
||||
return data.data ?? [];
|
||||
// if we are not localhost ignore the devDir setting.
|
||||
//const url: string = window.location.host.split(":")[0];
|
||||
return data.data ?? [];
|
||||
};
|
||||
|
||||
@@ -2,21 +2,21 @@ import { queryOptions } from "@tanstack/react-query";
|
||||
import axios from "axios";
|
||||
|
||||
export function getOpenOrders() {
|
||||
return queryOptions({
|
||||
queryKey: ["getOpenOrders"],
|
||||
queryFn: () => fetchStockSilo(),
|
||||
//enabled:
|
||||
staleTime: 1000,
|
||||
refetchInterval: 1000 * 60 * 15,
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
return queryOptions({
|
||||
queryKey: ["getOpenOrders"],
|
||||
queryFn: () => fetchStockSilo(),
|
||||
//enabled:
|
||||
staleTime: 1000,
|
||||
refetchInterval: 1000 * 60 * 15,
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
}
|
||||
|
||||
const fetchStockSilo = async () => {
|
||||
const { data } = await axios.get(
|
||||
`/api/datamart/getopenorders?sDay=15&eDay=45`
|
||||
);
|
||||
// if we are not localhost ignore the devDir setting.
|
||||
//const url: string = window.location.host.split(":")[0];
|
||||
return data.data ?? [];
|
||||
const { data } = await axios.get(
|
||||
`/lst/old/api/datamart/getopenorders?sDay=15&eDay=45`,
|
||||
);
|
||||
// if we are not localhost ignore the devDir setting.
|
||||
//const url: string = window.location.host.split(":")[0];
|
||||
return data.data ?? [];
|
||||
};
|
||||
|
||||
@@ -2,19 +2,19 @@ import { queryOptions } from "@tanstack/react-query";
|
||||
import axios from "axios";
|
||||
|
||||
export function getLanes() {
|
||||
return queryOptions({
|
||||
queryKey: ["getLanes"],
|
||||
queryFn: () => fetch(),
|
||||
//enabled:
|
||||
staleTime: 1000,
|
||||
refetchInterval: 60 * 1000,
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
return queryOptions({
|
||||
queryKey: ["getLanes"],
|
||||
queryFn: () => fetch(),
|
||||
//enabled:
|
||||
staleTime: 1000,
|
||||
refetchInterval: 60 * 1000,
|
||||
refetchOnWindowFocus: true,
|
||||
});
|
||||
}
|
||||
|
||||
const fetch = async () => {
|
||||
const { data } = await axios.get(`/api/logistics/getactivelanes`);
|
||||
// // if we are not localhost ignore the devDir setting.
|
||||
// //const url: string = window.location.host.split(":")[0];
|
||||
return data.data ?? [];
|
||||
const { data } = await axios.get(`/lst/old/api/logistics/getactivelanes`);
|
||||
// // if we are not localhost ignore the devDir setting.
|
||||
// //const url: string = window.location.host.split(":")[0];
|
||||
return data.data ?? [];
|
||||
};
|
||||
|
||||
@@ -1,9 +1,26 @@
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import { AddCards } from "./-components/dashboard/AddCards";
|
||||
import DashBoard from "./-components/dashboard/Dashboard";
|
||||
import { useCardStore } from "./-lib/store/useCardStore";
|
||||
|
||||
export const Route = createFileRoute("/_old/old/")({
|
||||
component: RouteComponent,
|
||||
});
|
||||
|
||||
function RouteComponent() {
|
||||
return <div>Missing DashBoard</div>;
|
||||
const { cards } = useCardStore();
|
||||
return (
|
||||
<div>
|
||||
{cards.length > 0 ? (
|
||||
<DashBoard />
|
||||
) : (
|
||||
<div className="m-3">
|
||||
<span>
|
||||
Looks like you have no cards added try clicking adding some
|
||||
</span>{" "}
|
||||
<AddCards />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,19 +28,21 @@ function RouteComponent() {
|
||||
const { session } = useAuth();
|
||||
const logout = useLogout();
|
||||
//const { settings } = useSettingStore();
|
||||
console.log(location.pathname);
|
||||
return (
|
||||
<div>
|
||||
<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>
|
||||
)}
|
||||
{location.pathname === "/lst/app/old" ||
|
||||
(location.pathname === "/lst/app/old/" && (
|
||||
<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" && (
|
||||
{location.pathname === "/lst/app/old/dm" && (
|
||||
<div className="m-auto pr-2 flex flex-row gap-2">
|
||||
{/* <DMButtons /> */}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user