<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Headimage')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-headimage" data-rule="required" class="form-control" size="50" name="row[headimage]" type="text" value="{$row.headimage|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-headimage" class="btn btn-danger faupload" data-input-id="c-headimage" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-headimage"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-headimage" class="btn btn-primary fachoose" data-input-id="c-headimage" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-headimage"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-headimage"></ul>
            <span style="color: red"><br> ( 推荐图片尺寸：690*482 )</span>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-images" data-maxcount="9"  class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-images" data-maxcount="9"  class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-images"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-images"></ul>
            <span style="color: red"><br> ( 推荐图片尺寸：750*450 )</span>
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Item_json')}:</label>
        <div class="col-xs-12 col-sm-8">
            <table class="table table-responsive fieldlist" data-name="row[item_json]" data-template="testtpl" data-tag="tr">
                <tr>
                    <td>活动项名</td>
                    <!--                    <td>开始结束时间</td>-->
                    <td>限定人数</td>
                    <td>年龄限制</td>
                    <!--                    <td>权重</td>-->
                    <td>是否上架</td>
                    <td>男女</td>
                    <td>价格</td>
                    <td></td>
                </tr>
                <tr>
                    <td colspan="5"><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 追加</a></td>
                </tr>
                <textarea name="row[item_json]" id="item_json" class="form-control hide" cols="30" rows="8">{$row.item_json|htmlentities}</textarea>
            </table>
            <!--            <span style="color: red">(每个课时规格为当前课程的一节课，课程总共多少节课就需要上多少个课时规格，每个课时的开始和结束时间不能有重叠，单节课开始结束时间必须在同一天，后续有变更将触发审核机制！)</span>-->
            <!--定义模板-->
            <script type="text/html" id="testtpl">
                <tr class="form-inline">
                    <td>
                        <input type="hidden" name="row[<%=name%>][<%=index%>][id]"  class="form-control" value="<%=row['id']%>" size="20" >
                        <input type="text" name="row[<%=name%>][<%=index%>][name]"  data-rule="required" class="form-control" value="<%=row['name']%>" size="15" placeholder="活动项名">
                    </td>
                    <!--                    <td>-->
                    <!--                        <input type="text" name="row[<%=name%>][<%=index%>][time]"  data-rule="required" class="form-control datetimerange"  data-time-picker="true"  data-locale='{"format":"YYYY/MM/DD HH:mm"}'  placeholder="指定开始结束时间" value="<%=row['time']%>" size="25" />-->
                    <!--                        &lt;!&ndash;<input type="text" class="form-control datetimerange" name="updatetime" value="" placeholder="修改时间" id="updatetime" data-index="49" autocomplete="off">&ndash;&gt;-->

                    <!--                    </td>-->
                    <td><input type="text" name="row[<%=name%>][<%=index%>][limit_num]"  data-rule="required"  class="form-control" value="<%=row['limit_num']%>" placeholder="限制人数" size="2" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></td>

                    <td><input type="text" name="row[<%=name%>][<%=index%>][age]"  data-rule="required" class="form-control" value="<%=row['age']%>" size="5" placeholder="年龄限制"></td>

                    <!--                    <td><input type="text" name="row[<%=name%>][<%=index%>][weigh]"   data-rule="required" class="form-control" value="<%=row['weigh']%>" size="2" placeholder="课时排序权重" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></td>-->
                    <td>
                        <select  class="form-control" name="row[<%=name%>][<%=index%>][status]">
                            {foreach name="itemStatusList" item="vo"}
                            <option value="{$key}" <%if(row.status=={$key}){%> selected <%}%> >{$vo}</option>
                            {/foreach}
                        </select>
                    </td>
                    <td>
                        <select   class="form-control" name="row[<%=name%>][<%=index%>][sex]">
                            {foreach name="sexList" item="vo"}
                            <option value="{$key}" <%if(row.sex=={$key}){%> selected <%}%> >{$vo}</option>
                            {/foreach}
                        </select>
                    </td>
                    <td><input size="10" type="text" name="row[<%=name%>][<%=index%>][price]"  data-rule="required"  class="form-control" value="<%=row['price']%>" placeholder="价格"  onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></td>


                    <td><span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span></td>
                </tr>
            </script>
        </div>
    </div>



    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Address_type')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="radio">
                {foreach name="addressTypeList" item="vo"}
                <label for="row[address_type]-{$key}"><input    id="row[address_type]-{$key}" name="row[address_type]" type="radio" value="{$key}" {in name="key" value="$row.address_type"}checked{/in} /> {$vo}</label>
                {/foreach}
                <span style="color: red">( 如果选独立位置需填写具体位置信息！ )</span>
            </div>
        </div>
    </div>




    <div id="c_position"  {eq name="$row.address_type" value="1"} style="display: none" {/eq} >
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Address_city')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class='control-relative'>
                <input id="c-address_city"  class="form-control form-control" data-toggle="city-picker" name="row[address_city]" value="{$row.address_city}" type="text">
            </div>
            <input type="hidden" id="province" name="row[province]" value="{$row.province}" >
            <input type="hidden" id="city" name="row[city]" value="{$row.city}" >
            <input type="hidden" id="district" name="row[district]" value="{$row.district}" >
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class='control-relative'>
                <input id="c-address"  class="form-control form-control"
                       data-lat-id="c-latitude" data-lng-id="c-longitude" readonly data-input-id="c-address" data-toggle="addresspicker" name="row[address]" value="{$row.address}" type="text" placeholder="请地图选址。如调起地图失败请检查插件《地图位置(经纬度)选择》是否安装">
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Address_detail')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-address_detail" class="form-control" name="row[address_detail]" type="text" value="{$row.address_detail}" placeholder="请输入{:__('Address_detail')}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Longitude')}:</label>
        <div class="col-xs-12 col-sm-3">
            <input id="c-longitude"  readonly class="form-control" name="row[longitude]" type="text" value="{$row.longitude}">
        </div>
        <label class="control-label col-xs-12 col-sm-2">{:__('Latitude')}:</label>
        <div class="col-xs-12 col-sm-3">
            <input id="c-latitude"  readonly class="form-control" name="row[latitude]" type="text" value="{$row.latitude}">
        </div>
    </div>
    </div>



    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('活动开始结束时间')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-time" class="form-control datetimerange"  data-rule="required" data-time-picker="true"  data-locale='{"format":"YYYY/MM/DD HH:mm"}'  placeholder="指定开始结束时间" name="row[time]" type="text" value="{:$row.start_time?datetime($row.start_time):''} - {:$row.end_time?datetime($row.end_time):''}">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('报名开始结束时间')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-sign_time" class="form-control datetimerange"  data-rule="required" data-time-picker="true"  data-locale='{"format":"YYYY/MM/DD HH:mm"}'  placeholder="指定开始结束时间" name="row[sign_time]" type="text" value="{:$row.sign_start_time?datetime($row.sign_start_time):''} - {:$row.sign_end_time?datetime($row.sign_end_time):''}">
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-price" data-rule="required" class="form-control" step="0.01" name="row[price]" type="number" value="{$row.price|htmlentities}">
        </div>
    </div>
<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('People_num')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->
<!--            <input id="c-people_num" class="form-control" name="row[people_num]" type="number" value="{$row.people_num|htmlentities}">-->
<!--        </div>-->
<!--    </div>-->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Item')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-item" class="form-control" name="row[item]" type="text" value="{$row.item|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea>
        </div>
    </div>





    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">

            <div class="radio">
                {foreach name="statusList" item="vo"}
                <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
                {/foreach}
            </div>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
        </div>
    </div>
<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('Recommend')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->

<!--            <select  id="c-recommend" class="form-control selectpicker" name="row[recommend]">-->
<!--                {foreach name="recommendList" item="vo"}-->
<!--                <option value="{$key}" {in name="key" value="$row.recommend"}selected{/in}>{$vo}</option>-->
<!--                {/foreach}-->
<!--            </select>-->

<!--        </div>-->
<!--    </div>-->
<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('Hot')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->

<!--            <select  id="c-hot" class="form-control selectpicker" name="row[hot]">-->
<!--                {foreach name="hotList" item="vo"}-->
<!--                <option value="{$key}" {in name="key" value="$row.hot"}selected{/in}>{$vo}</option>-->
<!--                {/foreach}-->
<!--            </select>-->

<!--        </div>-->
<!--    </div>-->
<!--    <div class="form-group">-->
<!--        <label class="control-label col-xs-12 col-sm-2">{:__('New')}:</label>-->
<!--        <div class="col-xs-12 col-sm-8">-->

<!--            <select  id="c-new" class="form-control selectpicker" name="row[new]">-->
<!--                {foreach name="newList" item="vo"}-->
<!--                <option value="{$key}" {in name="key" value="$row.new"}selected{/in}>{$vo}</option>-->
<!--                {/foreach}-->
<!--            </select>-->

<!--        </div>-->
<!--    </div>-->
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Selfhot')}:</label>
        <div class="col-xs-12 col-sm-8">

            <select  id="c-selfhot" class="form-control selectpicker" name="row[selfhot]">
                {foreach name="selfhotList" item="vo"}
                <option value="{$key}" {in name="key" value="$row.selfhot"}selected{/in}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('提交审核')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
