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

SA-1 : Added many functionalities of Hostel management for four different actors. #1301

Closed
wants to merge 141 commits into from
Closed
Changes from 5 commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
5c61a54
GAD-5: Fix responsiveness (#1125)
Lawful2002 Feb 23, 2023
9a4fc4d
Merge branch 'main' into gad-5
akshatnema Mar 15, 2023
b295d7f
Merge branch 'main' into gad-5
akshatnema Mar 15, 2023
72e34e7
Merge branch 'main' into gad-5
akshatnema Mar 18, 2023
721ee82
Merge branch 'main' into gad-5
akshatnema Mar 19, 2023
91ef4e9
Merge branch 'main' into gad-5
akshatnema Mar 23, 2023
da49572
Merge branch 'main' into gad-5
akshatnema Mar 26, 2023
c161ba4
setup
anujpatel03 Feb 13, 2024
c861c2c
chore:alloted_rooms and all_staff are added
aniruddha2002das Feb 15, 2024
34cefa3
doing
aniruddha2002das Feb 15, 2024
706176b
chor:HostelAllotment
stark-akshay3000 Feb 15, 2024
928e9ff
comment in import hostelstudentattendance in views
stark-akshay3000 Feb 16, 2024
8c48a4f
Chore:change in staff schedule
aniruddha2002das Feb 16, 2024
a175e81
chore:Hostelleave- caretaker and wardern can see all leave forms
stark-akshay3000 Feb 16, 2024
30de362
Merge pull request #2 from aniruddha2002das/hmweb-anni
anujpatel03 Feb 16, 2024
4d191c9
chore:post request delete from StaffScheduleView class
aniruddha2002das Feb 16, 2024
f7f2608
chore:Hostelleave- student can apply for hostel leave
stark-akshay3000 Feb 16, 2024
3c8cd67
adding functionality of super admin
anujpatel03 Feb 16, 2024
68eb614
chore:all_stuff changed
aniruddha2002das Feb 16, 2024
dbb0389
functionality assigned batch
Iamankit45 Feb 16, 2024
8f55472
Chore:CURD API in hostel_management_hostelinventory
aniruddha2002das Feb 16, 2024
9a32c21
added functionality of assigning caretaker
Iamankit45 Feb 16, 2024
2a3802d
chore:hostel_complaint_implemented
stark-akshay3000 Feb 17, 2024
d2f6f6b
chore:inventory_form change
aniruddha2002das Feb 17, 2024
c97c383
added frontend of alloted_room and linked with backend
anujpatel03 Feb 17, 2024
8dcf6ad
Merge branch 'hmweb-main' into hmweb3
anujpatel03 Feb 17, 2024
4a5695e
Merge pull request #3 from Iamankit45/hmweb3
anujpatel03 Feb 17, 2024
fcf2912
Merge remote-tracking branch 'origin/hmweb-main' into hmweb-main
anujpatel03 Feb 17, 2024
035e559
chore: hostel_complaint and hostel_leave implemented
stark-akshay3000 Feb 17, 2024
bc3dbe0
feat:hall_inventory form submmit,edit,delete
aniruddha2002das Feb 17, 2024
89111f8
Merging migration of database
anujpatel03 Feb 17, 2024
eea2625
Merge branch 'hmweb-main' into fusionv7
anujpatel03 Feb 17, 2024
76ae93a
Merge pull request #4 from stark-akshay3000/fusionv7
anujpatel03 Feb 17, 2024
0a6fb32
added assign-warden , add-hostel ,delete-hostel in frontend and backend
Iamankit45 Feb 17, 2024
07a8708
Merge remote-tracking branch 'origin/hmweb3' into hmweb3
Iamankit45 Feb 17, 2024
96068ce
akshay PR merge
anujpatel03 Feb 17, 2024
1d4ec36
Merge branch 'hmweb-main' into hmweb3
anujpatel03 Feb 17, 2024
388ea35
chore:hall id set
aniruddha2002das Feb 17, 2024
fc532be
Merge pull request #6 from Iamankit45/hmweb3
anujpatel03 Feb 17, 2024
31e264c
Final merge of akshay,ankit,anuj
anujpatel03 Feb 18, 2024
4b76c61
Merge branch 'main' into hmweb-main
anujpatel03 Feb 18, 2024
0f97dbc
uncommented functionality of hostel_complaint_list/
anujpatel03 Feb 18, 2024
578ff2e
fix:hall select problem fixed
aniruddha2002das Feb 18, 2024
0a5b2b9
fix:dropdownlist change when hall.id change in URL
aniruddha2002das Feb 18, 2024
a99d39e
Added frontend of all_leave_data,alloted_rooms_main,create_leave,comp…
anujpatel03 Feb 18, 2024
fb68faa
chore: login required
stark-akshay3000 Feb 18, 2024
d7c8c39
chore: login required implemented
stark-akshay3000 Feb 18, 2024
b2d5c4f
feat:authentication added
aniruddha2002das Feb 18, 2024
f8b27ad
feat: authentication added in hostel leave and hostel complaint syste…
stark-akshay3000 Feb 18, 2024
45c174e
Merge branch 'hmweb-main' into hmweb-anni11
anujpatel03 Feb 18, 2024
491e752
Merge pull request #7 from aniruddha2002das/hmweb-anni11
anujpatel03 Feb 18, 2024
a88e436
Merge branch 'hmweb-main' into fusionv9
anujpatel03 Feb 18, 2024
4d9175f
Merge pull request #8 from stark-akshay3000/fusionv9
anujpatel03 Feb 18, 2024
b27f381
Added frontend with templates of all_leave_data,alloted_rooms_main,cr…
anujpatel03 Feb 18, 2024
0ce5105
Merge remote-tracking branch 'origin/hmweb-main' into hmweb-main
anujpatel03 Feb 18, 2024
bc2f035
book guestroom
Iamankit45 Feb 18, 2024
27a45cf
chore: run python manage.py copy_data to merge table to get all stude…
stark-akshay3000 Feb 18, 2024
645b2d8
chore: Added functionality - caretaker and warden can get all details…
stark-akshay3000 Feb 18, 2024
2c38d19
guest room part done
Iamankit45 Feb 19, 2024
2d8bdca
Merge branch 'hmweb-main' into fusionv10
anujpatel03 Feb 19, 2024
8d2c57a
Merge pull request #9 from stark-akshay3000/fusionv10
anujpatel03 Feb 19, 2024
50107df
added templates for hostel_complaint,inventory_form,my_leaves
anujpatel03 Feb 19, 2024
f816426
Merge remote-tracking branch 'origin/hmweb-main' into hmweb-main
anujpatel03 Feb 19, 2024
abac924
added full student details table
anujpatel03 Feb 19, 2024
a8fe99b
Added api endpoints for notifications
kishankoushal Feb 19, 2024
b59514d
fix:input fields of complaint and leave form
stark-akshay3000 Feb 19, 2024
aef9fa4
added funtionality of hostel super admin , guest room
Iamankit45 Feb 19, 2024
55622c1
feat:caretaker manage fine impose
aniruddha2002das Feb 19, 2024
8bea54d
Merge branch 'hmweb-main' into superAdminEdit
anujpatel03 Feb 19, 2024
477a15b
Merge pull request #10 from Iamankit45/superAdminEdit
anujpatel03 Feb 19, 2024
7c95abc
Merge pull request #11 from anujpatel03/hmweb-main
anujpatel03 Feb 19, 2024
1e91f0a
migration files of DB
anujpatel03 Feb 19, 2024
a1ebc28
resolved error in sending notification for announcements
kishankoushal Feb 20, 2024
d444f16
chore:student fine show
aniruddha2002das Feb 20, 2024
46fb446
pulled and merged updates from main
aniruddha2002das Feb 20, 2024
edb2661
fix:student details
stark-akshay3000 Feb 20, 2024
8aa91d0
updated html files with template
anujpatel03 Feb 20, 2024
d09daed
Merge pull request #13 from aniruddha2002das/hmweb-anni-fine3
anujpatel03 Feb 20, 2024
084dea2
Merge branch 'hmweb-main' into infield
anujpatel03 Feb 20, 2024
e87da90
Merge pull request #14 from stark-akshay3000/infield
anujpatel03 Feb 20, 2024
702c197
updated alerts.html and alert1.html for implementing delete notification
kishankoushal Feb 20, 2024
125a72d
merged origin/hmweb-main
anujpatel03 Feb 20, 2024
4e85898
chore:fine frontend design
aniruddha2002das Feb 20, 2024
13672d2
fix:List name change
aniruddha2002das Feb 20, 2024
7527683
Merge pull request #15 from aniruddha2002das/hmweb-anni-fine3
anujpatel03 Feb 20, 2024
651681c
updated frontend using templates
anujpatel03 Feb 20, 2024
bf4ee94
Merge remote-tracking branch 'origin/hmweb-main' into hmweb-main
anujpatel03 Feb 20, 2024
90c64fb
fixed few bugs and few glitches.
anujpatel03 Feb 20, 2024
d814c2b
Merge pull request #16 from anujpatel03/hmweb-main
anujpatel03 Feb 20, 2024
c1359b7
Added pylint (#1302)
hardiksharma11 Mar 11, 2024
ed210c1
Revert "Added pylint (#1302)" (#1324)
ChaudharyRaman Mar 11, 2024
47af12c
GAD -5 Dashboard Changes (#1325)
BlackHAWK2001 Mar 11, 2024
ed642ee
dashboard and usercard updated (#1329)
Arpittak Mar 12, 2024
fdd459f
minor changes
aniruddha2002das Mar 12, 2024
916762a
Merge remote-tracking branch 'origin/main' into hmweb-anni-fine3
aniruddha2002das Mar 12, 2024
3c387cc
removed HostelAllotment class
anujpatel03 Mar 12, 2024
36e85f0
Merge pull request #17 from anujpatel03/hmweb-main
anujpatel03 Mar 12, 2024
2909377
chore:Student fine show
aniruddha2002das Mar 12, 2024
7ef94e3
chore:date disable feature added
aniruddha2002das Mar 12, 2024
f231582
fix:notification message for room booking request is changed
aniruddha2002das Mar 12, 2024
5d9be12
added dropdown in sidebar
anujpatel03 Mar 12, 2024
6de59f0
changes in programme_cuuriculam,adding version to models (#1330)
anudeeps0306 Mar 12, 2024
502a741
added hostelTransactions
Iamankit45 Mar 13, 2024
e682530
Seater type added and vacant seats added
Iamankit45 Mar 13, 2024
0d93b64
added seater,vacant,logs
Iamankit45 Mar 13, 2024
bdd582e
fix: calender,fine
aniruddha2002das Mar 13, 2024
6e550c5
Merge branch 'hmweb-main' into hostelSeater
anujpatel03 Mar 13, 2024
70c7222
Merge pull request #18 from Iamankit45/hostelSeater
anujpatel03 Mar 13, 2024
870fad3
Merge branch 'hmweb-main' into hmweb-anni-fine3
anujpatel03 Mar 13, 2024
cb4da74
Merge pull request #19 from aniruddha2002das/hmweb-anni-fine3
anujpatel03 Mar 13, 2024
09f2509
only vacant room show in guestroom
Iamankit45 Mar 13, 2024
99d14e3
Merge pull request #20 from anujpatel03/hmweb-main
anujpatel03 Mar 13, 2024
2f20fba
Merge remote-tracking branch 'origin/hostelSeater' into hostelSeater
Iamankit45 Mar 13, 2024
9cf9508
Merge pull request #21 from Iamankit45/hostelSeater
anujpatel03 Mar 13, 2024
1feab6e
added Hostel history functionality
Iamankit45 Mar 15, 2024
136bba8
Merge pull request #22 from Iamankit45/hallHistory
anujpatel03 Mar 15, 2024
db68e50
fix:UI of tables
anujpatel03 Mar 15, 2024
df43fe8
Merge remote-tracking branch 'origin/hmweb-main' into hmweb-main
anujpatel03 Mar 15, 2024
13d6395
fix:UI of tables
anujpatel03 Mar 15, 2024
9f66170
migration
aniruddha2002das Mar 15, 2024
8d434a1
Merge remote-tracking branch 'upstream/hmweb-main' into hmweb-leave
aniruddha2002das Mar 15, 2024
0a8bbb0
Merge remote-tracking branch 'remoteK/main' into notificationsPull
Iamankit45 Mar 15, 2024
85f74aa
Merge pull request #23 from anujpatel03/hmweb-main
anujpatel03 Mar 15, 2024
a765e45
Merge branch 'anujpatel03:main' into hmweb-leave
aniruddha2002das Mar 15, 2024
a9853ca
added remark field in leave
aniruddha2002das Mar 15, 2024
3ee3c58
Merge remote-tracking branch 'origin/hmweb-leave' into hmweb-leave
aniruddha2002das Mar 15, 2024
62fb346
fix:hostelTransaction
aniruddha2002das Mar 15, 2024
a2633e7
fix
aniruddha2002das Mar 15, 2024
5d8f810
fix:In leave request remark option is added
aniruddha2002das Mar 15, 2024
31c07be
Merge pull request #24 from aniruddha2002das/hmweb-leave
anujpatel03 Mar 15, 2024
1c9a221
added notification functionality
Iamankit45 Mar 16, 2024
2925a9e
Merge branch 'hmweb-main' into dashboardMerge
anujpatel03 Mar 16, 2024
5516b6f
Merge pull request #25 from Iamankit45/dashboardMerge
anujpatel03 Mar 16, 2024
5678579
Merge pull request #26 from anujpatel03/hmweb-main
anujpatel03 Mar 16, 2024
d40e94d
Fixing ui bugs (#1335)
SukulSarve Mar 17, 2024
1afa0de
Merge remote-tracking branch 'fusion/gad-5' into dashboardMerge
Iamankit45 Mar 18, 2024
69d3357
Synced with new Dashboard
Iamankit45 Mar 18, 2024
4c14426
Merge remote-tracking branch 'origin/dashboardMerge' into dashboardMerge
Iamankit45 Mar 18, 2024
a5eeacd
Merge pull request #27 from Iamankit45/dashboardMerge
anujpatel03 Mar 18, 2024
d5288a3
Merge pull request #28 from anujpatel03/hmweb-main
anujpatel03 Mar 18, 2024
1f5fa00
Merge branch 'FusionIIIT:main' into main
anujpatel03 Mar 18, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.5 on 2024-02-18 13:33

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('globals', '0004_auto_20240217_0054'),
]

operations = [
migrations.AlterField(
model_name='extrainfo',
name='user_status',
field=models.CharField(choices=[('PRESENT', 'PRESENT'), ('NEW', 'NEW')], default='PRESENT', max_length=50),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.5 on 2024-02-18 13:36

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('globals', '0005_auto_20240218_1333'),
]

operations = [
migrations.AlterField(
model_name='extrainfo',
name='user_status',
field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.5 on 2024-02-18 13:33

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('hostel_management', '0004_hostelcomplaint'),
]

operations = [
migrations.AddField(
model_name='hostelcomplaint',
name='status',
field=models.CharField(default='pending', max_length=20),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.1.5 on 2024-02-18 13:36

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('hostel_management', '0005_hostelcomplaint_status'),
]

operations = [
migrations.RemoveField(
model_name='hostelcomplaint',
name='status',
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.5 on 2024-02-18 13:42

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('hostel_management', '0006_remove_hostelcomplaint_status'),
]

operations = [
migrations.AddField(
model_name='hostelleave',
name='status',
field=models.CharField(default='pending', max_length=20),
),
]
2 changes: 2 additions & 0 deletions FusionIIIT/applications/hostel_management/models.py
Original file line number Diff line number Diff line change
@@ -271,6 +271,8 @@ class HostelLeave(models.Model):
reason = models.TextField()
start_date = models.DateField(default=timezone.now)
end_date = models.DateField()
status = models.CharField(max_length=20, default='pending')


def __str__(self):
return f"{self.student_name}'s Leave"
13 changes: 7 additions & 6 deletions FusionIIIT/applications/hostel_management/urls.py
Original file line number Diff line number Diff line change
@@ -43,18 +43,19 @@
path('hostel-notices/', views.hostel_notice_board, name='hostel_notices_board'),
# //caretaker and warden can see all leaves
path('all_leave_data/', views.all_leave_data, name='all_leave_data'),
# caretaker or wardern can approve leave
path('update_leave_status/', views.update_leave_status, name='update_leave_status'),
# //apply for leave
path('create_hostel_leave/', views.create_hostel_leave.as_view(), name='create_hostel_leave'),
path('create_hostel_leave/', views.create_hostel_leave, name='create_hostel_leave'),

# caretaker and warden can get all complaints
path('hostel_complaints/', views.hostel_complaint_list, name='hostel_complaint_list'),
# only user can see its complaints
path('user_complaints/<str:roll_number>/', views.UserComplaints.as_view(), name='user_complaints'),
# //register complaint

path('register_complaint/', views.PostComplaint.as_view(), name='PostComplaint'),

# //////////////////////
# Student can view his leave status
path('my_leaves/', views.my_leaves.as_view(), name='my_leaves'),

path('hostel_complaint_list/', views.hostel_complaint_list, name='hostel_complaint_list'),



124 changes: 87 additions & 37 deletions FusionIIIT/applications/hostel_management/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.shortcuts import render, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from rest_framework.permissions import IsAuthenticated
from django.urls import reverse
from django.shortcuts import render, redirect

from .models import HostelLeave
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from django.utils.decorators import method_decorator
@@ -513,22 +518,32 @@ def hostel_notice_board(request):



from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from .models import HostelLeave, HallCaretaker

@login_required
def all_leave_data(request):
all_leave = HostelLeave.objects.all()
return render(request, 'hostelmanagement/all_leave_data.html', {'all_leave': all_leave})
user_id = request.user.id # Using request.user to get the user ID
try:
staff = request.user.extrainfo.id # Assuming the user's profile is stored in extrainfo
except AttributeError:
staff = None

if staff is not None and HallCaretaker.objects.filter(staff_id=staff).exists():
all_leave = HostelLeave.objects.all()
return render(request, 'hostelmanagement/all_leave_data.html', {'all_leave': all_leave})
else:
return HttpResponse('<script>alert("You are not authorized to access this page"); window.location.href = "/hostelmanagement/"</script>')


class create_hostel_leave(APIView):
authentication_classes = [] # Allow public access for testing
permission_classes = [] # Allow any user to access the view

def get(self, request):
@login_required
def create_hostel_leave(request):
if request.method == 'GET':
return render(request, 'hostelmanagement/create_leave.html')

def post(self, request):

data = request.data
elif request.method == 'POST':
data = request.POST # Assuming you are sending form data via POST request
student_name = data.get('student_name')
roll_num = data.get('roll_num')
reason = data.get('reason')
@@ -546,20 +561,37 @@ def post(self, request):

return JsonResponse({'message': 'HostelLeave created successfully'}, status=status.HTTP_201_CREATED)

def create_leave(request):
return render(request, 'hostelmanagement/create_leave.html')

# hostel complaints

# hostel_complaints_list caretaker can see all hostel complaints

@login_required
def hostel_complaint_list(request):
complaints = HostelComplaint.objects.all()
return render(request, 'hostelmanagement/hostel_complaint.html', {'complaints': complaints})
user_id = request.user.id
try:
staff = request.user.extrainfo.id # Assuming the user's profile is stored in extrainfo
except AttributeError:
staff = None

if staff is not None and HallCaretaker.objects.filter(staff_id=staff).exists():
complaints = HostelComplaint.objects.all()
return render(request, 'hostelmanagement/hostel_complaint.html', {'complaints': complaints})
else:
return HttpResponse('<script>alert("You are not authorized to access this page"); window.location.href = "/hostelmanagement/"</script>')





# Student can post complaints

class PostComplaint(APIView):
authentication_classes = [] # Allow public access for testing
permission_classes = [] # Allow any user to access the view
authentication_classes = [SessionAuthentication] # Assuming you are using session authentication
permission_classes = [IsAuthenticated] # Allow only authenticated users to access the view

def dispatch(self, request, *args, **kwargs):
if not request.user.is_authenticated:
return redirect('/hostelmanagement') # Redirect to the login page if user is not authenticated
return super().dispatch(request, *args, **kwargs)

def get(self, request):
return render(request, 'hostelmanagement/post_complaint_form.html')
@@ -571,6 +603,9 @@ def post(self, request):
description = request.data.get('description')
contact_number = request.data.get('contact_number')

# Assuming the student's name is stored in the user object
student_name = request.user.username

complaint = HostelComplaint.objects.create(
hall_name=hall_name,
student_name=student_name,
@@ -583,31 +618,31 @@ def post(self, request):
return HttpResponse('<script>alert("Complaint submitted successfully"); window.location.href = "/hostelmanagement";</script>')


# userComplaint user can see complaints registered by him



class UserComplaints(APIView):
authentication_classes = [] # Allow public access for testing
permission_classes = [] # Allow any user to access the view

def get(self, request, roll_number):
# Filter complaints by the roll number, case-insensitive
user_complaints = HostelComplaint.objects.filter(Q(roll_number__iexact=roll_number))

# Render a template displaying the user's complaints
return render(request, 'hostelmanagement/user_complaints.html', {'complaints': user_complaints})

# // student can see his leave status

# /// login required
class my_leaves(View):
@method_decorator(login_required, name='dispatch')
def get(self, request, *args, **kwargs):
try:
# Get the user ID from the request's user
user_id = str(request.user)

# Retrieve leaves registered by the current student based on their roll number
my_leaves = HostelLeave.objects.filter(roll_num__iexact=user_id)

# Construct the context to pass to the template
context = {
'leaves': my_leaves
}

# @login_required
# def hostel_complaint_list(request):
# complaints = HostelComplaint.objects.all()
# return render(request, 'hostelmanagement/hostel_complaint.html', {'complaints': complaints})
# Render the template with the context data
return render(request, 'hostelmanagement/my_leaves.html', context)

except User.DoesNotExist:
# Handle the case where the user with the given ID doesn't exist
return HttpResponse(f"User with ID {user_id} does not exist.")


# @login_required
# def hostel_complaint_list(request):
@@ -1296,3 +1331,18 @@ def update_allotment(request, pk):
return JsonResponse({'error': 'Invalid request method'}, status=405)


# //Caretaker can approve or reject leave applied by the student
@csrf_exempt
def update_leave_status(request):
if request.method == 'POST':
leave_id = request.POST.get('leave_id')
status = request.POST.get('status')
try:
leave = HostelLeave.objects.get(id=leave_id)
leave.status = status
leave.save()
return JsonResponse({'status': status, 'message': 'Leave status updated successfully.'})
except HostelLeave.DoesNotExist:
return JsonResponse({'status': 'error', 'message': 'Leave not found.'}, status=404)
else:
return JsonResponse({'status': 'error', 'message': 'Only POST requests are allowed.'}, status=405)
Loading