@extends('admin/layout')
@section('header')
    <link href="{{asset('css/plugins/switchery/switchery.css')}}" rel="stylesheet">
    <style>
        .btn-danger, .btn-primary, .btn-info {
            background: #2a94e0 !important;
            border-color: #2a94e0 !important;
        }

        .table-striped > tbody > tr:nth-of-type(odd) {
            background: #f8f8f8 !important;
        }

        .table-striped > tbody > tr .btn {
            background: none !important;
        }

        .table-striped > tbody > tr td {
            font-size: 14px !important;
        }

        .table-striped > tbody > tr:hover {
            background: #ffebd8 !important;
        }

        .table-striped > tbody > tr:hover .btn {
            background: #2a94e0 !important;
            color: #fff !important;
        }

        .table-striped > tbody > tr:hover .btn .glyphicon {
            color: #fff !important;
        }
    </style>
@endsection

@section('content')
    @php   $authUser=auth()->user() @endphp
    <body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <form class="row" id="searchForm" onsubmit="units.search();return false;">
                            <div class="input-group">
                                <select name="sellerId" id="sellerId" title="" class="form-control"
                                        style="width: 150px;float: right" onchange="units.selectPage();">
                                    <option value="">请选择销售</option>
                                    @foreach($sellerUsers as $item)
                                        <option value="{{$item->id}}">{{$item->nickname}}</option>
                                    @endforeach
                                </select>
                                <select name="serverId" id="serverId" title="" class="form-control"
                                        style="width: 150px;float: right" onchange="units.selectPage();">
                                    <option value="">请选择客服</option>
                                    @foreach($services as $item)
                                        <option value="{{$item->id}}">{{$item->nickname}}</option>
                                    @endforeach
                                </select>

                                <input type="text" placeholder="请输入域名或项目名称" class="input-md form-control"
                                       name="keyword"
                                       id="keyword" style="width: 200px;float: right">

                                <span class="input-group-btn">
                                    <button type="button" class="btn btn-md btn-primary"
                                            onclick="units.search()"> 搜索</button>
                                    <button type="button" class="btn btn-md" style="margin-left: 10px"
                                            name="btnReset"> 重置</button>
                                    </span>
                            </div>

                        </form>
                        <hr>

                        <div class="table-responsive">

                            <table id="table" class="table table-condensed" data-mobile-responsive="true"></table>

                        </div>

                    </div>
                </div>
            </div>

        </div>
    </div>
    </body>
@endsection
@section('footer')
    <script>

        var units = {
            selectPage: function () {
                tips.selectPage();
            },

            search: function () {
                tips.selectPage();
            },

            openDetail: function (id, title) {
                tips.page('/admin/sites/' + id + '/overview', title);
            }
        };

        var config = {};
        config.url = '/admin/witness-project/renew-summary';
        config.pageSize = 20;
        config.showColumns = true;
        config.columns = [
            {
                title: '序号', align: 'center', formatter: function (value, item, index) {
                    return index + 1;
                },
                width: '10px'
            },
            {title: '项目', field: 'site', align: 'center'},
            {title: '客户姓名', field: 'customer_name', align: 'center'},
            {title: '职位', field: 'position', align: 'center'},
            {title: '电话', field: 'tel', align: 'center'},
            {title: '续费次数', field: 'number_renewals', align: 'center'},
            {title: '续费时长', field: 'duration_renewals', align: 'center'},
            {title: '礼品名称', field: 'gift_name', align: 'center'},
            {title: '礼品金额(元)', field: 'gift_amount', align: 'center'},
            {title: '送礼时间', field: 'gift_time', align: 'center'},
            {title: '备注', field: 'remark', align: 'center'},
            {
                title: '操作', field: 'site_id', align: 'center',
                formatter: function (value, row) {
                    return '<button onclick="units.openDetail(' + value + ',\'' + row.site + '\')" class="btn btn-xs"><span class="glyphicon glyphicon-menu-hamburger"></span>详情</button><br>';
                }
            }
        ];
        tips.bootstrapTable(config);


    </script>
@endsection