<ion-view view-title="字段信息" hide-tabs="true" hide-back-button="true" cache-view="false">
    <ion-nav-buttons side="right">
        <button class="button button-clear" ng-click='ok();'>确定</button>
    </ion-nav-buttons>
    <ion-nav-buttons side="left">
        <button class="button button-clear" ng-click='back();'>取消</button>
    </ion-nav-buttons>
    <ion-content>
        <div class=" item item-divider"></div>
        <label class="item item-input">
            <span class="input-label">字段名称：</span>
            <input type="text" ng-model="template_field.name" focus-me="true"/>
        </label>
        <ul>
            <li class="item item-toggle">
                是否必填
                <label class="toggle bar-balanced">
                    <input type="checkbox" ng-model="template_field.required">
                    <div class="track">
                        <div class="handle"></div>
                    </div>
                </label>
            </li>
        </ul>
        <div class=" item item-divider"></div>
        <ion-list>
            <div ng-repeat="item in template_fields">
                <ion-radio ng-model="template_field_active" ng-value="item" ng-click="change(item);"  class="field-radio">
                    {{item.name}}
                    <p>{{item.description}}</p>
                </ion-radio>
                <div ng-if="item.showlist" ng-show="template_field_active==item">
                    <ion-item class="item item-icon-left item-icon-right" ng-repeat="sitem in selecttexts track by $index" type="item-text-wrap">
                        <i class="icon ion-android-remove-circle" style="color:red;" ng-click="remove($index);"></i>
                        <input type="text" ng-model="sitem.text" placeholder="请输入选项名称" focus-me="true"/>
                        <i class="icon ion-navicon-round icon-accessory"></i>
                    </ion-item>
                    <ion-item class="item item-icon-left item-icon-right" type="item-text-wrap" ng-click="add();">
                        <i class="icon ion-plus-circled balanced"></i> 添加选项
                        <i class="icon ion-navicon-round icon-accessory"></i>
                    </ion-item>
                </div>
            </div>

            <div class='obligate-item'></div>
        </ion-list>
    </ion-content>
    <div class="bar bar-footer bar-balanced footer" ng-click='delete();' ng-show="!isNew">
        <div class="title">删除字段</div>
    </div>
</ion-view>
