Refactor input fields to handle empty values
This commit is contained in:
parent
e2d2310275
commit
856ae40900
1 changed files with 42 additions and 12 deletions
|
@ -113,9 +113,14 @@ export default function GetWeeklyReport(): JSX.Element {
|
||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
className="border-2 border-black rounded-md text-center w-1/2"
|
className="border-2 border-black rounded-md text-center w-1/2"
|
||||||
value={developmentTime}
|
value={developmentTime === 0 ? "" : developmentTime}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
|
if (e.target.value === "") {
|
||||||
|
setDevelopmentTime(0);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
setDevelopmentTime(parseInt(e.target.value));
|
setDevelopmentTime(parseInt(e.target.value));
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
onKeyDown={(event) => {
|
onKeyDown={(event) => {
|
||||||
const keyValue = event.key;
|
const keyValue = event.key;
|
||||||
|
@ -132,9 +137,14 @@ export default function GetWeeklyReport(): JSX.Element {
|
||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
className="border-2 border-black rounded-md text-center w-1/2"
|
className="border-2 border-black rounded-md text-center w-1/2"
|
||||||
value={meetingTime}
|
value={meetingTime === 0 ? "" : meetingTime}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
|
if (e.target.value === "") {
|
||||||
|
setMeetingTime(0);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
setMeetingTime(parseInt(e.target.value));
|
setMeetingTime(parseInt(e.target.value));
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
onKeyDown={(event) => {
|
onKeyDown={(event) => {
|
||||||
const keyValue = event.key;
|
const keyValue = event.key;
|
||||||
|
@ -151,9 +161,14 @@ export default function GetWeeklyReport(): JSX.Element {
|
||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
className="border-2 border-black rounded-md text-center w-1/2"
|
className="border-2 border-black rounded-md text-center w-1/2"
|
||||||
value={adminTime}
|
value={adminTime === 0 ? "" : adminTime}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
|
if (e.target.value === "") {
|
||||||
|
setAdminTime(0);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
setAdminTime(parseInt(e.target.value));
|
setAdminTime(parseInt(e.target.value));
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
onKeyDown={(event) => {
|
onKeyDown={(event) => {
|
||||||
const keyValue = event.key;
|
const keyValue = event.key;
|
||||||
|
@ -170,9 +185,14 @@ export default function GetWeeklyReport(): JSX.Element {
|
||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
className="border-2 border-black rounded-md text-center w-1/2"
|
className="border-2 border-black rounded-md text-center w-1/2"
|
||||||
value={ownWorkTime}
|
value={ownWorkTime === 0 ? "" : ownWorkTime}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
|
if (e.target.value === "") {
|
||||||
|
setOwnWorkTime(0);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
setOwnWorkTime(parseInt(e.target.value));
|
setOwnWorkTime(parseInt(e.target.value));
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
onKeyDown={(event) => {
|
onKeyDown={(event) => {
|
||||||
const keyValue = event.key;
|
const keyValue = event.key;
|
||||||
|
@ -189,9 +209,14 @@ export default function GetWeeklyReport(): JSX.Element {
|
||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
className="border-2 border-black rounded-md text-center w-1/2"
|
className="border-2 border-black rounded-md text-center w-1/2"
|
||||||
value={studyTime}
|
value={studyTime === 0 ? "" : studyTime}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
|
if (e.target.value === "") {
|
||||||
|
setStudyTime(0);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
setStudyTime(parseInt(e.target.value));
|
setStudyTime(parseInt(e.target.value));
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
onKeyDown={(event) => {
|
onKeyDown={(event) => {
|
||||||
const keyValue = event.key;
|
const keyValue = event.key;
|
||||||
|
@ -208,9 +233,14 @@ export default function GetWeeklyReport(): JSX.Element {
|
||||||
type="number"
|
type="number"
|
||||||
min="0"
|
min="0"
|
||||||
className="border-2 border-black rounded-md text-center w-1/2"
|
className="border-2 border-black rounded-md text-center w-1/2"
|
||||||
value={testingTime}
|
value={testingTime === 0 ? "" : testingTime}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
|
if (e.target.value === "") {
|
||||||
|
setTestingTime(0);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
setTestingTime(parseInt(e.target.value));
|
setTestingTime(parseInt(e.target.value));
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
onKeyDown={(event) => {
|
onKeyDown={(event) => {
|
||||||
const keyValue = event.key;
|
const keyValue = event.key;
|
||||||
|
|
Loading…
Reference in a new issue