<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Career extends Admin_Core_Controller {

	public function __construct() {
		parent::__construct();
	}

	public function career_category()
    {
        $data['title'] = "Category";
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['get_all_category'] = $this->career_model->get_all_category();
        $this->load->view('admin/include/header',$data);
        $this->load->view('admin/career_page/career_category');
        $this->load->view('admin/include/footer');
    }
    // Add Job Category 
    public function add_new_job_category()
    {
        if ($this->career_model->add_new_job_category()) 
        {
            $this->session->set_userdata('success', "Category Successfully Added");
            redirect($this->agent->referrer());
        } else {
            $this->session->set_userdata('error', "Category Added Failed");
            redirect($this->agent->referrer());
        }
    }
    // Update Job Category 
    public function update_job_category()
    {
        if ($this->career_model->update_job_category()) 
        {
            $this->session->set_userdata('success', "Category Successfully Updated");
            redirect($this->agent->referrer());
        } else {
            $this->session->set_userdata('error', "Category Updated Failed");
            redirect($this->agent->referrer());
        }
    }
    // Delete Job Category 
    public function delete_job_category($id)
    {
        if ($this->career_model->delete_job_category($id)) 
        {
            $this->session->set_userdata('success', "Category Successfully Deleted");
            redirect($this->agent->referrer());
        } else {
            $this->session->set_userdata('error', "Category Deleted Failed");
            redirect($this->agent->referrer());
        }
    }
     // Add New Job
    public function add_new_job()
    {
        $data['title'] = "Add New Job";
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['get_all_category'] = $this->career_model->get_all_category();
        $this->load->view('admin/include/header',$data);
        $this->load->view('admin/career_page/add_new_job');
        $this->load->view('admin/include/footer');
    }
    // Add New Job 
     public function add_job()
    {
        if ($this->career_model->add_job()) 
        {
            $this->session->set_userdata('success', "Job Successfully Added");
            redirect($this->agent->referrer());
        } else {
            $this->session->set_userdata('error', "Job Added Failed");
            redirect($this->agent->referrer());
        }
    }
    // Add New Job
    public function view_all_job()
    {
        $data['title'] = "View All Job";
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['view_all_job'] = $this->career_model->view_all_job();
        $this->load->view('admin/include/header',$data);
        $this->load->view('admin/career_page/view_all_job');
        $this->load->view('admin/include/footer');
    }
     // Edit Job By id
    public function edit_job($id)
    {
        $data['title'] = "Edit Job";
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        $data['job'] = $this->career_model->view_job_by_id($id);
        $data['get_all_category'] = $this->career_model->get_all_category();
        $this->load->view('admin/include/header',$data);
        $this->load->view('admin/career_page/edit_job');
        $this->load->view('admin/include/footer');
    }
    // Update Job 
     public function update_job()
    {
         if ($this->career_model->update_job()) 
        {
            $this->session->set_userdata('success', "Job Successfully Update");
            redirect($this->agent->referrer());
        } else {
            $this->session->set_userdata('error', "Job Update Failed");
            redirect($this->agent->referrer());
        }
    }
    // Delete Job 
     public function delete_job($id)
    {
        if ($this->career_model->delete_job($id)) 
        {
            $this->session->set_userdata('success', "Job Successfully Delete");
            redirect($this->agent->referrer());
        } else {
            $this->session->set_userdata('error', "Job Delete Failed");
            redirect($this->agent->referrer());
        }
    }
    // Apply New Job 
     public function apply_job()
    {
        if ($this->career_model->apply_job()) 
        {
            $this->session->set_userdata('success', "Job Successfully Update");
            redirect($this->agent->referrer());
        } else {
            $this->session->set_userdata('error', "Job Update Failed");
            redirect($this->agent->referrer());
        }
    }
     // All Job Appplication
    public function view_all_job_application()
    {
        $data['title'] = "All Job Application";
        $data['app_setting'] = $this->setting_model->get_all_app_setting();
        //$data['get_all_category'] = $this->career_model->get_all_category();
        $data['get_all_job_application'] = $this->career_model->get_all_job_application();
        $this->load->view('admin/include/header',$data);
        $this->load->view('admin/career_page/all_job_application');
        $this->load->view('admin/include/footer');
    }
     // Delete Job Application 
    public function delete_job_application($id)
    {
        if ($this->career_model->delete_job_application($id)) 
        {
            $this->session->set_userdata('success', "Job Successfully Delete");
            redirect($this->agent->referrer());
        } else {
            $this->session->set_userdata('error', "Job Delete Failed");
            redirect($this->agent->referrer());
        }
    }
	
}
