Exemplo n.º 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')
Exemplo n.º 2
0
def edit_currency_page(request, currency_id):
    currency = get_currency(currency_id)
    if request.POST:
        code = request.POST.get('code')
        desc = request.POST.get('desc')
        cost = request.POST.get('cost')
        update_currency(currency, code, desc, cost)
        messages.success(request, 'Successfully updated currency')
        return HttpResponseRedirect(reverse('settings_page'))
    context = {"currency": currency}
    return render(request, 'settings/edit_currency.html', context)
Exemplo n.º 3
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')
Exemplo n.º 4
0
def user_training_page(request):
    applicant = request.user.solitonuser.employee
    if request.POST:
        programme = request.POST.get('programme')
        institution = request.POST.get('institution')
        duration = request.POST.get('duration')
        cost = request.POST.get('cost')
        start_date = request.POST.get('start_date')
        end_date = request.POST.get('end_date')
        business_case = request.POST.get('business_case')
        objectives = request.POST.get('objectives')
        preparations = request.POST.get('preparations')
        skills = request.POST.get('skills')
        knowledge = request.POST.get('knowledge')
        currency_id = request.POST.get('currency_id')
        currency = get_currency(currency_id)

        Training.objects.create(applicant=applicant,
                                programme=programme,
                                institution=institution,
                                duration=duration,
                                cost=cost,
                                start_date=start_date,
                                end_date=end_date,
                                business_case=business_case,
                                objectives=objectives,
                                preparations=preparations,
                                skills=skills,
                                knowledge=knowledge,
                                currency=currency)

        return HttpResponseRedirect(reverse(user_training_page))

    currencies = get_all_currencies()
    trainings = get_applicant_trainings(applicant)
    context = {
        "training_page": "active",
        "currencies": currencies,
        "trainings": trainings
    }

    return render(request, 'training/user_training.html', context)
Exemplo n.º 5
0
def delete_currency(request, currency_id):
    currency = get_currency(currency_id)
    currency.delete()
    messages.success(request, "Successfully delete currency")
    return HttpResponseRedirect(reverse('settings_page'))