@extends('layouts.layout-2')

@section('content')
    <h4 class="font-weight-bold py-2 mb-2 d-flex justify-content-between align-items-center w-100 ">
        <div>{{ __('navigation.my_homeparty') }} / {{ $homeparty->name }} - {{ $homeparty->date }}</div>
        @if(!$homeparty->completed)
            <a href="{{route('user_homeparty_guest_detail', [$homeparty->id, 'new'])}}" class="btn btn-sm btn-secondary rounded-pill d-block float-right"><span class="ion ion-md-add"></span>&nbsp; Neue Gast anlegen</a>
        @endif
    </h4>

    <div class="row">
        <div class="col-12">
            @php($g_count = 1)

            @foreach($homeparty->homeparty_users as $homeparty_user)
            <div class="card mb-4">
                <div class="card-body d-flex justify-content-between align-items-start pb-2">
                    <div>
                        <a href="{{route('user_homeparty_guest_detail', [$homeparty->id, $homeparty_user->id])}}" class="text-body text-big font-weight-semibold">
                            @if($homeparty_user->is_host)
                                <span class="text-muted">Gastgeber/in: </span>
                            @else
                                <span class="text-muted">Gast {{$g_count++}}: </span>
                            @endif
                            {{$homeparty_user->billing_firstname}} {{$homeparty_user->billing_lastname}}
                        </a>
                        {{-- <span class="badge badge-success align-text-bottom ml-1">offen ...</span> --}}
                    </div>
                    @if(!$homeparty->completed)

                    <div>
                        <a href="{{route('user_homeparty_guest_detail', [$homeparty->id, $homeparty_user->id])}}" class="btn btn-sm btn-secondary mr-2"><i class="fa fa-edit"></i> bearbeiten</a>
                        <div class="btn-group project-actions">

                            <button type="button" class="btn btn-sm btn-default icon-btn borderless rounded-pill md-btn-flat dropdown-toggle hide-arrow" data-toggle="dropdown">
                                <i class="ion ion-ios-more"></i>
                            </button>
                            <div class="dropdown-menu dropdown-menu-right">
                                @if($homeparty_user->is_host)
                                <a href="#" class=" dropdown-item">
                                    Gastgeber/in kann nicht gelöscht werden
                                </a>
                                @else
                                <a href="{{ route('user_homeparty_delete', ['hpu', $homeparty->id, $homeparty_user->id]) }}"
                                   class=" dropdown-item" onclick="return confirm('Homeparty Gast wirklich löschen?');">
                                    <span class="ion ion-md-trash text-danger"></span> löschen
                                </a>
                                @endif
                            </div>

                        </div>
                    </div>
                    @endif
                 </div>
                 <div class="progress rounded-0" style="height: 2px;">
                     <div class="progress-bar" style="width: 100%;"></div>
                 </div>
                <div class="card-body pt-1 pb-3">
                    {{$homeparty->description}}
                </div>
                <div class="card-body pt-0">
                    <div class="row">
                        <div class="col">
                            <div class="text-muted small">Adresse</div>
                            <div class="font-weight-bold">{{$homeparty_user->billing_address}}
                                {{$homeparty_user->billing_zipcode}}
                                {{$homeparty_user->city}}
                                @if($homeparty_user->billing_country_id){{ $homeparty_user->billing_country->getLocated() }}@endif
                            </div>
                        </div>
                        <div class="col">
                            <div class="text-muted small">E-Telefon</div>
                            <div class="font-weight-bold">{{$homeparty_user->billing_phone}}</div>
                        </div>
                        <div class="col">
                            <div class="text-muted small">E-Mail</div>
                            <div class="font-weight-bold">{{$homeparty_user->billing_email}}</div>
                        </div>
                    </div>
                </div>

            </div>
            @endforeach
        </div>
    </div>
    <div class="text-left mt-1">
        @if(!$homeparty->completed)
        <a href="{{route('user_homeparty_detail', [$homeparty->id])}}" class="btn btn-sm btn-secondary mr-2 mb-2"><i class="ion ion-ios-cog"></i> Homparty verwalten</a>
        @endif
        <a href="{{route('user_homeparty_order', [$homeparty->id])}}" class="btn  btn-sm btn-secondary mr-2 mb-2"><i class="ion ion-md-basket"></i> Bestellung</a>
        <a href="{{route('user_homepartys')}}" class="btn btn-sm btn-default mb-2">zurück zur Übersicht</a>
    </div>

@endsection