diff --git a/components/time-ticket/screen-time-ticket-create.component.jsx b/components/time-ticket/screen-time-ticket-create.component.jsx index 6ba5462..f30f46a 100644 --- a/components/time-ticket/screen-time-ticket-create.component.jsx +++ b/components/time-ticket/screen-time-ticket-create.component.jsx @@ -32,6 +32,7 @@ import { useNavigation } from "@react-navigation/native"; import styles from "../styles"; import StyleRepeater from "../style-repeater/style-repeater"; import { FlatList } from "react-native"; +import JobSearchAndSelectModal from "../Modals/JobSearchAndSelectModal"; const mapStateToProps = createStructuredSelector({ currentEmployee: selectCurrentEmployee, @@ -60,9 +61,7 @@ export function TimeTicketCreate({ const [date2, setDate2] = useState(new Date()); const [currentSCC, setCurrentSCC] = useState(null); - // const [currentSJob, setCurrentSJob] = useState(null); - const [currentSJobId, setCurrentSJobId] = useState(null); - + const [curSelClockIntoJob,setCurSelClockIntoJob] = useState(null); const showDatePicker = () => { setDatePickerVisibility(true); }; @@ -88,7 +87,7 @@ export function TimeTicketCreate({ if ( !!currentSCC?.value && - !!currentSJobId?.value && + !!curSelClockIntoJob?.id && !!values.productivehours && !!currentBodyshop.id && !!currentEmployee?.technician?.id && @@ -120,10 +119,7 @@ export function TimeTicketCreate({ return; } } - - // if (date2) console.log("rate :", currentRatesNCostCenters && currentSCC?.value ? currentRatesNCostCenters.filter((r) => r.cost_center === currentSCC?.value)[0].rate : null);//2023-05-16T16:45:27.154Z - // if (date2) console.log("bodyshopid : ", currentBodyshop.id); - // if (date2) console.log("moment(date2).format(YYYY-MM-DD)", moment(date2).format("YYYY-MM-DD")); + const tempVariablesObj = { variables: { timeTicketInput: [ @@ -149,7 +145,7 @@ export function TimeTicketCreate({ currentEmployee && currentEmployee.technician && currentEmployee.technician?.flat_rate, - jobid: currentSJobId?.value, + jobid: curSelClockIntoJob?.id, productivehrs: values?.productivehours, rate: currentRatesNCostCenters && currentSCC?.value @@ -182,18 +178,8 @@ export function TimeTicketCreate({ // console.log("insertTicket, result. :", result.data); navigation.goBack(); } - // if (completedCallback) completedCallback(); }; - // const handleMutationError = (error) => { - // // setEnterAgain(false); - // console.log("insertTicket, result.error :", error); - // setError( - // error?.message ? JSON.stringify(error?.message) : JSON.stringify(error) - // ); - // setLoading(false); - // }; - const onRefresh = useCallback(() => { setLoading(true); // refetch(); @@ -210,7 +196,6 @@ export function TimeTicketCreate({ {({ handleChange, handleBlur, handleSubmit, values }) => ( - + /> */} +