@extends('layouts.app')

@section('content')
    <h3 class="page-title">@lang('quickadmin.residential-complex.title')</h3>

    {!! Form::model($residential_complex, ['method' => 'PUT', 'route' => ['admin.residential_complexes.update', $residential_complex->id], 'files' => true,]) !!}

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

        <div class="panel-body">
            <div class="row">
                <div class="col-xs-12 col-lg-4 form-group">
                    {!! Form::label('name', trans('quickadmin.residential-complex.fields.name').'*', ['class' => 'control-label']) !!}
                    {!! Form::text('name', old('name'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    <p class="help-block"></p>
                    @if($errors->has('name'))
                        <p class="help-block">
                            {{ $errors->first('name') }}
                        </p>
                    @endif
                </div>

                <div class="col-xs-12 col-lg-4 form-group">
                    {!! Form::label('code', trans('quickadmin.residential-complex.fields.code').'*', ['class' => 'control-label']) !!}
                    {!! Form::text('code', old('code'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    <p class="help-block"></p>
                    @if($errors->has('code'))
                        <p class="help-block">
                            {{ $errors->first('code') }}
                        </p>
                    @endif
                </div>

                <div class="col-xs-12 col-lg-4 form-group">
                    {!! Form::label('developer_id', trans('quickadmin.residential-complex.fields.developer'), ['class' => 'control-label']) !!}

                    @can('residential_complex_create')
                        {!! Form::select('developer_id', $developers, old('developer_id'), ['class' => 'form-control select2']) !!}
                    @else
                        {!! Form::select('developer_id', $developers, old('developer_id'), ['class' => 'form-control select2', "disabled"]) !!}
                        {!! Form::hidden('developer_id', old('developer_id')) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('developer_id'))
                        <p class="help-block">
                            {{ $errors->first('developer_id') }}
                        </p>
                    @endif
                </div>
            </div>

            <div class="flex-space-between">
                <div class="form-group">
                    <div class="checkbox">
                        <label class="control-label">
                            @can('residential_complex_create')
                                <input type="hidden" name="enabled" value="0">
                                {!! Form::checkbox('enabled', 1, old('enabled'), []) !!} @lang('quickadmin.residential-complex.fields.enabled')

                            @else
                                {!! Form::checkbox('enabled', 1, old('enabled'), ["disabled"]) !!} @lang('quickadmin.residential-complex.fields.enabled')
                                <input type="hidden" name="enabled" value="@if(old('enabled')){{old('enabled')}}@else{{ $residential_complex->enabled }} @endif">
                            @endcan
                        </label>
                    </div>
                    <p class="help-block"></p>
                    @if($errors->has('enabled'))
                        <p class="help-block">
                            {{ $errors->first('enabled') }}
                        </p>
                    @endif
                </div>
                <div class="form-group">
                    <div class="checkbox">
                        <label class="control-label">

                        @can('residential_complex_create')
                                <input type="hidden" name="is_repair" value="0">
                                {!! Form::checkbox('is_repair', 1, old('is_repair'), []) !!} @lang('quickadmin.residential-complex.fields.is-repair')
                            @else
                                {!! Form::checkbox('is_repair', 1, old('is_repair'), ["disabled"]) !!} @lang('quickadmin.residential-complex.fields.is-repair')

                                <input type="hidden" name="is_repair" value="@if(old('is_repair')){{old('is_repair')}}@else{{ $residential_complex->is_repair }} @endif">
                            @endcan
                        </label>
                    </div>

                    <p class="help-block"></p>
                    @if($errors->has('is_repair'))
                        <p class="help-block">
                            {{ $errors->first('is_repair') }}
                        </p>
                    @endif
                </div>
                <div class="form-group">
                    <div class="checkbox">
                        <label class="control-label">

                        @can('residential_complex_create')
                                <input type="hidden" name="is_credit" value="0">
                                {!! Form::checkbox('is_credit', 1, old('is_credit'), []) !!} @lang('quickadmin.residential-complex.fields.is-credit')

                            @else
                                {!! Form::checkbox('is_credit', 1, old('is_credit'), ["disabled"]) !!} @lang('quickadmin.residential-complex.fields.is-credit')
                                <input type="hidden" name="is_credit" value="@if(old('is_credit')){{old('is_credit')}}@else{{ $residential_complex->is_credit }} @endif">
                            @endcan
                        </label>
                    </div>

                    <p class="help-block"></p>
                    @if($errors->has('is_credit'))
                        <p class="help-block">
                            {{ $errors->first('is_credit') }}
                        </p>
                    @endif
                </div>
                <div class="form-group">
                    <div class="checkbox">
                        <label class="control-label">

                        @can('residential_complex_create')
                                <input type="hidden" name="is_transport_hub" value="0">
                                {!! Form::checkbox('is_transport_hub', 1, old('is_transport_hub'), []) !!} @lang('quickadmin.residential-complex.fields.is-transport-hub')

                            @else
                                {!! Form::checkbox('is_transport_hub', 1, old('is_transport_hub'), ["disabled"]) !!} @lang('quickadmin.residential-complex.fields.is-transport-hub')
                                <input type="hidden" name="is_transport_hub" value="@if(old('is_transport_hub')){{old('is_transport_hub')}}@else{{ $residential_complex->is_transport_hub }} @endif">
                            @endcan
                        </label>
                    </div>

                    <p class="help-block"></p>
                    @if($errors->has('is_transport_hub'))
                        <p class="help-block">
                            {{ $errors->first('is_transport_hub') }}
                        </p>
                    @endif
                </div>
                <div class="form-group">
                    <div class="checkbox">
                        <label class="control-label">
                        @can('residential_complex_create')
                                <input type="hidden" name="start_of_sale" value="0">
                                {!! Form::checkbox('start_of_sale', 1, old('start_of_sale'), []) !!} @lang('quickadmin.residential-complex.fields.start_of_sale')

                            @else
                                {!! Form::checkbox('start_of_sale', 1, old('start_of_sale'), ["disabled"]) !!} @lang('quickadmin.residential-complex.fields.start_of_sale')
                                <input type="hidden" name="start_of_sale" value="@if(old('start_of_sale')){{old('start_of_sale')}}@else{{ $residential_complex->start_of_sale }} @endif">
                            @endcan
                        </label>
                    </div>
                    <p class="help-block"></p>
                    @if($errors->has('start_of_sale'))
                        <p class="help-block">
                            {{ $errors->first('start_of_sale') }}
                        </p>
                    @endif
                </div>
                <div class="form-group">
                    <div class="checkbox">
                        <label class="control-label">


                        @can('residential_complex_create')
                                <input type="hidden" name="show_bank" value="0">

                                {!! Form::checkbox('show_bank', 1, old('show_bank'), []) !!} @lang('quickadmin.residential-complex.fields.show-bank')
                            @else
                                {!! Form::checkbox('show_bank', 1, old('show_bank'), ["disabled"]) !!} @lang('quickadmin.residential-complex.fields.show-bank')
                                <input type="hidden" name="show_bank" value="@if(old('show_bank')){{old('show_bank')}}@else{{ $residential_complex->show_bank }} @endif">
                            @endcan
                        </label>
                    </div>
                    <p class="help-block"></p>
                    @if($errors->has('show_bank'))
                        <p class="help-block">
                            {{ $errors->first('show_bank') }}
                        </p>
                    @endif
                </div>
            </div>

            <div class="row">
                <div class="col-xs-12 col-lg-8 form-group">
                    {!! Form::label('site_link', trans('quickadmin.residential-complex.fields.site-link').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('site_link', old('site_link'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('site_link', old('site_link'), ['class' => 'form-control', "readonly", 'placeholder' => '']) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('site_link'))
                        <p class="help-block">
                            {{ $errors->first('site_link') }}
                        </p>
                    @endif
                </div>

                <div class="col-xs-12 col-lg-4 form-group">
                    {!! Form::label('phone', trans('quickadmin.residential-complex.fields.phone').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('phone', old('phone'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('phone', old('phone'), ['class' => 'form-control', "readonly", 'placeholder' => '']) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('phone'))
                        <p class="help-block">
                            {{ $errors->first('phone') }}
                        </p>
                    @endif
                </div>
            </div>

            <div class="row">
                <div class="col-xs-12 col-lg-12 form-group">
                    {!! Form::label('site_utm', trans('quickadmin.residential-complex.fields.site-utm').'', ['class' => 'control-label']) !!}
                        {!! Form::text('site_utm', old('site_utm'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    <p class="help-block"></p>
                    @if($errors->has('site_utm'))
                        <p class="help-block">
                            {{ $errors->first('site_utm') }}
                        </p>
                    @endif
                </div>
            </div>

            <div class="row">
                <div class="col-xs-12 form-group">
                    {!! Form::label('meta_title', trans('quickadmin.residential-complex.fields.meta-title').'', ['class' => 'control-label']) !!}
                    {!! Form::text('residential_complex_seos[id-'.$residential_complex->residential_complex_seos->first()->id.'][meta_title]', old('residential_complex_seos[0][meta_title]', isset($residential_complex) ? $residential_complex->residential_complex_seos->first()->meta_title: ''), ['class' => 'form-control', 'placeholder' => '']) !!}

                    <p class="help-block"></p>
                    @if($errors->has('meta_title'))
                        <p class="help-block">
                            {{ $errors->first('meta_title') }}
                        </p>
                    @endif
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 form-group">
                    {!! Form::label('meta_keywords', trans('quickadmin.residential-complex.fields.meta-keywords').'', ['class' => 'control-label']) !!}
                    {!! Form::text('residential_complex_seos[id-'.$residential_complex->residential_complex_seos->first()->id.'][meta_keywords]', old('residential_complex_seos[0][meta_keywords]', isset($residential_complex) ? $residential_complex->residential_complex_seos->first()->meta_keywords: ''), ['class' => 'form-control', 'placeholder' => '']) !!}
                    <p class="help-block"></p>
                    @if($errors->has('meta_keywords'))
                        <p class="help-block">
                            {{ $errors->first('meta_keywords') }}
                        </p>
                    @endif
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 form-group">
                    {!! Form::label('meta_description', trans('quickadmin.residential-complex.fields.meta-description').'', ['class' => 'control-label']) !!}
                    {!! Form::text('residential_complex_seos[id-'.$residential_complex->residential_complex_seos->first()->id.'][meta_description]', old('residential_complex_seos[0][meta_description]', isset($residential_complex) ? $residential_complex->residential_complex_seos->first()->meta_description: ''), ['class' => 'form-control', 'placeholder' => '']) !!}

                    <p class="help-block"></p>
                    @if($errors->has('meta_description'))
                        <p class="help-block">
                            {{ $errors->first('meta_description') }}
                        </p>
                    @endif
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 form-group">
                    {!! Form::label('seo_text', trans('quickadmin.residential-complex.fields.seo-text').'', ['class' => 'control-label', ]) !!}

                    {!! Form::textarea('residential_complex_seos[id-'.$residential_complex->residential_complex_seos->first()->id.'][seo_text]', old('residential_complex_seos[0][seo_text]', isset($residential_complex) ? $residential_complex->residential_complex_seos->first()->seo_text: ''), ['id' => 'seo_text', 'rows' => 4, 'style' => 'resize:none; visibility: hidden;', 'class' => 'form-control', 'placeholder' => '']) !!}
                    <p class="help-block"></p>
                    @if($errors->has('seo_text'))
                        <p class="help-block">
                            {{ $errors->first('seo_text') }}
                        </p>
                    @endif
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 col-lg-2 form-group">
                    {!! Form::label('main_page_priority', trans('quickadmin.residential-complex.fields.main-page-priority').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::number('main_page_priority', old('main_page_priority'), ['class' => 'form-control', 'placeholder' => '', 'min'=>0]) !!}
                    @else
                        {!! Form::number('main_page_priority', old('main_page_priority'), ['class' => 'form-control', "readonly", 'placeholder' => '', 'min'=>0]) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('main_page_priority'))
                        <p class="help-block">
                            {{ $errors->first('main_page_priority') }}
                        </p>
                    @endif
                </div>
                <div class="col-xs-12 col-lg-2 form-group">
                    {!! Form::label('res_com_page_priority', trans('quickadmin.residential-complex.fields.res-com-page-priority').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::number('res_com_page_priority', old('res_com_page_priority'), ['class' => 'form-control', 'placeholder' => '', 'min'=>0]) !!}
                    @else
                        {!! Form::number('res_com_page_priority', old('res_com_page_priority'), ['class' => 'form-control', "readonly", 'placeholder' => '', 'min'=>0]) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('res_com_page_priority'))
                        <p class="help-block">
                            {{ $errors->first('res_com_page_priority') }}
                        </p>
                    @endif
                </div>

                <div class="col-xs-12 col-lg-4 form-group">
                    {!! Form::label('building_put_into_operation', trans('quickadmin.residential-complex.fields.building_put_into_operation').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('building_put_into_operation', old('building_put_into_operation'), ['class' => 'form-control', 'placeholder' => '', 'min'=>0]) !!}
                    @else
                        {!! Form::text('building_put_into_operation', old('building_put_into_operation'), ['class' => 'form-control', "readonly", 'placeholder' => '']) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('building_put_into_operation'))
                        <p class="help-block">
                            {{ $errors->first('building_put_into_operation') }}
                        </p>
                    @endif
                </div>

                <div class="col-lg-3">
                    {!! Form::label('date_putting_into_operation', trans('quickadmin.residential-complex.fields.date-putting-into-operation').'', ['class' => 'control-label']) !!}
                </div>

                <div class="col-xs-2">
                    @can('residential_complex_create')
                        {!! Form::text('date_putting_into_operation', old('date_putting_into_operation'), ['class' => 'form-control date text-align-center', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('date_putting_into_operation', old('date_putting_into_operation'), ['class' => 'form-control date', "readonly", 'placeholder' => '']) !!}
                        {!! Form::hidden('date_putting_into_operation', old('date_putting_into_operation')) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('date_putting_into_operation'))
                        <p class="help-block">
                            {{ $errors->first('date_putting_into_operation') }}
                        </p>
                    @endif
                </div>

                <div class="col-xs-2">
                    @can('residential_complex_create')
                        {!! Form::select('quarterly_putting_into_operation_id', $quarterly, old('quarterly_putting_into_operation_id'), ['class' => 'form-control select2']) !!}
                    @else
                        {!! Form::select('quarterly_putting_into_operation_id', $quarterly, old('quarterly_putting_into_operation_id'), ['class' => 'form-control select2', "disabled"]) !!}
                        {!! Form::hidden('quarterly_putting_into_operation_id', old('quarterly_putting_into_operation_id')) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('quarterly_putting_into_operation_id'))
                        <p class="help-block">
                            {{ $errors->first('quarterly_putting_into_operation_id') }}
                        </p>
                    @endif
                </div>


            </div>

            <div class="row">
                <div class="col-xs-12 col-lg-3 form-group">
                    {!! Form::label('building_count', trans('quickadmin.residential-complex.fields.building-count').'*', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::number('building_count', old('building_count'), ['class' => 'form-control', 'placeholder' => '', 'min'=>0]) !!}
                    @else
                        {!! Form::number('building_count', old('building_count'), ['class' => 'form-control', 'placeholder' => '', "readonly", 'min'=>0]) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('building_count'))
                        <p class="help-block">
                            {{ $errors->first('building_count') }}
                        </p>
                    @endif
                </div>
                <div class="col-xs-12 col-lg-3 form-group">
                    {!! Form::label('min_price', trans('quickadmin.residential-complex.fields.min-price').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('min_price', old('min_price'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('min_price', old('min_price'), ['class' => 'form-control', 'placeholder' => '', "readonly"]) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('min_price'))
                        <p class="help-block">
                            {{ $errors->first('min_price') }}
                        </p>
                    @endif
                </div>
                <div class="col-xs-12 col-lg-3 form-group">
                    {!! Form::label('room_count', trans('quickadmin.residential-complex.fields.room-count').'*', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::number('room_count', old('room_count'), ['class' => 'form-control', 'placeholder' => '', 'min'=>0]) !!}
                    @else
                        {!! Form::number('room_count', old('room_count'), ['class' => 'form-control', 'placeholder' => '', "readonly", 'min'=>0]) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('room_count'))
                        <p class="help-block">
                            {{ $errors->first('room_count') }}
                        </p>
                    @endif
                </div>
                <div class="col-xs-12 col-lg-3 form-group">
                    {!! Form::label('room_count_date', trans('quickadmin.residential-complex.fields.room-count-date').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('room_count_date', old('room_count_date'), ['class' => 'form-control date-time', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('room_count_date', old('room_count_date'), ['class' => 'form-control date-time', "readonly", 'placeholder' => '']) !!}
                        {!! Form::hidden('room_count_date', old('room_count_date')) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('room_count_date'))
                        <p class="help-block">
                            {{ $errors->first('room_count_date') }}
                        </p>
                    @endif
                </div>
            </div>

            <div class="row">
                {{--<div class="col-xs-12 col-lg-4 form-group">--}}
                {{--{!! Form::label('count_of_room_per_flat', trans('quickadmin.residential-complex.fields.count-of-room-per-flat').'', ['class' => 'control-label']) !!}--}}
                {{--@can('residential_complex_create')--}}
                {{--<button type="button" class="btn btn-primary btn-xs" id="selectbtn-count_of_room_per_flat">--}}
                {{--{{ trans('quickadmin.qa_select_all') }}--}}
                {{--</button>--}}
                {{--<button type="button" class="btn btn-primary btn-xs" id="deselectbtn-count_of_room_per_flat">--}}
                {{--{{ trans('quickadmin.qa_deselect_all') }}--}}
                {{--</button>--}}
                {{--@endcan--}}
                {{--@can('residential_complex_create')--}}
                {{--{!! Form::select('count_of_room_per_flat[]', $count_of_room_per_flats, old('count_of_room_per_flat') ? old('count_of_room_per_flat') : $residential_complex->count_of_room_per_flat->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', 'id' => 'selectall-count_of_room_per_flat' ]) !!}--}}
                {{--@else--}}
                {{--{!! Form::select('count_of_room_per_flat[]', $count_of_room_per_flats, old('count_of_room_per_flat') ? old('count_of_room_per_flat') : $residential_complex->count_of_room_per_flat->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', "disabled", 'id' => 'selectall-count_of_room_per_flat' ]) !!}--}}
                {{--{!! Form::hidden('count_of_room_per_flat', old('count_of_room_per_flat')) !!}--}}
                {{--@foreach($residential_complex->count_of_room_per_flat->pluck('id')->toArray() as $count_of_room_per_flat)--}}
                {{--{!! Form::hidden('count_of_room_per_flat[]', $count_of_room_per_flat) !!}--}}
                {{--@endforeach--}}
                {{--@endcan--}}

                {{--<p class="help-block"></p>--}}
                {{--@if($errors->has('count_of_room_per_flat'))--}}
                {{--<p class="help-block">--}}
                {{--{{ $errors->first('count_of_room_per_flat') }}--}}
                {{--</p>--}}
                {{--@endif--}}
                {{--</div>--}}

                {{--<div class="col-xs-12 col-lg-4 form-group">--}}
                {{--{!! Form::label('room_type', trans('quickadmin.residential-complex.fields.room-type').'', ['class' => 'control-label']) !!}--}}
                {{--@can('residential_complex_create')--}}
                {{--<button type="button" class="btn btn-primary btn-xs" id="selectbtn-room_type">--}}
                {{--{{ trans('quickadmin.qa_select_all') }}--}}
                {{--</button>--}}
                {{--<button type="button" class="btn btn-primary btn-xs" id="deselectbtn-room_type">--}}
                {{--{{ trans('quickadmin.qa_deselect_all') }}--}}
                {{--</button>--}}
                {{--@endcan--}}

                {{--@can('residential_complex_create')--}}
                {{--{!! Form::select('room_type[]', $room_types, old('room_type') ? old('room_type') : $residential_complex->room_type->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', 'id' => 'selectall-room_type' ]) !!}--}}
                {{--@else--}}
                {{--{!! Form::select('room_type[]', $room_types, old('room_type') ? old('room_type') : $residential_complex->room_type->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', 'id' => 'selectall-room_type', "disabled" ]) !!}--}}
                {{--@foreach($residential_complex->room_type->pluck('id')->toArray() as $room_type)--}}
                {{--{!! Form::hidden('room_type[]', $room_type) !!}--}}
                {{--@endforeach--}}
                {{--@endcan--}}
                {{--@if($errors->has('room_type'))--}}
                {{--<p class="help-block">--}}
                {{--{{ $errors->first('room_type') }}--}}
                {{--</p>--}}
                {{--@endif--}}
                {{--</div>--}}


            </div>

            <div class="row">
                <div class="col-xs-12 col-lg-6 form-group">
                    {!! Form::label('price_info', trans('quickadmin.residential-complex.fields.price-info').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('price_info', old('price_info'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('price_info', old('price_info'), ['class' => 'form-control', "readonly", 'placeholder' => '']) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('price_info'))
                        <p class="help-block">
                            {{ $errors->first('price_info') }}
                        </p>
                    @endif
                </div>
                <div class="col-xs-12 col-lg-6 form-group">
                    {!! Form::label('building_status_info', trans('quickadmin.residential-complex.fields.building-status-info').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('building_status_info', old('building_status_info'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('building_status_info', old('building_status_info'), ['class' => 'form-control', "readonly", 'placeholder' => '']) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('building_status_info'))
                        <p class="help-block">
                            {{ $errors->first('building_status_info') }}
                        </p>
                    @endif
                </div>
                <div class="col-xs-12 col-lg-6 form-group">
                    {!! Form::label('planning_info', trans('quickadmin.residential-complex.fields.planning-info').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('planning_info', old('planning_info'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('planning_info', old('planning_info'), ['class' => 'form-control', "readonly", 'placeholder' => '']) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('planning_info'))
                        <p class="help-block">
                            {{ $errors->first('planning_info') }}
                        </p>
                    @endif
                </div>
                <div class="col-xs-12 col-lg-6 form-group">
                    {!! Form::label('document_info', trans('quickadmin.residential-complex.fields.document-info').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('document_info', old('document_info'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('document_info', old('document_info'), ['class' => 'form-control', "readonly", 'placeholder' => '']) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('document_info'))
                        <p class="help-block">
                            {{ $errors->first('document_info') }}
                        </p>
                    @endif
                </div>
            </div>

            <div class="flex-space-between">
                <div class="form-group">
                    <div class="checkbox">
                        <label class="control-label">
                            @can('residential_complex_create')
                                <input type="hidden" name="is_show_consultation" value="0">
                                {!! Form::checkbox('is_show_consultation', 1, old('is_show_consultation', old('is_show_consultation')), []) !!} @lang('quickadmin.residential-complex.fields.is_show_consultation')
                            @else
                                {!! Form::checkbox('is_show_consultation', 1, old('is_show_consultation'), ['disabled']) !!} @lang('quickadmin.residential-complex.fields.is_show_consultation')
                                <input type="hidden" name="is_show_consultation" value="@if(old('is_show_consultation')){{old('is_show_consultation')}}@else{{ $residential_complex->is_show_consultation }} @endif">
                            @endcan
                        </label>
                    </div>
                    <p class="help-block"></p>
                    @if($errors->has('is_show_consultation'))
                        <p class="help-block">
                            {{ $errors->first('is_show_consultation') }}
                        </p>
                    @endif
                </div>
                <div class="form-group">
                    <div class="checkbox">
                        <label class="control-label">
                        @can('residential_complex_create')
                                <input type="hidden" name="is_show_presentation" value="0">
                                {!! Form::checkbox('is_show_presentation', 1, old('is_show_presentation', old('is_show_consultation')), []) !!} @lang('quickadmin.residential-complex.fields.is_show_presentation')

                            @else
                                {!! Form::checkbox('is_show_presentation', 1, old('is_show_presentation',old('is_show_consultation') ), ['disabled']) !!} @lang('quickadmin.residential-complex.fields.is_show_presentation')
                                <input type="hidden" name="is_show_presentation" value="@if(old('is_show_presentation')){{old('is_show_presentation')}}@else{{ $residential_complex->is_show_presentation }} @endif">
                            @endcan
                        </label>
                    </div>
                    <p class="help-block"></p>
                    @if($errors->has('is_show_presentation'))
                        <p class="help-block">
                            {{ $errors->first('is_show_presentation') }}
                        </p>
                    @endif
                </div>
                <div class="form-group">
                    <div class="checkbox">
                        <label class="control-label">
                            {{--{!! Form::hidden('is_show_telegram', 0) !!}--}}

                            @can('residential_complex_create')
                                <input type="hidden" name="is_show_telegram" value="0">

                                {!! Form::checkbox('is_show_telegram', 1, old('is_show_telegram', old('is_show_telegram')), []) !!} @lang('quickadmin.residential-complex.fields.is_show_telegram')
                            @else
                                {!! Form::checkbox('is_show_telegram', 1, old('is_show_telegram', old('is_show_telegram')), ['disabled']) !!} @lang('quickadmin.residential-complex.fields.is_show_telegram')
                                <input type="hidden" name="is_show_telegram" value="@if(old('is_show_telegram')){{old('is_show_telegram')}}@else{{ $residential_complex->is_show_telegram }} @endif">
                            @endcan
                        </label>
                    </div>
                    <p class="help-block"></p>
                    @if($errors->has('is_show_telegram'))
                        <p class="help-block">
                            {{ $errors->first('is_show_telegram') }}
                        </p>
                    @endif
                </div>
                <div class="form-group">
                    <div class="checkbox">
                        <label class="control-label">
                            {{--{!! Form::hidden('is_show_viber', 0) !!}--}}
                        @can('residential_complex_create')
                                <input type="hidden" name="is_show_viber" value="0">

                                {!! Form::checkbox('is_show_viber', 1, old('is_show_viber', old('is_show_viber')), []) !!} @lang('quickadmin.residential-complex.fields.is_show_viber')

                            @else
                                {!! Form::checkbox('is_show_viber', 1, old('is_show_viber', old('is_show_viber')), ['disabled']) !!} @lang('quickadmin.residential-complex.fields.is_show_viber')
                                <input type="hidden" name="is_show_viber" value="@if(old('is_show_viber')){{old('is_show_viber')}}@else{{ $residential_complex->is_show_viber }} @endif">
                            @endcan
                        </label>
                    </div>
                    <p class="help-block"></p>
                    @if($errors->has('is_show_viber'))
                        <p class="help-block">
                            {{ $errors->first('is_show_viber') }}
                        </p>
                    @endif
                </div>
                <div class="form-group">
                    <div class="checkbox">
                        <label class="control-label">
                            {{--{!! Form::hidden('is_show_skype', 0) !!}--}}
                        @can('residential_complex_create')
                                <input type="hidden" name="is_show_skype" value="0">

                                {!! Form::checkbox('is_show_skype', 1, old('is_show_skype', old('is_show_skype')), []) !!} @lang('quickadmin.residential-complex.fields.is_show_skype')

                            @else
                                {!! Form::checkbox('is_show_skype', 1, old('is_show_skype', old('is_show_skype')), ['disabled']) !!} @lang('quickadmin.residential-complex.fields.is_show_skype')
                                <input type="hidden" name="is_show_skype" value="@if(old('is_show_skype')){{old('is_show_skype')}}@else{{ $residential_complex->is_show_skype }} @endif">
                            @endcan

                        </label>
                    </div>
                    <p class="help-block"></p>
                    @if($errors->has('is_show_skype'))
                        <p class="help-block">
                            {{ $errors->first('is_show_skype') }}
                        </p>
                    @endif
                </div>
                <div class="form-group">
                    <div class="checkbox">
                        <label class="control-label">
                            {{--{!! Form::hidden('is_show_whatsapp', 0) !!}--}}

                        @can('residential_complex_create')
                                <input type="hidden" name="is_show_whatsapp" value="0">

                                {!! Form::checkbox('is_show_whatsapp', 1, old('is_show_whatsapp', old('is_show_whatsapp')), []) !!} @lang('quickadmin.residential-complex.fields.is_show_whatsapp')

                            @else
                                {!! Form::checkbox('is_show_whatsapp', 1, old('is_show_whatsapp', old('is_show_whatsapp')), ['disabled']) !!} @lang('quickadmin.residential-complex.fields.is_show_whatsapp')
                                <input type="hidden" name="is_show_whatsapp" value="@if(old('is_show_whatsapp')){{old('is_show_whatsapp')}}@else{{ $residential_complex->is_show_whatsapp }} @endif">
                            @endcan

                        </label>
                    </div>
                    <p class="help-block"></p>
                    @if($errors->has('is_show_whatsapp'))
                        <p class="help-block">
                            {{ $errors->first('is_show_whatsapp') }}
                        </p>
                    @endif
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    @if($errors->has('contact_error'))
                        <p class="help-block" style="text-align: center">
                            {{ $errors->first('contact_error') }}
                        </p>
                    @endif
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 col-lg-12 form-group">
                    {!! Form::label('consultation_description', trans('quickadmin.residential-complex.fields.consultation_description').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('consultation_description', old('consultation_description'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('consultation_description', old('consultation_description'), ['class' => 'form-control', "readonly", 'placeholder' => '']) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('consultation_description'))
                        <p class="help-block">
                            {{ $errors->first('consultation_description') }}
                        </p>
                    @endif
                </div>
            </div>
            <div class="row">

                <div class="col-xs-12 col-lg-6 form-group">
                    {!! Form::label('consultation_button_text', trans('quickadmin.residential-complex.fields.consultation_button_text').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('consultation_button_text', old('consultation_button_text'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('consultation_button_text', old('consultation_button_text'), ['class' => 'form-control', "readonly", 'placeholder' => '']) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('consultation_button_text'))
                        <p class="help-block">
                            {{ $errors->first('consultation_button_text') }}
                        </p>
                    @endif
                </div>
                <div class="col-xs-12 col-lg-6 form-group">
                    {!! Form::label('consultation_button_color', trans('quickadmin.residential-complex.fields.consultation_button_color'), ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        <input type="color" id="head" name="consultation_button_color" class="form-control" value="{{$residential_complex->consultation_button_color}}">
                    @else
                        <input type="color" id="head" name="consultation_button_color" class="form-control" readonly="readonly" value="{{$residential_complex->consultation_button_color}}">
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('consultation_button_color'))
                        <p class="help-block">
                            {{ $errors->first('consultation_button_color') }}
                        </p>
                    @endif
                </div>
            </div>

            <div class="row flex-align-end">
                <div class="col-xs-12 col-lg-4 form-group">
                    @if ($residential_complex->presentation)
                        <a href="{{ asset(env('UPLOAD_PATH').'/'. \App\Helpers\ImageSize::PRESENTATION .'/'.  $residential_complex->presentation) }}"
                           target="_blank">Завантажити
                            документ</a>
                        <p></p>
                    @endif

                    <label for='presentation' class="btn btn-info btn-lg">
                        @lang('quickadmin.residential-complex.fields.presentation')
                        <span class="glyphicon glyphicon-arrow-up"></span>
                    </label>
                    {!! Form::hidden('presentation', old('presentation')) !!}
                    @can('residential_complex_create')
                        {!! Form::file('presentation', ['class' => 'form-control up-document hidden', 'id'=>'presentation']) !!}
                    @else
                        {!! Form::file('presentation', ['class' => 'form-control up-document hidden', 'id'=>'presentation',"disabled" => "disabled"]) !!}
                    @endcan


                    {!! Form::hidden('presentation_max_size', 7) !!}
                    <p class="help-block"></p>
                    <div class="preview-document"></div>
                    @if($errors->has('presentation'))
                        <p class="help-block">
                            {{ $errors->first('presentation') }}
                        </p>
                    @endif
                </div>

                <div class="col-xs-12 col-lg-4 form-group">
                    {!! Form::label('email', trans('quickadmin.residential-complex.fields.email').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('email', old('email'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('email', old('email'), ['class' => 'form-control', 'placeholder' => '', "readonly"]) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('email'))
                        <p class="help-block">
                            {{ $errors->first('email') }}
                        </p>
                    @endif
                </div>
                <div class="col-xs-12 col-lg-4 form-group">
                    {!! Form::label('whatsapp', trans('quickadmin.residential-complex.fields.whatsapp').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('whatsapp', old('whatsapp'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('whatsapp', old('whatsapp'), ['class' => 'form-control', 'placeholder' => '', "readonly"]) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('whatsapp'))
                        <p class="help-block">
                            {{ $errors->first('whatsapp') }}
                        </p>
                    @endif
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 col-lg-4 form-group">
                    {!! Form::label('telegram', trans('quickadmin.residential-complex.fields.telegram').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('telegram', old('telegram'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('telegram', old('telegram'), ['class' => 'form-control', 'placeholder' => "", 'readonly']) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('telegram'))
                        <p class="help-block">
                            {{ $errors->first('telegram') }}
                        </p>
                    @endif
                </div>
                <div class="col-xs-12 col-lg-4 form-group">
                    {!! Form::label('viber', trans('quickadmin.residential-complex.fields.viber').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('viber', old('viber'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('viber', old('viber'), ['class' => 'form-control', 'placeholder' => "", 'readonly' ]) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('viber'))
                        <p class="help-block">
                            {{ $errors->first('viber') }}
                        </p>
                    @endif
                </div>
                <div class="col-xs-12 col-lg-4 form-group">
                    {!! Form::label('skype', trans('quickadmin.residential-complex.fields.skype').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('skype', old('skype'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('skype', old('skype'), ['class' => 'form-control', 'placeholder' => "", 'readonly' ]) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('skype'))
                        <p class="help-block">
                            {{ $errors->first('skype') }}
                        </p>
                    @endif
                </div>
            </div>


            <div class="row">
                <div class="col-xs-12 col-lg-3 form-group">
                    {!! Form::label('city_id', trans('quickadmin.residential-complex.fields.city').'*', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::select('city_id', $cities, old('city_id'), ['class' => 'form-control select2']) !!}
                    @else
                        {!! Form::select('city_id', $cities, old('city_id'), ['class' => 'form-control select2', "disabled"]) !!}
                        {!! Form::hidden('city_id', old('city_id')) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('city_id'))
                        <p class="help-block">
                            {{ $errors->first('city_id') }}
                        </p>
                    @endif
                </div>
                <div class="col-xs-12 col-lg-3 form-group">
                    {!! Form::label('district_id', trans('quickadmin.residential-complex.fields.district').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::select('district_id', $districts, old('district_id'), ['class' => 'form-control select2']) !!}
                    @else
                        {!! Form::select('district_id', $districts, old('district_id'), ['class' => 'form-control select2', "disabled"]) !!}
                        {!! Form::hidden('district_id', old('district_id')) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('district_id'))
                        <p class="help-block">
                            {{ $errors->first('district_id') }}
                        </p>
                    @endif
                </div>
                <div class="col-xs-12 col-lg-3 form-group">
                    {!! Form::label('street_name_id', trans('quickadmin.residential-complex.fields.street-name').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::select('street_name_id', $street_names, old('street_name_id'), ['class' => 'form-control select2' ]) !!}
                    @else
                        {!! Form::select('street_name_id', $street_names, old('street_name_id'), ['class' => 'form-control select2', "disabled"]) !!}
                        {!! Form::hidden('street_name_id', old('district_id')) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('street_name_id'))
                        <p class="help-block">
                            {{ $errors->first('street_name_id') }}
                        </p>
                    @endif
                </div>
                <div class="col-xs-12 col-lg-3 form-group">
                    {!! Form::label('street_number', trans('quickadmin.residential-complex.fields.street-number').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('street_number', old('street_number'), ['class' => 'form-control', 'placeholder' => '']) !!}
                    @else
                        {!! Form::text('street_number', old('street_number'), ['class' => 'form-control', 'placeholder' => '', "readonly"]) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('street_number'))
                        <p class="help-block">
                            {{ $errors->first('street_number') }}
                        </p>
                    @endif
                </div>
            </div>

            <div class="row">
                <div class="col-xs-12 form-group">
                    {!! Form::label('class', trans('quickadmin.residential-complex.fields.class').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        <button type="button" class="btn btn-primary btn-xs" id="selectbtn-class">
                            {{ trans('quickadmin.qa_select_all') }}
                        </button>
                        <button type="button" class="btn btn-primary btn-xs" id="deselectbtn-class">
                            {{ trans('quickadmin.qa_deselect_all') }}
                        </button>
                    @endcan
                    @can('residential_complex_create')
                        {!! Form::select('class[]', $classes, old('class') ? old('class') : $residential_complex->class->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', 'id' => 'selectall-class' ]) !!}
                    @else
                        {!! Form::select('class[]', $classes, old('class') ? old('class') : $residential_complex->class->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', "disabled", 'id' => 'selectall-class' ]) !!}
                        @foreach($residential_complex->class->pluck('id')->toArray() as $class)
                            {!! Form::hidden('class[]', $class) !!}
                        @endforeach
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('class'))
                        <p class="help-block">
                            {{ $errors->first('class') }}
                        </p>
                    @endif
                </div>
            </div>
            <div class="row">
                {{--<div class="col-xs-12 form-group">--}}
                {{--{!! Form::label('stage_of_construction', trans('quickadmin.residential-complex.fields.stage-of-construction').'', ['class' => 'control-label']) !!}--}}
                {{--@can('residential_complex_create')--}}
                {{--<button type="button" class="btn btn-primary btn-xs" id="selectbtn-stage_of_construction">--}}
                {{--{{ trans('quickadmin.qa_select_all') }}--}}
                {{--</button>--}}
                {{--<button type="button" class="btn btn-primary btn-xs" id="deselectbtn-stage_of_construction">--}}
                {{--{{ trans('quickadmin.qa_deselect_all') }}--}}
                {{--</button>--}}
                {{--@endcan--}}
                {{--@can('residential_complex_create')--}}
                {{--{!! Form::select('stage_of_construction[]', $stage_of_constructions, old('stage_of_construction') ? old('stage_of_construction') : $residential_complex->stage_of_construction->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', 'id' => 'selectall-stage_of_construction' ]) !!}--}}
                {{--@else--}}
                {{--{!! Form::select('stage_of_construction[]', $stage_of_constructions, old('stage_of_construction') ? old('stage_of_construction') : $residential_complex->stage_of_construction->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple',--}}
                {{--'id' => 'selectall-stage_of_construction', "disabled" ]) !!}--}}
                {{--@foreach($residential_complex->stage_of_construction->pluck('id')->toArray() as $stage_of_construction)--}}
                {{--{!! Form::hidden('stage_of_construction[]', $stage_of_construction) !!}--}}
                {{--@endforeach--}}
                {{--@endcan--}}
                {{--<p class="help-block"></p>--}}
                {{--@if($errors->has('stage_of_construction'))--}}
                {{--<p class="help-block">--}}
                {{--{{ $errors->first('stage_of_construction') }}--}}
                {{--</p>--}}
                {{--@endif--}}
                {{--</div>--}}
                <div class="col-xs-12 form-group">
                    {!! Form::label('stage_of_construction_id', trans('quickadmin.section.fields.stage-of-construction').'*', ['class' => 'control-label']) !!}


                    @can('residential_complex_create')
                        {!! Form::select('stage_of_construction_id', $stage_of_constructions, old('stage_of_construction_id'), ['class' => 'form-control select2', ]) !!}
                    @else
                        {!! Form::select('stage_of_construction_id', $stage_of_constructions, old('stage_of_construction_id'), ['class' => 'form-control select2', "disabled"]) !!}
                        {!! Form::hidden('stage_of_construction_id', old('stage_of_construction_id')) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('stage_of_construction_id'))
                        <p class="help-block">
                            {{ $errors->first('stage_of_construction_id') }}
                        </p>
                    @endif
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 form-group">
                    {!! Form::label('heating', trans('quickadmin.residential-complex.fields.heating').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        <button type="button" class="btn btn-primary btn-xs" id="selectbtn-heating">
                            {{ trans('quickadmin.qa_select_all') }}
                        </button>
                        <button type="button" class="btn btn-primary btn-xs" id="deselectbtn-heating">
                            {{ trans('quickadmin.qa_deselect_all') }}
                        </button>
                    @endcan
                    @can('residential_complex_create')
                        {!! Form::select('heating[]', $heatings, old('heating') ? old('heating') : $residential_complex->heating->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', 'id' => 'selectall-heating' ]) !!}
                        <p class="help-block"></p>
                    @else

                        {!! Form::select('heating[]', $heatings, old('heating') ? old('heating') : $residential_complex->heating->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', 'id' => 'selectall-heating', "disabled"]) !!}

                        @foreach($residential_complex->heating->pluck('id')->toArray() as $heating)
                            {!! Form::hidden('heating[]', $heating) !!}
                        @endforeach
                        <p class="help-block"></p>
                    @endcan
                    @if($errors->has('heating'))
                        <p class="help-block">
                            {{ $errors->first('heating') }}
                        </p>
                    @endif
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 form-group">
                    {!! Form::label('technology_building', trans('quickadmin.residential-complex.fields.technology-building').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        <button type="button" class="btn btn-primary btn-xs" id="selectbtn-technology_building">
                            {{ trans('quickadmin.qa_select_all') }}
                        </button>
                        <button type="button" class="btn btn-primary btn-xs" id="deselectbtn-technology_building">
                            {{ trans('quickadmin.qa_deselect_all') }}
                        </button>
                    @endcan
                    @can('residential_complex_create')
                        {!! Form::select('technology_building[]', $technology_buildings, old('technology_building') ? old('technology_building') : $residential_complex->technology_building->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', 'id' => 'selectall-technology_building' ]) !!}
                    @else
                        {!! Form::select('technology_building[]', $technology_buildings, old('technology_building') ? old('technology_building') : $residential_complex->technology_building->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', 'id' => 'selectall-technology_building' ]) !!}
                        @foreach($residential_complex->technology_building->pluck('id')->toArray() as $technology_building)
                            {!! Form::hidden('technology_building[]', $technology_building) !!}
                        @endforeach
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('technology_building'))
                        <p class="help-block">
                            {{ $errors->first('technology_building') }}
                        </p>
                    @endif
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 form-group">
                    {!! Form::label('other_option', trans('quickadmin.residential-complex.fields.other-option').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        <button type="button" class="btn btn-primary btn-xs" id="selectbtn-other_option">
                            {{ trans('quickadmin.qa_select_all') }}
                        </button>
                        <button type="button" class="btn btn-primary btn-xs" id="deselectbtn-other_option">
                            {{ trans('quickadmin.qa_deselect_all') }}
                        </button>
                    @endcan
                    @can('residential_complex_create')
                        {!! Form::select('other_option[]', $other_options, old('other_option') ? old('other_option') : $residential_complex->other_option->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', 'id' => 'selectall-other_option' ]) !!}
                    @else
                        {!! Form::select('other_option[]', $other_options, old('other_option') ? old('other_option') : $residential_complex->other_option->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', "disabled", 'id' => 'selectall-other_option' ]) !!}
                        @foreach($residential_complex->other_option->pluck('id')->toArray() as $other_option)
                            {!! Form::hidden('other_option[]', $other_option) !!}
                        @endforeach
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('other_option'))
                        <p class="help-block">
                            {{ $errors->first('other_option') }}
                        </p>
                    @endif
                </div>
            </div>

            <div class="row">
                <div class="col-xs-12 col-lg-6 form-group">
                    {!! Form::label('preview', trans('quickadmin.residential-complex.fields.preview'), ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('preview', old('preview'), ['class' => 'form-control', 'placeholder' => '', ]) !!}
                    @else
                        {!! Form::text('preview', old('preview'), ['class' => 'form-control', 'placeholder' => '', "readonly"]) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('preview'))
                        <p class="help-block">
                            {{ $errors->first('preview') }}
                        </p>
                    @endif
                </div>

                <div class="col-xs-12 col-lg-6 form-group">
                    {!! Form::label('preview_color_picker', trans('quickadmin.residential-complex.fields.preview-color-picker'), ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        <input type="color" id="head" name="preview_color_picker" class="form-control" value="{{$residential_complex->preview_color_picker}}">
                    @else
                        <input type="color" id="head" name="preview_color_picker" class="form-control" value="{{$residential_complex->preview_color_picker}}" readonly="readonly">
                    @endcan

                    <p class="help-block"></p>
                    @if($errors->has('preview_color_picker'))
                        <p class="help-block">
                            {{ $errors->first('preview_color_picker') }}
                        </p>
                    @endif
                </div>
            </div>

            <div class="row">
                <div class="col-xs-12 col-lg-6 form-group">
                    {!! Form::label('plajka', trans('quickadmin.promotion.fields.plajka').'*', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('plajka', old('plajka'), ['class' => 'form-control', 'placeholder' => '', ]) !!}
                    @else
                        {!! Form::text('plajka', old('plajka'), ['class' => 'form-control', 'placeholder' => '', "readonly"]) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('plajka'))
                        <p class="help-block">
                            {{ $errors->first('plajka') }}
                        </p>
                    @endif
                </div>

                <div class="col-xs-12 col-lg-6 form-group">
                    {!! Form::label('color_picker', trans('quickadmin.promotion.fields.color-picker').'*', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        <input type="color" id="head" name="color_picker" class="form-control" value="{{$residential_complex->color_picker}}">
                    @else
                        <input type="color" id="head" name="color_picker" class="form-control" value="{{$residential_complex->color_picker}}" readonly="readonly">
                    @endcan

                    <p class="help-block"></p>
                    @if($errors->has('color_picker'))
                        <p class="help-block">
                            {{ $errors->first('color_picker') }}
                        </p>
                    @endif
                </div>
            </div>

            <div class="row">
                <div class="col-xs-12 form-group">
                    <label for='photo' class="btn btn-info btn-info-rc btn-lg">
                        @lang('quickadmin.residential-complex.fields.photo')
                        <span class="glyphicon glyphicon-arrow-up"></span>
                    </label>
                    @can('residential_complex_create')
                        {!! Form::file('photo[]', [
                            'multiple',
                            'class' => 'form-control file-upload hidden',
                            'id' => 'photo',
                            'data-url' => route('admin.media.upload'),
                            'data-bucket' => 'photo',
                            'data-filekey' => 'photo',
                            ]) !!}
                    @else
                        {!! Form::file('photo[]', [
                        'multiple',
                        'class' => 'form-control file-upload hidden',
                        'data-url' => route('admin.media.upload'),
                        'data-bucket' => 'photo',
                        'data-filekey' => 'photo',
                        "disabled" => "disabled"
                        ]) !!}
                    @endcan
                    <div class="checkbox">
                        <label class="control-label">
                            @can('residential_complex_create')
                                {!! Form::hidden('use_cropper', 1) !!}
                                {!! Form::checkbox('use_cropper', 1, old('use_cropper', true), [
                                'id' => 'use_cropper'
                                ])
                                 !!} @lang('quickadmin.residential-complex.fields.use_cropper')
                            @else
                                {!! Form::hidden('use_cropper', 1)!!}
                                {!! Form::checkbox('use_cropper', 1, old('use_cropper', true), [
                                "disabled",
                                'id' => 'use_cropper'
                                ]) !!} @lang('quickadmin.residential-complex.fields.use_cropper')
                            @endcan
                        </label>
                    </div>
                    <p class="help-block"></p>
                    <div class="preview"></div>
                    <div class="photo-block">
                        <div class="progress-bar form-group">&nbsp;</div>
                        <div class="files-list">
                            @foreach($residential_complex->getMedia('photo') as $media)
                                <p class="form-group">

                                    <a href="{{ asset($media->getUrl()) }}" target="_blank">{{ $media->file_name }}
                                        ({{ $media->size }} bytes)</a>

                                    @can('residential_complex_create')
                                        <a href="#" class="btn btn-xs btn-danger remove-file">Видалити</a>
                                    @endcan
                                    <input type="hidden" name="photo_id[]" value="{{ $media->id }}">
                                </p>
                            @endforeach
                        </div>
                    </div>
                    @if($errors->has('photo'))
                        <p class="help-block">
                            {{ $errors->first('photo') }}
                        </p>
                    @endif
                </div>
            </div>

            <div class="row">
                <div class="col-xs-12 form-group">
                    <label for='landscape_photo' class="btn btn-info btn-info-rc btn-lg">
                        @lang('quickadmin.residential-complex.fields.landscape-photo')
                        <span class="glyphicon glyphicon-arrow-up"></span>
                    </label>

                    @can('residential_complex_create')
                        {!! Form::file('landscape_photo[]', [
                            'multiple',
                            'class' => 'form-control file-upload-landscape hidden',
                            'id' => 'landscape_photo',
                            'data-url' => route('admin.media.upload'),
                            'data-bucket' => 'landscape_photo',
                            'data-filekey' => 'landscape_photo',
                            ]) !!}
                    @else
                        {!! Form::file('landscape_photo[]', [
                        'multiple',
                        'id' => 'landscape_photo',
                        'class' => 'form-control file-upload hidden',
                        'data-url' => route('admin.media.upload'),
                        'data-bucket' => 'landscape_photo',
                        'data-filekey' => 'landscape_photo',
                        "disabled" => "disabled"
                        ]) !!}
                    @endcan

                    <p class="help-block"></p>
                    <div class="photo-block">
                        <div class="progress-bar form-group">&nbsp;</div>
                        <div class="files-list">
                            @foreach($residential_complex->getMedia('landscape_photo') as $media)
                                <p class="form-group">
                                    <a href="{{ asset($media->getUrl()) }}" target="_blank">{{ $media->name }}
                                        ({{ $media->size }} bytes)</a>
                                    <a href="#" class="btn btn-xs btn-danger remove-file">Видалити</a>
                                    <input type="hidden" name="landscape_photo_id[]" value="{{ $media->id }}">
                                </p>
                            @endforeach
                        </div>
                    </div>
                    @if($errors->has('landscape_photo'))
                        <p class="help-block">
                            {{ $errors->first('landscape_photo') }}
                        </p>
                    @endif
                </div>
            </div>

            <div class="row">
                <div class="col-xs-12 form-group">
                    {!! Form::label('icon', trans('quickadmin.residential-complex.fields.icon').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {{--<button type="button" class="btn btn-primary btn-xs" id="selectbtn-icon">--}}
                        {{--{{ trans('quickadmin.qa_select_all') }}--}}
                        {{--</button>--}}
                        <button type="button" class="btn btn-primary btn-xs" id="deselectbtn-icon">
                            {{ trans('quickadmin.qa_deselect_all') }}
                        </button>
                    @endcan
                    @can('residential_complex_create')
                        {!! Form::select('icon[]', $icons, old('icon') ? old('icon') : $residential_complex->icon->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', 'id' => 'selectall-icon' ]) !!}
                    @else
                        {!! Form::select('icon[]', $icons, old('icon') ? old('icon') : $residential_complex->icon->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', "disabled", 'id' => 'selectall-icon' ]) !!}
                        @foreach($residential_complex->icon->pluck('id')->toArray() as $icon)
                            {!! Form::hidden('icon[]', $icon) !!}
                        @endforeach
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('icon'))
                        <p class="help-block">
                            {{ $errors->first('icon') }}
                        </p>
                    @endif
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 form-group">
                    {!! Form::label('recomended_residental_complex_id', trans('quickadmin.residential-complex.fields.recomended-residental-complex-id').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        <button type="button" class="btn btn-primary btn-xs"
                                id="selectbtn-recomended_residental_complex_id">
                            {{ trans('quickadmin.qa_select_all') }}
                        </button>
                        <button type="button" class="btn btn-primary btn-xs"
                                id="deselectbtn-recomended_residental_complex_id">
                            {{ trans('quickadmin.qa_deselect_all') }}
                        </button>
                    @endcan
                    @can('residential_complex_create')
                        {!! Form::select('recomended_residental_complex_id[]', $recomended_residental_complex_ids, old('recomended_residental_complex_id') ? old('recomended_residental_complex_id') : $residential_complex->recomended_residental_complex_id->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', 'id' => 'selectall-recomended_residental_complex_id' ]) !!}
                    @else
                        {!! Form::select('recomended_residental_complex_id[]', $recomended_residental_complex_ids, old('recomended_residental_complex_id') ? old('recomended_residental_complex_id') : $residential_complex->recomended_residental_complex_id->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', "disabled", 'id' => 'selectall-recomended_residental_complex_id' ]) !!}
                        @foreach($residential_complex->recomended_residental_complex_id->pluck('id')->toArray() as $recomended_residental_complex_id)
                            {!! Form::hidden('recomended_residental_complex_id[]', $recomended_residental_complex_id) !!}
                        @endforeach
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('recomended_residental_complex_id'))
                        <p class="help-block">
                            {{ $errors->first('recomended_residental_complex_id') }}
                        </p>
                    @endif
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12 form-group">
                    {!! Form::label('bank', trans('quickadmin.residential-complex.fields.bank').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        <button type="button" class="btn btn-primary btn-xs" id="selectbtn-bank">
                            {{ trans('quickadmin.qa_select_all') }}
                        </button>
                        <button type="button" class="btn btn-primary btn-xs" id="deselectbtn-bank">
                            {{ trans('quickadmin.qa_deselect_all') }}
                        </button>
                    @endcan
                    @can('residential_complex_create')
                        {!! Form::select('bank[]', $banks, old('bank') ? old('bank') : $residential_complex->bank->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', 'id' => 'selectall-bank' ]) !!}
                    @else
                        {!! Form::select('bank[]', $banks, old('bank') ? old('bank') : $residential_complex->bank->pluck('id')->toArray(), ['class' => 'form-control select2', 'multiple' => 'multiple', 'id' => 'selectall-bank', "disabled" ]) !!}
                        @foreach($residential_complex->recomended_residental_complex_id->pluck('id')->toArray() as $recomended_residental_complex_id)
                            {!! Form::hidden('recomended_residental_complex_id[]', $recomended_residental_complex_id) !!}
                        @endforeach
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('bank'))
                        <p class="help-block">
                            {{ $errors->first('bank') }}
                        </p>
                    @endif
                </div>
            </div>

            <div class="row">
                <div class="col-xs-12 form-group">
                    {!! Form::label('location_address', trans('quickadmin.residential-complex.fields.location').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('location_address', old('location_address'), ['class' => 'form-control map-input', 'id' => 'location-input']) !!}
                    @else
                        {!! Form::text('location_address', old('location_address'), ['class' => 'form-control map-input', 'id' => 'location-input', "readonly"]) !!}
                    @endcan

                    <p class="help-block"></p>
                    @if($errors->has('location'))
                        <p class="help-block">
                            {{ $errors->first('location') }}
                        </p>
                    @endif
                </div>
            </div>

            <div class="row">
                <div class="col-xs-12 col-xs-6 form-group">
                    {!! Form::label('location_latitude', trans('quickadmin.residential-complex.fields.location_latitude').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('location_latitude', old('location_latitude'), ['class' => 'form-control', 'id' => 'location-latitude']) !!}
                    @else
                        {!! Form::text('location_latitude', old('location_latitude'), ['class' => 'form-control', 'id' => 'location-latitude', "readonly"]) !!}
                    @endcan
                    <p class="help-block"></p>
                    @if($errors->has('location_latitude'))
                        <p class="help-block">
                            {{ $errors->first('location_latitude') }}
                        </p>
                    @endif
                </div>

                <div class="col-xs-12 col-xs-6  form-group">
                    {!! Form::label('location_longitude', trans('quickadmin.residential-complex.fields.location_longitude').'', ['class' => 'control-label']) !!}
                    @can('residential_complex_create')
                        {!! Form::text('location_longitude', old('location_longitude'), ['class' => 'form-control', 'id' => 'location-longitude']) !!}
                    @else
                        {!! Form::text('location_longitude', old('location_longitude'), ['class' => 'form-control', 'id' => 'location-longitude', "readonly"]) !!}
                    @endcan

                    <p class="help-block"></p>
                    @if($errors->has('location_longitude'))
                        <p class="help-block">
                            {{ $errors->first('location_longitude') }}
                        </p>
                    @endif
                </div>
            </div>

            <div id="location-map-container" style="width:100%;height:200px; ">
                <div style="width: 100%; height: 100%" id="location-map"></div>
            </div>

        </div>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading">
            Характеристики
        </div>
        <div class="panel-body">
            <table class="table table-bordered table-striped">
                <thead>
                <tr>
                    <th>@lang('quickadmin.residential-complex-character.fields.type')</th>
                    <th>@lang('quickadmin.residential-complex-character.fields.value')</th>

                    <th>@lang('quickadmin.qa_actions')</th>
                </tr>
                </thead>
                <tbody id="kharakteristiki">
                @forelse(old('residential_complex_characters', []) as $index => $data)
                    @include('admin.residential_complexes.residential_complex_characters_row', [
                        'index' => $index
                    ])
                @empty
                    @foreach($residential_complex->residential_complex_characters as $item)
                        @include('admin.residential_complexes.residential_complex_characters_row', [
                            'index' => 'id-' . $item->id,
                            'field' => $item
                        ])
                    @endforeach
                @endforelse
                </tbody>
            </table>
            @can('residential_complex_create')
                <a href="#" class="btn btn-success pull-right add-new">@lang('quickadmin.qa_add_new')</a>
            @endcan
        </div>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading">
            <div class="row flex-align-center">
                <div class="col-lg-8">Ціноутворення ЖК</div>

                <div class="col-lg-3 pull-right">
                    <div class="form-group" style="text-align: end; margin-right: 20px;">
                        <div class="checkbox">
                            <label class="control-label">

                                @can('residential_complex_create')
                                    <input type="hidden" name="is_show_price" value="0">
                                    {!! Form::checkbox('is_show_price', 1, old('is_show_price'), []) !!} @lang('quickadmin.residential-complex.fields.is_show_price')
                                @else
                                    {{--{!! Form::checkbox('is_show_planning', 1, old('is_show_planning'), ["disabled"]) !!} @lang('quickadmin.residential-complex.fields.is_show_planning')--}}
                                    <input type="hidden" name="is_show_price" value="@if(old('is_show_price')){{old('is_show_price')}}@else{{ $residential_complex->is_show_price }} @endif">
                                @endcan
                            </label>
                        </div>

                        <p class="help-block"></p>
                        @if($errors->has('is_show_price'))
                            <p class="help-block">
                                {{ $errors->first('is_show_price') }}
                            </p>
                        @endif
                    </div>
                </div>
                <div class="col-lg-1 pull-right">
                    {{--<a href="#" class="btn btn-success pull-right add-new">Згенерувати</a>--}}
                    @can('residential_complex_create')
                    <a href="{{ route('admin.residential_complexes.price',[$residential_complex->id]) }}"
                       class="btn btn-primary pull-right add-new">Згенерувати</a>
                        @endcan
                </div>
            </div>
        </div>

        <div class="panel-body">
            <table class="table table-bordered table-striped">
                <thead>
                <tr>
                    <th>@lang('quickadmin.price.fields.section')</th>
                    <th>@lang('quickadmin.price.fields.room-count')</th>
                    <th>@lang('quickadmin.price.fields.room-type')</th>
                    <th>@lang('quickadmin.price.fields.min-space')</th>
                    <th>@lang('quickadmin.price.fields.max-space')</th>
                    <th>@lang('quickadmin.price.fields.price-per-squera-meter')</th>
                    <th>@lang('quickadmin.price.fields.price-per-squera-meter_max')</th>
                    <th>@lang('quickadmin.price.fields.min-price')</th>
                    <th>@lang('quickadmin.price.fields.max-price')</th>
                    {{--<th>@lang('quickadmin.price.fields.number_of_apartments')</th>--}}

                    <th>Дія</th>
                </tr>
                </thead>
                <tbody id="tsinoutvorennya-zhk">

                @forelse(old('prices', []) as $index => $data)
                    @include('admin.residential_complexes.prices_row', [
                        'index' => $index,

                    ])
                @empty
                    @foreach($residential_complex->prices as $item)
                        @include('admin.residential_complexes.prices_row', [
                            'index' => 'id-' . $item->id,
                            'field' => $item,

                        ])
                    @endforeach
                @endforelse
                </tbody>
            </table>
            @can('residential_complex_create')
                <a href="#" class="btn btn-success pull-right add-new">@lang('quickadmin.qa_add_new')</a>
            @endcan
        </div>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading">
            <div class="row flex-align-center">
                <div class="col-lg-9">Планування ЖК</div>

                <div class="col-lg-2 pull-right">
                    <div class="form-group">
                        <div class="checkbox">
                            <label class="control-label">

                                @can('residential_complex_create')
                                    <input type="hidden" name="is_show_planning" value="0">
                                    {!! Form::checkbox('is_show_planning', 1, old('is_show_planning'), []) !!} @lang('quickadmin.residential-complex.fields.is_show_planning')
                                @else
                                    {{--{!! Form::checkbox('is_show_planning', 1, old('is_show_planning'), ["disabled"]) !!} @lang('quickadmin.residential-complex.fields.is_show_planning')--}}
                                    <input type="hidden" name="is_show_planning" value="@if(old('is_show_planning')){{old('is_show_planning')}}@else{{ $residential_complex->is_show_planning }} @endif">
                                @endcan
                            </label>
                        </div>

                        <p class="help-block"></p>
                        @if($errors->has('is_show_planning'))
                            <p class="help-block">
                                {{ $errors->first('is_show_planning') }}
                            </p>
                        @endif
                    </div>
                </div>
                <div class="col-lg-1 pull-right">
                    {{--<a href="#" class="btn btn-success pull-right add-new">Згенерувати</a>--}}
                    @can('residential_complex_create')
                        <a href="{{ route('admin.residential_complexes.planning-price',[$residential_complex->id]) }}"
                           class="btn btn-primary pull-right add-new">Згенерувати</a>
                    @endcan
                </div>
            </div>
        </div>

        <div class="panel-body">
            <table class="table table-bordered table-striped">
                <thead>
                <tr>
                    <th>@lang('quickadmin.price.fields.section')</th>
                    <th>@lang('quickadmin.price.fields.room-count')</th>
                    <th>@lang('quickadmin.price.fields.room-type')</th>
                    <th>@lang('quickadmin.price.fields.min-space')</th>
                    <th>@lang('quickadmin.price.fields.max-space')</th>
                    <th>@lang('quickadmin.price.fields.price-per-squera-meter')</th>
                    <th>@lang('quickadmin.price.fields.price-per-squera-meter_max')</th>
                    <th>@lang('quickadmin.price.fields.min-price')</th>
                    <th>@lang('quickadmin.price.fields.max-price')</th>
                    {{--<th>@lang('quickadmin.price.fields.number_of_apartments')</th>--}}

                    <th>Дія</th>
                </tr>
                </thead>
                <tbody id="planning-prices-zhk">

                @forelse(old('planning_prices', []) as $index => $data)
                    @include('admin.residential_complexes.planning_prices_row', [
                        'index' => $index,

                    ])
                @empty
                    @foreach($residential_complex->planning_prices as $item)
                        @include('admin.residential_complexes.planning_prices_row', [
                            'index' => 'id-' . $item->id,
                            'field' => $item,

                        ])
                    @endforeach
                @endforelse
                </tbody>
            </table>
            @can('residential_complex_create')
                <a href="#" class="btn btn-success pull-right add-new">@lang('quickadmin.qa_add_new')</a>
            @endcan
        </div>
    </div>

    <div class="panel panel-default">
        <div class="panel-heading">
            <div class="row flex-align-center">
                <div class="col-lg-8">Умови купівлі</div>

                <div class="col-lg-4 pull-right">
                    <div class="form-group" style="text-align: end; margin-right: 20px;">
                        <div class="checkbox">
                            <label class="control-label">

                                @can('residential_complex_create')
                                    <input type="hidden" name="is_show_terms_of_payments" value="0">
                                    {!! Form::checkbox('is_show_terms_of_payments', 1, old('is_show_terms_of_payments'), []) !!} @lang('quickadmin.residential-complex.fields.is_show_terms_of_payments')
                                @else
                                    {{--{!! Form::checkbox('is_show_planning', 1, old('is_show_planning'), ["disabled"]) !!} @lang('quickadmin.residential-complex.fields.is_show_planning')--}}
                                    <input type="hidden" name="is_show_terms_of_payments"
                                           value="@if(old('is_show_terms_of_payments')){{old('is_show_terms_of_payments')}}@else{{ $residential_complex->is_show_terms_of_payments }} @endif">
                                @endcan
                            </label>
                        </div>

                        <p class="help-block"></p>
                        @if($errors->has('is_show_terms_of_payments'))
                            <p class="help-block">
                                {{ $errors->first('is_show_terms_of_payments') }}
                            </p>
                        @endif
                    </div>
                </div>
            </div>
        </div>

        <div class="panel-body">
{{--            <table class="table table-responsive table-bordered table-striped">--}}
            <table class="table table-responsive table-bordered table-striped term-of-payment">
                <thead>
                <tr>
                    <th>@lang('quickadmin.terms_of_payment.fields.header')</th>
                    <th>@lang('quickadmin.terms_of_payment.fields.content_option_one')</th>
                    <th>@lang('quickadmin.terms_of_payment.fields.content_option_two')</th>
                    <th>@lang('quickadmin.terms_of_payment.fields.content_option_three')</th>
                    <th class="action">@lang('quickadmin.terms_of_payment.fields.color_of_elements')</th>
                    <th class="action">@lang('quickadmin.terms_of_payment.fields.appeal')</th>
                    <th class="action">Дія</th>
                </tr>
                </thead>
                <tbody id="terms_of_payment-zhk">

                @forelse(old('terms_of_payments', []) as $index => $data)
                    @include('admin.residential_complexes.terms_of_payment_row', [
                        'index' => $index,

                    ])
                @empty
                    @foreach($residential_complex->term_of_paymentes as $item)
                        @include('admin.residential_complexes.terms_of_payment_row', [
                            'index' => 'id-' . $item->id,
                            'field' => $item,

                        ])
                    @endforeach
                @endforelse
                </tbody>
            </table>
            @can('residential_complex_create')
                <a href="#" class="btn btn-success pull-right add-new">@lang('quickadmin.qa_add_new')</a>
            @endcan
        </div>
    </div>


    {!! Form::submit(trans('quickadmin.qa_update'), ['class' => 'btn btn-danger']) !!}
    {!! Form::close() !!}

    @include('partials.cropper.cropper-collection', [
                        'aspectRatio' => '16 / 9',
         ])
@stop

@section('javascript')
    @parent
    {{--<script src="{{ url('js/tinymce/jquery.tinymce.min.js') }}"></script>--}}
    <script src="{{ url('js/tinymce/tinymce.min.js') }}"></script>
    <script>
        tinymce.init({
            selector: '#seo_text',
            // plugins: 'print preview paste importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern noneditable help charmap quickbars emoticons',
            plugins: 'lists',
            imagetools_cors_hosts: ['picsum.photos'],
            menubar: 'file edit view insert format tools table help',
            toolbar: 'undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent |  numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen  preview save print | insertfile image media template link anchor codesample | ltr rtl',
            toolbar_sticky: true,
        });
    </script>

    <script src="{{ url('adminlte/js/mapInput.js') }}"></script>
    <script src="https://maps.googleapis.com/maps/api/js?key={{ env('GOOGLE_MAPS_API_KEY') }}&libraries=places&callback=initialize"
            async defer></script>


    <script type="text/html" id="kharakteristiki-template">
        @include('admin.residential_complexes.residential_complex_characters_row',
                [
                    'index' => '_INDEX_',
                ])
    </script>

    <script type="text/html" id="tsinoutvorennya-zhk-template">
        @include('admin.residential_complexes.prices_row',
                [
                    'index' => '_INDEX_',
                ])
    </script>

    <script type="text/html" id="planning-prices-zhk-template">
        @include('admin.residential_complexes.planning_prices_row',
                [
                    'index' => '_INDEX_',
                ])
    </script>

    <script type="text/html" id="terms_of_payment-zhk-template">
        @include('admin.residential_complexes.terms_of_payment_row',
                [
                    'index' => '_INDEX_',
                ])
    </script>

    <script src="{{ url('adminlte/plugins/datetimepicker/moment-with-locales.min.js') }}"></script>
    <script src="{{ url('adminlte/plugins/datetimepicker/bootstrap-datetimepicker.min.js') }}"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.css"
          rel="stylesheet"/>
    <script>
        $(function () {
            moment.updateLocale('{{ App::getLocale() }}', {
                week: {dow: 1} // Monday is the first day of the week
            });

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

            $(".date").datepicker({
                format: "yyyy",
                viewMode: "years",
                minViewMode: "years"
            });
        });
    </script>

    <script>
        $('.add-new').click(function () {
            var tableBody = $(this).parent().find('tbody');
            var template = $('#' + tableBody.attr('id') + '-template').html();
            var lastIndex = parseInt(tableBody.find('tr').last().data('index'));
            if (isNaN(lastIndex)) {
                lastIndex = 0;
            }
            tableBody.append(template.replace(/_INDEX_/g, lastIndex + 1));
            return false;
        });

        $(document).on('click', '.remove', function () {
            var row = $(this).parentsUntil('tr').parent();
            row.remove();
            return false;
        });

        $(function () {
            $("#selectall-icon").select2({
                maximumSelectionLength: 5,
            });
        });
    </script>
    <script src="{{ asset('quickadmin/plugins/fileUpload/js/jquery.iframe-transport.js') }}"></script>
    <script src="{{ asset('quickadmin/plugins/fileUpload/js/jquery.fileupload.js') }}"></script>

    <script>
        $(function () {
            $('.file-upload-landscape').each(function () {
                var $this = $(this);
                var $parent = $(this).parent();

                $(this).fileupload({
                    dataType: 'json',
                    formData: {
                        model_name: 'ResidentialComplex',
                        bucket: $this.data('bucket'),
                        file_key: $this.data('filekey'),
                        _token: '{{ csrf_token() }}'
                    },
                    add: function (e, data) {
                        data.submit();
                    },
                    done: function (e, data) {
                        $.each(data.result.files, function (index, file) {
                            var $line = $($('<p/>', {class: "form-group"}).html(file.name + ' (' + file.size + ' bytes)').appendTo($parent.find('.files-list')));
                            $line.append('<a href="#" class="btn btn-xs btn-danger remove-file">Видалити</a>');
                            $line.append('<input type="hidden" name="' + $this.data('bucket') + '_id[]" value="' + file.id + '"/>');
                            if ($parent.find('.' + $this.data('bucket') + '-ids').val() != '') {
                                $parent.find('.' + $this.data('bucket') + '-ids').val($parent.find('.' + $this.data('bucket') + '-ids').val() + ',');
                            }
                            $parent.find('.' + $this.data('bucket') + '-ids').val($parent.find('.' + $this.data('bucket') + '-ids').val() + file.id);
                        });
                        $parent.find('.progress-bar').hide().css(
                            'width',
                            '0%'
                        );
                    }
                }).on('fileuploadprogressall', function (e, data) {
                    // var progress = parseInt(data.loaded / data.total * 100, 10);
                    // $parent.find('.progress-bar').show().css(
                    //     'width',
                    //     progress + '%'
                    // );
                });
            });
            $(document).on('click', '.remove-file', function () {
                var $parent = $(this).parent();
                $parent.remove();
                return false;
            });
        });
    </script>

    <script>
        $("#selectbtn-count_of_room_per_flat").click(function () {
            $("#selectall-count_of_room_per_flat > option").prop("selected", "selected");
            $("#selectall-count_of_room_per_flat").trigger("change");
        });
        $("#deselectbtn-count_of_room_per_flat").click(function () {
            $("#selectall-count_of_room_per_flat > option").prop("selected", "");
            $("#selectall-count_of_room_per_flat").trigger("change");
        });
    </script>

    <script>
        $("#selectbtn-room_type").click(function () {
            $("#selectall-room_type > option").prop("selected", "selected");
            $("#selectall-room_type").trigger("change");
        });
        $("#deselectbtn-room_type").click(function () {
            $("#selectall-room_type > option").prop("selected", "");
            $("#selectall-room_type").trigger("change");
        });
    </script>

    <script>
        $("#selectbtn-class").click(function () {
            $("#selectall-class > option").prop("selected", "selected");
            $("#selectall-class").trigger("change");
        });
        $("#deselectbtn-class").click(function () {
            $("#selectall-class > option").prop("selected", "");
            $("#selectall-class").trigger("change");
        });
    </script>

    <script>
        $("#selectbtn-stage_of_construction").click(function () {
            $("#selectall-stage_of_construction > option").prop("selected", "selected");
            $("#selectall-stage_of_construction").trigger("change");
        });
        $("#deselectbtn-stage_of_construction").click(function () {
            $("#selectall-stage_of_construction > option").prop("selected", "");
            $("#selectall-stage_of_construction").trigger("change");
        });
    </script>

    <script>
        $("#selectbtn-heating").click(function () {
            $("#selectall-heating > option").prop("selected", "selected");
            $("#selectall-heating").trigger("change");
        });
        $("#deselectbtn-heating").click(function () {
            $("#selectall-heating > option").prop("selected", "");
            $("#selectall-heating").trigger("change");
        });
    </script>

    <script>
        $("#selectbtn-technology_building").click(function () {
            $("#selectall-technology_building > option").prop("selected", "selected");
            $("#selectall-technology_building").trigger("change");
        });
        $("#deselectbtn-technology_building").click(function () {
            $("#selectall-technology_building > option").prop("selected", "");
            $("#selectall-technology_building").trigger("change");
        });
    </script>

    <script>
        $("#selectbtn-other_option").click(function () {
            $("#selectall-other_option > option").prop("selected", "selected");
            $("#selectall-other_option").trigger("change");
        });
        $("#deselectbtn-other_option").click(function () {
            $("#selectall-other_option > option").prop("selected", "");
            $("#selectall-other_option").trigger("change");
        });
    </script>

    <script>
        // $("#selectbtn-icon").click(function () {
        //     $("#selectall-icon > option").prop("selected", "selected");
        //     $("#selectall-icon").trigger("change");
        // });
        $("#deselectbtn-icon").click(function () {
            $("#selectall-icon > option").prop("selected", "");
            $("#selectall-icon").trigger("change");
        });

    </script>

    <script>
        $("#selectbtn-recomended_residental_complex_id").click(function () {
            $("#selectall-recomended_residental_complex_id > option").prop("selected", "selected");
            $("#selectall-recomended_residental_complex_id").trigger("change");
        });
        $("#deselectbtn-recomended_residental_complex_id").click(function () {
            $("#selectall-recomended_residental_complex_id > option").prop("selected", "");
            $("#selectall-recomended_residental_complex_id").trigger("change");
        });
    </script>

    <script>
        $("#selectbtn-bank").click(function () {
            $("#selectall-bank > option").prop("selected", "selected");
            $("#selectall-bank").trigger("change");
        });
        $("#deselectbtn-bank").click(function () {
            $("#selectall-bank > option").prop("selected", "");
            $("#selectall-bank").trigger("change");
        });
    </script>
    <script>
        $('#city_id').on('change', function() {
            let cityId = $('#city_id').val();

            if (cityId) {
                $.ajax({
                    'type': 'get',
                    'url': '{{route('api.crud.districts.city')}}',
                    'data': {
                        'city_id': cityId
                    },
                    'success': function (data) {
                        let districtOptions = `<option value selected>Будь ласка, виберіть</option>`;

                        data.forEach(item => {
                            districtOptions += `<option value = ${item.id}>${item.name}</option>`;
                        });

                        $('#district_id').find('option').remove().end();
                        $('#district_id').append(districtOptions);
                    }
                });
            } else {
                let districtOptions = `<option value selected>Будь ласка, виберіть</option>`;
                $('#district_id').find('option').remove().end();
                $('#district_id').append(districtOptions);
            }

        });
    </script>
    <script src="{{ asset('adminlte/js/image/validation/image-validate.js') }}"></script>
    @include('partials.cropper.cropper-collection-js', [
        'aspectRatio' => '16 / 9',
        'model' => 'ResidentialComplex'
     ])

    <script src="{{ asset('adminlte/js/image/upload-presentation.js') }}"></script>
@stop
