<x-app-layout>
    <x-slot name="header">
        <h2 class="font-semibold text-xl text-gray-800 leading-tight">
            {{ $project->name }}: {{ __('Scan AUK') }}
        </h2>
    </x-slot>

    <div class="py-12">
        <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
            <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                <div class="p-6 bg-white border-b border-gray-200">
                    <div class="w-96 mx-auto">
                        <h3 class="font-bold text-l text-gray-800 leading-tight pb-4">AUK List in
                            {{ $project->mmc_path }}</h3>
                        <table class="table table-sm border-b border-gray-200">
                            <tr class="border border-gray-200">
                                <th class="p-2 border border-gray-200">
                                    {{ __('AUK Name') }}
                                </th>
                                <th class="p-2 border border-gray-200">
                                    {{ __('AUK path') }}
                                </th>
                                <th class="p-2 border border-gray-200">
                                    {{ __('Image dir') }}
                                </th>
                                {{-- <th class="p-2 border border-gray-200">
                                    {{ __('Actions') }}
                                </th> --}}
                            </tr>
                            @forelse ($auks as $auk)
                                <tr class="border border-gray-200">
                                    <td class="p-2 border border-gray-200">{{ $auk['auk_name'] }}</td>
                                    <td class="p-2 border border-gray-200">{{ $auk['auk_path'] }}</td>
                                    <td class="p-2 border border-gray-200">{{ $auk['image_dir'] }}</td>
                                    {{-- <td class="p-2 border border-gray-200">&nbsp;</td> --}}
                                </tr>


                            @empty
                                <tr>
                                    <td colspan="3" class="p-2 border border-gray-200 text-center">No Documents!
                                    </td>
                                </tr>
                            @endforelse
                        </table>
                        @if (count($auks))
                            
                        <form method="POST" action="{{ route('auks.load') }}">
                            @csrf
                            @for($i = 0; $i < count($auks); $i++)
                            <input type="hidden" name="auk_name_{{$i}}" id="auk_name_{{$i}}" value="{{ $auks[$i]['auk_name'] }}">                                
                            <input type="hidden" name="auk_path_{{$i}}" id="auk_path_{{$i}}" value="{{ $auks[$i]['auk_path'] }}">                                
                            <input type="hidden" name="image_dir_{{$i}}" id="image_dir_{{$i}}" value="{{ $auks[$i]['image_dir'] }}">                                
                            @endfor
                            <div class="flex items-center justify-end mt-4">
                                <button
                                    class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full">
                                    <i class="fa fa-add pr-2"></i>{{ __('Insert AUKs') }}
                                </button>
                                <div class="pl-2">
                                    <a href="{{ route('auks.index') }}"
                                        class="btn bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded-full">
                                        <i class="fa fa-cancel pr-2"></i>{{ __('Cancel') }}
                                    </a>
                                </div>
                            </div>
                        </form>
                        @endif
                    </div>
                </div>
            </div>
        </div>
    </div>
</x-app-layout>
