function gdlr_hotel_room_info($post_option = array(), $list = array(), $wrapper = true)
 {
     global $hotel_option;
     if ($list != array('price') && $list != array('price-break-down') && !empty($post_option['facilities-and-services'])) {
         $room_info = json_decode($post_option['facilities-and-services'], true);
         return gdlr_hotel_room_info_new($room_info, $list, $wrapper);
     }
     if (empty($list)) {
         $list = array('bed', 'max-people', 'view', 'room-size', 'wifi', 'breakfast-included', 'room-service', 'airport-pickup-service');
     }
     $ret = '';
     foreach ($list as $slug) {
         switch ($slug) {
             case 'price':
             case 'price-break-down':
                 if (!empty($post_option['room-base-price'])) {
                     $ret .= '<div class="gdlr-room-price">';
                     if ($slug == 'price' || empty($hotel_option['booking-price-display']) || $hotel_option['booking-price-display'] == 'start-from') {
                         $ret .= '<span class="gdlr-head">' . __('Start From', 'gdlr-hotel') . '</span>';
                         $ret .= '<span class="gdlr-tail">' . gdlr_hotel_money_format($post_option['room-base-price']) . ' / ' . __('Night', 'gdlr-hotel') . '</span>';
                     } else {
                         $price_breakdown = get_price_breakdown_popup($post_option);
                         $ret .= '<span class="gdlr-tail">' . gdlr_hotel_money_format($price_breakdown['total']) . '</span>';
                     }
                     if ($slug == 'price-break-down') {
                         if (empty($price_breakdown)) {
                             $price_breakdown = get_price_breakdown_popup($post_option);
                         }
                         $ret .= '<div class="gdlr-price-break-down" >' . __('* view price breakdown', 'gdlr-hotel');
                         $ret .= $price_breakdown['price-breakdown'];
                         $ret .= '</div>';
                     }
                     $ret .= '</div>';
                 }
                 break;
             case 'bed':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('Bed', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . '</span>';
                     $ret .= '</div>';
                 }
                 break;
             case 'max-people':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('Max', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . ' ' . __('People', 'gdlr-hotel') . '</span>';
                     $ret .= '</div>';
                 }
                 break;
             case 'view':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('View', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . '</span>';
                     $ret .= '</div>';
                 }
                 break;
             case 'room-size':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('Room Size', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . '</span>';
                     $ret .= '</div>';
                 }
                 break;
             case 'wifi':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('Wifi', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . '</span>';
                     $ret .= '</div>';
                 }
                 break;
             case 'breakfast-included':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('Breakfast Included', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . '</span>';
                     $ret .= '</div>';
                 }
                 break;
             case 'room-service':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('Room Service', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . '</span>';
                     $ret .= '</div>';
                 }
                 break;
             case 'airport-pickup-service':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('Airport Pickup Service', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . '</span>';
                     $ret .= '</div>';
                 }
                 break;
         }
     }
     if ($wrapper && !empty($ret)) {
         $ret = '<div class="gdlr-hotel-room-info">' . $ret . '<div class="clear"></div></div>';
     }
     return $ret;
 }
    function gdlr_get_booking_services($branches, $selected_service)
    {
        global $hotel_option, $wpdb;
        // get every available services
        $services = array();
        if (!empty($branches)) {
            $sql = "SELECT DISTINCT wpostmeta.post_id FROM {$wpdb->postmeta} wpostmeta ";
            $sql .= "WHERE wpostmeta.meta_key = 'gdlr-branches' AND wpostmeta.meta_value LIKE '%\"{$branches}\"%' ";
            $sql .= "ORDER BY post_id DESC";
            $service_query = $wpdb->get_results($sql, OBJECT);
            if (empty($service_query)) {
                return;
            } else {
                foreach ($service_query as $service) {
                    $services[] = $service->post_id;
                }
            }
        } else {
            $args = array('post_type' => 'service', 'posts_per_page' => 99);
            $query = new WP_Query($args);
            foreach ($query->posts as $post) {
                $services[] = $post->ID;
            }
        }
        if (empty($services)) {
            return;
        }
        ob_start();
        ?>
		
<div class="gdlr-room-selection-divider"></div>
<div class="gdlr-booking-service-wrapper">
	<span class="gdlr-booking-service-head" ><?php 
        _e('Please select your preferred additional services. (optional)', 'gdlr-hotel');
        ?>
</span> 
	<form class="gdlr-booking-service-form" method="post" data-ajax="<?php 
        echo AJAX_URL;
        ?>
" >
	<?php 
        $words = array('night' => __('Night', 'gdlr-hotel'), 'trip' => __('Trip', 'gdlr-hotel'), 'car' => __('Car', 'gdlr-hotel'), 'group' => __('Group', 'gdlr-hotel'), 'guest' => __('Guest', 'gdlr-hotel'), 'room' => __('Room', 'gdlr-hotel'));
        foreach ($services as $service) {
            $active = in_array($service, $selected_service);
            $option = json_decode(gdlr_decode_preventslashes(get_post_meta($service, 'post-option', true)), true);
            echo '<div class="gdlr-room-service-option">';
            echo '<label class="gdlr-room-service-checkbox ' . ($active ? 'gdlr-active' : '') . '">';
            echo '<input type="checkbox" name="service-select[]" value="' . $service . '" ' . ($active ? 'checked' : '') . ' />';
            echo '</label>';
            echo '<span class="gdlr-room-service-title">' . get_the_title($service) . '</span>';
            if ($option['service-type'] == 'parking-service' && $option['car'] == 'car') {
                echo '<input type="text" name="service-amount[]" value="1" ' . ($active ? '' : 'disabled') . ' />';
                echo '<span class="gdlr-room-service-title">' . __('cars', 'gdlr-hotel') . '</span>';
            } else {
                echo '<input type="hidden" name="service-amount[]" value="1" ' . ($active ? '' : 'disabled') . ' />';
            }
            echo '<span class="gdlr-room-service-unit">';
            echo gdlr_hotel_money_format($option['price']);
            echo '<span class="sep">/</span>';
            if ($option['service-type'] == 'regular-service') {
                echo $words[$option['per']];
            } else {
                if ($option['service-type'] == 'parking-service') {
                    echo $words[$option['car']];
                }
            }
            echo '<span class="sep">/</span>';
            echo $words[$option['unit']];
            echo '</span>';
            echo '</div>';
        }
        ?>
	</form>
</div>
<?php 
        $ret = ob_get_contents();
        ob_end_clean();
        return $ret;
    }
 function gdlr_hotel_room_info($post_option = array(), $list = array(), $wrapper = true)
 {
     if (empty($list)) {
         $list = array('bed', 'max-people', 'view', 'room-size', 'wifi', 'breakfast-included', 'room-service', 'airport-pickup-service');
     }
     $ret = '';
     foreach ($list as $slug) {
         switch ($slug) {
             case 'price':
             case 'price-break-down':
                 if (!empty($post_option['room-base-price'])) {
                     $ret .= '<div class="gdlr-room-price">';
                     $ret .= '<span class="gdlr-head">' . __('Start From', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . gdlr_hotel_money_format($post_option['room-base-price']) . ' / ' . __('Night', 'gdlr-hotel') . '</span>';
                     if ($slug == 'price-break-down') {
                         $ret .= '<div class="gdlr-price-break-down" >' . __('* view price breakdown', 'gdlr-hotel');
                         $ret .= get_price_breakdown_popup($post_option);
                         $ret .= '</div>';
                     }
                     $ret .= '</div>';
                 }
                 break;
             case 'bed':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('Bed', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . '</span>';
                     $ret .= '</div>';
                 }
                 break;
             case 'max-people':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('Max', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . ' ' . __('People', 'gdlr-hotel') . '</span>';
                     $ret .= '</div>';
                 }
                 break;
             case 'view':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('View', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . '</span>';
                     $ret .= '</div>';
                 }
                 break;
             case 'room-size':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('Room Size', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . '</span>';
                     $ret .= '</div>';
                 }
                 break;
             case 'wifi':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('Wifi', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . '</span>';
                     $ret .= '</div>';
                 }
                 break;
             case 'breakfast-included':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('Breakfast Included', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . '</span>';
                     $ret .= '</div>';
                 }
                 break;
             case 'room-service':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('Room Service', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . '</span>';
                     $ret .= '</div>';
                 }
                 break;
             case 'airport-pickup-service':
                 if (!empty($post_option[$slug])) {
                     $ret .= '<div class="gdlr-room-info">';
                     $ret .= '<i class="fa fa-check-square-o icon-check" ></i>';
                     $ret .= '<span class="gdlr-head">' . __('Airport Pickup Service', 'gdlr-hotel') . '</span>';
                     $ret .= '<span class="gdlr-tail">' . $post_option[$slug] . '</span>';
                     $ret .= '</div>';
                 }
                 break;
         }
     }
     if ($wrapper && !empty($ret)) {
         $ret = '<div class="gdlr-hotel-room-info">' . $ret . '<div class="clear"></div></div>';
     }
     return $ret;
 }
 function gdlr_get_summary_form($data, $with_form = true, $coupon = '')
 {
     global $hotel_option;
     $total_price = 0;
     $ret = '<div class="gdlr-price-summary-wrapper" >';
     // display branches if exists
     if (!empty($data['gdlr-hotel-branches'])) {
         $term = get_term_by('id', $data['gdlr-hotel-branches'], 'room_category');
         $ret .= '<div class="gdlr-price-summary-hotel-branches gdlr-title-font">';
         $ret .= $term->name;
         $ret .= '</div>';
     } else {
         $ret .= '<div class="gdlr-price-summary-head">' . __('Price Breakdown', 'gdlr-hotel') . '</div>';
     }
     for ($i = 0; $i < intval($data['gdlr-room-number']); $i++) {
         $post_option = json_decode(gdlr_decode_preventslashes(get_post_meta($data['gdlr-room-id'][$i], 'post-option', true)), true);
         $post_option['data'] = array('check-in' => $data['gdlr-check-in'], 'check-out' => $data['gdlr-check-out'], 'adult' => $data['gdlr-adult-number'][$i], 'children' => $data['gdlr-children-number'][$i]);
         $price = gdlr_get_booking_price($post_option);
         $ret .= '<div class="gdlr-price-room-summary">';
         $ret .= '<div class="gdlr-price-room-summary-title">';
         $ret .= __('Room', 'gdlr-hotel') . ' ' . ($i + 1) . ' : ' . get_the_title($data['gdlr-room-id'][$i]);
         $ret .= '<span class="gdlr-price-room-summary-price" href="#" >' . gdlr_hotel_money_format($price['total']) . '</span>';
         $ret .= '</div>';
         $ret .= '<div class="gdlr-price-room-summary-info gdlr-title-font" >';
         $ret .= '<span>' . __('Adult', 'gdlr-hotel') . ' : ' . $data['gdlr-adult-number'][$i] . '</span>';
         $ret .= '<span>' . __('Children', 'gdlr-hotel') . ' : ' . $data['gdlr-children-number'][$i] . '</span>';
         $ret .= '</div>';
         $ret .= '</div>';
         $total_price += $price['total'];
     }
     // service
     if (!empty($data['service'])) {
         $services_price = gdlr_calculate_service_price($data);
         $ret .= '<div class="gdlr-service-price-summary">';
         $ret .= '<div class="gdlr-service-price-summary-head" >' . __('Additional Services', 'gdlr-hotel') . '</div>';
         foreach ($services_price as $key => $service_price) {
             if ($key == 'total') {
                 continue;
             }
             $ret .= '<div class="gdlr-service-price-summary-item">';
             $ret .= '<span class="gdlr-head">' . $service_price['title'] . '</span>';
             $ret .= '<span class="gdlr-tail">' . gdlr_hotel_money_format($service_price['price']) . '</span>';
             $ret .= '<div class="clear"></div>';
             $ret .= '</div>';
         }
         $ret .= '</div>';
         $total_price += $services_price['total'];
     }
     // vat
     if (!empty($hotel_option['booking-vat-amount'])) {
         $ret .= '<div class="gdlr-price-summary-vat" >';
         $ret .= '<div class="gdlr-price-summary-vat-total" >';
         $ret .= '<span class="gdlr-head">' . __('Total', 'gdlr-hotel') . '</span>';
         $ret .= '<span class="gdlr-tail">' . gdlr_hotel_money_format($total_price) . '</span>';
         $ret .= '<div class="clear"></div>';
         $ret .= '</div>';
         // vat-total
         if (!empty($coupon)) {
             $discount = gdlr_get_coupon_discount($data, $coupon);
             $total_price -= $discount;
             $ret .= '<div class="gdlr-price-summary-vat-discount" >';
             $ret .= '<span class="gdlr-head">' . __('Coupon Discount', 'gdlr-hotel') . '</span>';
             $ret .= '<span class="gdlr-tail">' . gdlr_hotel_money_format($discount) . '</span>';
             $ret .= '<div class="clear"></div>';
             $ret .= '</div>';
         }
         $vat_amount = $total_price * floatval($hotel_option['booking-vat-amount']) / 100;
         $total_price += $vat_amount;
         $ret .= '<div class="gdlr-price-summary-vat-amount" >';
         $ret .= '<span class="gdlr-head">' . __('Vat', 'gdlr-hotel') . ' ' . $hotel_option['booking-vat-amount'] . '%</span>';
         $ret .= '<span class="gdlr-tail">' . gdlr_hotel_money_format($vat_amount) . '</span>';
         $ret .= '<div class="clear"></div>';
         $ret .= '</div>';
         // vat-amount
         $ret .= '</div>';
     }
     // deposit
     if ($with_form && !empty($hotel_option['booking-deposit-amount'])) {
         // grand total
         $ret .= '<div class="gdlr-price-summary-grand-total gdlr-active" >';
         $ret .= '<span class="gdlr-head">' . __('Grand Total', 'gdlr-hotel') . '</span>';
         $ret .= '<span class="gdlr-tail">' . gdlr_hotel_money_format($total_price) . '</span>';
         $ret .= '</div>';
         $deposit_text = $hotel_option['booking-deposit-amount'] . '% ' . __('Deposit', 'gdlr-hotel');
         $deposit_amount = $total_price * floatval($hotel_option['booking-deposit-amount']) / 100;
         $ret .= '<div class="gdlr-price-deposit-wrapper">';
         $ret .= '<div class="gdlr-price-deposit-input" >';
         $ret .= '<span class="gdlr-active" ><label class="gdlr-radio-input"><input type="radio" name="pay_deposit" value="false" checked ></label>' . __('Pay Full Amount', 'gdlr-hotel') . '</span>';
         $ret .= '<span><label class="gdlr-radio-input"><input type="radio" name="pay_deposit" value="true" ></label>' . __('Pay', 'gdlr-hotel') . ' ' . $deposit_text . '</span>';
         $ret .= '</div>';
         $ret .= '<div class="gdlr-price-deposit-inner-wrapper">';
         $ret .= '<div class="gdlr-price-deposit-title">' . $deposit_text . '</div>';
         $ret .= '<div class="gdlr-price-deposit-caption">' . __('*Pay the rest on arrival', 'gdlr-hotel') . '</div>';
         $ret .= '<div class="gdlr-price-deposit-amount">' . gdlr_hotel_money_format($deposit_amount) . '</div>';
         $ret .= '</div>';
         $ret .= '</div>';
         $ret .= '<a id="gdlr-edit-booking-button" class="gdlr-edit-booking-button gdlr-button with-border" href="#">' . __('Edit Booking', 'gdlr-hotel') . '</a>';
     } else {
         $ret .= '<div class="gdlr-price-summary-grand-total-wrapper-2" >';
         $ret .= '<div class="gdlr-price-summary-grand-total ';
         $ret .= empty($data['pay_deposit']) || $data['pay_deposit'] == 'false' ? 'gdlr-active' : '';
         $ret .= '" >';
         $ret .= '<span class="gdlr-head">' . __('Grand Total', 'gdlr-hotel') . '</span>';
         $ret .= '<span class="gdlr-tail">' . gdlr_hotel_money_format($total_price) . '</span>';
         $ret .= '</div>';
         if (!empty($data['pay_deposit']) && $data['pay_deposit'] == 'true') {
             $deposit_text = $hotel_option['booking-deposit-amount'] . '% ' . __('Deposit', 'gdlr-hotel');
             $deposit_amount = $total_price * floatval($hotel_option['booking-deposit-amount']) / 100;
             $ret .= '<div class="gdlr-price-deposit-wrapper">';
             $ret .= '<div class="gdlr-price-deposit-inner-wrapper">';
             $ret .= '<div class="gdlr-price-deposit-title">' . $deposit_text . '</div>';
             $ret .= '<div class="gdlr-price-deposit-caption">' . __('*Pay the rest on arrival', 'gdlr-hotel') . '</div>';
             $ret .= '<div class="gdlr-price-deposit-amount">' . gdlr_hotel_money_format($deposit_amount) . '</div>';
             $ret .= '</div>';
             $ret .= '</div>';
             $ret .= '<div class="gdlr-pay-on-arrival" >';
             $ret .= '<span class="gdlr-head">' . __('Pay on arrival', 'gdlr-hotel') . '</span>';
             $ret .= '<span class="gdlr-tail">' . gdlr_hotel_money_format($total_price - $deposit_amount) . '</span>';
             $ret .= '</div>';
         }
         $ret .= '</div>';
     }
     $ret .= '</div>';
     // gdlr-price-summary-wrapper
     return $ret;
 }
function get_transaction_payment($result, $contact)
{
    $payment_info = unserialize($result->payment_info);
    $transaction_id = '';
    if (!empty($contact['payment-method'])) {
        if ($contact['payment-method'] == 'stripe') {
            $transaction_id = $payment_info['balance_transaction'];
        } else {
            if ($contact['payment-method'] == 'paypal') {
                $transaction_id = $payment_info['txn_id'];
            } else {
                if ($contact['payment-method'] == 'paymill') {
                    $transaction_id = $payment_info->getId();
                } else {
                    if ($contact['payment-method'] == 'authorize') {
                        $transaction_id = $payment_info->transaction_id;
                    }
                }
            }
        }
    } else {
        $contact['payment-method'] = '';
    }
    $ret = '<div class="transaction-description-wrapper">';
    $ret .= '<i class="close-transaction-description fa fa-remove icon-remove"></i>';
    $ret .= '<div class="transaction-description">';
    $ret .= '<span class="gdlr-head">' . __('Payment Date :', 'gdlr-hotel') . '</span>';
    $ret .= '<span class="gdlr-tail">' . $result->payment_date . '</span>';
    $ret .= '</div>';
    $ret .= '<div class="transaction-description">';
    $ret .= '<span class="gdlr-head">' . __('Payment Channel :', 'gdlr-hotel') . '</span>';
    $ret .= '<span class="gdlr-tail">' . $contact['payment-method'] . '</span>';
    $ret .= '</div>';
    $ret .= '<div class="transaction-description">';
    $ret .= '<span class="gdlr-head">' . __('Payment Transaction ID :', 'gdlr-hotel') . '</span>';
    $ret .= '<span class="gdlr-tail">' . $transaction_id . '</span>';
    $ret .= '</div>';
    $ret .= '<div class="transaction-description gdlr-large">';
    $ret .= '<span class="gdlr-head">' . __('Pay Amount :', 'gdlr-hotel') . '</span>';
    $ret .= '<span class="gdlr-tail">' . gdlr_hotel_money_format($result->pay_amount) . '</span>';
    $ret .= '</div>';
    $ret .= '<div class="transaction-description gdlr-large">';
    $ret .= '<span class="gdlr-head">' . __('Pay on Arrival :', 'gdlr-hotel') . '</span>';
    $ret .= '<span class="gdlr-tail">' . gdlr_hotel_money_format($result->total_price - $result->pay_amount) . '</span>';
    $ret .= '</div>';
    if (!empty($contact['coupon'])) {
        $posts = get_posts(array('post_type' => 'coupon', 'posts_per_page' => 1, 'meta_key' => 'gdlr-coupon-code', 'meta_value' => $contact['coupon']));
        $ret .= '<div class="transaction-description gdlr-large">';
        $ret .= '<span class="gdlr-head">' . __('Coupon Code :', 'gdlr-hotel') . '</span>';
        $ret .= '<span class="gdlr-tail"><a target="_blank" href="' . get_edit_post_link($posts[0]->ID) . '" >' . $contact['coupon'] . '</a></span>';
        $ret .= '</div>';
    }
    $ret .= '</div>';
    return $ret;
}
 function get_price_breakdown_popup($post_option)
 {
     $price = gdlr_get_booking_price($post_option);
     $weekday_title = '<span>x ' . $price['weekday-night'] . ' ' . __('Night', 'gdlr-hotel') . ($price['weekday-night'] > 1 ? 's' : '');
     $weekday_title .= ' ' . __('(Weekday)', 'gdlr-hotel') . '</span>';
     $weekend_title = '<span>x ' . $price['weekend-night'] . ' ' . __('Night', 'gdlr-hotel') . ($price['weekday-night'] > 1 ? 's' : '');
     $weekend_title .= ' ' . __('(Weekend)', 'gdlr-hotel') . '</span>';
     $ss_weekday_title = '<span>x ' . $price['ss_weekday-night'] . ' ' . __('Night', 'gdlr-hotel') . ($price['ss_weekday-night'] > 1 ? 's' : '');
     $ss_weekday_title .= ' ' . __('(Weekday)', 'gdlr-hotel') . '</span>';
     $ss_weekend_title = '<span>x ' . $price['ss_weekend-night'] . ' ' . __('Night', 'gdlr-hotel') . ($price['ss_weekday-night'] > 1 ? 's' : '');
     $ss_weekend_title .= ' ' . __('(Weekend)', 'gdlr-hotel') . '</span>';
     $price_title = array('base' => __('Base Price', 'gdlr-hotel') . $weekday_title, 'base-weekend' => __('Base Price', 'gdlr-hotel') . $weekend_title, 'ss_base' => __('Special Season Base Price', 'gdlr-hotel') . $ss_weekday_title, 'ss_base-weekend' => __('Special Season Base Price', 'gdlr-hotel') . $ss_weekend_title, 'adult' => $price['adult-num'] . ' ' . __('Adult', 'gdlr-hotel') . $weekday_title, 'adult-weekend' => $price['adult-num'] . ' ' . __('Adult', 'gdlr-hotel') . $weekend_title, 'ss_adult' => $price['adult-num'] . ' ' . __('Special Season Adult', 'gdlr-hotel') . $ss_weekday_title, 'ss_adult-weekend' => $price['adult-num'] . ' ' . __('Special Season Adult', 'gdlr-hotel') . $ss_weekend_title, 'child' => $price['child-num'] . ' ' . __('Children', 'gdlr-hotel') . $weekday_title, 'child-weekend' => $price['child-num'] . ' ' . __('Children', 'gdlr-hotel') . $weekend_title, 'ss_child' => $price['child-num'] . ' ' . __('Special Season Children', 'gdlr-hotel') . $ss_weekday_title, 'ss_child-weekend' => $price['child-num'] . ' ' . __('Special Season Children', 'gdlr-hotel') . $ss_weekend_title);
     $ret = '<div class="price-breakdown-wrapper">';
     $ret .= '<div class="price-breakdown-close"></div>';
     $ret .= '<div class="price-breakdown-content">';
     foreach ($price_title as $slug => $title) {
         if (!empty($price[$slug])) {
             $ret .= '<div class="price-breakdown-info">';
             $ret .= '<span class="gdlr-head">' . $price_title[$slug] . '</span>';
             $ret .= '<span class="gdlr-tail">' . gdlr_hotel_money_format($price[$slug]) . '</span>';
             $ret .= '</div>';
         }
     }
     $ret .= '<div class="price-breakdown-total">';
     $ret .= '<span class="gdlr-head">' . __('Total', 'gdlr-hotel');
     $ret .= '<span class="">' . __('*vat is not included yet', 'gdlr-hotel') . '</span>';
     $ret .= '</span>';
     $ret .= '<span class="gdlr-tail">' . gdlr_hotel_money_format($price['total']) . '</span>';
     $ret .= '</div>';
     $ret .= '</div>';
     // price-breakdown-content
     $ret .= '</div>';
     // price-breakdown-wrapper
     return array('price-breakdown' => $ret, 'total' => $price['total']);
 }
 function gdlr_hotel_mail_content($contact, $data, $payment_info, $price)
 {
     $content = __("Contact Info", "gdlr-hotel") . " \n";
     $content .= __("Name :", "gdlr-hotel") . " {$contact['first_name']}\n";
     $content .= __("Last Name :", "gdlr-hotel") . " {$contact['last_name']}\n";
     $content .= __("Phone :", "gdlr-hotel") . " {$contact['phone']}\n";
     $content .= __("Email :", "gdlr-hotel") . " {$contact['email']}\n";
     $content .= __("Address :", "gdlr-hotel") . " {$contact['address']}\n";
     $content .= __("Additional Note :", "gdlr-hotel") . " {$contact['additional-note']}\n";
     $content .= __("Coupon :", "gdlr-hotel") . " {$contact['coupon']}\n";
     if (!empty($data['gdlr-hotel-branches'])) {
         $term = get_term_by('id', $data['gdlr-hotel-branches'], 'room_category');
         $content .= "Branches : {$term->name}\n";
         $category_meta = get_option('gdlr_hotel_branch', array());
         if (!empty($category_meta[$term->slug]['content'])) {
             $content .= "Location : {$category_meta[$term->slug]['content']}\n";
         }
     }
     $content .= "\n";
     $content .= __("Room Information", "gdlr-hotel") . "\n";
     for ($i = 0; $i < intval($data['gdlr-room-number']); $i++) {
         $room_num = $i + 1;
         $content .= __("Room", "gdlr-hotel") . " {$room_num} : " . get_the_title($data['gdlr-room-id'][$i]) . " \n";
         $content .= __("Adult :", "gdlr-hotel") . " {$data['gdlr-adult-number'][$i]}\n";
         $content .= __("Children :", "gdlr-hotel") . " {$data['gdlr-children-number'][$i]}\n";
     }
     $content .= __("Check In :", "gdlr-hotel") . " {$data['gdlr-check-in']} \n";
     $content .= __("Check Out :", "gdlr-hotel") . " {$data['gdlr-check-out']} \n";
     $content .= "\n";
     if (!empty($data['service'])) {
         $content .= __("Additional Services", "gdlr-hotel") . "\n";
         $services_price = gdlr_calculate_service_price($data);
         foreach ($services_price as $key => $service_price) {
             if ($key == 'total') {
                 continue;
             }
             $content .= $service_price['title'] . "\n";
         }
         $content .= "\n";
     }
     $content .= __("Payment Information", "gdlr-hotel") . " \n";
     $content .= __("Total Price :", "gdlr-hotel") . " " . gdlr_hotel_money_format($price['total_price']) . " \n";
     $content .= __("Pay Amount :", "gdlr-hotel") . " " . gdlr_hotel_money_format($price['pay_amount']) . " \n";
     if (!empty($price['booking_code'])) {
         $content .= __("Booking Code :", "gdlr-hotel") . " {$price['booking_code']} \n";
     }
     if (!empty($contact['payment-method']) && !empty($payment_info)) {
         if ($contact['payment-method'] == 'stripe') {
             $content .= __("Payment Method : Stripe", "gdlr-hotel") . " \n";
             $content .= __("Transaction ID :", "gdlr-hotel") . " {$payment_info['balance_transaction']} \n";
         } else {
             if ($contact['payment-method'] == 'paypal') {
                 $content .= __("Payment Method : Paypal", "gdlr-hotel") . " \n";
                 $content .= __("Transaction ID :", "gdlr-hotel") . " {$payment_info['txn_id']} \n";
             } else {
                 if ($contact['payment-method'] == 'paymill') {
                     $content .= __("Payment Method : Paymill", "gdlr-hotel") . " \n";
                     $content .= __("Transaction ID :", "gdlr-hotel") . " {$payment_info->getId()} \n";
                 } else {
                     if ($contact['payment-method'] == 'authorize') {
                         $content .= __("Payment Method : Authorize", "gdlr-hotel") . " \n";
                         $content .= __("Transaction ID :", "gdlr-hotel") . " {$payment_info->transaction_id} \n";
                     }
                 }
             }
         }
     }
     return $content;
 }