{{include file="public/header" /}}

<!-- right content start  -->
<div class="content-right">
	<div class="content">
        <!-- operation start -->
        <div class="am-g">
            <button class="am-btn am-btn-secondary am-radius am-btn-xs am-icon-plus tree-submit-add" data-am-modal="{target: '#data-save-win'}"> 新增</button>
        </div>
        <!-- operation end -->

        <!-- save win start -->
        <div class="am-popup am-radius" id="data-save-win">
			<div class="am-popup-inner">
				<div class="am-popup-hd">
					<h4 class="am-popup-title" data-add-title="地区添加" data-edit-title="地区编辑">地区添加</h4>
					<span data-am-modal-close class="am-close">&times;</span>
				</div>
				<div class="am-popup-bd">
					<!-- form start -->
					<form class="am-form form-validation admin-save" action="{{:MyUrl('admin/region/save')}}" method="POST" request-type="ajax-fun" request-value="TreeFormSaveBack">
						<div class="am-form-group">
							<label>名称</label>
							<input type="text" placeholder="名称" name="name" minlength="2" maxlength="16" data-validation-message="名称格式 2~16 个字符" class="am-radius" required />
						</div>
						<div class="am-form-group">
							<label>顺序</label>
							<input type="number" placeholder="顺序" name="sort" min="0" max="255" data-validation-message="顺序 0~255 之间的数值" class="am-radius" value="0" required />
						</div>
						{{include file="lib/enable" /}}
						<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-horizontal-0">
							<input type="hidden" name="id" />
							<input type="hidden" name="pid" value="0" />
							<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
						</div>
					</form>
					<!-- form end -->
				</div>
			</div>
		</div>
		<!-- save win end -->

        <!-- list start -->
		<div id="tree" class="am-margin-top-sm" data-node-url="{{:MyUrl('admin/region/getnodeson')}}" data-del-url="{{:MyUrl('admin/region/delete')}}" data-popup-tag="#data-save-win" data-rank="4">
			{{include file="public/loading" /}}
		</div>
		<!-- list end -->
	</div>
</div>
<!-- right content end  -->
		
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->

<script type="text/javascript">
	// 初始化
	Tree(0, $('#tree').data('node-url'), 0, 1, 1);

	// 回调处理
	function TreeFormSaveBack(e)
	{
		TreeFormSaveBackHandle(e);
	}
</script>