import { GET_JOB_BY_PK } from "@/graphql/jobs.queries"; import { useQuery } from "@apollo/client"; import { useGlobalSearchParams } from "expo-router"; import React from "react"; import { useTranslation } from "react-i18next"; import { ScrollView, useWindowDimensions } from "react-native"; import { ActivityIndicator, DataTable, useTheme } from "react-native-paper"; import ErrorDisplay from "../error/error-display"; export default function JobLines() { const { jobId } = useGlobalSearchParams(); const { loading, error, data, refetch } = useQuery(GET_JOB_BY_PK, { variables: { id: jobId, }, skip: !jobId, }); const { width, height } = useWindowDimensions(); const isLandscape = width > height; const theme = useTheme(); const { t } = useTranslation(); const onRefresh = async () => { return refetch(); }; if (loading) { return ; } if (error) { return ; } if (!data?.jobs_by_pk) { return ; } const job = data.jobs_by_pk; return ( {t("jobdetail.labels.lines_desc")} {t("jobdetail.labels.lines_lbr_ty")} {t("jobdetail.labels.lines_lb_hrs")} {t("jobdetail.labels.lines_part_type")} {t("jobdetail.labels.lines_qty")} {job.joblines.map((item, index) => ( {item.line_desc} {item.mod_lbr_ty && t(`jobdetail.lbr_types.${item.mod_lbr_ty}`)} {item.mod_lb_hrs} {item.part_type && t(`jobdetail.part_types.${item.part_type}`)} {item.part_qty} ))} ); }