{% extends 'admin/edu-cloud/layout.html.twig' %}

{% set submenu = 'key' %}

{% set script_controller = 'setting/cloud-key' %}

{% block maincontent %}
  {% if is_trial() %}
    <div class="row form-group">
      <div class="help-block">
        </br></br>
        <script>
          var _hmt = _hmt || [];
        </script>
        <script charset="utf-8" src="http://wpa.b.qq.com/cgi/wpa.php"></script>

        <p style = "text-align:center;font-size:16px">{{'当前版本为试用版,不能进行更多操作。如需购买授权版,请联系销售人员。'|trans}}{{'电话：'|trans}}4008041114 {{'或 '|trans}}
        <span id="BizQQWPA" onclick="_hmt.push(['_trackEvent', 'advisory', 'click', 'qq'])"><a id="BizQQWPA" href="javascript:" style='text-decoration:none;'>QQ：800023860 </a>。</span>
        </p>
        <script type="text/javascript">
            BizQQWPA.addCustom({aty: '0', a: '0', nameAccount: 800023860, selector: 'BizQQWPA'}); 
        </script>
        </br>
      </div>
    </div>
    <hr>
  {% else %}
    {{ web_macro.flash_messages() }}
    <div class="page-header clearfix">
      <h1 class="pull-left">{{'套餐信息'|trans}}</h1>
    </div>
    {% if info.level|default(null) %}
    <form class="form-horizontal" id="cloud-edition-form" method="post" novalidate>
      <div class="form-group">
        <label class="col-md-3 control-label">{{'套餐名称：'|trans}}</label>
        <div class="col-md-6">
          <p class="form-control-static">{{ info.levelName|default(null) }}
          </p>
        </div>
      </div>
      {% if info.startDate|default(null) and info.endDate|default(null) %}
      <div class="form-group">
        <label class="col-md-3 control-label">{{'服务期限：'|trans}}</label>
        <div class="col-md-6">
          <p class="form-control-static">
            {{ info.startDate|date('Y.m.d') }} - {{ info.endDate|date('Y.m.d') }}
          </p>
        </div>
      </div>
      {% endif %}
      <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
    </form>
    {% elseif info.error|default(null) == 'error' %}
      {{'网络问题，无法连接到EduSoho开放云平台，暂时无法获取信息'|trans}}
    {% else %}
      {{'尚未购买套餐，点击'|trans}}<a href="http://www.edusoho.com/services/price?type=price" target="_blank">{{'这里'|trans}}</a>{{'了解详情'|trans}}
    {% endif %}

    <div class="page-header clearfix">
      <h1 class="pull-left">{{'授权码'|trans}}</h1>
    </div>
    <form class="form-horizontal" id="cloud-setting-form" method="post" novalidate>
      <div class="form-group">
        <label class="col-md-3 control-label">AccessKey</label>
        <div class="col-md-6">
          <p class="form-control-static">{{ setting('storage.cloud_access_key') }}</p>
        </div>
      </div>

      <div class="form-group">
        <label class="col-md-3 control-label">SecretKey</label>
        <div class="col-md-6">
          <p class="form-control-static">
            {{ setting('storage.cloud_secret_key') }}
          </p>
        </div>
      </div>
      {% if setting("developer.debug")|default(0) or info.level|default() == 'none' %}
      <div class="form-group">
        <div class="col-md-6 col-md-offset-3">
          <a href="{{ path('admin_setting_cloud_key_update') }}" class="btn btn-sm btn-default">{{'设置新的授权码'|trans}}</a>
          </div>
      </div>
      {% endif %}

      <div class="form-group" id="loading-text">
        <div class="col-md-6 col-md-offset-3">
          <p class="text-warning"><strong>{{'正在读取授权信息，请稍等...'|trans}}</strong></p>
        </div>
      </div>

      <div id="key-license-info" data-url="{{ path('admin_setting_cloud_key_info') }}">
        
      </div>

      <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
    </form>
  {% endif %}
{% endblock %}