From 43151aaa2deb5cb2c27855d4c2427f57527eff49 Mon Sep 17 00:00:00 2001 From: jfrye122 Date: Mon, 5 Jun 2023 16:43:58 -0400 Subject: [PATCH] removed unused components --- components/Selects/select-job-name.jsx | 168 ------------------ ...-allocations-table-container.component.jsx | 39 ---- 2 files changed, 207 deletions(-) delete mode 100644 components/Selects/select-job-name.jsx delete mode 100644 components/labor-allocations-table/labor-allocations-table-container.component.jsx diff --git a/components/Selects/select-job-name.jsx b/components/Selects/select-job-name.jsx deleted file mode 100644 index 8ef7f6a..0000000 --- a/components/Selects/select-job-name.jsx +++ /dev/null @@ -1,168 +0,0 @@ -import { useLazyQuery } from "@apollo/client"; -import React, { forwardRef, useState, useEffect } from "react"; -import { useTranslation } from "react-i18next"; -import _ from "lodash"; - -import { - SEARCH_JOBS_BY_ID_FOR_AUTOCOMPLETE, - SEARCH_JOBS_FOR_AUTOCOMPLETE, -} from "../../graphql/jobs.queries"; -import { StyleSheet, Text, View } from "react-native"; -import { Dropdown } from "react-native-element-dropdown"; -import { connect } from "react-redux"; -import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component"; - - -// This component is not currently used - -export function JobSearchSelect( - convertedOnly = false, - notInvoiced = false, - notExported = true, - clm_no = false, - ...restProps -) { - const { t } = useTranslation(); - const [selectorData, setSelectorData] = useState([]); - const [selectedvalue, setSelectedValue] = useState(null); - const [isFocus, setIsFocus] = useState(false); - - const [theOptions, setTheOptions] = useState([]); - - const [callSearch, { loading, error, data }] = useLazyQuery( - SEARCH_JOBS_FOR_AUTOCOMPLETE, - {} - ); - const [callIdSearch, { loading: idLoading, error: idError, data: idData }] = - useLazyQuery(SEARCH_JOBS_BY_ID_FOR_AUTOCOMPLETE); - - const executeSearch = (v) => { - if (v && v !== "") callSearch(v); - }; - const debouncedExecuteSearch = _.debounce(executeSearch, 500); - - const handleSearch = (value) => { - debouncedExecuteSearch({ - variables: { - search: value, - ...(convertedOnly || notExported - ? { - ...(convertedOnly ? { isConverted: true } : {}), - ...(notExported ? { notExported: true } : {}), - ...(notInvoiced ? { notInvoiced: true } : {}), - } - : {}), - }, - }); - }; - - useEffect(() => { - if (restProps.value) { - callIdSearch({ variables: { id: restProps.value } }); - } - }, [restProps.value, callIdSearch]); - - useEffect(() => { - setTheOptions( - _.uniqBy( - [ - ...(idData && idData.jobs_by_pk ? [idData.jobs_by_pk] : []), - ...(data && data.search_jobs ? data.search_jobs : []), - ], - "id" - ) - ); - }, [data, idData]); - - useEffect(() => { - var count = Object.keys(theOptions).length; - let selectDataArray = []; - for (let i = 0; i < count; i++) { - // let o = theOptions[i]; - selectDataArray.push({ - value: theOptions[i].id, - label: theOptions[i].ro_number, - // `${clm_no && o.clm_no ? `${o.clm_no} | ` : ""}${ - // o.ro_number || t("general.labels.na") - // } | ${OwnerNameDisplayFunction(o)} | ${o.v_model_yr || ""} ${o.v_make_desc || ""} ${ - // o.v_model_desc || "" - // }`, - - }); - } - setSelectorData(selectDataArray); - }, [theOptions]); - return ( - - setIsFocus(true)} - onBlur={() => setIsFocus(false)} - onChange={(item) => { - console.log(item); - setSelectedValue(item.value); - setIsFocus(false); - }} - onChangeText={(search) => { - handleSearch(search); - }} - /> - {/* {theOptions ? console.log(theOptions): null} */} - - ); -} - -export default connect(null, null)(JobSearchSelect); - -const styles = StyleSheet.create({ - container: { - padding: 16, - justifyContent: "center", - alignContent: "center", - }, - dropdown: { - height: 50, - borderColor: "gray", - borderWidth: 0.5, - borderRadius: 8, - paddingHorizontal: 8, - }, - icon: { - marginRight: 5, - }, - label: { - position: "absolute", - backgroundColor: "white", - left: 22, - top: 8, - zIndex: 999, - paddingHorizontal: 8, - fontSize: 14, - }, - placeholderStyle: { - fontSize: 16, - }, - selectedTextStyle: { - fontSize: 16, - }, - iconStyle: { - width: 20, - height: 20, - }, - inputSearchStyle: { - height: 40, - fontSize: 16, - }, -}); diff --git a/components/labor-allocations-table/labor-allocations-table-container.component.jsx b/components/labor-allocations-table/labor-allocations-table-container.component.jsx deleted file mode 100644 index ff85fe4..0000000 --- a/components/labor-allocations-table/labor-allocations-table-container.component.jsx +++ /dev/null @@ -1,39 +0,0 @@ -import React from "react"; -import { useTranslation } from "react-i18next"; -import { StyleSheet, View } from "react-native"; -import { GET_LINE_TICKET_BY_PK } from "../../graphql/jobs.queries"; -import ErrorDisplay from "../error-display/error-display.component"; -import { useQuery } from "@apollo/client"; -import { connect } from "react-redux"; - -export function LaborAllocationsTableContainer({ jobId }) { - // console.log("LaborAllocationsTableContainer, jobId", jobId); - const { t } = useTranslation(); - - const { loading, error, data, refetch } = useQuery(GET_LINE_TICKET_BY_PK, { - variables: { id: jobId }, - skip: !!!jobId, - fetchPolicy: "network-only", - nextFetchPolicy: "network-only", - }); - // console.log("LaborAllocationsTableContainer, data", data); - if (error) return ; - - return ( - - {data ? ( - - ) : null} - - ); -} - -const localStyles = StyleSheet.create({}); -export default connect(null, null)(LaborAllocationsTableContainer);