/**
  * Render the designation name column
  *
  * @param  object  $item
  *
  * @return string
  */
 function column_name($entitlement)
 {
     $actions = array();
     $delete_url = '';
     if (erp_get_option('erp_debug_mode', false, 0)) {
         $actions['delete'] = sprintf('<a href="%s" class="submitdelete" data-id="%d" data-user_id="%d" data-policy_id="%d" title="%s">%s</a>', $delete_url, $entitlement->id, $entitlement->user_id, $entitlement->policy_id, __('Delete this item', 'wp-erp'), __('Delete', 'wp-erp'));
     }
     return sprintf('<a href="%3$s"><strong>%1$s</strong></a> %2$s', esc_html($entitlement->employee_name), $this->row_actions($actions), erp_hr_url_single_employee($entitlement->user_id));
 }
Beispiel #2
0
?>

                </div><!-- .erp-profile-top -->

                <?php 
$active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'general';
$tabs = apply_filters('erp_hr_employee_single_tabs', array('general' => array('title' => __('General Info', 'wp-erp'), 'callback' => 'erp_hr_employee_single_tab_general'), 'job' => array('title' => __('Job', 'wp-erp'), 'callback' => 'erp_hr_employee_single_tab_job'), 'leave' => array('title' => __('Leave', 'wp-erp'), 'callback' => 'erp_hr_employee_single_tab_leave'), 'notes' => array('title' => __('Notes', 'wp-erp'), 'callback' => 'erp_hr_employee_single_tab_notes'), 'performance' => array('title' => __('Performance', 'wp-erp'), 'callback' => 'erp_hr_employee_single_tab_performance')));
?>

                <h2 class="nav-tab-wrapper" style="margin-bottom: 15px;">
                    <?php 
foreach ($tabs as $key => $tab) {
    $active_class = $key == $active_tab ? ' nav-tab-active' : '';
    ?>
                        <a href="<?php 
    echo add_query_arg(array('tab' => $key), erp_hr_url_single_employee($employee->id));
    ?>
" class="nav-tab<?php 
    echo $active_class;
    ?>
"><?php 
    echo $tab['title'];
    ?>
</a>
                    <?php 
}
?>
                </h2>

                <?php 
// call the tab callback function
Beispiel #3
0
 /**
  * Render the employee name column
  *
  * @param  object  $item
  *
  * @return string
  */
 function column_name($item)
 {
     $tpl = '?page=erp-leave&leave_action=%s&id=%d';
     $nonce = 'erp-hr-leave-req-nonce';
     $actions = array();
     $delete_url = wp_nonce_url(sprintf($tpl, 'delete', $item->id), $nonce);
     $reject_url = wp_nonce_url(sprintf($tpl, 'reject', $item->id), $nonce);
     $approve_url = wp_nonce_url(sprintf($tpl, 'approve', $item->id), $nonce);
     $pending_url = wp_nonce_url(sprintf($tpl, 'pending', $item->id), $nonce);
     $actions['delete'] = sprintf('<a href="%s">%s</a>', $delete_url, __('Delete', 'wp-erp'));
     if ($item->status == '2') {
         $actions['reject'] = sprintf('<a href="%s">%s</a>', $reject_url, __('Reject', 'wp-erp'));
         $actions['approved'] = sprintf('<a href="%s">%s</a>', $approve_url, __('Approve', 'wp-erp'));
     } elseif ($item->status == '1') {
         $actions['pending'] = sprintf('<a href="%s">%s</a>', $pending_url, __('Mark Pending', 'wp-erp'));
     } elseif ($item->status == '3') {
         $actions['approved'] = sprintf('<a href="%s">%s</a>', $approve_url, __('Approve', 'wp-erp'));
     }
     return sprintf('<a href="%3$s"><strong>%1$s</strong></a> %2$s', $item->display_name, $this->row_actions($actions), erp_hr_url_single_employee($item->user_id));
 }
        foreach ($entitlements as $num => $entitlement) {
            ?>
                        <tr class="<?php 
            echo $num % 2 == 0 ? 'alternate' : 'odd';
            ?>
">
                            <th scope="row" class="check-column">
                                <input id="cb-select-1" type="checkbox" name="id[]" value="<?php 
            echo $entitlement->id;
            ?>
">
                            </th>
                            <td class="col-">

                                <strong><a href="<?php 
            echo erp_hr_url_single_employee($entitlement->id);
            ?>
"><?php 
            echo esc_html($entitlement->employee_name);
            ?>
</a></strong>

                            </td>
                            <td class="col-"><?php 
            echo esc_html($entitlement->policy_name);
            ?>
</td>
                            <td class="col-"><?php 
            echo erp_format_date($entitlement->from_date);
            ?>
</td>
Beispiel #5
0
 /**
  * Render the employee name column
  *
  * @param  object  $item
  *
  * @return string
  */
 function column_name($employee)
 {
     $actions = array();
     $delete_url = '';
     $actions['edit'] = sprintf('<a href="%s" data-id="%d">%s</a>', $delete_url, $employee->id, __('Edit', 'wp-erp'));
     $actions['delete'] = sprintf('<a href="%s">%s</a>', $delete_url, __('Delete', 'wp-erp'));
     return sprintf('%4$s <a href="%3$s"><strong>%1$s</strong></a> %2$s', $employee->get_full_name(), $this->row_actions($actions), erp_hr_url_single_employee($employee->id), $employee->get_avatar());
 }
Beispiel #6
0
<?php

$filter_active = isset($_GET['department']) && $_GET['department'] != '-1' || isset($_GET['designation']) && $_GET['designation'] != '-1' ? $_GET : false;
$leave_requests = erp_hr_get_calendar_leave_events($filter_active);
$events = [];
foreach ($leave_requests as $key => $leave_request) {
    $events[] = array('id' => $leave_request->id, 'title' => $leave_request->display_name, 'start' => $leave_request->start_date, 'end' => $leave_request->end_date, 'url' => erp_hr_url_single_employee($leave_request->user_id), 'color' => $leave_request->color, 'img' => get_avatar($leave_request->user_id, 16));
}
?>

<style>
    .fc-time {
        display:none;
    }
    .erp-leave-avatar img {
        border-radius: 50%;
        margin: 3px 7px 0 0;

    }
    .erp-calendar-filter {
        margin: 15px 0px;
    }
    .fc-title {
        position: relative;
        top: -4px;
    }
</style>
<div class="wrap erp-hr-calendar-wrap">

    <h1><?php 
_e('Calendar', 'wp-erp');
 /**
  * Render the employee name column
  *
  * @param  object  $item
  *
  * @return string
  */
 function column_name($employee)
 {
     $actions = array();
     $delete_url = '';
     $data_hard = isset($_REQUEST['status']) && $_REQUEST['status'] == 'trash' ? 1 : 0;
     $delete_text = isset($_REQUEST['status']) && $_REQUEST['status'] == 'trash' ? __('Permanent Delete', 'wp-erp') : __('Delete', 'wp-erp');
     if (current_user_can('erp_edit_employee', $employee->id)) {
         $actions['edit'] = sprintf('<a href="%s" data-id="%d"  title="%s">%s</a>', $delete_url, $employee->id, __('Edit this item', 'wp-erp'), __('Edit', 'wp-erp'));
     }
     if (current_user_can('erp_delete_employee')) {
         $actions['delete'] = sprintf('<a href="%s" class="submitdelete" data-id="%d" data-hard=%d title="%s">%s</a>', $delete_url, $employee->id, $data_hard, __('Delete this item', 'wp-erp'), $delete_text);
     }
     return sprintf('%4$s <a href="%3$s"><strong>%1$s</strong></a> %2$s', $employee->get_full_name(), $this->row_actions($actions), erp_hr_url_single_employee($employee->id), $employee->get_avatar());
 }
/**
 * ERP dashboard leave calendar widget
 *
 * @since 0.1
 *
 * @return void
 */
function erp_hr_dashboard_widget_leave_calendar()
{
    $user_id = get_current_user_id();
    $leave_requests = erp_hr_get_calendar_leave_events(false, $user_id);
    $holidays = erp_array_to_object(\WeDevs\ERP\HRM\Models\Leave_Holiday::all()->toArray());
    $events = [];
    $holiday_events = [];
    $event_data = [];
    foreach ($leave_requests as $key => $leave_request) {
        $events[] = array('id' => $leave_request->id, 'title' => $leave_request->display_name, 'start' => $leave_request->start_date, 'end' => $leave_request->end_date, 'url' => erp_hr_url_single_employee($leave_request->user_id), 'color' => $leave_request->color, 'img' => get_avatar($leave_request->user_id, 16));
    }
    foreach ($holidays as $key => $holiday) {
        $holiday_events[] = ['id' => $holiday->id, 'title' => $holiday->title, 'start' => $holiday->start, 'end' => $holiday->end, 'color' => '#FF5354', 'img' => '', 'holiday' => true];
    }
    $event_data = array_merge($events, $holiday_events);
    ?>
    <style>
        .fc-time {
            display:none;
        }
        .erp-leave-avatar img {
            border-radius: 50%;
            margin: 3px 7px 0 0;

        }
        .erp-calendar-filter {
            margin: 15px 0px;
        }
        .fc-title {
            position: relative;
            top: -4px;
        }
    </style>

    <?php 
    if (erp_hr_get_assign_policy_from_entitlement($user_id)) {
        ?>
        <div class="erp-hr-new-leave-request-wrap">
            <a href="#" class="button button-primary" id="erp-hr-new-leave-req"><?php 
        _e('Take a Leave', 'wp-erp');
        ?>
</a>
        </div>
    <?php 
    }
    ?>

    <div id="erp-hr-calendar"></div>

    <script>
    ;jQuery(document).ready(function($) {

        $('#erp-hr-calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
            editable: false,
            eventLimit: true, // allow "more" link when too many events
            events: <?php 
    echo json_encode($event_data);
    ?>
,
            eventRender: function(event, element, calEvent) {
                if ( event.holiday ) {
                    element.find('.fc-content').find('.fc-title').css({ 'top':'0px', 'left' : '3px', 'fontSize' : '13px', 'padding':'2px' });
                };
                if( event.img != 'undefined' ) {
                    element.find('.fc-content').find('.fc-title').before( $("<span class=\"fc-event-icons erp-leave-avatar\">"+event.img+"</span>") );
                }
            },
        });
    });

</script>
    <?php 
}