@extends('layouts.app')

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

    <div class="panel panel-default">
        <div class="panel-heading">
            @lang('quickadmin.qa_view')
        </div>

        <div class="panel-body table-responsive">
            <div class="row">
                <div class="col-md-6">
                    <table class="table table-bordered table-striped">
                        <tr>
                            <th>@lang('quickadmin.customer-appeal-option.fields.name')</th>
                            <td field-key='name'>{{ $customer_appeal_option->name }}</td>
                        </tr>
                    </table>
                </div>
            </div><!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
    
<li role="presentation" class="active"><a href="#customer_appeal" aria-controls="customer_appeal" role="tab" data-toggle="tab">Звернення користувачів </a></li>
</ul>

<!-- Tab panes -->
<div class="tab-content">
    
<div role="tabpanel" class="tab-pane active" id="customer_appeal">
<table class="table table-bordered table-striped {{ count($customer_appeals) > 0 ? 'datatable' : '' }}">
    <thead>
        <tr>
            <th>@lang('quickadmin.customer-appeal.fields.phone')</th>
                        <th>@lang('quickadmin.customer-appeal.fields.customer-appeal-option')</th>
                        <th>@lang('quickadmin.customer-appeal.fields.question')</th>
                        <th>@lang('quickadmin.customer-appeal.fields.call-now')</th>
                        <th>@lang('quickadmin.customer-appeal.fields.call-time')</th>
                        <th>@lang('quickadmin.customer-appeal.fields.developer')</th>
                        <th>@lang('quickadmin.customer-appeal.fields.request-processed')</th>
                        <th>@lang('quickadmin.customer-appeal.fields.residential-complexes')</th>
                        @if( request('show_deleted') == 1 )
                        <th>&nbsp;</th>
                        @else
                        <th>&nbsp;</th>
                        @endif
        </tr>
    </thead>

    <tbody>
        @if (count($customer_appeals) > 0)
            @foreach ($customer_appeals as $customer_appeal)
                <tr data-entry-id="{{ $customer_appeal->id }}">
                    <td field-key='phone'>{{ $customer_appeal->phone }}</td>
                                <td field-key='customer_appeal_option'>{{ $customer_appeal->customer_appeal_option->name ?? '' }}</td>
                                <td field-key='question'>{!! $customer_appeal->question !!}</td>
                                <td field-key='call_now'>{{ Form::checkbox("call_now", 1, $customer_appeal->call_now == 1 ? true : false, ["disabled"]) }}</td>
                                <td field-key='call_time'>{{ $customer_appeal->call_time }}</td>
                                <td field-key='developer'>{{ $customer_appeal->developer->name ?? '' }}</td>
                                <td field-key='request_processed'>{{ Form::checkbox("request_processed", 1, $customer_appeal->request_processed == 1 ? true : false, ["disabled"]) }}</td>
                                <td field-key='residential_complexes'>{{ $customer_appeal->residential_complexes->name ?? '' }}</td>
                                @if( request('show_deleted') == 1 )
                                <td>
                                    @can('customer_appeal_delete')
                                                                        {!! Form::open(array(
                                        'style' => 'display: inline-block;',
                                        'method' => 'POST',
                                        'onsubmit' => "return confirm('".trans("quickadmin.qa_are_you_sure")."');",
                                        'route' => ['admin.customer_appeals.restore', $customer_appeal->id])) !!}
                                    {!! Form::submit(trans('quickadmin.qa_restore'), array('class' => 'btn btn-xs btn-success')) !!}
                                    {!! Form::close() !!}
                                @endcan
                                    @can('customer_appeal_delete')
                                                                        {!! Form::open(array(
                                        'style' => 'display: inline-block;',
                                        'method' => 'DELETE',
                                        'onsubmit' => "return confirm('".trans("quickadmin.qa_are_you_sure")."');",
                                        'route' => ['admin.customer_appeals.perma_del', $customer_appeal->id])) !!}
                                    {!! Form::submit(trans('quickadmin.qa_permadel'), array('class' => 'btn btn-xs btn-danger')) !!}
                                    {!! Form::close() !!}
                                @endcan
                                </td>
                                @else
                                <td>
                                    @can('customer_appeal_view')
                                    <a href="{{ route('admin.customer_appeals.show',[$customer_appeal->id]) }}" class="btn btn-xs btn-primary">@lang('quickadmin.qa_view')</a>
                                    @endcan
                                    @can('customer_appeal_edit')
                                    <a href="{{ route('admin.customer_appeals.edit',[$customer_appeal->id]) }}" class="btn btn-xs btn-info">@lang('quickadmin.qa_edit')</a>
                                    @endcan
                                    @can('customer_appeal_delete')
{!! Form::open(array(
                                        'style' => 'display: inline-block;',
                                        'method' => 'DELETE',
                                        'onsubmit' => "return confirm('".trans("quickadmin.qa_are_you_sure")."');",
                                        'route' => ['admin.customer_appeals.destroy', $customer_appeal->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="13">@lang('quickadmin.qa_no_entries_in_table')</td>
            </tr>
        @endif
    </tbody>
</table>
</div>
</div>

            <p>&nbsp;</p>

            <a href="{{ route('admin.customer_appeal_options.index') }}" class="btn btn-default">@lang('quickadmin.qa_back_to_list')</a>
        </div>
    </div>
@stop


