<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">
</head>
<body >
<div style="text-align: center" id="page">
    <h4 style="margin-bottom: 0">宝时物流 欢迎你</h4><br/>
    <h2 class="text-danger">进入组：{{$group_name}}</h2><br/>
    <h3 style="margin-bottom: 0">姓名：@if($full_name)<b style="color: #2a9055">{{$full_name}}</b>@endif&nbsp;&nbsp;&nbsp;&nbsp;进组时间：@if($check_in_at)<b style="color: #2a9055">{{$check_in_at}}</b> @endif</h3><br/>
    <div>
        <div v-if="laborReport.group_user_id"><h5 style="color: #2a9055" >组长已确认</h5></div>
        <h5 v-else style="margin-top: 0;color: red">等待组长确认登入，请勿关闭:<span id="_lefttime" ></span></h5>
    </div>
</div>
<script src="{{ asset('js/app.js') }}"></script>
<script>
    new Vue({
        el:'#page',
        data:{
            laborReport:{
              group_user_id:''
          },
        },
        mounted(){
            initEcho();
            Echo.channel('{{$laravelEchoPrefix}}laborReport').listen('TeamAuditEvent',(e)=>{
                let _this=this;
                let laborReport=e.laborReport;
                _this.laborReport.group_user_id=laborReport.group_user_id;
            });
        },
    });
    let secondsInit = 0;
    function _fresh()
    {
        secondsInit ++;
        let seconds = secondsInit;
        let result = '';
        if (seconds >= 3600)
        {
            let h = Math.floor(seconds / 3600);
            result += h + "小时";
            seconds -= 3600 * h;
        }
        if (seconds >= 60)
        {
            let m = Math.floor(seconds / 60);
            result += m + "分";
            seconds -= 60 * m;
        }
        result += seconds + "秒";
        document.getElementById('_lefttime').innerHTML = result;
    }
    _fresh();
    setInterval(_fresh,1000);
</script>
</body>
</html>
