<?php
$session = $this->session->userdata('c_user_id');
$job_category = $this->Recruitment_model->read_category_info($category_id); ?>
<?php if (!empty($this->session->userdata('c_user_id'))) { ?>
	<?php $session = $this->session->userdata('c_user_id'); ?>
	<?php $employer = $this->Recruitment_model->read_employer_info($session['c_user_id']); ?>
<?php } ?>
<?php
if (!is_null($job_category)) {
	$category_name = $job_category[0]->category_name;
} else {
	$category_name = '--';
}
?>
<?php $jtype = $this->Job_post_model->read_job_type_information($job_type_id); ?>
<?php
if (!is_null($jtype)) {
	$jt_type = $jtype[0]->type;
	if ($jt_type == 'Freelance') :
		$clS = 'freelance';
	elseif ($jt_type == 'Internship') :
		$clS = 'internship';
	elseif ($jt_type == 'Part Time') :
		$clS = 'part-time';
	elseif ($jt_type == 'Full Time') :
		$clS = 'full-time';
	else :
		$clS = 'full-time';
	endif;
} else {
	$jt_type = '--';
}
?>
<?php $time_ago = $this->Recruitment_model->timeAgo($created_at); ?>
<?php if($this->session->userdata('answer') == 1){?>
<style>
    #pertanyaan{
        display: none;
    }
</style>
<?php }else{?>
<style>
    #cv{
        display: none;
    }
</style>
<?php }?>
<!-- Titlebar
================================================== -->
<div id="titlebar" class="photo-bg" style="background: url(<?php echo base_url(); ?>skin/jobs/hrsale/images/all-categories-photo.jpg)">
	<div class="container">
		<div class="ten columns">
			<span style="color:#fff;"><?php echo $category_name; ?></span>
			<h2><?php echo $job_title; ?> <span class="<?php echo $clS; ?>"><?php echo $jt_type; ?></span></h2>
		</div>

	</div>
</div>
<style>
	.question-class {
		margin-bottom: 10px;
		padding: 15px;
		border-radius: 10px;
		box-shadow: rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px;
	}
</style>

<!-- Content
================================================== -->
<div class="container">
	<!-- Company Info -->
	<div class="company-info">
		<div class="content">
			<h3>Apply For This Job</h3>
		</div>
		<div class="clearfix"></div>
	</div>

</div>
<?php if (!empty($question)) : ?>
<div id="pertanyaan">
<div class="small-dialog-headline">
	<h2>Pertanyaan</h2>
</div>
	<div class="small-dialogg-content">
		<?php $attributes = array('name' => 'answer_apply', 'id' => 'answer_apply', 'class' => 'login', 'autocomplete' => 'on'); ?>
		<?php $hidden = array('answer_apply' => '1'); ?>
		<?php echo form_open('jobs/answer_apply', $attributes, $hidden); ?>

		<input type="hidden" id="url" name="url" value="<?php echo $this->uri->segment(3); ?>">
		<?php $i = 1;
		foreach ($question as $r) { ?>
			<div class="question-class">
				<label style="font-size:12px!important;font-weight:bold!important" for="<?= $r->id ?>"><?= $i++ . '. ' . $r->question ?></label>
				<div style="display: flex; align-items: center; gap: 10px;">
					<input type="radio" id="availability_yes" name="<?= $r->id ?>" value="1">
					<label style="font-size:12px!important;" for="availability_yes">Iya</label>
					<input type="radio" id="availability_no" name="<?= $r->id ?>" value="2">
					<label style="font-size:12px!important;" for="availability_no">Tidak</label>
				</div>
			</div>
		<?php } ?>
		<button type="submit" class="send" style="background-color:#ae2626;!important">Send Answer</button>
		</form>
	</div>
	</div>
<?php endif ?>
<div id="cv">
<div class="small-dialog-headline">
	<h2>Apply For This Job</h2>
</div>
<div class="small-dialog-content">
	<?php $attributes = array('name' => 'apply_job', 'id' => 'apply', 'class' => 'login', 'autocomplete' => 'on'); ?>
	<?php $hidden = array('apply_job' => '1'); ?>
	<?php echo form_open('jobs/apply_job/1', $attributes, $hidden); ?>
	<input type="text" placeholder="Full Name" name="full_name" value="<?= $employer[0]->first_name . ' ' . $employer[0]->last_name ?>" readonly />
	<input type="text" placeholder="Email Address" name="email" value="<?= $employer[0]->email ?>" readonly />
	<input type="text" placeholder="WhatsApp Number" name="notelp" value="<?= $employer[0]->contact_number ?>" readonly />
	<input type="hidden" placeholder="WhatsApp Number" name="id_user" value="<?= $employer[0]->user_id ?>" />
	<input type="hidden" name="totnilai" value="<?= $this->session->userdata('totalnilai'); ?>" readonly />
	<textarea placeholder="Your message / cover letter" name="message" id="cover_letter"></textarea>
	<input type="hidden" name="job_id" value="<?php echo $job_id; ?>">
	<input type="hidden" name="user_id" value="0">

	<!-- Upload CV -->
	<div class="upload-info"><strong>Upload your CV</strong> <span>Max. file size: 5MB</span></div>
	<div class="clearfix"></div>

	<label class="upload-btn">
		<input type="file" id="resume" name="resume" />
		<i class="fa fa-upload"></i> Browse
	</label>
	<div class="divider"></div>

	<button type="submit" class="send">Send Application</button>
	</form>
</div>
</div>
<div class="margin-top-50"></div>
<?php $this->load->view('frontend/hrsale/footer-block'); ?>