/**
     * Render extra filtering option in
     * top of the table
     *
     * @since 0.1
     *
     * @param  string $which
     *
     * @return void
     */
    function extra_tablenav($which)
    {
        if ($which != 'top') {
            return;
        }
        $selected_desingnation = isset($_GET['filter_designation']) ? $_GET['filter_designation'] : 0;
        $selected_department = isset($_GET['filter_department']) ? $_GET['filter_department'] : 0;
        $selected_type = isset($_GET['filter_employment_type']) ? $_GET['filter_employment_type'] : '';
        ?>
        <div class="alignleft actions">

            <label class="screen-reader-text" for="new_role"><?php 
        _e('Filter by Designation', 'wp-erp');
        ?>
</label>
            <select name="filter_designation" id="filter_designation">
                <?php 
        echo erp_hr_get_designation_dropdown($selected_desingnation);
        ?>
            </select>

            <label class="screen-reader-text" for="new_role"><?php 
        _e('Filter by Designation', 'wp-erp');
        ?>
</label>
            <select name="filter_department" id="filter_department">
                <?php 
        echo erp_hr_get_departments_dropdown($selected_department);
        ?>
            </select>

            <label class="screen-reader-text" for="new_role"><?php 
        _e('Filter by Employment Type', 'wp-erp');
        ?>
</label>
            <select name="filter_employment_type" id="filter_employment_type">
                <option value="-1"><?php 
        _e('- Select Employment Type -', 'wp-erp');
        ?>
</option>
                <?php 
        $types = erp_hr_get_employee_types();
        foreach ($types as $key => $title) {
            echo sprintf("<option value='%s'%s>%s</option>\n", $key, selected($selected_type, $key, false), $title);
        }
        ?>
            </select>

            <?php 
        submit_button(__('Filter'), 'button', 'filter_employee', false);
        echo '</div>';
    }
Example #2
0
 /**
  * Get the employee type
  *
  * @return string
  */
 public function get_type()
 {
     if ($this->type) {
         $types = erp_hr_get_employee_types();
         if (array_key_exists($this->type, $types)) {
             return $types[$this->type];
         }
     }
 }
Example #3
0
<div class="status-form-wrap">
    <div class="row">
        <?php 
erp_html_form_input(array('label' => __('Date', 'wp-erp'), 'name' => 'date', 'value' => date('Y-m-d', current_time('timestamp')), 'required' => true, 'class' => 'erp-date-field'));
?>
    </div>

    <div class="row">
        <?php 
erp_html_form_input(array('label' => __('Employment Status', 'wp-erp'), 'name' => 'status', 'value' => '', 'type' => 'select', 'options' => array(0 => __('- Select -', 'wp-erp')) + erp_hr_get_employee_types()));
?>
    </div>

    <div class="row">
        <?php 
erp_html_form_input(array('label' => __('Comment', 'wp-erp'), 'name' => 'comment', 'value' => '', 'placeholder' => __('Optional comment', 'wp-erp'), 'type' => 'textarea', 'custom_attr' => array('rows' => 4, 'cols' => 25)));
?>
    </div>

    <?php 
wp_nonce_field('employee_update_employment');
?>
    <input type="hidden" name="action" id="status-action" value="erp-hr-emp-update-status">
    <input type="hidden" name="employee_id" id="emp-id" value="{{ data.id }}">
</div>
Example #4
0
 /**
  * Update employment status
  *
  * @return void
  */
 public function employee_update_employment()
 {
     $this->verify_nonce('employee_update_employment');
     // @TODO: check permission
     $employee_id = isset($_REQUEST['employee_id']) ? intval($_REQUEST['employee_id']) : 0;
     $date = empty($_POST['date']) ? current_time('mysql') : $_POST['date'];
     $comment = strip_tags($_POST['comment']);
     $status = strip_tags($_POST['status']);
     $types = erp_hr_get_employee_types();
     if (!array_key_exists($status, $types)) {
         $this->send_error(__('Status error', 'wp-erp'));
     }
     $employee = new Employee($employee_id);
     if ($employee->id) {
         $employee->update_employment_status($status, $date, $comment);
         $this->send_success();
     }
     $this->send_error(__('Something went wrong!', 'wp-erp'));
 }
Example #5
0
</th>
                <th><?php 
_e('Employment Status', 'wp-erp');
?>
</th>
                <th><?php 
_e('Comment', 'wp-erp');
?>
</th>
                <th class="action">&nbsp;</th>
            </tr>
        </thead>
        <tbody>
            <?php 
if ($history['employment']) {
    $types = erp_hr_get_employee_types();
    foreach ($history['employment'] as $num => $row) {
        ?>
                    <tr class="<?php 
        echo $num % 2 == 0 ? 'alternate' : 'odd';
        ?>
">
                        <td><?php 
        echo erp_format_date($row->date);
        ?>
</td>
                        <td>
                            <?php 
        if (!empty($row->type) && array_key_exists($row->type, $types)) {
            echo $types[$row->type];
        }
Example #6
0
            <li data-selected="{{ data.work.location }}">
                <?php 
erp_html_form_input(array('label' => __('Location', 'wp-erp'), 'name' => 'work[location]', 'value' => '{{ data.work.location }}', 'custom_attr' => array('data-id' => 'erp-company-new-location'), 'class' => 'erp-hrm-select2-add-more erp-hr-location-drop-down', 'type' => 'select', 'options' => erp_company_get_location_dropdown_raw()));
?>
            </li>

            <li data-selected="{{ data.work.reporting_to }}">
                <?php 
erp_html_form_input(array('label' => __('Reporting To', 'wp-erp'), 'name' => 'work[reporting_to]', 'value' => '{{ data.work.reporting_to }}', 'class' => 'erp-hrm-select2', 'type' => 'select', 'id' => 'work_reporting_to', 'options' => erp_hr_get_employees_dropdown_raw()));
?>
            </li>

            <li data-selected="{{ data.work.type }}">
                <?php 
erp_html_form_input(array('label' => __('Employee Type', 'wp-erp'), 'name' => 'work[type]', 'value' => '{{ data.work.type }}', 'class' => 'erp-hrm-select2', 'type' => 'select', 'options' => array('-1' => __('- Select -', 'wp-erp')) + erp_hr_get_employee_types()));
?>
            </li>

            <li data-selected="{{ data.work.status }}">
                <?php 
erp_html_form_input(array('label' => __('Employee Status', 'wp-erp'), 'name' => 'work[status]', 'value' => '{{ data.work.status }}', 'class' => 'erp-hrm-select2', 'type' => 'select', 'options' => array('-1' => __('- Select -', 'wp-erp')) + erp_hr_get_employee_statuses()));
?>
            </li>

        <# } #>

            <li data-selected="{{ data.work.hiring_source }}">
                <?php 
erp_html_form_input(array('label' => __('Source of Hire', 'wp-erp'), 'name' => 'work[hiring_source]', 'value' => '{{ data.work.hiring_source }}', 'class' => 'erp-hrm-select2', 'type' => 'select', 'options' => array('-1' => __('- Select -', 'wp-erp')) + erp_hr_get_employee_sources()));
?>