Ejemplo n.º 1
0
def schedule_interview(request):
    if request.method=="POST":
        candidate=User.objects.get(id=(int(request.POST["candidate"])))
        candidate_profile=Profile.objects.get(user_id=candidate.id)
        application=Applicant.objects.get(applicant_id=candidate.id,job_id=int(request.POST["job"]))

        data=requests.post("https://api.zoom.us/v2/users/me/meetings",headers={
            'content-type':"application/json",
            "authorization":f"Bearer {request.session['zoom_access_token']}",
            
        }, data=json.dumps({
            "topic":f"Interview with {candidate_profile.name}",
            "type":2,
            "start_time":request.POST["time"],
        }))
        print(data.json()["join_url"],data.json()["start_url"])
        Messages(sender_id=request.user.id,reciever_id=candidate.id,application_id=application.id,message=f"You have been invited for an interview . Join this meeting <a href='{data.json()['join_url']}'>Enter Meeting </a> at {data.json()['start_time']} UTC").save()
        Messages(sender_id=request.user.id,reciever_id=candidate.id,application_id=application.id,message=f"To start the meeting click on link . Join this meeting <a href='{data.json()['start_url']}'>Enter Meeting </a> ",public=False).save()

        return HttpResponseRedirect(f"/employer/chat/{application.id}")

    else:
        profile=Profile.objects.get(user_id=request.user.id)
        jobs=Jobs.objects.filter(profile=profile.id)
        return render(request,"employer/interview.html",{
            "jobs":jobs,
        })
Ejemplo n.º 2
0
def mess_leave_reject(request, pk):
    if(check_isMessAdmin(request)):
        rt = MessLeave.objects.filter(pk = pk)
        temp = rt[0]
        temp.isDeleted = True
        temp.save()
        yt = Messages(message = ("Your mess leave request made on Date " + str(temp.timestamp)  + " was rejected"), student = temp.student)
        yt.created_at = datetime.datetime.now().date()
        yt.modified_at = datetime.datetime.now().date()
        yt.modified_by = request.user
        yt.created_by = request.user
        yt.save()
        return redirect('mess_admin:mess_admin_dashboard')
    return render(request,'index.html')
Ejemplo n.º 3
0
def pending_appointments(request, id):
    if (check_isMedicalAdmin(request)):
        try:
            medical_appointment = MedicalAppointment.objects.get(pk=id)
            me = Messages(message="Your medical appointment with " +
                          str(medical_appointment.doctor.doctor_name) +
                          " at " + str(medical_appointment.appointment_time) +
                          " has been confirmed ",
                          student=medical_appointment.student)
            me.created_at = datetime.datetime.now().date()
            me.modified_at = datetime.datetime.now().date()
            me.created_by = request.user.username
            me.modified_by = request.user.username
            me.save()
            medical_appointment.isDeleted = 1
            medical_appointment.save()
            return redirect('medical_admin:medical_admin_dashboard')
        except:
            pass
        return redirect('medical_admin:medical_admin_dashboard')
    return render(request, 'index.html')
Ejemplo n.º 4
0
def chat_with_applicant(request,applicants_id):
    if request.method=="POST":
        message=request.POST.get("message")
        recievers_id=Applicant.objects.get(id=applicants_id).applicant_id
        Messages(sender_id=request.user.id,reciever_id=recievers_id,application_id=applicants_id,message=message).save()
        return HttpResponseRedirect(f"employer/chat/{applicants_id}")

    else:
        applicant=Applicant.objects.get(id=applicants_id)
        job=Jobs.objects.get(id=applicant.job_id)
        message=Messages.objects.filter(application_id=applicants_id)
        profile=Profile.objects.get(user_id=applicant.applicant_id)
        profile1=Profile.objects.get(user_id=request.user.id)
        return render(request,"employer/conv.html",
        {
            "messages":message,
            "profile":profile,
            "job":job,
            "profile1":profile1
        })
Ejemplo n.º 5
0
def reject_leave(request, id):
    if (check_isMedicalAdmin(request)):
        try:
            medical_leave = MedicalLeave.objects.get(pk=id)
            me = Messages(
                message="Your medical leave has got rejected. Leave From" +
                str(medical_leave.leave_from) + " Leave to: " +
                str(medical_leave.leave_to) + " Reason: " +
                str(medical_leave.reason),
                student=medical_leave.student)
            me.created_at = datetime.datetime.now().date()
            me.modified_at = datetime.datetime.now().date()
            me.created_by = request.user.username
            me.modified_by = request.user.username
            me.save()
            medical_leave.isDeleted = 1
            medical_leave.save()
            return redirect('medical_admin:medical_admin_dashboard')
        except:
            pass
        return redirect('medical_admin:medical_admin_dashboard')
    return render(request, 'index.html')