Procházet zdrojové kódy

Small fixes

tags/Baseline_30082024_FRONTEND_UAT
Wayne před 1 rokem
rodič
revize
ab876f35f6
4 změnil soubory, kde provedl 16 přidání a 8 odebrání
  1. +1
    -1
      src/app/utils/formatUtil.ts
  2. +8
    -3
      src/components/CreateProject/CreateProject.tsx
  3. +4
    -4
      src/components/CreateProject/MilestoneSection.tsx
  4. +3
    -0
      src/components/TimesheetTable/EntryInputTable.tsx

+ 1
- 1
src/app/utils/formatUtil.ts Zobrazit soubor

@@ -39,7 +39,7 @@ export const shortDateFormatter = (locale?: string) => {
}
};

export function convertLocaleStringToNumber(numberString: String): number {
export function convertLocaleStringToNumber(numberString: string): number {
const numberWithoutCommas = numberString.replace(/,/g, "");
return parseFloat(numberWithoutCommas);
}

+ 8
- 3
src/components/CreateProject/CreateProject.tsx Zobrazit soubor

@@ -61,7 +61,9 @@ const hasErrorsInTab = (
) => {
switch (tabIndex) {
case 0:
return errors.projectName;
return (
errors.projectName || errors.projectCode || errors.projectDescription
);
default:
false;
}
@@ -101,7 +103,6 @@ const CreateProject: React.FC<Props> = ({
const onSubmit = useCallback<SubmitHandler<CreateProjectInputs>>(
async (data) => {
try {
console.log(data);
setServerError("");
await saveProject(data);
router.replace("/projects");
@@ -115,7 +116,11 @@ const CreateProject: React.FC<Props> = ({
const onSubmitError = useCallback<SubmitErrorHandler<CreateProjectInputs>>(
(errors) => {
// Set the tab so that the focus will go there
if (errors.projectName) {
if (
errors.projectName ||
errors.projectDescription ||
errors.projectCode
) {
setTabIndex(0);
}
},


+ 4
- 4
src/components/CreateProject/MilestoneSection.tsx Zobrazit soubor

@@ -29,7 +29,7 @@ import React, { useCallback, useEffect, useMemo, useState } from "react";
import { useFormContext } from "react-hook-form";
import { useTranslation } from "react-i18next";
import StyledDataGrid from "../StyledDataGrid";
import { moneyFormatter } from "@/app/utils/formatUtil";
import { INPUT_DATE_FORMAT, moneyFormatter } from "@/app/utils/formatUtil";
import isDate from "lodash/isDate";

interface Props {
@@ -206,7 +206,7 @@ const MilestoneSection: React.FC<Props> = ({ taskGroupId }) => {
description: p.description!,
id: p.id!,
amount: p.amount!,
date: dayjs(p.date!).toISOString(),
date: dayjs(p.date!).format(INPUT_DATE_FORMAT),
})),
},
});
@@ -245,7 +245,7 @@ const MilestoneSection: React.FC<Props> = ({ taskGroupId }) => {
...milestones,
[taskGroupId]: {
...milestones[taskGroupId],
startDate: date.toISOString(),
startDate: date.format(INPUT_DATE_FORMAT),
},
});
}}
@@ -264,7 +264,7 @@ const MilestoneSection: React.FC<Props> = ({ taskGroupId }) => {
...milestones,
[taskGroupId]: {
...milestones[taskGroupId],
endDate: date.toISOString(),
endDate: date.format(INPUT_DATE_FORMAT),
},
});
}}


+ 3
- 0
src/components/TimesheetTable/EntryInputTable.tsx Zobrazit soubor

@@ -22,6 +22,9 @@ import { AssignedProject } from "@/app/api/projects";
import uniqBy from "lodash/uniqBy";
import { TaskGroup } from "@/app/api/tasks";
import dayjs from "dayjs";
import isBetween from "dayjs/plugin/isBetween";

dayjs.extend(isBetween);

const mockProjects: AssignedProject[] = [
{


Načítá se…
Zrušit
Uložit