Update time ticket areas added to use translations

This commit is contained in:
jfrye122
2023-06-05 16:50:12 -04:00
parent 43151aaa2d
commit 0889453998
11 changed files with 235 additions and 84 deletions

View File

@@ -52,13 +52,6 @@ export function TimeTicketCreate({
// const [currentSJob, setCurrentSJob] = useState(null);
const [currentSJobId, setCurrentSJobId] = useState(null);
// const wrapperSetCurrentSJobState = useCallback(
// (val) => {
// setCurrentSJob(val);
// },
// [setCurrentSJob]
// );
const showDatePicker = () => {
setDatePickerVisibility(true);
};
@@ -67,7 +60,6 @@ export function TimeTicketCreate({
};
const handleConfirm = (date) => {
setDate2(date);
//console.war1n("A date has been picked: ", date);
hideDatePicker();
};
@@ -75,7 +67,7 @@ export function TimeTicketCreate({
const handleFinish = async (values) => {
logImEXEvent("handleFinish_called_in_TimeTicketCreate");
console.log("handleFinish called in TimeTicketCreate");
// console.log("handleFinish called in TimeTicketCreate");
setError(null);
setLoading(true);
@@ -93,17 +85,17 @@ export function TimeTicketCreate({
!!values.actualhours
) {
if (isNaN(values.actualhours) | isNaN(values.productivehours)) {
console.log("actual hours is NAN!");
// console.log("actual hours is NAN!");
setLoading(false);
setError({ message: "Please make sure all fields have valid values." });
setError({ message: t("createtimeticket.errors.nan") });
return;
}
setError(null);
console.log("have all values");
// console.log("have all values");
} else {
console.log("missing values!");
// console.log("missing values!");
setLoading(false);
setError({ message: "Please make sure all fields have a value." });
setError({ message: t("createtimeticket.errors.missingvalues")});
return;
}
@@ -211,7 +203,7 @@ export function TimeTicketCreate({
style={localStyles.dateButton}
>
<Text style={localStyles.textForButton}>
Ticket Date: {date2.toLocaleDateString('en-US', { day: '2-digit', month: '2-digit', year: 'numeric' })}
{t("createtimeticket.actions.ticketdate")}{date2.toLocaleDateString('en-US', { day: '2-digit', month: '2-digit', year: 'numeric' })}
</Text>
</Button>
<DateTimePickerModal
@@ -221,28 +213,25 @@ export function TimeTicketCreate({
onConfirm={handleConfirm}
onCancel={hideDatePicker}
/>
{/* Below will set to auto fill with current employee */}
<TextInput
style={localStyles.inputStyle}
mode="outlined"
disabled={true}
value={currentEmployeeFullName}
label={"Employee"}
label={t("createtimeticket.labels.employeeplaceholder")}
/>
<CostCenterSelect
currentRatesNCostCenters={currentRatesNCostCenters}
currentValue={currentSCC}
onValueSelected={setCurrentSCC}
/>
<TextInput
style={localStyles.inputStyle}
mode="outlined"
onChangeText={handleChange("productivehours")}
onBlur={handleBlur("productivehours")}
value={values.productivehours}
label={"Productive Hours"}
label={t("createtimeticket.labels.productivehoursplaceholder")}
keyboardType="numeric"
/>
<TextInput
@@ -251,7 +240,7 @@ export function TimeTicketCreate({
onChangeText={handleChange("actualhours")}
onBlur={handleBlur("actualhours")}
value={values.actualhours}
label={"Actual Hours"}
label={t("createtimeticket.labels.actualhoursplaceholder")}
keyboardType="numeric"
/>
{error ? <ErrorDisplay errorMessage={error.message} /> : null}
@@ -261,7 +250,7 @@ export function TimeTicketCreate({
loading={loading}
title="Submit"
>
<Text style={{ fontSize: 12 }}>Create Ticket</Text>
<Text style={{ fontSize: 12 }}>{t("createtimeticket.actions.createticket")}</Text>
</Button>
</View>
)}