<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"/>
    <script src="{{ mix('/js/manifest.js') }}" rel="script"></script>
    <link href="{{ asset('/css/vendor/picomplete/picomplete.css') }}" rel="stylesheet"/>
</head>
<body>
@include("common.header")
<div class="flex gap-3 px-3">
    <form class="w-full lg:w-1/2 border-2" action="" method="post" enctype="multipart/form-data">
        <input type="hidden" name="id" value="{{$append->id}}">
        @if($program)
            <label class="block my-2">
                结束图像
                @if(count($program->video_pivots) > 0 && $program->video_pivots->last()->stop_image)
                    <img src="{{$program->video_pivots->first()->stop_image}}" alt="结束图片">
                @else
                    <div>
                        <a href="{{route("program.construct.video.list", ["program"=>$program->id])}}"
                           class="block px-6 py-2 inline-block rounded-full bg-cyan-600 text-white">
                            去建设
                        </a>
                    </div>
                @endif
            </label>
        @endif
        <label class="block my-2 mx-2">
            追加内容(点播可不填)
            <input class="form-input border-0 border-b-2 w-full" autocomplete="off" type="text" name="name" value="{{ old('name', $append->name) }}">
        </label>
        <label class="block my-2 mx-2" id="from_select">
            点播老板
            <input class="form-input border-0 border-b-2 w-full" autocomplete="off" type="text" name="from" value="{{ old('from', $append->from) }}">
        </label>
        <label class="block my-2 mx-2">
            是否点播(不是追加)
            <input class="form-checkbox" type="checkbox" name="is_original" value="1" @if(old('is_original', $append->is_original) == 1) checked @endif>
        </label>
        <label class="block my-2 mx-2">
            分
            <input class="form-input border-0 border-b-2 w-full" type="number" step="0.5" name="price" value="{{ old('price', $append->price) }}">
        </label>
        <label class="block my-2 mx-2">
            补充说明
            <input class="form-input border-0 border-b-2 w-full" autocomplete="off" type="text" name="append" value="{{ old('append', $append->append) }}">
        </label>
        @include("common.form_error")
        <div class="block my-2 text-center">
            <input class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" type="submit">
        </div>
        <div class="block my-2">
            @if(count($program->video_pivots) > 0)
                <a class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" target="_blank"
                   href="https://www.bilibili.com/video/{{$program->video_pivots->first()->video_bvid}}?p={{$program->video_pivots->first()->start_part}}&t={{$program->video_pivots->first()->start_sec}}"
                   title="P{{$program->video_pivots->first()->start_part}}#{{$program->video_pivots->first()->start_time}}"
                >打开至开始位置</a>
                <a class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" target="_blank"
                   href="https://www.bilibili.com/video/{{$program->video_pivots->last()->video_bvid}}?p={{$program->video_pivots->last()->stop_part}}&t={{$program->video_pivots->last()->stop_sec}}"
                   title="P{{$program->video_pivots->last()->stop_part}}#{{$program->video_pivots->last()->stop_time}}"
                >打开至结束位置</a>
            @endif
            <a class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white"
               href="{{route('program.construct.append.list', ['program'=>$program->id])}}"
            >返回列表</a>
        </div>
    </form>
    <div class="hidden lg:block lg:w-1/2">
        <div>已有记录</div>
        <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">
                <td>老板</td>
                <td>类型</td>
                <td>要求</td>
                <td>分值</td>
                <td>补充说明</td>
            </tr>
            </thead>
            <tbody>
            @foreach($program->appends as $append)
                <tr>
                    <td>
                        <x-links.user_link :name="$append->from" :plt-id="$append->platform_id" :mid="$append->from_mid"></x-links.user_link>
                    </td>
                    <td>
                        @if($append->is_original)
                            点播
                        @else
                            追加
                        @endif
                    </td>
                    <td>
                        @if($append->is_original)
                            点播
                        @else
                            {{$append->name}}
                        @endif
                    </td>
                    <td>{{$append->price}}</td>
                    <td>{{$append->append}}</td>
                </tr>
            @endforeach
            </tbody>
        </table>
    </div>
</div>
@include("common.footer")
</body>
<script src="{{ mix('/js/component/from_select.js') }}" rel="script"></script>
</html>