@if($this_page=="1" || $this_page=="4" || $this_page=="5" || $this_page=="6")
    <a href="{{ Route("comparison") }}" style="text-decoration:none;"><h2 class="text-dark" style="font-size: 20pt;text-align: center;background: white">人員管理</h2></a>
@elseif($this_page=="7" || $this_page=="8" || $this_page=="17" || $this_page=="9" || $this_page=="23" || $this_page=="22" || $this_page=="10" || $this_page=="11")
    <a href="{{ Route("attendance") }}" style="text-decoration:none;"><h2 class="text-dark" style="font-size: 20pt;text-align: center;background: white">差勤管理</h2></a>
@elseif($this_page=="12" || $this_page=="13" || $this_page=="14" || $this_page=="15" || $this_page=="16"|| $this_page=="26")
    <a href="{{ Route("device_time") }}" style="text-decoration:none;"><h2 class="text-dark" style="font-size: 20pt;text-align: center;background: white">設備管理</h2></a>
@endif
<div style="height: 5vh"></div>
<div style="overflow: hidden">
    <nav class="nav flex-column">
        <a id="title_person" class="nav-link" data-toggle="collapse" href="#collapsePerson" role="button" aria-expanded="false" aria-controls="collapsePerson" href="#" style="color: #ffffff;display: none">人員管理</a>
        <div class="collapse" id="collapsePerson">
            <div class="card card-body" style="background: rgba(255,255,255,0);font-size:17px;">
                <a id="1" class="nav-link" href="{{ Route("person") }}" style="color: #ffffff;display: none">人臉庫管理</a>
                <a id="4" class="nav-link" href="{{ Route("comparison") }}" style="color: #ffffff;display: none">打卡紀錄</a>
                <a id="5" class="nav-link" href="{{ Route("Group_index") }}" style="color: #ffffff;display: none">人員群組管理</a>
                <a id="6" class="nav-link" href="{{ Route("insert_user") }}" style="color: #ffffff;display: none">使用者管理</a>
            </div>
        </div>
        <a id="title_attendance" class="nav-link" data-toggle="collapse" href="#collapseLeave" role="button" aria-expanded="false" aria-controls="collapseLeave" href="#" style="color: #ffffff;display: none">差勤管理</a>
        <div class="collapse" id="collapseLeave">
            <div class="card card-body" style="background: rgba(255,255,255,0);font-size:17px;">
{{--                <a id="7" class="nav-link" href="{{ Route("leave_index") }}" style="color: #ffffff;display: none">員工請假</a>--}}
{{--                <a id="8" class="nav-link" href="{{ Route("businesstrip_index") }}" style="color: #ffffff;display: none">員工出差</a>--}}
{{--                <a id="17" class="nav-link" href="{{ Route("overtime_index") }}" style="color: #ffffff;display: none">加班申請</a>--}}
{{--                <a id="9" class="nav-link" href="{{ Route("checkleave_index") }}" style="color: #ffffff;display: none">請假審核</a>--}}
{{--                <a id="23" class="nav-link" href="{{ Route("check_overtime") }}" style="color: #ffffff;display: none">加班審核</a>--}}
{{--                <a id="22" class="nav-link" href="{{ Route("statistics_index") }}" style="color: #ffffff;display: none">請假統計</a>--}}
                <a id="10" class="nav-link" href="{{ Route("attendance") }}" style="color: #ffffff;display: none">出勤管理</a>
{{--                <a id="11" class="nav-link" href="{{ Route("graph_attendance") }}" style="color: #ffffff;display: none">差勤圖表</a>--}}
            </div>
        </div>
        <a id="title_device" class="nav-link"data-toggle="collapse" href="#collapseDevice" role="button" aria-expanded="false" aria-controls="collapseDevice" href="#" style="color: #ffffff;display: none">設備管理</a>
            <div class="collapse " id="collapseDevice">
                <div class="card card-body" style="background: rgba(255,255,255,0);font-size:17px;">
                    <a id="12" class="nav-link" href="{{ Route("device") }}" style="color: #ffffff;display: none">設備管理</a>
{{--                    <a id="13" class="nav-link" href="{{ Route("type") }}" style="color: #ffffff;display: none">類型管理</a>--}}
                    <a id="26" class="nav-link" href="{{ Route("shift_index") }}" style="color: #ffffff;display: none">班別<a>
{{--                <a id="14" class="nav-link" href="{{ Route("group") }}" style="color: #ffffff;display: none">群組管理</a>--}}
{{--                 <a id="15" class="nav-link" href="{{ Route("relation") }}" style="color: #ffffff;display: none">設備群組關係</a>--}}
                    <a id="16" class="nav-link" href="{{ Route("device_time") }}" style="color: #ffffff;display: none">設備時間</a>
                </div>
            </div>
    </nav>
</div>
<div class="row">
    <div class="col-6" style="text-align: left">
        <form method="GET" action="{{ Route("user_logout") }}">
            <input class="btn btn-outline-light" style="font-size:16px;text-align: center" type="submit" id="logout" name="logout" value="登出" >
        </form>
    </div>
    <div class="col-6">
{{--        <form action="{{ route("user_word") }}" method="POST">--}}
{{--            {{ csrf_field() }}--}}
{{--            <div style="text-align: left">--}}
{{--                <input class="btn btn-outline-light" style="font-size:16px;text-align: center" type="submit"value="申請單" >--}}
{{--            </div>--}}
{{--        </form>--}}
    </div>
</div>


@foreach($authority as $auth)
    <script>
        var a_this=document.getElementById({{$auth["features_id"]}});
        // device.style.visibility="visible";
        a_this.style.display="";

        if({{$auth["features_id"]}}=='1' || {{$auth["features_id"]}}=='4' || {{$auth["features_id"]}}=='5' || {{$auth["features_id"]}}=='6' )
        {
            var person=document.getElementById("title_person");
            person.style.display="";
        }
        if({{$auth["features_id"]}}=='7' || {{$auth["features_id"]}}=='8' || {{$auth["features_id"]}}=='17' || {{$auth["features_id"]}}=='9' || {{$auth["features_id"]}}=='10' || {{$auth["features_id"]}}=='11'|| {{$auth["features_id"]}}=='22'|| {{$auth["features_id"]}}=='23' )
        {
            var attendance=document.getElementById("title_attendance");
            attendance.style.display="";
        }
        if({{$auth["features_id"]}}=='12' || {{$auth["features_id"]}}=='13' || {{$auth["features_id"]}}=='14' || {{$auth["features_id"]}}=='15' || {{$auth["features_id"]}}=='16'|| {{$auth["features_id"]}}=='26')
        {
            var device=document.getElementById("title_device");
            device.style.display="";
        }
    </script>
@endforeach
<script>
    var this_page=document.getElementById({{$this_page}});
    this_page.style.background='rgba(255,255,255,0.2)';
    if({{$this_page}}=='1' || {{$this_page}}=='4' || {{$this_page}}=='5' || {{$this_page}}=='6' )
    {
        $('#collapsePerson').collapse('show');
    }
    if({{$this_page}}=='7' || {{$this_page}}=='8' || {{$this_page}}=='17' || {{$this_page}}=='9' || {{$this_page}}=='10' || {{$this_page}}=='11'|| {{$this_page}}=='22'|| {{$this_page}}=='23' )
    {
        $('#collapseLeave').collapse('show');
    }
    if({{$this_page}}=='12' || {{$this_page}}=='13' || {{$this_page}}=='14' || {{$this_page}}=='15' || {{$this_page}}=='16'|| {{$this_page}}=='26')
    {
        $('#collapseDevice').collapse('show');
    }
</script>
