cleaned up clock out

This commit is contained in:
jfrye122
2023-05-15 08:55:45 -04:00
parent e1d72ad355
commit c7959c4080
3 changed files with 60 additions and 51 deletions

View File

@@ -11,15 +11,16 @@ import { useQuery } from "@apollo/client";
import { createStructuredSelector } from "reselect";
import { useTranslation } from "react-i18next";
import { ClockedinListItem } from "../time-ticket-items/clockedin-list-item.component";
import { setTmTicketJobId } from "../../redux/app/app.actions";
// import { setTmTicketJobId } from "../../redux/app/app.actions";
const mapStateToProps = createStructuredSelector({
technician: selectTechnician,
//currentEmployee: selectCurrentEmployee,
});
const mapDispatchToProps = (dispatch) => ({
setTmTicketJobId: (jobId) => dispatch(setTmTicketJobId(jobId)),
});
// const mapDispatchToProps = (dispatch) => ({
// setTmTicketJobId: (jobId) => dispatch(setTmTicketJobId(jobId)),
// });
export function EmployeeClockedInList({ technician }) {
const { t } = useTranslation();
@@ -37,23 +38,26 @@ export function EmployeeClockedInList({ technician }) {
);
if (loading) return <ActivityIndicator color="dodgerblue" size="large" />;
if (error) return <ErrorDisplay errorMessage={error.message} />;
//if (error) return <AlertComponent message={error.message} type="error" />;
console.log("QUERY_ACTIVE_TIME_TICKETS data", data);
console.log("EmployeeClockedInList, QUERY_ACTIVE_TIME_TICKETS data:", data);
// if (data) () => {setTmTicketJobId(data)}
const onRefresh = async () => {
return refetch();
};
return (
<View>
{data.timetickets.length > 0 ? (
<View>
<Text>You are already clocked in to the following job(s):</Text>
<Text style={{paddingLeft:12, paddingTop:14}}>You are already clocked in to the following job(s):</Text>
<FlatList
data={data.timetickets}
refreshControl={
<RefreshControl refreshing={loading} onRefresh={onRefresh} />
}
renderItem={(object) => <ClockedinListItem ticket={object.item} setTmTicketJobId={setTmTicketJobId}/>}
renderItem={(object) => <ClockedinListItem ticket={object.item} />}
// setTmTicketJobId={setTmTicketJobId}
/>
</View>
) : null}
@@ -117,4 +121,4 @@ export function EmployeeClockedInList({ technician }) {
);
}
export default connect(mapStateToProps, mapDispatchToProps)(EmployeeClockedInList);
export default connect(mapStateToProps, null)(EmployeeClockedInList);