Example #1
0
 function trav_init_currency()
 {
     global $def_currency, $trav_options;
     if (!empty($_GET['selected_currency'])) {
         if (!array_key_exists($_GET['selected_currency'], $trav_options['site_currencies'])) {
             $_GET['selected_currency'] = $def_currency;
         }
         $_SESSION['user_currency'] = sanitize_text_field($_GET['selected_currency']);
         $_SESSION['exchange_rate'] = trav_currency_converter(1, $def_currency, $_SESSION['user_currency']);
         $_SESSION['currency_symbol'] = trav_get_currency_symbol($_SESSION['user_currency']);
         setcookie("selected_currency", $_SESSION['user_currency'], time() + 3600 * 24 * 365);
         if (is_user_logged_in()) {
             $current_user = wp_get_current_user();
             update_user_meta($current_user->ID, 'selected_currency', $_SESSION['user_currency']);
         }
     }
     //user_currency init
     if (empty($_SESSION['user_currency'])) {
         $user_currency = '';
         if (is_user_logged_in()) {
             $current_user = wp_get_current_user();
             $user_currency = get_user_meta($current_user->ID, 'selected_currency', true);
         }
         if (!empty($user_currency)) {
             $_SESSION['user_currency'] = $user_currency;
         } elseif (isset($_COOKIE['selected_currency'])) {
             $_SESSION['user_currency'] = $_COOKIE['selected_currency'];
         } else {
             $_SESSION['user_currency'] = $def_currency;
         }
     }
     //exchange_rate init
     if (empty($_SESSION['exchange_rate'])) {
         $_SESSION['exchange_rate'] = trav_currency_converter(1, $def_currency, $_SESSION['user_currency']);
     }
     //currency_symbol init
     if (empty($_SESSION['currency_symbol'])) {
         $_SESSION['currency_symbol'] = trav_get_currency_symbol($_SESSION['user_currency']);
     }
 }
    function trav_tour_booking_render_manage_page()
    {
        global $wpdb, $trav_options;
        $post_table_name = $wpdb->prefix . 'posts';
        $site_currency_symbol = trav_get_site_currency_symbol();
        if (!empty($_POST['save'])) {
            trav_tour_booking_save_action();
            return;
        }
        $booking_data = array();
        if ('add' == $_REQUEST['action']) {
            $page_title = "Add New Tour booking";
        } elseif ('edit' == $_REQUEST['action']) {
            $page_title = 'Edit Tour Booking<a href="edit.php?post_type=tour&amp;page=tour_bookings&amp;action=add" class="add-new-h2">Add New</a>';
            if (empty($_REQUEST['booking_id'])) {
                echo "<h2>You attempted to edit an item that doesn't exist. Perhaps it was deleted?</h2>";
                return;
            }
            $booking_id = $_REQUEST['booking_id'];
            $where = 'booking.id = %3$d';
            if (!current_user_can('manage_options')) {
                $where .= " AND tour.post_author = '" . get_current_user_id() . "' ";
            }
            $sql = $wpdb->prepare('SELECT booking.*, tour.ID as tour_id, tour.post_title as tour_name FROM %1$s as booking
									INNER JOIN %2$s as tour ON booking.tour_id=tour.ID
									WHERE ' . $where, TRAV_TOUR_BOOKINGS_TABLE, $post_table_name, $booking_id);
            $booking_data = $wpdb->get_row($sql, ARRAY_A);
            if (empty($booking_data)) {
                echo "<h2>You attempted to edit an item that doesn't exist. Perhaps it was deleted?</h2>";
                return;
            }
        }
        $tour_id = empty($booking_data['tour_id']) ? '' : $booking_data['tour_id'];
        $schedule_types = trav_tour_get_schedule_types($tour_id);
        ?>

		<div class="wrap">
			<h2><?php 
        echo wp_kses_post($page_title);
        ?>
</h2>
			<?php 
        if (isset($_REQUEST['updated'])) {
            echo '<div id="message" class="updated below-h2"><p>Booking saved</p></div>';
        }
        ?>
			<form method="post" onsubmit="return manage_booking_validateForm();">
				<input type="hidden" name="id" value="<?php 
        if (!empty($booking_data['id'])) {
            echo esc_attr($booking_data['id']);
        }
        ?>
">
				<div class="one-half">
					<h3>Booking Detail</h3>
					<table class="trav_admin_table trav_booking_manage_table">
						<tr>
							<th>Tour</th>
							<td>
								<select name="tour_id" id="tour_id">
									<?php 
        echo trav_tour_get_tour_list($booking_data['tour_id']);
        ?>
								</select>
							</td>
						</tr>
						<tr class="schedule_type_wrapper<?php 
        if (empty($schedule_types)) {
            echo ' hide';
        }
        ?>
">
							<th>Schedule Type</th>
							<td>
								<select name="st_id" id="schedule_type">
									<?php 
        echo trav_tour_get_schedule_type_list($booking_data['tour_id'], $booking_data['st_id']);
        ?>
								</select>
							</td>
						</tr>
						<tr>
							<th>Tour Date</th>
							<td><input type="text" name="tour_date" id="tour_date" value="<?php 
        if (!empty($booking_data['tour_date'])) {
            echo esc_attr($booking_data['tour_date']);
        }
        ?>
"></td>
						</tr>
						<tr>
							<th>Adults</th>
							<td><input type="number" name="adults" value="<?php 
        if (!empty($booking_data['adults'])) {
            echo esc_attr($booking_data['adults']);
        }
        ?>
"></td>
						</tr>
						<tr>
							<th>Children</th>
							<td><input type="number" name="kids" value="<?php 
        if (!empty($booking_data['kids'])) {
            echo esc_attr($booking_data['kids']);
        }
        ?>
"></td>
						</tr>
						<tr>
							<th>Total Price</th>
							<td><input type="text" name="total_price" value="<?php 
        if (!empty($booking_data['total_price'])) {
            echo esc_attr($booking_data['total_price']);
        }
        ?>
"> <?php 
        echo esc_html($site_currency_symbol);
        ?>
</td>
						</tr>
						<?php 
        if (trav_is_multi_currency()) {
            ?>
							<tr>
								<th>User Currency</th>
								<td>
									<select name="currency_code">
										<?php 
            foreach (array_filter($trav_options['site_currencies']) as $key => $content) {
                ?>
											<option value="<?php 
                echo esc_attr($key);
                ?>
" <?php 
                if (!empty($booking_data['currency_code'])) {
                    selected($key, $booking_data['currency_code']);
                }
                ?>
><?php 
                echo esc_html($key);
                ?>
</option>
										<?php 
            }
            ?>
									</select>
								</td>
							</tr>
							<tr>
								<th>Exchange Rate</th>
								<td><input type="text" name="exchange_rate" value="<?php 
            if (!empty($booking_data['exchange_rate'])) {
                echo esc_attr($booking_data['exchange_rate']);
            }
            ?>
"></td>
							</tr>
							<tr>
								<th>Total Price in User Currency</th>
								<td><label> <?php 
            if (!empty($booking_data['total_price']) && !empty($booking_data['exchange_rate'])) {
                echo esc_attr($booking_data['total_price'] * $booking_data['exchange_rate']) . esc_html(trav_get_currency_symbol($booking_data['currency_code']));
            }
            ?>
</td>
							</tr>
						<?php 
        }
        ?>
						<?php 
        if (!empty($booking_data['deposit_price']) && !($booking_data['deposit_price'] == 0)) {
            ?>
							<tr>
								<th>Deposit Amount</th>
								<td><input type="text" name="deposit_price" value="<?php 
            if (!empty($booking_data['deposit_price'])) {
                echo esc_attr($booking_data['deposit_price']);
            }
            ?>
"> <?php 
            echo esc_html(trav_get_currency_symbol($booking_data['currency_code']));
            ?>
</td>
							</tr>
							<tr>
								<th>Deposit Paid</th>
								<td>
									<select name="deposit_paid">
										<?php 
            $deposit_paid = array('1' => 'yes', '0' => 'no');
            ?>
										<?php 
            foreach ($deposit_paid as $key => $content) {
                ?>
											<option value="<?php 
                echo esc_attr($key);
                ?>
" <?php 
                selected($key, $booking_data['deposit_paid']);
                ?>
><?php 
                echo esc_html($content);
                ?>
</option>
										<?php 
            }
            ?>
									</select>
								</td>
							</tr>
							<?php 
            if (!empty($booking_data['deposit_paid'])) {
                $other_data = unserialize($booking_data['other']);
                if (!empty($other_data['pp_transaction_id'])) {
                    ?>
								<tr>
									<th>Paypal Payment Transaction ID</th>
									<td><label><?php 
                    echo $other_data['pp_transaction_id'];
                    ?>
</label></td>
								</tr>
							<?php 
                }
            }
            ?>
						<?php 
        }
        ?>
						<tr>
							<th>Status</th>
							<td>
								<select name="status">
									<?php 
        $statuses = array('0' => 'cancelled', '1' => 'upcomming', '2' => 'completed');
        if (!isset($booking_data['status'])) {
            $booking_data['status'] = 1;
        }
        ?>
									<?php 
        foreach ($statuses as $key => $content) {
            ?>
										<option value="<?php 
            echo esc_attr($key);
            ?>
" <?php 
            selected($key, $booking_data['status']);
            ?>
><?php 
            echo esc_html($content);
            ?>
</option>
									<?php 
        }
        ?>
								</select>
							</td>
						</tr>
					</table>
				</div>
				<div class="one-half">
					<h3>Customer Infomation</h3>
					<table  class="trav_admin_table trav_booking_manage_table">
						<tr>
							<th>First Name</th>
							<td><input type="text" name="first_name" value="<?php 
        if (!empty($booking_data['first_name'])) {
            echo esc_attr($booking_data['first_name']);
        }
        ?>
"></td>
						</tr>
						<tr>
							<th>Last Name</th>
							<td><input type="text" name="last_name" value="<?php 
        if (!empty($booking_data['last_name'])) {
            echo esc_attr($booking_data['last_name']);
        }
        ?>
"></td>
						</tr>
						<tr>
							<th>Email</th>
							<td><input type="email" name="email" value="<?php 
        if (!empty($booking_data['email'])) {
            echo esc_attr($booking_data['email']);
        }
        ?>
"></td>
						</tr>
						<tr>
							<th>Country Code</th>
							<td><input type="text" name="country_code" value="<?php 
        if (!empty($booking_data['country_code'])) {
            echo esc_attr($booking_data['country_code']);
        }
        ?>
"></td>
						</tr>
						<tr>
							<th>Phone</th>
							<td><input type="text" name="phone" value="<?php 
        if (!empty($booking_data['phone'])) {
            echo esc_attr($booking_data['phone']);
        }
        ?>
"></td>
						</tr>
						<tr>
							<th>Address</th>
							<td><input type="text" name="address" value="<?php 
        if (!empty($booking_data['address'])) {
            echo esc_attr($booking_data['address']);
        }
        ?>
"></td>
						</tr>
						<tr>
							<th>City</th>
							<td><input type="text" name="city" value="<?php 
        if (!empty($booking_data['city'])) {
            echo esc_attr($booking_data['city']);
        }
        ?>
"></td>
						</tr>
						<tr>
							<th>Zip</th>
							<td><input type="text" name="zip" value="<?php 
        if (!empty($booking_data['zip'])) {
            echo esc_attr($booking_data['zip']);
        }
        ?>
"></td>
						</tr>
						<tr>
							<th>Country</th>
							<td><input type="text" name="country" value="<?php 
        if (!empty($booking_data['country'])) {
            echo esc_attr($booking_data['country']);
        }
        ?>
"></td>
						</tr>
						<tr>
							<th>Special Requirements</th>
							<td><textarea name="special_requirements"><?php 
        if (!empty($booking_data['special_requirements'])) {
            echo esc_textarea(stripslashes($booking_data['special_requirements']));
        }
        ?>
</textarea></td>
						</tr>
						<tr>
							<th>Booking No</th>
							<td><input type="text" name="booking_no" value="<?php 
        if (!empty($booking_data['booking_no'])) {
            echo esc_attr($booking_data['booking_no']);
        }
        ?>
"></td>
						</tr>
						<tr>
							<th>Pin Code</th>
							<td><input type="text" name="pin_code" value="<?php 
        if (!empty($booking_data['pin_code'])) {
            echo esc_attr($booking_data['pin_code']);
        }
        ?>
"></td>
						</tr>
					</table>
				</div>
				<input type="submit" class="button-primary button_save_booking" name="save" value="Save booking">
				<a href="edit.php?post_type=tour&amp;page=tour_bookings" class="button-secondary">Cancel</a>
				<?php 
        wp_nonce_field('trav_manage_tour_bookings', 'booking_save');
        ?>
			</form>
		</div>
		<?php 
        if (!empty($trav_options['vld_credit_card']) && !empty($trav_options['cc_off_charge']) && !empty($booking_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($booking_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>';
        }
    }
    function trav_acc_booking_render_manage_page()
    {
        global $wpdb, $trav_options;
        if (!empty($_POST['save'])) {
            trav_acc_booking_save_action();
            return;
        }
        $booking_data = array();
        if ('edit' == $_REQUEST['action']) {
            if (empty($_REQUEST['booking_id'])) {
                echo "<h2>You attempted to edit an item that doesn't exist. Perhaps it was deleted?</h2>";
                return;
            }
            $booking_id = $_REQUEST['booking_id'];
            $post_table_name = $wpdb->prefix . 'posts';
            $where = 'Trav_Bookings.id = %3$d';
            if (!current_user_can('manage_options')) {
                $where .= " AND accommodation.post_author = '" . get_current_user_id() . "' ";
            }
            $sql = $wpdb->prepare('SELECT Trav_Bookings.* , accommodation.post_title as accommodation_name, room_type.post_title as room_type_name FROM %1$s as Trav_Bookings
							INNER JOIN %2$s as accommodation ON Trav_Bookings.accommodation_id=accommodation.ID
							INNER JOIN %2$s as room_type ON Trav_Bookings.room_type_id=room_type.ID
							WHERE ' . $where, TRAV_ACCOMMODATION_BOOKINGS_TABLE, $post_table_name, $booking_id);
            $booking_data = $wpdb->get_row($sql, ARRAY_A);
            if (empty($booking_data)) {
                echo "<h2>You attempted to edit an item that doesn't exist. Perhaps it was deleted?</h2>";
                return;
            }
        }
        $default_booking_data = trav_acc_default_booking_data();
        $booking_data = array_replace($default_booking_data, $booking_data);
        $site_currency_symbol = trav_get_site_currency_symbol();
        $user_currency_symbol = trav_get_currency_symbol($booking_data['currency_code']);
        if (empty($user_currency_symbol)) {
            $user_currency_symbol = $site_currency_symbol;
        }
        ?>

		<div class="wrap">
			<?php 
        $page_title = 'edit' == $_REQUEST['action'] ? 'Edit Accommodation Booking<a href="edit.php?post_type=accommodation&amp;page=bookings&amp;action=add" class="add-new-h2">Add New</a>' : 'Add New Accommodation booking';
        ?>
			<h2><?php 
        echo wp_kses_post($page_title);
        ?>
</h2>
			<?php 
        if (isset($_REQUEST['updated'])) {
            echo '<div id="message" class="updated below-h2"><p>Booking saved</p></div>';
        }
        ?>
			<form method="post" onsubmit="return manage_booking_validateForm();">
				<input type="hidden" name="id" value="<?php 
        echo esc_attr($booking_data['id']);
        ?>
">
				<div class="one-half">
					<h3>Booking Detail</h3>
					<table class="trav_admin_table trav_booking_manage_table">
						<tr>
							<th>Accommodation</th>
							<td>
								<select name="accommodation_id" id="accommodation_id">
									<option></option>
									<?php 
        $args = array('post_type' => 'accommodation', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC');
        if (!current_user_can('manage_options')) {
            $args['author'] = get_current_user_id();
        }
        $accommodation_query = new WP_Query($args);
        if ($accommodation_query->have_posts()) {
            while ($accommodation_query->have_posts()) {
                $accommodation_query->the_post();
                $selected = '';
                $id = $accommodation_query->post->ID;
                if ($booking_data['accommodation_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>Room Type</th>
							<td>
								<select name="room_type_id" id="room_type_id">
									<option></option>
									<?php 
        $args = array('post_type' => 'room_type', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC');
        if (!empty($booking_data['accommodation_id'])) {
            $args['meta_query'] = array(array('key' => 'trav_room_accommodation', 'value' => $booking_data['accommodation_id']));
        }
        if (!current_user_can('manage_options')) {
            $args['author'] = get_current_user_id();
        }
        $room_type_query = new WP_Query($args);
        if ($room_type_query->have_posts()) {
            while ($room_type_query->have_posts()) {
                $room_type_query->the_post();
                $selected = '';
                $id = $room_type_query->post->ID;
                if ($booking_data['room_type_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>Number of Rooms</th>
							<td><input type="number" name="rooms" min="1" value="<?php 
        echo esc_attr($booking_data['rooms']);
        ?>
"></td>
						</tr>
						<tr>
							<th>Date From</th>
							<td><input type="text" name="date_from" id="date_from" value="<?php 
        echo esc_attr($booking_data['date_from']);
        ?>
"></td>
						</tr>
						<tr>
							<th>Date To</th>
							<td><input type="text" name="date_to" id="date_to" value="<?php 
        if ($booking_data['date_to'] != '9999-12-31') {
            echo esc_attr($booking_data['date_to']);
        }
        ?>
"></td>
						</tr>
						<tr>
							<th>Adults</th>
							<td><input type="number" name="adults" value="<?php 
        echo esc_attr($booking_data['adults']);
        ?>
"></td>
						</tr>
						<tr>
							<th>Children</th>
							<td><input type="number" name="kids" value="<?php 
        echo esc_attr($booking_data['kids']);
        ?>
"></td>
						</tr>
						<tr class="child_ages">
							<th>Child Ages</th>
							<td>
								<table>
									<?php 
        if ($booking_data['kids'] > 0) {
            ?>
										<tr class="clone-field">
											<td>
												<?php 
            $child_ages = array();
            if (!empty($booking_data['child_ages'])) {
                $child_ages = unserialize($booking_data['child_ages']);
            }
            for ($i = 0; $i < $booking_data['kids']; $i++) {
                ?>
													<input type="number" name="child_ages[]" value="<?php 
                echo esc_attr(isset($child_ages[$i]) ? $child_ages[$i] : '');
                ?>
"><a href="#" class="button remove-clone">-</a>
												<?php 
            }
            ?>
											</td>
										</tr>
									<?php 
        } else {
            ?>
										<tr class="clone-field">
											<td><input type="text" name="child_ages[0]"><a href="#" class="button remove-clone">-</a></td>
										</tr>
									<?php 
        }
        ?>
								</table>
								<a href="#" class="button-primary add-clone">+</a>
							</td>
						</tr>
						<tr>
							<th>Room Price</th>
							<td><input type="text" name="room_price" value="<?php 
        echo esc_attr($booking_data['room_price']);
        ?>
"> <?php 
        echo esc_html($site_currency_symbol);
        ?>
</td>
						</tr>
						<tr>
							<th>Tax</th>
							<td><input type="text" name="tax" value="<?php 
        echo esc_attr($booking_data['tax']);
        ?>
"> <?php 
        echo esc_html($site_currency_symbol);
        ?>
</td>
						</tr>
						<tr>
							<th>Total Price</th>
							<td><input type="text" name="total_price" value="<?php 
        echo esc_attr($booking_data['total_price']);
        ?>
"> <?php 
        echo esc_html($site_currency_symbol);
        ?>
</td>
						</tr>
						<?php 
        if (trav_is_multi_currency()) {
            ?>
							<tr>
								<th>User Currency</th>
								<td>
									<select name="currency_code">
										<?php 
            foreach (array_filter($trav_options['site_currencies']) as $key => $content) {
                ?>
											<option value="<?php 
                echo esc_attr($key);
                ?>
" <?php 
                selected($key, $booking_data['currency_code']);
                ?>
><?php 
                echo esc_html($key);
                ?>
</option>
										<?php 
            }
            ?>
									</select>
								</td>
							</tr>
							<tr>
								<th>Exchange Rate</th>
								<td><input type="text" name="exchange_rate" value="<?php 
            echo esc_attr($booking_data['exchange_rate']);
            ?>
"></td>
							</tr>
							<tr>
								<th>Total Price in User Currency</th>
								<td><label> <?php 
            if (!empty($booking_data['total_price']) && !empty($booking_data['exchange_rate'])) {
                echo esc_attr($booking_data['total_price'] * $booking_data['exchange_rate']) . esc_html($user_currency_symbol);
            }
            ?>
</td>
							</tr>
						<?php 
        }
        ?>
						<tr>
							<th>Deposit Amount</th>
							<td><input type="text" name="deposit_price" value="<?php 
        echo esc_attr($booking_data['deposit_price']);
        ?>
"> <?php 
        echo esc_html($user_currency_symbol);
        ?>
</td>
						</tr>
						<?php 
        if ('add' == $_REQUEST['action'] || !empty($booking_data['deposit_price']) && !($booking_data['deposit_price'] == 0)) {
            ?>
							<tr>
								<th>Deposit Paid</th>
								<td>
									<select name="deposit_paid">
										<?php 
            $deposit_paid = array('1' => 'yes', '0' => 'no');
            ?>
										<?php 
            foreach ($deposit_paid as $key => $content) {
                ?>
											<option value="<?php 
                echo esc_attr($key);
                ?>
" <?php 
                selected($key, $booking_data['deposit_paid']);
                ?>
><?php 
                echo esc_html($content);
                ?>
</option>
										<?php 
            }
            ?>
									</select>
								</td>
							</tr>
							<?php 
            if (!empty($booking_data['deposit_paid'])) {
                $other_data = unserialize($booking_data['other']);
                if (!empty($other_data['pp_transaction_id'])) {
                    ?>
								<tr>
									<th>Paypal Payment Transaction ID</th>
									<td><label><?php 
                    echo $other_data['pp_transaction_id'];
                    ?>
</label></td>
								</tr>
							<?php 
                }
            }
            ?>
						<?php 
        } else {
            ?>
							<input type="hidden" name="deposit_paid" value="1">
						<?php 
        }
        ?>
						<tr>
							<th>Status</th>
							<td>
								<select name="status">
									<?php 
        $statuses = array('0' => 'cancelled', '1' => 'upcomming', '2' => 'completed');
        if (!isset($booking_data['status'])) {
            $booking_data['status'] = 1;
        }
        ?>
									<?php 
        foreach ($statuses as $key => $content) {
            ?>
										<option value="<?php 
            echo esc_attr($key);
            ?>
" <?php 
            selected($key, $booking_data['status']);
            ?>
><?php 
            echo esc_html($content);
            ?>
</option>
									<?php 
        }
        ?>
								</select>
							</td>
						</tr>
					</table>
				</div>
				<div class="one-half">
					<h3>Customer Infomation</h3>
					<table  class="trav_admin_table trav_booking_manage_table">
						<tr>
							<th>First Name</th>
							<td><input type="text" name="first_name" value="<?php 
        echo esc_attr($booking_data['first_name']);
        ?>
"></td>
						</tr>
						<tr>
							<th>Last Name</th>
							<td><input type="text" name="last_name" value="<?php 
        echo esc_attr($booking_data['last_name']);
        ?>
"></td>
						</tr>
						<tr>
							<th>Email</th>
							<td><input type="email" name="email" value="<?php 
        echo esc_attr($booking_data['email']);
        ?>
"></td>
						</tr>
						<tr>
							<th>Country Code</th>
							<td><input type="text" name="country_code" value="<?php 
        echo esc_attr($booking_data['country_code']);
        ?>
"></td>
						</tr>
						<tr>
							<th>Phone</th>
							<td><input type="text" name="phone" value="<?php 
        echo esc_attr($booking_data['phone']);
        ?>
"></td>
						</tr>
						<tr>
							<th>Address</th>
							<td><input type="text" name="address" value="<?php 
        echo esc_attr($booking_data['address']);
        ?>
"></td>
						</tr>
						<tr>
							<th>City</th>
							<td><input type="text" name="city" value="<?php 
        echo esc_attr($booking_data['city']);
        ?>
"></td>
						</tr>
						<tr>
							<th>Zip</th>
							<td><input type="text" name="zip" value="<?php 
        echo esc_attr($booking_data['zip']);
        ?>
"></td>
						</tr>
						<tr>
							<th>Country</th>
							<td><input type="text" name="country" value="<?php 
        echo esc_attr($booking_data['country']);
        ?>
"></td>
						</tr>
						<tr>
							<th>Special Requirements</th>
							<td><textarea name="special_requirements"><?php 
        echo esc_textarea(stripslashes($booking_data['special_requirements']));
        ?>
</textarea></td>
						</tr>
						<tr>
							<th>Booking No</th>
							<td><input type="text" name="booking_no" value="<?php 
        echo esc_attr($booking_data['booking_no']);
        ?>
"></td>
						</tr>
						<tr>
							<th>Pin Code</th>
							<td><input type="text" name="pin_code" value="<?php 
        echo esc_attr($booking_data['pin_code']);
        ?>
"></td>
						</tr>
					</table>
				</div>
				<input type="submit" class="button-primary button_save_booking" name="save" value="Save booking">
				<a href="edit.php?post_type=accommodation&amp;page=bookings" class="button-secondary">Cancel</a>
				<?php 
        wp_nonce_field('trav_manage_bookings', 'booking_save');
        ?>
			</form>
		</div>
		<?php 
        if (!empty($trav_options['vld_credit_card']) && !empty($trav_options['cc_off_charge']) && !empty($booking_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($booking_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>';
        }
    }