diff --git a/backend/student/serializers.py b/backend/student/serializers.py index af9d6cf..eae82d7 100644 --- a/backend/student/serializers.py +++ b/backend/student/serializers.py @@ -30,10 +30,5 @@ class StudentDetailsSerializer(serializers.ModelSerializer): class Meta: model = StudentDetails fields = '__all__' - - - # def update(self, instance, validated_data): - # print("update called") - # return super().update(instance, validated_data) diff --git a/backend/student/views.py b/backend/student/views.py index 7a40f03..6a13e23 100644 --- a/backend/student/views.py +++ b/backend/student/views.py @@ -159,13 +159,13 @@ def msteams(self, request, *args, **kwargs): class StudentDetailsView(APIView): -# only authenticated users can access this view + + # only authenticated users can access this view permission_classes = (IsAuthenticated,) + # For submitting personal details of student def post(self, request): - student_instance = StudentDetails.objects.filter(enrollment_number=request.user.user_id).first() - # appending the enrollment_number to request data for saving request.data._mutable = True request.data['enrollment_number'] = request.user.user_id @@ -175,15 +175,15 @@ def post(self, request): # print(request.data) # Serialize using StudentDetailsSerializer for validation and saving - if student_instance: + student = StudentDetails.objects.filter(enrollment_number=request.user.user_id).first() + + if student: # If the record exists, update it with the new data - student_serializer = StudentDetailsSerializer(student_instance, data=request.data) + student_serializer = StudentDetailsSerializer(student, data=request.data) else: # If the record doesn't exist, create a new record student_serializer = StudentDetailsSerializer(data=request.data) - # print(student_serializer.errors) - if student_serializer.is_valid(): student_serializer.save() return Response({'message': 'Details Submitted Successfully'}, status=status.HTTP_200_OK) @@ -195,6 +195,10 @@ def post(self, request): def get(self, request): enrollment_number = request.user.user_id - serializer = StudentDetailsSerializer(StudentDetails.objects.get(enrollment_number=enrollment_number)) - # print(serializer.data) - return Response(serializer.data, status=status.HTTP_200_OK) \ No newline at end of file + student = StudentDetails.objects.filter(enrollment_number=enrollment_number).first() + + if student: + serializer = StudentDetailsSerializer(student) + return Response(serializer.data, status=status.HTTP_200_OK) + else: + return Response({'message': 'Student details not found'}, status=status.HTTP_204_NO_CONTENT) \ No newline at end of file diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 79930cf..98ac658 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -9,6 +9,8 @@ "version": "0.1.0", "dependencies": { "@babel/traverse": ">=7.23.2", + "@heroicons/react": "^2.0.18", + "@tailwindcss/forms": "^0.5.6", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", @@ -2370,6 +2372,14 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@heroicons/react": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.0.18.tgz", + "integrity": "sha512-7TyMjRrZZMBPa+/5Y8lN0iyvUU/01PeMGX2+RE7cQWpEUIcb4QotzUObFkJDejj/HUH4qjP/eQ0gzzKs2f+6Yw==", + "peerDependencies": { + "react": ">= 16" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", @@ -3574,6 +3584,17 @@ "url": "https://github.com/sponsors/gregberge" } }, + "node_modules/@tailwindcss/forms": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.6.tgz", + "integrity": "sha512-Fw+2BJ0tmAwK/w01tEFL5TiaJBX1NLT1/YbWgvm7ws3Qcn11kiXxzNTEQDMs5V3mQemhB56l3u0i9dwdzSQldA==", + "dependencies": { + "mini-svg-data-uri": "^1.2.3" + }, + "peerDependencies": { + "tailwindcss": ">=3.0.0 || >= 3.0.0-alpha.1" + } + }, "node_modules/@testing-library/dom": { "version": "9.3.1", "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-9.3.1.tgz", @@ -12538,6 +12559,14 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/mini-svg-data-uri": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/mini-svg-data-uri/-/mini-svg-data-uri-1.4.4.tgz", + "integrity": "sha512-r9deDe9p5FJUPZAk3A59wGH7Ii9YrjjWw0jmw/liSbHl2CHiyXj6FcDXDu2K3TjVAXqiJdaw3xxwlZZr9E6nHg==", + "bin": { + "mini-svg-data-uri": "cli.js" + } + }, "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", @@ -19454,6 +19483,12 @@ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.48.0.tgz", "integrity": "sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==" }, + "@heroicons/react": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.0.18.tgz", + "integrity": "sha512-7TyMjRrZZMBPa+/5Y8lN0iyvUU/01PeMGX2+RE7cQWpEUIcb4QotzUObFkJDejj/HUH4qjP/eQ0gzzKs2f+6Yw==", + "requires": {} + }, "@humanwhocodes/config-array": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", @@ -20286,6 +20321,14 @@ "loader-utils": "^2.0.0" } }, + "@tailwindcss/forms": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.6.tgz", + "integrity": "sha512-Fw+2BJ0tmAwK/w01tEFL5TiaJBX1NLT1/YbWgvm7ws3Qcn11kiXxzNTEQDMs5V3mQemhB56l3u0i9dwdzSQldA==", + "requires": { + "mini-svg-data-uri": "^1.2.3" + } + }, "@testing-library/dom": { "version": "9.3.1", "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-9.3.1.tgz", @@ -26877,6 +26920,11 @@ } } }, + "mini-svg-data-uri": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/mini-svg-data-uri/-/mini-svg-data-uri-1.4.4.tgz", + "integrity": "sha512-r9deDe9p5FJUPZAk3A59wGH7Ii9YrjjWw0jmw/liSbHl2CHiyXj6FcDXDu2K3TjVAXqiJdaw3xxwlZZr9E6nHg==" + }, "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", diff --git a/frontend/package.json b/frontend/package.json index 7eded2e..c16f33f 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -4,6 +4,8 @@ "private": true, "dependencies": { "@babel/traverse": ">=7.23.2", + "@heroicons/react": "^2.0.18", + "@tailwindcss/forms": "^0.5.6", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", diff --git a/frontend/src/App.css b/frontend/src/App.css index 74b5e05..19b2643 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -1,38 +1,34 @@ -.App { - text-align: center; -} - -.App-logo { - height: 40vmin; - pointer-events: none; -} +/* Tailwind.css or App.css */ -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } -} - -.App-header { - background-color: #282c34; - min-height: 100vh; +.sidebar { + width: 0; + height: 100%; + position: fixed; + top: 0; + left: 0; + background-color: #333; + overflow-x: hidden; + transition: 0.3s; display: flex; flex-direction: column; align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; + padding-top: 60px; + z-index: 1; +} + +.sidebar.open { + width: 250px; } -.App-link { - color: #61dafb; +.hamburger { + cursor: pointer; + margin-left: 15px; + margin-top: 15px; } -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } +.line { + width: 30px; + height: 3px; + background-color: white; + margin: 6px 0; } diff --git a/frontend/src/components/Student Portal/DetailsForm.js b/frontend/src/components/Student Portal/DetailsForm.js index 21284ed..77b9887 100644 --- a/frontend/src/components/Student Portal/DetailsForm.js +++ b/frontend/src/components/Student Portal/DetailsForm.js @@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react'; import ErrorPage from '../standard/ErrorPage'; import bgForm from "../../assets/bg_forms.jpg"; import { useNavigate } from 'react-router-dom'; - +import { PhotoIcon, UserCircleIcon } from '@heroicons/react/24/solid' const DetailsForm = () => { const [user, setUser] = useState(null); const [loading, setLoading] = useState(true); @@ -274,7 +274,7 @@ const DetailsForm = () => { switch (step) { case 1: return ( -
You have already filled the details form. Please wait until further notice.
+ ) : ( + + )} {/* You can add more student details and components as needed */}