diff --git a/FusionIIIT/Fusion/settings/common.py b/FusionIIIT/Fusion/settings/common.py index b98ea6960..67e7a8de1 100644 --- a/FusionIIIT/Fusion/settings/common.py +++ b/FusionIIIT/Fusion/settings/common.py @@ -125,6 +125,7 @@ 'applications.health_center', 'applications.online_cms', 'applications.ps1', + 'applications.ps2', 'applications.programme_curriculum', 'applications.placement_cell', 'applications.recruitment', @@ -170,7 +171,7 @@ TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(BASE_DIR, '..', 'templates/'),], + 'DIRS': [os.path.join(BASE_DIR, '..', 'templates'),], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -254,9 +255,13 @@ # os.path.join(BASE_DIR, 'static/') STATIC_URL = '/static/' -STATIC_ROOT = os.path.join(BASE_DIR, '..', 'static/') +STATIC_ROOT = os.path.join(BASE_DIR, '..', 'static') STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' -MEDIA_ROOT = os.path.join(BASE_DIR, '..', 'media/') +STATICFILES_DIRS = ( + os.path.join(BASE_DIR, "static"), +) + +MEDIA_ROOT = os.path.join(BASE_DIR, '..', 'media') MEDIA_URL = '/media/' ACCOUNT_USERNAME_REQUIRED = False diff --git a/FusionIIIT/Fusion/settings/development.py b/FusionIIIT/Fusion/settings/development.py index 6acc214c1..7ebfc2204 100644 --- a/FusionIIIT/Fusion/settings/development.py +++ b/FusionIIIT/Fusion/settings/development.py @@ -52,4 +52,4 @@ DEBUG_TOOLBAR_CONFIG = { 'INTERCEPT_REDIRECTS': False, - } + } \ No newline at end of file diff --git a/FusionIIIT/Fusion/urls.py b/FusionIIIT/Fusion/urls.py index 837bf776a..6e4c4033d 100755 --- a/FusionIIIT/Fusion/urls.py +++ b/FusionIIIT/Fusion/urls.py @@ -22,8 +22,11 @@ from django.contrib import admin from django.contrib.auth import views as auth_views +from rest_framework.authtoken.views import obtain_auth_token + urlpatterns = [ + url(r'^api-token-auth/', obtain_auth_token, name='api_token_auth'), url(r'^', include('applications.globals.urls')), url(r'^feeds/', include('applications.feeds.urls')), url(r'^admin/', admin.site.urls), @@ -51,6 +54,7 @@ url(r'^office/', include('applications.office_module.urls')), url(r'^finance/', include('applications.finance_accounts.urls')), url(r'^purchase-and-store/', include('applications.ps1.urls')), + url(r'^purchase-and-store2/', include('applications.ps2.urls')), url(r'^gymkhana/', include('applications.gymkhana.urls')), url(r'^library/', include('applications.library.urls')), url(r'^establishment/', include('applications.establishment.urls')), diff --git a/FusionIIIT/applications/academic_information/migrations/0002_student_hall_id.py b/FusionIIIT/applications/academic_information/migrations/0002_student_hall_id.py new file mode 100644 index 000000000..c8ff2689e --- /dev/null +++ b/FusionIIIT/applications/academic_information/migrations/0002_student_hall_id.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2023-04-04 11:39 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('academic_information', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='student', + name='hall_id', + field=models.CharField(blank=True, choices=[('saraswati', 'saraswati'), ('vivekananda', 'vivekananda'), ('aryabhatta', 'aryabhatta'), ('vashishtha', 'vashishtha')], max_length=255, null=True), + ), + ] diff --git a/FusionIIIT/applications/academic_information/migrations/0003_auto_20230406_1845.py b/FusionIIIT/applications/academic_information/migrations/0003_auto_20230406_1845.py new file mode 100644 index 000000000..9c0c7206e --- /dev/null +++ b/FusionIIIT/applications/academic_information/migrations/0003_auto_20230406_1845.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.5 on 2023-04-06 18:45 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('academic_information', '0002_student_hall_id'), + ] + + operations = [ + migrations.AddField( + model_name='calendar', + name='end_time', + field=models.TimeField(default='20:00'), + ), + migrations.AddField( + model_name='calendar', + name='start_time', + field=models.TimeField(default='20:00'), + ), + ] diff --git a/FusionIIIT/applications/academic_information/models.py b/FusionIIIT/applications/academic_information/models.py index ea1178878..ca8a4ec6c 100755 --- a/FusionIIIT/applications/academic_information/models.py +++ b/FusionIIIT/applications/academic_information/models.py @@ -64,6 +64,12 @@ class Constants: ('Management Science', 'Management Science'), ) + HALL_NAMES = ( + ('saraswati', 'saraswati'), + ('vivekananda', 'vivekananda'), + ('aryabhatta', 'aryabhatta'), + ('vashishtha', 'vashishtha'), + ) class Student(models.Model): ''' @@ -96,6 +102,7 @@ class Student(models.Model): father_name = models.CharField(max_length=40, default='') mother_name = models.CharField(max_length=40, default='') hall_no = models.IntegerField(default=0) + hall_id = models.CharField(max_length=255,null=True,blank=True, choices=Constants.HALL_NAMES) room_no = models.CharField(max_length=10, blank=True, null=True) specialization = models.CharField(max_length=40,choices=Constants.MTechSpecialization, null=True, default='') curr_semester_no = models.IntegerField(default=1) @@ -274,6 +281,8 @@ class Calendar(models.Model): ''' from_date = models.DateField() to_date = models.DateField() + start_time = models.TimeField(default='20:00') + end_time = models.TimeField(default='20:00') description = models.CharField(max_length=40) class Meta: diff --git a/FusionIIIT/applications/academic_information/views.py b/FusionIIIT/applications/academic_information/views.py index 22210a52e..e32a401b7 100755 --- a/FusionIIIT/applications/academic_information/views.py +++ b/FusionIIIT/applications/academic_information/views.py @@ -30,7 +30,8 @@ from applications.academic_procedures.views import acad_proced_global_context from applications.programme_curriculum.models import Batch - +from django.conf import settings +from django.core.files.storage import FileSystemStorage @login_required @@ -613,7 +614,11 @@ def add_timetable(request): acadTtForm = AcademicTimetableForm() if request.method == 'POST' and request.FILES: acadTtForm = AcademicTimetableForm(request.POST, request.FILES) - if acadTtForm.is_valid(): + file = request.FILES['time_table'] + full_path2 = settings.BASE_DIR+'\\..'+'\\applications'+'\\globals'+settings.STATIC_URL+'academic_procedures' + fs = FileSystemStorage(location=full_path2) + if acadTtForm.is_valid(): + fs.save(file.name, file) acadTtForm.save() return render(request, "ais/ais.html", context) else: @@ -725,21 +730,35 @@ def add_calendar(request): from_date = request.POST.getlist('from_date') to_date = request.POST.getlist('to_date') desc = request.POST.getlist('description')[0] + start = request.POST.getlist('start') + end = request.POST.getlist('end') from_date = from_date[0].split('-') from_date = [int(i) for i in from_date] from_date = datetime.datetime(*from_date).date() to_date = to_date[0].split('-') to_date = [int(i) for i in to_date] to_date = datetime.datetime(*to_date).date() + if start[0]: + start = start[0]+':00' + else: + start = '00:00:00' + if end[0]: + end = end[0]+':00' + else: + end = '00:00:00' except Exception as e: from_date="" to_date="" desc="" + start = '00:00:00' + end = '00:00:00' pass c = Calendar( from_date=from_date, to_date=to_date, - description=desc) + description=desc, + start_time=start, + end_time=end) c.save() HttpResponse("Calendar Added") @@ -774,6 +793,8 @@ def update_calendar(request): try: from_date = request.POST.getlist('from_date') to_date = request.POST.getlist('to_date') + start = request.POST.getlist('start') + end = request.POST.getlist('end') desc = request.POST.getlist('description')[0] prev_desc = request.POST.getlist('prev_desc')[0] from_date = from_date[0].split('-') @@ -782,15 +803,27 @@ def update_calendar(request): to_date = to_date[0].split('-') to_date = [int(i) for i in to_date] to_date = datetime.datetime(*to_date).date() + if start[0]: + start = start[0]+':00' + else: + start = '00:00:00' + if end[0]: + end = end[0]+':00' + else: + end = '00:00:00' get_calendar_details = Calendar.objects.all().filter(description=prev_desc).first() get_calendar_details.description = desc get_calendar_details.from_date = from_date get_calendar_details.to_date = to_date + get_calendar_details.start_time = start + get_calendar_details.end_time = end get_calendar_details.save() except Exception as e: from_date="" to_date="" desc="" + start = "00:00:00" + end = "00:00:00" return render(request, "ais/ais.html", context) return render(request, "ais/ais.html", context) @@ -1169,9 +1202,9 @@ def add_new_profile (request): } if request.method == 'POST' and request.FILES: profiles=request.FILES['profiles'] - excel = xlrd.open_workbook(file_contents=profiles.read()) + excel = xlrd.open_workbook(profiles.name,file_contents=profiles.read()) sheet=excel.sheet_by_index(0) - for i in range(sheet.nrows): + for i in range(1,sheet.nrows): roll_no=sheet.cell(i,0).value first_name=str(sheet.cell(i,1).value) last_name=str(sheet.cell(i,2).value) @@ -1191,7 +1224,7 @@ def add_new_profile (request): category="" phone_no=0 address="" - dept=str(sheet.cell(i,12).value) + dept=str(sheet.cell(i,11).value) specialization=str(sheet.cell(i,12).value) hall_no=None @@ -1209,7 +1242,6 @@ def add_new_profile (request): batch_year=request.POST['Batch'] batch = Batch.objects.all().filter(name = programme_name, discipline__acronym = dept, year = batch_year).first() - user = User.objects.create_user( username=roll_no, password='hello123', @@ -1217,6 +1249,7 @@ def add_new_profile (request): last_name=last_name, email=email, ) + einfo = ExtraInfo.objects.create( id=roll_no, @@ -1253,6 +1286,11 @@ def add_new_profile (request): working=user, designation=desig, ) + + user.save() + einfo.save() + stud_data.save() + hold_des.save() sem_id = Semester.objects.get(curriculum = batch.curriculum, semester_no = sem) course_slots = CourseSlot.objects.all().filter(semester = sem_id) diff --git a/FusionIIIT/applications/academic_procedures/api/views.py b/FusionIIIT/applications/academic_procedures/api/views.py index aab6deaa7..dc83ba59d 100644 --- a/FusionIIIT/applications/academic_procedures/api/views.py +++ b/FusionIIIT/applications/academic_procedures/api/views.py @@ -196,7 +196,7 @@ def academic_procedures_student(request): current_sem_branch_courses = get_branch_courses(current_user, user_sem, user_branch) - pre_registration_date_flag = get_pre_registration_eligibility(current_date) + pre_registration_date_flag = get_pre_registration_eligibility(current_date, user_sem, acad_year) final_registration_date_flag = get_final_registration_eligibility(current_date) add_or_drop_course_date_flag = get_add_or_drop_course_date_eligibility(current_date) diff --git a/FusionIIIT/applications/academic_procedures/views.py b/FusionIIIT/applications/academic_procedures/views.py index 7e55e3e45..e59b5ccee 100644 --- a/FusionIIIT/applications/academic_procedures/views.py +++ b/FusionIIIT/applications/academic_procedures/views.py @@ -38,6 +38,7 @@ from notification.views import academics_module_notif from .forms import BranchChangeForm from django.db.models.functions import Concat,ExtractYear,ExtractMonth,ExtractDay,Cast +from datetime import datetime @@ -297,9 +298,8 @@ def academic_procedures_student(request): curr_sem_id = Semester.objects.get(curriculum = curr_id, semester_no = obj.curr_semester_no) try: - semester_no = obj.curr_semester_no+1 - next_sem_id = Semester.objects.get(curriculum = curr_id, semester_no = semester_no) - user_sem = semester_no + user_sem = get_user_semester(request.user, ug_flag, masters_flag, phd_flag) + next_sem_id = Semester.objects.get(curriculum = curr_id, semester_no = user_sem+1) except Exception as e: user_sem = get_user_semester(request.user, ug_flag, masters_flag, phd_flag) @@ -315,8 +315,10 @@ def academic_procedures_student(request): branchchange_flag=False if user_sem==2 and des_flag==False and ug_flag==True: branchchange_flag=True - - pre_registration_date_flag, prd_start_date= get_pre_registration_eligibility(current_date, user_sem, year) + + now = datetime.now() + current_time = datetime(now.year, now.month, now.day, now.hour, now.minute, now.second) + pre_registration_date_flag, prd_start_date= get_pre_registration_eligibility(current_date, current_time.time(),user_sem, year) final_registration_date_flag = get_final_registration_eligibility(current_date) add_or_drop_course_date_flag = get_add_or_drop_course_date_eligibility(current_date) pre_registration_flag = False @@ -338,7 +340,7 @@ def academic_procedures_student(request): current_sem_branch_course = get_sem_courses(curr_sem_id, batch) next_sem_registration_courses = get_sem_courses(next_sem_id, batch) final_registration_choice, unavailable_courses_nextsem = get_final_registration_choices(next_sem_registration_courses,batch.year) - currently_registered_course = get_currently_registered_course(obj,obj.curr_semester_no) + currently_registered_course = get_currently_registered_course(obj,user_sem) current_credits = get_current_credits(currently_registered_course) @@ -470,6 +472,7 @@ def academic_procedures_student(request): return render( request, '../templates/academic_procedures/academic.html', {'details': details, + 'user_sem': user_sem, # 'calendar': calendar, 'currently_registered': currently_registered_course, 'pre_registered_course' : pre_registered_courses, @@ -1220,7 +1223,7 @@ def phd_details(request): def get_student_register(id): return Register.objects.all().select_related('curr_id','student_id','curr_id__course_id','student_id__id','student_id__id__user','student_id__id__department').filter(student_id = id) -def get_pre_registration_eligibility(current_date, user_sem, year): +def get_pre_registration_eligibility(current_date, current_time, user_sem, year): ''' This function is used to extract the elgibility of pre-registration for a given semester for a given year from the Calendar table. @@ -1242,13 +1245,23 @@ def get_pre_registration_eligibility(current_date, user_sem, year): ''' try: # pre_registration_date = Calendar.objects.all().filter(description="Pre Registration").first() - pre_registration_date = Calendar.objects.all().filter(description=f"Pre Registration {user_sem} {year}").first() + pre_registration_date = Calendar.objects.all().filter(description=f"Pre Registration {user_sem+1} {year}").first() + if pre_registration_date==None: + pre_registration_date = Calendar.objects.all().filter(description="Pre Registration").first() prd_start_date = pre_registration_date.from_date prd_end_date = pre_registration_date.to_date - if current_date>=prd_start_date and current_date<=prd_end_date: - return True, None - if current_date=prd_start_time: + return True, None + elif current_date>prd_start_date and current_dateprd_end_date: + elif current_date>>>>",roll_no,course_slot_name,course_code,course_name) - final_registration=FinalRegistration(student_id=student,course_slot_id=course_slot, - course_id=course,semester_id=sem_id) + course = Courses.objects.get(code=course_code) + curriculum_id = Curriculum.objects.get(course_code=str(course_code)) + # final_registration=FinalRegistration(student_id=student,course_slot_id=course_slot_name, + # course_id=course,semester_id=sem_id) + final_registration=FinalRegistration(student_id=student,course_id=course,semester_id=sem_id) final_registrations.append(final_registration) + register = Register(curr_id = curriculum_id,year = year,student_id = student,semester = sem_no) + registrations.append(register) + semester_id = Semester.objects.get(semester_no=sem_no, curriculum=batch.curriculum) + id = course_registration.objects.aggregate(Max('id'))['id__max'] + course_register = course_registration(id=id+1,student_id = student,working_year=year,semester_id = semester_id,course_id = course) + course_registrations.append(course_register) + try: FinalRegistration.objects.bulk_create(final_registrations) + try: + Register.objects.bulk_create(registrations) + course_registration.objects.bulk_create(course_registrations) + + except: + print("Registered is already") messages.success(request, 'Successfully uploaded!') return HttpResponseRedirect('/academic-procedures/main') # return HttpResponse("Success") @@ -1789,7 +1818,11 @@ def get_user_semester(roll_no, ug_flag, masters_flag, phd_flag): def get_branch_courses(roll_no, user_sem, branch): roll = str(roll_no) - year = int(roll[:4]) + year = 2020 + if roll[:4].isnumeric(): + year = int(roll[:4]) + else: + year = int("20" + roll[:2]) courses = Curriculum.objects.all().select_related().filter(batch=(year)) courses = courses.filter(sem = user_sem) courses = courses.filter(floated = True) diff --git a/FusionIIIT/applications/central_mess/admin.py b/FusionIIIT/applications/central_mess/admin.py index cbb2fcb6c..0c3226a83 100755 --- a/FusionIIIT/applications/central_mess/admin.py +++ b/FusionIIIT/applications/central_mess/admin.py @@ -2,7 +2,7 @@ from .models import (Feedback, Menu, Menu_change_request, Mess_meeting, Mess_minutes, Mess_reg, Messinfo, Monthly_bill, - Nonveg_data, Nonveg_menu, Payments, Rebate, + Payments, Rebate, Special_request, Vacation_food,MessBillBase) # Register your models here. @@ -56,14 +56,14 @@ class Monthly_billAdmin(admin.ModelAdmin): ('month', {'fields': ['month']}), ('year', {'fields': ['year']}), ('amount', {'fields': ['amount']}), - ('nonveg_total_bill', {'fields': ['nonveg_total_bill']}), + # ('nonveg_total_bill', {'fields': ['nonveg_total_bill']}), ('rebate_count', {'fields': ['rebate_count']}), ('rebate_amount', {'fields': ['rebate_amount']}), ('total_bill', {'fields': ['total_bill']}), ] list_display = ('student_id', 'month', 'year', 'amount', - 'nonveg_total_bill', 'rebate_count', 'rebate_amount', 'total_bill') + 'rebate_count', 'rebate_amount', 'total_bill') @@ -71,11 +71,9 @@ class PaymentsAdmin(admin.ModelAdmin): model = Payments fieldsets = [ ('student_id', {'fields': ['student_id']}), - ('sem', {'fields': ['sem']}), - ('year', {'fields': ['year']}), ('amount_paid', {'fields': ['amount_paid']}), ] - list_display = ('student_id', 'sem', 'year', 'amount_paid') + list_display = ('student_id', 'amount_paid') class RebateAdmin(admin.ModelAdmin): @@ -106,26 +104,26 @@ class Vacation_foodAdmin(admin.ModelAdmin): -class Nonveg_menuAdmin(admin.ModelAdmin): - model = Nonveg_menu - fieldsets = [ - ('dish', {'fields': ['dish']}), - ('price', {'fields': ['price']}), - ('order_interval', {'fields': ['order_interval']}), - ] - list_display = ('dish', 'price', 'order_interval') +# class Nonveg_menuAdmin(admin.ModelAdmin): +# model = Nonveg_menu +# fieldsets = [ +# ('dish', {'fields': ['dish']}), +# ('price', {'fields': ['price']}), +# ('order_interval', {'fields': ['order_interval']}), +# ] +# list_display = ('dish', 'price', 'order_interval') -class Nonveg_dataAdmin(admin.ModelAdmin): - model = Nonveg_data - fieldsets = [ - ('student_id', {'fields': ['student_id']}), - ('order_date', {'fields': ['order_date']}), - ('dish', {'fields': ['dish']}), - ('order_interval', {'fields': ['order_interval']}), - ] - list_display = ('student_id', 'order_date', 'dish', 'order_interval') +# class Nonveg_dataAdmin(admin.ModelAdmin): +# model = Nonveg_data +# fieldsets = [ +# ('student_id', {'fields': ['student_id']}), +# ('order_date', {'fields': ['order_date']}), +# ('dish', {'fields': ['dish']}), +# ('order_interval', {'fields': ['order_interval']}), +# ] +# list_display = ('student_id', 'order_date', 'dish', 'order_interval') @@ -194,8 +192,8 @@ class MessBillBaseAdmin(admin.ModelAdmin): admin.site.register(Rebate, RebateAdmin), admin.site.register(Vacation_food, Vacation_foodAdmin), admin.site.register(Special_request, Special_requestAdmin), -admin.site.register(Nonveg_menu, Nonveg_menuAdmin), -admin.site.register(Nonveg_data, Nonveg_dataAdmin), +# admin.site.register(Nonveg_menu, Nonveg_menuAdmin), +# admin.site.register(Nonveg_data, Nonveg_dataAdmin), admin.site.register(Mess_meeting, Mess_meetingAdmin), admin.site.register(Feedback, FeedbackAdmin), admin.site.register(MessBillBase,MessBillBaseAdmin), diff --git a/FusionIIIT/applications/central_mess/api/serializers.py b/FusionIIIT/applications/central_mess/api/serializers.py new file mode 100644 index 000000000..37e581c6d --- /dev/null +++ b/FusionIIIT/applications/central_mess/api/serializers.py @@ -0,0 +1,80 @@ +from rest_framework import serializers +from applications.central_mess.models import * + +class MessinfoSerializer(serializers.ModelSerializer): + + class Meta: + model=Messinfo + fields=('__all__') + +class Mess_regSerializer(serializers.ModelSerializer): + class Meta: + model = Mess_reg + fields=('__all__') + +class MessBillBaseSerializer(serializers.ModelSerializer): + class Meta: + model = MessBillBase + fields=('__all__') + +class Monthly_billSerializer(serializers.ModelSerializer): + class Meta: + model=Monthly_bill + fields=('__all__') + +class PaymentsSerializer(serializers.ModelSerializer): + class Meta: + model=Payments + fields=('__all__') + +class MenuSerializer(serializers.ModelSerializer): + class Meta: + model=Menu + fields=('__all__') + +class RebateSerializer(serializers.ModelSerializer): + + class Meta: + model=Rebate + fields=('__all__') + +class Vacation_foodSerializer(serializers.ModelSerializer): + class Meta: + model = Vacation_food + fields=('__all__') + +# class Nonveg_menuSerializer(serializers.ModelSerializer): +# class Meta: +# model = Nonveg_menu +# fields=('__all__') + +# class Nonveg_dataSerializer(serializers.ModelSerializer): +# class Meta: +# model=Nonveg_data +# fields=('__all__') + +class Special_requestSerializer(serializers.ModelSerializer): + class Meta: + model=Special_request + fields=('__all__') + +class Mess_meetingSerializer(serializers.ModelSerializer): + class Meta: + model=Mess_meeting + fields=('__all__') + +class Mess_minutesSerializer(serializers.ModelSerializer): + class Meta: + model = Mess_minutes + fields=('__all__') + +class Menu_change_requestSerializer(serializers.ModelSerializer): + class Meta: + model = Menu_change_request + fields=('__all__') + +class FeedbackSerializer(serializers.ModelSerializer): + class Meta: + model=Feedback + fields=('__all__') + diff --git a/FusionIIIT/applications/central_mess/api/urls.py b/FusionIIIT/applications/central_mess/api/urls.py new file mode 100644 index 000000000..bc6252de7 --- /dev/null +++ b/FusionIIIT/applications/central_mess/api/urls.py @@ -0,0 +1,21 @@ +from django.conf.urls import url +from . import views +from .views import * + +urlpatterns = [ + url("feedbackApi", views.FeedbackApi.as_view(), name="feedbackApi"), + url("menuChangeRequestApi", views.Menu_change_requestApi.as_view(), name="menuChangeRequestApi"), + url("messMinutesApi", views.Mess_minutesApi.as_view(), name="messMinutesApi"), + url("nonvegDataApi", views.Nonveg_dataApi.as_view(), name="nonvegDataApi"), + url("specialRequestApi", views.Special_requestApi.as_view(), name="specialRequestApi"), + url("messMeetingApi", views.Mess_meetingApi.as_view(), name="messMeetingApi"), + url("nonvegMenuApi", views.Nonveg_menuApi.as_view(), name="nonvegMenuApi"), + url("vacationFoodApi", views.Vacation_foodApi.as_view(), name="vacationFoodApi"), + url("messInfoApi", views.MessinfoApi.as_view(), name="messInfoApi"), + url("rebateApi", views.RebateApi.as_view(), name="rebateApi"), + url("menuApi", views.MenuApi.as_view(), name="menuApi"), + url("paymentsApi", views.PaymentsApi.as_view(), name="paymentsApi"), + url("monthlyBillApi", views.Monthly_billApi.as_view(), name="monthlyBillApi"), + url("messBillBaseApi", views.MessBillBaseApi.as_view(), name="messBillBaseApi"), + url("messRegApi", views.Mess_regApi.as_view(), name="messRegApi"), +] \ No newline at end of file diff --git a/FusionIIIT/applications/central_mess/api/views.py b/FusionIIIT/applications/central_mess/api/views.py new file mode 100644 index 000000000..69c16fffb --- /dev/null +++ b/FusionIIIT/applications/central_mess/api/views.py @@ -0,0 +1,407 @@ + #APIs +from rest_framework.views import APIView +from rest_framework.response import Response +from .serializers import * +from django.shortcuts import get_object_or_404 +from applications.central_mess.models import * +from django.contrib.auth.models import User +from applications.globals.models import ExtraInfo, HoldsDesignation, Designation + + +class FeedbackApi(APIView): + + def get(self, request): + feedback_obj = Feedback.objects.all(); + serialized_obj = FeedbackSerializer(feedback_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + data = request.data + + mess = data['mess'] + _type = data['type'] + desc = data['desc'] + username = get_object_or_404(User,username=request.user.username) + idd = ExtraInfo.objects.get(user=username) + student = Student.objects.get(id=idd.id) + obj = Feedback( + student_id = student, + mess =mess, + feedback_type=_type, + description=desc + ) + obj.save() + return Response({'status':200}) + + +class MessinfoApi(APIView): + def get(self, request): + messinfo_obj = Messinfo.objects.all(); + serialized_obj = MessinfoSerializer(messinfo_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + data = request.data + + mess_option = data['mess_option'] + + username = get_object_or_404(User,username=request.user.username) + idd = ExtraInfo.objects.get(user=username) + student = Student.objects.get(id=idd.id) + obj = Messinfo( + student_id = student, + mess_option =mess_option, + ) + obj.save() + return Response({'status':200}) + +class Mess_regApi(APIView): + def get(self, request): + mess_reg_obj = Mess_reg.objects.all(); + serialized_obj = Mess_regSerializer(mess_reg_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + data = request.data + + sem = data['sem'] + start_reg = data['start_reg'] + end_reg= data['end_reg'] + + obj = Mess_reg( + sem = sem, + start_reg = start_reg, + end_reg = end_reg + ) + obj.save() + return Response({'status':200}) + +class MessBillBaseApi(APIView): + def get(self, request): + messBillBase_obj = MessBillBase.objects.all(); + serialized_obj = MessBillBaseSerializer(messBillBase_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + data = request.data + + bill_amount = data['bill_amount'] + # timestamp = data['timestamp'] + + obj = MessBillBase( + bill_amount = bill_amount, + # timestamp = timestamp, + ) + obj.save() + return Response({'status':200}) + +class Monthly_billApi(APIView): + def get(self, request): + monthly_bill_obj = Monthly_bill.objects.all(); + serialized_obj = Monthly_billSerializer(monthly_bill_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + data = request.data + + month = data['month'] + year = data['year'] + amount = data['amount'] + rebate_count = data['rebate_count'] + rebate_amount = data['rebate_amount'] + #nonveg_total_bill = data['nonveg_total_bill'] + paid = data['paid'] + + username = get_object_or_404(User,username=request.user.username) + idd = ExtraInfo.objects.get(user=username) + student = Student.objects.get(id=idd.id) + + + obj = Monthly_bill( + student_id = student, + month = month, + year = year, + amount = amount, + rebate_count = rebate_count, + rebate_amount = rebate_amount, + # nonveg_total_bill = nonveg_total_bill, + paid = paid + ) + obj.save() + return Response({'status':200}) + +class PaymentsApi(APIView): + def get(self, request): + payments_obj = Payments.objects.all(); + serialized_obj = PaymentsSerializer(payments_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + data = request.data + + # sem = data['sem'] + # year = data['year'] + amount_paid = data['amount_paid'] + + + username = get_object_or_404(User,username=request.user.username) + idd = ExtraInfo.objects.get(user=username) + student = Student.objects.get(id=idd.id) + + + obj = Payments( + student_id = student, + # sem = sem, + # year = year, + amount_paid = amount_paid, + ) + obj.save() + return Response({'status':200}) +class MenuApi(APIView): + def get(self, request): + menu_obj = Menu.objects.all(); + serialized_obj = MenuSerializer(menu_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + data = request.data + + mess_option = data['mess_option'] + meal_time = data['meal_time'] + dish = data['dish'] + + + obj = Menu( + mess_option = mess_option, + meal_time = meal_time, + dish = dish, + ) + obj.save() + return Response({'status':200}) +class RebateApi(APIView): + def get(self, request): + rebate_obj = Rebate.objects.all(); + serialized_obj = RebateSerializer(rebate_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + data = request.data + + # student_id = data['mess_option'] + start_date = data['start_date'] + end_date = data['end_date'] + purpose = data['purpose'] + status = data['status'] + app_date = data['app_date'] + leave_type = data['leave_type'] + + username = get_object_or_404(User,username=request.user.username) + idd = ExtraInfo.objects.get(user=username) + student = Student.objects.get(id=idd.id) + + + obj = Rebate( + student_id = student, + leave_type = leave_type, + app_date = app_date, + status = status, + purpose = purpose, + end_date= end_date, + start_date = start_date + ) + obj.save() + return Response({'status':200}) +class Vacation_foodApi(APIView): + def get(self, request): + vacation_food_obj = Vacation_food.objects.all(); + serialized_obj = Vacation_foodSerializer(vacation_food_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + data = request.data + + start_date = data['start_date'] + end_date = data['end_date'] + purpose = data['purpose'] + status = data['status'] + app_date = data['app_date'] + + + username = get_object_or_404(User,username=request.user.username) + idd = ExtraInfo.objects.get(user=username) + student = Student.objects.get(id=idd.id) + + + obj = Vacation_food( + student_id = student, + app_date = app_date, + status = status, + purpose = purpose, + end_date= end_date, + start_date = start_date + ) + obj.save() + return Response({'status':200}) + +class Nonveg_menuApi(APIView): + def get(self, request): + nonveg_menu_obj = Nonveg_menu.objects.all(); + serialized_obj = Nonveg_menuSerializer(nonveg_menu_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + data = request.data + + dish= data['dish'] + price = data['price'] + order_interval = data['order_interval'] + + + obj = Nonveg_menu( + dish = dish, + price = price, + order_interval = order_interval, + ) + obj.save() + return Response({'status':200}) + +class Nonveg_dataApi(APIView): + def get(self, request): + nonveg_data_obj = Nonveg_data.objects.all(); + serialized_obj = Nonveg_dataSerializer(nonveg_data_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + data = request.data + + dish= data['dish'] + order_date = data['order_date'] + app_date = data['app_date'] + order_interval = data['order_interval'] + + username = get_object_or_404(User,username=request.user.username) + idd = ExtraInfo.objects.get(user=username) + student = Student.objects.get(id=idd.id) + + dish_obj = Nonveg_menu.objects.get(dish=dish) + + obj = Nonveg_data( + student_id = student, + order_date = order_date, + app_date = app_date, + dish = dish_obj, + order_interval = order_interval, + ) + obj.save() + return Response({'status':200}) + +class Special_requestApi(APIView): + def get(self, request): + special_request_obj = Special_request.objects.all(); + serialized_obj = Special_requestSerializer(special_request_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + + def post(self, request): + data = request.data + + + start_date = data['start_date'] + end_date = data['end_date'] + status = data['status'] + app_date = data['app_date'] + request_= data['request'] + item1 = data['item1'] + item2 = data['item2'] + + + + username = get_object_or_404(User,username=request.user.username) + idd = ExtraInfo.objects.get(user=username) + student = Student.objects.get(id=idd.id) + + obj = Special_request( + student_id = student, + app_date = app_date, + status = status, + item1 = item1, + item2 = item2, + end_date= end_date, + start_date = start_date, + request = request_ + ) + obj.save() + return Response({'status':200}) + +class Mess_meetingApi(APIView): + def get(self, request): + mess_meeting_obj = Mess_meeting.objects.all(); + serialized_obj = Mess_meetingSerializer(mess_meeting_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + data = request.data + meet_date = data['meet_date'] + agenda = data['agenda'] + venue = data['venue'] + meeting_time = data['meeting_time'] + + obj = Mess_meeting( + meet_date = meet_date, + meeting_time = meeting_time, + agenda = agenda, + venue = venue, + ) + obj.save() + return Response({'status':200}) + +class Mess_minutesApi(APIView): + def get(self, request): + mess_minutes_obj = Mess_minutes.objects.all(); + serialized_obj = Mess_minutesSerializer(mess_minutes_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + data = request.data + + # meeting_date = data['meeting_date'] + mess_minutes = data['mess_minutes'] + meeting_date_obj = Mess_meeting.objects.get(meet_date=meeting_date) + + obj = Mess_minutes( + # meeting_date = meeting_date_obj, + mess_minutes = mess_minutes, + ) + obj.save() + return Response({'status':200}) + +class Menu_change_requestApi(APIView): + def get(self, request): + menu_change_request_obj = Menu_change_request.objects.all(); + serialized_obj = Menu_change_requestSerializer(menu_change_request_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + data = request.data + dish = data['dish'] + reason = data['reason'] + status = data['status'] + app_date = data['app_date'] + request_ = data['request'] + + + dish_obj = Menu.objects.get(dish=dish) + username = get_object_or_404(User,username=request.user.username) + idd = ExtraInfo.objects.get(user=username) + student = Student.objects.get(id=idd.id) + + obj = Menu_change_request( + student_id = student, + app_date = app_date, + status = status, + reason = reason, + request = request_, + dish = dish_obj + ) + obj.save() + return Response({'status':200}) diff --git a/FusionIIIT/applications/central_mess/forms.py b/FusionIIIT/applications/central_mess/forms.py index ac52d5d3a..9f835c959 100644 --- a/FusionIIIT/applications/central_mess/forms.py +++ b/FusionIIIT/applications/central_mess/forms.py @@ -13,4 +13,5 @@ class MessInfoForm(forms.Form, ): ('mess1', 'Veg Mess'), ('mess2', 'Non Veg Mess'), ] - mess_option = forms.CharField(label='Mess Option', widget=forms.Select(choices=MESS_CHOICES)) \ No newline at end of file + mess_option = forms.CharField(label='Mess Option', widget=forms.Select( + choices=MESS_CHOICES, attrs={'style': 'border-radius:1rem;padding:7px;'})) diff --git a/FusionIIIT/applications/central_mess/handlers.py b/FusionIIIT/applications/central_mess/handlers.py index e469e1286..4acf1a45a 100644 --- a/FusionIIIT/applications/central_mess/handlers.py +++ b/FusionIIIT/applications/central_mess/handlers.py @@ -16,7 +16,7 @@ from applications.globals.models import ExtraInfo, HoldsDesignation, Designation from .models import (Feedback, Menu, Menu_change_request, Mess_meeting, Mess_minutes, Mess_reg, Messinfo, Monthly_bill, - Nonveg_data, Nonveg_menu, Payments, Rebate, + Payments, Rebate, Special_request, Vacation_food, MessBillBase) from notification.views import central_mess_notif @@ -33,32 +33,32 @@ next_month = first_day_of_next_month.month -def add_nonveg_order(request, student): - """ - This function is to place non veg orders - :param request: - user: Current user - order_interval: Time of the day for which order is placed eg breakfast/lunch/dinner - :param student: student placing the order - :variables: - extra_info: Extra information about the current user. From model ExtraInfo - student: Student information about the current user - student_mess: Mess choices of the student - dish_request: Predefined dish available - nonveg_object: Object of Nonveg_data - :return: - """ - try: - dish_request = Nonveg_menu.objects.get(dish=request.POST.get("dish")) - order_interval = request.POST.get("interval") - order_date = tomorrow_g - nonveg_object = Nonveg_data(student_id=student, order_date=order_date, - order_interval=order_interval, dish=dish_request) - nonveg_object.save() - # messages.success(request, 'Your request is forwarded !!', extra_tags='successmsg') - - except ObjectDoesNotExist: - return HttpResponse("Seems like object does not exist") +# def add_nonveg_order(request, student): +# """ +# This function is to place non veg orders +# :param request: +# user: Current user +# order_interval: Time of the day for which order is placed eg breakfast/lunch/dinner +# :param student: student placing the order +# :variables: +# extra_info: Extra information about the current user. From model ExtraInfo +# student: Student information about the current user +# student_mess: Mess choices of the student +# dish_request: Predefined dish available +# nonveg_object: Object of Nonveg_data +# :return: +# """ +# try: +# dish_request = Nonveg_menu.objects.get(dish=request.POST.get("dish")) +# order_interval = request.POST.get("interval") +# order_date = tomorrow_g +# nonveg_object = Nonveg_data(student_id=student, order_date=order_date, +# order_interval=order_interval, dish=dish_request) +# nonveg_object.save() +# # messages.success(request, 'Your request is forwarded !!', extra_tags='successmsg') + +# except ObjectDoesNotExist: +# return HttpResponse("Seems like object does not exist") def add_mess_feedback(request, student): @@ -117,7 +117,7 @@ def add_vacation_food_request(request, student): } return data - vacation_check = Vacation_food.objects.filter(student_id =student) + vacation_check = Vacation_food.objects.filter(student_id=student).prefetch_related('student_id','student_id__id','student_id__id__user','student_id__id__department') date_format = "%Y-%m-%d" b = datetime.strptime(str(start_date), date_format) @@ -155,11 +155,10 @@ def add_menu_change_request(request, student): :return: """ try: - print("inside add_menu") - dish = Menu.objects.get(dish=request.POST.get("dish")) - print(dish, "-------------------------------------------------------------------") + + dishID =request.POST['dish']; + dish=Menu.objects.get(id=dishID) new_dish = request.POST.get("newdish") - print(new_dish) reason = request.POST.get("reason") # menu_object = Menu_change_request(dish=dish, request=new_dish, reason=reason) menu_object = Menu_change_request(dish=dish, student_id=student, request=new_dish, reason=reason) @@ -172,7 +171,6 @@ def add_menu_change_request(request, student): data = { 'status': 0 } - print(e) return data @@ -192,16 +190,15 @@ def handle_menu_change_response(request): ap_id = request.POST.get('idm') user = request.user stat = request.POST['status'] - application = Menu_change_request.objects.get(pk=ap_id) + application = Menu_change_request.objects.get(id=ap_id) # student = application.student_id # receiver = User.objects.get(username=student) if stat == '2': application.status = 2 - meal = application.dish - obj = Menu.objects.get(dish=meal.dish) + obj = Menu.objects.get(Q(meal_time=application.dish.meal_time) & Q(mess_option=application.dish.mess_option)) obj.dish = application.request obj.save() - data = { + data = { 'status': '2', } # central_mess_notif(user, receiver, 'menu_change_accepted') @@ -334,9 +331,9 @@ def add_leave_request(request, student): } return data - rebates = Rebate.objects.filter(student_id=student) - rebate_check = rebates.filter(Q(status='1') | Q(status='2')) - + rebate_check = Rebate.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(student_id=student, status__in=['1', '2']) + + for r in rebate_check: a = datetime.strptime(str(r.start_date), date_format) c = datetime.strptime(str(r.end_date), date_format) @@ -373,8 +370,8 @@ def add_mess_meeting_invitation(request): venue = request.POST['venue'] agenda = request.POST['agenda'] time = request.POST['time'] - members_mess = HoldsDesignation.objects.filter(Q(designation__name__contains='mess_convener') - | Q(designation__name__contains='mess_committee')|Q(designation__name='mess_manager') + members_mess = HoldsDesignation.objects.select_related().filter(Q(designation__name__contains='mess_convener') + | Q(designation__name__contains='mess_committee')|Q(designation__name='mess_manager') | Q(designation__name='mess_warden')) date_today = str(today_g.date()) if date <= date_today: @@ -470,8 +467,8 @@ def add_special_food_request(request, student): return data spfood_obj = Special_request(student_id=student, start_date=fr, end_date=to, item1=food1, item2=food2, request=purpose) - requests_food = Special_request.objects.filter(student_id=student) - s_check = requests_food.filter(Q(status='1') | Q(status='2')) + s_check = Special_request.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(student_id=student,status__in=['1', '2']).order_by('-app_date') + for r in s_check: a = datetime.strptime(str(r.start_date), date_format) @@ -538,53 +535,56 @@ def add_bill_base_amount(request): def add_mess_committee(request, roll_number): - print("\n\n\\n\n\n\n\n") - print(roll_number) - mess = Messinfo.objects.get(student_id__id=roll_number) - print(mess) - if mess.mess_option == 'mess1': - designation = Designation.objects.get(name='mess_committee_mess1') - else: - designation = Designation.objects.get(name='mess_committee_mess2') - # designation = Designation.objects.get(name='mess_committee') - # add_obj = HoldsDesignation.objects.filter(Q(user__username=roll_number) & Q(designation=designation)) - check_obj = HoldsDesignation.objects.filter(Q(user__username=roll_number) & + studentHere = Student.objects.get(id=roll_number) + try: + mess = Messinfo.objects.get(student_id_id=studentHere) + if mess.mess_option == 'mess1': + designation = Designation.objects.get(name='mess_committee') + else: + designation = Designation.objects.get(name='mess_committee_mess2') + check_obj=HoldsDesignation.objects.select_related().filter(Q(user__username=studentHere) & (Q(designation__name__contains='mess_committee') | Q(designation__name__contains='mess_convener'))) - if check_obj: - data = { - 'status': 2, - 'message': roll_number + " is already a part of mess committee" - } + if check_obj: + data = { + 'status': 2, + 'message': roll_number + " is already a part of mess committee" + } + return data + else: + add_user = User.objects.get(username=roll_number) + designation_object = HoldsDesignation(user=add_user, working=add_user, designation=designation) + designation_object.save() + central_mess_notif(request.user, add_user, 'added_committee', '') + data = { + 'status': 1, + 'message': roll_number + " is added to Mess Committee" + } return data - else: - add_user = User.objects.get(username=roll_number) - designation_object = HoldsDesignation(user=add_user, working=add_user, designation=designation) - designation_object.save() - central_mess_notif(request.user, add_user, 'added_committee', '') + except: data = { - 'status': 1, - 'message': roll_number + " is added to Mess Committee" + 'status': 0, + 'message': roll_number + " is not registered for any Mess." } - return data def generate_bill(): - student_all = Student.objects.all() month_t = datetime.now().month - 1 month_g = last_day_prev_month.month first_day_prev_month = last_day_prev_month.replace(day=1) # previous_month = month_t.strftime("%B") + student_all = Student.objects.prefetch_related('rebate_set') amount_c = MessBillBase.objects.latest('timestamp') for student in student_all: - nonveg_total_bill=0 + # nonveg_total_bill=0 rebate_count = 0 total = 0 - nonveg_data = Nonveg_data.objects.filter(student_id=student) - rebates = Rebate.objects.filter(student_id=student) - for order in nonveg_data: - if order.order_date.strftime("%B") == previous_month: - nonveg_total_bill = nonveg_total_bill + order.dish.price + # nonveg_data = student.nonveg_data_set.all() + rebates = student.rebate_set.all() + # for order in nonveg_data: + # if order.order_date.strftime("%B") == previous_month: + # nonveg_total_bill = nonveg_total_bill + order.dish.price + for r in rebates: if r.status == '2': if r.start_date.month == month_g: @@ -597,20 +597,19 @@ def generate_bill(): else: rebate_count = 0 rebate_amount = rebate_count*amount_c.bill_amount/30 - total = amount_c.bill_amount + nonveg_total_bill - rebate_amount + total = amount_c.bill_amount - rebate_amount bill_object = Monthly_bill(student_id=student, month=previous_month, year = previous_month_year, amount=amount_c.bill_amount, rebate_count=rebate_count, rebate_amount=rebate_amount, - nonveg_total_bill=nonveg_total_bill, total_bill=total) if Monthly_bill.objects.filter(student_id=student, month=previous_month, year = previous_month_year, - total_bill=total): - print("exists") + total_bill=total).exists(): + 1 elif Monthly_bill.objects.filter(student_id=student, month=previous_month, year = previous_month_year): @@ -621,7 +620,6 @@ def generate_bill(): amount=amount_c.bill_amount, rebate_count=rebate_count, rebate_amount=rebate_amount, - nonveg_total_bill=nonveg_total_bill, total_bill=total) # bill_object.update() else: diff --git a/FusionIIIT/applications/central_mess/migrations/0002_auto_20230328_1942.py b/FusionIIIT/applications/central_mess/migrations/0002_auto_20230328_1942.py new file mode 100644 index 000000000..5002a3375 --- /dev/null +++ b/FusionIIIT/applications/central_mess/migrations/0002_auto_20230328_1942.py @@ -0,0 +1,38 @@ +# Generated by Django 3.1.5 on 2023-03-28 19:42 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('central_mess', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='monthly_bill', + name='nonveg_total_bill', + ), + migrations.AlterField( + model_name='feedback', + name='mess', + field=models.CharField(choices=[('mess1', 'Mess1'), ('mess2', 'Mess2')], default='mess1', max_length=10), + ), + migrations.AlterField( + model_name='menu', + name='mess_option', + field=models.CharField(choices=[('mess1', 'Mess1'), ('mess2', 'Mess2')], default='mess2', max_length=20), + ), + migrations.AlterField( + model_name='messinfo', + name='mess_option', + field=models.CharField(choices=[('mess1', 'Mess1'), ('mess2', 'Mess2')], default='mess2', max_length=20), + ), + migrations.DeleteModel( + name='Nonveg_data', + ), + migrations.DeleteModel( + name='Nonveg_menu', + ), + ] diff --git a/FusionIIIT/applications/central_mess/migrations/0002_monthly_bill_paid.py b/FusionIIIT/applications/central_mess/migrations/0002_monthly_bill_paid.py new file mode 100644 index 000000000..0884018c1 --- /dev/null +++ b/FusionIIIT/applications/central_mess/migrations/0002_monthly_bill_paid.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2023-04-04 11:39 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('central_mess', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='monthly_bill', + name='paid', + field=models.BooleanField(default=False), + ), + ] diff --git a/FusionIIIT/applications/central_mess/migrations/0003_auto_20230331_1935.py b/FusionIIIT/applications/central_mess/migrations/0003_auto_20230331_1935.py new file mode 100644 index 000000000..42b542001 --- /dev/null +++ b/FusionIIIT/applications/central_mess/migrations/0003_auto_20230331_1935.py @@ -0,0 +1,26 @@ +# Generated by Django 3.1.5 on 2023-03-31 19:35 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('academic_information', '0001_initial'), + ('central_mess', '0002_auto_20230328_1942'), + ] + + operations = [ + migrations.AlterUniqueTogether( + name='payments', + unique_together={('student_id',)}, + ), + migrations.RemoveField( + model_name='payments', + name='sem', + ), + migrations.RemoveField( + model_name='payments', + name='year', + ), + ] diff --git a/FusionIIIT/applications/central_mess/migrations/0004_merge_20230405_0022.py b/FusionIIIT/applications/central_mess/migrations/0004_merge_20230405_0022.py new file mode 100644 index 000000000..1fa962e73 --- /dev/null +++ b/FusionIIIT/applications/central_mess/migrations/0004_merge_20230405_0022.py @@ -0,0 +1,14 @@ +# Generated by Django 3.1.5 on 2023-04-05 00:22 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('central_mess', '0003_auto_20230331_1935'), + ('central_mess', '0002_monthly_bill_paid'), + ] + + operations = [ + ] diff --git a/FusionIIIT/applications/central_mess/models.py b/FusionIIIT/applications/central_mess/models.py index cdd4de8a3..dfb2ad70f 100644 --- a/FusionIIIT/applications/central_mess/models.py +++ b/FusionIIIT/applications/central_mess/models.py @@ -83,8 +83,8 @@ ) MESS_OPTION = ( - ('mess1', 'Veg_mess'), - ('mess2', 'Non_veg_mess') + ('mess1', 'Mess1'), + ('mess2', 'Mess2') ) @@ -126,8 +126,9 @@ class Monthly_bill(models.Model): amount = models.IntegerField(default=0) rebate_count = models.IntegerField(default=0) rebate_amount = models.IntegerField(default=0) - nonveg_total_bill = models.IntegerField(default=0) + # nonveg_total_bill = models.IntegerField(default=0) total_bill = models.IntegerField(default=0) + paid = models.BooleanField(default=False) class Meta: unique_together = (('student_id', 'month', 'year'),) @@ -138,15 +139,15 @@ def __str__(self): class Payments(models.Model): student_id = models.ForeignKey(Student, on_delete=models.CASCADE) - sem = models.IntegerField() - year = models.IntegerField(default=current_year) + # sem = models.IntegerField() + # year = models.IntegerField(default=current_year) amount_paid = models.IntegerField(default=0) class Meta: - unique_together = (('student_id', 'sem', 'year'),) + unique_together = (('student_id'),) def __str__(self): - return '{} - {}'.format(self.student_id.id, self.sem) + return '{}'.format(self.student_id.id) class Menu(models.Model): @@ -186,26 +187,26 @@ def __str__(self): return str(self.student_id.id) -class Nonveg_menu(models.Model): - dish = models.CharField(max_length=20) - price = models.IntegerField() - order_interval = models.CharField(max_length=20, choices=INTERVAL, - default='Breakfast') +# class Nonveg_menu(models.Model): +# dish = models.CharField(max_length=20) +# price = models.IntegerField() +# order_interval = models.CharField(max_length=20, choices=INTERVAL, +# default='Breakfast') - def __str__(self): - return '{} - {}'.format(self.dish, self.price) +# def __str__(self): +# return '{} - {}'.format(self.dish, self.price) -class Nonveg_data(models.Model): - student_id = models.ForeignKey(Student, on_delete=models.CASCADE) - order_date = models.DateField(default=datetime.date.today) - order_interval = models.CharField(max_length=20, choices=INTERVAL, - default='Breakfast') - dish = models.ForeignKey(Nonveg_menu, on_delete=models.CASCADE) - app_date = models.DateField(default=datetime.date.today) +# class Nonveg_data(models.Model): +# student_id = models.ForeignKey(Student, on_delete=models.CASCADE) +# order_date = models.DateField(default=datetime.date.today) +# order_interval = models.CharField(max_length=20, choices=INTERVAL, +# default='Breakfast') +# dish = models.ForeignKey(Nonveg_menu, on_delete=models.CASCADE) +# app_date = models.DateField(default=datetime.date.today) - def __str__(self): - return str(self.student_id.id) +# def __str__(self): +# return str(self.student_id.id) class Special_request(models.Model): diff --git a/FusionIIIT/applications/central_mess/urls.py b/FusionIIIT/applications/central_mess/urls.py index f98b83047..0271c442a 100644 --- a/FusionIIIT/applications/central_mess/urls.py +++ b/FusionIIIT/applications/central_mess/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import url +from django.conf.urls import url , include from . import views @@ -8,15 +8,16 @@ url(r'^$', views.mess, name='mess'), url(r'^menurequest/', views.menu_change_request, name='menu_change_request'), - url(r'^placeorder/', views.place_order, name='placeorder'), + # url(r'^placeorder/', views.place_order, name='placeorder'), url(r'^addleavet/', views.add_leave_manager, name='addleavet'), url(r'^submitmessfeedback/', views.submit_mess_feedback, name='submitmessfeedback'), url(r'^messvacationsubmit/', views.mess_vacation_submit, name='messvacationsubmit'), url(r'^messmenusubmit/', views.submit_mess_menu, name='messmenusubmit'), url(r'^regsubmit/', views.regsubmit, name='regsubmit'), url(r'^startmessregistration/', views.start_mess_registration, name='startmessregistration'), + url(r'^closemessregistration/', views.closeRegistration, name='closemessregistration'), url(r'^menudownload/', views.MenuPDF.as_view(), name='MenuPDF'), - url(r'^menudownload1/', views.MenuPDF.as_view(), name='MenuPDF1'), + url(r'^menudownload1/', views.MenuPDF1.as_view(), name='MenuPDF1'), # url(r'^(?P[0-9]+)/response/', views.response, name='response'), url(r'^response', views.menu_change_response, name='response'), url(r'^(?P[0-9]+)/responsevacationfood/', views.response_vacation_food, name='responsevacationfood'), @@ -29,12 +30,19 @@ url(r'^rebateresponse', views.rebate_response, name='rebateresponse'), url(r'^specialrequestresponse', views.special_request_response, name='specialrequestresponse'), url(r'^updatecost', views.update_cost, name='updatecost'), - url(r'^getnonvegorder', views.get_nonveg_order, name='getnonvegorder'), + # url(r'^getnonvegorder', views.get_nonveg_order, name='getnonvegorder'), url(r'^getleave', views.get_leave_data, name='getleave'), url(r'^generatemessbill', views.generate_mess_bill, name='generatemessbill'), url(r'^acceptleave', views.accept_vacation_leaves, name='acceptleave'), url(r'^selectmessconvener', views.select_mess_convener, name='selectmessconvener'), url(r'^billdownload', views.download_bill_mess, name='billdownload'), url("info-form", views.mess_info, name="info"), + url(r'^updatemenuu', views.update_menu1, name='update_menu1'), + url(r'^updatemenu', views.update_menu2, name='update_menu2'), + + url(r'^api', include('applications.central_mess.api.urls')), + + url(r'^registeredstudent', views.searchAddOrRemoveStudent, name='registeredstudent'), + url(r'^uploadpayment', views.uploadPaymentDue, name='uploadpayment') ] diff --git a/FusionIIIT/applications/central_mess/utils.py b/FusionIIIT/applications/central_mess/utils.py index 17ea7826e..480ef91a3 100644 --- a/FusionIIIT/applications/central_mess/utils.py +++ b/FusionIIIT/applications/central_mess/utils.py @@ -10,7 +10,7 @@ def render_to_pdf(template_src, context_dict={}): html = template.render(context_dict) result = BytesIO() print(result.read) - pdf = pisa.pisaDocument(BytesIO(html.encode("ISO-8859-1")), result) + pdf = pisa.pisaDocument(BytesIO(html.encode("utf-8")), result) if not pdf.err: return HttpResponse(result.getvalue(), content_type='application/pdf') return None diff --git a/FusionIIIT/applications/central_mess/views.py b/FusionIIIT/applications/central_mess/views.py index bb1498d55..c2a4fd196 100644 --- a/FusionIIIT/applications/central_mess/views.py +++ b/FusionIIIT/applications/central_mess/views.py @@ -17,15 +17,18 @@ from .forms import MinuteForm, MessInfoForm from .models import (Feedback, Menu, Menu_change_request, Mess_meeting, Mess_minutes, Mess_reg, Messinfo, Monthly_bill, - Nonveg_data, Nonveg_menu, Payments, Rebate, + Payments, Rebate, Special_request, Vacation_food, MessBillBase) -from .handlers import (add_nonveg_order, add_mess_feedback, add_vacation_food_request, +from .handlers import (add_mess_feedback, add_vacation_food_request, add_menu_change_request, handle_menu_change_response, handle_vacation_food_request, add_mess_registration_time, add_leave_request, add_mess_meeting_invitation, handle_rebate_response, add_special_food_request, handle_special_request, add_bill_base_amount, add_mess_committee, generate_bill) from notification.views import central_mess_notif +import csv +import openpyxl + today_g = datetime.today() month_g = today_g.month @@ -62,140 +65,132 @@ def mess(request): count6 = 0 count7 = 0 count8 = 0 - if extrainfo.user_type == 'student': student = Student.objects.select_related('id','id__user','id__department').get(id=extrainfo) vaca_obj = Vacation_food.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(student_id=student) feedback_obj = Feedback.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(student_id=student).order_by('-fdate') - data = Nonveg_data.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department','dish').filter(student_id=student).order_by('-app_date') monthly_bill = Monthly_bill.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(student_id=student) payments = Payments.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(student_id=student) rebates = Rebate.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(student_id=student).order_by('-app_date') splrequest = Special_request.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(student_id=student).order_by('-app_date') - try: - mess_optn = Messinfo.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').get(student_id=student) - except: - return HttpResponseRedirect("/mess/info-form") + monthly_bill=monthly_bill[::-1] + + tot_am=0 + if len(payments)>0: + tot_am=payments[0].amount_paid + else: + tot_am=0 + for x in monthly_bill: + tot_am=tot_am+x.total_bill + Payments.objects.create(student_id=student,amount_paid=(-tot_am)) + payments = Payments.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(student_id=student) + + + + + for i in range(0,len(monthly_bill)): + if(monthly_bill[i].paid): + monthly_bill[i].due_amount=0; + elif monthly_bill[i].total_bill+tot_am<0: + monthly_bill[i].due_amount=(monthly_bill[i].total_bill) + else: + monthly_bill[i].due_amount=(-tot_am) + tot_am+=monthly_bill[i].total_bill + amount_due=-payments[0].amount_paid if student.programme == 'B.Tech' or student.programme == 'B.Des': programme = 1 else: programme = 0 - # newmenu = Menu_change_request.objects.all() - # meeting = Mess_meeting.objects.all() - # minutes = Mess_minutes.objects.all() - # feed = Feedback.objects.all() - # sprequest = Special_request.objects.filter(status='1') + meeting = Mess_meeting.objects.all() + minutes = Mess_minutes.objects.all() count = 0 - #variable y stores the menu items - y = Menu.objects.filter(mess_option=mess_optn.mess_option) - x = Nonveg_menu.objects.all() - - # for item in rebates: - # d1 = item.start_date - # d2 = item.end_date - # item.duration = abs((d2 - d1).days)+1 - # item.save() - - # for items in rebates: - # if items.leave_type == 'casual' and (items.status == '1' or items.status == '2'): - # count += item.duration - - bill = Monthly_bill.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(Q(student_id=student) & Q(month=month_g_l) & Q(year=year_g)) - amount_c = MessBillBase.objects.latest('timestamp') - rebate_count = 0 - nonveg_total_bill = 0 - for z in data: - if z.order_date.month == month_g: - nonveg_total_bill = nonveg_total_bill + z.dish.price - - else: - bill.nonveg_total_bill = 0 + try: + mess_optn = Messinfo.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').get(student_id=student) + y = Menu.objects.filter(mess_option=mess_optn.mess_option) - for r in rebates: - if r.status == '2': - if r.start_date.month == month_g: - if r.end_date.month == next_month: - rebate_count = rebate_count + abs((last_day_of_this_month - r.start_date).days) + 1 + + bill = Monthly_bill.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(Q(student_id=student) & Q(month=month_g_l) & Q(year=year_g)) + amount_c = MessBillBase.objects.latest('timestamp') + rebate_count = 0 + + for r in rebates: + if r.status == '2': + if r.start_date.month == month_g: + if r.end_date.month == next_month: + rebate_count = rebate_count + abs((last_day_of_this_month - r.start_date).days) + 1 + else: + rebate_count = rebate_count + abs((r.end_date - r.start_date).days) + 1 + elif r.end_date.month == month_g: + rebate_count = rebate_count + abs((r.end_date - first_day_of_this_month).days) + 1 else: - rebate_count = rebate_count + abs((r.end_date - r.start_date).days) + 1 - elif r.end_date.month == month_g: - rebate_count = rebate_count + abs((r.end_date - first_day_of_this_month).days) + 1 - else: - rebate_count = 0 - rebate_amount = rebate_count * amount_c.bill_amount / 30 - total_bill = amount_c.bill_amount - rebate_amount + nonveg_total_bill - if bill: - bill.update(student_id = student, - month = month_g_l, - year = year_g, - amount = amount_c.bill_amount, - rebate_count = rebate_count, - rebate_amount = rebate_amount, - nonveg_total_bill=nonveg_total_bill, - total_bill = total_bill) + rebate_count = 0 + rebate_amount = rebate_count * amount_c.bill_amount / 30 + total_bill = amount_c.bill_amount - rebate_amount + if bill: + bill.update(student_id = student, + month = month_g_l, + year = year_g, + amount = amount_c.bill_amount, + rebate_count = rebate_count, + rebate_amount = rebate_amount, + total_bill = total_bill) - else: - bill_object = Monthly_bill(student_id=student, - amount=amount_c.bill_amount, - rebate_count=rebate_count, - rebate_amount=rebate_amount, - nonveg_total_bill=nonveg_total_bill, - total_bill=total_bill, - month=month_g_l, - year=year_g) - bill_object.save() + else: + bill_object = Monthly_bill(student_id=student, + amount=amount_c.bill_amount, + rebate_count=rebate_count, + rebate_amount=rebate_amount, + total_bill=total_bill, + month=month_g_l, + year=year_g) + bill_object.save() + except: + mess_optn={'mess_option':'no-mess'} + y = Menu.objects.filter(mess_option="mess1") for d in desig: - if d.designation.name == 'mess_committee_mess1' or d.designation.name == 'mess_convener_mess1': + if d.designation.name == 'mess_committee' or d.designation.name == 'mess_convener': newmenu = Menu_change_request.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department','dish').filter(dish__mess_option='mess1').order_by('-app_date') - # newmenu = Menu_change_request.objects.all() meeting = Mess_meeting.objects.all() minutes = Mess_minutes.objects.select_related().all() feed = Feedback.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(mess='mess1').order_by('-fdate') feed2 = Feedback.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(mess='mess2').order_by('-fdate') sprequest = Special_request.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(status='1').order_by('-app_date') sprequest_past = Special_request.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(status='2').order_by('-app_date') - # count1 = feed.filter(Q(feedback_type='Maintenance') & Q(mess='mess1')).count() + menuchangerequest= Menu_change_request.objects.select_related('student_id').filter().order_by('-app_date') + menu_data = Menu.objects.all() for f in feed: - if f.feedback_type == 'Maintenance' and mess_optn.mess_option == 'mess1': + if f.feedback_type == 'Maintenance' : count1 += 1 - elif f.feedback_type == 'Food' and mess_optn.mess_option == 'mess1': + elif f.feedback_type == 'Food' : count2 += 1 - elif f.feedback_type == 'Cleanliness' and mess_optn.mess_option == 'mess1': + elif f.feedback_type == 'Cleanliness' : count3 += 1 - elif f.feedback_type == 'Others' and mess_optn.mess_option == 'mess1': + elif f.feedback_type == 'Others' : count4 += 1 - for f in feed2: - if f.feedback_type == 'Maintenance' and mess_optn.mess_option == 'mess2': - count5 += 1 - - elif f.feedback_type == 'Food' and mess_optn.mess_option == 'mess2': - count6 += 1 - - elif f.feedback_type == 'Cleanliness' and mess_optn.mess_option == 'mess2': - count7 += 1 - - elif f.feedback_type == 'Others' and mess_optn.mess_option == 'mess2': - count8 += 1 + count5=0 + count6=0 + count7=0 + count8=0 context = { - 'menu': y, + 'menu': menu_data, + 'reg_menu': y, 'messinfo': mess_optn, 'newmenu': newmenu, 'monthly_bill': monthly_bill, - 'payments': payments, - 'nonveg': x, + 'total_due': amount_due, 'vaca': vaca_obj, 'info': extrainfo, 'feedback': feedback_obj, - 'feed': feed, + 'feed1': feed, + 'feed2':'', 'student': student, - 'data': data, 'mess_reg': mess_reg, 'current_date': current_date, 'count': count, @@ -205,6 +200,7 @@ def mess(request): 'sprequest': sprequest, 'splrequest': splrequest, 'sprequest_past': sprequest_past, + 'menuchangerequest':menuchangerequest, 'programme':programme, 'count1': count1, 'count2': count2, @@ -220,7 +216,6 @@ def mess(request): return render(request, "messModule/mess.html", context) if d.designation.name == 'mess_committee_mess2' or d.designation.name == 'mess_convener_mess2': - # newmenu = Menu_change_request.objects.all() newmenu = Menu_change_request.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department','dish').filter(dish__mess_option='mess2').order_by('-app_date') meeting = Mess_meeting.objects.all() minutes = Mess_minutes.objects.select_related().all() @@ -228,45 +223,39 @@ def mess(request): feed2 = Feedback.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(mess='mess1').order_by('-fdate') sprequest = Special_request.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(status='1').order_by('-app_date') sprequest_past = Special_request.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(status='2').order_by('-app_date') - # count5 = feed.filter(Q(feedback_type='Maintenance') & Q(mess='mess2')).count() - for f in feed2: - if f.feedback_type == 'Maintenance' and mess_optn.mess_option == 'mess1': + menuchangerequest= Menu_change_request.objects.select_related('student_id').filter().order_by('-app_date') + menu_data = Menu.objects.all().order_by() + count5=0 + count6=0 + count7=0 + count8=0 + for f in feed: + if f.feedback_type == 'Maintenance' : count1 += 1 - elif f.feedback_type == 'Food' and mess_optn.mess_option == 'mess1': + elif f.feedback_type == 'Food' : count2 += 1 - elif f.feedback_type == 'Cleanliness' and mess_optn.mess_option == 'mess1': + elif f.feedback_type == 'Cleanliness' : count3 += 1 - elif f.feedback_type == 'Others' and mess_optn.mess_option == 'mess1': + elif f.feedback_type == 'Others' : count4 += 1 - for f in feed: - if f.feedback_type == 'Maintenance' and mess_optn.mess_option == 'mess2': - count5 += 1 - - elif f.feedback_type == 'Food' and mess_optn.mess_option == 'mess2': - count6 += 1 - - elif f.feedback_type == 'Cleanliness' and mess_optn.mess_option == 'mess2': - count7 += 1 - - elif f.feedback_type == 'Others' and mess_optn.mess_option == 'mess2': - count8 += 1 context = { - 'menu': y, + 'menu': menu_data, + 'reg_menu': y, 'messinfo': mess_optn, 'newmenu': newmenu, 'monthly_bill': monthly_bill, - 'payments': payments, - 'nonveg': x, + 'total_due': amount_due, 'vaca': vaca_obj, 'info': extrainfo, 'feedback': feedback_obj, - 'feed': feed, + 'feed2': feed, + 'feed1':'', 'student': student, - 'data': data, + # 'data': data, 'mess_reg': mess_reg, 'current_date': current_date, 'count': count, @@ -274,9 +263,10 @@ def mess(request): 'programme': programme, 'meeting': meeting, 'minutes': minutes, - 'sprequest': sprequest, 'splrequest': splrequest, + 'sprequest': sprequest, 'sprequest_past': sprequest_past, + 'menuchangerequest':menuchangerequest, 'count1': count1, 'count2': count2, 'count3': count3, @@ -291,16 +281,14 @@ def mess(request): return render(request, "messModule/mess.html", context) context = { - 'menu': y, + 'reg_menu': y, 'messinfo': mess_optn, 'monthly_bill': monthly_bill, - 'payments': payments, - 'nonveg': x, + 'total_due': amount_due, 'vaca': vaca_obj, 'info': extrainfo, 'feedback': feedback_obj, 'student': student, - 'data': data, 'mess_reg': mess_reg, 'current_date': current_date, 'count': count, @@ -308,80 +296,117 @@ def mess(request): 'splrequest': splrequest, 'form': form, 'programme': programme, - 'desig': desig + 'desig': desig, + 'minutes': minutes, + 'meeting': meeting, + } return render(request, "messModule/mess.html", context) + + + elif extrainfo.user_type == 'staff': current_bill = MessBillBase.objects.latest('timestamp') - nonveg_orders_today = Nonveg_data.objects.filter(order_date=today_g)\ - .values('dish__dish','order_interval').annotate(total=Count('dish')) - nonveg_orders_tomorrow = Nonveg_data.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department','dish').filter(order_date=tomorrow_g)\ - .values('dish__dish','order_interval').annotate(total=Count('dish')) - # make info with diff name and then pass context newmenu = Menu_change_request.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department','dish').all().order_by('-app_date') vaca_all = Vacation_food.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').all().order_by('-app_date') - # members_mess = HoldsDesignation.objects.filter(designation__name='mess_convener') members_mess = HoldsDesignation.objects.select_related().filter(Q(designation__name__contains='mess_convener') | Q(designation__name__contains='mess_committee')) y = Menu.objects.all() - x = Nonveg_menu.objects.all() leave = Rebate.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(status='1').order_by('-app_date') leave_past = Rebate.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(status='2').order_by('-app_date') + meeting = Mess_meeting.objects.all() + minutes = Mess_minutes.objects.all() + feed1 = Feedback.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(mess='mess1').order_by('-fdate') + feed2 = Feedback.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(mess='mess2').order_by('-fdate') + + for f in feed1: + if f.feedback_type == 'Maintenance' : + count1 += 1 + + elif f.feedback_type == 'Food' : + count2 += 1 + + elif f.feedback_type == 'Cleanliness' : + count3 += 1 + + elif f.feedback_type == 'Others' : + count4 += 1 + + for f in feed2: + if f.feedback_type == 'Maintenance': + count5 += 1 + elif f.feedback_type == 'Food': + count6 += 1 + + elif f.feedback_type == 'Cleanliness': + count7 += 1 + + elif f.feedback_type == 'Others': + count8 += 1 + + sprequest = Special_request.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(status='1').order_by('-app_date') + sprequest_past = Special_request.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(status='2').order_by('-app_date') + context = { - 'bill_base': current_bill, - 'today': today_g.date(), - 'tomorrow': tomorrow_g.date(), - 'nonveg_orders_t':nonveg_orders_tomorrow, - 'nonveg_orders': nonveg_orders_today, - 'members': members_mess, - 'menu': y, - 'newmenu': newmenu, - 'vaca_all': vaca_all, - 'info': extrainfo, - 'leave': leave, - 'leave_past': leave_past, - 'current_date': current_date, - 'mess_reg': mess_reg, - 'desig': desig, - } + 'bill_base': current_bill, + 'today': today_g.date(), + 'tomorrow': tomorrow_g.date(), + 'members': members_mess, + 'menu': y, + 'newmenu': newmenu, + 'vaca_all': vaca_all, + 'info': extrainfo, + 'leave': leave, + 'leave_past': leave_past, + 'current_date': current_date, + 'mess_reg': mess_reg, + 'desig': desig, + 'meeting': meeting, + 'minutes': minutes, + 'sprequest': sprequest, + 'sprequest_past': sprequest_past, + 'count1': count1, + 'count2': count2, 'count3': count3, 'feed1': feed1,'feed2':feed2, + 'count4': count4, 'form': form, 'count5': count5, + 'count6': count6, 'count7': count7, 'count8': count8, 'desig': desig + } return render(request, "messModule/mess.html", context) elif extrainfo.user_type == 'faculty': meeting = Mess_meeting.objects.all() minutes = Mess_minutes.objects.select_related().all() - feed = Feedback.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').all().order_by('-fdate') + feed1 = Feedback.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(mess='mess1').order_by('-fdate') + feed2 = Feedback.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').filter(mess='mess2').order_by('-fdate') y = Menu.objects.all() - for f in feed: - mess_opt = Messinfo.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').get(student_id=f.student_id) - if f.feedback_type == 'Maintenance' and mess_opt.mess_option == 'mess1': + for f in feed1: + if f.feedback_type == 'Maintenance' : count1 += 1 - elif f.feedback_type == 'Food' and mess_opt.mess_option == 'mess1': + elif f.feedback_type == 'Food' : count2 += 1 - elif f.feedback_type == 'Cleanliness' and mess_opt.mess_option == 'mess1': + elif f.feedback_type == 'Cleanliness' : count3 += 1 - elif f.feedback_type == 'Others' and mess_opt.mess_option == 'mess1': + elif f.feedback_type == 'Others' : count4 += 1 - for f in feed: - mess_opt = Messinfo.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').get(student_id=f.student_id) - if f.feedback_type == 'Maintenance' and mess_opt.mess_option == 'mess2': + for f in feed2: + if f.feedback_type == 'Maintenance': count5 += 1 - elif f.feedback_type == 'Food' and mess_opt.mess_option == 'mess2': + elif f.feedback_type == 'Food': count6 += 1 - elif f.feedback_type == 'Cleanliness' and mess_opt.mess_option == 'mess2': + elif f.feedback_type == 'Cleanliness': count7 += 1 - elif f.feedback_type == 'Others' and mess_opt.mess_option == 'mess2': + elif f.feedback_type == 'Others': count8 += 1 context = { 'info': extrainfo, @@ -389,9 +414,10 @@ def mess(request): 'meeting': meeting, 'minutes': minutes, 'count1': count1, - 'count2': count2, 'count3': count3, 'feed': feed, + 'count2': count2, 'count3': count3, 'feed1': feed1,'feed2':feed2, 'count4': count4, 'form': form, 'count5': count5, 'count6': count6, 'count7': count7, 'count8': count8, 'desig': desig + } return render(request, 'messModule/mess.html', context) @@ -417,38 +443,19 @@ def mess_info(request): mess_option = form.cleaned_data['mess_option'] Messinfo.objects.create(student_id=student_id, mess_option=mess_option) return HttpResponseRedirect("/mess") - + user_id = request.user + student_id = Student.objects.select_related( + 'id').only('id__id').get(id__id=user_id) + if Messinfo.objects.filter(student_id=student_id).exists(): + return HttpResponseRedirect("/mess") form = MessInfoForm() context = { "form": form } return render(request, "messModule/messInfoForm.html", context) -@login_required -@transaction.atomic -@csrf_exempt -def place_order(request): - """ - This function is to place non-veg food orders - @param: - request: contains metadata about the requested page - - @variables: - user: Current user - order_interval: Time of the day for which order is placed eg breakfast/lunch/dinner - extra_info: Extra information about the current user. From model ExtraInfo - student: Student information about the current user - student_mess: Mess choices of the student - dish_request: Predefined dish available - """ - user = request.user - extra_info = ExtraInfo.objects.select_related().get(user=user) - if extra_info.user_type == 'student': - student = Student.objects.select_related('id','id__user','id__department').get(id=extra_info) - student_mess = Messinfo.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department').get(student_id=student) - add_nonveg_order(request, student) - return HttpResponseRedirect('/mess') + @csrf_exempt @@ -525,9 +532,9 @@ def submit_mess_menu(request): extrainfo = ExtraInfo.objects.select_related().get(user=user) designation = holds_designations student = Student.objects.select_related('id','id__user','id__department').get(id=extrainfo) - # globallyChange() + context = {} - # A user may hold multiple designations + data = add_menu_change_request(request,student) if data['status'] == 1: @@ -569,7 +576,7 @@ def response_vacation_food(request, ap_id): holds_designations: designation of current user """ user = request.user - # extra_info = ExtraInfo.objects.get(user=user) + holds_designations = HoldsDesignation.objects.select_related().filter(user=user) designation = holds_designations @@ -659,6 +666,12 @@ def start_mess_registration(request): data = add_mess_registration_time(request) return JsonResponse(data) +@csrf_exempt +def closeRegistration(request): + mess_reg = Mess_reg.objects.last() + yesterday = date.today() - timedelta(days=1) + Mess_reg.objects.filter(id=mess_reg.id).update(end_reg=yesterday) + return HttpResponseRedirect('/mess') @transaction.atomic @csrf_exempt @@ -798,7 +811,6 @@ def update_cost(request): user - contains user details """ user = request.user - # extrainfo = ExtraInfo.objects.get(user=user) data = add_bill_base_amount(request) return JsonResponse(data) @@ -825,7 +837,6 @@ def generate_mess_bill(request): t1 = Thread(target=generate_bill, args=()) t1.setDaemon(True) t1.start() - # int = generate_bill() data ={ 'status': 1 } @@ -899,6 +910,7 @@ def menu_change_request(request): return JsonResponse(data) +@csrf_exempt def submit_mess_committee(request): """ This function is to add the new mess committee @@ -910,10 +922,9 @@ def submit_mess_committee(request): current_user - get user from request user_details - extract details and designation of the user from the database """ - roll_number = request.POST['rollnumber'] - + roll_number = str(request.POST.get('roll_number')).upper() data = add_mess_committee(request, roll_number) - return JsonResponse(data) + return HttpResponseRedirect("/mess") def remove_mess_committee(request): @@ -931,10 +942,10 @@ def remove_mess_committee(request): member_id = request.POST['member_id'] data_m = member_id.split("-") roll_number = data_m[1] - if data_m[0] == 'mess_committee_mess1': - designation = Designation.objects.get(name='mess_committee_mess1') - elif data_m[0] == 'mess_convener_mess1': - designation = Designation.objects.get(name='mess_convener_mess1') + if data_m[0] == 'mess_committee': + designation = Designation.objects.get(name='mess_committee') + elif data_m[0] == 'mess_convener': + designation = Designation.objects.get(name='mess_convener') elif data_m[0] == 'mess_committee_mess2': designation = Designation.objects.get(name='mess_committee_mess2') else: @@ -1015,9 +1026,9 @@ def select_mess_convener(request): data_m = member_id.split("-") roll_number = data_m[1] - if data_m[0] == 'mess_committee_mess1': - designation = Designation.objects.get(name='mess_committee_mess1') - new_designation = Designation.objects.get(name='mess_convener_mess1') + if data_m[0] == 'mess_committee': + designation = Designation.objects.get(name='mess_committee') + new_designation = Designation.objects.get(name='mess_convener') # One mess can have only one mess convener existing_check = HoldsDesignation.objects.select_related().filter(designation=new_designation) if existing_check.count(): @@ -1081,27 +1092,6 @@ def download_bill_mess(request): } return render_to_pdf('messModule/billpdfexport.html', context) - -def get_nonveg_order(request): - """ - This function is to apply for non-veg order - - @param: - request - contains metadata about the requested page - - @variables: - current_user - get user from request - user_details - extract details of the user from the database - """ - date_o = request.POST['order_date'] - nonveg_orders_tomorrow = Nonveg_data.objects.select_related('student_id','student_id__id','student_id__id__user','student_id__id__department','dish').filter(order_date=date_o) \ - .values('dish__dish', 'order_interval').annotate(total=Count('dish')) - data = { - 'status': 1, - } - return JsonResponse(data) - - def add_leave_manager(request): """ This function is to apply for leave @@ -1162,3 +1152,211 @@ def add_leave_manager(request): central_mess_notif(request.user, student.id.user, 'leave_request', message) add_obj.save() return HttpResponseRedirect('/mess') + +def update_menu2(request): + if (request.method == "POST"): + mb = request.POST['MB2'] + ml = request.POST['ML2'] + md = request.POST['MD2'] + sud = request.POST['SUD2'] + sul = request.POST['SUL2'] + sub = request.POST['SUB2'] + sd = request.POST['SD2'] + sl = request.POST['SL2'] + sb = request.POST['SB2'] + fd = request.POST['FD2'] + fl = request.POST['FL2'] + fb = request.POST['FB2'] + thd = request.POST['THD2'] + thl = request.POST['THL2'] + thb = request.POST['THB2'] + wd = request.POST['WD2'] + wl = request.POST['WL2'] + wb = request.POST['WB2'] + td = request.POST['TD2'] + tl = request.POST['TL2'] + tb = request.POST['TB2'] + + print("mb", mb) + Menu.objects.filter(mess_option = 'mess2',meal_time='MB').update(dish = mb) + Menu.objects.filter(mess_option = 'mess2',meal_time='ML').update(dish = ml) + Menu.objects.filter(mess_option = 'mess2',meal_time='MD').update(dish = md) + Menu.objects.filter(mess_option = 'mess2',meal_time='TB').update(dish = tb) + Menu.objects.filter(mess_option = 'mess2',meal_time='TL').update(dish = tl) + Menu.objects.filter(mess_option = 'mess2',meal_time='TD').update(dish = td) + Menu.objects.filter(mess_option = 'mess2',meal_time='WB').update(dish = wb) + Menu.objects.filter(mess_option = 'mess2',meal_time='WL').update(dish = wl) + Menu.objects.filter(mess_option = 'mess2',meal_time='WD').update(dish = wd) + Menu.objects.filter(mess_option = 'mess2',meal_time='THB').update(dish = thb) + Menu.objects.filter(mess_option = 'mess2',meal_time='THL').update(dish = thl) + Menu.objects.filter(mess_option = 'mess2',meal_time='THD').update(dish = thd) + Menu.objects.filter(mess_option = 'mess2',meal_time='FB').update(dish = fb) + Menu.objects.filter(mess_option = 'mess2',meal_time='FL').update(dish = fl) + Menu.objects.filter(mess_option = 'mess2',meal_time='FD').update(dish = fd) + Menu.objects.filter(mess_option = 'mess2',meal_time='SB').update(dish = sb) + Menu.objects.filter(mess_option = 'mess2',meal_time='SL').update(dish = sl) + Menu.objects.filter(mess_option = 'mess2',meal_time='SD').update(dish = sd) + Menu.objects.filter(mess_option = 'mess2',meal_time='SUB').update(dish = sub) + Menu.objects.filter(mess_option = 'mess2',meal_time='SUL').update(dish = sul) + Menu.objects.filter(mess_option = 'mess2',meal_time='SUD').update(dish = sud) + + + return redirect('/mess') +def update_menu1(request): + if (request.method == "POST"): + mb1 = request.POST['MB1'] + ml1 = request.POST['ML1'] + md1 = request.POST['MD1'] + sud1 = request.POST['SUD1'] + sul1 = request.POST['SUL1'] + sub1 = request.POST['SUB1'] + sd1 = request.POST['SD1'] + sl1 = request.POST['SL1'] + sb1 = request.POST['SB1'] + fd1 = request.POST['FD1'] + fl1 = request.POST['FL1'] + fb1 = request.POST['FB1'] + thd1 = request.POST['THD1'] + thl1 = request.POST['THL1'] + thb1 = request.POST['THB1'] + wd1 = request.POST['WD1'] + wl1 = request.POST['WL1'] + wb1 = request.POST['WB1'] + td1 = request.POST['TD1'] + tl1 = request.POST['TL1'] + tb1 = request.POST['TB1'] + + print("mb", mb1) + Menu.objects.filter(mess_option = 'mess1',meal_time='MB').update(dish = mb1) + Menu.objects.filter(mess_option = 'mess1',meal_time='ML').update(dish = ml1) + Menu.objects.filter(mess_option = 'mess1',meal_time='MD').update(dish = md1) + Menu.objects.filter(mess_option = 'mess1',meal_time='TB').update(dish = tb1) + Menu.objects.filter(mess_option = 'mess1',meal_time='TL').update(dish = tl1) + Menu.objects.filter(mess_option = 'mess1',meal_time='TD').update(dish = td1) + Menu.objects.filter(mess_option = 'mess1',meal_time='WB').update(dish = wb1) + Menu.objects.filter(mess_option = 'mess1',meal_time='WL').update(dish = wl1) + Menu.objects.filter(mess_option = 'mess1',meal_time='WD').update(dish = wd1) + Menu.objects.filter(mess_option = 'mess1',meal_time='THB').update(dish = thb1) + Menu.objects.filter(mess_option = 'mess1',meal_time='THL').update(dish = thl1) + Menu.objects.filter(mess_option = 'mess1',meal_time='THD').update(dish = thd1) + Menu.objects.filter(mess_option = 'mess1',meal_time='FB').update(dish = fb1) + Menu.objects.filter(mess_option = 'mess1',meal_time='FL').update(dish = fl1) + Menu.objects.filter(mess_option = 'mess1',meal_time='FD').update(dish = fd1) + Menu.objects.filter(mess_option = 'mess1',meal_time='SB').update(dish = sb1) + Menu.objects.filter(mess_option = 'mess1',meal_time='SL').update(dish = sl1) + Menu.objects.filter(mess_option = 'mess1',meal_time='SD').update(dish = sd1) + Menu.objects.filter(mess_option = 'mess1',meal_time='SUB').update(dish = sub1) + Menu.objects.filter(mess_option = 'mess1',meal_time='SUL').update(dish = sul1) + Menu.objects.filter(mess_option = 'mess1',meal_time='SUD').update(dish = sud1) + + return redirect('/mess') + +@csrf_exempt +def searchAddOrRemoveStudent(request): + + if request.method=='GET': + submitType=request.GET.get('type') + msg="" + if submitType=='searchStudent': + studentId=str((request.GET.get('roll_number'))).upper() + try: + mess_optn = Messinfo.objects.select_related().values('mess_option').get(student_id=studentId) + msg= str(studentId)+" is registered for "+str(mess_optn['mess_option']) + except: + msg=str(studentId)+" is not registered for Mess" + elif submitType=='addStudent1' or submitType=='addStudent2': + messNo=request.GET.get('messNo') + studentId = str((request.GET.get('roll_number'))).upper() + try: + mess_optn = Messinfo.objects.select_related().values('mess_option').get(student_id=studentId) + msg=str(studentId)+" is already registered for "+str(mess_optn['mess_option']) + except: + try: + studentHere = Student.objects.select_related('id','id__user','id__department').get(id=studentId) + newData=Messinfo(student_id=studentHere,mess_option=str(messNo)) + newData.save() + msg=str(studentId)+" is successfully registered for Mess." + except: + msg="unable to find this student in database." + elif submitType=='removeStudent': + studentId = str((request.GET.get('roll_number'))).upper() + try: + studentHere = Student.objects.select_related('id','id__user','id__department').get(id=studentId) + data=Messinfo.objects.get(student_id=studentId) + data.delete() + Messinfo.objects.all() + msg=str(studentId)+" is successfully removed from mess." + except: + msg=str(studentId)+" is not registered for mess." + elif (submitType=='removeAllStudent1' or submitType=='removeAllStudent2'): + messNo=request.GET.get('mess') + try: + Messinfo.objects.filter(mess_option=str(messNo)).delete() + msg="All students removed successfully from "+str(messNo) + except: + msg="can't remove students." + + return JsonResponse({'message':msg}) + else: + if(request.FILES): + if 'excelUpload1' in request.POST: + messNo='mess1' + excel_file = request.FILES['excel_file1'] + else: + messNo='mess2' + excel_file = request.FILES['excel_file2'] + + wb = openpyxl.load_workbook(excel_file) + + for row in wb.active: + studentId=(str(row[0].value)).upper() + try: + studentHere = Student.objects.get(id=studentId) + if Messinfo.objects.filter(student_id=studentId).exists(): + Messinfo.objects.filter(student_id=studentId).update(mess_option=str(messNo)) + else: + newData=Messinfo(student_id=studentHere,mess_option=str(messNo)) + newData.save() + except: + 1 + messages.success(request,"Done.") + return HttpResponseRedirect("/mess") + +@csrf_exempt +def uploadPaymentDue(request): + if(request.FILES): + + excel_file = request.FILES['excel_file'] + wb = openpyxl.load_workbook(excel_file) + + for row in wb.active: + studentId=(str(row[0].value)).upper() + amount=(row[1].value) + try: + studentHere = Student.objects.get(id=studentId) + monthly_bill = Monthly_bill.objects.select_related('student_id').filter(student_id=studentHere) + try: + Payments.objects.filter(student_id=studentHere).delete() + except: + 1 + Payments.objects.create(student_id=studentHere,amount_paid=(-1*(amount))) + if amount<=0: + for x in monthly_bill: + Monthly_bill.objects.filter(student_id=studentHere).filter(month=x.month).filter(year=x.year).update(paid=True) + else: + monthly_bill=monthly_bill[::-1] + curr_amount=amount + for x in monthly_bill: + if(curr_amount<=0): + Monthly_bill.objects.filter(student_id=studentHere).filter(month=x.month).filter(year=x.year).update(paid=True) + else: + Monthly_bill.objects.filter(student_id=studentHere).filter(month=x.month).filter(year=x.year).update(paid=False) + curr_amount-=x.total_bill; + print(x) + except: + 1 + messages.success(request,"Done.") + return HttpResponseRedirect("/mess") + + + \ No newline at end of file diff --git a/FusionIIIT/applications/complaint_system/admin.py b/FusionIIIT/applications/complaint_system/admin.py index 84314fcd9..8bf43cab7 100644 --- a/FusionIIIT/applications/complaint_system/admin.py +++ b/FusionIIIT/applications/complaint_system/admin.py @@ -1,8 +1,9 @@ from django.contrib import admin -from .models import Caretaker, StudentComplain, Supervisor, Workers +from .models import Caretaker, StudentComplain, Supervisor, Workers, SectionIncharge admin.site.register(Caretaker) admin.site.register(Workers) admin.site.register(StudentComplain) admin.site.register(Supervisor) +admin.site.register(SectionIncharge) diff --git a/FusionIIIT/applications/complaint_system/api/serializers.py b/FusionIIIT/applications/complaint_system/api/serializers.py index 8a2b97439..b8f34a421 100644 --- a/FusionIIIT/applications/complaint_system/api/serializers.py +++ b/FusionIIIT/applications/complaint_system/api/serializers.py @@ -2,7 +2,7 @@ from rest_framework.authtoken.models import Token from rest_framework import serializers from notifications.models import Notification -from applications.complaint_system.models import Caretaker, StudentComplain, Supervisor, Workers +from applications.complaint_system.models import Caretaker, StudentComplain, Supervisor, Workers, SectionIncharge from applications.globals.models import ExtraInfo,User class StudentComplainSerializers(serializers.ModelSerializer): @@ -21,6 +21,11 @@ class Meta: model = Caretaker fields=('__all__') +class SectionInchargeSerializers(serializers.ModelSerializer): + class Meta: + model = SectionIncharge + fields=('__all__') + class SupervisorSerializers(serializers.ModelSerializer): class Meta: model=Supervisor diff --git a/FusionIIIT/applications/complaint_system/api/urls.py b/FusionIIIT/applications/complaint_system/api/urls.py index 480cd9af7..6d6834ab5 100644 --- a/FusionIIIT/applications/complaint_system/api/urls.py +++ b/FusionIIIT/applications/complaint_system/api/urls.py @@ -1,7 +1,7 @@ from django.conf.urls import url from . import views - + urlpatterns = [ url(r'^user/detail/(?P[0-9]+)/$', views.complaint_details_api,name='complain-detail-get-api'), @@ -9,8 +9,7 @@ url(r'^newcomplain',views.create_complain_api,name='complain-post-api'), url(r'^updatecomplain/(?P[0-9]+)',views.edit_complain_api,name='complain-put-api'), url(r'^removecomplain/(?P[0-9]+)',views.edit_complain_api,name='complain-delete-api'), - - + url(r'^workers',views.worker_api,name='worker-get-api'), url(r'^addworker',views.worker_api,name='worker-post-api'), url(r'^removeworker/(?P[0-9]+)',views.edit_worker_api,name='worker-delete-api'), @@ -21,9 +20,14 @@ url(r'^removecaretaker/(?P[0-9]+)',views.edit_caretaker_api,name='caretaker-delete-api'), url(r'^updatecaretaker/(?P[0-9]+)',views.edit_caretaker_api,name='caretaker-put-api'), + url(r'^secincharges',views.secincharge_api,name='secincharge-get-api'), + url(r'^addsecincharge',views.secincharge_api,name='secincharge-post-api'), + url(r'^removesecincharge/(?P[0-9]+)',views.edit_secincharge_api,name='secincharge-delete-api'), + url(r'^updatesecincharge/(?P[0-9]+)',views.edit_secincharge_api,name='secincharge-put-api'), + url(r'^supervisors',views.supervisor_api,name='supervisor-get-api'), url(r'^addsupervisor',views.supervisor_api,name='supervisor-post-api'), url(r'^removesupervisor/(?P[0-9]+)',views.edit_supervisor_api,name='supervisor-delete-api'), url(r'^updatesupervisor/(?P[0-9]+)',views.edit_supervisor_api,name='supervisor-put-api'), -] +] diff --git a/FusionIIIT/applications/complaint_system/api/views.py b/FusionIIIT/applications/complaint_system/api/views.py index 612c6573c..ab18021c7 100644 --- a/FusionIIIT/applications/complaint_system/api/views.py +++ b/FusionIIIT/applications/complaint_system/api/views.py @@ -10,10 +10,10 @@ from rest_framework.permissions import AllowAny from rest_framework.response import Response from applications.globals.models import User,ExtraInfo -from applications.complaint_system.models import Caretaker, StudentComplain, Supervisor, Workers +from applications.complaint_system.models import Caretaker, StudentComplain, Supervisor, Workers,SectionIncharge from . import serializers - + @api_view(['GET']) @permission_classes([IsAuthenticated]) @authentication_classes([TokenAuthentication]) @@ -23,7 +23,7 @@ def complaint_details_api(request,detailcomp_id1): if complaint_detail.worker_id is None: worker_detail_serialized = {} else : - worker_detail = worker_detail.objects.get(id=complaint_detail.worker_id) + worker_detail = Workers.objects.get(id=complaint_detail.worker_id.id) worker_detail_serialized = serializers.WorkersSerializers(instance=worker_detail).data complainer = User.objects.get(username=complaint_detail.complainer.user.username) complainer_serialized = serializers.UserSerializers(instance=complainer).data @@ -104,8 +104,8 @@ def worker_api(request): user = get_object_or_404(User ,username=request.user.username) user = ExtraInfo.objects.all().filter(user = user).first() try : - caretaker = Caretaker.objects.get(staff_id=user) - except Caretaker.DoesNotExist: + SecIncharge = SectionIncharge.objects.get(staff_id=user) + except SectionIncharge.DoesNotExist: return Response({'message':'Logged in user does not have the permissions'},status=status.HTTP_203_NON_AUTHORITATIVE_INFORMATION) serializer = serializers.WorkersSerializers(data=request.data) if serializer.is_valid(): @@ -120,8 +120,8 @@ def edit_worker_api(request,w_id): user = get_object_or_404(User ,username=request.user.username) user = ExtraInfo.objects.all().filter(user = user).first() try : - caretaker = Caretaker.objects.get(staff_id=user) - except Caretaker.DoesNotExist: + SecIncharge = SectionIncharge.objects.get(staff_id=user) + except SectionIncharge.DoesNotExist: return Response({'message':'Logged in user does not have the permissions'},status=status.HTTP_203_NON_AUTHORITATIVE_INFORMATION) try: worker = Workers.objects.get(id = w_id) @@ -154,7 +154,7 @@ def caretaker_api(request): user = get_object_or_404(User ,username=request.user.username) user = ExtraInfo.objects.all().filter(user = user).first() try : - supervisor = Supervisor.objects.get(staff_id=user) + supervisor = Supervisor.objects.get(sup_id=user) except Supervisor.DoesNotExist: return Response({'message':'Logged in user does not have the permissions'},status=status.HTTP_203_NON_AUTHORITATIVE_INFORMATION) serializer = serializers.CaretakerSerializers(data=request.data) @@ -170,7 +170,7 @@ def edit_caretaker_api(request,c_id): user = get_object_or_404(User ,username=request.user.username) user = ExtraInfo.objects.all().filter(user = user).first() try : - supervisor = Supervisor.objects.get(staff_id=user) + supervisor = Supervisor.objects.get(sup_id=user) except Supervisor.DoesNotExist: return Response({'message':'Logged in user does not have the permissions'},status=status.HTTP_203_NON_AUTHORITATIVE_INFORMATION) try: @@ -187,6 +187,56 @@ def edit_caretaker_api(request,c_id): return Response(serializer.data,status=status.HTTP_200_OK) return Response(serializer.errors,status=status.HTTP_400_BAD_REQUEST) +@api_view(['GET','POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def secincharge_api(request): + + if request.method == 'GET': + secincharge = SectionIncharge.objects.all() + secincharges = serializers.SectionInchargeSerializers(secincharge,many=True).data + resp = { + 'secincharges' : secincharges, + } + return Response(data=resp,status=status.HTTP_200_OK) + + elif request.method == 'POST': + user = get_object_or_404(User ,username=request.user.username) + user = ExtraInfo.objects.all().filter(user = user).first() + try : + supervisor = Supervisor.objects.get(sup_id=user) + except Supervisor.DoesNotExist: + return Response({'message':'Logged in user does not have the permissions'},status=status.HTTP_203_NON_AUTHORITATIVE_INFORMATION) + serializer = serializers.SectionInchargeSerializers(data=request.data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data,status=status.HTTP_201_CREATED) + return Response(serializer.errors,status=status.HTTP_400_BAD_REQUEST) + +@api_view(['DELETE','PUT']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def edit_secincharge_api(request,c_id): + user = get_object_or_404(User ,username=request.user.username) + user = ExtraInfo.objects.all().filter(user = user).first() + try : + supervisor = Supervisor.objects.get(sup_id=user) + except Supervisor.DoesNotExist: + return Response({'message':'Logged in user does not have the permissions'},status=status.HTTP_203_NON_AUTHORITATIVE_INFORMATION) + try: + secincharge = SectionIncharge.objects.get(id = c_id) + except SectionIncharge.DoesNotExist: + return Response({'message': 'The Section Incharge does not exist'}, status=status.HTTP_404_NOT_FOUND) + if request.method == 'DELETE': + secincharge.delete() + return Response({'message': 'Section Incharge deleted'},status=status.HTTP_404_NOT_FOUND) + elif request.method == 'PUT': + serializer = serializers.SectionInchargeSerializers(secincharge,data=request.data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data,status=status.HTTP_200_OK) + return Response(serializer.errors,status=status.HTTP_400_BAD_REQUEST) + @api_view(['GET','POST']) @permission_classes([IsAuthenticated]) @authentication_classes([TokenAuthentication]) @@ -220,10 +270,10 @@ def edit_supervisor_api(request,s_id): try: supervisor = Supervisor.objects.get(id = s_id) except Supervisor.DoesNotExist: - return Response({'message': 'The Caretaker does not exist'}, status=status.HTTP_404_NOT_FOUND) + return Response({'message': 'The Supervisor does not exist'}, status=status.HTTP_404_NOT_FOUND) if request.method == 'DELETE': supervisor.delete() - return Response({'message': 'Caretaker deleted'},status=status.HTTP_404_NOT_FOUND) + return Response({'message': 'Supervisor deleted'},status=status.HTTP_404_NOT_FOUND) elif request.method == 'PUT': serializer = serializers.SupervisorSerializers(supervisor,data=request.data) if serializer.is_valid(): diff --git a/FusionIIIT/applications/complaint_system/migrations/0002_auto_20230321_0050.py b/FusionIIIT/applications/complaint_system/migrations/0002_auto_20230321_0050.py new file mode 100644 index 000000000..224e44cb5 --- /dev/null +++ b/FusionIIIT/applications/complaint_system/migrations/0002_auto_20230321_0050.py @@ -0,0 +1,47 @@ +# Generated by Django 3.1.5 on 2023-03-21 00:50 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0001_initial'), + ('complaint_system', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='workers', + name='caretaker_id', + ), + migrations.AlterField( + model_name='caretaker', + name='area', + field=models.CharField(choices=[('hall-1', 'hall-1'), ('hall-3', 'hall-3'), ('hall-4', 'hall-4'), ('library', 'CC1'), ('computer center', 'CC2'), ('core_lab', 'core_lab'), ('LHTC', 'LHTC'), ('NR2', 'NR2'), ('NR3', 'NR3'), ('Admin building', 'Admin building'), ('Rewa_Residency', 'Rewa_Residency'), ('Maa Saraswati Hostel', 'Maa Saraswati Hostel'), ('Nagarjun Hostel', 'Nagarjun Hostel'), ('Panini Hostel', 'Panini Hostel')], default='hall-3', max_length=20), + ), + migrations.AlterField( + model_name='studentcomplain', + name='location', + field=models.CharField(choices=[('hall-1', 'hall-1'), ('hall-3', 'hall-3'), ('hall-4', 'hall-4'), ('library', 'CC1'), ('computer center', 'CC2'), ('core_lab', 'core_lab'), ('LHTC', 'LHTC'), ('NR2', 'NR2'), ('NR3', 'NR3'), ('Admin building', 'Admin building'), ('Rewa_Residency', 'Rewa_Residency'), ('Maa Saraswati Hostel', 'Maa Saraswati Hostel'), ('Nagarjun Hostel', 'Nagarjun Hostel'), ('Panini Hostel', 'Panini Hostel')], max_length=20), + ), + migrations.AlterField( + model_name='supervisor', + name='area', + field=models.CharField(choices=[('hall-1', 'hall-1'), ('hall-3', 'hall-3'), ('hall-4', 'hall-4'), ('library', 'CC1'), ('computer center', 'CC2'), ('core_lab', 'core_lab'), ('LHTC', 'LHTC'), ('NR2', 'NR2'), ('NR3', 'NR3'), ('Admin building', 'Admin building'), ('Rewa_Residency', 'Rewa_Residency'), ('Maa Saraswati Hostel', 'Maa Saraswati Hostel'), ('Nagarjun Hostel', 'Nagarjun Hostel'), ('Panini Hostel', 'Panini Hostel')], max_length=20), + ), + migrations.CreateModel( + name='SectionIncharge', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('work_type', models.CharField(choices=[('Electricity', 'Electricity'), ('carpenter', 'carpenter'), ('plumber', 'plumber'), ('garbage', 'garbage'), ('dustbin', 'dustbin'), ('internet', 'internet'), ('other', 'other')], default='Electricity', max_length=20)), + ('staff_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='globals.extrainfo')), + ], + ), + migrations.AddField( + model_name='workers', + name='secincharge_id', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='complaint_system.sectionincharge'), + ), + ] diff --git a/FusionIIIT/applications/complaint_system/migrations/0003_auto_20230402_1739.py b/FusionIIIT/applications/complaint_system/migrations/0003_auto_20230402_1739.py new file mode 100644 index 000000000..395b0cb40 --- /dev/null +++ b/FusionIIIT/applications/complaint_system/migrations/0003_auto_20230402_1739.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.5 on 2023-04-02 17:39 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('complaint_system', '0002_auto_20230321_0050'), + ] + + operations = [ + migrations.AlterField( + model_name='studentcomplain', + name='details', + field=models.TextField(), + ), + migrations.AlterField( + model_name='studentcomplain', + name='specific_location', + field=models.CharField(blank=True, max_length=100), + ), + ] diff --git a/FusionIIIT/applications/complaint_system/models.py b/FusionIIIT/applications/complaint_system/models.py index 9f8849e69..7fbef5857 100644 --- a/FusionIIIT/applications/complaint_system/models.py +++ b/FusionIIIT/applications/complaint_system/models.py @@ -12,11 +12,13 @@ class Constants: ('hall-1', 'hall-1'), ('hall-3', 'hall-3'), ('hall-4', 'hall-4'), - ('CC1', 'CC1'), - ('CC2', 'CC2'), + ('library', 'CC1'), + ('computer center', 'CC2'), ('core_lab', 'core_lab'), ('LHTC', 'LHTC'), ('NR2', 'NR2'), + ('NR3', 'NR3'), + ('Admin building', 'Admin building'), ('Rewa_Residency', 'Rewa_Residency'), ('Maa Saraswati Hostel', 'Maa Saraswati Hostel'), ('Nagarjun Hostel', 'Nagarjun Hostel'), @@ -44,9 +46,16 @@ class Caretaker(models.Model): def __str__(self): return str(self.id) + '-' + self.area +class SectionIncharge(models.Model): + staff_id = models.ForeignKey(ExtraInfo, on_delete=models.CASCADE) + work_type = models.CharField(choices=Constants.COMPLAINT_TYPE, + max_length=20, default='Electricity') + + def __str__(self): + return str(self.id) + '-' + self.work_type class Workers(models.Model): - caretaker_id = models.ForeignKey(Caretaker, on_delete=models.CASCADE) + secincharge_id = models.ForeignKey(SectionIncharge, on_delete=models.CASCADE, null=True) name = models.CharField(max_length=50) age = models.CharField(max_length=10) phone = models.BigIntegerField(blank=True) @@ -64,8 +73,8 @@ class StudentComplain(models.Model): complaint_type = models.CharField(choices=Constants.COMPLAINT_TYPE, max_length=20, default='internet') location = models.CharField(max_length=20, choices=Constants.AREA) - specific_location = models.CharField(max_length=50, blank=True) - details = models.CharField(max_length=100) + specific_location = models.CharField(max_length=100, blank=True) + details = models.TextField() status = models.IntegerField(default='0') remarks = models.CharField(max_length=300, default="Pending") flag = models.IntegerField(default='0') @@ -83,6 +92,6 @@ def __str__(self): class Supervisor(models.Model): sup_id = models.ForeignKey(ExtraInfo, on_delete=models.CASCADE) area = models.CharField(choices=Constants.AREA, max_length=20) - + def __str__(self): - return str(self.sup_id.user.username) + return str(self.sup_id.user.username) \ No newline at end of file diff --git a/FusionIIIT/applications/complaint_system/urls.py b/FusionIIIT/applications/complaint_system/urls.py index b95605ade..22d2cd959 100644 --- a/FusionIIIT/applications/complaint_system/urls.py +++ b/FusionIIIT/applications/complaint_system/urls.py @@ -7,45 +7,40 @@ urlpatterns = [ url(r'^$', views.check, name='complaint'), - # url(r'^login/$', views.login1, name='complaint'), + url(r'^login/$', views.login1, name='complaint'), url(r'^user/$', views.user), - url(r'^user/caretakerfb/$' , views.caretaker_feedback), - url(r'^user/(?P[0-9]+)/$', views.submitfeedback), url(r'^user/detail/(?P[0-9]+)/$', views.detail,name='detail'), - # url(r'^user/check_complaint/$', views.save_comp), - + url(r'^user/check_complaint/$', views.save_comp), # caretaker url(r'^caretaker/$', views.caretaker, name='caretaker'), url(r'^caretaker/feedback/(?P[0-9]+)/$', views.feedback_care), - url(r'^caretaker/worker_id_know_more/(?P[0-9]+)/complaint_reassign/(?P[0-9]+)/discharge_worker/$', views.discharge_worker,name='discharge_worker'), - url(r'^caretaker/worker_id_know_more/(?P[0-9]+)/$', views.worker_id_know_more, name='come_back_to_this'), - url(r'^caretaker/worker_id_know_more/(?P[0-9]+)/complaint_reassign/(?P[0-9]+)/$', views.complaint_reassign), - #url(r'^caretaker/list_caretakers_area/$', views.caretaker, name='caretaker'), url(r'^caretaker/pending/(?P[0-9]+)/$', views.resolvepending), - url(r'^caretaker/detail2/(?P[0-9]+)/$', views.detail2,name='detail2'), + url(r'^caretaker/detail/(?P[0-9]+)/$', views.detail), url(r'^caretaker/search_complaint$', views.search_complaint), - - + url(r'^caretaker/(?P[0-9]+)/(?P[0-9]+)/$', views.changestatus), + + # secincharge + url(r'^secincharge/$', views.section_incharge, name='secincharge'), + url(r'^secincharge/feedback/(?P[0-9]+)/$', views.feedback_care), + url(r'^secincharge/worker_id_know_more/(?P[0-9]+)/complaint_reassign/(?P[0-9]+)/discharge_worker/$', views.discharge_worker,name='discharge_worker'), + url(r'^secincharge/worker_id_know_more/(?P[0-9]+)/$', views.worker_id_know_more, name='come_back_to_this'), + url(r'^secincharge/worker_id_know_more/(?P[0-9]+)/complaint_reassign/(?P[0-9]+)/$', views.complaint_reassign, name='complaint_reassign'), + url(r'^secincharge/detail2/(?P[0-9]+)/$', views.detail2,name='detail2'), + url(r'^secincharge/worker_id_know_more/(?P[0-9]+)/removew/$', views.removew), + url(r'^secincharge/(?P[0-9]+)/$', views.assign_worker,name='assign_worker'), + url(r'^secincharge/deletecomplaint/(?P[0-9]+)/$', views.deletecomplaint), + # supervisor url(r'^supervisor/$', views.supervisor), url(r'^supervisor/feedback/(?P[0-9]+)/$', views.feedback_super), url(r'^supervisor/caretaker_id_know_more/(?P[0-9]+)/$', views.caretaker_id_know_more), url(r'^supervisor/caretaker_id_know_more/(?P[0-9]+)/complaint_reassign_super/(?P[0-9]+)/$', views.complaint_reassign_super, name = 'complaint_reassign_super'), - url(r'^supervisor/detail3/(?P[0-9]+)/$', views.detail3, name = 'detail3'), - - + url(r'^supervisor/detail3/(?P[0-9]+)/$', views.detail3, name = 'detail3'), - - # CRUD task - url(r'^caretaker/worker_id_know_more/(?P[0-9]+)/removew/$', views.removew), - url(r'^caretaker/(?P[0-9]+)/$', views.assign_worker,name='assign_worker'), - url(r'^caretaker/deletecomplaint/(?P[0-9]+)/$', views.deletecomplaint), - # url(r'^caretaker/(?P[0-9]+)/$', views.assign_worker), - url(r'^caretaker/(?P[0-9]+)/(?P[0-9]+)/$', views.changestatus), - + # api's for complaint system url(r'^api/',include('applications.complaint_system.api.urls')) ] \ No newline at end of file diff --git a/FusionIIIT/applications/complaint_system/views.py b/FusionIIIT/applications/complaint_system/views.py index b566856aa..a9b916e35 100644 --- a/FusionIIIT/applications/complaint_system/views.py +++ b/FusionIIIT/applications/complaint_system/views.py @@ -7,12 +7,14 @@ from django.contrib.auth.decorators import login_required from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404, render -from applications.globals.models import User , ExtraInfo, HoldsDesignation +from applications.globals.models import User , ExtraInfo, HoldsDesignation, Designation from notifications.models import Notification -from .models import Caretaker, StudentComplain, Supervisor, Workers +from .models import Caretaker, StudentComplain, Supervisor, Workers, SectionIncharge from notification.views import complaint_system_notif -#function for reassign to another worker + + +#for SectionIncharge @login_required def complaint_reassign(request,wid,iid): current_user = get_object_or_404(User, username=request.user.username) @@ -26,64 +28,63 @@ def complaint_reassign(request,wid,iid): complaint_finish = request.POST.get('complaint_finish', '') worker_id = request.POST.get('assign_worker', '') - w = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=worker_id) + w = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=worker_id) StudentComplain.objects.select_for_update().filter(id=iid).\ update(worker_id=w, status=1) - url = '/complaint/caretaker/worker_id_know_more/'+wid; - complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=iid) + url = '/complaint/secincharge/worker_id_know_more/'+wid; + complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=iid) student=0 message = "Your complaint has been re-assigned" complaint_system_notif(request.user, complainer_details.complainer.user ,'reassign_worker_alert',complainer_details.id,student,message) return HttpResponseRedirect(url) + elif type == 'redirect': - assign_caretaker = request.POST.get('assign_caretaker', '') - c = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(id=assign_caretaker) - c1 = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(id=iid) - remark = 'Redirect complaint from ' + c1.area + assign_secincharge = request.POST.get('assign_secincharge', '') + c = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(id=assign_secincharge) + c1 = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(id=iid) + remark = 'Redirect complaint from ' + c1.work_type StudentComplain.objects.select_for_update().filter(id=iid).\ - update(location=c.area, remarks=remark) - url = '/complaint/caretaker/worker_id_know_more/'+wid; - complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=iid) + update(complaint_type=c.work_type, remarks=remark) + url = '/complaint/secincharge/worker_id_know_more/'+wid; + complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=iid) student=0 - message = "Your complaint has been redirected to another caretaker" + message = "Your complaint has been redirected to another secincharge" complaint_system_notif(request.user, complainer_details.complainer.user ,'comp_redirect_alert',complainer_details.id,student,message) return HttpResponseRedirect(url) else: y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) - a = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) - b = a.area + a = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) + b = a.work_type comp_id = y.id try: - detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=iid).first() - total_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').all() - total_caretakers_in_area = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=b) + detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(id=iid).first() + total_secincharge = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').all() + print(total_secincharge) worker = [] workertemp = [] flag = '' temp = detail.location try: - if Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').filter(caretaker_id=a).count() == 0: + if Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').filter(secincharge_id=a).count() == 0: flag = 'no_worker' else: - workertemp = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').filter(caretaker_id=a) + workertemp = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').filter(secincharge_id=a) j = 1 for i in workertemp: worker.append(i) - # if j%2 != 0: - # worker.append(i) - # j = j + 1 - - except Caretaker.DoesNotExist: + except SectionIncharge.DoesNotExist: flag = 'no_worker' except StudentComplain.DoesNotExist: return HttpResponse("

Not a valid complaint

") return render(request, "complaintModule/reassignworker.html", {'detail': detail, 'worker': worker, 'flag': - flag, 'total_caretaker': total_caretaker,'a':a, 'wid':wid, 'total_caretakers_in_area':total_caretakers_in_area}) + flag, 'total_secincharge': total_secincharge,'a':a, 'wid':wid}) + + @login_required def complaint_reassign_super(request,caretaker_id,iid): @@ -97,9 +98,7 @@ def complaint_reassign_super(request,caretaker_id,iid): comp_id = y.id - - - +#for SectionIncharge @login_required def assign_worker(request, comp_id1): current_user = get_object_or_404(User, username=request.user.username) @@ -124,85 +123,77 @@ def assign_worker(request, comp_id1): if type == 'assign': complaint_finish = request.POST.get('complaint_finish', '') worker_id = request.POST.get('assign_worker', '') - w = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=worker_id) - StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').select_for_update().filter(id=comp_id1).\ + w = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=worker_id) + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').select_for_update().filter(id=comp_id1).\ update(worker_id=w, status=1) - complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=comp_id1) + complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=comp_id1) student = 0 message = "Worker has been assigned to your complaint" complaint_system_notif(request.user, complainer_details.complainer.user ,'assign_worker_alert',complainer_details.id,student,message) - - return HttpResponseRedirect('/complaint/caretaker/') + return HttpResponseRedirect('/complaint/secincharge/') + elif type == 'redirect': - assign_caretaker = request.POST.get('assign_caretaker', '') - c = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(id=assign_caretaker) - c1 = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(id=comp_id) - remark = 'Redirect complaint from ' + c1.area + assign_secincharge = request.POST.get('assign_secincharge','') + c = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(id=assign_secincharge) + c1 = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=comp_id) + remark = 'Redirect complaint from ' + c1.work_type StudentComplain.objects.select_for_update().filter(id=comp_id1).\ - update(location=c.area, remarks=remark) - complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=comp_id1) + update(complaint_type=c.work_type, remarks=remark) + complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=comp_id1) student=0 - message = "Your Complaint has been redirected to another caretaker" + message = "Your Complaint has been redirected to another secincharge" complaint_system_notif(request.user, complainer_details.complainer.user ,'comp_redirect_alert',complainer_details.id,student,message) - return HttpResponseRedirect('/complaint/caretaker/') + return HttpResponseRedirect('/complaint/secincharge/') + else: y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) - a = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) - b = a.area + a = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) + b = a.work_type comp_id = y.id try: - detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=comp_id1).first() - total_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').all() - total_caretakers_in_area = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=b and id!=a.id) + detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(id=comp_id1).first() + total_secincharge = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').all() workertemp = [] worker = [] flag = '' temp = detail.location try: - #care = Caretaker.objects.filter(area=temp).first() - if Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').filter(caretaker_id=a).count() == 0: + if Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').filter(secincharge_id=a).count() == 0: flag = 'no_worker' else: - workertemp1 = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').filter(caretaker_id=a) + workertemp1 = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').filter(secincharge_id=a) workertemp = workertemp1.filter(worker_type=detail.complaint_type) j = 1 for i in workertemp: worker.append(i) - # if j%2 != 0: - # worker.append(i) - # j = j + 1 - - - except Caretaker.DoesNotExist: + + except SectionIncharge.DoesNotExist: flag = 'no_worker' except StudentComplain.DoesNotExist: return HttpResponse("

Not a valid complaint

") return render(request, "complaintModule/assignworker.html", {'detail': detail, 'worker': worker, 'flag': - flag, 'total_caretaker': total_caretaker,'a':a, 'total_caretakers_in_area':total_caretakers_in_area}) + flag, 'total_secincharge': total_secincharge,'a':a}) + +#for SectionIncharge @login_required def discharge_worker(request,wid,cid): current_user = get_object_or_404(User, username=request.user.username) y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() - this_worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=wid) - com_in_concern= StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=cid); + this_worker = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=wid) + com_in_concern= StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=cid); com_in_concern.worker_id=None; com_in_concern.status=0; StudentComplain.objects.select_for_update().filter(id=cid).\ update(worker_id=None, status=0) - #StudentComplain.objects.get(id=cid).delete() - url='/complaint/caretaker/detail2/'+cid; + url='/complaint/secincharge/detail2/'+cid; return HttpResponseRedirect(url) - - - - @login_required def caretaker_feedback(request): """ @@ -234,23 +225,23 @@ def caretaker_feedback(request): return render(request, "complaintModule/submit_feedback_caretaker.html", {'a': a}) +#for SectionIncharge @login_required def worker_id_know_more(request, work_id): """ function to know pending complaints assigned to the worker """ - this_worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=work_id) - num = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(worker_id=this_worker).count(); - complaints_list = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(worker_id=this_worker); + this_worker = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=work_id) + num = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(worker_id=this_worker).count(); + complaints_list = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(worker_id=this_worker); complaints_list_onhold = [] for i in complaints_list: if i.status == 1: complaints_list_onhold.append(i) numpend = len(complaints_list_onhold) - work_under_caretaker1 = this_worker.caretaker_id.staff_id.user.first_name - work_under_caretaker2 = this_worker.caretaker_id.staff_id.user.last_name - return render(request, "complaintModule/worker_id_know_more.html",{'this_worker':this_worker,'work_under_caretaker1':work_under_caretaker1,'work_under_caretaker2':work_under_caretaker2, 'num':num, 'complaints_list':complaints_list, 'complaints_list_onhold':complaints_list_onhold, 'numpend':numpend}) - + work_under_secincharge1 = this_worker.secincharge_id.staff_id.user.first_name + work_under_secincharge2 = this_worker.secincharge_id.staff_id.user.last_name + return render(request, "complaintModule/worker_id_know_more.html",{'this_worker':this_worker,'work_under_secincharge1':work_under_secincharge1,'work_under_secincharge2':work_under_secincharge2, 'num':num, 'complaints_list':complaints_list, 'complaints_list_onhold':complaints_list_onhold, 'numpend':numpend}) @@ -286,9 +277,15 @@ def check(request): if b.user_type == 'student': return HttpResponseRedirect('/complaint/user/') elif b.user_type == 'staff': - return HttpResponseRedirect('/complaint/caretaker/') + if SectionIncharge.objects.all().select_related('work_type').filter(staff_id=b).count() == 0: + return HttpResponseRedirect('/complaint/caretaker/') + else: + return HttpResponseRedirect('/complaint/secincharge/') elif b.user_type == 'faculty': - return HttpResponseRedirect('/complaint/supervisor/') + if Supervisor.objects.all().filter(sup_id=b).count() == 0: + return HttpResponseRedirect('/complaint/user/') + else: + return HttpResponseRedirect('/complaint/supervisor/') else: return HttpResponse("

wrong user credentials

") else: @@ -341,17 +338,6 @@ def user(request): y = ExtraInfo.objects.all().select_related('user','department').get(id=comp_id) #check if location given if location!="": - # x = StudentComplain(complainer=y, - # complaint_type=comp_type, - # location=location, - # specific_location=specific_location, - # details=details, - # status=status, - # complaint_finish=complaint_finish, - # upload_complaint=comp_file) - - - # x.save() obj1, created = StudentComplain.objects.get_or_create(complainer=y, complaint_type=comp_type, location=location, @@ -362,26 +348,17 @@ def user(request): upload_complaint=comp_file) - historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).order_by('-id') + historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(complainer=y).order_by('-id') history = [] j = 1 k = 1 for i in historytemp: history.append(i) - # if j%2 != 0: - # history.append(i) - # j = j+1 - - + for h in history: h.serial_no = k k = k+1 - # if location == "hall1": - # dsgn = "hall1caretaker" - # elif location == "hall3": - # dsgn = "hall3caretaker" - # else : - # dsgn = "hall4caretaker" + if location == "hall-1": dsgn ="hall1caretaker" elif location =="hall-3": @@ -407,16 +384,14 @@ def user(request): else: dsgn = "rewacaretaker" caretaker_name = HoldsDesignation.objects.select_related('user','working','designation').get(designation__name = dsgn) - + secincharge_name = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(work_type = comp_type) + # This is to allow the student - student = 1 + student = 0 message = "A New Complaint has been lodged" complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert',obj1.id,student,message) - - # return render(request, "complaintModule/complaint_user.html", - # {'history': history, 'comp_id': comp_id }) - # next = request.POST.get('next', '/') + complaint_system_notif(request.user, secincharge_name.staff_id.user,'lodge_comp_alert',obj1.id,1,message) messages.success(request,message) return HttpResponseRedirect('/complaint/user') @@ -424,58 +399,25 @@ def user(request): else: a = get_object_or_404(User, username=request.user.username) y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() - historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).order_by('-id') + historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(complainer=y).order_by('-id') history=[] notification = Notification.objects.filter(recipient=a.id) notification = notification.filter(data__exact={'url':'complaint:detail','module':'Complaint System'}) - # notification_message = [] - # for notification in x: - # to = User.objects.get(id=notification.actor_object_id).username - # from django.utils.timesince import timesince as timesince_ - # duration = timesince_(notification.timestamp,None) - # notification_message.append(notification.verb+' by '+ to + ' ' + duration + ' ago ') - - - j = 1 for i in historytemp: history.append(i) - # if j%2 != 0: - # history.append(i) - # j = j+1 - + for i in history: i.serial_no = j j = j+1 - # if location == "hall-1": - # dsgn ="hall1caretaker" - # elif location =="hall-3": - # dsgn ="hall3caretaker" - # elif location =="hall-4": - # dsgn ="hall4caretaker" - # elif location =="CC1": - # dsgn ="CC convenor" - # elif location =="CC2": - # dsgn ="CC2 convener" - # elif location == "core_lab": - # dsgn = "corelabcaretaker" - # elif location =="LHTC": - # dsgn ="lhtccaretaker" - # elif location =="NR2": - # dsgn ="nr2caretaker" - # else: - # dsgn = "rewacaretaker" - # caretaker_name = HoldsDesignation.objects.get(designation__name = dsgn) - # complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert') return render(request, "complaintModule/complaint_user.html", {'history': history,'notification':notification, 'comp_id': y.id}) - return render(request, "complaintModule/complaint_user.html", - {'history': history, 'comp_id': comp_id }) + @login_required def save_comp(request): """ @@ -523,14 +465,154 @@ def save_comp(request): upload_complaint =comp_file) x.save() - # messages.info(request,'Complaint successfully launched.') - # return HttpResponseRedirect('/complaint/user/') + return HttpResponseRedirect('/complaint/user/') + + @login_required def caretaker(request): """ - The function is used to display details to the caretaker such as registered complaints and allows to assign workers + The function is used to display details to the caretaker such as registered complaints + @param: + request - trivial. + + + @variables: + issue - The issue object. + supported - True if the user's intention is to support the issue. + support_count - Total supporters of the above issue. + context - Holds data needed to make necessary changes in the template. + """ + current_user = get_object_or_404(User, username=request.user.username) + y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() + comp_id = y.id + if request.method == 'POST': + comp_type = request.POST.get('complaint_type', '') + location = request.POST.get('Location', '') + specific_location = request.POST.get('specific_location', '') + comp_file = request.FILES.get('myfile') + + details = request.POST.get('details', '') + status = 0 + # finish time is according to complaint type + complaint_finish = datetime.now() + timedelta(days=2) + if comp_type == 'Electricity': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'carpenter': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'plumber': + complaint_finish = datetime.now() + timedelta(days=2) + elif comp_type == 'garbage': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'dustbin': + complaint_finish = datetime.now() + timedelta(days=1) + elif comp_type == 'internet': + complaint_finish = datetime.now() + timedelta(days=4) + elif comp_type == 'other': + complaint_finish = datetime.now() + timedelta(days=3) + y = ExtraInfo.objects.all().select_related('user','department').get(id=comp_id) + #check if location given + if location!="": + obj1, created = StudentComplain.objects.get_or_create(complainer=y, + complaint_type=comp_type, + location=location, + specific_location=specific_location, + details=details, + status=status, + complaint_finish=complaint_finish, + upload_complaint=comp_file) + + + historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(complainer=y).order_by('-id') + history = [] + j = 1 + k = 1 + for i in historytemp: + history.append(i) + + for h in history: + h.serial_no = k + k = k+1 + + if location == "hall-1": + dsgn ="hall1caretaker" + elif location =="hall-3": + dsgn ="hall3caretaker" + elif location =="hall-4": + dsgn ="hall4caretaker" + elif location =="CC1": + dsgn ="cc1convener" + elif location =="CC2": + dsgn ="CC2 convener" + elif location == "core_lab": + dsgn = "corelabcaretaker" + elif location =="LHTC": + dsgn ="lhtccaretaker" + elif location =="NR2": + dsgn ="nr2caretaker" + elif location =="Maa Saraswati Hostel": + dsgn ="mshcaretaker" + elif location =="Nagarjun Hostel": + dsgn ="nhcaretaker" + elif location =="Panini Hostel": + dsgn ="phcaretaker" + else: + dsgn = "rewacaretaker" + caretaker_name = HoldsDesignation.objects.select_related('user','working','designation').get(designation__name = dsgn) + secincharge_name = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(work_type = comp_type) + + + # This is to allow the student + student = 0 + message = "A New Complaint has been lodged" + complaint_system_notif(request.user, caretaker_name.user,'lodge_comp_alert',obj1.id,student,message) + complaint_system_notif(request.user, secincharge_name.staff_id.user,'lodge_comp_alert',obj1.id,1,message) + + messages.success(request,message) + return HttpResponseRedirect('/complaint/caretaker') + + + else: + y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) + a = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) + b = a.area + history = [] + historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(location=b).order_by('-id') + + + overduecomplaint = [] + j = 1 + k = 1 + for i in historytemp: + history.append(i) + + for i in history: + i.serial_no = k + k = k + 1 + + if i.status != 2 and i.status !=3: + if i.complaint_finish < date.today(): + i.delay = date.today() - i.complaint_finish + overduecomplaint.append(i) + + notification = Notification.objects.filter(recipient=current_user.id) + notification = notification.filter(data__exact={'url':'complaint:detail','module':'Complaint System'}) + + + + return render(request, "complaintModule/complaint_caretaker.html", + { 'history': history, 'comp_id': y.id, + 'notification':notification, + 'overduecomplaint': overduecomplaint, 'care_id': a}) + + + +#for SectionIncharge +@login_required +def section_incharge(request): + """ + The function is used to display details to the department head such as registered complaints and allows to assign workers @param: request - trivial. @@ -552,50 +634,44 @@ def caretaker(request): age = request.POST.get('age', '') try: y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) - a = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) + a = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) except Exception as e: a = None y = None intage = int(age) intphone = int(phone) - # if len(phone) == 10 and intage > 20 and intage < 50 and intphone > 1999999999: - # x = Workers(caretaker_id=a, - # name=name, - # age=age, - # phone=phone, - # worker_type=worker_type) - # if not Workers.objects.filter(caretaker_id=a,name=name, age=age,phone=phone,worker_type=worker_type).exists(): - # x.save() + if len(phone) == 10 and intage > 20 and intage < 50 and intphone > 1999999999: + x = Workers(secincharge_id=a, + name=name, + age=age, + phone=phone, + worker_type=worker_type) + if not Workers.objects.filter(secincharge_id=a,name=name, age=age,phone=phone,worker_type=worker_type).exists(): + x.save() if len(phone) == 10 and intage > 20 and intage < 50 and intphone > 1999999999: - obj, created = Workers.objects.get_or_create(caretaker_id=a, + obj, created = Workers.objects.get_or_create( secincharge_id=a, name=name, age=age, phone=phone, worker_type=worker_type) - b = a.area - historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location=b).order_by('-id') + b = a.work_type + historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(complaint_type=b).order_by('-id') history = [] j = 1 k = 1 for i in historytemp: history.append(i) - # if j%2 == 1: - # history.append(i) - # j = j+1 + for h in history: h.serial_no = k k=k+1 total_worker = [] - total_workertemp = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').filter(caretaker_id=a) + total_workertemp = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').filter(secincharge_id=a) j = 1 - # for i in total_workertemp: - # if j%2 != 0: - # total_worker.append(i) - # j = j + 1 for i in total_workertemp: @@ -604,28 +680,27 @@ def caretaker(request): complaint_assign_no = [] for x in total_worker: - worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=x.id) - temp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(worker_id=worker).count() + worker = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=x.id) + temp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(worker_id=worker).count() worker.total_complaint = temp complaint_assign_no.append(worker) notification = Notification.objects.filter(recipient=current_user.id) notification = notification.filter(data__exact={'url':'complaint:detail2','module':'Complaint System'}) - return render(request, "complaintModule/complaint_caretaker.html", + return render(request, "complaintModule/complaint_secincharge.html", {'history': history, 'comp_id': y.id, 'notification': notification, 'total_worker': total_worker, 'complaint_assign_no': complaint_assign_no}) - else: y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) - a = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) - b = a.area + a = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) + b = a.work_type history = [] - historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location=b).order_by('-id') + historytemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(complaint_type=b).order_by('-id') total_worker = [] - total_workertemp = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').filter(caretaker_id=a) + total_workertemp = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').filter(secincharge_id=a) j = 1 for i in total_workertemp: total_worker.append(i) @@ -634,8 +709,8 @@ def caretaker(request): complaint_assign_no = [] for x in total_worker: - worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=x.id) - temp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(worker_id=worker).count() + worker = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=x.id) + temp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(worker_id=worker).count() worker.total_complaint = temp complaint_assign_no.append(worker) @@ -644,9 +719,7 @@ def caretaker(request): k = 1 for i in historytemp: history.append(i) - # if j%2 != 0: - # history.append(i) - # j=j+1 + for i in history: i.serial_no = k k = k + 1 @@ -661,22 +734,24 @@ def caretaker(request): - return render(request, "complaintModule/complaint_caretaker.html", + return render(request, "complaintModule/complaint_secincharge.html", { 'history': history, 'comp_id': y.id, 'total_worker': total_worker, 'complaint_assign_no': total_worker, 'notification':notification, - 'overduecomplaint': overduecomplaint, 'care_id': a}) + 'overduecomplaint': overduecomplaint, 'secincharge_id': a}) + + @login_required def remove_worker_from_complaint(request,complaint_id): """ - The function is used by caretaker to remove a worker + The function is used by secincharge to remove a worker already assigned to a complaint @param: request - trivial complaint_id - used to get complaint_id registered """ - complaint = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complaint_id=complaint_id).update(worker_id='') + complaint = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(complaint_id=complaint_id).update(worker_id='') return HttpResponseRedirect('/complaint/caretaker/') @@ -698,23 +773,26 @@ def changestatus(request, complaint_id, status): context - Holds data needed to make necessary changes in the template. """ if status == '3': - StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=complaint_id).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(id=complaint_id).\ update(status=status, worker_id='') return HttpResponseRedirect('/complaint/caretaker/') elif status == '2': - StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=complaint_id).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(id=complaint_id).\ update(status=status, worker_id='') return HttpResponseRedirect('/complaint/caretaker/') else: - StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=complaint_id).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(id=complaint_id).\ update(status=status) return HttpResponseRedirect('/complaint/caretaker/') + + +#for SectionIncharge @login_required def removew(request, work_id): """ - The function is used by caretaker to remove workers. + The function is used by secincharge to remove workers. @param: request - trivial. work_id - id of the issue object which the user intends to support/unsupport. @@ -725,11 +803,11 @@ def removew(request, work_id): support_count - Total supporters of the above issue. context - Holds data needed to make necessary changes in the template. """ - worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=work_id) - temp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(worker_id=worker).count() + worker = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=work_id) + temp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(worker_id=worker).count() if temp == 0: worker.delete() - return HttpResponseRedirect('/complaint/caretaker/') + return HttpResponseRedirect('/complaint/secincharge/') else: return HttpResponse('

Worker is assign some complaint

') @@ -752,9 +830,9 @@ def submitfeedback(request, complaint_id): if request.method == 'POST': feedback = request.POST.get('feedback', '') rating = request.POST.get('rating', '') - StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=complaint_id).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(id=complaint_id).\ update(feedback=feedback, flag=rating) - a = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=complaint_id).first() + a = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(id=complaint_id).first() care = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=a.location).first() rate = care.rating newrate = 0 @@ -768,27 +846,26 @@ def submitfeedback(request, complaint_id): Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=a.location).update(rating=newrate) return HttpResponseRedirect('/complaint/user/') - return render(request,"complaintModule/feedback.html",{'a' : a}) else: - a = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=complaint_id) + a = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=complaint_id) return render(request, "complaintModule/submit_feedback.html", {'a': a}) - - +#for SectionIncharge @login_required def deletecomplaint(request, comp_id1): """ function to delete complaint """ StudentComplain.objects.get(id=comp_id1).delete() - return HttpResponseRedirect('/complaint/caretaker/') + return HttpResponseRedirect('/complaint/secincharge/') + + def testEntry(): - # list1 = [('SKM','hall-1'),('HS','hall-3'),('PS','hall-4'),('MSR','Maa Saraswati Hostel'),('KKB','Maa Saraswati Hostel'), ('RP','Nagarjun Hostel'),('DS','Nagarjun Hostel'),('AV','Panini Hostel')] list1 = [('eecivil','NR2'),('eecivil','Rewa_Residency'),('eecivil','LHTC'),('eecivil','core_lab')] # to delete supervisors @@ -823,26 +900,63 @@ def supervisor(request): current_user = get_object_or_404(User, username=request.user.username) y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() + all_staff = ExtraInfo.objects.all().select_related('user','department').filter(user_type='staff') + total_staff = [] + for i in all_staff: + if not SectionIncharge.objects.filter(staff_id=i.id).exists(): + total_staff.append(i) + if request.method == 'POST' : + print("post method called") try: y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) a = Supervisor.objects.select_related('sup_id','sup_id__user','sup_id__department').get(sup_id=y) except Exception as e: a = None y = None + caretaker_new = request.POST.get('caretaker_new','') + caretaker_prev = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=a.area).first() + caretaker_new_user = ExtraInfo.objects.get(id=caretaker_new).user + if a.area == "hall-1": + dsgn ="hall1caretaker" + elif a.area =="hall-3": + dsgn ="hall3caretaker" + elif a.area =="hall-4": + dsgn ="hall4caretaker" + elif a.area =="CC1": + dsgn ="cc1convener" + elif a.area =="CC2": + dsgn ="CC2convener" + elif a.area == "core_lab": + dsgn = "corelabcaretaker" + elif a.area =="LHTC": + dsgn ="lhtccaretaker" + elif a.area =="NR2": + dsgn ="nr2caretaker" + elif a.area =="Maa Saraswati Hostel": + dsgn ="mshcaretaker" + elif a.area =="Nagarjun Hostel": + dsgn ="nhcaretaker" + elif a.area =="Panini Hostel": + dsgn ="phcaretaker" + else: + dsgn = "rewacaretaker" + dsgn = Designation.objects.get(name = dsgn) + + HoldsDesignation.objects.select_for_update().filter(designation = dsgn).\ + update(user=caretaker_new_user, working=caretaker_new_user) + Caretaker.objects.select_for_update().filter(id=caretaker_prev.id).\ + update(staff_id=caretaker_new) all_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=a.area).order_by('-id') area = all_caretaker[0].area - # ExtraInfo.objects.get(id=sup_id) all_complaint = [] - numtemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location = area).filter(status = 0).count() + numtemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(location = area).filter(status = 0).count() num = int(numtemp/2+0.5) - all_complainttemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location=a.area).order_by('-id') + all_complainttemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(location=a.area).order_by('-id') j = 1 for i in all_complainttemp: all_complaint.append(i) - # if j%2 != 0: - # all_complaint.append(i) - # j = j + 1 + overduecomplaint = [] for i in all_complaint: if i.status != 2 and i.status != 3: @@ -851,7 +965,7 @@ def supervisor(request): overduecomplaint.append(i) return render(request, "complaintModule/supervisor1.html", - {'all_caretaker': all_caretaker, 'all_complaint': all_complaint, + {'total_staff': total_staff, 'all_caretaker': all_caretaker, 'all_complaint': all_complaint, 'overduecomplaint': overduecomplaint, 'area': area,'num':num}) else: print('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') @@ -861,16 +975,14 @@ def supervisor(request): except : return HttpResponseRedirect('/') - #print(a) - # if(len(a)==0) : - # return render('../dashboard/') + a = Supervisor.objects.select_related('sup_id','sup_id__user','sup_id__department').get(sup_id=y) all_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=a.area).order_by('-id') area = all_caretaker[0].area - numtemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location = area).filter(status = 0).count() + numtemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(location = area).filter(status = 0).count() num = int(numtemp/2+0.5) all_complaint = [] - all_complainttemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location=a.area).order_by('-id') + all_complainttemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(location=a.area).order_by('-id') j = 1 for i in all_complainttemp: all_complaint.append(i) @@ -885,7 +997,7 @@ def supervisor(request): overduecomplaint.append(i) return render(request, "complaintModule/supervisor1.html", - {'all_caretaker': all_caretaker, 'all_complaint': all_complaint, + {'total_staff': total_staff, 'all_caretaker': all_caretaker, 'all_complaint': all_complaint, 'overduecomplaint': overduecomplaint, 'area': area, 'num' : num}) @login_required @@ -893,15 +1005,12 @@ def caretaker_id_know_more(request,caretaker_id): this_caretaker = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(id = caretaker_id) this_caretaker_area = this_caretaker.area; list_pending_complaints = [] - list_pending_complaintstemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(location = this_caretaker_area).filter(status = 0) + list_pending_complaintstemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(location = this_caretaker_area).filter(status = 0) j = 1 for i in list_pending_complaintstemp: list_pending_complaints.append(i) - # if j%2 != 0: - # list_pending_complaints.append(i) - # j = j + 1 + - # num = StudentComplain.objects.filter(location = this_caretaker_area).filter(status = 0).count(); num = len(list_pending_complaints) return render(request, "complaintModule/caretaker_id_know_more.html",{'this_caretaker':this_caretaker , 'list_pending_complaints':list_pending_complaints, 'num':num}) @@ -913,7 +1022,7 @@ def search_complaint(request): def resolvepending(request, cid): a = get_object_or_404(User, username=request.user.username) y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() - thiscomplaint = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=cid) + thiscomplaint = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=cid) if request.method == 'POST': newstatus = request.POST.get('yesorno','') comment = request.POST.get('comment') @@ -922,11 +1031,11 @@ def resolvepending(request, cid): intstatus = 2 else: intstatus = 3 - StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=cid).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(id=cid).\ update(status=intstatus) - StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(id=cid).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(id=cid).\ update(comment=comment) - complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=cid) + complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=cid) student=0 message = "Congrats! Your complaint has been resolved" complaint_system_notif(request.user, complainer_details.complainer.user ,'comp_resolved_alert',complainer_details.id,student,message) @@ -938,6 +1047,7 @@ def resolvepending(request, cid): + def login1(request): if request.method == 'POST': u = request.POST.get('username', '') @@ -956,10 +1066,10 @@ def login1(request): @login_required def feedback_super(request, feedcomp_id): - detail3 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=feedcomp_id) + detail3 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=feedcomp_id) a=User.objects.get(username=detail3.complainer.user.username) y=ExtraInfo.objects.all().select_related('user','department').get(user=a) - temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).first() + temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(complainer=y).first() comp_id=temp.id loc = detail3.location care = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=loc).first() @@ -968,47 +1078,49 @@ def feedback_super(request, feedcomp_id): @login_required def feedback_care(request, feedcomp_id): - detail2 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=feedcomp_id) + detail2 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=feedcomp_id) a=User.objects.get(username=detail2.complainer.user.username) y=ExtraInfo.objects.all().select_related('user','department').get(user=a) - temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).first() + temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(complainer=y).first() comp_id=temp.id return render(request, "complaintModule/feedback_care.html", {"detail2": detail2,"comp_id":comp_id}) - - +#for complainaint and caretaker @login_required def detail(request, detailcomp_id1): """ function that shows detail about complaint """ - detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=detailcomp_id1) + detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=detailcomp_id1) if(detail.worker_id is None): worker_name = None worker_id = detail.worker_id else: worker_id = detail.worker_id.id - worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=worker_id) + worker = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=worker_id) worker_name = worker.name a=User.objects.get(username=detail.complainer.user.username) y=ExtraInfo.objects.all().select_related('user','department').get(user=a) num=0 if detail.upload_complaint != "": num = 1 - temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).first() + temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(complainer=y).first() comp_id=temp.id return render(request, "complaintModule/complaint_user_detail.html", {"detail": detail, "comp_id":detail.id,"num":num,"worker_name":worker_name}) + + +#for SectionIncharge @login_required def detail2(request, detailcomp_id1): - detail2 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=detailcomp_id1) + detail2 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=detailcomp_id1) if(detail2.worker_id is None): worker_name = None worker_id = detail2.worker_id else: worker_id = detail2.worker_id.id - worker = Workers.objects.select_related('caretaker_id','caretaker_id__staff_id','caretaker_id__staff_id__user','caretaker_id__staff_id__department').get(id=worker_id) + worker = Workers.objects.select_related('secincharge_id','secincharge_id__staff_id','secincharge_id__staff_id__user','secincharge_id__staff_id__department').get(id=worker_id) worker_name = worker.name a=User.objects.get(username=detail2.complainer.user.username) y=ExtraInfo.objects.all().select_related('user','department').get(user=a) @@ -1016,20 +1128,21 @@ def detail2(request, detailcomp_id1): if detail2.upload_complaint != "": num = 1 - temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).first() + temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(complainer=y).first() comp_id=temp.id - return render(request, "complaintModule/complaint_caretaker_detail.html", {"detail2": detail2, "comp_id":detail2.id,"num":num,"worker_name":worker_name,"wid":worker_id}) + return render(request, "complaintModule/complaint_secincharge_detail.html", {"detail2": detail2, "comp_id":detail2.id,"num":num,"worker_name":worker_name,"wid":worker_id}) + @login_required def detail3(request, detailcomp_id1): - detail3 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').get(id=detailcomp_id1) + detail3 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=detailcomp_id1) a=User.objects.get(username=detail3.complainer.user.username) y=ExtraInfo.objects.all().select_related('user','department').get(user=a) num=0 if detail3.upload_complaint != "": num = 1 - temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__caretaker_id__staff_id','worker_id__caretaker_id__staff_id__user','worker_id__caretaker_id__staff_id__department').filter(complainer=y).first() + temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department','worker_id','worker_id__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(complainer=y).first() comp_id=temp.id loc = detail3.location care = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(area=loc).first() - return render(request, "complaintModule/complaint_supervisor_detail.html", {"detail3": detail3,"comp_id":comp_id,"care":care,"num":num}) + return render(request, "complaintModule/complaint_supervisor_detail.html", {"detail3": detail3,"comp_id":comp_id,"care":care,"num":num}) \ No newline at end of file diff --git a/FusionIIIT/applications/department/admin.py b/FusionIIIT/applications/department/admin.py index b4e6e3201..81c5cdeb4 100644 --- a/FusionIIIT/applications/department/admin.py +++ b/FusionIIIT/applications/department/admin.py @@ -1,7 +1,8 @@ from django.contrib import admin # Register your models here. -from .models import(Announcements, SpecialRequest) +from .models import(Announcements, SpecialRequest,Department) admin.site.register(Announcements) -admin.site.register(SpecialRequest) \ No newline at end of file +admin.site.register(SpecialRequest) +admin.site.register(Department) \ No newline at end of file diff --git a/FusionIIIT/applications/department/migrations/0002_department.py b/FusionIIIT/applications/department/migrations/0002_department.py new file mode 100644 index 000000000..f0562aaf8 --- /dev/null +++ b/FusionIIIT/applications/department/migrations/0002_department.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.5 on 2023-03-29 19:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('department', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Department', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100)), + ('about', models.TextField()), + ('facility', models.TextField()), + ('achievement', models.TextField()), + ], + ), + ] diff --git a/FusionIIIT/applications/department/migrations/0003_announcements_is_draft.py b/FusionIIIT/applications/department/migrations/0003_announcements_is_draft.py new file mode 100644 index 000000000..25c0b98f2 --- /dev/null +++ b/FusionIIIT/applications/department/migrations/0003_announcements_is_draft.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2023-04-13 18:16 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('department', '0002_department'), + ] + + operations = [ + migrations.AddField( + model_name='announcements', + name='is_draft', + field=models.BooleanField(default=True), + ), + ] diff --git a/FusionIIIT/applications/department/models.py b/FusionIIIT/applications/department/models.py index a78b35171..f6edc4de2 100644 --- a/FusionIIIT/applications/department/models.py +++ b/FusionIIIT/applications/department/models.py @@ -27,5 +27,17 @@ class Announcements(models.Model): department = models.CharField(max_length=40,default="ALL") programme = models.CharField(max_length=10) upload_announcement = models.FileField(upload_to='department/upload_announcement', null=True, default=" ") + is_draft = models.BooleanField(default=True) # New field for draft status + def __str__(self): return str(self.maker_id.user.username) + +class Department(models.Model): + name = models.CharField(max_length=100) + about = models.TextField() + facility = models.TextField() + achievement = models.TextField() + + def __str__(self): + return str(self.name) + \ No newline at end of file diff --git a/FusionIIIT/applications/department/serializers.py b/FusionIIIT/applications/department/serializers.py new file mode 100644 index 000000000..eb65119c9 --- /dev/null +++ b/FusionIIIT/applications/department/serializers.py @@ -0,0 +1,12 @@ +from rest_framework import serializers +from .models import * + +class AnnouncementSerializer(serializers.ModelSerializer): + class Meta: + model=Announcements + fields="__all__" + +class SpecialRequestSerializer(serializers.ModelSerializer): + class Meta: + model=SpecialRequest + fields="__all__" \ No newline at end of file diff --git a/FusionIIIT/applications/department/static/css/faculty-card.css b/FusionIIIT/applications/department/static/css/faculty-card.css new file mode 100644 index 000000000..05c28159f --- /dev/null +++ b/FusionIIIT/applications/department/static/css/faculty-card.css @@ -0,0 +1,85 @@ +.fac-container { + display: grid; + grid-template-columns: repeat(1, minmax(0, 1fr)); + gap: 1rem; + /* 16px */ +} + +@media only screen and (min-width: 550px) { + .fac-container { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 1rem; + /* 16px */ + } +} + +@media only screen and (min-width: 992px) { + .fac-container { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 1rem; + /* 16px */ + } +} + +@media only screen and (min-width: 1300px) { + .fac-container { + display: grid; + grid-template-columns: repeat(4, minmax(0, 1fr)); + gap: 1rem; + /* 16px */ + } +} + +.fac-card { + border-radius: 0.25rem; + background-color: rgb(255, 255, 255); + text-align: center; + padding: 0.5rem 0.5rem 1.5rem 0.5rem; + margin: 0.5rem; + box-shadow: 0px 0px 5px 2px rgb(195, 193, 193); +} + +.fac-image { + width: 12rem; + height: 12rem; + border-radius: 50%; + background-position: center; + background-repeat: no-repeat; + background-size: cover; + margin: auto; + +} + +.fac-content { + margin: 1.5rem 0rem; +} + +.fac-name { + font-size: 1.2rem; + font-weight: 500; +} + +.fac-department { + font-size: 0.9rem; + font-weight: 500; + color: gray; +} + +.fac-email { + color: rgb(56, 56, 179); +} + +.fac-btn { + margin-bottom: 1.1rem; + padding: 0.3rem 1rem; + color: rgb(22, 22, 180); + border: 0.1rem solid blue; + border-radius: 0.3rem; +} + +.fac-btn:hover { + background-color: rgb(22, 22, 180); + color: white; +} \ No newline at end of file diff --git a/FusionIIIT/applications/department/static/department/js/function.js b/FusionIIIT/applications/department/static/department/js/function.js index 732b50473..9b036a677 100644 --- a/FusionIIIT/applications/department/static/department/js/function.js +++ b/FusionIIIT/applications/department/static/department/js/function.js @@ -1,90 +1,445 @@ -$(document).ready(function(){ +$(document).ready(function () { console.log("TTTTTTTT"); - }); - - - -function announce(event) - { - var message= $('input[name="announcement"]').val(); - var batch = $('input[name="batch"]').val(); - var programme = $('input[name="programme"]').val(); - var department = $('input[name="department"]').val(); - var upload_announcement =$('input[name="upload_announcement"]').val(); - if(message=="" || batch=="" || programme =="" || department=="") - { - alert("Please fill all the details!"); - return; - } - else - { - event.preventDefault(); - $.ajax({ - type : 'POST', - url : '.', - data : { - 'message' : message, - 'batch' : batch, - 'programme' : programme, - 'upload_announcement' : upload_announcement, - 'department' : department, - }, - success : function (data){ - - alert("Announcement successfully made!!"); - setTimeout(function() { - window.location.reload(); - }, 1500); - - - }, - error : function (data,err){ - alert('Announcement successfully made ... '); - - } - }); - } - }; - -function request(event) - { - var request_type= $('input[name="request_type"]').val(); +}); + + + +function announce(event) { + event.preventDefault(); + var message = $('input[name="announcement"]').val(); + var batch = $('input[name="batch"]').val(); + var programme = $('input[name="programme"]').val(); + var department = $('input[name="department"]').val(); + var upload_announcement = $('input[name="upload_announcement"]')[0].files[0]; + if (message == "" || batch == "" || programme == "" || department == "") { + alert("Fill required fields!!"); + return; + } + else { + let btn =document.getElementById("btn-publish"); + btn.classList.add("loading"); + var formData = new FormData(); + formData.append('message', message); + formData.append('batch', batch); + formData.append('programme', programme); + formData.append('upload_announcement', upload_announcement); + formData.append('department', department); + formData.append('is_draft', "false"); + $.ajax({ + type: 'POST', + url: '.', + data: formData, + contentType: false, + processData: false, + success: function (data) { + // btn.classList.remove("loading"); + window.location.reload(); + }, + error: function (data, err) { + alert('Some error occured!!'); + + } + }); + } +}; +function draft(event) { + event.preventDefault(); + var message = $('input[name="announcement"]').val(); + var batch = $('input[name="batch"]').val(); + var programme = $('input[name="programme"]').val(); + var department = $('input[name="department"]').val(); + var upload_announcement = $('input[name="upload_announcement"]')[0].files[0]; + if (message == "" || batch == "" || programme == "" || department == "") { + alert("Fill required fields!!"); + return; + } + else { + let btn =document.getElementById("btn-draft"); + btn.classList.add("loading"); + var formData = new FormData(); + formData.append('message', message); + formData.append('batch', batch); + formData.append('programme', programme); + formData.append('upload_announcement', upload_announcement); + formData.append('department', department); + formData.append('is_draft', "true"); + $.ajax({ + type: 'POST', + url: '.', + data: formData, + contentType: false, + processData: false, + success: function (data) { + window.location.reload(); + }, + error: function (data, err) { + alert('Some error occured!!'); + + } + }); + } +}; + +document.getElementById("show_drafts").addEventListener("click", function (event) { + event.preventDefault(); + let pbsh = document.getElementById("published"); + let drft = document.getElementById("drafts"); + let pbsh_status = pbsh.getAttribute("data-status"); + if (pbsh_status == "hidden") { + pbsh.setAttribute("data-status", "visible"); + pbsh.style.display = "block"; + drft.style.display = "none"; + this.innerHTML = "See Drafts"; + + } + else { + pbsh.setAttribute("data-status", "hidden"); + pbsh.style.display = "none"; + drft.style.display = "block"; + this.innerHTML = "See Published"; + } +}); + +document.getElementById("show_announcement_form").addEventListener("click", function (event) { + event.preventDefault(); + let form = document.getElementById("make-announcement-form"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + this.innerHTML = "Done"; + } + else { + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + this.innerHTML = "New Announcement"; + } +}); + +function edit_aboutCSE(self) { + let form = document.getElementById("edit-about-formCSE"); + let about = document.getElementById("aboutCSE"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + about.style.display = "none"; + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + console.log(form); + self.innerHTML = "Done"; + } + else { + about.style.display = "block"; + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + console.log(form); + self.innerHTML = "Edit"; + } +} +function edit_facilityCSE(self) { + let form = document.getElementById("edit-facility-formCSE"); + let facility = document.getElementById("facilityCSE"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + facility.style.display = "none"; + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + console.log(form); + self.innerHTML = "Done"; + } + else { + facility.style.display = "block"; + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + console.log(form); + self.innerHTML = "Edit"; + } +} +function edit_achievementCSE(self) { + let form = document.getElementById("edit-achievement-formCSE"); + let achievement = document.getElementById("achievementCSE"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + achievement.style.display = "none"; + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + console.log(form); + self.innerHTML = "Done"; + } + else { + achievement.style.display = "block"; + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + console.log(form); + self.innerHTML = "Edit"; + } +} +function edit_aboutECE(self) { + let form = document.getElementById("edit-about-formECE"); + let about = document.getElementById("aboutECE"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + about.style.display = "none"; + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + console.log(form); + self.innerHTML = "Done"; + } + else { + about.style.display = "block"; + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + console.log(form); + self.innerHTML = "Edit"; + } +} +function edit_facilityECE(self) { + let form = document.getElementById("edit-facility-formECE"); + let facility = document.getElementById("facilityECE"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + facility.style.display = "none"; + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + console.log(form); + self.innerHTML = "Done"; + } + else { + facility.style.display = "block"; + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + console.log(form); + self.innerHTML = "Edit"; + } +} +function edit_achievementECE(self) { + let form = document.getElementById("edit-achievement-formECE"); + let achievement = document.getElementById("achievementECE"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + achievement.style.display = "none"; + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + console.log(form); + self.innerHTML = "Done"; + } + else { + achievement.style.display = "block"; + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + console.log(form); + self.innerHTML = "Edit"; + } +} +function edit_aboutME(self) { + let form = document.getElementById("edit-about-formME"); + let about = document.getElementById("aboutME"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + about.style.display = "none"; + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + console.log(form); + self.innerHTML = "Done"; + } + else { + about.style.display = "block"; + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + console.log(form); + self.innerHTML = "Edit"; + } +} +function edit_facilityME(self) { + let form = document.getElementById("edit-facility-formME"); + let facility = document.getElementById("facilityME"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + facility.style.display = "none"; + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + console.log(form); + self.innerHTML = "Done"; + } + else { + facility.style.display = "block"; + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + console.log(form); + self.innerHTML = "Edit"; + } +} +function edit_achievementME(self) { + let form = document.getElementById("edit-achievement-formME"); + let achievement = document.getElementById("achievementME"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + achievement.style.display = "none"; + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + console.log(form); + self.innerHTML = "Done"; + } + else { + achievement.style.display = "block"; + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + console.log(form); + self.innerHTML = "Edit"; + } +} + +function edit_aboutSM(self) { + let form = document.getElementById("edit-about-formSM"); + let about = document.getElementById("aboutSM"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + about.style.display = "none"; + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + console.log(form); + self.innerHTML = "Done"; + } + else { + about.style.display = "block"; + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + console.log(form); + self.innerHTML = "Edit"; + } +} +function edit_facilitySM(self) { + let form = document.getElementById("edit-facility-formSM"); + let facility = document.getElementById("facilitySM"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + facility.style.display = "none"; + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + console.log(form); + self.innerHTML = "Done"; + } + else { + facility.style.display = "block"; + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + console.log(form); + self.innerHTML = "Edit"; + } +} +function edit_achievementSM(self) { + let form = document.getElementById("edit-achievement-formSM"); + let achievement = document.getElementById("achievementSM"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + achievement.style.display = "none"; + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + console.log(form); + self.innerHTML = "Done"; + } + else { + achievement.style.display = "block"; + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + console.log(form); + self.innerHTML = "Edit"; + } +} +function edit_aboutDESIGN(self) { + let form = document.getElementById("edit-about-formDESIGN"); + let about = document.getElementById("aboutDESIGN"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + about.style.display = "none"; + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + console.log(form); + self.innerHTML = "Done"; + } + else { + about.style.display = "block"; + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + console.log(form); + self.innerHTML = "Edit"; + } +} +function edit_facilityDESIGN(self) { + let form = document.getElementById("edit-facility-formDESIGN"); + let facility = document.getElementById("facilityDESIGN"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + facility.style.display = "none"; + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + console.log(form); + self.innerHTML = "Done"; + } + else { + facility.style.display = "block"; + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + console.log(form); + self.innerHTML = "Edit"; + } +} +function edit_achievementDESIGN(self) { + let form = document.getElementById("edit-achievement-formDESIGN"); + let achievement = document.getElementById("achievementDESIGN"); + let status = form.getAttribute("data-status"); + if (status == "hidden") { + achievement.style.display = "none"; + form.setAttribute("data-status", "visible"); + form.style.display = "block"; + console.log(form); + self.innerHTML = "Done"; + } + else { + achievement.style.display = "block"; + form.setAttribute("data-status", "hidden"); + form.style.display = "none"; + console.log(form); + self.innerHTML = "Edit"; + } +} + +function request(event) { + var request_type = $('input[name="request_type"]').val(); var request_to = $('input[name="request_to"]').val(); - var request_details = $('input[name="request_details"]').val(); + var request_details = $('input[name="request_details"]').val(); + - if(request_type=="" || request_to=="" || request_details =="" ) - { + if (request_type == "" || request_to == "" || request_details == "") { alert("Please fill all the details!"); return; } - else - { + else { event.preventDefault(); + alert("please wait we are processing your request."); $.ajax({ - type : 'POST', - url : '.', - data : { - 'request_type' : request_type, - 'request_to' : request_to, - 'request_details' : request_details, + type: 'POST', + url: '.', + data: { + 'request_type': request_type, + 'request_to': request_to, + 'request_details': request_details, }, - success : function (data){ - + success: function (data) { alert("Request successfully made!!"); - setTimeout(function() { - window.location.reload(); - }, 1500); + setTimeout(function () { + window.location.reload(); + }, 0); }, - error : function (data,err){ - alert('Request successfully made ... '); + error: function (data, err) { + alert('Request not created'); } }); } }; -function editStatus(event){ +function editStatus(event) { alert("working but dont know what to do"); }; diff --git a/FusionIIIT/applications/department/urls.py b/FusionIIIT/applications/department/urls.py index b7338374a..f3469e27c 100644 --- a/FusionIIIT/applications/department/urls.py +++ b/FusionIIIT/applications/department/urls.py @@ -1,4 +1,5 @@ from django.conf.urls import url +from django.urls import path from . import views @@ -11,5 +12,13 @@ url(r'^staffView/$', views.staff_view, name='staff_view'), url(r'^All_Students/(?P[0-9]+)/$', views.all_students,name='all_students'), url(r'^approved/$', views.approved, name='approved'), - url(r'^deny/$', views.deny, name='deny') + url(r'^deny/$', views.deny, name='deny'), + path('editDepartmentDetail//', views.edit_department,name='edit_department'), + path('delete_draft//', views.delete_draft,name='edit_department'), + path('edit_draft/', views.edit_draft,name='edit_department'), + #api routes + url(r'^fetchAnnouncements/$', views.AnnouncementAPI.as_view(http_method_names=['get']), name='fetchAnnouncements'), + url(r'^addNewAnnouncement/$', views.AnnouncementAPI.as_view(http_method_names=['post']), name='addNewAnnouncement'), + url(r'^fetchRequest/$', views.SpecialRequestAPI.as_view(http_method_names=['get']), name='fetchRequest'), + url(r'^addNewRequest/$', views.SpecialRequestAPI.as_view(http_method_names=['post']), name='addNewRequest'), ] diff --git a/FusionIIIT/applications/department/views.py b/FusionIIIT/applications/department/views.py index ef7e71c64..f48dd97c9 100644 --- a/FusionIIIT/applications/department/views.py +++ b/FusionIIIT/applications/department/views.py @@ -17,10 +17,129 @@ from applications.eis.models import (faculty_about, emp_research_projects) from notification.views import department_notif -from .models import SpecialRequest, Announcements +from .models import SpecialRequest, Announcements , Department from jsonschema import validate from jsonschema.exceptions import ValidationError +# API +from rest_framework.views import APIView +from rest_framework.response import Response +from .serializers import AnnouncementSerializer, SpecialRequestSerializer + +# Announcement Api class to handle request related to announcements +class AnnouncementAPI(APIView): + """ + overriding the get method + if request body is empty then all the announcements will be fetched + else body should contain id of the Announcement that is to be fetched + """ + + def get(self , request): + data = request.data + if data: + id = data['id'] + announcemets_obj = Announcements.objects.get(id=id) + serializer_obj = AnnouncementSerializer(announcemets_obj , partial=True) + return Response({'status':HttpResponse.status_code , 'payload':serializer_obj.data}) + else: + announcemets_obj = Announcements.objects.all() + serializer_obj = AnnouncementSerializer(announcemets_obj , many=True) + return Response({'status':HttpResponse.status_code , 'payload':serializer_obj.data}) + + """ + body should contain following attributes + batch, programme, department, message and upload_announcement + """ + def post(self , request): + data = request.data + batch = data['batch'] + programme = data['programme'] + department = data['department'] + message = data['message'] + upload_announcement = data['upload_announcement'] + ann_date = date.today() + + usrnm = get_object_or_404(User, username=request.user.username) + user_info = ExtraInfo.objects.all().select_related('user','department').get(user=usrnm) + + announcement_obj = Announcements( + maker_id=user_info, + batch=batch, + programme=programme, + message=message, + upload_announcement=upload_announcement, + department = department, + ann_date=ann_date + ) + if announcement_obj: + announcement_obj.save() + return Response({'status':HttpResponse.status_code , 'payload':'Announcement added successfully'}) + else: + return Response({'status':HttpResponse.status_code , 'payload':'Unable to add announcement'}) + +# SpecialRequest Api class to handle request related to Request +class SpecialRequestAPI(APIView): + """ + overriding the get method + if api-request body is empty then all the requests will be fetched + else body should contain id of the requests that is to be fetched + """ + def get(self , request): + data = request.data + if data: + id = data['id'] + specialRequest_obj = SpecialRequest.objects.get(id=id) + serializer_obj = SpecialRequestSerializer(specialRequest_obj , partial=True) + return Response({'status':HttpResponse.status_code , 'payload':serializer_obj.data}) + else: + specialRequest_obj = SpecialRequest.objects.all() + serializer_obj = SpecialRequestSerializer(specialRequest_obj , many=True) + return Response({'status':HttpResponse.status_code , 'payload':serializer_obj.data}) + + """ + body should contain following attributes + request_type, request_to and request_details + """ + def post(self , request): + data = request.data + request_type = data['request_type'] + request_to = data['request_to'] + request_details = data['request_details'] + request_date = date.today() + + usrnm = get_object_or_404(User, username=request.user.username) + user_info = ExtraInfo.objects.all().select_related('user','department').get(user=usrnm) + + specialRequest_obj = SpecialRequest( + request_maker=user_info, + request_date=request_date, + brief=request_type, + request_details=request_details, + status="Pending", + remarks="--", + request_receiver=request_to + ) + if specialRequest_obj: + specialRequest_obj.save() + return Response({'status':HttpResponse.status_code , 'payload':'Request added successfully'}) + else: + return Response({'status':HttpResponse.status_code , 'payload':'Unable to add Request'}) + """ + body should contain following attributes + id, remark and status + """ + def put(self, request): + data = request.data + request_id = data['id'] + remark = data['remark'] + status = data['status'] + + SpecialRequest.objects.filter(id=request_id).update(status=status, remarks=remark) + + return Response({'status':HttpResponse.status_code , 'payload':status}) + + + # Create your views here. @@ -38,11 +157,11 @@ def browse_announcements(): context - Dictionary for storing all above data """ - cse_ann = Announcements.objects.filter(department="CSE") - ece_ann = Announcements.objects.filter(department="ECE") - me_ann = Announcements.objects.filter(department="ME") - sm_ann = Announcements.objects.filter(department="SM") - all_ann = Announcements.objects.filter(department="ALL") + cse_ann = Announcements.objects.filter(department="CSE" , is_draft = False) + ece_ann = Announcements.objects.filter(department="ECE", is_draft = False) + me_ann = Announcements.objects.filter(department="ME", is_draft = False) + sm_ann = Announcements.objects.filter(department="SM", is_draft = False) + all_ann = Announcements.objects.filter(department="ALL", is_draft = False) context = { "cse" : cse_ann, @@ -54,6 +173,30 @@ def browse_announcements(): return context +def browse_announcement_drafts(department): + """ + This function is used to browse Announcements Department-Wise + made by different faculties and admin. + + @variables: + cse_ann - Stores CSE Department Announcements + ece_ann - Stores ECE Department Announcements + me_ann - Stores ME Department Announcements + sm_ann - Stores SM Department Announcements + all_ann - Stores Announcements intended for all Departments + context - Dictionary for storing all above data + + """ + dep_drafts = Announcements.objects.filter(department=department , is_draft = True) + all_drafts = Announcements.objects.filter(department="ALL", is_draft = True) + + context = { + "dep_drafts" : dep_drafts, + "all_drafts" : all_drafts, + } + + return context + def get_make_request(user_id): """ This function is used to get requests for maker @@ -76,6 +219,15 @@ def get_to_request(username): req = SpecialRequest.objects.filter(request_receiver=username) return req +def department(): + department = Department.objects.all() + + context = {} + + for dep in department: + context[dep.name] = dep + return context + @login_required(login_url='/accounts/login') def dep_main(request): """ @@ -93,53 +245,55 @@ def dep_main(request): """ user = request.user - usrnm = get_object_or_404(User, username=request.user.username) - user_info = ExtraInfo.objects.all().select_related('user','department').filter(user=usrnm).first() - ann_maker_id = user_info.id - user_info = ExtraInfo.objects.all().select_related('user','department').get(id=ann_maker_id) - - requests_made = get_make_request(user_info) - - fac_view = request.user.holds_designations.filter(designation__name='faculty').exists() - student = request.user.holds_designations.filter(designation__name='student').exists() - staff = request.user.holds_designations.filter(designation__name='staff').exists() - - context = browse_announcements() - context_f = faculty() - user_designation = "" - - if fac_view: - user_designation = "faculty" - elif student: - user_designation = "student" - else: - user_designation = "staff" - - if request.method == 'POST': - request_type = request.POST.get('request_type', '') - request_to = request.POST.get('request_to', '') - request_details = request.POST.get('request_details', '') - request_date = date.today() - - obj_sprequest, created_object = SpecialRequest.objects.get_or_create(request_maker=user_info, - request_date=request_date, - brief=request_type, - request_details=request_details, - status="Pending", - remarks="--", - request_receiver=request_to - ) - - if user_designation == "student": - return render(request,"department/index.html", {"announcements":context, - "fac_list" : context_f, - "requests_made" : requests_made - }) - # elif(str(user.extrainfo.user_type)=="faculty"): - elif user_designation=="faculty": + if user.extrainfo.user_type=="faculty": return HttpResponseRedirect("facView") - elif user_designation=="staff": + elif user.extrainfo.user_type =="staff": return HttpResponseRedirect("staffView") + elif user.extrainfo.user_type == "student": + usrnm = get_object_or_404(User, username=request.user.username) + user_info = ExtraInfo.objects.all().select_related('user','department').filter(user=usrnm).first() + ann_maker_id = user_info.id + user_info = ExtraInfo.objects.all().select_related('user','department').get(id=ann_maker_id) + + requests_made = get_make_request(user_info) + + fac_view = request.user.holds_designations.filter(designation__name='faculty').exists() + student = request.user.holds_designations.filter(designation__name='student').exists() + staff = request.user.holds_designations.filter(designation__name='staff').exists() + + context = browse_announcements() + context_f = faculty() + departments = department() + user_designation = "" + + if fac_view: + user_designation = "faculty" + elif student: + user_designation = "student" + else: + user_designation = "staff" + + if request.method == 'POST': + request_type = request.POST.get('request_type', '') + request_to = request.POST.get('request_to', '') + request_details = request.POST.get('request_details', '') + request_date = date.today() + + if request_type and request_to and request_details: + obj_sprequest, created_object = SpecialRequest.objects.get_or_create(request_maker=user_info, + request_date=request_date, + brief=request_type, + request_details=request_details, + status="Pending", + remarks="--", + request_receiver=request_to + ) + + return render(request,"department/index.html", {"announcements":context, + "fac_list" : context_f, + "requests_made" : requests_made, + "departments":departments + }) def faculty_view(request): """ @@ -163,9 +317,11 @@ def faculty_view(request): if request.method == 'POST': batch = request.POST.get('batch', '') programme = request.POST.get('programme', '') - message = request.POST.get('announcement', '') + message = request.POST.get('message', '') upload_announcement = request.FILES.get('upload_announcement') - department = request.POST.get('department') + department_ = request.POST.get('department') + is_draft = request.POST.get('is_draft') + ann_date = date.today() user_info = ExtraInfo.objects.all().select_related('user','department').get(id=ann_maker_id) getstudents = ExtraInfo.objects.select_related('user') @@ -176,13 +332,19 @@ def faculty_view(request): programme=programme, message=message, upload_announcement=upload_announcement, - department = department, + department = department_, + is_draft = True if is_draft == "true" else False, ann_date=ann_date) - # department_notif(usrnm, recipients , message) context = browse_announcements() + drafts = browse_announcement_drafts(request.user.extrainfo.department.name) + context_f = faculty() + departments = department() return render(request, 'department/dep_request.html', {"user_designation":user_info.user_type, "announcements":context, + "drafts":drafts, + "fac_list" : context_f, + "departments":departments, "request_to":requests_received }) @@ -223,11 +385,12 @@ def staff_view(request): upload_announcement=upload_announcement, department = department, ann_date=ann_date) - # department_notif(usrnm, recipients , message) context = browse_announcements() + context_f = faculty() return render(request, 'department/dep_request.html', {"user_designation":user_info.user_type, "announcements":context, + "fac_list" : context_f, "request_to":requests_received }) @@ -586,4 +749,52 @@ def deny(request): remark = request.POST.get('remark') SpecialRequest.objects.filter(id=request_id).update(status="Denied", remarks=remark) request.method = '' - return redirect('/dep/facView/') \ No newline at end of file + return redirect('/dep/facView/') + +def delete_draft(request, id): + obj = get_object_or_404(Announcements , id=id) + obj.delete() + return redirect('/dep/') + + +def edit_draft(request): + if request.method == 'POST': + id = request.POST.get('id', '') + batch = request.POST.get('batch', '') + programme = request.POST.get('programme', '') + message = request.POST.get('message', '') + upload_announcement = request.FILES.get('upload_announcement') + department_ = request.POST.get('department') + is_draft = request.POST.get('is_draft') + ann_date = date.today() + + obj = Announcements.objects.get(id = id) + obj.batch=batch + obj.programme=programme + obj.message=message + obj.upload_announcement=upload_announcement + obj.department = department_ + obj.is_draft = True if is_draft == "true" else False + obj.ann_date=ann_date + + obj.save() + return redirect('/dep/') + + +def edit_department(request, department_name , field): + if request.method == "POST": + content = request.POST.get('dep_content') + if field == "about": + Department.objects.filter(name=department_name).update(about=content) + elif field == "facility": + Department.objects.filter(name=department_name).update(facility=content) + elif field == "achievement": + Department.objects.filter(name=department_name).update(achievement=content) + + + return redirect('/dep/') + + + + + diff --git a/FusionIIIT/applications/eis/api/urls.py b/FusionIIIT/applications/eis/api/urls.py index 6e9117aaa..c1fe02eb8 100644 --- a/FusionIIIT/applications/eis/api/urls.py +++ b/FusionIIIT/applications/eis/api/urls.py @@ -7,4 +7,5 @@ url(r'^profile/(?P\w+)/', views.profile, name='profile-api'), # current user profile url(r'^profile/', views.profile, name='profile-api'), + url(r'^getUser/', views.getUser, name="user-api"), ] diff --git a/FusionIIIT/applications/eis/api/views.py b/FusionIIIT/applications/eis/api/views.py index d05033da0..874a4d08c 100644 --- a/FusionIIIT/applications/eis/api/views.py +++ b/FusionIIIT/applications/eis/api/views.py @@ -1,5 +1,6 @@ from django.contrib.auth import get_user_model from django.shortcuts import get_object_or_404 +from django.http import HttpResponse from rest_framework.permissions import IsAuthenticated from rest_framework.authentication import TokenAuthentication @@ -18,6 +19,8 @@ User = get_user_model() @api_view(['GET']) +@authentication_classes([TokenAuthentication]) +@authentication_classes([TokenAuthentication]) def profile(request, username=None): user = get_object_or_404(User, username=username) if username else request.user user_detail = serializers.UserSerializer(user).data @@ -25,7 +28,7 @@ def profile(request, username=None): if extra_info['user_type'] != 'faculty': return Response(data={'message':'Not faculty'}, status=status.HTTP_400_BAD_REQUEST) - pf = extra_info['id'] + pf = user['id'] journal = serializers.EmpResearchPapersSerializer(emp_research_papers.objects.filter(pf_no=pf, rtype='Journal').order_by('-year'),many=True).data conference = serializers.EmpResearchPapersSerializer(emp_research_papers.objects.filter(pf_no=pf, rtype='Conference').order_by('-year'),many=True).data books = serializers.EmpPublishedBooksSerializer(emp_published_books.objects.filter(pf_no=pf).order_by('-pyear'),many=True).data @@ -87,3 +90,86 @@ def profile(request, username=None): 'faculty_about' : faculty_about } return Response(data=resp, status=status.HTTP_200_OK) + + +# # research project +# @api_view(['GET']) +# def getResearchProject(request): +# projects = emp_research_projects.objects.filter(pf_no=pf).order_by('-start_date') + +@api_view(['GET']) +@authentication_classes([TokenAuthentication]) +def getUser(request): + #example request + #http://127.0.0.1:8000/eis/api/getUser/?param=mayank + username = request.GET.get('param') + user = get_object_or_404(User, username=username) if username else request.user + user_detail = serializers.UserSerializer(user).data + extra_info = serializers.ExtraInfoSerializer(user.extrainfo).data + if extra_info['user_type'] != 'faculty': + return Response(data={'message':'Not faculty'}, status=status.HTTP_400_BAD_REQUEST) + + pf = user['id'] + journal = serializers.EmpResearchPapersSerializer(emp_research_papers.objects.filter(pf_no=pf, rtype='Journal').order_by('-year'),many=True).data + conference = serializers.EmpResearchPapersSerializer(emp_research_papers.objects.filter(pf_no=pf, rtype='Conference').order_by('-year'),many=True).data + books = serializers.EmpPublishedBooksSerializer(emp_published_books.objects.filter(pf_no=pf).order_by('-pyear'),many=True).data + projects = serializers.EmpResearchProjectsSerializer(emp_research_projects.objects.filter(pf_no=pf).order_by('-start_date'),many=True).data + consultancy = serializers.EmpConsultancyProjectsSerializer(emp_consultancy_projects.objects.filter(pf_no=pf).order_by('-date_entry'),many=True).data + patents = serializers.EmpPatentsSerializer(emp_patents.objects.filter(pf_no=pf).order_by('-date_entry'),many=True).data + techtransfers = serializers.EmpTechTransferSerializer(emp_techtransfer.objects.filter(pf_no=pf).order_by('-date_entry'),many=True).data + mtechs = serializers.EmpMtechPhdThesisSerializer(emp_mtechphd_thesis.objects.filter(pf_no=pf, degree_type=1).order_by('-date_entry'),many=True).data + phds = serializers.EmpMtechPhdThesisSerializer(emp_mtechphd_thesis.objects.filter(pf_no=pf, degree_type=2).order_by('-date_entry'),many=True).data + fvisits = serializers.EmpVisitsSerializer(emp_visits.objects.filter(pf_no=pf, v_type=2).order_by('-entry_date'),many=True).data + ivisits = serializers.EmpVisitsSerializer(emp_visits.objects.filter(pf_no=pf, v_type=1).order_by('-entry_date'),many=True).data + for fvisit in fvisits: + fvisit['countryfull'] = countries[fvisit['country']] + consymps = serializers.EmpConfrenceOrganisedSerializer(emp_confrence_organised.objects.filter(pf_no=pf).order_by('-date_entry'),many=True).data + awards = serializers.EmpAchievementSerializer(emp_achievement.objects.filter(pf_no=pf).order_by('-date_entry'),many=True).data + talks = serializers.EmpExpertLecturesSerializer(emp_expert_lectures.objects.filter(pf_no=pf).order_by('-date_entry'),many=True).data + chairs = serializers.EmpSessionChairSerializer(emp_session_chair.objects.filter(pf_no=pf).order_by('-date_entry'),many=True).data + keynotes = serializers.EmpKeynoteAddressSerializer(emp_keynote_address.objects.filter(pf_no=pf).order_by('-date_entry'),many=True).data + events = serializers.EmpEventOrganizedSerializer(emp_event_organized.objects.filter(pf_no=pf).order_by('-start_date'),many=True).data + year_range = [] + for r in range(1995, (datetime.datetime.now().year + 1)): + year_range.append(r) + try: + faculty_about = serializers.FacultyAboutSerializer(user.faculty_about).data + except: + faculty_about = None + + holds_desig = user.current_designation.all() + flag_rspc = 0 + for i in holds_desig: + if(str(i.designation)=='Dean (RSPC)'): + flag_rspc = 1 + + designation = serializers.HoldsDesignationSerializer(holds_desig,many=True).data + + resp = {'user' : user_detail, + 'profile' : extra_info, + 'designation' : designation, + 'pf' : pf, + 'flag_rspc' : flag_rspc, + 'journal' : journal, + 'conference' : conference, + 'books' : books, + 'projects' : projects, + 'consultancy' : consultancy, + 'patents' : patents, + 'techtransfers' : techtransfers, + 'mtechs' : mtechs, + 'phds' : phds, + 'fvisits' : fvisits, + 'ivisits' : ivisits, + 'consymps' : consymps, + 'awards' : awards, + 'talks' : talks, + 'chairs' : chairs, + 'keynotes' : keynotes, + 'events' : events, + 'year_range' : year_range, + 'faculty_about' : faculty_about + } + return Response(data=resp, status=status.HTTP_200_OK) + + diff --git a/FusionIIIT/applications/eis/views.py b/FusionIIIT/applications/eis/views.py index 76a4532c2..9e1bc60d4 100644 --- a/FusionIIIT/applications/eis/views.py +++ b/FusionIIIT/applications/eis/views.py @@ -12,7 +12,7 @@ from django.views import generic from django.views.generic.edit import CreateView, DeleteView, UpdateView from xhtml2pdf import pisa - +from django.contrib import messages from applications.eis import admin from applications.globals.models import ExtraInfo, HoldsDesignation, DepartmentInfo from django.http.response import JsonResponse @@ -279,7 +279,7 @@ def profile(request, username=None): extra_info = get_object_or_404(ExtraInfo, user=user) if extra_info.user_type != 'faculty': return redirect('/') - pf = extra_info.id + pf = user.id form = ConfrenceForm() @@ -321,7 +321,7 @@ def profile(request, username=None): a1 = HoldsDesignation.objects.select_related('user','working','designation').filter(working = user) flag_rspc = 0 for i in a1: - if(str(i.designation)=='Dean (RSPC)'): + if(str(i.designation)=='dean_rspc'): flag_rspc = 1 # done edit @@ -367,9 +367,15 @@ def profile(request, username=None): # Dean RSPC Profile def rspc_profile(request): - user = get_object_or_404(faculty_about, user=request.user) - pf = user.user + # user = get_object_or_404(faculty_about, user=request.user) + # pf = user.user + user = get_object_or_404(User, username= request.user) + extra_info = get_object_or_404(ExtraInfo, user=user) + if extra_info.user_type != 'faculty': + return redirect('/') + pf = extra_info.id + form = ConfrenceForm() journal = emp_research_papers.objects.filter(rtype='Journal').order_by('-year', '-a_month') @@ -395,12 +401,12 @@ def rspc_profile(request): for r in range(1995, (datetime.datetime.now().year + 1)): y.append(r) - pers = get_object_or_404(faculty_about, user = request.user) - design = HoldsDesignation.objects.select_related('user','working','designation').filter(working=request.user) + # pers = get_object_or_404(faculty_about, user = request.user) + # design = HoldsDesignation.objects.select_related('user','working','designation').filter(working=request.user) desig=[] - for i in design: - desig.append(str(i.designation)) + # for i in design: + # desig.append(str(i.designation)) context = {'user': user, 'desig':desig, 'pf':pf, @@ -423,7 +429,7 @@ def rspc_profile(request): 'keynotes':keynotes, 'events':events, 'year_range':y, - 'pers':pers + # 'pers':pers } return render(request, 'eisModulenew/rspc_profile.html', context) @@ -576,7 +582,7 @@ def emp_visitsDelete(request, pk, sr, mark): # Views for inserting fields in EIS def pg_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id if (request.POST.get('pg_id')==None or request.POST.get('pg_id')==""): eis = emp_mtechphd_thesis() @@ -596,7 +602,7 @@ def pg_insert(request): def phd_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id if (request.POST.get('phd_id')==None or request.POST.get('phd_id')==""): eis = emp_mtechphd_thesis() @@ -617,7 +623,7 @@ def phd_insert(request): def fvisit_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id if (request.POST.get('fvisit_id')==None or request.POST.get('fvisit_id')==""): eis = emp_visits() @@ -643,7 +649,7 @@ def fvisit_insert(request): def ivisit_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id if (request.POST.get('ivisit_id')==None or request.POST.get('ivisit_id')==""): eis = emp_visits() @@ -671,7 +677,7 @@ def ivisit_insert(request): #Function to save journal of employee def journal_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - eis = emp_research_papers.objects.create(pf_no = user.id) + eis = emp_research_papers.objects.create(pf_no = request.user.id) eis.rtype = 'Journal' eis.authors = request.POST.get('authors') eis.title_paper = request.POST.get('title') @@ -872,7 +878,7 @@ def editindianvisit(request): def conference_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id eis = emp_research_papers() eis.user = request.user eis.pf_no = pf @@ -1028,7 +1034,7 @@ def editconference(request): def book_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id eis = emp_published_books() eis.user = request.user eis.pf_no = pf @@ -1055,7 +1061,7 @@ def editbooks(request): def consym_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id eis = emp_confrence_organised() eis.user = request.user eis.pf_no = pf @@ -1127,7 +1133,7 @@ def editconsym(request): def event_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id if (request.POST.get('event_id')==None or request.POST.get('event_id')==""): eis = emp_event_organized() @@ -1187,7 +1193,7 @@ def editevent(request): def award_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id if (request.POST.get('ach_id')==None or request.POST.get('ach_id')==""): eis = emp_achievement() @@ -1209,7 +1215,7 @@ def award_insert(request): def talk_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id if (request.POST.get('lec_id')==None or request.POST.get('lec_id')==""): eis = emp_expert_lectures() @@ -1233,7 +1239,7 @@ def talk_insert(request): def chaired_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id if (request.POST.get('ses_id')==None or request.POST.get('ses_id')==""): eis = emp_session_chair() @@ -1258,7 +1264,7 @@ def chaired_insert(request): def keynote_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id if (request.POST.get('keyid')==None or request.POST.get('keyid')==""): eis = emp_keynote_address() @@ -1283,7 +1289,7 @@ def keynote_insert(request): def project_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id if (request.POST.get('project_id')==None or request.POST.get('project_id')==""): eis = emp_research_projects() @@ -1327,7 +1333,7 @@ def project_insert(request): def consult_insert(request): print("=======================") user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id print(">>>>>>>.",user,type(user)) print(">>>>>>>",request.user,type(request.user)) if (request.POST.get('consultancy_id')==None or request.POST.get('consultancy_id')==""): @@ -1361,7 +1367,10 @@ def consult_insert(request): def patent_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + if(int(request.POST.get('earnings')) < 0): + messages.error(request, 'Earnings cannot be negative') + return HttpResponseRedirect('/profile') + pf = request.user.id if (request.POST.get('patent_id')==None or request.POST.get('patent_id')==""): eis = emp_patents() @@ -1376,11 +1385,12 @@ def patent_insert(request): eis.status = request.POST.get('status') eis.a_month = request.POST.get('month') eis.save() - return redirect('/profile/?page6=1') + messages.success(request, 'New patent created') + return HttpResponseRedirect('/profile') def transfer_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id if (request.POST.get('tech_id')==None or request.POST.get('tech_id')==""): eis = emp_techtransfer() @@ -2145,7 +2155,7 @@ def render_to_pdf(template_src, context_dict): def generate_report(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id start = request.POST.get('syear') star_date = start+'-01-01' end = request.POST.get('lyear') @@ -2569,12 +2579,11 @@ def generate_report(request): return render_to_pdf('eisModulenew/generatereportshow.html', context) -# report for dean rspc def rspc_generate_report(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id start = request.POST.get('syear') star_date = start+'-01-01' end = request.POST.get('lyear') @@ -2949,16 +2958,8 @@ def rspc_generate_report(request): else: events="" events_req = "0" - - pers = get_object_or_404(faculty_about, user = request.user) - design = HoldsDesignation.objects.select_related('user','working','designation').filter(working=request.user) - - desig=[] - for i in design: - desig.append(str(i.designation)) context = {'user': user, 'pf':pf, - 'desig':desig, 'journal':journal, 'journal_req':journal_req, 'conference': conference, diff --git a/FusionIIIT/applications/establishment/views.py b/FusionIIIT/applications/establishment/views.py index 73487cca8..d2e26208a 100644 --- a/FusionIIIT/applications/establishment/views.py +++ b/FusionIIIT/applications/establishment/views.py @@ -1079,7 +1079,7 @@ def generate_cpda_eligible_lists(request): for app in to_review_apps: app.reviewform = Review_Form(initial={'app_id': app.id}) - pf_number=1234 + pf_number=request.user.id if(emp_consultancy_projects.objects.filter(user=request.user).first() is not None): pf_number = emp_consultancy_projects.objects.filter(user=request.user).first().pf_no @@ -1163,12 +1163,12 @@ def generate_ltc_eligible_lists(request): availed_archived = (Ltc_availed.objects.filter(ltc__applicant=request.user).exclude(ltc__status='requested')) to_avail_archived = (Ltc_to_avail.objects.filter(ltc__applicant=request.user).exclude(ltc__status='requested')) depend_archived = (Dependent.objects.filter(ltc__applicant=request.user).exclude(ltc__status='requested')) - pf_number=1234 + pf_number=request.user.id if(emp_consultancy_projects.objects.filter(user=request.user).first() is not None): pf_number = emp_consultancy_projects.objects.filter(user=request.user).first().pf_no form = Ltc_Form(initial={'pf_number':pf_number}) - pf_number=1234 + pf_number=request.user.id to_review_apps = (Ltc_application.objects .filter(tracking_info__reviewer_id=request.user) .filter(status='requested') diff --git a/FusionIIIT/applications/filetracking/views.py b/FusionIIIT/applications/filetracking/views.py index ef5d8f347..a3c0a94ee 100644 --- a/FusionIIIT/applications/filetracking/views.py +++ b/FusionIIIT/applications/filetracking/views.py @@ -14,7 +14,56 @@ @login_required(login_url = "/accounts/login/") +### + +def errorCheck(request): + return render(request, 'filetracking/contactUs.html') + +#### + +def user_check(request): + """ + This function is used to check if the user is a student or not + Its return type is bool + @param: + request - contains metadata about the requested page + + @Variables: + current_user - get user from request + user_details - extract details of the user from the database + desig_id - check for designation + student - designation for a student + final_user - final designation of the request(our user) + + + """ + try: + current_user = get_object_or_404(User, username=request.user.username) + + #extra info details , user id used as main id + user_details = ExtraInfo.objects.select_related('user','department').get(user = request.user) + + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + print(str(des.designation)) + if str(des.designation) == "student": + return True + else: + return False + + except Exception as e: + return False + + + ################################### + + def filetracking(request): + + if user_check(request): + return render(request, 'filetracking/fileTrackingNotAllowed.html') + + + """ The function is used to create files by current user(employee). It adds the employee(uploader) and file datails to a file(table) of filetracking(model) @@ -134,7 +183,10 @@ def filetracking(request): @login_required(login_url = "/accounts/login") + def drafts(request): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## """ The function is used to get the designation of the user and renders it on draft template. @@ -146,6 +198,8 @@ def drafts(request): context - Holds data needed to make necessary changes in the template. """ + + ### designation = get_designation(request.user) context = { 'designation': designation, @@ -155,6 +209,8 @@ def drafts(request): @login_required(login_url = "/accounts/login") def fileview(request,id): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## """ This function is used to veiw all all created files by the user ordered by upload date.it collects all the created files from File object. @@ -204,6 +260,8 @@ def fileview(request,id): @login_required(login_url = "/accounts/login") def fileview1(request,id): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## """ The function is used to get all the files sent by user(employee) to other employees @@ -236,6 +294,8 @@ def fileview1(request,id): @login_required(login_url = "/accounts/login") def fileview2(request,id): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## """ The function is used to fetch the files received by the user form other employees. @@ -267,6 +327,8 @@ def fileview2(request,id): @login_required(login_url = "/accounts/login") def outward(request): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## """ This function fetches the different designations of the user and renders it on outward template @param: @@ -286,6 +348,8 @@ def outward(request): @login_required(login_url = "/accounts/login") def inward(request): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## """ This function fetches the different designations of the user and renders it on inward template @@ -306,6 +370,8 @@ def inward(request): @login_required(login_url = "/accounts/login") def confirmdelete(request,id): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## """ The function is used to confirm the deletion of a file. @@ -327,6 +393,8 @@ def confirmdelete(request,id): @login_required(login_url = "/accounts/login") def forward(request, id): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## """ The function is used to forward files received by user(employee) from other employees which are filtered from Tracking(table) objects by current user @@ -427,6 +495,8 @@ def forward(request, id): @login_required(login_url = "/accounts/login") def archive_design(request): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## designation = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) @@ -441,6 +511,8 @@ def archive_design(request): @login_required(login_url = "/accounts/login") def archive(request , id): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## draft = File.objects.select_related('uploader__user','uploader__department','designation').filter(is_read=True).order_by('-upload_date') @@ -470,6 +542,8 @@ def archive(request , id): @login_required(login_url = "/accounts/login") def archive_finish(request, id): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## file1 = get_object_or_404(File, id=id) ##file = get_object_or_404(File, ref_id=id) track = Tracking.objects.filter(file_id=file1) @@ -482,6 +556,8 @@ def archive_finish(request, id): @login_required(login_url = "/accounts/login") def finish_design(request): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## designation = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) @@ -493,6 +569,8 @@ def finish_design(request): @login_required(login_url = "/accounts/login") def finish_fileview(request, id): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## out = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department', 'current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id__uploader=request.user.extrainfo, is_read=False).order_by('-forward_date') @@ -515,6 +593,8 @@ def finish_fileview(request, id): @login_required(login_url = "/accounts/login") def finish(request, id): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## file1 = get_object_or_404(File, id=id) ##file = get_object_or_404(File, ref_id=id) track = Tracking.objects.filter(file_id=file1) @@ -537,6 +617,8 @@ def finish(request, id): def AjaxDropdown1(request): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## """ This function returns the designation of receiver on the forward or compose file template. @@ -560,6 +642,8 @@ def AjaxDropdown1(request): def AjaxDropdown(request): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## """ This function returns the usernames of receiver on the forward or compose file template. @@ -589,6 +673,8 @@ def test(request): @login_required(login_url = "/accounts/login") def delete(request,id): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## """ The function is used the delete of a file and it returns to the drafts page. @@ -606,6 +692,8 @@ def delete(request,id): def forward_inward(request,id): + if user_check(request):## + return render(request, 'filetracking/fileTrackingNotAllowed.html')## """ This function is used forward the files which are available in the inbox of the user . diff --git a/FusionIIIT/applications/finance_accounts/serializers.py b/FusionIIIT/applications/finance_accounts/serializers.py new file mode 100644 index 000000000..615c1384a --- /dev/null +++ b/FusionIIIT/applications/finance_accounts/serializers.py @@ -0,0 +1,33 @@ +from rest_framework import serializers +from applications.finance_accounts.models import * + + +class PaymentschemeSerializer(serializers.ModelSerializer): + + class Meta: + model=Paymentscheme + fields=('__all__') + +class ReceiptsSerializer(serializers.ModelSerializer): + + class Meta: + model=Receipts + fields=('__all__') + +class PaymentsSerializer(serializers.ModelSerializer): + + class Meta: + model=Payments + fields=('__all__') + +class BankSerializer(serializers.ModelSerializer): + + class Meta: + model=Bank + fields=('__all__') + +class CompanySerializer(serializers.ModelSerializer): + + class Meta: + model=Company + fields=('__all__') \ No newline at end of file diff --git a/FusionIIIT/applications/finance_accounts/urls.py b/FusionIIIT/applications/finance_accounts/urls.py index 26a4c28b9..5693af4d4 100644 --- a/FusionIIIT/applications/finance_accounts/urls.py +++ b/FusionIIIT/applications/finance_accounts/urls.py @@ -21,4 +21,13 @@ url(r'^printSalary', views.printSalary, name='Salary'), url(r'^previewing_file/', views.previewing_file, name='previewing_file'), + + #########################################api + + url(r'^paymentschemeApi/$', views.PaymentschemeApi.as_view(http_method_names=['post']), name="paymentschemeApi"), + url(r'^reciptsApi/$', views.ReceiptsApi.as_view(http_method_names=['post']), name="reciptsApi"), + url(r'^paymentsApi/$', views.PaymentsApi.as_view(http_method_names=['post']), name="paymentsApi"), + url(r'^bankApi/$', views.BankApi.as_view(http_method_names=['post']), name="bankApi"), + url(r'^companyApi/$', views.CompanyApi.as_view(http_method_names=['post']), name="companyApi"), + ] diff --git a/FusionIIIT/applications/finance_accounts/views.py b/FusionIIIT/applications/finance_accounts/views.py index f94fdc32c..34b332eca 100644 --- a/FusionIIIT/applications/finance_accounts/views.py +++ b/FusionIIIT/applications/finance_accounts/views.py @@ -1,3 +1,15 @@ +from rest_framework.views import APIView + +import json + +from django.http import JsonResponse + +from rest_framework.decorators import api_view, permission_classes,authentication_classes +from rest_framework.permissions import IsAuthenticated +from rest_framework.authentication import TokenAuthentication +from rest_framework import status + + from django.http import (Http404, HttpResponse, HttpResponseNotFound, HttpResponseRedirect) @@ -916,4 +928,248 @@ def previewing_file(request): return render(request, "financeAndAccountsModule/financeAndAccountsModuleds.html") - \ No newline at end of file + + + +#API + + + + +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +class PaymentschemeApi(APIView): + def get(self, request): + Paymentscheme_obj = Paymentscheme.objects.all(); + serialized_obj = PaymentschemeSerializer(serialized_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + request_body = json.loads(request.body) + month = request_body.get('month') + year = request_body.get('year') + pf = request_body.get('pf') + name = request_body.get('name') + designation =request_body.get('designation') + pay = request_body.get('pay') + gr_pay = request_body.get('gr_pay') + da = request_body.get('da') + ta = request_body.get('ta') + hra = request_body.get('hra') + fpa = request_body.get('fpa') + special_allow = request_body.get('special_allow') + nps = request_body.get('nps') + gpf = request_body.get('gpf') + income_tax = request_body.get('income_tax') + p_tax = request_body.get('p_tax') + gslis = request_body.get('gslis') + gis = request_body.get('gis') + license_fee = request_body.get('license_fee') + electricity_charges = request_body.get('electricity_charges') + others = request_body.get('others') + gr_reduction = request_body.get('gr_reduction') + net_payment = request_body.get('net_payment') + senior_verify = request_body.get('senior_verify') + ass_registrar_verify = request_body.get('ass_registrar_verify') + ass_registrar_aud_verify = request_body.get('ass_registrar_aud_verify') + registrar_director_verify = request_body.get('registrar_director_verify') + runpayroll = request_body.get('runpayroll') + view = request_body.get('view') + + query = Paymentscheme.objects.all() + if month: + query = query.filter(month=month) + if year: + query = query.filter(year=year) + if pf: + query = query.filter(pf=pf) + if name: + query = query.filter(name=name) + if designation: + query = query.filter(designation=designation) + if pay: + query = query.filter(pay=pay) + if gr_pay: + query = query.filter(gr_pay=gr_pay) + if da: + query = query.filter(da=da) + if ta: + query = query.filter(ta=ta) + if hra: + query = query.filter(hra=hra) + if fpa: + query = query.filter(fpa=fpa) + if special_allow: + query = query.filter(special_allow=special_allow) + if nps: + query = query.filter(nps=nps) + if gpf: + query = query.filter(gpf=gpf) + if income_tax: + query = query.filter(income_tax=income_tax) + if p_tax: + query = query.filter(p_tax=p_tax) + if gslis: + query = query.filter(gslis=gslis) + if gis: + query = query.filter(gis=gis) + if license_fee: + query = query.filter( license_fee= license_fee) + if electricity_charges: + query = query.filter(electricity_charges=electricity_charges) + if others: + query = query.filter(others=others) + if gr_reduction: + query = query.filter(gr_reduction=gr_reduction) + if net_payment: + query = query.filter(net_payment=net_payment) + if senior_verify: + query = query.filter(senior_verify=senior_verify) + if ass_registrar_verify: + query = query.filter(ass_registrar_verify=ass_registrar_verify) + if ass_registrar_aud_verify: + query = query.filter(ass_registrar_aud_verify=ass_registrar_aud_verify) + if registrar_director_verify: + query = query.filter(registrar_director_verify=registrar_director_verify) + if runpayroll: + query = query.filter( runpayroll= runpayroll) + if view: + query = query.filter(view=view) + + results = list(query.values()) + return JsonResponse({'results': results}) + +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +class ReceiptsApi(APIView): + def get(self, request): + receipts_obj = Receipts.objects.all(); + serialized_obj = ReceiptsSerializer(receipts_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + def post(self, request): + request_body = json.loads(request.body) + receipt_id = request_body.get('receipt_id') + transaction_id = request_body.get('transaction_id') + to_whom = request_body.get('to_whom') + from_whom = request_body.get('from_whom') + purpose = request_body.get('purpose') + date = request_body.get('date') + + query = Receipts.objects.all() + if receipt_id: + query = query.filter(receipt_id=receipt_id) + if transaction_id: + query = query.filter(TransactionId=transaction_id) + if to_whom: + query = query.filter(ToWhom__icontains=to_whom) + if from_whom: + query = query.filter(FromWhom__icontains=from_whom) + if purpose: + query = query.filter(Purpose__icontains=purpose) + if date: + query = query.filter(Date=date) + + results = list(query.values()) + return JsonResponse({'results': results}) + + +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +class PaymentsApi(APIView): + def get(self, request): + receipts_obj = Receipts.objects.all(); + serialized_obj = ReceiptsSerializer(receipts_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + request_body = json.loads(request.body) + paymentID= request_body.get('payment_id') + transaction_id = request_body.get('TransactionId') + to_whom = request_body.get('ToWhom') + from_whom = request_body.get('FromWhom') + purpose = request_body.get('Purpose') + date = request_body.get('Date') + + query = Payments.objects.all() + if paymentID: + query = query.filter(payment_id=paymentID) + if transaction_id: + query = query.filter(TransactionId=transaction_id) + if to_whom: + query = query.filter(ToWhom__icontains=to_whom) + if from_whom: + query = query.filter(FromWhom__icontains=from_whom) + if purpose: + query = query.filter(Purpose__icontains=purpose) + if date: + query = query.filter(Date=date) + + results = list(query.values()) + return JsonResponse({'results': results}) + +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +class BankApi(APIView): + def get(self, request): + receipts_obj = Receipts.objects.all(); + serialized_obj = ReceiptsSerializer(receipts_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + request_body = json.loads(request.body) + bank_id= request_body.get('bank_id') + Account_no = request_body.get('Account_no') + Bank_Name = request_body.get('Bank_Name') + IFSC_Code = request_body.get('IFSC_Code') + Branch_Name = request_body.get('Branch_Name') + + query = Bank.objects.all() + if bank_id: + query = query.filter(bank_id=bank_id) + if Account_no: + query = query.filter(Account_no=Account_no) + if Bank_Name: + query = query.filter(Bank_Name=Bank_Name) + if IFSC_Code: + query = query.filter(IFSC_Code=IFSC_Code) + if Branch_Name: + query = query.filter(Branch_Name=Branch_Name) + + bank_data = list(query.values()) + return JsonResponse({'banks': bank_data}) + +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +class CompanyApi(APIView): + def get(self, request): + Company_obj = Company.objects.all(); + Company_obj = CompanySerializer(Company_obj, many=True) + return Response({'status':200, 'payload':serialized_obj.data}) + + def post(self, request): + request_body = json.loads(request.body) + company_id= request_body.get('company_id') + Company_Name = request_body.get('Company_Name') + Start_Date = request_body.get('Start_Date') + End_Date = request_body.get('End_Date') + Description = request_body.get('Description') + Status = request_body.get('Status') + + companies = Company.objects.all() + if company_id: + companies = companies.filter(company_id=company_id) + if Company_Name: + companies = companies.filter(company_name=Company_Name) + if Start_Date: + companies = companies.filter(Start_Date=Start_Date) + if End_Date: + companies = companies.filter(End_date=End_Date) + if Description: + companies = companies.filter(Description=Description) + if Status: + companies = companies.filter(Status=Status) + + results = list(companies.values()) + return JsonResponse({'results': results}) + + diff --git a/FusionIIIT/applications/globals/migrations/.DS_Store b/FusionIIIT/applications/globals/migrations/.DS_Store new file mode 100644 index 000000000..5008ddfcf Binary files /dev/null and b/FusionIIIT/applications/globals/migrations/.DS_Store differ diff --git a/FusionIIIT/applications/globals/migrations/0002_auto_20230323_2222.py b/FusionIIIT/applications/globals/migrations/0002_auto_20230323_2222.py new file mode 100644 index 000000000..edc2d489a --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0002_auto_20230323_2222.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2023-03-23 22:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('PRESENT', 'PRESENT'), ('NEW', 'NEW')], default='PRESENT', max_length=50), + ), + ] diff --git a/FusionIIIT/applications/globals/migrations/0002_auto_20230327_1058.py b/FusionIIIT/applications/globals/migrations/0002_auto_20230327_1058.py new file mode 100644 index 000000000..22b764415 --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0002_auto_20230327_1058.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2023-03-27 10:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50), + ), + ] diff --git a/FusionIIIT/applications/globals/migrations/0003_auto_20230327_1100.py b/FusionIIIT/applications/globals/migrations/0003_auto_20230327_1100.py new file mode 100644 index 000000000..994b10df5 --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0003_auto_20230327_1100.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2023-03-27 11:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0002_auto_20230327_1058'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('PRESENT', 'PRESENT'), ('NEW', 'NEW')], default='PRESENT', max_length=50), + ), + ] diff --git a/FusionIIIT/applications/globals/migrations/0004_auto_20230327_1101.py b/FusionIIIT/applications/globals/migrations/0004_auto_20230327_1101.py new file mode 100644 index 000000000..c7639ff0e --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0004_auto_20230327_1101.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2023-03-27 11:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0003_auto_20230327_1100'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50), + ), + ] diff --git a/FusionIIIT/applications/globals/migrations/0005_merge_20230404_1133.py b/FusionIIIT/applications/globals/migrations/0005_merge_20230404_1133.py new file mode 100644 index 000000000..6bf3c2f07 --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0005_merge_20230404_1133.py @@ -0,0 +1,14 @@ +# Generated by Django 3.1.5 on 2023-04-04 11:33 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0002_auto_20230323_2222'), + ('globals', '0004_auto_20230327_1101'), + ] + + operations = [ + ] diff --git a/FusionIIIT/applications/globals/migrations/0006_auto_20230404_1139.py b/FusionIIIT/applications/globals/migrations/0006_auto_20230404_1139.py new file mode 100644 index 000000000..a2ab2f27d --- /dev/null +++ b/FusionIIIT/applications/globals/migrations/0006_auto_20230404_1139.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2023-04-04 11:39 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0005_merge_20230404_1133'), + ] + + operations = [ + migrations.AlterField( + model_name='extrainfo', + name='user_status', + field=models.CharField(choices=[('NEW', 'NEW'), ('PRESENT', 'PRESENT')], default='PRESENT', max_length=50), + ), + ] diff --git a/FusionIIIT/applications/globals/views.py b/FusionIIIT/applications/globals/views.py index a7f3886c9..996e3ba7c 100644 --- a/FusionIIIT/applications/globals/views.py +++ b/FusionIIIT/applications/globals/views.py @@ -28,6 +28,7 @@ from Fusion.settings.common import LOGIN_URL from notifications.models import Notification from .models import * +from applications.academic_procedures.views import get_user_semester def index(request): context = {} @@ -723,6 +724,42 @@ def dashboard(request): desig = list(HoldsDesignation.objects.select_related('user','working','designation').all().filter(working = request.user).values_list('designation')) b = [i for sub in desig for i in sub] design = HoldsDesignation.objects.select_related('user','designation').filter(working=request.user) + try: + user_details = ExtraInfo.objects.select_related('user','department').get(id = request.user) + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + + if str(des.designation) == "student": + obj = Student.objects.select_related('id','id__user','id__department').get(id = user_details.id) + + if obj.programme.upper() == "PHD" : + ug_flag = False + masters_flag = False + phd_flag = True + + elif obj.programme.upper() == "M.DES" : + ug_flag = False + masters_flag = True + phd_flag = False + + elif obj.programme.upper() == "B.DES" : + ug_flag = True + masters_flag = False + phd_flag = False + + elif obj.programme.upper() == "M.TECH" : + ug_flag = False + masters_flag = True + phd_flag = False + + elif obj.programme.upper() == "B.TECH" : + ug_flag = True + masters_flag = False + phd_flag = False + + else : + return HttpResponse("Student has no record") + except: + pass designation=[] for i in design: @@ -750,6 +787,8 @@ def dashboard(request): context.update(response) return render(request, "dashboard/dashboard.html", context) else: + user_sem = get_user_semester(request.user, ug_flag, masters_flag, phd_flag) + context['user_sem'] = user_sem return render(request, "dashboard/dashboard.html", context) diff --git a/FusionIIIT/applications/gymkhana/api/serializers.py b/FusionIIIT/applications/gymkhana/api/serializers.py index 57a7434f8..6d440a77f 100644 --- a/FusionIIIT/applications/gymkhana/api/serializers.py +++ b/FusionIIIT/applications/gymkhana/api/serializers.py @@ -68,3 +68,8 @@ class Voting_pollSerializer(serializers.ModelSerializer): class Meta: model=Voting_polls fields=['title','pub_date','exp_date','created_by','groups'] + +class NewClubSerializer(serializers.ModelSerializer): + class Meta: + model=Club_info + fields='__all__' diff --git a/FusionIIIT/applications/gymkhana/api/views.py b/FusionIIIT/applications/gymkhana/api/views.py index 194d7c503..75194c10c 100644 --- a/FusionIIIT/applications/gymkhana/api/views.py +++ b/FusionIIIT/applications/gymkhana/api/views.py @@ -5,9 +5,11 @@ from rest_framework.decorators import api_view, permission_classes,authentication_classes from rest_framework.permissions import AllowAny from rest_framework.response import Response -from django.shortcuts import render +from ..models import ExtraInfo, Student, Faculty +from django.shortcuts import get_object_or_404, redirect, render +import json from applications.gymkhana.models import Club_info,Club_member,Core_team,Session_info,Event_info,Club_budget,Club_report,Fest_budget,Registration_form,Voting_polls -from .serializers import Club_memberSerializer,Core_teamSerializer,Club_infoSerializer,Club_DetailsSerializer,Session_infoSerializer,event_infoserializer,club_budgetserializer,Club_reportSerializers,Fest_budgerSerializer,Registration_formSerializer,Voting_pollSerializer +from .serializers import Club_memberSerializer,Core_teamSerializer,Club_infoSerializer,Club_DetailsSerializer,Session_infoSerializer,event_infoserializer,club_budgetserializer,Club_reportSerializers,Fest_budgerSerializer,Registration_formSerializer,Voting_pollSerializer, NewClubSerializer from django.contrib.auth.models import User def coordinator_club(request): @@ -87,3 +89,13 @@ def get(self,respect): votingpolls=Voting_polls.objects.all() serializer=Voting_pollSerializer(votingpolls, many=True) return Response(serializer.data) + +class New_Club(APIView): + permission_classes = [IsAuthenticated] + authentication_classes = [TokenAuthentication] + def post(self,request): + serializer = NewClubSerializer(data=request.data) + if serializer.is_valid(): + serializer.save() + Response(serializer.data, status=status.HTTP_201_CREATED) + return Response(serializer.errors,status=status.HTTP_400_BAD_REQUEST) diff --git a/FusionIIIT/applications/gymkhana/migrations/0002_auto_20230410_1902.py b/FusionIIIT/applications/gymkhana/migrations/0002_auto_20230410_1902.py new file mode 100644 index 000000000..120bc4a80 --- /dev/null +++ b/FusionIIIT/applications/gymkhana/migrations/0002_auto_20230410_1902.py @@ -0,0 +1,24 @@ +# Generated by Django 3.1.5 on 2023-04-10 19:02 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('gymkhana', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='club_info', + name='created_on', + field=models.DateTimeField(default=django.utils.timezone.now, null=True), + ), + migrations.AddField( + model_name='club_info', + name='head_changed_on', + field=models.DateTimeField(default=django.utils.timezone.now, null=True), + ), + ] diff --git a/FusionIIIT/applications/gymkhana/models.py b/FusionIIIT/applications/gymkhana/models.py index c4513b236..a94cf25fe 100644 --- a/FusionIIIT/applications/gymkhana/models.py +++ b/FusionIIIT/applications/gymkhana/models.py @@ -89,7 +89,8 @@ class Club_info(models.Model): avail_budget = models.IntegerField(null=True, default=0) status = models.CharField( max_length=50, choices=Constants.status, default='open') - + head_changed_on = models.DateTimeField(null=True, default=timezone.now) + created_on = models.DateTimeField(null=True, default=timezone.now) def __str__(self): return str(self.club_name) diff --git a/FusionIIIT/applications/gymkhana/urls.py b/FusionIIIT/applications/gymkhana/urls.py index 308ce4d7b..82fd124de 100644 --- a/FusionIIIT/applications/gymkhana/urls.py +++ b/FusionIIIT/applications/gymkhana/urls.py @@ -1,9 +1,8 @@ from django.conf.urls import url from rest_framework.urlpatterns import format_suffix_patterns -from applications.gymkhana.api.views import Voting_Polls -from applications.gymkhana.api.views import clubname,Club_Details,club_events,club_budgetinfo,Fest_Budget,club_report,Registraion_form -from applications.gymkhana.api.views import session_details +from applications.gymkhana.api.views import clubname,Club_Details,club_events,club_budgetinfo,Fest_Budget,club_report,Registraion_form, New_Club, session_details, Voting_Polls from . import views +from django.urls import path from rest_framework.authtoken.views import obtain_auth_token app_name = 'gymkhana' @@ -16,23 +15,26 @@ url(r'^club_approve/$', views.club_approve, name='club_approve'), url(r'^club_reject/$', views.club_reject, name='club_reject'), # This is post method which takes username and password to generates/return Token - url(r'^login/$', obtain_auth_token, name='login'), + url(r'^api/login/$', obtain_auth_token, name='login'), # api for "clubdetails" method="get" with TokenAuthentication - url(r'^clubdetails/$', Club_Details.as_view()), + url(r'^api/clubdetails/$', Club_Details.as_view()), # api for "clubname" method="get" with TokenAuthentication - url(r'^Fest_budget/$',Fest_Budget.as_view(),name='Fest_budget'), + url(r'^api/Fest_budget/$',Fest_Budget.as_view(),name='Fest_budget'), # api for "festbudget" method="get" with TokenAuthentication - url(r'^club_report/$',club_report.as_view()), + url(r'^api/club_report/$',club_report.as_view()), # api for "club_report" method="get" with TokenAuthentication - url(r'^registration_form/$',Registraion_form.as_view()), + url(r'^api/registration_form/$',Registraion_form.as_view()), # api for "registration_form" method="get" with TokenAuthentication - url(r'^voting_polls/$',Voting_Polls.as_view()), + url(r'^api/voting_polls/$',Voting_Polls.as_view()), # api for "voting_polls" method="get" with TokenAuthentication + url(r'^api/new_club/$',New_Club.as_view()), + # api for "New Club" method="get" with TokenAuthentication url(r'^clubname/$', clubname.as_view()), - url(r'^$', views.gymkhana, name='gymkhana'), + url(r'^$', views.gymkhana_redirect, name='gymkhana-redirect'), + path(r'tabs//', views.gymkhana, name='gymkhana'), url(r'^delete_requests/$', views.delete_requests, name='delete_requests'), url(r'^form_avail/$', views.form_avail, name='form_avail'), url(r'^registration_form/$', views.registration_form, name='registration_form'), @@ -64,7 +66,6 @@ url(r'^delete_requests/$', views.delete_requests, name='delete_requests'), url(r'^club_membership/$', views.club_membership, name='membership'), url(r'^(?P\d+)/$', views.vote, name='vote'), - url(r'^$', views.gymkhana, name='gymkhana'), #data recieving url(r'^form_avail/$', views.form_avail, name='form_avail'), diff --git a/FusionIIIT/applications/gymkhana/views.py b/FusionIIIT/applications/gymkhana/views.py index 7f54215bb..a7effaf0d 100644 --- a/FusionIIIT/applications/gymkhana/views.py +++ b/FusionIIIT/applications/gymkhana/views.py @@ -1,17 +1,13 @@ from django.contrib import messages from django.contrib.auth.decorators import login_required -from django.contrib.auth.models import User -from django.http import HttpResponse from django.shortcuts import get_object_or_404, redirect, render from django.utils.dateparse import parse_date from django.db.models import Q from bisect import bisect -from django.contrib import messages from django.shortcuts import * from applications.filetracking.models import File, Tracking from django.template.defaulttags import csrf_token from django.http import HttpResponse, HttpResponseRedirect, JsonResponse -from django.contrib.auth.decorators import login_required from django.db import IntegrityError from django.core import serializers from django.contrib.auth.models import User @@ -603,7 +599,10 @@ def registration_form(request): # return redirect('/gymkhana/') -def retrun_content(request, roll, name, desig , club__ ): +def gymkhana_redirect(request): + return redirect('/gymkhana/tabs/clubs-details') + +def retrun_content(request, roll, name, desig , club__ , sub_tab ): """ retrun_content This view returns all data regarding the parameters that sent through function @@ -662,9 +661,12 @@ def retrun_content(request, roll, name, desig , club__ ): venue.append(room[0]) curr_club=[] if 'student' in desig: - user_name = get_object_or_404(User, username = str(roll)) - extra = get_object_or_404(ExtraInfo, id = roll, user = user_name) - student = get_object_or_404(Student, id = extra) + try : + user_name = get_object_or_404(User, username = str(roll)) + extra = get_object_or_404(ExtraInfo, id = roll, user = user_name) + student = get_object_or_404(Student, id = extra) + except : + curr_club = [] else : curr_club = [] @@ -716,6 +718,7 @@ def retrun_content(request, roll, name, desig , club__ ): 'status': status, } content.update(content1) + content["sub_tab"] = sub_tab; return content @login_required @@ -752,7 +755,7 @@ def getVenue(request): return HttpResponse(content) @login_required -def gymkhana(request): +def gymkhana(request,sub_tab): """ gymkhana This view gives us the complete information regarding various clubs and it @@ -775,14 +778,16 @@ def gymkhana(request): designation_data = [element for designation in designations for element in designation] roll_ = [] for designation in designation_data : - name_ = get_object_or_404(Designation, id = designation) - # # # print name_ - roll_.append(str(name_.name)) + try: + name_ = get_object_or_404(Designation, id = designation) + roll_.append(str(name_.name)) + except: + pass for club_data in Club_info.objects.select_related('co_ordinator','co_ordinator__id','co_ordinator__id__user','co_ordinator__id__department','co_coordinator','co_coordinator__id','co_coordinator__id__user','co_coordinator__id__department','faculty_incharge','faculty_incharge__id','faculty_incharge__id__user','faculty_incharge__id__department').all(): lines =str("") Types = lines.split(" ") club__ = coordinator_club(request) - return render(request, "gymkhanaModule/gymkhana.html", retrun_content(request, roll, name, roll_ , club__ )) + return render(request, "gymkhanaModule/gymkhana.html", retrun_content(request, roll, name, roll_ , club__ , sub_tab)) @login_required def club_membership(request): @@ -1870,5 +1875,3 @@ def forward(request, id): return render(request, 'filetracking/forward.html', context) - - diff --git a/FusionIIIT/applications/health_center/migrations/0002_auto_20230406_1140.py b/FusionIIIT/applications/health_center/migrations/0002_auto_20230406_1140.py new file mode 100644 index 000000000..a7d68c804 --- /dev/null +++ b/FusionIIIT/applications/health_center/migrations/0002_auto_20230406_1140.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2023-04-06 11:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('health_center', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='doctor', + name='doctor_name', + field=models.CharField(max_length=200), + ), + ] diff --git a/FusionIIIT/applications/health_center/migrations/0002_doctor_contact_no.py b/FusionIIIT/applications/health_center/migrations/0002_doctor_contact_no.py new file mode 100644 index 000000000..82f1570aa --- /dev/null +++ b/FusionIIIT/applications/health_center/migrations/0002_doctor_contact_no.py @@ -0,0 +1,19 @@ +# Generated by Django 3.1.5 on 2023-04-06 12:10 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('health_center', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='doctor', + name='contact_no', + field=models.CharField(default='0000000000', max_length=10, validators=[django.core.validators.MinLengthValidator(10)]), + ), + ] diff --git a/FusionIIIT/applications/health_center/migrations/0003_merge_20230411_1341.py b/FusionIIIT/applications/health_center/migrations/0003_merge_20230411_1341.py new file mode 100644 index 000000000..ec86d32d1 --- /dev/null +++ b/FusionIIIT/applications/health_center/migrations/0003_merge_20230411_1341.py @@ -0,0 +1,14 @@ +# Generated by Django 3.1.5 on 2023-04-11 13:41 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('health_center', '0002_auto_20230406_1140'), + ('health_center', '0002_doctor_contact_no'), + ] + + operations = [ + ] diff --git a/FusionIIIT/applications/health_center/migrations/0004_auto_20230411_1342.py b/FusionIIIT/applications/health_center/migrations/0004_auto_20230411_1342.py new file mode 100644 index 000000000..579fb2744 --- /dev/null +++ b/FusionIIIT/applications/health_center/migrations/0004_auto_20230411_1342.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2023-04-11 13:42 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('health_center', '0003_merge_20230411_1341'), + ] + + operations = [ + migrations.AlterField( + model_name='ambulance_request', + name='reason', + field=models.CharField(max_length=255), + ), + ] diff --git a/FusionIIIT/applications/health_center/migrations/0005_auto_20230416_1755.py b/FusionIIIT/applications/health_center/migrations/0005_auto_20230416_1755.py new file mode 100644 index 000000000..36c4455f1 --- /dev/null +++ b/FusionIIIT/applications/health_center/migrations/0005_auto_20230416_1755.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.5 on 2023-04-16 17:55 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('health_center', '0004_auto_20230411_1342'), + ] + + operations = [ + migrations.RemoveField( + model_name='doctor', + name='contact_no', + ), + migrations.AlterField( + model_name='doctor', + name='doctor_phone', + field=models.CharField(default='0000000000', max_length=10, validators=[django.core.validators.MinLengthValidator(10)]), + ), + ] diff --git a/FusionIIIT/applications/health_center/migrations/0006_auto_20230416_1822.py b/FusionIIIT/applications/health_center/migrations/0006_auto_20230416_1822.py new file mode 100644 index 000000000..11510987d --- /dev/null +++ b/FusionIIIT/applications/health_center/migrations/0006_auto_20230416_1822.py @@ -0,0 +1,28 @@ +# Generated by Django 3.1.5 on 2023-04-16 18:22 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('health_center', '0005_auto_20230416_1755'), + ] + + operations = [ + migrations.RemoveField( + model_name='hospital', + name='phone', + ), + migrations.AddField( + model_name='hospital', + name='hospital_address', + field=models.CharField(default='', max_length=255), + ), + migrations.AddField( + model_name='hospital', + name='hospital_phone', + field=models.CharField(default='0000000000', max_length=10, validators=[django.core.validators.MinLengthValidator(10)]), + ), + ] diff --git a/FusionIIIT/applications/health_center/models.py b/FusionIIIT/applications/health_center/models.py index 4daaae0de..27bbb8d47 100644 --- a/FusionIIIT/applications/health_center/models.py +++ b/FusionIIIT/applications/health_center/models.py @@ -1,4 +1,5 @@ from django.db import models +from django.core.validators import MinLengthValidator from applications.globals.models import ExtraInfo @@ -23,8 +24,9 @@ class Constants: ) class Doctor(models.Model): - doctor_name = models.IntegerField(choices=Constants.NAME_OF_DOCTOR) - doctor_phone = models.CharField(max_length=10) + # doctor_name = models.IntegerField(choices=Constants.NAME_OF_DOCTOR) + doctor_name = models.CharField(max_length=200) + doctor_phone = models.CharField(max_length=10, validators=[MinLengthValidator(10)], default="0000000000") specialization = models.CharField(max_length=100) active = models.BooleanField(default=True) @@ -57,11 +59,12 @@ class Medicine(models.Model): times = models.IntegerField(default=0) def __str__(self): - return self.medicine_id + return self.medicine_id.medicine_name class Hospital(models.Model): hospital_name=models.CharField(max_length=100) - phone=models.CharField(max_length=10) + hospital_address=models.CharField(max_length=255, default="") + hospital_phone=models.CharField(max_length=10, validators=[MinLengthValidator(10)], default="0000000000") def __str__(self): return self.hospital_name @@ -155,7 +158,7 @@ class Ambulance_request(models.Model): date_request = models.DateTimeField() start_date = models.DateField() end_date = models.DateField(null=True, blank=True) - reason = models.CharField(max_length=50) + reason = models.CharField(max_length=255) class Hospital_admit(models.Model): user_id = models.ForeignKey(ExtraInfo,on_delete=models.CASCADE) diff --git a/FusionIIIT/applications/health_center/utils.py b/FusionIIIT/applications/health_center/utils.py index f965c5f60..52b327ba4 100644 --- a/FusionIIIT/applications/health_center/utils.py +++ b/FusionIIIT/applications/health_center/utils.py @@ -253,8 +253,8 @@ def compounder_view_handler(request): test=tests, appointment=appointment ) - query = Medicine.objects.select_related('patient','patient__user','patient__department').objects.filter(patient=user) - prescribe = Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','appointment','appointment__user_id','appointment__user_id__user','appointment__user_id__department','appointment__doctor_id','appointment__schedule','appointment__schedule__doctor_id').objects.all().last() + query = Medicine.objects.select_related('patient','patient__user','patient__department').filter(patient=user) + prescribe = Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','appointment','appointment__user_id','appointment__user_id__user','appointment__user_id__department','appointment__doctor_id','appointment__schedule','appointment__schedule__doctor_id').all().last() for medicine in query: medicine_id = medicine.medicine_id quantity = medicine.quantity @@ -296,6 +296,7 @@ def compounder_view_handler(request): healthcare_center_notif(request.user, user.user, 'presc') data = {'status': status, 'stock': stock} return JsonResponse(data) + elif 'prescribe_b' in request.POST: user_id = request.POST.get('user') user = ExtraInfo.objects.select_related('user','department').get(id=user_id) @@ -363,17 +364,31 @@ def compounder_view_handler(request): healthcare_center_notif(request.user, user.user, 'presc') data = {'status': status} return JsonResponse(data) + elif 'cancel_presc' in request.POST: presc_id = request.POST.get('cancel_presc') Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','appointment','appointment__user_id','appointment__user_id__user','appointment__user_id__department','appointment__doctor_id','appointment__schedule','appointment__schedule__doctor_id').filter(pk=presc_id).delete() data = {'status': 1} return JsonResponse(data) + elif 'medicine' in request.POST: med_id = request.POST.get('medicine') thresh = Stock.objects.get(id=med_id).threshold data = {'thresh': thresh} return JsonResponse(data) - + + elif 'add_hospital' in request.POST: + hospital_name=request.POST.get('hospital_name') + hospital_address=request.POST.get('hospital_address') + hospital_phone=request.POST.get('hospital_phone') + print(hospital_name,hospital_address,hospital_phone) + Hospital.objects.create( + hospital_name=hospital_name, + hospital_address=hospital_address, + hospital_phone=hospital_phone, + ) + data={'status':1, 'hospital_name':hospital_name, 'hospital_address':hospital_address, 'hospital_phone':hospital_phone} + return JsonResponse(data) def student_view_handler(request): if 'amb_submit' in request.POST: @@ -422,6 +437,37 @@ def student_view_handler(request): healthcare_center_notif(request.user, cmp.user, 'appoint_req') return JsonResponse(data) + elif 'appointment' in request.POST: + print("WE ARE IN") + user_id = ExtraInfo.objects.select_related('user','department').get(user=request.user) + doctor_id = request.POST.get('doctor') + + date = request.POST.get('date') + from_time = request.POST.get('from_time') + to_time = request.POST.get('to_time') + from_time_obj = datetime.time(datetime.strptime(from_time, '%H:%M')) + to_time_obj = datetime.time(datetime.strptime(to_time, '%H:%M')) + + description = request.POST.get('description') + doctor = Doctor.objects.get(id=doctor_id) + day_on_date_in_integer = datetime.strptime(date, '%Y-%m-%d').weekday() + schedule = Schedule.objects.filter(doctor_id=doctor, day=day_on_date_in_integer, from_time__lte=from_time_obj, to_time__gte=to_time_obj).first() + + if(schedule != None): + Appointment.objects.create( + user_id=user_id, + doctor_id=doctor, + description=description, + schedule=schedule, + date=date + ) + data = {'status': 1} + healthcare_center_notif(request.user, request.user, 'appoint') + return JsonResponse(data) + else: + data = {'status': 0, 'message': 'Doctor is not available on this date & time. Please refer the Doctor\'s Schedule.'} + return JsonResponse(data) + elif 'doctor' in request.POST: doctor_id = request.POST.get('doctor') days = Schedule.objects.select_related('doctor_id').filter(doctor_id=doctor_id).values('day') diff --git a/FusionIIIT/applications/health_center/views.py b/FusionIIIT/applications/health_center/views.py index cd2bba84f..a5a1306e4 100644 --- a/FusionIIIT/applications/health_center/views.py +++ b/FusionIIIT/applications/health_center/views.py @@ -80,8 +80,8 @@ def compounder_view(request): stocks = Stock.objects.all() days = Constants.DAYS_OF_WEEK schedule=Schedule.objects.select_related('doctor_id').all().order_by('doctor_id') - expired=Expiry.objects.select_related('medicine_id').filter(expiry_date__lt=datetime.now(),returned=False).order_by('expiry_date') - live_meds=Expiry.objects.select_related('medicine_id').filter(returned=False).order_by('quantity') + expired=Expiry.objects.select_related('medicine_id').filter(expiry_date__lt=datetime.now(), returned=False).order_by('expiry_date') + live_meds=Expiry.objects.select_related('medicine_id').filter(expiry_date__gte=datetime.now(), returned=False).order_by('quantity') count=Counter.objects.all() presc_hist=Prescription.objects.select_related('user_id','user_id__user','user_id__department','doctor_id','appointment','appointment__user_id','appointment__user_id__user','appointment__user_id__department','appointment__doctor_id','appointment__schedule','appointment__schedule__doctor_id').all().order_by('-date') medicines_presc=Prescribed_medicine.objects.select_related('prescription_id','prescription_id__user_id','prescription_id__user_id__user','prescription_id__user_id__department','prescription_id__doctor_id','prescription_id__appointment','prescription_id__appointment__user_id','prescription_id__appointment__user_id__user','prescription_id__appointment__user_id__department','prescription_id__appointment__doctor_id','prescription_id__appointment__schedule','prescription_id__appointment__schedule__doctor_id','medicine_id').all() @@ -93,14 +93,15 @@ def compounder_view(request): schedule=Schedule.objects.select_related('doctor_id').all().order_by('day','doctor_id') doctors=Doctor.objects.filter(active=True).order_by('id') - doct= ["Dr. G S Sandhu", "Dr. Jyoti Garg", "Dr. Arvind Nath Gupta"] + # doct= ["Dr. G S Sandhu", "Dr. Jyoti Garg", "Dr. Arvind Nath Gupta"] + print(live_meds.values()) return render(request, 'phcModule/phc_compounder.html', {'days': days, 'users': users, 'count': count,'expired':expired, 'stocks': stocks, 'all_complaints': all_complaints, 'all_hospitals': all_hospitals, 'hospitals':hospitals, 'all_ambulances': all_ambulances, - 'appointments_today': appointments_today, 'doctors': doctors, 'doct': doct, + 'appointments_today': appointments_today, 'doctors': doctors, 'appointments_future': appointments_future, 'schedule': schedule, 'live_meds': live_meds, 'presc_hist': presc_hist, 'medicines_presc': medicines_presc, 'hospitals_list': hospitals_list}) elif usertype == 'student': return HttpResponseRedirect("/healthcenter/student") # compounder view ends @@ -150,14 +151,14 @@ def student_view(request): Counter.objects.create(count=0,fine=0) count=Counter.objects.get() - doct= ["Dr. G S Sandhu", "Dr. Jyoti Garg", "Dr. Arvind Nath Gupta"] + # doct= ["Dr. G S Sandhu", "Dr. Jyoti Garg", "Dr. Arvind Nath Gupta"] return render(request, 'phcModule/phc_student.html', {'complaints': complaints, 'medicines': medicines, 'ambulances': ambulances, 'doctors': doctors, 'days': days,'count':count, 'hospitals': hospitals, 'appointments': appointments, - 'prescription': prescription, 'schedule': schedule, 'users': users,'doct': doct, 'curr_date': datetime.now().date()}) + 'prescription': prescription, 'schedule': schedule, 'users': users, 'curr_date': datetime.now().date()}) elif usertype == 'compounder': return HttpResponseRedirect("/healthcenter/compounder") # student view ends diff --git a/FusionIIIT/applications/hostel_management/admin.py b/FusionIIIT/applications/hostel_management/admin.py index 0ab767ac1..f3c8ebee6 100644 --- a/FusionIIIT/applications/hostel_management/admin.py +++ b/FusionIIIT/applications/hostel_management/admin.py @@ -5,7 +5,6 @@ admin.site.register(Hall) admin.site.register(HallCaretaker) admin.site.register(HallWarden) -admin.site.register(GuestRoomDetail) admin.site.register(GuestRoomBooking) admin.site.register(StaffSchedule) admin.site.register(HostelNoticeBoard) diff --git a/FusionIIIT/applications/hostel_management/forms.py b/FusionIIIT/applications/hostel_management/forms.py index a727bd069..1fa8a75a3 100644 --- a/FusionIIIT/applications/hostel_management/forms.py +++ b/FusionIIIT/applications/hostel_management/forms.py @@ -1,9 +1,49 @@ from django import forms -from .models import HostelNoticeBoard, Hall - +from .models import HostelNoticeBoard, Hall, GuestRoomBooking +import re +from django.core.exceptions import ValidationError class HostelNoticeBoardForm(forms.ModelForm): class Meta: model = HostelNoticeBoard fields = ('hall', 'head_line', 'content', 'description') - \ No newline at end of file + +class GuestRoomBookingForm(forms.ModelForm): + class Meta: + model = GuestRoomBooking + fields = ( + 'hall', + 'guest_name', + 'guest_phone', + 'guest_email', + 'guest_address', + 'rooms_required', + 'total_guest', + 'purpose', + 'arrival_date', + 'arrival_time', + 'departure_date', + 'departure_time', + 'nationality' + ) + + # def clean_guest_phone(self): + # guest_phone = self.cleaned_data['guest_phone'] + # valid = re.fullmatch('^[6-9]\d{9}$', guest_phone) + # if valid: + # return guest_phone + # else: + # raise ValidationError( + # 'Please enter a valid 10-digit mobile number.' + # ) + + # def clean_guest_email(self): + # guest_email = self.cleaned_data['guest_email'] + # valid = re.fullmatch(r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b', guest_email) + # if valid: + # return guest_email + # else: + # raise ValidationError( + # 'Please enter a valid email address.' + # ) + diff --git a/FusionIIIT/applications/hostel_management/migrations/.DS_Store b/FusionIIIT/applications/hostel_management/migrations/.DS_Store new file mode 100644 index 000000000..5008ddfcf Binary files /dev/null and b/FusionIIIT/applications/hostel_management/migrations/.DS_Store differ diff --git a/FusionIIIT/applications/hostel_management/migrations/0002_auto_20230404_1139.py b/FusionIIIT/applications/hostel_management/migrations/0002_auto_20230404_1139.py new file mode 100644 index 000000000..397602516 --- /dev/null +++ b/FusionIIIT/applications/hostel_management/migrations/0002_auto_20230404_1139.py @@ -0,0 +1,119 @@ +# Generated by Django 3.1.5 on 2023-04-04 11:39 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('globals', '0006_auto_20230404_1139'), + ('hostel_management', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='HallAdmin', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('faculty', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='globals.faculty')), + ], + ), + migrations.AlterField( + model_name='guestroombooking', + name='guest_email', + field=models.CharField(blank=True, max_length=255), + ), + migrations.AlterField( + model_name='guestroombooking', + name='guest_name', + field=models.CharField(max_length=255), + ), + migrations.AlterField( + model_name='guestroombooking', + name='guest_phone', + field=models.CharField(max_length=255), + ), + migrations.RemoveField( + model_name='guestroombooking', + name='guest_room_id', + ), + migrations.AddField( + model_name='guestroombooking', + name='guest_room_id', + field=models.CharField(blank=True, max_length=255), + ), + migrations.AlterField( + model_name='guestroombooking', + name='intender', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='globals.extrainfo'), + ), + migrations.AlterField( + model_name='guestroombooking', + name='nationality', + field=models.CharField(blank=True, max_length=255), + ), + migrations.AlterField( + model_name='guestroombooking', + name='status', + field=models.CharField(choices=[('Confirmed', 'Confirmed'), ('Pending', 'Pending'), ('Rejected', 'Rejected'), ('Canceled', 'Canceled'), ('CancelRequested', 'Cancel Requested'), ('CheckedIn', 'Checked In'), ('Complete', 'Complete'), ('Forward', 'Forward')], default='Pending', max_length=255), + ), + migrations.AlterField( + model_name='hall', + name='hall_id', + field=models.CharField(max_length=255), + ), + migrations.AlterField( + model_name='hall', + name='hall_name', + field=models.CharField(choices=[('saraswati', 'saraswati'), ('vivekananda', 'vivekananda'), ('aryabhatta', 'aryabhatta'), ('vashishtha', 'vashishtha')], max_length=255), + ), + migrations.AlterField( + model_name='hallroom', + name='block_no', + field=models.CharField(max_length=255), + ), + migrations.AlterField( + model_name='hallroom', + name='room_no', + field=models.CharField(max_length=255), + ), + migrations.AlterField( + model_name='hostelnoticeboard', + name='head_line', + field=models.CharField(max_length=255), + ), + migrations.AlterField( + model_name='staffschedule', + name='day', + field=models.CharField(choices=[('Monday', 'Monday'), ('Tuesday', 'Tuesday'), ('Wednesday', 'Wednesday'), ('Thursday', 'Thursday'), ('Friday', 'Friday'), ('Saturday', 'Saturday'), ('Sunday', 'Sunday')], max_length=255), + ), + migrations.AlterField( + model_name='staffschedule', + name='staff_type', + field=models.CharField(default='Caretaker', max_length=255), + ), + migrations.AlterField( + model_name='workerreport', + name='remark', + field=models.CharField(max_length=255), + ), + migrations.AlterField( + model_name='workerreport', + name='worker_id', + field=models.CharField(max_length=255), + ), + migrations.AlterField( + model_name='workerreport', + name='worker_name', + field=models.CharField(max_length=255), + ), + migrations.DeleteModel( + name='GuestRoomDetail', + ), + migrations.AddField( + model_name='halladmin', + name='hall', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='hostel_management.hall'), + ), + ] diff --git a/FusionIIIT/applications/hostel_management/models.py b/FusionIIIT/applications/hostel_management/models.py index 9b667d9e2..e9cd8534b 100644 --- a/FusionIIIT/applications/hostel_management/models.py +++ b/FusionIIIT/applications/hostel_management/models.py @@ -33,7 +33,14 @@ class HostelManagementConstants: ("CheckedIn" , 'Checked In'), ("Complete", 'Complete'), ("Forward", 'Forward') - ) + ) + + HALL_NAMES = ( + ('saraswati', 'saraswati'), + ('vivekananda', 'vivekananda'), + ('aryabhatta', 'aryabhatta'), + ('vashishtha', 'vashishtha'), + ) class Hall(models.Model): @@ -44,8 +51,8 @@ class Hall(models.Model): 'max_accomodation' stores maximum accomodation limit of a Hall of Residence. 'number_students' stores number of students currently residing in a Hall of Residence. """ - hall_id = models.CharField(max_length=10) - hall_name = models.CharField(max_length=50) + hall_id = models.CharField(max_length=255) + hall_name = models.CharField(max_length=255, choices=HostelManagementConstants.HALL_NAMES) max_accomodation = models.IntegerField(default=0) number_students = models.PositiveIntegerField(default=0) @@ -80,22 +87,18 @@ class HallWarden(models.Model): def __str__(self): return str(self.hall) + ' (' + str(self.faculty.id.user.username) + ')' - -class GuestRoomDetail(models.Model): +class HallAdmin(models.Model): """ - Records information related to guest rooms in Hall of Residences. + Records the admin of Hall of Residences. 'hall' refers to the related Hall of Residence. - 'room_no' stores the guest room number. - 'room_status' stores the current status of the guest room from the available choices in 'ROOM_STATUS'. + 'faculty' refers to the acting admin for the same Hall of Residence. """ hall = models.ForeignKey(Hall, on_delete=models.CASCADE) - room_no = models.CharField(max_length=4, unique=True) - room_status = models.CharField(max_length=20, choices=HostelManagementConstants.ROOM_STATUS, default='Available') + faculty = models.ForeignKey(Faculty, on_delete=models.CASCADE) def __str__(self): - return self.room_no - + return str(self.hall) + 'admin ' + '(' + str(self.faculty) + ')' class GuestRoomBooking(models.Model): """ @@ -115,22 +118,22 @@ class GuestRoomBooking(models.Model): 'nationality' stores the nationality of the guests. """ hall = models.ForeignKey(Hall, on_delete=models.CASCADE) - intender = models.ForeignKey(User, on_delete=models.CASCADE) - guest_name = models.CharField(max_length=100) - guest_phone = models.CharField(max_length=15) - guest_email = models.CharField(max_length=40, blank=True) + intender = models.ForeignKey(ExtraInfo, on_delete=models.CASCADE) + guest_name = models.CharField(max_length=255) + guest_phone = models.CharField(max_length=255) + guest_email = models.CharField(max_length=255, blank=True) guest_address = models.TextField(blank=True) - rooms_required = models.IntegerField(default=1,null=True,blank=True) - guest_room_id = models.ManyToManyField(GuestRoomDetail) + rooms_required = models.IntegerField(default=1, null=True, blank=True) + guest_room_id = models.CharField(max_length=255, blank=True) total_guest = models.IntegerField(default=1) purpose = models.TextField() arrival_date = models.DateField(auto_now_add=False, auto_now=False) arrival_time = models.TimeField(auto_now_add=False, auto_now=False) departure_date = models.DateField(auto_now_add=False, auto_now=False) departure_time = models.TimeField(auto_now_add=False, auto_now=False) - status = models.CharField(max_length=15, choices=HostelManagementConstants.BOOKING_STATUS ,default ="Pending") + status = models.CharField(max_length=255, choices=HostelManagementConstants.BOOKING_STATUS ,default ="Pending") booking_date = models.DateField(auto_now_add=False, auto_now=False, default=timezone.now) - nationality = models.CharField(max_length=20, blank=True) + nationality = models.CharField(max_length=255, blank=True) def __str__(self): return '%s ----> %s - %s' % (self.id, self.guest_name, self.status) @@ -148,8 +151,8 @@ class StaffSchedule(models.Model): """ hall = models.ForeignKey(Hall, on_delete=models.CASCADE) staff_id = models.ForeignKey(Staff, on_delete=models.ForeignKey) - staff_type = models.CharField(max_length=100, default='Caretaker') - day = models.CharField(max_length=15, choices=HostelManagementConstants.DAYS_OF_WEEK) + staff_type = models.CharField(max_length=255, default='Caretaker') + day = models.CharField(max_length=255, choices=HostelManagementConstants.DAYS_OF_WEEK) start_time = models.TimeField(null=True,blank=True) end_time = models.TimeField(null=True,blank=True) @@ -169,7 +172,7 @@ class HostelNoticeBoard(models.Model): """ hall = models.ForeignKey(Hall, on_delete=models.CASCADE) posted_by = models.ForeignKey(ExtraInfo, on_delete=models.ForeignKey) - head_line = models.CharField(max_length=100) + head_line = models.CharField(max_length=255) content = models.FileField(upload_to='hostel_management/', blank=True, null=True) description = models.TextField(blank=True) @@ -205,8 +208,8 @@ class HallRoom(models.Model): 'room_occupied' stores the current number of occupants of a room. """ hall = models.ForeignKey(Hall, on_delete=models.CASCADE) - room_no = models.CharField(max_length=4) - block_no = models.CharField(max_length=1) + room_no = models.CharField(max_length=255) + block_no = models.CharField(max_length=255) room_cap = models.IntegerField(default=3) room_occupied = models.IntegerField(default=0) @@ -226,14 +229,14 @@ class WorkerReport(models.Model): 'total_day' stores the number of days in a month. 'remark' stores remarks for a worker. """ - worker_id = models.CharField(max_length=10) + worker_id = models.CharField(max_length=255) hall = models.ForeignKey(Hall, on_delete=models.CASCADE) - worker_name = models.CharField(max_length=50) + worker_name = models.CharField(max_length=255) year = models.IntegerField(default=2020) month = models.IntegerField(default=1) absent = models.IntegerField(default= 0) total_day = models.IntegerField(default=31) - remark = models.CharField(max_length=100) + remark = models.CharField(max_length=255) def str(self): return str(self.worker_name)+'->' + str(self.month) + '-' + str(self.absent) \ No newline at end of file diff --git a/FusionIIIT/applications/hostel_management/urls.py b/FusionIIIT/applications/hostel_management/urls.py index f0ea19b1d..6f7735901 100644 --- a/FusionIIIT/applications/hostel_management/urls.py +++ b/FusionIIIT/applications/hostel_management/urls.py @@ -18,7 +18,12 @@ #Student Room path('edit_student/',views.edit_student_room,name="edit_student_room"), path('edit_student_rooms_sheet/', views.edit_student_rooms_sheet, name="edit_student_rooms_sheet"), + path('insert_rooms/',views.insert_rooms,name="insert_rooms"), + #Guest Room + path('book_guest_room/', views.request_guest_room, name="book_guest_room"), + path('update_guest_room/', views.update_guest_room, name="update_guest_room"), + #Attendance path('edit_attendance/', views.edit_attendance, name='edit_attendance'), diff --git a/FusionIIIT/applications/hostel_management/utils.py b/FusionIIIT/applications/hostel_management/utils.py index 7c7a76648..7402c39af 100644 --- a/FusionIIIT/applications/hostel_management/utils.py +++ b/FusionIIIT/applications/hostel_management/utils.py @@ -5,14 +5,23 @@ from .models import * import re -def get_caretaker_hall(hall_caretakers,user): +def get_staff_hall(hall_caretakers=None, hall_wardens=None, user=None): """ - This function returns hall number corresponding to a caretaker. + This function returns the hall number corresponding to a caretaker or warden. """ - for caretaker in hall_caretakers: - if caretaker.staff.id.user==user: - return caretaker.hall - + if not user: + return None + if hall_caretakers: + for caretaker in hall_caretakers: + if caretaker.staff.id.user == user: + return caretaker.hall + if hall_wardens: + for warden in hall_wardens: + if warden.faculty.id.user == user: + return warden.hall + return None + + def remove_from_room(student): """Removes the student from his current room""" @@ -21,7 +30,7 @@ def remove_from_room(student): room = re.findall('[0-9]+',str(student.room_no)) room_num=str(room[0]) block = str(student.room_no[0]) - hall=Hall.objects.get(hall_id="hall"+str(student.hall_no)) + hall=Hall.objects.get(hall_id=student.hall_id) Room=HallRoom.objects.get(hall=hall,block_no=block,room_no=room_num) Room.room_occupied=Room.room_occupied-1 Room.save() @@ -35,9 +44,9 @@ def add_to_room(student, new_room, new_hall): block=str(new_room[0]) room = re.findall('[0-9]+', new_room) student.room_no=str(block)+"-"+str(room[0]) - student.hall_no = int(new_hall[-1]) + student.hall_id = new_hall student.save() - hall=Hall.objects.get(hall_id="hall"+str(student.hall_no)) + hall=Hall.objects.get(hall_id=student.hall_id) Room=HallRoom.objects.get(hall=hall,block_no=block,room_no=str(room[0])) Room.room_occupied=Room.room_occupied+1 Room.save() diff --git a/FusionIIIT/applications/hostel_management/views.py b/FusionIIIT/applications/hostel_management/views.py index 0015748a4..5e64bebdd 100644 --- a/FusionIIIT/applications/hostel_management/views.py +++ b/FusionIIIT/applications/hostel_management/views.py @@ -20,7 +20,7 @@ from django.views.generic import View from django.db.models import Q from django.contrib import messages -from .utils import render_to_pdf, save_worker_report_sheet,get_caretaker_hall +from .utils import render_to_pdf, save_worker_report_sheet,get_staff_hall from .utils import add_to_room, remove_from_room @login_required @@ -43,7 +43,7 @@ def hostel_view(request, context={}): all_hall = Hall.objects.all() halls_student = {} for hall in all_hall: - halls_student[hall.hall_id] = Student.objects.filter(hall_no=int(hall.hall_id[4])).select_related('id__user') + halls_student[hall.hall_id] = Student.objects.filter(hall_id=hall.hall_id).select_related('id__user') hall_staffs = {} for hall in all_hall: @@ -53,25 +53,34 @@ def hostel_view(request, context={}): hall_notices = {} for hall in all_hall: hall_notices[hall.hall_id] = HostelNoticeBoard.objects.filter(hall=hall).select_related('hall','posted_by__user') + pending_guest_room_requests = {} + for hall in all_hall: + pending_guest_room_requests[hall.hall_id] = GuestRoomBooking.objects.filter(hall=hall, status='Pending').select_related('hall', 'intender__user') + + user_guest_room_requests = GuestRoomBooking.objects.filter(intender=request.user.extrainfo).order_by("-arrival_date") Staff_obj = Staff.objects.all().select_related('id__user') - hall1 = Hall.objects.get(hall_id='hall1') - hall3=Hall.objects.get(hall_id='hall3') - hall4=Hall.objects.get(hall_id='hall4') - hall1_staff = StaffSchedule.objects.filter(hall=hall1) - hall3_staff = StaffSchedule.objects.filter(hall=hall3) - hall4_staff = StaffSchedule.objects.filter(hall=hall4) + vashishtha = Hall.objects.get(hall_id='vashishtha') + aryabhatta = Hall.objects.get(hall_id='aryabhatta') + vivekananda = Hall.objects.get(hall_id='vivekananda') + vashishtha_staff = StaffSchedule.objects.filter(hall=vashishtha) + aryabhatta_staff = StaffSchedule.objects.filter(hall=aryabhatta) + vivekananda_staff = StaffSchedule.objects.filter(hall=vivekananda) + saraswati = Hall.objects.get(hall_id='saraswati') + saraswati_staff = StaffSchedule.objects.filter(hall=saraswati) hall_caretakers = HallCaretaker.objects.all().select_related() hall_wardens = HallWarden.objects.all().select_related() hall_student="" current_hall="" get_avail_room=[] - get_hall=get_caretaker_hall(hall_caretakers,request.user) + + get_hall = get_staff_hall(hall_caretakers, hall_wardens, request.user) if get_hall: - get_hall_num=re.findall('[0-9]+',str(get_hall.hall_id)) - hall_student=Student.objects.filter(hall_no=int(str(get_hall_num[0]))).select_related('id__user') - current_hall='hall'+str(get_hall_num[0]) + get_hall_name = get_hall.hall_id + hall_student = Student.objects.filter(hall_id=get_hall_name).select_related('id__user') + current_hall = get_hall_name + for hall in all_hall: total_rooms=HallRoom.objects.filter(hall=hall) @@ -103,25 +112,27 @@ def hostel_view(request, context={}): context = { - - 'all_hall': all_hall, - 'all_notice': all_notice, - 'staff':Staff_obj, - 'hall1_staff' : hall1_staff, - 'hall3_staff' : hall3_staff, - 'hall4_staff' : hall4_staff, - 'hall_caretaker' : hall_caretaker_user, - 'hall_warden' : hall_warden_user, - 'room_avail' : get_avail_room, - 'hall_student':hall_student, - 'worker_report': worker_report, - 'halls_student': halls_student, - 'current_hall' : current_hall, - 'hall_staffs': hall_staffs, - 'hall_notices': hall_notices, - 'attendance': halls_attendance, - **context - } + 'all_hall': all_hall, + 'all_notice': all_notice, + 'staff': Staff_obj, + 'vashishtha_staff': vashishtha_staff, + 'aryabhatta_staff': aryabhatta_staff, + 'vivekananda_staff': vivekananda_staff, + 'saraswati_staff': saraswati_staff, + 'hall_caretaker': hall_caretaker_user, + 'hall_warden': hall_warden_user, + 'room_avail': get_avail_room, + 'hall_student': hall_student, + 'worker_report': worker_report, + 'halls_student': halls_student, + 'current_hall': current_hall, + 'hall_staffs': hall_staffs, + 'hall_notices': hall_notices, + 'pending_guest_room_requests': pending_guest_room_requests, + 'user_guest_room_requests': user_guest_room_requests, + 'attendance': halls_attendance, + **context +} return render(request, 'hostelmanagement/hostel.html', context) @@ -162,7 +173,7 @@ def staff_edit_schedule(request): except: hall_caretakers = HallCaretaker.objects.all() get_hall="" - get_hall=get_caretaker_hall(hall_caretakers,request.user) + get_hall=get_staff_hall(hall_caretakers=hall_caretakers,user = request.user) StaffSchedule(hall=get_hall,staff_id=staff,day=day,staff_type=staff_type,start_time=start_time,end_time=end_time).save() messages.success(request, 'Staff schedule created successfully.') return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) @@ -253,17 +264,19 @@ def edit_student_rooms_sheet(request): hall_no = row[1].value if row[0].ctype == 2: roll_no = str(int(roll_no)) - if row[1].ctype == 2: - hall_no = str(int(hall_no)) room_no = row[2].value block=str(room_no[0]) room = re.findall('[0-9]+', room_no) is_valid = True student = Student.objects.filter(id=roll_no.strip()) - hall = Hall.objects.filter(hall_id="hall"+hall_no[0]) + hall = Hall.objects.filter(hall_id=hall_no) + print("Hello----------------------->",room_no); + if student and hall.exists(): Room = HallRoom.objects.filter(hall=hall[0],block_no=block,room_no=str(room[0])) + for r in Room: + print("room details------------------------>",r.hall,r.block_no,r.room_no,r.room_occupied,r.room_cap) if Room.exists() and Room[0].room_occupied < Room[0].room_cap: continue else: @@ -288,7 +301,7 @@ def edit_student_rooms_sheet(request): roll_no = str(int(roll_no)) - hall_no = str(int(row[1].value)) + hall_no = row[1].value room_no = row[2].value block=str(room_no[0]) room = re.findall('[0-9]+', room_no) @@ -314,17 +327,49 @@ def edit_student_room(request): students - stores students related to 'batch'. """ if request.method == "POST": - roll_no = request.POST["roll_no"] - hall_room_no=request.POST["hall_room_no"] - index=hall_room_no.find('-') - room_no = hall_room_no[index+1:] - hall_no = hall_room_no[:index] - student = Student.objects.get(id=roll_no) - remove_from_room(student) - add_to_room(student, new_room=room_no, new_hall=hall_no) - messages.success(request, 'Student room changed successfully.') + if 'interchange' in request.POST: + roll_no_1 = request.POST["roll_no_1"] + roll_no_2 = request.POST["roll_no_2"] + student1 = Student.objects.get(id=roll_no_1) + room_no_student1 = student1.room_no + hall_id_student1= student1.hall_id + student2 = Student.objects.get(id=roll_no_2) + room_no_student2 = student2.room_no + hall_id_student2= student2.hall_id + remove_from_room(student1) + remove_from_room(student2) + add_to_room(student1,room_no_student2,hall_id_student2) + add_to_room(student2,room_no_student1,hall_id_student1) + messages.success(request, 'Student room interchange successful.') + else: + roll_no = request.POST["roll_no_1"] + hall_room_no=request.POST["hall_room_no"] + index=hall_room_no.find('-') + room_no = hall_room_no[index+1:] + hall_id = hall_room_no[:index] + student = Student.objects.get(id=roll_no) + remove_from_room(student) + add_to_room(student, new_room=room_no, new_hall=hall_id) + messages.success(request, 'Student room changed successfully.') return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) +def insert_rooms(request): + if request.method == "POST": + sheet = request.FILES["upload_rooms_in_database"] + excel = xlrd.open_workbook(file_contents=sheet.read()) + all_rows = excel.sheets()[0] + for i, row in enumerate(all_rows): + if not i: continue + print(row) + room_no, block_no, room_cap, room_occupied, hall_id = int(row[0].value), str(row[1].value), int(row[2].value), int(row[3].value), int(row[4].value) + existing_room = HallRoom.objects.filter(room_no=room_no, hall_id=hall_id, block_no=block_no) + if existing_room: continue + room = HallRoom(room_cap=room_cap, room_no=room_no, block_no=block_no, room_occupied=room_occupied, hall_id=hall_id) + room.save() + messages.success(request, 'Rooms added to database.') + return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + + def edit_attendance(request): """ This function is used to edit the attendance of a student. @@ -340,7 +385,7 @@ def edit_attendance(request): roll_no = request.POST["roll_no"] student = Student.objects.get(id=roll_no) - hall = Hall.objects.get(hall_id='hall'+str(student.hall_no)) + hall = Hall.objects.get(hall_id=student.hall_id) date = datetime.datetime.today().strftime('%Y-%m-%d') if HostelStudentAttendence.objects.filter(student_id=student,date=date).exists() == True: @@ -355,8 +400,72 @@ def edit_attendance(request): return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) +@login_required +def request_guest_room(request): + """ + This function is used by the student to book a guest room. + @param: + request - HttpRequest object containing metadata about the user request. + """ + print("Inside book guest room") + if request.method == "POST": + form = GuestRoomBookingForm(request.POST) + if form.is_valid(): + print("Iside valid") + hall = form.cleaned_data['hall'] + guest_name = form.cleaned_data['guest_name'] + guest_phone = form.cleaned_data['guest_phone'] + guest_email = form.cleaned_data['guest_email'] + guest_address = form.cleaned_data['guest_address'] + rooms_required = form.cleaned_data['rooms_required'] + total_guest = form.cleaned_data['total_guest'] + purpose = form.cleaned_data['purpose'] + arrival_date = form.cleaned_data['arrival_date'] + arrival_time = form.cleaned_data['arrival_time'] + departure_date = form.cleaned_data['departure_date'] + departure_time = form.cleaned_data['departure_time'] + nationality = form.cleaned_data['nationality'] + + newBooking = GuestRoomBooking.objects.create(hall=hall, intender=request.user.extrainfo, guest_name=guest_name, guest_address=guest_address, + guest_phone=guest_phone, guest_email=guest_email, rooms_required=rooms_required, total_guest=total_guest, purpose=purpose, + arrival_date=arrival_date, arrival_time=arrival_time, departure_date=departure_date, departure_time=departure_time, nationality= nationality) + newBooking.save() + messages.success(request,"Room booked successfuly") + return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + else: + messages.error(request, "Something went wrong") + return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) +@login_required +def update_guest_room(request): + if request.method == "POST": + approve = request.POST['accept_request'] if 'accept_request' in request.POST else None + reject = request.POST['reject_request'] if 'reject_request' in request.POST else None + status = request.POST['status'] if 'status' in request.POST else None + guest_room_request = GuestRoomBooking.objects.get(pk=(approve if approve else reject)) + if approve: + guest_room_request.status = status + guest_room_request.guest_room_id = request.POST['guest_room_id'] + guest_room_request.save() + if reject: + guest_room_request.delete() + messages.success(request, "Changes made successfully!") + return HttpResponseRedirect(reverse("hostelmanagement:hostel_view")) + + + + +@login_required +def allot_hostel_room(request): + if request.method == "POST": + body = request.body + student = body.get('student') + hall_no = body.get('hall_no') + room_no = body.get('room_no') + alot_student = Student.objects.get(id=student.id) + alot_student.hall_no = hall_no + alot_student.room_no = room_no @login_required def generate_worker_report(request): @@ -413,7 +522,7 @@ def get(self, request, *args, **kwargs): hall_caretakers = HallCaretaker.objects.all() get_hall="" - get_hall=get_caretaker_hall(hall_caretakers,request.user) + get_hall=get_staff_hall(hall_caretakers = hall_caretakers,user = request.user) print(get_hall) if months < current_month: worker_report = WorkerReport.objects.filter(hall=get_hall, month__gte=current_month-months, year=current_year) diff --git a/FusionIIIT/applications/hr2/api/serializers.py b/FusionIIIT/applications/hr2/api/serializers.py new file mode 100644 index 000000000..e318fc7ff --- /dev/null +++ b/FusionIIIT/applications/hr2/api/serializers.py @@ -0,0 +1,43 @@ +from applications.hr2.models import models, Employee, EmpConfidentialDetails, EmpDependents, WorkAssignemnt, EmpAppraisalForm, ForeignService +from rest_framework import serializers + +class EmployeeSerializer(serializers.ModelSerializer): + class Meta: + model = Employee + fields = ( 'extra_info' , + 'father_name' , + 'mother_name' , + 'religion', + 'category', + 'cast' , + 'home_district', + 'date_of_joining', + 'designation', + 'blood_group' + ) + +class EmpConfidentialDetailsSerializer(serializers.ModelSerializer): + class Meta: + model = EmpConfidentialDetails + fields=('__all__') + +class EmpDependentsSerializer(serializers.ModelSerializer): + class Meta: + model = EmpDependents + fields=('__all__') + +class ForeignServiceSerializer(serializers.ModelSerializer): + class Meta: + model = ForeignService + fields=('__all__') + +class EmpAppraisalFormSerializer(serializers.ModelSerializer): + class Meta: + model = EmpAppraisalForm + fields=('__all__') + +class WorkAssignemntSerializer(serializers.ModelSerializer): + class Meta: + model = WorkAssignemnt + fields=('__all__') + diff --git a/FusionIIIT/applications/hr2/api/urls.py b/FusionIIIT/applications/hr2/api/urls.py new file mode 100644 index 000000000..93333dfe9 --- /dev/null +++ b/FusionIIIT/applications/hr2/api/urls.py @@ -0,0 +1,13 @@ +from django.conf.urls import url +from . import views + +urlpatterns = [ + + url(r'employee_details/$', views.employee_details_api,name='employee_details_api'), + url(r'emp_confidential_details/$', views.emp_confidential_details_api,name='emp_confidential_details_api'), + url(r'emp_dependents/$', views.emp_dependents_api,name='emp_dependents_api'), + url(r'foreign_service/$', views.foreign_service_api,name='foreign_service_api'), + url(r'emp_appraisal_form/$', views.emp_appraisal_form_api,name='emp_appraisal_form_api'), + url(r'work_assignment/$', views.work_assignment_api,name='work_assignment_api'), +] + \ No newline at end of file diff --git a/FusionIIIT/applications/hr2/api/views.py b/FusionIIIT/applications/hr2/api/views.py new file mode 100644 index 000000000..179a5bb62 --- /dev/null +++ b/FusionIIIT/applications/hr2/api/views.py @@ -0,0 +1,134 @@ +from django.contrib.auth import get_user_model +from django.contrib.auth.decorators import login_required +from django.shortcuts import get_object_or_404 +from django.forms.models import model_to_dict +from rest_framework.permissions import * +from rest_framework.authentication import * +from rest_framework import status +from rest_framework.decorators import api_view, permission_classes,authentication_classes +from rest_framework.permissions import AllowAny +from rest_framework.response import Response +from . import serializers +from applications.hr2.models import * + + +@api_view(['GET','POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +@login_required +def employee_details_api(request,*args,**kwargs): + if request.method == 'GET': + employee_details = Employee.objects.all() + employee_details = serializers.EmployeeSerializer(employee_details,many=True).data + resp = { + 'employee_details' : employee_details, + } + return Response(data=resp,status=status.HTTP_200_OK) + + elif request.method == 'POST': + serializer = serializers.EmployeeSerializer(data=request.data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_201_CREATED) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + + +@api_view(['GET','POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +@login_required +def emp_confidential_details_api(request,*args,**kwargs): + if request.method == 'GET': + emp_confidential_details = EmpConfidentialDetails.objects.all() + emp_confidential_details = serializers.EmpConfidentialDetailsSerializer(emp_confidential_details,many=True).data + resp = { + 'emp_confidential_details' : emp_confidential_details, + } + return Response(data=resp,status=status.HTTP_200_OK) + + elif request.method == 'POST': + serializer = serializers.EmpConfidentialDetailsSerializer(data=request.data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_201_CREATED) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + +@api_view(['GET','POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +@login_required +def emp_dependents_api(request,*args,**kwargs): + if request.method == 'GET': + emp_dependents_details = EmpDependents.objects.all() + emp_dependents_details = serializers.EmpDependentsSerializer(emp_dependents_details,many=True).data + resp = { + 'emp_dependents_details' : emp_dependents_details, + } + return Response(data=resp,status=status.HTTP_200_OK) + + elif request.method == 'POST': + serializer = serializers.EmpDependentsSerializer(data=request.data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_201_CREATED) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + +@api_view(['GET','POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +@login_required +def foreign_service_api(request,*args,**kwargs): + if request.method == 'GET': + foreign_service_details = ForeignService.objects.all() + foreign_service_details = serializers.ForeignServiceSerializer(foreign_service_details,many=True).data + resp = { + 'foreign_service_details' : foreign_service_details, + } + return Response(data=resp,status=status.HTTP_200_OK) + + elif request.method == 'POST': + serializer = serializers.ForeignServiceSerializer(data=request.data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_201_CREATED) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + +@api_view(['GET','POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +@login_required +def emp_appraisal_form_api(request,*args,**kwargs): + if request.method == 'GET': + emp_appraisal_form_details = ForeignService.objects.all() + emp_appraisal_form_details = serializers.EmpAppraisalFormSerializer(emp_appraisal_form_details,many=True).data + resp = { + 'emp_appraisal_form_details' : emp_appraisal_form_details, + } + return Response(data=resp,status=status.HTTP_200_OK) + + elif request.method == 'POST': + serializer = serializers.EmpAppraisalFormSerializer(data=request.data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_201_CREATED) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) + +@api_view(['GET','POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +@login_required +def work_assignment_api(request,*args,**kwargs): + if request.method == 'GET': + work_assignment_details = ForeignService.objects.all() + work_assignment_details = serializers.WorkAssignemntSerializer(work_assignment_details,many=True).data + resp = { + 'work_assignment_details' : work_assignment_details, + } + return Response(data=resp,status=status.HTTP_200_OK) + + elif request.method == 'POST': + serializer = serializers.WorkAssignemntSerializer(data=request.data) + if serializer.is_valid(): + serializer.save() + return Response(serializer.data, status=status.HTTP_201_CREATED) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) diff --git a/FusionIIIT/applications/hr2/serializers.py b/FusionIIIT/applications/hr2/serializers.py new file mode 100644 index 000000000..39c7930c3 --- /dev/null +++ b/FusionIIIT/applications/hr2/serializers.py @@ -0,0 +1,19 @@ +from . import models +from models import employee +from rest_framework import serializers + +class EmployeeSerializer(serializers.ModelSerializer): + class Meta: + model = employee + fields = ( 'extra_info' , + 'father_name' , + 'mother_name' , + 'religion', + 'category', + 'cast' , + 'home_district', + 'date_of_joining', + 'designation', + 'blood_group' + ) + diff --git a/FusionIIIT/applications/hr2/urls.py b/FusionIIIT/applications/hr2/urls.py index 56918efb7..a3089e305 100644 --- a/FusionIIIT/applications/hr2/urls.py +++ b/FusionIIIT/applications/hr2/urls.py @@ -1,5 +1,4 @@ -from django.conf.urls import url - +from django.conf.urls import url,include from . import views app_name = 'hr2' @@ -17,5 +16,5 @@ url(r'^administrativeProfile/$', views.administrative_profile, name='administrativeProfile'), url(r'^addnew/$', views.add_new_user, name='addnew'), - -] + url(r'^api/',include('applications.hr2.api.urls')), +] \ No newline at end of file diff --git a/FusionIIIT/applications/hr2/views.py b/FusionIIIT/applications/hr2/views.py index f2f9d4fcd..e6a5eb668 100644 --- a/FusionIIIT/applications/hr2/views.py +++ b/FusionIIIT/applications/hr2/views.py @@ -12,9 +12,11 @@ from applications.establishment.views import * from applications.eis.models import * from applications.globals.models import ExtraInfo, HoldsDesignation, DepartmentInfo +from applications.leave.models import LeavesCount from html import escape from io import BytesIO import re +import datetime from django.contrib.auth.models import User from django.http import HttpResponse, HttpResponseRedirect @@ -112,7 +114,7 @@ def service_book(request): extra_info=extra_info).filter(service_type="OTHER").order_by('-start_date') appraisal_form = EmpAppraisalForm.objects.filter( extra_info=extra_info).order_by('-year') - pf = extra_info.id + pf = user.id workAssignemnt = WorkAssignemnt.objects.filter( extra_info_id=pf).order_by('-start_date') @@ -241,6 +243,11 @@ def edit_employee_servicebook(request, id): return render(request, template, context) +def to_snake_case(string): + string = re.sub(r'\W+', '_', string) + string = string.lower() + return string + def administrative_profile(request, username=None): user = get_object_or_404( @@ -248,8 +255,12 @@ def administrative_profile(request, username=None): extra_info = get_object_or_404(ExtraInfo, user=user) if extra_info.user_type != 'faculty' and extra_info.user_type != 'staff': return redirect('/') - pf = extra_info.id + pf = user.id + leaves_count = LeavesCount.objects.filter(user_id = request.user.id, year = datetime.date.today().year) + leaves = {} + for leave in leaves_count: + leaves[to_snake_case(leave.leave_type.name)] = int(leave.remaining_leaves) lien_service_book = ForeignService.objects.filter( extra_info=extra_info).filter(service_type="LIEN").order_by('-start_date') deputation_service_book = ForeignService.objects.filter( @@ -278,12 +289,19 @@ def administrative_profile(request, username=None): 'appraisal': True, 'leave': False}) workAssignemnt = WorkAssignemnt.objects.filter( extra_info_id=pf).order_by('-start_date') + design = HoldsDesignation.objects.select_related('user','designation').filter(working=request.user) + + designation=[] + for i in design: + designation.append(str(i.designation)) context = {'user': user, 'pf': pf, 'lienServiceBooks': lien_service_book, 'deputationServiceBooks': deputation_service_book, 'otherServiceBooks': other_service_book, 'extrainfo': extra_info, - 'workAssignment': workAssignemnt + 'workAssignment': workAssignemnt, + 'designation': designation, + 'leaves': leaves } context.update(response) diff --git a/FusionIIIT/applications/income_expenditure/migrations/0001_initial.py b/FusionIIIT/applications/income_expenditure/migrations/0001_initial.py index 1501efdb9..dc23c0380 100644 --- a/FusionIIIT/applications/income_expenditure/migrations/0001_initial.py +++ b/FusionIIIT/applications/income_expenditure/migrations/0001_initial.py @@ -42,19 +42,7 @@ class Migration(migrations.Migration): ('income_source', models.CharField(max_length=100)), ], ), - migrations.CreateModel( - name='otherExpense', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('spent_on', models.CharField(max_length=100)), - ('status', models.CharField(max_length=20)), - ('name', models.CharField(max_length=30)), - ('userid', models.CharField(max_length=10)), - ('amount', models.IntegerField()), - ('date_added', models.DateField()), - ('remarks', models.CharField(blank=True, max_length=100)), - ], - ), + migrations.CreateModel( name='Income', fields=[ diff --git a/FusionIIIT/applications/income_expenditure/migrations/0002_otherexpense.py b/FusionIIIT/applications/income_expenditure/migrations/0002_otherexpense.py new file mode 100644 index 000000000..60f1852ca --- /dev/null +++ b/FusionIIIT/applications/income_expenditure/migrations/0002_otherexpense.py @@ -0,0 +1,26 @@ +# Generated by Django 3.1.5 on 2023-04-10 15:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('income_expenditure', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='otherExpense', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('spent_on', models.CharField(max_length=100)), + ('status', models.CharField(max_length=20)), + ('name', models.CharField(max_length=30)), + ('userid', models.CharField(max_length=10)), + ('amount', models.IntegerField()), + ('date_added', models.DateField()), + ('remarks', models.CharField(blank=True, max_length=100)), + ], + ), + ] diff --git a/FusionIIIT/applications/iwdModuleV2/views.py b/FusionIIIT/applications/iwdModuleV2/views.py index 2b36550fc..7cc9cf67c 100644 --- a/FusionIIIT/applications/iwdModuleV2/views.py +++ b/FusionIIIT/applications/iwdModuleV2/views.py @@ -18,7 +18,7 @@ # in conjunction with SRS. After that, everything will become easier. def dashboard(request): - eligible = False + eligible = True userObj = request.user userDesignationObjects = HoldsDesignation.objects.filter(user=userObj) for p in userDesignationObjects: @@ -107,7 +107,8 @@ def page2_1(request): def corrigendumInput(request): if request.method == 'POST': - existingObject = CorrigendumTable.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = CorrigendumTable.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = CorrigendumTable() @@ -128,7 +129,8 @@ def corrigendumInput(request): def addendumInput(request): if request.method == 'POST': - existingObject = Addendum.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = Addendum.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = Addendum() @@ -145,7 +147,8 @@ def addendumInput(request): def PreBidForm(request): if request.method == 'POST': - existingObject = PreBidDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = PreBidDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = PreBidDetails() @@ -161,9 +164,11 @@ def PreBidForm(request): def noOfEntriesTechnicalBid(request): formNoTechnicalObjects = NoOfTechnicalBidTimes() - formNoTechnicalObjects.key = Projects.objects.get(id=request.session['projectId']) + formNoTechnicalObjects.key = Projects.objects.get( + id=request.session['projectId']) if request.method == 'POST': - existingObject = NoOfTechnicalBidTimes.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = NoOfTechnicalBidTimes.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formNoTechnicalObjects.number = int(request.POST['number']) @@ -174,9 +179,11 @@ def noOfEntriesTechnicalBid(request): def TechnicalBidForm(request): formObject = TechnicalBidDetails() - numberOfTechnicalBidTimes = NoOfTechnicalBidTimes.objects.get(key=Projects.objects.get(id=request.session['projectId'])).number + numberOfTechnicalBidTimes = NoOfTechnicalBidTimes.objects.get( + key=Projects.objects.get(id=request.session['projectId'])).number if request.method == 'POST': - existingObject = TechnicalBidDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = TechnicalBidDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = TechnicalBidDetails() @@ -184,12 +191,14 @@ def TechnicalBidForm(request): formObject.sNo = request.POST['sNo'] formObject.requirements = request.POST['requirements'] formObject.save() - TechnicalBidContractorDetails.objects.filter(key=formObject).all().delete() + TechnicalBidContractorDetails.objects.filter( + key=formObject).all().delete() for w in range(numberOfTechnicalBidTimes): formContractorObject = TechnicalBidContractorDetails() formContractorObject.key = formObject formContractorObject.name = request.POST[str(w) + 'name'] - formContractorObject.description = request.POST[str(w) + 'Description'] + formContractorObject.description = request.POST[str( + w) + 'Description'] formContractorObject.save() return redirect('iwdModuleV2/noOfEntriesFinancialBid') return render(request, 'iwdModuleV2/page2_support_4_technicalbid.html', @@ -198,12 +207,15 @@ def TechnicalBidForm(request): def noOfEntriesFinancialBid(request): listOfContractors = [] - objectTechnicalBid = TechnicalBidDetails.objects.get(key=Projects.objects.get(id=request.session['projectId'])) - objects = TechnicalBidContractorDetails.objects.filter(key=objectTechnicalBid) + objectTechnicalBid = TechnicalBidDetails.objects.get( + key=Projects.objects.get(id=request.session['projectId'])) + objects = TechnicalBidContractorDetails.objects.filter( + key=objectTechnicalBid) for t in objects: listOfContractors.append(t.name) if request.method == 'POST': - existingObject = FinancialBidDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = FinancialBidDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = FinancialBidDetails() @@ -217,7 +229,8 @@ def noOfEntriesFinancialBid(request): formContractorObject.name = listOfContractors[f] formContractorObject.totalCost = request.POST[listOfContractors[f] + 'totalCost'] formContractorObject.estimatedCost = request.POST[listOfContractors[f] + 'estimatedCost'] - formContractorObject.percentageRelCost = request.POST[listOfContractors[f] + 'percentageRelCost'] + formContractorObject.percentageRelCost = request.POST[ + listOfContractors[f] + 'percentageRelCost'] formContractorObject.perFigures = request.POST[listOfContractors[f] + 'perFigures'] formContractorObject.save() return redirect('iwdModuleV2/letterOfIntent') @@ -227,7 +240,8 @@ def noOfEntriesFinancialBid(request): def letterOfIntent(request): if request.method == 'POST': - existingObject = LetterOfIntentDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = LetterOfIntentDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = LetterOfIntentDetails() @@ -244,7 +258,8 @@ def letterOfIntent(request): def workOrderForm(request): if request.method == 'POST': - existingObject = WorkOrderForm.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = WorkOrderForm.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = WorkOrderForm() @@ -267,7 +282,8 @@ def workOrderForm(request): def AgreementInput(request): if request.method == 'POST': - existingObject = Agreement.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + existingObject = Agreement.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) if existingObject.count() == 1: existingObject.delete() formObject = Agreement() @@ -291,7 +307,8 @@ def milestonesForm(request): formObject.timeAllowed = request.POST['timeAllowed'] formObject.save() return redirect('iwdModuleV2/page3_1') - Milestones.objects.filter(key=Projects.objects.get(id=request.session['projectId'])).all().delete() + Milestones.objects.filter(key=Projects.objects.get( + id=request.session['projectId'])).all().delete() return render(request, 'iwdModuleV2/page2_support_9_milestone.html', {}) @@ -321,35 +338,42 @@ def ExtensionOfTimeForm(request): def page1View(request): - request.session['projectId'] = request.POST['id'] - projectPageOne = PageOneDetails.objects.get(id=Projects.objects.get(id=request.session['projectId'])) + if request.POST: + request.session['projectId'] = request.POST['id'] + projectPageOne = PageOneDetails.objects.get( + id=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/Page1.html', {'x': projectPageOne}) def page2View(request): - projectPageTwo = PageTwoDetails.objects.get(id=Projects.objects.get(id=request.session['projectId'])) + projectPageTwo = PageTwoDetails.objects.get( + id=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/Page2.html', {'x': projectPageTwo}) def AESView(request): - objects = AESDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + objects = AESDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/AA&ES.html', {'AES': objects}) def financialBidView(request): elements = [] - objects = FinancialBidDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + objects = FinancialBidDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) for f in objects: contractorObjects = FinancialContractorDetails.objects.filter(key=f) for w in contractorObjects: - obj = [f.sNo, f.description, w.name, w.estimatedCost, w.percentageRelCost, w.perFigures, w.totalCost] + obj = [f.sNo, f.description, w.name, w.estimatedCost, + w.percentageRelCost, w.perFigures, w.totalCost] elements.append(obj) return render(request, 'iwdModuleV2/Page2_financialbid.html', {'financial': elements}) def technicalBidView(request): elements = [] - objects = TechnicalBidDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + objects = TechnicalBidDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) for f in objects: contractorObjects = TechnicalBidContractorDetails.objects.filter(key=f) for w in contractorObjects: @@ -359,45 +383,54 @@ def technicalBidView(request): def preBidDetailsView(request): - preBidObjects = PreBidDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + preBidObjects = PreBidDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/Page2_pre-bid.html', {'preBidDetails': preBidObjects}) def corrigendumView(request): - corrigendumObject = CorrigendumTable.objects.get(key=Projects.objects.get(id=request.session['projectId'])) + corrigendumObject = CorrigendumTable.objects.get( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/corrigendum.html', {'corrigendum': corrigendumObject}) def addendumView(request): - addendumObject = Addendum.objects.get(key=Projects.objects.get(id=request.session['projectId'])) + addendumObject = Addendum.objects.get( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/Addendum.html', {'x': addendumObject}) def letterOfIntentView(request): - letterOfIntentObject = LetterOfIntentDetails.objects.get(key=Projects.objects.get(id=request.session['projectId'])) + letterOfIntentObject = LetterOfIntentDetails.objects.get( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/letterOfIntent.html', {'x': letterOfIntentObject}) def workOrderFormView(request): - workOrderFormObject = WorkOrderForm.objects.get(key=Projects.objects.get(id=request.session['projectId'])) + workOrderFormObject = WorkOrderForm.objects.get( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/WorkOrderForm.html', {'x': workOrderFormObject}) def agreementView(request): - agreementObject = Agreement.objects.get(key=Projects.objects.get(id=request.session['projectId'])) + agreementObject = Agreement.objects.get( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/Agreement.html', {'agreement': agreementObject}) def milestoneView(request): - milestoneObjects = Milestones.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + milestoneObjects = Milestones.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/Page2_milestones.html', {'milestones': milestoneObjects}) def page3View(request): - pageThreeDetails = PageThreeDetails.objects.get(id=Projects.objects.get(id=request.session['projectId'])) + pageThreeDetails = PageThreeDetails.objects.get( + id=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/Page3.html', {'x': pageThreeDetails}) def extensionFormView(request): - extensionObjects = ExtensionOfTimeDetails.objects.filter(key=Projects.objects.get(id=request.session['projectId'])) + extensionObjects = ExtensionOfTimeDetails.objects.filter( + key=Projects.objects.get(id=request.session['projectId'])) return render(request, 'iwdModuleV2/ExtensionForm.html', {'extension': extensionObjects}) diff --git a/FusionIIIT/applications/leave/forms.py b/FusionIIIT/applications/leave/forms.py index 73d939b89..ca503a78d 100644 --- a/FusionIIIT/applications/leave/forms.py +++ b/FusionIIIT/applications/leave/forms.py @@ -21,7 +21,7 @@ class StudentApplicationForm(forms.Form): end_date = forms.DateField(label='To') purpose = forms.CharField(label='Purpose', widget=forms.TextInput) address = forms.CharField(label='Address') - document = forms.FileField(label='Related Document', required=False) + document = forms.FileField(label='Related Document', required=False, widget=forms.ClearableFileInput(attrs={'multiple': True})) def __init__(self, *args, **kwargs): if 'user' in kwargs: @@ -32,32 +32,60 @@ def clean(self, *args, **kwargs): super(StudentApplicationForm, self).clean(*args, **kwargs) data = self.cleaned_data errors = dict() + + today = timezone.now().date() - """if data.get('start_date') < today: + if data.get('start_date') < today: errors['start_date'] = ['Past Dates are not allowed'] if data.get('end_date') < today: errors['end_date'] = ['Past Dates are not allowed'] -""" + + try: + fileS = data.get('document').size + if int(fileS) > 2048000: + errors['document'] = ['Documents must not be greater than 2Mb'] + except: + pass + + lt = LeaveType.objects.filter(name=data.get('leave_type')).first() + # if lt is None, use default + if lt is None: + lt = LeaveType() + if lt.requires_proof and not data.get('document'): errors['document'] = [f'{lt.name} Leave requires document proof'] - if data.get('start_date') > data.get('end_date'): - if 'start_date' in errors: - errors['start_date'].append('Start Date must be less than End Date') - else: - errors['start_date'] = ['Start Date must be less than End Date'] + try: + if data.get('start_date') > data.get('end_date'): + if 'start_date' in errors: + errors['start_date'].append('Start Date must be less than End Date') + else: + errors['start_date'] = ['Start Date must be less than End Date'] + except: + pass + + try: + leave_type = LeaveType.objects.get(name=data.get('leave_type')) + except LeaveType.DoesNotExist: + leave_type = LeaveType() - leave_type = LeaveType.objects.get(name=data.get('leave_type')) count = get_leave_days(data.get('start_date'), data.get('end_date'), leave_type, False, False) - remaining_leaves = LeavesCount.objects.get(user=self.user, leave_type=leave_type) \ + try: + remaining_leaves = LeavesCount.objects.get(user=self.user, leave_type=leave_type) \ .remaining_leaves - if remaining_leaves < count: - errors['leave_type'] = f'You have only {remaining_leaves} {leave_type.name} leaves' \ - ' remaining.' + except LeavesCount.DoesNotExist: + remaining_leaves = LeavesCount().remaining_leaves + + try: + if remaining_leaves < count: + errors['leave_type'] = f'You have only {remaining_leaves} {leave_type.name} leaves' \ + ' remaining.' + except: + pass raise VE(errors) @@ -117,7 +145,11 @@ def clean(self, *args, **kwargs): errors = dict() def check_special_leave_overlap(start_date, end_date, leave_type_id): - leave_type = LeaveType.objects.get(id=leave_type_id) + try: + leave_type = LeaveType.objects.get(id=leave_type_id) + except LeaveType.DoesNotExist: + leave_type = LeaveType() + if leave_type.name.lower() in ['restricted']: count = get_special_leave_count(start_date, end_date, leave_type.name.lower()) if count < 0: @@ -324,7 +356,11 @@ def clean(self): for form in self.forms: try: data = form.cleaned_data - leave_type = LeaveType.objects.get(id=data.get('leave_type')) + + try: + leave_type = LeaveType.objects.get(id=data.get('leave_type')) + except LeaveType.DoesNotExist: + leave_type = LeaveType() #if leave_type.is_station: # continue @@ -399,7 +435,11 @@ def clean(self, *args, **kwargs): errors = dict() def check_special_leave_overlap(start_date, end_date, leave_type_id): - leave_type = LeaveType.objects.get(id=leave_type_id) + try: + leave_type = LeaveType.objects.get(id=leave_type_id) + except LeaveType.DoesNotExist: + leave_type = LeaveType() + if leave_type.name.lower() in ['restricted']: count = get_special_leave_count(start_date, end_date, leave_type.name.lower()) if count < 0: @@ -575,7 +615,10 @@ def clean(self): for form in self.forms: try: data = form.cleaned_data - leave_type = LeaveType.objects.get(id=data.get('leave_type')) + try: + leave_type = LeaveType.objects.get(id=data.get('leave_type')) + except LeaveType.DoesNotExist: + leave_type = LeaveType() #if leave_type.is_station: # continue diff --git a/FusionIIIT/applications/leave/handlers.py b/FusionIIIT/applications/leave/handlers.py index 03488a35d..6f0dcc582 100644 --- a/FusionIIIT/applications/leave/handlers.py +++ b/FusionIIIT/applications/leave/handlers.py @@ -32,6 +32,22 @@ def add_leave_segment(form, type_of_leaves): + """ + Creates a new LeaveSegment object using form data and returns it. + + Parameters: + - form: the LeaveSegmentForm object containing the form data + - type_of_leaves: the queryset of available LeaveType objects + + Description: + This function creates a new LeaveSegment object using the cleaned form data. It retrieves the selected + LeaveType object from the provided queryset and uses the form data to create a new LeaveSegment object. + The function then returns the created LeaveSegment object. + + Results: + This function returns a new LeaveSegment object created using the form data. The object includes the + selected LeaveType, start date, end date, start half, end half, document, and address information. + """ data = form.cleaned_data leave_type = type_of_leaves.get(id=data.get('leave_type')) leave_segment = LeaveSegment( @@ -47,6 +63,21 @@ def add_leave_segment(form, type_of_leaves): def add_acad_rep_segment(form): + """ + Creates a new ReplacementSegment object for academic replacement using form data and returns it. + + Parameters: + - form: the AcademicReplacementSegmentForm object containing the form data + + Description: + This function creates a new ReplacementSegment object for academic replacement using the cleaned form data. + It retrieves the selected academic representative's user object and uses the form data to create a new + ReplacementSegment object. The function then returns the created ReplacementSegment object. + + Results: + This function returns a new ReplacementSegment object created using the form data. The object includes the + replacer user object, replacement type 'academic', start date, and end date information. + """ data = form.cleaned_data rep_user = User.objects.get(username=data.get('acad_rep')) rep = ReplacementSegment( @@ -59,6 +90,21 @@ def add_acad_rep_segment(form): def add_admin_rep_segment(form): + """ + Creates a new ReplacementSegment object for administrative replacement using form data and returns it. + + Parameters: + - form: the AdminReplacementSegmentForm object containing the form data + + Description: + This function creates a new ReplacementSegment object for administrative replacement using the cleaned form data. + It retrieves the selected administrative representative's user object and uses the form data to create a new + ReplacementSegment object. The function then returns the created ReplacementSegment object. + + Results: + This function returns a new ReplacementSegment object created using the form data. The object includes the + replacer user object, replacement type 'administrative', start date, and end date information. + """ data = form.cleaned_data rep_user = User.objects.get(username=data.get('admin_rep')) rep = ReplacementSegment( @@ -71,6 +117,22 @@ def add_admin_rep_segment(form): def add_leave_segment_offline(form, type_of_leaves): + """ + Creates a new LeaveSegmentOffline object using form data and returns it. + + Parameters: + - form: the LeaveSegmentOfflineForm object containing the form data + - type_of_leaves: the queryset of available LeaveType objects + + Description: + This function creates a new LeaveSegmentOffline object using the cleaned form data. It retrieves the selected + LeaveType object from the provided queryset and uses the form data to create a new LeaveSegmentOffline object. + The function then returns the created LeaveSegmentOffline object. + + Results: + This function returns a new LeaveSegmentOffline object created using the form data. The object includes the + selected LeaveType, start date, end date, start half, end half, document, and address information. + """ data = form.cleaned_data leave_type = type_of_leaves.get(id=data.get('leave_type')) leave_segment = LeaveSegmentOffline( @@ -86,6 +148,21 @@ def add_leave_segment_offline(form, type_of_leaves): def add_acad_rep_segment_offline(form): + """ + Creates a new ReplacementSegmentOffline object for academic replacement using form data and returns it. + + Parameters: + - form: the AcademicReplacementSegmentOfflineForm object containing the form data + + Description: + This function creates a new ReplacementSegmentOffline object for academic replacement using the cleaned form data. + It retrieves the selected academic representative's user object and uses the form data to create a new + ReplacementSegmentOffline object. The function then returns the created ReplacementSegmentOffline object. + + Results: + This function returns a new ReplacementSegmentOffline object created using the form data. The object includes the + replacer user object, replacement type 'academic', start date, and end date information. + """ data = form.cleaned_data rep_user = User.objects.get(username=data.get('acad_rep')) rep = ReplacementSegmentOffline( @@ -98,6 +175,21 @@ def add_acad_rep_segment_offline(form): def add_admin_rep_segment_offline(form): + """ + Creates a new ReplacementSegmentOffline object for administrative replacement using form data and returns it. + + Parameters: + - form: the AdminReplacementSegmentOfflineForm object containing the form data + + Description: + This function creates a new ReplacementSegmentOffline object for administrative replacement using the cleaned form + data. It retrieves the selected administrative representative's user object and uses the form data to create a new + ReplacementSegmentOffline object. The function then returns the created ReplacementSegmentOffline object. + + Results: + This function returns a new ReplacementSegmentOffline object created using the form data. The object includes the + replacer user object, replacement type 'administrative', start date, and end date information. + """ data = form.cleaned_data rep_user = User.objects.get(username=data.get('admin_rep')) rep = ReplacementSegmentOffline( @@ -111,6 +203,27 @@ def add_admin_rep_segment_offline(form): @transaction.atomic def handle_faculty_leave_application(request): + """ + Handle faculty leave application by validating and creating Leave, LeaveSegment, + and ReplacementSegment objects. + + Args: + request (HttpRequest): HTTP request object representing the faculty leave application. + + Returns: + HttpResponse: HTTP response object representing the success/failure of the faculty leave application. + + Raises: + N/A + + Required Modules: + django.db.transaction + django.shortcuts.redirect + django.shortcuts.render + django.urls.reverse + django.contrib.messages.add_message + + """ leave_form_set = LeaveFormSet(request.POST, request.FILES, prefix='leave_form', user=request.user) academic_form_set = AcadFormSet(request.POST, prefix='acad_form', @@ -190,6 +303,19 @@ def handle_faculty_leave_application(request): def handle_staff_leave_application(request): + """ + View function to handle staff leave application. + It renders the leave.html template for GET request and handles the leave application + submission for POST request. + Args: + request (HttpRequest): The HTTP request object. + + Returns: + HttpResponse: The HTTP response object. + + Raises: + None + """ leave_form_set = LeaveFormSet(request.POST, request.FILES, prefix='leave_form', user=request.user) admin_form_set = AdminFormSet(request.POST, prefix='admin_form', @@ -264,7 +390,20 @@ def handle_staff_leave_application(request): @transaction.atomic def handle_student_leave_application(request): + """ + Handle student leave application. + + This view function handles the form submission of student leave application. If the form is valid, the leave application is + created and a leave request is sent to the concerned leave authority. Then, the leave balance of the student is deducted. + + Parameters: + request : HttpRequest object + The HTTP request object representing the current request. + Returns: + HttpResponse object + The HTTP response object representing the resulting page. + """ form = StudentApplicationForm(request.POST, request.FILES, user=request.user) user_designation = get_designation(request.user) @@ -275,8 +414,14 @@ def handle_student_leave_application(request): purpose=data.get('purpose'), extra_info=data.get('leave_info'), ) + leave.save() + + try: + leave_type = LeaveType.objects.get(name=data.get('leave_type')) + except LeaveType.DoesNotExist: + leave_type = LeaveType() - leave_type = LeaveType.objects.get(name=data.get('leave_type')) + leave_type.save() LeaveSegment.objects.create( leave=leave, @@ -285,7 +430,9 @@ def handle_student_leave_application(request): start_date=data.get('start_date'), end_date=data.get('end_date') ) - requested_from = request.user.leave_admins.authority.designees.first().user + + requested_from = request.user + LeaveRequest.objects.create( leave=leave, requested_from=requested_from @@ -306,6 +453,17 @@ def handle_student_leave_application(request): def send_faculty_leave_form(request): + """ + Method name: send_faculty_leave_form(request) + + Parameters: + request: HttpRequest object representing the current request. + Short description: + Renders the 'leave.html' template with context data containing various form sets, leave balance, leave requests, and leave applications for a faculty member. + + Results: + Returns an HttpResponse object that renders the 'leave.html' template with context data containing various form sets, leave balance, leave requests, and leave applications for a faculty member. + """ rep_segments = request.user.rep_requests.filter(status='pending') leave_requests = get_pending_leave_requests(request.user) leave_balance = request.user.leave_balance.all() @@ -333,6 +491,20 @@ def send_faculty_leave_form(request): def send_staff_leave_form(request): + """ + The send_staff_leave_form function accepts a request object and generates a context dictionary containing information related to staff leave requests. The context dictionary is then rendered using the leaveModule/leave.html template and returned as an HTTP response. + + Parameters: + request: An HTTP request object. + + Returns: + An HTTP response object containing the leaveModule/leave.html template rendered with the context dictionary. + + Short Description: + This function generates a context dictionary containing information related to staff leave requests and renders it using the leaveModule/leave.html template. + Note: + The function assumes that the LeaveFormSet, AdminFormSet, and common_form objects are defined and imported from other modules. + """ rep_segments = request.user.rep_requests.filter(status='pending') leave_balance = request.user.leave_balance.all() leave_requests = get_pending_leave_requests(request.user) @@ -360,6 +532,17 @@ def send_staff_leave_form(request): def send_student_leave_form(request): + """ + Method : send_student_leave_form(request) + Sends the leave application form to the student user along with their leave balance and any + previous leave applications made by the user. + + Parameters: + - request: HttpRequest object representing the incoming request + + Returns: + - HttpResponse object representing the rendered leave application page with all the necessary context data. + """ leave_balance = request.user.leave_balance.all() user_leave_applications = Leave.objects.filter(applicant=request.user).order_by('-timestamp') form = StudentApplicationForm(initial={}, user=request.user) @@ -376,6 +559,20 @@ def send_student_leave_form(request): @transaction.atomic def intermediary_processing(request, leave_request): + """ + Function: `intermediary_processing(request, leave_request)` + + Parameters: + + request: HttpRequest object representing the current request + leave_request: LeaveRequest object representing the leave request being processed + + Description: + This function handles the processing of a leave request by an intermediary authority. It retrieves the status and remark submitted with the request, updates the leave request object with the remark, and performs the appropriate action based on the status. If the status is 'forward', the leave request is marked as forwarded and a new leave request is created for the next authority. If the status is not 'forward', the leave request is marked as rejected and the corresponding leave object is updated with the 'rejected' status and remark. The function also sends notifications to the applicant and updates the leave balance if necessary. + + Returns: + A JsonResponse object containing a status flag and a message indicating the success or failure of the processing. + """ status = request.POST.get('status') remark = request.POST.get('remark') leave_request.remark = remark @@ -406,6 +603,18 @@ def intermediary_processing(request, leave_request): @transaction.atomic def authority_processing(request, leave_request): + """ + authority_processing(request, leave_request) + Parameters: + - request: HTTP request object + - leave_request: LeaveRequest object + + Short description: + This function handles the processing of a leave request by the Leave Sanctioning Authority. + + Results: + This function updates the status and remark of the given leave_request object based on the action taken by the Leave Sanctioning Authority. If the leave request is accepted, it updates the status of the associated leave object, creates a migration object, and sends a notification to the applicant. If the leave request is forwarded, it creates a new LeaveRequest object for the next level of authority and sends a notification to the applicant and officer. If the leave request is rejected, it updates the status of the associated leave object, restores the leave balance, and sends a notification to the applicant. + """ status = request.POST.get('status') remark = request.POST.get('remark') leave_request.remark = remark @@ -450,6 +659,19 @@ def authority_processing(request, leave_request): @transaction.atomic def officer_processing(request, leave_request): + """ + Method name: officer_processing(request, leave_request) + + Parameters: + - request: HttpRequest object representing the current request + - leave_request: LeaveRequest object representing the leave request being processed + + Short description: + This function is responsible for processing a leave request by a Leave Sanctioning Officer. It updates the status and remark of the leave request and leave objects, and sends notification to the applicant. + + Results: + The function generates a JSON response with status and message indicating whether the leave request was successfully accepted or rejected. + """ status = request.POST.get('status') remark = request.POST.get('remark') leave_request.remark = remark @@ -477,6 +699,14 @@ def officer_processing(request, leave_request): @transaction.atomic def process_staff_faculty_application(request): + """ + Processes staff/faculty leave requests and replacement requests by updating the relevant database objects. + If a replacement request is accepted, and all other replacements have been accepted, the function creates a LeaveRequest object for the appropriate authority to approve the leave request. If a replacement request is rejected, the leave request associated with it is also rejected, and any other pending replacement requests are automatically rejected. If the original request was submitted by an authority, it is forwarded to the next level of authority for approval. + + :param request: The HTTP request object. + + :return: A JSON response indicating the success of the operation. + """ is_replacement_request = request.POST.get('rep') status = request.POST.get('status') id = request.POST.get('id') @@ -537,6 +767,16 @@ def process_staff_faculty_application(request): @transaction.atomic def process_student_application(request): + """ + Function : process_student_application(request) + Processes a student leave application by either accepting or rejecting it, based on the input parameters. + Args: + request (HttpRequest): The HTTP request object containing the input parameters. + + Returns: + A JsonResponse object containing the status and message indicating whether the leave request was successfully + accepted or rejected, or an error message if the user is not authorized to process the request. + """ leave_request = LeaveRequest.objects.get(id=request.POST.get('id')) if request.user == leave_request.requested_from: status = request.POST.get('status') @@ -565,6 +805,18 @@ def process_student_application(request): def delete_leave_application(request): + """ + Function Name: delete_leave_application + + Parameters: + request: HTTP request object containing data for the leave application to be deleted + + Description: + This function handles the cancellation of a leave application by a user. The function checks if the leave exists, belongs to the user and has not been rejected, and that the start date of the leave is not past. If these conditions are met, any accepted replacement segments or leave requests associated with the leave are cancelled, and the leave is deleted. Notifications are sent to any affected users. If the conditions are not met, an error response is sent. + + Returns: + response: A JSON response containing a status message indicating whether the leave was successfully cancelled or not. + """ leave_id = request.POST.get('id') leave = request.user.all_leaves.filter(id=leave_id).first() leave_start_date = LeaveSegment.objects.filter(leave=leave).first().start_date @@ -596,7 +848,20 @@ def delete_leave_application(request): @transaction.atomic def handle_offline_leave_application(request): + """ + Function Name : `handle_offline_leave_application(request)` + Parameter list: + + `request`: an HTTP request object representing the current request. + Short description: + + The function handles the submission of an offline leave application by a staff or faculty member. It performs form validation, creates leave and replacement segments, deducts leave balance, sends a notification, and redirects to the leave manager page. + + Results/queries: + + The function creates a new instance of LeaveOffline and saves it to the database, along with its corresponding LeaveSegmentOffline and ReplacementSegmentOffline instances. It also deducts the leave balance of the applicant, sends a notification to the leave module, and redirects to the leave manager page. If the form is not valid, it displays an error message and renders the form page again with the input data. If the user is a staff member, the academic form set is not needed and is not validated. The function returns an HTTP response object. + """ try: leave_form_set = LeaveFormSetOffline(request.POST, request.FILES, prefix='leave_form_offline') @@ -729,6 +994,18 @@ def handle_offline_leave_application(request): def send_offline_leave_form(request): + """ + Function definition: send_offline_leave_form(request) + + Parameter list: + - request: The HTTP request sent by the client. + + Short description: + This function generates a context dictionary with formsets and a common form to be rendered in the 'leaveModule/test.html' template. + + Results: + The function returns a rendered HTTP response with the 'leaveModule/test.html' template, which displays formsets and a common form. + """ #rep_segments = request.user.rep_requests_offline.all() #leave_balance = request.user.leave_balance.all() #user_leave_applications = LeaveOffline.objects.filter(applicant=request.user).order_by('-timestamp') diff --git a/FusionIIIT/applications/leave/helpers.py b/FusionIIIT/applications/leave/helpers.py index 542ac343f..06a3cce49 100644 --- a/FusionIIIT/applications/leave/helpers.py +++ b/FusionIIIT/applications/leave/helpers.py @@ -7,18 +7,54 @@ from .models import LeaveMigration, LeaveRequest, LeavesCount def get_designation(user): + """ + Function Definition: get_designation(user) + + Parameter List: + + user: a User object representing the user for whom the designation is being retrieved + + Short Description: + + This function retrieves the designation of a user from the database by querying the HoldsDesignation and Designation models. If the user holds the Assistant Registrar designation, the function returns "Assistant Registrar" as the designation. + + Results: + + This function returns the designation of the user as a string. If the user holds the Assistant Registrar designation, "Assistant Registrar" is returned as the designation. The function also prints the designation to the console. + """ desig = list(HoldsDesignation.objects.all().filter(working = user).values_list('designation')) b = [i for sub in desig for i in sub] - c=str(Designation.objects.get(id=b[0])) - for i in b: - if str(Designation.objects.get(id=i))=='Assistant Registrar': - c='Assistant Registrar' - break + try: + c=str(Designation.objects.get(id=b[0])) + for i in b: + obj = Designation.objects.get(id=i) + if str(obj)=='Assistant Registrar': + c='Assistant Registrar' + elif str(obj)== 'administrative': + c='administrative' + except: + c = 'administrative' + print(c) return c def get_user_choices(user): + """ + Function name: get_user_choices(user) + + Parameter: + + user: a User object representing the current user + + Description: + This function retrieves a list of user choices based on the user type of the current user. If the current user's user type is not defined, an empty list is returned. Otherwise, it returns a list of tuples, with each tuple containing the username and full name of a user with the same user type as the current user. The list excludes the current user. + + Return: + + USER_CHOICES: a list of tuples representing the user choices, or an empty list if the current user's user type is not defined. + """ + """ @@ -53,6 +89,23 @@ def get_user_choices(user): def get_special_leave_count(start, end, leave_name): + """ + Function Definition: get_special_leave_count(start, end, leave_name) + + Parameters: + + - start: A datetime object representing the start date of the leave period + - end: A datetime object representing the end date of the leave period + - leave_name: A string representing the name of the special leave + + Short Description: + + This function calculates the number of special leaves taken between two dates, based on the given name of the special leave. + + Results: + + The function returns a float value representing the number of special leaves taken. If any of the days between start and end are not a special leave day, the function returns -1. + """ #from applications.academic_information.models import Holiday #special_holidays = Holiday.objects.filter(holiday_name=leave_name) from applications.leave.models import RestrictedHoliday @@ -70,6 +123,23 @@ def get_special_leave_count(start, end, leave_name): # return [start+datetime.timedelta(days=i) for i in range(r)] def get_vacation_leave_count(start,end,leave_name): + """ + Function definition: get_vacation_leave_count(start,end,leave_name): + + Parameter list: + + - start: a datetime.date object representing the start date of the period for which vacation leave count is to be calculated + - end: a datetime.date object representing the end date of the period for which vacation leave count is to be calculated + - leave_name: a string representing the name of the vacation leave for which the count is to be calculated + + Short description: + + This function calculates the count of vacation leave for a given period. + + Results: + + This function returns a float value representing the count of vacation leave for the given period. If the vacation holiday does not exist for any of the dates in the given period, the function returns -1. + """ #win_start = datetime.date(2018,12,1) #win_end = datetime.date(2018,12,31) #vacation_winter=date_range(win_start,win_end) @@ -88,27 +158,49 @@ def get_vacation_leave_count(start,end,leave_name): def get_leave_days(start, end, leave_type, start_half, end_half): + """ + Function definition: get_leave_days(start, end, leave_type, start_half, end_half) + + Parameter List: + + - start: A datetime object representing the starting date of the leave + - end: A datetime object representing the ending date of the leave + - leave_type: A LeaveType object representing the type of leave being requested + - start_half: A boolean value indicating if the start date of the leave includes half-day + - end_half: A boolean value indicating if the end date of the leave includes half-day + + Short Description: + + This function calculates the number of leave days between the start and end dates based on the leave_type and whether the leave includes half-day or not. + + Results: + + The function returns the number of leave days as a float value. + """ count = 0.0 leave_name = leave_type.name # TODO: Remove this hard code and make it database dependent # Maybe add one field in leave type, which tells that this has to be taken from # academic calendar - if leave_name.lower()=='restricted': - count = get_special_leave_count(start, end, leave_name.lower()) - elif leave_name.lower()=='vacation': - count = get_vacation_leave_count(start, end, leave_name.lower()) - else: - while start <= end: - if not start.weekday() in [5, 6]: - count += 1.0 + try: + if leave_name.lower()=='restricted': + count = get_special_leave_count(start, end, leave_name.lower()) + elif leave_name.lower()=='vacation': + count = get_vacation_leave_count(start, end, leave_name.lower()) + else: + while start <= end: + if not start.weekday() in [5, 6]: + count += 1.0 - start = start + datetime.timedelta(days=1) + start = start + datetime.timedelta(days=1) - if start_half and start.weekday() not in [5, 6]: - count -= 0.5 - if end_half and end.weekday() not in [5, 6]: - count -= 0.5 + if start_half and start.weekday() not in [5, 6]: + count -= 0.5 + if end_half and end.weekday() not in [5, 6]: + count -= 0.5 + except: + pass return count @@ -170,6 +262,21 @@ def get_leaves_restore(leave): def restore_leave_balance(leave): + """ + Function definition: restore_leave_balance(leave) + + Parameter list: + + - leave: a Leave object for which the leave balance is to be restored + + Short description: + + This function restores the leave balance for a given Leave object. + + Results generated: + + This function restores the leave balance by updating the LeavesCount objects in the database according to the leave type and the year of the leave. If the LeavesCount object does not exist, the function does not update the database. + """ to_restore = get_leaves_restore(leave) for key, value in to_restore.items(): try: @@ -212,6 +319,21 @@ def restore_leave_balance(leave): def deduct_leave_balance(leave,check): + """ + Function definition: deduct_leave_balance(leave,check) + + Parameter list: + - leave: an instance of a leave application + - check: a boolean variable indicating whether to check if leave balance is sufficient or not + + Short description: + + This function deducts the leave balance for a given leave application and updates the LeavesCount table. + + Results generated: + + This function does not return any value. It updates the remaining leave balance in the LeavesCount table for the applicant of the leave application. + """ to_deduct = get_leaves(leave,check) for key, value in to_deduct.items(): @@ -238,6 +360,22 @@ def deduct_leave_balance(leave,check): def get_pending_leave_requests(user): + """ + Function definition: get_pending_leave_requests(user) + + Parameter list: + + - user: an instance of a user for whom pending leave requests are to be retrieved. + + Short description: + + This function retrieves all pending leave requests for a user, based on their current designation. + + Results: + + This function returns a queryset of all pending leave requests for the user. If no pending leave requests exist, an empty queryset is returned. + """ + users = list(x.user for x in user.current_designation.all()) requests = LeaveRequest.objects.filter(Q(requested_from__in=users), Q(status='pending')) return requests @@ -248,6 +386,21 @@ def get_processed_leave_requests(user): def create_migrations(leave): + """ + Function definition: create_migrations(leave) + + Parameter list: + + - leave: an instance of LeaveRequest model + + Short description: + + This function creates LeaveMigration objects for each replacement segment of a leave request. + + Results: + + This function does not return anything. It creates LeaveMigration objects and saves them to the database. + """ migrations = [] applicant = leave.applicant for rep_segment in leave.replace_segments.all(): diff --git a/FusionIIIT/applications/leave/migrations/0002_auto_20230327_1101.py b/FusionIIIT/applications/leave/migrations/0002_auto_20230327_1101.py new file mode 100644 index 000000000..56e10de7b --- /dev/null +++ b/FusionIIIT/applications/leave/migrations/0002_auto_20230327_1101.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2023-03-27 11:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('leave', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='leavetype', + name='name', + field=models.CharField(default='casual', max_length=40), + ), + ] diff --git a/FusionIIIT/applications/leave/models.py b/FusionIIIT/applications/leave/models.py index 180f679bf..661509e57 100644 --- a/FusionIIIT/applications/leave/models.py +++ b/FusionIIIT/applications/leave/models.py @@ -32,7 +32,7 @@ class Constants: #@python_2_unicode_compatible class LeaveType(models.Model): - name = models.CharField(max_length=40, null=False) + name = models.CharField(max_length=40, null=False, default='casual') max_in_year = models.IntegerField(default=2) requires_proof = models.BooleanField(default=False) authority_forwardable = models.BooleanField(default=False) diff --git a/FusionIIIT/applications/leave/tasks.py b/FusionIIIT/applications/leave/tasks.py index d29285a92..f14c686c7 100644 --- a/FusionIIIT/applications/leave/tasks.py +++ b/FusionIIIT/applications/leave/tasks.py @@ -11,6 +11,17 @@ @celery.task() @transaction.atomic def execute_leave_migrations(): + """ + Function definition: execute_leave_migrations() + + Parameter list: None + + Short description: + + This function executes leave migrations by updating the working status of the replacee and replacer users in the corresponding Designation model instances. + + Results generated: None + """ today = timezone.now().date() # today = timezone.now() migrations = LeaveMigration.objects.filter(Q(on_date__lte=today)).order_by('on_date') diff --git a/FusionIIIT/applications/online_cms/admin.py b/FusionIIIT/applications/online_cms/admin.py index ac9eb780a..8bf6cd720 100644 --- a/FusionIIIT/applications/online_cms/admin.py +++ b/FusionIIIT/applications/online_cms/admin.py @@ -2,16 +2,17 @@ from .models import (Assignment, CourseDocuments, CourseVideo, Forum, ForumReply, Quiz, QuizQuestion, QuizResult, StudentAnswer, - StudentAssignment, Topics) + StudentAssignment1, Topics,CourseSlide,CourseAssignment + ) class QuizResultAdmin(admin.ModelAdmin): model = QuizResult raw_id_fields = ("student_id",) admin.site.register(CourseDocuments) - +admin.site.register(CourseSlide) admin.site.register(CourseVideo) - +admin.site.register(CourseAssignment) admin.site.register(Quiz) admin.site.register(Topics) @@ -22,7 +23,7 @@ class QuizResultAdmin(admin.ModelAdmin): admin.site.register(Assignment) -admin.site.register(StudentAssignment) +admin.site.register(StudentAssignment1) admin.site.register(QuizResult, QuizResultAdmin) diff --git a/FusionIIIT/applications/online_cms/forms.py b/FusionIIIT/applications/online_cms/forms.py index e656a838f..61d4f1c84 100644 --- a/FusionIIIT/applications/online_cms/forms.py +++ b/FusionIIIT/applications/online_cms/forms.py @@ -1,10 +1,13 @@ +# from django import forms import datetime from datetime import time, timedelta #import information from the models from django import forms # from .models import StoreMarks from applications.academic_information.models import Student_attendance +from django.forms import ModelForm +from .models import * #the types of exam whose marks can be stored from edit marks in assessment, related to StoreMarks table in models EXAM_TYPES= [ ('quiz1', 'Quiz 1'), @@ -112,4 +115,17 @@ def clean(self): examtype = self.cleaned_data.get("exam_type") enteredmarks = self.cleaned_data.get("entered_marks") - return self.cleaned_data \ No newline at end of file + return self.cleaned_data + + +class UploadSlideForm(forms.Form): + class Meta: + model=CourseDocuments + fields=['couse_id','doc'] + + # title = forms.CharField(max_length=50) + file = forms.FileField() + +class AssignmentMarks(forms.Form): + marks=forms.IntegerField() + feedback=forms.CharField(max_length=255) \ No newline at end of file diff --git a/FusionIIIT/applications/online_cms/helpers.py b/FusionIIIT/applications/online_cms/helpers.py index 8fb9f530e..05babe3bc 100644 --- a/FusionIIIT/applications/online_cms/helpers.py +++ b/FusionIIIT/applications/online_cms/helpers.py @@ -5,12 +5,25 @@ def semester(roll): - month = datetime.now().month - sem = 0 - if month >= 8 and month <= 12: - sem = 1 - semester = (datetime.now().year-int(roll))*2+sem - return semester + if not roll.isnumeric(): + s='' + s+='2' + s+='0' + s+=roll[0] + s+=roll[1] + month = datetime.now().month + sem = 0 + if month >= 8 and month <= 12: + sem = 1 + semester = (datetime.now().year-int(s))*2+sem + return semester + else: + month = datetime.now().month + sem = 0 + if month >= 8 and month <= 12: + sem = 1 + semester = (datetime.now().year-int(roll))*2+sem + return semester #storing media files like images, videos and assignments def create_thumbnail(course_code,course, row, name, ext, attach_str, thumb_time, thumb_size): diff --git a/FusionIIIT/applications/online_cms/migrations/0002_auto_20230406_1625.py b/FusionIIIT/applications/online_cms/migrations/0002_auto_20230406_1625.py new file mode 100644 index 000000000..f6d607f0b --- /dev/null +++ b/FusionIIIT/applications/online_cms/migrations/0002_auto_20230406_1625.py @@ -0,0 +1,60 @@ +# Generated by Django 3.1.5 on 2023-04-06 16:25 + +import applications.online_cms.models +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('academic_information', '0002_student_hall_id'), + ('online_cms', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='CourseAssignment', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('upload_time', models.DateTimeField(auto_now=True)), + ('submit_date', models.DateTimeField()), + ('assignment_name', models.CharField(max_length=100)), + ('doc', models.FileField(blank=True, null=True, upload_to=applications.online_cms.models.assignment_file_name)), + ('course_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.course')), + ], + ), + migrations.CreateModel( + name='CourseSlide', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('upload_time', models.DateTimeField(auto_now=True)), + ('document_name', models.CharField(max_length=40)), + ('description', models.CharField(max_length=100)), + ('doc', models.FileField(blank=True, null=True, upload_to=applications.online_cms.models.content_file_name)), + ('course_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.course')), + ], + ), + migrations.CreateModel( + name='StudentAssignment1', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('upload_time', models.DateTimeField(auto_now=True)), + ('course_code', models.CharField(max_length=100)), + ('doc', models.FileField(blank=True, null=True, upload_to=applications.online_cms.models.assignment_submit_name)), + ('score', models.IntegerField(null=True)), + ('feedback', models.CharField(max_length=100, null=True)), + ('assign_name', models.CharField(max_length=100)), + ('assignment_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='online_cms.courseassignment')), + ('student_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), + ], + ), + migrations.AlterField( + model_name='coursedocuments', + name='document_url', + field=models.CharField(blank=True, max_length=100, null=True), + ), + migrations.DeleteModel( + name='StudentAssignment', + ), + ] diff --git a/FusionIIIT/applications/online_cms/models.py b/FusionIIIT/applications/online_cms/models.py index a34e5c3ee..fa890d2d3 100644 --- a/FusionIIIT/applications/online_cms/models.py +++ b/FusionIIIT/applications/online_cms/models.py @@ -4,13 +4,32 @@ from applications.academic_procedures.models import Register from applications.globals.models import ExtraInfo + + + +def content_file_name(instance, filename): + name, ext = filename.split('.') + obj=Curriculum.objects.get(course_id=instance.course_id) + course_code=obj.course_code + file_path = 'online_cms/{course_id}/doc/{fileName}.{ext}'.format( + course_id=course_code, fileName=instance.document_name, ext=ext) + return file_path #the documents in the course (slides , ppt) added by the faculty and can be downloaded by the students +class CourseSlide(models.Model): + course_id = models.ForeignKey(Course, on_delete=models.CASCADE) + upload_time = models.DateTimeField(auto_now=True) + document_name = models.CharField(max_length=40) + description = models.CharField(max_length=100) + doc=models.FileField(upload_to=content_file_name, null=True, blank=True) + def __str__(self): + return '{} - {}'.format(self.course_id, self.document_name) + class CourseDocuments(models.Model): course_id = models.ForeignKey(Course, on_delete=models.CASCADE) upload_time = models.DateTimeField(auto_now=True) description = models.CharField(max_length=100) document_name = models.CharField(max_length=40) - document_url = models.CharField(max_length=100, null=True) + document_url = models.CharField(max_length=100, null=True,blank=True) def __str__(self): return '{} - {}'.format(self.course_id, self.document_name) @@ -149,16 +168,41 @@ class Assignment(models.Model): def __str__(self): return '{} - {} - {}'.format(self.pk, self.course_id, self.assignment_name) -#details of the solution uploaded by the student -class StudentAssignment(models.Model): +def assignment_file_name(instance, filename): + name, ext = filename.split('.') + obj=Curriculum.objects.get(course_id=instance.course_id) + course_code=obj.course_code + file_path = 'online_cms/{course_id}/doc/{fileName}.{ext}'.format( + course_id=course_code, fileName=instance.assignment_name, ext=ext) + return file_path +class CourseAssignment(models.Model): + course_id = models.ForeignKey(Course, on_delete=models.CASCADE) + upload_time = models.DateTimeField(auto_now=True) + submit_date = models.DateTimeField() + assignment_name = models.CharField(max_length=100) + doc = models.FileField(upload_to=assignment_file_name, null=True, blank=True) + + def __str__(self): + return '{} - {} - {}'.format(self.pk, self.course_id, self.assignment_name) + + +def assignment_submit_name(instance, filename): + name, ext = filename.split('.') + course_code=instance.course_code + assignmentName=instance.assignment_id.assignment_name + file_path = 'online_cms/{course_id}/assi/{assignmentName}/{fileName}.{ext}'.format( + course_id=course_code,assignmentName=assignmentName, fileName=name, ext=ext) + return file_path +class StudentAssignment1(models.Model): student_id = models.ForeignKey(Student, on_delete=models.CASCADE) - assignment_id = models.ForeignKey(Assignment, on_delete=models.CASCADE) + assignment_id = models.ForeignKey(CourseAssignment, on_delete=models.CASCADE) upload_time = models.DateTimeField(auto_now=True) - upload_url = models.TextField(max_length=200) + # upload_url = models.TextField(max_length=200) + course_code=models.CharField(max_length=100) + doc = models.FileField(upload_to=assignment_submit_name, null=True, blank=True) score = models.IntegerField(null=True) #score is submitted by faculty feedback = models.CharField(max_length=100, null=True) #feedback by the faculty for the solution of the assignment submitted assign_name = models.CharField(max_length=100) - def __str__(self): return '{} - {} - {} - {} - {}'.format( self.pk, self.student_id, diff --git a/FusionIIIT/applications/online_cms/urls.py b/FusionIIIT/applications/online_cms/urls.py index c24c69cc2..07e5d178c 100644 --- a/FusionIIIT/applications/online_cms/urls.py +++ b/FusionIIIT/applications/online_cms/urls.py @@ -1,10 +1,11 @@ +from django.conf import settings +from django.conf.urls.static import static from django.conf.urls import url - from . import views -app_name = 'online_cms' +app_name = 'online_cms' urlpatterns = [ - + url(r'^$', views.viewcourses, name='viewcourses'), url(r'^(?P[A-z]+[0-9]+[A-z]?)/$', views.course, name='course'), # url(r'^(?P[A-z]+[0-9]+[A-z]?)/edit_marks$', views.edit_marks, name='edit_marks'), @@ -69,4 +70,8 @@ url(r'^(?P[A-z]+[0-9]+[A-z]?)/edit_bank/(?P[0-9]+)$', views.edit_bank, name='edit_bank'), url(r'^(?P[A-z]+[0-9]+[A-z]?)/attendance$', views.submit_attendance, - name='submit_attendance'),] + name='submit_attendance'), + url(r'^(?P[A-z]+[0-9]+[A-z]?)/edit-assignment-marks$', views.edit_assignment_marks, + name='assignment_marks'), ] + +urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/FusionIIIT/applications/online_cms/views.py b/FusionIIIT/applications/online_cms/views.py index cc74626f3..e1a5fa9e5 100644 --- a/FusionIIIT/applications/online_cms/views.py +++ b/FusionIIIT/applications/online_cms/views.py @@ -14,6 +14,7 @@ from django.http import HttpResponse, HttpResponseBadRequest from django.shortcuts import redirect, render from django.utils import timezone +from django.contrib import messages from applications.academic_information.models import (Course, Curriculum_Instructor,Curriculum, Student,Student_attendance) @@ -25,6 +26,8 @@ # from .helpers import create_thumbnail, semester from .models import * from .helpers import create_thumbnail, semester +from django.shortcuts import HttpResponseRedirect +from django.urls import reverse @login_required @@ -39,13 +42,21 @@ def viewcourses(request): student = Student.objects.select_related('id').get(id=extrainfo) roll = student.id.id[:4] #get the roll no. of the student register = Register.objects.select_related().filter(student_id=student, semester=semester(roll)) #info of registered student - courses = collections.OrderedDict() #courses in which student is registerd + courses = [] #courses in which student is registerd + print(register) + # serializer=OCMSStudentSerializer(register,many=True) + for reg in register: #info of the courses - instructor = Curriculum_Instructor.objects.select_related().get(course_id=reg.course_id) - courses[reg] = instructor + course={} + course['data']=reg.curr_id + # course=reg.curr_id + course['instructor'] = Curriculum_Instructor.objects.select_related().get(curriculum_id=reg.curr_id) + courses.append(course) + # print(serializer.data) + # return Response(serializer.data) + # return Response({'status':200}) return render(request, 'coursemanagement/coursemanagement1.html', {'courses': courses, - 'extrainfo': extrainfo}) else: #if the user is lecturer instructor = Curriculum_Instructor.objects.select_related('curriculum_id').filter(instructor_id=extrainfo) #get info of the instructor @@ -62,6 +73,7 @@ def viewcourses(request): + @login_required def course(request, course_code): ''' @@ -81,93 +93,94 @@ def course(request, course_code): #course material uploaded by the instructor # videos = CourseVideo.objects.filter(course_id=course) videos = [] - if request.method == 'POST': - search_url = "https://www.googleapis.com/youtube/v3/search" - video_url = "https://www.googleapis.com/youtube/v3/videos" - search_params = { - 'part': 'snippet', - 'q': request.POST['search'], - 'key': settings.YOUTUBE_DATA_API_KEY, - 'type': 'video', - 'channelId': 'channel_id' - } - videos_ids = [] - r = requests.get(search_url, params=search_params) - # print(r) - results = r.json()['items'] - for result in results: - videos_ids.append(result['id']['videoId']) - - video_params = { - 'key': settings.YOUTUBE_DATA_API_KEY, - 'part': 'snippet,contentDetails', - 'id': ','.join(videos_ids), - 'maxResults': 9 - } - - p = requests.get(video_url, params=video_params) - results1 = p.json()['items'] - - for result in results1: - video_data = { - 'id': result['id'], - # 'url': f'https://www.youtube.com/watch?v={result["id"]}', - 'title': result['snippet']['title'], - # 'duration': int(parse_duration(result['contentDetails']['duration']).total_seconds() // 60), - # 'thumbnails': result['snippet']['thumbnails']['high']['url'] - } - - videos.append(video_data) - else: - channel_url = "https://www.googleapis.com/youtube/v3/channels" - playlist_url = "https://www.googleapis.com/youtube/v3/playlistItems" - videos_url = "https://www.googleapis.com/youtube/v3/videos" - - videos_list = [] - channel_params = { - 'part': 'contentDetails', - 'id': 'channel_id', - 'key': settings.YOUTUBE_DATA_API_KEY, - } - r = requests.get(channel_url, params=channel_params) - results = r.json()['items'][0]['contentDetails']['relatedPlaylists']['uploads'] - - playlist_params = { - 'key': settings.YOUTUBE_DATA_API_KEY, - 'part': 'snippet', - 'playlistId': results, - 'maxResults': 5, - } - p = requests.get(playlist_url, params=playlist_params) - results1 = p.json()['items'] - - for result in results1: - # print(results) - videos_list.append(result['snippet']['resourceId']['videoId']) - - videos_params = { - 'key': settings.YOUTUBE_DATA_API_KEY, - 'part': 'snippet', - 'id': ','.join(videos_list) - } - - v = requests.get(videos_url, params=videos_params) - results2 = v.json()['items'] - videos = [] - for res in results2: - video_data = { - 'id': res['id'], - 'title': res['snippet']['title'], - } - - videos.append(video_data) - # print(videos) - slides = CourseDocuments.objects.select_related().filter(course_id=course) + # if request.method == 'POST': + # if(request) + # if request.method == 'POST': + # search_url = "https://www.googleapis.com/youtube/v3/search" + # video_url = "https://www.googleapis.com/youtube/v3/videos" + # search_params = { + # 'part': 'snippet', + # 'q': request.POST['search'], + # 'key': settings.YOUTUBE_DATA_API_KEY, + # 'type': 'video', + # 'channelId': 'channel_id' + # } + # videos_ids = [] + # r = requests.get(search_url, params=search_params) + # # print(r) + # results = r.json()['items'] + # for result in results: + # videos_ids.append(result['id']['videoId']) + + # video_params = { + # 'key': settings.YOUTUBE_DATA_API_KEY, + # 'part': 'snippet,contentDetails', + # 'id': ','.join(videos_ids), + # 'maxResults': 9 + # } + + # p = requests.get(video_url, params=video_params) + # results1 = p.json()['items'] + + # for result in results1: + # video_data = { + # 'id': result['id'], + # # 'url': f'https://www.youtube.com/watch?v={result["id"]}', + # 'title': result['snippet']['title'], + # # 'duration': int(parse_duration(result['contentDetails']['duration']).total_seconds() // 60), + # # 'thumbnails': result['snippet']['thumbnails']['high']['url'] + # } + + # videos.append(video_data) + # else: + # channel_url = "https://www.googleapis.com/youtube/v3/channels" + # playlist_url = "https://www.googleapis.com/youtube/v3/playlistItems" + # videos_url = "https://www.googleapis.com/youtube/v3/videos" + + # videos_list = [] + # channel_params = { + # 'part': 'contentDetails', + # 'id': 'channel_id', + # 'key': settings.YOUTUBE_DATA_API_KEY, + # } + # r = requests.get(channel_url, params=channel_params) + # results = r.json()['items'][0]['contentDetails']['relatedPlaylists']['uploads'] + + # playlist_params = { + # 'key': settings.YOUTUBE_DATA_API_KEY, + # 'part': 'snippet', + # 'playlistId': results, + # 'maxResults': 5, + # } + # p = requests.get(playlist_url, params=playlist_params) + # results1 = p.json()['items'] + + # for result in results1: + # # print(results) + # videos_list.append(result['snippet']['resourceId']['videoId']) + + # videos_params = { + # 'key': settings.YOUTUBE_DATA_API_KEY, + # 'part': 'snippet', + # 'id': ','.join(videos_list) + # } + + # v = requests.get(videos_url, params=videos_params) + # results2 = v.json()['items'] + # videos = [] + # for res in results2: + # video_data = { + # 'id': res['id'], + # 'title': res['snippet']['title'], + # } + + + slides = CourseSlide.objects.select_related().filter(course_id=course) quiz = Quiz.objects.select_related().filter(course_id=course) - assignment = Assignment.objects.select_related().filter(course_id=course) + assignment = CourseAssignment.objects.select_related().filter(course_id=course) student_assignment = [] for assi in assignment: - sa = StudentAssignment.objects.select_related().filter(assignment_id=assi, student_id=student) + sa = StudentAssignment1.objects.select_related().filter(assignment_id=assi, student_id=student) student_assignment.append(sa) ''' marks to store the marks of quizes of student @@ -210,6 +223,7 @@ def course(request, course_code): 'curriculum': curriculum}) else: + instructor = Curriculum_Instructor.objects.select_related('curriculum_id').filter(instructor_id=extrainfo) for ins in instructor: if ins.curriculum_id.course_code == course_code: @@ -247,56 +261,65 @@ def course(request, course_code): lec = 1 # videos = CourseVideo.objects.filter(course_id=course) - channel_url = "https://www.googleapis.com/youtube/v3/channels" - playlist_url = "https://www.googleapis.com/youtube/v3/playlistItems" - videos_url = "https://www.googleapis.com/youtube/v3/videos" - - videos_list = [] - channel_params = { - 'part': 'contentDetails', - # 'forUsername': 'TechGuyWeb', - 'id': 'UCdGQeihs84hyCssI2KuAPmA', - 'key': settings.YOUTUBE_DATA_API_KEY, - } - r = requests.get(channel_url, params=channel_params) - results = r.json()['items'][0]['contentDetails']['relatedPlaylists']['uploads'] - - playlist_params = { - 'key': settings.YOUTUBE_DATA_API_KEY, - 'part': 'snippet', - 'playlistId': results, - 'maxResults': 5, - } - p = requests.get(playlist_url, params=playlist_params) - results1 = p.json()['items'] - - for result in results1: - videos_list.append(result['snippet']['resourceId']['videoId']) - - videos_params = { - 'key': settings.YOUTUBE_DATA_API_KEY, - 'part': 'snippet', - 'id': ','.join(videos_list) - } - - v = requests.get(videos_url, params=videos_params) - results2 = v.json()['items'] - videos = [] - for res in results2: - video_data = { - 'id': res['id'], - 'title': res['snippet']['title'], - } - - videos.append(video_data) - slides = CourseDocuments.objects.select_related().filter(course_id=course) + # channel_url = "https://www.googleapis.com/youtube/v3/channels" + # playlist_url = "https://www.googleapis.com/youtube/v3/playlistItems" + # videos_url = "https://www.googleapis.com/youtube/v3/videos" + + # videos_list = [] + # channel_params = { + # 'part': 'contentDetails', + # # 'forUsername': 'TechGuyWeb', + # 'id': 'UCdGQeihs84hyCssI2KuAPmA', + # 'key': settings.YOUTUBE_DATA_API_KEY, + # } + # r = requests.get(channel_url, params=channel_params) + # results = r.json()['items'][0]['contentDetails']['relatedPlaylists']['uploads'] + + # playlist_params = { + # 'key': settings.YOUTUBE_DATA_API_KEY, + # 'part': 'snippet', + # 'playlistId': results, + # 'maxResults': 5, + # } + # p = requests.get(playlist_url, params=playlist_params) + # results1 = p.json()['items'] + + # for result in results1: + # videos_list.append(result['snippet']['resourceId']['videoId']) + + # videos_params = { + # 'key': settings.YOUTUBE_DATA_API_KEY, + # 'part': 'snippet', + # 'id': ','.join(videos_list) + # } + + # v = requests.get(videos_url, params=videos_params) + # results2 = v.json()['items'] + # videos = [] + # for res in results2: + # video_data = { + # 'id': res['id'], + # 'title': res['snippet']['title'], + # } + + # videos.append(video_data) + # if request.method == 'POST': + # form = UploadSlideForm(request.POST, request.FILES) + # if form.is_valid(): + # tempform=form.save(commit=False) + # tempform.course_id=course + # tempform.save() + videos=[] + slides1 = CourseSlide.objects.select_related().filter(course_id=course) + slides=None quiz = Quiz.objects.select_related().filter(course_id=course) marks = [] quizs = [] assignment = Assignment.objects.select_related().filter(course_id=course) + assignment1 = CourseAssignment.objects.select_related().filter(course_id=course) student_assignment = [] - for assi in assignment: - sa = StudentAssignment.objects.select_related().filter(assignment_id=assi) + for assi in assignment1: + sa = StudentAssignment1.objects.select_related().filter(assignment_id=assi) student_assignment.append(sa) for q in quiz: qs = QuizResult.objects.select_related().filter(quiz_id=q) @@ -326,13 +349,15 @@ def course(request, course_code): 'course': course, 'answers': answers, 'assignment': assignment, + 'assignment1': assignment1, 'student_assignment': student_assignment, 'Lecturer': lec, 'questionbank': qb, 'students': students, 'total_attendance' : total_attendance, 'present_attendance':present_attendance, - 'test_marks': test_marks + 'test_marks': test_marks, + 'slides1':slides1 }) #when student uploads the assignment's solution @@ -346,28 +371,21 @@ def upload_assignment(request, course_code): doc = request.FILES.get('img') #the images in the assignment assi_name = request.POST.get('assignment_topic') name = request.POST.get('name') - assign = Assignment.objects.get(pk=assi_name) + assign = CourseAssignment.objects.get(pk=assi_name) filename, file_extenstion = os.path.splitext(request.FILES.get('img').name) except: return HttpResponse("Please fill each and every field correctly!") filename = name - full_path = settings.MEDIA_ROOT + "/online_cms/" + course_code + "/assi/" #storing the media files - full_path = full_path + assign.assignment_name + "/" + student.id.id + "/" - url = settings.MEDIA_URL + filename - if not os.path.isdir(full_path): - cmd = "mkdir " + full_path - subprocess.call(cmd, shell=True) - fs = FileSystemStorage(full_path, url) - fs.save(name + file_extenstion, doc) #saving the media files - uploaded_file_url = full_path+ "/" + name + file_extenstion + # to save the solution of assignment the database - sa = StudentAssignment( - student_id=student, - assignment_id=assign, - upload_url=uploaded_file_url, - assign_name=name+file_extenstion + StudentAssignment1.objects.create( + student_id=student, + doc=doc, + assignment_id=assign, + course_code=course_code, + assign_name=name+file_extenstion + ) - sa.save() return HttpResponse("Upload successful.") else: return HttpResponse("not found") @@ -387,6 +405,8 @@ def add_document(request, course_code): description = request.POST.get('description') doc = request.FILES.get('img') name = request.POST.get('name') + # obj =CourseDocuments.objects.create(course_id=course,description=description,) + # = request.FILES['img'] filename, file_extenstion = os.path.splitext(request.FILES.get('img').name) except: return HttpResponse("Please fill each and every field correctly!") @@ -401,15 +421,18 @@ def add_document(request, course_code): fs.save(filename + file_extenstion, doc) uploaded_file_url = full_path + filename + file_extenstion #save the info/details in the database - CourseDocuments.objects.create( + print(settings.MEDIA_ROOT) + CourseSlide.objects.create( course_id=course, upload_time=datetime.datetime.now(), description=description, - document_url=uploaded_file_url, - document_name=name+file_extenstion + document_name=name, + doc=doc ) + return HttpResponse("Upload successful.") else: + return HttpResponse("not found") #it is to delete things(assignment, slides, videos, ) from the dustin icon or delete buttons @@ -444,12 +467,12 @@ def delete(request, course_code): slide.delete() #to delete the submitted assignment elif data_type == 'stuassignment': - stu_assi = StudentAssignment.objects.select_related().get(pk=pk) + stu_assi = StudentAssignment1.objects.select_related().get(pk=pk) path = stu_assi.upload_url stu_assi.delete() #to delete the assignment uploaded by faculty elif data_type == 'lecassignment': - lec_assi = Assignment.objects.select_related().get(pk=pk) + lec_assi = CourseAssignment.objects.select_related().get(pk=pk) path = lec_assi.assignment_url lec_assi.delete() cmd = "rm "+path @@ -572,8 +595,7 @@ def ajax_new(request, course_code): roll = student.id.id[:4] #course = Course.objects.get(course_id=course_code, sem=semester(roll)) curriculum_details = Curriculum.objects.select_related('course_id').filter(course_code=course_code) #curriculum id - #print(curriculum_details[0].course_id) - #print(Curriculum.objects.values_list('curriculum_id')) + course = curriculum_details[0].course_id else: @@ -635,25 +657,36 @@ def add_assignment(request, course_code): #from faculty side except: return HttpResponse("Please Enter The Form Properly") filename = name - full_path = settings.MEDIA_ROOT + "/online_cms/" + course_code + "/assi/" + name + "/" - url = settings.MEDIA_URL + filename - if not os.path.isdir(full_path): - cmd = "mkdir " + full_path - subprocess.call(cmd, shell=True) - fs = FileSystemStorage(full_path, url) - fs.save(filename+file_extenstion, assi) - uploaded_file_url = full_path + filename + file_extenstion - assign = Assignment( + + CourseAssignment.objects.create( course_id=course, submit_date=request.POST.get('myDate'), - assignment_url=uploaded_file_url, + doc=assi, assignment_name=name ) - assign.save() + return HttpResponse("Upload successful.") else: return HttpResponse("not found") +@login_required +def edit_assignment_marks(request,*args, **kwargs): + if request.method=='POST': + print("hiii") + form=AssignmentMarks(request.POST) + if form.is_valid(): + sa=StudentAssignment1.objects.get(pk=int(request.POST['assignmentid'][0])) + # print() + sa.score=form.cleaned_data['marks'] + sa.feedback=form.cleaned_data['feedback'] + sa.save() + # print(sa.course_code) + course_code = sa.course_code + # url = reverse('course', args=[course_code]) + messages.success(request, 'Marks updated successfullt') + return HttpResponseRedirect('/ocms/'+course_code) + # return redirect(course,course_code='CS416e') + return HttpResponse("Error Occured!") @login_required def edit_bank(request, course_code, qb_code): diff --git a/FusionIIIT/applications/placement_cell/admin.py b/FusionIIIT/applications/placement_cell/admin.py index e333e2a68..049968344 100644 --- a/FusionIIIT/applications/placement_cell/admin.py +++ b/FusionIIIT/applications/placement_cell/admin.py @@ -74,7 +74,7 @@ class PlacementStatusAdmin(admin.ModelAdmin): class PlacementRecordAdmin(admin.ModelAdmin): - list_display = ('placement_type', 'name', 'ctc', 'year', 'test_score', 'test_type') + list_display = ('placement_type', 'name', 'ctc', 'year', 'test_score', 'test_type',"branch","unique_id") class StudentRecordAdmin(admin.ModelAdmin): diff --git a/FusionIIIT/applications/placement_cell/api/serializers.py b/FusionIIIT/applications/placement_cell/api/serializers.py index e6960adb0..7e03bd9ea 100644 --- a/FusionIIIT/applications/placement_cell/api/serializers.py +++ b/FusionIIIT/applications/placement_cell/api/serializers.py @@ -1,23 +1,23 @@ from rest_framework.authtoken.models import Token from rest_framework import serializers -from applications.placement_cell.models import (Achievement, Course, Education, - Experience, Has, Patent, - Project, Publication, Skill, - PlacementStatus, NotifyStudent) +from applications.placement_cell.models import * +class ProjectSerializer(serializers.ModelSerializer): + + class Meta: + model = Project + fields = list(Project().__dict__.keys())[1:] class SkillSerializer(serializers.ModelSerializer): class Meta: model = Skill - fields = ('__all__') + fields = list(Skill().__dict__.keys())[1:] class HasSerializer(serializers.ModelSerializer): - skill_id = SkillSerializer() - class Meta: model = Has - fields = ('skill_id','skill_rating') + fields = ('skill_id_id','skill_rating') def create(self, validated_data): skill = validated_data.pop('skill_id') @@ -32,53 +32,130 @@ class EducationSerializer(serializers.ModelSerializer): class Meta: model = Education - fields = ('__all__') + fields = list(Education().__dict__.keys())[1:] -class CourseSerializer(serializers.ModelSerializer): +class ReferenceSerializer(serializers.ModelSerializer): + + class Meta: + model=Reference + fields=list(Reference().__dict__.keys())[1:] + +class CoauthorSerializer(serializers.ModelSerializer): class Meta: - model = Course - fields = ('__all__') + model=Coauthor + fields=list(Coauthor().__dict__.keys())[1:] -class ExperienceSerializer(serializers.ModelSerializer): +class PatentSerializer(serializers.ModelSerializer): + + class Meta: + model=Patent + fields=list(Patent().__dict__.keys())[1:] + +class CoinventorSerializer(serializers.ModelSerializer): class Meta: - model = Experience - fields = ('__all__') + model=Coinventor + fields=list(Coinventor().__dict__.keys())[1:] -class ProjectSerializer(serializers.ModelSerializer): +class InterestSerializer(serializers.ModelSerializer): class Meta: - model = Project - fields = ('__all__') + model=Interest + fields=list(Interest().__dict__.keys())[1:] class AchievementSerializer(serializers.ModelSerializer): class Meta: - model = Achievement - fields = ('__all__') - -class PublicationSerializer(serializers.ModelSerializer): + model=Achievement + fields=list(Achievement().__dict__.keys())[1:] + +class ExtracurricularSerializer(serializers.ModelSerializer): class Meta: - model = Publication - fields = ('__all__') + model = Extracurricular + fields=list(Extracurricular().__dict__.keys())[1:] -class PatentSerializer(serializers.ModelSerializer): +class MessageOfficerSerializer(serializers.ModelSerializer): class Meta: - model = Patent - fields = ('__all__') + model = MessageOfficer + fields=list(MessageOfficer().__dict__.keys())[1:] class NotifyStudentSerializer(serializers.ModelSerializer): class Meta: model = NotifyStudent - fields = ('__all__') + fields = list(NotifyStudent().__dict__.keys())[1:] + +class RoleSerializer(serializers.ModelSerializer): + + class Meta: + model = Role + fields = list(Role().__dict__.keys())[1:] + +class CompanyDetailsSerializer(serializers.ModelSerializer): + + class Meta: + model = CompanyDetails + fields = list(CompanyDetails().__dict__.keys())[1:] class PlacementStatusSerializer(serializers.ModelSerializer): - notify_id = NotifyStudentSerializer() class Meta: model = PlacementStatus - fields = ('notify_id', 'invitation', 'placed', 'timestamp', 'no_of_days') + fields = list(PlacementStatus().__dict__.keys())[1:] + +class PlacementRecordSerializer(serializers.ModelSerializer): + + class Meta: + model = PlacementRecord + fields = list(PlacementRecord().__dict__.keys())[1:] + +class StudentRecordSerializer(serializers.ModelSerializer): + + class Meta: + model = StudentRecord + fields = list(StudentRecord().__dict__.keys())[1:] + +class ChairmanVisitSerializer(serializers.ModelSerializer): + + class Meta: + model = ChairmanVisit + fields = list(ChairmanVisit().__dict__.keys())[1:] + +class PlacementScheduleSerializer(serializers.ModelSerializer): + + class Meta: + model = PlacementSchedule + fields = list(PlacementSchedule().__dict__.keys())[1:-1] + +class StudentPlacementSerializer(serializers.ModelSerializer): + + class Meta: + model = StudentPlacement + fields = list(StudentPlacement().__dict__.keys())[1:] + +class ExperienceSerializer(serializers.ModelSerializer): + + class Meta: + model = Experience + fields = list(Experience().__dict__.keys())[1:] + +class CourseSerializer(serializers.ModelSerializer): + + class Meta: + model = Course + fields = list(Course().__dict__.keys())[1:] + +class ConferenceSerializer(serializers.ModelSerializer): + + class Meta: + model = Conference + fields = list(Conference().__dict__.keys())[1:] + +class PublicationSerializer(serializers.ModelSerializer): + + class Meta: + model = Publication + fields = list(Publication().__dict__.keys())[1:] \ No newline at end of file diff --git a/FusionIIIT/applications/placement_cell/api/urls.py b/FusionIIIT/applications/placement_cell/api/urls.py new file mode 100644 index 000000000..b5405df44 --- /dev/null +++ b/FusionIIIT/applications/placement_cell/api/urls.py @@ -0,0 +1,34 @@ +from django.conf.urls import url + +from . import views + +urlpatterns = [ + # generic profile endpoint + # url(r'^projects/(?P\w+)/', views.projects, name='projects-api'), + # current user profile + url(r'projects/', views.projects, name='projects-api'), + url(r'experiences/',views.experiences,name="experiences-api"), + url(r'skills/',views.skills,name="skills-api"), + url(r'has/',views.has,name="has-api"), + url(r'education/',views.education,name="eduaction-api"), + url(r'courses/',views.courses,name="courses-api"), + url(r'conference/',views.conference,name="conference-api"), + url(r'publications/',views.publications,name="publications-api"), + url(r'references/',views.references,name="references-api"), + url(r'coauthor/',views.coauthor,name="coauthor-api"), + url(r'patent/',views.patent,name="patent-api"), + url(r'coinventor/',views.coinventor,name="coinventor-api"), + url(r'interest/',views.interest,name="interest-api"), + url(r'achievement/',views.achievement,name="achievement-api"), + url(r'extracurricular/',views.extracurricular,name="extracurricular-api"), + url(r'messageofficer/',views.messageofficer,name="messageofficer-api"), + url(r'notifystudent/',views.notifystudent,name="notifystudent-api"), + url(r'role/',views.role,name="role-api"), + url(r'companydetails/',views.companydetails,name="companydetails-api"), + url(r'placementstatus/',views.placementstatus,name="placementstatus-api"), + url(r'placementrecord/',views.placementrecord,name="placementrecord-api"), + url(r'studentrecord/',views.studentrecord,name="studentrecord-api"), + url(r'chairmanvisit/',views.chairmanvisit,name="chairmanvisit-api"), + url(r'placementschedule/',views.placementschedule,name="placementschedule-api"), + url(r'studentplacement/',views.studentplacement,name="studentplacement-api"), +] \ No newline at end of file diff --git a/FusionIIIT/applications/placement_cell/api/views.py b/FusionIIIT/applications/placement_cell/api/views.py new file mode 100644 index 000000000..0fb4625c6 --- /dev/null +++ b/FusionIIIT/applications/placement_cell/api/views.py @@ -0,0 +1,301 @@ +from django.contrib.auth import get_user_model +from django.shortcuts import get_object_or_404 + +from rest_framework.permissions import IsAuthenticated +from rest_framework.authentication import TokenAuthentication +from rest_framework import status +from rest_framework.decorators import api_view, permission_classes,authentication_classes +from rest_framework.permissions import AllowAny +from rest_framework.response import Response + +from applications.placement_cell.models import * +from . import serializers +from applications.globals.api.serializers import ExtraInfoSerializer +from applications.academic_information.api.serializers import StudentSerializers + + +@api_view(['GET']) +def projects(request): + username=request.query_params.get("username") + if not username: + return Response({"message":"No Username Found"},status=status.HTTP_400_BAD_REQUEST) + all_projects = Project.objects.filter(unique_id=username) + project_details=serializers.ProjectSerializer(all_projects, many=True).data + resp={ + "projects":project_details + } + return Response(data=resp, status=status.HTTP_200_OK) + +@api_view(['GET']) +def skills(request): + skills=Skill.objects.all() + skills_details=serializers.SkillSerializer(skills,many=True).data + resp={ + "skills":skills_details, + } + + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def has(request): + username=request.query_params.get("username") + if not username: + return Response({"messgae":"No Username Found"},status=status.HTTP_400_BAD_REQUEST) + has=Has.objects.filter(unique_id=username) + has_details=serializers.HasSerializer(has,many=True).data + resp={ + "has_skills":has_details + } + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def education(request): + username=request.query_params.get("username") + if not username: + return Response({"messgae":"No Username Found"},status=status.HTTP_400_BAD_REQUEST) + education=Education.objects.filter(unique_id=username) + education_details=serializers.EducationSerializer(education,many=True).data + resp={ + "education_details":education_details + } + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def experiences(request): + username=request.query_params.get("username") + if not username: + return Response({"messgae":"No Username Found"},status=status.HTTP_400_BAD_REQUEST) + + expriences=Experience.objects.filter(unique_id=username) + experience_details=serializers.ExperienceSerializer(expriences,many=True).data + resp={ + "experiences":experience_details + } + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def courses(request): + username=request.query_params.get("username") + if not username: + return Response({"messgae":"No Username Found"},status=status.HTTP_400_BAD_REQUEST) + + courses=Course.objects.filter(unique_id=username) + courses_details=serializers.CourseSerializer(courses,many=True).data + resp={ + "experiences":courses_details + } + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def conference(request): + username=request.query_params.get("username") + if not username: + return Response({"messgae":"No Username Found"},status=status.HTTP_400_BAD_REQUEST) + + conference=Conference.objects.filter(unique_id=username) + conference_details=serializers.ConferenceSerializer(conference,many=True).data + resp={ + "experiences":conference_details + } + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def publications(request): + username=request.query_params.get("username") + if not username: + return Response({"messgae":"No Username Found"},status=status.HTTP_400_BAD_REQUEST) + + publications=Publication.objects.filter(unique_id=username) + publications_details=serializers.PublicationSerializer(publications,many=True).data + resp={ + "experiences":publications_details + } + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def references(request): + username=request.query_params.get("username") + if not username: + return Response({"messgae":"No Username Found"},status=status.HTTP_400_BAD_REQUEST) + reference=Reference.objects.filter(unique_id=username) + reference_details=serializers.ReferenceSerializer(reference,many=True).data + resp={ + "references":reference_details + } + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def coauthor(request): + coauthor=Coauthor.objects.all() + coauthor_details=serializers.CoauthorSerializer(coauthor,many=True).data + resp={ + "coauthor":coauthor_details, + } + + return Response(data=resp,status=status.HTTP_200_OK) + + +@api_view(['GET']) +def patent(request): + username=request.query_params.get("username") + if not username: + return Response({"messgae":"No Username Found"},status=status.HTTP_400_BAD_REQUEST) + patent=Patent.objects.filter(unique_id=username) + patent_details=serializers.PatentSerializer(patent,many=True).data + resp={ + "patent":patent_details + } + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def coinventor(request): + coinventor=Coinventor.objects.all() + coinventor_details=serializers.CoinventorSerializer(coinventor,many=True).data + resp={ + "coinventor":coinventor_details, + } + + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def interest(request): + username=request.query_params.get("username") + if not username: + return Response({"messgae":"No Username Found"},status=status.HTTP_400_BAD_REQUEST) + interest=Interest.objects.filter(unique_id=username) + interest_details=serializers.InterestSerializer(interest,many=True).data + resp={ + "interest":interest_details + } + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def achievement(request): + username=request.query_params.get("username") + if not username: + return Response({"messgae":"No Username Found"},status=status.HTTP_400_BAD_REQUEST) + achievement=Achievement.objects.filter(unique_id=username) + achievement_details=serializers.AchievementSerializer(achievement,many=True).data + resp={ + "achievement":achievement_details + } + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def extracurricular(request): + username=request.query_params.get("username") + if not username: + return Response({"messgae":"No Username Found"},status=status.HTTP_400_BAD_REQUEST) + extracurricular = Extracurricular.objects.filter(unique_id=username) + extracurricular_details = serializers.ExtracurricularSerializer(extracurricular,many=True).data + resp={ + "extracurricular":extracurricular_details + } + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def messageofficer(request): + messageofficer=MessageOfficer.objects.all() + messageofficer=serializers.MessageOfficerSerializer(messageofficer,many=True).data + resp={ + "messageofficer":messageofficer, + } + + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def notifystudent(request): + notifystudent=NotifyStudent.objects.all() + notifystudent=serializers.NotifyStudentSerializer(notifystudent,many=True).data + resp={ + "notifystudent":notifystudent, + } + + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def role(request): + role=Role.objects.all() + role=serializers.RoleSerializer(role,many=True).data + resp={ + "role":role, + } + + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def companydetails(request): + companydetails=CompanyDetails.objects.all() + companydetails=serializers.CompanyDetailsSerializer(companydetails,many=True).data + resp={ + "companydetails":companydetails, + } + + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def placementstatus(request): + username=request.query_params.get("username") + if not username: + return Response({"messgae":"No Username Found"},status=status.HTTP_400_BAD_REQUEST) + placementstatus = PlacementStatus.objects.filter(unique_id=username) + placementstatus_details = serializers.PlacementStatusSerializer(placementstatus,many=True).data + resp={ + "placementstatus":placementstatus_details + } + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def placementrecord(request): + print(list(PlacementRecord().__dict__.keys())[1:-2]) + placementrecord=PlacementRecord.objects.all() + placementrecord=serializers.PlacementRecordSerializer(placementrecord,many=True).data + resp={ + "placementrecord":placementrecord, + } + + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def studentrecord(request): + username=request.query_params.get("username") + if not username: + return Response({"messgae":"No Username Found"},status=status.HTTP_400_BAD_REQUEST) + studentrecord = StudentRecord.objects.filter(unique_id=username) + studentrecord_details = serializers.StudentRecordSerializer(studentrecord,many=True).data + resp={ + "studentrecord":studentrecord_details + } + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def chairmanvisit(request): + chairmanvisit=ChairmanVisit.objects.all() + chairmanvisit=serializers.ChairmanVisitSerializer(chairmanvisit,many=True).data + resp={ + "chairmanvisit":chairmanvisit, + } + + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def placementschedule(request): + placementschedule=PlacementSchedule.objects.all() + placementschedule=serializers.PlacementScheduleSerializer(placementschedule,many=True).data + resp={ + "placementschedule":placementschedule, + } + + return Response(data=resp,status=status.HTTP_200_OK) + +@api_view(['GET']) +def studentplacement(request): + username=request.query_params.get("username") + if not username: + return Response({"messgae":"No Username Found"},status=status.HTTP_400_BAD_REQUEST) + studentplacement = StudentPlacement.objects.filter(unique_id=username) + studentplacement_details = serializers.StudentPlacementSerializer(studentplacement,many=True).data + resp={ + "studentplacement":studentplacement_details + } + return Response(data=resp,status=status.HTTP_200_OK) \ No newline at end of file diff --git a/FusionIIIT/applications/placement_cell/forms.py b/FusionIIIT/applications/placement_cell/forms.py index 54fb122ba..b3e43d36e 100644 --- a/FusionIIIT/applications/placement_cell/forms.py +++ b/FusionIIIT/applications/placement_cell/forms.py @@ -376,7 +376,7 @@ class SearchStudentRecord(forms.Form): """ name = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, 'class': 'field'}), label="name", required=False) - rollno = forms.IntegerField(label="rollno", widget=forms.NumberInput(attrs={'min': 0}), required=False) + rollno = forms.CharField(label="rollno", widget=forms.TextInput(attrs={'max_length': 100}), required=False) programme = forms.ChoiceField(choices = Con.PROGRAMME, required=False, label="programme", widget=forms.Select(attrs={'style': "height:45px", 'onchange': "changeDeptForSearch()", @@ -410,8 +410,8 @@ class SendInvite(forms.Form): company - name of company """ company = forms.ModelChoiceField(required=True, queryset=NotifyStudent.objects.all(), label="company") - rollno = forms.IntegerField(label="rollno", widget=forms.NumberInput(attrs={'min': 0}), required=False) - programme = forms.ChoiceField(choices = Con.PROGRAMME, required=False, + rollno = forms.CharField(label="rollno", widget=forms.TextInput(attrs={'max_length': 100}), required=False) + programme = forms.ChoiceField(choices = (((),"-----"),)+Con.PROGRAMME, required=False, label="programme", widget=forms.Select(attrs={'style': "height:45px", 'onchange': "changeDeptForSend()", 'id': "id_programme_send"})) @@ -507,10 +507,9 @@ class SearchPlacementRecord(forms.Form): label="stuname", required=False) year = forms.TypedChoiceField(coerce=int, choices=year_choices, initial=current_year, label="year", required=False, widget=forms.NumberInput(attrs={'id': 'add_placement_year'})) ctc = forms.CharField(label="ctc", required=False, widget=forms.NumberInput(attrs={ 'min':0, 'id': 'add_placement_ctc', 'step': 0.25})) - roll = forms.IntegerField(widget=forms.NumberInput(attrs={ 'min':0, - 'max_length': 10, - 'class': 'form-control', - 'id': 'add_placement_roll'}), + roll = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, + 'class': 'form-control', + 'id': 'add_placement_roll'}), label="roll", required=False) cname = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, 'class': 'field', @@ -534,10 +533,9 @@ class SearchPbiRecord(forms.Form): label="stuname", required=False) year = forms.TypedChoiceField(coerce=int, choices=year_choices, initial=current_year, label="year", required=False, widget=forms.NumberInput(attrs={'id': 'add_pbi_year'})) ctc = forms.DecimalField(label="ctc", required=False, widget=forms.NumberInput(attrs={ 'min':0, 'id': 'add_pbi_ctc', 'step': 0.25})) - roll = forms.IntegerField(widget=forms.NumberInput(attrs={ 'min':0, - 'max_length': 10, - 'class': 'form-control', - 'id': 'add_pbi_roll'}), + roll = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, + 'class': 'form-control', + 'id': 'add_pbi_roll'}), label="roll", required=False) cname = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, 'class': 'field', @@ -556,9 +554,9 @@ class SearchHigherRecord(forms.Form): year -year of clearing the test uname - name of the university """ - roll = forms.IntegerField(widget=forms.NumberInput(attrs={ 'min':0, 'max_length': 10, - 'class': 'form-control', - 'id': 'add_higher_roll'}), + roll = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, + 'class': 'form-control', + 'id': 'add_higher_roll'}), label="roll", required=False) stuname = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, 'class': 'field', @@ -589,9 +587,8 @@ class ManagePlacementRecord(forms.Form): stuname = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, 'class': 'field'}), label="stuname", required=False) - roll = forms.IntegerField(widget=forms.NumberInput(attrs={ 'min':0, - 'max_length': 10, - 'class': 'form-control'}), + roll = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, + 'class': 'form-control'}), label="roll", required=False) company = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, 'class': 'field'}), @@ -611,9 +608,8 @@ class ManagePbiRecord(forms.Form): stuname = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, 'class': 'field'}), label="stuname", required=False) - roll = forms.IntegerField(widget=forms.NumberInput(attrs={ 'min':0, - 'max_length': 10, - 'class': 'form-control'}), + roll = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, + 'class': 'form-control'}), label="roll", required=False) company = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, 'class': 'field'}), @@ -634,9 +630,8 @@ class ManageHigherRecord(forms.Form): stuname = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, 'class': 'field'}), label="stuname", required=False) - roll = forms.IntegerField(widget=forms.NumberInput(attrs={ 'min':0, - 'max_length': 10, - 'class': 'form-control'}), + roll = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, + 'class': 'form-control'}), label="roll", required=False) test_type = forms.CharField(widget=forms.TextInput(attrs={'max_length': 100, 'class': 'field'}), diff --git a/FusionIIIT/applications/placement_cell/migrations/0001_initial.py b/FusionIIIT/applications/placement_cell/migrations/0001_initial.py index 257c98609..0908a63c5 100644 --- a/FusionIIIT/applications/placement_cell/migrations/0001_initial.py +++ b/FusionIIIT/applications/placement_cell/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.1.5 on 2023-03-15 18:53 +# Generated by Django 3.1.5 on 2023-04-06 12:31 import datetime from django.db import migrations, models diff --git a/FusionIIIT/applications/placement_cell/migrations/0002_placementrecord_unique_id.py b/FusionIIIT/applications/placement_cell/migrations/0002_placementrecord_unique_id.py new file mode 100644 index 000000000..5c93ed484 --- /dev/null +++ b/FusionIIIT/applications/placement_cell/migrations/0002_placementrecord_unique_id.py @@ -0,0 +1,21 @@ +# Generated by Django 3.1.5 on 2023-04-06 13:48 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('academic_information', '0001_initial'), + ('placement_cell', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='placementrecord', + name='unique_id', + field=models.ForeignKey(default='20BCS239', on_delete=django.db.models.deletion.CASCADE, to='academic_information.student'), + preserve_default=False, + ), + ] diff --git a/FusionIIIT/applications/placement_cell/migrations/0003_placementrecord_branch.py b/FusionIIIT/applications/placement_cell/migrations/0003_placementrecord_branch.py new file mode 100644 index 000000000..125dac809 --- /dev/null +++ b/FusionIIIT/applications/placement_cell/migrations/0003_placementrecord_branch.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2023-04-06 20:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('placement_cell', '0002_placementrecord_unique_id'), + ] + + operations = [ + migrations.AddField( + model_name='placementrecord', + name='branch', + field=models.CharField(default='', max_length=100), + ), + ] diff --git a/FusionIIIT/applications/placement_cell/models.py b/FusionIIIT/applications/placement_cell/models.py index d9837608e..8402957d3 100644 --- a/FusionIIIT/applications/placement_cell/models.py +++ b/FusionIIIT/applications/placement_cell/models.py @@ -1,9 +1,9 @@ -# imports import datetime - from django.db import models from django.utils import timezone from django.utils.translation import gettext as _ +from datetime import time +from django import forms from applications.academic_information.models import Student @@ -94,7 +94,7 @@ class Project(models.Model): edate = models.DateField(null=True, blank=True) def __str__(self): - return '{} - {}'.format(self.unique_id.id, self.project_name) + return '{} - {}'.format(self.unique_id, self.project_name) class Skill(models.Model): @@ -333,10 +333,12 @@ class PlacementRecord(models.Model): placement_type = models.CharField(max_length=20, choices=Constants.PLACEMENT_TYPE, default='PLACEMENT') name = models.CharField(max_length=100, default='') + branch = models.CharField(max_length=100, default='') ctc = models.DecimalField(decimal_places=2, max_digits=5, default=0) year = models.IntegerField(default=0) test_score = models.IntegerField(default=0, null=True, blank=True) test_type = models.CharField(max_length=30, default='', null=True, blank=True) + unique_id=models.ForeignKey(Student, on_delete=models.CASCADE) def __str__(self): return '{} - {}'.format(self.name, self.year) diff --git a/FusionIIIT/applications/placement_cell/urls.py b/FusionIIIT/applications/placement_cell/urls.py index 9f3e77307..161942a77 100644 --- a/FusionIIIT/applications/placement_cell/urls.py +++ b/FusionIIIT/applications/placement_cell/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import url +from django.conf.urls import include, url from . import views app_name = 'placement' @@ -25,4 +25,6 @@ url(r'^placement_record_save/$', views.placement_record_save, name='placement_record_save'), url(r'^add_placement_visit/$', views.add_placement_visit, name='add_placement_visit'), url(r'^placement_visit_save/$', views.placement_visit_save, name='placement_visit_save'), + + url(r'^api/', include('applications.placement_cell.api.urls')) ] diff --git a/FusionIIIT/applications/placement_cell/views.py b/FusionIIIT/applications/placement_cell/views.py index 80c8f12d7..e3ffbf0e6 100644 --- a/FusionIIIT/applications/placement_cell/views.py +++ b/FusionIIIT/applications/placement_cell/views.py @@ -29,6 +29,7 @@ from notification.views import placement_cell_notif from applications.globals.models import (DepartmentInfo, ExtraInfo, HoldsDesignation) +from applications.academic_information.models import Student from .forms import (AddAchievement, AddChairmanVisit, AddCourse, AddEducation, AddExperience, AddReference, AddPatent, AddProfile, AddProject, AddPublication, AddSchedule, AddSkill, ManageHigherRecord, @@ -146,9 +147,7 @@ def get_reference_list(request): if request.method == 'POST': - # arr = request.POST.getlist('arr[]') - # print(arr) - # print(type(arr)) + user = request.user profile = get_object_or_404(ExtraInfo, Q(user=user)) student = get_object_or_404(Student, Q(id=profile.id)) @@ -250,16 +249,7 @@ def placement(request): address = request.POST.get('address') contact = request.POST.get('contact') pic = request.POST.get('pic') - # futu = request.POST.get('futu') - # print(studentplacement_obj.future_aspect) - # print('fut=', fut) - # print('futu=', futu) - # if studentplacement_obj.future_aspect == "HIGHER STUDIES": - # if futu == 2: - # studentplacement_obj.future_aspect = "PLACEMENT" - # elif studentplacement_obj.future_aspect == "PLACEMENT": - # if futu == None: - # studentplacement_obj.future_aspect = "HIGHER STUDIES" + extrainfo_obj = ExtraInfo.objects.get(user=user) extrainfo_obj.about_me = about_me extrainfo_obj.age = age @@ -553,7 +543,7 @@ def invitation_status(request): mnpbi_tab = 0 mnplacement_post = 0 mnpbi_post = 0 - invitation_status_tab = 1 + invitation_status_tab = 0 placementstatus_placement = [] placementstatus_pbi = [] mnplacement_tab = 1 @@ -920,7 +910,9 @@ def student_records(request): ''' function for searching the records of student ''' - if request.user.is_staff==True: + + profile = get_object_or_404(ExtraInfo, Q(user=request.user)) + if profile.user_type=="staff": user = request.user strecord_tab = 1 no_pagination = 0 @@ -1201,7 +1193,6 @@ def student_records(request): unique_id=student, no_of_days=no_of_days) for student in students] ) for st in students: - #print(request.user, '-----------------------', st.id.user,'-----------------') placement_cell_notif(request.user, st.id.user, "") students = '' @@ -1226,7 +1217,8 @@ def student_records(request): } return render(request, 'placementModule/studentrecords.html', context) - return redirect('/placement') + else: + return redirect('/placement') @login_required @@ -1856,7 +1848,7 @@ def placement_statistics(request): #working here to fetch all placement record all_records=PlacementRecord.objects.all() - print(all_records) + # print("All records",all_records) @@ -1975,49 +1967,9 @@ def placement_statistics(request): id__icontains=rollno)) ))) - p = PlacementRecord.objects.filter(Q(placement_type="PLACEMENT", name__icontains=stuname, ctc__icontains=ctc, year__icontains=year)) - + p = PlacementRecord.objects.filter(Q(placement_type="PLACEMENT",name__icontains=stuname, ctc__icontains=ctc, year__icontains=year)) - - - """placementrecord = StudentRecord.objects.select_related('unique_id','record_id').filter( - Q(record_id__in=PlacementRecord.objects.filter( - Q(placement_type="PLACEMENT", name__icontains=cname, ctc__gte=ctc, year=year)), - unique_id__in=Student.objects.filter( - (Q(id__in=ExtraInfo.objects.filter( - Q(user__in=User.objects.filter( - first_name__icontains=first_name, - last_name__icontains=last_name, - id__icontains=rollno)))))))) - #print("In if:", placementrecord) - else: - s = Student.objects.filter((Q(id__in=ExtraInfo.objects.filter( - Q(user__in=User.objects.filter( - first_name__icontains=first_name, - last_name__icontains=last_name), - id__icontains=rollno)) - ))) - - p = PlacementRecord.objects.filter(Q(placement_type="PLACEMENT", name__icontains=cname, ctc__gte=ctc)) - print("Agein p:",p) - placementrecord = StudentRecord.objects.select_related('unique_id','record_id').filter( - Q(record_id__in=PlacementRecord.objects.filter( - Q(placement_type="PLACEMENT", name__icontains=cname, ctc__gte=ctc)), - unique_id__in=Student.objects.filter( - (Q(id__in=ExtraInfo.objects.filter( - Q(user__in=User.objects.filter( - first_name__icontains=first_name, - last_name__icontains=last_name), - id__icontains=rollno))))))) - - request.session['first_name'] = first_name - request.session['last_name'] = last_name - request.session['ctc'] = ctc - request.session['cname'] = cname - request.session['rollno'] = rollno - request.session['year'] = form.cleaned_data['year']""" - - print(p) + # print(p) total_query = p.count() @@ -2103,7 +2055,7 @@ def placement_statistics(request): last_name__icontains=request.session['last_name'])), id__icontains=request.session['rollno']))))))) except Exception as e: - print(e) + print("Exception",e) placementrecord = '' if placementrecord != '': @@ -2159,10 +2111,10 @@ def placement_statistics(request): stuname = '' first_name = '' last_name = '' - if form.cleaned_data['ctc']: - ctc = form.cleaned_data['ctc'] - else: - ctc = 0 + # if form.cleaned_data['ctc']: + # ctc = form.cleaned_data['ctc'] + # else: + ctc = 0 if form.cleaned_data['cname']: cname = form.cleaned_data['cname'] else: @@ -2176,7 +2128,7 @@ def placement_statistics(request): pbirecord = StudentRecord.objects.select_related('unique_id','record_id').filter(Q(record_id__in=PlacementRecord.objects.filter (Q(placement_type="PBI", name__icontains=cname, - ctc__gte=ctc, year=year)), + year=year)), unique_id__in=Student.objects.filter ((Q(id__in=ExtraInfo.objects.filter (Q(user__in=User.objects.filter @@ -2185,7 +2137,7 @@ def placement_statistics(request): id__icontains=rollno)) ))))) p1 = PlacementRecord.objects.filter( - Q(placement_type="PBI", name__icontains=stuname, ctc__icontains=ctc, year__icontains=year)) + Q(placement_type="PBI", name__icontains=stuname, year__icontains=year)) """else: pbirecord = StudentRecord.objects.select_related('unique_id','record_id').filter(Q(record_id__in=PlacementRecord.objects.filter (Q(placement_type="PBI", @@ -2605,20 +2557,20 @@ def cv(request, username): extracurricularcheck = '1' - # print(achievementcheck,' ',educationcheck,' ',publicationcheck,' ',patentcheck,' ',internshipcheck,' ',projectcheck,' \n\n\n') + user = get_object_or_404(User, Q(username=username)) profile = get_object_or_404(ExtraInfo, Q(user=user)) + student_info=get_object_or_404(Student,Q(id=user.username)) + + batch=student_info.batch + now = datetime.datetime.now() - if int(str(profile.id)[:2]) == 20: - if (now.month>4): - roll = 1+now.year-int(str(profile.id)[:4]) - else: - roll = now.year-int(str(profile.id)[:4]) + print("year----->",now.year) + if now.year-batch<=4: + roll=now.year-batch else: - if (now.month>4): - roll = 1+(now.year)-int("20"+str(profile.id)[0:2]) - else: - roll = (now.year)-int("20"+str(profile.id)[0:2]) + roll=4 + student = get_object_or_404(Student, Q(id=profile.id)) skills = Has.objects.select_related('skill_id','unique_id').filter(Q(unique_id=student)) @@ -2695,7 +2647,6 @@ def export_to_xls_std_records(qs): wb = xlwt.Workbook(encoding='utf-8') ws = wb.add_sheet('Report') - # Sheet header, first row row_num = 0 font_style = xlwt.XFStyle() @@ -2706,7 +2657,6 @@ def export_to_xls_std_records(qs): for col_num in range(len(columns)): ws.write(row_num, col_num, columns[col_num], font_style) - # Sheet body, remaining rows font_style = xlwt.XFStyle() for student in qs: @@ -2741,7 +2691,7 @@ def export_to_xls_invitation_status(qs): wb = xlwt.Workbook(encoding='utf-8') ws = wb.add_sheet('Report') - # Sheet header, first row + row_num = 0 font_style = xlwt.XFStyle() @@ -2752,7 +2702,7 @@ def export_to_xls_invitation_status(qs): for col_num in range(len(columns)): ws.write(row_num, col_num, columns[col_num], font_style) - # Sheet body, remaining rows + font_style = xlwt.XFStyle() for student in qs: @@ -2786,7 +2736,6 @@ def check_invitation_date(placementstatus): if ps.invitation=='PENDING': dt = ps.timestamp+datetime.timedelta(days=ps.no_of_days) if dt\d+)$', views.draftview_multiple_items_indent, name='draftview_multiple_items_indent'), + url(r'^drafted_indent/(?P\d+)/$', views.drafted_indent, name='drafted_indent'), + url(r'^composed_indents_multiple/$', views.composed_indents_multiple, name='composed_indents_multiple'), + url(r'^filled_indent_list/(?P\d+)$', views.filled_indent_list, name='filled_indent_list'), + url(r'^view_my_indent/(?P\d+)/$', views.view_my_indent, name='view_my_indent'), + url(r'^confirmdeletemultiple/(?P\d+)$', views.confirmdeletemultiple, name='confirmdeletemultiple'), + url(r'^delete_multiple/(?P\d+)$',views.delete_multiple, name='delete_multiple'), + url(r'^inwardIndentMultiple/$', views.inward_multiple, name='inward_multiple'), + url(r'^inbox_indent_list/(?P\d+)$', views.inboxlist, name='inbox_indent_list'), + url(r'^inward_indent_details/(?P\d+)/$', views.inward_indent_details, name='inward_indent_details'), + url(r'^reject_indent/(?P\d+)/$', views.reject_indent, name='reject_indent'), + url(r'^item_purchase/(?P\d+)/$', views.item_purchase, name='item_purchase'), + url(r'^get_designations/$', views.get_designations,name='get_designations') + ] diff --git a/FusionIIIT/applications/ps1/views.py b/FusionIIIT/applications/ps1/views.py index 15168a6b9..13bb76ef2 100644 --- a/FusionIIIT/applications/ps1/views.py +++ b/FusionIIIT/applications/ps1/views.py @@ -1,7 +1,7 @@ from django.contrib import messages from django.shortcuts import render, get_object_or_404, redirect from applications.filetracking.models import File, Tracking -from applications.ps1.models import IndentFile,StockEntry +from applications.ps1.models import IndentFile,StockEntry,IndentFile2,Item from applications.globals.models import ExtraInfo, HoldsDesignation, Designation from django.template.defaulttags import csrf_token from django.http import HttpResponse, HttpResponseRedirect, JsonResponse @@ -11,6 +11,166 @@ from django.contrib.auth.models import User from timeit import default_timer as time from notification.views import office_module_notif +from django.views.decorators.csrf import csrf_exempt +import json + + + +@login_required(login_url = "/accounts/login/") +def create_indent_multiple(request): + """ + The function is used to create indents by faculty. + It adds the indent datails to the IndentFile2 table and Item details to Item table + for tracking the indent we are using filetracking module + @param: + request - trivial. + @variables: + uploader - Employee who creates file. + subject - Title of the file. + description - Description of the file. + upload_file - Attachment uploaded while creating file. + file - The file object. + extrainfo - The Extrainfo object. + holdsdesignations - The HoldsDesignation object. + context - Holds data needed to make necessary changes in the template. + item_name- Name of the item to be procured + quantity - Qunat of the item to be procured + present_stock=request.POST.get('present_stock') + estimated_cost=request.POST.get('estimated_cost') + purpose=request.POST.get('purpose') + specification=request.POST.get('specification') + indent_type=request.POST.get('indent_type') + nature=request.POST.get('nature') + indigenous=request.POST.get('indigenous') + replaced =request.POST.get('replaced') + budgetary_head=request.POST.get('budgetary_head') + expected_delivery=request.POST.get('expected_delivery') + sources_of_supply=request.POST.get('sources_of_supply') + approved=False + purchased =request.POST.get('purchased') + items= List of details of all the item + """ + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') + if request.user.extrainfo.id == '132': + return redirect("/purchase-and-store/entry/") + if request.method == 'POST': + try: + uploader = request.user.extrainfo + upload_file = request.FILES.get('myfile') + design = request.POST.get('design') + designation = Designation.objects.get(id = HoldsDesignation.objects.select_related('user','working','designation').get(id = design).designation_id) + description=request.POST.get('desc') + subject=request.POST.get('title') + budgetary_head = request.POST.get('budgetary_head') + sources_of_supply = request.POST.get('sources_of_supply') + expected_delivery = request.POST.get('expected_delivery') + # information related to reciever + remarks = request.POST.get('remarks') + receiver = request.POST.get('receiver') + reciever_designation = request.POST.get('reciever_designation') + # items related information + item_list = json.loads(request.POST.get('items')) # this will contain the list of all the item details + + # First we will create the file for IndentFile table + file=File.objects.create( + uploader=uploader, + description=description, + subject=subject, + designation=designation, + upload_file=upload_file + ) + + # Now we will create Indent Table and add to file + + created_indent_file = IndentFile2.objects.create( + file_info = file, + title = subject, + budgetary_head = budgetary_head, + expected_delivery = expected_delivery, + sources_of_supply = sources_of_supply, + description = description + ) + for i in range(len(item_list)) : + # upload_file = temp[i]['file'] + item_name = item_list[i]["item_name"] + quantity = item_list[i]["quantity"] + present_stock = item_list[i]["present_stock"] + estimated_cost = item_list[i]["estimated_cost"] + purpose = item_list[i]["purpose"] + specification = item_list[i]["specification"] + indent_type = item_list[i]["indent_type"] + nature =item_list[i]["nature"] + indigenous = item_list[i]["indigenous"] + replaced = item_list[i]["replaced"] + item_file = request.FILES.get(f"item_file{i}") + Item.objects.create( + indent_file_id = created_indent_file, + item_name = item_name, + quantity = quantity, + present_stock = present_stock, + estimated_cost = estimated_cost, + purpose = purpose , + specification = specification, + indent_type = indent_type, + nature = nature, + indigenous = indigenous, + replaced = replaced, + upload_file = item_file + ) + + if (receiver is not None) and (reciever_designation is not None): + current_design = HoldsDesignation.objects.select_related('user','working','designation').get(id=design) + try: + receiver_id = User.objects.get(username=receiver) + except Exception as e: + messages.error(request, 'Enter a valid Username') + return redirect('/purchase-and-store/') + try: + receive_design = Designation.objects.get(name=reciever_designation) + except Exception as e: + messages.error(request, 'Enter a valid Designation') + return redirect('/purchase-and-store/') + + Tracking.objects.create( + file_id=file, + current_id=uploader, + current_design=current_design, + receive_design=receive_design, + receiver_id=receiver_id, + remarks=remarks, + upload_file=upload_file, + ) + office_module_notif(request.user, receiver_id) + messages.success(request,'Indent Filed Successfully!') + return redirect("/purchase-and-store/composed_indents_multiple/") + else : + return redirect('/purchase-and-store/drafts1/') + finally: + message = 'File Already taken' + + file = File.objects.select_related('uploader__user','uploader__department','designation').all() + extrainfo = ExtraInfo.objects.select_related('user','department').all() + holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() + designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user = request.user) + users = User.objects.all() + username_with_1 = User.objects.filter(username__startswith='1') # batch from 2010-2019 + username_with_2 = User.objects.filter(username__startswith='2') # batch from 2020-2029 + users = users.difference(username_with_1.union(username_with_2)) # users other than students + context = { + 'users':users, + 'file': file, + 'extrainfo': extrainfo, + 'holdsdesignations': holdsdesignations, + 'designations': designations, + } + return render(request, 'ps1/ComposeIndentMultiple.html', context) + + + + + @login_required(login_url = "/accounts/login/") def ps1(request): @@ -184,7 +344,7 @@ def ps1(request): receive_design = Designation.objects.get(name=receive) except Exception as e: messages.error(request, 'Enter a valid Designation') - return redirect('/ps1/') + return redirect('/purchase-and-store/') upload_file = request.FILES.get('myfile') @@ -207,8 +367,13 @@ def ps1(request): extrainfo = ExtraInfo.objects.select_related('user','department').all() holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user = request.user) + users = User.objects.all() + username_with_1 = User.objects.filter(username__startswith='1') # batch from 2010-2019 + username_with_2 = User.objects.filter(username__startswith='2') # batch from 2020-2029 + users = users.difference(username_with_1.union(username_with_2)) # users other than students context = { + 'users':users, 'file': file, 'extrainfo': extrainfo, 'holdsdesignations': holdsdesignations, @@ -216,22 +381,6 @@ def ps1(request): } return render(request, 'ps1/composeIndent.html', context) -# @login_required(login_url = "/accounts/login") -# def compose_indent(request): -# file = File.objects.select_related('uploader__user','uploader__department','designation').all() -# extrainfo = ExtraInfo.objects.select_related('user','department').all() -# holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() -# designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user = request.user) - -# context = { -# 'file': file, -# 'extrainfo': extrainfo, -# 'holdsdesignations': holdsdesignations, -# 'designations': designations, -# } -# return render(request, 'ps1/composeIndent.html', context) - - @login_required(login_url = "/accounts/login") def composed_indents(request): """ @@ -255,6 +404,9 @@ def composed_indents(request): # print(File.objects) # extrainfo = ExtraInfo.objects.all() # designation = Designation.objects.get(id=HoldsDesignation.objects.get(user=request.user).designation_id) + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') designation = HoldsDesignation.objects.filter(user=request.user) context = { # 'draft': draft, @@ -263,6 +415,54 @@ def composed_indents(request): } return render(request, 'ps1/composed_indents.html', context) +@login_required(login_url = "/accounts/login") +def composed_indents_multiple(request): + """ + The function is used to get all the files created by user(employee). + It gets all files created by user by filtering file(table) object by user i.e, uploader. + It displays user and file details of a file(table) of filetracking(model) in the + template of 'Saved files' tab. + + @param: + request - trivial. + + @variables: + draft - The File object filtered by uploader(user). + extrainfo - The Extrainfo object. + context - Holds data needed to make necessary changes in the template. + """ + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') + designation = HoldsDesignation.objects.filter(user=request.user) + context = { + 'designation': designation, + } + return render(request, 'ps1/composed_indents2.html', context) + + + +@login_required(login_url = "/accounts/login") +def drafts_for_multiple_item(request): + """ + The function is used to get all the designations hold by the user. + + @param: + request - trivial. + + @variables: + context - Holds data needed to make necessary changes in the template. + """ + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') + designation = HoldsDesignation.objects.filter(user=request.user) + context = { + 'designation': designation, + } + return render(request, 'ps1/drafts1.html', context) + + def drafts(request): """ The function is used to get all the files created by user(employee). @@ -285,6 +485,9 @@ def drafts(request): # print(File.objects) # extrainfo = ExtraInfo.objects.all() # designation = Designation.objects.get(id=HoldsDesignation.objects.get(user=request.user).designation_id) + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') designation = HoldsDesignation.objects.filter(user=request.user) context = { # 'draft': draft, @@ -296,6 +499,9 @@ def drafts(request): @login_required(login_url = "/accounts/login") def indentview(request,id): + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') tracking_objects=Tracking.objects.all() tracking_obj_ids=[obj.file_id for obj in tracking_objects] @@ -315,9 +521,82 @@ def indentview(request,id): } return render(request, 'ps1/indentview.html', context) +@login_required(login_url = "/accounts/login") +def filled_indent_list(request,id): + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') + + tracking_objects=Tracking.objects.all() + tracking_obj_ids=[obj.file_id for obj in tracking_objects] + draft_indent = IndentFile2.objects.filter(file_info__in=tracking_obj_ids) + draft=[indent.file_info.id for indent in draft_indent] + draft_files=File.objects.filter(id__in=draft).order_by('-upload_date') + indents=[file.indentfile2 for file in draft_files] + extrainfo = ExtraInfo.objects.all() + abcd = HoldsDesignation.objects.get(pk=id) + s = str(abcd).split(" - ") + designations = s[1] + print("hello world") + context = { + 'username':str(request.user), + 'indents' : indents, + 'extrainfo': extrainfo, + 'designations': designations, + } + return render(request, 'ps1/indentViewList.html', context) + + +@login_required(login_url = "/accounts/login") +def draftview_multiple_items_indent(request,id): + """ + The function is used to get all the files created by user(employee). + It gets all files created by user by filtering file(table) object by user i.e, uploader. + It displays user and file details of a file(table) of filetracking(model) in the + template of 'Saved files (new)' tab for indentfile with multiple items. + + @param: + request - trivial. + + @variables: + draft - The File object filtered by uploader(user). + extrainfo - The Extrainfo object. + context - Holds data needed to make necessary changes in the template. + """ + + + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') + + indents= IndentFile2.objects.filter(file_info__in=request.user.extrainfo.uploaded_files.all()).select_related('file_info') + indent_ids=[indent.file_info for indent in indents] + filed_indents=Tracking.objects.filter(file_id__in=indent_ids) + filed_indent_ids=[indent.file_id for indent in filed_indents] + draft = list(set(indent_ids) - set(filed_indent_ids)) + draft_indent=IndentFile2.objects.filter(file_info__in=draft).values("file_info") + draft_files=File.objects.filter(id__in=draft_indent).order_by('-upload_date') + extrainfo = ExtraInfo.objects.all() + abcd = HoldsDesignation.objects.get(pk=id) + s = str(abcd).split(" - ") + designations = s[1] + + context = { + 'draft':draft_files, + 'extrainfo': extrainfo, + 'designations': designations, + } + return render(request, 'ps1/draftview1.html', context) + + + @login_required(login_url = "/accounts/login") def draftview(request,id): + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') + indents= IndentFile.objects.filter(file_info__in=request.user.extrainfo.uploaded_files.all()).select_related('file_info') indent_ids=[indent.file_info for indent in indents] filed_indents=Tracking.objects.filter(file_id__in=indent_ids) @@ -337,11 +616,38 @@ def draftview(request,id): } return render(request, 'ps1/draftview.html', context) + + @login_required(login_url = "/accounts/login") -def indentview2(request,id): +def inboxlist(request,id): + + + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') + indent_files = IndentFile2.objects.all().values('file_info') + print(indent_files) + in_file = Tracking.objects.filter(file_id__in=indent_files,receiver_id=request.user).order_by("-receive_date") + + #print (File.designation) + abcd = HoldsDesignation.objects.get(pk=id) + s = str(abcd).split(" - ") + designations = s[1] + + context = { + + 'in_file': in_file, + 'designations': designations, + } + return render(request, 'ps1/inboxIndentList.html', context) +@login_required(login_url = "/accounts/login") +def indentview2(request,id): + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') indent_files = IndentFile.objects.all().values('file_info') print(indent_files) in_file = Tracking.objects.filter(file_id__in=indent_files,receiver_id=request.user).order_by("-receive_date") @@ -359,7 +665,35 @@ def indentview2(request,id): return render(request, 'ps1/indentview2.html', context) + + @login_required(login_url = "/accounts/login") +def inward_multiple(request): + """ + The function is used to get all the Indent files received by user(employee) from other + employees which are filtered from Tracking(table) objects by current user i.e.receiver_id. + It displays files received by user from other employees of a Tracking(table) of + filetracking(model) in the 'Inbox' tab of template. + @param: + request - trivial. + @variables: + in_file - The Tracking object filtered by receiver_id i.e, present working user. + context - Holds data needed to make necessary changes in the template. + """ + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') + designation = HoldsDesignation.objects.filter(user=request.user) + in_file=Tracking.objects.filter(receiver_id=request.user).order_by('-receive_date') + + + context = { + 'in_file': in_file, + 'designation': designation, + } + + return render(request, 'ps1/inwardIndentMultiple.html', context) + def inward(request): """ The function is used to get all the Indent files received by user(employee) from other @@ -372,6 +706,9 @@ def inward(request): in_file - The Tracking object filtered by receiver_id i.e, present working user. context - Holds data needed to make necessary changes in the template. """ + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') designation = HoldsDesignation.objects.filter(user=request.user) in_file=Tracking.objects.filter(receiver_id=request.user).order_by('-receive_date') @@ -384,6 +721,9 @@ def inward(request): return render(request, 'ps1/inwardIndent.html', context) @login_required(login_url = "/accounts/login") def confirmdelete(request,id): + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') file = File.objects.get(pk = id) context = { @@ -391,6 +731,17 @@ def confirmdelete(request,id): 'j': file, } return render(request, 'ps1/confirmdelete.html',context) +def confirmdeletemultiple(request,id): + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') + file = File.objects.get(pk = id) + + context = { + + 'j': file, + } + return render(request, 'ps1/confirmdeletemultiple.html',context) @login_required(login_url = "/accounts/login") def forwardindent(request, id): @@ -416,15 +767,18 @@ def forwardindent(request, id): holdsdesignations = HoldsDesignation objects. context - Holds data needed to make necessary changes in the template. """ - # start = timer() - - # end = timer() + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') indent=IndentFile.objects.select_related('file_info').get(file_info=id) file=indent.file_info - # start = timer() track = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department', -'current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file) +'current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file).order_by('-forward_date') # end = timer() + users = User.objects.all() + username_with_1 = User.objects.filter(username__startswith='1') # batch from 2010-2019 + username_with_2 = User.objects.filter(username__startswith='2') # batch from 2020-2029 + users = users.difference(username_with_1.union(username_with_2)) # users other than students @@ -462,10 +816,15 @@ def forwardindent(request, id): except Exception as e: messages.error(request, 'Enter a valid Designation') designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) + users = User.objects.all() + username_with_1 = User.objects.filter(username__startswith='1') # batch from 2010-2019 + username_with_2 = User.objects.filter(username__startswith='2') # batch from 2020-2029 + users = users.difference(username_with_1.union(username_with_2)) # users other than students context = { # 'extrainfo': extrainfo, # 'holdsdesignations': holdsdesignations, + 'users':users, 'designations': designations, 'file': file, 'track': track, @@ -487,26 +846,6 @@ def forwardindent(request, id): check=str(request.user) val=str(request.POST.get('approval')) - - - # if val=="accept": - # print("correct") - # if check=="ptandon" or check=="atul" or check=="prabin16" or check=="subirs" or check=="prabir": - # indent.head_approval=True - # elif check=="director": - # indent.director_approval=True - # elif check=="rizwan": - # indent.financial_approval=True - - # else: - # if check=="ptandon" or check=="atul" or check=="prabin16" or check=="subirs" or check=="prabir": - # indent.head_approval=False - # elif check=="director": - # indent.director_approval=False - # elif check=="rizwan": - # indent.financial_approval=False - - designs =[] designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) for designation in designations : @@ -533,14 +872,12 @@ def forwardindent(request, id): messages.success(request, 'Indent File sent successfully') - # start = timer() extrainfo = ExtraInfo.objects.select_related('user','department').all() holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) context = { - # 'extrainfo': extrainfo, - # 'holdsdesignations': holdsdesignations, + 'users':users, 'designations':designations, 'file': file, 'track': track, @@ -549,6 +886,476 @@ def forwardindent(request, id): return render(request, 'ps1/forwardindent.html', context) + + +@login_required(login_url='/accounts/login') +def view_my_indent(request,id): + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + + if str(des.designation) == "student": + return redirect('/dashboard') + + indent = IndentFile2.objects.select_related('file_info').get(file_info=id) + indent_items = Item.objects.filter(indent_file_id=id).order_by('item_id') + file = indent.file_info + track = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department','current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file).order_by('-forward_date') + extrainfo = ExtraInfo.objects.select_related('user','department').all() + holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() + designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) + context = { + 'items':indent_items, + 'designations':designations, + 'file':file, + 'track': track, + 'indent' : indent + } + return render(request,'ps1/viewMyIndentFile.html',context) + + + + +@login_required(login_url='/accounts/login') +def reject_indent(request,id): + ''' + This endpoint is for rejecting a indent file. + ''' + try : + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') + indent = IndentFile2.objects.select_related('file_info').get(file_info=id) + + indent.rejected = True + indent.save() + messages.success(request, 'Indent File Rejected Successfully') + context ={ + 'success':True, + 'message':'file rejected successfully' + } + return HttpResponse(json.dumps(context), content_type="application/json") + except Exception as e: + context = { + 'success':False, + 'message':'Some Error occured' + } + return HttpResponse(json.dumps(context), content_type="application/json"),500 + +@login_required(login_url = '/accounts/login') +def item_purchase(request,id): + ''' + This function is reponsible for making item purchased + ''' + if request.method == 'POST': + item = Item.objects.get(item_id=id) + item.purchased = True + item.save() + context = { + 'success' : True, + 'message' : 'Item purchage status changed successfully' + } + messages.success(request, 'Item Purchase status changed successfully') + return HttpResponse(json.dumps(context), content_type="application/json") + + + + + + +@login_required(login_url='/accounts/login') +def inward_indent_details(request,id): + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + + if str(des.designation) == "student": + return redirect('/dashboard') + + indent = IndentFile2.objects.select_related('file_info').get(file_info=id) + indent_items = Item.objects.filter(indent_file_id=id).order_by('item_id') + purchased_items = indent_items.filter(purchased=True) + indent_items_length = len(indent_items) + purchaged_items_length = len(purchased_items) + + file = indent.file_info + track = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department','current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file).order_by('-forward_date') + extrainfo = ExtraInfo.objects.select_related('user','department').all() + holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() + designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) + users = User.objects.all() + username_with_1 = User.objects.filter(username__startswith='1') # batch from 2010-2019 + username_with_2 = User.objects.filter(username__startswith='2') # batch from 2020-2029 + users = users.difference(username_with_1.union(username_with_2)) # users other than students + context = { + 'users':users, + 'items':indent_items, + 'designations':designations, + 'file':file, + 'track': track, + 'indent' : indent, + 'indent_items_length' : indent_items_length, + 'purchaged_items_length' : purchaged_items_length + } + if request.method == "POST": + if 'approve' in request.POST: + current_id = request.user.extrainfo + remarks = request.POST.get('remarks') + + sender = request.POST.get('sender') + current_design = HoldsDesignation.objects.select_related('user','working','designation').get(id=sender) + + receiver = request.POST.get('receiver') + receive = request.POST.get('recieve') + + + try: + receiver_id = User.objects.get(username=receiver) + except Exception as e: + messages.error(request,'Some Error Occured') + indent = IndentFile2.objects.select_related('file_info').get(file_info=id) + indent_items = Item.objects.filter(indent_file_id=id) + purchased_items = indent_items.filter(purchased=True) + indent_items_length = len(indent_items) + purchaged_items_length = len(purchased_items) + file = indent.file_info + track = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department','current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file).order_by('-forward_date') + extrainfo = ExtraInfo.objects.select_related('user','department').all() + holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() + designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) + users = User.objects.all() + username_with_1 = User.objects.filter(username__startswith='1') # batch from 2010-2019 + username_with_2 = User.objects.filter(username__startswith='2') # batch from 2020-2029 + users = users.difference(username_with_1.union(username_with_2)) # users other than students + context = { + 'users':users, + 'items':indent_items, + 'designations':designations, + 'file':file, + 'track': track, + 'indent' : indent, + 'indent_items_length' : indent_items_length, + 'purchaged_items_length' : purchaged_items_length + } + return render(request,'ps1/viewInwardItemDetails.html',context) + try: + receive_design = Designation.objects.get(name=receive) + except Exception as e: + messages.error(request,'Enter Valid Designation') + indent = IndentFile2.objects.select_related('file_info').get(file_info=id) + indent_items = Item.objects.filter(indent_file_id=id) + purchased_items = indent_items.filter(purchased=True) + indent_items_length = len(indent_items) + purchaged_items_length = len(purchased_items) + file = indent.file_info + track = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department','current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file).order_by('-forward_date') + extrainfo = ExtraInfo.objects.select_related('user','department').all() + holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() + designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) + users = User.objects.all() + username_with_1 = User.objects.filter(username__startswith='1') # batch from 2010-2019 + username_with_2 = User.objects.filter(username__startswith='2') # batch from 2020-2029 + users = users.difference(username_with_1.union(username_with_2)) # users other than students + context = { + 'users':users, + 'items':indent_items, + 'designations':designations, + 'file':file, + 'track': track, + 'indent' : indent, + 'indent_items_length' : indent_items_length, + 'purchaged_items_length' : purchaged_items_length + } + return render(request,'ps1/viewInwardItemDetails.html',context) + upload_file = request.FILES.get('myfile') + remarks = remarks + f'\n Approved by :{str(request.user)}' + Tracking.objects.create( + file_id=file, + current_id=current_id, + current_design=current_design, + receive_design=receive_design, + receiver_id=receiver_id, + remarks=remarks, + upload_file=upload_file, + ) + + indent.approved = True + indent.save() + messages.success(request, 'Indent File sent and approved successfully') + elif 'forward' in request.POST: + current_id = request.user.extrainfo + remarks = request.POST.get('remarks') + + sender = request.POST.get('sender') + current_design = HoldsDesignation.objects.select_related('user','working','designation').get(id=sender) + + receiver = request.POST.get('receiver') + receive = request.POST.get('recieve') + + + try: + receiver_id = User.objects.get(username=receiver) + except Exception as e: + messages.error(request,'Some Error Occured') + indent = IndentFile2.objects.select_related('file_info').get(file_info=id) + indent_items = Item.objects.filter(indent_file_id=id) + purchased_items = indent_items.filter(purchased=True) + indent_items_length = len(indent_items) + purchaged_items_length = len(purchased_items) + file = indent.file_info + track = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department','current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file).order_by('-forward_date') + extrainfo = ExtraInfo.objects.select_related('user','department').all() + holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() + designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) + users = User.objects.all() + username_with_1 = User.objects.filter(username__startswith='1') # batch from 2010-2019 + username_with_2 = User.objects.filter(username__startswith='2') # batch from 2020-2029 + users = users.difference(username_with_1.union(username_with_2)) # users other than students + context = { + 'users':users, + 'items':indent_items, + 'designations':designations, + 'file':file, + 'track': track, + 'indent' : indent, + 'indent_items_length' : indent_items_length, + 'purchaged_items_length' : purchaged_items_length + } + return render(request,'ps1/viewInwardItemDetails.html',context) + try: + receive_design = Designation.objects.get(name=receive) + except Exception as e: + messages.error(request,'Enter Valid Designation') + indent = IndentFile2.objects.select_related('file_info').get(file_info=id) + indent_items = Item.objects.filter(indent_file_id=id) + purchased_items = indent_items.filter(purchased=True) + indent_items_length = len(indent_items) + purchaged_items_length = len(purchased_items) + file = indent.file_info + track = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department','current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file).order_by('-forward_date') + extrainfo = ExtraInfo.objects.select_related('user','department').all() + holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() + designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) + users = User.objects.all() + username_with_1 = User.objects.filter(username__startswith='1') # batch from 2010-2019 + username_with_2 = User.objects.filter(username__startswith='2') # batch from 2020-2029 + users = users.difference(username_with_1.union(username_with_2)) # users other than students + context = { + 'users':users, + 'items':indent_items, + 'designations':designations, + 'file':file, + 'track': track, + 'indent' : indent, + 'indent_items_length' : indent_items_length, + 'purchaged_items_length' : purchaged_items_length + } + return render(request,'ps1/viewInwardItemDetails.html',context) + upload_file = request.FILES.get('myfile') + Tracking.objects.create( + file_id=file, + current_id=current_id, + current_design=current_design, + receive_design=receive_design, + receiver_id=receiver_id, + remarks=remarks, + upload_file=upload_file, + ) + messages.success(request, 'Indent File sent successfully') + elif 'reject' in request.POST: + indent.rejected = True + indent.save() + messages.success(request,'Indent Rejected Successfully') + elif 'procure' in request.POST: + current_id = request.user.extrainfo + remarks = request.POST.get('remarks') + + sender = request.POST.get('sender') + current_design = HoldsDesignation.objects.select_related('user','working','designation').get(id=sender) + + receiver = request.POST.get('receiver') + receive = request.POST.get('recieve') + + + try: + receiver_id = User.objects.get(username=receiver) + except Exception as e: + messages.error(request,'Some Error Occured') + indent = IndentFile2.objects.select_related('file_info').get(file_info=id) + indent_items = Item.objects.filter(indent_file_id=id) + purchased_items = indent_items.filter(purchased=True) + indent_items_length = len(indent_items) + purchaged_items_length = len(purchased_items) + file = indent.file_info + track = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department','current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file).order_by('-forward_date') + extrainfo = ExtraInfo.objects.select_related('user','department').all() + holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() + designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) + users = User.objects.all() + username_with_1 = User.objects.filter(username__startswith='1') # batch from 2010-2019 + username_with_2 = User.objects.filter(username__startswith='2') # batch from 2020-2029 + users = users.difference(username_with_1.union(username_with_2)) # users other than students + context = { + 'users':users, + 'items':indent_items, + 'designations':designations, + 'file':file, + 'track': track, + 'indent' : indent, + 'indent_items_length' : indent_items_length, + 'purchaged_items_length' : purchaged_items_length + } + return render(request,'ps1/viewInwardItemDetails.html',context) + try: + receive_design = Designation.objects.get(name=receive) + except Exception as e: + messages.error(request,'Enter Valid Designation') + indent = IndentFile2.objects.select_related('file_info').get(file_info=id) + indent_items = Item.objects.filter(indent_file_id=id) + purchased_items = indent_items.filter(purchased=True) + indent_items_length = len(indent_items) + purchaged_items_length = len(purchased_items) + file = indent.file_info + track = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department','current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file).order_by('-forward_date') + extrainfo = ExtraInfo.objects.select_related('user','department').all() + holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() + designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) + users = User.objects.all() + username_with_1 = User.objects.filter(username__startswith='1') # batch from 2010-2019 + username_with_2 = User.objects.filter(username__startswith='2') # batch from 2020-2029 + users = users.difference(username_with_1.union(username_with_2)) # users other than students + context = { + 'users':users, + 'items':indent_items, + 'designations':designations, + 'file':file, + 'track': track, + 'indent' : indent, + 'indent_items_length' : indent_items_length, + 'purchaged_items_length' : purchaged_items_length + } + return render(request,'ps1/viewInwardItemDetails.html',context) + upload_file = request.FILES.get('myfile') + remarks = remarks + f'\n Approved by :{str(sender)}' + Tracking.objects.create( + file_id=file, + current_id=current_id, + current_design=current_design, + receive_design=receive_design, + receiver_id=receiver_id, + remarks=remarks, + upload_file=upload_file, + ) + + indent.procured = True + indent.save() + messages.success(request, 'Indent File Procured successfully and went for stock entry') + + return render(request,'ps1/viewInwardItemDetails.html',context) + + +@login_required(login_url='/accounts/login') +def drafted_indent(request,id): + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + + if str(des.designation) == "student": + return redirect('/dashboard') + + indent = IndentFile2.objects.select_related('file_info').get(file_info=id) + indent_items = Item.objects.filter(indent_file_id=id).order_by('item_id') + print(indent_items) + file = indent.file_info + track = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department','current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file).order_by('-forward_date') + extrainfo = ExtraInfo.objects.select_related('user','department').all() + holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() + designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) + users = User.objects.all() + username_with_1 = User.objects.filter(username__startswith='1') # batch from 2010-2019 + username_with_2 = User.objects.filter(username__startswith='2') # batch from 2020-2029 + users = users.difference(username_with_1.union(username_with_2)) # users other than students + if request.method == "POST": + if 'finish' in request.POST: + file.complete_flag = True + file.save() + if 'send' in request.POST: + current_id = request.user.extrainfo + remarks = request.POST.get('remarks') + sender = request.POST.get('sender') + current_design = HoldsDesignation.objects.select_related('user','working','designation').get(id=sender) + receiver = request.POST.get('receiver') + try: + receiver_id = User.objects.get(username=receiver) + except Exception as e: + messages.error(request, 'Enter a valid destination') + indent = IndentFile2.objects.select_related('file_info').get(file_info=id) + indent_items = Item.objects.filter(indent_file_id=id).order_by('item_id') + print(indent_items) + file = indent.file_info + track = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department','current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file).order_by('-forward_date') + extrainfo = ExtraInfo.objects.select_related('user','department').all() + holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() + designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) + users = User.objects.all() + username_with_1 = User.objects.filter(username__startswith='1') # batch from 2010-2019 + username_with_2 = User.objects.filter(username__startswith='2') # batch from 2020-2029 + users = users.difference(username_with_1.union(username_with_2)) # users other than students + context = { + 'users':users, + 'items':indent_items, + 'designations':designations, + 'file':file, + 'track': track, + 'indent' : indent + } + return render(request, 'ps1/draftedIndentDetails.html', context) + receive = request.POST.get('recieve') + try: + receive_design = Designation.objects.get(name=receive) + except Exception as e: + indent = IndentFile2.objects.select_related('file_info').get(file_info=id) + indent_items = Item.objects.filter(indent_file_id=id).order_by('item_id') + print(indent_items) + file = indent.file_info + track = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department','current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file).order_by('-forward_date') + extrainfo = ExtraInfo.objects.select_related('user','department').all() + holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').all() + designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) + users = User.objects.all() + username_with_1 = User.objects.filter(username__startswith='1') # batch from 2010-2019 + username_with_2 = User.objects.filter(username__startswith='2') # batch from 2020-2029 + users = users.difference(username_with_1.union(username_with_2)) # users other than students + context = { + 'users':users, + 'items':indent_items, + 'designations':designations, + 'file':file, + 'track': track, + 'indent' : indent + } + return render(request, 'ps1/draftedIndentDetails.html', context) + + # receive_design = receive_designation[0] + upload_file = request.FILES.get('myfile') + # return HttpResponse ("success") + Tracking.objects.create( + file_id=file, + current_id=current_id, + current_design=current_design, + receive_design=receive_design, + receiver_id=receiver_id, + remarks=remarks, + upload_file=upload_file, + ) + + + messages.success(request, 'Indent File sent successfully') + + context = { + 'users':users, + 'items':indent_items, + 'designations':designations, + 'file':file, + 'track': track, + 'indent' : indent + } + return render(request,'ps1/draftedIndentDetails.html',context) + @login_required(login_url = "/accounts/login") def createdindent(request, id): """ @@ -567,6 +1374,9 @@ def createdindent(request, id): holdsdesignations = HoldsDesignation objects. context - Holds data needed to make necessary changes in the template. """ + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') # start = timer() # end = timer() @@ -574,8 +1384,12 @@ def createdindent(request, id): file=indent.file_info # start = timer() track = Tracking.objects.select_related('file_id__uploader__user','file_id__uploader__department','file_id__designation','current_id__user','current_id__department', -'current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file) +'current_design__user','current_design__working','current_design__designation','receiver_id','receive_design').filter(file_id=file).order_by('-forward_date') # end = timer() + users = User.objects.all() + username_with_1 = User.objects.filter(username__startswith='1') # batch from 2010-2019 + username_with_2 = User.objects.filter(username__startswith='2') # batch from 2020-2029 + users = users.difference(username_with_1.union(username_with_2)) # users other than students @@ -588,10 +1402,8 @@ def createdindent(request, id): if 'send' in request.POST: current_id = request.user.extrainfo remarks = request.POST.get('remarks') - sender = request.POST.get('sender') current_design = HoldsDesignation.objects.select_related('user','working','designation').get(id=sender) - receiver = request.POST.get('receiver') try: receiver_id = User.objects.get(username=receiver) @@ -644,8 +1456,7 @@ def createdindent(request, id): designations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=request.user) context = { - # 'extrainfo': extrainfo, - # 'holdsdesignations': holdsdesignations, + 'users':users, 'designations':designations, 'file': file, 'track': track, @@ -657,15 +1468,15 @@ def createdindent(request, id): + + def AjaxDropdown1(request): - print('brefore post') + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') if request.method == 'POST': value = request.POST.get('value') - # print(value) - hold = Designation.objects.filter(name__startswith=value) - # for h in hold: - # print(h) print('secnod method') holds = serializers.serialize('json', list(hold)) context = { @@ -676,20 +1487,12 @@ def AjaxDropdown1(request): def AjaxDropdown(request): - print('asdasdasdasdasdasdasdas---------------\n\n') - # Name = ['student','co-ordinator','co co-ordinator'] - # design = Designation.objects.filter(~Q(name__in=(Name))) - # hold = HoldsDesignation.objects.filter(Q(designation__in=(design))) - - # arr = [] - - # for h in hold: - # arr.append(ExtraInfo.objects.filter(user=h.user)) + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') if request.method == 'POST': value = request.POST.get('value') - # print(value) - users = User.objects.filter(username__startswith=value) users = serializers.serialize('json', list(users)) @@ -701,39 +1504,37 @@ def AjaxDropdown(request): def test(request): return HttpResponse('success') + +@login_required(login_url = "/accounts/login") +def delete_multiple(request,id): + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') + file = File.objects.get(pk = id) + file.delete() + return redirect('/purchase-and-store/composed_indents_multiple/') + @login_required(login_url = "/accounts/login") def delete(request,id): + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') file = File.objects.get(pk = id) file.delete() - - # Not required - #draft = File.objects.filter(uploader=request.user.extrainfo) - #extrainfo = ExtraInfo.objects.all() - - #context = { - # 'draft': draft, - # 'extrainfo': extrainfo, - #} - - #problem over here no need of render since it doesnot affect the url - #return render(request, 'filetracking/drafts.html', context) - - return redirect('/ps1/composed_indents/') + return redirect('/purchase-and-store/composed_indents/') @login_required(login_url = "/accounts/login") - def Stock_Entry(request): - - + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') + else : if request.method=='GET' : - return HttpResponseRedirect('../stock_view') if request.method =="POST": - - #dealing_assistant_id=request.POST.get('dealing_assistant_id') id=request.POST.get('id') @@ -750,10 +1551,6 @@ def Stock_Entry(request): current_stock=request.POST.get('current_stock') recieved_date=request.POST.get('recieved_date') bill=request.FILES.get('bill') - - - # staff=Staff.objects.get(id=request.user.extrainfo) - StockEntry.objects.create(item_id=item_id,item_name= item_name,vendor=vendor,current_stock=current_stock,dealing_assistant_id=dealing_assistant_id,bill=bill,recieved_date=recieved_date,) IndentFile.objects.filter(file_info=temp).update(purchased=True) @@ -761,13 +1558,40 @@ def Stock_Entry(request): - +@login_required(login_url="/accounts/login") +def get_designations(request): + """ + This function is used for getting the all the designations associated with + an user + request type : POST + body : + { + value : "username", + } + """ + if request.method == 'POST': + username = request.POST.get('value') + user_value = User.objects.filter(username=username) + holdsdesignations = HoldsDesignation.objects.select_related('user','working','designation').filter(user=user_value[0]) + holdsdesignations = serializers.serialize('json', list(holdsdesignations)) + holdsdesignations = json.loads(holdsdesignations) + designations = Designation.objects.none() + for value in holdsdesignations: + qs = Designation.objects.filter(id=value['fields']['designation']) + designations = designations.union(qs) + designations = serializers.serialize('json', list(designations)) + context = { + 'designations' : designations + } + return HttpResponse(JsonResponse(context), content_type='application/json') + @login_required(login_url = "/accounts/login") def stock_edit(request): - # stocks=StockEntry.objects.get(pk=id) - # return render(request,'ps1/stock_edit.html',{'StockEntry':stocks}) + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') if request.method =="POST": @@ -776,21 +1600,13 @@ def stock_edit(request): temp1=IndentFile.objects.get(file_info=temp) stocks=StockEntry.objects.get(item_id=temp1) return render(request,'ps1/stock_edit.html',{'StockEntry':stocks}) - - # if 'save' in request.POST: - # stocks.item_name=request.POST.get('item_name') - # stocks.vendor=request.POST.get('vendor') - # stocks.current_stock=request.POST.get('current_stock') - # stocks.recieved_date=request.POST.get('recieved_date') - # stocks.bill=request.FILES.get('bill') - # stocks.save() return HttpResponseRedirect('../stock_view') - #else: - # print("ELSE") - # return render(request,'ps1/stock_edit.html',{'StockEntry':stocks}) def stock_update(request): + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') if request.method =="POST": if 'save' in request.POST: id=request.POST.get('id') @@ -807,14 +1623,12 @@ def stock_update(request): return HttpResponseRedirect('../stock_view') - - -# def stock_view(request): -# sto=StockEntry.objects.all() -# return render(request,'ps1/stock_view.html',{'StockEntry':sto}) -# @login_required(login_url = "/accounts/login") def stock_view(request): + + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') sto=StockEntry.objects.all() if sto: @@ -826,8 +1640,12 @@ def stock_view(request): print() return render(request,'ps1/stock_view.html',{'sto':sto}) + @login_required(login_url = "/accounts/login") def stock_delete(request): + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') if request.method=='POST': @@ -839,8 +1657,13 @@ def stock_delete(request): stocks=StockEntry.objects.get(item_id=temp1) stocks.delete() return HttpResponseRedirect('../stock_view') + + @login_required(login_url = "/accounts/login") def entry(request): + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') if request.method=='POST': id=request.POST.get('id') @@ -855,9 +1678,12 @@ def entry(request): return render(request,'ps1/entry.html',{'ent':ent}) def dealing_assistant(request): + des = HoldsDesignation.objects.all().select_related().filter(user = request.user).first() + if str(des.designation) == "student": + return redirect('/dashboard') print(request.user.extrainfo.id) print(type(request.user.extrainfo.id)) if request.user.extrainfo.id=='132' : - return redirect('/ps1/entry/') + return redirect('/purchase-and-store/entry/') else: - return redirect('/ps1') + return redirect('/purchase-and-store') diff --git a/FusionIIIT/media/New_Text_Document_2.txt b/FusionIIIT/applications/ps2/__init__.py similarity index 100% rename from FusionIIIT/media/New_Text_Document_2.txt rename to FusionIIIT/applications/ps2/__init__.py diff --git a/FusionIIIT/applications/ps2/admin.py b/FusionIIIT/applications/ps2/admin.py new file mode 100644 index 000000000..998bd1788 --- /dev/null +++ b/FusionIIIT/applications/ps2/admin.py @@ -0,0 +1,6 @@ +from django.contrib import admin +from .models import StockAdmin, StockEntry, TransferEntry +# Register your models here. +admin.site.register(StockAdmin) +admin.site.register(StockEntry) +admin.site.register(TransferEntry) diff --git a/FusionIIIT/applications/ps2/apps.py b/FusionIIIT/applications/ps2/apps.py new file mode 100644 index 000000000..17284468d --- /dev/null +++ b/FusionIIIT/applications/ps2/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class Ps2Config(AppConfig): + name = 'ps2' diff --git a/FusionIIIT/applications/ps2/migrations/0001_initial.py b/FusionIIIT/applications/ps2/migrations/0001_initial.py new file mode 100644 index 000000000..35aa91723 --- /dev/null +++ b/FusionIIIT/applications/ps2/migrations/0001_initial.py @@ -0,0 +1,37 @@ +# Generated by Django 3.1.5 on 2023-03-24 22:54 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='StockEntry', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('stock_no', models.IntegerField()), + ('name_of_particulars', models.CharField(max_length=50)), + ('inventory_no', models.CharField(max_length=50)), + ('quantity', models.IntegerField()), + ('rate', models.IntegerField()), + ('amount', models.IntegerField()), + ('supplier_name', models.CharField(max_length=50)), + ('bill_no', models.IntegerField()), + ('buy_date', models.DateField()), + ('issued_date', models.DateField()), + ('head_of_asset', models.CharField(max_length=50)), + ('section', models.CharField(blank=True, max_length=50, null=True)), + ('floor', models.IntegerField(blank=True, null=True)), + ('receiver_name', models.CharField(max_length=50)), + ], + options={ + 'db_table': 'ps2_stocks', + }, + ), + ] \ No newline at end of file diff --git a/FusionIIIT/applications/ps2/migrations/0002_auto_20230404_1727.py b/FusionIIIT/applications/ps2/migrations/0002_auto_20230404_1727.py new file mode 100644 index 000000000..9f3e2ccf3 --- /dev/null +++ b/FusionIIIT/applications/ps2/migrations/0002_auto_20230404_1727.py @@ -0,0 +1,32 @@ +# Generated by Django 3.1.5 on 2023-04-04 17:27 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('ps2', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='stockentry', + name='quantity', + ), + migrations.RemoveField( + model_name='stockentry', + name='stock_no', + ), + migrations.CreateModel( + name='StockAdmin', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('department', models.CharField(max_length=255)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/FusionIIIT/applications/ps2/migrations/0003_transferentry.py b/FusionIIIT/applications/ps2/migrations/0003_transferentry.py new file mode 100644 index 000000000..23db8661e --- /dev/null +++ b/FusionIIIT/applications/ps2/migrations/0003_transferentry.py @@ -0,0 +1,29 @@ +# Generated by Django 3.1.5 on 2023-04-09 20:44 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ps2', '0002_auto_20230404_1727'), + ] + + operations = [ + migrations.CreateModel( + name='TransferEntry', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('Item_id', models.IntegerField()), + ('From_department', models.CharField(max_length=50)), + ('From_location', models.IntegerField(blank=True, null=True)), + ('To_department', models.CharField(max_length=50)), + ('To_location', models.IntegerField(blank=True, null=True)), + ('Date', models.DateTimeField()), + ('Remark', models.CharField(max_length=200)), + ], + options={ + 'db_table': 'ps2_transfer', + }, + ), + ] diff --git a/FusionIIIT/media/New_Text_Document_2_wgRF9M5.txt b/FusionIIIT/applications/ps2/migrations/__init__.py similarity index 100% rename from FusionIIIT/media/New_Text_Document_2_wgRF9M5.txt rename to FusionIIIT/applications/ps2/migrations/__init__.py diff --git a/FusionIIIT/applications/ps2/models.py b/FusionIIIT/applications/ps2/models.py new file mode 100644 index 000000000..3d10d861c --- /dev/null +++ b/FusionIIIT/applications/ps2/models.py @@ -0,0 +1,36 @@ +from django.conf import settings +from django.db import models +from ..globals.models import User + +class StockAdmin(models.Model): + user = models.ForeignKey(User, on_delete=models.CASCADE) + department = models.CharField(max_length=255, blank=False) + +class StockEntry(models.Model): + name_of_particulars = models.CharField(max_length=50, blank=False) + inventory_no = models.CharField(max_length=50, blank=False) + rate = models.IntegerField(blank=False) + amount = models.IntegerField(blank=False) + supplier_name = models.CharField(max_length=50, blank=False) + bill_no = models.IntegerField(blank=False) + buy_date = models.DateField(blank=False) + issued_date = models.DateField(blank=False) + head_of_asset = models.CharField(max_length=50, blank=False) + section = models.CharField(max_length=50, blank=True, null=True) + floor = models.IntegerField(blank=True, null=True) + receiver_name = models.CharField(max_length=50, blank=False) + + class Meta: + db_table = 'ps2_stocks' + +class TransferEntry(models.Model): + Item_id = models.IntegerField(blank=False) + From_department = models.CharField(max_length=50, blank=False) + From_location = models.IntegerField(blank=True, null=True) + To_department = models.CharField(max_length=50, blank=False) + To_location = models.IntegerField(blank=True, null=True) + Date = models.DateTimeField(blank=False) + Remark = models.CharField(max_length=200, blank=False) + + class Meta: + db_table = 'ps2_transfer' \ No newline at end of file diff --git a/FusionIIIT/applications/ps2/static/ps2/css/rating.css b/FusionIIIT/applications/ps2/static/ps2/css/rating.css new file mode 100644 index 000000000..4074a4f0e --- /dev/null +++ b/FusionIIIT/applications/ps2/static/ps2/css/rating.css @@ -0,0 +1,263 @@ +/*! + * # Semantic UI 2.2.12 - Rating + * http://github.com/semantic-org/semantic-ui/ + * + * + * Released under the MIT license + * http://opensource.org/licenses/MIT + * + */ + + +/******************************* + Rating +*******************************/ + +.ui.rating { + display: -webkit-inline-box; + display: -ms-inline-flexbox; + display: inline-flex; + white-space: nowrap; + vertical-align: baseline; +} +.ui.rating:last-child { + margin-right: 0em; +} + +/* Icon */ +.ui.rating .icon { + padding: 0em; + margin: 0em; + text-align: center; + font-weight: normal; + font-style: normal; + -webkit-box-flex: 1; + -ms-flex: 1 0 auto; + flex: 1 0 auto; + cursor: pointer; + width: 1.25em; + height: auto; + -webkit-transition: opacity 0.1s ease, background 0.1s ease, text-shadow 0.1s ease, color 0.1s ease; + transition: opacity 0.1s ease, background 0.1s ease, text-shadow 0.1s ease, color 0.1s ease; +} + + +/******************************* + Types +*******************************/ + + +/*------------------- + Standard +--------------------*/ + + +/* Inactive Icon */ +.ui.rating .icon { + background: transparent; + color: rgba(0, 0, 0, 0.15); +} + +/* Active Icon */ +.ui.rating .active.icon { + background: transparent; + color: rgba(0, 0, 0, 0.85); +} + +/* Selected Icon */ +.ui.rating .icon.selected, +.ui.rating .icon.selected.active { + background: transparent; + color: rgba(0, 0, 0, 0.87); +} + +/*------------------- + Star +--------------------*/ + + +/* Inactive */ +.ui.star.rating .icon { + width: 1.25em; + height: auto; + background: transparent; + color: rgba(0, 0, 0, 0.15); + text-shadow: none; +} + +/* Active Star */ +.ui.star.rating .active.icon { + background: transparent !important; + color: #FFE623 !important; + text-shadow: 0px -1px 0px #DDC507, -1px 0px 0px #DDC507, 0px 1px 0px #DDC507, 1px 0px 0px #DDC507 !important; +} + +/* Selected Star */ +.ui.star.rating .icon.selected, +.ui.star.rating .icon.selected.active { + background: transparent !important; + color: #FFCC00 !important; + text-shadow: 0px -1px 0px #E6A200, -1px 0px 0px #E6A200, 0px 1px 0px #E6A200, 1px 0px 0px #E6A200 !important; +} + +/*------------------- + Heart +--------------------*/ + +.ui.heart.rating .icon { + width: 1.4em; + height: auto; + background: transparent; + color: rgba(0, 0, 0, 0.15); + text-shadow: none !important; +} + +/* Active Heart */ +.ui.heart.rating .active.icon { + background: transparent !important; + color: #FF6D75 !important; + text-shadow: 0px -1px 0px #CD0707, -1px 0px 0px #CD0707, 0px 1px 0px #CD0707, 1px 0px 0px #CD0707 !important; +} + +/* Selected Heart */ +.ui.heart.rating .icon.selected, +.ui.heart.rating .icon.selected.active { + background: transparent !important; + color: #FF3000 !important; + text-shadow: 0px -1px 0px #AA0101, -1px 0px 0px #AA0101, 0px 1px 0px #AA0101, 1px 0px 0px #AA0101 !important; +} + + +/******************************* + States +*******************************/ + + +/*------------------- + Disabled +--------------------*/ + + +/* disabled rating */ +.ui.disabled.rating .icon { + cursor: default; +} + +/*------------------- + User Interactive +--------------------*/ + + +/* Selected Rating */ +.ui.rating.selected .active.icon { + opacity: 1; +} +.ui.rating.selected .icon.selected, +.ui.rating .icon.selected { + opacity: 1; +} + + +/******************************* + Variations +*******************************/ + +.ui.mini.rating { + font-size: 0.78571429rem; +} +.ui.tiny.rating { + font-size: 0.85714286rem; +} +.ui.small.rating { + font-size: 0.92857143rem; +} +.ui.rating { + font-size: 1rem; +} +.ui.large.rating { + font-size: 1.14285714rem; +} +.ui.huge.rating { + font-size: 1.42857143rem; +} +.ui.massive.rating { + font-size: 2rem; +} + + +/******************************* + Theme Overrides +*******************************/ + +@font-face { + font-family: 'Rating'; + src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMggjCBsAAAC8AAAAYGNtYXCj2pm8AAABHAAAAKRnYXNwAAAAEAAAAcAAAAAIZ2x5ZlJbXMYAAAHIAAARnGhlYWQBGAe5AAATZAAAADZoaGVhA+IB/QAAE5wAAAAkaG10eCzgAEMAABPAAAAAcGxvY2EwXCxOAAAUMAAAADptYXhwACIAnAAAFGwAAAAgbmFtZfC1n04AABSMAAABPHBvc3QAAwAAAAAVyAAAACAAAwIAAZAABQAAAUwBZgAAAEcBTAFmAAAA9QAZAIQAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADxZQHg/+D/4AHgACAAAAABAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAFAAEAJAAAAAgACAABAAAAAEAIOYF8AbwDfAj8C7wbvBw8Irwl/Cc8SPxZf/9//8AAAAAACDmAPAE8AzwI/Au8G7wcPCH8JfwnPEj8WT//f//AAH/4xoEEAYQAQ/sD+IPow+iD4wPgA98DvYOtgADAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAPAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAABAAAAAAAAAAAAAgAANzkBAAAAAAIAAP/tAgAB0wAKABUAAAEvAQ8BFwc3Fyc3BQc3Jz8BHwEHFycCALFPT7GAHp6eHoD/AHAWW304OH1bFnABGRqgoBp8sFNTsHyyOnxYEnFxElh8OgAAAAACAAD/7QIAAdMACgASAAABLwEPARcHNxcnNwUxER8BBxcnAgCxT0+xgB6enh6A/wA4fVsWcAEZGqCgGnywU1OwfLIBHXESWHw6AAAAAQAA/+0CAAHTAAoAAAEvAQ8BFwc3Fyc3AgCxT0+xgB6enh6AARkaoKAafLBTU7B8AAAAAAEAAAAAAgABwAArAAABFA4CBzEHDgMjIi4CLwEuAzU0PgIzMh4CFz4DMzIeAhUCAAcMEgugBgwMDAYGDAwMBqALEgwHFyg2HhAfGxkKChkbHxAeNigXAS0QHxsZCqAGCwkGBQkLBqAKGRsfEB42KBcHDBILCxIMBxcoNh4AAAAAAgAAAAACAAHAACsAWAAAATQuAiMiDgIHLgMjIg4CFRQeAhcxFx4DMzI+Aj8BPgM1DwEiFCIGMTAmIjQjJy4DNTQ+AjMyHgIfATc+AzMyHgIVFA4CBwIAFyg2HhAfGxkKChkbHxAeNigXBwwSC6AGDAwMBgYMDAwGoAsSDAdbogEBAQEBAaIGCgcEDRceEQkREA4GLy8GDhARCREeFw0EBwoGAS0eNigXBwwSCwsSDAcXKDYeEB8bGQqgBgsJBgUJCwagChkbHxA+ogEBAQGiBg4QEQkRHhcNBAcKBjQ0BgoHBA0XHhEJERAOBgABAAAAAAIAAcAAMQAAARQOAgcxBw4DIyIuAi8BLgM1ND4CMzIeAhcHFwc3Jzc+AzMyHgIVAgAHDBILoAYMDAwGBgwMDAagCxIMBxcoNh4KFRMSCC9wQLBwJwUJCgkFHjYoFwEtEB8bGQqgBgsJBgUJCwagChkbHxAeNigXAwUIBUtAoMBAOwECAQEXKDYeAAABAAAAAAIAAbcAKgAAEzQ3NjMyFxYXFhcWFzY3Njc2NzYzMhcWFRQPAQYjIi8BJicmJyYnJicmNQAkJUARExIQEAsMCgoMCxAQEhMRQCUkQbIGBwcGsgMFBQsKCQkGBwExPyMkBgYLCgkKCgoKCQoLBgYkIz8/QawFBawCBgUNDg4OFRQTAAAAAQAAAA0B2wHSACYAABM0PwI2FzYfAhYVFA8BFxQVFAcGByYvAQcGByYnJjU0PwEnJjUAEI9BBQkIBkCPEAdoGQMDBgUGgIEGBQYDAwEYaAcBIwsCFoEMAQEMgRYCCwYIZJABBQUFAwEBAkVFAgEBAwUFAwOQZAkFAAAAAAIAAAANAdsB0gAkAC4AABM0PwI2FzYfAhYVFA8BFxQVFAcmLwEHBgcmJyY1ND8BJyY1HwEHNxcnNy8BBwAQj0EFCQgGQI8QB2gZDAUGgIEGBQYDAwEYaAc/WBVsaxRXeDY2ASMLAhaBDAEBDIEWAgsGCGSQAQUNAQECRUUCAQEDBQUDA5BkCQURVXg4OHhVEW5uAAABACMAKQHdAXwAGgAANzQ/ATYXNh8BNzYXNh8BFhUUDwEGByYvASY1IwgmCAwLCFS8CAsMCCYICPUIDAsIjgjSCwkmCQEBCVS7CQEBCSYJCg0H9gcBAQePBwwAAAEAHwAfAXMBcwAsAAA3ND8BJyY1ND8BNjMyHwE3NjMyHwEWFRQPARcWFRQPAQYjIi8BBwYjIi8BJjUfCFRUCAgnCAwLCFRUCAwLCCcICFRUCAgnCAsMCFRUCAsMCCcIYgsIVFQIDAsIJwgIVFQICCcICwwIVFQICwwIJwgIVFQICCcIDAAAAAACAAAAJQFJAbcAHwArAAA3NTQ3NjsBNTQ3NjMyFxYdATMyFxYdARQHBiMhIicmNTczNTQnJiMiBwYdAQAICAsKJSY1NCYmCQsICAgIC/7tCwgIW5MWFR4fFRZApQsICDc0JiYmJjQ3CAgLpQsICAgIC8A3HhYVFRYeNwAAAQAAAAcBbgG3ACEAADcRNDc2NzYzITIXFhcWFREUBwYHBiMiLwEHBiMiJyYnJjUABgUKBgYBLAYGCgUGBgUKBQcOCn5+Cg4GBgoFBicBcAoICAMDAwMICAr+kAoICAQCCXl5CQIECAgKAAAAAwAAACUCAAFuABgAMQBKAAA3NDc2NzYzMhcWFxYVFAcGBwYjIicmJyY1MxYXFjMyNzY3JicWFRQHBiMiJyY1NDcGBzcUFxYzMjc2NTQ3NjMyNzY1NCcmIyIHBhUABihDREtLREMoBgYoQ0RLS0RDKAYlJjk5Q0M5OSYrQREmJTU1JSYRQSuEBAQGBgQEEREZBgQEBAQGJBkayQoKQSgoKChBCgoKCkEoJycoQQoKOiMjIyM6RCEeIjUmJSUmNSIeIUQlBgQEBAQGGBIRBAQGBgQEGhojAAAABQAAAAkCAAGJACwAOABRAGgAcAAANzQ3Njc2MzIXNzYzMhcWFxYXFhcWFxYVFDEGBwYPAQYjIicmNTQ3JicmJyY1MxYXNyYnJjU0NwYHNxQXFjMyNzY1NDc2MzI3NjU0JyYjIgcGFRc3Njc2NyYnNxYXFhcWFRQHBgcGBwYjPwEWFRQHBgcABitBQU0ZGhADBQEEBAUFBAUEBQEEHjw8Hg4DBQQiBQ0pIyIZBiUvSxYZDg4RQSuEBAQGBgQEEREZBgQEBAQGJBkaVxU9MzQiIDASGxkZEAYGCxQrODk/LlACFxYlyQsJQycnBRwEAgEDAwIDAwIBAwUCNmxsNhkFFAMFBBUTHh8nCQtKISgSHBsfIh4hRCUGBAQEBAYYEhEEBAYGBAQaGiPJJQUiIjYzISASGhkbCgoKChIXMRsbUZANCyghIA8AAAMAAAAAAbcB2wA5AEoAlAAANzU0NzY7ATY3Njc2NzY3Njc2MzIXFhcWFRQHMzIXFhUUBxYVFAcUFRQHFgcGKwEiJyYnJisBIicmNTcUFxYzMjc2NTQnJiMiBwYVFzMyFxYXFhcWFxYXFhcWOwEyNTQnNjc2NTQnNjU0JyYnNjc2NTQnJisBNDc2NTQnJiMGBwYHBgcGBwYHBgcGBwYHBgcGBwYrARUACwoQTgodEQ4GBAMFBgwLDxgTEwoKDjMdFhYOAgoRARkZKCUbGxsjIQZSEAoLJQUFCAcGBQUGBwgFBUkJBAUFBAQHBwMDBwcCPCUjNwIJBQUFDwMDBAkGBgsLDmUODgoJGwgDAwYFDAYQAQUGAwQGBgYFBgUGBgQJSbcPCwsGJhUPCBERExMMCgkJFBQhGxwWFR4ZFQoKFhMGBh0WKBcXBgcMDAoLDxIHBQYGBQcIBQYGBQgSAQEBAQICAQEDAgEULwgIBQoLCgsJDhQHCQkEAQ0NCg8LCxAdHREcDQ4IEBETEw0GFAEHBwUECAgFBQUFAgO3AAADAAD/2wG3AbcAPABNAJkAADc1NDc2OwEyNzY3NjsBMhcWBxUWFRQVFhUUBxYVFAcGKwEWFRQHBgcGIyInJicmJyYnJicmJyYnIyInJjU3FBcWMzI3NjU0JyYjIgcGFRczMhcWFxYXFhcWFxYXFhcWFxYXFhcWFzI3NjU0JyY1MzI3NjU0JyYjNjc2NTQnNjU0JyYnNjU0JyYrASIHIgcGBwYHBgcGIwYrARUACwoQUgYhJRsbHiAoGRkBEQoCDhYWHTMOCgoTExgPCwoFBgIBBAMFDhEdCk4QCgslBQUIBwYFBQYHCAUFSQkEBgYFBgUGBgYEAwYFARAGDAUGAwMIGwkKDg5lDgsLBgYJBAMDDwUFBQkCDg4ZJSU8AgcHAwMHBwQEBQUECbe3DwsKDAwHBhcWJwIWHQYGExYKChUZHhYVHRoiExQJCgsJDg4MDAwNBg4WJQcLCw+kBwUGBgUHCAUGBgUIpAMCBQYFBQcIBAUHBwITBwwTExERBw0OHBEdHRALCw8KDQ0FCQkHFA4JCwoLCgUICBgMCxUDAgEBAgMBAQG3AAAAAQAAAA0A7gHSABQAABM0PwI2FxEHBgcmJyY1ND8BJyY1ABCPQQUJgQYFBgMDARhoBwEjCwIWgQwB/oNFAgEBAwUFAwOQZAkFAAAAAAIAAAAAAgABtwAqAFkAABM0NzYzMhcWFxYXFhc2NzY3Njc2MzIXFhUUDwEGIyIvASYnJicmJyYnJjUzFB8BNzY1NCcmJyYnJicmIyIHBgcGBwYHBiMiJyYnJicmJyYjIgcGBwYHBgcGFQAkJUARExIQEAsMCgoMCxAQEhMRQCUkQbIGBwcGsgMFBQsKCQkGByU1pqY1BgYJCg4NDg0PDhIRDg8KCgcFCQkFBwoKDw4REg4PDQ4NDgoJBgYBMT8jJAYGCwoJCgoKCgkKCwYGJCM/P0GsBQWsAgYFDQ4ODhUUEzA1oJ82MBcSEgoLBgcCAgcHCwsKCQgHBwgJCgsLBwcCAgcGCwoSEhcAAAACAAAABwFuAbcAIQAoAAA3ETQ3Njc2MyEyFxYXFhURFAcGBwYjIi8BBwYjIicmJyY1PwEfAREhEQAGBQoGBgEsBgYKBQYGBQoFBw4Kfn4KDgYGCgUGJZIZef7cJwFwCggIAwMDAwgICv6QCggIBAIJeXkJAgQICAoIjRl0AWP+nQAAAAABAAAAJQHbAbcAMgAANzU0NzY7ATU0NzYzMhcWHQEUBwYrASInJj0BNCcmIyIHBh0BMzIXFh0BFAcGIyEiJyY1AAgIC8AmJjQ1JiUFBQgSCAUFFhUfHhUWHAsICAgIC/7tCwgIQKULCAg3NSUmJiU1SQgFBgYFCEkeFhUVFh43CAgLpQsICAgICwAAAAIAAQANAdsB0gAiAC0AABM2PwI2MzIfAhYXFg8BFxYHBiMiLwEHBiMiJyY/AScmNx8CLwE/AS8CEwEDDJBABggJBUGODgIDCmcYAgQCCAMIf4IFBgYEAgEZaQgC7hBbEgINSnkILgEBJggCFYILC4IVAggICWWPCgUFA0REAwUFCo9lCQipCTBmEw1HEhFc/u0AAAADAAAAAAHJAbcAFAAlAHkAADc1NDc2OwEyFxYdARQHBisBIicmNTcUFxYzMjc2NTQnJiMiBwYVFzU0NzYzNjc2NzY3Njc2NzY3Njc2NzY3NjMyFxYXFhcWFxYXFhUUFRQHBgcGBxQHBgcGBzMyFxYVFAcWFRYHFgcGBxYHBgcjIicmJyYnJiciJyY1AAUGB1MHBQYGBQdTBwYFJQUFCAcGBQUGBwgFBWQFBQgGDw8OFAkFBAQBAQMCAQIEBAYFBw4KCgcHBQQCAwEBAgMDAgYCAgIBAU8XEBAQBQEOBQUECwMREiYlExYXDAwWJAoHBQY3twcGBQUGB7cIBQUFBQgkBwYFBQYHCAUGBgUIJLcHBQYBEBATGQkFCQgGBQwLBgcICQUGAwMFBAcHBgYICQQEBwsLCwYGCgIDBAMCBBEQFhkSDAoVEhAREAsgFBUBBAUEBAcMAQUFCAAAAAADAAD/2wHJAZIAFAAlAHkAADcUFxYXNxY3Nj0BNCcmBycGBwYdATc0NzY3FhcWFRQHBicGJyY1FzU0NzY3Fjc2NzY3NjcXNhcWBxYXFgcWBxQHFhUUBwYHJxYXFhcWFRYXFhcWFRQVFAcGBwYHBgcGBwYnBicmJyYnJicmJyYnJicmJyYnJiciJyY1AAUGB1MHBQYGBQdTBwYFJQUFCAcGBQUGBwgFBWQGBQcKJBYMDBcWEyUmEhEDCwQFBQ4BBRAQEBdPAQECAgIGAgMDAgEBAwIEBQcHCgoOBwUGBAQCAQIDAQEEBAUJFA4PDwYIBQWlBwYFAQEBBwQJtQkEBwEBAQUGB7eTBwYEAQEEBgcJBAYBAQYECZS4BwYEAgENBwUCBgMBAQEXEyEJEhAREBcIDhAaFhEPAQEFAgQCBQELBQcKDAkIBAUHCgUGBwgDBgIEAQEHBQkIBwUMCwcECgcGCRoREQ8CBgQIAAAAAQAAAAEAAJth57dfDzz1AAsCAAAAAADP/GODAAAAAM/8Y4MAAP/bAgAB2wAAAAgAAgAAAAAAAAABAAAB4P/gAAACAAAAAAACAAABAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAEAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAdwAAAHcAAACAAAjAZMAHwFJAAABbgAAAgAAAAIAAAACAAAAAgAAAAEAAAACAAAAAW4AAAHcAAAB3AABAdwAAAHcAAAAAAAAAAoAFAAeAEoAcACKAMoBQAGIAcwCCgJUAoICxgMEAzoDpgRKBRgF7AYSBpgG2gcgB2oIGAjOAAAAAQAAABwAmgAFAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAA4ArgABAAAAAAABAAwAAAABAAAAAAACAA4AQAABAAAAAAADAAwAIgABAAAAAAAEAAwATgABAAAAAAAFABYADAABAAAAAAAGAAYALgABAAAAAAAKADQAWgADAAEECQABAAwAAAADAAEECQACAA4AQAADAAEECQADAAwAIgADAAEECQAEAAwATgADAAEECQAFABYADAADAAEECQAGAAwANAADAAEECQAKADQAWgByAGEAdABpAG4AZwBWAGUAcgBzAGkAbwBuACAAMQAuADAAcgBhAHQAaQBuAGdyYXRpbmcAcgBhAHQAaQBuAGcAUgBlAGcAdQBsAGEAcgByAGEAdABpAG4AZwBGAG8AbgB0ACAAZwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABJAGMAbwBNAG8AbwBuAC4AAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format('truetype'), url(data:application/font-woff;charset=utf-8;base64,d09GRk9UVE8AABcUAAoAAAAAFswAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABDRkYgAAAA9AAAEuEAABLho6TvIE9TLzIAABPYAAAAYAAAAGAIIwgbY21hcAAAFDgAAACkAAAApKPambxnYXNwAAAU3AAAAAgAAAAIAAAAEGhlYWQAABTkAAAANgAAADYBGAe5aGhlYQAAFRwAAAAkAAAAJAPiAf1obXR4AAAVQAAAAHAAAABwLOAAQ21heHAAABWwAAAABgAAAAYAHFAAbmFtZQAAFbgAAAE8AAABPPC1n05wb3N0AAAW9AAAACAAAAAgAAMAAAEABAQAAQEBB3JhdGluZwABAgABADr4HAL4GwP4GAQeCgAZU/+Lix4KABlT/4uLDAeLZviU+HQFHQAAAP0PHQAAAQIRHQAAAAkdAAAS2BIAHQEBBw0PERQZHiMoLTI3PEFGS1BVWl9kaW5zeH2Ch4xyYXRpbmdyYXRpbmd1MHUxdTIwdUU2MDB1RTYwMXVFNjAydUU2MDN1RTYwNHVFNjA1dUYwMDR1RjAwNXVGMDA2dUYwMEN1RjAwRHVGMDIzdUYwMkV1RjA2RXVGMDcwdUYwODd1RjA4OHVGMDg5dUYwOEF1RjA5N3VGMDlDdUYxMjN1RjE2NHVGMTY1AAACAYkAGgAcAgABAAQABwAKAA0AVgCWAL0BAgGMAeQCbwLwA4cD5QR0BQMFdgZgB8MJkQtxC7oM2Q1jDggOmRAYEZr8lA78lA78lA77lA74lPetFftFpTz3NDz7NPtFcfcU+xBt+0T3Mt73Mjht90T3FPcQBfuU+0YV+wRRofcQMOP3EZ3D9wXD+wX3EXkwM6H7EPsExQUO+JT3rRX7RaU89zQ8+zT7RXH3FPsQbftE9zLe9zI4bfdE9xT3EAX7lPtGFYuLi/exw/sF9xF5MDOh+xD7BMUFDviU960V+0WlPPc0PPs0+0Vx9xT7EG37RPcy3vcyOG33RPcU9xAFDviU98EVi2B4ZG5wCIuL+zT7NAV7e3t7e4t7i3ube5sI+zT3NAVupniyi7aL3M3N3Iu2i7J4pm6mqLKetovci81JizoIDviU98EVi9xJzTqLYItkeHBucKhknmCLOotJSYs6i2CeZKhwCIuL9zT7NAWbe5t7m4ubi5ubm5sI9zT3NAWopp6yi7YIME0V+zb7NgWKioqKiouKi4qMiowI+zb3NgV6m4Ghi6OLubCwuYuji6GBm3oIule6vwWbnKGVo4u5i7Bmi12Lc4F1ensIDviU98EVi2B4ZG5wCIuL+zT7NAV7e3t7e4t7i3ube5sI+zT3NAVupniyi7aL3M3N3Iuni6WDoX4IXED3BEtL+zT3RPdU+wTLssYFl46YjZiL3IvNSYs6CA6L98UVi7WXrKOio6Otl7aLlouXiZiHl4eWhZaEloSUhZKFk4SShZKEkpKSkZOSkpGUkZaSCJaSlpGXj5iPl42Wi7aLrX+jc6N0l2qLYYthdWBgYAj7RvtABYeIh4mGi4aLh42Hjgj7RvdABYmNiY2Hj4iOhpGDlISUhZWFlIWVhpaHmYaYiZiLmAgOZ4v3txWLkpCPlo0I9yOgzPcWBY6SkI+Ri5CLkIePhAjL+xb3I3YFlomQh4uEi4aJh4aGCCMmpPsjBYuKi4mLiIuHioiJiImIiIqHi4iLh4yHjQj7FM/7FUcFh4mHioiLh4uIjImOiY6KjouPi4yLjYyOCKP3IyPwBYaQiZCLjwgOZ4v3txWLkpCPlo0I9yOgzPcWBY6SkI+Ri5CLkIePhAjL+xb3I3YFlomQh4uEi4aJh4aGCCMmpPsjBYuKi4mLiIuCh4aDi4iLh4yHjQj7FM/7FUcFh4mHioiLh4uIjImOiY6KjouPi4yLjYyOCKP3IyPwBYaQiZCLjwjKeRXjN3b7DfcAxPZSd/cN4t/7DJ1V9wFV+wEFDq73ZhWLk42RkZEIsbIFkZCRjpOLkouSiJCGCN8291D3UAWQkJKOkouTi5GIkYYIsWQFkYaNhIuEi4OJhYWFCPuJ+4kFhYWFiYOLhIuEjYaRCPsi9yIFhZCJkouSCA77AartFYuSjpKQkAjf3zffBYaQiJKLk4uSjpKQkAiysgWRkJGOk4uSi5KIkIYI3zff3wWQkJKOk4uSi5KIkIYIsmQFkIaOhIuEi4OIhIaGCDc33zcFkIaOhIuEi4OIhYaFCGRkBYaGhIiEi4OLhI6GkAg33zc3BYaGhIiEi4OLhY6FkAhksgWGkYiRi5MIDvtLi8sVi/c5BYuSjpKQkJCQko6SiwiVi4vCBYuul6mkpKSkqpiui66LqX6kcqRymG2LaAiLVJSLBZKLkoiQhpCGjoSLhAiL+zkFi4OIhYaGhoWEiYSLCPuniwWEi4SNhpGGkIiRi5MI5vdUFfcni4vCBYufhJx8mn2ZepJ3i3aLeoR9fX18g3qLdwiLVAUO+yaLshWL+AQFi5GNkY+RjpCQj5KNj42PjI+LCPfAiwWPi4+Kj4mRiZCHj4aPhY2Fi4UIi/wEBYuEiYWHhoeGhoeFiIiKhoqHi4GLhI6EkQj7EvcN+xL7DQWEhYOIgouHi4eLh42EjoaPiJCHkImRi5IIDov3XRWLko2Rj5Kltq+vuKW4pbuZvYu9i7t9uHG4ca9npWCPhI2Fi4SLhYmEh4RxYGdoXnAIXnFbflmLWYtbmF6lXqZnrnG2h5KJkouRCLCLFaRkq2yxdLF0tH+4i7iLtJexorGiq6qksm64Z61goZZ3kXaLdItnfm1ycnJybX9oiwhoi22XcqRypH6pi6+LopGglp9gdWdpbl4I9xiwFYuHjIiOiI6IjoqPi4+LjoyOjo2OjY6Lj4ubkJmXl5eWmZGbi4+LjoyOjo2OjY6LjwiLj4mOiY6IjYiNh4tzi3eCenp6eoJ3i3MIDov3XRWLko2Sj5GouK+utqW3pbqYvouci5yJnIgIm6cFjY6NjI+LjIuNi42JjYqOio+JjomOiY6KjomOiY6JjoqNioyKjomMiYuHi4qLiouLCHdnbVVjQ2NDbVV3Zwh9cgWJiIiJiIuJi36SdJiIjYmOi46LjY+UlJlvl3KcdJ90oHeie6WHkYmSi5IIsIsVqlq0Z711CKGzBXqXfpqCnoKdhp6LoIuikaCWn2B1Z2luXgj3GLAVi4eMiI6IjoiOio+Lj4uOjI6OjY6NjouPi5uQmZeXl5aZkZuLj4uOjI6OjY6NjouPCIuPiY6JjoiNiI2Hi3OLd4J6enp6gneLcwji+10VoLAFtI+wmK2hrqKnqKKvdq1wp2uhCJ2rBZ1/nHycepx6mHqWeY+EjYWLhIuEiYWHhIR/gH1+fG9qaXJmeWV5Y4Jhiwi53BXb9yQFjIKMg4uEi3CDc3x1fHV3fHOBCA6L1BWL90sFi5WPlJKSkpKTj5aLCNmLBZKPmJqepJaZlZeVlY+Qj5ONl42WjpeOmI+YkZWTk5OSk46Vi5uLmYiYhZiFlIGSfgiSfo55i3WLeYd5gXgIvosFn4uchJl8mn2Seot3i3qGfIJ9jYSLhYuEi3yIfoR+i4eLh4uHi3eGen99i3CDdnt8CHt8dYNwiwhmiwV5i3mNeY95kHeRc5N1k36Ph4sIOYsFgIuDjoSShJKHlIuVCLCdFYuGjIePiI+Hj4mQi5CLj42Pj46OjY+LkIuQiZCIjoePh42Gi4aLh4mHh4eIioaLhgjUeRWUiwWNi46Lj4qOi4+KjYqOi4+Kj4mQio6KjYqNio+Kj4mQio6KjIqzfquEpIsIrosFr4uemouri5CKkYqQkY6QkI6SjpKNkouSi5KJkoiRlZWQlouYi5CKkImRiZGJj4iOCJGMkI+PlI+UjZKLkouViJODk4SSgo+CiwgmiwWLlpCalJ6UnpCbi5aLnoiYhJSFlH+QeYuGhoeDiYCJf4h/h3+IfoWBg4KHh4SCgH4Ii4qIiYiGh4aIh4mIiIiIh4eGh4aHh4eHiIiHiIeHiIiHiIeKh4mIioiLCIKLi/tLBQ6L90sVi/dLBYuVj5OSk5KSk46WiwjdiwWPi5iPoZOkk6CRnZCdj56Nn4sIq4sFpougg5x8m3yTd4txCIuJBZd8kHuLd4uHi4eLh5J+jn6LfIuEi4SJhZR9kHyLeot3hHp8fH19eoR3iwhYiwWVeI95i3mLdIh6hH6EfoKBfoV+hX2He4uBi4OPg5KFkYaTh5SHlYiTipOKk4qTiJMIiZSIkYiPgZSBl4CaeKR+moSPCD2LBYCLg4+EkoSSh5SLlQiw9zgVi4aMh4+Ij4ePiZCLkIuPjY+Pjo6Nj4uQi5CJkIiOh4+HjYaLhouHiYeHh4iKhouGCNT7OBWUiwWOi46Kj4mPio+IjoiPh4+IjoePiI+Hj4aPho6HjoiNiI6Hj4aOho6Ii4qWfpKDj4YIk4ORgY5+j36OgI1/jYCPg5CGnYuXj5GUkpSOmYuei5aGmoKfgp6GmouWCPCLBZSLlI+SkpOTjpOLlYuSiZKHlIeUho+Fi46PjY+NkY2RjJCLkIuYhpaBlY6RjZKLkgiLkomSiJKIkoaQhY6MkIyRi5CLm4aXgpOBkn6Pe4sIZosFcotrhGN9iouIioaJh4qHiomKiYqIioaKh4mHioiKiYuHioiLh4qIi4mLCIKLi/tLBQ77lIv3txWLkpCPlo0I9yOgzPcWBY6SkI+RiwiL/BL7FUcFh4mHioiLh4uIjImOiY6KjouPi4yLjYyOCKP3IyPwBYaQiZCLjwgOi/fFFYu1l6yjoqOjrZe2i5aLl4mYh5eHloWWhJaElIWShZOEkoWShJKSkpGTkpKRlJGWkgiWkpaRl4+Yj5eNlou2i61/o3OjdJdqi2GLYXVgYGAI+0b7QAWHiIeJhouGi4eNh44I+0b3QAWJjYmNh4+IjoaRg5SElIWVhZSFlYaWh5mGmImYi5gIsIsVi2ucaa9oCPc6+zT3OvczBa+vnK2Lq4ubiZiHl4eXhpSFkoSSg5GCj4KQgo2CjYONgYuBi4KLgIl/hoCGgIWChAiBg4OFhISEhYaFhoaIhoaJhYuFi4aNiJCGkIaRhJGEkoORgZOCkoCRgJB/kICNgosIgYuBi4OJgomCiYKGgoeDhYSEhYSGgod/h3+Jfot7CA77JouyFYv4BAWLkY2Rj5GOkJCPko2PjY+Mj4sI98CLBY+Lj4qPiZGJkIePho+FjYWLhQiL/AQFi4SJhYeGh4aGh4WIiIqGioeLgYuEjoSRCPsS9w37EvsNBYSFg4iCi4eLh4uHjYSOho+IkIeQiZGLkgiwkxX3JvchpHL3DfsIi/f3+7iLi/v3BQ5ni8sVi/c5BYuSjpKQkJCQko6Siwj3VIuLwgWLrpippKSkpKmYrouvi6l+pHKkcpdti2gIi0IFi4aKhoeIh4eHiYaLCHmLBYaLh42Hj4eOipCLkAiL1AWLn4OcfZp9mXqSdot3i3qEfX18fIR6i3cIi1SniwWSi5KIkIaQho6Ei4QIi/s5BYuDiIWGhoaFhImEiwj7p4sFhIuEjYaRhpCIkYuTCA5njPe6FYyQkI6UjQj3I6DM9xYFj5KPj5GLkIuQh4+ECMv7FvcjdgWUiZCIjYaNhoiFhYUIIyak+yMFjIWKhomHiYiIiYaLiIuHjIeNCPsUz/sVRwWHiYeKiIuHi4eNiY6Jj4uQjJEIo/cjI/AFhZGJkY2QCPeB+z0VnILlW3rxiJ6ZmNTS+wydgpxe54v7pwUOZ4vCFYv3SwWLkI2Pjo+Pjo+NkIsI3osFkIuPiY6Ij4eNh4uGCIv7SwWLhomHh4eIh4eKhosIOIsFhouHjIePiI+Jj4uQCLCvFYuGjIePh46IkImQi5CLj42Pjo6PjY+LkIuQiZCIjoePh42Gi4aLhomIh4eIioaLhgjvZxWL90sFi5CNj46Oj4+PjZCLj4ySkJWWlZaVl5SXmJuVl5GRjo6OkI6RjZCNkIyPjI6MkY2TCIySjJGMj4yPjZCOkY6RjpCPjo6Pj42Qi5SLk4qSiZKJkYiPiJCIjoiPho6GjYeMhwiNh4yGjIaMhYuHi4iLiIuHi4eLg4uEiYSJhImFiYeJh4mFh4WLioqJiomJiIqJiokIi4qKiIqJCNqLBZqLmIWWgJaAkH+LfIt6hn2Af46DjYSLhIt9h36Cf4+Bi3+HgImAhYKEhI12hnmAfgh/fXiDcosIZosFfot+jHyOfI5/joOOg41/j32Qc5N8j4SMhouHjYiOh4+Jj4uQCA5ni/c5FYuGjYaOiI+Hj4mQiwjeiwWQi4+Njo+Pjo2Qi5AIi/dKBYuQiZCHjoiPh42Giwg4iwWGi4eJh4eIiImGi4YIi/tKBbD3JhWLkIyPj4+OjpCNkIuQi4+Jj4iOh42Hi4aLhomHiIeHh4eKhouGi4aMiI+Hj4qPi5AI7/snFYv3SwWLkI2Qj46Oj4+NkIuSi5qPo5OZkJePk46TjZeOmo6ajpiMmIsIsIsFpIueg5d9ln6Qeol1koSRgo2Aj4CLgIeAlH+Pfot9i4WJhIiCloCQfIt7i3yFfoGACICAfoZ8iwg8iwWMiIyJi4mMiYyJjYmMiIyKi4mPhI2GjYeNh42GjYOMhIyEi4SLhouHi4iLiYuGioYIioWKhomHioeJh4iGh4eIh4aIh4iFiISJhImDioKLhouHjYiPh4+Ij4iRiJGJkIqPCIqPipGKkomTipGKj4qOiZCJkYiQiJCIjoWSgZZ+nIKXgZaBloGWhJGHi4aLh42HjwiIjomQi48IDviUFPiUFYsMCgAAAAADAgABkAAFAAABTAFmAAAARwFMAWYAAAD1ABkAhAAAAAAAAAAAAAAAAAAAAAEQAAAAAAAAAAAAAAAAAAAAAEAAAPFlAeD/4P/gAeAAIAAAAAEAAAAAAAAAAAAAACAAAAAAAAIAAAADAAAAFAADAAEAAAAUAAQAkAAAACAAIAAEAAAAAQAg5gXwBvAN8CPwLvBu8HDwivCX8JzxI/Fl//3//wAAAAAAIOYA8ATwDPAj8C7wbvBw8Ifwl/Cc8SPxZP/9//8AAf/jGgQQBhABD+wP4g+jD6IPjA+AD3wO9g62AAMAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAf//AA8AAQAAAAEAAJrVlLJfDzz1AAsCAAAAAADP/GODAAAAAM/8Y4MAAP/bAgAB2wAAAAgAAgAAAAAAAAABAAAB4P/gAAACAAAAAAACAAABAAAAAAAAAAAAAAAAAAAAHAAAAAAAAAAAAAAAAAEAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAdwAAAHcAAACAAAjAZMAHwFJAAABbgAAAgAAAAIAAAACAAAAAgAAAAEAAAACAAAAAW4AAAHcAAAB3AABAdwAAAHcAAAAAFAAABwAAAAAAA4ArgABAAAAAAABAAwAAAABAAAAAAACAA4AQAABAAAAAAADAAwAIgABAAAAAAAEAAwATgABAAAAAAAFABYADAABAAAAAAAGAAYALgABAAAAAAAKADQAWgADAAEECQABAAwAAAADAAEECQACAA4AQAADAAEECQADAAwAIgADAAEECQAEAAwATgADAAEECQAFABYADAADAAEECQAGAAwANAADAAEECQAKADQAWgByAGEAdABpAG4AZwBWAGUAcgBzAGkAbwBuACAAMQAuADAAcgBhAHQAaQBuAGdyYXRpbmcAcgBhAHQAaQBuAGcAUgBlAGcAdQBsAGEAcgByAGEAdABpAG4AZwBGAG8AbgB0ACAAZwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABJAGMAbwBNAG8AbwBuAC4AAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format('woff'); + font-weight: normal; + font-style: normal; +} +.ui.rating .icon { + font-family: 'Rating'; + line-height: 1; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; + font-weight: normal; + font-style: normal; + text-align: center; +} + +/* Empty Star */ +.ui.rating .icon:before { + content: '\f005'; +} + +/* Active Star */ +.ui.rating .active.icon:before { + content: '\f005'; +} + +/*------------------- + Star +--------------------*/ + + +/* Unfilled Star */ +.ui.star.rating .icon:before { + content: '\f005'; +} + +/* Active Star */ +.ui.star.rating .active.icon:before { + content: '\f005'; +} + +/* Partial */ +.ui.star.rating .partial.icon:before { + content: '\f006'; +} +.ui.star.rating .partial.icon { + content: '\f005'; +} + +/*------------------- + Heart +--------------------*/ + + +/* Empty Heart +.ui.heart.rating .icon:before { + content: '\f08a'; +} +*/ +.ui.heart.rating .icon:before { + content: '\f004'; +} +/* Active */ +.ui.heart.rating .active.icon:before { + content: '\f004'; +} + + +/******************************* + Site Overrides +*******************************/ + diff --git a/FusionIIIT/applications/ps2/static/ps2/js/rating.js b/FusionIIIT/applications/ps2/static/ps2/js/rating.js new file mode 100644 index 000000000..96bd39dca --- /dev/null +++ b/FusionIIIT/applications/ps2/static/ps2/js/rating.js @@ -0,0 +1,48 @@ +/*! + * # Semantic UI 2.2.12 - Rating + * http://github.com/semantic-org/semantic-ui/ + * + * + * Released under the MIT license + * http://opensource.org/licenses/MIT + * + */ + +$(document).ready(function(){ + console.log("TTTTTTTT"); +}); + +function addtoinv(event) { + var department = $('input[name="Department"]'); + var name = $('input[name="name"]').val(); + var date = $('input[name="date"]'); + var price = $('input[name="price"]').val(); + var quantity = $('input[name="quantity"]').val(); + + if (name == "a") + { + alert("The Inventory can't be updated successfully"); + return; + } + else + { + event.preventDefault(); + $.ajax({ + type: 'POST', + url: '.', + data: { + 'department' : department, + 'name' : name, + 'date' : date, + 'price' : price, + 'quantity' : quantity, + }, + success: function(data) { + alert("The Inventory has been updated successfully"); + setTimeout(function() { + window.location.replace('http://localhost:8000/ps2'); + }, 1500); + }, + }); + } +}; \ No newline at end of file diff --git a/FusionIIIT/applications/ps2/tests.py b/FusionIIIT/applications/ps2/tests.py new file mode 100644 index 000000000..7ce503c2d --- /dev/null +++ b/FusionIIIT/applications/ps2/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/FusionIIIT/applications/ps2/urls.py b/FusionIIIT/applications/ps2/urls.py new file mode 100644 index 000000000..d3d4a4751 --- /dev/null +++ b/FusionIIIT/applications/ps2/urls.py @@ -0,0 +1,13 @@ +from django.conf.urls import url + +from . import views + +app_name = 'ps2' + +urlpatterns = [ + url(r'^$', views.ps2, name='ps2'), + url(r'^addstock/$', views.addstock, name='addstock'), + url(r'^transfers/$', views.viewtransfers, name='viewtransfers'), + url(r'^transfers_form/$', views.addtransfers, name='addtransfers'), + url(r'^report/$',views.report,name="report") +] \ No newline at end of file diff --git a/FusionIIIT/applications/ps2/utils.py b/FusionIIIT/applications/ps2/utils.py new file mode 100644 index 000000000..21b6fee8a --- /dev/null +++ b/FusionIIIT/applications/ps2/utils.py @@ -0,0 +1,14 @@ +from io import BytesIO +from django.http import HttpResponse +from django.template.loader import get_template + +from xhtml2pdf import pisa + +def render_to_pdf(template_src,context_dict={}): + template = get_template(template_src) + html = template.render(context_dict) + result = BytesIO() + pdf = pisa.pisaDocument(BytesIO(html.encode("ISO-8859-1")),result) + if not pdf.err: + return HttpResponse(result.getvalue(),content_type='application/pdf') + return None \ No newline at end of file diff --git a/FusionIIIT/applications/ps2/views.py b/FusionIIIT/applications/ps2/views.py new file mode 100644 index 000000000..37cd6b995 --- /dev/null +++ b/FusionIIIT/applications/ps2/views.py @@ -0,0 +1,217 @@ +from django.shortcuts import render +from django.http import HttpResponseRedirect,HttpResponse +from django.shortcuts import get_object_or_404, render +from django.shortcuts import redirect +import datetime as dd +from html import escape + +from django.template.loader import get_template +from .utils import render_to_pdf + +from io import BytesIO +from django.template.loader import render_to_string +from xhtml2pdf import pisa + +from .models import StockEntry, StockAdmin ,TransferEntry +from ..globals.models import ExtraInfo, User + +# Create your views here. +def ps2(request): + sel = request.GET.get("dep") + + current_user = get_object_or_404(User, username=request.user.username) + extraInfo = ExtraInfo.objects.get(user=current_user) + if(extraInfo.user_type=="student"): + return HttpResponseRedirect('/') + + stock_admin = StockAdmin.objects.filter(user=current_user) + if not stock_admin: + return HttpResponseRedirect('/') + + stock_admin_department = stock_admin.first().department + + stocks = StockEntry.objects.all().filter(head_of_asset=stock_admin_department).order_by('id').values() + + if current_user.username == 'acadadmin': + if sel: + if sel != 'Global': + stocks = StockEntry.objects.all().filter(head_of_asset=sel).order_by('id').values() + else : + stocks = StockEntry.objects.all().order_by('id').values() + else : + stocks = StockEntry.objects.all().order_by('id').values() + + + stock_admin = StockAdmin.objects.all() + stock_ad = set() + for i in stock_admin: + stock_ad.add(i.department) + + context = { + 'user' : 'acadadmin', + 'stocks': stocks, + 'department': stock_ad, + } + return render(request, "ps2/ps2.html", context) + + else : + context = { + 'user' : current_user.username, + 'stocks': stocks, + 'department': stock_admin_department, + } + return render(request, "ps2/ps2.html", context) + + +def addstock(request): + current_user = get_object_or_404(User, username=request.user.username) + extraInfo = ExtraInfo.objects.get(user=current_user) + if(extraInfo.user_type=="student"): + return HttpResponseRedirect('/') + + if request.method == "POST": + name_of_particulars = request.POST.get('name_of_particulars') + inventory_no = request.POST.get('inventory_no') + rate = request.POST.get('rate') + amount = request.POST.get('amount') + quantity = request.POST.get('quantity') + supplier_name = request.POST.get('supplier_name') + bill_no = request.POST.get('bill_no') + buy_date = request.POST.get('buy_date') + head_of_asset = request.POST.get('head_of_asset') + issued_date = request.POST.get('issued_date') + section = request.POST.get('section') + floor = request.POST.get('floor') + receiver_name = request.POST.get('receiver_name') + + stock_admin = StockAdmin.objects.filter(user=current_user) + if not stock_admin: + return HttpResponseRedirect('/') + + if not head_of_asset: + head_of_asset = stock_admin.first().department + + for i in range(int(quantity)): + stock = StockEntry(name_of_particulars=name_of_particulars, inventory_no=inventory_no, rate=rate, amount=amount, supplier_name=supplier_name, bill_no=bill_no, buy_date=buy_date, issued_date=issued_date, head_of_asset=head_of_asset, section=section, floor=floor, receiver_name=receiver_name) + stock.save() + + return HttpResponseRedirect('/purchase-and-store2/') + + context = { + 'global_admin': False + } + + if current_user.username == 'acadadmin': + context['global_admin'] = True + + return render(request, "ps2/addstock.html", context) + + +def viewtransfers(request): + current_user = get_object_or_404(User, username=request.user.username) + extraInfo = ExtraInfo.objects.get(user=current_user) + if(extraInfo.user_type=="student"): + return HttpResponseRedirect('/') + + stock_admin = StockAdmin.objects.filter(user=current_user) + if not stock_admin: + return HttpResponseRedirect('/') + + stock_admin_department = stock_admin.first().department + + if current_user.username == 'acadadmin': + stocks = TransferEntry.objects.all().order_by('Date').values() + context = { + 'stocks': stocks, + 'department': stock_admin_department, + } + return render(request, "ps2/viewtransfers.html", context) + + else : + stocks = TransferEntry.objects.all().filter(From_department=stock_admin_department) | TransferEntry.objects.all().filter(To_department=stock_admin_department).order_by('Date').values() + context = { + 'stocks': stocks, + 'department': stock_admin_department, + } + return render(request, "ps2/viewtransfers.html", context) + +def addtransfers(request): + + current_user = get_object_or_404(User, username=request.user.username) + extraInfo = ExtraInfo.objects.get(user=current_user) + if(extraInfo.user_type=="student"): + return HttpResponseRedirect('/') + + if request.method == "POST": + id = request.POST.get('id') + to_department = request.POST.get('to_department') + to_location = request.POST.get('to_location') + r = request.POST.get('remark') + + item = StockEntry.objects.all().filter(id=id) + if to_department != item.first().head_of_asset: + stocks = TransferEntry(Item_id=id, From_department=item.first().head_of_asset, From_location=item.first().floor, To_department=to_department, To_location=to_location, Date=dd.date.today(), Remark=r) + stocks.save() + + stock_admin = StockEntry.objects.get(id=id) + stock_admin.head_of_asset = to_department + stock_admin.floor = to_location + stock_admin.save() + return redirect('ps2:viewtransfers') + + context = {} + return render(request, "ps2/addtransfers.html", context) + +def render_to_pdf(template_src, context_dict): + template = get_template(template_src) + html = template.render(context_dict) + result = BytesIO() + pdf = pisa.pisaDocument(BytesIO(html.encode("UTF-8")), result) + if not pdf.err: + return HttpResponse(result.getvalue(), content_type='application/pdf') + return HttpResponse('We had some errors
%s
' % escape(html)) + +def report(request): + sel = request.GET.get("dep") + + current_user = get_object_or_404(User, username=request.user.username) + extraInfo = ExtraInfo.objects.get(user=current_user) + if(extraInfo.user_type=="student"): + return HttpResponseRedirect('/') + + stock_admin = StockAdmin.objects.filter(user=current_user) + if not stock_admin: + return HttpResponseRedirect('/') + + stock_admin_department = stock_admin.first().department + + + if current_user.username == 'acadadmin': + stock_admin = StockAdmin.objects.all() + stock_ad = set() + for i in stock_admin: + stock_ad.add(i.department) + + if sel: + if sel != 'Global': + context = { + 'user' : 'acadadmin', + 'stocks': StockEntry.objects.all().filter(head_of_asset=sel).order_by('id').values(), + 'department': stock_ad, + } + return render_to_pdf('ps2/pdf.html',context) + context = { + 'user' : 'acadadmin', + 'stocks': StockEntry.objects.all().order_by('id').values(), + 'department': stock_ad, + } + return render_to_pdf('ps2/pdf.html',context) + + else : + stocks = StockEntry.objects.all().filter(head_of_asset=stock_admin_department).order_by('id').values() + context = { + 'user' : current_user.username, + 'stocks': stocks, + 'department': stock_admin_department, + } + return render_to_pdf('ps2/pdf.html', context) diff --git a/FusionIIIT/applications/research_procedures/tests.py b/FusionIIIT/applications/research_procedures/tests.py index c6fa3f281..ad0d58205 100644 --- a/FusionIIIT/applications/research_procedures/tests.py +++ b/FusionIIIT/applications/research_procedures/tests.py @@ -1,4 +1,15 @@ from django.test import TestCase - +from django.shortcuts import render +from django.http import HttpResponse +from django.http import JsonResponse +import json +from applications.research_procedures.models import ResearchGroup,ResearchProject # Create your tests here . +def testfun(request): + # received_json_data=json.loads(request.body) + # print(received_json_data['name']) + data = ResearchProject.objects.values() + + return JsonResponse(list(data),safe=False) + \ No newline at end of file diff --git a/FusionIIIT/applications/research_procedures/urls.py b/FusionIIIT/applications/research_procedures/urls.py index 05e653c74..f351b29b3 100644 --- a/FusionIIIT/applications/research_procedures/urls.py +++ b/FusionIIIT/applications/research_procedures/urls.py @@ -1,16 +1,20 @@ from django.urls import include from django.conf.urls import url from . import views - +from . import tests app_name="research_procedures" urlpatterns = [ - url(r'^$', views.patent_registration, name='patent_registration'), + url(r'^$', views.rspc_profile, name='rspc_profile_main'), + url(r'^user_profile', views.rspc_profile_faculty, name='rspc_profile_faculty'), + url(r'^citation', views.generate_citation, name='generate_citation'), + url(r'^report', views.rspc_generate_report, name='rspc_generate_report'), url(r'^update$', views.patent_status_update, name='patent_status_update'), url(r'^research_group$', views.research_group_create, name='research_group_create'), url(r'^project_insert$',views.project_insert,name='project_insert'), url(r'^consult_insert$',views.consult_insert,name='consult_insert'), url(r'^transfer_insert$',views.transfer_insert,name='transfer_insert'), url(r'^api/',include('applications.research_procedures.api.urls')), + url(r'^test/$',tests.testfun,name = 'test') ] \ No newline at end of file diff --git a/FusionIIIT/applications/research_procedures/views.py b/FusionIIIT/applications/research_procedures/views.py index 0b17aa3ee..dd53b090c 100644 --- a/FusionIIIT/applications/research_procedures/views.py +++ b/FusionIIIT/applications/research_procedures/views.py @@ -2,11 +2,19 @@ from django.contrib import messages from applications.research_procedures.models import Patent, ResearchGroup, ResearchProject, ConsultancyProject, TechTransfer from applications.globals.models import ExtraInfo, HoldsDesignation, Designation +from django.contrib.auth.models import User +from applications.eis.models import * from django.core.files.storage import FileSystemStorage from notification.views import research_procedures_notif from django.urls import reverse from .forms import ResearchGroupForm from django.contrib.auth.decorators import login_required +from django.template import loader +from django.template.loader import get_template +from io import BytesIO +from xhtml2pdf import pisa +from django.http import HttpResponse, HttpResponseRedirect +from html import escape import datetime # Faculty can file patent and view status of it. @@ -150,7 +158,7 @@ def research_group_create(request): @login_required def project_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id research_project = ResearchProject() research_project.user = request.user @@ -192,7 +200,7 @@ def project_insert(request): @login_required def consult_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id consultancy_project = ConsultancyProject() consultancy_project.user = request.user consultancy_project.pf_no = pf @@ -223,11 +231,633 @@ def consult_insert(request): def transfer_insert(request): user = get_object_or_404(ExtraInfo, user=request.user) - pf = user.id + pf = request.user.id tech_transfer = TechTransfer() tech_transfer.pf_no = pf tech_transfer.details = request.POST.get('details') tech_transfer.save() messages.success(request,"Successfully created Technology Transfer") - return redirect(reverse("research_procedures:patent_registration")) \ No newline at end of file + return redirect(reverse("research_procedures:patent_registration")) + +# Dean RSPC Profile + +def rspc_profile(request): + all_extra_info = [] + # for user in all_user: + curr_extra_info = ExtraInfo.objects.filter(user_type = 'faculty') + for curr_info in curr_extra_info: + if(curr_info.user_type == 'faculty'): + all_extra_info.append(curr_info.user.username) + + + print(all_extra_info) + + + all_extra_info = ExtraInfo.objects.filter() + user = get_object_or_404(User, username= request.user) + extra_info = get_object_or_404(ExtraInfo, user=user) + if extra_info.user_type == 'student': + return redirect('/') + pf = extra_info.id + designations = HoldsDesignation.objects.filter(user_id=extra_info.user.id) + flag_rspc = False + for designation in designations: + print(designation.designation_id) + currDesig = get_object_or_404(Designation, id=designation.designation_id) + print(currDesig.name) + if(currDesig.name=="dean_rspc"): + flag_rspc = True + break + + if flag_rspc != True: + if extra_info.user_type == 'faculty' or extra_info.user_type == 'staff': + return redirect('/eis/profile/') + + journal = emp_research_papers.objects.filter(rtype='Journal').order_by('-year', '-a_month') + conference = emp_research_papers.objects.filter(rtype='Conference').order_by('-year', '-a_month') + books = emp_published_books.objects.all().order_by('-pyear', '-authors') + projects = emp_research_projects.objects.all().order_by('-start_date') + consultancy = emp_consultancy_projects.objects.all().order_by('-start_date') + patents = emp_patents.objects.all().order_by('-p_year', '-a_month') + techtransfers = emp_techtransfer.objects.all().order_by('-date_entry') + mtechs = emp_mtechphd_thesis.objects.filter(degree_type=1).order_by('-s_year', '-a_month') + phds = emp_mtechphd_thesis.objects.filter(degree_type=2).order_by('-s_year', '-a_month') + fvisits = emp_visits.objects.filter(v_type=2).order_by('-start_date') + ivisits = emp_visits.objects.filter(v_type=1).order_by('-start_date') + # for fvisit in fvisits: + # fvisit.countryfull = countries[fvisit.country] + consymps = emp_confrence_organised.objects.all().order_by('-start_date') + awards = emp_achievement.objects.all().order_by('-a_year', '-a_month') + talks = emp_expert_lectures.objects.all().order_by('-l_year', '-a_month') + chairs = emp_session_chair.objects.all().order_by('-start_date') + keynotes = emp_keynote_address.objects.all().order_by('-start_date') + events = emp_event_organized.objects.all().order_by('-start_date') + y=[] + for r in range(1995, (datetime.datetime.now().year + 1)): + y.append(r) + + + context = {'user': user, + 'pf':pf, + 'journal':journal, + 'conference': conference, + 'books': books, + 'projects': projects, + 'consultancy':consultancy, + 'patents':patents, + 'techtransfers':techtransfers, + 'mtechs':mtechs, + 'phds':phds, + 'fvisits':fvisits, + 'ivisits': ivisits, + 'consymps':consymps, + 'awards':awards, + 'talks':talks, + 'chairs':chairs, + 'keynotes':keynotes, + 'events':events, + 'year_range':y, + # 'pers':pers + } + return render(request, 'eisModulenew/rspc_profile.html', context) + + +# generating rspc profile of a faculty +def rspc_profile_faculty(request): + # user = get_object_or_404(faculty_about, user=request.user) + # pf = user.user + username = request.POST.get('data') + print(username) + user = get_object_or_404(User, username= request.user) + extra_info = get_object_or_404(ExtraInfo, user=user) + user_faculty = get_object_or_404(User, username= username) + extra_info_faculty = get_object_or_404(ExtraInfo, user=user_faculty) + if extra_info_faculty.user_type == 'student': + return redirect('/') + pf = extra_info.id + pf_faculty = extra_info_faculty.id + print(pf_faculty) + designations = HoldsDesignation.objects.filter(user_id=extra_info.user.id) + flag_rspc = False + for designation in designations: + print(designation.designation_id) + currDesig = get_object_or_404(Designation, id=designation.designation_id) + print(currDesig.name) + if(currDesig.name=="dean_rspc"): + flag_rspc = True + break + + if flag_rspc != True: + if extra_info.user_type == 'faculty': + return redirect('/eis/profile/') + + + journal = emp_research_papers.objects.filter(pf_no=pf_faculty, rtype='Journal').order_by('-year', '-a_month') + conference = emp_research_papers.objects.filter(pf_no=pf_faculty, rtype='Conference').order_by('-year', '-a_month') + books = emp_published_books.objects.filter(pf_no=pf_faculty).order_by('-pyear', '-authors') + projects = emp_research_projects.objects.filter(user=user_faculty).order_by('-start_date') + print(projects) + consultancy = emp_consultancy_projects.objects.filter(pf_no=pf_faculty).order_by('-start_date') + patents = emp_patents.objects.filter(pf_no=pf_faculty).order_by('-p_year', '-a_month') + techtransfers = emp_techtransfer.objects.filter(pf_no=pf_faculty).order_by('-date_entry') + mtechs = emp_mtechphd_thesis.objects.filter(pf_no=pf_faculty, degree_type=1).order_by('-s_year', '-a_month') + phds = emp_mtechphd_thesis.objects.filter(pf_no=pf_faculty, degree_type=2).order_by('-s_year', '-a_month') + fvisits = emp_visits.objects.filter(pf_no=pf_faculty, v_type=2).order_by('-start_date') + ivisits = emp_visits.objects.filter(pf_no=pf_faculty, v_type=1).order_by('-start_date') + + + consymps = emp_confrence_organised.objects.filter(pf_no=pf_faculty).order_by('-date_entry') + awards = emp_achievement.objects.filter(pf_no=pf_faculty).order_by('-date_entry') + talks = emp_expert_lectures.objects.filter(pf_no=pf_faculty).order_by('-date_entry') + chairs = emp_session_chair.objects.filter(pf_no=pf_faculty).order_by('-date_entry') + keynotes = emp_keynote_address.objects.filter(pf_no=pf_faculty).order_by('-date_entry') + events = emp_event_organized.objects.filter(pf_no=pf_faculty).order_by('-start_date') + y=[] + for r in range(1995, (datetime.datetime.now().year + 1)): + y.append(r) + + context = {'user': user, + 'pf':pf, + 'journal':journal, + 'conference': conference, + 'books': books, + 'projects': projects, + 'consultancy':consultancy, + 'patents':patents, + 'techtransfers':techtransfers, + 'mtechs':mtechs, + 'phds':phds, + 'fvisits':fvisits, + 'ivisits': ivisits, + 'consymps':consymps, + 'awards':awards, + 'talks':talks, + 'chairs':chairs, + 'keynotes':keynotes, + 'events':events, + 'year_range':y, + } + return render(request, 'eisModulenew/rspc_profile.html', context) + + +def generate_citation(request): + username = request.POST.get('data') + print(username) + user = get_object_or_404(User, username= request.user) + extra_info = get_object_or_404(ExtraInfo, user=user) + user_faculty = get_object_or_404(User, username= username) + extra_info_faculty = get_object_or_404(ExtraInfo, user=user_faculty) + if extra_info_faculty.user_type == 'student': + return redirect('/') + pf = extra_info.id + pf_faculty = extra_info_faculty.id + print(pf_faculty) + designations = HoldsDesignation.objects.filter(user_id=extra_info.user.id) + flag_rspc = False + for designation in designations: + print(designation.designation_id) + currDesig = get_object_or_404(Designation, id=designation.designation_id) + print(currDesig.name) + if(currDesig.name=="dean_rspc"): + flag_rspc = True + break + + if flag_rspc != True: + if extra_info.user_type == 'faculty': + return redirect('/eis/profile/') + + projects = emp_research_projects.objects.filter(user=user_faculty).order_by('-start_date') + context = { + 'projects' : projects + } + + return render(request, 'rs/citation.html', context) + +def render_to_pdf(template_src, context_dict): + template = get_template(template_src) + html = template.render(context_dict) + result = BytesIO() + pdf = pisa.pisaDocument(BytesIO(html.encode("UTF-8")), result) + if not pdf.err: + return HttpResponse(result.getvalue(), content_type='application/pdf') + return HttpResponse('We had some errors
%s
' % escape(html)) + + +def rspc_generate_report(request): + user = get_object_or_404(ExtraInfo, user=request.user) + pf = user.id + start = request.POST.get('syear') + star_date = start+'-01-01' + end = request.POST.get('lyear') + star = request.POST.get('smonth') + star_date = start + '-01-01' + en = request.POST.get('lmonth') + if(request.POST.get('journal_select')=="journal"): + journal = emp_research_papers.objects.filter(rtype='Journal').filter(year__range=[start,end]).order_by('-date_entry') + journal_req="1" + else: + journal="" + journal_req="0" + + if (request.POST.get('conference_select') == "conference"): + conference = emp_research_papers.objects.filter(rtype='Conference').filter(year__range=[start,end]).order_by('-date_entry') + conference_req = "1" + else: + conference="" + conference_req = "0" + + if (request.POST.get('books_select') == "books"): + books = emp_published_books.objects.all().order_by('-date_entry') + books_req = "1" + else: + books="" + books_req = "0" + + if (request.POST.get('projects_select') == "projects"): + projects = emp_research_projects.objects.all().filter(start_date__year__range=[start,end]).filter(start_date__month__range=[star,en]).order_by('-start_date') + projects_req = "1" + else: + projects = "" + projects_req = "0" + + if (request.POST.get('consultancy_select') == "consultancy"): + consultancy = emp_consultancy_projects.objects.all().filter(start_date__year__range=[start,end]).filter(start_date__month__range=[star,en]).order_by('-date_entry') + consultancy_req = "1" + else: + consultancy = "" + consultancy_req = "0" + + if (request.POST.get('patents_select') == "patents"): + patents = emp_patents.objects.all().filter(p_year__range=[start,end]).filter(a_month__range=[star,en]).order_by('-date_entry') + patents_req = "1" + else: + patents = "" + patents_req = "0" + + if (request.POST.get('techtransfers_select') == "techtransfers"): + techtransfers = emp_techtransfer.objects.all().filter(date_entry__year__range=[start,end]).filter(date_entry__month__range=[star,en]).order_by('-date_entry') + techtransfers_req = "1" + else: + techtransfers="" + techtransfers_req = "0" + + if (request.POST.get('mtechs_select') == "mtechs"): + mtechs = emp_mtechphd_thesis.objects.filter(degree_type=1).filter(s_year__range=[start,end]).filter(a_month__range=[star,en]).order_by('-date_entry') + mtechs_req = "1" + else: + mtechs="" + mtechs_req = "0" + + if (request.POST.get('phds_select') == "phds"): + phds = emp_mtechphd_thesis.objects.filter(degree_type=2).filter(s_year__range=[start,end]).filter(a_month__range=[star,en]).order_by('-date_entry') + phds_req = "1" + else: + phds="" + phds_req = "0" + + if (request.POST.get('fvisits_select') == "fvisits"): + fvisits = emp_visits.objects.filter(v_type=2).filter(start_date__year__range=[start,end]).filter(start_date__month__range=[star,en]).order_by('-entry_date') + fvisits_req = "1" + else: + fvisits="" + fvisits_req = "0" + countries = { + 'AF': 'Afghanistan', + 'AX': 'Aland Islands', + 'AL': 'Albania', + 'DZ': 'Algeria', + 'AS': 'American Samoa', + 'AD': 'Andorra', + 'AO': 'Angola', + 'AI': 'Anguilla', + 'AQ': 'Antarctica', + 'AG': 'Antigua And Barbuda', + 'AR': 'Argentina', + 'AM': 'Armenia', + 'AW': 'Aruba', + 'AU': 'Australia', + 'AT': 'Austria', + 'AZ': 'Azerbaijan', + 'BS': 'Bahamas', + 'BH': 'Bahrain', + 'BD': 'Bangladesh', + 'BB': 'Barbados', + 'BY': 'Belarus', + 'BE': 'Belgium', + 'BZ': 'Belize', + 'BJ': 'Benin', + 'BM': 'Bermuda', + 'BT': 'Bhutan', + 'BO': 'Bolivia', + 'BA': 'Bosnia And Herzegovina', + 'BW': 'Botswana', + 'BV': 'Bouvet Island', + 'BR': 'Brazil', + 'IO': 'British Indian Ocean Territory', + 'BN': 'Brunei Darussalam', + 'BG': 'Bulgaria', + 'BF': 'Burkina Faso', + 'BI': 'Burundi', + 'KH': 'Cambodia', + 'CM': 'Cameroon', + 'CA': 'Canada', + 'CV': 'Cape Verde', + 'KY': 'Cayman Islands', + 'CF': 'Central African Republic', + 'TD': 'Chad', + 'CL': 'Chile', + 'CN': 'China', + 'CX': 'Christmas Island', + 'CC': 'Cocos (Keeling) Islands', + 'CO': 'Colombia', + 'KM': 'Comoros', + 'CG': 'Congo', + 'CD': 'Congo, Democratic Republic', + 'CK': 'Cook Islands', + 'CR': 'Costa Rica', + 'CI': 'Cote D\'Ivoire', + 'HR': 'Croatia', + 'CU': 'Cuba', + 'CY': 'Cyprus', + 'CZ': 'Czech Republic', + 'DK': 'Denmark', + 'DJ': 'Djibouti', + 'DM': 'Dominica', + 'DO': 'Dominican Republic', + 'EC': 'Ecuador', + 'EG': 'Egypt', + 'SV': 'El Salvador', + 'GQ': 'Equatorial Guinea', + 'ER': 'Eritrea', + 'EE': 'Estonia', + 'ET': 'Ethiopia', + 'FK': 'Falkland Islands (Malvinas)', + 'FO': 'Faroe Islands', + 'FJ': 'Fiji', + 'FI': 'Finland', + 'FR': 'France', + 'GF': 'French Guiana', + 'PF': 'French Polynesia', + 'TF': 'French Southern Territories', + 'GA': 'Gabon', + 'GM': 'Gambia', + 'GE': 'Georgia', + 'DE': 'Germany', + 'GH': 'Ghana', + 'GI': 'Gibraltar', + 'GR': 'Greece', + 'GL': 'Greenland', + 'GD': 'Grenada', + 'GP': 'Guadeloupe', + 'GU': 'Guam', + 'GT': 'Guatemala', + 'GG': 'Guernsey', + 'GN': 'Guinea', + 'GW': 'Guinea-Bissau', + 'GY': 'Guyana', + 'HT': 'Haiti', + 'HM': 'Heard Island & Mcdonald Islands', + 'VA': 'Holy See (Vatican City State)', + 'HN': 'Honduras', + 'HK': 'Hong Kong', + 'HU': 'Hungary', + 'IS': 'Iceland', + 'IN': 'India', + 'ID': 'Indonesia', + 'IR': 'Iran, Islamic Republic Of', + 'IQ': 'Iraq', + 'IE': 'Ireland', + 'IM': 'Isle Of Man', + 'IL': 'Israel', + 'IT': 'Italy', + 'JM': 'Jamaica', + 'JP': 'Japan', + 'JE': 'Jersey', + 'JO': 'Jordan', + 'KZ': 'Kazakhstan', + 'KE': 'Kenya', + 'KI': 'Kiribati', + 'KR': 'Korea', + 'KW': 'Kuwait', + 'KG': 'Kyrgyzstan', + 'LA': 'Lao People\'s Democratic Republic', + 'LV': 'Latvia', + 'LB': 'Lebanon', + 'LS': 'Lesotho', + 'LR': 'Liberia', + 'LY': 'Libyan Arab Jamahiriya', + 'LI': 'Liechtenstein', + 'LT': 'Lithuania', + 'LU': 'Luxembourg', + 'MO': 'Macao', + 'MK': 'Macedonia', + 'MG': 'Madagascar', + 'MW': 'Malawi', + 'MY': 'Malaysia', + 'MV': 'Maldives', + 'ML': 'Mali', + 'MT': 'Malta', + 'MH': 'Marshall Islands', + 'MQ': 'Martinique', + 'MR': 'Mauritania', + 'MU': 'Mauritius', + 'YT': 'Mayotte', + 'MX': 'Mexico', + 'FM': 'Micronesia, Federated States Of', + 'MD': 'Moldova', + 'MC': 'Monaco', + 'MN': 'Mongolia', + 'ME': 'Montenegro', + 'MS': 'Montserrat', + 'MA': 'Morocco', + 'MZ': 'Mozambique', + 'MM': 'Myanmar', + 'NA': 'Namibia', + 'NR': 'Nauru', + 'NP': 'Nepal', + 'NL': 'Netherlands', + 'AN': 'Netherlands Antilles', + 'NC': 'New Caledonia', + 'NZ': 'New Zealand', + 'NI': 'Nicaragua', + 'NE': 'Niger', + 'NG': 'Nigeria', + 'NU': 'Niue', + 'NF': 'Norfolk Island', + 'MP': 'Northern Mariana Islands', + 'NO': 'Norway', + 'OM': 'Oman', + 'PK': 'Pakistan', + 'PW': 'Palau', + 'PS': 'Palestinian Territory, Occupied', + 'PA': 'Panama', + 'PG': 'Papua New Guinea', + 'PY': 'Paraguay', + 'PE': 'Peru', + 'PH': 'Philippines', + 'PN': 'Pitcairn', + 'PL': 'Poland', + 'PT': 'Portugal', + 'PR': 'Puerto Rico', + 'QA': 'Qatar', + 'RE': 'Reunion', + 'RO': 'Romania', + 'RU': 'Russian Federation', + 'RW': 'Rwanda', + 'BL': 'Saint Barthelemy', + 'SH': 'Saint Helena', + 'KN': 'Saint Kitts And Nevis', + 'LC': 'Saint Lucia', + 'MF': 'Saint Martin', + 'PM': 'Saint Pierre And Miquelon', + 'VC': 'Saint Vincent And Grenadines', + 'WS': 'Samoa', + 'SM': 'San Marino', + 'ST': 'Sao Tome And Principe', + 'SA': 'Saudi Arabia', + 'SN': 'Senegal', + 'RS': 'Serbia', + 'SC': 'Seychelles', + 'SL': 'Sierra Leone', + 'SG': 'Singapore', + 'SK': 'Slovakia', + 'SI': 'Slovenia', + 'SB': 'Solomon Islands', + 'SO': 'Somalia', + 'ZA': 'South Africa', + 'GS': 'South Georgia And Sandwich Isl.', + 'ES': 'Spain', + 'LK': 'Sri Lanka', + 'SD': 'Sudan', + 'SR': 'Suriname', + 'SJ': 'Svalbard And Jan Mayen', + 'SZ': 'Swaziland', + 'SE': 'Sweden', + 'CH': 'Switzerland', + 'SY': 'Syrian Arab Republic', + 'TW': 'Taiwan', + 'TJ': 'Tajikistan', + 'TZ': 'Tanzania', + 'TH': 'Thailand', + 'TL': 'Timor-Leste', + 'TG': 'Togo', + 'TK': 'Tokelau', + 'TO': 'Tonga', + 'TT': 'Trinidad And Tobago', + 'TN': 'Tunisia', + 'TR': 'Turkey', + 'TM': 'Turkmenistan', + 'TC': 'Turks And Caicos Islands', + 'TV': 'Tuvalu', + 'UG': 'Uganda', + 'UA': 'Ukraine', + 'AE': 'United Arab Emirates', + 'GB': 'United Kingdom', + 'US': 'United States', + 'UM': 'United States Outlying Islands', + 'UY': 'Uruguay', + 'UZ': 'Uzbekistan', + 'VU': 'Vanuatu', + 'VE': 'Venezuela', + 'VN': 'Viet Nam', + 'VG': 'Virgin Islands, British', + 'VI': 'Virgin Islands, U.S.', + 'WF': 'Wallis And Futuna', + 'EH': 'Western Sahara', + 'YE': 'Yemen', + 'ZM': 'Zambia', + 'ZW': 'Zimbabwe', + 'KP': 'Korea (Democratic Peoples Republic of)', + } + + if (request.POST.get('ivisits_select') == "ivisits"): + ivisits = emp_visits.objects.filter(v_type=1).filter(start_date__year__range=[start,end]).filter(start_date__month__range=[star,en]).order_by('-entry_date') + ivisits_req = "1" + else: + ivisits="" + ivisits_req = "0" + for fvisit in fvisits: + fvisit.countryfull = countries[fvisit.country] + + if (request.POST.get('consymps_select') == "consymps"): + consymps = emp_confrence_organised.objects.all().filter(start_date__year__range=[start,end]).filter(start_date__month__range=[star,en]).order_by('-date_entry') + consymps_req = "1" + else: + consymps="" + consymps_req = "0" + + if (request.POST.get('awards_select') == "awards"): + awards = emp_achievement.objects.all().filter(a_year__range=[start,end]).order_by('-date_entry') + awards_req = "1" + else: + awards="" + awards_req = "0" + + if (request.POST.get('talks_select') == "talks"): + talks = emp_expert_lectures.objects.all().filter(l_date__year__range=[start,end]).filter(l_date__month__range=[star,en]).order_by('-date_entry') + talks_req = "1" + else: + talks="" + talks_req = "0" + + if (request.POST.get('chairs_select') == "chairs"): + chairs = emp_session_chair.objects.all().filter(start_date__year__range=[start,end]).filter(start_date__month__range=[star,en]).order_by('-date_entry') + chairs_req = "1" + else: + chairs="" + chairs_req = "0" + + if (request.POST.get('keynotes_select') == "keynotes"): + keynotes = emp_keynote_address.objects.all().filter(start_date__year__range=[start,end]).filter(start_date__month__range=[star,en]).order_by('-date_entry') + keynotes_req = "1" + else: + keynotes="" + keynotes_req = "0" + + if (request.POST.get('events_select') == "events"): + events = emp_event_organized.objects.all().filter(start_date__year__range=[start,end]).filter(start_date__month__range=[star,en]).order_by('-start_date') + events_req = "1" + else: + events="" + events_req = "0" + context = {'user': user, + 'pf':pf, + 'journal':journal, + 'journal_req':journal_req, + 'conference': conference, + 'conference_req': conference_req, + 'books': books, + 'books_req': books_req, + 'projects': projects, + 'projects_req': projects_req, + 'consultancy':consultancy, + 'consultancy_req': consultancy_req, + 'patents':patents, + 'patents_req': patents_req, + 'techtransfers':techtransfers, + 'techtransfers_req': techtransfers_req, + 'mtechs':mtechs, + 'mtechs_req': mtechs_req, + 'phds':phds, + 'phds_req': phds_req, + 'fvisits':fvisits, + 'fvisits_req': fvisits_req, + 'ivisits': ivisits, + 'ivisits_req': ivisits_req, + 'consymps':consymps, + 'consymps_req': consymps_req, + 'awards':awards, + 'awards_req': awards_req, + 'talks':talks, + 'talks_req': talks_req, + 'chairs':chairs, + 'chairs_req': chairs_req, + 'keynotes':keynotes, + 'keynotes_req': keynotes_req, + 'events':events, + 'events_req': events_req, + 'first_name':request.user.first_name, + 'last_name': request.user.last_name, + } + return render_to_pdf('eisModulenew/rspc_generatereportshow.html', context) diff --git a/FusionIIIT/applications/scholarships/admin.py b/FusionIIIT/applications/scholarships/admin.py index 77718a111..02c81b4ac 100755 --- a/FusionIIIT/applications/scholarships/admin.py +++ b/FusionIIIT/applications/scholarships/admin.py @@ -2,14 +2,15 @@ # Register your models here. from .models import (Award_and_scholarship, Director_gold, Director_silver, - Mcm, Notional_prize, Previous_winner, Proficiency_dm, + Mcm, Notional_prize, Previous_winner, DM_Proficiency_gold, IIITDM_Proficiency, Release,Notification,Application) admin.site.register(Mcm), admin.site.register(Award_and_scholarship), admin.site.register(Previous_winner), admin.site.register(Release), -admin.site.register(Proficiency_dm), +admin.site.register(DM_Proficiency_gold), +admin.site.register(IIITDM_Proficiency), admin.site.register(Director_silver), admin.site.register(Director_gold), admin.site.register(Notional_prize), diff --git a/FusionIIIT/applications/scholarships/migrations/0002_auto_20230411_0848.py b/FusionIIIT/applications/scholarships/migrations/0002_auto_20230411_0848.py new file mode 100644 index 000000000..18df5c4a0 --- /dev/null +++ b/FusionIIIT/applications/scholarships/migrations/0002_auto_20230411_0848.py @@ -0,0 +1,534 @@ +# Generated by Django 3.1.5 on 2023-04-11 08:48 + +import datetime +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('academic_information', '0003_auto_20230406_1845'), + ('scholarships', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='DM_Proficiency_gold', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('status', models.CharField(choices=[('Complete', 'COMPLETE'), ('Incomplete', 'INCOMPLETE'), ('Reject', 'REJECT'), ('Accept', 'ACCEPT')], default='INCOMPLETE', max_length=10)), + ('date', models.DateField(default=datetime.date.today)), + ('brief_description_project', models.TextField(max_length=1000, null=True)), + ('project_grade', models.TextField(max_length=1000, null=True)), + ('cross_disciplinary', models.TextField(max_length=1000, null=True)), + ('project_cross_disciplinary', models.TextField(max_length=1000, null=True)), + ('project_cross_disciplinary_doc', models.FileField(blank=True, null=True, upload_to='')), + ('project_publication', models.TextField(max_length=1000, null=True)), + ('project_type', models.TextField(max_length=1000, null=True)), + ('patent_ipr_project', models.TextField(max_length=1000, null=True)), + ('prototype_available', models.TextField(max_length=1000, null=True)), + ('team_members_name', models.TextField(max_length=1000, null=True)), + ('team_members_cpi', models.TextField(max_length=1000, null=True)), + ('project_evaluation_prototype', models.TextField(max_length=1000, null=True)), + ('project_evaluation_prototype_doc', models.FileField(blank=True, null=True, upload_to='')), + ('project_utility', models.TextField(max_length=1000, null=True)), + ('project_utility_doc', models.FileField(blank=True, null=True, upload_to='')), + ('sports_cultural_doc', models.FileField(blank=True, null=True, upload_to='')), + ('sports_cultural', models.TextField(max_length=1000, null=True)), + ('sci', models.TextField(max_length=1000, null=True)), + ('sci_doc', models.FileField(blank=True, null=True, upload_to='')), + ('esci', models.TextField(max_length=1000, null=True)), + ('esci_doc', models.FileField(blank=True, null=True, upload_to='')), + ('scie', models.TextField(max_length=1000, null=True)), + ('scie_doc', models.FileField(blank=True, null=True, upload_to='')), + ('ij', models.TextField(max_length=1000, null=True)), + ('ij_doc', models.FileField(blank=True, null=True, upload_to='')), + ('ic', models.TextField(max_length=1000, null=True)), + ('ic_doc', models.FileField(blank=True, null=True, upload_to='')), + ('nc', models.TextField(max_length=1000, null=True)), + ('nc_doc', models.FileField(blank=True, null=True, upload_to='')), + ('workshop', models.TextField(max_length=1000, null=True)), + ('workshop_doc', models.FileField(blank=True, null=True, upload_to='')), + ('award_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='scholarships.award_and_scholarship')), + ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), + ], + options={ + 'db_table': 'DM_Proficiency_gold', + }, + ), + migrations.CreateModel( + name='IIITDM_Proficiency', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('status', models.CharField(choices=[('Complete', 'COMPLETE'), ('Incomplete', 'INCOMPLETE'), ('Reject', 'REJECT'), ('Accept', 'ACCEPT')], default='INCOMPLETE', max_length=10)), + ('date', models.DateField(default=datetime.date.today)), + ('project_objectives', models.TextField(max_length=1000, null=True)), + ('project_mentor', models.TextField(max_length=1000, null=True)), + ('project_outcome', models.TextField(max_length=1000, null=True)), + ('project_publications', models.TextField(max_length=1000, null=True)), + ('research_Or_Patent_Detail', models.TextField(max_length=1000, null=True)), + ('project_Beneficial', models.TextField(max_length=1000, null=True)), + ('improvement_Done', models.TextField(max_length=1000, null=True)), + ('project_report', models.FileField(blank=True, null=True, upload_to='')), + ('project_title', models.TextField(max_length=1000, null=True)), + ('project_abstract', models.TextField(max_length=1000, null=True)), + ('sci', models.TextField(max_length=1000, null=True)), + ('sci_doc', models.FileField(blank=True, null=True, upload_to='')), + ('esci', models.TextField(max_length=1000, null=True)), + ('esci_doc', models.FileField(blank=True, null=True, upload_to='')), + ('scie', models.TextField(max_length=1000, null=True)), + ('scie_doc', models.FileField(blank=True, null=True, upload_to='')), + ('ij', models.TextField(max_length=1000, null=True)), + ('ij_doc', models.FileField(blank=True, null=True, upload_to='')), + ('ic', models.TextField(max_length=1000, null=True)), + ('ic_doc', models.FileField(blank=True, null=True, upload_to='')), + ('nc', models.TextField(max_length=1000, null=True)), + ('nc_doc', models.FileField(blank=True, null=True, upload_to='')), + ('indian_national_Conference', models.TextField(max_length=1000, null=True)), + ('indian_national_Conference_doc', models.FileField(blank=True, null=True, upload_to='')), + ('international_Conference', models.TextField(max_length=1000, null=True)), + ('international_Conference_doc', models.FileField(blank=True, null=True, upload_to='')), + ('project_grade', models.TextField(max_length=1000, null=True)), + ('patent_Status', models.TextField(max_length=1000, null=True)), + ('interdisciplinary_Criteria', models.TextField(max_length=1000, null=True)), + ('awards_Recieved_Workshop', models.TextField(max_length=1000, null=True)), + ('placement_Status', models.TextField(max_length=1000, null=True)), + ('workshop', models.TextField(max_length=1000, null=True)), + ('workshop_doc', models.TextField(max_length=1000, null=True)), + ('prototype', models.TextField(max_length=1000, null=True)), + ('prototype_doc', models.FileField(blank=True, null=True, upload_to='')), + ('utility', models.TextField(max_length=1000, null=True)), + ('utility_doc', models.FileField(blank=True, null=True, upload_to='')), + ('core_Area', models.TextField(max_length=1000, null=True)), + ('core_Area_doc', models.FileField(blank=True, null=True, upload_to='')), + ('technology_Transfer', models.TextField(max_length=1000, null=True)), + ('technology_Transfer_doc', models.FileField(blank=True, null=True, upload_to='')), + ('project_write_up', models.TextField(max_length=1000, null=True)), + ('award_id', models.ForeignKey(default=4, on_delete=django.db.models.deletion.CASCADE, to='scholarships.award_and_scholarship')), + ('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='academic_information.student')), + ], + options={ + 'db_table': 'IIITDM_Proficiency', + }, + ), + migrations.RemoveField( + model_name='director_gold', + name='academic_achievements', + ), + migrations.RemoveField( + model_name='director_gold', + name='correspondence_address', + ), + migrations.RemoveField( + model_name='director_gold', + name='cultural_inside', + ), + migrations.RemoveField( + model_name='director_gold', + name='cultural_outside', + ), + migrations.RemoveField( + model_name='director_gold', + name='games_inside', + ), + migrations.RemoveField( + model_name='director_gold', + name='games_outside', + ), + migrations.RemoveField( + model_name='director_gold', + name='grand_total', + ), + migrations.RemoveField( + model_name='director_gold', + name='justification', + ), + migrations.RemoveField( + model_name='director_gold', + name='nearest_policestation', + ), + migrations.RemoveField( + model_name='director_gold', + name='nearest_railwaystation', + ), + migrations.RemoveField( + model_name='director_gold', + name='other_activities', + ), + migrations.RemoveField( + model_name='director_gold', + name='relevant_document', + ), + migrations.RemoveField( + model_name='director_gold', + name='science_inside', + ), + migrations.RemoveField( + model_name='director_gold', + name='science_outside', + ), + migrations.RemoveField( + model_name='director_silver', + name='award_type', + ), + migrations.RemoveField( + model_name='director_silver', + name='correspondence_address', + ), + migrations.RemoveField( + model_name='director_silver', + name='financial_assistance', + ), + migrations.RemoveField( + model_name='director_silver', + name='grand_total', + ), + migrations.RemoveField( + model_name='director_silver', + name='inside_achievements', + ), + migrations.RemoveField( + model_name='director_silver', + name='justification', + ), + migrations.RemoveField( + model_name='director_silver', + name='nearest_policestation', + ), + migrations.RemoveField( + model_name='director_silver', + name='nearest_railwaystation', + ), + migrations.RemoveField( + model_name='director_silver', + name='outside_achievements', + ), + migrations.RemoveField( + model_name='director_silver', + name='relevant_document', + ), + migrations.AddField( + model_name='director_gold', + name='academic', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_gold', + name='academic_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='blood_donation', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='corporate_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='counselling_activities_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='cultural', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_gold', + name='cultural_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='disciplinary_action', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_gold', + name='financial_assistance_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='games', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_gold', + name='games_doc', + field=models.TextField(blank=True, null=True), + ), + migrations.AddField( + model_name='director_gold', + name='gymkhana_activities_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='hall_activities_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='ic', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_gold', + name='ic_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='ij', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_gold', + name='ij_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='institute_activities_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='jagriti', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='nc', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_gold', + name='nc_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='novelty', + field=models.TextField(max_length=200, null=True), + ), + migrations.AddField( + model_name='director_gold', + name='other_extra_curricular_activities', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='sci', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_gold', + name='sci_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='scie', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_gold', + name='scie_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='science', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_gold', + name='science_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='social_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='warning_letter', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_gold', + name='workshop', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_gold', + name='workshop_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='cultural_club_co_coordinator', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_silver', + name='cultural_club_co_coordinator_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='cultural_club_coordinator', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_silver', + name='cultural_club_coordinator_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='cultural_event_member', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_silver', + name='cultural_event_member_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='cultural_interIIIT_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='cultural_interIIIT_certificates_no', + field=models.IntegerField(blank=True, null=True), + ), + migrations.AddField( + model_name='director_silver', + name='cultural_interIIIT_team_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='cultural_interIIIT_team_certificates_no', + field=models.IntegerField(blank=True, null=True), + ), + migrations.AddField( + model_name='director_silver', + name='cultural_intercollege_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='cultural_intercollege_certificates_no', + field=models.IntegerField(blank=True, null=True), + ), + migrations.AddField( + model_name='director_silver', + name='cultural_intercollege_team_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='cultural_intercollege_team_certificates_no', + field=models.IntegerField(blank=True, null=True), + ), + migrations.AddField( + model_name='director_silver', + name='cultural_intercollege_team_event', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_silver', + name='culturalfest_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='culturalfest_certificates_no', + field=models.IntegerField(blank=True, null=True), + ), + migrations.AddField( + model_name='director_silver', + name='sports_club_co_coordinator', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_silver', + name='sports_club_co_coordinator_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='sports_club_coordinator', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_silver', + name='sports_club_coordinator_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='sports_event_member', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_silver', + name='sports_event_member_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='sports_interIIIT_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='sports_interIIIT_team_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='sports_intercollege_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='sports_intercollege_team_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='sports_other_accomplishment', + field=models.TextField(max_length=1000, null=True), + ), + migrations.AddField( + model_name='director_silver', + name='sports_other_accomplishment_doc', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='sportsfest_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.AddField( + model_name='director_silver', + name='sportsfest_team_certificate', + field=models.FileField(blank=True, null=True, upload_to=''), + ), + migrations.DeleteModel( + name='Proficiency_dm', + ), + ] diff --git a/FusionIIIT/applications/scholarships/models.py b/FusionIIIT/applications/scholarships/models.py old mode 100755 new mode 100644 index 9f81e976e..662acb330 --- a/FusionIIIT/applications/scholarships/models.py +++ b/FusionIIIT/applications/scholarships/models.py @@ -11,8 +11,7 @@ class Constants: ('Complete', 'COMPLETE'), ('Incomplete', 'INCOMPLETE'), ('Reject', 'REJECT'), - ('Accept', 'ACCEPT') - + ('Accept', 'ACCEPT'), ) TIME = ( ('0', '12 Midnight'), @@ -39,7 +38,7 @@ class Constants: ('9pm', '21'), ('10pm', '22'), ('11pm', '23'), - ('12 Midnight', '0') + ('12 Midnight', '0'), ) BATCH = ( ('UG1', 'UG1'), @@ -47,7 +46,7 @@ class Constants: ('UG3', 'UG3'), ('UG4', 'UG4'), ('PG1', 'PG1'), - ('PG2', 'PG2') + ('PG2', 'PG2'), ) FATHER_OCC_CHOICE = ( ('government', 'Government'), @@ -56,7 +55,7 @@ class Constants: ('business', 'Business'), ('medical', 'Medical'), ('consultant', 'Consultant'), - ('pensioners', 'Pensioners') + ('pensioners', 'Pensioners'), ) MOTHER_OCC_CHOICES = ( ('EMPLOYED', 'EMPLOYED'), @@ -67,6 +66,19 @@ class Constants: ('OWNED', 'OWNED') ) + PROGRAMME_CHOICES = ( + ('B', 'UNDER_GRAD'), + ('P', 'POST_GRAD_PHD'), + ('M', 'POST_GRAD_MASTER') + ) + + DISCIPLINE_CHOICES = ( + ('C', 'CSE'), + ('E', 'ECE'), + ('M', 'ME'), + ('D', 'DES') + ) + class Award_and_scholarship(models.Model): award_name = models.CharField(max_length=100, default='') @@ -117,7 +129,6 @@ class Mcm(models.Model): date = models.DateField(default=datetime.date.today) award_id = models.ForeignKey(Award_and_scholarship, default=4, on_delete=models.CASCADE) - class Meta: db_table = 'Mcm' @@ -131,14 +142,14 @@ class Notional_prize(models.Model): year = models.CharField(max_length=10, choices=Constants.BATCH) award_id = models.ForeignKey(Award_and_scholarship, default=4, on_delete=models.CASCADE) - class Meta: db_table = 'Notional_prize' -#Addition: a column programme added + +# Addition: a column programme added class Previous_winner(models.Model): student = models.ForeignKey(Student, on_delete=models.CASCADE) - programme = models.CharField(max_length=10,default='B.Tech') + programme = models.CharField(max_length=10, default='B.Tech') year = models.IntegerField(default=datetime.datetime.now().year) award_id = models.ForeignKey(Award_and_scholarship, on_delete=models.CASCADE) @@ -148,36 +159,39 @@ class Meta: class Release(models.Model): date_time = models.DateTimeField(default=datetime.datetime.now, blank=True) - programme = models.CharField(max_length=10,default='B.Tech') + programme = models.CharField(max_length=10, default='B.Tech') startdate = models.DateField(default=datetime.date.today) enddate = models.DateField() - award = models.CharField(default='',max_length=50) - remarks = models.TextField(max_length=500,default='') + award = models.CharField(default='', max_length=50) + remarks = models.TextField(max_length=500, default='') batch = models.TextField(default='all') notif_visible = models.IntegerField(default=1) class Meta: db_table = 'Release' + # new class added for keeping track of notifications and applied application by students class Notification(models.Model): - release_id = models.ForeignKey(Release,default=None, on_delete=models.CASCADE) - student_id = models.ForeignKey(Student, on_delete = models.CASCADE) + release_id = models.ForeignKey(Release, default=None, on_delete=models.CASCADE) + student_id = models.ForeignKey(Student, on_delete=models.CASCADE) notification_mcm_flag = models.BooleanField(default=False) notification_convocation_flag = models.BooleanField(default=False) invite_mcm_accept_flag = models.BooleanField(default=False) invite_convocation_accept_flag = models.BooleanField(default=False) + def __str__(self): return str(self.student_id) class Meta: db_table = 'Notification' + class Application(models.Model): - application_id = models.CharField(max_length = 100, primary_key=True) - student_id = models.ForeignKey(ExtraInfo, on_delete = models.CASCADE) + application_id = models.CharField(max_length=100, primary_key=True) + student_id = models.ForeignKey(ExtraInfo, on_delete=models.CASCADE) applied_flag = models.BooleanField(default=False) - award = models.CharField(max_length = 30) + award = models.CharField(max_length=30) def __str__(self): return str(self.application_id) @@ -185,98 +199,208 @@ def __str__(self): class Meta: db_table = 'Application' + class Director_silver(models.Model): - nearest_policestation = models.TextField(max_length=30, default='station') - nearest_railwaystation = models.TextField(max_length=30, default='station') - correspondence_address = models.TextField(max_length=150, null=True) student = models.ForeignKey(Student, on_delete=models.CASCADE) award_id = models.ForeignKey(Award_and_scholarship, on_delete=models.CASCADE) - award_type = models.CharField(max_length=50, null=True) - status = models.CharField(max_length=10, choices=Constants.STATUS_CHOICES,default='INCOMPLETE') - relevant_document = models.FileField(null=True, blank=True) + status = models.CharField(max_length=10, choices=Constants.STATUS_CHOICES, default='INCOMPLETE') date = models.DateField(default=datetime.date.today) - financial_assistance = models.TextField(max_length=1000 ,null=True) - grand_total = models.IntegerField(null=True) - inside_achievements = models.TextField(max_length=1000, null=True) - justification = models.TextField(max_length=1000, null=True) - outside_achievements = models.TextField(max_length=1000, null=True) - + cultural_intercollege_certificate = models.FileField(blank=True, null=True) + cultural_intercollege_certificates_no = models.IntegerField(blank=True, null=True) + cultural_intercollege_team_event = models.TextField(max_length=1000, null=True) + cultural_intercollege_team_certificate = models.FileField(null=True, blank=True) + cultural_intercollege_team_certificates_no = models.IntegerField( + blank=True, null=True + ) + culturalfest_certificate = models.FileField(null=True, blank=True) + culturalfest_certificates_no = models.IntegerField(blank=True, null=True) + cultural_club_coordinator = models.TextField(max_length=1000, null=True) + cultural_club_coordinator_certificate = models.FileField(null=True, blank=True) + cultural_club_co_coordinator = models.TextField(max_length=1000, null=True) + cultural_club_co_coordinator_certificate = models.FileField(null=True, blank=True) + cultural_event_member = models.TextField(max_length=1000, null=True) + cultural_event_member_certificate = models.FileField(null=True, blank=True) + cultural_interIIIT_certificates_no = models.IntegerField(blank=True, null=True) + cultural_interIIIT_team_certificate = models.FileField(null=True, blank=True) + cultural_interIIIT_certificate = models.FileField(blank=True, null=True) + cultural_interIIIT_team_certificates_no = models.IntegerField(blank=True, null=True) + sports_intercollege_certificate = models.FileField(blank=True, null=True) + sports_intercollege_team_certificate = models.FileField(null=True, blank=True) + sportsfest_certificate = models.FileField(null=True, blank=True) + sportsfest_team_certificate = models.FileField(null=True, blank=True) + sports_club_coordinator = models.TextField(max_length=1000, null=True) + sports_club_coordinator_certificate = models.FileField(null=True, blank=True) + sports_club_co_coordinator = models.TextField(max_length=1000, null=True) + sports_club_co_coordinator_certificate = models.FileField(null=True, blank=True) + sports_event_member = models.TextField(max_length=1000, null=True) + sports_event_member_certificate = models.FileField(null=True, blank=True) + sports_interIIIT_team_certificate = models.FileField(null=True, blank=True) + sports_interIIIT_certificate = models.FileField(blank=True, null=True) + sports_other_accomplishment = models.TextField(max_length=1000, null=True) + sports_other_accomplishment_doc = models.FileField(null=True, blank=True) class Meta: db_table = 'Director_silver' -class Proficiency_dm(models.Model): - relevant_document = models.FileField(null=True, blank=True) - title_name = models.CharField(max_length=30, null=True) +class DM_Proficiency_gold(models.Model): student = models.ForeignKey(Student, on_delete=models.CASCADE) award_id = models.ForeignKey(Award_and_scholarship, on_delete=models.CASCADE) - award_type = models.CharField(max_length=50, null=True) - status = models.CharField(max_length=10, choices=Constants.STATUS_CHOICES,default='INCOMPLETE') - nearest_policestation = models.TextField(max_length=30, default='station') - nearest_railwaystation = models.TextField(max_length=30, default='station') - correspondence_address = models.TextField(max_length=150, null=True) - no_of_students = models.IntegerField(default=1) + status = models.CharField( + max_length=10, choices=Constants.STATUS_CHOICES, default='INCOMPLETE' + ) date = models.DateField(default=datetime.date.today) - roll_no1 = models.IntegerField(default=0) - roll_no2 = models.IntegerField(default=0) - roll_no3 = models.IntegerField(default=0) - roll_no4 = models.IntegerField(default=0) - roll_no5 = models.IntegerField(default=0) - financial_assistance = models.TextField(max_length=1000 ,null=True) - brief_description = models.TextField(max_length=1000 ,null=True) - justification = models.TextField(max_length=1000 ,null=True) - grand_total = models.IntegerField(null=True) - ece_topic = models.CharField(max_length=25,null=True) - cse_topic = models.CharField(max_length=25,null=True) - mech_topic = models.CharField(max_length=25,null=True) - design_topic = models.CharField(max_length=25,null=True) - ece_percentage = models.IntegerField(null=True) - cse_percentage = models.IntegerField(null=True) - mech_percentage = models.IntegerField(null=True) - design_percentage = models.IntegerField(null=True) - correspondence_address = models.CharField(max_length=100, null=True) - financial_assistance = models.TextField(max_length=1000, null=True) - grand_total = models.IntegerField(null=True) - nearest_policestation = models.CharField(max_length=25, null=True) - nearest_railwaystation = models.CharField(max_length=25, null=True) - + brief_description_project = models.TextField(max_length=1000, null=True) + project_grade = models.TextField(max_length=1000, null=True) + cross_disciplinary = models.TextField(max_length=1000, null=True) + project_cross_disciplinary = models.TextField(max_length=1000, null=True) + project_cross_disciplinary_doc = models.FileField(null=True, blank=True) + project_publication = models.TextField(max_length=1000, null=True) + project_type = models.TextField(max_length=1000, null=True) + patent_ipr_project = models.TextField(max_length=1000, null=True) + prototype_available = models.TextField(max_length=1000, null=True) + team_members_name = models.TextField(max_length=1000, null=True) + team_members_cpi = models.TextField(max_length=1000, null=True) + project_evaluation_prototype = models.TextField(max_length=1000, null=True) + project_evaluation_prototype_doc = models.FileField(null=True, blank=True) + project_utility = models.TextField(max_length=1000, null=True) + project_utility_doc = models.FileField(null=True, blank=True) + sports_cultural_doc = models.FileField(null=True, blank=True) + sports_cultural = models.TextField(max_length=1000, null=True) + sci = models.TextField(max_length=1000, null=True) # new attribute added + sci_doc = models.FileField(null=True, blank=True) # new attribute added + esci = models.TextField(max_length=1000, null=True) # new attribute added + esci_doc = models.FileField(null=True, blank=True) # new attribute added + scie = models.TextField(max_length=1000, null=True) # new attribute added + scie_doc = models.FileField(null=True, blank=True) # new attribute added + ij = models.TextField(max_length=1000, null=True) # new attribute added + ij_doc = models.FileField(null=True, blank=True) # new attribute added + ic = models.TextField(max_length=1000, null=True) # new attribute added + ic_doc = models.FileField(null=True, blank=True) # new attribute added + nc = models.TextField(max_length=1000, null=True) # new attribute added + nc_doc = models.FileField(null=True, blank=True) # new attribute added + workshop = models.TextField(max_length=1000, null=True) # new attribute added + workshop_doc = models.FileField(null=True, blank=True) # new attribute added class Meta: - db_table = 'Proficiency_dm' + db_table = 'DM_Proficiency_gold' class Director_gold(models.Model): student = models.ForeignKey(Student, on_delete=models.CASCADE) - status = models.CharField(max_length=10,choices=Constants.STATUS_CHOICES, default='INCOMPLETE') - correspondence_address = models.TextField(max_length=40, default='address') - nearest_policestation = models.TextField(max_length=30, default='station') - nearest_railwaystation = models.TextField(max_length=30, default='station') - relevant_document = models.FileField(null=True, blank=True) + status = models.CharField( + max_length=10, choices=Constants.STATUS_CHOICES, default='INCOMPLETE' + ) date = models.DateField(default=datetime.date.today) - award_id = models.ForeignKey(Award_and_scholarship, default=4, on_delete=models.CASCADE) - financial_assistance = models.TextField(max_length=1000 ,null=True) - academic_achievements = models.TextField(max_length=1000 ,null=True) - science_inside = models.TextField(max_length=1000 ,null=True) - science_outside = models.TextField(max_length=1000 ,null=True) - games_inside = models.TextField(max_length=1000 ,null=True) - games_outside = models.TextField(max_length=1000 ,null=True) - cultural_inside = models.TextField(max_length=1000 ,null=True) - cultural_outside = models.TextField(max_length=1000 ,null=True) - social = models.TextField(max_length=1000 ,null=True) - corporate = models.TextField(max_length=1000 ,null=True) - hall_activities = models.TextField(max_length=1000 ,null=True) - gymkhana_activities = models.TextField(max_length=1000 ,null=True) - institute_activities = models.TextField(max_length=1000 ,null=True) - counselling_activities = models.TextField(max_length=1000 ,null=True) - other_activities = models.TextField(max_length=1000 ,null=True) - justification = models.TextField(max_length=1000 ,null=True) - grand_total = models.IntegerField(null=True) - correspondence_address = models.CharField(max_length=100, null=True) + award_id = models.ForeignKey( + Award_and_scholarship, default=4, on_delete=models.CASCADE + ) financial_assistance = models.TextField(max_length=1000, null=True) - grand_total = models.IntegerField(null=True) - nearest_policestation = models.CharField(max_length=25, null=True) - nearest_railwaystation = models.CharField(max_length=25, null=True) + financial_assistance_doc = models.FileField(null=True, blank=True) + academic = models.TextField(max_length=1000, null=True) + academic_doc = models.FileField(null=True, blank=True) + science = models.TextField(max_length=1000, null=True) + science_doc = models.FileField(null=True, blank=True) + games = models.TextField(max_length=1000, null=True) + games_doc = models.TextField(null=True, blank=True) + cultural = models.TextField(max_length=1000, null=True) + cultural_doc = models.FileField(null=True, blank=True) + social = models.TextField(max_length=1000, null=True) + social_doc = models.FileField(null=True, blank=True) + corporate = models.TextField(max_length=1000, null=True) + corporate_doc = models.FileField(null=True, blank=True) + hall_activities = models.TextField(max_length=1000, null=True) + hall_activities_doc = models.FileField(null=True, blank=True) + gymkhana_activities = models.TextField(max_length=1000, null=True) + gymkhana_activities_doc = models.FileField(null=True, blank=True) + institute_activities = models.TextField(max_length=1000, null=True) + institute_activities_doc = models.FileField(null=True, blank=True) + counselling_activities = models.TextField(max_length=1000, null=True) + counselling_activities_doc = models.FileField(null=True, blank=True) + sci = models.TextField(max_length=1000, null=True) # new attribute added for PG + sci_doc = models.FileField(null=True, blank=True) # new attribute added for PG + scie = models.TextField(max_length=1000, null=True) # new attribute added for PG + scie_doc = models.FileField(null=True, blank=True) # new attribute added for PG + ij = models.TextField(max_length=1000, null=True) # new attribute added for PG + ij_doc = models.FileField(null=True, blank=True) # new attribute added for PG + ic = models.TextField(max_length=1000, null=True) # new attribute added for PG + ic_doc = models.FileField(null=True, blank=True) # new attribute added for PG + nc = models.TextField(max_length=1000, null=True) # new attribute added for PG + nc_doc = models.FileField(null=True, blank=True) # new attribute added for PG + workshop = models.TextField( + max_length=1000, null=True + ) # new attribute added for PG + workshop_doc = models.FileField(null=True, blank=True) # new attribute added for PG + novelty = models.TextField(max_length=200, null=True) # new attribute added for PG + warning_letter = models.FileField( + null=True, blank=True + ) # new attribute added for PG + disciplinary_action = models.TextField( + max_length=1000, null=True + ) # new attribute added + other_extra_curricular_activities = models.FileField(null=True, blank=True) + jagriti = models.FileField(null=True, blank=True) # new attribute added + blood_donation = models.FileField(null=True, blank=True) # new attribute added class Meta: db_table = 'Director_gold' + + +class IIITDM_Proficiency(models.Model): + student = models.ForeignKey(Student, on_delete=models.CASCADE) + status = models.CharField( + max_length=10, choices=Constants.STATUS_CHOICES, default='INCOMPLETE' + ) + date = models.DateField(default=datetime.date.today) + award_id = models.ForeignKey( + Award_and_scholarship, default=4, on_delete=models.CASCADE + ) + project_objectives = models.TextField(max_length=1000, null=True) + project_mentor = models.TextField(max_length=1000, null=True) + project_outcome = models.TextField(max_length=1000, null=True) + project_publications = models.TextField(max_length=1000, null=True) + research_Or_Patent_Detail = models.TextField(max_length=1000, null=True) + project_Beneficial = models.TextField(max_length=1000, null=True) + improvement_Done = models.TextField(max_length=1000, null=True) + project_report = models.FileField(null=True, blank=True) + project_title = models.TextField(max_length=1000, null=True) + project_abstract = models.TextField(max_length=1000, null=True) + sci = models.TextField(max_length=1000, null=True) # new attribute added for PG + sci_doc = models.FileField(null=True, blank=True) # new attribute added for PG + esci = models.TextField(max_length=1000, null=True) # new attribute added for PG + esci_doc = models.FileField(null=True, blank=True) # new attribute added for PG + scie = models.TextField(max_length=1000, null=True) # new attribute added for PG + scie_doc = models.FileField(null=True, blank=True) # new attribute added for PG + ij = models.TextField(max_length=1000, null=True) # new attribute added for PG + ij_doc = models.FileField(null=True, blank=True) # new attribute added for PG + ic = models.TextField(max_length=1000, null=True) # new attribute added for PG + ic_doc = models.FileField(null=True, blank=True) # new attribute added for PG + nc = models.TextField(max_length=1000, null=True) # new attribute added for PG + nc_doc = models.FileField(null=True, blank=True) # new attribute added for PG + indian_national_Conference = models.TextField(max_length=1000, null=True) + indian_national_Conference_doc = models.FileField(null=True, blank=True) + international_Conference = models.TextField(max_length=1000, null=True) + international_Conference_doc = models.FileField(null=True, blank=True) + project_grade = models.TextField(max_length=1000, null=True) + patent_Status = models.TextField( + max_length=1000, null=True + ) # new attribute added for PG + interdisciplinary_Criteria = models.TextField( + max_length=1000, null=True + ) # new attribute added for PG + awards_Recieved_Workshop = models.TextField(max_length=1000, null=True) + placement_Status = models.TextField(max_length=1000, null=True) + workshop = models.TextField(max_length=1000, null=True) + workshop_doc = models.TextField(max_length=1000, null=True) + prototype = models.TextField(max_length=1000, null=True) + prototype_doc = models.FileField(null=True, blank=True) + utility = models.TextField(max_length=1000, null=True) + utility_doc = models.FileField(null=True, blank=True) + core_Area = models.TextField(max_length=1000, null=True) + core_Area_doc = models.FileField(null=True, blank=True) + technology_Transfer = models.TextField(max_length=1000, null=True) + technology_Transfer_doc = models.FileField(null=True, blank=True) + project_write_up = models.TextField(max_length=1000, null=True) + + class Meta: + db_table = 'IIITDM_Proficiency' diff --git a/FusionIIIT/applications/scholarships/validations.py b/FusionIIIT/applications/scholarships/validations.py index 18cb37b19..e02ed6656 100644 --- a/FusionIIIT/applications/scholarships/validations.py +++ b/FusionIIIT/applications/scholarships/validations.py @@ -1,34 +1,4 @@ - -MCM_schema={ - "brother_name" : {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, - "brother_occupation" : {"anuOf": [{"type": "string", "maxLength": 100}, {"type": "null"}]}, - "sister_name" : {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, - "sister_occupation" : {"anuOf": [{"type": "string", "maxLength": 100}, {"type": "null"}]}, - "income_father" : {"type": "number"}, - "income_mother" : {"type": "number"}, - "income_other" : {"type": "number"}, - "father_occ" : {"type": "string", "maxLength": 10}, - "mother_occ" : {"type": "string", "maxLength": 10}, - "father_occ_desc" : {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, - "mother_occ_desc" : {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, - "four_wheeler" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "four_wheeler_desc" : {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, - "two_wheeler" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "two_wheeler_desc" : {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, - "house" : {"anuOf": [{"type": "string", "maxLength": 10}, {"type": "null"}]}, - "plot_area" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "constructed_area" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "school_fee" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "school_name" : {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, - "bank_name" : {"anuOf": [{"type": "string", "maxLength": 100}, {"type": "null"}]}, - "loan_amount" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "college_fee" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "college_name" : {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, - "status" : {"anuOf": [{"type": "string", "maxLength": 10}, {"type": "null"}]}, - "annual_income" : {"anuOf": [{"type": "number"}, {"type": "null"}]} -} - -MCM_list = [ +Mcm_list = [ "brother_name", "brother_occupation", "sister_name", @@ -56,121 +26,311 @@ "annual_income", ] -gold_list=[ - "academic_achievements", - "science_inside", - "science_outside", - "games_inside", - "games_outside", - "cultural_inside", - "cultural_outside", +Mcm_schema = { + "brother_name": {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, + "brother_occupation": { + "anuOf": [{"type": "string", "maxLength": 100}, {"type": "null"}] + }, + "sister_name": {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, + "sister_occupation": { + "anuOf": [{"type": "string", "maxLength": 100}, {"type": "null"}] + }, + "income_father": {"type": "number"}, + "income_mother": {"type": "number"}, + "income_other": {"type": "number"}, + "father_occ": {"type": "string", "maxLength": 10}, + "mother_occ": {"type": "string", "maxLength": 10}, + "father_occ_desc": { + "anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}] + }, + "mother_occ_desc": { + "anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}] + }, + "four_wheeler": {"anuOf": [{"type": "number"}, {"type": "null"}]}, + "four_wheeler_desc": { + "anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}] + }, + "two_wheeler": {"anuOf": [{"type": "number"}, {"type": "null"}]}, + "two_wheeler_desc": { + "anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}] + }, + "house": {"anuOf": [{"type": "string", "maxLength": 10}, {"type": "null"}]}, + "plot_area": {"anuOf": [{"type": "number"}, {"type": "null"}]}, + "constructed_area": {"anuOf": [{"type": "number"}, {"type": "null"}]}, + "school_fee": {"anuOf": [{"type": "number"}, {"type": "null"}]}, + "school_name": {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, + "bank_name": {"anuOf": [{"type": "string", "maxLength": 100}, {"type": "null"}]}, + "loan_amount": {"anuOf": [{"type": "number"}, {"type": "null"}]}, + "college_fee": {"anuOf": [{"type": "number"}, {"type": "null"}]}, + "college_name": {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, + "status": {"anuOf": [{"type": "string", "maxLength": 10}, {"type": "null"}]}, + "annual_income": {"anuOf": [{"type": "number"}, {"type": "null"}]}, +} + +Director_gold_list = [ + "award_id", + "financial_assistance", + "academic", + "science", + "games", + "cultural", "social", "corporate", "hall_activities", "gymkhana_activities", "institute_activities", "counselling_activities", - "other_activities", - "justification", - "correspondence_address", - "financial_assistance", - "grand_total", - "nearest_policestation", - "nearest_railwaystation" + "other_extra_curricular_activities", + "sci", + "scie", + "ij", + "ic", + "nc", + "workshop", + "novelty", + "disciplinary_action", ] -gold_schema={ - "academic_achievements" : {"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "science_inside" : {"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "science_outside" : {"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "games_inside" : {"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "games_outside" : {"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "cultural_inside" : {"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "cultural_outside" :{"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "social" :{"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "corporate" :{"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "hall_activities" :{"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "gymkhana_activities" :{"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "institute_activities" :{"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "counselling_activities" :{"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "other_activities" :{"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "justification" :{"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "grand_total" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "correspondence_address" : {"anuOf": [{"type": "string", "maxLength": 100}, {"type": "null"}]}, - "financial_assistance" : {"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "grand_total" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "nearest_policestation" : {"anuOf": [{"type": "string", "maxLength": 25}, {"type": "null"}]}, - "nearest_railwaystation" : {"anuOf": [{"type": "string", "maxLength": 25}, {"type": "null"}]} +Director_gold_schema = { + "award_id": {"anuof": [{"type": "string", "maxLength": 100}, {"type": ""}]}, + "financial_assistance": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "academic": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "science": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "games": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "cultural": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "social": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "corporate": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "hall_activities": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "gymkhana_activities": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "institute_activities": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "counselling_activities": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "other_extra_curricular_activities": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "sci": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "scie": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "ij": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "ic": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "nc": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "workshop": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "novelty": {"anuof": [{"type": "string", "maxLength": 200}, {"type": "null"}]}, + "disciplinary_action": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, } -silver_schema={ - "nearest_policestation" : {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, - "nearest_railwaystation" : {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, - "correspondence_address" : {"anuOf": [{"type": "string", "maxLength": 150}, {"type": "null"}]}, - "financial_assistance" : {"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "grand_total" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "inside_achievements" : {"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "justification" : {"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "outside_achievements" : {"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]} -} +Director_silver_list = [ + "award_id", + "cultural_intercollege_certificates_no", + "cultural_intercollege_team_event", + "cultural_intercollege_team_certificates_no", + "culturalfest_certificates_no", + "cultural_club_coordinator", + "cultural_club_co_coordinator", + "cultural_event_member", + "cultural_interIIIT_certificates_no", + "cultural_interIIIT_team_certificates_no", + "sports_club_coordinator", + "sports_club_co_coordinator", + "sports_event_member", + "sports_other_accomplishment", +] + +Director_silver_schema = { + "award_id": {"anuof": [{"type": "string", "maxLength": 100}, {"type": ""}]}, + "cultural_intercollege_certificates_no": { + "anuOf": [{"type": "number"}, {"type": "null"}] + }, + "cultural_intercollege_team_event": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "cultural_intercollege_team_certificates_no": { + "anuOf": [{"type": "number"}, {"type": "null"}] + }, + "culturalfest_certificates_no": {"anuOf": [{"type": "number"}, {"type": "null"}]}, + "cultural_club_coordinator": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "cultural_club_co_coordinator": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "cultural_event_member": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "cultural_interIIIT_certificates_no": { + "anuOf": [{"type": "number"}, {"type": "null"}] + }, + "cultural_interIIIT_team_certificates_no": { + "anuOf": [{"type": "number"}, {"type": "null"}] + }, + "sports_club_coordinator": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "sports_club_co_coordinator": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "sports_event_member": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "sports_other_accomplishment": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, +} -silver_list=[ - "nearest_policestation", - "nearest_railwaystation", - "correspondence_address", - "financial_assistance", - "grand_total", - "inside_achievements", - "justification", - "outside_achievements", +DM_Proficiency_Gold_list = [ + "award_id", + "brief_description_project", + "project_grade", + "cross_disciplinary", + "project_publication", + "project_type", + "patent_ipr_project", + "prototype_available", + "team_members_name", + "team_members_cpi", + "project_evaluation_prototype", + "project_utility", + "sports_cultural", + "sci", + "esci", + "scie", + "ij", + "ic", + "nc", + "workshop", ] -proficiency_schema={ - "title_name" : {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, - "award_type" : {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, - "nearest_policestation" : {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, - "nearest_railwaystation" : {"anuOf": [{"type": "string", "maxLength": 30}, {"type": "null"}]}, - "correspondence_address" : {"anuOf": [{"type": "string", "maxLength": 150}, {"type": "null"}]}, - "financial_assistance" : {"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "brief_description" : {"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "justification" : {"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "grand_total" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "ece_topic" : {"anuOf": [{"type": "string", "maxLength": 25}, {"type": "null"}]}, - "cse_topic" : {"anuOf": [{"type": "string", "maxLength": 25}, {"type": "null"}]}, - "mech_topic" : {"anuOf": [{"type": "string", "maxLength": 25}, {"type": "null"}]}, - "design_topic" : {"anuOf": [{"type": "string", "maxLength": 25}, {"type": "null"}]}, - "ece_percentage" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "cse_percentage" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "mech_percentage" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "design_percentage" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "correspondence_address" : {"anuOf": [{"type": "string", "maxLength": 25}, {"type": "null"}]}, - "financial_assistance" : {"anuOf": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, - "grand_total" : {"anuOf": [{"type": "number"}, {"type": "null"}]}, - "nearest_policestation" : {"anuOf": [{"type": "string", "maxLength": 25}, {"type": "null"}]}, - "nearest_railwaystation" :{"anuOf": [{"type": "string", "maxLength": 25}, {"type": "null"}]}, +DM_Proficiency_Gold_schema = { + "award_id": {"anuof": [{"type": "string", "maxLength": 100}, {"type": ""}]}, + "brief_description_project": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "project_grade": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "cross_disciplinary": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "project_publication": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "project_type": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "patent_ipr_project": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "prototype_available": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "team_members_name": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "team_members_cpi": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "project_evaluation_prototype": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "project_utility": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "sports_cultural": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "sci": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "esci": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "scie": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "ij": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "ic": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "nc": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "workshop": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, +} + +IIITDM_Proficiency_list = [ + "project_objectives", + "project_mentor", + "project_outcome", + "research_Or_Patent_Detail", + "project_Beneficial", + "improvement_Done", + "sci", + "esci", + "scie", + "ij", + "ic", + "nc", + "indian_national_Conference", + "international_Conference", + "patent_Status", + "interdisciplinary_Criteria", + "awards_Recieved_Workshop", + "placement_Status", + "workshop", + "prototype", + "utility", + "core_Area", + "technology_Transfer", +] +IIITDM_Proficiency_schema = { + "project_objectives": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "project_mentor": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "project_outcome": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "research_Or_Patent_Detail": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "project_Beneficial": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "improvement_Done": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "sci": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "esci": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "scie": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "ij": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "ic": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "nc": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "indian_national_Conference": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "international_Conference": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "patent_Status": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "interdisciplinary_Criteria": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "awards_Recieved_Workshop": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "placement_Status": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, + "workshop": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "prototype": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "utility": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "core_Area": {"anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}]}, + "technology_Transfer": { + "anuof": [{"type": "string", "maxLength": 1000}, {"type": "null"}] + }, } -proficiency_list=[ - "title_name", - "award_type", - "nearest_policestation", - "nearest_railwaystation", - "correspondence_address", - "financial_assistance", - "brief_description", - "justification", - "grand_total", - "ece_topic", - "cse_topic", - "mech_topic", - "design_topic", - "ece_percentage", - "cse_percentage", - "mech_percentage", - "design_percentage", - "correspondence_address", - "financial_assistance", - "grand_total", - "nearest_policestation", - "nearest_railwaystation" -] \ No newline at end of file diff --git a/FusionIIIT/applications/scholarships/views.py b/FusionIIIT/applications/scholarships/views.py index 5f547149f..acbb821a3 100755 --- a/FusionIIIT/applications/scholarships/views.py +++ b/FusionIIIT/applications/scholarships/views.py @@ -6,85 +6,109 @@ from django.contrib import messages from django.contrib.auth.decorators import login_required from django.http import HttpResponse, HttpResponseRedirect + # Create your views here. from django.db.models import Q from django.shortcuts import render from django.contrib.auth.models import User from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from applications.academic_information.models import Spi, Student -from applications.globals.models import (Designation, ExtraInfo, - HoldsDesignation) - -from .models import (Award_and_scholarship, Constants, Director_gold, - Director_silver, Mcm, Notional_prize, Previous_winner, - Proficiency_dm, Release, Notification) +from applications.globals.models import Designation, ExtraInfo, HoldsDesignation + +from .models import ( + Award_and_scholarship, + Constants, + Director_gold, + Director_silver, + IIITDM_Proficiency, + Mcm, + Notional_prize, + Previous_winner, + DM_Proficiency_gold, + Release, + Notification, +) from notification.views import scholarship_portal_notif -from .validations import MCM_list, MCM_schema, gold_list, gold_schema, silver_list, silver_schema, proficiency_list,proficiency_schema +from .validations import ( + Mcm_list, + Mcm_schema, + Director_gold_list, + Director_gold_schema, + Director_silver_list, + Director_silver_schema, + DM_Proficiency_Gold_list, + DM_Proficiency_Gold_schema, + IIITDM_Proficiency_list, + IIITDM_Proficiency_schema, +) from jsonschema import validate from jsonschema.exceptions import ValidationError + # Create your views here. -@login_required(login_url='/accounts/login') +@login_required(login_url="/accounts/login") def spacs(request): - convener = Designation.objects.get(name='spacsconvenor') - assistant = Designation.objects.get(name='spacsassistant') + convener = Designation.objects.get(name="spacsconvenor") + assistant = Designation.objects.get(name="spacsassistant") hd_convener = HoldsDesignation.objects.filter( - user=request.user, designation=convener) + user=request.user, designation=convener + ) hd_assistant = HoldsDesignation.objects.filter( - user=request.user, designation=assistant) + user=request.user, designation=assistant + ) # Student either accepts or Declines the Award Notification - if request.method == 'POST': - if 'studentApproveSubmit' in request.POST: - award = request.POST.get('studentApproveSubmit') - if award == 'Merit-cum-Means Scholarship': - request.session['last_clicked'] = 'studentApproveSubmit_MCM' + if request.method == "POST": + if "studentApproveSubmit" in request.POST: + award = request.POST.get("studentApproveSubmit") + if award == "Merit-cum-Means Scholarship": + request.session["last_clicked"] = "studentApproveSubmit_MCM" else: - request.session['last_clicked'] = 'studentApproveSubmit_Con' - elif 'studentDeclineSubmit' in request.POST: - award = request.POST.get('studentDeclineSubmit') - release_id = request.POST.get('release_id') + request.session["last_clicked"] = "studentApproveSubmit_Con" + elif "studentDeclineSubmit" in request.POST: + award = request.POST.get("studentDeclineSubmit") + release_id = request.POST.get("release_id") release = Release.objects.get(id=release_id) - x = Notification.objects.select_related('student_id','release_id').get( - student_id=request.user.extrainfo.id, release_id=release) - if award == 'Merit-cum-Means Scholarship': - request.session['last_clicked'] = 'studentApproveSubmit_MCM' + x = Notification.objects.select_related("student_id", "release_id").get( + student_id=request.user.extrainfo.id, release_id=release + ) + if award == "Merit-cum-Means Scholarship": + request.session["last_clicked"] = "studentApproveSubmit_MCM" x.notification_mcm_flag = False else: - request.session['last_clicked'] = 'studentApproveSubmit_Con' + request.session["last_clicked"] = "studentApproveSubmit_Con" x.notification_convocation_flag = False x.save() - if request.user.extrainfo.user_type == 'student': - return HttpResponseRedirect('/spacs/student_view') + if request.user.extrainfo.user_type == "student": + return HttpResponseRedirect("/spacs/student_view") elif hd_convener: - return HttpResponseRedirect('/spacs/convener_view') + return HttpResponseRedirect("/spacs/convener_view") elif hd_assistant: - return HttpResponseRedirect('/spacs/staff_view') + return HttpResponseRedirect("/spacs/staff_view") else: # this view is for the other members of the college - return HttpResponseRedirect('/spacs/stats') + return HttpResponseRedirect("/spacs/stats") -@login_required(login_url='/accounts/login') +@login_required(login_url="/accounts/login") def convener_view(request): try: - convener = Designation.objects.get(name='spacsconvenor') - hd = HoldsDesignation.objects.get( - user=request.user, designation=convener) + convener = Designation.objects.get(name="spacsconvenor") + hd = HoldsDesignation.objects.get(user=request.user, designation=convener) except: - return HttpResponseRedirect('/logout') - if request.method == 'POST': - if 'Submit' in request.POST: - award = request.POST.get('type') - programme = request.POST.get('programme') - batch = request.POST.get('batch') - from_date = request.POST.get('From') - to_date = request.POST.get('To') - remarks = request.POST.get('remarks') - request.session['last_clicked'] = 'Submit' + return HttpResponseRedirect("/logout") + if request.method == "POST": + if "Submit" in request.POST: + award = request.POST.get("type") + programme = request.POST.get("programme") + batch = request.POST.get("batch") + from_date = request.POST.get("From") + to_date = request.POST.get("To") + remarks = request.POST.get("remarks") + request.session["last_clicked"] = "Submit" d_time = datetime.datetime.now() Release.objects.create( date_time=d_time, @@ -96,339 +120,512 @@ def convener_view(request): batch=batch, notif_visible=1, ) - + # It updates the student Notification table on the spacs head sending the mcm invitation - if batch == 'all': - active_batches = range(datetime.datetime.now().year - 4 , datetime.datetime.now().year + 1) - query = reduce(or_, (Q(id__id__startswith=batch) for batch in active_batches)) - recipient = Student.objects.filter(programme=programme).filter(query) + if batch.lower() == "all": + active_batches = range( + datetime.datetime.now().year - 4, datetime.datetime.now().year + 1 + ) + recipient = Student.objects.filter(programme=programme).filter( + batch__in=active_batches + ) else: - recipient = Student.objects.filter(programme=programme, id__id__startswith=batch) - + recipient = Student.objects.filter(programme=programme, batch=batch) # Notification starts convenor = request.user for student in recipient: - scholarship_portal_notif(convenor, student.id.user, 'award_' + award) # Notification - if award == 'Merit-cum-Means Scholarship': + scholarship_portal_notif( + convenor, student.id.user, "award_" + award + ) # Notification + if award == "Merit-cum-Means Scholarship": rel = Release.objects.get(date_time=d_time) - Notification.objects.select_related('student_id','release_id').bulk_create([Notification( - release_id=rel, - student_id=student, - notification_mcm_flag=True, - invite_mcm_accept_flag=False) for student in recipient]) + Notification.objects.select_related( + "student_id", "release_id" + ).bulk_create( + [ + Notification( + release_id=rel, + student_id=student, + notification_mcm_flag=True, + invite_mcm_accept_flag=False, + ) + for student in recipient + ] + ) else: rel = Release.objects.get(date_time=d_time) - Notification.objects.select_related('student_id','release_id').bulk_create([Notification( - release_id=rel, - student_id=student, - notification_convocation_flag=True, - invite_convocation_accept_flag=False) for student in recipient]) + Notification.objects.select_related( + "student_id", "release_id" + ).bulk_create( + [ + Notification( + release_id=rel, + student_id=student, + notification_convocation_flag=True, + invite_convocation_accept_flag=False, + ) + for student in recipient + ] + ) # Notification ends - - messages.success(request, - award + ' applications are invited successfully for ' + batch + ' batch(es)') - return HttpResponseRedirect('/spacs/convener_view') - - elif 'Email' in request.POST: - year = request.POST.get('year') - spi = request.POST.get('spi') - cpi = request.POST.get('cpi') + + messages.success( + request, + award + + " applications are invited successfully for " + + batch + + " batch(es)", + ) + return HttpResponseRedirect("/spacs/convener_view") + + elif "Email" in request.POST: + year = request.POST.get("year") + spi = request.POST.get("spi") + cpi = request.POST.get("cpi") award, award_id = getAwardId(request) Notional_prize.objects.create( - year=year, spi=spi, cpi=cpi, award_id=award_id) - messages.success(request, award+' are invited successfully') - return HttpResponseRedirect('/spacs/convener_view') - - elif 'Accept_MCM' in request.POST: - pk = request.POST.get('id') - award = Mcm.objects.select_related('award_id','student').get(id=pk).award_id - student_id = Mcm.objects.select_related('award_id','student').get(id=pk).student + year=year, spi=spi, cpi=cpi, award_id=award_id + ) + messages.success(request, award + " are invited successfully") + return HttpResponseRedirect("/spacs/convener_view") + + elif "Accept_MCM" in request.POST: + pk = request.POST.get("id") + award = ( + Mcm.objects.select_related("award_id", "student").get(id=pk).award_id + ) + student_id = ( + Mcm.objects.select_related("award_id", "student").get(id=pk).student + ) year = datetime.datetime.now().year - Mcm.objects.select_related('award_id','student').filter(id=pk).update(status='Accept') - request.session['last_clicked'] = 'Accept_MCM' + Mcm.objects.select_related("award_id", "student").filter(id=pk).update( + status="Accept" + ) + request.session["last_clicked"] = "Accept_MCM" Previous_winner.objects.create( - student=student_id, year=year, award_id=award) + student=student_id, year=year, award_id=award + ) convenor = request.user recipient = student_id - scholarship_portal_notif(convenor, recipient.id.user, 'Accept_MCM') - messages.success(request, 'Application is accepted') - return HttpResponseRedirect('/spacs/convener_view') - - elif 'Reject_MCM' in request.POST: - pk = request.POST.get('id') - student_id = Mcm.objects.select_related('award_id','student').get(id=pk).student - Mcm.objects.select_related('award_id','student').filter(id=pk).update(status='Reject') + scholarship_portal_notif(convenor, recipient.id.user, "Accept_MCM") + messages.success(request, "Application is accepted") + return HttpResponseRedirect("/spacs/convener_view") + + elif "Reject_MCM" in request.POST: + pk = request.POST.get("id") + student_id = ( + Mcm.objects.select_related("award_id", "student").get(id=pk).student + ) + Mcm.objects.select_related("award_id", "student").filter(id=pk).update( + status="Reject" + ) convenor = request.user recipient = student_id - scholarship_portal_notif(convenor, recipient.id.user, 'Reject_MCM') - messages.success(request, 'Application is rejected') - request.session['last_clicked'] = 'Reject_MCM' - return HttpResponseRedirect('/spacs/convener_view') - - elif 'Accept_Gold' in request.POST: - pk = request.POST.get('id') - award = Director_gold.objects.select_related('student','award_id').get(id=pk).award_id - student_id = Director_gold.objects.select_related('student','award_id').get(id=pk).student + scholarship_portal_notif(convenor, recipient.id.user, "Reject_MCM") + messages.success(request, "Application is rejected") + request.session["last_clicked"] = "Reject_MCM" + return HttpResponseRedirect("/spacs/convener_view") + + elif "Accept_Gold" in request.POST: + pk = request.POST.get("id") + award = ( + Director_gold.objects.select_related("student", "award_id") + .get(id=pk) + .award_id + ) + student_id = ( + Director_gold.objects.select_related("student", "award_id") + .get(id=pk) + .student + ) year = datetime.datetime.now().year - Director_gold.objects.select_related('student','award_id').filter(id=pk).update(status='Accept') + Director_gold.objects.select_related("student", "award_id").filter( + id=pk + ).update(status="Accept") Previous_winner.objects.create( - student=student_id, year=year, award_id=award) + student=student_id, year=year, award_id=award + ) convenor = request.user recipient = student_id - scholarship_portal_notif( - convenor, recipient.id.user, 'Accept_Gold') - request.session['last_clicked'] = 'Accept_Gold' - messages.success(request, 'Application is accepted') - return HttpResponseRedirect('/spacs/convener_view') - - elif 'Reject_Gold' in request.POST: - pk = request.POST.get('id') - student_id = Director_gold.objects.select_related('student','award_id').get(id=pk).student - Director_gold.objects.select_related('student','award_id').filter(id=pk).update(status='Reject') + scholarship_portal_notif(convenor, recipient.id.user, "Accept_Gold") + request.session["last_clicked"] = "Accept_Gold" + messages.success(request, "Application is accepted") + return HttpResponseRedirect("/spacs/convener_view") + + elif "Reject_Gold" in request.POST: + pk = request.POST.get("id") + student_id = ( + Director_gold.objects.select_related("student", "award_id") + .get(id=pk) + .student + ) + Director_gold.objects.select_related("student", "award_id").filter( + id=pk + ).update(status="Reject") convenor = request.user recipient = student_id - scholarship_portal_notif( - convenor, recipient.id.user, 'Reject_Gold') - request.session['last_clicked'] = 'Reject_Gold' - messages.success(request, 'Application is rejected') - return HttpResponseRedirect('/spacs/convener_view') - - elif 'Accept_Silver' in request.POST: - pk = request.POST.get('id') + scholarship_portal_notif(convenor, recipient.id.user, "Reject_Gold") + request.session["last_clicked"] = "Reject_Gold" + messages.success(request, "Application is rejected") + return HttpResponseRedirect("/spacs/convener_view") + + elif "Accept_Silver" in request.POST: + pk = request.POST.get("id") award = Director_silver.objects.get(id=pk).award_id - student_id = Director_silver.objects.select_related('student','award_id').get(id=pk).student + student_id = ( + Director_silver.objects.select_related("student", "award_id") + .get(id=pk) + .student + ) year = datetime.datetime.now().year - Director_silver.objects.select_related('student','award_id').filter(id=pk).update(status='Accept') + Director_silver.objects.select_related("student", "award_id").filter( + id=pk + ).update(status="Accept") Previous_winner.objects.create( - student=student_id, year=year, award_id=award) + student=student_id, year=year, award_id=award + ) convenor = request.user recipient = student_id - scholarship_portal_notif( - convenor, recipient.id.user, 'Accept_Silver') - request.session['last_clicked'] = 'Accept_Silver' - messages.success(request, 'Application is accepted') - return HttpResponseRedirect('/spacs/convener_view') - - elif 'Reject_Silver' in request.POST: - pk = request.POST.get('id') - student_id = Director_silver.objects.select_related('student','award_id').get(id=pk).student - Director_silver.objects.select_related('student','award_id').filter(id=pk).update(status='Reject') + scholarship_portal_notif(convenor, recipient.id.user, "Accept_Silver") + request.session["last_clicked"] = "Accept_Silver" + messages.success(request, "Application is accepted") + return HttpResponseRedirect("/spacs/convener_view") + + elif "Reject_Silver" in request.POST: + pk = request.POST.get("id") + student_id = ( + Director_silver.objects.select_related("student", "award_id") + .get(id=pk) + .student + ) + Director_silver.objects.select_related("student", "award_id").filter( + id=pk + ).update(status="Reject") convenor = request.user recipient = student_id - scholarship_portal_notif( - convenor, recipient.id.user, 'Reject_Silver') - request.session['last_clicked'] = 'Reject_Silver' - messages.success(request, 'Application is rejected') - return HttpResponseRedirect('/spacs/convener_view') - - elif 'Accept_DM' in request.POST: - pk = request.POST.get('id') - award = Proficiency_dm.objects.select_related('student','award_id').get(id=pk).award_id - student_id = Proficiency_dm.objects.select_related('student','award_id').get(id=pk).student + scholarship_portal_notif(convenor, recipient.id.user, "Reject_Silver") + request.session["last_clicked"] = "Reject_Silver" + messages.success(request, "Application is rejected") + return HttpResponseRedirect("/spacs/convener_view") + + elif "Accept_DM" in request.POST: + pk = request.POST.get("id") + award = ( + DM_Proficiency_gold.objects.select_related("student", "award_id") + .get(id=pk) + .award_id + ) + student_id = ( + DM_Proficiency_gold.objects.select_related("student", "award_id") + .get(id=pk) + .student + ) year = datetime.datetime.now().year - Proficiency_dm.objects.select_related('student','award_id').filter(id=pk).update(status='Accept') + DM_Proficiency_gold.objects.select_related("student", "award_id").filter( + id=pk + ).update(status="Accept") Previous_winner.objects.create( - student=student_id, year=year, award_id=award) + student=student_id, year=year, award_id=award + ) convenor = request.user recipient = student_id - scholarship_portal_notif(convenor, recipient.id.user, 'Accept_DM') - request.session['last_clicked'] = 'Accept_DM' - messages.success(request, 'Application is accepted') - return HttpResponseRedirect('/spacs/convener_view') - - elif 'Reject_DM' in request.POST: - pk = request.POST.get('id') - Proficiency_dm.objects.select_related('student','award_id').filter(id=pk).update(status='Reject') - student_id = Proficiency_dm.objects.select_related('student','award_id').get(id=pk).student + scholarship_portal_notif(convenor, recipient.id.user, "Accept_DM") + request.session["last_clicked"] = "Accept_DM" + messages.success(request, "Application is accepted") + return HttpResponseRedirect("/spacs/convener_view") + + elif "Reject_DM" in request.POST: + pk = request.POST.get("id") + DM_Proficiency_gold.objects.select_related("student", "award_id").filter( + id=pk + ).update(status="Reject") + student_id = ( + DM_Proficiency_gold.objects.select_related("student", "award_id") + .get(id=pk) + .student + ) convenor = request.user recipient = student_id - scholarship_portal_notif(convenor, recipient.id.user, 'Reject_DM') - request.session['last_clicked'] = 'Reject_DM' - messages.success(request, 'Application is rejected') - return HttpResponseRedirect('/spacs/convener_view') + scholarship_portal_notif(convenor, recipient.id.user, "Reject_DM") + request.session["last_clicked"] = "Reject_DM" + messages.success(request, "Application is rejected") + return HttpResponseRedirect("/spacs/convener_view") + + elif "Accept_Proficiency" in request.POST: + pk = request.POST.get("id") + award = ( + IIITDM_Proficiency.objects.select_related("student", "award_id") + .get(id=pk) + .award_id + ) + student_id = ( + IIITDM_Proficiency.objects.select_related("student", "award_id") + .get(id=pk) + .student + ) + year = datetime.datetime.now().year + IIITDM_Proficiency.objects.select_related("student", "award_id").filter( + id=pk + ).update(status="Accept") + Previous_winner.objects.create( + student=student_id, year=year, award_id=award + ) + convenor = request.user + recipient = student_id + scholarship_portal_notif(convenor, recipient.id.user, "Accept_Proficiency") + request.session["last_clicked"] = "Accept_Proficiency" + messages.success(request, "Application is accepted") + return HttpResponseRedirect("/spacs/convener_view") + + elif "Reject_Proficiency" in request.POST: + pk = request.POST.get("id") + IIITDM_Proficiency.objects.select_related("student", "award_id").filter( + id=pk + ).update(status="Reject") + student_id = ( + IIITDM_Proficiency.objects.select_related("student", "award_id") + .get(id=pk) + .student + ) + convenor = request.user + recipient = student_id + scholarship_portal_notif(convenor, recipient.id.user, "Reject_Proficiency") + request.session["last_clicked"] = "Reject_Proficiency" + messages.success(request, "Application is rejected") + return HttpResponseRedirect("/spacs/convener_view") elif "SubmitPreviousWinner" in request.POST: winners_list = submitPreviousWinner(request) - return sendConvenerRenderRequest(request, { 'winners_list':winners_list }) + return sendConvenerRenderRequest(request, {"winners_list": winners_list}) else: return sendConvenerRenderRequest(request) -@login_required(login_url='/accounts/login') +@login_required(login_url="/accounts/login") def student_view(request): - if request.method == 'POST': - if 'Submit_MCM' in request.POST: + if request.method == "POST": + # print(request.POST, request.POST.get("event_member_team") or None) + # print(request.FILES, request.FILES.get("dhsfh") or None) + print("Submit_Silver" in request.POST, request.POST) + if "Submit_MCM" in request.POST: return submitMCM(request) - elif 'Submit_Gold' in request.POST: + elif "Submit_Gold" in request.POST: return submitGold(request) - - elif 'Submit_Silver' in request.POST: + + elif "Submit_Silver" in request.POST: return submitSilver(request) - elif 'Submit_DM' in request.POST: + elif "Submit_DM" in request.POST: return submitDM(request) + elif "Submit_Proficiency" in request.POST: + return submitProficiency(request) + elif "SubmitPreviousWinner" in request.POST: winners_list = submitPreviousWinner(request) - return sendStudentRenderRequest(request, {'winners_list':winners_list}) + return sendStudentRenderRequest(request, {"winners_list": winners_list}) else: return sendStudentRenderRequest(request) -@login_required(login_url='/accounts/login') + +@login_required(login_url="/accounts/login") def staff_view(request): try: - assistant = Designation.objects.get( - name='spacsassistant' - ) + assistant = Designation.objects.get(name="spacsassistant") except: - return HttpResponseRedirect('/logout') - - if request.method == 'POST': - - if 'Verify_MCM' in request.POST: - scholarship_key = request.POST.get('id') - Mcm.objects.select_related('award_id','student').filter(id=scholarship_key).update(status='COMPLETE') - request.session['last_clicked'] = 'Verify_MCM' - messages.success(request, 'Verified successfully') - return HttpResponseRedirect('/spacs/staff_view') - - elif 'Reject_MCM' in request.POST: - scholarship_key = request.POST.get('id') - Mcm.objects.select_related('award_id','student').filter(id=scholarship_key).update(status='Reject') - request.session['last_clicked'] = 'Reject_MCM' - messages.success(request, 'Rejected successfully') - return HttpResponseRedirect('/spacs/staff_view') - - elif 'Verify_Gold' in request.POST: - scholarship_key = request.POST.get('id') - Director_gold.objects.select_related('student','award_id').filter(id=scholarship_key).update(status='COMPLETE') - request.session['last_clicked'] = 'Verify_Gold' - messages.success(request, 'Verified successfully') - return HttpResponseRedirect('/spacs/staff_view') - - elif 'Reject_Gold' in request.POST: - scholarship_key = request.POST.get('id') - Director_gold.objects.select_related('student','award_id').filter(id=scholarship_key).update(status='Reject') - request.session['last_clicked'] = 'Reject_Gold' - messages.success(request, 'Rejected successfully') - return HttpResponseRedirect('/spacs/staff_view') - - elif 'Verify_Silver' in request.POST: - scholarship_key = request.POST.get('id') - Director_silver.objects.select_related('student','award_id').filter(id=scholarship_key).update(status='COMPLETE') - request.session['last_clicked'] = 'Verify_Silver' - messages.success(request, 'Verified successfully') - return HttpResponseRedirect('/spacs/staff_view') - - elif 'Reject_Silver' in request.POST: - scholarship_key = request.POST.get('id') - Director_silver.objects.select_related('student','award_id').filter(id=scholarship_key).update(status='Reject') - request.session['last_clicked'] = 'Reject_Silver' - messages.success(request, 'Rejected successfully') - return HttpResponseRedirect('/spacs/staff_view') - - elif 'Verify_DM' in request.POST: - scholarship_key = request.POST.get('id') - Proficiency_dm.objects.select_related('student','award_id').filter(id=scholarship_key).update(status='COMPLETE') - request.session['last_clicked'] = 'Verify_DM' - messages.success(request, 'Verified successfully') - return HttpResponseRedirect('/spacs/staff_view') - - elif 'Reject_DM' in request.POST: - scholarship_key = request.POST.get('id') - Proficiency_dm.objects.select_related('student','award_id').filter(id=scholarship_key).update(status='Reject') - request.session['last_clicked'] = 'Reject_DM' - messages.success(request, 'Rejected successfully') - return HttpResponseRedirect('/spacs/staff_view') + return HttpResponseRedirect("/logout") + + if request.method == "POST": + if "Verify_MCM" in request.POST: + scholarship_key = request.POST.get("id") + Mcm.objects.select_related("award_id", "student").filter( + id=scholarship_key + ).update(status="COMPLETE") + request.session["last_clicked"] = "Verify_MCM" + messages.success(request, "Verified successfully") + return HttpResponseRedirect("/spacs/staff_view") + + elif "Reject_MCM" in request.POST: + scholarship_key = request.POST.get("id") + Mcm.objects.select_related("award_id", "student").filter( + id=scholarship_key + ).update(status="Reject") + request.session["last_clicked"] = "Reject_MCM" + messages.success(request, "Rejected successfully") + return HttpResponseRedirect("/spacs/staff_view") + + elif "Verify_Gold" in request.POST: + scholarship_key = request.POST.get("id") + Director_gold.objects.select_related("student", "award_id").filter( + id=scholarship_key + ).update(status="COMPLETE") + request.session["last_clicked"] = "Verify_Gold" + messages.success(request, "Verified successfully") + return HttpResponseRedirect("/spacs/staff_view") + + elif "Reject_Gold" in request.POST: + scholarship_key = request.POST.get("id") + Director_gold.objects.select_related("student", "award_id").filter( + id=scholarship_key + ).update(status="Reject") + request.session["last_clicked"] = "Reject_Gold" + messages.success(request, "Rejected successfully") + return HttpResponseRedirect("/spacs/staff_view") + + elif "Verify_Silver" in request.POST: + scholarship_key = request.POST.get("id") + Director_silver.objects.select_related("student", "award_id").filter( + id=scholarship_key + ).update(status="COMPLETE") + request.session["last_clicked"] = "Verify_Silver" + messages.success(request, "Verified successfully") + return HttpResponseRedirect("/spacs/staff_view") + + elif "Reject_Silver" in request.POST: + scholarship_key = request.POST.get("id") + Director_silver.objects.select_related("student", "award_id").filter( + id=scholarship_key + ).update(status="Reject") + request.session["last_clicked"] = "Reject_Silver" + messages.success(request, "Rejected successfully") + return HttpResponseRedirect("/spacs/staff_view") + + elif "Verify_DM" in request.POST: + scholarship_key = request.POST.get("id") + DM_Proficiency_gold.objects.select_related("student", "award_id").filter( + id=scholarship_key + ).update(status="COMPLETE") + request.session["last_clicked"] = "Verify_DM" + messages.success(request, "Verified successfully") + return HttpResponseRedirect("/spacs/staff_view") + + elif "Reject_DM" in request.POST: + scholarship_key = request.POST.get("id") + DM_Proficiency_gold.objects.select_related("student", "award_id").filter( + id=scholarship_key + ).update(status="Reject") + request.session["last_clicked"] = "Reject_DM" + messages.success(request, "Rejected successfully") + return HttpResponseRedirect("/spacs/staff_view") + + elif "Verify_Proficiency" in request.POST: + scholarship_key = request.POST.get("id") + IIITDM_Proficiency.objects.select_related("student", "award_id").filter( + id=scholarship_key + ).update(status="COMPLETE") + request.session["last_clicked"] = "Verify_Proficiency" + messages.success(request, "Verified successfully") + return HttpResponseRedirect("/spacs/staff_view") + + elif "Reject_Proficiency" in request.POST: + scholarship_key = request.POST.get("id") + IIITDM_Proficiency.objects.select_related("student", "award_id").filter( + id=scholarship_key + ).update(status="Reject") + request.session["last_clicked"] = "Reject_Proficiency" + messages.success(request, "Rejected successfully") + return HttpResponseRedirect("/spacs/staff_view") + elif "SubmitPreviousWinner" in request.POST: winners_list = submitPreviousWinner(request) - return sendStaffRenderRequest(request, {'winners_list':winners_list}) + return sendStaffRenderRequest(request, {"winners_list": winners_list}) else: return sendStaffRenderRequest(request) -def stats(request): # This view is created for the rest of audience excluding students, spacs convenor and spacs assistant - if request.method == 'POST': + +def stats( + request, +): # This view is created for the rest of audience excluding students, spacs convenor and spacs assistant + if request.method == "POST": if "SubmitPreviousWinner" in request.POST: winners_list = submitPreviousWinner(request) - return sendStatsRenderRequest(request, {'winners_list':winners_list}) + return sendStatsRenderRequest(request, {"winners_list": winners_list}) else: return sendStatsRenderRequest(request) + def convenerCatalogue(request): - if request.method == 'POST': - award_name = request.POST.get('award_name') - catalog_content = request.POST.get('catalog_content') + if request.method == "POST": + award_name = request.POST.get("award_name") + catalog_content = request.POST.get("catalog_content") context = {} try: award = Award_and_scholarship.objects.get(award_name=award_name) award.catalog = catalog_content award.save() - context['result'] = 'Success' + context["result"] = "Success" except: - context['result'] = 'Failure' - return HttpResponse(json.dumps(context), content_type='convenerCatalogue/json') + context["result"] = "Failure" + return HttpResponse(json.dumps(context), content_type="convenerCatalogue/json") else: - award_name = request.GET.get('award_name') + award_name = request.GET.get("award_name") context = {} try: award = Award_and_scholarship.objects.get(award_name=award_name) - context['catalog'] = award.catalog - context['result'] = 'Success' + context["catalog"] = award.catalog + context["result"] = "Success" except: - context['result'] = 'Failure' - return HttpResponse(json.dumps(context), content_type='convenerCatalogue/json') + context["result"] = "Failure" + return HttpResponse(json.dumps(context), content_type="convenerCatalogue/json") + def getWinners(request): - award_name = request.GET.get('award_name') - batch_year = int(request.GET.get('batch')) - programme_name = request.GET.get('programme') + award_name = request.GET.get("award_name") + batch_year = int(request.GET.get("batch")) + programme_name = request.GET.get("programme") award = Award_and_scholarship.objects.get(award_name=award_name) - winners = Previous_winner.objects.select_related('student','award_id').filter( - year=batch_year, award_id=award, programme=programme_name) + winners = Previous_winner.objects.select_related("student", "award_id").filter( + year=batch_year, award_id=award, programme=programme_name + ) context = {} - context['student_name'] = [] - context['student_program'] = [] - context['roll'] = [] + context["student_name"] = [] + context["student_program"] = [] + context["roll"] = [] -# If-Else Condition for previous winner if there is or no data in the winner table + # If-Else Condition for previous winner if there is or no data in the winner table if winners: for winner in winners: - extra_info = ExtraInfo.objects.get(id=winner.student_id) student_id = Student.objects.get(id=extra_info) student_name = extra_info.user.first_name student_roll = winner.student_id student_program = student_id.programme - context['student_name'].append(student_name) - context['roll'].append(student_roll) - context['student_program'].append(student_program) + context["student_name"].append(student_name) + context["roll"].append(student_roll) + context["student_program"].append(student_program) - context['result'] = 'Success' + context["result"] = "Success" else: - context['result'] = 'Failure' + context["result"] = "Failure" + + return HttpResponse(json.dumps(context), content_type="getWinners/json") - return HttpResponse(json.dumps(context), content_type='getWinners/json') def get_MCM_Flag(request): # Here we are extracting mcm_flag - x = Notification.objects.select_related('student_id','release_id').filter(student_id=request.user.extrainfo.id) + x = Notification.objects.select_related("student_id", "release_id").filter( + student_id=request.user.extrainfo.id + ) for i in x: i.invite_mcm_accept_flag = True i.save() # i.notification_mcm_flag=False - request.session['last_clicked'] = 'get_MCM_Flag' + request.session["last_clicked"] = "get_MCM_Flag" context = {} - context['show_mcm_flag'] = True + context["show_mcm_flag"] = True if x: - context['result'] = 'Success' + context["result"] = "Success" else: - context['result'] = 'Failure' - return HttpResponse(json.dumps(context), content_type='get_MCM_Flag/json') - # return HttpResponseRedirect('/spacs/student_view') + context["result"] = "Failure" + return HttpResponse(json.dumps(context), content_type="get_MCM_Flag/json") + + +# return HttpResponseRedirect('/spacs/student_view') + def getConvocationFlag(request): # Here we are extracting convocation_flag x = Notification.objects.filter(student_id=request.user.extrainfo.id) @@ -436,28 +633,30 @@ def getConvocationFlag(request): # Here we are extracting convocation_flag i.invite_convocation_accept_flag = True i.save() # i.notification_convocation_flag=False - request.session['last_clicked'] = 'getConvocationFlag' + request.session["last_clicked"] = "getConvocationFlag" context = {} - context['show_convocation_flag'] = True + context["show_convocation_flag"] = True if x: - context['result'] = 'Success' + context["result"] = "Success" else: - context['result'] = 'Failure' - return HttpResponse(json.dumps(context), content_type='getConvocationFlag/json') + context["result"] = "Failure" + return HttpResponse(json.dumps(context), content_type="getConvocationFlag/json") + def getContent(request): - award_name = request.GET.get('award_name') + award_name = request.GET.get("award_name") context = {} try: award = Award_and_scholarship.objects.get(award_name=award_name) - context['result'] = 'Success' - context['content'] = award.catalog + context["result"] = "Success" + context["content"] = award.catalog print(type(award.catalog)) # context['content'] = 'Hi' except: - context['result'] = 'Failure' - return HttpResponse(json.dumps(context), content_type='getContent/json') + context["result"] = "Failure" + return HttpResponse(json.dumps(context), content_type="getContent/json") + def checkDate(start_date, end_date): current_date = datetime.date.today() @@ -469,54 +668,59 @@ def checkDate(start_date, end_date): else: return False + def updateEndDate(request): - id = request.GET.get('up_id') - end_date = request.GET.get('up_d') + id = request.GET.get("up_id") + end_date = request.GET.get("up_d") is_released = Release.objects.filter(pk=id).update(enddate=end_date) - request.session['last_clicked'] = "Enddate_updated" + request.session["last_clicked"] = "Enddate_updated" context = {} if is_released: - context['result'] = 'Success' + context["result"] = "Success" else: - context['result'] = 'Failure' - return HttpResponse(json.dumps(context), content_type='updateEndDate/json') + context["result"] = "Failure" + return HttpResponse(json.dumps(context), content_type="updateEndDate/json") + def getAwardId(request): - award = request.POST.get('award') + award = request.POST.get("award") a = Award_and_scholarship.objects.get(award_name=award).id award_id = Award_and_scholarship.objects.get(id=a) return award, award_id + def submitMCM(request): - i = Notification.objects.select_related('student_id','release_id').filter(student_id=request.user.extrainfo.id) + i = Notification.objects.select_related("student_id", "release_id").filter( + student_id=request.user.extrainfo.id + ) for x in i: x.invite_mcm_accept_flag = False x.save() - father_occ = request.POST.get('father_occ') - mother_occ = request.POST.get('mother_occ') - brother_name = request.POST.get('brother_name') - sister_name = request.POST.get('sister_name') - brother_occupation = request.POST.get('brother_occupation') - sister_occupation = request.POST.get('sister_occupation') - income_father = int(request.POST.get('father_income')) - income_mother = int(request.POST.get('mother_income')) - income_other = int(request.POST.get('other_income')) - father_occ_desc = request.POST.get('father_occ_desc') - mother_occ_desc = request.POST.get('mother_occ_desc') - four_wheeler = request.POST.get('four_wheeler') - four_wheeler_desc = request.POST.get('four_wheeler_desc') - two_wheeler_desc = request.POST.get('two_wheeler_desc') - two_wheeler = request.POST.get('two_wheeler') - house = request.POST.get('house') - plot_area = request.POST.get('plot_area') - constructed_area = request.POST.get('constructed_area') - school_fee = request.POST.get('school_fee') - school_name = request.POST.get('school_name') - college_fee = request.POST.get('college_fee') - college_name = request.POST.get('college_name') - loan_amount = request.POST.get('loan_amount') - bank_name = request.POST.get('bank_name') - income_certificate = request.FILES.get('income_certificate') + father_occ = request.POST.get("father_occ") + mother_occ = request.POST.get("mother_occ") + brother_name = request.POST.get("brother_name") + sister_name = request.POST.get("sister_name") + brother_occupation = request.POST.get("brother_occupation") + sister_occupation = request.POST.get("sister_occupation") + income_father = int(request.POST.get("father_income")) + income_mother = int(request.POST.get("mother_income")) + income_other = int(request.POST.get("other_income")) + father_occ_desc = request.POST.get("father_occ_desc") + mother_occ_desc = request.POST.get("mother_occ_desc") + four_wheeler = request.POST.get("four_wheeler") + four_wheeler_desc = request.POST.get("four_wheeler_desc") + two_wheeler_desc = request.POST.get("two_wheeler_desc") + two_wheeler = request.POST.get("two_wheeler") + house = request.POST.get("house") + plot_area = request.POST.get("plot_area") + constructed_area = request.POST.get("constructed_area") + school_fee = request.POST.get("school_fee") + school_name = request.POST.get("school_name") + college_fee = request.POST.get("college_fee") + college_name = request.POST.get("college_name") + loan_amount = request.POST.get("loan_amount") + bank_name = request.POST.get("bank_name") + income_certificate = request.FILES.get("income_certificate") student = request.user.extrainfo.student annual_income = income_father + income_mother + income_other award, award_id = getAwardId(request) @@ -548,8 +752,8 @@ def submitMCM(request): "annual_income": annual_income, } try: - for column in MCM_list: - validate(instance=data_insert[column], schema=MCM_schema[column]) + for column in Mcm_list: + validate(instance=data_insert[column], schema=Mcm_schema[column]) releases = Release.objects.filter( Q( @@ -558,11 +762,13 @@ def submitMCM(request): ) ).filter(award="Merit-cum-Means Scholarship") for release in releases: - if Mcm.objects.select_related('award_id','student').filter( - Q(date__gte=release.startdate, date__lte=release.enddate) - ).filter(student=request.user.extrainfo.student): + if ( + Mcm.objects.select_related("award_id", "student") + .filter(Q(date__gte=release.startdate, date__lte=release.enddate)) + .filter(student=request.user.extrainfo.student) + ): # if len(Mcm.objects.filter(student = request.user.extrainfo.student)) > 0: - Mcm.objects.select_related('award_id','student').filter( + Mcm.objects.select_related("award_id", "student").filter( Q( date__gte=release.startdate, date__lte=release.enddate, @@ -599,7 +805,7 @@ def submitMCM(request): status="INCOMPLETE", ) messages.success( - request, award + ' Application is successfully submitted' + request, award + " Application is successfully submitted" ) break else: @@ -634,354 +840,793 @@ def submitMCM(request): college_name=college_name, ) messages.success( - request, award + ' Application is successfully submitted' + request, award + " Application is successfully submitted" ) break request.session["last_clicked"] = "Submit_mcm" except ValidationError as exc: messages.error(column + " : " + str(exc)) - request.session['last_clicked'] = 'Submit_MCM' - return HttpResponseRedirect('/spacs/student_view') + request.session["last_clicked"] = "Submit_MCM" + return HttpResponseRedirect("/spacs/student_view") + def submitGold(request): - i = Notification.objects.select_related('student_id','release_id').filter( - student_id=request.user.extrainfo.id) + i = Notification.objects.select_related("student_id", "release_id").filter( + student_id=request.user.extrainfo.id + ) for x in i: x.invite_convocation_accept_flag = False x.save() - relevant_document = request.FILES.get('myfile') + student_id = request.user.extrainfo.student award, award_id = getAwardId(request) - academic_achievements = request.POST.get('academic_achievements') - science_inside = request.POST.get('science_inside') - science_outside = request.POST.get('science_outside') - games_inside = request.POST.get('games_inside') - games_outside = request.POST.get('games_outside') - cultural_inside = request.POST.get('cultural_inside') - cultural_outside = request.POST.get('cultural_outside') - social = request.POST.get('social') - corporate = request.POST.get('corporate') - hall_activities = request.POST.get('hall_activities') - gymkhana_activities = request.POST.get('gymkhana_activities') - institute_activities = request.POST.get('institute_activities') - counselling_activities = request.POST.get('counselling_activities') - other_activities = request.POST.get('other_activities') - justification = request.POST.get('justification') - correspondence_address = request.POST.get('c_address') - financial_assistance = request.POST.get('financial_assistance') - grand_total = request.POST.get('grand_total') - nearest_policestation = request.POST.get('nps') - nearest_railwaystation = request.POST.get('nrs') - data_insert={ - "academic_achievements":academic_achievements, - "science_inside":science_inside, - "science_outside":science_outside, - "games_inside":games_inside, - "games_outside":games_outside, - "cultural_inside":cultural_inside, - "cultural_outside":cultural_outside, - "social":social, - "corporate":corporate, - "hall_activities":hall_activities, - "gymkhana_activities":gymkhana_activities, - "institute_activities":institute_activities, - "counselling_activities":counselling_activities, - "other_activities":other_activities, - "justification":justification, - "correspondence_address":correspondence_address, - "financial_assistance":financial_assistance, - "grand_total":grand_total, - "nearest_policestation":nearest_policestation, - "nearest_railwaystation":nearest_railwaystation + financial_assistance = request.POST.get("scholarship_detail") + academic = request.POST.get("academic_detail") + science = request.POST.get("science_detail") + games = request.POST.get("sports_detail") + cultural = request.POST.get("cultural_detail") + social = request.POST.get("social_detail") + corporate = request.POST.get("corporate_detail") + hall_activities = request.POST.get("hall_detail") + gymkhana_activities = request.POST.get("gymkhana_detail") + institute_activities = request.POST.get("institute_detail") + counselling_activities = request.POST.get("counselling_detail") + sci = request.POST.get("sci") + scie = request.POST.get("scie") + ij = request.POST.get("ij") + ic = request.POST.get("ic") + nc = request.POST.get("nc") + workshop = request.POST.get("workshop") + novelty = request.POST.get("novelty") + disciplinary_action = request.POST.get("disciplinary_details") + + academic_doc = request.FILES.get("academic_detail_doc") or None + financial_assistance_doc = request.FILES.get("scholarship_detail_doc") or None + science_doc = request.FILES.get("science_detail_doc") or None + games_doc = request.FILES.get("sports_detail_doc") or None + cultural_doc = request.FILES.get("cultural_detail_doc") or None + social_doc = request.FILES.get("social_detail_doc") or None + corporate_doc = request.FILES.get("corporate_detail_doc") or None + hall_activities_doc = request.FILES.get("hall_detail_doc") or None + gymkhana_activities_doc = request.FILES.get("gymkhana_detail_doc") or None + institute_activities_doc = request.FILES.get("institute_detail_doc") or None + counselling_activities_doc = request.FILES.get("counselling_detail_doc") or None + sci_doc = request.FILES.get("sci_doc") or None + scie_doc = request.FILES.get("scie_doc") or None + ij_doc = request.FILES.get("ij_doc") or None + ic_doc = request.FILES.get("ic_doc") or None + nc_doc = request.FILES.get("nc_doc") or None + workshop_doc = request.FILES.get("workshop_doc") or None + warning_letter = request.FILES.get("warning_letter") or None + jagriti = request.FILES.get("jagriti_doc") or None + blood_donation = request.FILES.get("blood_donation_doc") or None + other_extra_curricular_activities = ( + request.FILES.get("extra_curricular_others_doc") or None + ) + + data_insert = { + "award_id": award_id, + "financial_assistance": financial_assistance, + "academic": academic, + "science": science, + "games": games, + "cultural": cultural, + "social": social, + "corporate": corporate, + "hall_activities": hall_activities, + "gymkhana_activities": gymkhana_activities, + "institute_activities": institute_activities, + "counselling_activities": counselling_activities, + "other_extra_curricular_activities": other_extra_curricular_activities, + "sci": sci, + "scie": scie, + "ij": ij, + "ic": ic, + "nc": nc, + "workshop": workshop, + "novelty": novelty, + "disciplinary_action": disciplinary_action, } try: - for column in gold_list: - validate(instance=data_insert[column], schema=gold_schema[column]) - releases = Release.objects.filter(Q(startdate__lte=datetime.datetime.today().strftime( - '%Y-%m-%d'), enddate__gte=datetime.datetime.today().strftime('%Y-%m-%d'))).filter(award="Convocation Medals") + for column in Director_gold_list: + validate(instance=data_insert[column], schema=Director_gold_schema[column]) + releases = Release.objects.filter( + Q( + startdate__lte=datetime.datetime.today().strftime("%Y-%m-%d"), + enddate__gte=datetime.datetime.today().strftime("%Y-%m-%d"), + ) + ).filter(award="Convocation Medals") for release in releases: - existingRelease = Director_gold.objects.select_related('student','award_id').filter(Q(date__gte=release.startdate, date__lte=release.enddate)).filter(student=request.user.extrainfo.student) + existingRelease = ( + Director_gold.objects.select_related("student", "award_id") + .filter(Q(date__gte=release.startdate, date__lte=release.enddate)) + .filter(student=request.user.extrainfo.student) + ) if existingRelease: existingRelease.update( student=student_id, - relevant_document=relevant_document, award_id=award_id, - academic_achievements=academic_achievements, - science_inside=science_inside, - science_outside=science_outside, - games_inside=games_inside, - games_outside=games_outside, - cultural_inside=cultural_inside, - cultural_outside=cultural_outside, + financial_assistance=financial_assistance, + academic=academic, + science=science, + games=games, + cultural=cultural, social=social, corporate=corporate, hall_activities=hall_activities, gymkhana_activities=gymkhana_activities, institute_activities=institute_activities, counselling_activities=counselling_activities, - correspondence_address=correspondence_address, - financial_assistance=financial_assistance, - grand_total=grand_total, - nearest_policestation=nearest_policestation, - nearest_railwaystation=nearest_railwaystation, - justification=justification, - status='INCOMPLETE' + sci=sci, + scie=scie, + ij=ij, + ic=ic, + nc=nc, + workshop=workshop, + novelty=novelty, + disciplinary_action=disciplinary_action, + academic_doc=academic_doc, + financial_assistance_doc=financial_assistance_doc, + science_doc=science_doc, + games_doc=games_doc, + cultural_doc=cultural_doc, + social_doc=social_doc, + corporate_doc=corporate_doc, + hall_activities_doc=hall_activities_doc, + gymkhana_activities_doc=gymkhana_activities_doc, + institute_activities_doc=institute_activities_doc, + counselling_activities_doc=counselling_activities_doc, + sci_doc=sci_doc, + scie_doc=scie_doc, + ij_doc=ij_doc, + ic_doc=ic_doc, + nc_doc=nc_doc, + workshop_doc=workshop_doc, + warning_letter=warning_letter, + jagriti=jagriti, + blood_donation=blood_donation, + other_extra_curricular_activities=other_extra_curricular_activities, + status="INCOMPLETE", + ) + messages.success( + request, award + " Application is successfully updated" ) - messages.success(request, award + ' Application is successfully updated') break else: Director_gold.objects.create( student=student_id, - relevant_document=relevant_document, award_id=award_id, - academic_achievements=academic_achievements, - science_inside=science_inside, - science_outside=science_outside, - games_inside=games_inside, - games_outside=games_outside, - cultural_inside=cultural_inside, - cultural_outside=cultural_outside, + academic=academic, + science=science, + games=games, + cultural=cultural, social=social, corporate=corporate, hall_activities=hall_activities, gymkhana_activities=gymkhana_activities, institute_activities=institute_activities, counselling_activities=counselling_activities, - correspondence_address=correspondence_address, - financial_assistance=financial_assistance, - grand_total=grand_total, - nearest_policestation=nearest_policestation, - nearest_railwaystation=nearest_railwaystation, - justification=justification + sci=sci, + scie=scie, + ij=ij, + ic=ic, + nc=nc, + workshop=workshop, + novelty=novelty, + disciplinary_action=disciplinary_action, + academic_doc=academic_doc, + financial_assistance_doc=financial_assistance_doc, + science_doc=science_doc, + games_doc=games_doc, + cultural_doc=cultural_doc, + social_doc=social_doc, + corporate_doc=corporate_doc, + hall_activities_doc=hall_activities_doc, + gymkhana_activities_doc=gymkhana_activities_doc, + institute_activities_doc=institute_activities_doc, + counselling_activities_doc=counselling_activities_doc, + sci_doc=sci_doc, + scie_doc=scie_doc, + ij_doc=ij_doc, + ic_doc=ic_doc, + nc_doc=nc_doc, + workshop_doc=workshop_doc, + warning_letter=warning_letter, + jagriti=jagriti, + blood_donation=blood_donation, + other_extra_curricular_activities=other_extra_curricular_activities, + ) + messages.success( + request, award + " Application is successfully submitted" ) - messages.success(request, award + ' Application is successfully submitted') break except ValidationError as exc: messages.error(column + " : " + str(exc)) - request.session['last_clicked'] = 'Submit_Gold' - return HttpResponseRedirect('/spacs/student_view') + request.session["last_clicked"] = "Submit_Gold" + return HttpResponseRedirect("/spacs/student_view") + def submitSilver(request): - i = Notification.objects.select_related('student_id','release_id').filter( - student_id=request.user.extrainfo.id) + i = Notification.objects.select_related("student_id", "release_id").filter( + student_id=request.user.extrainfo.id + ) for x in i: x.invite_convocation_accept_flag = False x.save() - relevant_document = request.FILES.get('myfile') award, award_id = getAwardId(request) - award_type = request.POST.get('award-type') student_id = request.user.extrainfo.student - inside_achievements = request.POST.get('inside_achievements') - outside_achievements = request.POST.get('outside_achievements') - justification = request.POST.get('justification') - correspondence_address = request.POST.get('c_address') - financial_assistance = request.POST.get('financial_assistance') - grand_total = request.POST.get('grand_total') - nearest_policestation = request.POST.get('nps') - nearest_railwaystation = request.POST.get('nrs') - data_insert={ - "nearest_policestation":nearest_policestation, - "nearest_railwaystation":nearest_railwaystation, - "correspondence_address":correspondence_address, - "financial_assistance":financial_assistance, - "grand_total":grand_total, - "inside_achievements":inside_achievements, - "justification":justification, - "outside_achievements":outside_achievements + cultural_intercollege_certificates_no = int( + request.POST.get("cultural_inter_college_certificate") or 0 + ) + cultural_intercollege_team_event = request.POST.get( + "cultural_inter_college_team_event" + ) + cultural_intercollege_team_certificates_no = int( + request.POST.get("cultural_inter_college_team_certificate") or 0 + ) + culturalfest_certificates_no = int(request.POST.get("cultural_fest_certificate") or 0) + cultural_club_coordinator = request.POST.get("cultural_club_coordinator") + cultural_club_co_coordinator = request.POST.get("cultural_club_co_coordinator") + cultural_event_member = request.POST.get("cultural_event_member_team") + cultural_interIIIT_certificates_no = int( + request.POST.get("cultural_inter_iiit_individual") or 0 + ) + cultural_interIIIT_team_certificates_no = int( + request.POST.get("cultural_inter_iiit_team") or 0 + ) + sports_club_coordinator = request.POST.get("sports_club_coordinator") + sports_club_co_coordinator = request.POST.get("sports_club_co_coordinator") + sports_event_member = request.POST.get("sports_event_member_team") + sports_other_accomplishment = request.POST.get("sports_accomplishments") + cultural_intercollege_certificate = ( + request.FILES.get("cultural_inter_college_certificate_doc") or None + ) + cultural_intercollege_team_certificate = ( + request.FILES.get("cultural_inter_college_team_certificate_doc") or None + ) + culturalfest_certificate = ( + request.FILES.get("cultural_fest_certificate_doc") or None + ) + cultural_club_coordinator_certificate = ( + request.FILES.get("cultural_club_coordinator_doc") or None + ) + cultural_club_co_coordinator_certificate = ( + request.FILES.get("cultural_club_co_coordinator_doc") or None + ) + cultural_event_member_certificate = ( + request.FILES.get("cultural_event_member_team_doc") or None + ) + cultural_interIIIT_team_certificate = ( + request.FILES.get("cultural_inter_iiit_team_doc") or None + ) + cultural_interIIIT_certificate = ( + request.FILES.get("cultural_inter_iiit_individual_doc") or None + ) + sports_intercollege_certificate = ( + request.FILES.get("sports_inter_college_individual") or None + ) + sports_intercollege_team_certificate = ( + request.FILES.get("sports_inter_college_team") or None + ) + sportsfest_certificate = request.FILES.get("gusto_individual") or None + sportsfest_team_certificate = request.FILES.get("gusto_team") or None + sports_club_coordinator_certificate = ( + request.FILES.get("sports_club_coordinator_doc") or None + ) + sports_club_co_coordinator_certificate = ( + request.FILES.get("sports_club_co_coordinator_doc") or None + ) + sports_event_member_certificate = ( + request.FILES.get("sports_event_member_team_doc") or None + ) + sports_interIIIT_team_certificate = ( + request.FILES.get("sports_inter_iiit_team") or None + ) + sports_interIIIT_certificate = ( + request.FILES.get("sports_inter_iiit_individual") or None + ) + sports_other_accomplishment_doc = ( + request.FILES.get("sports_accomplishments_doc") or None + ) + + data_insert = { + "award_id": award_id, + "cultural_intercollege_certificates_no": cultural_intercollege_certificates_no, + "cultural_intercollege_team_event": cultural_intercollege_team_event, + "cultural_intercollege_team_certificates_no": cultural_intercollege_team_certificates_no, + "culturalfest_certificates_no": culturalfest_certificates_no, + "cultural_club_coordinator": cultural_club_coordinator, + "cultural_club_co_coordinator": cultural_club_co_coordinator, + "cultural_event_member": cultural_event_member, + "cultural_interIIIT_certificates_no": cultural_interIIIT_certificates_no, + "cultural_interIIIT_team_certificates_no": cultural_interIIIT_team_certificates_no, + "sports_club_coordinator": sports_club_coordinator, + "sports_club_co_coordinator": sports_club_co_coordinator, + "sports_event_member": sports_event_member, + "sports_other_accomplishment": sports_other_accomplishment, } try: - for column in silver_list: - validate(instance=data_insert[column], schema=silver_schema[column]) - releases = Release.objects.filter(Q(startdate__lte=datetime.datetime.today().strftime( - '%Y-%m-%d'), enddate__gte=datetime.datetime.today().strftime('%Y-%m-%d'))).filter(award="Convocation Medals") + for column in Director_silver_list: + validate( + instance=data_insert[column], schema=Director_silver_schema[column] + ) + releases = Release.objects.filter( + Q( + startdate__lte=datetime.datetime.today().strftime("%Y-%m-%d"), + enddate__gte=datetime.datetime.today().strftime("%Y-%m-%d"), + ) + ).filter(award="Convocation Medals") + print(releases) for release in releases: - existingRelease = Director_silver.objects.select_related('student','award_id').filter(Q(date__gte=release.startdate, date__lte=release.enddate)).filter(student=request.user.extrainfo.student) + existingRelease = ( + Director_silver.objects.select_related("student", "award_id") + .filter(Q(date__gte=release.startdate, date__lte=release.enddate)) + .filter(student=request.user.extrainfo.student) + ) if existingRelease: existingRelease.update( student=student_id, award_id=award_id, - award_type=award_type, - relevant_document=relevant_document, - inside_achievements=inside_achievements, - justification=justification, - correspondence_address=correspondence_address, - financial_assistance=financial_assistance, - grand_total=grand_total, - nearest_policestation=nearest_policestation, - nearest_railwaystation=nearest_railwaystation, - outside_achievements=outside_achievements, - status='INCOMPLETE' + cultural_intercollege_certificates_no=cultural_intercollege_certificates_no, + cultural_intercollege_team_event=cultural_intercollege_team_event, + cultural_intercollege_team_certificates_no=cultural_intercollege_team_certificates_no, + culturalfest_certificates_no=culturalfest_certificates_no, + cultural_club_coordinator=cultural_club_coordinator, + cultural_club_co_coordinator=cultural_club_co_coordinator, + cultural_event_member=cultural_event_member, + cultural_interIIIT_certificates_no=cultural_interIIIT_certificates_no, + cultural_interIIIT_team_certificates_no=cultural_interIIIT_team_certificates_no, + sports_club_coordinator=sports_club_coordinator, + sports_club_co_coordinator=sports_club_co_coordinator, + sports_event_member=sports_event_member, + sports_other_accomplishment=sports_other_accomplishment, + cultural_intercollege_certificate=cultural_intercollege_certificate, + cultural_intercollege_team_certificate=cultural_intercollege_team_certificate, + culturalfest_certificate=culturalfest_certificate, + cultural_club_coordinator_certificate=cultural_club_coordinator_certificate, + cultural_club_co_coordinator_certificate=cultural_club_co_coordinator_certificate, + cultural_event_member_certificate=cultural_event_member_certificate, + cultural_interIIIT_team_certificate=cultural_interIIIT_team_certificate, + cultural_interIIIT_certificate=cultural_interIIIT_certificate, + sports_intercollege_certificate=sports_intercollege_certificate, + sports_intercollege_team_certificate=sports_intercollege_team_certificate, + sportsfest_certificate=sportsfest_certificate, + sportsfest_team_certificate=sportsfest_team_certificate, + sports_club_coordinator_certificate=sports_club_coordinator_certificate, + sports_club_co_coordinator_certificate=sports_club_co_coordinator_certificate, + sports_event_member_certificate=sports_event_member_certificate, + sports_interIIIT_team_certificate=sports_interIIIT_team_certificate, + sports_interIIIT_certificate=sports_interIIIT_certificate, + sports_other_accomplishment_doc=sports_other_accomplishment_doc, + status="INCOMPLETE", + ) + messages.success( + request, award + " Application is successfully updated" ) - messages.success(request, award + ' Application is successfully updated') break else: Director_silver.objects.create( student=student_id, award_id=award_id, - award_type=award_type, - relevant_document=relevant_document, - inside_achievements=inside_achievements, - justification=justification, - correspondence_address=correspondence_address, - financial_assistance=financial_assistance, - grand_total=grand_total, - nearest_policestation=nearest_policestation, - nearest_railwaystation=nearest_railwaystation, - outside_achievements=outside_achievements + cultural_intercollege_certificates_no=cultural_intercollege_certificates_no, + cultural_intercollege_team_event=cultural_intercollege_team_event, + cultural_intercollege_team_certificates_no=cultural_intercollege_team_certificates_no, + culturalfest_certificates_no=culturalfest_certificates_no, + cultural_club_coordinator=cultural_club_coordinator, + cultural_club_co_coordinator=cultural_club_co_coordinator, + cultural_event_member=cultural_event_member, + cultural_interIIIT_certificates_no=cultural_interIIIT_certificates_no, + cultural_interIIIT_team_certificates_no=cultural_interIIIT_team_certificates_no, + sports_club_coordinator=sports_club_coordinator, + sports_club_co_coordinator=sports_club_co_coordinator, + sports_event_member=sports_event_member, + sports_other_accomplishment=sports_other_accomplishment, + cultural_intercollege_certificate=cultural_intercollege_certificate, + cultural_intercollege_team_certificate=cultural_intercollege_team_certificate, + culturalfest_certificate=culturalfest_certificate, + cultural_club_coordinator_certificate=cultural_club_coordinator_certificate, + cultural_club_co_coordinator_certificate=cultural_club_co_coordinator_certificate, + cultural_event_member_certificate=cultural_event_member_certificate, + cultural_interIIIT_team_certificate=cultural_interIIIT_team_certificate, + cultural_interIIIT_certificate=cultural_interIIIT_certificate, + sports_intercollege_certificate=sports_intercollege_certificate, + sports_intercollege_team_certificate=sports_intercollege_team_certificate, + sportsfest_certificate=sportsfest_certificate, + sportsfest_team_certificate=sportsfest_team_certificate, + sports_club_coordinator_certificate=sports_club_coordinator_certificate, + sports_club_co_coordinator_certificate=sports_club_co_coordinator_certificate, + sports_event_member_certificate=sports_event_member_certificate, + sports_interIIIT_team_certificate=sports_interIIIT_team_certificate, + sports_interIIIT_certificate=sports_interIIIT_certificate, + sports_other_accomplishment_doc=sports_other_accomplishment_doc, + ) + messages.success( + request, award + " Application is successfully submitted" ) - messages.success(request, award + ' Application is successfully submitted') break except ValidationError as exc: messages.error(column + " : " + str(exc)) - request.session['last_clicked'] = 'Submit_Silver' - return HttpResponseRedirect('/spacs/student_view') + request.session["last_clicked"] = "Submit_Silver" + return HttpResponseRedirect("/spacs/student_view") + def submitDM(request): - i = Notification.objects.select_related('student_id','release_id').filter(student_id=request.user.extrainfo.id) + i = Notification.objects.select_related("student_id", "release_id").filter( + student_id=request.user.extrainfo.id + ) for x in i: x.invite_convocation_accept_flag = False x.save() - title_name = request.POST.get('title') - no_of_students = request.POST.get('students') - relevant_document = request.FILES.get('myfile') award, award_id = getAwardId(request) - award_type = request.POST.get('award-type') student_id = request.user.extrainfo.student + brief_description_project = request.POST.get("brief_description_project") + project_grade = request.POST.get("project_grades") + cross_disciplinary = request.POST.get("cross_disciplinary_content") + project_cross_disciplinary = request.POST.get("project_cross_disciplinary") + project_publication = request.POST.get("project_publication") + project_type = request.POST.get("project_type") + patent_ipr_project = request.POST.get("project_patent_ipr") + prototype_available = request.POST.get("prototype") + team_members_name = request.POST.get("members_name") + team_members_cpi = request.POST.get("members_cpi") + project_evaluation_prototype = request.POST.get("project_prototype") + project_utility = request.POST.get("project_utility") + sports_cultural = request.POST.get("project_sports") + sci = request.POST.get("sci") + esci = request.POST.get("esci") + scie = request.POST.get("scie") + ij = request.POST.get("ij") + ic = request.POST.get("ic") + nc = request.POST.get("nc") + workshop = request.POST.get("workshop") + + project_evaluation_prototype_doc = ( + request.FILES.get("project_prototype_doc") or None + ) + project_utility_doc = request.FILES.get("project_utility_doc") or None + sports_cultural_doc = request.FILES.get("project_sports_doc") or None + project_cross_disciplinary_doc = ( + request.FILES.get("project_cross_disciplinary_doc") or None + ) + sci_doc = request.FILES.get("sci_doc") or None + esci_doc = request.FILES.get("esci_doc") or None + scie_doc = request.FILES.get("scie_doc") or None + ij_doc = request.FILES.get("ij_doc") or None + ic_doc = request.FILES.get("ic_doc") or None + nc_doc = request.FILES.get("nc_doc") or None + workshop_doc = request.FILES.get("workshop_doc") or None + + data_insert = { + "award_id": award_id, + "brief_description_project": brief_description_project, + "project_grade": project_grade, + "cross_disciplinary": cross_disciplinary, + "project_publication": project_publication, + "project_type": project_type, + "patent_ipr_project": patent_ipr_project, + "prototype_available": prototype_available, + "team_members_name": team_members_name, + "team_members_cpi": team_members_cpi, + "project_evaluation_prototype": project_evaluation_prototype, + "project_utility": project_utility, + "sports_cultural": sports_cultural, + "sci": sci, + "esci": esci, + "scie": scie, + "ij": ij, + "ic": ic, + "nc": nc, + "workshop": workshop, + } try: - roll_no1 = int(request.POST.get('roll_no1')) - except: - roll_no1 = 0 - try: - roll_no2 = int(request.POST.get('roll_no2')) - except: - roll_no2 = 0 - try: - roll_no3 = int(request.POST.get('roll_no3')) - except: - roll_no3 = 0 - try: - roll_no4 = int(request.POST.get('roll_no4')) - except: - roll_no4 = 0 - try: - roll_no5 = int(request.POST.get('roll_no5')) - except: - roll_no5 = 0 - ece_topic = request.POST.get('ece_topic') - cse_topic = request.POST.get('cse_topic') - mech_topic = request.POST.get('mech_topic') - design_topic = request.POST.get('design_topic') - ece_percentage = int(request.POST.get('ece_percentage')) - cse_percentage = int(request.POST.get('cse_percentage')) - mech_percentage = int(request.POST.get('mech_percentage')) - design_percentage = int(request.POST.get('design_percentage')) - brief_description = request.POST.get('brief_description') - justification = request.POST.get('justification') - correspondence_address = request.POST.get('c_address') - financial_assistance = request.POST.get('financial_assistance') - grand_total = request.POST.get('grand_total') - nearest_policestation = request.POST.get('nps') - nearest_railwaystation = request.POST.get('nrs') - data_insert={ - "title_name":title_name, - "award_type":award_type, - "nearest_policestation":nearest_policestation, - "nearest_railwaystation":nearest_railwaystation, - "correspondence_address":correspondence_address, - "financial_assistance":financial_assistance, - "brief_description":brief_description, - "justification":justification, - "grand_total":grand_total, - "ece_topic":ece_topic, - "cse_topic":cse_topic, - "mech_topic":mech_topic, - "design_topic":design_topic, - "ece_percentage":ece_percentage, - "cse_percentage":cse_percentage, - "mech_percentage":mech_percentage, - "design_percentage":design_percentage, - "correspondence_address":correspondence_address, - "financial_assistance":financial_assistance, - "grand_total":grand_total, - "nearest_policestation":nearest_policestation, - "nearest_railwaystation":nearest_railwaystation + for column in DM_Proficiency_Gold_list: + validate( + instance=data_insert[column], schema=DM_Proficiency_Gold_schema[column] + ) + releases = Release.objects.filter( + Q( + startdate__lte=datetime.datetime.today().strftime("%Y-%m-%d"), + enddate__gte=datetime.datetime.today().strftime("%Y-%m-%d"), + ) + ).filter(award="Convocation Medals") + for release in releases: + existingRelease = ( + DM_Proficiency_gold.objects.select_related("student", "award_id") + .filter(Q(date__gte=release.startdate, date__lte=release.enddate)) + .filter(student=request.user.extrainfo.student) + ) + if existingRelease: + existingRelease.update( + student=student_id, + award_id=award_id, + brief_description_project=brief_description_project, + project_grade=project_grade, + cross_disciplinary=cross_disciplinary, + project_cross_disciplinary=project_cross_disciplinary, + project_publication=project_publication, + project_type=project_type, + patent_ipr_project=patent_ipr_project, + prototype_available=prototype_available, + team_members_name=team_members_name, + team_members_cpi=team_members_cpi, + project_evaluation_prototype=project_evaluation_prototype, + project_utility=project_utility, + sports_cultural=sports_cultural, + sci=sci, + esci=esci, + scie=scie, + ij=ij, + ic=ic, + nc=nc, + workshop=workshop, + project_evaluation_prototype_doc=project_evaluation_prototype_doc, + project_utility_doc=project_utility_doc, + sports_cultural_doc=sports_cultural_doc, + project_cross_disciplinary_doc=project_cross_disciplinary_doc, + sci_doc=sci_doc, + esci_doc=esci_doc, + scie_doc=scie_doc, + ij_doc=ij_doc, + ic_doc=ic_doc, + nc_doc=nc_doc, + workshop_doc=workshop_doc, + status="INCOMPLETE", + ) + messages.success( + request, award + " Application is successfully updated" + ) + break + else: + DM_Proficiency_gold.objects.create( + student=student_id, + award_id=award_id, + brief_description_project=brief_description_project, + project_grade=project_grade, + cross_disciplinary=cross_disciplinary, + project_cross_disciplinary=project_cross_disciplinary, + project_publication=project_publication, + project_type=project_type, + patent_ipr_project=patent_ipr_project, + prototype_available=prototype_available, + team_members_name=team_members_name, + team_members_cpi=team_members_cpi, + project_evaluation_prototype=project_evaluation_prototype, + project_utility=project_utility, + sports_cultural=sports_cultural, + sci=sci, + esci=esci, + scie=scie, + ij=ij, + ic=ic, + nc=nc, + workshop=workshop, + project_evaluation_prototype_doc=project_evaluation_prototype_doc, + project_utility_doc=project_utility_doc, + sports_cultural_doc=sports_cultural_doc, + project_cross_disciplinary_doc=project_cross_disciplinary_doc, + sci_doc=sci_doc, + esci_doc=esci_doc, + scie_doc=scie_doc, + ij_doc=ij_doc, + ic_doc=ic_doc, + nc_doc=nc_doc, + workshop_doc=workshop_doc, + ) + messages.success( + request, award + " Application is successfully submitted" + ) + break + except ValidationError as exc: + messages.error(column + " : " + str(exc)) + request.session["last_clicked"] = "Submit_dm" + return HttpResponseRedirect("/spacs/student_view") + + +def submitProficiency(request): + i = Notification.objects.select_related("student_id", "release_id").filter( + student_id=request.user.extrainfo.id + ) + for x in i: + x.invite_convocation_accept_flag = False + x.save() + award, award_id = getAwardId(request) + student_id = request.user.extrainfo.student + project_objectives = request.POST.get("project_objectives") + project_mentor = request.POST.get("project_mentor") + project_outcome = request.POST.get("project_outcome") + project_publications = request.POST.get("project_publication") + research_Or_Patent_Detail = request.POST.get("project_ipr") + project_Beneficial = request.POST.get("project_benefits") + improvement_Done = request.POST.get("project_justification") + project_title = request.POST.get("project_title") + project_abstract = request.POST.get("project_brief") + sci = request.POST.get("sci") + esci = request.POST.get("esci") + scie = request.POST.get("scie") + ij = request.POST.get("ij") + ic = request.POST.get("ic") + nc = request.POST.get("nc") + indian_national_Conference = request.POST.get("ic_nc") + international_Conference = request.POST.get("international_conference") + project_grade = request.POST.get("project_grade") + patent_Status = request.POST.get("patent_status") + interdisciplinary_Criteria = request.POST.get("interdisciplinary_criteria") + awards_Recieved_Workshop = request.POST.get("awards_recieved") + placement_Status = request.POST.get("placement_status") + workshop = request.POST.get("workshop") + prototype = request.POST.get("thesis_prototype") + utility = request.POST.get("thesis_utility") + core_Area = request.POST.get("thesis_core_area") + technology_Transfer = request.POST.get("work_details") + project_write_up = request.POST.get("project_write_up") + + project_report = request.FILES.get("project_report") or None + sci_doc = request.FILES.get("sci_doc") or None + esci_doc = request.FILES.get("esci_doc") or None + scie_doc = request.FILES.get("scie_doc") or None + ij_doc = request.FILES.get("ij_doc") or None + ic_doc = request.FILES.get("ic_doc") or None + nc_doc = request.FILES.get("nc_doc") or None + indian_national_Conference_doc = request.FILES.get("ic_nc_doc") or None + international_Conference_doc = ( + request.FILES.get("internation_conference_doc") or None + ) + workshop_doc = request.FILES.get("workshop_doc") or None + prototype_doc = request.FILES.get("thesis_prototype_doc") or None + utility_doc = request.FILES.get("thesis_utility_doc") or None + core_Area_doc = request.FILES.get("thesis_core_area_doc") or None + technology_Transfer_doc = request.FILES.get("work_details_doc") or None + + data_insert = { + "project_objectives": project_objectives, + "project_mentor": project_mentor, + "project_outcome": project_outcome, + "research_Or_Patent_Detail": research_Or_Patent_Detail, + "project_Beneficial": project_Beneficial, + "improvement_Done": improvement_Done, + "sci": sci, + "esci": esci, + "scie": scie, + "ij": ij, + "ic": ic, + "nc": nc, + "indian_national_Conference": indian_national_Conference, + "international_Conference": international_Conference, + "patent_Status": patent_Status, + "interdisciplinary_Criteria": interdisciplinary_Criteria, + "awards_Recieved_Workshop": awards_Recieved_Workshop, + "placement_Status": placement_Status, + "workshop": workshop, + "prototype": prototype, + "utility": utility, + "core_Area": core_Area, + "technology_Transfer": technology_Transfer, } try: - for column in proficiency_list: - validate(instance=data_insert[column], schema=proficiency_schema[column]) - releases = Release.objects.filter(Q(startdate__lte=datetime.datetime.today().strftime( - '%Y-%m-%d'), enddate__gte=datetime.datetime.today().strftime('%Y-%m-%d'))).filter(award="Convocation Medals") + for column in IIITDM_Proficiency_list: + validate( + instance=data_insert[column], schema=IIITDM_Proficiency_schema[column] + ) + releases = Release.objects.filter( + Q( + startdate__lte=datetime.datetime.today().strftime("%Y-%m-%d"), + enddate__gte=datetime.datetime.today().strftime("%Y-%m-%d"), + ) + ).filter(award="Convocation Medals") for release in releases: - existingRelease = Proficiency_dm.objects.select_related('student','award_id').filter(Q(date__gte=release.startdate, date__lte=release.enddate)).filter(student=request.user.extrainfo.student) + existingRelease = ( + IIITDM_Proficiency.objects.select_related("student", "award_id") + .filter(Q(date__gte=release.startdate, date__lte=release.enddate)) + .filter(student=request.user.extrainfo.student) + ) if existingRelease: existingRelease.update( - title_name=title_name, - no_of_students=no_of_students, student=student_id, award_id=award_id, - award_type=award_type, - relevant_document=relevant_document, - roll_no1=roll_no1, - roll_no2=roll_no2, - roll_no3=roll_no3, - roll_no4=roll_no4, - roll_no5=roll_no5, - ece_topic=ece_topic, - cse_topic=cse_topic, - mech_topic=mech_topic, - design_topic=design_topic, - ece_percentage=ece_percentage, - cse_percentage=cse_percentage, - mech_percentage=mech_percentage, - design_percentage=design_percentage, - brief_description=brief_description, - correspondence_address=correspondence_address, - financial_assistance=financial_assistance, - grand_total=grand_total, - nearest_policestation=nearest_policestation, - nearest_railwaystation=nearest_railwaystation, - justification=justification, - status='INCOMPLETE' + project_objectives=project_objectives, + project_mentor=project_mentor, + project_outcome=project_outcome, + project_publications=project_publications, + research_Or_Patent_Detail=research_Or_Patent_Detail, + project_Beneficial=project_Beneficial, + improvement_Done=improvement_Done, + project_title=project_title, + project_abstract=project_abstract, + sci=sci, + esci=esci, + scie=scie, + ij=ij, + ic=ic, + nc=nc, + indian_national_Conference=indian_national_Conference, + international_Conference=international_Conference, + project_grade=project_grade, + patent_Status=patent_Status, + interdisciplinary_Criteria=interdisciplinary_Criteria, + awards_Recieved_Workshop=awards_Recieved_Workshop, + placement_Status=placement_Status, + workshop=workshop, + prototype=prototype, + utility=utility, + core_Area=core_Area, + technology_Transfer=technology_Transfer, + project_write_up=project_write_up, + project_report=project_report, + sci_doc=sci_doc, + esci_doc=esci_doc, + scie_doc=scie_doc, + ij_doc=ij_doc, + ic_doc=ic_doc, + nc_doc=nc_doc, + indian_national_Conference_doc=indian_national_Conference_doc, + international_Conference_doc=international_Conference_doc, + workshop_doc=workshop_doc, + prototype_doc=prototype_doc, + utility_doc=utility_doc, + core_Area_doc=core_Area_doc, + technology_Transfer_doc=technology_Transfer_doc, + status="INCOMPLETE", ) messages.success( - request, award + ' Application is successfully updated') + request, award + " Application is successfully updated" + ) break else: - Proficiency_dm.objects.create( - title_name=title_name, - no_of_students=no_of_students, + IIITDM_Proficiency.objects.create( student=student_id, award_id=award_id, - award_type=award_type, - relevant_document=relevant_document, - roll_no1=roll_no1, - roll_no2=roll_no2, - roll_no3=roll_no3, - roll_no4=roll_no4, - roll_no5=roll_no5, - ece_topic=ece_topic, - cse_topic=cse_topic, - mech_topic=mech_topic, - design_topic=design_topic, - ece_percentage=ece_percentage, - cse_percentage=cse_percentage, - mech_percentage=mech_percentage, - design_percentage=design_percentage, - brief_description=brief_description, - correspondence_address=correspondence_address, - financial_assistance=financial_assistance, - grand_total=grand_total, - nearest_policestation=nearest_policestation, - nearest_railwaystation=nearest_railwaystation, - justification=justification + project_objectives=project_objectives, + project_mentor=project_mentor, + project_outcome=project_outcome, + project_publications=project_publications, + research_Or_Patent_Detail=research_Or_Patent_Detail, + project_Beneficial=project_Beneficial, + improvement_Done=improvement_Done, + project_title=project_title, + project_abstract=project_abstract, + sci=sci, + esci=esci, + scie=scie, + ij=ij, + ic=ic, + nc=nc, + indian_national_Conference=indian_national_Conference, + international_Conference=international_Conference, + project_grade=project_grade, + patent_Status=patent_Status, + interdisciplinary_Criteria=interdisciplinary_Criteria, + awards_Recieved_Workshop=awards_Recieved_Workshop, + placement_Status=placement_Status, + workshop=workshop, + prototype=prototype, + utility=utility, + core_Area=core_Area, + technology_Transfer=technology_Transfer, + project_write_up=project_write_up, + project_report=project_report, + sci_doc=sci_doc, + esci_doc=esci_doc, + scie_doc=scie_doc, + ij_doc=ij_doc, + ic_doc=ic_doc, + nc_doc=nc_doc, + indian_national_Conference_doc=indian_national_Conference_doc, + international_Conference_doc=international_Conference_doc, + workshop_doc=workshop_doc, + prototype_doc=prototype_doc, + utility_doc=utility_doc, + core_Area_doc=core_Area_doc, + technology_Transfer_doc=technology_Transfer_doc, ) messages.success( - request, award + ' Application is successfully submitted') + request, award + " Application is successfully submitted" + ) break except ValidationError as exc: messages.error(column + " : " + str(exc)) - request.session['last_clicked'] = 'Submit_dm' - return HttpResponseRedirect('/spacs/student_view') + request.session["last_clicked"] = "Submit_dm" + return HttpResponseRedirect("/spacs/student_view") + def submitPreviousWinner(request): request.session["last_clicked"] = "SubmitPreviousWinner" @@ -993,7 +1638,9 @@ def submitPreviousWinner(request): request.session["PreviousWinnerProgramme"] = PreviousWinnerProgramme award = Award_and_scholarship.objects.get(award_name=PreviousWinnerAward) - winners = Previous_winner.objects.select_related('student','award_id').filter(year=PreviousWinnerAcadYear, award_id=award, programme=PreviousWinnerProgramme) + winners = Previous_winner.objects.select_related("student", "award_id").filter( + year=PreviousWinnerAcadYear, award_id=award, programme=PreviousWinnerProgramme + ) paginator = Paginator(winners, 10) page = 1 @@ -1006,17 +1653,20 @@ def submitPreviousWinner(request): winners_list = paginator.page(paginator.num_pages) return winners_list + def sendConvenerRenderRequest(request, additionalParams={}): context = getCommonParams(request) ch = Constants.BATCH source = Constants.FATHER_OCC_CHOICE time = Constants.TIME release = Release.objects.all() - notification = Notification.objects.select_related('student_id','release_id').all() spi = Spi.objects.all() - context.update({ 'source': source, 'time': time, 'ch': ch, 'spi': spi, 'release': release}) + context.update( + {"source": source, "time": time, "ch": ch, "spi": spi, "release": release} + ) context.update(additionalParams) - return render(request, 'scholarshipsModule/scholarships_convener.html', context) + return render(request, "scholarshipsModule/scholarships_convener.html", context) + def sendStudentRenderRequest(request, additionalParams={}): context = getCommonParams(request) @@ -1027,10 +1677,31 @@ def sendStudentRenderRequest(request, additionalParams={}): release = Release.objects.all() release_count = release.count() spi = Spi.objects.all() - no_of_mcm_filled = len(Mcm.objects.select_related('award_id','student').filter( - student=request.user.extrainfo.student)) - no_of_con_filled = len(Director_silver.objects.select_related('student','award_id').filter(student=request.user.extrainfo.student)) + len(Director_gold.objects.select_related('student','award_id').filter( - student=request.user.extrainfo.student)) + len(Proficiency_dm.objects.select_related('student','award_id').filter(student=request.user.extrainfo.student)) + no_of_mcm_filled = len( + Mcm.objects.select_related("award_id", "student").filter( + student=request.user.extrainfo.student + ) + ) + no_of_con_filled = 0 + len( + Director_silver.objects.select_related("student", "award_id").filter( + student=request.user.extrainfo.student + ) + ) + len( + Director_gold.objects.select_related("student", "award_id").filter( + student=request.user.extrainfo.student + ) + ) + +len( + DM_Proficiency_gold.objects.select_related("student", "award_id").filter( + student=request.user.extrainfo.student + ) + ) + +len( + IIITDM_Proficiency.objects.select_related("student", "award_id").filter( + student=request.user.extrainfo.student + ) + ) # Here we are fetching the flags from the Notification table of student # end of database queries @@ -1039,31 +1710,53 @@ def sendStudentRenderRequest(request, additionalParams={}): update_con_flag = False x_notif_mcm_flag = False x_notif_con_flag = False + student_batch = str(request.user.extrainfo.student.batch) for dates in release: if checkDate(dates.startdate, dates.enddate): - if dates.award == 'Merit-cum-Means Scholarship' and dates.batch == str(request.user.extrainfo.student)[0:4] and dates.programme == request.user.extrainfo.student.programme: + if ( + dates.award == "Merit-cum-Means Scholarship" + and dates.batch == student_batch + and dates.programme == request.user.extrainfo.student.programme + ): x_notif_mcm_flag = True if no_of_mcm_filled > 0: update_mcm_flag = True - elif dates.award == 'Convocation Medals' and dates.batch == str(request.user.extrainfo.student)[0:4] and dates.programme == request.user.extrainfo.student.programme: + elif ( + dates.award == "Convocation Medals" + and dates.batch == student_batch + and dates.programme == request.user.extrainfo.student.programme + ): x_notif_con_flag = True if no_of_con_filled > 0: update_con_flag = True else: - if dates.award == "Merit-cum-Means Scholarship" and dates.batch == str(request.user.extrainfo.student)[0:4]: + if ( + dates.award == "Merit-cum-Means Scholarship" + and dates.batch == student_batch + ): try: - x = Notification.objects.select_related('student_id','release_id').get( - student_id=request.user.extrainfo.id, release_id=dates.id).delete() + x = ( + Notification.objects.select_related("student_id", "release_id") + .get(student_id=request.user.extrainfo.id, release_id=dates.id) + .delete() + ) except: pass - elif dates.award == 'Convocation Medals' and dates.batch == str(request.user.extrainfo.student)[0:4]: + elif dates.award == "Convocation Medals" and dates.batch == student_batch: try: - x = Notification.objects.select_related('student_id','release_id').get( - student_id=request.user.extrainfo.id, release_id=dates.id).delete() + x = ( + Notification.objects.select_related("student_id", "release_id") + .get(student_id=request.user.extrainfo.id, release_id=dates.id) + .delete() + ) except: pass - x = Notification.objects.select_related('student_id','release_id').filter(student_id=request.user.extrainfo.id).order_by('-release_id__date_time') + x = ( + Notification.objects.select_related("student_id", "release_id") + .filter(student_id=request.user.extrainfo.id) + .order_by("-release_id__date_time") + ) show_mcm_flag = False show_convocation_flag = False for i in x: @@ -1074,42 +1767,80 @@ def sendStudentRenderRequest(request, additionalParams={}): if i.invite_convocation_accept_flag == True: show_convocation_flag = True break - context.update({'time': time, 'ch': ch, 'spi': spi, 'release': release, - 'release_count': release_count, 'x_notif_mcm_flag': x_notif_mcm_flag, 'x_notif_con_flag': x_notif_con_flag, - 'source': source, 'show_mcm_flag': show_mcm_flag, 'show_convocation_flag': show_convocation_flag, - 'update_mcm_flag': update_mcm_flag, 'update_con_flag': update_con_flag, 'mother_occ': mother_occ,'x': x}) + context.update( + { + "time": time, + "ch": ch, + "spi": spi, + "release": release, + "release_count": release_count, + "x_notif_mcm_flag": x_notif_mcm_flag, + "x_notif_con_flag": x_notif_con_flag, + "source": source, + "show_mcm_flag": show_mcm_flag, + "show_convocation_flag": show_convocation_flag, + "update_mcm_flag": update_mcm_flag, + "update_con_flag": update_con_flag, + "mother_occ": mother_occ, + "x": x, + } + ) context.update(additionalParams) - return render(request, 'scholarshipsModule/scholarships_student.html',context) + return render(request, "scholarshipsModule/scholarships_student.html", context) + def sendStaffRenderRequest(request, additionalParams={}): context = getCommonParams(request) context.update(additionalParams) - return render(request, 'scholarshipsModule/scholarships_staff.html', context) + return render(request, "scholarshipsModule/scholarships_staff.html", context) + def sendStatsRenderRequest(request, additionalParams={}): context = getCommonParams(request) context.update(additionalParams) - return render(request, 'scholarshipsModule/stats.html', context) + return render(request, "scholarshipsModule/stats.html", context) + def getCommonParams(request): student = Student.objects.all() - mcm = Mcm.objects.select_related('award_id','student').all() - gold = Director_gold.objects.select_related('student','award_id').all() - silver = Director_silver.objects.select_related('student','award_id').all() - dandm = Proficiency_dm.objects.select_related('student','award_id').all() + mcm = Mcm.objects.select_related("award_id", "student").all().values() + gold = Director_gold.objects.select_related("student", "award_id").all() + silver = Director_silver.objects.select_related("student", "award_id").all() + dandm = DM_Proficiency_gold.objects.select_related("student", "award_id").all() + proficiency = IIITDM_Proficiency.objects.select_related("student", "award_id").all() awards = Award_and_scholarship.objects.all() - con = Designation.objects.get(name='spacsconvenor') - assis = Designation.objects.get(name='spacsassistant') - hd = HoldsDesignation.objects.get(designation=con) - hd1 = HoldsDesignation.objects.get(designation=assis) + con = Designation.objects.get(name="spacsconvenor") + assis = Designation.objects.get(name="spacsassistant") + hd = None + hd1 = None + try: + hd = HoldsDesignation.objects.get(designation=con) + hd1 = HoldsDesignation.objects.get(designation=assis) + except: + print("spcacsconvenor or spcacsassistant") year_range = range(2013, datetime.datetime.now().year + 1) - active_batches = range(datetime.datetime.now().year - 4 , datetime.datetime.now().year + 1) - last_clicked = '' + active_batches = range( + datetime.datetime.now().year - 4, datetime.datetime.now().year + 1 + ) + last_clicked = "" try: - last_clicked = request.session['last_clicked'] + last_clicked = request.session["last_clicked"] except: - print('last_clicked not found') - context = {'mcm': mcm, 'awards': awards, 'student': student, 'gold': gold, 'silver': silver, - 'dandm': dandm, 'con': con, 'assis': assis, 'hd': hd, 'hd1': hd1, - 'last_clicked': last_clicked, 'year_range': year_range, 'active_batches': active_batches} + print("last_clicked not found") + context = { + "mcm": mcm, + "awards": awards, + "student": student, + "gold": gold, + "silver": silver, + "dandm": dandm, + "proficiency": proficiency, + "con": con, + "assis": assis, + "hd": hd, + "hd1": hd1, + "last_clicked": last_clicked, + "year_range": year_range, + "active_batches": active_batches, + } return context diff --git a/FusionIIIT/applications/visitor_hostel/api/serializers.py b/FusionIIIT/applications/visitor_hostel/api/serializers.py new file mode 100644 index 000000000..d2384e6a3 --- /dev/null +++ b/FusionIIIT/applications/visitor_hostel/api/serializers.py @@ -0,0 +1,54 @@ +from django.contrib.auth import get_user_model +from rest_framework.authtoken.models import Token +from rest_framework import serializers +from applications.visitor_hostel.models import VisitorDetail, BookingDetail, InventoryBill, MealRecord, RoomDetail, Bill, Inventory +from applications.globals.models import ExtraInfo,User + +class VisitorDetailSerializer(serializers.ModelSerializer): + + class Meta: + model=VisitorDetail + fields=('__all__') + +class BookingDetailSerializer(serializers.ModelSerializer): + class Meta: + model = BookingDetail + fields=('__all__') + +class InventorySerializer(serializers.ModelSerializer): + class Meta: + model = Inventory + fields=('__all__') + +class InventoryBillSerializer(serializers.ModelSerializer): + class Meta: + model = InventoryBill + fields=('__all__') + +class MealRecordSerializer(serializers.ModelSerializer): + class Meta: + model=MealRecord + fields=('__all__') + +class RoomDetailSerializer(serializers.ModelSerializer): + class Meta: + model=RoomDetail + fields=('__all__') + +class BillSerializer(serializers.ModelSerializer): + class Meta: + model=Bill + fields=('__all__') + +class ExtraInfoSerializer(serializers.ModelSerializer): + class Meta: + model=ExtraInfo + fields=('__all__') + +class UserSerializer(serializers.ModelSerializer): + class Meta: + model=User + fields=('__all__') + +class BookingDetailListSerializer(serializers.ListSerializer): + child = BookingDetailSerializer() \ No newline at end of file diff --git a/FusionIIIT/applications/visitor_hostel/api/urls.py b/FusionIIIT/applications/visitor_hostel/api/urls.py new file mode 100644 index 000000000..d88e5f5ac --- /dev/null +++ b/FusionIIIT/applications/visitor_hostel/api/urls.py @@ -0,0 +1,31 @@ +from django.conf.urls import url, include + +from . import views + + +urlpatterns = [ + + url(r'^visitorhostel/', views.visitorhostel, name='visitorhostel'), + url(r'^get-booking-requests/', views.get_booking_requests, name='get_booking_requests'), + url(r'^get-active-bookings/', views.get_active_bookings, name='get_active_bookings'), + url(r'^get-inactive-bookings/', views.get_inactive_bookings, name='get_inactive_bookings'), + # url(r'^get-booking-form/', views.get_booking_form, name='get_booking_form'), + url(r'^request-booking/' , views.request_booking , name ='request_booking'), + url(r'^confirm-booking/' , views.confirm_booking , name ='confirm_booking'), + url(r'^cancel-booking/', views.cancel_booking, name = 'cancel_booking'), + url(r'^cancel-booking-request/', views.cancel_booking_request, name = 'cancel_booking_request'), + url(r'^reject-booking/', views.reject_booking, name = 'reject_booking'), + url(r'^check-in/', views.check_in, name = 'check_in'), + url(r'^check-out/', views.check_out, name = 'check_out'), + url(r'^record-meal/', views.record_meal, name = 'record_meal'), + # url(r'^bill/', views.bill_generation, name = 'bill_generation'), + url(r'^update-booking/', views.update_booking, name = 'update_booking'), + + url(r'^bill_between_date_range/', views.bill_between_dates, name = 'generate_records'), + url(r'^room-availability/', views.room_availabity, name = 'room_availabity'), + url(r'^add-to-inventory/', views.add_to_inventory, name = 'add_to_inventory'), + url(r'^update-inventory/', views.update_inventory, name = 'update_inventory'), + url(r'^edit-room-status/', views.edit_room_status, name = 'edit_room_status'), + url(r'^booking-details/', views.booking_details, name = 'booking_details'), + url(r'^forward-booking/', views.forward_booking, name = 'forward_booking') +] \ No newline at end of file diff --git a/FusionIIIT/applications/visitor_hostel/api/views.py b/FusionIIIT/applications/visitor_hostel/api/views.py new file mode 100644 index 000000000..65d455059 --- /dev/null +++ b/FusionIIIT/applications/visitor_hostel/api/views.py @@ -0,0 +1,933 @@ +import datetime +from datetime import date +from django.shortcuts import get_object_or_404 +from Fusion import settings +from applications.visitor_hostel.models import RoomDetail +from django.contrib.auth.models import User +from rest_framework.permissions import IsAuthenticated +from rest_framework.authentication import TokenAuthentication +from rest_framework import status +from rest_framework.decorators import api_view, permission_classes,authentication_classes + +from django.db.models import Q +import os + +from django.core.files.storage import FileSystemStorage +from applications.globals.models import * +from applications.visitor_hostel.forms import * +from applications.visitor_hostel.models import * + +import json + +# from notification.views import visitor_hostel_caretaker_notif +import numpy as np +from django.contrib.auth.models import User +from rest_framework.response import Response +# # for notifications +from notification.views import visitors_hostel_notif +from . import serializers + +# main page showing dashboard of user + +@api_view(['GET']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def visitorhostel(request): + + # intenders + intenders = User.objects.all() + user = request.user + # intender = request.user.holds_designations.filter(designation__name = 'Intender').exists() + vhcaretaker = request.user.holds_designations.filter( + designation__name='VhCaretaker').exists() + vhincharge = request.user.holds_designations.filter( + designation__name='VhIncharge').exists() + + # finding designation of user + print("1") + + user_designation = "student" + if vhincharge: + user_designation = "VhIncharge" + elif vhcaretaker: + user_designation = "VhCaretaker" + else: + user_designation = "Intender" + + available_rooms = {} + forwarded_rooms = {} + cancel_booking_request = [] + + # bookings for intender view + if (user_designation == "Intender"): + print("2") + all_bookings = BookingDetail.objects.select_related('intender','caretaker').all().order_by('booking_from') + pending_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status="Pending") | Q(status="Forward"), booking_to__gte=datetime.datetime.today(), intender=user).order_by('booking_from') + active_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(status="CheckedIn", booking_to__gte=datetime.datetime.today(), intender=user).order_by('booking_from') + dashboard_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status = "Pending") | Q(status="Forward") | Q(status = "Confirmed") | Q(status = 'Rejected'), booking_to__gte=datetime.datetime.today(), intender=user).order_by('booking_from') + # print(dashboard_bookings.booking_from) + + visitors = {} + rooms = {} + for booking in active_bookings: + temp = range(2, booking.person_count + 1) + visitors[booking.id] = temp + + for booking in active_bookings: + for room_no in booking.rooms.all(): + temp2 = range(1, booking.number_of_rooms_alloted) + rooms[booking.id] = temp2 + + complete_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(booking_to__lt=datetime.datetime.today(), intender=user).order_by('booking_from') + canceled_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(status="Canceled", intender=user).order_by('booking_from') + rejected_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(status='Rejected', intender=user).order_by('booking_from') + cancel_booking_requested = BookingDetail.objects.select_related('intender','caretaker').filter(status='CancelRequested', intender=user).order_by('booking_from') + + + else: # booking for caretaker and incharge view + all_bookings = BookingDetail.objects.select_related('intender','caretaker').all().order_by('booking_from') + pending_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status="Pending") | Q(status="Forward"), booking_to__gte=datetime.datetime.today()).order_by('booking_from') + active_bookings = BookingDetail.objects.filter(Q(status="Confirmed") | Q(status="CheckedIn"), booking_to__gte=datetime.datetime.today()).select_related('intender','caretaker').order_by('booking_from') + cancel_booking_request = BookingDetail.objects.select_related('intender','caretaker').filter(status="CancelRequested", booking_to__gte=datetime.datetime.today()).order_by('booking_from') + dashboard_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status = "Pending") | Q(status="Forward") | Q(status = "Confirmed"), booking_to__gte=datetime.datetime.today()).order_by('booking_from') + visitors = {} + rooms = {} + + # x = BookingDetail.objects.all().annotate(rooms_count=Count('rooms')) + + c_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status="Forward"), booking_to__gte=datetime.datetime.today()).order_by('booking_from') + + # number of visitors + for booking in active_bookings: + temp = range(2, booking.person_count + 1) + visitors[booking.id] = temp + + + # rooms alloted to booking + for booking in active_bookings: + for room_no in booking.rooms.all(): + temp2 = range(2, booking.number_of_rooms_alloted + 1) + rooms[booking.id] = temp2 + #print(booking.rooms.all()) + + print("3") + complete_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status="Canceled") | Q(status="Complete"), booking_to__lt=datetime.datetime.today()).select_related().order_by('booking_from') + canceled_bookings = BookingDetail.objects.filter(status="Canceled").select_related('intender','caretaker').order_by('booking_from') + cancel_booking_requested = BookingDetail.objects.select_related('intender','caretaker').filter(status='CancelRequested', booking_to__gte=datetime.datetime.today(), intender=user).order_by('booking_from') + rejected_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(status='Rejected').order_by('booking_from') + + # finding available room list for alloting rooms + for booking in pending_bookings: + booking_from = booking.booking_from + booking_to = booking.booking_to + temp1 = booking_details(booking_from, booking_to) + available_rooms[booking.id] = temp1 + + # forwarded rooms details + for booking in c_bookings: + booking_from = booking.booking_from + booking_to = booking.booking_to + temp2 = forwarded_booking_details(booking_from, booking_to) + forwarded_rooms[booking.id] = temp2 + # inventory data + inventory = Inventory.objects.all() + inventory_bill = InventoryBill.objects.select_related('item_name').all() + + # completed booking bills + + completed_booking_bills = {} + all_bills = Bill.objects.select_related() + + current_balance = 0 + for bill in all_bills: + completed_booking_bills[bill.id] = {'intender': str(bill.booking.intender), 'booking_from': str(bill.booking.booking_from), 'booking_to': str(bill.booking.booking_to), 'total_bill': str(bill.meal_bill + bill.room_bill)} + current_balance = current_balance+bill.meal_bill + bill.room_bill + + for inv_bill in inventory_bill: + current_balance = current_balance - inv_bill.cost + + active_visitors = {} + for booking in active_bookings: + if booking.status == 'CheckedIn': + for visitor in booking.visitor.all(): + active_visitors[booking.id] = visitor + + # edit_room_statusForm=RoomStatus.objects.filter(Q(status="UnderMaintenance") | Q(status="Available")) + + previous_visitors = VisitorDetail.objects.all() + + # ------------------------------------------------------------------------------------------------------------------------------ + bills = {} + print("3") + for booking in active_bookings: + if booking.status == 'CheckedIn': + rooms = booking.rooms.all() + days = (datetime.date.today() - booking.check_in).days + category = booking.visitor_category + person = booking.person_count + + room_bill = 0 + if days == 0: + days = 1 + + if category == 'A': + room_bill = 0 + elif category == 'B': + for i in rooms: + if i.room_type == 'SingleBed': + room_bill = room_bill+days*400 + else: + room_bill = room_bill+days*500 + elif category == 'C': + for i in rooms: + if i.room_type == 'SingleBed': + room_bill = room_bill+days*800 + else: + room_bill = room_bill+days*1000 + else: + for i in rooms: + if i.room_type == 'SingleBed': + room_bill = room_bill+days*1400 + else: + room_bill = room_bill+days*1600 + + mess_bill = 0 + for visitor in booking.visitor.all(): + meal = MealRecord.objects.select_related('booking__intender','booking__caretaker','visitor','room').filter(visitor=visitor) + + mess_bill1 = 0 + for m in meal: + if m.morning_tea == True: + mess_bill1 = mess_bill1+10 + if m.eve_tea == True: + mess_bill1 = mess_bill1+10 + if m.breakfast == True: + mess_bill1 = mess_bill1+50 + if m.lunch == True: + mess_bill1 = mess_bill1+100 + if m.dinner == True: + mess_bill1 = mess_bill1+100 + + if mess_bill1 == 270: + mess_bill = mess_bill+225 + else: + mess_bill = mess_bill + mess_bill1 + + total_bill = mess_bill + room_bill + + bills[booking.id] = {'mess_bill': mess_bill, + 'room_bill': room_bill, 'total_bill': total_bill} + + # print(available_rooms) + # ------------------------------------------------------------------------------------------------------------------------------- + + visitor_list = [] + for b in dashboard_bookings: + count=1 + b_visitor_list = b.visitor.all() + for v in b_visitor_list: + if count == 1: + visitor_list.append(v) + count = count+1 + + # ------------------------------------------------------------------------------------------------------------------------------- + # Serialization + + all_bookings = serializers.BookingDetailSerializer(all_bookings, many=True).data + + complete_bookings = serializers.BookingDetailSerializer(complete_bookings, many=True).data + + pending_bookings = serializers.BookingDetailSerializer(pending_bookings, many=True).data + + active_bookings = serializers.BookingDetailSerializer(active_bookings, many=True).data + + canceled_bookings = serializers.BookingDetailSerializer(canceled_bookings, many=True).data + + dashboard_bookings = serializers.BookingDetailSerializer(dashboard_bookings, many=True).data + + bills = serializers.BillSerializer(bills, many=True).data + + available_rooms = serializers.RoomDetailSerializer(available_rooms, many=True).data + + forwarded_rooms = serializers.RoomDetailSerializer(forwarded_rooms, many=True).data + + inventory = serializers.InventorySerializer(inventory, many=True).data + + inventory_bill = serializers.InventoryBillSerializer(inventory_bill, many=True).data + + + previous_visitors = serializers.VisitorDetailSerializer(previous_visitors, many=True).data + + completed_booking_bills = serializers.BillSerializer(completed_booking_bills, many=True).data + # current_balance + + rejected_bookings = serializers.BookingDetailSerializer(rejected_bookings, many=True).data + + cancel_booking_request = serializers.BookingDetailListSerializer(cancel_booking_request, many=True).data + + cancel_booking_requested = serializers.BookingDetailSerializer(cancel_booking_requested, many=True).data + # user_designation + user_serilized = serializers.UserSerializer(instance=user).data + + + response = {'all_bookings': all_bookings, + 'complete_bookings': complete_bookings, + 'pending_bookings': pending_bookings, + 'active_bookings': active_bookings, + 'canceled_bookings': canceled_bookings, + 'dashboard_bookings' : dashboard_bookings, + + 'bills': bills, + 'available_rooms': available_rooms, + 'forwarded_rooms': forwarded_rooms, + 'inventory': inventory, + 'inventory_bill': inventory_bill, + 'active_visitors': active_visitors, + 'user': user, + 'visitors': visitors, + 'rooms' : rooms, + 'previous_visitors': previous_visitors, + 'completed_booking_bills': completed_booking_bills, + 'current_balance': current_balance, + 'rejected_bookings': rejected_bookings, + 'cancel_booking_request': cancel_booking_request, + 'cancel_booking_requested' : cancel_booking_requested, + 'user_designation': user_designation} + + + return Response(data=response,status=status.HTTP_200_OK) + +# Get methods for bookings + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def get_booking_requests(request): + if request.method == 'POST': + pending_bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter(status="Pending") + serializer = serializers.BookingDetailSerializer(pending_bookings, many=True) + return Response(serializer.data, status=status.HTTP_200_OK) + else: + return Response(data="invalid request method", status=status.HTTP_400_BAD_REQUEST) + +# getting active bookings + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def get_active_bookings(request): + if request.method == 'POST': + active_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(status="Confirmed") + active_bookings = serializers.BookingDetailSerializer(active_bookings, many=True).data + response = {'active_bookings': active_bookings} + return Response(data=response,status=status.HTTP_200_OK) + else: + return Response(data="invalid request method", status=status.HTTP_400_BAD_REQUEST) + + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def get_inactive_bookings(request): + if request.method == 'POST' : + inactive_bookings = BookingDetail.objects.select_related('intender','caretaker').filter( + Q(status="Cancelled") | Q(status="Rejected") | Q(status="Complete")) + + inactive_bookings = serializers.BookingDetailSerializer(inactive_bookings, many=True).data + response = {'inactive_bookings': inactive_bookings} + return Response(data=response,status=status.HTTP_200_OK) + else: + return Response(data="invalid request method", status=status.HTTP_400_BAD_REQUEST) + + +# --------------------------------------------------- + + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def request_booking(request): + + if request.method == 'POST': + flag=0 + + # getting details from request form + intender = request.POST.get('intender') + user = User.objects.get(id=intender) + print(user) + booking_id = request.POST.get('booking-id') + category = request.POST.get('category') + person_count = request.POST.get('number-of-people') + bookingObject = [] + purpose_of_visit = request.POST.get('purpose-of-visit') + booking_from = request.POST.get('booking_from') + booking_to = request.POST.get('booking_to') + booking_from_time = request.POST.get('booking_from_time') + booking_to_time = request.POST.get('booking_to_time') + remarks_during_booking_request = request.POST.get('remarks_during_booking_request') + bill_to_be_settled_by = request.POST.get('bill_settlement') + number_of_rooms = request.POST.get('number-of-rooms') + caretaker = 'shailesh' + + print(len(HoldsDesignation.objects.select_related('user','working','designation').filter(designation__name = "VhCaretaker"))) + care_taker = (HoldsDesignation.objects.select_related('user','working','designation').filter(designation__name = "VhCaretaker")) + care_taker = care_taker[0] + care_taker = care_taker.user + bookingObject = BookingDetail.objects.create( + caretaker = care_taker, + purpose=purpose_of_visit, + intender=user, + booking_from=booking_from, + booking_to=booking_to, + visitor_category=category, + person_count=person_count, + arrival_time=booking_from_time, + departure_time=booking_to_time, + #remark=remarks_during_booking_request, + number_of_rooms=number_of_rooms, + bill_to_be_settled_by=bill_to_be_settled_by) + bookingObject.save() + + + # in case of any attachment + + doc = request.FILES.get('files-during-booking-request') + remark=remarks_during_booking_request, + if doc: + + filename, file_extenstion = os.path.splitext(request.FILES.get('files-during-booking-request').booking_id) + filename = booking_id + full_path = settings.MEDIA_ROOT + "/VhImage/" + url = settings.MEDIA_URL + filename + file_extenstion + if not os.path.isdir(full_path): + cmd = "mkdir " + full_path + os.subprocess.call(cmd, shell=True) + fs = FileSystemStorage(full_path, url) + fs.save(filename + file_extenstion, doc) + uploaded_file_url = "/media/online_cms/" + filename + uploaded_file_url = uploaded_file_url + file_extenstion + bookingObject.image = uploaded_file_url + bookingObject.save() + + # visitor datails from place request form + + visitor_name = request.POST.get('name') + visitor_phone = request.POST.get('phone') + visitor_email = request.POST.get('email') + visitor_address = request.POST.get('address') + visitor_organization = request.POST.get('organization') + visitor_nationality = request.POST.get('nationality') + # visitor_nationality="jk" + if visitor_organization == '': + visitor_organization = ' ' + + visitor = VisitorDetail.objects.create( + visitor_phone=visitor_phone, visitor_name=visitor_name, visitor_email=visitor_email, visitor_address=visitor_address, visitor_organization=visitor_organization + , nationality=visitor_nationality + ) + + # try: + # bd = BookingDetail.objects.get(id=booking_id) + + bookingObject.visitor.add(visitor) + bookingObject.save() + + return Response(status=status.HTTP_201_CREATED, data={"message":"Request submitted successfully"}) + else: + return Response(status=status.HTTP_400_BAD_REQUEST) + + +# updating a booking request + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def update_booking(request): + if request.method == 'POST': + user = request.user + print(request.POST) + + booking_id = request.POST.get('booking-id') + + category = request.POST.get('category') + person_count = request.POST.get('number-of-people') + bookingObject = [] + if person_count: + person_count = person_count + else: + person_count = 1 + purpose_of_visit = request.POST.get('purpose-of-visit') + booking_from = request.POST.get('booking_from') + booking_to = request.POST.get('booking_to') + number_of_rooms = request.POST.get('number-of-rooms') + + # remark = request.POST.get('remark') + booking = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) + booking.person_count = person_count + booking.number_of_rooms = number_of_rooms + booking.booking_from = booking_from + booking.booking_to = booking_to + booking.purpose = purpose_of_visit + booking.save() + + booking = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) + c_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status="Forward"), booking_to__gte=datetime.datetime.today()).order_by('booking_from') + forwarded_rooms = {} + for booking in c_bookings: + booking_from = booking.booking_from + booking_to = booking.booking_to + temp2 = forwarded_booking_details(booking_from, booking_to) + forwarded_rooms[booking.id] = temp2 + return Response(data = {'forwarded_rooms': forwarded_rooms}, status=status.HTTP_200_OK) + + else: + return Response(status = status.HTTP_400_BAD_REQUEST) + + +# confirm booking by VhIncharge + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def confirm_booking(request): + if request.method == 'POST': + booking_id = request.POST.get('booking-id') + intender = request.POST.get('intender'), + category = request.POST.get('category') + purpose = request.POST.get('purpose-of-visit') + booking_from = request.POST.get('booking_from') + booking_to = request.POST.get('booking_to') + person_count = request.POST.get('number-of-people') + + # rooms list + rooms = request.POST.getlist('rooms[]') + + bd = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) + bd.status = 'Confirmed' + bd.category = category + + for room in rooms: + room_object = RoomDetail.objects.get(room_number=room) + bd.rooms.add(room_object) + bd.save() + + # notification of booking confirmation + visitors_hostel_notif(request.user, bd.intender, 'booking_confirmation') + return Response(status=status.HTTP_200_OK) + + else: + return Response(status = status.HTTP_400_BAD_REQUEST) + + + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def cancel_booking(request): + if request.method == 'POST': + user = request.user + print(request.POST) + booking_id = request.POST.get('booking-id') + remark = request.POST.get('remark') + charges = request.POST.get('charges') + BookingDetail.objects.select_related('intender','caretaker').filter(id=booking_id).update( + status='Canceled', remark=remark) + booking = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) + + # if no applicable charges then set charges to zero + x = 0 + if charges: + Bill.objects.create(booking=booking, meal_bill=x, room_bill=int(charges), caretaker=user, payment_status=True) + else: + Bill.objects.create(booking=booking, meal_bill=x, room_bill=x, caretaker=user, payment_status=True) + + complete_bookings = BookingDetail.objects.filter(Q(status="Canceled") | Q(status="Complete"), booking_to__lt=datetime.datetime.today()).select_related('intender','caretaker').order_by('booking_from') + + + # to notify the intender that his cancellation request has been confirmed + + visitors_hostel_notif(request.user, booking.intender, 'booking_cancellation_request_accepted') + return Response(status=status.HTTP_200_OK) + + else: + return Response(status = status.HTTP_400_BAD_REQUEST) + + +# cancel confirmed booking by intender + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def cancel_booking_request(request): + if request.method == 'POST': + intender = request.user.holds_designations.filter(designation__name = 'VhIncharge') + booking_id = request.POST.get('booking-id') + remark = request.POST.get('remark') + BookingDetail.objects.select_related('intender','caretaker').filter(id=booking_id).update(status='CancelRequested', remark=remark) + + incharge_name = HoldsDesignation.objects.select_related('user','working','designation').filter(designation__name = "VhIncharge")[1] + + # to notify the VhIncharge about a new cancelltaion request + + visitors_hostel_notif(request.user, incharge_name.user, 'cancellation_request_placed') + return Response(status=status.HTTP_200_OK) + + else: + return Response(status = status.HTTP_400_BAD_REQUEST) + + +# rehject a booking request + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def reject_booking(request): + if request.method == 'POST': + booking_id = request.POST.get('booking-id') + remark = request.POST.get('remark') + BookingDetail.objects.select_related('intender','caretaker').filter(id=booking_id).update( + status="Rejected", remark=remark) + + # to notify the intender that his request has been rejected + + #visitors_hostel_notif(request.user, booking.intender, 'booking_rejected') + return Response(status=status.HTTP_200_OK) + + else: + return Response(status = status.HTTP_400_BAD_REQUEST) + + +# Guest check in view + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def check_in(request): + if request.method == 'POST': + booking_id = request.POST.get('booking-id') + visitor_name = request.POST.get('name') + visitor_phone = request.POST.get('phone') + visitor_email = request.POST.get('email') + visitor_address = request.POST.get('address') + check_in_date = datetime.date.today() + + # save visitors details + visitor = VisitorDetail.objects.create( + visitor_phone=visitor_phone, visitor_name=visitor_name, visitor_email=visitor_email, visitor_address=visitor_address) + try: + bd = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) + bd.status = "CheckedIn" + bd.check_in = check_in_date + bd.visitor.add(visitor) + bd.save() + + except: + return Response(status=status.HTTP_500_INTERNAL_SERVER_ERROR) + + return Response(status=status.HTTP_200_OK) + + else: + return Response(status = status.HTTP_400_BAD_REQUEST) + + +# guest check out view + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def check_out(request): + user = get_object_or_404(User, username=request.user.username) + c = ExtraInfo.objects.select_related('department').all().filter(user=user) + + if user: + if request.method == 'POST': + id = request.POST.get('id') + meal_bill = request.POST.get('mess_bill') + room_bill = request.POST.get('room_bill') + BookingDetail.objects.select_related('intender','caretaker').filter(id=id).update( + check_out=datetime.datetime.today(), status="Complete") + booking = BookingDetail.objects.select_related('intender','caretaker').get(id=id) + Bill.objects.create(booking=booking, meal_bill=int(meal_bill), room_bill=int( + room_bill), caretaker=user, payment_status=True) + + return Response(status=status.HTTP_200_OK) + + else: + return Response(status = status.HTTP_400_BAD_REQUEST) + + + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def record_meal(request): + user = get_object_or_404(User, username=request.user.username) + c = ExtraInfo.objects.select_related('department').all().filter(user=user) + + if user: + if request.method == "POST": + + id = request.POST.get('pk') + booking_id = request.POST.get('booking') + booking = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) + visitor = VisitorDetail.objects.get(id=id) + date_1 = datetime.datetime.today() + food = request.POST.getlist('food[]') + if '1' in food: + m_tea = True + else: + m_tea = False + + if '4' in food: + e_tea = True + else: + e_tea = False + + if '2' in food: + breakfast = True + else: + breakfast = False + + if '3' in food: + lunch = True + else: + lunch = False + + if '5' in food: + dinner = True + else: + dinner = False + + if request.POST.get('numberofpeople'): + person = request.POST.get('numberofpeople') + else: + person = 1 + + + try: + meal = MealRecord.objects.select_related('booking__intender','booking__caretaker','visitor','room').get( + visitor=visitor, booking=booking, meal_date=date_1) + except: + meal = False + + if meal: + meal.morning_tea = m_tea + meal.eve_tea = e_tea + meal.breakfast = breakfast + meal.lunch = lunch + meal.dinner = dinner + meal.save() + return Response(status=status.HTTP_200_OK) + + else: + MealRecord.objects.create(visitor=visitor, + booking=booking, + morning_tea=m_tea, + eve_tea=e_tea, + meal_date=date_1, + breakfast=breakfast, + lunch=lunch, + dinner=dinner, + persons=person) + + return Response(status=status.HTTP_200_OK) + else: + return Response(status=status.HTTP_400_BAD_REQUEST) + +# generate bill records between date range + + +# get available rooms list between date range + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def room_availabity(request): + if request.method == 'POST': + date_1 = request.POST.get('start_date') + date_2 = request.POST.get('end_date') + available_rooms_list = [] + available_rooms_bw_dates = booking_details(date_1, date_2) + #print("Available rooms are ") + for room in available_rooms_bw_dates: + available_rooms_list.append(room.room_number) + + available_rooms_array = np.asarray(available_rooms_list) + return Response(data={'available_rooms': available_rooms_array}, status=status.HTTP_200_OK) + else: + return Response(status=status.HTTP_400_BAD_REQUEST) + + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def add_to_inventory(request): + if request.method == 'POST': + item_name = request.POST.get('item_name') + bill_number = request.POST.get('bill_number') + quantity = (request.POST.get('quantity')) + cost = request.POST.get('cost') + consumable = request.POST.get('consumable') + + Inventory.objects.create( + item_name=item_name, quantity=quantity, consumable=consumable) + + item_name_key = Inventory.objects.get(item_name=item_name) + InventoryBill.objects.create( + item_name=item_name_key, bill_number=bill_number, cost=cost) + return Response(status=status.HTTP_200_OK) + else: + return Response(status=status.HTTP_400_BAD_REQUEST) + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def update_inventory(request): + if request.method == 'POST': + id = request.POST.get('id') + quantity = request.POST.get('quantity') + + Inventory.objects.filter(id=id).update(quantity=quantity) + return Response(status=status.HTTP_200_OK) + else: + return Response(status=status.HTTP_400_BAD_REQUEST) + + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def edit_room_status(request): + if request.method == 'POST': + room_number = request.POST.get('room_number') + room_status = request.POST.get('room_status') + room = RoomDetail.objects.get(room_number=room_number) + RoomDetail.objects.filter(room_id=room).update(status=room_status) + return Response(status=status.HTTP_200_OK) + else: + return Response(status=status.HTTP_400_BAD_REQUEST) + + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def bill_between_dates(request): + if request.method == 'POST': + date_1 = request.POST.get('start_date') + date_2 = request.POST.get('end_date') + bill_range_bw_dates = bill_range(date_1, date_2) + meal_total = 0 + room_total = 0 + individual_total =[] + + # calculating room and mess bill booking wise + for i in bill_range_bw_dates: + meal_total = meal_total + i.meal_bill + room_total = room_total + i.room_bill + individual_total.append(i.meal_bill + i.room_bill) + total_bill = meal_total + room_total + + response = { + 'booking_bw_dates_length': bill_range_bw_dates, + 'meal_total' : meal_total, + 'room_total' :room_total, + 'total_bill' : total_bill, + 'individual_total' : individual_total, + 'booking_bw_dates': zip(bill_range_bw_dates, individual_total) + } + return Response(data=response, status=status.HTTP_200_OK) + else: + return Response(status=status.HTTP_400_BAD_REQUEST) + + +@api_view(['POST']) +@permission_classes([IsAuthenticated]) +@authentication_classes([TokenAuthentication]) +def forward_booking(request): + if request.method == 'POST': + user = request.user + booking_id = request.POST.get('id') + previous_category = request.POST.get('previous_category') + modified_category = request.POST.get('modified_category') + rooms = request.POST.getlist('rooms[]') + print(rooms) + BookingDetail.objects.select_related('intender','caretaker').filter(id=booking_id).update(status="Forward") + booking = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) + bd = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) + bd.modified_visitor_category = modified_category + + count_rooms = 0 + for room in rooms: + count_rooms = count_rooms + 1 + room_object = RoomDetail.objects.get(room_number=room) + bd.rooms.add(room_object) + bd.number_of_rooms_alloted = count_rooms + bd.save() + + dashboard_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status = "Pending") | Q(status="Forward") | Q(status = "Confirmed") | Q(status = 'Rejected'), booking_to__gte=datetime.datetime.today(), intender=user).order_by('booking_from') + + incharge_name = HoldsDesignation.objects.select_related('user','working','designation').filter(designation__name = "VhIncharge")[1] + + # notify incharge about forwarded booking + visitors_hostel_notif(request.user, incharge_name.user, 'booking_forwarded') + return Response(status=status.HTTP_200_OK) + else: + return Response(status=status.HTTP_400_BAD_REQUEST) + + +def bill_range(date1,date2): + + + bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(booking_from__lte=date1, booking_to__gte=date1) | Q(booking_from__gte=date1, + booking_to__lte=date2) | Q(booking_from__lte=date2, booking_to__gte=date2) | Q(booking_from__lte=date1, booking_to__gte=date1) | Q(booking_from__gte=date1, booking_to__lte=date2) | Q(booking_from__lte=date2, booking_to__gte=date2)) + bookings_bw_dates = [] + booking_ids = [] + for booking_id in bookings: + booking_ids.append(booking_id.id) + + all_bill = Bill.objects.select_related('caretaker').all().order_by('-id') + + for b_id in booking_ids: + if Bill.objects.select_related('caretaker').filter(booking__pk=b_id).exists() : + bill_id = Bill.objects.select_related('caretaker').get(booking__pk=b_id) + bookings_bw_dates.append(bill_id) + + return bookings_bw_dates + + +def booking_details(date1, date2): + + bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(booking_from__lte=date1, booking_to__gte=date1, status="Confirmed") | Q(booking_from__gte=date1, + booking_to__lte=date2, status="Confirmed") | Q(booking_from__lte=date2, booking_to__gte=date2, status="Confirmed") | Q(booking_from__lte=date1, booking_to__gte=date1, status="Forward") | Q(booking_from__gte=date1, + booking_to__lte=date2, status="Forward") | Q(booking_from__lte=date2, booking_to__gte=date2, status="Forward") | Q(booking_from__lte=date1, booking_to__gte=date1, status="CheckedIn") | Q(booking_from__gte=date1, booking_to__lte=date2, status="CheckedIn") | Q(booking_from__lte=date2, booking_to__gte=date2, status="CheckedIn")) + + booked_rooms = [] + for booking in bookings: + for room in booking.rooms.all(): + booked_rooms.append(room) + + available_rooms = [] + all_rooms = RoomDetail.objects.all() + for room in all_rooms: + if room not in booked_rooms: + available_rooms.append(room) + + return available_rooms + +# function for finding forwarded booking rooms + +def forwarded_booking_details(date1, date2): + + bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(booking_from__lte=date1, booking_to__gte=date1, status="Confirmed") | Q(booking_from__gte=date1, + booking_to__lte=date2, status="Confirmed") | Q(booking_from__lte=date2, booking_to__gte=date2, status="Confirmed") | Q(booking_from__lte=date1, booking_to__gte=date1, status="CheckedIn") | Q(booking_from__gte=date1, booking_to__lte=date2, status="CheckedIn") | Q(booking_from__lte=date2, booking_to__gte=date2, status="CheckedIn")) + forwarded_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(booking_from__lte=date1, booking_to__gte=date1, status="Forward") | Q(booking_from__gte=date1, + booking_to__lte=date2, status="Forward") | Q(booking_from__lte=date2, booking_to__gte=date2, status="Forward") ) + booked_rooms = [] + + # Bookings for rooms which are forwarded but not yet approved + + forwarded_booking_rooms = [] + for booking in forwarded_bookings: + for room in booking.rooms.all(): + forwarded_booking_rooms.append(room) + + return forwarded_booking_rooms diff --git a/FusionIIIT/applications/visitor_hostel/forms.py b/FusionIIIT/applications/visitor_hostel/forms.py index 32b915407..c506bc932 100644 --- a/FusionIIIT/applications/visitor_hostel/forms.py +++ b/FusionIIIT/applications/visitor_hostel/forms.py @@ -5,41 +5,37 @@ from applications.visitor_hostel.models import * -from .models import Inventory - #class booking_request(forms.Form): CHOICES = (('A', 'A',), ('B', 'B',), ('C', 'C',), ('D', 'D',)) class ViewBooking(forms.Form): - date_from = forms.DateField(initial=datetime.date.today) - date_to = forms.DateField(initial=datetime.date.today) + date_from = forms.DateField(initial=datetime.date.today) + date_to = forms.DateField(initial=datetime.date.today) -class MealBooking(ModelForm): - date = forms.DateField(initial=datetime.date.today) - class Meta: - model = MealRecord - exclude = ['meal_date'] class RoomAvailability(forms.Form): - date_from = forms.DateField(initial=datetime.date.today) - date_to = forms.DateField(initial=datetime.date.today) + date_from = forms.DateField(initial=datetime.date.today) + date_to = forms.DateField(initial=datetime.date.today) -class InventoryForm(forms.ModelForm): - class Meta: - model = Inventory - fields = ["item_name", "quantity", "consumable"] +# class InventoryForm(forms.Form): +# # class Meta: +# # model = Inventory +# # fields = ["item_name", "quantity"] +# item_name = forms.CharField(max_length=20) +# quantity = forms.IntegerField(min_value=0) +# consumable = forms.BooleanField(initial=False) +# # checkbox = ["consumable"] class Room_booking(forms.Form): - name = forms.CharField(max_length=100) - mob = forms.CharField(max_length=12) - email = forms.CharField(max_length=40) - address = forms.CharField(max_length=200) - country = forms.CharField(max_length=25) - category = forms.ChoiceField(widget=forms.RadioSelect, choices=CHOICES) - total_persons = forms.IntegerField() - purpose = forms.CharField(widget=forms.Textarea) - date_from = forms.DateField(initial=datetime.date.today) - date_to = forms.DateField(initial=datetime.date.today) - \ No newline at end of file + name = forms.CharField(max_length=100) + mob = forms.CharField(max_length=12) + email = forms.CharField(max_length=40) + address = forms.CharField(max_length=200) + country = forms.CharField(max_length=25) + category = forms.ChoiceField(widget=forms.RadioSelect, choices=CHOICES) + total_persons = forms.IntegerField() + purpose = forms.CharField(widget=forms.Textarea) + date_from = forms.DateField(initial=datetime.date.today) + date_to = forms.DateField(initial=datetime.date.today) diff --git a/FusionIIIT/applications/visitor_hostel/migrations/0002_auto_20230401_1704.py b/FusionIIIT/applications/visitor_hostel/migrations/0002_auto_20230401_1704.py new file mode 100644 index 000000000..1539dc04d --- /dev/null +++ b/FusionIIIT/applications/visitor_hostel/migrations/0002_auto_20230401_1704.py @@ -0,0 +1,38 @@ +# Generated by Django 3.1.5 on 2023-04-01 16:04 +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('visitor_hostel', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='bill', + name='bill_date', + field=models.DateField(blank=True, default=django.utils.timezone.now), + ), + migrations.DeleteModel( + name='MealRecord', + ), + migrations.CreateModel( + name='MealRecord', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('meal_date', models.DateField()), + ('morning_tea', models.IntegerField(default=0)), + ('eve_tea', models.IntegerField(default=0)), + ('breakfast', models.IntegerField(default=0)), + ('lunch', models.IntegerField(default=0)), + ('dinner', models.IntegerField(default=0)), + ('persons', models.IntegerField(default=0)), + ('booking', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='visitor_hostel.bookingdetail')), + ('visitor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='visitor_hostel.visitordetail')), + ], + ), + ] diff --git a/FusionIIIT/applications/visitor_hostel/models.py b/FusionIIIT/applications/visitor_hostel/models.py index 508b2fa63..ffd49a1be 100644 --- a/FusionIIIT/applications/visitor_hostel/models.py +++ b/FusionIIIT/applications/visitor_hostel/models.py @@ -58,7 +58,6 @@ class VisitorDetail(models.Model): visitor_address = models.TextField(blank=True) nationality = models.CharField(max_length=20, blank=True) - def __str__(self): return '{} - {}'.format(self.id, self.visitor_name, self.visitor_email, self.visitor_organization, self.visitor_address, self.visitor_phone) @@ -71,7 +70,7 @@ class RoomDetail(models.Model): room_status = models.CharField(max_length=20, choices=ROOM_STATUS, default='Available') def __str__(self): - return self.room_number + return '{} - {}'.format(self.id, self.room_number , self.room_type, self.room_status, self.room_floor) class BookingDetail(models.Model): @@ -100,7 +99,7 @@ class BookingDetail(models.Model): number_of_rooms_alloted = models.IntegerField(default=1,null=True,blank=True) booking_date = models.DateField(auto_now_add=False, auto_now=False, default=timezone.now) bill_to_be_settled_by = models.CharField(max_length=15, choices=BILL_TO_BE_SETTLED_BY ,default ="Intender") - + def __str__(self): return '%s ----> %s - %s id is %s and category is %s' % (self.id, self.visitor, self.status, self.id, self.visitor_category) @@ -108,13 +107,12 @@ def __str__(self): class MealRecord(models.Model): booking = models.ForeignKey(BookingDetail, on_delete=models.CASCADE) visitor = models.ForeignKey(VisitorDetail, on_delete=models.CASCADE) - room = models.ForeignKey(RoomDetail, on_delete=models.CASCADE, default=0) meal_date = models.DateField() - morning_tea = models.BooleanField(default=False) - eve_tea = models.BooleanField(default=False) - breakfast = models.BooleanField(default=False) - lunch = models.BooleanField(default=False) - dinner = models.BooleanField(default=False) + morning_tea = models.IntegerField(default=0) + eve_tea = models.IntegerField(default=0) + breakfast = models.IntegerField(default=0) + lunch = models.IntegerField(default=0) + dinner = models.IntegerField(default=0) persons=models.IntegerField(default=0) @@ -125,6 +123,7 @@ class Bill(models.Model): meal_bill = models.IntegerField(default=0) room_bill = models.IntegerField(default=0) payment_status = models.BooleanField(default=False) + bill_date = models.DateField(default=timezone.now, blank=True) def __str__(self): return '%s ----> %s - %s id is %s' % (self.booking.id, self.meal_bill, self.room_bill, self.payment_status) @@ -154,5 +153,3 @@ class InventoryBill(models.Model): def __str__(self): return str(self.bill_number) - - diff --git a/FusionIIIT/applications/visitor_hostel/static/visitor_hostel/visitor-hostel.js b/FusionIIIT/applications/visitor_hostel/static/visitor_hostel/visitor-hostel.js index 3ecb7a431..dcae10190 100644 --- a/FusionIIIT/applications/visitor_hostel/static/visitor_hostel/visitor-hostel.js +++ b/FusionIIIT/applications/visitor_hostel/static/visitor_hostel/visitor-hostel.js @@ -294,31 +294,51 @@ function request_booking (event) { // Meal Record -$('.bookameal-submit').click(function(event){ +function bookameal_submit(event, htmlElement) { + console.log('hii') event.preventDefault(); - var pk = $(this).attr('data-pk'); - var food = [] - $('input[name=food'+pk+']:checked').each(function(){ - food.push($(this).val()); - }); - $.ajax({ - type: 'POST', - url: '/visitorhostel/record-meal/', - data: { + var pk = $(htmlElement).attr('data-pk'); + var booking_id = $(htmlElement).attr('booking_id') + // 'numberofpeople': $('input[name="numberofpeople-meal"]').val(), + m_tea = $(`input[name="m_tea${booking_id}"]`).val() + breakfast = $(`input[name="breakfast${booking_id}"]`).val() + lunch = $(`input[name="lunch${booking_id}"]`).val() + eve_tea = $(`input[name="eve_tea${booking_id}"]`).val() + dinner = $(`input[name="dinner${booking_id}"]`).val() + if (m_tea < 0 || breakfast < 0 || lunch < 0 || eve_tea < 0 || dinner < 0) { + alertModal('Meal record cannot be negative'); + } + else { + console.log(pk); + var jsondata = { 'pk' : pk, - 'booking' : $('input[name="meal-booking-id"]').val(), - 'numberofpeople': $('input[name="numberofpeople-meal"]').val(), - 'food':food, + 'booking' : booking_id, + 'm_tea': $(`input[name="m_tea${booking_id}"]`).val(), + 'breakfast': $(`input[name="breakfast${booking_id}"]`).val(), + 'lunch': $(`input[name="lunch${booking_id}"]`).val(), + 'eve_tea': $(`input[name="eve_tea${booking_id}"]`).val(), + 'dinner': $(`input[name="dinner${booking_id}"]`).val(), + 'csrfmiddlewaretoken': $('input[name="csrf"]').val(), - }, - success: function(data) { - alertModal('Great! Meals recorded successfully'); - }, - error: function(data, err) { - alertModal('Something missing! Please refill the form'); - } - }); -}); + } + console.log(jsondata) + $.ajax({ + type: 'POST', + url: '/visitorhostel/record-meal/', + data: jsondata, + success: function(data) { + alertModal('Great! Meals recorded successfully'); + setTimeout(function() { + location.reload(); + }, 1500); + + }, + error: function (data, err) { + alertModal('Something missing! Please refill the form '); + } + }); + } +}; // Update Inventory @@ -333,82 +353,122 @@ function update_inventory_form(id){ function submit_inventory_form(id){ id = id; quantity = $('#input-'.concat(id))[0].value; - $.ajax({ - type: 'POST', - url: '/visitorhostel/update-inventory/', - data: { - 'csrfmiddlewaretoken': $('input[name="csrf"]').val(), - 'id' : id, - 'quantity' : quantity, - }, - success: function(data) { - $('#show-'.concat(id))[0].innerHTML = quantity; - console.log(room_status); - $('#show-'.concat(id)).fadeToggle(); - $('#select-'.concat(id)).fadeToggle(); - $('#submit-'.concat(id)).fadeToggle(); - }, - error: function(data, err) { - alertModal('Something missing! Please refill the form'); - } - }); + if (quantity < 0) { + alertModal('Quantity cannot be negative! Please refill the form'); + } + else { + $.ajax({ + type: 'POST', + url: '/visitorhostel/update-inventory/', + data: { + 'csrfmiddlewaretoken': $('input[name="csrf"]').val(), + 'id' : id, + 'quantity' : quantity, + }, + success: function(data) { + $('#show-'.concat(id))[0].innerHTML = quantity; + console.log(room_status); + $('#show-'.concat(id)).fadeToggle(); + $('#select-'.concat(id)).fadeToggle(); + $('#submit-'.concat(id)).fadeToggle(); + }, + error: function(data, err) { + alertModal('Something missing! Please refill the form'); + } + }); + } }; // Adding more items to inventory -$('#add-more-items-inventory').click(function(event){ +// $('#add-more-items-inventory').click(function(event){ +// $.ajax({ +// type: 'POST', +// url: '/visitorhostel/add-to-inventory/', +// data: { +// 'item' : $('.reset-this-form')[0].children[2].children[0].children[1].children[0].value, +// 'quantity' : $('.reset-this-form')[0].children[2].children[1].children[1].children[0].value, +// 'amount' : $('.reset-this-form')[0].children[2].children[2].children[1].children[0].value, +// 'consumable' : $('.reset-this-form')[0].children[2].children[3].children[1].children[0].value, +// 'csrfmiddlewaretoken': '{{csrf_token}}' +// }, +// success: function(data) { +// $('.reset-this-form')[0].children[2].children[0].children[1].children[0].value = ""; +// $('.reset-this-form')[0].children[2].children[1].children[1].children[0].value = ""; +// $('.reset-this-form')[0].children[2].children[2].children[1].children[0].value = ""; +// }, +// error: function(data, err) { +// alertModal('Something missing! Please refill the form'); +// } +// }); - $.ajax({ - type: 'POST', - url: '/visitorhostel/add-to-inventory/', - data: { - 'item' : $('.reset-this-form')[0].children[2].children[0].children[1].children[0].value, - 'quantity' : $('.reset-this-form')[0].children[2].children[1].children[1].children[0].value, - 'amount' : $('.reset-this-form')[0].children[2].children[2].children[1].children[0].value, - 'consumable' : $('.reset-this-form')[0].children[2].children[3].children[1].children[0].value, - 'csrfmiddlewaretoken': '{{csrf_token}}' - }, - success: function(data) { - $('.reset-this-form')[0].children[2].children[0].children[1].children[0].value = ""; - $('.reset-this-form')[0].children[2].children[1].children[1].children[0].value = ""; - $('.reset-this-form')[0].children[2].children[2].children[1].children[0].value = ""; - }, - error: function(data, err) { - alertModal('Something missing! Please refill the form'); - } - }); +// }); -}); -$('#add-item-form-submit').click(function(event){ +function add_inventory_item(event) { event.preventDefault(); - if($('input[name="consumable"]:checked')){ - consumable = 'True'; + quantity = $('input[name="quantity_add"]').val() + if (quantity < 0) { + alertModal('Quantity cannot be negative! Please refill the form'); } else{ - consumable = 'False'; + jsondata = { + 'csrfmiddlewaretoken': $('input[name="csrf"]').val(), + 'item_name' : $('input[name="item_name"]').val(), + 'quantity' : quantity, + 'cost' : $('input[name="cost"]').val(), + 'consumable': ($('input[name="consumable"]:checked').val())?true:false, + 'bill_number' : $('input[name="bill_number"]').val() + } + console.log(jsondata) + $.ajax({ + type: 'POST', + url: '/visitorhostel/add-to-inventory/', + data: jsondata, + success: function(data) { + alertModal('Great! Item added successfully'); + setTimeout(function() { + location.reload(); + }, 1500); + }, + error: function(xhr, data, err) { + alertModal('Something missing! Please refill the form'); + } + + }); } - $.ajax({ - type: 'POST', - url: '/visitorhostel/add-to-inventory/', - data: { +} +$('.add-item-form-submit').click(function(event){ + event.preventDefault(); + quantity = $('input[name="quantity_add"]').val() + if (quantity < 0) { + alertModal('Quantity cannot be negative! Please refill the form'); + } + else { + jsondata = { 'csrfmiddlewaretoken': $('input[name="csrf"]').val(), - 'item_name' : $('input[name="item-name"]').val(), - 'quantity' : $('input[name="quantity_add"]').val(), + 'item_name' : $('input[name="item_name"]').val(), + 'quantity' : quantity, 'cost' : $('input[name="cost"]').val(), - 'consumable' : consumable, + 'consumable': ($('input[name="consumable"]:checked').val())?true:false, 'bill_number' : $('input[name="bill_number"]').val() - }, - success: function(data) { - $('.reset-this-form')[0].children[2].children[0].children[1].children[0].value = ""; - $('.reset-this-form')[0].children[2].children[1].children[1].children[0].value = ""; - $('.reset-this-form')[0].children[2].children[2].children[1].children[0].value = ""; - }, - error: function(xhr, data, err) { - alertModal('Something missing! Please refill the form'); } - - }); + console.log(jsondata) + $.ajax({ + type: 'POST', + url: '/visitorhostel/add-to-inventory/', + data: jsondata, + success: function(data) { + $('.reset-this-form')[0].children[2].children[0].children[1].children[0].value = ""; + $('.reset-this-form')[0].children[2].children[1].children[1].children[0].value = ""; + $('.reset-this-form')[0].children[2].children[2].children[1].children[0].value = ""; + }, + error: function(xhr, data, err) { + alertModal('Something missing! Please refill the form'); + } + + }); + } }); @@ -485,7 +545,7 @@ function confirm_booking (id) { function reject_booking (id) { remarks = $('input[name=cancellation-remarks-'+id+']').val(); - if (remarks == '') { + if (!remarks) { alertModal("Please fill in why you want to reject this booking in remarks."); return; } @@ -614,12 +674,12 @@ function forward_booking (id) { previous_category = $('input[name=category-'+id+']').val(); modified_category = $('input[name=modified-category-'+id+']').val(); rooms = $('select[name=alloted-rooms-'+id+']').val(); - + numberOfRoomsRequired = $('input[name=number-of-rooms-'+id+']').val(); + remark = $('input[name=cancellation-remarks-' + id + ']').val(); // if (previous_category == 0) { // alertModal("Please fill the category to confirm."); // return; // } - if (modified_category == 0) { modified_category = previous_category; } @@ -628,6 +688,11 @@ function forward_booking (id) { alertModal("Please fill the rooms to confirm booking."); return; } + console.log("rooms req:", numberOfRoomsRequired, rooms.length); + if (rooms.length > numberOfRoomsRequired) { + alertModal("Number of rooms cannot be more than number of rooms required!"); + return; + } $.ajax({ type: 'POST', @@ -637,7 +702,8 @@ function forward_booking (id) { 'csrfmiddlewaretoken': csrfmiddlewaretoken, 'previous_category' : previous_category, 'modified_category' : modified_category, - 'rooms' : rooms, + 'rooms': rooms, + 'remark': remark, }, success: function(data) { alertModal("This booking has been forwarded"); @@ -684,28 +750,28 @@ function cancel_active_booking (id, booking_from) { // Edit Inventory -$("#edit-inventory").click(function(e){ - $(".inventory-item").slideToggle(); - $(".inventory-form").slideToggle(); - $("#update-inventory-submit").slideToggle(); -}); -$("#update-inventory-submit").click(function(e){ - event.preventDefault(); - $.ajax({ - type: 'POST', - url: '/visitorhostel/bookaroom/', - data: { - 'csrfmiddlewaretoken' : '{{csrf_token}}', - 'data' : data - }, - success: function(data) { - alertModal("Congratulations! Inventory is updated successfully"); - }, - error: function(data, err) { - alertModal('Something missing! PLease refill the form'); - } - }); -}); +// $("#edit-inventory").click(function(e){ +// $(".inventory-item").slideToggle(); +// $(".inventory-form").slideToggle(); +// $("#update-inventory-submit").slideToggle(); +// }); +// $("#update-inventory-submit").click(function(e){ +// event.preventDefault(); +// $.ajax({ +// type: 'POST', +// url: '/visitorhostel/bookaroom/', +// data: { +// 'csrfmiddlewaretoken' : '{{csrf_token}}', +// 'data' : data +// }, +// success: function(data) { +// alertModal("Congratulations! Inventory is updated successfully"); +// }, +// error: function(data, err) { +// alertModal('Something missing! PLease refill the form'); +// } +// }); +// }); // Submit Visitor Details @@ -787,7 +853,7 @@ function submit_visitor_details (id) { // Check Out -function check_out (id , mess_bill , room_bill) { +function check_out(id, mess_bill, room_bill) { $.ajax({ type: 'POST', url: '/visitorhostel/check-out/', @@ -813,10 +879,10 @@ function check_out (id , mess_bill , room_bill) { function bill_between_date_range() { - start_date = $('input[name=start').val(); - end_date = $('input[name=end]').val(); - - if(new Date(start_date)>new Date(end_date)) + start = $('input[name=start]').val(); + end = $('input[name=end]').val(); + + if(new Date(start)>new Date(end)) { alertModal('Please check start date and end date.') return; @@ -824,24 +890,21 @@ function bill_between_date_range() { $.ajax({ type: 'POST', - url: '/visitorhostel/bill_between_date_range/', + url: '/visitorhostel/bill_between_dates/', data: { 'csrfmiddlewaretoken' : $('input[name="csrf"]').val(), - 'start_date' : start_date, - 'end_date' : end_date, + 'start_date' : start, + 'end_date' : end, }, success: function(data) { $('#replace-this-div-booking-bw-dates').html(data); console.log("winning"); - console.log(start_date); // alert('Bookings Between range are ..'); }, error: function(data, err) { - alertModal ('Error !'); - console.log(start_date); - console.log(end_date); + alertModal ('Error !', data, err); // alertModal('Something missing! Please refill the form'); } }); @@ -850,14 +913,12 @@ function bill_between_date_range() { // finding available room's list between date range function find_available_rooms ( available_rooms ) { - start_date = $('input[name=start-date').val(); + start_date = $('input[name=start-date]').val(); end_date = $('input[name=end-date]').val(); if (new Date(start_date) > new Date(end_date)) { alertModal ('Please check start date and end date!'); return; } - console.log(start_date); - console.log(end_date); $.ajax({ type: 'POST', diff --git a/FusionIIIT/applications/visitor_hostel/urls.py b/FusionIIIT/applications/visitor_hostel/urls.py index fc352d646..ee7855492 100644 --- a/FusionIIIT/applications/visitor_hostel/urls.py +++ b/FusionIIIT/applications/visitor_hostel/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import url +from django.conf.urls import url, include from . import views @@ -12,9 +12,9 @@ url(r'^get-booking-form/', views.get_booking_form, name='get_booking_form'), url(r'^request-booking/' , views.request_booking , name ='request_booking'), url(r'^confirm-booking/' , views.confirm_booking , name ='confirm_booking'), - url(r'^cancel-booking/', views.cancel_booking, name = 'cancel_booking'), - url(r'^cancel-booking-request/', views.cancel_booking_request, name = 'cancel_booking_request'), - url(r'^reject-booking/', views.reject_booking, name = 'reject_booking'), + url(r'^cancel-booking/', views.cancel_booking, name='cancel_booking'), + url(r'^cancel-booking-request/', views.cancel_booking_request,name='cancel_booking_request'), + url(r'^reject-booking/', views.reject_booking, name='reject_booking'), url(r'^check-in/', views.check_in, name = 'check_in'), url(r'^check-out/', views.check_out, name = 'check_out'), url(r'^record-meal/', views.record_meal, name = 'record_meal'), @@ -28,5 +28,7 @@ url(r'^edit-room-status/', views.edit_room_status, name = 'edit_room_status'), url(r'^booking-details/', views.booking_details, name = 'booking_details'), url(r'^forward-booking/', views.forward_booking, name = 'forward_booking'), + + # include API routes + url(r'^api/',include('applications.visitor_hostel.api.urls')) ] - \ No newline at end of file diff --git a/FusionIIIT/applications/visitor_hostel/views.py b/FusionIIIT/applications/visitor_hostel/views.py index ab0711153..bb5ea5737 100644 --- a/FusionIIIT/applications/visitor_hostel/views.py +++ b/FusionIIIT/applications/visitor_hostel/views.py @@ -25,7 +25,7 @@ import numpy as np from django.contrib.auth.models import User -from .forms import InventoryForm +# from .forms import InventoryForm # for notifications from notification.views import visitors_hostel_notif @@ -61,10 +61,14 @@ def visitorhostel(request): # bookings for intender view if (user_designation == "Intender"): - all_bookings = BookingDetail.objects.select_related('intender','caretaker').all().order_by('booking_from') - pending_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status="Pending") | Q(status="Forward"), booking_to__gte=datetime.datetime.today(), intender=user).order_by('booking_from') - active_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(status="CheckedIn", booking_to__gte=datetime.datetime.today(), intender=user).order_by('booking_from') - dashboard_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status = "Pending") | Q(status="Forward") | Q(status = "Confirmed") | Q(status = 'Rejected'), booking_to__gte=datetime.datetime.today(), intender=user).order_by('booking_from') + all_bookings = BookingDetail.objects.select_related( + 'intender', 'caretaker').all().order_by('booking_from') + pending_bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter(Q(status="Pending") | Q( + status="Forward"), booking_to__gte=datetime.datetime.today(), intender=user).order_by('booking_from') + active_bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter( + status="CheckedIn", booking_to__gte=datetime.datetime.today(), intender=user).order_by('booking_from') + dashboard_bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter(Q(status="Pending") | Q(status="Forward") | Q( + status="Confirmed") | Q(status='Rejected'), booking_to__gte=datetime.datetime.today(), intender=user).order_by('booking_from') # print(dashboard_bookings.booking_from) visitors = {} @@ -78,43 +82,56 @@ def visitorhostel(request): temp2 = range(1, booking.number_of_rooms_alloted) rooms[booking.id] = temp2 - complete_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(booking_to__lt=datetime.datetime.today(), intender=user).order_by('booking_from') - canceled_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(status="Canceled", intender=user).order_by('booking_from') - rejected_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(status='Rejected', intender=user).order_by('booking_from') - cancel_booking_requested = BookingDetail.objects.select_related('intender','caretaker').filter(status='CancelRequested', intender=user).order_by('booking_from') + complete_bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter( + check_out__lt=datetime.datetime.today(), intender=user).order_by('booking_from').reverse() + canceled_bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter( + status="Canceled", intender=user).order_by('booking_from') + rejected_bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter( + status='Rejected', intender=user).order_by('booking_from') + cancel_booking_requested = BookingDetail.objects.select_related('intender', 'caretaker').filter( + status='CancelRequested', intender=user).order_by('booking_from') else: # booking for caretaker and incharge view - all_bookings = BookingDetail.objects.select_related('intender','caretaker').all().order_by('booking_from') - pending_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status="Pending") | Q(status="Forward"), booking_to__gte=datetime.datetime.today()).order_by('booking_from') - active_bookings = BookingDetail.objects.filter(Q(status="Confirmed") | Q(status="CheckedIn"), booking_to__gte=datetime.datetime.today()).select_related('intender','caretaker').order_by('booking_from') - cancel_booking_request = BookingDetail.objects.select_related('intender','caretaker').filter(status="CancelRequested", booking_to__gte=datetime.datetime.today()).order_by('booking_from') - dashboard_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status = "Pending") | Q(status="Forward") | Q(status = "Confirmed"), booking_to__gte=datetime.datetime.today()).order_by('booking_from') + all_bookings = BookingDetail.objects.select_related( + 'intender', 'caretaker').all().order_by('booking_from') + pending_bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter( + Q(status="Pending") | Q(status="Forward"), booking_to__gte=datetime.datetime.today()).order_by('booking_from') + active_bookings = BookingDetail.objects.filter(Q(status="Confirmed") | Q( + status="CheckedIn"), booking_to__gte=datetime.datetime.today()).select_related('intender', 'caretaker').order_by('booking_from') + cancel_booking_request = BookingDetail.objects.select_related('intender', 'caretaker').filter( + status="CancelRequested", booking_to__gte=datetime.datetime.today()).order_by('booking_from') + dashboard_bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter(Q(status="Pending") | Q( + status="Forward") | Q(status="Confirmed"), booking_to__gte=datetime.datetime.today()).order_by('booking_from') visitors = {} rooms = {} # x = BookingDetail.objects.all().annotate(rooms_count=Count('rooms')) - c_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status="Forward"), booking_to__gte=datetime.datetime.today()).order_by('booking_from') - + c_bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter( + Q(status="Forward"), booking_to__gte=datetime.datetime.today()).order_by('booking_from') + # number of visitors for booking in active_bookings: temp = range(2, booking.person_count + 1) visitors[booking.id] = temp - # rooms alloted to booking for booking in active_bookings: for room_no in booking.rooms.all(): temp2 = range(2, booking.number_of_rooms_alloted + 1) rooms[booking.id] = temp2 - #print(booking.rooms.all()) + # print(booking.rooms.all()) + complete_bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter(Q(status="Canceled") | Q( + status="Complete"), check_out__lt=datetime.datetime.today()).select_related().order_by('booking_from').reverse() - complete_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status="Canceled") | Q(status="Complete"), booking_to__lt=datetime.datetime.today()).select_related().order_by('booking_from') - canceled_bookings = BookingDetail.objects.filter(status="Canceled").select_related('intender','caretaker').order_by('booking_from') - cancel_booking_requested = BookingDetail.objects.select_related('intender','caretaker').filter(status='CancelRequested', booking_to__gte=datetime.datetime.today(), intender=user).order_by('booking_from') - rejected_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(status='Rejected').order_by('booking_from') + canceled_bookings = BookingDetail.objects.filter(status="Canceled").select_related( + 'intender', 'caretaker').order_by('booking_from') + cancel_booking_requested = BookingDetail.objects.select_related('intender', 'caretaker').filter( + status='CancelRequested', booking_to__gte=datetime.datetime.today(), intender=user).order_by('booking_from') + rejected_bookings = BookingDetail.objects.select_related( + 'intender', 'caretaker').filter(status='Rejected').order_by('booking_from') # finding available room list for alloting rooms for booking in pending_bookings: @@ -122,17 +139,18 @@ def visitorhostel(request): booking_to = booking.booking_to temp1 = booking_details(booking_from, booking_to) available_rooms[booking.id] = temp1 - + # forwarded rooms details for booking in c_bookings: booking_from = booking.booking_from booking_to = booking.booking_to temp2 = forwarded_booking_details(booking_from, booking_to) forwarded_rooms[booking.id] = temp2 + # print(available_rooms) + # print(forwarded_rooms) # inventory data inventory = Inventory.objects.all() inventory_bill = InventoryBill.objects.select_related('item_name').all() - # completed booking bills completed_booking_bills = {} @@ -140,7 +158,8 @@ def visitorhostel(request): current_balance = 0 for bill in all_bills: - completed_booking_bills[bill.id] = {'intender': str(bill.booking.intender), 'booking_from': str(bill.booking.booking_from), 'booking_to': str(bill.booking.booking_to), 'total_bill': str(bill.meal_bill + bill.room_bill)} + completed_booking_bills[bill.id] = {'intender': str(bill.booking.intender), 'booking_from': str( + bill.booking.booking_from), 'booking_to': str(bill.booking.booking_to), 'total_bill': str(bill.meal_bill + bill.room_bill), 'bill_date': str(bill.bill_date)} current_balance = current_balance+bill.meal_bill + bill.room_bill for inv_bill in inventory_bill: @@ -166,7 +185,7 @@ def visitorhostel(request): category = booking.visitor_category person = booking.person_count - room_bill = 0 + room_bill = 100 if days == 0: days = 1 @@ -193,25 +212,23 @@ def visitorhostel(request): mess_bill = 0 for visitor in booking.visitor.all(): - meal = MealRecord.objects.select_related('booking__intender','booking__caretaker','visitor','room').filter(visitor=visitor) + meal = MealRecord.objects.select_related( + 'booking__intender', 'booking__caretaker', 'visitor').filter(booking_id=booking.id) mess_bill1 = 0 for m in meal: - if m.morning_tea == True: - mess_bill1 = mess_bill1+10 - if m.eve_tea == True: - mess_bill1 = mess_bill1+10 - if m.breakfast == True: - mess_bill1 = mess_bill1+50 - if m.lunch == True: - mess_bill1 = mess_bill1+100 - if m.dinner == True: - mess_bill1 = mess_bill1+100 - - if mess_bill1 == 270: - mess_bill = mess_bill+225 - else: - mess_bill = mess_bill + mess_bill1 + if m.morning_tea != 0: + mess_bill1 = mess_bill1+m.morning_tea*10 + if m.eve_tea != 0: + mess_bill1 = mess_bill1+m.eve_tea*10 + if m.breakfast != 0: + mess_bill1 = mess_bill1+m.breakfast*50 + if m.lunch != 0: + mess_bill1 = mess_bill1+m.lunch*100 + if m.dinner != 0: + mess_bill1 = mess_bill1+m.dinner*100 + + mess_bill = mess_bill + mess_bill1 total_bill = mess_bill + room_bill @@ -223,7 +240,7 @@ def visitorhostel(request): visitor_list = [] for b in dashboard_bookings: - count=1 + count = 1 b_visitor_list = b.visitor.all() for v in b_visitor_list: if count == 1: @@ -236,7 +253,7 @@ def visitorhostel(request): 'pending_bookings': pending_bookings, 'active_bookings': active_bookings, 'canceled_bookings': canceled_bookings, - 'dashboard_bookings' : dashboard_bookings, + 'dashboard_bookings': dashboard_bookings, 'bills': bills, # 'all_rooms_status' : all_rooms_status, @@ -251,7 +268,7 @@ def visitorhostel(request): 'intenders': intenders, 'user': user, 'visitors': visitors, - 'rooms' : rooms, + 'rooms': rooms, # 'num_rooms' : list(range(1, booking.number_of_rooms_alloted+1)), # 'num_rooms' :list(range(1, booking.number_of_rooms_alloted+1)), 'previous_visitors': previous_visitors, @@ -259,15 +276,17 @@ def visitorhostel(request): 'current_balance': current_balance, 'rejected_bookings': rejected_bookings, 'cancel_booking_request': cancel_booking_request, - 'cancel_booking_requested' : cancel_booking_requested, + 'cancel_booking_requested': cancel_booking_requested, 'user_designation': user_designation}) # Get methods for bookings + @login_required(login_url='/accounts/login/') def get_booking_requests(request): if request.method == 'POST': - pending_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(status="Pending") + pending_bookings = BookingDetail.objects.select_related( + 'intender', 'caretaker').filter(status="Pending") return render(request, "vhModule/visitorhostel.html", {'pending_bookings': pending_bookings}) else: @@ -275,10 +294,12 @@ def get_booking_requests(request): # getting active bookings + @login_required(login_url='/accounts/login/') def get_active_bookings(request): if request.method == 'POST': - active_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(status="Confirmed") + active_bookings = BookingDetail.objects.select_related( + 'intender', 'caretaker').filter(status="Confirmed") return render(request, "vhModule/visitorhostel.html", {'active_bookings': active_bookings}) else: @@ -287,8 +308,8 @@ def get_active_bookings(request): @login_required(login_url='/accounts/login/') def get_inactive_bookings(request): - if request.method == 'POST' : - inactive_bookings = BookingDetail.objects.select_related('intender','caretaker').filter( + if request.method == 'POST': + inactive_bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter( Q(status="Cancelled") | Q(status="Rejected") | Q(status="Complete")) return render(request, "vhModule/visitorhostel.html", {'inactive_bookings': inactive_bookings}) @@ -308,26 +329,27 @@ def get_booking_form(request): # request booking form action view starts here + @login_required(login_url='/accounts/login/') def request_booking(request): if request.method == 'POST': - flag=0 + flag = 0 # getting details from request form intender = request.POST.get('intender') user = User.objects.get(id=intender) print("jiihuhhih") print(user) - booking_id = request.POST.get('booking-id') + booking_id = request.POST.get('booking-id') category = request.POST.get('category') person_count = request.POST.get('number-of-people') bookingObject = [] - #if person_count and (int(person_count)<20): - # person_count = person_count + # if person_count and (int(person_count)<20): + # person_count = person_count - #else: - # flag = 1 # for error + # else: + # flag = 1 # for error # person_count = 1 purpose_of_visit = request.POST.get('purpose-of-visit') @@ -335,7 +357,8 @@ def request_booking(request): booking_to = request.POST.get('booking_to') booking_from_time = request.POST.get('booking_from_time') booking_to_time = request.POST.get('booking_to_time') - remarks_during_booking_request = request.POST.get('remarks_during_booking_request') + remarks_during_booking_request = request.POST.get( + 'remarks_during_booking_request') bill_to_be_settled_by = request.POST.get('bill_settlement') number_of_rooms = request.POST.get('number-of-rooms') caretaker = 'shailesh' @@ -349,22 +372,23 @@ def request_booking(request): print(sys.getsizeof(purpose_of_visit)) print(sys.getsizeof(bill_to_be_settled_by)) - care_taker = HoldsDesignation.objects.select_related('user','working','designation').filter(designation__name = "VhCaretaker") + care_taker = HoldsDesignation.objects.select_related( + 'user', 'working', 'designation').filter(designation__name="VhCaretaker") care_taker = care_taker[1] care_taker = care_taker.user bookingObject = BookingDetail.objects.create( - caretaker = care_taker, - purpose=purpose_of_visit, - intender=user, - booking_from=booking_from, - booking_to=booking_to, - visitor_category=category, - person_count=person_count, - arrival_time=booking_from_time, - departure_time=booking_to_time, - #remark=remarks_during_booking_request, - number_of_rooms=number_of_rooms, - bill_to_be_settled_by=bill_to_be_settled_by) + caretaker=care_taker, + purpose=purpose_of_visit, + intender=user, + booking_from=booking_from, + booking_to=booking_to, + visitor_category=category, + person_count=person_count, + arrival_time=booking_from_time, + departure_time=booking_to_time, + # remark=remarks_during_booking_request, + number_of_rooms=number_of_rooms, + bill_to_be_settled_by=bill_to_be_settled_by) # visitor_hostel_caretaker_notif(request.user,care_taker,"Submitted") # print (bookingObject) # print("Hello") @@ -382,10 +406,11 @@ def request_booking(request): # in case of any attachment doc = request.FILES.get('files-during-booking-request') - remark=remarks_during_booking_request, + remark = remarks_during_booking_request, if doc: print("hello") - filename, file_extenstion = os.path.splitext(request.FILES.get('files-during-booking-request').booking_id) + filename, file_extenstion = os.path.splitext( + request.FILES.get('files-during-booking-request').booking_id) filename = booking_id full_path = settings.MEDIA_ROOT + "/VhImage/" url = settings.MEDIA_URL + filename + file_extenstion @@ -399,7 +424,7 @@ def request_booking(request): bookingObject.image = uploaded_file_url bookingObject.save() - # visitor datails from place request form + # visitor datails from place request form visitor_name = request.POST.get('name') visitor_phone = request.POST.get('phone') @@ -412,9 +437,8 @@ def request_booking(request): visitor_organization = ' ' visitor = VisitorDetail.objects.create( - visitor_phone=visitor_phone, visitor_name=visitor_name, visitor_email=visitor_email, visitor_address=visitor_address, visitor_organization=visitor_organization - , nationality=visitor_nationality - ) + visitor_phone=visitor_phone, visitor_name=visitor_name, visitor_email=visitor_email, visitor_address=visitor_address, visitor_organization=visitor_organization, nationality=visitor_nationality + ) # try: # bd = BookingDetail.objects.get(id=booking_id) @@ -423,13 +447,13 @@ def request_booking(request): bookingObject.save() # except: - #print("exception occured") - # return HttpResponse('/visitorhostel/') + # print("exception occured") + # return HttpResponse('/visitorhostel/') # for sending notification of booking request to caretaker - #caretaker_name = HoldsDesignation.objects.select_related('user','working','designation').get(designation__name = "VhCaretaker") - #visitors_hostel_notif(request.user, care_taker.user, 'booking_request') + # caretaker_name = HoldsDesignation.objects.select_related('user','working','designation').get(designation__name = "VhCaretaker") + # visitors_hostel_notif(request.user, care_taker.user, 'booking_request') return HttpResponseRedirect('/visitorhostel/') else: @@ -459,30 +483,33 @@ def update_booking(request): number_of_rooms = request.POST.get('number-of-rooms') # remark = request.POST.get('remark') - booking = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) + booking = BookingDetail.objects.select_related( + 'intender', 'caretaker').get(id=booking_id) booking.person_count = person_count booking.number_of_rooms = number_of_rooms booking.booking_from = booking_from booking.booking_to = booking_to booking.purpose = purpose_of_visit booking.save() - + forwarded_rooms = {} # BookingDetail.objects.filter(id=booking_id).update(person_count=person_count, # purpose=purpose_of_visit, # booking_from=booking_from, # booking_to=booking_to, # number_of_rooms=number_of_rooms) - booking = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) - c_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status="Forward"), booking_to__gte=datetime.datetime.today()).order_by('booking_from') + booking = BookingDetail.objects.select_related( + 'intender', 'caretaker').get(id=booking_id) + c_bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter( + Q(status="Forward"), booking_to__gte=datetime.datetime.today()).order_by('booking_from') for booking in c_bookings: booking_from = booking.booking_from booking_to = booking.booking_to temp2 = forwarded_booking_details(booking_from, booking_to) forwarded_rooms[booking.id] = temp2 return render(request, "visitorhostel/", - { - 'forwarded_rooms': forwarded_rooms}) - + { + 'forwarded_rooms': forwarded_rooms}) + else: return HttpResponseRedirect('/visitorhostel/') @@ -502,9 +529,11 @@ def confirm_booking(request): # rooms list rooms = request.POST.getlist('rooms[]') - #print(rooms) - booking = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) - bd = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) + # print(rooms) + booking = BookingDetail.objects.select_related( + 'intender', 'caretaker').get(id=booking_id) + bd = BookingDetail.objects.select_related( + 'intender', 'caretaker').get(id=booking_id) bd.status = 'Confirmed' bd.category = category @@ -513,8 +542,9 @@ def confirm_booking(request): bd.rooms.add(room_object) bd.save() - # notification of booking confirmation - visitors_hostel_notif(request.user, bd.intender, 'booking_confirmation') + # notification of booking confirmation + visitors_hostel_notif(request.user, bd.intender, + 'booking_confirmation') return HttpResponseRedirect('/visitorhostel/') else: return HttpResponseRedirect('/visitorhostel/') @@ -528,42 +558,51 @@ def cancel_booking(request): booking_id = request.POST.get('booking-id') remark = request.POST.get('remark') charges = request.POST.get('charges') - BookingDetail.objects.select_related('intender','caretaker').filter(id=booking_id).update( + BookingDetail.objects.select_related('intender', 'caretaker').filter(id=booking_id).update( status='Canceled', remark=remark) - booking = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) + booking = BookingDetail.objects.select_related( + 'intender', 'caretaker').get(id=booking_id) # if no applicable charges then set charges to zero x = 0 if charges: - Bill.objects.create(booking=booking, meal_bill=x, room_bill=int(charges), caretaker=user, payment_status=True) + Bill.objects.create(booking=booking, meal_bill=x, room_bill=int( + charges), caretaker=user, payment_status=True) else: - Bill.objects.create(booking=booking, meal_bill=x, room_bill=x, caretaker=user, payment_status=True) + Bill.objects.create(booking=booking, meal_bill=x, + room_bill=x, caretaker=user, payment_status=True) + + complete_bookings = BookingDetail.objects.filter(Q(status="Canceled") | Q( + status="Complete"), booking_to__lt=datetime.datetime.today()).select_related('intender', 'caretaker').order_by('booking_from') - complete_bookings = BookingDetail.objects.filter(Q(status="Canceled") | Q(status="Complete"), booking_to__lt=datetime.datetime.today()).select_related('intender','caretaker').order_by('booking_from') - - # to notify the intender that his cancellation request has been confirmed - visitors_hostel_notif(request.user, booking.intender, 'booking_cancellation_request_accepted') + visitors_hostel_notif(request.user, booking.intender, + 'booking_cancellation_request_accepted') return HttpResponseRedirect('/visitorhostel/') else: return HttpResponseRedirect('/visitorhostel/') # cancel confirmed booing by intender + @login_required(login_url='/accounts/login/') def cancel_booking_request(request): if request.method == 'POST': - intender = request.user.holds_designations.filter(designation__name = 'VhIncharge') + intender = request.user.holds_designations.filter( + designation__name='VhIncharge') booking_id = request.POST.get('booking-id') remark = request.POST.get('remark') - BookingDetail.objects.select_related('intender','caretaker').filter(id=booking_id).update(status='CancelRequested', remark=remark) + BookingDetail.objects.select_related('intender', 'caretaker').filter( + id=booking_id).update(status='CancelRequested', remark=remark) - incharge_name = HoldsDesignation.objects.select_related('user','working','designation').filter(designation__name = "VhIncharge")[1] + incharge_name = HoldsDesignation.objects.select_related( + 'user', 'working', 'designation').filter(designation__name="VhIncharge")[1] # to notify the VhIncharge about a new cancelltaion request - visitors_hostel_notif(request.user, incharge_name.user, 'cancellation_request_placed') + visitors_hostel_notif( + request.user, incharge_name.user, 'cancellation_request_placed') return HttpResponseRedirect('/visitorhostel/') else: return HttpResponseRedirect('/visitorhostel/') @@ -576,18 +615,19 @@ def reject_booking(request): if request.method == 'POST': booking_id = request.POST.get('booking-id') remark = request.POST.get('remark') - BookingDetail.objects.select_related('intender','caretaker').filter(id=booking_id).update( + BookingDetail.objects.select_related('intender', 'caretaker').filter(id=booking_id).update( status="Rejected", remark=remark) # to notify the intender that his request has been rejected - #visitors_hostel_notif(request.user, booking.intender, 'booking_rejected') + # visitors_hostel_notif(request.user, booking.intender, 'booking_rejected') return HttpResponseRedirect('/visitorhostel/') else: return HttpResponseRedirect('/visitorhostel/') # Guest check in view + @login_required(login_url='/accounts/login/') def check_in(request): if request.method == 'POST': @@ -602,7 +642,8 @@ def check_in(request): visitor = VisitorDetail.objects.create( visitor_phone=visitor_phone, visitor_name=visitor_name, visitor_email=visitor_email, visitor_address=visitor_address) try: - bd = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) + bd = BookingDetail.objects.select_related( + 'intender', 'caretaker').get(id=booking_id) bd.status = "CheckedIn" bd.check_in = check_in_date bd.visitor.add(visitor) @@ -616,6 +657,7 @@ def check_in(request): # guest check out view + @login_required(login_url='/accounts/login/') def check_out(request): user = get_object_or_404(User, username=request.user.username) @@ -626,11 +668,14 @@ def check_out(request): id = request.POST.get('id') meal_bill = request.POST.get('mess_bill') room_bill = request.POST.get('room_bill') - BookingDetail.objects.select_related('intender','caretaker').filter(id=id).update( + checkout_date = datetime.date.today() + total_bill = int(meal_bill)+int(room_bill) + BookingDetail.objects.select_related('intender', 'caretaker').filter(id=id).update( check_out=datetime.datetime.today(), status="Complete") - booking = BookingDetail.objects.select_related('intender','caretaker').get(id=id) + booking = BookingDetail.objects.select_related( + 'intender', 'caretaker').get(id=id) Bill.objects.create(booking=booking, meal_bill=int(meal_bill), room_bill=int( - room_bill), caretaker=user, payment_status=True) + room_bill), caretaker=user, payment_status=True, bill_date=checkout_date) # for visitors in visitor_info: @@ -662,7 +707,6 @@ def check_out(request): return HttpResponseRedirect('/visitorhostel/') - @login_required(login_url='/accounts/login/') def record_meal(request): user = get_object_or_404(User, username=request.user.username) @@ -673,58 +717,39 @@ def record_meal(request): id = request.POST.get('pk') booking_id = request.POST.get('booking') - booking = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) + booking = BookingDetail.objects.select_related( + 'intender', 'caretaker').get(id=booking_id) visitor = VisitorDetail.objects.get(id=id) date_1 = datetime.datetime.today() - food = request.POST.getlist('food[]') - if '1' in food: - m_tea = True - else: - m_tea = False - - if '4' in food: - e_tea = True - else: - e_tea = False - - if '2' in food: - breakfast = True - else: - breakfast = False - - if '3' in food: - lunch = True - else: - lunch = False - - if '5' in food: - dinner = True - else: - dinner = False - - if request.POST.get('numberofpeople'): - person = request.POST.get('numberofpeople') - else: - person = 1 - + print(id, booking_id, booking, visitor, date_1) + m_tea = request.POST.get("m_tea") + breakfast = request.POST.get("breakfast") + lunch = request.POST.get("lunch") + eve_tea = request.POST.get("eve_tea") + dinner = request.POST.get("dinner") + + person = 1 + try: - meal = MealRecord.objects.select_related('booking__intender','booking__caretaker','visitor','room').get( + meal = MealRecord.objects.select_related('booking__intender', 'booking__caretaker', 'visitor').get( visitor=visitor, booking=booking, meal_date=date_1) except: meal = False if meal: - meal.morning_tea = m_tea - meal.eve_tea = e_tea - meal.breakfast = breakfast - meal.lunch = lunch - meal.dinner = dinner + meal.morning_tea += int(m_tea) + meal.eve_tea += int(eve_tea) + meal.breakfast += int(breakfast) + meal.lunch += int(lunch) + meal.dinner += int(dinner) meal.save() + return HttpResponseRedirect('/visitorhostel/') + else: MealRecord.objects.create(visitor=visitor, booking=booking, morning_tea=m_tea, - eve_tea=e_tea, + eve_tea=eve_tea, meal_date=date_1, breakfast=breakfast, lunch=lunch, @@ -737,6 +762,7 @@ def record_meal(request): # generate bill records between date range + @login_required(login_url='/accounts/login/') def bill_generation(request): user = get_object_or_404(User, username=request.user.username) @@ -755,7 +781,8 @@ def bill_generation(request): st = False user = get_object_or_404(User, username=request.user.username) - c = ExtraInfo.objects.select_related('department').filter(user=user) + c = ExtraInfo.objects.select_related( + 'department').filter(user=user) visitor = Visitor.objects.filter(visitor_phone=v_id) visitor = visitor[0] visitor_bill = Visitor_bill.objects.create( @@ -768,6 +795,7 @@ def bill_generation(request): # get available rooms list between date range + @login_required(login_url='/accounts/login/') def room_availabity(request): if request.method == 'POST': @@ -775,7 +803,7 @@ def room_availabity(request): date_2 = request.POST.get('end_date') available_rooms_list = [] available_rooms_bw_dates = booking_details(date_1, date_2) - #print("Available rooms are ") + # print("Available rooms are ") for room in available_rooms_bw_dates: available_rooms_list.append(room.room_number) @@ -791,18 +819,21 @@ def add_to_inventory(request): if request.method == 'POST': item_name = request.POST.get('item_name') bill_number = request.POST.get('bill_number') - quantity = (request.POST.get('quantity')) - cost = request.POST.get('cost') + quantity = int((request.POST.get('quantity'))) + cost = int(request.POST.get('cost')) consumable = request.POST.get('consumable') - # if(Inventory.objects.get(item_name = item_name)): - # Inventory.objects.filter(item_name=item_name).update(quantity=quantity,consumable=consumable) - # else: - Inventory.objects.create( - item_name=item_name, quantity=quantity, consumable=consumable) - - item_name_key = Inventory.objects.get(item_name=item_name) + if consumable == 'false': + isConsumable = False + else: + isConsumable = True + print(isConsumable) + x = Inventory.objects.create( + item_name=item_name, quantity=quantity, consumable=isConsumable) + print(x.pk) + item = Inventory.objects.get(pk=x.pk) + item_id = item.pk InventoryBill.objects.create( - item_name=item_name_key, bill_number=bill_number, cost=cost) + bill_number=bill_number, cost=cost, item_name_id=item_id) return HttpResponseRedirect('/visitorhostel/') else: return HttpResponseRedirect('/visitorhostel/') @@ -812,9 +843,13 @@ def add_to_inventory(request): def update_inventory(request): if request.method == 'POST': id = request.POST.get('id') - quantity = request.POST.get('quantity') - - Inventory.objects.filter(id=id).update(quantity=quantity) + quantity = int(request.POST.get('quantity')) + if quantity < 0: + quantity = 1 + if quantity == 0: + Inventory.objects.filter(id=id).delete() + else: + Inventory.objects.filter(id=id).update(quantity=quantity) return HttpResponseRedirect('/visitorhostel/') else: return HttpResponseRedirect('/visitorhostel/') @@ -832,7 +867,6 @@ def edit_room_status(request): return HttpResponseRedirect('/visitorhostel/') - @login_required(login_url='/accounts/login/') def bill_between_dates(request): if request.method == 'POST': @@ -841,7 +875,7 @@ def bill_between_dates(request): bill_range_bw_dates = bill_range(date_1, date_2) meal_total = 0 room_total = 0 - individual_total =[] + individual_total = [] # calculating room and mess bill booking wise for i in bill_range_bw_dates: @@ -851,24 +885,22 @@ def bill_between_dates(request): total_bill = meal_total + room_total # zip(bill_range_bw_dates, individual_total) return render(request, "vhModule/booking_bw_dates.html", { - # 'booking_bw_dates': bill_range_bw_dates, - 'booking_bw_dates_length': bill_range_bw_dates, - 'meal_total' : meal_total, - 'room_total' :room_total, - 'total_bill' : total_bill, - 'individual_total' : individual_total, - 'booking_bw_dates': zip(bill_range_bw_dates, individual_total) - }) + # 'booking_bw_dates': bill_range_bw_dates, + 'booking_bw_dates_length': bill_range_bw_dates, + 'meal_total': meal_total, + 'room_total': room_total, + 'total_bill': total_bill, + 'individual_total': individual_total, + 'booking_bw_dates': zip(bill_range_bw_dates, individual_total) + }) else: return HttpResponseRedirect('/visitorhostel/') +def bill_range(date1, date2): -def bill_range(date1,date2): - - - bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(booking_from__lte=date1, booking_to__gte=date1) | Q(booking_from__gte=date1, - booking_to__lte=date2) | Q(booking_from__lte=date2, booking_to__gte=date2) | Q(booking_from__lte=date1, booking_to__gte=date1) | Q(booking_from__gte=date1, booking_to__lte=date2) | Q(booking_from__lte=date2, booking_to__gte=date2)) + bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter(Q(booking_from__lte=date1, booking_to__gte=date1) | Q(booking_from__gte=date1, + booking_to__lte=date2) | Q(booking_from__lte=date2, booking_to__gte=date2) | Q(booking_from__lte=date1, booking_to__gte=date1) | Q(booking_from__gte=date1, booking_to__lte=date2) | Q(booking_from__lte=date2, booking_to__gte=date2)) # bill_details = Bill.objects.filter(Q(booking__booking_from__lte=date1, booking__booking_to__gte=date1, booking__status="Confirmed") | Q(booking__booking_from__gte=date1, # booking__booking_to__lte=date2, booking__status="Confirmed") | Q(booking__booking_from__lte=date2, booking__booking_to__gte=date2, status="Confirmed") | Q(booking_from__lte=date1, booking__booking_to__gte=date1, status="CheckedIn") | Q(booking__booking_from__gte=date1, booking__booking_to__lte=date2, booking__status="CheckedIn") | Q(booking__booking_from__lte=date2, booking__booking_to__gte=date2, booking__status="CheckedIn")) bookings_bw_dates = [] @@ -879,8 +911,9 @@ def bill_range(date1,date2): all_bill = Bill.objects.select_related('caretaker').all().order_by('-id') for b_id in booking_ids: - if Bill.objects.select_related('caretaker').filter(booking__pk=b_id).exists() : - bill_id = Bill.objects.select_related('caretaker').get(booking__pk=b_id) + if Bill.objects.select_related('caretaker').filter(booking__pk=b_id).exists(): + bill_id = Bill.objects.select_related( + 'caretaker').get(booking__pk=b_id) bookings_bw_dates.append(bill_id) return bookings_bw_dates @@ -888,9 +921,9 @@ def bill_range(date1,date2): def booking_details(date1, date2): - bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(booking_from__lte=date1, booking_to__gte=date1, status="Confirmed") | Q(booking_from__gte=date1, - booking_to__lte=date2, status="Confirmed") | Q(booking_from__lte=date2, booking_to__gte=date2, status="Confirmed") | Q(booking_from__lte=date1, booking_to__gte=date1, status="Forward") | Q(booking_from__gte=date1, - booking_to__lte=date2, status="Forward") | Q(booking_from__lte=date2, booking_to__gte=date2, status="Forward") | Q(booking_from__lte=date1, booking_to__gte=date1, status="CheckedIn") | Q(booking_from__gte=date1, booking_to__lte=date2, status="CheckedIn") | Q(booking_from__lte=date2, booking_to__gte=date2, status="CheckedIn")) + bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter(Q(booking_from__lte=date1, booking_to__gte=date1, status="Confirmed") | Q(booking_from__gte=date1, + booking_to__lte=date2, status="Confirmed") | Q(booking_from__lte=date2, booking_to__gte=date2, status="Confirmed") | Q(booking_from__lte=date1, booking_to__gte=date1, status="Forward") | Q(booking_from__gte=date1, + booking_to__lte=date2, status="Forward") | Q(booking_from__lte=date2, booking_to__gte=date2, status="Forward") | Q(booking_from__lte=date1, booking_to__gte=date1, status="CheckedIn") | Q(booking_from__gte=date1, booking_to__lte=date2, status="CheckedIn") | Q(booking_from__lte=date2, booking_to__gte=date2, status="CheckedIn")) booked_rooms = [] for booking in bookings: @@ -907,12 +940,13 @@ def booking_details(date1, date2): # function for finding forwarded booking rooms + def forwarded_booking_details(date1, date2): - bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(booking_from__lte=date1, booking_to__gte=date1, status="Confirmed") | Q(booking_from__gte=date1, - booking_to__lte=date2, status="Confirmed") | Q(booking_from__lte=date2, booking_to__gte=date2, status="Confirmed") | Q(booking_from__lte=date1, booking_to__gte=date1, status="CheckedIn") | Q(booking_from__gte=date1, booking_to__lte=date2, status="CheckedIn") | Q(booking_from__lte=date2, booking_to__gte=date2, status="CheckedIn")) - forwarded_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(booking_from__lte=date1, booking_to__gte=date1, status="Forward") | Q(booking_from__gte=date1, - booking_to__lte=date2, status="Forward") | Q(booking_from__lte=date2, booking_to__gte=date2, status="Forward") ) + bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter(Q(booking_from__lte=date1, booking_to__gte=date1, status="Confirmed") | Q(booking_from__gte=date1, + booking_to__lte=date2, status="Confirmed") | Q(booking_from__lte=date2, booking_to__gte=date2, status="Confirmed") | Q(booking_from__lte=date1, booking_to__gte=date1, status="CheckedIn") | Q(booking_from__gte=date1, booking_to__lte=date2, status="CheckedIn") | Q(booking_from__lte=date2, booking_to__gte=date2, status="CheckedIn")) + forwarded_bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter(Q(booking_from__lte=date1, booking_to__gte=date1, status="Forward") | Q(booking_from__gte=date1, + booking_to__lte=date2, status="Forward") | Q(booking_from__lte=date2, booking_to__gte=date2, status="Forward")) booked_rooms = [] # Bookings for rooms which are forwarded but not yet approved @@ -935,10 +969,15 @@ def forward_booking(request): previous_category = request.POST.get('previous_category') modified_category = request.POST.get('modified_category') rooms = request.POST.getlist('rooms[]') + remark = request.POST.get('remark') print(rooms) - BookingDetail.objects.select_related('intender','caretaker').filter(id=booking_id).update(status="Forward") - booking = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) - bd = BookingDetail.objects.select_related('intender','caretaker').get(id=booking_id) + BookingDetail.objects.select_related('intender', 'caretaker').filter( + id=booking_id).update(status="Forward", remark=remark) + + booking = BookingDetail.objects.select_related( + 'intender', 'caretaker').get(id=booking_id) + bd = BookingDetail.objects.select_related( + 'intender', 'caretaker').get(id=booking_id) bd.modified_visitor_category = modified_category count_rooms = 0 @@ -949,14 +988,17 @@ def forward_booking(request): bd.number_of_rooms_alloted = count_rooms bd.save() - dashboard_bookings = BookingDetail.objects.select_related('intender','caretaker').filter(Q(status = "Pending") | Q(status="Forward") | Q(status = "Confirmed") | Q(status = 'Rejected'), booking_to__gte=datetime.datetime.today(), intender=user).order_by('booking_from') + dashboard_bookings = BookingDetail.objects.select_related('intender', 'caretaker').filter(Q(status="Pending") | Q(status="Forward") | Q( + status="Confirmed") | Q(status='Rejected'), booking_to__gte=datetime.datetime.today(), intender=user).order_by('booking_from') # return render(request, "vhModule/visitorhostel.html", # {'dashboard_bookings' : dashboard_bookings}) - incharge_name = HoldsDesignation.objects.select_related('user','working','designation').filter(designation__name = "VhIncharge")[1] + incharge_name = HoldsDesignation.objects.select_related( + 'user', 'working', 'designation').filter(designation__name="VhIncharge")[1] # notify incharge about forwarded booking - visitors_hostel_notif(request.user, incharge_name.user, 'booking_forwarded') + visitors_hostel_notif( + request.user, incharge_name.user, 'booking_forwarded') return HttpResponseRedirect('/visitorhostel/') else: - return HttpResponseRedirect('/visitorhostel/') \ No newline at end of file + return HttpResponseRedirect('/visitorhostel/') diff --git a/FusionIIIT/media/0.98MB.png b/FusionIIIT/media/0.98MB.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_57t5s4b.png b/FusionIIIT/media/0.98MB_57t5s4b.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_57t5s4b.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_7FiXoj8.png b/FusionIIIT/media/0.98MB_7FiXoj8.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_7FiXoj8.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_L99QaqW.png b/FusionIIIT/media/0.98MB_L99QaqW.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_L99QaqW.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_LMwYOps.png b/FusionIIIT/media/0.98MB_LMwYOps.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_LMwYOps.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_P93Gzkf.png b/FusionIIIT/media/0.98MB_P93Gzkf.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_P93Gzkf.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_b8VDHuo.png b/FusionIIIT/media/0.98MB_b8VDHuo.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_b8VDHuo.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_e6cGhm4.png b/FusionIIIT/media/0.98MB_e6cGhm4.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_e6cGhm4.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_ib1hWcs.png b/FusionIIIT/media/0.98MB_ib1hWcs.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_ib1hWcs.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_igbRwIm.png b/FusionIIIT/media/0.98MB_igbRwIm.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_igbRwIm.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_jTd86LL.png b/FusionIIIT/media/0.98MB_jTd86LL.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_jTd86LL.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_jXilZaV.png b/FusionIIIT/media/0.98MB_jXilZaV.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_jXilZaV.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_o5whyyv.png b/FusionIIIT/media/0.98MB_o5whyyv.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_o5whyyv.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_oPouQfP.png b/FusionIIIT/media/0.98MB_oPouQfP.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_oPouQfP.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_oQkgkRh.png b/FusionIIIT/media/0.98MB_oQkgkRh.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_oQkgkRh.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_pmemS4n.png b/FusionIIIT/media/0.98MB_pmemS4n.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_pmemS4n.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_qXDyVYy.png b/FusionIIIT/media/0.98MB_qXDyVYy.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_qXDyVYy.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_rNj6b4q.png b/FusionIIIT/media/0.98MB_rNj6b4q.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_rNj6b4q.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_tz69HNE.png b/FusionIIIT/media/0.98MB_tz69HNE.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_tz69HNE.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_utFsMj9.png b/FusionIIIT/media/0.98MB_utFsMj9.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_utFsMj9.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_xIcO1Zb.png b/FusionIIIT/media/0.98MB_xIcO1Zb.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_xIcO1Zb.png and /dev/null differ diff --git a/FusionIIIT/media/0.98MB_yoy2RBN.png b/FusionIIIT/media/0.98MB_yoy2RBN.png deleted file mode 100644 index 7160beec9..000000000 Binary files a/FusionIIIT/media/0.98MB_yoy2RBN.png and /dev/null differ diff --git a/FusionIIIT/media/0.99MB.jpg b/FusionIIIT/media/0.99MB.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB.jpg and /dev/null differ diff --git a/FusionIIIT/media/0.99MB_DHG7YXd.jpg b/FusionIIIT/media/0.99MB_DHG7YXd.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB_DHG7YXd.jpg and /dev/null differ diff --git a/FusionIIIT/media/0.99MB_EGLIPZ2.jpg b/FusionIIIT/media/0.99MB_EGLIPZ2.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB_EGLIPZ2.jpg and /dev/null differ diff --git a/FusionIIIT/media/0.99MB_HHduay1.jpg b/FusionIIIT/media/0.99MB_HHduay1.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB_HHduay1.jpg and /dev/null differ diff --git a/FusionIIIT/media/0.99MB_JTYIGIj.jpg b/FusionIIIT/media/0.99MB_JTYIGIj.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB_JTYIGIj.jpg and /dev/null differ diff --git a/FusionIIIT/media/0.99MB_aAwWnr2.jpg b/FusionIIIT/media/0.99MB_aAwWnr2.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB_aAwWnr2.jpg and /dev/null differ diff --git a/FusionIIIT/media/0.99MB_e0LQOmD.jpg b/FusionIIIT/media/0.99MB_e0LQOmD.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB_e0LQOmD.jpg and /dev/null differ diff --git a/FusionIIIT/media/0.99MB_lsfSTir.jpg b/FusionIIIT/media/0.99MB_lsfSTir.jpg deleted file mode 100644 index b3f96bf29..000000000 Binary files a/FusionIIIT/media/0.99MB_lsfSTir.jpg and /dev/null differ diff --git a/FusionIIIT/media/1.png b/FusionIIIT/media/1.png deleted file mode 100644 index 9c8220bd3..000000000 Binary files a/FusionIIIT/media/1.png and /dev/null differ diff --git a/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g.jpeg b/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g.jpeg deleted file mode 100644 index 83a35d102..000000000 Binary files a/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g.jpeg and /dev/null differ diff --git a/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g_5F4vkCu.jpeg b/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g_5F4vkCu.jpeg deleted file mode 100644 index 83a35d102..000000000 Binary files a/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g_5F4vkCu.jpeg and /dev/null differ diff --git a/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g_792jnyr.jpeg b/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g_792jnyr.jpeg deleted file mode 100644 index 83a35d102..000000000 Binary files a/FusionIIIT/media/1_vo8bfvr4k9iNktDWxd1F2g_792jnyr.jpeg and /dev/null differ diff --git a/FusionIIIT/media/48KB.jpg b/FusionIIIT/media/48KB.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/48KB.jpg and /dev/null differ diff --git a/FusionIIIT/media/48KB_2JSfQTH.jpg b/FusionIIIT/media/48KB_2JSfQTH.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/48KB_2JSfQTH.jpg and /dev/null differ diff --git a/FusionIIIT/media/48KB_PmnwtUs.jpg b/FusionIIIT/media/48KB_PmnwtUs.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/48KB_PmnwtUs.jpg and /dev/null differ diff --git a/FusionIIIT/media/48KB_TISNA0m.jpg b/FusionIIIT/media/48KB_TISNA0m.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/48KB_TISNA0m.jpg and /dev/null differ diff --git a/FusionIIIT/media/48KB_TyyHR1E.jpg b/FusionIIIT/media/48KB_TyyHR1E.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/48KB_TyyHR1E.jpg and /dev/null differ diff --git a/FusionIIIT/media/48KB_ezsXDVu.jpg b/FusionIIIT/media/48KB_ezsXDVu.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/48KB_ezsXDVu.jpg and /dev/null differ diff --git a/FusionIIIT/media/4KB.png b/FusionIIIT/media/4KB.png deleted file mode 100644 index 911f3ee02..000000000 Binary files a/FusionIIIT/media/4KB.png and /dev/null differ diff --git a/FusionIIIT/media/4KB_VuQkbvP.png b/FusionIIIT/media/4KB_VuQkbvP.png deleted file mode 100644 index 911f3ee02..000000000 Binary files a/FusionIIIT/media/4KB_VuQkbvP.png and /dev/null differ diff --git a/FusionIIIT/media/4KB_YKxdDGZ.png b/FusionIIIT/media/4KB_YKxdDGZ.png deleted file mode 100644 index 911f3ee02..000000000 Binary files a/FusionIIIT/media/4KB_YKxdDGZ.png and /dev/null differ diff --git a/FusionIIIT/media/564KB.png b/FusionIIIT/media/564KB.png deleted file mode 100644 index d475b5856..000000000 Binary files a/FusionIIIT/media/564KB.png and /dev/null differ diff --git a/FusionIIIT/media/564KB_tAorR6k.png b/FusionIIIT/media/564KB_tAorR6k.png deleted file mode 100644 index d475b5856..000000000 Binary files a/FusionIIIT/media/564KB_tAorR6k.png and /dev/null differ diff --git a/FusionIIIT/media/564KB_w8K2FLg.png b/FusionIIIT/media/564KB_w8K2FLg.png deleted file mode 100644 index d475b5856..000000000 Binary files a/FusionIIIT/media/564KB_w8K2FLg.png and /dev/null differ diff --git a/FusionIIIT/media/976KB.png b/FusionIIIT/media/976KB.png deleted file mode 100644 index 2c83209f4..000000000 Binary files a/FusionIIIT/media/976KB.png and /dev/null differ diff --git a/FusionIIIT/media/976KB_LsFRDHW.png b/FusionIIIT/media/976KB_LsFRDHW.png deleted file mode 100644 index 2c83209f4..000000000 Binary files a/FusionIIIT/media/976KB_LsFRDHW.png and /dev/null differ diff --git a/FusionIIIT/media/ASSIGNMENT.pdf b/FusionIIIT/media/ASSIGNMENT.pdf deleted file mode 100644 index 5f59b08c0..000000000 Binary files a/FusionIIIT/media/ASSIGNMENT.pdf and /dev/null differ diff --git a/FusionIIIT/media/ASSIGNMENT_M9FShVJ.pdf b/FusionIIIT/media/ASSIGNMENT_M9FShVJ.pdf deleted file mode 100644 index 5f59b08c0..000000000 Binary files a/FusionIIIT/media/ASSIGNMENT_M9FShVJ.pdf and /dev/null differ diff --git a/FusionIIIT/media/Administrator/academic_information/sheet.xls b/FusionIIIT/media/Administrator/academic_information/sheet.xls new file mode 100644 index 000000000..5b8e6d4b3 Binary files /dev/null and b/FusionIIIT/media/Administrator/academic_information/sheet.xls differ diff --git a/FusionIIIT/media/Capture_832VvV6.PNG b/FusionIIIT/media/Capture_832VvV6.PNG deleted file mode 100644 index 9e858c70a..000000000 Binary files a/FusionIIIT/media/Capture_832VvV6.PNG and /dev/null differ diff --git a/FusionIIIT/media/Capture_NCxCLwL.PNG b/FusionIIIT/media/Capture_NCxCLwL.PNG deleted file mode 100644 index e9fc35e68..000000000 Binary files a/FusionIIIT/media/Capture_NCxCLwL.PNG and /dev/null differ diff --git a/FusionIIIT/media/Capture_TphWQy5.PNG b/FusionIIIT/media/Capture_TphWQy5.PNG deleted file mode 100644 index 9e858c70a..000000000 Binary files a/FusionIIIT/media/Capture_TphWQy5.PNG and /dev/null differ diff --git a/FusionIIIT/media/Capture_V7GzWgM.PNG b/FusionIIIT/media/Capture_V7GzWgM.PNG deleted file mode 100644 index 9e858c70a..000000000 Binary files a/FusionIIIT/media/Capture_V7GzWgM.PNG and /dev/null differ diff --git a/FusionIIIT/media/Capture_lHfdqEG.PNG b/FusionIIIT/media/Capture_lHfdqEG.PNG deleted file mode 100644 index 9e858c70a..000000000 Binary files a/FusionIIIT/media/Capture_lHfdqEG.PNG and /dev/null differ diff --git a/FusionIIIT/media/Capture_ofqjYvS.PNG b/FusionIIIT/media/Capture_ofqjYvS.PNG deleted file mode 100644 index 9e858c70a..000000000 Binary files a/FusionIIIT/media/Capture_ofqjYvS.PNG and /dev/null differ diff --git a/FusionIIIT/media/Chrysanthemum.jpg b/FusionIIIT/media/Chrysanthemum.jpg deleted file mode 100644 index 757c2a628..000000000 Binary files a/FusionIIIT/media/Chrysanthemum.jpg and /dev/null differ diff --git a/FusionIIIT/media/Chrysanthemum_KIrrQ5X.jpg b/FusionIIIT/media/Chrysanthemum_KIrrQ5X.jpg deleted file mode 100644 index 757c2a628..000000000 Binary files a/FusionIIIT/media/Chrysanthemum_KIrrQ5X.jpg and /dev/null differ diff --git a/FusionIIIT/media/Chrysanthemum_boupFDj.jpg b/FusionIIIT/media/Chrysanthemum_boupFDj.jpg deleted file mode 100644 index 757c2a628..000000000 Binary files a/FusionIIIT/media/Chrysanthemum_boupFDj.jpg and /dev/null differ diff --git a/FusionIIIT/media/Desert.jpg b/FusionIIIT/media/Desert.jpg deleted file mode 100644 index 0b88c9133..000000000 Binary files a/FusionIIIT/media/Desert.jpg and /dev/null differ diff --git a/FusionIIIT/media/Desert_H55mbwi.jpg b/FusionIIIT/media/Desert_H55mbwi.jpg deleted file mode 100644 index 0b88c9133..000000000 Binary files a/FusionIIIT/media/Desert_H55mbwi.jpg and /dev/null differ diff --git a/FusionIIIT/media/Desert_sMVqJfr.jpg b/FusionIIIT/media/Desert_sMVqJfr.jpg deleted file mode 100644 index 0b88c9133..000000000 Binary files a/FusionIIIT/media/Desert_sMVqJfr.jpg and /dev/null differ diff --git a/FusionIIIT/media/IMG-20180914-WA0001.jpg b/FusionIIIT/media/IMG-20180914-WA0001.jpg deleted file mode 100644 index 8867752da..000000000 Binary files a/FusionIIIT/media/IMG-20180914-WA0001.jpg and /dev/null differ diff --git a/FusionIIIT/media/IP_Project_Brain_Haemorrhage.pdf b/FusionIIIT/media/IP_Project_Brain_Haemorrhage.pdf deleted file mode 100644 index 5af26ab52..000000000 Binary files a/FusionIIIT/media/IP_Project_Brain_Haemorrhage.pdf and /dev/null differ diff --git a/FusionIIIT/media/IP_Project_Brain_Haemorrhage_9XhG25i.pdf b/FusionIIIT/media/IP_Project_Brain_Haemorrhage_9XhG25i.pdf deleted file mode 100644 index 5af26ab52..000000000 Binary files a/FusionIIIT/media/IP_Project_Brain_Haemorrhage_9XhG25i.pdf and /dev/null differ diff --git a/FusionIIIT/media/Lighthouse_2MzJMjV.jpg b/FusionIIIT/media/Lighthouse_2MzJMjV.jpg deleted file mode 100644 index 494be09b8..000000000 Binary files a/FusionIIIT/media/Lighthouse_2MzJMjV.jpg and /dev/null differ diff --git a/FusionIIIT/media/Lighthouse_asJUMg0.jpg b/FusionIIIT/media/Lighthouse_asJUMg0.jpg deleted file mode 100644 index 494be09b8..000000000 Binary files a/FusionIIIT/media/Lighthouse_asJUMg0.jpg and /dev/null differ diff --git a/FusionIIIT/media/Lighthouse_k8vR5gc.jpg b/FusionIIIT/media/Lighthouse_k8vR5gc.jpg deleted file mode 100644 index 494be09b8..000000000 Binary files a/FusionIIIT/media/Lighthouse_k8vR5gc.jpg and /dev/null differ diff --git a/FusionIIIT/media/Lighthouse_kv2ONOy.jpg b/FusionIIIT/media/Lighthouse_kv2ONOy.jpg deleted file mode 100644 index 494be09b8..000000000 Binary files a/FusionIIIT/media/Lighthouse_kv2ONOy.jpg and /dev/null differ diff --git a/FusionIIIT/media/Parivartan_Desktop.jpg b/FusionIIIT/media/Parivartan_Desktop.jpg deleted file mode 100644 index 0b6773b5b..000000000 Binary files a/FusionIIIT/media/Parivartan_Desktop.jpg and /dev/null differ diff --git a/FusionIIIT/media/Parivartan_Desktop_2AZxa7A.jpg b/FusionIIIT/media/Parivartan_Desktop_2AZxa7A.jpg deleted file mode 100644 index 0b6773b5b..000000000 Binary files a/FusionIIIT/media/Parivartan_Desktop_2AZxa7A.jpg and /dev/null differ diff --git a/FusionIIIT/media/Parivartan_Desktop_A3za29C.jpg b/FusionIIIT/media/Parivartan_Desktop_A3za29C.jpg deleted file mode 100644 index 0b6773b5b..000000000 Binary files a/FusionIIIT/media/Parivartan_Desktop_A3za29C.jpg and /dev/null differ diff --git a/FusionIIIT/media/Parivartan_Desktop_D3gcCwQ.jpg b/FusionIIIT/media/Parivartan_Desktop_D3gcCwQ.jpg deleted file mode 100644 index 0b6773b5b..000000000 Binary files a/FusionIIIT/media/Parivartan_Desktop_D3gcCwQ.jpg and /dev/null differ diff --git a/FusionIIIT/media/Parivartan_Desktop_WObTsJy.jpg b/FusionIIIT/media/Parivartan_Desktop_WObTsJy.jpg deleted file mode 100644 index 0b6773b5b..000000000 Binary files a/FusionIIIT/media/Parivartan_Desktop_WObTsJy.jpg and /dev/null differ diff --git a/FusionIIIT/media/Parivartan_Desktop_pucd5dp.jpg b/FusionIIIT/media/Parivartan_Desktop_pucd5dp.jpg deleted file mode 100644 index 0b6773b5b..000000000 Binary files a/FusionIIIT/media/Parivartan_Desktop_pucd5dp.jpg and /dev/null differ diff --git a/FusionIIIT/media/Parivartan_Desktop_sQh5sCr.jpg b/FusionIIIT/media/Parivartan_Desktop_sQh5sCr.jpg deleted file mode 100644 index 0b6773b5b..000000000 Binary files a/FusionIIIT/media/Parivartan_Desktop_sQh5sCr.jpg and /dev/null differ diff --git a/FusionIIIT/media/R19BZ0dfQ1NDNF9QUk9EX0FQLlxBUFxQUk9EXEdvVG9NeURlc2t0b3AyMFxHb1RvTXlEZXNrdG9wMg--.ica b/FusionIIIT/media/R19BZ0dfQ1NDNF9QUk9EX0FQLlxBUFxQUk9EXEdvVG9NeURlc2t0b3AyMFxHb1RvTXlEZXNrdG9wMg--.ica deleted file mode 100644 index 91a31a332..000000000 --- a/FusionIIIT/media/R19BZ0dfQ1NDNF9QUk9EX0FQLlxBUFxQUk9EXEdvVG9NeURlc2t0b3AyMFxHb1RvTXlEZXNrdG9wMg--.ica +++ /dev/null @@ -1,76 +0,0 @@ -[Encoding] -InputEncoding=UTF8 - -[WFClient] -CDMAllowed=False -CLIPBOARDALLOWED=False -ProxyFavorIEConnectionSetting=Yes -ProxyTimeout=30000 -ProxyType=Auto -ProxyUseFQDN=Off -RemoveICAFile=yes -TransparentKeyPassthrough=Local -TransportReconnectEnabled=Off -Version=2 -VirtualCOMPortEmulation=On - -[ApplicationServers] -XA0008_GoToMyDeskto= - -[XA0008_GoToMyDeskto] -Address=;40;STA847546794;875677C91ECA49699902808E05782B -AutologonAllowed=On -BrowserProtocol=HTTPonTCP -CGPSecurityTicket=On -ClientAudio=On -DesiredColor=8 -DesiredHRES=0 -DesiredVRES=0 -DisableCtrlAltDel=Off -DoNotUseDefaultCSL=On -FontSmoothingType=0 -HDXoverUDP=Off -HTTPBrowserAddress=! -InitialProgram=#XA0008_GoToMyDeskto -Launcher=WI -LaunchReference=2FCB7AABF5E0F23777A748B167C751 -LocHttpBrowserAddress=! -LongCommandLine= -LPWD=235 -NRWD=151 -ProxyTimeout=30000 -ProxyType=Auto -SecureChannelProtocol=Detect -SessionsharingKey=KzQ0nZ+F/Kvu3YOEOdLNqmFKhdt8KyOz -SFRAllowed=Off -SSLCiphers=all -SSLEnable=On -SSLProxyHost=mydesk-ap-r.credit-suisse.com:443 -startSCD=1591082680062 -Title=GoToMyDesktop2 -TransportDriver=TCP/IP -TRWD=0 -TWIMode=On -UseLocalUserAndPassword=On -WinStationDriver=ICA 3.0 - -[Compress] -DriverNameWin16=pdcompw.dll -DriverNameWin32=pdcompn.dll - -[EncRC5-0] -DriverNameWin16=pdc0w.dll -DriverNameWin32=pdc0n.dll - -[EncRC5-128] -DriverNameWin16=pdc128w.dll -DriverNameWin32=pdc128n.dll - -[EncRC5-40] -DriverNameWin16=pdc40w.dll -DriverNameWin32=pdc40n.dll - -[EncRC5-56] -DriverNameWin16=pdc56w.dll -DriverNameWin32=pdc56n.dll - diff --git a/FusionIIIT/media/SFTBR-04.PDF b/FusionIIIT/media/SFTBR-04.PDF deleted file mode 100644 index af7279bbb..000000000 Binary files a/FusionIIIT/media/SFTBR-04.PDF and /dev/null differ diff --git a/FusionIIIT/media/SamplePNGImage_500kbmb.png b/FusionIIIT/media/SamplePNGImage_500kbmb.png deleted file mode 100644 index b374d33c1..000000000 --- a/FusionIIIT/media/SamplePNGImage_500kbmb.png +++ /dev/null @@ -1,1122 +0,0 @@ - - - Download Sample Videos / Dummy Videos For Demo Use - - - - - - - - - - - - - - - - - -
- - -
-
- - - -
-
-
-
- -
- - -
- -
- - -
- -
-
-
- - - -
- -

Download Sample Videos

- -

Are you a mobile app developer?

-

Are you looking for videos of different resolution and sizes to test while designing or developing a mobile app?

-

Sample-Videos.com is a 100% FREE service that allows programmers, testers, designers, developers to download sample videos for demo/test use. No matter what video format they use (MP4, FLV, MKV, 3GP); they will be able to test videos on any Smartphone without any hustle. This is a one stop destination for all sample video testing needs. Just search below for the relevant video formats in specific sizes, download them, and start testing.

-

A mobile screen resolution can be a big challenge when it comes to watching videos online or offline. By testing out videos one can be rest assured regarding the video playback in an app, without annoying the end users. Choose from four different video extensions i.e. 3GP, MKV, FLV, and MP4. The best thing is all of these are free and very easy to download. We provide you with a specific and perfect resolution in all sizes possible with just one simple click. Check out the one which suits your requirements. All you need to do is hit the DOWNLOAD button, and get started.

- - -
-

Download .mp4 Sample Video

- -
- - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
1mp41280x720Click
2mp41280x720Click
5mp41280x720Click
10mp41280x720Click
- - - -
20mp41280x720Click
30mp41280x720Click
1mp4720x480Click
2mp4720x480Click
5mp4720x480Click
10mp4720x480Click
20mp4720x480Click
30mp4720x480Click
1mp4640x360Click
2mp4640x360Click
5mp4640x360Click
10mp4640x360Click
20mp4640x360Click
30mp4640x360Click
1mp4360x240Click
2mp4360x240Click
5mp4360x240Click
10mp4360x240Click
20mp4360x240Click
30mp4360x240Click
- -
- -
-
- -

Download .flv Sample Video

-
- - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
1flv1280x720Click
2flv1280x720Click
5flv1280x720Click
10flv1280x720Click
- - - -
20flv1280x720Click
30flv1280x720Click
1flv720x480Click
2flv720x480Click
5flv720x480Click
10flv720x480Click
20flv720x480Click
30flv720x480Click
1flv640x360Click
2flv640x360Click
5flv640x360Click
10flv640x360Click
20flv640x360Click
30flv640x360Click
1flv360x240Click
2flv360x240Click
5flv360x240Click
10flv360x240Click
20flv360x240Click
30flv360x240Click
-
- -
-
- -

Download .mkv Sample Video

-
- - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
1mkv1280x720Click
2mkv1280x720Click
5mkv1280x720Click
10mkv1280x720Click
- - - -
20mkv1280x720Click
30mkv1280x720Click
1mkv720x480Click
2mkv720x480Click
5mkv720x480Click
10mkv720x480Click
20mkv720x480Click
30mkv720x480Click
1mkv640x360Click
2mkv640x360Click
5mkv640x360Click
10mkv640x360Click
20mkv640x360Click
30mkv640x360Click
1mkv360x240Click
2mkv360x240Click
5mkv360x240Click
10mkv360x240Click
20mkv360x240Click
30mkv360x240Click
- -
- -
-
- -

Download .3gp Sample Video

-
- - - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
13gp176x144Click
23gp176x144Click
53gp176x144Click
103gp176x144Click
- - - -
13gp320x240Click
23gp320x240Click
53gp320x240Click
103gp320x240Click
203gp320x240Click
303gp320x240Click
- -
- -
- - - - -
- - -
-
- - - - - -
-
- -
-
-
- -
-
- -
-
-
- -
-
- -
-
- - - -
- -
- -
- - - - - - - -
- - - - -
- - -
- -
- - -
- - - - - - - - - - - - - -
-
- © Sample Video Developers - www.bigbuckbunny.org -
-
- - - - - - - - - - - - - - - - - - - - - -
- - diff --git a/FusionIIIT/media/SamplePNGImage_500kbmb_0BkXR0Y.png b/FusionIIIT/media/SamplePNGImage_500kbmb_0BkXR0Y.png deleted file mode 100644 index b374d33c1..000000000 --- a/FusionIIIT/media/SamplePNGImage_500kbmb_0BkXR0Y.png +++ /dev/null @@ -1,1122 +0,0 @@ - - - Download Sample Videos / Dummy Videos For Demo Use - - - - - - - - - - - - - - - - - -
- - -
-
- - - -
-
-
-
- -
- - -
- -
- - -
- -
-
-
- - - -
- -

Download Sample Videos

- -

Are you a mobile app developer?

-

Are you looking for videos of different resolution and sizes to test while designing or developing a mobile app?

-

Sample-Videos.com is a 100% FREE service that allows programmers, testers, designers, developers to download sample videos for demo/test use. No matter what video format they use (MP4, FLV, MKV, 3GP); they will be able to test videos on any Smartphone without any hustle. This is a one stop destination for all sample video testing needs. Just search below for the relevant video formats in specific sizes, download them, and start testing.

-

A mobile screen resolution can be a big challenge when it comes to watching videos online or offline. By testing out videos one can be rest assured regarding the video playback in an app, without annoying the end users. Choose from four different video extensions i.e. 3GP, MKV, FLV, and MP4. The best thing is all of these are free and very easy to download. We provide you with a specific and perfect resolution in all sizes possible with just one simple click. Check out the one which suits your requirements. All you need to do is hit the DOWNLOAD button, and get started.

- - -
-

Download .mp4 Sample Video

- -
- - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
1mp41280x720Click
2mp41280x720Click
5mp41280x720Click
10mp41280x720Click
- - - -
20mp41280x720Click
30mp41280x720Click
1mp4720x480Click
2mp4720x480Click
5mp4720x480Click
10mp4720x480Click
20mp4720x480Click
30mp4720x480Click
1mp4640x360Click
2mp4640x360Click
5mp4640x360Click
10mp4640x360Click
20mp4640x360Click
30mp4640x360Click
1mp4360x240Click
2mp4360x240Click
5mp4360x240Click
10mp4360x240Click
20mp4360x240Click
30mp4360x240Click
- -
- -
-
- -

Download .flv Sample Video

-
- - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
1flv1280x720Click
2flv1280x720Click
5flv1280x720Click
10flv1280x720Click
- - - -
20flv1280x720Click
30flv1280x720Click
1flv720x480Click
2flv720x480Click
5flv720x480Click
10flv720x480Click
20flv720x480Click
30flv720x480Click
1flv640x360Click
2flv640x360Click
5flv640x360Click
10flv640x360Click
20flv640x360Click
30flv640x360Click
1flv360x240Click
2flv360x240Click
5flv360x240Click
10flv360x240Click
20flv360x240Click
30flv360x240Click
-
- -
-
- -

Download .mkv Sample Video

-
- - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
1mkv1280x720Click
2mkv1280x720Click
5mkv1280x720Click
10mkv1280x720Click
- - - -
20mkv1280x720Click
30mkv1280x720Click
1mkv720x480Click
2mkv720x480Click
5mkv720x480Click
10mkv720x480Click
20mkv720x480Click
30mkv720x480Click
1mkv640x360Click
2mkv640x360Click
5mkv640x360Click
10mkv640x360Click
20mkv640x360Click
30mkv640x360Click
1mkv360x240Click
2mkv360x240Click
5mkv360x240Click
10mkv360x240Click
20mkv360x240Click
30mkv360x240Click
- -
- -
-
- -

Download .3gp Sample Video

-
- - - - - - - - - - - - - - - -
Size(mb)FormatResolutionOne Click Download
13gp176x144Click
23gp176x144Click
53gp176x144Click
103gp176x144Click
- - - -
13gp320x240Click
23gp320x240Click
53gp320x240Click
103gp320x240Click
203gp320x240Click
303gp320x240Click
- -
- -
- - - - -
- - -
-
- - - - - -
-
- -
-
-
- -
-
- -
-
-
- -
-
- -
-
- - - -
- -
- -
- - - - - - - -
- - - - -
- - -
- -
- - -
- - - - - - - - - - - - - -
-
- © Sample Video Developers - www.bigbuckbunny.org -
-
- - - - - - - - - - - - - - - - - - - - - -
- - diff --git a/FusionIIIT/media/Screenshot_1.png b/FusionIIIT/media/Screenshot_1.png deleted file mode 100644 index 03aed985d..000000000 Binary files a/FusionIIIT/media/Screenshot_1.png and /dev/null differ diff --git a/FusionIIIT/media/Screenshot_1_ZRkbwbZ.png b/FusionIIIT/media/Screenshot_1_ZRkbwbZ.png deleted file mode 100644 index 03aed985d..000000000 Binary files a/FusionIIIT/media/Screenshot_1_ZRkbwbZ.png and /dev/null differ diff --git a/FusionIIIT/media/Screenshot_2020-07-01_CBIR_Using_Color_Difference_Histogram_-_Retrieval_-_Jupyter_Notebook.png b/FusionIIIT/media/Screenshot_2020-07-01_CBIR_Using_Color_Difference_Histogram_-_Retrieval_-_Jupyter_Notebook.png deleted file mode 100644 index 80bfcf678..000000000 Binary files a/FusionIIIT/media/Screenshot_2020-07-01_CBIR_Using_Color_Difference_Histogram_-_Retrieval_-_Jupyter_Notebook.png and /dev/null differ diff --git a/FusionIIIT/media/Solution.jpeg b/FusionIIIT/media/Solution.jpeg deleted file mode 100644 index c4467fe4b..000000000 Binary files a/FusionIIIT/media/Solution.jpeg and /dev/null differ diff --git a/FusionIIIT/media/a1.PNG b/FusionIIIT/media/a1.PNG deleted file mode 100644 index 1d1e6039d..000000000 Binary files a/FusionIIIT/media/a1.PNG and /dev/null differ diff --git a/FusionIIIT/media/ajju.pdf b/FusionIIIT/media/ajju.pdf deleted file mode 100644 index 8c794c0a0..000000000 Binary files a/FusionIIIT/media/ajju.pdf and /dev/null differ diff --git a/FusionIIIT/media/ajju_ipTPZnA.pdf b/FusionIIIT/media/ajju_ipTPZnA.pdf deleted file mode 100644 index 8c794c0a0..000000000 Binary files a/FusionIIIT/media/ajju_ipTPZnA.pdf and /dev/null differ diff --git a/FusionIIIT/media/allane.pdf b/FusionIIIT/media/allane.pdf deleted file mode 100644 index aea95724d..000000000 Binary files a/FusionIIIT/media/allane.pdf and /dev/null differ diff --git a/FusionIIIT/media/allane_mqBZZDj.pdf b/FusionIIIT/media/allane_mqBZZDj.pdf deleted file mode 100644 index aea95724d..000000000 Binary files a/FusionIIIT/media/allane_mqBZZDj.pdf and /dev/null differ diff --git a/FusionIIIT/media/bonafide.pdf b/FusionIIIT/media/bonafide.pdf deleted file mode 100644 index 9469632b6..000000000 Binary files a/FusionIIIT/media/bonafide.pdf and /dev/null differ diff --git a/FusionIIIT/media/bonafide_3p6qeQY.pdf b/FusionIIIT/media/bonafide_3p6qeQY.pdf deleted file mode 100644 index 9469632b6..000000000 Binary files a/FusionIIIT/media/bonafide_3p6qeQY.pdf and /dev/null differ diff --git a/FusionIIIT/media/bonafide_W7s1Auu.pdf b/FusionIIIT/media/bonafide_W7s1Auu.pdf deleted file mode 100644 index 9469632b6..000000000 Binary files a/FusionIIIT/media/bonafide_W7s1Auu.pdf and /dev/null differ diff --git a/FusionIIIT/media/bonafide_b25Y6TV.pdf b/FusionIIIT/media/bonafide_b25Y6TV.pdf deleted file mode 100644 index 9469632b6..000000000 Binary files a/FusionIIIT/media/bonafide_b25Y6TV.pdf and /dev/null differ diff --git a/FusionIIIT/media/demo.zip b/FusionIIIT/media/demo.zip deleted file mode 100644 index 15cb0ecb3..000000000 Binary files a/FusionIIIT/media/demo.zip and /dev/null differ diff --git a/FusionIIIT/media/demo_0SCeEho.zip b/FusionIIIT/media/demo_0SCeEho.zip deleted file mode 100644 index 15cb0ecb3..000000000 Binary files a/FusionIIIT/media/demo_0SCeEho.zip and /dev/null differ diff --git a/FusionIIIT/media/demo_Ecf0ATC.zip b/FusionIIIT/media/demo_Ecf0ATC.zip deleted file mode 100644 index 15cb0ecb3..000000000 Binary files a/FusionIIIT/media/demo_Ecf0ATC.zip and /dev/null differ diff --git a/FusionIIIT/media/demo_uqf8R7p.zip b/FusionIIIT/media/demo_uqf8R7p.zip deleted file mode 100644 index 15cb0ecb3..000000000 Binary files a/FusionIIIT/media/demo_uqf8R7p.zip and /dev/null differ diff --git a/FusionIIIT/media/documents/wrist_band.jpg b/FusionIIIT/media/documents/wrist_band.jpg deleted file mode 100644 index abbbdceda..000000000 Binary files a/FusionIIIT/media/documents/wrist_band.jpg and /dev/null differ diff --git a/FusionIIIT/media/event.jpg b/FusionIIIT/media/event.jpg deleted file mode 100644 index bb88b387b..000000000 Binary files a/FusionIIIT/media/event.jpg and /dev/null differ diff --git a/FusionIIIT/media/event.pdf b/FusionIIIT/media/event.pdf deleted file mode 100644 index b92477282..000000000 Binary files a/FusionIIIT/media/event.pdf and /dev/null differ diff --git a/FusionIIIT/media/event_n6JOVni.pdf b/FusionIIIT/media/event_n6JOVni.pdf deleted file mode 100644 index b92477282..000000000 Binary files a/FusionIIIT/media/event_n6JOVni.pdf and /dev/null differ diff --git a/FusionIIIT/media/image.jpg b/FusionIIIT/media/image.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_007RJnp.jpg b/FusionIIIT/media/image_007RJnp.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_007RJnp.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_08EzmEH.jpg b/FusionIIIT/media/image_08EzmEH.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_08EzmEH.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_6xkgtat.jpg b/FusionIIIT/media/image_6xkgtat.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_6xkgtat.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_8Al2hkC.jpg b/FusionIIIT/media/image_8Al2hkC.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_8Al2hkC.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_DArY4kM.jpg b/FusionIIIT/media/image_DArY4kM.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_DArY4kM.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_Dj9wBVK.jpg b/FusionIIIT/media/image_Dj9wBVK.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_Dj9wBVK.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_DnBzrXz.jpg b/FusionIIIT/media/image_DnBzrXz.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_DnBzrXz.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_EHN0uUR.jpg b/FusionIIIT/media/image_EHN0uUR.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_EHN0uUR.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_ERAUsuR.jpg b/FusionIIIT/media/image_ERAUsuR.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_ERAUsuR.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_FCiEnEA.jpg b/FusionIIIT/media/image_FCiEnEA.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_FCiEnEA.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_GDxnCEC.jpg b/FusionIIIT/media/image_GDxnCEC.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_GDxnCEC.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_Gt3KGJq.jpg b/FusionIIIT/media/image_Gt3KGJq.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_Gt3KGJq.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_Gt3KGJq_bdxtRTW.jpg b/FusionIIIT/media/image_Gt3KGJq_bdxtRTW.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_Gt3KGJq_bdxtRTW.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_Gt3KGJq_rXplFd4.jpg b/FusionIIIT/media/image_Gt3KGJq_rXplFd4.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_Gt3KGJq_rXplFd4.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_Gt3KGJq_sTQs693.jpg b/FusionIIIT/media/image_Gt3KGJq_sTQs693.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_Gt3KGJq_sTQs693.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_IsZTv03.jpg b/FusionIIIT/media/image_IsZTv03.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_IsZTv03.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_LUkx8md.jpg b/FusionIIIT/media/image_LUkx8md.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_LUkx8md.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_OFiO2Bh.jpg b/FusionIIIT/media/image_OFiO2Bh.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_OFiO2Bh.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_OLuWcRU.jpg b/FusionIIIT/media/image_OLuWcRU.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_OLuWcRU.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_Onw3X55.jpg b/FusionIIIT/media/image_Onw3X55.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_Onw3X55.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_SGKG9Zh.jpg b/FusionIIIT/media/image_SGKG9Zh.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_SGKG9Zh.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_UiGJa1M.jpg b/FusionIIIT/media/image_UiGJa1M.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_UiGJa1M.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_VAHo0g5.jpg b/FusionIIIT/media/image_VAHo0g5.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_VAHo0g5.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_Z5HxbWe.jpg b/FusionIIIT/media/image_Z5HxbWe.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_Z5HxbWe.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_ZHDevJQ.jpg b/FusionIIIT/media/image_ZHDevJQ.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_ZHDevJQ.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_behus5I.jpg b/FusionIIIT/media/image_behus5I.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_behus5I.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_iBr1k6y.jpg b/FusionIIIT/media/image_iBr1k6y.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_iBr1k6y.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_kKfwblf.jpg b/FusionIIIT/media/image_kKfwblf.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_kKfwblf.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_nJznh8V.jpg b/FusionIIIT/media/image_nJznh8V.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_nJznh8V.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_nbHQErT.jpg b/FusionIIIT/media/image_nbHQErT.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_nbHQErT.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_qsbU8zn.jpg b/FusionIIIT/media/image_qsbU8zn.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_qsbU8zn.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_r9niVQQ.jpg b/FusionIIIT/media/image_r9niVQQ.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_r9niVQQ.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_vanCtHs.jpg b/FusionIIIT/media/image_vanCtHs.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_vanCtHs.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_xStQjYa.jpg b/FusionIIIT/media/image_xStQjYa.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_xStQjYa.jpg and /dev/null differ diff --git a/FusionIIIT/media/image_xZWkinz.jpg b/FusionIIIT/media/image_xZWkinz.jpg deleted file mode 100644 index 725dd6a15..000000000 Binary files a/FusionIIIT/media/image_xZWkinz.jpg and /dev/null differ diff --git a/FusionIIIT/media/mj.png b/FusionIIIT/media/mj.png deleted file mode 100644 index 4a086b80a..000000000 Binary files a/FusionIIIT/media/mj.png and /dev/null differ diff --git a/FusionIIIT/media/mj_Al5ccBb.png b/FusionIIIT/media/mj_Al5ccBb.png deleted file mode 100644 index 4a086b80a..000000000 Binary files a/FusionIIIT/media/mj_Al5ccBb.png and /dev/null differ diff --git a/FusionIIIT/media/mj_J3NIY2c.png b/FusionIIIT/media/mj_J3NIY2c.png deleted file mode 100644 index 4a086b80a..000000000 Binary files a/FusionIIIT/media/mj_J3NIY2c.png and /dev/null differ diff --git a/FusionIIIT/media/mj_NfL2mTM.png b/FusionIIIT/media/mj_NfL2mTM.png deleted file mode 100644 index 4a086b80a..000000000 Binary files a/FusionIIIT/media/mj_NfL2mTM.png and /dev/null differ diff --git a/FusionIIIT/media/mj_ZImWkc8.png b/FusionIIIT/media/mj_ZImWkc8.png deleted file mode 100644 index 4a086b80a..000000000 Binary files a/FusionIIIT/media/mj_ZImWkc8.png and /dev/null differ diff --git a/FusionIIIT/media/mmmm.png b/FusionIIIT/media/mmmm.png deleted file mode 100644 index 52a802bb0..000000000 Binary files a/FusionIIIT/media/mmmm.png and /dev/null differ diff --git a/FusionIIIT/media/mmmm_dFrFt7K.png b/FusionIIIT/media/mmmm_dFrFt7K.png deleted file mode 100644 index 52a802bb0..000000000 Binary files a/FusionIIIT/media/mmmm_dFrFt7K.png and /dev/null differ diff --git a/FusionIIIT/media/output-onlinepngtools_5.png b/FusionIIIT/media/output-onlinepngtools_5.png deleted file mode 100644 index 782551f21..000000000 Binary files a/FusionIIIT/media/output-onlinepngtools_5.png and /dev/null differ diff --git a/FusionIIIT/media/output-onlinepngtools_5_47NIAdi.png b/FusionIIIT/media/output-onlinepngtools_5_47NIAdi.png deleted file mode 100644 index 782551f21..000000000 Binary files a/FusionIIIT/media/output-onlinepngtools_5_47NIAdi.png and /dev/null differ diff --git a/FusionIIIT/media/output-onlinepngtools_5_ZAOVWvi.png b/FusionIIIT/media/output-onlinepngtools_5_ZAOVWvi.png deleted file mode 100644 index 782551f21..000000000 Binary files a/FusionIIIT/media/output-onlinepngtools_5_ZAOVWvi.png and /dev/null differ diff --git a/FusionIIIT/media/photo-1480365501497-199581be0e66.jpg b/FusionIIIT/media/photo-1480365501497-199581be0e66.jpg deleted file mode 100644 index 55c4b20bc..000000000 Binary files a/FusionIIIT/media/photo-1480365501497-199581be0e66.jpg and /dev/null differ diff --git a/FusionIIIT/media/sample.jpg b/FusionIIIT/media/sample.jpg deleted file mode 100644 index 0a18df12f..000000000 Binary files a/FusionIIIT/media/sample.jpg and /dev/null differ diff --git a/FusionIIIT/media/sample_a2In3HQ.jpg b/FusionIIIT/media/sample_a2In3HQ.jpg deleted file mode 100644 index 0a18df12f..000000000 Binary files a/FusionIIIT/media/sample_a2In3HQ.jpg and /dev/null differ diff --git a/FusionIIIT/media/sample_maFMAz9.jpg b/FusionIIIT/media/sample_maFMAz9.jpg deleted file mode 100644 index 0a18df12f..000000000 Binary files a/FusionIIIT/media/sample_maFMAz9.jpg and /dev/null differ diff --git a/FusionIIIT/media/window.png b/FusionIIIT/media/window.png deleted file mode 100644 index 4ddc642a5..000000000 Binary files a/FusionIIIT/media/window.png and /dev/null differ diff --git a/FusionIIIT/media/window_QaSCiCB.png b/FusionIIIT/media/window_QaSCiCB.png deleted file mode 100644 index 4ddc642a5..000000000 Binary files a/FusionIIIT/media/window_QaSCiCB.png and /dev/null differ diff --git a/FusionIIIT/media/wrist_band.jpg b/FusionIIIT/media/wrist_band.jpg deleted file mode 100644 index abbbdceda..000000000 Binary files a/FusionIIIT/media/wrist_band.jpg and /dev/null differ diff --git a/FusionIIIT/media/wrist_band_104sJ7l.jpg b/FusionIIIT/media/wrist_band_104sJ7l.jpg deleted file mode 100644 index abbbdceda..000000000 Binary files a/FusionIIIT/media/wrist_band_104sJ7l.jpg and /dev/null differ diff --git a/FusionIIIT/templates/academic_procedures/academic.html b/FusionIIIT/templates/academic_procedures/academic.html old mode 100755 new mode 100644 index 6b04a54fb..35eebf446 --- a/FusionIIIT/templates/academic_procedures/academic.html +++ b/FusionIIIT/templates/academic_procedures/academic.html @@ -22,6 +22,39 @@ } + + {% endblock css %} @@ -30,13 +63,12 @@ {% include 'dashboard/navbar.html' %} {% endblock %} -
+
- {% comment %}The left-margin segment!{% endcomment %} -
+ {% comment %}The left-rail segment starts here!{% endcomment %} -
+
{% comment %}The user image card starts here!{% endcomment %} {% block usercard %} {% include 'globals/usercard.html' %} @@ -46,8 +78,8 @@
{% comment %}The Tab-Menu starts here!{% endcomment %} -
+
+
+
+ + +
+

+ +
+
+
+ + +
+

diff --git a/FusionIIIT/templates/ais/profile.html b/FusionIIIT/templates/ais/profile.html index 479de29f6..d30c5fa0e 100755 --- a/FusionIIIT/templates/ais/profile.html +++ b/FusionIIIT/templates/ais/profile.html @@ -29,7 +29,7 @@

Note : Provide the data in Excel Sheet in following format:

RollNo | First Name | Last Name | Email | Sex | DOB | Father's Name | Mother's Name | Category | Phone No | Address | Department | Specialization | Hall No -

Download the sample Excel, fill the data accordingly and then upload the same

+

Download the sample Excel, fill the data accordingly and then upload the same

diff --git a/FusionIIIT/templates/complaintModule/add_workers.html b/FusionIIIT/templates/complaintModule/add_workers.html index 842d4397a..eafae79c7 100644 --- a/FusionIIIT/templates/complaintModule/add_workers.html +++ b/FusionIIIT/templates/complaintModule/add_workers.html @@ -118,7 +118,7 @@ Click on the particular worker to remove

- These Worker present under Caretaker : {{ request.user.first_name}} + These Worker present under Department Head : {{ request.user.first_name}} {{ request.user.last_name}}


diff --git a/FusionIIIT/templates/complaintModule/assignworker.html b/FusionIIIT/templates/complaintModule/assignworker.html index 458d05ff9..7bd227d28 100644 --- a/FusionIIIT/templates/complaintModule/assignworker.html +++ b/FusionIIIT/templates/complaintModule/assignworker.html @@ -1,4 +1,4 @@ - + {% extends 'globals/base.html' %} {% load static %} @@ -110,7 +110,12 @@ : {{ detail.specific_location }}
- +
+ + Complaint Detail + : {{ detail.details }} + +
Status @@ -165,7 +170,7 @@

If you think that this complaint does not belong to you .
- You a can pass this complaint to required caretaker .

+ You a can pass this complaint to required section incharge .

{% csrf_token %}
@@ -198,17 +203,11 @@

If you think that this complaint does not belong to you .
- {% if detail.status != 0 %} - -

You have assigned a worker. First, remove the worker from this complaint then - declined this complaint. - .

- {% else %} - - + {% if total_secincharge %} + {% for i in total_secincharge %} + {% endfor %} {% else %} @@ -221,13 +220,12 @@

You have assigned a worker. First, remove the worker from this complaint the - {% if total_caretakers_in_area %} + {% if total_secincharge %} {% endif %} - {% endif %}

@@ -235,11 +233,9 @@

You have assigned a worker. First, remove the worker from this complaint the

{% comment %}The ... end here!{% endcomment %} - - +
- {% comment %}The central-rail segment ends here!{% endcomment %} {% comment %}The right-rail segment starts here!{% endcomment %} diff --git a/FusionIIIT/templates/complaintModule/complaint_caretaker.html b/FusionIIIT/templates/complaintModule/complaint_caretaker.html index 688097058..861bf411a 100644 --- a/FusionIIIT/templates/complaintModule/complaint_caretaker.html +++ b/FusionIIIT/templates/complaintModule/complaint_caretaker.html @@ -61,25 +61,19 @@ {% comment %}The Tab-Menu ends here!{% endcomment %} @@ -94,16 +88,9 @@ The central-rail segment starts here! {% endcomment %}
- {% comment %}The ... start here!{% endcomment %} -
- {% block lodgecomplaint %} - {% include 'complaintModule/add_workers.html' %} - {% endblock %} -
- {% comment %}The ... end here!{% endcomment %} {% comment %}The ... starts here!{% endcomment %} -
+
{% block complainthistory %} {% include 'complaintModule/complainthistory_caretaker.html' %} {% endblock %} @@ -111,21 +98,20 @@ {% comment %}The ... ends here!{% endcomment %} {% comment %}The ... starts here!{% endcomment %} -
+
{% block resolvecomplaint %} - {% include 'complaintModule/resolvecomplaint.html' %} - {% endblock %} -
-
- {% block overduecomplaint %} - {% include 'complaintModule/overduecomplaint.html' %} + {% include 'complaintModule/resolvecomplaint_caretaker.html' %} {% endblock %}
{% comment %}The ... ends here!{% endcomment %} - {% comment %}The ... starts here!{% endcomment %} - - {% comment %}The ... ends here!{% endcomment %} + {% comment %}The ... start here!{% endcomment %} +
+ {% block lodgecomplaint %} + {% include 'complaintModule/lodgecomplaint_user.html' %} + {% endblock %} +
+ {% comment %}The ... end here!{% endcomment %}
{% comment %}The central-rail segment ends here!{% endcomment %} diff --git a/FusionIIIT/templates/complaintModule/complaint_secincharge.html b/FusionIIIT/templates/complaintModule/complaint_secincharge.html new file mode 100644 index 000000000..5b941db40 --- /dev/null +++ b/FusionIIIT/templates/complaintModule/complaint_secincharge.html @@ -0,0 +1,161 @@ + + +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} + Complaint +{% endblock %} + + + + +{% block body %} + {% block navBar %} + {% include 'dashboard/navbar.html' %} + {% endblock %} + + + {% comment %}The grid starts here!{% endcomment %} +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %} + The left-rail segment starts here! + {% endcomment %} +
+ + {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + + {% comment %}
{% endcomment %} +       + {% comment %}
+ {% if care_id.rating == 5 %} + + + {% elif care_id.rating == 4 %} + + + {% elif care_id.rating == 3 %} + + + {% elif care_id.rating == 2 %} + + + {% elif care_id.rating == 1 %} + + + {% elif care_id.rating == 0 %} + + + {% endif %} +
{% endcomment %} + {% comment %}The Tab-Menu starts here!{% endcomment %} + + {% comment %}The Tab-Menu ends here!{% endcomment %} + +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ {% comment %}The ... start here!{% endcomment %} +
+ {% block lodgecomplaint %} + {% include 'complaintModule/add_workers.html' %} + {% endblock %} +
+ {% comment %}The ... end here!{% endcomment %} + + {% comment %}The ... starts here!{% endcomment %} +
+ {% block complainthistory %} + {% include 'complaintModule/complainthistory_secincharge.html' %} + {% endblock %} +
+ {% comment %}The ... ends here!{% endcomment %} + + {% comment %}The ... starts here!{% endcomment %} +
+ {% block resolvecomplaint %} + {% include 'complaintModule/resolvecomplaint_secincharge.html' %} + {% endblock %} +
+
+ {% block overduecomplaint %} + {% include 'complaintModule/overduecomplaint.html' %} + {% endblock %} +
+ {% comment %}The ... ends here!{% endcomment %} + + {% comment %}The ... starts here!{% endcomment %} + + {% comment %}The ... ends here!{% endcomment %} + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% block complaint_notification %} + {% include 'complaintModule/complaint_notification.html' %} + {% endblock %} +
+ +
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+ {% comment %}The grid ends here!{% endcomment %} + +{% endblock %} + +{% block javascript %} + + + + + +{% endblock %} + + + diff --git a/FusionIIIT/templates/complaintModule/complaint_caretaker_detail.html b/FusionIIIT/templates/complaintModule/complaint_secincharge_detail.html similarity index 81% rename from FusionIIIT/templates/complaintModule/complaint_caretaker_detail.html rename to FusionIIIT/templates/complaintModule/complaint_secincharge_detail.html index 790d00b6f..07bee8beb 100644 --- a/FusionIIIT/templates/complaintModule/complaint_caretaker_detail.html +++ b/FusionIIIT/templates/complaintModule/complaint_secincharge_detail.html @@ -1,167 +1,151 @@ - -{% extends 'globals/base.html' %} -{% load static %} - - -{% block title %} -Complaint -{% endblock %} - - -{% block body %} -{% block navBar %} -{% include 'dashboard/navbar.html' %} -{% endblock %} - - -{% comment %}The grid starts here!{% endcomment %} -
- - {% comment %}The left-margin segment!{% endcomment %} -
- - {% comment %} - The left-rail segment starts here! - {% endcomment %} -
- - {% comment %}The user image card starts here!{% endcomment %} - {% block usercard %} - {% include 'globals/usercard.html' %} - {% endblock %} - {% comment %}The user image card ends here!{% endcomment %} - - -
- - {% comment %}The Tab-Menu starts here!{% endcomment %} - - {% comment %}The Tab-Menu ends here!{% endcomment %} - -
- {% comment %} - The left-rail segment ends here! - {% endcomment %} -
- {% comment %}The ... start here!{% endcomment %} -
- - - - -
- -
-
- {% csrf_token %} -
-

-
Complainer : - {{detail2.complainer.user.first_name}} - {{detail2.complainer.user.last_name}} -
Complainer ID : {{ detail2.complainer.id }} -
-
-

-
-

-
Complaint ID : {{ comp_id }}
- Complaint Details : {{detail2.details }}
- Worker Assigned : {{ worker_name }} -
-
- {% if num == 1 %} -
-

- -

-
- {% else%} -
-

- -

-
- {% endif %} - - -
-
- -
- - - {% if worker_name is None %} - - {% else %} - - - {% endif %} -
- -
- {% comment %}The ... end here!{% endcomment %} -
- {% comment %}The central-rail segment ends here!{% endcomment %} - - {% comment %}The right-rail segment starts here!{% endcomment %} -
-
- {% comment %} - TODO: the right rail! - {% endcomment %} -
-
- {% comment %}The right-rail segment ends here!{% endcomment %} - - {% comment %}The right-margin segment!{% endcomment %} -
- -
- {% comment %}The grid ends here!{% endcomment %} - - {% endblock %} - - {% block javascript %} - - - - - {% endblock %} - - {% block css %} - - {% endblock %} - + +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Complaint +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + + +{% comment %}The grid starts here!{% endcomment %} +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %} + The left-rail segment starts here! + {% endcomment %} +
+ + {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + + +
+ + {% comment %}The Tab-Menu starts here!{% endcomment %} + + {% comment %}The Tab-Menu ends here!{% endcomment %} + +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} +
+ {% comment %}The ... start here!{% endcomment %} +
+ + + + +
+ +
+
+ {% csrf_token %} +
+

+
Complainer : + {{detail2.complainer.user.first_name}} + {{detail2.complainer.user.last_name}} +
Complainer ID : {{ detail2.complainer.id }} +
+
+

+
+

+
Complaint ID : {{ comp_id }}
+ Complaint Details : {{detail2.details }}
+ Worker Assigned : {{ worker_name }} +
+
+ {% if num == 1 %} +
+

+ +

+
+ {% else%} +
+

+ +

+
+ {% endif %} + + +
+
+ +
+ + + {% if worker_name is None %} + + {% else %} + + + {% endif %} +
+ +
+ {% comment %}The ... end here!{% endcomment %} +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+
+ {% comment %} + TODO: the right rail! + {% endcomment %} +
+
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+ {% comment %}The grid ends here!{% endcomment %} + + {% endblock %} + + {% block javascript %} + + + + + {% endblock %} + + {% block css %} + + {% endblock %} + diff --git a/FusionIIIT/templates/complaintModule/complainthistory_caretaker.html b/FusionIIIT/templates/complaintModule/complainthistory_caretaker.html index 74ef9798f..6d3afc30c 100644 --- a/FusionIIIT/templates/complaintModule/complainthistory_caretaker.html +++ b/FusionIIIT/templates/complaintModule/complainthistory_caretaker.html @@ -1,7 +1,7 @@ {% load static %} -{% block complainthistory %} +{% block complainthistory_caretaker.html %} {% comment %}The tab menu starts here!{% endcomment %} {% endblock %} {% block javascript %} - - - + + + {% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/complaintModule/reassignworker.html b/FusionIIIT/templates/complaintModule/reassignworker.html index 1839d013b..0a36640ed 100644 --- a/FusionIIIT/templates/complaintModule/reassignworker.html +++ b/FusionIIIT/templates/complaintModule/reassignworker.html @@ -1,4 +1,4 @@ - + {% extends 'globals/base.html' %} {% load static %} @@ -38,7 +38,7 @@ style="max-width: 320px;"> - Assign Workers / Redirect + Reassign Worker @@ -57,9 +57,6 @@ Assign Worker - - Redirect -
@@ -110,7 +107,12 @@ : {{ detail.specific_location }}
- +
+ + Complaint Detail + : {{ detail.details }} + +
Status @@ -161,78 +163,7 @@

- -
-
-

If you think that this complaint does not belong to you .
- You a can pass this complaint to required caretaker .

-
- {% csrf_token %} -
- -
Complaint ID :{{ detail.complainer }}
-
Complainer :{{ detail.complainer.user.first_name }} - {{detail.complainer.user.last_name}} -
-
-
- -
-
- - - - -
-
- - - - -
-
- - - - -
Complaint Type: {{ detail.complaint_type }}
Location: {{ detail.location }}
Specific Location: {{ detail.specific_location }}
-
- - {% if detail.status != 0 %} - -

You have assigned a worker. First, remove the worker from this complaint then - declined this complaint. - .

- - - - {% else %} - - -

- - - - - - {% endif %} -
-
-
-
-
- + {% comment %}The ... end here!{% endcomment %} diff --git a/FusionIIIT/templates/complaintModule/resolve_pending.html b/FusionIIIT/templates/complaintModule/resolve_pending.html index 71fc9ef80..57cdd816d 100644 --- a/FusionIIIT/templates/complaintModule/resolve_pending.html +++ b/FusionIIIT/templates/complaintModule/resolve_pending.html @@ -99,7 +99,7 @@
diff --git a/FusionIIIT/templates/complaintModule/resolvecomplaint_caretaker.html b/FusionIIIT/templates/complaintModule/resolvecomplaint_caretaker.html new file mode 100644 index 000000000..853759ffe --- /dev/null +++ b/FusionIIIT/templates/complaintModule/resolvecomplaint_caretaker.html @@ -0,0 +1,128 @@ +{% load static %} +{% block resolvecomplaint_caretaker %} + + {% comment %}The tab menu starts here!{% endcomment %} + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + {% for a in history %} + {% if a.status == 1 %} + + + + + + + + + + + + + + + {% endif %} + {% endfor %} +
+ Student + + Date + + Type + + Location + + Details + + Worker
Name
+
+ change status +
+

+ +
+ {{ a.complainer.user }} +
+
+
+

+
+ {{ a.complaint_date }} + + {{ a.complaint_type }} + + {{ a.specific_location }},  + {{ a.location }} + + + + + {{ a.worker_id }} + +
+
+ + + +
+
+
+ +
+
+ + + +
+
+ : These Complaints have been ASSIGNED to Workers! Please Change their status as soon as they are Resolved !       + +
+
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/complaintModule/resolvecomplaint.html b/FusionIIIT/templates/complaintModule/resolvecomplaint_secincharge.html similarity index 51% rename from FusionIIIT/templates/complaintModule/resolvecomplaint.html rename to FusionIIIT/templates/complaintModule/resolvecomplaint_secincharge.html index a2d48ec12..105e7581d 100644 --- a/FusionIIIT/templates/complaintModule/resolvecomplaint.html +++ b/FusionIIIT/templates/complaintModule/resolvecomplaint_secincharge.html @@ -1,5 +1,5 @@ {% load static %} -{% block resolvecomplaint %} +{% block resolvecomplaint_secincharge %} {% comment %}The tab menu starts here!{% endcomment %} @@ -133,132 +131,4 @@

- - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - {% for a in history %} - {% if a.status == 1 %} - - - - - - - - - - - - - - - {% endif %} - {% endfor %} -
- Student - - Date - - Type - - Location - - Details - - Worker
Name
-
- change status -
-

- -
- {{ a.complainer.user }} -
-
-
-

-
- {{ a.complaint_date }} - - {{ a.complaint_type }} - - {{ a.specific_location }},  - {{ a.location }} - - - - - {{ a.worker_id }} - -
-
- - - -
-
-
- -
-
- - - -
-
- : These Complaints have been ASSIGNED to Workers! Please Change their status as soon as they are Resolved !       - -
-
-
-
- {% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/complaintModule/supervisor1.html b/FusionIIIT/templates/complaintModule/supervisor1.html index 9e25db8f1..edeb08110 100644 --- a/FusionIIIT/templates/complaintModule/supervisor1.html +++ b/FusionIIIT/templates/complaintModule/supervisor1.html @@ -36,7 +36,7 @@ style="max-width: 320px;"> - View Caretaker + Manage Caretaker @@ -50,13 +50,11 @@ Overdue Complaints + + + Lodge Complaint + - - - - - -
{% comment %}The Tab-Menu ends here!{% endcomment %} @@ -86,7 +84,7 @@
{% comment %}The ... end here!{% endcomment %} {% comment %}The ... start here!{% endcomment %} -
+
{% block unresolvedsuper %} {% include 'complaintModule/unresolved_super.html' %} {% endblock %} @@ -98,9 +96,6 @@ {% endblock %}
{% comment %}The ... end here!{% endcomment %} - - - {% comment %}The ... starts here!{% endcomment %} @@ -131,4 +126,9 @@ + {% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/complaintModule/worker_id_know_more.html b/FusionIIIT/templates/complaintModule/worker_id_know_more.html index 8d1f2d801..fae142121 100644 --- a/FusionIIIT/templates/complaintModule/worker_id_know_more.html +++ b/FusionIIIT/templates/complaintModule/worker_id_know_more.html @@ -72,7 +72,7 @@
-

{{this_worker.name}} works under {{work_under_caretaker1}} {{work_under_caretaker2}}




+

{{this_worker.name}} works under {{work_under_secincharge1}} {{work_under_secincharge2}}




{%if numpend == 0 %}

The Worker does not hold any pending complaints.

diff --git a/FusionIIIT/templates/coursemanagement/addcontent.html b/FusionIIIT/templates/coursemanagement/addcontent.html index 22e9986c7..17b3363dc 100644 --- a/FusionIIIT/templates/coursemanagement/addcontent.html +++ b/FusionIIIT/templates/coursemanagement/addcontent.html @@ -69,13 +69,13 @@

Report:

- {% for slide in slides %} + {% for slide in slides1 %} {{forloop.counter}} {{slide.document_name}} + {% comment %}

{{slide.document_url}}

{% endcomment %} diff --git a/FusionIIIT/templates/coursemanagement/assessment.html b/FusionIIIT/templates/coursemanagement/assessment.html index 41a7954e9..286a33820 100644 --- a/FusionIIIT/templates/coursemanagement/assessment.html +++ b/FusionIIIT/templates/coursemanagement/assessment.html @@ -11,11 +11,11 @@

{{course.course_name}}

- {% for assi in assignment %} + {% for assi in assignment1 %}
@@ -45,18 +45,35 @@

- - {% ifequal extrainfo.designation|stringformat:"s" "student" %} + {% ifequal extrainfo.user_type|stringformat:"s" "student" %} {% endifequal %} - {% ifequal extrainfo.designation|stringformat:"s" "student" %} {% for course,instructor in courses.items %} + {% ifequal extrainfo.user_type|stringformat:"s" "student" %} {% for x in courses %} - - - + {% comment %} {{x.data}} {% endcomment %} + + + {% endfor %} {% else %} {% for curriculum in curriculum_list %} @@ -113,14 +114,13 @@

{% comment %}The Basic Course details segment ends here!{% endcomment %} {% comment %}The Assignment segment starts here!{% endcomment %} - -
- + {% comment %}

hfexlelel

{% endcomment %} +

-
+
- +
diff --git a/FusionIIIT/templates/coursemanagement/submitassignments.html b/FusionIIIT/templates/coursemanagement/submitassignments.html index 217a12bde..945a74ffc 100644 --- a/FusionIIIT/templates/coursemanagement/submitassignments.html +++ b/FusionIIIT/templates/coursemanagement/submitassignments.html @@ -188,12 +188,12 @@

Report:

- {% for assi in assignment %} + {% for assi in assignment1 %} - diff --git a/FusionIIIT/templates/coursemanagement/viewcourse.html b/FusionIIIT/templates/coursemanagement/viewcourse.html index 88e91fb2a..a35078e4b 100644 --- a/FusionIIIT/templates/coursemanagement/viewcourse.html +++ b/FusionIIIT/templates/coursemanagement/viewcourse.html @@ -312,7 +312,7 @@

Submitable Assignments

- {% endfor %} @@ -333,11 +333,13 @@

Submitable Assignments

{% if Lecturer == 1 %} + {% comment %}

{{course.course_name}}

{% endcomment %}
{% block addcontent %} {% include 'coursemanagement/addcontent.html' %} {% endblock %}
{% else %} +

{{course.course_name}}

@@ -349,7 +351,8 @@

{{course.course_name}}

@@ -413,6 +416,24 @@

Quiz Time Table

{% block comments %} {% include 'coursemanagement/comments.html' %} {% endblock %}
+
+
+ + {% if messages %} +
+
+ +
+ {% for message in messages %} + {{ message }} + {% endfor %} +
+
+
+ {% endif %} + +
+
diff --git a/FusionIIIT/templates/coursemanagement/viewperformance.html b/FusionIIIT/templates/coursemanagement/viewperformance.html index 386b6a9af..489c12d8e 100644 --- a/FusionIIIT/templates/coursemanagement/viewperformance.html +++ b/FusionIIIT/templates/coursemanagement/viewperformance.html @@ -59,13 +59,13 @@

You didn't submit any assignment

{% endif %} {% else %}

Results

- {% if assignment|length %} + {% if assignment1|length %} - {% for assi in assignment %} + {% for assi in assignment1 %}
+
+ {%csrf_token%}
- + {% comment %} {% endcomment %} + +
+
+
+
+ {% comment %} {% endcomment %} + +
- -
- +
-
+ + + + {% comment %}
+
{% endcomment %} + {% comment %}
+ +
{% endcomment %}
- Download + + {% if sa.score %} @@ -85,46 +102,7 @@

-
- - {% csrf_token %} -
- - - - - - - - - - - {% for x in registered_students %} - - - - - {% endfor %} - -
Students
-
-

{{x.student_id}}

-
-
- - - -
-
- - -
+
{% endblock %} diff --git a/FusionIIIT/templates/coursemanagement/coursemanagement1.html b/FusionIIIT/templates/coursemanagement/coursemanagement1.html index 678d79b71..f4dcb29e4 100644 --- a/FusionIIIT/templates/coursemanagement/coursemanagement1.html +++ b/FusionIIIT/templates/coursemanagement/coursemanagement1.html @@ -85,16 +85,17 @@

Course Code Name Of the CourseInstructor
{{course.course_id.course_name}}{{course.course_id.course_id}}{{instructor.instructor_id.user.username}}{{x.data.course_code}}{{x.data.course_id}}{{x.instructor.instructor_id.user.username}}
{{forloop.counter}} {{assi.assignment_name}} {{assi.submit_date}}
+

{{forloop.counter}} {{assi.assignment_name}} {{assi.submit_date}}
+

diff --git a/FusionIIIT/templates/dashboard/dashboard.html b/FusionIIIT/templates/dashboard/dashboard.html old mode 100755 new mode 100644 index 2b940cdbb..d8635259e --- a/FusionIIIT/templates/dashboard/dashboard.html +++ b/FusionIIIT/templates/dashboard/dashboard.html @@ -1,148 +1,140 @@ {% extends 'globals/base.html' %} {% load static %} - {% block title %} -Dashboard + Dashboard {% endblock %} {% block css %} + + + {% endblock %} - -{% comment %}The grid starts here!{% endcomment %} -
- - {% comment %}The left-margin segment!{% endcomment %} -
- - {% comment %} - The left-rail segment starts here! - {% endcomment %} -
- - {% comment %}The user image card starts here!{% endcomment %} - {% block usercard %} - {% include 'globals/usercard.html' %} - {% endblock %} - {% comment %}The user image card ends here!{% endcomment %} - -
- - {% comment %}The Tab-Menu starts here!{% endcomment %} - - {% comment %}The Tab-Menu ends here!{% endcomment %} - - - {% if 'student' != request.user.extrainfo.user_type %} - - {% comment %}The Tab-Menu starts here!{% endcomment %} - - {% comment %}The Tab-Menu ends here!{% endcomment %} - - {% endif %} - - {% comment %}The Tab-Menu starts here!{% endcomment %} - - - {% if request.user.extrainfo.user_type == 'faculty' %} - {%for desig in designat%} - {% if 'hradmin' == desig.designation.name %} - - - {% endif %} - {%endfor %} - {% endif %} - {% comment %}The Tab-Menu ends here!{% endcomment %} - - - - - - - - -
- {% comment %} - The left-rail segment ends here! - {% endcomment %} +{% block body %} + {% block navBar %} + {% include 'dashboard/navbar.html' %} + {% endblock %} + {% comment %} The grid starts here! {% endcomment %} +
- {% comment %} - The central-rail segment starts here! - {% endcomment %} + {% comment %} The left-rail segment starts here! {% endcomment %} +
+ + {% comment %} The user image card starts here! {% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu starts here!{% endcomment %} + + {% comment %}The Tab-Menu ends here!{% endcomment %} -
- -
-
+ {% comment %} The left-rail segment ends here! {% endcomment %} + + {% comment %} The central-rail segment starts here! {% endcomment %} + + {% comment %} The central-rail segment ends here! {% endcomment %} - {% comment %}The right-rail segment starts here!{% endcomment %} -
-
- {% comment %}The Modules:{% endcomment %} + {% comment %} The right-rail segment starts here! {% endcomment %} +
{% block modules %} - {% include 'dashboard/modules.html' %} + {% include 'dashboard/modules.html' %} {% endblock %}
- + {% comment %}The right-rail segment ends here!{% endcomment %}
- {% comment %}The right-rail segment ends here!{% endcomment %} - - {% comment %}The right-margin segment!{% endcomment %} -
- -
-{% comment %}The grid ends here!{% endcomment %} - - - + {% comment %}The grid ends here!{% endcomment %} {% endblock %} {% block javascript %} - - + - + }); + + /*$(document).ready(function(){ + $("#textLoader").toggle(); + $("#replacement-card").toggle(); + setTimeout(loader, 1750); + }); + function loader() { + $("#textLoader").toggle(); + $("#replacement-card").toggle(); + $("#loader").removeClass("active"); + $("#loader").addClass("disabled"); + }*/ + {% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/dashboard/modules.html b/FusionIIIT/templates/dashboard/modules.html index a8680958a..c9c7cd94c 100755 --- a/FusionIIIT/templates/dashboard/modules.html +++ b/FusionIIIT/templates/dashboard/modules.html @@ -20,28 +20,28 @@ {% comment %}A single modules row starts here!{% endcomment %} diff --git a/FusionIIIT/templates/dashboard/navbar.html b/FusionIIIT/templates/dashboard/navbar.html old mode 100755 new mode 100644 index 7d0e7e3f9..8aba787ba --- a/FusionIIIT/templates/dashboard/navbar.html +++ b/FusionIIIT/templates/dashboard/navbar.html @@ -1,14 +1,59 @@ {% load static %} + +{% block css %} + +{% endblock %} + {% block navBar %} {% include 'dashboard/sidenavbar.html' %}
- - - - - {% block data%} - - {% endblock %} - - - + {% block data %} {% endblock %}
- - {% endblock %} diff --git a/FusionIIIT/templates/department/AllStudents.html b/FusionIIIT/templates/department/AllStudents.html index 2d7b5cdf9..50cd0c803 100644 --- a/FusionIIIT/templates/department/AllStudents.html +++ b/FusionIIIT/templates/department/AllStudents.html @@ -24,8 +24,6 @@
- - {% comment %}
{% endcomment %}
{% if student_list %} @@ -64,23 +62,6 @@
- {% comment %}
- - {% if student_list.has_previous %} - Previous < - {% endif %} - - {{student_list.number}} - - {% if student_list.has_next %} - > Next - {% endif %} - -
- - {% else %} -

No Students Records. Table Not Created.

{% endcomment %} - {% endcomment %}
- -{% comment %} {% endblock %} {% endcomment %} - {% include 'department/alert.html' %} {% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/department/browse_announcements.html b/FusionIIIT/templates/department/browse_announcements.html index aa08eec20..96dd082df 100644 --- a/FusionIIIT/templates/department/browse_announcements.html +++ b/FusionIIIT/templates/department/browse_announcements.html @@ -3,8 +3,6 @@ {% block browse_announcement %}

View Department-wise Announcements

- - {% comment %} tabs ui {% endcomment %}
- {% comment %} tabs content facilities {% endcomment %}
@@ -81,7 +76,6 @@

View Department-wise Announcements

- {% comment %} {% if ann_list %} {% endcomment %} @@ -107,7 +101,6 @@

View Department-wise Announcements

{% endfor %}
Announcement Date
- {% comment %} {% endif %} {% endcomment %}

@@ -116,8 +109,6 @@

View Department-wise Announcements

- - {% comment %} tabs content faculty {% endcomment %}
@@ -126,7 +117,6 @@

View Department-wise Announcements

- {% comment %} {% if ann_list %} {% endcomment %} @@ -152,7 +142,6 @@

View Department-wise Announcements

{% endfor %}
Announcement Date
- {% comment %} {% endif %} {% endcomment %}

@@ -162,7 +151,6 @@

View Department-wise Announcements

-{% comment %} tabs contains Announcement_List {% endcomment %}
@@ -171,7 +159,6 @@

View Department-wise Announcements

- {% comment %} {% if ann_list %} {% endcomment %} @@ -197,7 +184,6 @@

View Department-wise Announcements

{% endfor %}
Announcement Date
- {% comment %} {% endif %} {% endcomment %}

@@ -206,8 +192,6 @@

View Department-wise Announcements

- - {% comment %} tabs content students {% endcomment %}
- - {% comment %} tabs content facilities {% endcomment %}
@@ -80,8 +73,6 @@

View Category-wise Announcements

- - {% comment %} {% if ann_list %} {% endcomment %} @@ -107,7 +98,6 @@

View Category-wise Announcements

{% endfor %}
Announcement Date
- {% comment %} {% endif %} {% endcomment %}

@@ -116,8 +106,6 @@

View Category-wise Announcements

- - {% comment %} tabs content faculty {% endcomment %}
@@ -125,8 +113,6 @@

View Category-wise Announcements

- - {% comment %} {% if ann_list %} {% endcomment %} @@ -152,7 +138,6 @@

View Category-wise Announcements

{% endfor %}
Announcement Date
- {% comment %} {% endif %} {% endcomment %}

@@ -161,8 +146,6 @@

View Category-wise Announcements

- -{% comment %} tabs contains Announcement_List {% endcomment %}
@@ -170,8 +153,6 @@

View Category-wise Announcements

- - {% comment %} {% if ann_list %} {% endcomment %} @@ -197,7 +178,6 @@

View Category-wise Announcements

{% endfor %}
Announcement Date
- {% comment %} {% endif %} {% endcomment %}

@@ -207,7 +187,6 @@

View Category-wise Announcements

- {% comment %} tabs content students {% endcomment %}
@@ -215,8 +194,6 @@

View Category-wise Announcements

- - {% comment %} {% if ann_list %} {% endcomment %} @@ -242,7 +219,6 @@

View Category-wise Announcements

{% endfor %}
Announcement Date
- {% comment %} {% endif %} {% endcomment %}

diff --git a/FusionIIIT/templates/department/cse_dep.html b/FusionIIIT/templates/department/cse_dep.html index d99ee84d4..bea713f5a 100644 --- a/FusionIIIT/templates/department/cse_dep.html +++ b/FusionIIIT/templates/department/cse_dep.html @@ -1,10 +1,12 @@ {% load static %} +{% block css %} + +{% endblock css %} + {% block CSE_Dep %}

Welcome to CSE Department

- - {% comment %} tabs ui {% endcomment %}
@@ -35,87 +40,72 @@

Welcome to CSE Department

- -

- Our Mission : -

-

- The mission of the Computer Engineering Department is to provide educational programs that would encourage students to read critically, reason analytically, communicate persuasively, apply professionally and prepare them to excel in the field of computing. -

-

- Our Vision : -

-

- The vision of the Computer Engineering Department is to recognize itself as renowned department in the field of technical education in Computer Engineering and strives to carry out the superior level of research based on the quality, innovation and excellence; with the help of its stakeholders viz. the students, research scholars, faculty members, the support staff and the alumni. -

-
+ {% if user_designation == "faculty" %} + + + {% elif user_designation == "staff" %} + + + {% endif %} +
+ {{departments.CSE.about|safe}} +
- - {% comment %} tabs content facilities {% endcomment %}
- -

- Central Library : -

-

- Institute library has e-resources through INDEST, Science Direct, IEEE, ACM, Springger Link, Nature and ASME. The Institute also has access to various online research journals & articles like following resources SIAm, AMS, ACS, Kluwer, APS, Palgrave, INFORMS, Rev.of Scientific Instruments, Appl.Physics Letters and the search engine Scopus. Total number of books in the Institute library by the year 2009-10 are approximately 6742. -

-

- High Performance Computing Labortory : Specification of Parallel Cluster (for Central Computing Facility)- JS22 Blade No.3, 16GB(2*8GB) DDR2 533 Mhz DiMMs, IBM 146GB SAS 10K SFF HDD, IBM blade center JS22 4-core 4.0 Ghz Processor and WiFi Campus etc. -

-

- Lab Infrastructure : -

-
    -
  1. -

    - Advanced Manufacturing Laboratory : This Laboratory contains Rapid Prototyping Machine, CNC Controlled Abrasive Waterjet Machine, CNC Milling Center, CNC Turning Center, Dynamometer, Electro Chemical Machining System, Injection Moulding Machine etc. -

    -
  2. -
    -
  3. -

    - Biometric Laboratory : This Laboratory contains S Series, H Series, W Series cameras and p6 p520(Tower Model), p6 p520:8203 Model servers Made by IBM etc. -

    -
  4. -
    -
  5. -

    - Digital Signal Processing and Image Processing Laboratory : This Laboratory contains DSP Starter SPARTAN-3 kit (DSK), TMS 320C6713 DSK with CCS (Code Composer Studio), Image Daughter Kit with CCD Cameras, Bloom with DSP, Matrox Imaging Library, Matrox Morphis, Frame Graber Card, Color CCD Camera for online Processing etc. -

    -
  6. -
    -
  7. -

    - Infrared Imaging Laboratory : This Laboratory contains Radiometeric calibration, Extender rings, NDT Base Module, Central computing unit with TFT display, Software Modules for Lockin, Transient-and Pulse Measurement, Module Pulse- and Transient- Thermography, Source for Vibro- Thermography etc. -

    -
  8. -
    -
  9. -

    - Materials Research Laboratory : This Laboratory contains three important instruments for material characterization which are X-Ray Diffractometer (XRD), Scanning Electron Microscope (SEM) and Atomic Force Microscope (AFM) including SPM, MFM etc. -

    -
  10. -
-
+ {% if user_designation == "faculty" %} + + + {% elif user_designation == "staff" %} + + + {% endif %} +
+ {{departments.CSE.facility|safe}} +
- - {% comment %} tabs content faculty {% endcomment %} - - - - {% comment %}The tab menu starts here!{% endcomment %}
@@ -124,42 +114,27 @@

- {% comment %} {% if ann_list %} {% endcomment %} - - - - - - - - - - {% comment %} - - {% endcomment %} - - - - {% for fcu in fac_list.cse_f %} - - {% with "/eis/profile/"|add:fcu.user.username as link %} - - - - - - - - {% comment %} - - {% endcomment %} - {% endwith %} - + {% if fac_list.cse_f %} +
+ {% for faculty in fac_list.cse_f %} +
+
+
+
{{ faculty.title }}{{ faculty.user.first_name}} {{ faculty.user.last_name}}
+
Computer Science & Engineering
+ +
Research Interests
+
+ {% with "/eis/profile/"|add:faculty.user.username as link %} + Profile + {% endwith %} +
{% endfor %} - -
id faculty name sex date_of_birth address phone_no user_type department github
{{ fcu.id }}{{fcu.title}} {{ fcu.user.first_name}} {{ fcu.user.last_name}}{{ fcu.sex }}{{ fcu.date_of_birth }}{{ fcu.address }}{{ fcu.phone_no }}{{ fcu.user_type }}{{ fcu.department.name }}{{ fcu.id.faculty_about.github }}
- +
+ {% else %} + No Data Found. + {% endif %}

@@ -167,18 +142,29 @@

- -{% comment %} tabs contains Announcement_List {% endcomment %}
+ {% if user.extrainfo.department.name == "CSE" %}
+ + {% if user_designation == "faculty" %} + + + + {% elif user_designation == "staff" %} + + + {% endif %} +
-
- - {% comment %} {% if ann_list %} {% endcomment %} - +
+
@@ -192,7 +178,7 @@

{% for stu in announcements.cse %}

- + @@ -204,7 +190,7 @@

{% for stu in announcements.all %}

- + @@ -215,8 +201,66 @@

{% endfor %}

Announcement Date Announcement By
{{ stu.ann_date.date }}{{ stu.maker_id.user }}{{ stu.maker_id.user.first_name}} {{ stu.maker_id.user.last_name}} {{ stu.programme }} {{ stu.batch }} {{ stu.message }}
{{ stu.ann_date.date }}{{ stu.maker_id.user }}{{ stu.maker_id.user.first_name}} {{ stu.maker_id.user.last_name}} {{ stu.programme }} {{ stu.batch }} {{ stu.message }}
- {% comment %} {% endif %} {% endcomment %} - {% comment %}

{% endcomment %} +
+
@@ -224,23 +268,20 @@

+ {% endif %}
- - {% comment %} tabs content students {% endcomment %}
@@ -359,19 +391,69 @@

{% include "department/request_history.html" %} {% endblock %} - {% comment %}
{% endcomment %}

- {% comment %}
{% endcomment %}
- +
+
+
+
+ {% if user_designation == "faculty" %} + + + {% elif user_designation == "staff" %} + + + {% endif %} +
+ {{departments.CSE.achievement|safe}} +
+
+
+
+
+ {% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/department/dep_request.html b/FusionIIIT/templates/department/dep_request.html index 85954600e..d0cc98ed3 100644 --- a/FusionIIIT/templates/department/dep_request.html +++ b/FusionIIIT/templates/department/dep_request.html @@ -11,87 +11,52 @@ {% block navBar %} {% include 'dashboard/navbar.html' %} {% endblock %} - - {% comment %}The grid starts here!{% endcomment %}
- - {% comment %}The left-margin segment!{% endcomment %}
- - {% comment %} - The left-rail segment starts here! - {% endcomment %}
- - {% comment %}The user image card starts here!{% endcomment %} {% block usercard %} {% include 'globals/usercard.html' %} {% endblock %} - {% comment %}The user image card ends here!{% endcomment %}
- - {% comment %}The Tab-Menu starts here!{% endcomment %} - {% comment %}The Tab-Menu ends here!{% endcomment %}
- {% comment %} - The left-rail segment ends here! - {% endcomment %} - - - - {% comment %} - The central-rail segment starts here! - {% endcomment %} -
- - {% comment %}Make announcement{% endcomment %} -
- {% block make_announcement %} - {% if user_designation == "faculty" %} - {% include "department/make_announcements_fac.html" %} - {% elif user_designation == "staff" %} - {% include "department/make_announcements_staff.html" %} - {% endif %} - {% endblock %} -
- {% comment %}Make announcement{% endcomment %} - - {% comment %}See announcement{% endcomment %} -
- {% block browse_announcement %} - {% if user_designation == "faculty" %} - {% include "department/browse_announcements.html" %} - {% elif user_designation == "staff" %} - {% include "department/browse_announcements_staff.html" %} - {% endif %} - {% endblock %} -
- {% comment %}See announcement{% endcomment %} +
{% comment %}status of request!{% endcomment %}
@@ -99,7 +64,31 @@ {% include "department/request_status.html" %} {% endblock %}
- {% comment %}status of request!{% endcomment %} +
+ {% block CSE_Dep %} + {% include "department/cse_dep.html" %} + {% endblock %} +
+
+ {% block ECE_Dep %} + {% include "department/ece_dep.html" %} + {% endblock %} +
+
+ {% block ME_Dep %} + {% include "department/me_dep.html" %} + {% endblock %} +
+
+ {% block SM_Dep %} + {% include "department/sm_dep.html" %} + {% endblock %} +
+
+ {% block DESIGN_Dep %} + {% include "department/design_dep.html" %} + {% endblock %} +
@@ -107,19 +96,12 @@
- {% comment %} - TODO: the right rail! - {% endcomment %}
- {% comment %}The right-rail segment ends here!{% endcomment %} - - {% comment %}The right-margin segment!{% endcomment %}
- {% comment %}The grid ends here!{% endcomment %} {% include 'department/alert.html' %} diff --git a/FusionIIIT/templates/department/design_dep.html b/FusionIIIT/templates/department/design_dep.html new file mode 100644 index 000000000..eb9b9623e --- /dev/null +++ b/FusionIIIT/templates/department/design_dep.html @@ -0,0 +1,385 @@ +{% load static %} + +{% block CSE_Dep %} + +

Welcome to DESIGN Department

+ +
+
+
+
+ {% if user_designation == "faculty" %} + + + {% elif user_designation == "staff" %} + + + {% endif %} +
+ {{departments.DESIGN.about|safe}} +
+
+
+
+
+
+
+
+
+
+ {% if user_designation == "faculty" %} + + + {% elif user_designation == "staff" %} + + + {% endif %} +
+ {{departments.DESIGN.facility|safe}} +
+
+
+
+
+
+
+
+
+
+ + +
+ + {% if fac_list.des_f %} +
+ {% for faculty in fac_list.des_f %} +
+
+
+
{{ faculty.title }}{{ faculty.user.first_name}} {{ faculty.user.last_name}}
+
Design Discipline
+ +
Research Interests
+
+ {% with "/eis/profile/"|add:faculty.user.username as link %} + Profile + {% endwith %} +
+ {% endfor %} +
+ {% else %} + No Data Found. + {% endif %} +
+
+
+
+
+
+
+
+ {% if user.extrainfo.department.name == "Design" %} +
+
+
+ + +
+ + + + + + + + + + + + {% for stu in announcements.design %} + + + + + + + {% if stu.upload_announcement %} + + {% endif %} + + {% endfor %} + {% for stu in announcements.all %} + + + + + + + {% if stu.upload_announcement %} + + {% endif %} + + {% endfor %} + +
Announcement DateAnnouncement ByProgrammeBatch  MessageFile
{{ stu.ann_date.date }}{{ stu.maker_id.user }}{{ stu.programme }}{{ stu.batch }}{{ stu.message }}
{{ stu.ann_date.date }}{{ stu.maker_id.user }}{{ stu.programme }}{{ stu.batch }}{{ stu.message }}
+
+ +
+
+
+
+
+ {% endif %} +
+ +
+
+ +
+
+ +
+
+
+
+ + + +
+
+
+
+ + {% with fac_list.staffNcse as faculty %} + {% block file-requests %} + {% include "department/file_request.html" %} + {% endblock %} + {% endwith %} + +
+
+
+
+
+ +
+
+
+
+ + {% block request_history %} + {% include "department/request_history.html" %} + {% endblock %} + +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+ {% if user_designation == "faculty" %} + + + {% elif user_designation == "staff" %} + + + {% endif %} +
+ {{departments.DESIGN.achievement|safe}} +
+
+
+
+
+
+ + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/department/ece_dep.html b/FusionIIIT/templates/department/ece_dep.html index 2a202f2e4..18ed662a6 100644 --- a/FusionIIIT/templates/department/ece_dep.html +++ b/FusionIIIT/templates/department/ece_dep.html @@ -3,8 +3,6 @@ {% block ECE_Dep %}

Welcome to ECE Department

- - {% comment %} tabs ui {% endcomment %} - - {% comment %} active tab content {% endcomment %}
- -

- Our Mission : -

-

- The discipline of Electronics and Communication Engineering (ECE) has a perfect combination of teaching and research activities pertaining to field of Electronics and Communication. Since its inception the main objective of discipline is to impart quality education, hands-on training and research in the frontier areas of Electronics & Communication Engineering with broad focus on IT enabled design and manufacturing. -

-

- Our Vision : -

-

- The vision of ECE department is to become pioneer in higher learning and research and to produce creative solution to societal needs. To provide excellence in education, research and public service. To provide quality education and to make the students entrepreneur and employable. -

-
+ {% if user_designation == "faculty" %} + + + {% elif user_designation == "staff" %} + + + {% endif %} +
+ {{departments.ECE.about|safe}} +
- - {% comment %} tabs content facilities {% endcomment %}
- -

- Central Library : -

-

- Institute library has e-resources through INDEST, Science Direct, IEEE, ACM, Springger Link, Nature and ASME. The Institute also has access to various online research journals & articles like following resources SIAm, AMS, ACS, Kluwer, APS, Palgrave, INFORMS, Rev.of Scientific Instruments, Appl.Physics Letters and the search engine Scopus. Total number of books in the Institute library by the year 2009-10 are approximately 6742. -

-

- Lab Infrastructure : -

-
    -
  1. -

    - Circuits and Innovation Lab :This laboratory is dedicated to circuits designing, is intended to serve its facilities as one of the teaching labs and also to facilitate teaching projects and research projects. These projects and teaching work include the experimental and innovative study in the field of analog and digital circuits, microcontrollers and its applications. -

    -
  2. -
    -
  3. -

    - Basic Electronics lab : This Laboratory is dedicated to the concepts and implementation of basic circuits designing. It serves its facilities as one of the teaching labs and also to facilitate course projects -

    -
  4. -
    -
  5. -

    - RF&Applied Electromagnetics : This Laboratory acts as a research lab to researchscholars,research associatives. Main research areas of lab include understanding of high frequency devices ,Antenna theory concepts and design fields. -

    -
  6. -
-
+ {% if user_designation == "faculty" %} + + + {% elif user_designation == "staff" %} + + + {% endif %} +
+ {{departments.ECE.facility|safe}} +
- - {% comment %} tabs content faculty {% endcomment %} - {% comment %}The tab menu starts here!{% endcomment %}
@@ -108,43 +111,26 @@

- - {% comment %} {% if ann_list %} {% endcomment %} - - - - - - - - - - {% comment %} - - {% endcomment %} - - - - {% for fcu in fac_list.ece_f %} - - {% with "/eis/profile/"|add:fcu.user.username as link %} - - - - - - - - {% comment %} - - {% endcomment %} + {% if fac_list.ece_f %} +
+ {% for faculty in fac_list.ece_f %} +
+
+
+
{{ faculty.title }}{{ faculty.user.first_name}} {{ faculty.user.last_name}}
+
Electronics & Communications Engineering
+ +
Research Interests
+
+ {% with "/eis/profile/"|add:faculty.user.username as link %} + Profile {% endwith %} -
- + {% endfor %} - -
id faculty name sex date_of_birth address phone_no user_type department github
{{ fcu.id }}{{fcu.title}} {{ fcu.user.first_name}} {{ fcu.user.last_name}}{{ fcu.sex }}{{ fcu.date_of_birth }}{{ fcu.address }}{{ fcu.phone_no }}{{ fcu.user_type }}{{ fcu.department.name }}{{ fcu.id.faculty_about.github }}
- +
+ {% else %} + No Data Found. + {% endif %}

@@ -152,16 +138,14 @@

- - {% comment %} tabs contains Announcement_List {% endcomment %}
+ {% if user.extrainfo.department.name == "ECE" %}
- {% comment %} {% if ann_list %} {% endcomment %} @@ -199,8 +183,6 @@

{% endfor %}

Announcement Date
- {% comment %} {% endif %} {% endcomment %} - {% comment %}

{% endcomment %}
@@ -208,23 +190,20 @@

+ {% endif %}
- - {% comment %} tabs content students {% endcomment %}
@@ -342,14 +312,66 @@

{% include "department/request_history.html" %} {% endblock %} - {% comment %}
{% endcomment %}

- {% comment %}
{% endcomment %} +
+
+
+ +
+
+
+
+ {% if user_designation == "faculty" %} + + + {% elif user_designation == "staff" %} + + + {% endif %} +
+ {{departments.ECE.achievement|safe}} +
+
+
+
+
+
+ diff --git a/FusionIIIT/templates/department/edit-draft.html b/FusionIIIT/templates/department/edit-draft.html new file mode 100644 index 000000000..bb0a0ee47 --- /dev/null +++ b/FusionIIIT/templates/department/edit-draft.html @@ -0,0 +1,208 @@ + + +
+ {% csrf_token %} +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+ + +
+ +
+ + +
+ +
+
+ + + + + \ No newline at end of file diff --git a/FusionIIIT/templates/department/faculty.html b/FusionIIIT/templates/department/faculty.html index 79029081b..c88b189ae 100644 --- a/FusionIIIT/templates/department/faculty.html +++ b/FusionIIIT/templates/department/faculty.html @@ -9,11 +9,6 @@ {% block navBar %} {% include 'dashboard/navbar.html' %} {% endblock %} - -{% comment %} {% block CSE_faculty_List %} {% endcomment %} - - - {% comment %}The tab menu starts here!{% endcomment %}
- {% comment %}
{% endcomment %} {% if fac_list %} - {% comment %} {% endcomment %} + - -{% comment %} {% endblock %} {% endcomment %} - {% include 'department/alert.html' %} {% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/department/file_request.html b/FusionIIIT/templates/department/file_request.html index 033e43c50..05c3337ef 100644 --- a/FusionIIIT/templates/department/file_request.html +++ b/FusionIIIT/templates/department/file_request.html @@ -10,7 +10,7 @@ {% endcomment %} {% comment %}
{% endcomment %} -
+
{% csrf_token %}
@@ -77,16 +77,11 @@
{% endcomment %} -
- - - -
-
- +
+ {% comment %}
{% endcomment %} {% comment %}
{% endcomment %} diff --git a/FusionIIIT/templates/department/index.html b/FusionIIIT/templates/department/index.html index 10ebb1c26..6c81ee262 100644 --- a/FusionIIIT/templates/department/index.html +++ b/FusionIIIT/templates/department/index.html @@ -1,6 +1,6 @@ {% extends 'globals/base.html' %} {% load static %} - + {% block title %} Department @@ -12,28 +12,12 @@ {% include 'dashboard/navbar.html' %} {% endblock %} - {% comment %}The grid starts here!{% endcomment %}
- {% comment %}The left-margin segment!{% endcomment %}
- - {% comment %} - The left-rail segment starts here! - {% endcomment %}
- {% comment %}The user image card starts here!{% endcomment %} - {% block usercard %} - {% include 'globals/usercard.html' %} - {% endblock %} - {% comment %}The user image card ends here!{% endcomment %} - - -
- - {% comment %}The Tab-Menu starts here!{% endcomment %} - {% comment %}The Tab-Menu ends here!{% endcomment %}
- {% comment %} - The left-rail segment ends here! - {% endcomment %} +
- - - {% comment %} - The central-rail segment starts here! - {% endcomment %} -
- - - {% comment %}CSE Department!{% endcomment %}
{% block CSE_Dep %} - {{ user_designation }} {% include "department/cse_dep.html" %} {% endblock %}
- {% comment %}CSE Department!{% endcomment %} - - {% comment %}ECE Department!{% endcomment %}
{% block ECE_Dep %} {% include "department/ece_dep.html" %} {% endblock %}
- {% comment %}ECE Department!{% endcomment %} - - {% comment %}ME Department!{% endcomment %}
{% block ME_Dep %} {% include "department/me_dep.html" %} {% endblock %}
- {% comment %}ME Department!{% endcomment %} - - {% comment %}SM Department!{% endcomment %}
{% block SM_Dep %} {% include "department/sm_dep.html" %} {% endblock %}
- {% comment %}SM{% endcomment %} +
+ {% block DESIGN_Dep %} + {% include "department/design_dep.html" %} + {% endblock %} +
- {% comment %} - TODO: the right rail! - {% endcomment %}
- {% comment %}The right-rail segment ends here!{% endcomment %} - - {% comment %}The right-margin segment!{% endcomment %}
- {% comment %}The grid ends here!{% endcomment %} {% include 'department/alert.html' %} diff --git a/FusionIIIT/templates/department/make_announcements_fac.html b/FusionIIIT/templates/department/make_announcements_fac.html index 7f4892535..bb9c8ad00 100644 --- a/FusionIIIT/templates/department/make_announcements_fac.html +++ b/FusionIIIT/templates/department/make_announcements_fac.html @@ -1,161 +1,131 @@ -{% load static %} -{% block make_announcements %} - - {% comment %}The tab menu starts here!{% endcomment %} - - -
-
- -
- {% csrf_token %} -
- Make a new Announcement: -
- -
- -
+{% comment %}The tab menu starts here!{% endcomment %} +
+
+ + + {% csrf_token %} +
-
- -
- - - - - - - - - {% comment %} - - {% endcomment %} - - - - {% for fcu in fac_list.me_f %} - - {% with "/eis/profile/"|add:fcu.user.username as link %} - - - - - - - - {% comment %} - - {% endcomment %} + {% if fac_list.me_f %} +
+ {% for faculty in fac_list.me_f %} +
+
+
+
{{ faculty.title }}{{ faculty.user.first_name}} {{ faculty.user.last_name}}
+
Mechanical Engineering
+ +
Research Interests
+
+ {% with "/eis/profile/"|add:faculty.user.username as link %} + Profile {% endwith %} -
- + {% endfor %} - -
id faculty name sex date_of_birth address phone_no user_type department github
{{ fcu.id }}{{fcu.title}} {{ fcu.user.first_name}} {{ fcu.user.last_name}}{{ fcu.sex }}{{ fcu.date_of_birth }}{{ fcu.address }}{{ fcu.phone_no }}{{ fcu.user_type }}{{ fcu.department.name }}{{ fcu.id.faculty_about.github }}
- +
+ {% else %} + No Data Found. + {% endif %}
@@ -222,15 +140,14 @@

- {% comment %} tabs contains Announcement_List {% endcomment %}
+ {% if user.extrainfo.department.name == "ME" %}
- {% comment %} {% if ann_list %} {% endcomment %} @@ -268,37 +185,28 @@

{% endfor %}

Announcement Date
- {% comment %} {% endif %} {% endcomment %} - {% comment %}

{% endcomment %}
- {% comment %} - - - {% endcomment %} +
+ {% endif %}
- {% comment %} tabs content students {% endcomment %}
@@ -416,14 +315,65 @@

{% include "department/request_history.html" %} {% endblock %} - {% comment %}
{% endcomment %}

- {% comment %}
{% endcomment %} + + + + +
+
+
+
+ {% if user_designation == "faculty" %} + + + {% elif user_designation == "staff" %} + + + {% endif %} +
+ {{departments.ME.achievement|safe}} +
+
+
+
+
+
+ diff --git a/FusionIIIT/templates/department/request_history.html b/FusionIIIT/templates/department/request_history.html index 40e445d2b..bb036876c 100644 --- a/FusionIIIT/templates/department/request_history.html +++ b/FusionIIIT/templates/department/request_history.html @@ -7,7 +7,7 @@
{% comment %} {% if ann_list %} {% endcomment %} - +
diff --git a/FusionIIIT/templates/department/request_status.html b/FusionIIIT/templates/department/request_status.html index f86eeb403..daeeb3672 100644 --- a/FusionIIIT/templates/department/request_status.html +++ b/FusionIIIT/templates/department/request_status.html @@ -11,7 +11,7 @@

View Requests

{% comment %} {% if ann_list %} {% endcomment %} -
Request Date Request To
+
diff --git a/FusionIIIT/templates/department/sm_dep.html b/FusionIIIT/templates/department/sm_dep.html index 2ddd097a4..8af83b073 100644 --- a/FusionIIIT/templates/department/sm_dep.html +++ b/FusionIIIT/templates/department/sm_dep.html @@ -3,8 +3,6 @@ {% block SM_Dep %}

Welcome to SM Department

- - {% comment %} tabs ui {% endcomment %} - {% comment %} active tab content {% endcomment %}
- -

- Our Mission : -

-

- The programme is designed to provide various tools and techniques associated with IoT, - IIoT, Information and Computing Technology (ICT) and System Engineering, with special - focus on additive manufacturing (AM) or 3D printing and near net shape manufacturing - processes. -

-

- Our Vision : -

-

- This programme focuses on some of the disruptive innovations that the last decade has been - witnessed to, namely, Internet of Things (IoT), Robotics, Additive Manufacturing (3D - Printing), Industrial Automation, Artificial Intelligence, Machine Learning, etc. These - technologies have a huge potential to shape the future of mankind. - Smart manufacturing, being an important aspect of the Industrial Internet of Things (IIoT) is - the next industrial revolution. Smart manufacturing integrates data and information from - multiple open and vendor applications and products to form new solutions. It can be applied - to a single machine line, an entire factory or across a network of manufacturers, suppliers and - customers. This new area of innovation will optimize the entire manufacturing industry to - create higher quality products at lower prices, improve productivity, increase energy - efficiency, and sustain safer plants. -

-
+ {% if user_designation == "faculty" %} + + + {% elif user_designation == "staff" %} + + + {% endif %} +
+ {{departments.SM.about|safe}} +
- - {% comment %} tabs content facilities {% endcomment %}
- -

- Central Library : -

-

- Institute library has e-resources through INDEST, Science Direct, IEEE, ACM, Springger Link, Nature and ASME. The Institute also has access to various online research journals & articles like following resources SIAm, AMS, ACS, Kluwer, APS, Palgrave, INFORMS, Rev.of Scientific Instruments, Appl.Physics Letters and the search engine Scopus. Total number of books in the Institute library by the year 2009-10 are approximately 6742. -

-

- Lab Infrastructure : -

-
    -
  1. -

    - Circuits and Innovation Lab :This laboratory is dedicated to circuits designing, is intended to serve its facilities as one of the teaching labs and also to facilitate teaching projects and research projects. These projects and teaching work include the experimental and innovative study in the field of analog and digital circuits, microcontrollers and its applications. -

    -
  2. -
    -
  3. -

    - Basic Electronics lab : This Laboratory is dedicated to the concepts and implementation of basic circuits designing. It serves its facilities as one of the teaching labs and also to facilitate course projects -

    -
  4. -
    -
  5. -

    - RF&Applied Electromagnetics : This Laboratory acts as a research lab to researchscholars,research associatives. Main research areas of lab include understanding of high frequency devices ,Antenna theory concepts and design fields. -

    -
  6. -
-
+ {% if user_designation == "faculty" %} + + + {% elif user_designation == "staff" %} + + + {% endif %} +
+ {{departments.SM.facility|safe}} +
- - {% comment %} tabs content faculty {% endcomment %} - {% comment %}The tab menu starts here!{% endcomment %}
@@ -121,43 +111,26 @@

- - {% comment %} {% if ann_list %} {% endcomment %} -

Request Date Maker
- - - - - - - - {% comment %} - - {% endcomment %} - - - {%if fac_list.sm_f%} - {% for fcu in fac_list.sm_f %} - - {% with "/eis/profile/"|add:fcu.user.username as link %} - - - - - - - - {% comment %} - - {% endcomment %} + {% if fac_list.sm_f %} +
+ {% for faculty in fac_list.sm_f %} +
+
+
+
{{ faculty.title }}{{ faculty.user.first_name}} {{ faculty.user.last_name}}
+
Smart Manufacturing Discipline
+ +
Research Interests
+
+ {% with "/eis/profile/"|add:faculty.user.username as link %} + Profile {% endwith %} -
- + {% endfor %} - {%endif%} - -
id faculty name sex date_of_birth address phone_no user_type department github
{{ fcu.id }}{{fcu.title}} {{ fcu.user.first_name}} {{ fcu.user.last_name}}{{ fcu.sex }}{{ fcu.date_of_birth }}{{ fcu.address }}{{ fcu.phone_no }}{{ fcu.user_type }}{{ fcu.department.name }}{{ fcu.id.faculty_about.github }}
- +
+ {% else %} + No Data Found. + {% endif %}
@@ -165,15 +138,15 @@

- {% comment %} tabs contains Announcement_List {% endcomment %} +
+ {% if user.extrainfo.department.name == "SM" %}
- {% comment %} {% if ann_list %} {% endcomment %} @@ -211,38 +184,30 @@

{% endfor %}

Announcement Date
- {% comment %} {% endif %} {% endcomment %} - {% comment %}

{% endcomment %}
- {% comment %} - - {% endcomment %} +
+ {% endif %}
- - - {% comment %} tabs content students {% endcomment %}
@@ -360,14 +316,65 @@

{% include "department/request_history.html" %} {% endblock %} - {% comment %}
{% endcomment %}

- {% comment %}
{% endcomment %} + + + + +
+
+
+
+ {% if user_designation == "faculty" %} + + + {% elif user_designation == "staff" %} + + + {% endif %} +
+ {{departments.SM.achievement|safe}} +
+
+
+
+
+
+ diff --git a/FusionIIIT/templates/eisModulenew/conference.html b/FusionIIIT/templates/eisModulenew/conference.html index c43c7799d..1df3a8572 100644 --- a/FusionIIIT/templates/eisModulenew/conference.html +++ b/FusionIIIT/templates/eisModulenew/conference.html @@ -21,7 +21,7 @@

Add a Conference/Symposium

@@ -89,6 +92,7 @@

Add a Workshop /Training Program

type="text" id="event_venue" name="event_venue" + required />
@@ -96,7 +100,7 @@

Add a Workshop /Training Program

@@ -147,6 +152,7 @@

Add a Workshop /Training Program

type="text" id="event_name" name="event_name" + required />
diff --git a/FusionIIIT/templates/eisModulenew/my_projects.html b/FusionIIIT/templates/eisModulenew/my_projects.html index c02be1cc9..ea4f54c38 100644 --- a/FusionIIIT/templates/eisModulenew/my_projects.html +++ b/FusionIIIT/templates/eisModulenew/my_projects.html @@ -126,15 +126,9 @@

Report:

- + - + @@ -178,14 +172,6 @@

Report:

Sr.Sr. Consultant(s) Title Client
- - @@ -221,13 +207,6 @@

Report:

Sr. Patent No. Title
- diff --git a/FusionIIIT/templates/eisModulenew/others.html b/FusionIIIT/templates/eisModulenew/others.html index d42ac8b21..3b26a5694 100644 --- a/FusionIIIT/templates/eisModulenew/others.html +++ b/FusionIIIT/templates/eisModulenew/others.html @@ -35,11 +35,11 @@

Add an Achievement

+ {% for book in books %} + + + + + + + + + + {% endfor %} diff --git a/FusionIIIT/templates/eisModulenew/rspc_conference.html b/FusionIIIT/templates/eisModulenew/rspc_conference.html index 2e7c83fa5..23b264a11 100755 --- a/FusionIIIT/templates/eisModulenew/rspc_conference.html +++ b/FusionIIIT/templates/eisModulenew/rspc_conference.html @@ -34,14 +34,7 @@

Report:

User Ptype
{{ forloop.counter }}{{ book.title }}{{ book.authors }}{{ book.p_type}}{{ book.pyear}}{{ book.publisher}}
- - - + diff --git a/FusionIIIT/templates/eisModulenew/rspc_faculty.html b/FusionIIIT/templates/eisModulenew/rspc_faculty.html new file mode 100644 index 000000000..cf978879b --- /dev/null +++ b/FusionIIIT/templates/eisModulenew/rspc_faculty.html @@ -0,0 +1,1230 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Profile +{% endblock %} + +{% block css %} + + + +{% endblock %} + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + + +{% comment %}The grid starts here!{% endcomment %} +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %} + The left-rail segment starts here! + {% endcomment %} +
+ + {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu starts here!{% endcomment %} + + {% comment %}The Tab-Menu ends here!{% endcomment %} + +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + + + {% comment %} + The central-rail segment starts here! + {% endcomment %} +
+ {% comment %}The Details start here!{% endcomment %} + +
+ + {% block personaldetails %} + {% include 'eisModulenew/personaldetails.html' %} + {% endblock %} +
+ {% comment %}The Personal Details end here!{% endcomment %} + + + {% comment %}The Publications starts here!{% endcomment %} + +
+ {% block publications %} + {% include 'eisModulenew/publications.html' %} + {% endblock %} +
+ + {% comment %}The Publications ends here!{% endcomment %} + + + {% comment %}The Projects starts here!{% endcomment %} + +
+ {% block projects %} + {% include 'eisModulenew/projects.html' %} + {% endblock %} +
+ + {% comment %}The Projects ends here!{% endcomment %} + + + {% comment %}The Thesis Supervision starts here!{% endcomment %} + +
+ {% block thesis %} + {% include 'eisModulenew/thesis.html' %} + {% endblock %} +
+ + {% comment %}The thesis ends here!{% endcomment %} + + {% comment %}The events organised starts here!{% endcomment %} + +
+ {% block eventorganised %} + {% include 'eisModulenew/eventorganized.html' %} + {% endblock %} +
+ + {% comment %}The event organised ends here!{% endcomment %} + + {% comment %}The visits starts here!{% endcomment %} + +
+ {% block visits %} + {% include 'eisModulenew/visits.html' %} + {% endblock %} +
+ {% comment %}The visits ends here!{% endcomment %} + + {% comment %}The conference starts here!{% endcomment %} +
+ {% block conference %} + {% include 'eisModulenew/conference.html' %} + {% endblock %} +
+ {% comment %}The conference ends here!{% endcomment %} + + {% comment %}The others starts here!{% endcomment %} +
+ + {% block others %} + {% include 'eisModulenew/others.html' %} + {% endblock %} +
+ {% comment %}The others ends here!{% endcomment %} + + + + + + {% comment %}The Project management form starts here!{% endcomment %} +
+ + {% block form1 %} + {% include 'officeModule/officeOfDeanRSPC/tab1.html' %} + {% endblock %} + +
+
+ + {% block my_projects %} + {% include 'eisModulenew/my_projects.html' %} + {% endblock %} +
+ + + + + {% comment %}The servicebook starts here!{% endcomment %} +
+ {% block service %} + {% include 'hr2Module/service_main.html' %} + {% endblock %} +
+ {% comment %}The others ends here!{% endcomment %} + + + + + + + + + + + + + + {% comment %}The Publications ends here!{% endcomment %} + + {% comment %}Block for Displaying Messages{% endcomment %} + {% if messages %} + {% for message in messages %} + {% if message.tags == "success" %} +
+ +
+ Successful! +
+ {% else %} +
+ +
+ Alert! +
+ {% endif %} +

{{message}}

+
+ {% endfor %} + {% endif %} + +
+ {% comment %}The central-rail segment ends here!{% endcomment %} + + {% comment %}The right-rail segment starts here!{% endcomment %} +
+ {% if request.user == user %} +
+
+ Generate Report
+
+ + {% endif %} + + +
+ {% comment %}The Modules:{% endcomment %} + {% block modules %} + {% include 'dashboard/modules.html' %} + {% endblock %} +
+ +
+ {% comment %}The right-rail segment ends here!{% endcomment %} + + {% comment %}The right-margin segment!{% endcomment %} +
+ +
+ {% comment %}The grid ends here!{% endcomment %} + + + + {% endblock %} + + + + + + + + + {% block javascript %} + {% csrf_token %} + + + + + + + + + + + + + + {% comment %} + + {% endcomment %} + + + + + + {% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/eisModulenew/rspc_generatereport.html b/FusionIIIT/templates/eisModulenew/rspc_generatereport.html index 21a0c9374..35306807f 100755 --- a/FusionIIIT/templates/eisModulenew/rspc_generatereport.html +++ b/FusionIIIT/templates/eisModulenew/rspc_generatereport.html @@ -7,6 +7,19 @@ Report +
+
+
+ {% csrf_token %} + + + +

+
+ {% csrf_token %} + + +

{% csrf_token %} @@ -367,4 +380,5 @@
TO
+ {% endblock%} \ No newline at end of file diff --git a/FusionIIIT/templates/eisModulenew/rspc_others.html b/FusionIIIT/templates/eisModulenew/rspc_others.html index fce41497d..307413f26 100755 --- a/FusionIIIT/templates/eisModulenew/rspc_others.html +++ b/FusionIIIT/templates/eisModulenew/rspc_others.html @@ -41,12 +41,7 @@

Report:

Sr.Sr. Role Conference Name Venue
- - + @@ -162,11 +157,7 @@

Report:

Sr. Achievement Title
- + @@ -224,12 +215,6 @@

Report:

Sr.
- diff --git a/FusionIIIT/templates/eisModulenew/rspc_projects.html b/FusionIIIT/templates/eisModulenew/rspc_projects.html index 41421c28f..3b761b40d 100755 --- a/FusionIIIT/templates/eisModulenew/rspc_projects.html +++ b/FusionIIIT/templates/eisModulenew/rspc_projects.html @@ -2,6 +2,9 @@ {% block projects %} {% comment %}The tab menu starts here!{% endcomment %} + {% if message %} +

{{message}}

+ {% endif %}
Sr. Type
- @@ -114,13 +110,7 @@

Report:

Sr. PI/CO-PI
- + @@ -166,13 +156,7 @@

Report:

Sr. Consultant(s)
- + @@ -232,9 +216,7 @@

Report:

Sr. Patent No.
- + diff --git a/FusionIIIT/templates/eisModulenew/rspc_publications.html b/FusionIIIT/templates/eisModulenew/rspc_publications.html index 221f4ec65..6ae2ccae3 100755 --- a/FusionIIIT/templates/eisModulenew/rspc_publications.html +++ b/FusionIIIT/templates/eisModulenew/rspc_publications.html @@ -110,13 +110,7 @@

Report:

Sr. Details Action
- + @@ -182,13 +176,6 @@

Report:

Sr. Authors Title of Paper
- diff --git a/FusionIIIT/templates/eisModulenew/visits.html b/FusionIIIT/templates/eisModulenew/visits.html index be7fa8334..403f46690 100644 --- a/FusionIIIT/templates/eisModulenew/visits.html +++ b/FusionIIIT/templates/eisModulenew/visits.html @@ -27,7 +27,7 @@

Add a Foreign Visit

@@ -293,7 +291,7 @@

Add a Foreign Visit

- +
@@ -306,7 +304,7 @@

Add a Foreign Visit

- +
@@ -317,7 +315,7 @@

Add a Foreign Visit

- +
@@ -453,7 +451,7 @@

Add an Indian University Visit

- +
@@ -467,7 +465,7 @@

Add an Indian University Visit

- +
@@ -480,7 +478,7 @@

Add an Indian University Visit

- +
@@ -491,7 +489,7 @@

Add an Indian University Visit

- +
diff --git a/FusionIIIT/templates/establishment/appraisal.html b/FusionIIIT/templates/establishment/appraisal.html index d3fceaadc..d5681bb51 100755 --- a/FusionIIIT/templates/establishment/appraisal.html +++ b/FusionIIIT/templates/establishment/appraisal.html @@ -3,19 +3,25 @@ {% block sidetabmenu %} {% comment %}The Tab-Menu starts here!{% endcomment %}
{% comment %}The Tab-Menu ends here!{% endcomment %} @@ -111,7 +117,6 @@

          Showing All the - - {% comment %}The grid starts here!{% endcomment %}
- {% comment %}The left-margin segment!{% endcomment %}
- {% comment %} The left-rail segment starts here! {% endcomment %}
- {% comment %}The user image card starts here!{% endcomment %} {% block usercard %} {% include 'globals/usercard.html' %} {% endblock %} {% comment %}The user image card ends here!{% endcomment %} -
- {% comment %}The Tab-Menu starts here!{% endcomment %} - {% comment %}The Tab-Menu ends here!{% endcomment %} -
-
- {% comment %}The Details start here!{% endcomment %} - -
+
{% block voting_polls %} {% include 'gymkhanaModule/voting_polls.html' %} {% endblock %}
- - {% if "student" in Curr_desig %} - -
- {% block applyform %} - {% include 'gymkhanaModule/applyform.html' %} - {% endblock %} -
- - {% endif %} - -
+ {% if "student" in Curr_desig %} +
+ {% block applyform %} + {% include 'gymkhanaModule/applyform.html' %} + {% endblock %} +
+ {% endif %} +
{% block view_budget %} {% include 'gymkhanaModule/club_details.html' %} {% endblock %}
- - {% if "student" in Curr_desig and status == True %} - -
- {% block convenor_form %} - {% include 'gymkhanaModule/convenor_form.html' %} - {% endblock %} -
- - {% endif %} - - {% if "Convenor" in Curr_desig %} - -
- {% block nomination_details %} - {% include 'gymkhanaModule/nomination_details.html' %} - {% endblock %} -
- - {% endif %} - - {% if "Junior Superintendent" in Curr_desig or request.user.username == "acadadmin" %} - -
- {% block festbudget %} - {% include 'gymkhanaModule/festbudget.html' %} - {% endblock %} -
- -
- {% block eventReport %} - {% include 'gymkhanaModule/eventReport.html' %} - {% endblock %} -
- - {% endif %} - -
+ {% if "student" in Curr_desig and status == True %} +
+ {% block convenor_form %} + {% include 'gymkhanaModule/convenor_form.html' %} + {% endblock %} +
+ {% endif %} + {% if "Convenor" in Curr_desig %} +
+ {% block nomination_details %} + {% include 'gymkhanaModule/nomination_details.html' %} + {% endblock %} +
+ {% endif %} + {% if "Junior Superintendent" in Curr_desig or request.user.username == "acadadmin" %} +
+ {% block festbudget %} + {% include 'gymkhanaModule/festbudget.html' %} + {% endblock %} +
+
+ {% block eventReport %} + {% include 'gymkhanaModule/eventReport.html' %} + {% endblock %} +
+ {% endif %} +
{% block memberrecords %} {% include 'gymkhanaModule/memberrecords.html' %} {% endblock %}
- - {% if "Dean_s" in Curr_desig %} - -
- {% block approvalrequests %} - {% include 'gymkhanaModule/approvalrequests.html' %} - {% endblock %} -
- -
- {% block change_head %} - {% include 'gymkhanaModule/change_head.html' %} - {% endblock %} -
- - {% endif %} - - {% if "co-ordinator" in Curr_desig or "co co-ordinator" in Curr_desig %} - -
- {% block newsession %} - {% include 'gymkhanaModule/newsession.html' %} - {% endblock %} -
- -
- {% block newevent %} - {% include 'gymkhanaModule/newevent.html' %} - {% endblock %} -
- -
- {% block memberrequests %} - {% include 'gymkhanaModule/memberrequests.html' %} - {% endblock %} -
- -
- {% block activityCalender %} - {% include 'gymkhanaModule/activityCalender.html' %} - {% endblock %} -
- -
- {% block clubReport %} - {% include 'gymkhanaModule/otherReport.html' %} - {% endblock %} -
- -
- {% block clubbudget %} - {% include 'gymkhanaModule/clubbudget.html' %} - {% endblock %} -
- -
- {% block pendingrequest %} - {% include 'gymkhanaModule/pending_request.html' %} - {% endblock %} -
- - {% endif %} - + {% if "Dean_s" in Curr_desig %} +
+ {% block approvalrequests %} + {% include 'gymkhanaModule/approvalrequests.html' %} + {% endblock %} +
+
+ {% block change_head %} + {% include 'gymkhanaModule/change_head.html' %} + {% endblock %} +
+ {% endif %} + {% if "co-ordinator" in Curr_desig or "co co-ordinator" in Curr_desig %} +
+ {% block newsession %} + {% include 'gymkhanaModule/newsession.html' %} + {% endblock %} +
+
+ {% block newevent %} + {% include 'gymkhanaModule/newevent.html' %} + {% endblock %} +
+
+ {% block memberrequests %} + {% include 'gymkhanaModule/memberrequests.html' %} + {% endblock %} +
+
+ {% block activityCalender %} + {% include 'gymkhanaModule/activityCalender.html' %} + {% endblock %} +
+
+ {% block clubReport %} + {% include 'gymkhanaModule/otherReport.html' %} + {% endblock %} +
+
+ {% block clubbudget %} + {% include 'gymkhanaModule/clubbudget.html' %} + {% endblock %} +
+
+ {% block pendingrequest %} + {% include 'gymkhanaModule/pending_request.html' %} + {% endblock %} +
+ {% endif %} {% comment %}The Details start here!{% endcomment %} -
- {% comment %}The central-rail segment ends here!{% endcomment %} - {% comment %}The right-rail segment starts here!{% endcomment %}
@@ -562,70 +484,67 @@
{% comment %}The right-rail segment ends here!{% endcomment %} - {% comment %}The right-margin segment!{% endcomment %}
-
-

Sr. Published
- - - - - - - - - - - - - - - - {% for i in Club_member %} {% if i.status == "confirmed" %} - - - - - - - - - - - - {% endif %} {% endfor %} - -
-
Name
-
Roll No.Club NameCategoryAchievements
- -
-
- - - + +
+
+
+
+ + +
+
+
+

Members

+ + + + + + + + + + + + {% for i in Club_member %} + {% if i.status == "confirmed" %} + + + + + + + + {% endif %} + {% endfor %} + +
+
Name
+
Roll No.Club NameCategoryAchievements
+
+
+
+
{% endblock %} diff --git a/FusionIIIT/templates/gymkhanaModule/memberrequests.html b/FusionIIIT/templates/gymkhanaModule/memberrequests.html index cc2eae0eb..a6c12340e 100644 --- a/FusionIIIT/templates/gymkhanaModule/memberrequests.html +++ b/FusionIIIT/templates/gymkhanaModule/memberrequests.html @@ -1,36 +1,29 @@ {% load static %} {% block memberrequests %} - {% comment %}The tab menu starts here!{% endcomment %} - {% for i in Club_member %} {% if i.status == "open" %} - {% endblock %} diff --git a/FusionIIIT/templates/gymkhanaModule/newevent.html b/FusionIIIT/templates/gymkhanaModule/newevent.html index e8bc80bcd..e72186153 100644 --- a/FusionIIIT/templates/gymkhanaModule/newevent.html +++ b/FusionIIIT/templates/gymkhanaModule/newevent.html @@ -2,101 +2,105 @@ {% block newevent %} {% comment %}The tab menu starts here!{% endcomment %} -
- {% csrf_token %} + {% csrf_token %} {% comment %}The add a new skill Accordian starts here!{% endcomment %} -
+
- +
-
- -
- -
- - -
- - -
- - {{ choice }} -
-
- -
-
-
- -
- - -
-
- -
- -
-
- - -
- -
- - -
-
-
- - - {% comment %} {% endcomment %} -
-
- - + + +
+
+ + + +
+
+ + {{ choice }} +
+
+ +
+
+ +
+ +
- -
-
+
+
+
+ + +
+
+ + +
+
+
+ + + + {% comment %} {% endcomment %} +
+
+ + +
+
+
-
-
- + +
+
+
+
+
+
{% endblock %} - - {% block javascript %} - - -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/FusionIIIT/templates/gymkhanaModule/newsession.html b/FusionIIIT/templates/gymkhanaModule/newsession.html index ed74dac39..2eef3be0a 100644 --- a/FusionIIIT/templates/gymkhanaModule/newsession.html +++ b/FusionIIIT/templates/gymkhanaModule/newsession.html @@ -1,7 +1,6 @@ {% block newsession %} - {% comment %}The tab menu starts here!{% endcomment %} - + --> -
- {% csrf_token %} + {% csrf_token %} {% comment %}The add a new skill Accordian starts here!{% endcomment %} -
- +
- +
- + {{ choice }}
@@ -36,12 +34,10 @@
Select
-
-
- -
- - +
+ +
+ + +
-
- -
- +
-
- - -
- +
+ + +
@@ -72,31 +71,35 @@
- -
-
- - -
- -
- -
+ +
- -
-
-
+
+ + +
+
+ +
+
+ +

-
- - - - -{% endblock %} \ No newline at end of file + +{% endblock %} diff --git a/FusionIIIT/templates/gymkhanaModule/nomination_details.html b/FusionIIIT/templates/gymkhanaModule/nomination_details.html index f82d8d4db..e33ecc8c2 100644 --- a/FusionIIIT/templates/gymkhanaModule/nomination_details.html +++ b/FusionIIIT/templates/gymkhanaModule/nomination_details.html @@ -1,62 +1,58 @@ {% load static %} {% block nomination_details %} - {% comment %}The tab menu starts here!{% endcomment %} -
-
-
- {% csrf_token %} + + {% csrf_token %} {% comment %}The add a new skill Accordian starts here!{% endcomment %} -
-
- - - -
- -
- - - -
+
-
+
+ + +
+
+
@@ -68,16 +64,19 @@
- -
- - {% csrf_token %} + + {% csrf_token %} {% comment %}The add a new skill Accordian starts here!{% endcomment %} -
+
-
@@ -86,68 +85,37 @@

-
- - {% csrf_token %} - - - - - - - - - - - - - - - + + {% csrf_token %} +
- Name - - Roll Number - - Branch - - CPI - - Programme -
+ + + + + + + + + + {% for i in registration_form %} - - - - - - - - - - - - + + + + + + + {% endfor %} - -
NameRoll NumberBranchCPIProgramme
- {{ i.user_name }} - - {{ i.roll }} - - {{ i.branch }} - - {{ i.cpi }} - - {{ i.programme }} -
{{ i.user_name }}{{ i.roll }}{{ i.branch }}{{ i.cpi }}{{ i.programme }}
- - - + + +
-
- {% endblock %} diff --git a/FusionIIIT/templates/gymkhanaModule/otherReport.html b/FusionIIIT/templates/gymkhanaModule/otherReport.html index 94eb89458..bf3a3f8b2 100644 --- a/FusionIIIT/templates/gymkhanaModule/otherReport.html +++ b/FusionIIIT/templates/gymkhanaModule/otherReport.html @@ -1,12 +1,8 @@ {% block reportform %} - {% comment %}The tab menu starts here!{% endcomment %} - -
- {% csrf_token %} + {% csrf_token %} {% comment %}The add a new skill Accordian starts here!{% endcomment %} -
- +
@@ -47,43 +48,53 @@
-
-
- +
-
- +
-
-
-
-
@@ -95,5 +106,4 @@
- {% endblock %} diff --git a/FusionIIIT/templates/gymkhanaModule/pending_request.html b/FusionIIIT/templates/gymkhanaModule/pending_request.html index 7d73c87b0..50861126d 100644 --- a/FusionIIIT/templates/gymkhanaModule/pending_request.html +++ b/FusionIIIT/templates/gymkhanaModule/pending_request.html @@ -1,233 +1,171 @@ {% load static %} - -{% block css %} - -{% endblock %} - +{% block css %}{% endblock %} {% block pendingrequest %} - - -
- - {% csrf_token %} - - - - - - - - - - - - - - - - - - - {% if "co-ordinator" in Curr_desig or "co co-ordinator" in Curr_desig %} - {% for i in Club_session%} - {% if club_details.club_name|stringformat:"s" == i.club|stringformat:"s" %} - - - - - - - - - - - - - - - {% endif %} - {% endfor %} - {% endif %} - -
- Select - - Venue - - Date - - Start Time - - End Time - - Status -
-
- -
-
- {{ i.venue }} - - {{ i.date }} - - {{ i.start_time}} - - {{ i.end_time}} - - {{ i.status }} - - -
- - -
- - - -
- + + {% csrf_token %} + + + + + + + + + + + + + {% if "co-ordinator" in Curr_desig or "co co-ordinator" in Curr_desig %} + {% for i in Club_session %} + {% if club_details.club_name|stringformat:"s" == i.club|stringformat:"s" %} + + + + + + + + + + {% endif %} + {% endfor %} + {% endif %} + +
SelectVenueDateStart TimeEnd TimeStatus
+
+ + +
+
{{ i.venue }}{{ i.date }}{{ i.start_time }}{{ i.end_time }}{{ i.status }} + + + +

-
- -
- + + +
+ +
+
+
+
-
-
-
- {% csrf_token %} - - - - - - - - - - - - - - - - - {% if "co-ordinator" in Curr_desig or "co co-ordinator" in Curr_desig %} - {% for i in Club_event%} - {% if club_details.club_name|stringformat:"s" == i.club|stringformat:"s" %} - - {% csrf_token %} + + {% csrf_token %} +
- Select - - Club - - Event - - Incharge - - Venue - - Date - - Update -
+ + + + + + + + + + + + + {% if "co-ordinator" in Curr_desig or "co co-ordinator" in Curr_desig %} + {% for i in Club_event %} + {% if club_details.club_name|stringformat:"s" == i.club|stringformat:"s" %} + + {% csrf_token %} + + + + + + + + + + + {% endif %} + {% empty %} - - - - - - - - - - - - {% endif %} - {% empty %} - - - - {% endfor %} - - {% endif %} - -
SelectClubEventInchargeVenueDate + Update +
+
+ + +
+
+ {{ i.club.club_name }} + + {{ i.event_name }} + + {{ i.incharge }} + + {{ i.venue }} + + {{ i.date }} + + + + +
-
- -
-
- {{ i.club.club_name }} - - {{ i.event_name }} - - {{ i.incharge }} - + + No Events - - {{i.venue}} - - - {{i.date}} - - - -
No Events
- - -
- - - -
- + + {% endfor %} + {% endif %} + + +
+ + +
+ +
+

+ +
-
- -
-
- - - - - - + - - +
--> {% endblock %} - {% block javascript %} - - - - {% endblock %} diff --git a/FusionIIIT/templates/gymkhanaModule/poll_status.html b/FusionIIIT/templates/gymkhanaModule/poll_status.html index c6b4dd315..ff6124ead 100644 --- a/FusionIIIT/templates/gymkhanaModule/poll_status.html +++ b/FusionIIIT/templates/gymkhanaModule/poll_status.html @@ -1,59 +1,55 @@ {% block poll_status %} - - - - - - - - -
-
- {% for poll in voting_polls %} -
-
-
- {{poll.title}}
-
- + +
-
- {% for choice in poll.choices %} -
-
{{choice.title}}
-
- {{choice.votes}} + +
+
+ {% for poll in voting_polls %} +
+
+
+ + {{ poll.title }} +
+
+ +
+
+
+
+ {% for choice in poll.choices %} +
+
{{ choice.title }}
+
{{ choice.votes }}
+
+ {% endfor %} +
+ {% endfor %}
-
- {% endfor %}
- {% endfor %} -
-
- - -{% endblock poll_status %} \ No newline at end of file + +{% endblock poll_status %} diff --git a/FusionIIIT/templates/gymkhanaModule/view_budget.html b/FusionIIIT/templates/gymkhanaModule/view_budget.html index 86d7e26ea..a434e8376 100644 --- a/FusionIIIT/templates/gymkhanaModule/view_budget.html +++ b/FusionIIIT/templates/gymkhanaModule/view_budget.html @@ -1,50 +1,35 @@ {% load static %} {% block view_budget %} - {% comment %}The tab menu starts here!{% endcomment %} - {% for i in Club_name %} - {% endblock %} - - diff --git a/FusionIIIT/templates/gymkhanaModule/voting_polls.html b/FusionIIIT/templates/gymkhanaModule/voting_polls.html index 33aa60c8e..1b2c788fa 100644 --- a/FusionIIIT/templates/gymkhanaModule/voting_polls.html +++ b/FusionIIIT/templates/gymkhanaModule/voting_polls.html @@ -1,41 +1,26 @@ -{% block voting_polls %} {% comment %}The tab menu starts here!{% endcomment %} - -{% comment %} {% endcomment %} + + {% block active_poll %} + {% include 'gymkhanaModule/active_poll.html' %} + {% endblock active_poll %} + {% block create_poll %} + {% include 'gymkhanaModule/create_poll.html' %} + {% endblock create_poll %} + {% block poll_status %} + {% include 'gymkhanaModule/poll_status.html' %} + {% endblock poll_status %} +{% endblock voting_polls %} diff --git a/FusionIIIT/templates/hostelmanagement/add_new_rooms.html b/FusionIIIT/templates/hostelmanagement/add_new_rooms.html new file mode 100644 index 000000000..55fc452f3 --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/add_new_rooms.html @@ -0,0 +1,29 @@ +{% block insert_room %} + +

Insert Rooms in Database Form



+ +
+ +
+ {% csrf_token %} +
+

Note : Provide the data in Excel Sheet(xls not xlsx) in following format:

+ Room No | Block No | Room Cap | Room Occupied | Hall Id +
+ +
+ + + + +
+
+
+ +
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/add_student.html b/FusionIIIT/templates/hostelmanagement/add_student.html index 2ae897173..7a95f0ecc 100644 --- a/FusionIIIT/templates/hostelmanagement/add_student.html +++ b/FusionIIIT/templates/hostelmanagement/add_student.html @@ -1,42 +1,60 @@ {% block add_student %}

Student Room Allotment Application Form



-
+ {% comment %}The add a new skill Accordian starts here!{% endcomment %}
- {% csrf_token %} - -
-
- - {% comment %} {% endcomment %} - -
- - -
- - {% comment %} {% endcomment %} - -
- - - -
- + {% csrf_token %} + +
+
+
+
+
+ + +
+
+
+
+
+
+
+ + +
+
+
+
+ + +
+ +
+
+
+
@@ -58,6 +65,13 @@ {% endblock %}
+
+
+ {% block insert_room %} + {% include 'hostelmanagement/add_new_rooms.html' %} + {% endblock %} +
+


diff --git a/FusionIIIT/templates/hostelmanagement/attendance.html b/FusionIIIT/templates/hostelmanagement/attendance.html index 9ff13e039..34d69e64a 100644 --- a/FusionIIIT/templates/hostelmanagement/attendance.html +++ b/FusionIIIT/templates/hostelmanagement/attendance.html @@ -7,7 +7,7 @@ diff --git a/FusionIIIT/templates/hostelmanagement/book_guest_room.html b/FusionIIIT/templates/hostelmanagement/book_guest_room.html new file mode 100644 index 000000000..dc192240c --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/book_guest_room.html @@ -0,0 +1,124 @@ +{% block book_guest_room %} + +
+
+ + Book a Guest Room! +
+ {{ form.non_field_errors }} +
+
+ {% csrf_token %} +
+ + +
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ {% comment %}
+ + + +
{% endcomment %} + +
+
+ {{ form.guests.errors }} + + +
+
+ {{ form.nationality.errors }} + + +
+
+
+
+ {{ form.rooms_required.errors }} + + +
+
+ {{ form.guest_name.errors }} + + +
+
+
+
+ {{ form.guest_email.errors }} + + +
+
+ {{ form.guest_phone.errors }} + + +
+
+
+ {{ form.guest_address.errors }} + + +
+
+ {{ form.purpose.errors }} + + +
+ + +
+
+ + +
+
+
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/book_guest_room_status.html b/FusionIIIT/templates/hostelmanagement/book_guest_room_status.html new file mode 100644 index 000000000..8faba8964 --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/book_guest_room_status.html @@ -0,0 +1,51 @@ +{% block book_guest_room_status %} + {% for user_request in user_guest_room_requests %} +
+
+
+

Room for {{user_request.total_guest}} in {{user_request.hall.hall_id}}

+
+
+ + + + + + + + + + + + + + + + + + + + + + +
Requested ForContactArrivalDepartureStatus
{{user_request.guest_name}}{{user_request.guest_phone}}{{user_request.arrival_date}}{{user_request.departure_date}}{{user_request.status}}
+
+
+ + Reason +
+
+

Description

+ +
+
+
+
+
+
+ +
+
+
+ {% endfor %} +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hostelmanagement/hostel.html b/FusionIIIT/templates/hostelmanagement/hostel.html index b86676914..9163264ed 100644 --- a/FusionIIIT/templates/hostelmanagement/hostel.html +++ b/FusionIIIT/templates/hostelmanagement/hostel.html @@ -33,28 +33,42 @@ - {% if user in hall_caretaker or hall_warden%} + {% if user in hall_caretaker or user in hall_warden%} Staff's Schedule {% endif %} - Notice Board - Student Attendance - {% comment %} - Book Guest Room + {%if user not in hall_caretaker and user not in hall_warden%} + + Book Guest Room + + + {% endif %} + + {%if user in hall_caretaker or user in hall_warden%} + + Guest Room Requests - {% endcomment %} + + {% endif %} + + {%if user not in hall_caretaker and user not in hall_warden%} + + Your Bookings + + + {% endif %}
@@ -68,7 +82,7 @@ {% endblock %}
- {% if user in hall_caretaker or hall_warden%} + {% if user in hall_caretaker or user in hall_warden%}
{% block staff_schedule %} {% include 'hostelmanagement/staff_schedule.html'%} @@ -88,11 +102,29 @@ {% endblock %}
- {% comment %}
- {% block guest_room %} - {% include 'hostelmanagement/guestroom_booking.html'%} + {% if user not in hall_caretaker and user not in hall_warden%} +
+ {% block book_guest_room %} + {% include 'hostelmanagement/book_guest_room.html' %} + {% endblock %} +
+ {% endif %} + + {% if user in hall_caretaker or user in hall_warden %} +
+ {% block request_list %} + {% include 'hostelmanagement/update_guest_room.html' %} {% endblock %} -
{% endcomment %} +
+ {% endif %} + + {% if user not in hall_caretaker and user not in hall_warden%} +
+ {% block book_guest_room_status %} + {% include 'hostelmanagement/book_guest_room_status.html' %} + {% endblock %} +
+ {% endif %}
diff --git a/FusionIIIT/templates/hostelmanagement/notice.html b/FusionIIIT/templates/hostelmanagement/notice.html index 2f19361a8..7d6bc6ee4 100644 --- a/FusionIIIT/templates/hostelmanagement/notice.html +++ b/FusionIIIT/templates/hostelmanagement/notice.html @@ -8,13 +8,13 @@ Notice Board
-{% if user in hall_caretaker or hall_warden %} +{% if user in hall_caretaker or user in hall_warden %} {% endif %}
-{% if user in hall_caretaker or hall_warden %} +{% if user in hall_caretaker or user in hall_warden %}
{% block notice_form %} @@ -33,7 +33,7 @@ {% endif %} {% for hall in all_hall %} -
+

- {% if user in hall_caretaker or hall_warden %} + {% if user in hall_caretaker or user in hall_warden %} {% ifequal current_hall notice.hall.hall_id %}
{% csrf_token %} diff --git a/FusionIIIT/templates/hostelmanagement/request_list.html b/FusionIIIT/templates/hostelmanagement/request_list.html new file mode 100644 index 000000000..8b90893b9 --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/request_list.html @@ -0,0 +1,80 @@ +{% load custom_tags %} + +{% block {{hall.hall_id}} %} + {% for pending_request in pending_guest_room_requests|get_hall_no:hall_id %} +
+
+
+

Room for {{pending_request.total_guest}} in {{pending_request.hall.hall_id}}

+
+
+ + + + + + + + + + + + + + + + + + + + + + +
Requested ByGuest NameGuest PhoneArrivalDeparture
{{pending_request.intender.user.username}}{{pending_request.guest_name}}{{pending_request.guest_phone}}{{pending_request.arrival_date}}{{pending_request.departure_date}}
+
+
+ + Reason +
+
+

Description

+ +
+
+
+
+
+
+
+ {% if user in hall_caretaker or user in hall_warden %} + {% ifequal current_hall pending_request.hall.hall_id %} + + {% csrf_token %} +
+
+ + +
+
+ + +
+
+
+ +
+ + + {% endifequal %} + {% endif %} +
+
+
+
+ {% endfor %} +{% endblock %} diff --git a/FusionIIIT/templates/hostelmanagement/staff_schedule.html b/FusionIIIT/templates/hostelmanagement/staff_schedule.html index b0f21856f..d3a105134 100644 --- a/FusionIIIT/templates/hostelmanagement/staff_schedule.html +++ b/FusionIIIT/templates/hostelmanagement/staff_schedule.html @@ -6,8 +6,8 @@ Select Hall
@@ -34,7 +34,7 @@
{% for hall in all_hall %} -
+
{% block {{hall.hall_id}} %} {% include 'hostelmanagement/hall_staffs.html' with hall_id=hall.hall_id %} diff --git a/FusionIIIT/templates/hostelmanagement/update_guest_room.html b/FusionIIIT/templates/hostelmanagement/update_guest_room.html new file mode 100644 index 000000000..0ded23d9f --- /dev/null +++ b/FusionIIIT/templates/hostelmanagement/update_guest_room.html @@ -0,0 +1,28 @@ +{% load static %} +{% block request_list %} + + + +{% for hall in all_hall %} +
+
+ {% block {{hall.hall_id}} %} + {% include 'hostelmanagement/request_list.html' with hall_id=hall.hall_id %} + {% endblock %} +
+
+{% endfor %} + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/hr2Module/service_main.html b/FusionIIIT/templates/hr2Module/service_main.html index b483e8ed4..7059c76e9 100644 --- a/FusionIIIT/templates/hr2Module/service_main.html +++ b/FusionIIIT/templates/hr2Module/service_main.html @@ -1,7 +1,6 @@ {%block service%} -
- - - - - - - -
@@ -1008,12 +960,6 @@

Deputations :

- {% if awards %} - - {% elif not awards %} - - {% endif%} - @@ -1052,78 +998,45 @@

Awards

- -
- -
Awards :-No Entries :-
Sr. Name
- {% if otherServiceBooks %} - - {% elif not otherServiceBooks %} - - {% endif%} +

Leave Record

- - - - - - - - + + - - - - -

Others :

- - - - - {% for serviceBook in otherServiceBooks%} - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - {% endfor %} - + +
Others :-No Entries :-
Start DateEnd DateJob TitleOrganisationDescriptionSalary SourceDesignationEarned Leaves{{leaves.earned_leaves}}
- {{forloop.counter }}. - {{serviceBook.start_date}}{{serviceBook.end_date}}{{serviceBook.job_title}}{{serviceBook.organisation}}{{serviceBook.description}}Medical Leaves{{leaves.medical_leaves}}
Vactional Leaves{{leaves.vacation_leaves}}
Special Casual Leaves{{leaves.special_casual_leave}}
Duty Leaves{{leaves.project_leave}}
Commuted Leaves{{leaves.commuted_leaves}}
- - - - - - - -
- - - -
diff --git a/FusionIIIT/templates/iwdModuleV2/Page1.html b/FusionIIIT/templates/iwdModuleV2/Page1.html index 8e7eac710..bfd2d8a69 100644 --- a/FusionIIIT/templates/iwdModuleV2/Page1.html +++ b/FusionIIIT/templates/iwdModuleV2/Page1.html @@ -65,7 +65,7 @@ AA And AES
- +
@@ -111,7 +111,8 @@ - Next + Next + {% if var %}

{{var}}

{% endif %}
diff --git a/FusionIIIT/templates/iwdModuleV2/Page2.html b/FusionIIIT/templates/iwdModuleV2/Page2.html index 9f933e3be..715244f82 100644 --- a/FusionIIIT/templates/iwdModuleV2/Page2.html +++ b/FusionIIIT/templates/iwdModuleV2/Page2.html @@ -65,7 +65,7 @@ Corrigendum
- +
@@ -73,7 +73,8 @@ Addendum
- + +
@@ -81,7 +82,8 @@ Pre-bid meeting details
- + +
@@ -89,7 +91,8 @@ Technical-bid meeting details
- + +
@@ -101,7 +104,8 @@ Financial-bid meeting details
- + +
@@ -113,7 +117,8 @@ Letter of intent
- + +
@@ -121,7 +126,8 @@ Work order
- + +
@@ -129,7 +135,8 @@ Agreement Letter
- + +
@@ -137,13 +144,15 @@ Milestones
- + +
- Next + Prev + Next
@@ -178,4 +187,4 @@ -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/Page3.html b/FusionIIIT/templates/iwdModuleV2/Page3.html index d19ae128d..ddde765e5 100644 --- a/FusionIIIT/templates/iwdModuleV2/Page3.html +++ b/FusionIIIT/templates/iwdModuleV2/Page3.html @@ -65,7 +65,8 @@ Extension of time
- + +
@@ -76,7 +77,8 @@ - Next + Prev + Back To Home
@@ -110,4 +112,4 @@ -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/createWork.html b/FusionIIIT/templates/iwdModuleV2/createWork.html index 04323ba15..7fa533571 100644 --- a/FusionIIIT/templates/iwdModuleV2/createWork.html +++ b/FusionIIIT/templates/iwdModuleV2/createWork.html @@ -4,20 +4,17 @@ Create Project Requisition: -
+
- - -
+ -
+ - -
+ -
+
diff --git a/FusionIIIT/templates/iwdModuleV2/page1_create.html b/FusionIIIT/templates/iwdModuleV2/page1_create.html index c549fe90f..de798b7cb 100644 --- a/FusionIIIT/templates/iwdModuleV2/page1_create.html +++ b/FusionIIIT/templates/iwdModuleV2/page1_create.html @@ -78,7 +78,7 @@
- +

+{% comment %}The grid ends here!{% endcomment %} {% endblock %} {% block javascript %} - - - + + + -{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/iwdModuleV2/viewWork.html b/FusionIIIT/templates/iwdModuleV2/viewWork.html index 3fb49831f..d67b8d528 100644 --- a/FusionIIIT/templates/iwdModuleV2/viewWork.html +++ b/FusionIIIT/templates/iwdModuleV2/viewWork.html @@ -1,6 +1,7 @@
-
{% csrf_token %} + + {% csrf_token %}

diff --git a/FusionIIIT/templates/leaveModule/leave.html b/FusionIIIT/templates/leaveModule/leave.html index 86f97c2ed..f9d01befb 100755 --- a/FusionIIIT/templates/leaveModule/leave.html +++ b/FusionIIIT/templates/leaveModule/leave.html @@ -112,6 +112,11 @@

Please Add a remark

+ {% comment %}The grid starts here!{% endcomment %}
@@ -120,7 +125,7 @@

Please Add a remark

{% comment %}The left-rail segment starts here!{% endcomment %} -
+
{% comment %}ROW #1 starts here!{% endcomment %}
@@ -172,7 +177,7 @@

Please Add a remark

{% comment %}The left-rail segment endss here!{% endcomment %} {% comment %}The central-rail segment starts here!{% endcomment %} -
+
{% comment %}The Leave Application Form starts here!{% endcomment %} diff --git a/FusionIIIT/templates/libraryModule/issuedItems.html b/FusionIIIT/templates/libraryModule/issuedItems.html index 8a5b3afe0..8e73513f5 100644 --- a/FusionIIIT/templates/libraryModule/issuedItems.html +++ b/FusionIIIT/templates/libraryModule/issuedItems.html @@ -9,7 +9,7 @@
-
+
{% block tab1content1 %} {% include 'libraryModule/issuedItems_content.html' %} {% endblock %} diff --git a/FusionIIIT/templates/libraryModule/libraryModule.html b/FusionIIIT/templates/libraryModule/libraryModule.html index cb617b11c..ac94c2d17 100644 --- a/FusionIIIT/templates/libraryModule/libraryModule.html +++ b/FusionIIIT/templates/libraryModule/libraryModule.html @@ -34,7 +34,7 @@ {% endblock %} {% comment %}The user image card ends here!{% endcomment %} -
+
{% comment %}The Tab-Menu starts here!{% endcomment %} + + + -
-
- -
+ +
+ {%endif%} + {%endfor%}
@@ -73,9 +251,114 @@
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + {% for item in menuchangerequest %} + + + + + + + + + + + + {% endfor %} + + +
+ Application Date + + Previous Dish + + Requested Dish + + Reason + + Status +
+ {{item.app_date}} + + {{item.dish}} + + {{item.request}} + + {{item.reason}} + + {% if item.status == '2' %} + + {% elif item.status == '0' %} + + {% elif item.status == '1' %} + + + {% endif %} + +
+
+
+
+
+
+ +
+
+ : Approved       + : Pending       + : Declined +
+
+ +
+ {% block javascript %} {% endblock %} {% endblock %} diff --git a/FusionIIIT/templates/messModule/meeting_information.html b/FusionIIIT/templates/messModule/meeting_information.html index 05913ca03..190133372 100644 --- a/FusionIIIT/templates/messModule/meeting_information.html +++ b/FusionIIIT/templates/messModule/meeting_information.html @@ -33,7 +33,7 @@ - +
@@ -187,7 +187,7 @@ + {% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/messModule/messInfoForm.html b/FusionIIIT/templates/messModule/messInfoForm.html index 0a1b4c214..74ae115bd 100644 --- a/FusionIIIT/templates/messModule/messInfoForm.html +++ b/FusionIIIT/templates/messModule/messInfoForm.html @@ -1,9 +1,37 @@ {% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Central Mess +{% endblock %} + {% block body %} -
+ {% block navBar %} + {% include 'dashboard/navbar.html' %} + {% endblock %} +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %} + The left-rail segment starts here! + {% endcomment %} +
+ + {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ +

Mess registration

{% csrf_token %} {{ form }} - + {% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/messModule/messactivities.html b/FusionIIIT/templates/messModule/messactivities.html index 3c47cc844..ebca3eb5e 100644 --- a/FusionIIIT/templates/messModule/messactivities.html +++ b/FusionIIIT/templates/messModule/messactivities.html @@ -33,9 +33,9 @@ {% for items in members %} - {% if items.designation.name == "mess_committee_mess1" or items.designation.name == "mess_convener_mess1" %} + {% if items.designation.name == "mess_committee" or items.designation.name == "mess_convener" %}

{{ items.user|truncatechars:7 }} - {{ items.user.first_name|title }} {{ items.user.last_name|title }} - {% if items.designation.name == "mess_convener_mess1" %} + {% if items.designation.name == "mess_convener" %} (Mess Convener) {% endif %}

@@ -82,6 +82,13 @@ {% if current_date < mess_reg.end_reg %} Registration ongoing till {{ mess_reg.end_reg }} +
+
+ +
+
{% else %} {#
#} @@ -214,14 +221,14 @@
Add To Mess Committee
- + {% csrf_token %}
- +
- +
@@ -267,7 +274,7 @@ +
+
+ + + + +
+ +
+
+
+
+
+
+
+ {% csrf_token %} +
+ + +
+
+ +
+
+
+
+ {% csrf_token %} +
+ + +
+
+
+ +
    +
  • + The excel sheet should only contain one column with the roll + number of all the Students those should be registered or present + in Mess1. +
  • +
  • File should be in .xlsx or .xls format.
  • +
  • This registration will add the Students to mess1.
  • +
+
+
+
+
+
+
+
+
+
+ {% csrf_token %} +
+ + +
+
+ +
+
+
+
+ {% csrf_token %} +
+ + +
+
+
+ +
    +
  • + The excel sheet should only contain one column with the roll + number of all the Students which should be registered or present + in Mess2. +
  • +
  • File should be in .xlsx or .xls format.
  • +
  • This registration will add the Students to mess2.
  • +
+
+
+
+
+
+ +
+ +{% block javascript %} + + + +{% endblock %} {% endblock %} diff --git a/FusionIIIT/templates/messModule/respondmenu.html b/FusionIIIT/templates/messModule/respondmenu.html index b954d67cc..d16debf9b 100644 --- a/FusionIIIT/templates/messModule/respondmenu.html +++ b/FusionIIIT/templates/messModule/respondmenu.html @@ -35,7 +35,7 @@
Date of Application: {{list.app_date}}
- Student: {{ list.student_id|truncatewords:1|slice:"-4" }} + Student: {{ list.student_id|truncatewords:1|slice:"-1" }}
Reason: {{list.reason}}
@@ -57,7 +57,7 @@
-
+ {% endif %} @@ -81,7 +81,7 @@

Accepted

Date of Application: {{list.app_date}}
- Student: {{ list.student_id|truncatewords:1|slice:"-4" }} + Student: {{ list.student_id|truncatewords:1|slice:"-1" }}
Reason: {{list.reason}}
@@ -91,7 +91,7 @@
-
+ {% endif %} {% if list.status == '0' %} @@ -100,7 +100,7 @@

Rejected

Date of Application: {{list.app_date}}
- Student: {{ list.student_id|truncatewords:1|slice:"-4" }} + Student: {{ list.student_id|truncatewords:1|slice:"-1" }}
Reason: {{list.reason}}
@@ -110,7 +110,7 @@
-
+ {% endif %} {% endfor %} diff --git a/FusionIIIT/templates/messModule/respondtorequests.html b/FusionIIIT/templates/messModule/respondtorequests.html index e08223270..ef43726e7 100644 --- a/FusionIIIT/templates/messModule/respondtorequests.html +++ b/FusionIIIT/templates/messModule/respondtorequests.html @@ -131,7 +131,7 @@

- {{ item.student_id.id|truncatewords:1|slice:"-4" }} + {{ item.student_id.id|truncatewords:1|slice:"-1" }}

@@ -195,7 +195,7 @@

Application Date: {{item.app_date}}
- Student: {{ item.student_id.id|truncatewords:1|slice:"-4" }} + Student: {{ item.student_id.id|truncatewords:1|slice:"-1" }}
Reason: {{item.purpose}}
diff --git a/FusionIIIT/templates/messModule/splreq.html b/FusionIIIT/templates/messModule/splreq.html index a5a7aeaac..d226593dd 100644 --- a/FusionIIIT/templates/messModule/splreq.html +++ b/FusionIIIT/templates/messModule/splreq.html @@ -32,7 +32,7 @@ {{var.app_date}} - {{var.student_id.id|truncatewords:1|slice:"-4"}} + {{var.student_id.id|truncatewords:1|slice:"-1"}} {{var.start_date}}-{{var.end_date}} {# {{var.end_date}}#} @@ -82,7 +82,7 @@ {{var.app_date}} - {{var.student_id.id|truncatewords:1|slice:"-4"}} + {{var.student_id.id|truncatewords:1|slice:"-1"}} {{var.start_date}}-{{var.end_date}} {# {{var.end_date}}#} diff --git a/FusionIIIT/templates/messModule/updatemenu.html b/FusionIIIT/templates/messModule/updatemenu.html new file mode 100644 index 000000000..45ae240af --- /dev/null +++ b/FusionIIIT/templates/messModule/updatemenu.html @@ -0,0 +1,519 @@ +{% block update_menu %} +{% load static %} + + {% comment %}The tab menu starts here!{% endcomment %} + + + +
+
+ + {% csrf_token %} +
+ + + + + + + + + + + + + + + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'MB' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'ML' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'MD' %} + + {% endif %} + {% endif %} + {% endfor %} + + + + + + + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'TB' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'TL' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'TD' %} + + {% endif %} + {% endif %} + {% endfor %} + + + + + + + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'WB' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'WL' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'WD' %} + + {% endif %} + {% endif %} + {% endfor %} + + + + + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'THB' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'THL' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'THD' %} + + {% endif %} + {% endif %} + {% endfor %} + + + + + + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'FB' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'FL' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'FD' %} + + {% endif %} + {% endif %} + {% endfor %} + + + + + + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'SB' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'SL' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'SD' %} + + {% endif %} + {% endif %} + {% endfor %} + + + + + + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'SUB' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'SUL' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess2' %} + {% if item.meal_time == 'SUD' %} + + {% endif %} + {% endif %} + {% endfor %} + + + + + +
BreakfastLunchDinner
Monday
Tuesday
Wednesday
Thursday
Frnameay
Saturday
Sunday
+
+
+ +
+ +
+
+ + +
+ +
+
+ +
+
+ + {% csrf_token %} +
+ + + + + + + + + + + + + + + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'MB' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'ML' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'MD' %} + + {% endif %} + {% endif %} + {% endfor %} + + + + + + + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'TB' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'TL' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'TD' %} + + {% endif %} + {% endif %} + {% endfor %} + + + + + + + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'WB' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'WL' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'WD' %} + + {% endif %} + {% endif %} + {% endfor %} + + + + + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'THB' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'THL' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'THD' %} + + {% endif %} + {% endif %} + {% endfor %} + + + + + + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'FB' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'FL' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'FD' %} + + {% endif %} + {% endif %} + {% endfor %} + + + + + + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'SB' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'SL' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'SD' %} + + {% endif %} + {% endif %} + {% endfor %} + + + + + + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'SUB' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'SUL' %} + + {% endif %} + {% endif %} + {% endfor %} + + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'SUD' %} + + {% endif %} + {% endif %} + {% endfor %} + + + + + +
BreakfastLunchDinner
Monday
Tuesday
Wednesday
Thursday
Frnameay
Saturday
Sunday
+
+
+ +
+ +
+
+ + +
+ +
+
+{% endblock %} + +{% block javascript %} + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/messModule/uploadPaymentDue.html b/FusionIIIT/templates/messModule/uploadPaymentDue.html new file mode 100644 index 000000000..c62ad4130 --- /dev/null +++ b/FusionIIIT/templates/messModule/uploadPaymentDue.html @@ -0,0 +1,64 @@ +{% load static %} {% block uploadPaymentDue %} + + + +
+
+
+
+ {% csrf_token %} +
+ +
+
+
+ +
    +
  • + The single excel sheet should only contain two columns with each row representing student roll number + and amount due. columnA should consists of rollnumber and column2 should consists of the amount. +
  • +
  • File should be in .xlsx or .xls format.
  • +
  • The negative due amount represents that the student paid fee in advance.
  • +
  • If some data of perticular should already present then that data will overlap with the current one.
  • +
+
+
+
+
+
+ +
+ +{% block javascript %} + + + +{% endblock %} {% endblock %} diff --git a/FusionIIIT/templates/messModule/view_feedback.html b/FusionIIIT/templates/messModule/view_feedback.html index a52e70447..6bfa6e951 100644 --- a/FusionIIIT/templates/messModule/view_feedback.html +++ b/FusionIIIT/templates/messModule/view_feedback.html @@ -38,16 +38,31 @@ Student ID Feedback Type Description + Mess - {% for item in feed %} + {% for item in feed1 %} {% if item.feedback_type == 'Food' %} {{item.fdate}} - {{ item.student_id.id|truncatewords:1|slice:"-4" }} + {{ item.student_id.id|truncatewords:1|slice:"8" }} {{item.feedback_type}} {{item.description}} + Mess1 + + {% endif %} + {% endfor %} + + + {% for item in feed2%} + {% if item.feedback_type == 'Food' %} + + {{item.fdate}} + {{ item.student_id.id|truncatewords:1|slice:"8" }} + {{item.feedback_type}} + {{item.description}} + Mess2 {% endif %} {% endfor %} @@ -68,16 +83,31 @@ Student ID Feedback Type Description + Mess - {% for item in feed %} + {% for item in feed1 %} + {% if item.feedback_type == 'Cleanliness' %} + + {{item.fdate}} + {{ item.student_id|truncatewords:1|slice:"8" }} + {{item.feedback_type}} + {{item.description}} + Mess1 + + {% endif %} + {% endfor %} + + + {% for item in feed2%} {% if item.feedback_type == 'Cleanliness' %} {{item.fdate}} - {{ item.student_id|truncatewords:1|slice:"-4" }} + {{ item.student_id.id|truncatewords:1|slice:"8" }} {{item.feedback_type}} {{item.description}} + Mess2 {% endif %} {% endfor %} @@ -98,16 +128,32 @@ Student ID Feedback Type Description + Mess + - {% for item in feed %} + {% for item in feed1 %} {% if item.feedback_type == 'Maintenance' %} {{item.fdate}} - {{ item.student_id.id|truncatewords:1|slice:"-4" }} + {{ item.student_id.id|truncatewords:1|slice:"8" }} {{item.feedback_type}} {{item.description}} + Mess1 + + {% endif %} + {% endfor %} + + + {% for item in feed2%} + {% if item.feedback_type == 'Maintenance' %} + + {{item.fdate}} + {{ item.student_id.id|truncatewords:1|slice:"8" }} + {{item.feedback_type}} + {{item.description}} + Mess2 {% endif %} {% endfor %} @@ -117,7 +163,7 @@

-

+
@@ -128,16 +174,32 @@ Student ID Feedback Type Description + Mess + - {% for item in feed %} + {% for item in feed1%} {% if item.feedback_type == 'Others' %} {{item.fdate}} - {{ item.student_id.id|truncatewords:1|slice:"-4" }} + {{ item.student_id.id|truncatewords:1|slice:"8" }} {{item.feedback_type}} {{item.description}} + Mess1 + + {% endif %} + {% endfor %} + + + {% for item in feed2%} + {% if item.feedback_type == 'Others' %} + + {{item.fdate}} + {{ item.student_id.id|truncatewords:1|slice:"8" }} + {{item.feedback_type}} + {{item.description}} + Mess2 {% endif %} {% endfor %} @@ -152,12 +214,35 @@
diff --git a/FusionIIIT/templates/messModule/viewmenu.html b/FusionIIIT/templates/messModule/viewmenu.html index cae07f21a..0ac8034c6 100644 --- a/FusionIIIT/templates/messModule/viewmenu.html +++ b/FusionIIIT/templates/messModule/viewmenu.html @@ -4,14 +4,14 @@ {% comment %}The tab menu starts here!{% endcomment %} -
+
@@ -28,21 +28,6 @@ - {% for item in menu %} {% if item.mess_option == 'mess2' %} {% if item.meal_time == 'MB' %} @@ -72,22 +57,6 @@ - {% for item in menu %} {% if item.mess_option == 'mess2' %} {% if item.meal_time == 'TB' %} @@ -118,21 +87,6 @@ - {% for item in menu %} {% if item.mess_option == 'mess2' %} {% if item.meal_time == 'WB' %} @@ -161,22 +115,6 @@ - {% for item in menu %} {% if item.mess_option == 'mess2' %} {% if item.meal_time == 'THB' %} @@ -206,21 +144,6 @@ - {% for item in menu %} {% if item.mess_option == 'mess2' %} {% if item.meal_time == 'FB' %} @@ -250,21 +173,6 @@ - {% for item in menu %} {% if item.mess_option == 'mess2' %} {% if item.meal_time == 'SB' %} @@ -294,21 +202,6 @@ - {% for item in menu %} {% if item.mess_option == 'mess2' %} {% if item.meal_time == 'SUB' %} @@ -356,7 +249,7 @@ -
+
Monday
Tuesday
Wednesday
ThursdayFriday
Saturday
Sunday
@@ -373,21 +266,21 @@ - {% for item in menu %} - {% if item.mess_option == 'mess1' %} - {% if item.meal_time == 'MB' or item.meal_time == 'ML' or item.meal_time == 'MD' %} - - {% if item.meal_time == 'MB' %} - - {% elif item.meal_time == 'ML' %} - - {% elif item.meal_time == 'MD' %} - + {% for item in menu %} + {% if item.mess_option == 'mess1' %} + {% if item.meal_time == 'MB' or item.meal_time == 'ML' or item.meal_time == 'MD' %} + + {% if item.meal_time == 'MB' %} + + {% elif item.meal_time == 'ML' %} + + {% elif item.meal_time == 'MD' %} + + {% endif %} + {% endif %} - {% endif %} - {% endif %} - {% endfor %} + {% endfor %} diff --git a/FusionIIIT/templates/messModule/views.html b/FusionIIIT/templates/messModule/views.html index f4a4a0ff2..8049c4920 100644 --- a/FusionIIIT/templates/messModule/views.html +++ b/FusionIIIT/templates/messModule/views.html @@ -22,7 +22,7 @@ -
Monday{{item.dish}}{{item.dish}}{{item.dish}}{{item.dish}}{{item.dish}}{{item.dish}}
@@ -40,28 +40,22 @@ - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'MB' %} {% endif %} - {% endif %} {% endfor %} - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'ML' %} {% endif %} - {% endif %} {% endfor %} - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'MD' %} {% endif %} - {% endif %} {% endfor %} @@ -70,28 +64,22 @@ - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'TB' %} {% endif %} - {% endif %} {% endfor %} - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'TL' %} {% endif %} - {% endif %} {% endfor %} - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'TD' %} {% endif %} - {% endif %} {% endfor %} @@ -101,28 +89,22 @@ - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'WB' %} {% endif %} - {% endif %} {% endfor %} - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'WL' %} {% endif %} - {% endif %} {% endfor %} - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'WD' %} {% endif %} - {% endif %} {% endfor %} @@ -130,28 +112,22 @@ - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'THB' %} {% endif %} - {% endif %} {% endfor %} - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'THL' %} {% endif %} - {% endif %} {% endfor %} - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'THD' %} {% endif %} - {% endif %} {% endfor %} @@ -160,28 +136,22 @@ - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'FB' %} {% endif %} - {% endif %} {% endfor %} - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'FL' %} {% endif %} - {% endif %} {% endfor %} - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'FD' %} {% endif %} - {% endif %} {% endfor %} @@ -189,28 +159,22 @@ - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'SB' %} {% endif %} - {% endif %} {% endfor %} - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'SL' %} {% endif %} - {% endif %} {% endfor %} - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'SD' %} {% endif %} - {% endif %} {% endfor %} @@ -219,28 +183,22 @@ - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'SUB' %} {% endif %} - {% endif %} {% endfor %} - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'SUL' %} {% endif %} - {% endif %} {% endfor %} - {% for item in menu %} - {% if item.mess_option == messinfo.mess_option %} + {% for item in reg_menu %} {% if item.meal_time == 'SUD' %} {% endif %} - {% endif %} {% endfor %} @@ -277,8 +235,9 @@ - + + {% for stu in monthly_bill %} @@ -287,13 +246,27 @@ - + + + {% endfor %}
Monday{{item.dish}}{{item.dish}}{{item.dish}}
Tuesday{{item.dish}}{{item.dish}}{{item.dish}}Wednesday{{item.dish}}{{item.dish}}{{item.dish}}
Thursday{{item.dish}}{{item.dish}}{{item.dish}}
Friday{{item.dish}}{{item.dish}}{{item.dish}}
Saturday{{item.dish}}{{item.dish}}{{item.dish}}
Sunday{{item.dish}}{{item.dish}}{{item.dish}}
Monthly bill Rebate Count Rebate AmtNonVeg Amt TotalPaidDue Amount
{{stu.amount}} {{stu.rebate_count}} {{stu.rebate_amount}}{{stu.nonveg_total_bill}} {{stu.total_bill}} + {% if stu.paid %} + + {% else %} + + {% endif %} + + {% if stu.paid %} + 0 + {% else %} + {{stu.due_amount}} + {% endif %} +
- +

Total Due Amount : {{total_due}}



@@ -313,26 +286,6 @@ - - {% for pay in payments %} - - -

- -
- {{pay.student_id}} -
-

- - - {{pay.sem}} - - {{pay.amount_paid}} - - - - {% endfor %} -
diff --git a/FusionIIIT/templates/officeModule/officeOfDeanRSPC/tab1content1.html b/FusionIIIT/templates/officeModule/officeOfDeanRSPC/tab1content1.html index 8af0fd948..e864850ae 100644 --- a/FusionIIIT/templates/officeModule/officeOfDeanRSPC/tab1content1.html +++ b/FusionIIIT/templates/officeModule/officeOfDeanRSPC/tab1content1.html @@ -12,7 +12,7 @@
- +
@@ -34,7 +34,7 @@
- @@ -59,12 +59,12 @@
- +
- @@ -75,12 +75,12 @@
- +
- +
- - - -

- - -

- - -

- - - - -
- - -
-

-
- -
-
- -
- - -
- -
- -
- - - - -
-
+{% comment %}the main tab starts here {% endcomment %} + + +{% comment %}the doctor appointment tab starts here {% endcomment %} +
+
+
{% csrf_token %} +
+ + +
+
+ + + +

+ + +

+ + +

+
+ +
+ +

+
+
-
-
- -
- {% comment %}the doctor appointment tab ends here {% endcomment %} - - {% comment %}the ambulance appointment tab starts here {% endcomment %} -
-
- {% csrf_token %} -
-
- - -

- -
-
- - - -

- - -
-
- - -
- -
- -

-
-
- -
- -
- -
-
- - - -
-
+
+ +
+ + +
+
-
-
-
+
+ + + + +
+
+
+
+
+
+{% comment %}the doctor appointment tab ends here {% endcomment %} + +{% comment %}the ambulance appointment tab starts here {% endcomment %} +
+
+
+ {% csrf_token %} +
+
+ + + +
+
+ + + +
+
+
+ +
+ +
+
- {% comment %}the ambulance appointment tab ends here {% endcomment %} +
+ +
+ +
+
+
+ +
+
+
+
+
+
+{% comment %}the ambulance appointment tab ends here {% endcomment %} {% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/phcModule/comp_prescription.html b/FusionIIIT/templates/phcModule/comp_prescription.html index b1b1fa226..89c240029 100755 --- a/FusionIIIT/templates/phcModule/comp_prescription.html +++ b/FusionIIIT/templates/phcModule/comp_prescription.html @@ -4,13 +4,16 @@ {% comment %}the compounder prescription tab starts here {% endcomment %} {% comment %}the prescribe tab starts here {% endcomment %} @@ -22,17 +25,27 @@
{% csrf_token %}

+
- {% for a in appointments_today %} {% endfor %} +
-
- +
+ + +
+
@@ -120,6 +133,7 @@ $('#medicine').click(function(e){ $("#sched tr").remove(); var user = document.getElementById('user').value; + var doctor = document.getElementById('doctor').value; var quantity = document.getElementById('quantity').value; var medicine = document.getElementById('medicine_id').value; var days = document.getElementById('days').value; @@ -135,6 +149,7 @@ data: { csrfmiddlewaretoken: '{{ csrf_token }}', user:$("#user").val(), + doctor:$("#doctor").val(), quantity:$("#quantity").val(), medicine_name:$("#medicine_id").val(), days:$("#days").val(), @@ -142,7 +157,7 @@ }, success: function(data){ - alert("added medicine"); + alert("Added Medicine!"); document.getElementById("quantity").value=""; document.getElementById("medicine_id").value=""; document.getElementById("days").value=""; @@ -185,7 +200,7 @@ }, success: function(data){ if (data.status == 1 ){ - alert("prescribed medicine"); + alert("Prescription Added!"); document.getElementById("details").value=""; document.getElementById("tests").value=""; $('#sched').empty(); @@ -210,13 +225,14 @@ style="padding-left: 3.5%; padding-right: 3.5%;"> - {% csrf_token %} + + {% csrf_token %}

- +
@@ -338,7 +354,7 @@ times:$("#times_b").val() }, success: function(data){ - alert("added medicine"); + alert("Added Medicine!"); document.getElementById("quantity_b").value=""; document.getElementById("medicine_id_b").value=""; document.getElementById("days_b").value=""; @@ -381,7 +397,7 @@ }, success: function(data){ if (data.status == 1){ - alert("prescribed medicine"); + alert("Prescription Added!"); document.getElementById("doctor_b").value=""; document.getElementById("details_b").value=""; document.getElementById("tests_b").value=""; @@ -524,11 +540,97 @@

*Admission details for outside hospitals

}); }); - +

+ +{% comment %}the add hospital tab starts here {% endcomment %} +
+

+
+ + {% csrf_token %} + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ + +
+
+
+
+{% comment %}the add doctor tab ends here {% endcomment %} +
diff --git a/FusionIIIT/templates/phcModule/doctors.html b/FusionIIIT/templates/phcModule/doctors.html index 3c852475a..52139e260 100644 --- a/FusionIIIT/templates/phcModule/doctors.html +++ b/FusionIIIT/templates/phcModule/doctors.html @@ -57,7 +57,7 @@ Doctor - {% for d in doct %} + {% for d in doctors %} {{count.doctor_count}} {{d}} {% endfor %} @@ -88,7 +88,7 @@ {% comment %}the add doctor tab starts here {% endcomment %}
-

+

{% csrf_token %}
@@ -124,10 +124,14 @@ var new_doctor = document.getElementById('new_doctor').value; var specialization = document.getElementById('specialization').value; var phone = document.getElementById('phone').value; - if ( new_medicine==""||phone==""||specialization=="") { + if (new_medicine=="" || phone=="" || specialization=="") { $('#doc_add').html('Enter valid details'); return false; } + if(phone.toString().length != 10){ + $('#doc_add').html('Enter valid phone number'); + return false; + } $.ajax({ type:'post', @@ -140,7 +144,7 @@ add_doctor:$('#add_doctor').val() }, success: function(data){ - alert("added doctor"); + alert("Added Doctor!"); {% comment %} $('#phc_docs').find('tbody'); $('#phc_docs tbody').append("" + data.doctor + "" + data.specialization + "" + data.phone + ""); diff --git a/FusionIIIT/templates/phcModule/history.html b/FusionIIIT/templates/phcModule/history.html index 1231b6a54..3fd66b9ac 100755 --- a/FusionIIIT/templates/phcModule/history.html +++ b/FusionIIIT/templates/phcModule/history.html @@ -340,27 +340,27 @@

+ + Date + + Doctor - Description - - - - Date + Description - - - - {% for appointment in appointments %} + + {{appointment.date}} + + {{appointment.doctor_id}} @@ -368,16 +368,9 @@

{{appointment.description}} - - - {{appointment.date}} - - - - {% endfor %} @@ -387,7 +380,7 @@

+
- - - - - - - - + + + + + + + {% for complaint in complaints %} - + + @@ -450,11 +445,6 @@

{{complaint.feedback}} {% endif %} - -

- {% endfor %} diff --git a/FusionIIIT/templates/phcModule/manage_stock.html b/FusionIIIT/templates/phcModule/manage_stock.html index 5d9bfbe22..f85db5d4e 100644 --- a/FusionIIIT/templates/phcModule/manage_stock.html +++ b/FusionIIIT/templates/phcModule/manage_stock.html @@ -19,7 +19,7 @@ View Stock - Required Medicine + Threshold/Required @@ -435,41 +435,83 @@ {% comment %}the threshold stock tab starts here {% endcomment %}
-
- - - +
+ + + + {% endfor %} + +
- Feedback - - Response - - Date -
+ Date + + Feedback + + Response +
+ {{complaint.date}} + {{complaint.complaint}} - {{complaint.date}} -
+ {{stock.quantity}} + + {{stock.threshold}} +
+

Required Stock

+
+ + + +
@@ -507,8 +549,7 @@ {% endif %} {% endfor %} -
-
+
{% comment %}the view inventory tab ends here {% endcomment %} diff --git a/FusionIIIT/templates/phcModule/phc_compounder.html b/FusionIIIT/templates/phcModule/phc_compounder.html index bb0bc3751..2954e8b59 100644 --- a/FusionIIIT/templates/phcModule/phc_compounder.html +++ b/FusionIIIT/templates/phcModule/phc_compounder.html @@ -43,7 +43,7 @@ - Prescribe + Prescribe/Hospital diff --git a/FusionIIIT/templates/phcModule/schedule.html b/FusionIIIT/templates/phcModule/schedule.html index 35197ea1f..404604081 100644 --- a/FusionIIIT/templates/phcModule/schedule.html +++ b/FusionIIIT/templates/phcModule/schedule.html @@ -1,25 +1,25 @@ {% load static %} {% block schedule %} - {% comment %}the main tab starts here {% endcomment %} - - - {% comment %}the doctor appointment tab starts here {% endcomment %} -
-
- - - - - -
- -
-
-
- - - - - {% for d in doct %} - {{count.doctor_count}} - - {% endfor %} - - - - {% for d in doctors %} - {{count.doctor_count}} - - {% endfor %} - - - {% for p,day in days %} - {{count.empty_fine}} - - - - {% for d in doctors %} - {{count.empty_fine}} - {% for s in schedule %} - {% if s.day == p %} - {% if d.id == s.doctor_id.id %} - - {{count.increment}} - {% else %} - {% endif %} - {% endif %} - {% endfor %} - {% if count.count == 0 %} - - {% endif %} - {% endfor %} - - - {% endfor %} - -
Doctor {{d}}
Specialization{{d.specialization}}
{{day}}{{s.from_time}}--{{s.to_time}}
-
-
-
- {% comment %}the view schedule tab ends here {% endcomment %} - {% comment %}the edit schedule tab starts here {% endcomment %} -
-
- {% csrf_token %} -

-

-
- - -
-
- - - -
-
-
- -
- -
-
-
- - - -
- -
- - -
-
- - - -
-

- - -
- -
- -
-
- - - - - - -
+ }); + + + + +
+ +
+
+
+ + + + + {% for d in doctors %} + {{count.doctor_count}} + + {% endfor %} + + + + {% for d in doctors %} + {{count.doctor_count}} + + {% endfor %} + + + {% for p,day in days %} + {{count.empty_fine}} + + + + {% for d in doctors %} + {{count.empty_fine}} + {% for s in schedule %} + {% if s.day == p %} + {% if d.id == s.doctor_id.id %} + + {{count.increment}} + {% else %} + {% endif %} + {% endif %} + {% endfor %} + {% if count.count == 0 %} + + {% endif %} + {% endfor %} + + + {% endfor %} + +
Doctor {{d}}
Specialization{{d.specialization}}
{{day}}{{s.from_time}}--{{s.to_time}}
+
+
+{% comment %}the view schedule tab ends here {% endcomment %} +{% comment %}the edit schedule tab starts here {% endcomment %} +
+
+
{% csrf_token %} +
+

+
+
+ + +
+
+ + + +
+
+
+ +
+
+
+
+ + + +
+ +
+ + +
+
+ + + +
+

+ +
+ +
- {% comment %}the ambulance appointment tab ends here {% endcomment %} -{% endblock %} +
+
+
+ + + + + +
+
+ + +{% comment %}the ambulance appointment tab ends here {% endcomment %} +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/phcModule/schedule_student.html b/FusionIIIT/templates/phcModule/schedule_student.html index 305352fe4..f3e88fdc3 100644 --- a/FusionIIIT/templates/phcModule/schedule_student.html +++ b/FusionIIIT/templates/phcModule/schedule_student.html @@ -55,7 +55,7 @@ Doctor - {% for d in doct %} + {% for d in doctors %} {{count.doctor_count}} {{d}} {% endfor %} @@ -101,7 +101,7 @@ Doctor - {% for d in doct %} + {% for d in doctors %} {{count.doctor_count}} {{d}} {% endfor %} @@ -112,7 +112,7 @@ {{count.doctor_count}} {{d.specialization}} {% endfor %} - + {% for p,day in days %} {{count.empty_fine}} diff --git a/FusionIIIT/templates/placementModule/placementstatistics.html b/FusionIIIT/templates/placementModule/placementstatistics.html index fa57d7f9a..6bcd73ed6 100644 --- a/FusionIIIT/templates/placementModule/placementstatistics.html +++ b/FusionIIIT/templates/placementModule/placementstatistics.html @@ -66,10 +66,6 @@ {% endif %} - {% endif %} {% endfor %} @@ -91,23 +87,8 @@ Placement Schedule - {% endif %} - - @@ -120,20 +101,9 @@ - - {% if current2 %} - - + {% if current2 %} - - Add Placement Record @@ -149,9 +119,6 @@ {% comment %}The Tab-Menu ends here!{% endcomment %}
- {% comment %} - The left-rail segment ends here! - {% endcomment %} {% comment %} The central-rail segment starts here!{% endcomment %} @@ -202,7 +169,7 @@
{{ form3.stuname.errors }}
@@ -220,7 +187,7 @@
-
+
@@ -246,10 +213,11 @@ {% comment %}Form Tag ends here!{% endcomment %} {% if placementrecord == 1 %} -
+ {% elif placementrecord %} -
-
+ + {% if pagination_placement %} @@ -289,8 +257,9 @@
{% endif %} + -
+

@@ -351,44 +320,30 @@

-
-
+ +
+
{% if placement_search_record != " " %}

- - - - - - - - - + + + + + + {% for rec in placement_search_record %} - - - - - - - - - + + + {% endfor %}
id TypePlacement TypeNameCTCYearTest ScoreTest Type
Roll No.Company NameCTC
{{ rec.id }}{{ rec.placement_type }}{{ rec.name }}{{ rec.ctc }}{{ rec.year }}{{ rec.test_score }}{{ rec.test_type }} -
- {% csrf_token %} - -
-
{{ rec.unique_id }}{{ rec.name }}{{ rec.ctc }}
{% else %} +

No Data Found.

{% if current2 %}
Add Student Record @@ -407,26 +362,25 @@

No Data Found.

- {% comment %}The add a new skill Accordian starts here!{% endcomment %}
- Search a Student! + Search a Student
{{ form3.non_field_errors }}
{% csrf_token %}
-
- {{ form3.stuname.errors }} - - -
- {{ form3.stuname }} -
+
+ {{ form3.stuname.errors }} + + +
+ {{ form3.stuname }} +
@@ -436,18 +390,10 @@

No Data Found.

-
-
- {{ form3.ctc.errors }} - - -
- {{ form3.ctc }} -
+ +
@@ -460,11 +406,10 @@

No Data Found.

- {% comment %}The add a new skill Accordian ends here!{% endcomment %} + -
-
+ {% if pagination_pbi %} @@ -504,8 +449,9 @@

No Data Found.

{% endif %} + -
+

{% if pbirecord == 1 %} @@ -577,29 +523,15 @@

{% if pbi_search_record != " " %} - - + + - - - {% for rec in pbi_search_record %} - - - - - - - + + + {% endfor %} @@ -667,14 +599,13 @@

No Data Found.

- {% comment %}The add a new skill Accordian ends here!{% endcomment %} -
-
+ + - + {% if pagination_higher %}
@@ -713,8 +644,9 @@

No Data Found.

{% endif %} + -
+

{% if higherrecord == 1 %} @@ -786,34 +718,18 @@

{% if higher_search_record != " " %}

Placement TypeNameRoll No.Company Name CTCYearTest ScoreTest Type
{{ rec.placement_type }}{{ rec.name }}{{ rec.ctc }}{{ rec.year }}{{ rec.test_score }}{{ rec.test_type }} -
- {% csrf_token %} - -
-
{{ rec.unique_id }}{{ rec.name }}{{ rec.ctc }}
- - - - - - - - - {% for rec in higher_search_record %} - - - - - - - - - - - - {% endfor %} + + + + + + {% for rec in higher_search_record %} + + + + + + {% endfor %}
Placement TypeNameCTCYearTest ScoreTest Type
{{ rec.placement_type }}{{ rec.name }}{{ rec.ctc }}{{ rec.year }}{{ rec.test_score }}{{ rec.test_type }} -
- {% csrf_token %} - -
-
Roll No.NameYear
{{ rec.unique_id }}{{ rec.name }}{{ rec.year }}
{% else %}

No Data Found.

@@ -847,72 +763,72 @@

No Data Found.

{% for year in years %} - {% if forloop.first %} -
+ {% if forloop.first %} +
{% else %} -
+
{% endif %} - - - - - - - - - - - - - - {% for record in records %} +
CSEECEMETotalPackage
+ + + + + + + + + + + + + {% for record in records %} {% if record.year == year.year %} - {% if record.placement_type != "HIGHER STUDIES" %} - - - - - - - - - {% endif %} - {% endif %} + {% if record.placement_type != "HIGHER STUDIES" %} + + + + + + + + + {% endif %} + {% endif %} {% endfor %} - - + + - + - + - + - + - - + + - + -
CSEECEMETotalPackage
{{ record.name }} - {{ record.name__count }} - - {{ record.year__count }} - - {{ record.placement_type__count }} - {{ record.ctc__count }}{{ record.ctc }}
{{ record.name }} + {{ record.name__count }} + + {{ record.year__count }} + + {{ record.placement_type__count }} + {{ record.ctc__count }}{{ record.ctc }}
Total Offers
Total Offers - {{ year.year__count.1 }} - + {{ year.year__count.1 }} + - {{ year.year__count.2 }} - + {{ year.year__count.2 }} + - {{ year.year__count.3 }} - + {{ year.year__count.3 }} + - {{ year.year__count.0 }} - + {{ year.year__count.0 }} + + -
+
@@ -922,7 +838,6 @@

No Data Found.

- {% comment %} The central-rail segment ends here!{% endcomment %}
diff --git a/FusionIIIT/templates/placementModule/studentrecords.html b/FusionIIIT/templates/placementModule/studentrecords.html index ff849b0d4..caf7569b5 100644 --- a/FusionIIIT/templates/placementModule/studentrecords.html +++ b/FusionIIIT/templates/placementModule/studentrecords.html @@ -169,7 +169,7 @@ Send Invitation - + Invitation Status
@@ -558,7 +558,7 @@
-
+ -
+ -
+ -
+ -
+ +
+ +
-
- -

- - - - - -
@@ -233,27 +206,7 @@
-
- - - - +

@@ -282,31 +235,6 @@
- - - - - - - - - - - - - - - - - - - - - - - - - {% for t in track %}
@@ -344,6 +272,43 @@
+ -{% endblock %} - - - \ No newline at end of file +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/ps1/draftedIndentDetails.html b/FusionIIIT/templates/ps1/draftedIndentDetails.html new file mode 100644 index 000000000..ef2cfdfe3 --- /dev/null +++ b/FusionIIIT/templates/ps1/draftedIndentDetails.html @@ -0,0 +1,422 @@ +{% extends 'ps1/ps1.html' %} +{% load static %} + +{% block filetracking_tab %} + + + +
+ + + +
+ + {% csrf_token %} + +
+
+
Subject- {{file.subject}}
+
+ + +
+
+

Indent Details

+
{{file.description}}
+
+ +
+
+ +

{{ indent.title }}

+
+
+ +

{{ indent.budgetary_head }}

+
+
+ +
+
+ +
+
+ +

{{ indent.expected_delivery }}

+
+
+ +

{{ indent.sources_of_supply }}

+
+
+
+
+ +
+

Items Details :

+ + + + + + + + + + + + + {% for j in items %} + + + + + + + + + {% endfor %} + + +
Namequantityest. costindent_typeView
{{j.item_name}}{{j.quantity}}{{j.estimated_cost}}{{j.indent_type}}
View
+ + + + + {% for t in track %} +
+
+
+ {{t.current_design}} + + + +
+ Received by: {{t.receiver_id}}-{{t.receive_design}} +
+ +
+
+                                                        {% if t.remarks %}
+                                                            {{t.remarks}}
+                                                        {% else %}
+                                                            No Remarks
+                                                        {% endif %}
+
+                                                     
+
+
+
+
+ {% endfor %} + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+ + +
+ +
+
+
+ + +
+ + +
+
+ + +
+ +
+
+ + + + + + + + + + + +{% endblock %} diff --git a/FusionIIIT/templates/ps1/drafts1.html b/FusionIIIT/templates/ps1/drafts1.html new file mode 100644 index 000000000..8833448a3 --- /dev/null +++ b/FusionIIIT/templates/ps1/drafts1.html @@ -0,0 +1,26 @@ +{% extends 'ps1/ps1.html' %} +{% load static %} + +{% block filetracking_tab %} + + +
+
+ {% endfor %} + + + +
+ +{% endblock %} diff --git a/FusionIIIT/templates/ps1/draftview1.html b/FusionIIIT/templates/ps1/draftview1.html new file mode 100644 index 000000000..c6053a8c7 --- /dev/null +++ b/FusionIIIT/templates/ps1/draftview1.html @@ -0,0 +1,51 @@ +{% extends 'ps1/ps1.html' %} +{% load static %} + +{% block filetracking_tab %} + + +
+ + + + + + + + + + + + + + {% for j in draft %} + {% ifequal designations j.designation|stringformat:'s' %} + + + + + + + + + + {% endifequal %} + {% endfor %} + + +
Created ByFile IDSubjectDateView IndentDelete Indent
{{j.uploader.user}} - {{j.designation}}{{request.user.extrainfo.department.name}}-{{j.upload_date.year}}-{{j.upload_date.month}}-#{{j.id}}{{j.subject}}{{j.upload_date}}
+ +
+ +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/ps1/forwardindent.html b/FusionIIIT/templates/ps1/forwardindent.html index 16b1378fc..e0562d651 100644 --- a/FusionIIIT/templates/ps1/forwardindent.html +++ b/FusionIIIT/templates/ps1/forwardindent.html @@ -170,69 +170,42 @@

- -
- - - -
-
+
-
@@ -243,25 +216,7 @@
-
- - +
@@ -292,31 +247,6 @@
- - - - - - - - - - - - - - - - - - - - - - - - - {% for t in track %}
@@ -353,7 +283,43 @@
- + + + + + + + + +{% endblock %} diff --git a/FusionIIIT/templates/ps1/viewMyIndentFile.html b/FusionIIIT/templates/ps1/viewMyIndentFile.html new file mode 100644 index 000000000..7cb27cf8b --- /dev/null +++ b/FusionIIIT/templates/ps1/viewMyIndentFile.html @@ -0,0 +1,346 @@ +{% extends 'ps1/ps1.html' %} +{% load static %} + +{% block filetracking_tab %} + + + +
+ + + +
+ + {% csrf_token %} + +
+
+
Subject- {{file.subject}}
+
+ + +
+
+ +

Status :

+ {% if indent.rejected == True %} + + {% elif indent.procured == True %} + + {% elif indent.approved == False %} + + {% elif indent.approved == True %} + + + {% endif %} +

Indent Details

+
{{file.description}}
+
+ +
+
+ +

{{ indent.title }}

+
+
+ +

{{ indent.budgetary_head }}

+
+
+ +
+
+ +
+
+ +

{{ indent.expected_delivery }}

+
+
+ +

{{ indent.sources_of_supply }}

+
+
+
+
+ +
+

Items Details :

+ + + + + + + + + + + + + {% for j in items %} + + + + + + + + + + + + {% endfor %} + + +
Namequantityest. costindent_typeView
{{j.item_name}}{{j.quantity}}{{j.estimated_cost}}{{j.indent_type}}
View
+ + +
+

Tracking Detais

+ {% for t in track %} +
+
+
+ {{t.current_design}} + + + +
+ Received by: {{t.receiver_id}}-{{t.receive_design}} +
+ +
+
+                                                        {% if t.remarks %}
+                                                            {{t.remarks}}
+                                                        {% else %}
+                                                            No Remarks
+                                                        {% endif %}
+
+                                                     
+
+
+
+
+ {% endfor %} + + +
+ + +
+ +
+
+
+ +
+ +
+ +
+
+ + + + + + + + + + + +{% endblock %} + diff --git a/FusionIIIT/templates/ps2/addstock.html b/FusionIIIT/templates/ps2/addstock.html new file mode 100644 index 000000000..1afb0a96a --- /dev/null +++ b/FusionIIIT/templates/ps2/addstock.html @@ -0,0 +1,190 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Stock Tracking +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +{% comment %}The grid starts here!{% endcomment %} +
+ + {% comment %} The left-margin segment! {% endcomment %} +
+ + {% comment %} The left-rail segment starts here! {% endcomment %} + +
+ {% comment %} The user image card starts here! {% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu starts here!{% endcomment %} + + {% comment %}The Tab-Menu ends here!{% endcomment %} + +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + +
+ + {% comment %}the form section starts here {% endcomment %} +
+
+ +
+ {% csrf_token %} + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ + +
+ +
+ + + {% if global_admin %} +
+ + +
+ {% endif %} + +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + + +
+ +
+ +
+ +
+
+
+
+
+{% endblock %} + +{% block javascript %} + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/ps2/addtransfers.html b/FusionIIIT/templates/ps2/addtransfers.html new file mode 100644 index 000000000..16d6beb9f --- /dev/null +++ b/FusionIIIT/templates/ps2/addtransfers.html @@ -0,0 +1,140 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Stock Tracking +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +{% comment %}The grid starts here!{% endcomment %} +
+ + {% comment %} The left-margin segment! {% endcomment %} +
+ + {% comment %} The left-rail segment starts here! {% endcomment %} + +
+ {% comment %} The user image card starts here! {% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu starts here!{% endcomment %} + + {% comment %}The Tab-Menu ends here!{% endcomment %} + +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + +
+ + {% comment %}the form section starts here {% endcomment %} +
+
+ +
+ {% csrf_token %} + +
+ + +
+ +
+ +
+ + +
+ +
+ +
+ + +
+ +
+ + +
+ + + +
+ +
+ +
+ +
+
+
+
+
+{% endblock %} + +{% block javascript %} + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/ps2/form.html b/FusionIIIT/templates/ps2/form.html new file mode 100644 index 000000000..4222c647a --- /dev/null +++ b/FusionIIIT/templates/ps2/form.html @@ -0,0 +1,140 @@ +{% extends 'globals/base.html' %} +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+
+
+ {% csrf_token %} +
+ Add To Inventory : +
+
+
+ +
+ + + +
+ +
+
+ +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+
+
+ +
+
+
+ +{% endblock %} diff --git a/FusionIIIT/templates/ps2/home.html b/FusionIIIT/templates/ps2/home.html new file mode 100644 index 000000000..ca7261630 --- /dev/null +++ b/FusionIIIT/templates/ps2/home.html @@ -0,0 +1,73 @@ +{% extends 'globals/base.html' %} +{% load static %} + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +
+
+ + + + + + + + + + + {% for i in tab %} + + + + + + + + + {% endfor %} +
S No. Name Quantity Currently in
{{ i.id }} +

+ +
+ {{ i.name }} +
+

+
{{ i.quantity }} {{ i.currentlyin }}
+
+
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/ps2/pdf.html b/FusionIIIT/templates/ps2/pdf.html new file mode 100644 index 000000000..a6e05bf9b --- /dev/null +++ b/FusionIIIT/templates/ps2/pdf.html @@ -0,0 +1,51 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block body %} + +
+ + + + + + + + + + + + + + + + + + + + + + {% for item in stocks %} + + + + + + + + + + + + + + + + {% endfor %} + +
Stock NoName of particularsInventory NoRateAmountSupplier NameBill NoBuy DateIssued DateHead of AssetSectionFloor NumberReceiver Name
{{ item.id }}{{ item.name_of_particulars }}{{ item.inventory_no }}{{ item.rate }}{{ item.amount }}{{ item.supplier_name }}{{ item.bill_no }}{{ item.buy_date }}{{ item.issued_date }}{{ item.head_of_asset }}{{ item.section }}{{ item.floor }}{{ item.receiver_name }}
+
+
+ +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/ps2/ps2.html b/FusionIIIT/templates/ps2/ps2.html new file mode 100644 index 000000000..2514aa840 --- /dev/null +++ b/FusionIIIT/templates/ps2/ps2.html @@ -0,0 +1,134 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Stock Tracking +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +{% comment %}The grid starts here!{% endcomment %} +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %} + The left-rail segment starts here! + {% endcomment %} +
+ + {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu starts here!{% endcomment %} + + {% comment %}The Tab-Menu ends here!{% endcomment %} + +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + +
+ + + {% if user == 'acadadmin' %} +
+
+
+ + + +
+

+ {% endif %} + + + + + + + + + + + + + + + + + + + + {% for item in stocks %} + + + + + + + + + + + + + + + + {% endfor %} + +
Stock NoName of particularsInventory NoRateAmountSupplier NameBill NoBuy DateIssued DateHead of AssetSectionFloor NumberReceiver Name
{{ item.id }}{{ item.name_of_particulars }}{{ item.inventory_no }}{{ item.rate }}{{ item.amount }}{{ item.supplier_name }}{{ item.bill_no }}{{ item.buy_date }}{{ item.issued_date }}{{ item.head_of_asset }}{{ item.section }}{{ item.floor }}{{ item.receiver_name }}
+ +
+
+ + + {% endblock %} +
+ +{% block javascript %} + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/ps2/viewtransfers.html b/FusionIIIT/templates/ps2/viewtransfers.html new file mode 100644 index 000000000..6fa740400 --- /dev/null +++ b/FusionIIIT/templates/ps2/viewtransfers.html @@ -0,0 +1,109 @@ +{% extends 'globals/base.html' %} +{% load static %} + + +{% block title %} +Stock Tracking +{% endblock %} + + +{% block body %} +{% block navBar %} +{% include 'dashboard/navbar.html' %} +{% endblock %} + +{% comment %}The grid starts here!{% endcomment %} +
+ + {% comment %}The left-margin segment!{% endcomment %} +
+ + {% comment %} + The left-rail segment starts here! + {% endcomment %} +
+ + {% comment %}The user image card starts here!{% endcomment %} + {% block usercard %} + {% include 'globals/usercard.html' %} + {% endblock %} + {% comment %}The user image card ends here!{% endcomment %} + +
+ + {% comment %}The Tab-Menu starts here!{% endcomment %} + + {% comment %}The Tab-Menu ends here!{% endcomment %} + +
+ {% comment %} + The left-rail segment ends here! + {% endcomment %} + + + + +
+ +
+ + + + + + + + + + + + + + + {% for item in stocks %} + + + + + + + + + + {% endfor %} + +
Item_id From_department From_location To_department To_location Date Remarks
{{ item.Item_id }}{{ item.From_department }}{{ item.From_location }}{{ item.To_department }}{{ item.To_location }}{{ item.Date }}{{ item.Remarks }}
+
+
+ + {% endblock %} +
+ +{% block javascript %} + + + +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/rs/citation.html b/FusionIIIT/templates/rs/citation.html new file mode 100644 index 000000000..c21a7553c --- /dev/null +++ b/FusionIIIT/templates/rs/citation.html @@ -0,0 +1,19 @@ + + + + + + Citation PDF + + + +

Citation PDF

+ + {% for project in projects %} + +

{{project.pf_no}}, {{project.ptype}}, {{project.pi}}, {{project.co_pi}}, {{project.title}}

+

{{project.funding_agency}}, {{project.status}}


+ {% endfor %} + + + \ No newline at end of file diff --git a/FusionIIIT/templates/rs/menu_card.html b/FusionIIIT/templates/rs/menu_card.html index 9b5ae6631..35afc94af 100644 --- a/FusionIIIT/templates/rs/menu_card.html +++ b/FusionIIIT/templates/rs/menu_card.html @@ -2,5 +2,6 @@ Patents Projects +Show Faculties Data {% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/rs/patent.html b/FusionIIIT/templates/rs/patent.html index 42e824bd2..10e1a5678 100644 --- a/FusionIIIT/templates/rs/patent.html +++ b/FusionIIIT/templates/rs/patent.html @@ -1,82 +1,77 @@ - {% load static %} {% block Issues %} - {% comment %}The tab menu starts here!{% endcomment %} - +{% comment %}The tab menu starts here!{% endcomment %} + + + +
+
+ + {% comment %}Form Tag starts here!{% endcomment %} +
+ {% csrf_token %} + {% comment %}The add a new skill Accordian starts here!{% endcomment %} +
+ +
+ patent form: +
+
+ +
+ + +
+ +
+ + +

-
-
- - {% comment %}Form Tag starts here!{% endcomment %} - - {% csrf_token %} - {% comment %}The add a new skill Accordian starts here!{% endcomment %} -
- -
- patent form: -
-
- -
- - -
- -
- - -

- -
+
- -
- -
- - -
+ +
+
+ +
- - {% comment %}Form Tag ends here!{% endcomment %} +
+ + {% comment %}Form Tag ends here!{% endcomment %} -
-
+
+
+
-
-
-
- Status of Patent -
+
+
+
+ Status of Patent +
-
-
- - - - +
+
+ +
+ + @@ -90,36 +85,36 @@ - + - - - - - {% comment %} {% endcomment %} - - {% for patent in patents %} - - - + + - - - {% endfor %} - - -
Patend ID Status
- {{patent.application_id}} - + + + + + {% comment %} {% endcomment %} + + {% for patent in patents %} +
+ {{patent.application_id}} + {{patent.ipd_form}} - - {{patent.project_details}} - - {{patent.status}} -
-
+ + + {{patent.project_details}} + + + {{patent.status}} + + {% endfor %} + + +
+
{% endblock %} @@ -127,6 +122,4 @@ {% block javascript %} -{% endblock javascript %} - - +{% endblock javascript %} \ No newline at end of file diff --git a/FusionIIIT/templates/rs/research.html b/FusionIIIT/templates/rs/research.html index a5ca65540..8baa612d3 100644 --- a/FusionIIIT/templates/rs/research.html +++ b/FusionIIIT/templates/rs/research.html @@ -89,6 +89,11 @@ {% include 'rs/projects.html' %} {% endblock %}
+
+ {% block show_projects %} + {% include 'rs/show_projects.html' %} + {% endblock %} +
{% comment %}
diff --git a/FusionIIIT/templates/rs/show_projects.html b/FusionIIIT/templates/rs/show_projects.html new file mode 100644 index 000000000..dd2c6a45b --- /dev/null +++ b/FusionIIIT/templates/rs/show_projects.html @@ -0,0 +1,101 @@ +{% load static %} + +{% block projects %} +{% comment %}The tab menu starts here!{% endcomment %} + + + +{% comment %}The Research Project segment starts here!{% endcomment %} +
+ {% if request.user == user %}

Add a Research Project

+
+ {% csrf_token %} +
+
+
+
+ + +
+ +
+ + +
+
+
+ + + +
+
+ {% endif %} +
+{% comment %}The Research project segment ends here!{% endcomment %} + + + {% comment %}The Consultancy Project segment starts here!{% endcomment %} +
+ {% if request.user == user %}

Add a Consultancy Project

+
+ {% csrf_token %} +
+
+
+
+ + +
+ +
+ + +
+
+
+ +
+ +
+
+ +
+ +
+
+
+
+ + +
+
+
+
+ +
+ + + + +
+ {% endif %} +
+{% comment %}The Consultancy Project ends here!{% endcomment %} + + +{% comment %}The Technology segment ends here!{% endcomment %} +{% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/scholarshipsModule/applyNew.html b/FusionIIIT/templates/scholarshipsModule/applyNew.html index 652e3bb6f..a09598e1f 100755 --- a/FusionIIIT/templates/scholarshipsModule/applyNew.html +++ b/FusionIIIT/templates/scholarshipsModule/applyNew.html @@ -2,1003 +2,178 @@ {% block awards %} {% comment %}The tab menu starts here!{% endcomment %} -