@extends('admin.master')

@section('content')
    <div class="row">
        <div class="col-lg-12">
            <div class="contentpanel">
                <form id="listForm" method="post">
                    <!-- 功能按鈕(新增/批量處理等等) -->
                    <div class="row" style="margin-bottom: 5px;">
                        <div class="col-lg-12">
                            <ol class="headermenu">
                                <li>
                                    <button class="btn btn-darkblue btn-xs" id="btnNew"><strong>新增</strong></button>
                                </li>
                            </ol>
                        </div>
                    </div>
                    <!-- 搜尋段 -->
                    <div class="panel panel-default">
                        <div class="panel-heading" data-toggle="collapse" data-target="#search_content">
                            <h3 class="panel-title">獎項管理</h3>
                        </div>
                        <div id="search_content" class="collapse in">
                            <div class="panel-body">
                            </div>
                        </div>
                    </div>
                    <hr class="search-hr"/>
                    <!-- 列表段 -->
                    <div class="row">
                        <div class="col-lg-12">
                            相同一筆設定，若有分上下兩部分:<br>
                            上排代表目前修改中的最新設定，在審核通過前都不會生效。<br>
                            下排代表目前經審核通過的線上設定。
                        </div>
                        <div class="col-lg-12">
                            <table id="GridView1" class="table table-striped table-bordered" cellspacing="0">
                                <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>LINE POINT</th>
                                    <th>吉點</th>
                                    <th>有效否</th>
                                    <th>共可發數量</th>
                                    <th>已發數量</th>
                                    <th>建立時間</th>
                                    <th>修改時間</th>
                                    <th>修改人</th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                </form>
                <!-- row -->
            </div>
        </div>
    </div>
@endsection

@section('extjs')
    <script>
        $(document).ready(function () {
            var table = $('#GridView1').dataTable({
                "scrollX": true,
                "processing": true,
                "serverSide": true,
                "ajax": "goodManagement/grid",
                "paging": true,
                "ordering": true,
                "info": true,
                "order": [[1, "desc"]],
                "stateSave": true,
                "pagingType": "full",
                "bFilter": true,
                "aoColumnDefs": [{
                    'bSortable': false,
                    'aTargets': [0] //不想參加排序的欄位，可指定多個，逗號分隔
                }]
            });
            // 從網址參觸發搜尋
            custom_search();
            $('#GridView1_filter').hide();
        });

        //客製化搜尋欄位
        function custom_search() {
            $('#GridView1').DataTable()
            ;
            $('#GridView1').dataTable().fnDraw(true);
        }

        // 新增
        $("#btnNew").click(function () {
            location.href = 'goodManagement/create';
            return false;
        });

    </script>
@endsection
