Example #1
0
def full_name(value):
    from app.models import Applicant
    applicant = Applicant.find_applicant(value)
    if applicant.middle_name != '':
        return f'{applicant.first_name} {applicant.middle_name} {applicant.last_name}'
    else:
        return f'{applicant.first_name} {applicant.last_name}'
Example #2
0
def no_additional_info(value):
    default_datetime = datetime.strptime('0001-01-01 12:00 AM',
                                         '%Y-%m-%d %I:%M %p')
    from app.models import Applicant
    applicant = Applicant.find_applicant(value)
    return (not applicant.source
            and applicant.interview_datetime == default_datetime)
Example #3
0
def view_applicant_page(applicant_id):
	applicant = Applicant.find_applicant(applicant_id)
	if not applicant:
		flash('Applicant does not exist', 'danger')
		return redirect(url_for('admin.candidates_page'))

	return render_template('pages/account/view_applicant.html', applicant=applicant)
Example #4
0
def call_applicant_page(applicant_id):
    form = CalloutForm(request.form)
    applicant = Applicant.find_applicant(applicant_id)
    form.personal.address.data = applicant.address
    form.call.remarks.data = applicant.remarks

    if not applicant:
        flash('Applicant does not exist', 'danger')
        return redirect(url_for('hr.home_page'))

    return render_template('pages/account/hr/call_applicant.html',
                           form=form,
                           applicant=applicant)
Example #5
0
def edit_applicant_page(applicant_id):
	form = CalloutForm(request.form)
	applicant = Applicant.find_applicant(applicant_id)

	form.call.hr.validators.append(DataRequired())
	form.personal.address.data = applicant.address
	form.call.remarks.data = applicant.remarks
	form.call.hr.choices = list()

	callers = Account.get_all_active_hr()
	for caller in callers:
		form.call.hr.choices.append((caller.id, caller.username))

	if not applicant:
		flash('Applicant does not exist', 'danger')
		return redirect(url_for('admin.candidates_page'))

	return render_template('pages/account/edit_applicant.html', form=form, applicant=applicant)
Example #6
0
def call_applicant(applicant_id):
    form = CalloutForm(request.form)
    applicant = Applicant.find_applicant(applicant_id)
    form.personal.address.data = applicant.address
    form.call.remarks.data = applicant.remarks

    if form.validate_on_submit():
        applicant.last_name = request.form.get('personal-last_name')
        applicant.first_name = request.form.get('personal-first_name')
        applicant.middle_name = request.form.get('personal-middle_name')
        applicant.email = request.form.get('personal-email')
        applicant.mobile1 = request.form.get('personal-mobile1')
        applicant.mobile2 = request.form.get('personal-mobile2')
        applicant.landline = request.form.get('personal-landline')
        applicant.address = request.form.get('personal-address')
        applicant.marital_status = request.form.get('personal-marital_status')
        applicant.course = request.form.get('education-course')
        applicant.graduation_year = request.form.get(
            'education-graduation_year')
        applicant.applied_position = request.form.get(
            'preference-applied_position')
        applicant.expected_salary = request.form.get(
            'preference-expected_salary')
        applicant.preferred_shift = request.form.get('preference-shift')
        applicant.preferred_location = request.form.get('preference-location')
        applicant.status = request.form.get('call-disposition')
        applicant.remarks = request.form.get('call-remarks')
        applicant.source = request.form.get('additional-source')
        applicant.hr_id = current_user.id

        birthdate = request.form.get('personal-birthdate')
        if birthdate != '':
            applicant.birthdate = datetime.strptime('{0}'.format(birthdate),
                                                    '%Y-%m-%d')

        educational_attainment = request.form.get('education-attainment')
        if educational_attainment != '':
            applicant.educational_attainment = educational_attainment

        interview_date = request.form.get('additional-interview_date')
        interview_time = request.form.get('additional-interview_time')

        if interview_date != '' and interview_time != '':
            timepiece = interview_time.split(" ")

            try:
                hour = timepiece[0].split(":")[0]
                minute = timepiece[0].split(":")[1]
            except IndexError as e:
                minute = '00'

            locale_time = timepiece[1]

            interview_datetime = datetime.strptime(
                '{0} {1}:{2} {3}'.format(interview_date, hour, minute,
                                         locale_time), '%Y-%m-%d %I:%M %p')

            applicant.interview_datetime = interview_datetime

        call = CallHistory(hr_id=current_user.id, applicant_id=applicant.id)

        db.session.add(call)
        db.session.commit()

        call_date_str = datetime.strftime(call.datetime, '%B %d, %Y %I:%M %p')
        flash(
            'You called applicant {0} {1} on {2}'.format(
                applicant.first_name, applicant.last_name, call_date_str),
            'success')
        return redirect(url_for('hr.home_page'))

    else:
        flash('Applicant not modified', 'danger')
        print('==================== ERRORS: add_applicant() ================')
        for err in form.errors:
            print(err)
        print('=============================================================')
        for err in form.personal.errors:
            print(err)
        print('=============================================================')
        for err in form.education.errors:
            print(err)
        print('=============================================================')
        for err in form.preference.errors:
            print(err)
        print('=============================================================')
        for err in form.call.errors:
            print(err)
        print('=============================================================')
        for err in form.additional.errors:
            print(err)

        return render_template('pages/account/hr/call_applicant.html',
                               form=form,
                               applicant=applicant)

    return redirect(
        url_for('hr.call_applicant_page', applicant_id=applicant_id))
Example #7
0
def no_call_info(value):
    from app.models import Applicant
    applicant = Applicant.find_applicant(value)
    return (not applicant.status and not applicant.remarks)
Example #8
0
def no_preference(value):
    from app.models import Applicant
    applicant = Applicant.find_applicant(value)
    return (not applicant.applied_position and not applicant.expected_salary
            and not applicant.preferred_shift
            and not applicant.preferred_location)
Example #9
0
def no_scholastic_info(value):
    from app.models import Applicant
    applicant = Applicant.find_applicant(value)
    return (not applicant.educational_attainment and not applicant.course
            and not applicant.graduation_year)