index.php
98 lines
| 1 | <?php |
| 2 | /* @var $activities OsActivityModel[] */ |
| 3 | /* @var $showing_from int */ |
| 4 | /* @var $showing_to int */ |
| 5 | /* @var $total_activities int */ |
| 6 | /* @var $per_page int */ |
| 7 | /* @var $total_pages int */ |
| 8 | /* @var $current_page_number int */ |
| 9 | |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit; // Exit if accessed directly |
| 12 | } |
| 13 | ?> |
| 14 | |
| 15 | <?php if($activities){ ?> |
| 16 | |
| 17 | <div class="table-with-pagination-w has-scrollable-table no-overflow"> |
| 18 | <div class="os-pagination-w with-actions"> |
| 19 | |
| 20 | <div class="table-heading-w"> |
| 21 | <div class="pagination-info"><?php echo esc_html__('Showing', 'latepoint'). ' <span class="os-pagination-from">'. esc_html($showing_from) . '</span>-<span class="os-pagination-to">'. esc_html($showing_to) .'</span> '.esc_html__('of', 'latepoint').' <span class="os-pagination-total">'. esc_html($total_activities). '</span>'; ?></div> |
| 22 | </div> |
| 23 | <div class="mobile-table-actions-trigger"><i class="latepoint-icon latepoint-icon-more-horizontal"></i></div> |
| 24 | <div class="table-actions"> |
| 25 | <a data-os-success-action="reload" data-os-params="<?php echo esc_attr(OsUtilHelper::build_os_params([], 'clear_activities')); ?>" data-os-action="<?php echo esc_attr(OsRouterHelper::build_route_name('activities', 'clear_all')); ?>" data-os-prompt="<?php esc_attr_e('Are you sure you want to clear the activities log?', 'latepoint'); ?>" href="#" class="latepoint-btn latepoint-btn-outline latepoint-btn-danger latepoint-btn-sm"><i class="latepoint-icon latepoint-icon-trash"></i><span><?php esc_html_e('Clear All', 'latepoint'); ?></span></a> |
| 26 | <a |
| 27 | class="latepoint-btn latepoint-btn-outline latepoint-btn-sm" |
| 28 | href="<?php echo esc_url( |
| 29 | OsRouterHelper::build_admin_post_link( |
| 30 | ['activities', 'export'], |
| 31 | ['_wpnonce' => wp_create_nonce('export_activities')] |
| 32 | ) |
| 33 | ); ?>" |
| 34 | target="_blank"> |
| 35 | <i class="latepoint-icon latepoint-icon-download"></i> |
| 36 | <span><?php esc_html_e('Export', 'latepoint'); ?></span> |
| 37 | </a> |
| 38 | </div> |
| 39 | </div> |
| 40 | <div class="activities-index"> |
| 41 | <div class="os-scrollable-table-w"> |
| 42 | <div class="os-table-w os-table-compact"> |
| 43 | <table class="os-table os-reload-on-booking-update os-scrollable-table" data-route="<?php echo esc_attr(OsRouterHelper::build_route_name('activities', 'index')); ?>"> |
| 44 | <thead> |
| 45 | <tr> |
| 46 | <th><?php esc_html_e('Type', 'latepoint'); ?></th> |
| 47 | <th><?php esc_html_e('Action By', 'latepoint'); ?></th> |
| 48 | <th><?php esc_html_e('Date/Time', 'latepoint'); ?></th> |
| 49 | </tr> |
| 50 | <tr> |
| 51 | <th><?php echo OsFormHelper::select_field('filter[code]', false, OsActivitiesHelper::get_codes(), '', ['placeholder' => __('All Types', 'latepoint'),'class' => 'os-table-filter']); ?></th> |
| 52 | <th><?php echo OsFormHelper::text_field('filter[initiated_by_id]', false, '', ['placeholder' => __('User ID', 'latepoint'), 'class' => 'os-table-filter']); ?></th> |
| 53 | <th> |
| 54 | <div class="os-form-group"> |
| 55 | <div class="os-date-range-picker os-table-filter-datepicker" data-can-be-cleared="yes" data-no-value-label="<?php esc_attr_e('Filter By Date', 'latepoint'); ?>" data-clear-btn-label="<?php esc_attr_e('Reset Date Filtering', 'latepoint'); ?>"> |
| 56 | <span class="range-picker-value"><?php esc_html_e('Filter By Date', 'latepoint'); ?></span> |
| 57 | <i class="latepoint-icon latepoint-icon-chevron-down"></i> |
| 58 | <input type="hidden" class="os-table-filter os-datepicker-date-from" name="filter[created_at_from]" value=""/> |
| 59 | <input type="hidden" class="os-table-filter os-datepicker-date-to" name="filter[created_at_to]" value=""/> |
| 60 | </div> |
| 61 | </div> |
| 62 | </th> |
| 63 | </tr> |
| 64 | </thead> |
| 65 | <tbody> |
| 66 | <?php include '_table_body.php'; ?> |
| 67 | </tbody> |
| 68 | <tfoot> |
| 69 | <tr> |
| 70 | <th><?php esc_html_e('Type', 'latepoint'); ?></th> |
| 71 | <th><?php esc_html_e('Action By', 'latepoint'); ?></th> |
| 72 | <th><?php esc_html_e('Date/Time', 'latepoint'); ?></th> |
| 73 | </tr> |
| 74 | </tfoot> |
| 75 | </table> |
| 76 | </div> |
| 77 | </div> |
| 78 | <div class="os-pagination-w"> |
| 79 | <div class="pagination-info"><?php echo esc_html__('Showing activities', 'latepoint'). ' <span class="os-pagination-from">'. esc_html($showing_from) . '</span> '.esc_html__('to', 'latepoint').' <span class="os-pagination-to">'. esc_html($showing_to) .'</span> '.esc_html__('of', 'latepoint').' <span class="os-pagination-total">'. esc_html($total_activities). '</span>'; ?></div> |
| 80 | <div class="pagination-page-select-w"> |
| 81 | <label for="tablePaginationPageSelector"><?php esc_html_e('Page:', 'latepoint'); ?></label> |
| 82 | <select id="tablePaginationPageSelector" name="page" class="pagination-page-select"> |
| 83 | <?php |
| 84 | for($i = 1; $i <= $total_pages; $i++){ |
| 85 | $selected = ($current_page_number == $i) ? 'selected' : ''; |
| 86 | echo '<option '.esc_attr($selected).'>'.esc_html($i).'</option>'; |
| 87 | } ?> |
| 88 | </select> |
| 89 | </div> |
| 90 | </div> |
| 91 | </div> |
| 92 | </div> |
| 93 | <?php }else{ ?> |
| 94 | <div class="no-results-w"> |
| 95 | <div class="icon-w"><i class="latepoint-icon latepoint-icon-bell"></i></div> |
| 96 | <h2><?php esc_html_e('No Activity', 'latepoint'); ?></h2> |
| 97 | </div> |
| 98 | <?php } ?> |