From d29a8a6d66ec05955b781cf8c80ea9764a5abc16 Mon Sep 17 00:00:00 2001 From: jfrye122 Date: Tue, 25 Jul 2023 14:10:27 -0400 Subject: [PATCH] update laboralloctable --- .../labor-allocations-table.component.jsx | 37 +++++-------------- translations/en-US/common.json | 11 ++++++ translations/es-MX/common.json | 11 ++++++ translations/fr-CA/common.json | 11 ++++++ 4 files changed, 43 insertions(+), 27 deletions(-) diff --git a/components/labor-allocations-table/labor-allocations-table.component.jsx b/components/labor-allocations-table/labor-allocations-table.component.jsx index e9ab057..08bca5b 100644 --- a/components/labor-allocations-table/labor-allocations-table.component.jsx +++ b/components/labor-allocations-table/labor-allocations-table.component.jsx @@ -1,6 +1,6 @@ -import React, { useEffect, useMemo, useState } from "react"; +import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import { FlatList, RefreshControl, StyleSheet, Text, View } from "react-native"; +import { FlatList, StyleSheet, Text, View } from "react-native"; import _ from "lodash"; import { ActivityIndicator, Card, DataTable, Divider } from "react-native-paper"; import { GET_LINE_TICKET_BY_PK } from "../../graphql/jobs.queries"; @@ -18,34 +18,19 @@ const mapStateToProps = createStructuredSelector({ }); export function LaborAllocationsTable({ jobId, bodyshop, technician,costCenterDiff,selectedCostCenter, style, shouldRefresh}) { - // console.log("LaborAllocationsTable, costCenterDiff", costCenterDiff); - // console.log("LaborAllocationsTable, selectedCostCenter", selectedCostCenter); const { t } = useTranslation(); - - const onRefresh = async () => { - // console.log("LaborAllocationsTable refetch"); - return refetch(); - }; - + const onRefresh = async () => { return refetch(); }; const { loading, error, data, refetch } = useQuery(GET_LINE_TICKET_BY_PK, { variables: { id: jobId }, skip: !!!jobId, fetchPolicy: "network-only", nextFetchPolicy: "network-only", }); - - // console.log("LaborAllocationsTable, data", data); if (error) return ; - // if (loading) return ; const [totals, setTotals] = useState([]); - // useEffect(() => { - // // console.log("LaborAllocationsTable useEffect on data change"); - // }, [data]); - useEffect(() => { - // console.log("LaborAllocationsTable useEffect on [all inputs] change",data?.joblines,data?.adjustments); if (!!data?.joblines && !!data?.timetickets && !!bodyshop){ let temptotals = CalculateAllocationsTotals( bodyshop, @@ -70,7 +55,6 @@ export function LaborAllocationsTable({ jobId, bodyshop, technician,costCenterDi }, [data?.joblines, data?.timetickets, bodyshop, data?.adjustments, jobId, selectedCostCenter]); useEffect(() => { - // console.log("made it here, shouldRefresh is :", shouldRefresh ); !!shouldRefresh && shouldRefresh ? onRefresh() : null },[shouldRefresh]); @@ -86,22 +70,21 @@ export function LaborAllocationsTable({ jobId, bodyshop, technician,costCenterDi }, { hrs_total: 0, hrs_claimed: 0, adjustments: 0, difference: 0 } ); - // console.log("labor summary is:", summary); if (loading) return ; return ( {typeof data !== "undefined" ? ( - + - Cost Center - Hours Total - Hours Claimed + {t("laborallocations.labels.costcenter")} + {t("laborallocations.labels.hourstotal")} + {t("laborallocations.labels.hoursclaimed")} {/* Hours Claimed */} - Adjustments - Difference + {t("laborallocations.labels.adjustments")} + {t("laborallocations.labels.difference")} @@ -148,7 +131,7 @@ export function LaborAllocationsTable({ jobId, bodyshop, technician,costCenterDi /> {summary && ( - Totals + {t("laborallocations.labels.totals")} {summary.hrs_total.toFixed(1)} diff --git a/translations/en-US/common.json b/translations/en-US/common.json index 9e6f473..cefc4e2 100644 --- a/translations/en-US/common.json +++ b/translations/en-US/common.json @@ -508,6 +508,17 @@ "actions": { "clockout": "Clock Out" } + }, + "laborallocations": { + "labels": { + "laborallocations": "Labor Allocations", + "costcenter": "Cost Center", + "hourstotal": "Hours Total", + "hoursclaimed": "Hours Claimed", + "adjustments": "Adjustments", + "difference": "Difference", + "totals": "Totals" + } } } } diff --git a/translations/es-MX/common.json b/translations/es-MX/common.json index 145017f..3d8180b 100644 --- a/translations/es-MX/common.json +++ b/translations/es-MX/common.json @@ -508,6 +508,17 @@ "actions": { "clockout": "" } + }, + "laborallocations": { + "labels": { + "laborallocations": "", + "costcenter": "", + "hourstotal": "", + "hoursclaimed": "", + "adjustments": "", + "difference": "", + "totals": "" + } } } } diff --git a/translations/fr-CA/common.json b/translations/fr-CA/common.json index c52eb80..e8f1ddc 100644 --- a/translations/fr-CA/common.json +++ b/translations/fr-CA/common.json @@ -508,6 +508,17 @@ "actions": { "clockout": "" } + }, + "laborallocations": { + "labels": { + "laborallocations": "", + "costcenter": "", + "hourstotal": "", + "hoursclaimed": "", + "adjustments": "", + "difference": "", + "totals": "" + } } } }