{% extends '_base_create_update.html' %}
{% load i18n %}
{% load static %}
{% load bootstrap %}
{% block form %}
     <form method="post" class="form-horizontal" action="" enctype="multipart/form-data">
         {% csrf_token %}
         <h3>{% trans 'Account' %}</h3>
         {{ form.username|bootstrap_horizontal }}
         {{ form.name|bootstrap_horizontal }}
         {{ form.email|bootstrap_horizontal }}
         {{ form.groups|bootstrap_horizontal }}

         <div class="hr-line-dashed"></div>
         {% block password %} {% endblock %}

         <div class="hr-line-dashed"></div>
         <h3>{% trans 'Security and Role' %}</h3>
         {{ form.role|bootstrap_horizontal }}
         <div class="form-group {% if form.date_expired.errors %} has-error {% endif %}" id="date_5">
             <label for="{{ form.date_expired.id_for_label }}" class="col-sm-2 control-label">{{ form.date_expired.label }}</label>
             <div class="col-sm-9">
                 <div class="input-group date">
                     <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                     <input id="{{ form.date_expired.id_for_label }}" name="{{ form.date_expired.html_name }}" type="text" class="form-control" value="{{ form.date_expired.value|date:'Y-m-d' }}">
                 </div>
                 <span class="help-block ">{{ form.date_expired.errors }}</span>
             </div>
          </div>
           {{ form.date_expired|bootstrap_horizontal }}
         <div class="form-group">
             <label for="{{ form.enable_otp.id_for_label }}" class="col-sm-2 control-label">{% trans 'Enable OTP' %}</label>
             <div class="col-sm-8">
                 {{ form.enable_otp }}
             </div>
         </div>
         <div class="hr-line-dashed"></div>
         <h3>{% trans 'Profile' %}</h3>
         {{ form.phone|bootstrap_horizontal }}
         {{ form.wechat|bootstrap_horizontal }}
         {{ form.comment|bootstrap_horizontal }}
         <div class="hr-line-dashed"></div>
         <div class="form-group">
             <div class="col-sm-4 col-sm-offset-2">
                 <button class="btn btn-white" type="reset">{% trans 'Reset' %}</button>
                 <button id="submit_button" class="btn btn-primary" type="submit">{% trans 'Submit' %}</button>
             </div>
         </div>
     </form>
{% endblock %}
{% block custom_foot_js %}
    <script src="{% static 'js/plugins/datepicker/bootstrap-datepicker.js' %}"></script>
    <script>
        $(document).ready(function () {
            $('.select2').select2();

            $('.input-group.date').datepicker({
                format: "yyyy-mm-dd",
                todayBtn: "linked",
                keyboardNavigation: false,
                forceParse: false,
                calendarWeeks: true,
                autoclose: true
            });
        })
    </script>
{% endblock %}
