diff --git a/frontend/src/components/logistics/siloAdjustments/HistoricalData.tsx b/frontend/src/components/logistics/siloAdjustments/HistoricalData.tsx new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/components/logistics/siloAdjustments/SiloCard.tsx b/frontend/src/components/logistics/siloAdjustments/SiloCard.tsx index deed719..817bb6a 100644 --- a/frontend/src/components/logistics/siloAdjustments/SiloCard.tsx +++ b/frontend/src/components/logistics/siloAdjustments/SiloCard.tsx @@ -81,74 +81,106 @@ export default function SiloCard(data: any) {
-
{ - e.preventDefault(); - e.stopPropagation(); - }} - > - - value.length > 1 - ? undefined - : "You must enter a value greate than 1", + {silo.Stock_Total === 0 ? ( +
+ + The silo is currently empty you will not be + able to do an adjustment until you have + received material in. + +
+
    +
  • + -Someone click "Take inventory on a + empty location" in stock. +
  • +
  • + -Silo virtualy ran empty due to + production over consumption. +
  • +
  • + -Someone forgot to move a railcar + compartment over to this location. +
  • +
+
+ ) : ( + { + e.preventDefault(); + e.stopPropagation(); }} - children={(field) => { - return ( -
-
- -
- + > + + value.length > 1 + ? undefined + : "You must enter a value greate than 1", + }} + children={(field) => { + return ( +
+
+ +
+ +
+
+
+ + field.handleChange( + e.target.value + ) + } + /> +
-
-
- - field.handleChange( - e.target.value - ) - } - /> - -
- {field.state.meta.errors.length ? ( - - {field.state.meta.errors.join( - "," - )} - - ) : null} -
- ); - }} - /> - + {field.state.meta.errors + .length ? ( + + {field.state.meta.errors.join( + "," + )} + + ) : null} +
+ ); + }} + /> + + )}
diff --git a/frontend/src/components/ui/chart.tsx b/frontend/src/components/ui/chart.tsx new file mode 100644 index 0000000..e4589f0 --- /dev/null +++ b/frontend/src/components/ui/chart.tsx @@ -0,0 +1,351 @@ +import * as React from "react" +import * as RechartsPrimitive from "recharts" + +import { cn } from "@/lib/utils" + +// Format: { THEME_NAME: CSS_SELECTOR } +const THEMES = { light: "", dark: ".dark" } as const + +export type ChartConfig = { + [k in string]: { + label?: React.ReactNode + icon?: React.ComponentType + } & ( + | { color?: string; theme?: never } + | { color?: never; theme: Record } + ) +} + +type ChartContextProps = { + config: ChartConfig +} + +const ChartContext = React.createContext(null) + +function useChart() { + const context = React.useContext(ChartContext) + + if (!context) { + throw new Error("useChart must be used within a ") + } + + return context +} + +function ChartContainer({ + id, + className, + children, + config, + ...props +}: React.ComponentProps<"div"> & { + config: ChartConfig + children: React.ComponentProps< + typeof RechartsPrimitive.ResponsiveContainer + >["children"] +}) { + const uniqueId = React.useId() + const chartId = `chart-${id || uniqueId.replace(/:/g, "")}` + + return ( + +
+ + + {children} + +
+
+ ) +} + +const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => { + const colorConfig = Object.entries(config).filter( + ([, config]) => config.theme || config.color + ) + + if (!colorConfig.length) { + return null + } + + return ( +