<?php

use WpBookingHotel\Factory;
use WpBookingHotel\Html\WpBookingHotelHtmlBackend as WpBookingHotelHtmlBackendAlias;
use WpBookingHotel\Language\Text;
use WpBookingHotel\Utilities\Utility;

WpBookingHotelHtmlBackendAlias::load_jquery_library('icheck');
WpBookingHotelHtmlBackendAlias::load_jquery_library('confirm');
$doc = Factory::getDocument();
$doc->addLessStyleSheet('admin/app/assets/less/view_tool.less');
$input = Factory::getInput();
$step = $input->getInt('step', 0);
$step++;
$toolChecked = $input->get('tool', array(), 'array');
?>
    <div class="view-tool-form">
        <div class="notification-before-download hide">
            <p><?php esc_html_e('Before download please check database structor','wpbookinghotel')?></p>
            <p><?php esc_html_e('When you successfully download please open with phpstorm then check the error code','wpbookinghotel')?></p>
        </div>
        <div class="tool-bar">
            <div class="row">
                <div class="col-md-12">
                    <div class="pull-right">
                        <a class="btn btn-primary"
                           href="<?php echo (Utility::getBackendGoToLink('tool.create_view')) ?>"><?php esc_html_e('Create view','wpbookinghotel') ?></a>
                        <a class="btn btn-primary"
                           href="<?php echo (Utility::getBackendGoToLink('tool.list_page_front_end')) ?>"><?php esc_html_e('List page frontend','wpbookinghotel') ?></a>

                        <a class="btn btn-primary"
                           href="<?php echo (Utility::getBackendGoToLink('tool.setup_view')) ?>"><?php esc_html_e('Setup view','wpbookinghotel') ?></a>
                        <a class="btn btn-primary"
                           href="<?php echo (Utility::getBackendGoToLink('tool.create_sample_data')) ?>"><?php esc_html_e('Create sample data','wpbookinghotel') ?></a>
                        <a class="btn btn-primary btn-download-package"
                           href="<?php echo (Utility::getBackendGoToLink('tool.download_package')) ?>"><?php esc_html_e('Download package','wpbookinghotel') ?></a>
                        <a class="btn btn-primary btn-download-package"
                           href="<?php echo (Utility::getBackendGoToLink('tool.import_data_hotel')) ?>"><?php esc_html_e('Import data hotel','wpbookinghotel') ?></a>
                    </div>
                </div>
            </div>
        </div>
        <div class="wrapper-main-tool">
            <form action="" name="admin-form" method="post">
                <div class="row">
                    <div class="col-md-offset-3 col-md-9">
                        <h3 class="setup"><?php esc_html_e('Setup','wpbookinghotel') ?></h3>
                    </div>
                </div>
                <div class="body">
                    <div class="row">
                        <div class="col-md-3">
                            <div class="wrapper-tool">
                                <ul class="list-tool">
                                    <li>
                                        <label>
                                            <input class="tool-item" name="tool[]" <?php echo (in_array("setup_sample_page", $toolChecked) ? ' checked ' : '') ?> value="setup_sample_page" type="checkbox">
                                            <?php esc_html_e('Setup page sample','wpbookinghotel') ?>
                                        </label>
                                    </li>
                                    <li>
                                        <label>
                                            <input class="tool-item" name="tool[]" <?php echo (in_array("setup_sample_database", $toolChecked) ? ' checked ' : '')?> value="setup_sample_database" type="checkbox" />
                                            <?php esc_html_e('Setup sample database','wpbookinghotel') ?>
                                        </label>
                                    </li>
                                    <li>
                                        <label>
                                            <input class="tool-item" name="tool[]" <?php echo (in_array("backup_database", $toolChecked) ? ' checked ' : '') ?> value="backup_database" type="checkbox" />
                                            <?php esc_html_e('Backup database','wpbookinghotel') ?>
                                        </label>
                                    </li>
                                    <li>
                                        <label>
                                            <input class="tool-item" name="tool[]" <?php echo (in_array("backup_media", $toolChecked) ? ' checked ' : '') ?> value="backup_media" type="checkbox" />
                                            <?php esc_html_e('Backup media','wpbookinghotel') ?>
                                        </label>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="col-md-9">
                            <div class="description">
                                <?php esc_html_e('Description when hover tool','wpbookinghotel') ?>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="tool-bar pull-right">
                            <button class="btn btn-primary btn-next" type="button"><?php  esc_html_e('Next','wpbookinghotel') ?></button>
                        </div>
                    </div>
                </div>
                <input type="hidden" name="step" value="<?php echo ($step) ?>">
                <input type="hidden" name="task" value="tool.next">
            </form>
        </div>
    </div>
<?php
$doc->addScriptApplySelector('.view-tool-form','view_tool',array(
    "step"=>  (int)$step,
    "tool_check"=>  json_encode($toolChecked),
),'admin/app/assets/js/view_tool.js');
