<?php

use WpBookingEvent\Factory as FactoryAlias;
use WpBookingEvent\Html\ToolBar;
use WpBookingEvent\Html\WpBookingEventHtmlBackend as WpBookingEventHtmlBackendAlias;
use WpBookingEvent\Utilities\Utility as UtilityAlias;
use WpBookingEventAdmin\app\Html\HtmlBackend;
use WpBookingEvent\Language\Text;
$doc = FactoryAlias::getDocument();
WpBookingEventHtmlBackendAlias::load_jquery_library('moment');
WpBookingEventHtmlBackendAlias::load_jquery_library('fullcalendar');
WpBookingEventHtmlBackendAlias::load_jquery_library('loading_js');
WpBookingEventHtmlBackendAlias::load_jquery_library('icheck');
WpBookingEventHtmlBackendAlias::load_jquery_library('ui');
WpBookingEventHtmlBackendAlias::load_jquery_library('timepicker');
WpBookingEventHtmlBackendAlias::load_jquery_library('validate');
ToolBar::setTitle("Calendar");
$list_customer=array_reverse($this->list_customer);
$week = array('Sunday','Monday','Tuesday' ,'Wednesday' ,'Thursday' ,'Friday','Saturday');
$repeat = array('does not repeat','Daily' ,'Weekly' ,'Monthly');
$day = array('1','2' ,'3' ,'4' ,'5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31');
if(isset($value) && trim($value) != '') {
    $arr_value= json_decode($value);
} else {
    $arr_value=array();
}
$i=-1;
$j=0;
?>
<?php ?>
    <div class="view-list-calendar">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="wrapper-employee">
                        <ul id="employees" class="list-employee">
                            <li class="employee-item active" data-employee_id="0">
                                <div class="wrapper-img">
                                    <div class="block-image">
                                        <span><?php esc_attr_e('All', 'wpbookingevent');?></span>
                                    </div>
                                </div>
                                <p class="text"><?php esc_attr_e('All employees', 'wpbookingevent');?></p>
                            </li>
                            <?php foreach ($this->list_employee as $employee) {?>
                                <li class="employee-item item" data-employee_id="<?php esc_html_e($employee->id);?>">
                                    <div class="wrapper-img">
                                        <div class="img-box">
                                            <div>
                                                <img src="<?php echo(FactoryAlias::getRootUrlPlugin())?><?php esc_html_e($employee->cover);?>" alt="">
                                            </div>
                                        </div>
                                    </div>
                                    <p class="employee-name name"><?php echo($employee->first_name.' '.$employee->last_name);?></p>
                                </li>
                            <?php }?>
                        </ul>
                        <input type="text" id="Inputemployee"  placeholder="Search employee" title="Type in a name">
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <div class="wrapper-customer">
                        <ul id="customers" class="list-customer">
                            <li class="customer-item " data-customer_id="0">
                                <div class="wrapper-img">
                                    <div class="block-image">
                                        <span><?php esc_attr_e('All', 'wpbookingevent');?></span>
                                    </div>
                                </div>
                                <p class="text"><?php esc_attr_e('All customers', 'wpbookingevent');?></p>
                            </li>
                            <?php foreach ($list_customer as $customer) {?>
                                <li class="customer-item item" data-customer_id="<?php esc_html_e($customer->id);?>">
                                    <div class="wrapper-img">
                                        <div class="img-box">
                                            <div>
                                                <i class="fas fa-user-circle"></i>
                                            </div>
                                        </div>
                                    </div>
                                    <p class="customer-name name"><?php esc_html_e($customer->first_name.' '.$customer->last_name) ?></p>
                                </li>
                            <?php }?>
                        </ul>
                        <input type="text" id="Inputcustomer" placeholder="Search customer" title="Type in a name">
                    </div>
                </div>
            </div>
            <div id="calendar"></div>
            <div class="recurring">
                <div class="not-recurring">
                    <i class="fas fa-circle"></i>
                    <p><?php esc_attr_e('Not Recurring', 'wpbookingevent');?></p>
                </div>
                <div class="daily">
                    <i class="fas fa-circle"></i>
                    <p><?php esc_attr_e('Daily', 'wpbookingevent');?></p>
                </div>
                <div class="weekly">
                    <i class="fas fa-circle"></i>
                    <p><?php esc_attr_e('Weekly', 'wpbookingevent');?></p>
                </div>
                <div class="monthly">
                    <i class="fas fa-circle"></i>
                    <p><?php esc_attr_e('Monthly', 'wpbookingevent');?></p>
                </div>
                <div class="book-service">
                    <i class="fas fa-circle"></i>
                    <p><?php esc_attr_e('Service(not edit)', 'wpbookingevent');?></p>
                </div>
            </div>
            <div id="calendarModal" class="modal fade" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
                <div class="modal-dialog modal-dialog-centered" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span> <span class="sr-only"><?php esc_html_e('Close','wpbookingevent') ?></span></button>
                            <h4 id="modalTitle" class="modal-title"><?php esc_html_e('Edit Event','wpbookingevent') ?></h4>
                        </div>
                        <div id="modalBody" class="modal-body">
                            <form  action="<?php echo(UtilityAlias::getBackendGoToLink("calendar.list")) ?>"  method="post" id="changeform" role="form" name="client-form" enctype="multipart/form-data">
                                <div class="start-date-end-date">
                                    <div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <label for="start-date"><?php esc_html_e('Date','wpbookingevent') ?></label>
                                                <input type="text" class="form-control start-date" id="start-date"  placeholder="start date" name="start_date">
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <label for="start-time"><?php esc_html_e('Start time','wpbookingevent') ?></label>
                                                <input type="text" class="form-control start-time" id="start-time"  placeholder="start time" name="start_time">
                                            </div>
                                            <div class="form-group">
                                                <label for="end-time"><?php esc_html_e('End time','wpbookingevent') ?></label>
                                                <input type="text" class="form-control end-time" id="end-time"  placeholder="end time" name="end_time">
                                            </div>

                                        </div>
                                    </div>
                                </div>
                                <div class="select-repeat">
                                    <div class="row">
                                        <div class="col-md-2">
                                            <h5><?php esc_html_e('Repeat','wpbookingevent') ?></h5>
                                        </div>
                                        <div class="col-md-10">
                                            <label class="name-repeat not">
                                                <input type="radio" class="repeat" name="repeat" value="does not repeat" checked/>
                                                does not repeat
                                            </label>
                                            <label class="name-repeat daily">
                                                <input type="radio" class="repeat" name="repeat" value="daily" />
                                                Daily
                                            </label>
                                            <label class="name-repeat weekly">
                                                <input type="radio" class="repeat" name="repeat" value="weekly"/>
                                                Weekly
                                            </label>
                                            <label class="name-repeat monthly">
                                                <input type="radio" class="repeat" name="repeat" value="monthly"/>
                                                Monthly
                                            </label>
                                        </div>
                                    </div>
                                </div>

                                <div class="select-day-of-week">
                                    <div class="row">
                                        <div class="col-md-2">
                                            <h5><?php esc_html_e('Day of week','wpbookingevent') ?></h5>
                                        </div>
                                        <div class="col-md-10">
                                            <?php foreach ($week as $dayName) {?>
                                                <?php $i=$i+1  ?>
                                                <label class="name-day-of-week">
                                                    <input type='checkbox' class="day-of-week" name="day_of_week[]" value="<?php esc_html_e($i);?>" <?php echo(in_array($dayName,$arr_value)? 'checked':''); ?>/>
                                                    <?php esc_html_e($dayName);?>
                                                </label>
                                            <?php }?>
                                        </div>
                                    </div>
                                </div>

                                <div class="select-day-of-month">
                                    <div class="row">
                                        <div class="col-md-2">
                                            <h5><?php esc_html_e('Day of month','wpbookingevent') ?></h5>
                                        </div>
                                        <div class="col-md-10">
                                            <?php foreach ($day as $dayName) {?>
                                                <?php $j=$j+1; ?>
                                                <label class="name-day-of-month">
                                                    <input type='checkbox' class="day-of-month" name="day_of_month[]" value="<?php esc_html_e($j);?>" <?php echo(in_array($dayName,$arr_value)? 'checked':''); ?>/>
                                                    <?php esc_html_e($dayName);?>
                                                </label>
                                            <?php }?>
                                        </div>
                                    </div>
                                </div>


                                <div class="start-date-end-date-recurring">
                                    <div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <label for="start-date"><?php esc_html_e('Start recurring date','wpbookingevent') ?></label>
                                                <input type="text" class="form-control start-date" name="start_date_recurring" id="start-date-recurring" value="" placeholder="start date">
                                            </div>
                                            <div class="form-group">
                                                <label for="end-date"><?php esc_html_e('End recurring date','wpbookingevent') ?></label>
                                                <input type="text" class="form-control end-date" name="end_date_recurring" id="end-date-recurring"  placeholder="end date">
                                            </div>

                                        </div>
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <label for="start-time"><?php esc_html_e('Start recurring time','wpbookingevent') ?></label>
                                                <input type="text" class="form-control start-time" name="start_time_recurring" id="start-time-recurring"  placeholder="start time">
                                            </div>
                                            <div class="form-group">
                                                <label for="end-time"><?php esc_html_e('End recurring time','wpbookingevent') ?></label>
                                                <input type="text" class="form-control end-time" name="end_time_recurring" id="end-time-recurring"  placeholder="end time">
                                            </div>

                                        </div>
                                    </div>
                                </div>
                                <input type="hidden" name="event_id" value="">
                                <input type="hidden" name="id" value="">
                                <input type="hidden" name="order_detail_rate_id" value="">
                                <input type="hidden" name="event_name" value="">
                                <input type="hidden" name="employee_id" value="">
                                <input type="hidden" name="location_id" value="">
                                <input type="hidden" name="event_price" value="">
                                <input type="hidden" name="customer_id" value="">
                                <input type="hidden" name="payment_id" value="">
                                <input type="hidden" name="total" value="">
                                <input type="hidden" name="order_id" value="">
                                <input type="hidden" name="employee_cover" value="">
                                <input type="hidden" name="employee_fullname" value="">
                                <input type="hidden" name="customer_email" value="">
                                <input type="hidden" name="customer_fullname" value="">
                                <input type="hidden" name="location_address" value="">
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal" ><?php esc_html_e('Close','wpbookingevent') ?></button>
                            <button type="submit" id="btnRemoveIt" class="btn btn-danger" data-dismiss="modal" ><?php esc_html_e('Remove','wpbookingevent') ?></button>
                            <button type="submit" id="btnSaveIt" class="btn btn-success" data-dismiss="modal" ><?php esc_html_e('Clone Event','wpbookingevent') ?></button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php
$doc->addLessStyleSheet('admin/app/assets/less/view_list_calendar.less');
$doc->addStyleSheet('admin/app/assets/nb-font-icon/nb-font-icon.css');
$doc->addScriptApplySelector('.view-list-calendar','view_list_calendar',array(
    "list_rate"=>  $this->list,
    "list_order"=>   $this->list_order,
),'admin/app/assets/js/view_list_calendar.js');
?>