@extends('layouts.admin')

@section('content')
<div class="row">
    <div class="col-lg-12">
        <h1 class="page-header">用户行为列表</h1>
    </div>
    <!-- /.col-lg-12 -->
</div>
<div class="panel">
    <form action=''>

        <div class="form-group">
            <label>渠道名称</label>
            <input class="form-control" name="cm" value="{{ @$params['cm'] }}">
        </div>
       
        <div class="form-group">
            <label>open_id</label>
            <input class="form-control" name="open_id" value="{{ @$params['open_id'] }}">
        </div>
        <div class="form-group">
            <label>邀请者open_id</label>
            <input class="form-control" name="inventory_open_id" value="{{ @$params['inventory_open_id'] }}">
        </div>
        <div class="form-group">
            <label>选择公众号</label>
            <select class="form-control" name="wx_id">
                <option value="0" >全部</option>
                @foreach ($gzh_list as $id=>$gzh)
                <option value="{{ $id }}" {{ $id == @$params['wx_id'] ? 'selected' : '' }}>{{ $gzh->gzh_name }}</option>
                @endforeach
            </select>
        </div>
        <div class="form-group">
            <label>选择时间:</label>
            <input  name="start" onClick="WdatePicker()" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="{{ @$params['start'] }}"> -
            <input name="end" onClick="WdatePicker()" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="{{ @$params['end'] }}">
        </div>

        <button type="submit" class="btn btn-success">查询</button>
        <button type="button" class="btn btn-success" onclick="user_action_statistics_export()">导出</button> 
                        
    </form>
</div>
<div class="alert alert-success">

</div>

<div class="panel panel-default">
    
    <div class="panel-heading">
        列表
    </div>
    <!-- /.panel-heading -->
    <div class="panel-body">
         <div class="dataTable_wrapper">
 
             <table class="table table-striped table-bordered table-hover" id="dataTables-example" style="text-align: center">
                <tr>
                    <th>ID</th>
                    <th>公众号</th>
                    <th>用户</th>
                    <th>邀请人</th>
                    <th>渠道名称</th>
                    <th>性别<br>省<br>市<br>价格</th>
                    <th>课程组别<br>年龄段</th>
                    <th>行为</th>
                    <th>时间</th>
                    <th>ip</th>
                </tr>
                @foreach ($records as $record)
                <tr >
                    <td>{{ $record->id }}</td>
                    <td>
                    {{ $record->gzh_name2 }}
                    <!--
                    @if (@$record->wx_id1)
                      {{ $record->gzh_name }}
                    @else
                     {{ $record->gzh_name2 }}
                     @endif  -->
                    </td>
                    <td style='text-align:center;'><img src='{{ $record->headimgurl }}' style='width:40px;height:40px;margin:0 auto;'>
                    <br>{{ $record->nick_name }}
                    @if (@$record->is_share_vip)
                      <br>
                      <span style='color:red;'>vip</span>
                    @endif
                    <br>
                    <!-- {{ $record->auth_created_at }}  -->
                    </td>
                    <td style='text-align:center;'>
                    @if (@$record->inventory_nick_name)
                       <img src='{{ $record->inventory_headimgurl }}' style='width:40px;height:40px;margin:0 auto;'>
                       <br>{{ $record->inventory_nick_name }}
                    @else
                    @endif
                    
                    </td>
                    <td>
                    <span style="color:blue;font-weight:bold;">{{ $record->channel_name }}</span>
                    </td>
                    <td>
                    @if (@$record->open_id == '00001')
                    @else
                           @if (@$record->sex == 1)
		                       男
		                    @else
		                      女
		                    @endif
		                    
		                    <br>{{ $record->province }}<br>{{ $record->city }}
		                    <br>
		                      @if (@$record->price_tag=='low')
		                       低价格
		                    @elseif (@$record->price_tag=='high')
		                      高价格
		                    @elseif (@$record->price_tag=='nomal')
		                      低价格
		                    @endif
                    @endif
                     
                    </td>
                    <td>
                    @if (@$record->group_type=='single')
                       单人课程
                    @elseif (@$record->group_type=='spouse')
                      夫妻共读
                    @elseif (@$record->group_type=='ladybro')
                      闺蜜共读
                    @else
                       {{@$record->group_type}}
                    @endif
                    
                    <br>
                    @if (@$record->age_range=='0_3')
                       0~3岁
                    @elseif (@$record->age_range=='4_6')
                      4~6岁
                    @elseif (@$record->age_range=='7_12')
                      7~12岁
                    @else
                      {{@$record->age_range}}
                    @endif
                    </td>
                    <td>
                    @if (@$record->action=='index')
                       进入首页
                    @elseif (@$record->action=='class')
                      进入课程列表
                    @elseif (@$record->action=='one_class')
                      进入单课程(抽奖)
                    @elseif (@$record->action=='create_pay')
                      创建支付
                    @elseif (@$record->action=='suc_pay')
                      支付成功
                    @elseif (@$record->action=='success')
                      进入支付成功页
                    @elseif (@$record->action=='share_friend')
                      分享(朋友或朋友圈)
                    @elseif (@$record->action=='subscribe_gzh')
                       关注公众号
                    @elseif (@$record->action=='unsubscribe_gzh')
                       取关公众号
                    @elseif (@$record->action=='enter_category')
                       进入分类
                    @elseif (@$record->action=='enter_book_list')
                       进入书籍列表
                     @elseif (@$record->action=='enter_user_center')
                       进入个人中心
                     @elseif (@$record->action=='enter_reader')
                       进入阅读
                     @elseif (@$record->action=='enter_recent')
                       进入最近阅读
                     @elseif (@$record->action=='enter_book_shelf')
                       进入书架
                     @elseif (@$record->action=='enter_detail')
                       进入书详情
                     @elseif (@$record->action=='enter_catalog')
                       进入目录
                     @elseif (@$record->action=='get_my_extend_pic')
                        获取推广卡
                     @elseif (@$record->action=='group_index_scan')
                       群推广扫码页
                     @else
                       {{ $record->action }}
                     @endif
                   
                    </td>
                    <td>
                    {{ $record->created_at }}
                    </td>
                    <td>
                    <?php echo "<a href='http://www.ip138.com/ips138.asp?ip=".$record->ip."&action=2'  target='_blank'>".$record->ip."</a>";?>
                    </td>
                </tr>
                @endforeach
            </table>

        </div>
        
        <div class="paging">
            总计:{{ $records->total() }}
            {!! $records->appends($params)->links() !!}
         </div>
    </div>
</div>


<script type="text/javascript" src="{{ asset('admin/js/My97DatePicker/WdatePicker.js') }}"></script>
<script>

function user_action_statistics_export()
{
    $('form').attr('action',"{{ route('admin.user_action_statistics.user_action_statistics_export') }}");
    $('form').submit().attr('action','');
}

</script>
@endsection