added component for testing selecting job id
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { View, Text } from "react-native";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
selectCurrentTimeTicketJob,
|
||||
selectCurrentTimeTicketJobId,
|
||||
} from "../../redux/timetickets/timetickets.selectors";
|
||||
import { JobIdSearchSelect } from "../Selects/select-job-id";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentEmployee: selectCurrentEmployee,
|
||||
@@ -49,7 +50,9 @@ export function ScreenTimeTicketBrowser({
|
||||
currentSelectedTimeTicketJobId,
|
||||
}) {
|
||||
//const employeeId = currentEmployee.technician.id;
|
||||
const [currentCC, setCurrentCC] = useState(null);
|
||||
const [currentSCC, setCurrentSCC] = useState(null);
|
||||
const [currentSJob, setCurrentSJob] = useState(null);
|
||||
const [currentSJobId, setCurrentSJobId] = useState(null);
|
||||
|
||||
// const { error, data } = useQuery(QUERY_EMPLOYEE_BY_ID, {
|
||||
// variables: { id: currentEmployee.technician.id },
|
||||
@@ -57,15 +60,24 @@ export function ScreenTimeTicketBrowser({
|
||||
// const signingErrorMsg = error ? (<ErrorDisplay errorMessage={error.message} />) : null;
|
||||
// const signingErrorMsg = signingError ? (<ErrorDisplay errorMessage={signingError} />) : null;
|
||||
|
||||
const wrapperSetCurrentSJobState = useCallback(val => {
|
||||
setCurrentSJob(val);
|
||||
}, [setCurrentSJob]);
|
||||
|
||||
|
||||
const getRates = (currentEmployee) => {
|
||||
employeeGetRatesStart(currentEmployee.technician.id);
|
||||
};
|
||||
const createTheTimeTicketOBJ = (
|
||||
currentEmployee,
|
||||
currentBodyshop,
|
||||
currentCC
|
||||
currentSCC,
|
||||
currentSJob,
|
||||
currentSJobId
|
||||
) => {
|
||||
console.log("currentCC", currentCC.value);
|
||||
console.log("currentSCC", currentSCC.value);
|
||||
console.log("currentSJob", currentSJob.value);
|
||||
console.log("currentSJobId", currentSJobId.value);
|
||||
console.log("bodyshopid", currentBodyshop.id);
|
||||
console.log("employeeid", currentEmployee.technician.id);
|
||||
console.log(currentBodyshop);
|
||||
@@ -99,21 +111,38 @@ export function ScreenTimeTicketBrowser({
|
||||
loading={loaderGettingRates}
|
||||
//onPress={() => getRates(currentEmployee)}
|
||||
onPress={() =>
|
||||
createTheTimeTicketOBJ(currentEmployee, currentBodyshop, currentCC)
|
||||
createTheTimeTicketOBJ(currentEmployee, currentBodyshop, currentSCC)
|
||||
}
|
||||
>
|
||||
<Text>text here</Text>
|
||||
</Button>
|
||||
{/* {signingErrorMsg} */}
|
||||
<JobIdSearchSelect
|
||||
currentValue={currentSJobId}
|
||||
//onValueSelected={setCurrentSJobId}
|
||||
convertedOnly={!currentBodyshop.tt_allow_post_to_invoiced}
|
||||
notExported={!currentBodyshop.tt_allow_post_to_invoiced}
|
||||
/>
|
||||
|
||||
<JobSearchSelect
|
||||
currentValue={currentSJob}
|
||||
onValueSelected={setCurrentSJob}
|
||||
convertedOnly={!currentBodyshop.tt_allow_post_to_invoiced}
|
||||
notExported={!currentBodyshop.tt_allow_post_to_invoiced}
|
||||
/>
|
||||
<CostCenterSelect
|
||||
currentValue={currentCC}
|
||||
currentValue={currentSCC}
|
||||
currentRatesNCostCenters={currentRatesNCostCenters}
|
||||
onValueSelected={setCurrentCC}
|
||||
onValueSelected={setCurrentSCC}
|
||||
/>
|
||||
<Button
|
||||
mode="outlined"
|
||||
//loading={loaderClockIn}
|
||||
//onPress={() => clockIn()}
|
||||
|
||||
>
|
||||
<Text>Clock In</Text>
|
||||
</Button>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user