Skip to content

Commit

Permalink
wip: remove extent
Browse files Browse the repository at this point in the history
  • Loading branch information
jonandernovella committed Oct 20, 2023
1 parent bb519e0 commit da7a516
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 46 deletions.
25 changes: 0 additions & 25 deletions frontend/src/components/AbsencePlanner/AbsenceExtentInput.tsx

This file was deleted.

25 changes: 4 additions & 21 deletions frontend/src/pages/AbsencePlanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import floppy from "../icons/floppy.svg";
import { useConfirm } from "../components/ConfirmDialogProvider";
import calender from "../icons/calendar-week-white.svg";

import AbsenceExtentInput from "../components/AbsencePlanner/AbsenceExtentInput";
import AbsenceIssuesSelector from "../components/AbsencePlanner/AbsenceIssuesSelector";

export const AbsencePlanner = () => {
Expand All @@ -58,7 +57,7 @@ export const AbsencePlanner = () => {
id: number;
subject: string;
}>(absenceIssueOptions[0]);
const [selectedExtent, setSelectedExtent] = useState<number>(8);
const extentOfAbsence = 8;

const [isLoading, setIsLoading] = useState(false);
const [tableData, setTableData] = useState<AbsenceInterval[]>([]);
Expand Down Expand Up @@ -480,7 +479,7 @@ export const AbsencePlanner = () => {
const allReported = await reportAbsenceTime(
reportable_days,
selectedIssue.id,
selectedExtent
extentOfAbsence
);
toggleLoadingPage(false);
setStartDate(undefined);
Expand Down Expand Up @@ -535,7 +534,7 @@ export const AbsencePlanner = () => {
0
);
const expectedNewAmountOfHoursForWeek =
reportedHours + selectedExtent * numberOfEntries;
reportedHours + extentOfAbsence * numberOfEntries;

numberOfReportedHoursPerWeek.push(expectedNewAmountOfHoursForWeek);
});
Expand Down Expand Up @@ -572,7 +571,7 @@ export const AbsencePlanner = () => {
};
const onAddAbsenceButton = async () => {
const areDatesValid: boolean = validateDates();
const isExtentValid: boolean = validateExtent(selectedExtent);
const isExtentValid: boolean = validateExtent(extentOfAbsence);

if (areDatesValid) {
if (isExtentValid) {
Expand Down Expand Up @@ -667,11 +666,6 @@ export const AbsencePlanner = () => {
setSelectedIssue(selectedIssue);
};

const onSelectAbsenceExtent = (e: React.ChangeEvent<HTMLInputElement>) => {
const extent = Number(e.target.value);
setSelectedExtent(extent);
};

return (
<>
<LoadingOverlay
Expand Down Expand Up @@ -708,7 +702,6 @@ export const AbsencePlanner = () => {
<th>Start</th>
<th>End</th>
<th>Reason </th>
<th>Extent </th>
</tr>
{tableData.map((element, index) => {
return (
Expand Down Expand Up @@ -750,7 +743,6 @@ export const AbsencePlanner = () => {
)?.subject
}
</td>
<td>{element.extent ? element.extent : "NA"}</td>
</tr>
);
})}
Expand Down Expand Up @@ -810,15 +802,6 @@ export const AbsencePlanner = () => {
defaultOption={absenceIssueOptions[0].id}
/>
</div>
<div className="">
<label htmlFor="absence-extent" className="">
Daily extent
</label>
<AbsenceExtentInput
onChange={onSelectAbsenceExtent}
value={selectedExtent}
/>
</div>
</div>
<div className="add-absence">
<button
Expand Down

0 comments on commit da7a516

Please sign in to comment.