@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>选择时间：</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>
        <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>
        <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>公众号</th>
                    <th>渠道名称</th>
                    <th>行为</th>
                    <th>用户数</th>
                    <th>ip数</th>
                    <th>年龄段对应数量</th>
                    <th>课程对应数量</th>
                </tr>
                @foreach ($records as $cm => $cm_records)
                @foreach ($cm_records as $action => $record)
                <tr>
                    <td>
                         {{ @$extend_channels[$cm]['channel_name'] }}
                    </td>
                    <td>
                    <span style="color:blue;font-weight:bold;">{{ @$extend_channels[$cm]['channel_name'] }}</span>
                    </td>
                    <td>
                    @if (@$action=='index')
                       进入首页
                    @elseif (@$action=='class')
                      进入课程列表
                    @elseif (@$action=='one_class')
                      进入单课程(抽奖)
                    @elseif (@$action=='create_pay')
                      创建支付
                    @elseif (@$action=='suc_pay')
                      支付成功
                    @elseif (@$action=='success')
                      进入支付成功页
                    @elseif (@$action=='share_friend')
                      分享（朋友）
                    @elseif (@$action=='share_friend_group')
                      分享（朋友圈）
                      
                    @elseif (@$action=='subscribe_gzh')
                       关注公众号
                    @elseif (@$action=='unsubscribe_gzh')
                       取关公众号
                    @elseif (@$action=='enter_category')
                       进入分类
                    @elseif (@$action=='enter_book_list')
                       进入书籍列表
                    @elseif (@$action=='enter_user_center')
                       进入个人中心
                    @else
                       {{ @$action }}
                    @endif
                    </td>
                    <td>
                       {{ @$record['open_id_count'] }}</span>
                    </td>
                    <td>
                       {{ @$record['ip_count'] }}</span>
                    </td>
                    <td>
                    @if (@$record['age_range_count'])
                    @foreach (@$record['age_range_count'] as $age_range => $age_range_count)
	                    @if (@age_range=='0_3')
	                       0~3岁
	                    @elseif (@$age_range=='4_6')
	                      4~6岁
	                    @elseif (@age_range=='7_12')
	                      7~12岁
	                    @else
	                      {{@$age_range}}
	                    @endif
	                    （{{@$age_range_count}}）<br>
                    @endforeach
                    @endif
                    </td>
                    <td>
                    @if (@$record['group_type_count'])
                    @foreach (@$record['group_type_count'] as $group_type => $group_type_count)
	                    @if (@$group_type=='single')
	                       单人课程
	                    @elseif (@$group_type=='spouse')
	                      夫妻共读
	                    @elseif (@$group_type=='ladybro')
	                      闺蜜共读
	                    @else
	                       {{@$group_type}}
	                    @endif
	                    （{{@$group_type_count}}）<br>
                    @endforeach
                    @endif
                    </td>

                </tr>
                @endforeach
                @endforeach
            </table>

        </div>

    </div>
</div>


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

</script>
@endsection
