diff --git a/FusionIIIT/applications/complaint_system/urls.py b/FusionIIIT/applications/complaint_system/urls.py index 7e96bf066..2bd0c87e0 100644 --- a/FusionIIIT/applications/complaint_system/urls.py +++ b/FusionIIIT/applications/complaint_system/urls.py @@ -19,7 +19,7 @@ url(r'^caretaker/$', views.caretaker, name='caretaker'), url(r'^caretaker/feedback/(?P[0-9]+)/$', views.feedback_care), url(r'^caretaker/pending/(?P[0-9]+)/$', views.resolvepending), - url(r'^caretaker/detail/(?P[0-9]+)/$', views.detail), + url(r'^caretaker/detail2/(?P[0-9]+)/$', views.detail), url(r'^caretaker/search_complaint$', views.search_complaint), url(r'^caretaker/(?P[0-9]+)/feedback/$', views.submitfeedbackcaretaker), @@ -29,8 +29,8 @@ 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/caretaker_id_know_more/(?P[0-9]+)/complaint_reassign_super/(?P[0-9]+)/$', views.complaint_reassign_super, name = 'complaint_reassign_super'), + url(r'^supervisor/detail/(?P[0-9]+)/$', views.detail3, name = 'detail3'), url(r'^supervisor/pending/(?P[0-9]+)/$', views.resolvependingsuper), url(r'^supervisor/(?P[0-9]+)/$', views.submitfeedbacksuper), diff --git a/FusionIIIT/applications/complaint_system/views.py b/FusionIIIT/applications/complaint_system/views.py index 1410ea846..e0a4bbb0f 100644 --- a/FusionIIIT/applications/complaint_system/views.py +++ b/FusionIIIT/applications/complaint_system/views.py @@ -19,73 +19,73 @@ #function for reassign to another worker -@login_required -def complaint_reassign(request,wid,iid): - current_user = get_object_or_404(User, username=request.user.username) - y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() - if request.method == 'POST': - type = request.POST.get('submit', '') - a = get_object_or_404(User, username=request.user.username) - y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() - comp_id = y.id - if type == 'assign': - - complaint_finish = request.POST.get('complaint_finish', '') - worker_id = request.POST.get('assign_worker', '') - 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/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) +# @login_required +# def complaint_reassign(request,wid,iid): + # current_user = get_object_or_404(User, username=request.user.username) + # y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() + # if request.method == 'POST': + # type = request.POST.get('submit', '') + # a = get_object_or_404(User, username=request.user.username) + # y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() + # comp_id = y.id + # if type == 'assign': + + # complaint_finish = request.POST.get('complaint_finish', '') + # worker_id = request.POST.get('assign_worker', '') + # 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/secincharge/worker_id_know_more/'+wid; + # complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__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) - else: - y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) - 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__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() - total_secincharges_in_area = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(work_type=b) - worker = [] - workertemp = [] - flag = '' - temp = detail.location - try: + # else: + # y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) + # 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').filter(id=iid).first() + # total_secincharge = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').all() + # total_secincharges_in_area = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').filter(work_type=b) + # worker = [] + # workertemp = [] + # flag = '' + # temp = detail.location + # try: - 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('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 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('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) - except SectionIncharge.DoesNotExist: - flag = 'no_worker' + # 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_secincharge': total_secincharge,'a':a, 'wid':wid, 'total_secincharges_in_area':total_secincharges_in_area}) + # except StudentComplain.DoesNotExist: + # return HttpResponse("

Not a valid complaint

") + # return render(request, "complaintModule/reassignworker.html", + # {'detail': detail, 'worker': worker, 'flag': + # flag, 'total_secincharge': total_secincharge,'a':a, 'wid':wid, 'total_secincharges_in_area':total_secincharges_in_area}) -@login_required -def complaint_reassign_super(request,caretaker_id,iid): - current_user = get_object_or_404(User, username=request.user.username) - y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() - sup = Supervisor.objects.select_related('sup_id','sup_id__user','sup_id__department').get(sup_id = y) - this_area = sup.area - if request.method == 'POST': - a = get_object_or_404(User, username=request.user.username) - y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() - comp_id = y.id +# @login_required +# def complaint_reassign_super(request,caretaker_id,iid): + # current_user = get_object_or_404(User, username=request.user.username) + # y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() + # sup = Supervisor.objects.select_related('sup_id','sup_id__user','sup_id__department').get(sup_id = y) + # this_area = sup.area + # if request.method == 'POST': + # a = get_object_or_404(User, username=request.user.username) + # y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() + # comp_id = y.id #for SectionIncharge @@ -110,38 +110,28 @@ def assign_worker(request, comp_id1): a = get_object_or_404(User, username=request.user.username) y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() comp_id = y.id - assign_caretaker = request.POST.get('assign_caretaker', '') - c1 = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=comp_id) - # c2=Supervisor.objects.all().filter(area=c1.area) - # y1 = ExtraInfo.objects.all().select_related('user','department').filter(id=c2[0].sup_id.id).first() + + complaint_details = StudentComplain.objects.all().filter(id=comp_id1) - # update(complaint_details[0].status=1) - print(complaint_details) + + complaint_type=complaint_details[0].complaint_type - print(complaint_type) + supervisor=Supervisor.objects.all().filter(type=complaint_type) if not supervisor.exists(): return HttpResponse("

Supervisor does not exist of this complaint type

") - print("----------") - print(supervisor[0]) - print("----------") + supervisor_details=ExtraInfo.objects.all().filter(id=supervisor[0].sup_id.id) - print(supervisor_details[0].user_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').filter(id=comp_id1).\ update(status=1) - # supervisor_id=ExtraInfo.objects.all().filter(id=supervisor) - # student=0 - # message = "Your Complaint has been redirected to supervisor" - # complaint_system_notif(request.user, complainer_details.complainer.user ,'comp_redirect_alert',complainer_details.id,student,message) + sup = HoldsDesignation.objects.select_related('user','working','designation').filter(user = supervisor_details[0].user_id) - print(sup[0].designation) - # print(sup.designation) + + files=File.objects.all().filter(src_object_id=comp_id1) - # print("----------") - # print(files.first().id) - # user_details=User.objects.get(id=y.user_id) - # des=HoldsDesignation.objects.filter(user=user_details).all() + supervisor_username=User.objects.all().filter(id=supervisor_details[0].user_id) file=forward_file(file_id= files.first().id, receiver=supervisor_username[0].username, @@ -155,37 +145,36 @@ def assign_worker(request, comp_id1): return HttpResponseRedirect('/complaint/caretaker/') else: y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id) - a = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) - b = a.work_type + # a = SectionIncharge.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y) + 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 = Supervisor.objects.select_related('sup_id') + detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__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 = Supervisor.objects.select_related('sup_id') # supervisors_in_area= HoldsDesignation.objects.select_related('user','working','designation').get(total_caretakers_in_area = dsgn) - workertemp = [] - worker = [] - flag = '' - temp = detail.location - try: - 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('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) + # workertemp = [] + # worker = [] + # flag = '' + # temp = detail.location + # try: + # 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('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) - except SectionIncharge.DoesNotExist: - flag = 'no_worker' + # 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_secincharge': total_secincharge,'a':a, 'total_secincharges_in_area':total_secincharges_in_area}) - + {'detail': detail}) + #for SectionIncharge @login_required @@ -194,7 +183,7 @@ def discharge_worker(request,wid,cid): y = ExtraInfo.objects.all().select_related('user','department').filter(user=current_user).first() 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= StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=cid); com_in_concern.worker_id=None; com_in_concern.status=0; StudentComplain.objects.select_for_update().filter(id=cid).\ @@ -242,8 +231,8 @@ def worker_id_know_more(request, work_id): function to know pending complaints assigned to the 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); + num = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(worker_id=this_worker).count(); + complaints_list = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(worker_id=this_worker); complaints_list_onhold = [] for i in complaints_list: if i.status == 1: @@ -358,20 +347,9 @@ def user(request): complaint_finish = datetime.now() + timedelta(days=4) elif comp_type == 'other': complaint_finish = datetime.now() + timedelta(days=3) - # y = ExtraInfo.objects.all().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() + user_details=User.objects.get(id=y.user_id) obj1, created = StudentComplain.objects.get_or_create(complainer=y, @@ -385,16 +363,8 @@ def user(request): - 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') - 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" @@ -440,7 +410,7 @@ def user(request): 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) + # complaint_system_notif(request.user, secincharge_name.staff_id.user,'lodge_comp_alert',obj1.id,1,message) messages.success(request,message) @@ -451,8 +421,7 @@ 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__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=[] + user_details=User.objects.get(id=y.user_id) @@ -470,13 +439,7 @@ def user(request): print(c1[0].designation) # c2=Designation.objects.filter(i) - j = 1 - for i in historytemp: - history.append(i) - # # if j%2 != 0: - # # history.append(i) - # # j = j+1 - + outbox_files = view_outbox( @@ -499,7 +462,8 @@ def user(request): print(comp[0].src_object_id) complaint=StudentComplain.objects.all().filter(id=comp[0].src_object_id) print(complaint) - comp_list.add(complaint) + if complaint[0].complainer.user.username == user_details.username : + comp_list.add(complaint) # file_history = view_history(file_id=i['id']) # comp=File.objects.filter(uploader=file_history[0]['current_id']) @@ -514,7 +478,7 @@ def user(request): complaint_final_list.append(i[0]) print(complaint_final_list) return render(request, "complaintModule/complaint_user.html", - {'history': complaint_final_list,'notification':notification, 'comp_id': y.id, 'outbox':outbox}) + {'outbox': complaint_final_list,'notification':notification, 'comp_id': y.id, 'history':outbox}) @login_required @@ -687,26 +651,7 @@ def caretaker(request): complaint_finish=complaint_finish, 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') - 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": @@ -769,8 +714,8 @@ def caretaker(request): notification = Notification.objects.filter(recipient=current_user.id) notification = notification.filter(data__exact={'url':'complaint:detail2','module':'Complaint System'}) - return render(request, "complaintModule/complaint_secincharge.html", - {'history': history, 'comp_id': y.id, + return render(request, "complaintModule/complaint_caretaker.html", + { 'comp_id': y.id, 'notification': notification, 'complaint_assign_no': complaint_assign_no}) @@ -781,70 +726,21 @@ def caretaker(request): a = Caretaker.objects.select_related('staff_id','staff_id__user','staff_id__department').get(staff_id=y.id) b = a.area 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') - # 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) - # j = 1 - # for i in total_workertemp: - # total_worker.append(i) - - # complaint_assign_no = [] + + complaint_assign_no = [] user_details=User.objects.get(id=y.user_id) - # if user_details.username=="shyams": - # desgn="hall3caretaker" - # if user_details.username=="hall4caretaker": - # desgn="hall4caretaker" - # a = get_object_or_404(User, username=request.user.username) - # y = ExtraInfo.objects.all().select_related('user','department').filter(user=a).first() - carehistorytemp = 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') - carehistory=[] - j = 1 - for i in carehistorytemp: - carehistory.append(i) - # if j%2 != 0: - # history.append(i) - # j = j+1 - - for i in carehistory: - i.serial_no = j - j = j+1 - # 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.total_complaint = temp - # complaint_assign_no.append(worker) - - 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:detail2','module':'Complaint System'}) user_details=User.objects.get(id=y.user_id) - # print(y.user_type) - # print(user_details.username) - # print(user_details) + des=HoldsDesignation.objects.filter(user=user_details).all() - # print(y.user_id) - # print(user_details) - # print(des[0].designation) - user_object = get_user_object_from_username(y.user.username) - user_des=HoldsDesignation.objects.filter(user=user_details).all() - # print(user_object) - # print(user_des) + print("######") + print(user_details.username) + print(des[0].designation) + print("&&&&&") outbox_files = view_outbox( username=user_details.username, designation=des[0].designation, @@ -860,19 +756,17 @@ def caretaker(request): for i in outbox: file_history = view_history(file_id=i['id']) print(i['id']) + print("********") comp=File.objects.filter(id=i['id']) print(comp[0].src_object_id) + print("------") complaint=StudentComplain.objects.all().filter(id=comp[0].src_object_id) - print(complaint) - comp_list.add(complaint) - # file_history = view_history(file_id=i['id']) + print(complaint[0].complainer.user.username) - # comp=File.objects.filter(uploader=file_history[0]['current_id']) - # for j in comp: - # c=StudentComplain.objects.all().filter(id=j.src_object_id) - # comp_list.add(c) - # # print(c[0]) - + print("......") + if complaint[0].complainer.user.username== user_details.username : + comp_list.add(complaint) + # break complaint_final_list=[] for i in comp_list: @@ -900,20 +794,7 @@ def caretaker(request): complaint=StudentComplain.objects.all().filter(id=comp[0].src_object_id) print(complaint) comp_list_in.add(complaint) - # file_history = view_history(file_id=i['id']) - # print(file_history[0]) - # file_history_list.append(file_history[0]) - # print(file_history[0]['file_id']) - # comp=File.objects.filter(id=file_history[0]['file_id']) - # print(comp[0].src_object_id) - # for j in comp: - # c=StudentComplain.objects.all().filter(id=j.src_object_id) - # comp_list_in.add(c) - # print(c[0]) - - # break - # file_history_list_final=uniqueList(file_history_list) - # print(file_history_list) + complaint_final_list_in=[] for i in comp_list_in: complaint_final_list_in.append(i[0]) @@ -924,8 +805,7 @@ def caretaker(request): { 'history': complaint_final_list_in, 'comp_id': y.id, 'carehistory':complaint_final_list, - 'notification':notification, - 'overduecomplaint': overduecomplaint, + 'notification':notification, 'care_id': a}) @login_required @@ -937,7 +817,7 @@ def remove_worker_from_complaint(request,complaint_id): request - trivial complaint_id - used to get complaint_id registered """ - 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='') + complaint = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(complaint_id=complaint_id).update(worker_id='') return HttpResponseRedirect('/complaint/caretaker/') @@ -959,15 +839,15 @@ 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__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(id=complaint_id).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__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__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(id=complaint_id).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__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__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(id=complaint_id).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=complaint_id).\ update(status=status) return HttpResponseRedirect('/complaint/caretaker/') @@ -1018,7 +898,7 @@ def removew(request, work_id): context - Holds data needed to make necessary changes in the template. """ 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() + temp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(worker_id=worker).count() if temp == 0: worker.delete() return HttpResponseRedirect('/complaint/secincharge/') @@ -1026,6 +906,9 @@ def removew(request, work_id): return HttpResponse('

Worker is assign some complaint

') + + + @login_required def submitfeedback(request, complaint_id): """ @@ -1044,9 +927,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__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(id=complaint_id).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=complaint_id).\ update(feedback=feedback, flag=rating) - 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() + a = StudentComplain.objects.select_related('complainer','complainer__user','complainer__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 @@ -1062,7 +945,7 @@ def submitfeedback(request, complaint_id): return HttpResponseRedirect('/complaint/user/') else: - 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) + a = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=complaint_id) return render(request, "complaintModule/submit_feedback.html", {'a': a}) @@ -1127,23 +1010,121 @@ def supervisor(request): 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__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() + numtemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__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=location).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: - if i.complaint_finish < date.today(): - i.delay = date.today() - i.complaint_finish - overduecomplaint.append(i) + + + 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!="": + # 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, + specific_location=specific_location, + details=details, + status=status, + complaint_finish=complaint_finish, + upload_complaint=comp_file) + + + + 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) + user_details=User.objects.get(id=y.user_id) + # c2=Supervisor.objects.all().filter(area=location) + print(caretaker_name.user.username) + print(user_details.username) + print(caretaker_name.designation) + + # sup = HoldsDesignation.objects.select_related('user','working','designation').get(user = y.id) + # print(sup.designation) + + user_details=User.objects.get(id=y.user_id) + des=HoldsDesignation.objects.filter(user=user_details).all() + + + file_id = create_file(uploader=user_details.username, + uploader_designation=des[0].designation, + receiver=caretaker_name.user.username, + receiver_designation=str(caretaker_name.designation), + src_module="complaint", + src_object_id= str(obj1.id), + file_extra_JSON= {}, + attached_file = None) + + + # This is to allow the student + student = 1 + 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', '/') + + messages.success(request,message) + # return HttpResponseRedirect('/complaint/user') comp_type = request.POST.get('complaint_type', '') location = request.POST.get('Location', '') @@ -1273,61 +1254,20 @@ def supervisor(request): # return HttpResponseRedirect('/complaint/user') return render(request, "complaintModule/supervisor1.html", - {'all_caretaker': all_caretaker, 'all_complaint': all_complaint, - 'overduecomplaint': overduecomplaint, 'area': area,'num':num}) + {'all_caretaker': all_caretaker, 'all_complaint': all_complaint}) else: - # y = ExtraInfo.objects.all().select_related('user','department').get(id=y.id).fi - # try: - # a = get_object_or_404(Supervisor, sup_id=y) - # except : - # return HttpResponseRedirect('/') - - #print(a) - # if(len(a)==0) : - # return render('../dashboard/') - 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') - history=[] - 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 - 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').order_by('-id') area = all_caretaker[0].area - # desgn=HoldsDesignation.objects.select_related('user','working','designation').get(user = y.id) - # desgn="hall3supervisor" + 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() num = int(numtemp/2+0.5) all_complaint = [] user_details=User.objects.get(id=y.user_id) - 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').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: - if i.complaint_finish < date.today(): - i.delay = date.today() - i.complaint_finish - overduecomplaint.append(i) + - # print(y.user_id) - # print(des[0].designation) - # u=ExtraInfo.objects.filter(user=y.user_id).all() - # print(u) - # des=HoldsDesignation.objects.filter(user=u[0].id).all() - # print(des[0].designation.name) + current_user = get_object_or_404(User, username=request.user.username) @@ -1405,15 +1345,14 @@ def supervisor(request): print(complaint_final_list_in) return render(request, "complaintModule/supervisor1.html", - {'history':complaint_final_list_in,'all_caretaker': all_caretaker, 'all_complaint': all_complaint,'outbox':complaint_final_list, - 'overduecomplaint': overduecomplaint, 'area': area, 'num' : num}) + {'history':complaint_final_list_in,'all_caretaker': all_caretaker, 'all_complaint': all_complaint,'outbox':complaint_final_list}) @login_required 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__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) + list_pending_complaintstemp = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(location = this_caretaker_area).filter(status = 0) j = 1 for i in list_pending_complaintstemp: list_pending_complaints.append(i) @@ -1430,7 +1369,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__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=cid) + thiscomplaint = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=cid) if request.method == 'POST': newstatus = request.POST.get('yesorno','') comment = request.POST.get('comment') @@ -1439,11 +1378,11 @@ def resolvepending(request, cid): intstatus = 2 else: intstatus = 3 - 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).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=cid).\ update(status=intstatus) - 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).\ + StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(id=cid).\ update(comment=comment) - 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) + complainer_details = StudentComplain.objects.select_related('complainer','complainer__user','complainer__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) @@ -1490,7 +1429,7 @@ def resolvependingsuper(request, cid): def resolvependingsuper(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').get(id=cid) if request.method == 'POST': newstatus = request.POST.get('yesorno','') comment = request.POST.get('comment') @@ -1499,11 +1438,11 @@ def resolvependingsuper(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').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').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').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) @@ -1534,10 +1473,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__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=feedcomp_id) + detail3 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__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__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(complainer=y).first() + temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__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() @@ -1546,10 +1485,10 @@ 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__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=feedcomp_id) + detail2 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__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__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(complainer=y).first() + temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(complainer=y).first() comp_id=temp.id return render(request, "complaintModule/feedback_care.html", {"detail2": detail2,"comp_id":comp_id}) @@ -1560,7 +1499,7 @@ 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__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=detailcomp_id1) + detail = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=detailcomp_id1) if(detail.worker_id is None): worker_name = None worker_id = detail.worker_id @@ -1573,7 +1512,7 @@ def detail(request, detailcomp_id1): num=0 if detail.upload_complaint != "": num = 1 - 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() + temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__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}) @@ -1582,7 +1521,7 @@ def detail(request, detailcomp_id1): #for SectionIncharge @login_required def detail2(request, 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) + detail2 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').get(id=detailcomp_id1) if(detail2.worker_id is None): worker_name = None worker_id = detail2.worker_id @@ -1596,20 +1535,20 @@ 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__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(complainer=y).first() + temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__department').filter(complainer=y).first() comp_id=temp.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__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').get(id=detailcomp_id1) + detail3 = StudentComplain.objects.select_related('complainer','complainer__user','complainer__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__secincharge_id__staff_id','worker_id__secincharge_id__staff_id__user','worker_id__secincharge_id__staff_id__department').filter(complainer=y).first() + temp=StudentComplain.objects.select_related('complainer','complainer__user','complainer__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() @@ -1821,9 +1760,9 @@ def submitfeedbacksuper(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').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').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 @@ -1840,7 +1779,7 @@ def submitfeedbacksuper(request, complaint_id): 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').get(id=complaint_id) return render(request, "complaintModule/submit_feedback.html", {'a': a}) @@ -2046,9 +1985,9 @@ def submitfeedbackcaretaker(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').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').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 @@ -2065,5 +2004,5 @@ def submitfeedbackcaretaker(request, complaint_id): 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').get(id=complaint_id) return render(request, "complaintModule/submit_feedback.html", {'a': a}) \ No newline at end of file diff --git a/FusionIIIT/templates/complaintModule/assignworker.html b/FusionIIIT/templates/complaintModule/assignworker.html index 455815d9f..47eb65201 100644 --- a/FusionIIIT/templates/complaintModule/assignworker.html +++ b/FusionIIIT/templates/complaintModule/assignworker.html @@ -60,104 +60,7 @@ - +
@@ -196,38 +99,27 @@

If you want to redirect this complaint ,
- {% if detail.status != 0 %} + - - - + {% else %} --> + - {% if total_caretakers_in_area %} - - {% endif %} - {% endif %} + + + +

diff --git a/FusionIIIT/templates/complaintModule/carefeedback.html b/FusionIIIT/templates/complaintModule/carefeedback.html index 10b02b975..2168a65f2 100644 --- a/FusionIIIT/templates/complaintModule/carefeedback.html +++ b/FusionIIIT/templates/complaintModule/carefeedback.html @@ -80,7 +80,7 @@ - + @@ -127,7 +127,7 @@ {% endblock %} \ No newline at end of file diff --git a/FusionIIIT/templates/complaintModule/complaint_caretaker.html b/FusionIIIT/templates/complaintModule/complaint_caretaker.html index 9c3fba87b..4db5b1127 100644 --- a/FusionIIIT/templates/complaintModule/complaint_caretaker.html +++ b/FusionIIIT/templates/complaintModule/complaint_caretaker.html @@ -122,7 +122,7 @@ {% comment %}The ... end here!{% endcomment %} {% comment %}The ... starts here!{% endcomment %} -
+
{% block complainthistory %} {% include 'complaintModule/complainthistory_care_final.html' %} {% endblock %} diff --git a/FusionIIIT/templates/complaintModule/complainthistory_care_final.html b/FusionIIIT/templates/complaintModule/complainthistory_care_final.html index 0228465a2..32f4cd5a9 100644 --- a/FusionIIIT/templates/complaintModule/complainthistory_care_final.html +++ b/FusionIIIT/templates/complaintModule/complainthistory_care_final.html @@ -323,13 +323,13 @@

{% endblock%} \ No newline at end of file diff --git a/FusionIIIT/templates/complaintModule/complainthistory_user_final.html b/FusionIIIT/templates/complaintModule/complainthistory_user_final.html index 7de22f17a..e54c02f43 100644 --- a/FusionIIIT/templates/complaintModule/complainthistory_user_final.html +++ b/FusionIIIT/templates/complaintModule/complainthistory_user_final.html @@ -72,7 +72,7 @@ - {% for a in history %} + {% for a in outbox %} {% if a.status == 0 %} @@ -196,7 +196,7 @@

- {% for a in history %} + {% for a in outbox %} {% if a.status == 2 %} @@ -310,7 +310,7 @@

- {% for a in history %} + {% for a in outbox %} {% if a.status == 3 %} @@ -360,13 +360,13 @@

{% endblock%} \ No newline at end of file diff --git a/FusionIIIT/templates/complaintModule/feedback.html b/FusionIIIT/templates/complaintModule/feedback.html index 11933c4f4..98e586258 100644 --- a/FusionIIIT/templates/complaintModule/feedback.html +++ b/FusionIIIT/templates/complaintModule/feedback.html @@ -59,7 +59,7 @@ - {% for a in history %} + {% for a in outbox %} {% if a.status == 2 %} diff --git a/FusionIIIT/templates/dashboard/modules.html b/FusionIIIT/templates/dashboard/modules.html index 80b7c3121..ddb516907 100755 --- a/FusionIIIT/templates/dashboard/modules.html +++ b/FusionIIIT/templates/dashboard/modules.html @@ -133,8 +133,7 @@ {% comment %}A single modules row starts here!{% endcomment %} - {% if request.user.extrainfo.user_type == "student" or request.user.extrainfo.user_type == "staff" or request.user.extrainfo.user_type == "faculty" or "spacsconvenor" == global_var or "spacsassistant" == global_var or "hall1caretaker" == global_var or "hall4caretaker" == global_var or "shyams" == global_var or "ccsupervisor" == global_var%} - - -