{% load i18n %}


<script type="text/javascript">
    $(document).ready(function(){
        


        $('.btn-confirm').removeAttr("style",""); 
        $('.btn-confirm').unbind('click').bind('click',function(){    
            $(this).hide();
            $('form').ajaxSubmit({
                type: 'post',
                url: '{{request.path}}{{form.instance.id}}/',    
                success: function(html) {
                    $('form').html(html);         
                        
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    alert('连接服务器失败');                        
                }                    
            });
            return; // 阻止表单自动提交事件  
        }).show();

        



        
        {% if is_saved %}   
            $('#confirm-url-modal').modal('hide');                 
            $.RefreshContent('/company/orginazition/cgroup/');
            
        {% endif %}




        /*  
       
        $('.btn-save').click(function(){    
            $(this).hide();
            $('form').ajaxSubmit({
                type: 'post',
                url: '{{request.path}}{{form.instance.id}}/',    
                success: function(html) {
                    $('#cgroup_edit').html(html);     

                        
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    alert('连接服务器失败');                        
                }                    
            });
            return; // 阻止表单自动提交事件  
        });

        {% if is_saved %}   
            toastr.success('数据已保存。', '操作完成：');  
            
        {% endif %}
        */
    });
</script>

   
<div class="row">    
    <form role="form" method='POST' class="form-horizontal"> {% csrf_token %}    
        {% if messages %}
            {% for message in messages %}
                <div class="alert {% if message.tags %} alert-{{ message.tags }}{% endif %}">{{ message|safe }}</div>
            {% endfor %}
        {% endif %}
        {% if form.errors %}
            <div class="alert alert-error">
                <h4>{% trans '数据输入有错误,请先改正以下错误:' %}</h4>
                <ul>
                    {% for field in form %}
                        {% if field.errors %}
                            {% for error in field.errors %}
                                <li class="error">{{ field.label}}: {{ error|escape }}</li>
                            {% endfor %}
                        {% endif %}
                    {% endfor %}
                </ul>
                {% if form.non_field_errors %}
                    {{ form.non_field_errors }}
                {% endif %}
            </div>
        {% endif %}
        {% for hidden_field in form.hidden_fields %}
            {{ hidden_field }}
        {% endfor %}      
        
        {{form.id}}
        
        <div class="form-group ">
            <label class="col-sm-2 control-label ">{% trans '功能组别:' %} </label>
            <div class="col-sm-10">{{ form.name }}</div>
        </div>   
        <div class="form-group ">
            <label class="col-sm-2 control-label ">{% trans '备注说明:' %} </label>
            <div class="col-sm-10">{{form.remark}}</div>
        </div>
        <div class="form-group ">
            <label class="col-sm-2 control-label ">{% trans '是否停用:' %} </label>
            <div class="col-sm-10" style='margin-top:6px;'>{{form.is_delete}}</div>
        </div>      
              
   
      
    </form>
</div>

