<?php

use WpBookingPro\Factory;
use WpBookingPro\Language\Text;
use WpBookingPro\Utilities\Utility;
$doc = Factory::getDocument();
$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_attr_e('Before download please check database structor','wpbookingpro')?></p>
            <p><?php esc_attr_e('When you successfully download please open with phpstorm then check the error code','wpbookingpro')?></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','wpbookingpro') ?></a>
                        <a class="btn btn-primary"
                           href="<?php echo (Utility::getBackendGoToLink('tool.list_page_front_end')) ?>"><?php esc_html_e('List page frontend','wpbookingpro') ?></a>

                        <a class="btn btn-primary"
                           href="<?php echo (Utility::getBackendGoToLink('tool.setup_view')) ?>"><?php esc_html_e('Setup view','wpbookingpro') ?></a>
                        <a class="btn btn-primary"
                           href="<?php echo (Utility::getBackendGoToLink('tool.create_sample_data')) ?>"><?php esc_html_e('Create sample data','wpbookingpro') ?></a>
                        <a class="btn btn-primary btn-download-package"
                           href="<?php echo (Utility::getBackendGoToLink('tool.download_package')) ?>"><?php esc_html_e('Download package','wpbookingpro') ?></a>
                        <a class="btn btn-primary btn-download-package"
                           href="<?php echo (Utility::getBackendGoToLink('tool.import_data_appointment')) ?>"><?php esc_html_e('Import data appointment','wpbookingpro') ?></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','wpbookingpro') ?></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 (esc_attr(in_array("setup_sample_page", $toolChecked) ? ' checked ' : '')) ?> value="setup_sample_page" type="checkbox">
                                            <?php esc_html_e('Setup page sample','wpbookingpro') ?>
                                        </label>
                                    </li>
                                    <li>
                                        <label>
                                            <input class="tool-item" name="tool[]" <?php echo (esc_attr(in_array("setup_sample_database", $toolChecked) ? ' checked ' : ''))?> value="setup_sample_database" type="checkbox" />
                                            <?php esc_html_e('Setup sample database','wpbookingpro') ?>
                                        </label>
                                    </li>
                                    <li>
                                        <label>
                                            <input class="tool-item" name="tool[]" <?php echo (esc_attr(in_array("backup_database", $toolChecked) ? ' checked ' : '')) ?> value="backup_database" type="checkbox" />
                                            <?php esc_html_e('Backup database','wpbookingpro') ?>
                                        </label>
                                    </li>
                                    <li>
                                        <label>
                                            <input class="tool-item" name="tool[]" <?php echo (esc_attr(in_array("backup_media", $toolChecked) ? ' checked ' : '')) ?> value="backup_media" type="checkbox" />
                                            <?php esc_html_e('Backup media','wpbookingpro') ?>
                                        </label>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="col-md-9">
                            <div class="description">
                                <?php esc_html_e('Description when hover tool','wpbookingpro') ?>
                            </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','wpbookingpro') ?></button>
                        </div>
                    </div>
                </div>
                <input type="hidden" name="step" value="<?php echo (esc_attr($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');
