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

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

    <form id="fMovieCompany" method="get" action="{{ route('movie.company.index') }}" autocomplete="on" accept-charset="UTF-8">
        <div class="row g-2">
            <div class="col-5">
                <input type="text" name="keyword" class="form-control" value="{{ $keyword }}" maxlength="100" placeholder="영화사명"/>
            </div>
            <div class="col-4">
                <input type="text" name="ceo" class="form-control" value="{{ $ceo }}" maxlength="30" placeholder="대표자명"/>
            </div>
            <div class="col-3 d-grid">
                <button type="submit" class="btn btn-dark">검색</button>
            </div>
        </div>
    </form>
    <br/>

    @if($companies->count() > 0)
    <table class="table table-hover align-middle">
        <colgroup>
            <col width="*"/>
            <col width="90px"/>
        </colgroup>
        <thead>
            <tr class="text-center">
                <th>영화사명</th>
                <th>대표자</th>
            </tr>
        </thead>
        <tbody>
        @foreach($companies as $row)
            <tr>
                <td>
                    <a href="{{ $row->viewURL }}" target="_self">
                        {{ $row->companyNm }}
                    </a>
                    @if($row->companyPartNames)
                        <div><small class="text-secondary">{{ $row->companyPartNames }}</small></div>
                    @endif
                </td>
                <td class="text-center">{{ $row->ceoNm ?: '-' }}</td>
            </tr>
        @endforeach
        </tbody>
    </table>

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