/** * Get the employee status * * @return string */ public function get_status() { if ($this->status) { $statuses = erp_hr_get_employee_statuses(); if (array_key_exists($this->status, $statuses)) { return $statuses[$this->status]; } } }
<?php $history = $employee->get_history(); ?> <?php if (current_user_can('erp_manage_jobinfo')) { ?> <h3><?php _e('Employee Main Status', 'wp-erp'); ?> </h3> <form action="" method="post"> <?php erp_html_form_input(array('label' => __('Employee Status : ', 'wp-erp'), 'name' => 'employee_status', 'value' => $employee->erp->status, 'class' => 'select2', 'type' => 'select', 'options' => array(0 => __('- Select -', 'wp-erp')) + erp_hr_get_employee_statuses())); ?> <input type="hidden" name="user_id" id="erp-employee-id" value="<?php echo $employee->id; ?> "> <input type="hidden" name="action" id="erp-employee-status-action" value="erp-hr-employee-status"> <?php wp_nonce_field('wp-erp-hr-employee-update-nonce'); ?> <input type="submit" class="button" name="employee_update_status" value="<?php esc_attr_e('Update', 'wp-erp'); ?> "> </form>
/** * Get Employee status count * * @since 0.1 * * @return array */ function erp_hr_employee_get_status_count() { global $wpdb; $statuses = array('all' => __('All', 'wp-erp')) + erp_hr_get_employee_statuses(); $counts = array(); foreach ($statuses as $status => $label) { $counts[$status] = array('count' => 0, 'label' => $label); } $cache_key = 'erp-hr-employee-status-counts'; $results = wp_cache_get($cache_key, 'wp-erp'); if (false === $results) { $employee = new \WeDevs\ERP\HRM\Models\Employee(); $db = new \WeDevs\ORM\Eloquent\Database(); $results = $employee->select(array('status', $db->raw('COUNT(id) as num')))->where('status', '!=', '0')->groupBy('status')->get()->toArray(); wp_cache_set($cache_key, $results, 'wp-erp'); } foreach ($results as $row) { if (array_key_exists($row['status'], $counts)) { $counts[$row['status']]['count'] = (int) $row['num']; } $counts['all']['count'] += (int) $row['num']; } return $counts; }
<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())); ?> </li> <li> <?php erp_html_form_input(array('label' => __('Date of Hire', 'wp-erp'), 'name' => 'work[hiring_date]', 'value' => '{{ data.work.hiring_date }}', 'type' => 'text', 'class' => 'erp-date-field')); ?>