<?php
use WpBookingEvent\Factory;
use WpBookingEvent\Language\Text;
use WpBookingEventFrontend\app\helpers\FrontendHelper;
use WpBookingEventFrontend\app\Html\HtmlFrontend;
use WpBookingEventFrontend\app\helpers\ConfigHelper as ConfigHelperAlias;

$item = $this->item;
$input = Factory::getInput();
$input->set('event_id', $item->id);
$page_event_detail = ConfigHelperAlias::get_page_event_detail();
$this->page_event_detail = get_page_link($page_event_detail);
$page_service_detail = ConfigHelperAlias::get_page_service_detail();
$page_go_to_page_event_detail = ConfigHelperAlias::get_go_to_page_event_detail();
$style_booking = ConfigHelperAlias::get_style_booking();
$this->page_service_detail = get_page_link($page_service_detail);
?>
<div class="event-table">
    <div class="col-md-12 col-sm-12 col-xs-12">
        <div class="each-event-table">
            <div class="img-service">
                <img class="" src="<?php echo(Factory::getRootUrlPlugin() . '/' . $item->service_image) ?>">
                <a href="<?php echo($this->page_service_detail . '?service_id=' . $item->service_id); ?>">
                    <div class="border-full"></div>
                </a>
                <div class="name-service">
                    <span><?php esc_html_e($item->eventtype_name) ?></span>
                </div>
                <div class="open-date">
                    <?php
                    $date_review = date('d', strtotime($item->open_date));
                    $month_review = date('M', strtotime($item->open_date));
                    ?>
                    <span class="day"><?php esc_html_e($date_review) ?></span>
                    <span class="month"><?php esc_html_e($month_review) ?></span>
                </div>
                <div class="price">
                    <span><?php esc_html_e(FrontendHelper::format_currency($item->price)) ?></span>
                </div>
            </div>
            <div class="information">
                <div class="name-event">
                    <a href="<?php echo($this->page_service_detail . '?service_id=' . $item->service_id); ?>"><span><?php esc_html_e($item->name) ?></span></a>
                </div>
                <div class="capacity">
                    <i class="icon-nb-user-2"></i>
                    <span><?php esc_attr_e('Capacity', 'wpbookingevent'); ?>-</span>
                    <span><?php esc_html_e($item->min_allowed_person) ?>/<?php esc_html_e($item->max_allowed_person) ?></span>
                </div>
                <div class="hour-duration">
                    <i class="icon-nb-clock"></i>
                    <span class="hour">
                                    <?php esc_html_e($item->duration) ?> <?php ($item->duration) <=1 ? esc_attr_e('Hour','wpbookingevent') : esc_attr_e('Hours','wpbookingevent') ; ?>
                                </span>
                </div>
                <div class="location">
                    <i class="icon-nb-pin"></i>
                    <span><?php esc_html_e($item->location_name) ?></span>
                </div>
            </div>
            <?php  if ($page_go_to_page_event_detail=="go_event_page") { ?>
                <div class="wrapper-button-action">
                    <div class="btn-booknow">
                        <a class="div-link" href="<?php echo($this->page_event_detail . '?event_id=' . $item->id); ?>"><?php esc_attr_e('Link', 'wpbookingevent') ?></a>
                        <a><?php esc_attr_e('Book now', 'wpbookingevent') ?></a>
                    </div>
                </div>
            <?php } else { ?>
                <div class="wrapper-button-action">
                    <div class="btn-booknow">
                        <p class="div-link"><?php esc_attr_e('Link', 'wpbookingevent') ?></p>
                        <a><?php esc_attr_e('Book now', 'wpbookingevent') ?></a>
                    </div>
                </div>
            <?php } ?>

        </div>
    </div>
    <?php  if ($page_go_to_page_event_detail=="go_event_page") { ?>
        <div></div>
    <?php } else {?>
        <div class="wrapper-dropdown-item">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="event-detail">
                    <div class="block-event-detail">
                        <div class="title">
                            <h4><?php esc_html_e('Event Detail','wpbookingevent')?></h4>
                            <div class="border-bottom"></div>
                        </div>
                        <div class="content-description">
                            <p>
                                <?php esc_html_e($item->description,'wpbookingevent');?>
                            </p>
                        </div>
                        <div class="wrapper-slider">
                            <div class="slider-event-detail">
                                <div class="block-gallery-slider-large-mobile">
                                    <?php foreach ($item->list_image as $image) {?>
                                        <div class="img-block">
                                            <div>
                                                <img src="<?php echo(Factory::getRootUrlPlugin())?><?php esc_attr_e($image->path);?>" alt="">
                                            </div>
                                        </div>
                                    <?php }?>
                                </div>
                                <div class="button-prev prev"><i class="icon-nb-down-arrow"></i></div>
                                <div class="button-next next"><i class="icon-nb-down-arrow"></i></div>
                            </div>
                        </div>
                    </div>
                    <div class="block-booking-process">
                        <div class="title">
                            <h4><?php esc_html_e('Booking process','wpbookingevent')?></h4>
                            <div class="border-bottom"></div>
                        </div>
                        <ul class="nav nav-tabs menu-booking">
                            <li class="menu-item active">
                                <a href="javascript:void(0)">
                                    <span>1</span>
                                    <span><?php esc_html_e('Select expert','wpbookingevent')?></span>
                                </a>
                                <div class="border-bottom"></div>
                            </li>
                            <li class="menu-item">
                                <a href="javascript:void(0)">
                                    <span>2</span>
                                    <span><?php esc_html_e('Time','wpbookingevent')?></span>
                                </a>
                                <div class="border-bottom"></div>
                            </li>
                            <li class="menu-item">
                                <a href="javascript:void(0)">
                                    <span>3</span>
                                    <span><?php esc_html_e('Detail','wpbookingevent')?></span>
                                </a>
                                <div class="border-bottom"></div>
                            </li>
                            <li class="menu-item">
                                <a href="javascript:void(0)">
                                    <span>4</span>
                                    <span><?php esc_html_e('Payment','wpbookingevent')?></span>
                                </a>
                                <div class="border-bottom"></div>
                            </li>
                            <li class="menu-item">
                                <a href="javascript:void(0)">
                                    <span>5</span>
                                    <span><?php esc_html_e('Payment Info','wpbookingevent')?></span>
                                </a>
                                <div class="border-bottom"></div>
                            </li>
                        </ul>
                        <?php if($style_booking=="style_1") { ?>
                            <form action="" method="post" name="form-booking" class="booking-event ">
                                <div class="tab-content">
                                    <div id="block-select-expert-<?php esc_attr_e($item->id)?>" class="tab-pane fade in active block-select-expert">
                                        <div class="row">
                                            <div class="col-md-offset-3 col-md-6">
                                                <div class="block-expert-inner">
                                                    <div class="title">
                                                        <i class="icon-nb-shapes"></i>
                                                        <h5><?php esc_html_e('Select Expert','wpbookingevent')?></h5>
                                                    </div>
                                                    <div class="block-slide-expert">
                                                        <?php
                                                        $field = $this->form->getField('employee_id');
                                                        echo ($field->input)
                                                        ?>
                                                    </div>
                                                    <div class="button-action">
                                                        <button type="button" class="btn btn-danger btn-cancel"><?php esc_html_e('Cancel','wpbookingevent')?></button>
                                                        <button type="button" class="btn btn-success btn-next"><?php esc_html_e('Next','wpbookingevent')?></button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div id="block-select-time-<?php esc_attr_e($item->id)?>" class="tab-pane fade block-select-time">
                                        <div class="row">
                                            <div class="col-md-offset-3 col-md-6">
                                                <div class="block-time-inner">
                                                    <div class="block-wrapper-time-quantity">
                                                        <div class="title">
                                                            <i class="icon-nb-shapes"></i>
                                                            <h5><?php esc_html_e('Select Time','wpbookingevent')?></h5>
                                                        </div>
                                                        <div class="block-rate-time">
                                                            <?php
                                                            $field = $this->form->getField('calendar');
                                                            echo ($field->input)
                                                            ?>
                                                        </div>
                                                    </div>
                                                    <div class="button-action">
                                                        <button type="button" class="btn btn-danger btn-back"><?php esc_html_e('Back','wpbookingevent')?></button>
                                                        <button type="button" class="btn btn-success btn-next"><?php esc_html_e('Next','wpbookingevent')?></button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div id="block-detail-<?php esc_attr_e($item->id)?>" class="tab-pane fade block-detail">
                                        <div class="row">
                                            <div class="col-md-offset-3 col-md-6">
                                                <div class="block-detail-inner">
                                                    <div class="block-wrapper-info-user">
                                                        <div class="title">
                                                            <i class="icon-nb-shapes"></i>
                                                            <h5><?php esc_html_e('Your payment detail','wpbookingevent')?></h5>
                                                        </div>
                                                        <div class="block-form-info">
                                                            <div class="row">
                                                                <div class="col-md-6">
                                                                    <div class="block-input input-first-name">
                                                                        <?php
                                                                        $field = $this->form->getField('first_name');
                                                                        echo ($field->input);
                                                                        ?>
                                                                        <p class="notice-error-1" ><?php esc_html_e('This field is required','wpbookingevent')?></p>
                                                                        <p class="notice-error-2"><?php esc_html_e('This field must not contain number ','wpbookingevent')?></p>
                                                                    </div>
                                                                </div>
                                                                <div class="col-md-6">
                                                                    <div class="block-input input-last-name">
                                                                        <?php
                                                                        $field = $this->form->getField('last_name');
                                                                        echo ($field->input);
                                                                        ?>
                                                                        <p class="notice-error-1"><?php esc_html_e('This field is required','wpbookingevent')?></p>
                                                                        <p class="notice-error-2"><?php esc_html_e('This field must not contain number','wpbookingevent')?></p>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="row">
                                                                <div class="col-md-6">
                                                                    <div class="block-input input-email">
                                                                        <?php
                                                                        $field = $this->form->getField('email');
                                                                        echo ($field->input);
                                                                        ?>
                                                                        <p class="notice-error-1"><?php esc_html_e('This field is required','wpbookingevent')?></p>
                                                                        <p class="notice-error-2"><?php esc_html_e('Please enter a valid email : example@email.com','wpbookingevent')?></p>
                                                                    </div>
                                                                </div>
                                                                <div class="col-md-6">
                                                                    <div class="block-input input-phone">
                                                                        <?php
                                                                        $field = $this->form->getField('phone');
                                                                        echo ($field->input);
                                                                        ?>
                                                                        <p class="notice-error-1"><?php esc_html_e('This field is required','wpbookingevent')?></p>
                                                                        <p class="notice-error-2"><?php esc_html_e('This field must not contain character','wpbookingevent')?></p>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="button-action">
                                                        <button type="button" class="btn btn-danger btn-back"><?php esc_html_e('Back','wpbookingevent')?></button>
                                                        <button type="button" class="btn btn-success btn-next"><?php esc_html_e('Next','wpbookingevent')?></button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div id="block-select-payment-<?php esc_attr_e($item->id)?>" class="tab-pane fade block-select-payment">
                                        <div class="row">
                                            <div class="col-md-offset-3 col-md-6">
                                                <div class="block-payment-inner">
                                                    <div class="title">
                                                        <i class="icon-nb-shapes"></i>
                                                        <h5><?php esc_html_e('Select Payment','wpbookingevent')?></h5>
                                                    </div>
                                                    <div class="block-payment-method">
                                                        <?php
                                                        $field = $this->form->getField('payment_id');
                                                        echo ($field->input)
                                                        ?>
                                                        <p class="notice-error"><?php esc_html_e('This field is required','wpbookingevent')?></p>
                                                    </div>
                                                    <div class="button-action">
                                                        <button type="button" class="btn btn-danger btn-back"><?php esc_html_e('Back','wpbookingevent')?></button>
                                                        <button type="button" class="btn btn-success btn-next"><?php esc_html_e('Next','wpbookingevent')?></button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div id="block-payment-info-<?php esc_attr_e($item->id)?>" class="tab-pane fade block-payment-info">
                                        <div class="row">
                                            <div class="col-md-6">
                                                <div class="block-booking-information">
                                                    <div class="title">
                                                        <i class="icon-nb-shapes"></i>
                                                        <h5><?php esc_html_e('Booking Information','wpbookingevent')?></h5>
                                                    </div>
                                                    <div class="content-information">
                                                        <div class="content-item">
                                                            <div class="item-left">
                                                                <span><?php esc_html_e('Event','wpbookingevent')?> :</span>
                                                                <span class="event"><?php esc_html_e($item->name);?></span>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-md-6">
                                                <div class="block-payment-info">
                                                    <div class="title">
                                                        <i class="icon-nb-shapes"></i>
                                                        <h5><?php esc_html_e('Booking Information','wpbookingevent')?></h5>
                                                    </div>
                                                    <div class="payment-sum">
                                                        <div class="block-detail-cost">
                                                            <div class="item-cost">
                                                                <span><?php esc_html_e('Base price','wpbookingevent')?></span>
                                                                <span class="base-price"><?php esc_html_e(FrontendHelper::format_currency($item->price)) ?></span>
                                                            </div>
                                                        </div>
                                                        <div class="block-summary">
                                                            <div class="item-total">
                                                                <span><?php esc_html_e('Total Cost','wpbookingevent')?></span>
                                                                <span class="total-cost"><?php esc_html_e(FrontendHelper::format_currency($item->price)) ?></span>
                                                            </div>
                                                            <div class="wrapper-button-booking">
                                                                <button type="button" class="btn btn-danger btn-cancel-booking"><?php esc_html_e('Cancel','wpbookingevent')?></button>
                                                                <button type="submit" class="btn btn-success btn-booking-now"><?php esc_html_e('Book Now','wpbookingevent')?></button>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <input type="hidden" name="task" value="booking.book_event">
                                <input type="hidden" name="event_id" value="<?php esc_html_e($item->id) ?>"/>
                            </form>
                        <?php } else { ?>
                            <form action="" method="post" name="form-booking" class="booking-event style-2">
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="block-expert-inner">
                                            <div class="title">
                                                <i class="icon-nb-shapes"></i>
                                                <h5><?php esc_html_e('Select Expert','wpbookingevent')?></h5>
                                            </div>
                                            <div class="block-slide-expert">
                                                <?php
                                                $field = $this->form->getField('employee_id');
                                                echo ($field->input)
                                                ?>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="block-time-inner">
                                            <div class="block-wrapper-time-quantity">
                                                <div class="title">
                                                    <i class="icon-nb-shapes"></i>
                                                    <h5><?php esc_html_e('Select Time','wpbookingevent')?></h5>
                                                </div>
                                                <div class="block-rate-time">
                                                    <?php
                                                    $field = $this->form->getField('calendar');
                                                    echo ($field->input)
                                                    ?>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="block-detail-inner">
                                            <div class="block-wrapper-info-user">
                                                <div class="title">
                                                    <i class="icon-nb-shapes"></i>
                                                    <h5><?php esc_html_e('Your payment detail','wpbookingevent')?></h5>
                                                </div>
                                                <div class="block-form-info">
                                                    <div class="row">
                                                        <div class="col-md-6">
                                                            <div class="block-input input-first-name">
                                                                <?php
                                                                $field = $this->form->getField('first_name');
                                                                echo ($field->input);
                                                                ?>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-6">
                                                            <div class="block-input input-last-name">
                                                                <?php
                                                                $field = $this->form->getField('last_name');
                                                                echo ($field->input);
                                                                ?>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row">
                                                        <div class="col-md-6">
                                                            <div class="block-input input-email">
                                                                <?php
                                                                $field = $this->form->getField('email');
                                                                echo ($field->input);
                                                                ?>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-6">
                                                            <div class="block-input input-phone">
                                                                <?php
                                                                $field = $this->form->getField('phone');
                                                                echo ($field->input);
                                                                ?>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="block-payment-inner">
                                            <div class="title">
                                                <i class="icon-nb-shapes"></i>
                                                <h5><?php esc_html_e('Select Payment','wpbookingevent')?></h5>
                                            </div>
                                            <div class="block-payment-method">
                                                <?php
                                                $field = $this->form->getField('payment_id');
                                                echo ($field->input)
                                                ?>
                                                <p class="notice-error"><?php esc_html_e('This field is required','wpbookingevent')?></p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="block-booking-information">
                                            <div class="title">
                                                <i class="icon-nb-shapes"></i>
                                                <h5><?php esc_html_e('Booking Information','wpbookingevent')?></h5>
                                            </div>
                                            <div class="content-information">
                                                <div class="content-item">
                                                    <div class="item-left">
                                                        <span><?php esc_html_e('Event','wpbookingevent')?> :</span>
                                                        <span class="event"><?php esc_html_e($item->name);?></span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="block-payment-info">
                                            <div class="title">
                                                <i class="icon-nb-shapes"></i>
                                                <h5><?php esc_html_e('Booking Information','wpbookingevent')?></h5>
                                            </div>
                                            <div class="payment-sum">
                                                <div class="block-detail-cost">
                                                    <div class="item-cost">
                                                        <span><?php esc_html_e('Base price','wpbookingevent')?></span>
                                                        <span class="base-price"><?php esc_html_e(FrontendHelper::format_currency($item->price)) ?></span>
                                                    </div>
                                                </div>
                                                <div class="block-summary">
                                                    <div class="item-total">
                                                        <span><?php esc_html_e('Total Cost','wpbookingevent')?></span>
                                                        <span class="total-cost"><?php esc_html_e(FrontendHelper::format_currency($item->price)) ?></span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-12">
                                        <div class="wrapper-button-booking pull-right">
                                            <button type="button" class="btn btn-danger btn-cancel-booking-2"><?php esc_html_e('Cancel','wpbookingevent')?></button>
                                            <button type="submit" class="btn btn-success btn-booking-now-2"><?php esc_html_e('Book Now','wpbookingevent')?></button>
                                        </div>
                                    </div>
                                </div>
                                <input type="hidden" name="task" value="booking.book_event">
                                <input type="hidden" name="event_id" value="<?php esc_html_e($item->id) ?>"/>
                            </form>
                        <?php } ?>
                    </div>

                </div>
            </div>
        </div>
    <?php } ?>

</div>