@extends('layouts.default')

@section('content')
    @parent

    <section class="bg-white space-sm pb-4">
        <div class="container">
            <div class="row justify-content-between align-items-center">
                <div class="col-auto">
                    <h1 class="h2">Účet používateľa</h1>
                </div>
            </div>
        </div>
    </section>

    <section class="flush-with-above space-0">
        <div class="bg-white">
            <div class="container">
                <div class="row">
                    <div class="col">
                        <ul class="nav nav-tabs" id="myTab" role="tablist">
                            <li class="nav-item">
                                <a class="nav-link" href="{{ route('portal.sprava.pouzivatelia.edit', $pouzivatel) }}" role="tab">Hlavné</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link active" role="tab">Akcie</a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section class="flush-with-above height-80 d-block">
        <div class="tab-content">
            <div class="tab-pane active" role="tabpanel">
                <div class="container">
                    <div class="row mb-4">
                        <div class="col">
                            <h5>
                                Akcie vykonané používateľom
                                <span class="badge badge-info ml-1">{{ $akcie->total() }}</span>
                            </h5>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col">
                            @if($akcie->isEmpty())
                                <div class="alert alert-primary">
                                    <i class="icon-info mr-1"></i>
                                    Zatiaľ neexistujú žiadne akcie používateľa...
                                </div>
                            @else
                                <div class="table-responsive">
                                    <table class="table table-borderless table-hover align-items-center">
                                        <thead>
                                        <tr>
                                            <th scope="col">Akcia</th>
                                            <th scope="col">Značka</th>
                                            <th scope="col">Časová značka vykonania</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        @foreach($akcie as $akcia)
                                            <tr class="bg-white">
                                                <th scope="row">
                                                    {{ $akcia->description }}
                                                </th>
                                                <td class="text-left">
                                                <span class="badge badge-info text-uppercase">
                                                    {{ $akcia->log_name }}
                                                </span>
                                                </td>
                                                <td class="text-left">
                                                    {{ $akcia->created_at->format('d.m.Y H:i:s') }}
                                                </td>
                                            </tr>
                                        @endforeach
                                        </tbody>
                                    </table>
                                </div>
                            @endif
                        </div>
                    </div>
                    @if(!$akcie->isEmpty() && $akcie->hasPages())
                        <div class="row">
                            <div class="col-12 d-flex justify-content-center">
                                {{ $akcie->onEachSide(25)->links() }}
                            </div>
                        </div>
                    @endif
                </div>
            </div>
        </div>
    </section>
@endsection