do_action('ct_payment_update_booking_no_row'); } else { do_action('ct_payment_update_booking_success'); } } } } if (empty($order_data['deposit_paid'])) { do_action('ct_order_deposit_payment_not_paid', $order_data); // deposit payment not paid } if (empty($order_data['mail_sent'])) { do_action('ct_order_conf_mail_not_sent', $order_data); // mail is not sent } $order_rooms = $order->get_rooms(); ?> <div class="row"> <div class="col-md-8"> <div class="form_title"> <h3><strong><i class="icon-ok"></i></strong><?php echo esc_html__('Thank you!', 'citytours'); ?> </h3> <p><?php echo esc_html__('Your Booking Order is Confirmed Now.', 'citytours'); ?> </p> </div> <div class="step">
function ct_hotel_order_render_manage_page() { global $wpdb, $ct_options; if (!empty($_POST['save'])) { ct_hotel_order_save_action(); return; } $order_data = array(); $room_data = array(); $service_data = array(); if ('edit' == $_REQUEST['action']) { if (empty($_REQUEST['order_id'])) { echo "<h2>" . esc_html__("You attempted to edit an item that doesn't exist. Perhaps it was deleted?", "ct") . "</h2>"; return; } $order_id = $_REQUEST['order_id']; $post_table_name = $wpdb->prefix . 'posts'; $order = new CT_Hotel_Order($order_id); $order_data = $order->get_order_info(); $room_data = $order->get_rooms(); $service_data = $order->get_services(); if (empty($order_data)) { echo "<h2>" . esc_html__("You attempted to edit an item that doesn't exist. Perhaps it was deleted?", "ct") . "</h2>"; return; } } $default_order_data = ct_order_default_order_data(); $order_data = array_replace($default_order_data, $order_data); $site_currency_symbol = ct_get_site_currency_symbol(); ?> <div class="wrap"> <?php $page_title = 'edit' == $_REQUEST['action'] ? 'Edit Hotel Order<a href="edit.php?post_type=hotel&page=orders&action=add" class="add-new-h2">Add New</a>' : 'Add New Hotel Order'; ?> <h2><?php echo wp_kses_post($page_title); ?> </h2> <?php if (isset($_REQUEST['updated'])) { echo '<div id="message" class="updated below-h2"><p>Order saved</p></div>'; } ?> <form method="post" id="order-form" onsubmit="return manage_order_validateForm();" data-message="<?php echo esc_attr(esc_html__('Please select a hotel', 'citytours')); ?> "> <input type="hidden" name="id" value="<?php echo esc_attr($order_data['id']); ?> "> <div class="row postbox"> <div class="one-half"> <h3><?php echo esc_html__('Order Detail', 'citytours'); ?> </h3> <table class="ct_admin_table ct_order_manage_table"> <tr> <th><?php echo esc_html__('Hotel', 'citytours'); ?> </th> <td> <select name="post_id" id="post_id"> <option></option> <?php $args = array('post_type' => 'hotel', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC'); if (!current_user_can('manage_options')) { $args['author'] = get_current_user_id(); } $hotel_query = new WP_Query($args); if ($hotel_query->have_posts()) { while ($hotel_query->have_posts()) { $hotel_query->the_post(); $selected = ''; $id = $hotel_query->post->ID; if ($order_data['post_id'] == $id) { $selected = ' selected '; } echo '<option ' . esc_attr($selected) . 'value="' . esc_attr($id) . '">' . wp_kses_post(get_the_title($id)) . '</option>'; } } wp_reset_postdata(); ?> </select> </td> </tr> <tr> <th><?php echo esc_html__('Date From', 'citytours'); ?> </th> <td><input type="text" name="date_from" id="date_from" value="<?php echo esc_attr($order_data['date_from']); ?> "></td> </tr> <tr> <th><?php echo esc_html__('Date To', 'citytours'); ?> </th> <td><input type="text" name="date_to" id="date_to" value="<?php if ($order_data['date_to'] != '9999-12-31') { echo esc_attr($order_data['date_to']); } ?> "></td> </tr> <tr> <th><?php echo esc_html__('Total Adults', 'citytours'); ?> </th> <td><input type="number" name="total_adults" value="<?php echo esc_attr($order_data['total_adults']); ?> "></td> </tr> <tr> <th><?php echo esc_html__('Total Children', 'citytours'); ?> </th> <td><input type="number" name="total_kids" value="<?php echo esc_attr($order_data['total_kids']); ?> "></td> </tr> <tr> <th><?php echo esc_html__('Total Price', 'citytours'); ?> </th> <td><input type="text" name="total_price" value="<?php echo esc_attr($order_data['total_price']); ?> "> <?php echo esc_html($site_currency_symbol); ?> </td> </tr> <?php if (ct_is_multi_currency()) { ?> <tr> <th><?php echo esc_html__('User Currency', 'citytours'); ?> </th> <td> <select name="currency_code"> <?php foreach (array_filter($ct_options['site_currencies']) as $key => $content) { ?> <option value="<?php echo esc_attr($key); ?> " <?php selected($key, $order_data['currency_code']); ?> ><?php echo esc_html($key); ?> </option> <?php } ?> </select> </td> </tr> <tr> <th><?php echo esc_html__('Exchange Rate', 'citytours'); ?> </th> <td><input type="text" name="exchange_rate" value="<?php echo esc_attr($order_data['exchange_rate']); ?> "></td> </tr> <tr> <th><?php echo esc_html__('Total Price in User Currency', 'citytours'); ?> </th> <td><label> <?php if (!empty($order_data['total_price']) && !empty($order_data['exchange_rate'])) { echo esc_html($order_data['total_price'] * $order_data['exchange_rate']) . esc_html(ct_get_currency_symbol($order_data['currency_code'])); } ?> </td> </tr> <?php } ?> <tr> <th><?php echo esc_html__('Deposit Amount', 'citytours'); ?> </th> <td><input type="text" name="deposit_price" value="<?php echo esc_attr($order_data['deposit_price']); ?> "> <?php echo esc_html(ct_get_currency_symbol($order_data['currency_code'])); ?> </td> </tr> <?php if ('add' == $_REQUEST['action'] || !empty($order_data['deposit_price']) && !($order_data['deposit_price'] == 0)) { ?> <tr> <th><?php echo esc_html__('Deposit Paid', 'citytours'); ?> </th> <td> <select name="deposit_paid"> <?php $deposit_paid = array('1' => esc_html__('yes', 'citytours'), '0' => esc_html__('no', 'citytours')); ?> <?php foreach ($deposit_paid as $key => $content) { ?> <option value="<?php echo esc_attr($key); ?> " <?php selected($key, $order_data['deposit_paid']); ?> ><?php echo esc_html($content); ?> </option> <?php } ?> </select> </td> </tr> <?php if (!empty($order_data['deposit_paid'])) { $other_data = unserialize($order_data['other']); if (!empty($other_data['pp_transaction_id'])) { ?> <tr> <th><?php echo esc_html__('Paypal Payment Transaction ID', 'citytours'); ?> </th> <td><label><?php echo esc_html($other_data['pp_transaction_id']); ?> </label></td> </tr> <?php } } ?> <?php } else { ?> <input type="hidden" name="deposit_paid" value="1"> <?php } ?> <tr> <th><?php echo esc_html__('Status', 'citytours'); ?> </th> <td> <select name="status"> <?php $statuses = array('new' => esc_html__('New', 'citytours'), 'confirmed' => esc_html__('Confirmed', 'citytours'), 'cancelled' => esc_html__('Cancelled', 'citytours'), 'pending' => esc_html__('Pending', 'citytours')); if (!isset($order_data['status'])) { $order_data['status'] = 'new'; } ?> <?php foreach ($statuses as $key => $content) { ?> <option value="<?php echo esc_attr($key); ?> " <?php selected($key, $order_data['status']); ?> ><?php echo esc_html($content); ?> </option> <?php } ?> </select> </td> </tr> </table> </div> <div class="one-half"> <h3><?php echo esc_html__('Customer Infomation', 'citytours'); ?> </h3> <table class="ct_admin_table ct_order_manage_table"> <tr> <th><?php echo esc_html__('First Name', 'citytours'); ?> </th> <td><input type="text" name="first_name" value="<?php echo esc_attr($order_data['first_name']); ?> "></td> </tr> <tr> <th><?php echo esc_html__('Last Name', 'citytours'); ?> </th> <td><input type="text" name="last_name" value="<?php echo esc_attr($order_data['last_name']); ?> "></td> </tr> <tr> <th><?php echo esc_html__('Email', 'citytours'); ?> </th> <td><input type="email" name="email" value="<?php echo esc_attr($order_data['email']); ?> "></td> </tr> <tr> <th><?php echo esc_html__('Phone', 'citytours'); ?> </th> <td><input type="text" name="phone" value="<?php echo esc_attr($order_data['phone']); ?> "></td> </tr> <tr> <th><?php echo esc_html__('Street line 1', 'citytours'); ?> </th> <td><input type="text" name="address1" value="<?php echo esc_attr($order_data['address1']); ?> "></td> </tr> <tr> <th><?php echo esc_html__('Street line 2', 'citytours'); ?> </th> <td><input type="text" name="address2" value="<?php echo esc_attr($order_data['address2']); ?> "></td> </tr> <tr> <th><?php echo esc_html__('City', 'citytours'); ?> </th> <td><input type="text" name="city" value="<?php echo esc_attr($order_data['city']); ?> "></td> </tr> <tr> <th><?php echo esc_html__('State', 'citytours'); ?> </th> <td><input type="text" name="state" value="<?php echo esc_attr($order_data['state']); ?> "></td> </tr> <tr> <th><?php echo esc_html__('Postal Code', 'citytours'); ?> </th> <td><input type="text" name="zip" value="<?php echo esc_attr($order_data['zip']); ?> "></td> </tr> <tr> <th><?php echo esc_html__('Country', 'citytours'); ?> </th> <td><input type="text" name="country" value="<?php echo esc_attr($order_data['country']); ?> "></td> </tr> <tr> <th><?php echo esc_html__('Special Requirements', 'citytours'); ?> </th> <td><textarea name="special_requirements"><?php echo esc_textarea(stripslashes($order_data['special_requirements'])); ?> </textarea></td> </tr> <tr> <th><?php echo esc_html__('Booking No', 'citytours'); ?> </th> <td><input type="text" name="booking_no" value="<?php echo esc_attr($order_data['booking_no']); ?> "></td> </tr> <tr> <th><?php echo esc_html__('Pin Code', 'citytours'); ?> </th> <td><input type="text" name="pin_code" value="<?php echo esc_attr($order_data['pin_code']); ?> "></td> </tr> </table> </div> </div> <div class="row postbox ct-order-rooms"> <h3><?php echo esc_html__('Order Rooms Detail', 'citytours'); ?> </h3> <div class="rooms-wrapper"> <table class="rooms-table"><tbody class="clone-wrapper"> <tr class="clone-field"> <th><?php echo esc_html__('Title', 'citytours'); ?> </th> <th><?php echo esc_html__('Rooms', 'citytours'); ?> </th> <th><?php echo esc_html__('Adults', 'citytours'); ?> </th> <th><?php echo esc_html__('Childs', 'citytours'); ?> </th> <th><?php echo esc_html__('Total Price', 'citytours'); ?> </th> <th> </th> </tr> <?php if (empty($room_data)) { ?> <tr class="clone-field"> <td> <input type="hidden" name="room_booking_id[0]" value=""> <select name="room_post_id[0]" class="room_hotel_id_select"> <?php echo ct_hotel_get_room_list($order_data['post_id']); ?> </select> </td> <td><input type="text" name="room_rooms[0]"></td> <td><input type="text" name="room_adults[0]"></td> <td><input type="text" name="room_kids[0]"></td> <td><input type="text" name="room_total_price[0]"></td> <td><a href="#" class="rwmb-button button remove-clone" style="display: none;">-</a></td> </tr> <?php } else { ?> <?php foreach ($room_data as $key => $room) { ?> <tr class="clone-field"> <td> <input type="hidden" name="room_booking_id[<?php echo esc_attr($key); ?> ]" value="<?php echo esc_attr($room['id']); ?> "> <select name="room_post_id[<?php echo esc_attr($key); ?> ]" class="room_hotel_id_select"> <?php echo ct_hotel_get_room_list($order_data['post_id'], $room['room_type_id']); ?> </select> </td> <td><input type="text" name="room_rooms[<?php echo esc_attr($key); ?> ]" value="<?php echo esc_attr($room['rooms']); ?> "></td> <td><input type="text" name="room_adults[<?php echo esc_attr($key); ?> ]" value="<?php echo esc_attr($room['adults']); ?> "></td> <td><input type="text" name="room_kids[<?php echo esc_attr($key); ?> ]" value="<?php echo esc_attr($room['kids']); ?> "></td> <td><input type="text" name="room_total_price[<?php echo esc_attr($key); ?> ]" value="<?php echo esc_attr($room['total_price']); ?> "></td> <td><a href="#" class="rwmb-button button remove-clone" style="display: none;">-</a></td> </tr> <?php } ?> <?php } ?> <tr><td colspan="6"><a href="#" class="rwmb-button button-primary add-clone">+</a></td></tr> </tbody></table> </div> </div> <div class="row postbox ct-order-services"> <h3><?php echo esc_html__('Order Services Detail', 'citytours'); ?> </h3> <div class="services-wrapper"> <table class="services-table"><tbody class="clone-wrapper"> <tr class="rwmb-field"> <th><?php echo esc_html__('Title', 'citytours'); ?> </th> <th><?php echo esc_html__('Qty', 'citytours'); ?> </th> <th><?php echo esc_html__('Total Price', 'citytours'); ?> </th> <th> </th> </tr> <?php if (empty($service_data)) { ?> <tr class="clone-field"> <td> <input type="hidden" name="service_booking_id[0]" value=""> <select name="service_id[0]" class="service_id_select"> <?php echo ct_get_service_list($order_data['post_id']); ?> </select> </td> <td><input type="text" name="service_qty[0]"></td> <td><input type="text" name="service_price[0]"></td> <td><a href="#" class="rwmb-button button remove-clone" style="display: none;">-</a></td> </tr> <?php } else { ?> <?php foreach ($service_data as $key => $service) { ?> <tr class="clone-field"> <td> <input type="hidden" name="service_booking_id[<?php echo esc_attr($key); ?> ]" value="<?php echo esc_attr($service['id']); ?> "> <select name="service_id[<?php echo esc_attr($key); ?> ]" class="service_id_select"> <?php echo ct_get_service_list($order_data['post_id'], $service['add_service_id']); ?> </select> </td> <td><input type="text" name="service_qty[<?php echo esc_attr($key); ?> ]" value="<?php echo esc_attr($service['qty']); ?> "></td> <td><input type="text" name="service_price[<?php echo esc_attr($key); ?> ]" value="<?php echo esc_attr($service['total_price']); ?> "></td> <td><a href="#" class="rwmb-button button remove-clone">-</a></td> </tr> <?php } ?> <?php } ?> <tr><td colspan="5"><a href="#" class="rwmb-button button-primary add-clone">+</a></td></tr> </tbody></table> </div> </div> <input type="submit" class="button-primary button_save_order" name="save" value="Save order"> <a href="edit.php?post_type=hotel&page=orders" class="button-secondary">Cancel</a> <?php wp_nonce_field('ct_manage_orders', 'order_save'); ?> </form> </div> <?php if (!empty($ct_options['vld_credit_card']) && !empty($ct_options['cc_off_charge']) && !empty($order_data['other'])) { $cc_fields = array('cc_type' => 'CREDIT CARD TYPE', 'cc_holder_name' => 'CARD HOLDER NAME', 'cc_number' => 'CARD NUMBER', 'cc_cid' => 'CARD IDENTIFICATION NUMBER', 'cc_exp_year' => 'EXPIRATION YEAR', 'cc_exp_month' => 'EXPIRATION MONTH'); $cc_infos = unserialize($order_data['other']); echo '<style>.cc_table{background:#fff;margin-top:30px;}.cc_table td{padding:10px;}.cc_table,.cc_table tr,.cc_table td{border:1px solid #000; border-collapse: collapse;}</style>'; echo '<div style="clear:both"></div><h3>Credit Card Info</h3><table class="cc_table"><tbody>'; foreach ($cc_fields as $key => $label) { if (!empty($cc_infos[$key])) { echo '<tr><td><label>' . $label . '</label></td><td>' . $cc_infos[$key] . '</td></tr>'; } } echo '</tbody></table>'; } }