<!DOCTYPE html>
<html>

<head>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
    <meta content="utf-8" http-equiv="encoding">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="<?php echo base_url();?>/favicon.ico" type="image/x-icon">
    <link rel="icon" href="<?php echo base_url();?>/favicon.ico" type="image/x-icon">

    <title><?php echo SITE_TITLE;?>: Promotion Application</title>

    <!-- Stylesheets -->
    <link rel="stylesheet" href="<?php echo base_url();?>/assets/css/jquery-ui.css" />
    <link rel="stylesheet" href="<?php echo base_url();?>/assets/css/tmis.css" />
    <link rel="stylesheet" href="<?php echo base_url();?>/assets/css/tmis.mobile.css" media="(max-width:790px)" />
    <link rel="stylesheet" href="<?php echo base_url();?>/assets/css/tmis.tablet.css" media="(min-width:791px) and (max-width: 900px)" />
    <link rel="stylesheet" href="<?php echo base_url();?>/assets/css/tmis.desktop.css" media="(min-width:901px)" />
    <link rel="stylesheet" href="<?php echo base_url();?>/assets/css/tmis.list.css" />
    <link rel="stylesheet" href="<?php echo base_url();?>/assets/css/tmis.menu.css" />
    <link rel="stylesheet" href="<?php echo base_url();?>/assets/css/trumbowyg.css" />
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-uWxY/CJNBR+1zjPWmfnSnVxwRheevXITnMqoEIeG1LJrdI0GlVs/9cVSyPYXdcSF" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
    <link rel="stylesheet" href="<?php echo base_url();?>/assets/css/updated.css" />

    <!-- Javascript -->
    <script src="" integrity="sha384-kQtW33rZJAHjgefvhyyzcGF3C5TFyBQBA13V1RKPf4uH+bwyzQxZ6CmMZHmNBEfJ" crossorigin="anonymous"></script>
    <?php echo minify_js('job-promotion_application', array('jquery-2.1.1.min.js', 'jquery-ui.js', 'jquery.form.js', 'tmis.js',  'tmis.fileform.js', 'tmis.menu.js', 'tmis.responsive.js', 'trumbowyg.js'));?>
    <script type="text/javascript">
    var logout_timer = 0;

    function set_logout_interval() {
        // the interval 'timer' is set as soon as the page loads
        logout_timer = setInterval("auto_logout()", 600000);
        // the figure '600000' above indicates how many milliseconds (10 Minutes) the timer be set to.

    }

    function reset_logout_interval() {
        //After events on a page like click,scroll,page load, keystroke
        if (logout_timer != 0) {
            clearInterval(logout_timer);
            logout_timer = 0;
            // second step: implement the timer again
            logout_timer = setInterval("auto_logout()", 600000);
            // completed the reset of the timer
        }
    }

    function auto_logout() {

        // this function will redirect the user to the logout script
        window.location.href = "<?php echo base_url();?>/Account/logout";
    }
    </script>
</head>

<body onload="set_logout_interval()" onmousemove="reset_logout_interval()" onclick="reset_logout_interval()" onkeypress="reset_logout_interval()" onscroll="reset_logout_interval()" style="margin:0px;">
    <?php echo view("addons/secure_header"); $this->session = \Config\Services::session();?>

    <div class="container-fluid mx-auto mt-5 pt-5 px-0 app-area">
        <aside class="app-area-sidebar px-3 py-4 bg-primary d-none d-md-block">
            <nav id="menucontainer" class="nav flex-column">
                <?php echo view("addons/menu");?>
            </nav>
        </aside>
        <main class="app-area-content px-3 bg-light">
            <section class="d-flex justify-content-between align-items-center app-area-content-intro">
                <h3>Promotion Application</h3>
                <?php echo !empty($msg)?"<tr><td>".format_notice($this, $msg)."</td></tr>": "";?>
            </section>
            <section class="app-area-content-body mt-3 px-3 py-3 bg-white">
                <form id="promotion_application" method="post" autocomplete="off"
                    action="<?php echo base_url().'/Job/apply_for_promotion';?>"
                    class='simplevalidator'>
                    <table border="0" cellspacing="0" cellpadding="10"
                        <?php echo !$this->session->get('jobname')? " style='width:100%;' ": "";?>>
                        <?php
                        if ($this->session->get('jobname')) {
                        ?>
                        <tr>
                            <td class="label">Your Current Job:</td>
                            <td class='value'><?php echo $this->session->get('jobname'); ?></td>
                        </tr>
                        <tr>
                            <td class="label">Select Job:</td>
                            <td><input type="text" id="job__schooljobs" name="job__schooljobs"
                                    title="Select Job" placeholder="Select Desired Job"
                                    class="textfield selectfield searchable"
                                    value="<?php echo $this->session->get('job__schooljobs'); ?>"
                                    style="width:85%;" /><input type='hidden' id='vacancyid'
                                    name='vacancyid'
                                    value='<?php echo $this->session->get('vacancyid'); ?>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="label">Desired Effective Date:</td>
                            <td><input type="text" id="proposeddate" name="proposeddate"
                                    title="Effective Date" class="textfield datefield"
                                    value="<?php echo $this->session->get('proposeddate')? date('d-M-Y', strtotime($this->session->get('proposeddate'))):''; ?>"
                                    style="width:95%;" /></td>
                        </tr>
                        <tr>
                            <td class="label top">Reason:</td>
                            <td><textarea id="promotionreason" name="promotionreason"
                                    title="Reason" class="textfield optional"
                                    placeholder="Enter the reason here (Optional)."
                                    style="width:300px; height: 150px;"><?php echo $this->session->get('promotionreason'); ?></textarea>
                            </td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td>
                            <td><input type="submit" name="submit" id="submit" class="btn"
                                    value="SUBMIT" /></td>
                        </tr>
                        <?php
                        } else {
                            echo "<tr><td>".format_notice($this, "WARNING: You do not have a current job posting to submit a promotion application.")."</td></tr>";
                        }
                        ?>
                    </table>
                </form>
            </section>
        </main>
    </div>
    
    <?php echo view("addons/secure_footer");?>

</body>

</html>