<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>录播节目查询</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link href="{{ mix('/css/app.css') }}" rel="stylesheet"/>
</head>
<body>
@include("common.header")
<div class="w-full text-white bg-blue-500" id="_notice">
    <div class="container flex items-center justify-between px-2 sm:px-6 lg:px-8 py-4 mx-auto">
        <div class="flex">
            <svg viewBox="0 0 40 40" class="w-6 h-6 fill-current">
                <path d="M20 3.33331C10.8 3.33331 3.33337 10.8 3.33337 20C3.33337 29.2 10.8 36.6666 20 36.6666C29.2 36.6666 36.6667 29.2 36.6667 20C36.6667 10.8 29.2 3.33331 20 3.33331ZM21.6667 28.3333H18.3334V25H21.6667V28.3333ZM21.6667 21.6666H18.3334V11.6666H21.6667V21.6666Z">
                </path>
            </svg>
            <p class="mx-3 font-medium">数据待补充完整,需要查较为久远的节目,请先点击上方节目单查询</p>
        </div>

        <button class="p-1 transition-colors duration-300 transform rounded-md hover:bg-opacity-25 hover:bg-gray-600 focus:outline-none" type="button" onclick="document.getElementById('_notice').remove()">
            <span class="sr-only">关闭</span>
            <svg class="w-5 h-5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path d="M6 18L18 6M6 6L18 18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
            </svg>
        </button>
    </div>
</div>
<form class="form py-2" action="">
    <label for="keyword">查找节目关键词,空格隔开查找多个关键词,支持通过点播老板或追加内容搜索</label>
    <input class="border border-black" type="text" name="keyword" id="keyword" value="{{$keyword}}">
    <input class="border border-black" type="submit">
</form>
<table class="table-auto border-collapse w-full lg:border lg:border-black">
    <thead>
    <tr class="border border-black sticky bg-white lg:static top-0 left-0 right-0">
        <th class="border border-black">节目名称</th>
        <th class="border border-black">点播及追加</th>
        <th class="border border-black hidden lg:table-cell">节目开始</th>
        <th class="border border-black hidden lg:table-cell">节目结束</th>
    </tr>
    </thead>
    <tbody>
    @foreach($programs as $program)
        <tr>
            <td class="border align-top w-1/2 lg:w-1/4">
                @if(sizeof($program->video_pivots) > 0)
                    <div class="block lg:hidden">{{$program->created_at}}</div>
                @endif
                @auth("web")
                    <a href="{{route("program.construct.edit", ["program"=>$program->id])}}">编辑</a>
                @endauth
                <a class="text-blue-600 lg:text-current underline lg:no-underline" href="/programs/{{ $program->id }}/video">
                    <span title="节目">{{$program->name}}</span>
                    <span title="难度">{{$program->difficulty}}</span>
                    <span title="要求">{{$program->desc}}</span>
                </a>
            </td>
            <td class="border align-top w-1/2 lg:w-1/4">
                @foreach($program->appends as $append)
                    <x-append :append="$append"></x-append>
                @endforeach
            </td>
            <td class="border align-top hidden lg:table-cell lg:w-1/4">
                @foreach($program->video_pivots as $video_pivot)
                    <x-links.video_link :bvid="$video_pivot->video_bvid" :part="$video_pivot->start_part" :time="$video_pivot->start_time">
                        <div>{{$video_pivot->created_at}} P{{$video_pivot->start_part}}#{{$video_pivot->start_time}}</div>
                        @if($video_pivot->start_image)
                            <img loading="lazy" width="300" src="{{$video_pivot->start_image}}" alt="开始时的画面">
                        @else
                            节目开始位置
                        @endif
                    </x-links.video_link>
                @endforeach
            </td>
            <td class="border align-top hidden lg:table-cell lg:w-1/4">
                @foreach($program->video_pivots as $video_pivot)
                    <x-links.video_link :bvid="$video_pivot->video_bvid" :part="$video_pivot->stop_part" :time="$video_pivot->stop_time">
                        <div>P{{$video_pivot->stop_part}}#{{$video_pivot->stop_time}}</div>
                        @if($video_pivot->start_image)
                            <img loading="lazy" width="300" src="{{$video_pivot->stop_image}}" alt="结束时的画面">
                        @else
                            节目结束位置
                        @endif
                    </x-links.video_link>
                @endforeach
            </td>
        </tr>
    @endforeach
    </tbody>
</table>
{{$programs->links()}}
@include("common.footer")
</body>
</html>