added select job id selector

This commit is contained in:
jfrye122
2023-05-09 16:19:34 -04:00
parent 8404873d40
commit c470508505
4 changed files with 247 additions and 33 deletions

View File

@@ -14,17 +14,21 @@ import {
selectRates,
} from "../../redux/employee/employee.selectors";
import DateTimePickerModal from "react-native-modal-datetime-picker";
import { JobSearchSelect } from "../Selects/select-job-name";
import { selectBodyshop } from "../../redux/user/user.selectors";
//TODO add props needed for call
const mapStateToProps = createStructuredSelector({
currentEmployee: selectCurrentEmployee,
currentRatesNCostCenters: selectRates,
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({});
export function TimeTicketCreate({
currentEmployee,
currentRatesNCostCenters,
bodyshop
}) {
const { t } = useTranslation();
@@ -77,20 +81,13 @@ export function TimeTicketCreate({
{({ handleChange, handleBlur, handleSubmit, values }) => (
<View style={localStyles.topTimeTicketContainer}>
{/* Below will be replaced with a copy of SelectCostCenter but for jobs*/}
<TextInput
style={localStyles.input}
onChangeText={handleChange("jobid")}
mode="flat"
onBlur={handleBlur("jobid")}
value={values.jobid}
label={"Job to Post Against"}
/>
<JobSearchSelect convertedOnly={!bodyshop.tt_allow_post_to_invoiced}
notExported={!bodyshop.tt_allow_post_to_invoiced} />
{/* Below will be replaced with a Date Picker*/}
{/* <TextInput style={localStyles.input} mode="flat" onChangeText={handleChange("ticketdate")} onBlur={handleBlur("ticketdate")} value={values.ticketdate} label={"Ticket Date"} /> */}
<Button title="TicketDatePickerButton" onPress={showDatePicker}>
{" "}
Ticket Date: {date2.toLocaleDateString()}{" "}
<Button mode="outlined" title="TicketDatePickerButton" onPress={showDatePicker} style={localStyles.dateButton}>
<Text style={localStyles.textForButton}>Ticket Date: {date2.toLocaleDateString()}</Text>
</Button>
<DateTimePickerModal
isVisible={isDatePickerVisible}
@@ -101,8 +98,9 @@ export function TimeTicketCreate({
/>
{/* Below will set to auto fill with current employee */}
<TextInput
style={localStyles.input}
mode="flat"
style={localStyles.inputStyle}
mode="outlined"
disabled={true}
onChangeText={handleChange("employee")}
onBlur={handleBlur("employee")}
value={values.employee}
@@ -110,26 +108,18 @@ export function TimeTicketCreate({
/>
<SelectCostCenter selectorData={costCenters} />
{/* Below will be replaced with 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"
style={localStyles.inputStyle}
mode="outlined"
onChangeText={handleChange("productivehours")}
onBlur={handleBlur("productivehours")}
value={values.productivehours}
label={"Productive Hours"}
/>
<TextInput
style={localStyles.input}
mode="flat"
style={localStyles.inputStyle}
mode="outlined"
onChangeText={handleChange("actualhours")}
onBlur={handleBlur("actualhours")}
value={values.actualhours}
@@ -163,4 +153,23 @@ const localStyles = StyleSheet.create({
topTimeTicketContainer: {},
bottomTimeTicketContainer: {},
input: {},
dateButton: {
margin: 16,
height: 40,
justifyContent: "center",
alignContent: "center",
borderColor:"blue",
borderWidth:0.8,
flex: 1,
},
textForButton: {
flex: 1,
justifyContent: "center",
alignContent: "center",
},
inputStyle: {
margin: 16,
height: 48,
fontSize: 16,
},
});