ソースを参照

Do not show project pass actual end date in timesheet project selection

tags/Baseline_180220205_Frontend
Wayne 10ヶ月前
コミット
703591adc4
6個のファイルの変更18行の追加6行の削除
  1. +1
    -0
      src/app/api/projects/index.ts
  2. +3
    -0
      src/components/TimeLeaveModal/TimeLeaveInputTable.tsx
  3. +3
    -0
      src/components/TimeLeaveModal/TimeLeaveMobileEntry.tsx
  4. +2
    -0
      src/components/TimesheetTable/FastTimeEntryModal.tsx
  5. +7
    -6
      src/components/TimesheetTable/ProjectSelect.tsx
  6. +2
    -0
      src/components/TimesheetTable/TimesheetEditModal.tsx

+ 1
- 0
src/app/api/projects/index.ts ファイルの表示

@@ -79,6 +79,7 @@ export interface ProjectWithTasks {
id: number;
code: string;
status?: string;
actualEnd?: string;
description?: string;
name: string;
tasks: Task[];


+ 3
- 0
src/components/TimeLeaveModal/TimeLeaveInputTable.tsx ファイルの表示

@@ -345,6 +345,7 @@ const TimeLeaveInputTable: React.FC<Props> = ({
renderEditCell(params: GridRenderEditCellParams<TimeLeaveRow, number>) {
return (
<ProjectSelect
referenceDay={dayjs(day)}
includeLeaves
leaveTypes={leaveTypes}
multiple={false}
@@ -618,6 +619,7 @@ const TimeLeaveInputTable: React.FC<Props> = ({
taskGroupsByProject,
taskGroupsWithoutProject,
miscTasks,
day,
],
);

@@ -747,6 +749,7 @@ const TimeLeaveInputTable: React.FC<Props> = ({
/>
{fastEntryEnabled && (
<FastTimeEntryModal
recordDate={day}
allProjects={allProjects}
assignedProjects={assignedProjects}
open={fastEntryModalOpen}


+ 3
- 0
src/components/TimeLeaveModal/TimeLeaveMobileEntry.tsx ファイルの表示

@@ -268,6 +268,7 @@ const TimeLeaveMobileEntry: React.FC<Props> = ({
)}
</Stack>
<TimesheetEditModal
recordDate={date}
allProjects={allProjects}
assignedProjects={assignedProjects}
open={editTimeModalOpen}
@@ -278,6 +279,7 @@ const TimeLeaveMobileEntry: React.FC<Props> = ({
{...editTimeModalProps}
/>
<LeaveEditModal
recordDate={date}
leaveTypes={leaveTypes}
open={editLeaveModalOpen}
onClose={closeEditLeaveModal}
@@ -287,6 +289,7 @@ const TimeLeaveMobileEntry: React.FC<Props> = ({
/>
{fastEntryEnabled && (
<FastTimeEntryModal
recordDate={date}
allProjects={allProjects}
assignedProjects={assignedProjects}
open={fastEntryModalOpen}


+ 2
- 0
src/components/TimesheetTable/FastTimeEntryModal.tsx ファイルの表示

@@ -30,6 +30,7 @@ import { manhourFormatter, shortDateFormatter } from "@/app/utils/formatUtil";
import { DAILY_NORMAL_MAX_HOURS } from "@/app/api/timesheets/utils";
import zip from "lodash/zip";
import intersectionBy from "lodash/intersectionBy";
import dayjs from "dayjs";

export interface FastTimeEntryForm {
projectIds: TimeEntry["projectId"][];
@@ -174,6 +175,7 @@ const FastTimeEntryModal: React.FC<Props> = ({
name="projectIds"
render={({ field }) => (
<ProjectSelect
referenceDay={dayjs(recordDate)}
includeLeaves={false}
error={Boolean(formState.errors.projectIds)}
multiple


+ 7
- 6
src/components/TimesheetTable/ProjectSelect.tsx ファイルの表示

@@ -15,13 +15,14 @@ import differenceBy from "lodash/differenceBy";
import intersectionWith from "lodash/intersectionWith";
import { TFunction } from "i18next";
import { LeaveType } from "@/app/api/timesheets";
import dayjs, { Dayjs } from "dayjs";

interface CommonProps {
allProjects: ProjectWithTasks[];
assignedProjects: AssignedProject[];
error?: boolean;
multiple?: boolean;
showOnlyOngoing?: boolean;
referenceDay: Dayjs;
includeLeaves?: boolean;
leaveTypes?: LeaveType[];
}
@@ -64,7 +65,7 @@ const getGroupName = (t: TFunction, groupName: string): string => {

const AutocompleteProjectSelect: React.FC<Props> = ({
allProjects,
showOnlyOngoing = true,
referenceDay,
assignedProjects,
value,
onProjectSelect,
@@ -75,10 +76,10 @@ const AutocompleteProjectSelect: React.FC<Props> = ({
}) => {
const { t } = useTranslation("home");
const allFilteredProjects = useMemo(() => {
return showOnlyOngoing
? allProjects.filter((p) => p.status === "On-going")
: allProjects;
}, [showOnlyOngoing, allProjects]);
return allProjects.filter((p) =>
p.actualEnd ? !referenceDay.isAfter(p.actualEnd) : true,
);
}, [allProjects, referenceDay]);

const nonAssignedProjects = useMemo(() => {
return differenceBy(allFilteredProjects, assignedProjects, "id");


+ 2
- 0
src/components/TimesheetTable/TimesheetEditModal.tsx ファイルの表示

@@ -29,6 +29,7 @@ import {
DAILY_NORMAL_MAX_HOURS,
TIMESHEET_DAILY_MAX_HOURS,
} from "@/app/api/timesheets/utils";
import dayjs from "dayjs";

export interface Props extends Omit<ModalProps, "children"> {
onSave: (timeEntry: TimeEntry, recordDate?: string) => Promise<void>;
@@ -162,6 +163,7 @@ const TimesheetEditModal: React.FC<Props> = ({
name="projectId"
render={({ field }) => (
<ProjectSelect
referenceDay={dayjs(recordDate)}
multiple={false}
allProjects={allProjects}
assignedProjects={assignedProjects}


読み込み中…
キャンセル
保存