@extends('layouts.layout-2')

@section('content')

    @if ($errors->any())
        <div class="row">
            <div class="col-sm-12">
                <div class="alert alert-danger">
                    <ul>
                        @foreach ($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            </div>
        </div>
    @endif

    {!! Form::open(['url' => route('travel_user_detail', [$id]), 'class' => 'form-horizontal']) !!}

    <h4 class="font-weight-bold py-3 mb-1">
        Kunden @if($id == "new") <span class="text-primary">anlegen</span> @else {{"(ID: ".$id.")"}} verwalten @endif
        <div class="float-right">
            <button type="submit" name="action" value="saveAll" class="btn btn-submit btn-sm">{{ __('save changes') }}</button>&nbsp;
            <a href="{{route('travel_user_booking_fewos')}}" class="btn btn-default btn-sm">{{ __('back') }}</a>
        </div>
    </h4>
    <div class="clearfix"></div>


    <input type="hidden" name="id" id="id" value="{{$id}}">

    @include('travel.user.form')

    <div class="card mb-2">
        <div class="card-body">
            <h4>FeWo Buchungen</h4>
            @if($travel_user->travel_user_booking_fewos)
                <div class="card-datatable table-responsive py-2">
                    <table class="table table-striped border-bottom">
                        <thead>
                            <tr>
                                <th style="max-width: 10px;">&nbsp;</th>
                                <th>{{__('ID')}}</th>
                                <th>{{__('FeWo')}}</th>
                                <th>{{__('vom')}}</th>
                                <th>{{__('bis')}}</th>
                                <th>{{__('Eingetragen')}}</th>
                                <th>{{__('Status')}}</th>
                                <th>{{__('Datum')}}</th>
                                <th>{{__('R.-Nr.')}}</th>
                            </tr>
                        </thead>
                        <tbody>
                        @foreach($travel_user->travel_user_booking_fewos as $travel_user_booking_fewo)
                            <tr>
                                <td style="width:1%">
                                    <a href="{{route('travel_user_booking_fewo_detail', [$travel_user_booking_fewo->id])}}" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>
                                </td>
                                <td>{{ $travel_user_booking_fewo->id }}</td>
                                <td>{{ $travel_user_booking_fewo->fewo_lodging->name }}</td>
                                <td>{{ $travel_user_booking_fewo->from_date }}</td>
                                <td>{{ $travel_user_booking_fewo->to_date }}</td>
                                <td>{!! $travel_user_booking_fewo->getCheckedBadgeCalendar() !!}</td>
                                <td>{{ $travel_user_booking_fewo->getStatuesName() }}</td>
                                <td>{{ $travel_user_booking_fewo->booking_date }}</td>
                                <td>{{ $travel_user_booking_fewo->invoice_number }}</td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                </div>
            @endif
        </div>
    </div>

    <div class="text-left mt-3">
        <button type="submit" name="action" value="saveAll" class="btn btn-submit">{{ __('save changes') }}</button>&nbsp;
        <a href="{{route('travel_users')}}" class="btn btn-default">{{ __('back') }}</a>
    </div>

    {!! Form::close() !!}

@endsection






