<div class="container-fluid">
    <div class="">
        <div class="row">
            <div class="col-sm-12">
                <div class="fpbx-container">
                    <div class="display no-border">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <div class="col-md-11 h1">
                                        <div class="col-md-3"><a target="_blank" data-placement="right" data-content="<?php echo _('Learn more about module installation') ?>" href="https://informunity.<?php echo _('us')?>/marketplace/asterisk/" class="fa fa-question"></a></div>
                                        <div class="col-md-offset-2 col-md-5">InformUnity Bitrix24<i class="h6">Ver:<?php echo $version?></i></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row col-xs-12">
                            <div class="col-xs-4">
                                <div data-target="#registrationData" data-toggle="modal" class="panel panel-danger iub24_panel">
                                    <div class="panel-heading" >
                                        <h3 class="panel-title"><?php echo _("Registration Data") ?>:<br></h3>
                                    </div>
                                    <div class="panel-body fixed">
                                        <!--#MAIN_1-->
                                        <?php echo $RegistrationData ?>
                                        <!--#END_MAIN_1-->
                                    </div>
                                </div>
                            </div>
                            <div class="col-xs-4">
                                <div class="panel panel-info iub24_panel position-absolute saveOnLeave" id="AdvancedPanel">
                                    <div class="panel-heading">
                                        <h3 class="panel-title"><?php echo _("Advanced") ?>:<br></h3>
                                    </div>
                                    <div class="panel-body fixed">
                                        <?php if($autorized):?>
                                        <!-- Check  softphone button -->
                                        <div class="element-container">
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="form-group">
                                                        <button class='btn' data-bind='check_softphone_comp'><?php echo _("Softphone24 Settings")?></button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <!-- End check softphone button-->
                                        <?php endif;?>

                                        <!--Cache ID's-->
                                        <div class="element-container">
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="row">
                                                        <div class="form-group">
                                                            <div class="col-md-5">
                                                                <label class="control-label" for="clear_cache"><?php echo _("Cache")?></label>
                                                                <i class="fa fa-question-circle fpbx-help-icon" data-for="clear_cache"></i>
                                                            </div>
                                                            <div class="col-md-7">
                                                                <a href="javascript:void(0);" id="clear_cache"><?php echo _("Clear Cache")?></a>
                                                            </div>
                                                        </div>
                                                    </div>

                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <span id="clear_cache-help" class="help-block fpbx-help-block"></span>
                                                </div>
                                            </div>
                                        </div>
                                        <!--END Cache-->
                                        <!--Requests Timeout-->
                                        <div class="element-container">
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="row">
                                                        <div class="form-group">
                                                            <div class="col-md-5">
                                                                <label class="control-label" for="timeout"><?php echo _("Requests Timeout, sec.")?></label>
                                                                <i class="fa fa-question-circle fpbx-help-icon" data-for="timeout"></i>
                                                            </div>
                                                            <div class="col-md-2">
                                                                <select name="timeout" class="form-control protocol">
                                                                    <?php for($i=3;$i <= 10; $i++):?>
                                                                    <option value="<?php echo $i?>" <?php echo $config['timeout'] == $i ? 'selected' : ''?>><?php echo $i?></option>
                                                                    <?php endfor;?>
                                                                </select>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <span id="timeout-help" class="help-block fpbx-help-block"></span>
                                                </div>
                                            </div>
                                        </div>
                                        <!--END Requests Timeout-->
                                        <!-- Download log -->
                                        <div class="element-container">
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="row">
                                                        <div class="form-group">
                                                            <div class="col-md-3">
                                                                <label class="control-label"><?php echo _("Download log")?></label>
                                                            </div>
                                                            <?php if(extension_loaded ('Zip')):?>

                                                            <?php if(!empty($log_files)):?>
                                                            <div class="col-md-5">
                                                                <select class="form-control protocol" name="log-files">
                                                                    <?php foreach($log_files as $log_file):?>
                                                                    <option value='<?php echo $log_file["FILE_NAME"]?>' data-link='<?php echo $log_file["FILE_LINK"]?>'>
                                                                        <?php echo $log_file["FILE_NAME"]?>
                                                                    </option>
                                                                    <?php endforeach;?>
                                                                </select>
                                                            </div>
                                                            <div class="col-md-54">
                                                                <input type="button" value='<?php echo _("Download")?>' data-bind="download_log">
                                                            </div>
                                                            <?php else:?>
                                                            <div class="col-md-9"><b style="color:orange" >ERROR: <?php echo _("Events logging is not set up. Please, check Verbose parameter.")?> </b><a href="config.php?display=logfiles_settings#logfiles_logfiles"><?php echo _("more")?></a></div>
                                                            <?php endif;?>
                                                            <?php else:?>
                                                            <div class="col-md-9"><b style="color:red">ERROR: <?php echo _("Zip extension for PHP is not enabled")?> </b><a href="http://php.net/manual/ru/book.zip.php"><?php echo _("more")?></a></div>
                                                            <?php endif;?>


                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <!-- End Download log -->
                                    </div>
                                </div>
                            </div>
                        </div>


                <!--Modals -->
                    <!--Modal Menus-->
                        <!--Registration Data -->
                        <div id="registrationData" tabindex="-1" class="modal fade in" role="dialog">
                            <div class="modal-dialog modal-lg">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                                        <h2 class="modal-title"><?php echo _("Registration Data")?></h2>
                                    </div>
                                    <div class="modal-body">
                                        <!--#MAIN_1-->
                                        <div class="element-container">
                                            <div class="row">
                                                <div class="col-xs-12">
                                                    <div class="row">
                                                        <div class="form-group">
                                                            <div class="col-xs-4">
                                                                <label class="control-label"
                                                                       for="client_server"><?php echo _("Bitrix24 address")?></label>
                                                                <i class="fa fa-question-circle fpbx-help-icon"
                                                                   data-for="client_server"></i>
                                                            </div>
                                                            <div class="col-xs-2">
                                                                <select name="portal_protocol"
                                                                        class="form-control protocol">
                                                                    <?php
                                                        $exist_client_server_port = parse_url($config['client_server'],PHP_URL_PORT);
                                                        $exist_client_server_scheme = parse_url($config['client_server'],PHP_URL_SCHEME);
                                                        ?>
                                                                    <option value="https"
                                                                    <?php echo ($exist_client_server_scheme == "https" ? ' SELECTED' : '')?>
                                                                    >https</option>
                                                                    <option value="http"
                                                                    <?php echo ($exist_client_server_scheme == "http" ? ' SELECTED' : '')?>
                                                                    >http</option>

                                                                </select>
                                                            </div>
                                                            <div class="col-xs-4">
                                                                <input type="text" name="client_server"
                                                                       id="client_server"
                                                                       class="form-control fields_are_required"
                                                                       value="<?php echo parse_url($config['client_server'],PHP_URL_HOST)?>">
                                                            </div>
                                                            <div class="col-xs-2">
                                                                <input type="text" name="client_server_port"
                                                                       id="client_server_port"
                                                                <?php
                                                        $client_server_port = $exist_client_server_port;
                                                        ?>
                                                                class="form-control fields_are_required port"
                                                                value="<?php echo $client_server_port ? $client_server_port : '443'?>
                                                                ">
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-xs-12">
                                                    <span id="client_server-help" class="help-block fpbx-help-block"></span>
                                                </div>
                                            </div>
                                            <div id="registerError" class="row hidden">
                                                <div class="col-md-12">
                                                    <label class="element-container" style="color:red;"></label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="element-container" id="div_ext_address">
                                            <div class="row">
                                                <div class="col-xs-12">
                                                    <div class="row">
                                                        <div class="form-group">
                                                            <div class="col-xs-4">
                                                                <label class="control-label"
                                                                       for="ext_address"><?php echo _("FreePBX address")?></label>
                                                                <i class="fa fa-question-circle fpbx-help-icon"
                                                                   data-for="ext_address"></i>
                                                            </div>
                                                            <div class="col-xs-2">
                                                                <select name="fpbx_protocol"
                                                                        class="form-control protocol">
                                                                    <?php
                                                        $exist_ext_address_port = parse_url($config['ext_address'],PHP_URL_PORT);
                                                        $exist_ext_address_scheme = parse_url($config['ext_address'],PHP_URL_SCHEME);
                                                        ?>
                                                                    <option value="http"
                                                                    <?php echo ($exist_ext_address_scheme == "http" ? ' SELECTED' : '')?>
                                                                    >http</option>
                                                                    <option value="https"
                                                                    <?php echo ($exist_ext_address_scheme == "https" ? ' SELECTED' : '')?>
                                                                    >https</option>
                                                                </select>
                                                            </div>
                                                            <div class="col-xs-4">
                                                                <input type="text" name="ext_address" id="ext_address"
                                                                       class="form-control fields_are_required"
                                                                       value="<?php echo parse_url($config['ext_address'],PHP_URL_HOST)?>">
                                                            </div>
                                                            <div class="col-xs-2">
                                                                <input type="text" name="ext_address_port"
                                                                       id="ext_address_port"
                                                                <?php
                                                        $ext_address_port = $exist_ext_address_port;
                                                        ?>
                                                                class="form-control fields_are_required port"
                                                                value="<?php echo $ext_address_port ? $ext_address_port : '80' ?>
                                                                ">
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-xs-12">
                                                    <span id="ext_address-help" class="help-block fpbx-help-block"></span>
                                                </div>
                                            </div>
                                        </div>

                                    </div>
                                    <div class="modal-footer">
                                        <button class='btn' id="registerModule" name='registerModule'><?php echo _("Register")?></button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--END Registration Data -->
                    <!--End Modal Menus-->
                    <!--Modal Actions-->
                        <!--Access Code-->
                        <div id="modal_access_code" tabindex="-1" class="modal" role="dialog">
                            <div class="modal-dialog modal-md">
                                <div class="modal-content panel-danger">
                                    <div class="panel-heading">
                                        <h2 class="panel-title"><?php echo _("Access Code") ?></h2>
                                    </div>
                                    <div class="panel-body">
                                        <!--Access Code-->
                                        <div class="element-container">
                                            <div class="row">
                                                <div class="col-xs-12">
                                                    <div class="row">
                                                        <div class="form-group">
                                                            <div class="col-xs-12">
                                                                <input class="form-control" id="access_code"
                                                                       name="access_code" value="" type="text">
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                        </div>
                                        <!--END Description-->
                                    </div>
                                    <div class='modal-footer '>
                                        <button class='btn btn-default' data-dismiss='modal' aria-hidden='true'><?php echo _("Return") ?></button>
                                        <button class='btn btn-primary' id='modal_register_ok' data-dismiss='modal'><?php echo _("Register") ?></button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--End Access Code-->
                    <!--End Modal Actions -->
                <!--END MODAL-->
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php echo $textHelpers ?>



