@inject('request', 'Illuminate\Http\Request')
@extends('layouts.app')

@section('content')
    <h3 class="page-title">@lang('quickadmin.customer-appeal-option.title')</h3>

    <div class="panel panel-default customer-appeal">
        <div class="panel-heading header-block">
            @include('partials.header-filter', [
                'model_key' => $model_key,
                'gate_key' => $gate_key,
                'search_id' => $search_id,
                'listForSelect' => $filterList
            ])
        </div>

        <div class="panel-body table-responsive">
            <table class="table table-bordered table-striped {{ count($customer_appeal_options) > 0 ? 'datatable' : '' }} @can('customer_appeal_option_delete') @if ( request('show_deleted') != 1 ) dt-select @endif @endcan">
                <thead>
                    <tr>
                        @can('customer_appeal_option_delete')
                            @if ( request('show_deleted') != 1 )<th style="text-align:center;"><input type="checkbox" id="select-all" /></th>@endif
                        @endcan

                        <th>@lang('quickadmin.customer-appeal-option.fields.name')</th>
                        @if( request('show_deleted') == 1 )
                            <th>@lang('quickadmin.qa_action')</th>
                        @else
                            <th>@lang('quickadmin.qa_action')</th>
                        @endif
                    </tr>
                </thead>
                
                <tbody>
                    @if (count($customer_appeal_options) > 0)
                        @foreach ($customer_appeal_options as $customer_appeal_option)
                            <tr data-entry-id="{{ $customer_appeal_option->id }}">
                                @can('customer_appeal_option_delete')
                                    @if ( request('show_deleted') != 1 )<td></td>@endif
                                @endcan

                                <td field-key='name'>{{ $customer_appeal_option->name }}</td>
                                @if( request('show_deleted') == 1 )
                                <td class="action">
                                    @can('customer_appeal_option_delete')
                                                                        {!! Form::open(array(
                                        'style' => 'display: inline-block;',
                                        'method' => 'POST',
                                        'onsubmit' => "return confirm('".trans("quickadmin.qa_are_you_sure")."');",
                                        'route' => ['admin.customer_appeal_options.restore', $customer_appeal_option->id])) !!}
                                    {!! Form::submit(trans('quickadmin.qa_restore'), array('class' => 'btn btn-xs btn-success')) !!}
                                    {!! Form::close() !!}
                                @endcan
                                    @can('customer_appeal_option_delete')
                                                                        {!! Form::open(array(
                                        'style' => 'display: inline-block;',
                                        'method' => 'DELETE',
                                        'onsubmit' => "return confirm('".trans("quickadmin.qa_are_you_sure")."');",
                                        'route' => ['admin.customer_appeal_options.perma_del', $customer_appeal_option->id])) !!}
                                    {!! Form::submit(trans('quickadmin.qa_permadel'), array('class' => 'btn btn-xs btn-danger')) !!}
                                    {!! Form::close() !!}
                                @endcan
                                </td>
                                @else
                                <td class="action">
                                    @can('customer_appeal_option_view')
                                    <a href="{{ route('admin.customer_appeal_options.show',[$customer_appeal_option->id]) }}" class="btn btn-xs btn-primary">@lang('quickadmin.qa_view')</a>
                                    @endcan
                                    @can('customer_appeal_option_edit')
                                    <a href="{{ route('admin.customer_appeal_options.edit',[$customer_appeal_option->id]) }}" class="btn btn-xs btn-info">@lang('quickadmin.qa_edit')</a>
                                    @endcan
                                    @can('customer_appeal_option_delete')
{!! Form::open(array(
                                        'style' => 'display: inline-block;',
                                        'method' => 'DELETE',
                                        'onsubmit' => "return confirm('".trans("quickadmin.qa_are_you_sure")."');",
                                        'route' => ['admin.customer_appeal_options.destroy', $customer_appeal_option->id])) !!}
                                    {!! Form::submit(trans('quickadmin.qa_delete'), array('class' => 'btn btn-xs btn-danger')) !!}
                                    {!! Form::close() !!}
                                    @endcan
                                </td>
                                @endif
                            </tr>
                        @endforeach
                    @else
                        <tr>
                            <td colspan="6">@lang('quickadmin.qa_no_entries_in_table')</td>
                        </tr>
                    @endif
                </tbody>
            </table>
        </div>
    </div>
@stop

@section('javascript') 
    <script>
        @can('customer_appeal_option_delete')
            @if ( request('show_deleted') != 1 ) window.route_mass_crud_entries_destroy = '{{ route('admin.customer_appeal_options.mass_destroy') }}'; @endif
        @endcan

    </script>
@endsection