Example #1
0
def approve_overtime_application(request, overtime_application_id):
    approver = request.user
    overtime_application = get_overtime_application(overtime_application_id)
    approved_overtime_application = approve_overtime_application_service(approver, overtime_application)
    if approved_overtime_application:
        messages.success(request, "You approved %s's overtime application" % approved_overtime_application.applicant)
    else:
        messages.error(request, "You are not associated to any role on the system")
    return HttpResponseRedirect(reverse('approve_overtime_page'))
Example #2
0
def pending_overtime_application_page(request, overtime_application_id):
    overtime_application = get_overtime_application(overtime_application_id)

    context = {
        "overtime_page": "active",
        "overtime_application": overtime_application
    }

    return render(request, 'overtime/pending_overtime_application.html', context)
Example #3
0
def amend_overtime_application_page(request, overtime_application_id):
    overtime_application = get_overtime_application(overtime_application_id)
    if request.POST:
        start_time = request.POST.get('start_time')
        end_time = request.POST.get('end_time')
        description = request.POST.get('description')
        update_overtime_application(overtime_application.id, start_time, end_time, description)
        messages.success(request, "Successfully amended the overtime application")
        return HttpResponseRedirect(reverse('approve_overtime_page'))

    context = {
        "overtime_page": "active",
        "overtime_application": overtime_application
    }

    return render(request, 'overtime/amend_overtime_application.html', context)
Example #4
0
def delete_overtime_application(request, id):
    """Delete overtime application"""
    overtime_application = get_overtime_application(id)
    overtime_application.delete()
    return HttpResponseRedirect(reverse(overtime_applications_page))