import { preloadBomCombo } from "@/app/api/bom";
import JoSearch from "@/components/JoSearch";
import { I18nProvider, getServerI18n } from "@/i18n";
import { Stack, Typography } from "@mui/material";
import { Metadata } from "next";
import React, { Suspense } from "react";

export const metadata: Metadata = {
    title: "Job Order"
}

const jo: React.FC = async () => {
    const { t } = await getServerI18n("jo");

    preloadBomCombo()

    return (
        <>
            <Stack
                direction="row"
                justifyContent="space-between"
                flexWrap="wrap"
                rowGap={2}
            >
                <Typography variant="h4" marginInlineEnd={2}>
                    {t("Job Order")}
                </Typography>
            </Stack>
            <I18nProvider namespaces={["jo", "common"]}>
                <Suspense fallback={<JoSearch.Loading />}>
                    <JoSearch />
                </Suspense>
            </I18nProvider>
        </>
    )
}

export default jo;