#@layout()
#define css()
<style type="text/css">
    .switchery-item {
        padding-bottom: 10px;
    }

    .switchery-item .switchery-small {
        margin-top: -2px;
        margin-right: 10px;
    }
</style>
#end

#define content()
<div class="content-wrapper">

    <section class="content-header">
        <h1>
            商品设置
            <small>Product Setting</small>
        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-xs-12">
                <div class="box box-primary">
                    <div class="box-header ">
                        <h3 class="box-title"></h3>
                    </div>
                    <!-- form start -->
                    <form class="form-horizontal form-setting" autocomplete="off" id="optionForm">
                        <div class="box-body ">


                            <h4 class="page-first-header">评论功能</h4>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"></label>
                                <div class="col-sm-6">
                                    <div class="switchery-item">
                                        <input type="checkbox" class="switchery" data-for="product_comment_enable"
                                               #checkedIf(option("product_comment_enable"))>
                                        <input type="hidden" id="product_comment_enable" name="product_comment_enable">
                                        开启评论功能
                                    </div>
                                    <div class="switchery-item">
                                        <input type="checkbox" class="switchery"
                                               data-for="product_comment_unlogin_enable" #checkedIf(option("product_comment_unlogin_enable"))>
                                        <input type="hidden" id="product_comment_unlogin_enable"
                                               name="product_comment_unlogin_enable"> 允许未登录用户发表评论
                                    </div>
                                    <div class="switchery-item">
                                        <input type="checkbox" class="switchery"
                                               data-for="product_comment_review_enable" #checkedIf(option("product_comment_review_enable"))>
                                        <input type="hidden" id="product_comment_review_enable"
                                               name="product_comment_review_enable"> 评论必须经过管理员审核
                                    </div>
                                    <div class="switchery-item">
                                        <input type="checkbox" class="switchery" data-for="product_comment_vcode_enable"
                                               #checkedIf(option("product_comment_vcode_enable"))>
                                        <input type="hidden" id="product_comment_vcode_enable"
                                               name="product_comment_vcode_enable"> 启用评论验证码功能
                                    </div>
                                </div>
                            </div>


                            <h4 class="page-header">评论邮件通知管理员</h4>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">启用</label>
                                <div class="col-sm-6">
                                    <input type="checkbox" class="switchery"
                                           data-for="product_comment_email_notify_enable"
                                           #checkedIf(option("product_comment_email_notify_enable"))>
                                    <input type="hidden" id="product_comment_email_notify_enable"
                                           name="product_comment_email_notify_enable">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">管理员邮箱</label>
                                <div class="col-sm-6">
                                    <input type="input" class="form-control" placeholder="例如：email@jpress.io"
                                           name="product_comment_email_notify_address"
                                           value="#option('product_comment_email_notify_address')">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">通知邮件模板</label>
                                <div class="col-sm-6">
                                    <textarea rows="3" class="form-control" placeholder="..."
                                              name="product_comment_email_notify_template">#option('product_comment_email_notify_template')</textarea>
                                    <p class="help-block"> 请先在 <a href="#(CPATH)/admin/setting/connection">[通信]</a> 开启邮件功能后才能使用。
                                    </p>
                                </div>
                            </div>


                            <h4 class="page-header">评论短信通知管理员</h4>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">启用</label>
                                <div class="col-sm-6">
                                    <input type="checkbox" class="switchery"
                                           data-for="product_comment_sms_notify_enable"
                                           #checkedIf(option("product_comment_sms_notify_enable"))>
                                    <input type="hidden" id="product_comment_sms_notify_enable"
                                           name="product_comment_sms_notify_enable">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">管理员手机号</label>
                                <div class="col-sm-6">
                                    <input type="input" class="form-control" placeholder="例如：18612345678"
                                           name="product_comment_sms_notify_mobile"
                                           value="#option('product_comment_sms_notify_mobile')">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">通知短信模板</label>
                                <div class="col-sm-6">
                                    <textarea rows="2" class="form-control" placeholder="..."
                                              name="product_comment_sms_notify_template">#option('product_comment_sms_notify_template')</textarea>
                                    <p class="help-block"> 请先在 <a href="#(CPATH)/admin/setting/connection">[通信]</a> 开启短信功能，这里填写阿里云或腾讯云的短信模板ID。
                                    </p>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">短信签名</label>
                                <div class="col-sm-6">
                                    <input type="input" class="form-control" placeholder="只有部分服务商需要短信签名"
                                           name="product_comment_sms_notify_sign"
                                           value="#option('product_comment_sms_notify_sign')">
                                    <p class="help-block"> 请填写阿里云或腾讯云的短信签名。</p>
                                </div>
                            </div>


                            <h4 class="page-header">产品搜索功能</h4>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">启用</label>
                                <div class="col-sm-6">
                                    <input type="checkbox" class="switchery"
                                           data-for="product_search_enable"
                                           #checkedIf(option("product_search_enable","true"))>
                                    <input type="hidden" id="product_search_enable"
                                           name="product_search_enable">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">搜索引擎</label>
                                <div class="col-sm-6">
                                    <select class="form-control" name="product_search_engine">
                                        <option value="sql" #selectedIf(option(
                                        'product_search_engine') == 'sql')>默认（数据库SQL检索）</option>
                                        <option value="lucene" #selectedIf(option(
                                        'product_search_engine') == 'lucene')>Lucene</option>
                                        <option value="es" #selectedIf(option(
                                        'product_search_engine') == 'es')>ElasticSearch</option>
                                        <option value="aliopensearch" #selectedIf(option(
                                        'product_search_engine') == 'aliopensearch')>阿里云OpenSearch</option>
                                    </select>
                                    <p class="help-block"> 注意：选择 ElasticSearch 或 OpenSearch 需要在下方填写对应的服务器配置。</p>
                                </div>
                            </div>

                            <h4 class="page-header">ElasticSearch 服务器配置</h4>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">服务器地址</label>
                                <div class="col-sm-6">
                                    <input type="input" class="form-control" placeholder="请填写ElasticSearch的IP地址或域名"
                                           name="product_search_es_host"
                                           value="#option('product_search_es_host')">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">服务器端口号</label>
                                <div class="col-sm-6">
                                    <input type="input" class="form-control" placeholder="以及端口号（默认值：9200）"
                                           name="product_search_es_port"
                                           value="#option('product_search_es_port')">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">认证账号</label>
                                <div class="col-sm-6">
                                    <input type="input" class="form-control" placeholder="ElasticSearch服务器的账号"
                                           name="product_search_es_username"
                                           value="#option('product_search_es_username')">
                                    <p class="help-block">若服务器不配置，不要填写任何内容。</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">密码</label>
                                <div class="col-sm-6">
                                    <input type="input" class="form-control" placeholder="以及密码"
                                           name="product_search_es_password"
                                           value="#option('product_search_es_password')">
                                    <p class="help-block">若服务器不配置，不要填写任何内容。</p>
                                </div>
                            </div>


                            <h4 class="page-header">阿里云 OpenSearch 配置</h4>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">accesskey</label>
                                <div class="col-sm-6">
                                    <input type="input" class="form-control" placeholder="您的阿里云的Access Key ID"
                                           name="product_search_aliopensearch_accesskey"
                                           value="#option('product_search_aliopensearch_accesskey')">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">密钥 Secret</label>
                                <div class="col-sm-6">
                                    <input type="input" class="form-control" placeholder="阿里云 Access Key ID 对应的 Access Key Secret"
                                           name="product_search_aliopensearch_secret"
                                           value="#option('product_search_aliopensearch_secret')">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">应用名称 appName</label>
                                <div class="col-sm-6">
                                    <input type="input" class="form-control" placeholder="您在阿里云创建的 OpenSearch 应用名称"
                                           name="product_search_aliopensearch_appname"
                                           value="#option('product_search_aliopensearch_appname')">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">OpenSearch 的 API 域名</label>
                                <div class="col-sm-6">
                                    <input type="input" class="form-control" placeholder="例如：http://opensearch-cn-qingdao.aliyuncs.com"
                                           name="product_search_aliopensearch_host"
                                           value="#option('product_search_aliopensearch_host')">
                                    <p class="help-block">若 JPress 运行服务器 和 OpenSearch 都使用阿里云同一区域的服务器，建议填写内网域名（性能更好），否则请填写公网域名。</p>

                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">已配置自动同步数据库</label>
                                <div class="col-sm-6">
                                    <input type="checkbox" class="switchery"
                                           data-for="product_search_aliopensearch_autosync"
                                           #checkedIf(option("product_search_aliopensearch_autosync"))>
                                    <input type="hidden" id="product_search_aliopensearch_autosync"
                                           name="product_search_aliopensearch_autosync">
                                    <p class="help-block">不会配置请点击 <a href="https://help.aliyun.com/document_detail/29123.html" target="_blank">这里</a> 访问阿里云帮助文档。</p>

                                </div>
                            </div>

                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <div class="col-sm-offset-2 col-sm-10 submit-block">
                                <div class="box-submit">
                                    <button type="submit" class="btn btn-primary">提交</button>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-footer -->
                    </form>
                </div>
            </div>
        </div>

    </section>

</div>
#end
