@extends('layouts.app')

@section('content')
    <h3 class="page-title">@lang('quickadmin.other-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.other-option.fields.name')</th>
                            <td field-key='name'>{{ $other_option->name }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.other-option.fields.code')</th>
                            <td field-key='code'>{{ $other_option->code }}</td>
                        </tr>
                    </table>
                </div>
            </div><!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
    
<li role="presentation" class="active"><a href="#residential_complex" aria-controls="residential_complex" role="tab" data-toggle="tab">Житловий комплекс</a></li>
</ul>

<!-- Tab panes -->
<div class="tab-content">
    
<div role="tabpanel" class="tab-pane active" id="residential_complex">
<table class="table table-bordered table-striped {{ count($residential_complexes) > 0 ? 'datatable' : '' }}">
    <thead>
        <tr>
            <th>@lang('quickadmin.residential-complex.fields.name')</th>
                        <th>@lang('quickadmin.residential-complex.fields.code')</th>
                        <th>@lang('quickadmin.residential-complex.fields.enabled')</th>
                        <th>@lang('quickadmin.residential-complex.fields.developer')</th>
                        <th>@lang('quickadmin.residential-complex.fields.main-page-priority')</th>
                        <th>@lang('quickadmin.residential-complex.fields.res-com-page-priority')</th>
                        <th>@lang('quickadmin.residential-complex.fields.min-price')</th>
                        <th>@lang('quickadmin.residential-complex.fields.city')</th>
                        <th>@lang('quickadmin.residential-complex.fields.district')</th>
                        <th>@lang('quickadmin.residential-complex.fields.street-name')</th>
                        <th>@lang('quickadmin.residential-complex.fields.stage-of-construction')</th>
                        @if( request('show_deleted') == 1 )
                        <th>&nbsp;</th>
                        @else
                        <th>&nbsp;</th>
                        @endif
        </tr>
    </thead>

    <tbody>
        @if (count($residential_complexes) > 0)
            @foreach ($residential_complexes as $residential_complex)
                <tr data-entry-id="{{ $residential_complex->id }}">
                    <td field-key='name'>{{ $residential_complex->name }}</td>
                                <td field-key='code'>{{ $residential_complex->code }}</td>
                                <td field-key='enabled'>{{ Form::checkbox("enabled", 1, $residential_complex->enabled == 1 ? true : false, ["disabled"]) }}</td>
                                <td field-key='developer'>{{ $residential_complex->developer->name ?? '' }}</td>
                                <td field-key='main_page_priority'>{{ $residential_complex->main_page_priority }}</td>
                                <td field-key='res_com_page_priority'>{{ $residential_complex->res_com_page_priority }}</td>
                                <td field-key='min_price'>{{ $residential_complex->min_price }}</td>
                                <td field-key='city'>{{ $residential_complex->city->name ?? '' }}</td>
                                <td field-key='district'>{{ $residential_complex->district->name ?? '' }}</td>
                                <td field-key='street_name'>{{ $residential_complex->street_name->name ?? '' }}</td>
                                <td field-key='stage_of_construction'>
                                    @foreach ($residential_complex->stage_of_construction as $singleStageOfConstruction)
                                        <span class="label label-info label-many">{{ $singleStageOfConstruction->name }}</span>
                                    @endforeach
                                </td>
                                @if( request('show_deleted') == 1 )
                                <td>
                                    @can('residential_complex_delete')
                                                                        {!! Form::open(array(
                                        'style' => 'display: inline-block;',
                                        'method' => 'POST',
                                        'onsubmit' => "return confirm('".trans("quickadmin.qa_are_you_sure")."');",
                                        'route' => ['admin.residential_complexes.restore', $residential_complex->id])) !!}
                                    {!! Form::submit(trans('quickadmin.qa_restore'), array('class' => 'btn btn-xs btn-success')) !!}
                                    {!! Form::close() !!}
                                @endcan
                                    @can('residential_complex_delete')
                                                                        {!! Form::open(array(
                                        'style' => 'display: inline-block;',
                                        'method' => 'DELETE',
                                        'onsubmit' => "return confirm('".trans("quickadmin.qa_are_you_sure")."');",
                                        'route' => ['admin.residential_complexes.perma_del', $residential_complex->id])) !!}
                                    {!! Form::submit(trans('quickadmin.qa_permadel'), array('class' => 'btn btn-xs btn-danger')) !!}
                                    {!! Form::close() !!}
                                @endcan
                                </td>
                                @else
                                <td>
                                    @can('residential_complex_view')
                                    <a href="{{ route('admin.residential_complexes.show',[$residential_complex->id]) }}" class="btn btn-xs btn-primary">@lang('quickadmin.qa_view')</a>
                                    @endcan
                                    @can('residential_complex_edit')
                                    <a href="{{ route('admin.residential_complexes.edit',[$residential_complex->id]) }}" class="btn btn-xs btn-info">@lang('quickadmin.qa_edit')</a>
                                    @endcan
                                    @can('residential_complex_delete')
{!! Form::open(array(
                                        'style' => 'display: inline-block;',
                                        'method' => 'DELETE',
                                        'onsubmit' => "return confirm('".trans("quickadmin.qa_are_you_sure")."');",
                                        'route' => ['admin.residential_complexes.destroy', $residential_complex->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="41">@lang('quickadmin.qa_no_entries_in_table')</td>
            </tr>
        @endif
    </tbody>
</table>
</div>
</div>

            <p>&nbsp;</p>

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


