@extends('layouts.layout-2')

@section('content')
    <h4 class="font-weight-bold py-3 mb-1">
        Leistungsträger
    </h4>

    <div class="card">

        <div class="card-datatable table-responsive">
            <table class="datatables-default table table-striped table-bordered">
                <thead>
                <tr>
                    <th style="max-width: 60px;">&nbsp;</th>
                    <th>{{__('Name')}}</th>
                    <th>{{__('E-Mail(s)')}}</th>
                    <th>{{__('Type')}}</th>
                    <th>{{__('sichtbar')}}</th>
                    <th></th>
                </tr>
                </thead>
                <tbody>
                @foreach($service_provider as $value)
                    <tr>
                        <td data-sort="{{ $value->id }}">
                            <a href="{{ route('admin_settings_service_provider_detail', [$value->id]) }}" class="btn icon-btn btn-sm btn-primary">
                                <span class="fa fa-edit"></span>
                            </a>
                        </td>
                        <td>{{ $value->name }}</td>
                        <td>{!! \App\Services\Util::_implodeLines($value->contact_emails, "<br>") !!}</td>
                        <td data-sort="{{ $value->type }}">{{$value->type}}</td>
                        <td data-sort="{{ $value->active }}">{!! \App\Services\HTMLHelper::getActiveIcon($value->active) !!}</td>
                        <td><a class="text-danger" href="{{ route('admin_settings_service_provider_delete', [$value->id]) }}"  onclick="return confirm('{{__('Wirklich löschen?')}}');"><i class="fa fa-trash-alt"></i></a></td>
                    </tr>
                @endforeach
                </tbody>
            </table>
            <div class="mt-4 col">
                <a href="{{ route('admin_settings_service_provider_detail', ['new']) }}" class="btn btn-sm btn-primary">Neuen Leistungsträger anlegen</a>
            </div>
        </div>

        <script>
            $( document ).ready(function() {

                $('.datatables-default').dataTable({
                    "bLengthChange": false,
                    "iDisplayLength": 50,
                    "order": [[ 0, "asc" ]],
                    "language": {
                        "url": "/js/German.json"
                    }
                });
            });
        </script>

    </div>


@endsection