Skip to content

Commit

Permalink
Merge branch 'main' into reset-password
Browse files Browse the repository at this point in the history
  • Loading branch information
Tudor-Barsan authored Aug 26, 2024
2 parents 9d0503c + d77e915 commit d3cb809
Show file tree
Hide file tree
Showing 24 changed files with 592 additions and 221 deletions.
1 change: 0 additions & 1 deletion backend/app/graphql/meal_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ def mutate(

print("requestor id is", requestor_id)

# TODO: Re-enable this check
if (
requestor_role != "Admin"
and meal_request.donation_info["donor"]["id"] != requestor_id
Expand Down
19 changes: 10 additions & 9 deletions backend/app/resources/meal_request_dto.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,18 @@ def validate(self):

validate_user(self.requestor, "requestor", error_list)

# if type(self.status) is not str:
# error_list.append("The status supplied is not a string.")
if type(self.status) is not str:
error_list.append(
f"The status supplied was type {type(self.status)}, but expected a string."
)

if self.status not in MEAL_STATUSES_STRINGS:
# TODO: revisit this
pass
# error_list.append(
# "The status {self_status} is not one of {valid_statuses}".format(
# self_status=self.status, valid_statuses=", ".join(MEAL_STATUSES)
# )
# )
error_list.append(
"The status {self_status} is not one of {valid_statuses}".format(
self_status=self.status,
valid_statuses=", ".join(MEAL_STATUSES_STRINGS),
)
)

if type(self.drop_off_datetime) is not datetime.datetime:
error_list.append(
Expand Down
217 changes: 201 additions & 16 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"jose": "^4.11.1",
"json-schema": "^0.3.0",
"json2csv": "^5.0.6",
"react": "^18.2.0",
"react": "^18.3.1",
"react-bootstrap": "^1.5.2",
"react-dom": "^18.2.0",
"react-dom": "^18.3.1",
"react-icons": "^5.0.1",
"react-json-schema": "^1.2.2",
"react-jsonschema-form": "^1.8.1",
Expand Down Expand Up @@ -109,4 +109,4 @@
"autoprefixer": "10.4.5",
"postcss-preset-env": "7.4.4"
}
}
}
5 changes: 5 additions & 0 deletions frontend/src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import MealDonationForm from "./components/meal_donor/donation_form/MealDonation
import * as Paths from "./constants/Routes";
import Dashboard from "./pages/ASPDashboard";
import MealDonorCalendar from "./pages/MealDonorCalendar";
import MealDonorConfirmation from "./pages/MealDonorConfirmation";
import MealDonorDashboard from "./pages/MealDonorDashboard";
import NotFound from "./pages/NotFound";
import OnboardingRequestsPage from "./pages/OnboardingRequestsPage";
Expand Down Expand Up @@ -57,6 +58,10 @@ const Routes = (): React.ReactElement => {
path={Paths.MEAL_DONOR_UPCOMING_PAGE}
element={<UpcomingPage />}
/>
<Route
path={Paths.MEAL_DONOR_CONFIRMATION_PAGE}
element={<MealDonorConfirmation />}
/>
<Route
path={Paths.ONBOARDING_REQUESTS_PAGE}
element={<OnboardingRequestsPage />}
Expand Down
Binary file added frontend/src/assets/confirmation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion frontend/src/components/asp/requests/CreateMealRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ const CreateMealRequest = (): React.ReactElement => {
Array(7).fill(false),
);

// TODO: once the last tab is reached, submit the form
// Below is a way to get a list of days, i.e. the indexes of the true values in the boolean array
const selectedDays = weekdayButtonStates
.map((state, i) => (state ? i : -1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const SchedulingFormMealInfo: React.FunctionComponent<SchedulingFormMealInfoProp
<OnsiteContactSection
onsiteInfo={onsiteContact}
setOnsiteInfo={setOnsiteContact}
attemptedSubmit={false /* todo change */}
attemptedSubmit={attemptedSubmit}
availableStaff={availableStaff}
dropdown
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gql, useMutation } from "@apollo/client";
import { gql, useApolloClient, useMutation } from "@apollo/client";
import {
Box,
Button,
Expand Down Expand Up @@ -103,6 +103,8 @@ const SchedulingFormReviewAndSubmit: React.FunctionComponent<SchedulingFormRevie

const navigate = useNavigate();
const [isSubmitLoading, setIsSubmitLoading] = useState(false);
const apolloClient = useApolloClient();


// Datetimes is a list of javascript dates with the correct date and time.
// The "mealRequestDates" only is dates without the time, so we need to add the time to it.
Expand Down Expand Up @@ -142,6 +144,8 @@ const SchedulingFormReviewAndSubmit: React.FunctionComponent<SchedulingFormRevie

// On success, navigate to dashboard
if (response.data) {
apolloClient.cache.evict({ fieldName: "getMealRequestsByRequestorId" });
apolloClient.cache.evict({ fieldName: "getMealRequestsByDonorId" });
toast({
title: "Meal request submitted!",
status: "success",
Expand Down
Loading

0 comments on commit d3cb809

Please sign in to comment.