fixbugwithselectordropdownaddedclockedinlist
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { Formik } from "formik";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { StyleSheet, Text,View, ScrollView } from "react-native";
|
||||
import { StyleSheet, Text, View, ScrollView } from "react-native";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { Button, Dialog, TextInput } from "react-native-paper";
|
||||
import { CostCenterSelect } from "../Selects/select-cost-center";
|
||||
import { JobSearchSelect } from "../Selects/select-job-name";
|
||||
import { JobIdSearchSelect } from "../Selects/select-job-id";
|
||||
import DateTimePickerModal from "react-native-modal-datetime-picker";
|
||||
import {
|
||||
selectCurrentEmployee,
|
||||
@@ -26,7 +26,7 @@ const mapStateToProps = createStructuredSelector({
|
||||
export function TimeTicketCreate({
|
||||
currentEmployee,
|
||||
currentRatesNCostCenters,
|
||||
currentBodyshop
|
||||
currentBodyshop,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -35,10 +35,14 @@ export function TimeTicketCreate({
|
||||
|
||||
const [currentSCC, setCurrentSCC] = 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);
|
||||
@@ -48,7 +52,7 @@ export function TimeTicketCreate({
|
||||
};
|
||||
const handleConfirm = (date) => {
|
||||
setDate2(date);
|
||||
//console.warn("A date has been picked: ", date);
|
||||
//console.war1n("A date has been picked: ", date);
|
||||
hideDatePicker();
|
||||
};
|
||||
const formSubmit = (values) => {
|
||||
@@ -72,14 +76,23 @@ export function TimeTicketCreate({
|
||||
>
|
||||
{({ handleChange, handleBlur, handleSubmit, values }) => (
|
||||
<View style={localStyles.topTimeTicketContainer}>
|
||||
{/* Below will be replaced with a copy of SelectCostCenter but for jobs*/}
|
||||
<JobSearchSelect convertedOnly={!currentBodyshop.tt_allow_post_to_invoiced}
|
||||
notExported={!currentBodyshop.tt_allow_post_to_invoiced} />
|
||||
|
||||
<JobIdSearchSelect
|
||||
currentValue={currentSJobId}
|
||||
onJobSelected={setCurrentSJobId}
|
||||
convertedOnly={!currentBodyshop.tt_allow_post_to_invoiced}
|
||||
notExported={!currentBodyshop.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 mode="outlined" title="TicketDatePickerButton" onPress={showDatePicker} style={localStyles.dateButton}>
|
||||
<Text style={localStyles.textForButton}>Ticket Date: {date2.toLocaleDateString()}</Text>
|
||||
<Button
|
||||
mode="outlined"
|
||||
title="TicketDatePickerButton"
|
||||
onPress={showDatePicker}
|
||||
style={localStyles.dateButton}
|
||||
>
|
||||
<Text style={localStyles.textForButton}>
|
||||
Ticket Date: {date2.toLocaleDateString()}
|
||||
</Text>
|
||||
</Button>
|
||||
<DateTimePickerModal
|
||||
isVisible={isDatePickerVisible}
|
||||
@@ -99,7 +112,12 @@ export function TimeTicketCreate({
|
||||
label={"Employee"}
|
||||
/>
|
||||
|
||||
<CostCenterSelect currentRatesNCostCenters={currentRatesNCostCenters} currentValue={currentSCC} onValueSelected={setCurrentSCC}/>
|
||||
<CostCenterSelect
|
||||
currentRatesNCostCenters={currentRatesNCostCenters}
|
||||
currentValue={currentSCC}
|
||||
onValueSelected={setCurrentSCC}
|
||||
/>
|
||||
|
||||
<TextInput
|
||||
style={localStyles.inputStyle}
|
||||
mode="outlined"
|
||||
@@ -149,8 +167,8 @@ const localStyles = StyleSheet.create({
|
||||
height: 40,
|
||||
justifyContent: "center",
|
||||
alignContent: "center",
|
||||
borderColor:"blue",
|
||||
borderWidth:0.8,
|
||||
borderColor: "blue",
|
||||
borderWidth: 0.8,
|
||||
flex: 1,
|
||||
},
|
||||
textForButton: {
|
||||
|
||||
Reference in New Issue
Block a user