added screen-time-ticket-create.component.jsx
This commit is contained in:
125
components/time-ticket/screen-time-ticket-create.component.jsx
Normal file
125
components/time-ticket/screen-time-ticket-create.component.jsx
Normal file
@@ -0,0 +1,125 @@
|
||||
import { Formik } from "formik";
|
||||
import React from "react";
|
||||
import { StyleSheet, Text } from "react-native";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { View, ScrollView } from "react-native";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { Button, Dialog, TextInput } from "react-native-paper";
|
||||
import { QUERY_EMPLOYEE_BY_ID } from "../../graphql/employees.queries";
|
||||
//import SelectDropdown from 'react-native-select-dropdown';
|
||||
import { SelectCostCenter } from "../Selects/select-cost-center";
|
||||
import { selectCurrentEmployee } from "../../redux/employee/employee.selectors";
|
||||
//import {DateTimePicker} from "expo";
|
||||
|
||||
//TODO add props needed for call
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentEmployee: selectCurrentEmployee,
|
||||
});
|
||||
|
||||
export function TimeTicketCreate() {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const formSubmit = (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>
|
||||
<Formik
|
||||
|
||||
initialValues={{
|
||||
jobid: "",
|
||||
ticketdate: "",
|
||||
employee: "",
|
||||
costcenter: "",
|
||||
productivehours: "",
|
||||
actualhours: "",
|
||||
}}
|
||||
onSubmit={formSubmit}
|
||||
>
|
||||
{({ handleChange, handleBlur, handleSubmit, values }) => (
|
||||
<View style={localStyles.topTimeTicketContainer}>
|
||||
<TextInput
|
||||
style={localStyles.input}
|
||||
onChangeText={handleChange("jobid")}
|
||||
mode="flat"
|
||||
onBlur={handleBlur("jobid")}
|
||||
value={values.jobid}
|
||||
label={"Job to Post Against"}
|
||||
/>
|
||||
<TextInput
|
||||
style={localStyles.input}
|
||||
mode="flat"
|
||||
onChangeText={handleChange("ticketdate")}
|
||||
onBlur={handleBlur("ticketdate")}
|
||||
value={values.ticketdate}
|
||||
label={"Ticket Date"}
|
||||
/>
|
||||
<TextInput
|
||||
style={localStyles.input}
|
||||
mode="flat"
|
||||
onChangeText={handleChange("employee")}
|
||||
onBlur={handleBlur("employee")}
|
||||
value={values.employee}
|
||||
label={"Employee"}
|
||||
/>
|
||||
<SelectCostCenter />
|
||||
<TextInput
|
||||
style={localStyles.input}
|
||||
mode="flat"
|
||||
onChangeText={handleChange("costcenter")}
|
||||
onBlur={handleBlur("costcenter")}
|
||||
value={values.costcenter}
|
||||
label={"Cost Center"}
|
||||
/>
|
||||
<TextInput
|
||||
style={localStyles.input}
|
||||
mode="flat"
|
||||
onChangeText={handleChange("productivehours")}
|
||||
onBlur={handleBlur("productivehours")}
|
||||
value={values.productivehours}
|
||||
label={"Productive Hours"}
|
||||
/>
|
||||
<TextInput
|
||||
style={localStyles.input}
|
||||
mode="flat"
|
||||
onChangeText={handleChange("actualhours")}
|
||||
onBlur={handleBlur("actualhours")}
|
||||
value={values.actualhours}
|
||||
label={"Actual Hours"}
|
||||
/>
|
||||
<Button
|
||||
style={localStyles.input}
|
||||
onPress={handleSubmit}
|
||||
title="Submit"
|
||||
>
|
||||
<Text style={{ fontSize: 12 }}>Save</Text>
|
||||
</Button>
|
||||
</View>
|
||||
)}
|
||||
</Formik>
|
||||
<View style={localStyles.bottomTimeTicketContainer}>
|
||||
|
||||
</View>
|
||||
</ScrollView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(null, null)(TimeTicketCreate);
|
||||
|
||||
const localStyles = StyleSheet.create({
|
||||
content: {
|
||||
display: "flex",
|
||||
flex: 1
|
||||
},
|
||||
topTimeTicketContainer: {
|
||||
},
|
||||
bottomTimeTicketContainer: {
|
||||
},
|
||||
input: {
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user