예제 #1
0
def add_new_job_position(request):
    if request.method == "POST":
        job_title = request.POST["job_title"]
        pos = request.POST["positions"]
        type = request.POST.get('type')
        salary = get_salary_scale(request.POST.get('salary'))
        currency_id = request.POST.get('currency')
        description = request.POST.get('description')

        currency = get_currency(currency_id)

        job = Position.objects.filter(name=job_title)

        if job:
            messages.warning(request, f'Position {job_title} Already Exists')

            return redirect('manage_job_positions_page')
        else:
            job = Position(name=job_title, number_of_slots=pos, type=type, salary_scale=salary,
                        currency=currency, description=description)
            job.save()

            messages.success(request, f'Position {job_title} added Successfully')
            return redirect('manage_job_positions_page')

        messages.error(request, f'Information Not Saved, Check you inputs and try again!')

    return redirect('manage_job_positions_page')
예제 #2
0
def edit_salary_scale_page(request, scale_id):
    scale = get_salary_scale(scale_id)
    context = {
        "user": request.user,
        "scale": scale,
        "organisation_page": "active"

    }
    return render(request, 'organisation_details/edit_salary_scale.html', context)
예제 #3
0
def delete_salary_scale(request, scale_id):
    try:
        salary_scale=get_salary_scale(scale_id)

        salary_scale.delete()
        return redirect('manage_salary_scale_page')
    except SalaryScale.DoesNotExist:
        messages.warning(request, f"Salary Grade Doesn't Exist")
        
        return redirect('manage_salary_scale_page')
예제 #4
0
def edit_salary_scale(request):
    if request.method=="POST":
        scale_id = request.POST.get('scale_id')
        salary_scale = get_salary_scale(scale_id)

        salary_scale.level=request.POST.get('grade_level')
        salary_scale.minimum=request.POST.get('min_value')
        salary_scale.maximum = request.POST.get('max_value')

        salary_scale.save()

        messages.success(request, f'Changes Saved Successfully!')

        return redirect('manage_salary_scale_page')
예제 #5
0
def edit_job_position(request):
    if not request.POST:
        return redirect('manage_job_positions_page')

    position_id = request.POST.get('position_id')
    currency_id = request.POST.get('currency')
    currency = get_currency(currency_id)
    position = get_position(position_id)
    position.name = request.POST.get('name')
    position.number_of_slots = request.POST.get('number_of_slots')
    position.type = request.POST.get('type')
    position.salary_scale = get_salary_scale(request.POST.get('salary'))
    position.currency = currency
    position.description = request.POST.get('description')
    position.save()
    messages.success(request, "Changes successfully Saved")
    return redirect('manage_job_positions_page')