<?php

use TourOperatorPro\Factory;
use TourOperatorPro\Html\TourOperatorProHtmlWooPanel as TourOperatorProHtmlWooPanelAlias;
use TourOperatorPro\Utilities\Utility;
use TourOperatorPro\Language\Text;
TourOperatorProHtmlWooPanelAlias::load_jquery_library('icheck');
TourOperatorProHtmlWooPanelAlias::load_jquery_library('confirm');
TourOperatorProHtmlWooPanelAlias::load_jquery_library('loading_js');
TourOperatorProHtmlWooPanelAlias::load_jquery_library('ui_progress_bar');
TourOperatorProHtmlWooPanelAlias::load_jquery_library('waitingfor');
$doc = Factory::getDocument();
$doc->addLessStyleSheet('admin_woopanel/app/assets/less/view_config_install.less');

$input = Factory::getInput();
$toolChecked = $input->get('tool', array(), 'array');
$step = $input->getInt('step', 0);
if ($step == 1) {
    array_unshift($toolChecked, "install_construct");
    array_unshift($toolChecked, "check_required");
    array_push($toolChecked, "finish_install");
}
$step++;
$list_lang_install=array(
       "install_construct"=>touroperator_get_content('Install construct'),
       "check_required"=>touroperator_get_content('Check required'),
       "setup_sample_database"=>touroperator_get_content('Setup sample database'),
       "import_media_sample"=>touroperator_get_content('Import media sample'),
       "finish_install"=>touroperator_get_content('Finish install'),
);
?>
    <div class="view-config-install">
        <div class="row">
            <div class="col-md-3"></div>
            <div class="col-md-6">
                <div class="form-install" title="Form install">
                    <div class="tool-bar">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="pull-right">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="wrapper-main-tool">
                        <h3><?php esc_attr_e('Welcome to tour operator pro','touroperatorpro')?></h3>
                        <form action="<?php echo(Factory::getRootUrl()) ?>/wp-admin/admin.php?page=wb_config&layout=install" name="admin-form" method="post">
                            <h4 class="setup"><?php esc_attr_e('Setup','touroperatorpro')?></h4>
                            <div class="wrapper-tool">
                                <ul class="list-tool">
                                    <li>
                                        <label title="<?php esc_attr_e('Check required','touroperatorpro')?>">
                                            <input class="tool-item" checked disabled value="" type="checkbox"> <?php esc_attr_e('Check required','touroperatorpro')?>
                                        </label>
                                        <div class="description-content">
                                        </div>
                                    </li>
                                    <li>
                                        <label title="<?php esc_attr_e('Install construct database','touroperatorpro')?>">
                                            <input class="tool-item" checked disabled value="" type="checkbox">
                                            <?php esc_attr_e('Install construct database','touroperatorpro')?>
                                        </label>
                                    </li>
                                    <li>
                                        <label title="<?php esc_attr_e('Setup sample database','touroperatorpro')?>">
                                            <input class="tool-item" checked <?php echo ($step == 2 ? " disabled " : "") ?>name="tool[]" <?php esc_attr_e(in_array("setup_sample_database",
                                                $toolChecked) ? ' checked ' : '') ?> value="setup_sample_database" type="checkbox"> <?php esc_attr_e('Setup sample database','touroperatorpro')?>(<span class="recommend">recommend</span>)
                                        </label>
                                    </li>
                                    <li>
                                        <label title="<?php esc_attr_e('Import media sample','touroperatorpro')?>">
                                            <input class="tool-item" name="tool[]" <?php echo ($step == 2 ? " disabled " : "") ?> <?php esc_attr_e(in_array("import_media_sample",
                                                $toolChecked) ? ' checked ' : '') ?> value="import_media_sample" type="checkbox"> <?php esc_attr_e('Import media sample','touroperatorpro')?>(<span class="recommend">take 3 minutes, optional</span>)
                                        </label>
                                    </li>
                                </ul>
                                <div class="tool-bar">
                                    <button class="btn btn-primary btn-next"
                                            type="button" <?php echo ($step == 2 ? " disabled " : "") ?>>
                                        Next
                                    </button>
                                </div>
                            </div>
                            <input type="hidden" name="step" value="<?php esc_attr_e($step) ?>">
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php



$doc->addScriptApplySelector('.view-config-install','view_config_install',array(
    "step"=>  (int)$step,
    "tool_check"=>  array_reverse($toolChecked),
    "list_lang_install"=>$list_lang_install
),'admin_woopanel/app/assets/js/view_config_install.js');

