function gdlrs_register_room_item($page_builder = array()) { global $gdlr_spaces; $page_builder['content-item']['options']['hostel-room'] = array('title' => __('Hostel Room', 'gdlr-hotel'), 'type' => 'item', 'options' => array_merge(gdlr_page_builder_title_option(__('View all rooms', 'gdlr-hotel')), array('category' => array('title' => __('Category', 'gdlr-hotel'), 'type' => 'multi-combobox', 'options' => gdlr_get_term_list('hostel_room_category'), 'description' => __('You can use Ctrl/Command button to select multiple categories or remove the selected category. <br><br> Leave this field blank to select all categories.', 'gdlr-hotel')), 'tag' => array('title' => __('Tag', 'gdlr-hotel'), 'type' => 'multi-combobox', 'options' => gdlr_get_term_list('hostel_room_tag'), 'description' => __('Will be ignored when the room filter option is enabled.', 'gdlr-hotel')), 'room-style' => array('title' => __('Room Style', 'gdlr-hotel'), 'type' => 'combobox', 'options' => array('classic' => __('Classic', 'gdlr-hotel'), 'classic-no-space' => __('Classic No Space', 'gdlr-hotel'), 'modern' => __('Modern', 'gdlr-hotel'), 'modern-no-space' => __('Modern No Space', 'gdlr-hotel'), 'medium' => __('Medium Thumbnail', 'gdlr-hotel'))), 'enable-carousel' => array('title' => __('Room Carousel', 'gdlr-hotel'), 'type' => 'checkbox', 'wrapper-class' => 'room-style-wrapper modern-wrapper modern-no-space-wrapper classic-wrapper classic-no-space-wrapper'), 'room-size' => array('title' => __('Room Column Size', 'gdlr-hotel'), 'type' => 'combobox', 'options' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4'), 'default' => 3, 'wrapper-class' => 'room-style-wrapper classic-wrapper classic-no-space-wrapper modern-wrapper modern-no-space-wrapper'), 'num-fetch' => array('title' => __('Num Fetch', 'gdlr-hotel'), 'type' => 'text', 'default' => '8', 'description' => __('Specify the number of rooms you want to pull out.', 'gdlr-hotel')), 'num-excerpt' => array('title' => __('Num Excerpt', 'gdlr-hotel'), 'type' => 'text', 'default' => '20', 'wrapper-class' => 'room-style-wrapper medium-wrapper'), 'thumbnail-size' => array('title' => __('Thumbnail Size', 'gdlr-hotel'), 'type' => 'combobox', 'options' => gdlr_get_thumbnail_list(), 'description' => __('Only effects to <strong>standard and gallery post format</strong>', 'gdlr-hotel')), 'orderby' => array('title' => __('Order By', 'gdlr-hotel'), 'type' => 'combobox', 'options' => array('date' => __('Publish Date', 'gdlr-hotel'), 'title' => __('Title', 'gdlr-hotel'), 'rand' => __('Random', 'gdlr-hotel'))), 'order' => array('title' => __('Order', 'gdlr-hotel'), 'type' => 'combobox', 'options' => array('desc' => __('Descending Order', 'gdlr-hotel'), 'asc' => __('Ascending Order', 'gdlr-hotel'))), 'pagination' => array('title' => __('Enable Pagination', 'gdlr-hotel'), 'type' => 'checkbox'), 'margin-bottom' => array('title' => __('Margin Bottom', 'gdlr-hotel'), 'type' => 'text', 'default' => $gdlr_spaces['bottom-blog-item'], 'description' => __('Spaces after ending of this item', 'gdlr-hotel'))))); $page_builder['content-item']['options']['hostel-room-category'] = array('title' => __('Hostel Room Category / Branches', 'gdlr-hotel'), 'type' => 'item', 'options' => array_merge(gdlr_page_builder_title_option(__('View All Branches', 'gdlr-hotel')), array('category' => array('title' => __('Select Category to Display', 'gdlr-hotel'), 'type' => 'multi-combobox', 'options' => gdlr_get_term_id_list('hostel_room_category'), 'description' => __('Will be ignored when the room filter option is enabled.', 'gdlr-hotel')), 'item-size' => array('title' => __('Item Column Size', 'gdlr-hotel'), 'type' => 'combobox', 'options' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4'), 'default' => 3, 'wrapper-class' => 'room-style-wrapper classic-wrapper modern-wrapper'), 'thumbnail-size' => array('title' => __('Thumbnail Size', 'gdlr-hotel'), 'type' => 'combobox', 'options' => gdlr_get_thumbnail_list(), 'description' => __('Only effects to <strong>standard and gallery post format</strong>', 'gdlr-hotel')), 'margin-bottom' => array('title' => __('Margin Bottom', 'gdlr-hotel'), 'type' => 'text', 'default' => $gdlr_spaces['bottom-blog-item'], 'description' => __('Spaces after ending of this item', 'gdlr-hotel'))))); return $page_builder; }
function gdlr_create_service_options() { if (!class_exists('gdlr_page_options')) { return; } $branches = array(); global $hotel_option; if (!empty($hotel_option['enable-hotel-branch']) && $hotel_option['enable-hotel-branch'] == 'enable') { $branches = array_merge($branches, array('branches' => array('title' => __('Assign to Hotel Branches', 'gdlr-hotel'), 'type' => 'multi-combobox', 'options' => gdlr_get_term_id_list('room_category'), 'custom_field' => 'gdlr-branches'))); } global $hostel_option; if (!empty($hostel_option['enable-hotel-branch']) && $hostel_option['enable-hotel-branch'] == 'enable') { $branches = array_merge($branches, array('hostel-branches' => array('title' => __('Assign to Hostel Branches', 'gdlr-hotel'), 'type' => 'multi-combobox', 'options' => gdlr_get_term_id_list('hostel_room_category'), 'custom_field' => 'gdlr-hostel-branches'))); } new gdlr_page_options(array('post_type' => array('service'), 'meta_title' => __('Goodlayers Service Option', 'gdlr-hotel'), 'meta_slug' => 'goodlayers-page-option', 'option_name' => 'post-option', 'position' => 'normal', 'priority' => 'high'), array('page-layout' => array('title' => __('Option', 'gdlr-hotel'), 'options' => array_merge(array('service-type' => array('title' => __('Service Type', 'gdlr-hotel'), 'type' => 'combobox', 'options' => array('regular-service' => __('Regular Service', 'gdlr-hotel'), 'parking-service' => __('Parking Service', 'gdlr-hotel'))), 'price' => array('title' => __('Price (*Only Number)', 'gdlr-hotel'), 'type' => 'text', 'wrapper-class' => 'four columns'), 'per' => array('title' => __('Per', 'gdlr-hotel'), 'type' => 'combobox', 'options' => array('guest' => __('Guest', 'gdlr-hotel'), 'room' => __('Room', 'gdlr-hotel'), 'group' => __('Group', 'gdlr-hotel')), 'wrapper-class' => 'service-type-wrapper regular-service-wrapper four columns no-action'), 'car' => array('title' => __('Per', 'gdlr-hotel'), 'type' => 'combobox', 'options' => array('car' => __('Car', 'gdlr-hotel'), 'group' => __('Group', 'gdlr-hotel')), 'wrapper-class' => 'service-type-wrapper parking-service-wrapper four columns no-action'), 'unit' => array('title' => __('Per', 'gdlr-hotel'), 'type' => 'combobox', 'options' => array('night' => __('Night', 'gdlr-hotel'), 'trip' => __('Trip', 'gdlr-hotel')), 'wrapper-class' => 'four columns'), 'clear-1' => array('type' => 'clear')), $branches)))); }
function gdlrs_get_reservation_branch_combobox($option, $min_num = 0, $max_num = 10) { $branches = gdlr_get_term_id_list('hostel_room_category'); $ret = '<div class="gdlr-reservation-field gdlr-resv-branches-combobox">'; $ret .= '<span class="gdlr-reservation-field-title">' . $option['title'] . '</span>'; $ret .= '<div class="gdlr-combobox-wrapper">'; $ret .= '<select name="' . $option['slug'] . '" '; $ret .= !empty($option['id']) ? 'id="' . $option['id'] . '" >' : '>'; $ret .= '<option value="" >' . __('Please select hotel branch', 'gdlr-hotel') . '</option>'; foreach ($branches as $slug => $branch) { $ret .= '<option value="' . $slug . '" ' . (!empty($option['value']) && $slug == $option['value'] ? 'selected' : '') . ' >' . $branch . '</option>'; } $ret .= '</select>'; $ret .= '</div>'; // gdlr-combobox-wrapper $ret .= '<div id="please-select-branches" >' . __('* Please select branch', 'gdlr-hotel') . '</div>'; $ret .= '</div>'; return $ret; }
function gdlr_hotel_transaction_option() { global $hotel_option; gdlr_apply_hotel_transaction(); $keyword = empty($_GET['keyword']) ? '' : $_GET['keyword']; $search_by = empty($_GET['search-by']) ? '' : $_GET['search-by']; $sel_branch = empty($_GET['hotel-branches']) ? '' : $_GET['hotel-branches']; $status = empty($_GET['type']) ? 'new' : $_GET['type']; ?> <div class="gdlr-transaction-wrapper"> <h3><?php _e('Booking List : Deposit Paid', 'gdlr-hotel'); ?> </h3> <form class="gdlr-transaction-form" method="GET" action=""> <div class="gdlr-transaction-row"> <span class="gdlr-transaction-head"><?php _e('Search Transaction By :', 'gdlr-lms'); ?> </span> <div class="gdlr-combobox-wrapper"> <select name="search-by" > <option value="contact" <?php echo $search_by == 'contact' ? 'selected' : ''; ?> ><?php _e('Contact', 'gdlr-hotel'); ?> </option> <option value="room" <?php echo $search_by == 'room' ? 'selected' : ''; ?> ><?php _e('Room ID', 'gdlr-hotel'); ?> </option> <option value="code" <?php echo $search_by == 'code' ? 'selected' : ''; ?> ><?php _e('Code', 'gdlr-hotel'); ?> </option> </select> </div> </div> <?php if (!empty($hotel_option['enable-hotel-branch']) && $hotel_option['enable-hotel-branch'] == 'enable') { ?> <div class="gdlr-transaction-row"> <span class="gdlr-transaction-head"><?php _e('Hotel Branches :', 'gdlr-lms'); ?> </span> <div class="gdlr-combobox-wrapper"> <select name="hotel-branches" > <option value=""><?php _e('All', 'gdlr-hotel'); ?> </option> <?php $branches = gdlr_get_term_id_list('room_category'); foreach ($branches as $slug => $branch) { echo '<option value="' . $slug . '" ' . ($slug == $sel_branch ? 'selected' : '') . '>' . $branch . '</option>'; } ?> </select> </div> </div> <?php } ?> <div class="gdlr-transaction-row"> <input type="hidden" name="page" value="hotel-transaction" /> <span class="gdlr-transaction-head"><?php _e('Keywords :', 'gdlr-hotel'); ?> </span> <input class="gdlr-transaction-keyword" type="text" name="keyword" value="<?php echo esc_attr($keyword); ?> " /> <input type="submit" value="<?php _e('Search!', 'gdlr-hotel'); ?> " /> </div> </form> <?php $query_arg = $_GET; ?> <div class="gdlr-transaction-type"> <a class="gdlr-button <?php echo $status == 'new' ? 'gdlr-active' : ''; ?> " href="<?php $query_arg['type'] = 'new'; echo esc_url(add_query_arg($query_arg)); ?> " ><?php _e('Show new booking', 'gdlr-hotel'); ?> </a> <a class="gdlr-button <?php echo $status == 'read' ? 'gdlr-active' : ''; ?> " href="<?php $query_arg['type'] = 'read'; echo esc_url(add_query_arg($query_arg)); ?> " ><?php _e('Show read booking', 'gdlr-hotel'); ?> </a> </div> <form class="gdlr-transaction-table" method="post" > <input type="hidden" name="transaction-type" value="" /> <div class="transaction-bulk"> <span class="transaction-bulk-title"><?php _e('Bulk Action :', 'gdlr-hotel'); ?> </span> <?php if ($status == 'new') { echo '<span class="transaction-bulk-read">' . __('Mark as read') . '</span>'; } else { echo '<span class="transaction-bulk-unread">' . __('Mark as unread') . '</span>'; } ?> | <span class="transaction-bulk-cancel"><?php _e('Cancel Booking', 'gdlr-hotel'); ?> </span> </div> <table> <tr> <th><input id="bulk-select" type="checkbox" /><?php _e('id', 'gdlr-hotel'); ?> </th> <th><?php _e('Name', 'gdlr-hotel'); ?> </th> <th><?php _e('Contact', 'gdlr-hotel'); ?> </th> <th><?php _e('Room', 'gdlr-hotel'); ?> </th> <th><?php _e('Payment', 'gdlr-hotel'); ?> </th> <th><?php _e('Type', 'gdlr-hotel'); ?> </th> <th><?php _e('Code', 'gdlr-hotel'); ?> </th> <th><?php _e('Action', 'gdlr-hotel'); ?> </th> </tr> <?php global $wpdb; $temp_sql = "SELECT * FROM {$wpdb->prefix}gdlr_hotel_payment "; $temp_sql .= "WHERE payment_status != 'pending' "; if (!empty($keyword)) { if ($search_by == 'contact') { $temp_sql .= 'AND contact_info LIKE \'%' . $keyword . '%\' '; } else { if ($search_by == 'room') { $temp_sql .= 'AND booking_data LIKE \'%' . $keyword . '%\' '; } else { if ($search_by == 'code') { $temp_sql .= 'AND customer_code LIKE \'%' . $keyword . '%\' '; } } } } if ($status == 'read') { $temp_sql .= 'AND read_status = \'read\' '; } else { $temp_sql .= 'AND (read_status = \'\' OR read_status IS NULL) '; } $temp_sql .= "ORDER BY id desc"; $results = $wpdb->get_results($temp_sql); // filter result for hotel branches if (!empty($sel_branch)) { foreach ($results as $slug => $result) { $data = unserialize($result->booking_data); if (empty($data['gdlr-hotel-branches']) || $data['gdlr-hotel-branches'] != $sel_branch) { unset($results[$slug]); } } } global $hotel_option; $record_num = count($results); $current_page = empty($_GET['paged']) ? 1 : intval($_GET['paged']); $record_per_page = empty($hotel_option['transaction-per-page']) ? 30 : intval($hotel_option['transaction-per-page']); $max_num_page = ceil($record_num / $record_per_page); for ($i = $record_per_page * ($current_page - 1); $i < $record_num && $i < $record_per_page * $current_page; $i++) { $result = $results[$i]; $data = unserialize($result->booking_data); $contact = unserialize($result->contact_info); echo '<tr>'; // col 12 echo '<td><input type="checkbox" name="tid[]" value="' . $result->id . '" >' . $result->id . '</td>'; echo '<td>' . esc_html($contact['first_name']) . ' ' . esc_html($contact['last_name']) . '</td>'; // col 345 echo '<td><a href="#" class="transaction-open-detail">' . __('Detail', 'gdlr-hotel') . '</a>' . get_transaction_contact($contact) . '</td>'; echo '<td><a href="#" class="transaction-open-detail">' . __('Detail', 'gdlr-hotel') . '</a>' . get_transaction_room($data) . '</td>'; echo '<td><a href="#" class="transaction-open-detail">' . __('Detail', 'gdlr-hotel') . '</a>' . get_transaction_payment($result, $contact) . '</td>'; // col 6 echo '<td>'; if ($result->payment_status == 'booking') { _e('Booking', 'gdlr-hotel'); } else { if ($result->payment_status == 'paid') { if ($result->total_price == $result->pay_amount) { _e('Full Amount', 'gdlr-hotel'); } else { _e('Deposit', 'gdlr-hotel'); } } else { echo $result->payment_status; } } echo '</td>'; // col 7 echo '<td>' . $result->customer_code . '</td>'; // col 8 echo '<td>'; if ($status == 'new') { echo '<a href="#" class="gdlr-mark-as-read">' . __('Mark as read', 'gdlr-hotel') . '</a>'; } else { echo '<a href="#" class="gdlr-mark-as-unread">' . __('Mark as unread', 'gdlr-hotel') . '</a>'; } if ($result->payment_status == 'booking') { echo ' / <a href="#" class="gdlr-mark-as-paid">' . __('Mark as paid', 'gdlr-hotel') . '</a>'; } else { echo ' / <a href="#" class="gdlr-mark-as-booking">' . __('Mark as booking', 'gdlr-hotel') . '</a>'; } echo '</td>'; echo '</tr>'; } ?> </table> <?php // print pagination if ($max_num_page > 1) { $page_var = $_GET; echo '<div class="gdlr-transaction-pagination">'; if ($current_page > 1) { $page_var['paged'] = intval($current_page) - 1; echo '<a class="prev page-numbers" href="' . esc_url(add_query_arg($page_var)) . '" >'; echo __('‹ Previous', 'gdlr-lms') . '</a>'; } for ($i = 1; $i <= $max_num_page; $i++) { $page_var['paged'] = $i; if ($i == $current_page) { echo '<span class="page-numbers current" href="' . esc_url(add_query_arg($page_var)) . '" >' . $i . '</span>'; } else { echo '<a class="page-numbers" href="' . esc_url(add_query_arg($page_var)) . '" >' . $i . '</a>'; } } if ($current_page < $max_num_page) { $page_var['paged'] = intval($current_page) + 1; echo '<a class="next page-numbers" href="' . esc_url(add_query_arg($page_var)) . '" >'; echo __('Next ›', 'gdlr-lms') . '</a>'; } echo '</div>'; } ?> </form> </div> <?php }