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 { employeeSignInStart } from "../../redux/employee/employee.actions";
|
||||||
import { useRef } from "react";
|
import { useRef } from "react";
|
||||||
|
|
||||||
|
|
||||||
// const selectNumCompletedTodos = createSelector(
|
// const selectNumCompletedTodos = createSelector(
|
||||||
// (state) => state.timeTickets,
|
// (state) => state.timeTickets,
|
||||||
// (timeTickets) => timeTickets.timeTicketJobId
|
// (timeTickets) => timeTickets.timeTicketJobId
|
||||||
// );
|
// );
|
||||||
//const mapStateToProps = createStructuredSelector({});
|
//const mapStateToProps = createStructuredSelector({});
|
||||||
// // setTimeTicketJobId: (jobId) =>dispatch(setTimeTicketJobId({jobId})),
|
// // setTimeTicketJobId: (jobId) =>dispatch(setTimeTicketJobId({jobId})),
|
||||||
//employeeSignInStart:(idjob) => dispatch(employeeSignInStart(idjob)),
|
//employeeSignInStart:(idjob) => dispatch(employeeSignInStart(idjob)),
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
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 { t } = useTranslation();
|
||||||
const navigation = useNavigation();
|
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);
|
console.log("ClockedinListItem, jbId: ", jbId);
|
||||||
const te = useRef(jbId)
|
// const te = useRef(jbId);
|
||||||
let makeNave = (jobId) => (
|
|
||||||
console.log("ClockedinListItem ", setTmTicketJobId)
|
const makeNavToTimeTicketClockOff = (jbId,setTmTicketJobId) => (
|
||||||
,console.log("te", jobId)
|
console.log("ClockedinListItem, makeNavToTimeTicketClockOff, setTmTicketJobId :", setTmTicketJobId),
|
||||||
,setTmTicketJobId(jobId)
|
console.log("ClockedinListItem, makeNavToTimeTicketClockOff, jobId :", jbId)
|
||||||
|
//,setTmTicketJobId(jbId)
|
||||||
// ,navigation.navigate("TimeTicketClockOff")
|
|
||||||
);
|
,navigation.navigate("TimeTicketClockOff")
|
||||||
|
);
|
||||||
// const onPress = (ticket, setCameraJobId) => {
|
// const onPress = (ticket, setCameraJobId) => {
|
||||||
// console.log("ClockedinListItem, onPress called");
|
// console.log("ClockedinListItem, onPress called");
|
||||||
// console.log("ClockedinListItem, ticket", ticket);
|
// console.log("ClockedinListItem, ticket", ticket);
|
||||||
@@ -63,24 +66,25 @@ export function ClockedinListItem( props ) {
|
|||||||
<Card style={{ margin: 8 }}>
|
<Card style={{ margin: 8 }}>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
title={`${
|
title={`${
|
||||||
props.ticket.job.ro_number || t("general.labels.na")
|
ticket.job.ro_number || t("general.labels.na")
|
||||||
} ${OwnerNameDisplayFunction(props.ticket.job)}`}
|
} ${OwnerNameDisplayFunction(ticket.job)}`}
|
||||||
/>
|
/>
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<Text>
|
<Text>
|
||||||
Vehicle :
|
Vehicle :
|
||||||
{`${props.ticket.job.v_model_yr || ""} ${props.ticket.job.v_make_desc || ""} ${
|
{`${ticket.job.v_model_yr || ""} ${
|
||||||
props.ticket.job.v_model_desc || ""
|
ticket.job.v_make_desc || ""
|
||||||
}`}
|
} ${ticket.job.v_model_desc || ""}`}
|
||||||
</Text>
|
</Text>
|
||||||
<Text>
|
<Text>
|
||||||
Clocked In : <DateTimeFormatter>{props.ticket.clockon}</DateTimeFormatter>
|
Clocked In :{" "}
|
||||||
|
<DateTimeFormatter>{ticket.clockon}</DateTimeFormatter>
|
||||||
</Text>
|
</Text>
|
||||||
<Text>
|
<Text>
|
||||||
Cost Center :{" "}
|
Cost Center :{" "}
|
||||||
{props.ticket.cost_center === "timetickets.labels.shift"
|
{ticket.cost_center === "timetickets.labels.shift"
|
||||||
? t(props.ticket.cost_center)
|
? t(ticket.cost_center)
|
||||||
: props.ticket.cost_center}
|
: ticket.cost_center}
|
||||||
</Text>
|
</Text>
|
||||||
</Card.Content>
|
</Card.Content>
|
||||||
<Card.Actions>
|
<Card.Actions>
|
||||||
@@ -90,25 +94,25 @@ export function ClockedinListItem( props ) {
|
|||||||
completedCallback={refetch}
|
completedCallback={refetch}
|
||||||
/> */}
|
/> */}
|
||||||
<Button
|
<Button
|
||||||
key={props.ticket.id}
|
// key={ticket.id}
|
||||||
mode="outlined"
|
mode="outlined"
|
||||||
onPress={makeNave(props.ticket.id)}
|
onPress={makeNavToTimeTicketClockOff}
|
||||||
// {
|
// {
|
||||||
// logImEXEvent("imexmobile_setcamerajobid_row");
|
// logImEXEvent("imexmobile_setcamerajobid_row");
|
||||||
// // setTmTicketJobId(ticket.id);
|
// // setTmTicketJobId(ticket.id);
|
||||||
// // console.log("ticket.jobid is :",ticket.jobid );
|
// // console.log("ticket.jobid is :",ticket.jobid );
|
||||||
// // console.log("setTimeTicketJobId is :",setTimeTicketJobId );
|
// // console.log("setTimeTicketJobId is :",setTimeTicketJobId );
|
||||||
// // console.log("ham is :",setTimeTicketJobId );
|
// // console.log("ham is :",setTimeTicketJobId );
|
||||||
// // if (typeof ham === 'undefined') {
|
// // if (typeof ham === 'undefined') {
|
||||||
// // console.error("yo dog, setTimeTicketJobId is undefined!");
|
// // console.error("yo dog, setTimeTicketJobId is undefined!");
|
||||||
// // return;
|
// // return;
|
||||||
// // }
|
// // }
|
||||||
// const { id, jobid } = e;
|
// const { id, jobid } = e;
|
||||||
// console.log("ticket.jobid is :", ticket.jobid);
|
// console.log("ticket.jobid is :", ticket.jobid);
|
||||||
// setTmTicketJobId(ticket.jobid);
|
// setTmTicketJobId(ticket.jobid);
|
||||||
// // setTimeTicketJobId(ticket.jobid);
|
// // setTimeTicketJobId(ticket.jobid);
|
||||||
// //navigation.navigate("TimeTicketClockOff");
|
// //navigation.navigate("TimeTicketClockOff");
|
||||||
// }}
|
// }}
|
||||||
>
|
>
|
||||||
Clock Out
|
Clock Out
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -11,15 +11,16 @@ import { useQuery } from "@apollo/client";
|
|||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { ClockedinListItem } from "../time-ticket-items/clockedin-list-item.component";
|
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({
|
const mapStateToProps = createStructuredSelector({
|
||||||
technician: selectTechnician,
|
technician: selectTechnician,
|
||||||
//currentEmployee: selectCurrentEmployee,
|
//currentEmployee: selectCurrentEmployee,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
// const mapDispatchToProps = (dispatch) => ({
|
||||||
setTmTicketJobId: (jobId) => dispatch(setTmTicketJobId(jobId)),
|
// setTmTicketJobId: (jobId) => dispatch(setTmTicketJobId(jobId)),
|
||||||
});
|
// });
|
||||||
|
|
||||||
export function EmployeeClockedInList({ technician }) {
|
export function EmployeeClockedInList({ technician }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -37,23 +38,26 @@ export function EmployeeClockedInList({ technician }) {
|
|||||||
);
|
);
|
||||||
if (loading) return <ActivityIndicator color="dodgerblue" size="large" />;
|
if (loading) return <ActivityIndicator color="dodgerblue" size="large" />;
|
||||||
if (error) return <ErrorDisplay errorMessage={error.message} />;
|
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)}
|
// if (data) () => {setTmTicketJobId(data)}
|
||||||
|
|
||||||
const onRefresh = async () => {
|
const onRefresh = async () => {
|
||||||
return refetch();
|
return refetch();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
{data.timetickets.length > 0 ? (
|
{data.timetickets.length > 0 ? (
|
||||||
<View>
|
<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
|
<FlatList
|
||||||
data={data.timetickets}
|
data={data.timetickets}
|
||||||
refreshControl={
|
refreshControl={
|
||||||
<RefreshControl refreshing={loading} onRefresh={onRefresh} />
|
<RefreshControl refreshing={loading} onRefresh={onRefresh} />
|
||||||
}
|
}
|
||||||
renderItem={(object) => <ClockedinListItem ticket={object.item} setTmTicketJobId={setTmTicketJobId}/>}
|
renderItem={(object) => <ClockedinListItem ticket={object.item} />}
|
||||||
|
// setTmTicketJobId={setTmTicketJobId}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
) : null}
|
) : 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 } }) {
|
export function* insertNewTimeTicket({ payload: { timeTicketInput } }) {
|
||||||
try {
|
try {
|
||||||
logImEXEvent("redux_insertnewtimeticket_attempt");
|
logImEXEvent("redux_insertnewtimeticket_attempt");
|
||||||
|
console.log("Saga, TIME_TICKET_CREATE_START :", timeTicketInput);
|
||||||
//console.loging
|
//console.loging
|
||||||
// console.log("Saga", employeeId, pin, pin);
|
// console.log("Saga", employeeId, pin, pin);
|
||||||
const timeTicket = yield select(selectCurrentTimeTicket);
|
const timeTicket = yield select(selectCurrentTimeTicket);
|
||||||
|
|||||||
Reference in New Issue
Block a user