added timeticket redux
This commit is contained in:
@@ -1,34 +1,31 @@
|
||||
import { Formik } from "formik";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { StyleSheet, Text } from "react-native";
|
||||
import { StyleSheet, Text,View, ScrollView } 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 { JobSearchSelect } from "../Selects/select-job-name";
|
||||
import DateTimePickerModal from "react-native-modal-datetime-picker";
|
||||
import {
|
||||
selectCurrentEmployee,
|
||||
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,
|
||||
currentBodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({});
|
||||
// const mapDispatchToProps = (dispatch) => ({});
|
||||
|
||||
export function TimeTicketCreate({
|
||||
currentEmployee,
|
||||
currentRatesNCostCenters,
|
||||
bodyshop
|
||||
currentBodyshop
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -53,15 +50,17 @@ export function TimeTicketCreate({
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
var count = Object.keys(currentRatesNCostCenters).length;
|
||||
let selectDataArray = [];
|
||||
for (let i = 0; i < count; i++) {
|
||||
selectDataArray.push({
|
||||
value: currentRatesNCostCenters[i].cost_center,
|
||||
label: currentRatesNCostCenters[i].cost_center,
|
||||
});
|
||||
}
|
||||
setCostCenters(selectDataArray);
|
||||
if (typeof currentRatesNCostCenters !== 'undefined') {
|
||||
var count = Object.keys(currentRatesNCostCenters).length;
|
||||
let selectDataArray = [];
|
||||
for (let i = 0; i < count; i++) {
|
||||
selectDataArray.push({
|
||||
value: currentRatesNCostCenters[i].cost_center,
|
||||
label: currentRatesNCostCenters[i].cost_center,
|
||||
});
|
||||
}
|
||||
setCostCenters(selectDataArray);
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -81,8 +80,8 @@ 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={!bodyshop.tt_allow_post_to_invoiced}
|
||||
notExported={!bodyshop.tt_allow_post_to_invoiced} />
|
||||
<JobSearchSelect 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"} /> */}
|
||||
|
||||
Reference in New Issue
Block a user