{{:ModuleInclude('public/header')}}

<!-- right content start  -->
<div class="content-right" style="padding: 0 40px;">
    <div class="content">
        <!-- 搜索与筛选区域 -->
        <div class="am-panel am-panel-default am-radius">
            <div class="am-panel-bd">
                <form class="am-form form-validation form-search" method="post" action="{{:PluginsAdminUrl('vr_ticket', 'admin', 'VenueList')}}" request-type="form">
                    <div class="am-g am-g-fixed">
                        <!-- 基本搜索: 场馆名称 -->
                        <div class="am-u-sm-12 am-u-md-4">
                            <div class="am-form-group">
                                <label class="am-text-sm">场馆名称</label>
                                <input type="text" autocomplete="off" name="name" class="am-radius am-form-field" placeholder="搜索场馆名称..." value="{{if !empty($data_req['name'])}}{{$data_req['name']}}{{/if}}" />
                            </div>
                        </div>

                        <!-- 更多筛选条件 (始终显示或切换) -->
                        <div class="am-u-sm-12 am-u-md-3">
                            <div class="am-form-group">
                                <label class="am-text-sm">状态</label>
                                <select name="status" class="chosen-select am-radius" data-placeholder="全部状态">
                                    <option value="">全部状态</option>
                                    <option value="1" {{if isset($data_req['status']) and $data_req['status'] eq '1'}}selected{{/if}}>启用</option>
                                    <option value="0" {{if isset($data_req['status']) and $data_req['status'] eq '0'}}selected{{/if}}>禁用</option>
                                </select>
                            </div>
                        </div>

                        <!-- 操作按钮组 -->
                        <div class="am-u-sm-12 am-u-md-5 am-text-right" style="padding-top: 24px;">
                            <button class="am-btn am-btn-primary am-radius am-btn-sm" type="submit" data-am-loading="{spinner:'circle-o-notch', loadingText:'搜索中...'}">
                                <i class="am-icon-search"></i> 查询数据
                            </button>
                            <a href="{{:PluginsAdminUrl('vr_ticket', 'admin', 'VenueList')}}" class="am-btn am-btn-default am-radius am-btn-sm am-margin-left-xs">
                                <i class="am-icon-refresh"></i> 重置
                            </a>
                            <a href="{{:PluginsAdminUrl('vr_ticket', 'admin', 'VenueSave')}}" class="am-btn am-btn-success am-radius am-btn-sm am-margin-left-sm">
                                <i class="am-icon-plus"></i> 添加场馆
                            </a>
                        </div>
                    </div>
                </form>
            </div>
        </div>

        <!-- 数据列表区域 -->
        <div class="am-panel am-panel-default am-radius am-margin-top-lg">
            <div class="am-panel-hd">场馆管理列表</div>
            <div class="am-scrollable-horizontal">
                <table class="am-table am-table-striped am-table-hover am-text-middle am-margin-bottom-0">
                    <thead>
                    <tr>
                        <th class="am-text-center" width="60">ID</th>
                        <th class="am-text-left">场馆信息</th>
                        <th class="am-text-left">展厅/放映室</th>
                        <th class="am-text-center" width="90">分区数</th>
                        <th class="am-text-center" width="90">座位数</th>
                        <th class="am-text-center" width="90">状态</th>
                        <th class="am-text-right" width="160">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {{if !empty($list)}}
                        {{foreach $list as $v}}
                            <tr id="data-list-{{$v.id}}">
                                <td class="am-text-center">
                                    <span class="am-text-secondary">{{$v.id}}</span>
                                </td>
                                <td class="am-text-left">
                                    <div class="am-text-md"><strong>{{$v.name}}</strong></div>
                                    <div class="am-text-xs am-text-grey" style="margin: 2px 0;">
                                        （{{$v.venue_name}}）
                                    </div>
                                    {{if !empty($v.venue_address)}}
                                        <div class="am-text-xs am-text-grey"><i class="am-icon-map-marker"></i> {{$v.venue_address}}</div>
                                    {{/if}}
                                </td>
                                <td class="am-text-left">
                                    <div class="am-cf">
                                        {{if !empty($v.rooms)}}
                                            {{foreach $v.rooms as $rk=>$rv}}
                                                <span class="am-badge am-badge-secondary am-radius am-text-xs am-margin-bottom-xs">{{$rv.name}}</span>
                                            {{/foreach}}
                                        {{else /}}
                                            <span class="am-text-grey">-</span>
                                        {{/if}}
                                    </div>
                                </td>
                                <td class="am-text-center">
                                    <span class="am-badge am-radius" style="background: #999;">{{$v.zone_count}}</span>
                                </td>
                                <td class="am-text-center">
                                    <span class="am-badge am-badge-success am-radius">{{$v.seat_count}}</span>
                                </td>
                                <td class="am-text-center">
                                    {{if $v.status eq 1}}
                                        <span class="am-text-success"><i class="am-icon-check-circle"></i> 启用</span>
                                    {{else /}}
                                        <span class="am-text-danger"><i class="am-icon-times-circle"></i> 禁用</span>
                                    {{/if}}
                                </td>
                                <td class="am-text-right view-operation">
                                    <a href="{{:PluginsAdminUrl('vr_ticket', 'admin', 'VenueSave', ['id'=>$v['id']])}}" class="am-btn am-btn-secondary am-btn-xs am-radius">
                                        <i class="am-icon-edit"></i> 编辑
                                    </a>
                                    {{if $v.status eq 1}}
                                    <button class="am-btn am-btn-warning am-btn-xs am-radius am-margin-left-xs submit-ajax" data-url="{{:PluginsAdminUrl('vr_ticket', 'admin', 'VenueDelete')}}" data-id="{{$v.id}}" data-view="reload" data-msg="确定要禁用此场馆？">
                                        <i class="am-icon-ban"></i> 禁用
                                    </button>
                                    {{/if}}
                                    <button class="am-btn am-btn-danger am-btn-xs am-radius am-margin-left-xs submit-ajax" data-url="{{:PluginsAdminUrl('vr_ticket', 'admin', 'VenueDelete')}}" data-id="{{$v.id}}" data-value="hard" data-view="reload" data-msg="确定要删除此场馆？删除后关联商品的场馆信息将被自动清除。" data-is-loading="1">
                                        <i class="am-icon-trash-o"></i> 删除
                                    </button>
                                    {{if $v.status eq 0}}
                                    <button class="am-btn am-btn-success am-btn-xs am-radius am-margin-left-xs submit-ajax" data-url="{{:PluginsAdminUrl('vr_ticket', 'admin', 'VenueEnable')}}" data-id="{{$v.id}}" data-view="reload" data-msg="确定要启用此场馆？">
                                        <i class="am-icon-check"></i> 启用
                                    </button>
                                    {{/if}}
                                </td>
                            </tr>
                        {{/foreach}}
                    {{else /}}
                        <tr><td colspan="7" class="table-no">暂无场馆数据</td></tr>
                    {{/if}}
                    </tbody>
                </table>
            </div>
        </div>
        

        <div class="am-margin-top-sm">
            {{if !empty($list)}}
                {{$page|raw}}
            {{/if}}
        </div>
    </div>
</div>
<!-- right content end  -->

{{:ModuleInclude('public/footer')}}
