<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="edit_field.aspx.cs" Inherits="wjdhcms_SAAS.module.model.edit_field" %>


<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>内容</title>
    <!-- start: CSS file-->
    <!-- Vendor CSS-->
    <link href="../static/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="../static/vendor/skycons/css/skycons.css" rel="stylesheet" />
    <link href="../static/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
    <!-- Plugins CSS-->
    <link href="../static/plugins/bootkit/css/bootkit.css" rel="stylesheet" />
    <!-- Page CSS -->   
    <link href="../static/css/style.css" rel="stylesheet" />
    <link href="../static/css/add-ons.min.css" rel="stylesheet" />

    <!-- end: CSS file--> 
    <!-- Head Libs -->
    <script src="../static/plugins/modernizr/js/modernizr.js"></script>
    
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="../static/js/html5shiv.min.js"></script>
      <script src="../static/js/respond.min.js"></script>
    <![endif]-->
    




</head>

<body class="mainbody">
  <div class="container-fluid">
    <div class="row">
      <div class="col-lg-12">
        <div class="panel wizard-type1" id="wizard2">

          <form id="form" data-toggle="formcache">
                <div class="panel-heading bk-bg-primary">
                  <ul class="steps">
                      <li><a href="#tab11" data-toggle="tab"><span class="badge badge-info"><i class="fa fa-file-text"></i></span>基本信息</a></li>
                    </ul>
                    <div class="progress thin progress-striped active">
                      <div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">
                      </div>
                    </div>
                </div>
                <div class="panel-body">
                  <form class="form">
                    <div class="tab-content">
                      <div class="tab-pane" id="tab11">
                        <div class="row">
                          <div class="col-sm-12">
                            <div class="form-horizontal">
                              <div class="form-group">
                                <label class="col-md-1 control-label" for="model_name1">模型名称</label>
                                <div class="col-md-3">
                                  
                                  <input type="text" name="model_name1" id="model_name1" class="form-control" value="<%=name %>" disabled>
                                  
                                </div>
                                <div class="col-md-2">
                                  <span class="help-block text-right">*模型名称</span>
                                </div>
                              </div>

                              <div class="form-group">
                                <label class="col-md-1 control-label" for="field_type">字段类别</label>
                                <div class="col-md-3">
                                  <select id="field_type" name="field_type" class="form-control" size="1">
                                    <option value="text">单行文本</option>
                                    <option value="textarea">多行文本</option>
                                  </select>                                
                                </div>
                                <div class="col-md-2">
                                  <span class="help-block text-right">*请选择列表模板</span>
                                </div>
                              </div>

                              <div class="form-group">
                                <label class="col-md-1 control-label" for="field_name">字段名称</label>
                                <div class="col-md-3">
                                  <input type="text" name="field_name" id="field_name" class="form-control" data-no-empty="true" value="">
                                </div>
                                <div class="col-md-2">
                                  <span class="help-block text-right">*汉字（如：名称,标题）</span>
                                </div>
                              </div>

                              <div class="form-group">
                                <label class="col-md-1 control-label" for="field_eng">字段别名</label>
                                <div class="col-md-3">
                                  <input type="text" name="field_eng" id="field_eng" class="form-control" data-no-empty="true" value="">
                                </div>
                                <div class="col-md-2">
                                  <span class="help-block text-right">*英文字母组成（如：name,title）</span>
                                </div>
                              </div>

                              <div class="form-group">
                                <label class="col-md-1 control-label" for="field_tips">提示文字</label>
                                <div class="col-md-3">
                                  <input type="text" name="field_tips" id="field_tips" class="form-control" value="">
                                </div>
                                <div class="col-md-2">
                                  <span class="help-block text-right">字段提示</span>
                                </div>
                              </div>

                            </div>
                          </div>
                        </div>
                      </div>
                      
                    </div>
                    <div class="navbar-fixed-bottom" style="padding: 0 25px;">
                      <div class="actions"> 
                          <input type="hidden" name="model_name" id="model_name" class="form-control" value="<%=name %>">
                          <input type="hidden" name="id" id="id" value="<%=id %>">   
                          <input type="hidden" name="model_id" id="model_id" value="<%=model_id %>">           
                        <input type="button" class="btn btn-info" id="submit" value="提交保存" />
                        <input type="button" class="btn btn-primary button-next" name="next" value="下一项" />
                      </div>
                    </div>
                  </form>
                </div>
                </form>
              </div>
      </div>
    </div>
  </div>

    <!-- start: JavaScript-->
    
    <!-- Vendor JS-->       
    <script src="../static/vendor/js/jquery-2.1.1.min.js"></script>
    <script src="../static/vendor/js/jquery-migrate-1.2.1.min.js"></script>
    <script src="../static/vendor/bootstrap/js/bootstrap.min.js"></script>
    
    <!-- Plugins JS-->
    <script src="../static/plugins/wizard/js/jquery.bootstrap.wizard.min.js"></script>

    
    <!-- Pages JS -->
    <script src="../static/js/pages/form-wizard.js"></script>
    <script src="../static/js/ajax.js"></script>
    
    <!-- end: JavaScript-->
    <script type="text/javascript">
        $(function () {
            if ($.getUrlParam('action') == 'edit') {
                $('#field_eng').prop('disabled', true);
                get_json('../../api/models.ashx?action=getfield&id=' + $.getUrlParam('id'), function (data, waiting) {
                    for (var attr in data.data) {
                        if (attr == 'type') {
                            $('#' + attr).find('option[value="' + data.data[attr] + '"]').prop('selected', true);
                        } else {
                            $('#' + attr).val(data.data[attr])
                        }
                    }
                });
            } else {
                $('body').fadeIn(function () {
                    bootstrapWizard();
                })
            };

            $('#submit').on("click", function () {
                noEmpty(function () {
                    var json = $('#form').serializeArray();
                    send_json('../../api/models.ashx?action=addfield', json, function () {
                        window.location.href = document.referrer
                    });
                })

            });
        })
    </script>
</body>
</html>