Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #435 from SELab-2/feature/calendar_schedule
Browse files Browse the repository at this point in the history
Feature/calendar schedule
  • Loading branch information
simvadnbu authored May 10, 2023
2 parents 2801480 + 87a5315 commit a3ef145
Show file tree
Hide file tree
Showing 28 changed files with 2,797 additions and 3,848 deletions.
4,524 changes: 1,499 additions & 3,025 deletions backend/datadump.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions backend/student_on_tour/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class StudentOnTourBulk(APIView):

@extend_schema(
description="POST body consists of a data component that is a list of Student-Tour instances. "
"This enables the frontend to save a schedule in 1 request instead of multiple. "
"If a save fails, all the previous saves will be undone as well.",
"This enables the frontend to save a schedule in 1 request instead of multiple. "
"If a save fails, all the previous saves will be undone as well.",
request=StudOnTourSerializer,
responses={200: SuccessSerializer, 400: None},
examples=[
Expand Down Expand Up @@ -93,9 +93,9 @@ def post(self, request):

@extend_schema(
description="DELETE body consists of an ids component that is a list of Student-Tour instances. "
"This enables the frontend to remove assignments in a schedule in 1 request instead of multiple."
"If a remove fails, the previous removes will **NOT** be undone."
"""
"This enables the frontend to remove assignments in a schedule in 1 request instead of multiple."
"If a remove fails, the previous removes will **NOT** be undone."
"""
<h3> special</h3>
<br/>**Request body for bulk remove:**<br/>
<i>
Expand Down Expand Up @@ -139,8 +139,8 @@ def delete(self, request):

@extend_schema(
description="PATCH body is a map of ids on Student-Tour instances (with new data). "
"This enables the frontend to edit a schedule in 1 request instead of multiple. "
"If a save fails, the previous saves will **NOT** be undone.",
"This enables the frontend to edit a schedule in 1 request instead of multiple. "
"If a save fails, the previous saves will **NOT** be undone.",
request=StudOnTourSerializer,
responses={200: SuccessSerializer, 400: None},
examples=[
Expand Down
1 change: 1 addition & 0 deletions frontend/.env.local
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ NEXT_PUBLIC_API_ALL_ROLES=role/all/
NEXT_PUBLIC_API_STUDENT_ON_TOUR=student-on-tour/
NEXT_PUBLIC_API_ALL_STUDENT_ON_TOURS=student-on-tour/all/
NEXT_PUBLIC_API_TOURS_OF_STUDENT=student-on-tour/student/
NEXT_PUBLIC_API_BULK_STUDENT_ON_TOUR=student-on-tour/bulk/

NEXT_PUBLIC_API_REMARK_AT_BUILDING=remark-at-building/
NEXT_PUBLIC_API_ALL_REMARKS=remark-at-building/all/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export interface GenericProps {
required: boolean;
}

export interface TourUserProps {
initialId: any;
setObjectId: (value: any) => void;
tourId?: number | null;
}

const AutocompleteComponent: React.FC<Props> = ({ initialId, label, fetchOptions, mapping, setObjectId }) => {
const [value, setValue] = React.useState<any>();
const [inputValue, setInputValue] = useState("");
Expand Down
17 changes: 17 additions & 0 deletions frontend/components/autocompleteComponents/studentAutocomplete.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from "react";
import { getStudents, User, userSearchString } from "@/lib/user";
import AutocompleteComponent, { GenericProps } from "@/components/autocompleteComponents/autocompleteComponent";

const StudentAutocomplete: React.FC<GenericProps> = ({ initialId, setObjectId, required }) => {
return (
<AutocompleteComponent
initialId={initialId}
label={`Selecteer student${required ? "*" : ""}`}
fetchOptions={getStudents}
mapping={(user: User) => userSearchString(user)}
setObjectId={setObjectId}
/>
);
};

export default StudentAutocomplete;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from "react";
import { getTourUsersFromRegion, User, userSearchString } from "@/lib/user";
import AutocompleteComponent, { TourUserProps } from "@/components/autocompleteComponents/autocompleteComponent";

const TourUserAutocomplete: React.FC<TourUserProps> = ({ initialId, setObjectId, tourId = null }) => {
return (
<AutocompleteComponent
initialId={initialId}
label={""}
fetchOptions={() => getTourUsersFromRegion(tourId)}
mapping={(user: User) => userSearchString(user)}
setObjectId={setObjectId}
/>
);
};

export default TourUserAutocomplete;
239 changes: 0 additions & 239 deletions frontend/components/calendar/addEvent.tsx

This file was deleted.

Loading

0 comments on commit a3ef145

Please sign in to comment.