Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement task prefill buttons #11

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions pages/TaskConfig/SubmitCard/SubmitCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,70 @@ export const SubmitCard = () => {
.catch(alert);
};

const TwentyFourHrTestPrefillHandler = () => {
const inputs = document.querySelectorAll("input");
inputs.forEach(function (input) {
switch (input.getAttribute("name")) {
case "timeBetween":
input.value = "3600";
break;
case "valves":
input.value = "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23";
break;
case "flushTime":
input.value = "30";
break;
case "sampleTime":
input.value = "120";
break;
case "sampleVolume":
input.value = "1";
break;
case "samplePressure":
input.value = "35";
break;
case "dryTime":
input.value = "30";
break;
case "preserveTime":
input.value = "30";
break;
}
});
};

const TwoWeekTestPrefillHandler = () => {
const inputs = document.querySelectorAll("input");
inputs.forEach(function (input) {
switch (input.getAttribute("name")) {
case "timeBetween":
input.value = "50400";
break;
case "valves":
input.value = "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23";
break;
case "flushTime":
input.value = "30";
break;
case "sampleTime":
input.value = "300";
break;
case "sampleVolume":
input.value = "1";
break;
case "samplePressure":
input.value = "35";
break;
case "dryTime":
input.value = "30";
break;
case "preserveTime":
input.value = "30";
break;
}
});
};

const taskStatus = mapTaskStatusToString[task.status];

return (
Expand Down Expand Up @@ -167,6 +231,23 @@ export const SubmitCard = () => {
/>
</div>

<div tw="text-subtitle text-secondary whitespace-normal">
{"Task value prefills"}
</div>
<Button
tw="bg-transparent border-accent border text-accent shadow-none
hover:(shadow-none font-bold)"
text="24hr Pressure Test"
onClick={TwentyFourHrTestPrefillHandler}
/>

<Button
tw="bg-transparent border-accent border text-accent shadow-none
hover:(shadow-none font-bold)"
text="2w Pressure Test"
onClick={TwoWeekTestPrefillHandler}
/>

<div tw="text-subtitle text-secondary justify-self-end">
<span>Click here to </span>
<button
Expand Down