added missing fuctionallity
This commit is contained in:
@@ -2,30 +2,41 @@ import { Ionicons } from "@expo/vector-icons";
|
||||
import { useNavigation } from "@react-navigation/native";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Button, List, Title, Card, Text } from "react-native-paper";
|
||||
import { Button, Card, Text } from "react-native-paper";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component";
|
||||
import { DateTimeFormatter } from "../../util/DateFormater";
|
||||
// import { setTimeTicketJobId } from "../../redux/timetickets/timetickets.actions";
|
||||
import { setTmTicketJobId } from "../../redux/app/app.actions";
|
||||
import { logImEXEvent } from "../../firebase/firebase.analytics";
|
||||
|
||||
// const mapStateToProps = createStructuredSelector({});
|
||||
// const mapDispatchToProps = (dispatch) => ({
|
||||
// setCameraJobId: (id) => dispatch(setCameraJobId(id)),
|
||||
// setCameraJob: (job) => dispatch(setCameraJob(job)),
|
||||
// });
|
||||
const mapStateToProps = createStructuredSelector({});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
// setTimeTicketJobId: (jobId) =>dispatch(setTimeTicketJobId({jobId})),
|
||||
setTmTicketJobId:(id) => dispatch(setTmTicketJobId(id)),
|
||||
});
|
||||
|
||||
export function ClockedinListItem({ ticket }) {
|
||||
export function ClockedinListItem({ setTmTicketJobId, ticket }) {
|
||||
const { t } = useTranslation();
|
||||
const navigation = useNavigation();
|
||||
|
||||
const onPress = () => {
|
||||
// logImEXEvent("imexmobile_view_job_detail");
|
||||
// navigation.push("JobDetail", {
|
||||
// jobId: item.id,
|
||||
// title: item.ro_number || t("general.labels.na"),
|
||||
// job: item,
|
||||
// });
|
||||
const onPress = (ticket, setCameraJobId) => {
|
||||
console.log("ClockedinListItem, onPress called");
|
||||
console.log("ClockedinListItem, ticket", ticket);
|
||||
setTimeTicketJobId(ticket.jobid);
|
||||
// logImEXEvent("imexmobile_view_job_detail");
|
||||
navigation.push("TimeTicketClockOff", {
|
||||
jobId: ticket.jobid, //item.id,
|
||||
timeTicketId: ticket.id,
|
||||
//completedCallback: refetch,
|
||||
});
|
||||
// navigation.push("JobDetail", {
|
||||
// jobId: item.id,
|
||||
// timeTicketId: item.ro_number || t("general.labels.na"),
|
||||
// job: item,
|
||||
// });
|
||||
// () => {navigation.navigate("TimeTicketClockOff");}
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -36,18 +47,20 @@ export function ClockedinListItem({ ticket }) {
|
||||
} ${OwnerNameDisplayFunction(ticket.job)}`}
|
||||
/>
|
||||
<Card.Content>
|
||||
<Text>Vehicle :
|
||||
{`${ticket.job.v_model_yr || ""} ${
|
||||
ticket.job.v_make_desc || ""
|
||||
} ${ticket.job.v_model_desc || ""}`}
|
||||
<Text>
|
||||
Vehicle :
|
||||
{`${ticket.job.v_model_yr || ""} ${ticket.job.v_make_desc || ""} ${
|
||||
ticket.job.v_model_desc || ""
|
||||
}`}
|
||||
</Text>
|
||||
<Text>
|
||||
Clocked In : <DateTimeFormatter>{ticket.clockon}</DateTimeFormatter>
|
||||
</Text>
|
||||
<Text>
|
||||
Cost Center : {ticket.cost_center === "timetickets.labels.shift"
|
||||
? t(ticket.cost_center)
|
||||
: ticket.cost_center}
|
||||
Cost Center :{" "}
|
||||
{ticket.cost_center === "timetickets.labels.shift"
|
||||
? t(ticket.cost_center)
|
||||
: ticket.cost_center}
|
||||
</Text>
|
||||
</Card.Content>
|
||||
<Card.Actions>
|
||||
@@ -56,8 +69,25 @@ export function ClockedinListItem({ ticket }) {
|
||||
timeTicketId={ticket.id}
|
||||
completedCallback={refetch}
|
||||
/> */}
|
||||
<Button
|
||||
mode="outlined" onPress={() => onPress}>Clock Out</Button>
|
||||
<Button
|
||||
mode="outlined"
|
||||
onPress={() => {
|
||||
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;
|
||||
// }
|
||||
|
||||
// setTimeTicketJobId(ticket.jobid);
|
||||
navigation.navigate("TimeTicketClockOff");
|
||||
}}
|
||||
>
|
||||
Clock Out
|
||||
</Button>
|
||||
</Card.Actions>
|
||||
</Card>
|
||||
// <List.Item
|
||||
@@ -91,4 +121,4 @@ export function ClockedinListItem({ ticket }) {
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(null, null)(ClockedinListItem);
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(ClockedinListItem);
|
||||
|
||||
Reference in New Issue
Block a user