@extends('layouts.default')

@section('content')
    @parent
    <section class="bg-white space-sm">
        <div class="container">
            <div class="row justify-content-center">
                <div class="col">
                    <h1 class="h2 mb-2">Zoznam nainštalovaných modulov</h1>
                    <span>Zoznam a správa nainštalovaných modulov Portálu</span>
                </div>
            </div>
        </div>
    </section>

    <section>
        <div class="container">
            <div class="row">
                <div class="col-12">
                @if($moduly->isEmpty())
                    <div class="alert alert-primary text-small">
                        <i class="icon-info mr-2"></i>
                        Neboli nájdené žiadne moduly...
                    </div>
                @else
                    <div class="card card-sm shadow">
                        <div class="card-header bg-secondary d-flex justify-content-between align-items-center">
                            <div>
                                <span class="text-muted text-small">Počet položiek {{ $moduly->count() }}</span>
                            </div>
                        </div>

                        <div class="table-responsive">
                            <table class="table align-items-center mb-0">
                                <thead>
                                    <tr>
                                        <th scope="col">#</th>
                                        <th scope="col">Názov</th>
                                        <th scope="col">Stav</th>
                                    </tr>
                                </thead>
                                <tbody>
                                @foreach($moduly as $modul)
                                    <tr class="bg-white">
                                        <th scope="row">{{ $loop->index + 1 }}.</th>
                                        <td>
                                            <div class="media align-items-center">
                                                <i class="icon-archive text-gray fa-2x mr-2"></i>
                                                <div class="media-body">
                                                    <span class="h6 font-weight-bolder mb-1">{{ $modul->getName() }}</span>
                                                    <span class="text-small text-secondary">{{ $modul->getDescription() }}</span>
                                                </div>
                                            </div>
                                        </td>
                                        <td class="text-left">
                                            @livewire('components.switch-box.module-state-switch', ['moduleName' => $modul->getLowerName()])
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                @endif
                </div>
            </div>
        </div>
    </section>
@endsection

@push('styles')
    @livewireStyles
@endpush

@push('scripts')
    @livewireScripts
@endpush