<#-- @ftlvariable name="serp" type="com.serphacker.serposcope.models.google.GoogleSerp" -->
<#import "../admin.ftl.html" as layout>
<@layout.adminLayout i18n("admin.settings.title") >

<div class="row" >
    <div class="col-xs-12" >
        <div class="col-xs-12 col-md-offset-3 col-md-6  setting-form" >
            <form class="form" method="post" action="${reverseRoute("admin.SettingsController","update")}" >
                <@authenticityForm/>
                  
                <hr/>
                <h2 class="styled-h2">${i18n("label.general")}</h2>
                
                <hr/>
                <div class="form-group" >
                    <label for="cronTime" >${i18n("admin.settings.cronTime")} (${i18n("label.serverTime")} = ${serverTime})</label>
                    <input id="cronTime" class="form-control" name="cronTime" placeholder="${i18n("admin.settings.cronTimeExample")}"
                        value="<#if config.getCronTime()??><#if config.getCronTime().getHour() < 10>0</#if>${config.getCronTime().getHour()}:<#if config.getCronTime().getMinute() < 10>0</#if>${config.getCronTime().getMinute()}</#if>"
                    >
                    <span class="help-block">${i18n("admin.settings.cronTimeHelp")}</span>
                </div>
                
                <hr/>
                <div class="form-group" >
                    <label for="pruneRuns" >${i18n("admin.settings.historyLimit")}</label>
                    <span class="help-block">
                        ${i18n("label.dbSize")} : <strong><#if diskUsage?? >${diskUsage}<#else>${i18n("label.unavailableOnMySQL")}</#if></strong> |
                        ${i18n("label.diskFree")} : <strong><#if diskFree?? >${diskFree}<#else>${i18n("label.unavailable")}</#if></strong> |
                        ${i18n("label.tasks")} : <strong>${runs}</strong>
                    </span>
                    <div class="input-group" >
                        <input id="pruneRuns" class="form-control" name="pruneRuns" placeholder="0 to disable" value="${config.getPruneRuns()}" >
                        <span class="input-group-btn">
                            <button class="btn btn-danger btn-prune-now" type="button"
                                data-warning="${i18n("admin.settings.pruneWarning")}"
                                data-action="${reverseRoute("admin.SettingsController","prune")}" >${i18n("admin.settings.pruneNow")}</button>
                        </span>
                    </div>
                    <div class="help-block">${i18n("admin.settings.historyLimitHelp")}</div>
                </div>                
                
                <hr/>
                <h2 class="styled-h2">${i18n("label.display")}</h2>
                
                <hr/>
                <div class="form-group" >
                    <label for="displayHome" >${i18n("admin.settings.searchDisplayMode")}</label>
                    <div>
                        <div class="btn-group" data-toggle="buttons">
                            <label class="btn btn-default <#if config.getDisplayHome() == "summary" >active</#if>">
                                <input type="radio" name="displayHome" value="summary" <#if config.getDisplayHome() == "summary" >checked="checked"</#if> > 
                                <i class="fa fa-th-large" ></i> ${i18n("label.summary")}
                            </label>
                            <label class="btn btn-default <#if config.getDisplayHome() == "table" >active</#if>">
                                <input type="radio" name="displayHome" value="table" <#if config.getDisplayGoogleTarget() == "table" >checked="checked"</#if>>
                                <i class="fa fa-table" ></i> ${i18n("label.table")}
                            </label>
                        </div>         
                    </div>
                </div>                
                
                <div class="form-group" >
                    <label for="displayGoogleTarget" >${i18n("admin.settings.targetDisplayMode")}</label>
                    <div>
                        <div class="btn-group" data-toggle="buttons">
                            <label class="btn btn-default <#if config.getDisplayGoogleTarget() == "variation" >active</#if>">
                                <input type="radio" name="displayGoogleTarget" value="variation" <#if config.getDisplayGoogleTarget() == "variation" >checked="checked"</#if> > 
                                <i class="fa fa-random" ></i> ${i18n("google.target.variations")}
                            </label>                            
                            <label class="btn btn-default <#if config.getDisplayGoogleTarget() == "chart" >active</#if>">
                                <input type="radio" name="displayGoogleTarget" value="chart" <#if config.getDisplayGoogleTarget() == "chart" >checked="checked"</#if> > 
                                <i class="glyphicon glyphicon-signal" ></i> ${i18n("label.chart")}
                            </label>
                            <label class="btn btn-default <#if config.getDisplayGoogleTarget() == "table" >active</#if>">
                                <input type="radio" name="displayGoogleTarget" value="table" <#if config.getDisplayGoogleTarget() == "table" >checked="checked"</#if>>
                                <i class="fa fa-table" ></i> ${i18n("label.table")}
                            </label>
                        </div>         
                    </div>
                </div>                

                <div class="form-group" >
                    <label for="displayGoogleSearch" >${i18n("admin.settings.searchDisplayMode")}</label>
                    <div>
                        <div class="btn-group" data-toggle="buttons">
                            
                            <label class="btn btn-default <#if config.getDisplayGoogleSearch() == "split" >active</#if>">
                                <input type="radio" name="displayGoogleSearch" value="split" <#if config.getDisplayGoogleSearch() == "split" >checked="checked"</#if> > 
                                <i class="glyphicon glyphicon-th-large" ></i> ${i18n("label.split")}
                            </label>                            
                            <label class="btn btn-default <#if config.getDisplayGoogleSearch() == "chart" >active</#if>">
                                <input type="radio" name="displayGoogleSearch" value="chart" <#if config.getDisplayGoogleSearch() == "chart" >checked="checked"</#if>> 
                                <i class="glyphicon glyphicon-signal" ></i> ${i18n("label.chart")}
                            </label>
                            <label class="btn btn-default <#if config.getDisplayGoogleSearch() == "table" >active</#if>">
                                <input type="radio" name="displayGoogleSearch" value="table" <#if config.getDisplayGoogleSearch() == "table" >checked="checked"</#if>>
                                <i class="glyphicon glyphicon-list-alt" ></i> SERP
                            </label>                            
                        </div>         
                    </div>
                </div>

                <hr/>
                
                <h2 class="styled-h2">${i18n("label.captcha")} <span style="text-transform: none;">(<a href="https://serposcope.serphacker.com/fr/doc/faq.html?pk_campaign=serposcope#captcha" target="_blank" >${i18n("label.help")}</a>)</span></h2>
                <hr/>
                
                <div>
                    <p class="help-block" >${i18n("admin.settings.captchaHelp")}</p>
                </div>
                
                <!-- anticaptcha -->
                <div class="form-group" >
                    <label for="anticaptchaApiKey" >${i18n("admin.settings.anticaptchaApiKey")}</label>
                    <input id="anticaptchaApiKey" class="form-control" name="anticaptchaApiKey" value="${config.getAnticaptchaKey()!""}" >
                </div>

                <div class="form-group">
                    <div class="pull-right">
                        <a href="${reverseRoute("admin.SettingsController","testCaptcha")}" class="btn btn-default btn-test-captcha"
                           data-service="anticaptcha" >${i18n("admin.settings.testCredentials")}</a>
                    </div>
                    <div><a rel="noreferrer" href="http://getcaptchasolution.com/6dpc07kilc" target="_blank" >www.anti-captcha.com</a></div>
                </div>
                <hr/>
                
                <!-- 2captcha -->
                <div class="form-group" >
                    <label for="twoCaptchaKey" >${i18n("admin.settings.twoCaptchaKey")}</label>
                    <input id="twoCaptchaKey" class="form-control" name="twoCaptchaKey" value="${config.getTwoCaptchaKey()!""}" >
                </div>

                <div class="form-group">
                    <div class="pull-right">
                        <a href="${reverseRoute("admin.SettingsController","testCaptcha")}" class="btn btn-default btn-test-captcha"
                           data-service="twocaptcha" >${i18n("admin.settings.testCredentials")}</a>
                    </div>
                    <div><a rel="noreferrer" href="https://2captcha.com?from=5245306" target="_blank" >2captcha.com</a></div>
                </div>
                <hr/>
                
                <!-- imagetyperz -->
                <div class="form-group" >
                    <label for="imageTyperzKey" >${i18n("admin.settings.imageTyperzKey")}</label>
                    <input id="imageTyperzKey" class="form-control" name="imageTyperzKey" value="${config.getImageTyperzKey()!""}" >
                </div>

                <div class="form-group">
                    <div class="pull-right">
                        <a href="${reverseRoute("admin.SettingsController","testCaptcha")}" class="btn btn-default btn-test-captcha"
                           data-service="imagetyperz" >${i18n("admin.settings.testCredentials")}</a>
                    </div>
                    <div><a rel="noreferrer" href="https://www.imagetyperz.com" target="_blank" >www.imagetyperz.com</a></div>
                </div>
                <hr/>                
                
                <!-- deathbycaptcha -->
                <div class="form-group" >
                    <label for="dbcUser" >${i18n("admin.settings.dbcLogin")}</label>
                    <input id="dbcUser" class="form-control" name="dbcUser" value="${config.getDbcUser()!""}" >
                </div>

                <div class="form-group" >
                    <label for="dbcPass" >${i18n("admin.settings.dbcPass")}</label>
                    <input id="dbcPass" class="form-control" name="dbcPass" value="${config.getDbcPass()!""}" >
                </div>
                
                <div class="form-group">
                    <div class="pull-right">
                        <a href="${reverseRoute("admin.SettingsController","testCaptcha")}" class="btn btn-default btn-test-captcha" 
                           data-service="dbc" >${i18n("admin.settings.testCredentials")}</a>
                    </div>
                    <div><a rel="noreferrer"href="http://www.deathbycaptcha.com/" target="_blank" >www.deathbycaptcha.com</a></div>
                </div>
                <hr/>
                
                <!-- decaptcher -->
<!--                <div class="form-group" >
                    <label for="decaptcherUser" >${i18n("admin.settings.decaptcherLogin")}</label>
                    <input id="decaptcherUser" class="form-control" name="decaptcherUser" value="${config.getDecaptcherUser()!""}" >
                </div>

                <div class="form-group" >
                    <label for="decaptcherPass" >${i18n("admin.settings.decaptcherPass")}</label>
                    <input id="decaptcherPass" class="form-control" name="decaptcherPass" value="${config.getDecaptcherPass()!""}" >
                </div>
                
                <div class="form-group">
                    <div class="pull-right">
                        <a href="${reverseRoute("admin.SettingsController","testCaptcha")}" class="btn btn-default btn-test-captcha"
                           data-service="decaptcher" >${i18n("admin.settings.testCredentials")}</a>
                    </div>
                    <div><a rel="noreferrer"href="https://de-captcher.com/" target="_blank" >www.de-captcher.com</a></div>
                </div>
                <hr/>-->
                
                <input type="button" id="btn-reset-settings" class="btn btn-default" value="${i18n("label.reset")}" 
                       data-action="${reverseRoute("admin.SettingsController","reset")}" />
                       <input type="submit" class="btn btn-primary" value="${i18n("label.save")}" />
            </form>
        </div>
    </div>
</div>
<div class="csp-script" data-src="adminSettingsController.settings" ></div>
</@>