added labor allocationtable

This commit is contained in:
jfrye122
2023-05-14 11:59:34 -04:00
parent 66fa8196af
commit 6d852453b0
8 changed files with 591 additions and 45 deletions

View File

@@ -14,6 +14,8 @@ import {
} from "../../redux/employee/employee.selectors";
import { selectBodyshop } from "../../redux/user/user.selectors";
import { useCallback } from "react";
// import LaborAllocationsTable from "../labor-allocations-table/labor-allocations-table.component";
import LaborAllocationsTable from "../labor-allocations-table/labor-allocations-table.component";
//TODO add props needed for call
const mapStateToProps = createStructuredSelector({
@@ -34,15 +36,15 @@ export function TimeTicketCreate({
const [date2, setDate2] = useState(new Date());
const [currentSCC, setCurrentSCC] = useState(null);
const [currentSJob, setCurrentSJob] = useState(null);
// const [currentSJob, setCurrentSJob] = useState(null);
const [currentSJobId, setCurrentSJobId] = useState(null);
const wrapperSetCurrentSJobState = useCallback(
(val) => {
setCurrentSJob(val);
},
[setCurrentSJob]
);
// const wrapperSetCurrentSJobState = useCallback(
// (val) => {
// setCurrentSJob(val);
// },
// [setCurrentSJob]
// );
const showDatePicker = () => {
setDatePickerVisibility(true);
@@ -56,19 +58,20 @@ export function TimeTicketCreate({
hideDatePicker();
};
const formSubmit = (values) => {
Dialog.alert({ content: <pre>{JSON.stringify(values, null, 2)}</pre> });
console.log("values", values);
//Dialog.alert({ content: <pre>{JSON.stringify(values, null, 2)}</pre> });
//TODO update with start call for create time ticket
};
return (
<View style={localStyles.content}>
<ScrollView>
<ScrollView contentContainerStyle={{ flexGrow: 1 }}>
<Formik
initialValues={{
jobid: "",
jobid: {currentSJobId},
ticketdate: date2.toLocaleDateString(),
employee: currentEmployee.technician.first_name,
costcenter: "",
costcenter: {currentSCC},
productivehours: "",
actualhours: "",
}}
@@ -146,8 +149,13 @@ export function TimeTicketCreate({
</Formik>
{/* Below is for list of jobs/tickets */}
<View style={localStyles.bottomTimeTicketContainer}></View>
</ScrollView>
<View style={{ flexGrow: 1 }}>
<LaborAllocationsTable jobId={currentSJobId?.value} />
</View>
</View>
);
}
@@ -159,12 +167,13 @@ const localStyles = StyleSheet.create({
display: "flex",
flex: 1,
},
topTimeTicketContainer: {},
bottomTimeTicketContainer: {},
topContainer: {},
bottomContainer: {},
input: {},
dateButton: {
margin: 16,
height: 40,
marginVertical: 4,
marginHorizontal: 16,
height: 48,
justifyContent: "center",
alignContent: "center",
borderColor: "blue",
@@ -177,7 +186,8 @@ const localStyles = StyleSheet.create({
alignContent: "center",
},
inputStyle: {
margin: 16,
marginVertical: 4,
marginHorizontal: 16,
height: 48,
fontSize: 16,
},