@extends('layouts.app')

@section('content')
    <h3 class="page-title">@lang('quickadmin.developer.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.developer.fields.name')</th>
                            <td field-key='name'>{{ $developer->name }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.code')</th>
                            <td field-key='code'>{{ $developer->code }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.enabled')</th>
                            <td field-key='enabled'>{{ Form::checkbox("enabled", 1, $developer->enabled == 1 ? true : false, ["disabled"]) }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.description')</th>
                            <td field-key='description'>{{ $developer->description }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.logotype-icon')</th>
                            <td field-key='logotype_icon'>@if($developer->logotype_icon)<a
                                        href="{{ asset(env('UPLOAD_PATH').'/' . $developer->logotype_icon) }}"
                                        target="_blank"><img
                                            src="{{ asset(env('UPLOAD_PATH').'/thumb/' . $developer->logotype_icon) }}"/></a>@endif
                            </td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.email')</th>
                            <td field-key='email'>{{ $developer->email }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.phone')</th>
                            <td field-key='phone'>{{ $developer->phone }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.main-page-priority')</th>
                            <td field-key='main_page_priority'>{{ $developer->main_page_priority }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.developer-page-priority')</th>
                            <td field-key='developer_page_priority'>{{ $developer->developer_page_priority }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.birthday')</th>
                            <td field-key='birthday'>{{ $developer->birthday }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.meta-title')</th>
                            <td field-key='meta_title'>{{ $developer->meta_title }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.meta-keywords')</th>
                            <td field-key='meta_keywords'>{{ $developer->meta_keywords }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.meta-description')</th>
                            <td field-key='meta_description'>{{ $developer->meta_description }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.seo-text')</th>
                            <td field-key='seo_text'>{{ $developer->seo_text }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.facebook')</th>
                            <td field-key='facebook'>{{ $developer->facebook }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.site-link')</th>
                            <td field-key='site_link'>{{ $developer->site_link }}</td>
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.developer.fields.city')</th>
                            <td field-key='city'>{{ $developer->city->name ?? '' }}</td>
                        </tr>
                    </table>
                </div>
            </div><!-- Nav tabs -->
            <ul class="nav nav-tabs" role="tablist">

                {{--<li role="presentation" class="active"><a href="#wishlist_user_developer" aria-controls="wishlist_user_developer" role="tab" data-toggle="tab">Уподобані Забудовники користувача</a></li>--}}
                <li role="presentation" class=""><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="wishlist_user_developer">--}}
                {{--<table class="table table-bordered table-striped {{ count($wishlist_user_developers) > 0 ? 'datatable' : '' }}">--}}
                {{--<thead>--}}
                {{--<tr>--}}
                {{--<th>@lang('quickadmin.wishlist-user-developer.fields.user')</th>--}}
                {{--<th>@lang('quickadmin.wishlist-user-developer.fields.developer')</th>--}}
                {{--@if( request('show_deleted') == 1 )--}}
                {{--<th>&nbsp;</th>--}}
                {{--@else--}}
                {{--<th>&nbsp;</th>--}}
                {{--@endif--}}
                {{--</tr>--}}
                {{--</thead>--}}

                {{--<tbody>--}}
                {{--@if (count($wishlist_user_developers) > 0)--}}
                {{--@foreach ($wishlist_user_developers as $wishlist_user_developer)--}}
                {{--<tr data-entry-id="{{ $wishlist_user_developer->id }}">--}}
                {{--<td field-key='user'>{{ $wishlist_user_developer->user->name ?? '' }}</td>--}}
                {{--<td field-key='developer'>{{ $wishlist_user_developer->developer->name ?? '' }}</td>--}}
                {{--@if( request('show_deleted') == 1 )--}}
                {{--<td>--}}
                {{--@can('wishlist_user_developer_delete')--}}
                {{--{!! Form::open(array(--}}
                {{--'style' => 'display: inline-block;',--}}
                {{--'method' => 'POST',--}}
                {{--'onsubmit' => "return confirm('".trans("quickadmin.qa_are_you_sure")."');",--}}
                {{--'route' => ['admin.wishlist_user_developers.restore', $wishlist_user_developer->id])) !!}--}}
                {{--{!! Form::submit(trans('quickadmin.qa_restore'), array('class' => 'btn btn-xs btn-success')) !!}--}}
                {{--{!! Form::close() !!}--}}
                {{--@endcan--}}
                {{--@can('wishlist_user_developer_delete')--}}
                {{--{!! Form::open(array(--}}
                {{--'style' => 'display: inline-block;',--}}
                {{--'method' => 'DELETE',--}}
                {{--'onsubmit' => "return confirm('".trans("quickadmin.qa_are_you_sure")."');",--}}
                {{--'route' => ['admin.wishlist_user_developers.perma_del', $wishlist_user_developer->id])) !!}--}}
                {{--{!! Form::submit(trans('quickadmin.qa_permadel'), array('class' => 'btn btn-xs btn-danger')) !!}--}}
                {{--{!! Form::close() !!}--}}
                {{--@endcan--}}
                {{--</td>--}}
                {{--@else--}}
                {{--<td>--}}
                {{--@can('wishlist_user_developer_view')--}}
                {{--<a href="{{ route('admin.wishlist_user_developers.show',[$wishlist_user_developer->id]) }}" class="btn btn-xs btn-primary">@lang('quickadmin.qa_view')</a>--}}
                {{--@endcan--}}
                {{--@can('wishlist_user_developer_edit')--}}
                {{--<a href="{{ route('admin.wishlist_user_developers.edit',[$wishlist_user_developer->id]) }}" class="btn btn-xs btn-info">@lang('quickadmin.qa_edit')</a>--}}
                {{--@endcan--}}
                {{--@can('wishlist_user_developer_delete')--}}
                {{--{!! Form::open(array(--}}
                {{--'style' => 'display: inline-block;',--}}
                {{--'method' => 'DELETE',--}}
                {{--'onsubmit' => "return confirm('".trans("quickadmin.qa_are_you_sure")."');",--}}
                {{--'route' => ['admin.wishlist_user_developers.destroy', $wishlist_user_developer->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="7">@lang('quickadmin.qa_no_entries_in_table')</td>--}}
                {{--</tr>--}}
                {{--@endif--}}
                {{--</tbody>--}}
                {{--</table>--}}
                {{--</div>--}}
                <div role="tabpanel" class="tab-pane " id="residential_complex">
                    <table class="table table-bordered table-striped {{ count($residential_complexes) > 0 ? 'datatable' : '' }}">
                        <thead>
                        <tr>
                            <th rowspan="2">@lang('quickadmin.residential-complex.fields.name')</th>
                            <th rowspan="2">@lang('quickadmin.residential-complex.fields.code')</th>
                            <th rowspan="2">@lang('quickadmin.residential-complex.fields.enabled')</th>
                            <th rowspan="2">@lang('quickadmin.residential-complex.fields.developer')</th>

                            <th colspan="2" id="priority-border">@lang('quickadmin.developer.fields.page-priority')</th>

                            <th rowspan="2">@lang('quickadmin.residential-complex.fields.min-price')</th>
                            <th rowspan="2">@lang('quickadmin.residential-complex.fields.city')</th>
                            <th rowspan="2">@lang('quickadmin.residential-complex.fields.district')</th>
                            <th rowspan="2">@lang('quickadmin.residential-complex.fields.street-name')</th>
                            <th rowspan="2">@lang('quickadmin.residential-complex.fields.stage-of-construction')</th>
                            @if( request('show_deleted') == 1 )
                                <th rowspan="2">@lang('quickadmin.qa_action')</th>
                            @else
                                <th rowspan="2">@lang('quickadmin.qa_action')</th>
                            @endif
                        </tr>
                        <tr>
                            <th>@lang('quickadmin.residential-complex.fields.main-page-priority_index')</th>
                            <th>@lang('quickadmin.residential-complex.fields.res-com-page-priority_index')</th>
                        </tr>
                        </thead>

                        <tbody>
                        @if (count($residential_complexes) > 0)
                            @dump(count($residential_complexes))
                            @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'>{{ $residential_complex->stageOfConstruction->name ?? '' }}</td>
                                    @if( request('show_deleted') == 1 )
                                        <td class="action">
                                            @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 class="action">
                                            @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.developers.index') }}"
               class="btn btn-default">@lang('quickadmin.qa_back_to_list')</a>
        </div>
    </div>
@stop

@section('javascript')
    @parent

    <script src="{{ url('adminlte/plugins/datetimepicker/moment-with-locales.min.js') }}"></script>
    <script src="{{ url('adminlte/plugins/datetimepicker/bootstrap-datetimepicker.min.js') }}"></script>
    <script>
        $(function () {
            moment.updateLocale('{{ App::getLocale() }}', {
                week: {dow: 1} // Monday is the first day of the week
            });

            $('.date').datetimepicker({
                format: "{{ config('app.date_format_moment') }}",
                locale: "{{ App::getLocale() }}",
            });

        });
    </script>

@stop
