cleaned up clock out
This commit is contained in:
@@ -13,34 +13,37 @@ import { logImEXEvent } from "../../firebase/firebase.analytics";
|
||||
import { employeeSignInStart } from "../../redux/employee/employee.actions";
|
||||
import { useRef } from "react";
|
||||
|
||||
|
||||
// const selectNumCompletedTodos = createSelector(
|
||||
// (state) => state.timeTickets,
|
||||
// (timeTickets) => timeTickets.timeTicketJobId
|
||||
// );
|
||||
//const mapStateToProps = createStructuredSelector({});
|
||||
// // setTimeTicketJobId: (jobId) =>dispatch(setTimeTicketJobId({jobId})),
|
||||
//employeeSignInStart:(idjob) => dispatch(employeeSignInStart(idjob)),
|
||||
// // setTimeTicketJobId: (jobId) =>dispatch(setTimeTicketJobId({jobId})),
|
||||
//employeeSignInStart:(idjob) => dispatch(employeeSignInStart(idjob)),
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setTmTicketJobId:() => dispatch(setTmTicketJobId(jobId)),
|
||||
setTmTicketJobId: () => dispatch(setTmTicketJobId({ jobId })),
|
||||
});
|
||||
|
||||
export function ClockedinListItem( props ) {
|
||||
export function ClockedinListItem( {setTmTicketJobId, ticket }) {
|
||||
console.log("ClockedinListItem, ticket", ticket);
|
||||
console.log("ClockedinListItem, setTmTicketJobId", setTmTicketJobId);
|
||||
|
||||
const { t } = useTranslation();
|
||||
const navigation = useNavigation();
|
||||
console.log("ClockedinListItem, ", props.ticket.job.id);
|
||||
const jbId = props.ticket.job.id;
|
||||
|
||||
console.log("ClockedinListItem, ticket job id", ticket.job.id);
|
||||
const jbId = ticket.job.id;
|
||||
console.log("ClockedinListItem, jbId: ", jbId);
|
||||
const te = useRef(jbId)
|
||||
let makeNave = (jobId) => (
|
||||
console.log("ClockedinListItem ", setTmTicketJobId)
|
||||
,console.log("te", jobId)
|
||||
,setTmTicketJobId(jobId)
|
||||
|
||||
// ,navigation.navigate("TimeTicketClockOff")
|
||||
);
|
||||
// const te = useRef(jbId);
|
||||
|
||||
const makeNavToTimeTicketClockOff = (jbId,setTmTicketJobId) => (
|
||||
console.log("ClockedinListItem, makeNavToTimeTicketClockOff, setTmTicketJobId :", setTmTicketJobId),
|
||||
console.log("ClockedinListItem, makeNavToTimeTicketClockOff, jobId :", jbId)
|
||||
//,setTmTicketJobId(jbId)
|
||||
|
||||
,navigation.navigate("TimeTicketClockOff")
|
||||
);
|
||||
// const onPress = (ticket, setCameraJobId) => {
|
||||
// console.log("ClockedinListItem, onPress called");
|
||||
// console.log("ClockedinListItem, ticket", ticket);
|
||||
@@ -63,24 +66,25 @@ export function ClockedinListItem( props ) {
|
||||
<Card style={{ margin: 8 }}>
|
||||
<Card.Title
|
||||
title={`${
|
||||
props.ticket.job.ro_number || t("general.labels.na")
|
||||
} ${OwnerNameDisplayFunction(props.ticket.job)}`}
|
||||
ticket.job.ro_number || t("general.labels.na")
|
||||
} ${OwnerNameDisplayFunction(ticket.job)}`}
|
||||
/>
|
||||
<Card.Content>
|
||||
<Text>
|
||||
Vehicle :
|
||||
{`${props.ticket.job.v_model_yr || ""} ${props.ticket.job.v_make_desc || ""} ${
|
||||
props.ticket.job.v_model_desc || ""
|
||||
}`}
|
||||
{`${ticket.job.v_model_yr || ""} ${
|
||||
ticket.job.v_make_desc || ""
|
||||
} ${ticket.job.v_model_desc || ""}`}
|
||||
</Text>
|
||||
<Text>
|
||||
Clocked In : <DateTimeFormatter>{props.ticket.clockon}</DateTimeFormatter>
|
||||
Clocked In :{" "}
|
||||
<DateTimeFormatter>{ticket.clockon}</DateTimeFormatter>
|
||||
</Text>
|
||||
<Text>
|
||||
Cost Center :{" "}
|
||||
{props.ticket.cost_center === "timetickets.labels.shift"
|
||||
? t(props.ticket.cost_center)
|
||||
: props.ticket.cost_center}
|
||||
{ticket.cost_center === "timetickets.labels.shift"
|
||||
? t(ticket.cost_center)
|
||||
: ticket.cost_center}
|
||||
</Text>
|
||||
</Card.Content>
|
||||
<Card.Actions>
|
||||
@@ -90,25 +94,25 @@ export function ClockedinListItem( props ) {
|
||||
completedCallback={refetch}
|
||||
/> */}
|
||||
<Button
|
||||
key={props.ticket.id}
|
||||
// key={ticket.id}
|
||||
mode="outlined"
|
||||
onPress={makeNave(props.ticket.id)}
|
||||
// {
|
||||
// logImEXEvent("imexmobile_setcamerajobid_row");
|
||||
// // setTmTicketJobId(ticket.id);
|
||||
// // console.log("ticket.jobid is :",ticket.jobid );
|
||||
// // console.log("setTimeTicketJobId is :",setTimeTicketJobId );
|
||||
// // console.log("ham is :",setTimeTicketJobId );
|
||||
// // if (typeof ham === 'undefined') {
|
||||
// // console.error("yo dog, setTimeTicketJobId is undefined!");
|
||||
// // return;
|
||||
// // }
|
||||
// const { id, jobid } = e;
|
||||
// console.log("ticket.jobid is :", ticket.jobid);
|
||||
// setTmTicketJobId(ticket.jobid);
|
||||
// // setTimeTicketJobId(ticket.jobid);
|
||||
// //navigation.navigate("TimeTicketClockOff");
|
||||
// }}
|
||||
onPress={makeNavToTimeTicketClockOff}
|
||||
// {
|
||||
// logImEXEvent("imexmobile_setcamerajobid_row");
|
||||
// // setTmTicketJobId(ticket.id);
|
||||
// // console.log("ticket.jobid is :",ticket.jobid );
|
||||
// // console.log("setTimeTicketJobId is :",setTimeTicketJobId );
|
||||
// // console.log("ham is :",setTimeTicketJobId );
|
||||
// // if (typeof ham === 'undefined') {
|
||||
// // console.error("yo dog, setTimeTicketJobId is undefined!");
|
||||
// // return;
|
||||
// // }
|
||||
// const { id, jobid } = e;
|
||||
// console.log("ticket.jobid is :", ticket.jobid);
|
||||
// setTmTicketJobId(ticket.jobid);
|
||||
// // setTimeTicketJobId(ticket.jobid);
|
||||
// //navigation.navigate("TimeTicketClockOff");
|
||||
// }}
|
||||
>
|
||||
Clock Out
|
||||
</Button>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -24,6 +24,7 @@ export function* onCreateTimeTicketStart() {
|
||||
export function* insertNewTimeTicket({ payload: { timeTicketInput } }) {
|
||||
try {
|
||||
logImEXEvent("redux_insertnewtimeticket_attempt");
|
||||
console.log("Saga, TIME_TICKET_CREATE_START :", timeTicketInput);
|
||||
//console.loging
|
||||
// console.log("Saga", employeeId, pin, pin);
|
||||
const timeTicket = yield select(selectCurrentTimeTicket);
|
||||
|
||||
Reference in New Issue
Block a user