@extends('desktop.layouts.app')
@section('content')
<div id="movieCompany" class="container">

    <h5>영화사</h5>
    <hr/>

    <form id="fMovieCompany" method="get" action="{{ route('movie.company.index') }}" autocomplete="on" accept-charset="UTF-8">
        <table class="table table-borderless w-auto">
            <colgroup>
                <col width="80px"/>
                <col width="300px"/>
                <col width="80px"/>
                <col width="300px"/>
                <col width="*"/>
            </colgroup>
            <tr class="align-middle text-center">
                <th>영화사명</th>
                <td>
                    <input type="text" name="keyword" class="form-control" value="{{ $keyword }}" maxlength="100"/>
                </td>
                <th>대표자명</th>
                <td>
                    <input type="text" name="ceo" class="form-control" value="{{ $ceo }}" maxlength="30"/>
                </td>
                <td class="text-start">
                    <button type="submit" class="btn btn-dark">검색</button>
                </td>
            </tr>
        </table>
    </form>
    <hr/>

    @if($companies->count() > 0)
    <table class="table table-hover align-middle" style="table-layout: fixed;">
        <colgroup>
            <col width="260px"/>
            <col width="100px"/>
            <col width="170px"/>
            <col width="*"/>
        </colgroup>
        <thead>
            <tr class="text-center">
                <th>영화사명</th>
                <th>대표자</th>
                <th>분류</th>
                <th>필모그래피</th>
            </tr>
        </thead>
        <tbody>
        @foreach($companies as $row)
            <tr>
                <td class="text-truncate">
                    <a href="{{ $row->viewURL }}" target="_self" title="{{ $row->companyNm }}">
                        {{ $row->companyNm }}
                        @if($row->companyNmEn)
                            <small class="text-secondary">({{ $row->companyNmEn }})</small>
                        @endif
                    </a>
                </td>
                <td class="text-center text-truncate">{{ $row->ceoNm ?: '-' }}</td>
                <td class="text-center text-truncate" title="{{ $row->companyPartNames }}">{{ $row->companyPartNames ?: '-' }}</td>
                <td class="text-truncate">
                    <small class="text-secondary">{{ Str::limit($row->filmoNames, 120) }}</small>
                </td>
            </tr>
        @endforeach
        </tbody>
    </table>

    {{ $companies->onEachSide(10)->links('component.pagination') }}
    @else
    <div class="text-center p-5">
        <h6>자료가 존재하지 않습니다.</h6>
    </div>
    @endif
</div>
@endsection
