@extends('business.layouts.base')

{{-- header --}}
@section('contents-header')
@include('business.objects.projects.detail-header', ['number' => '1', 'totalCount' => '10', 'isForSale' => true])
@endsection

@php
// tab
$tabs = [];
$disp_flag = isset($_GET['open']) ? (int)$_GET['open'] : 0;

$tab = new stdClass();
$tab->title = '自社物件シート';
$tab->id = 'nav-property-tab';
$tab->href = 'nav-property';
$tab->active = (!isset($showNavSheetTab) && $disp_flag != 1) ? 'active' : '';
array_push($tabs, $tab);

$tab = new stdClass();
$tab->title = '写真';
$tab->id = 'nav-photo-tab';
$tab->href = 'nav-photo';
$tab->active = '';
array_push($tabs, $tab);

$tab = new stdClass();
$tab->title = '周辺施設';
$tab->id = 'nav-map-tab';
$tab->href = 'nav-map';
$tab->active = '';
array_push($tabs, $tab);

$tab = new stdClass();
$tab->title = '業者物件シート';
$tab->id = 'nav-sheet-tab';
$tab->href = 'nav-sheet';
$tab->active = ($disp_flag == 1 || isset($showNavSheetTab)) ? 'active' : '';
// $tab->display = $disp_flag == 1;
array_push($tabs, $tab);

$tab = new stdClass();
$tab->title = '物件概要';
$tab->id = 'nav-summary-tab';
$tab->href = 'nav-summary';
$tab->active = '';
array_push($tabs, $tab);
@endphp

@section('contents')
<div class="mt-4">
    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-detail', ['id' => '']),
    'id' => 'link_detail', 'params' => $params])
    @include('business.objects.projects.results-noimage', [
        'data' => [$item],
        'disp_flag' => $disp_flag,
        'attr' => 'data-next-btn=' . $item->building_id,
        'showFormCheck' => $showFormCheck ?? '',
        'isForSale' => true,
        'isShowOwnCompany' => true,
    ])

    {{-- tab contents --}}
    @include('business.objects.projects.detail-tab', ['tabs' => $tabs])
    <div class="tab-content">
        <div class="tab-pane bg-white {{  (!isset($showNavSheetTab) && $disp_flag != 1) ? 'active' : ''}}"
            id="nav-property" role="tabpanel" aria-labelledby="nav-property-tab">
            @include('business.objects.projects.detail-main-sheet', ['data' => $article_list,'pref' => $pref, 'city'
            =>$city,'town'=>$town])
        </div>
        <div class="tab-pane bg-white" id="nav-photo" role="tabpanel" aria-labelledby="nav-photo-tab">
            @include('business.objects.projects.detail-photo', ['data' => $article_list])
        </div>
        <div class="tab-pane bg-white" id="nav-map" role="tabpanel" aria-labelledby="nav-map-tab">
            @include('business.objects.projects.detail-map-around', ['data' => $article_list,
            'tmp_facilities'=>$tmp_facilities,'facility'=>$facility])
        </div>
        <div class="tab-pane bg-white {{ ($disp_flag == 1 || isset($showNavSheetTab)) ? 'active' : ''}}" id="nav-sheet"
            role="tabpanel" aria-labelledby="nav-sheet-tab"
            {{--                 @if($disp_flag != 1) style="display: none" @endif--}}>
            @include('business.objects.projects.detail-vendor-sheet', ['data' => $article_list])
        </div>
        <div class="tab-pane bg-white" id="nav-summary" role="tabpanel" aria-labelledby="nav-summary-tab">
            @include('business.objects.projects.detail-summary', ['data' => $article_list])
        </div>
    </div>
    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-setprint'), 'id' =>
    'multiPrintForm', 'params' => $params])
    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-print'), 'id' =>
    'singlePrintForm', 'params' => $params])

    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-setprint-vendor'), 'id' =>
    'multiPrintFormVendor', 'params' => $params])
    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-print-vendor'), 'id' =>
    'singlePrintFormVendor', 'params' => $params_single])

    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-setprint-set1'), 'id' =>
    'multiPrintFormSet1', 'params' => $params])
    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-print-set1'), 'id' =>
    'singlePrintFormSet1', 'params' => $params_single])

    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-setprint-set2'), 'id' =>
    'multiPrintFormSet2', 'params' => $params])
    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-print-set2'), 'id' =>
    'singlePrintFormSet2', 'params' => $params_single])

    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-setprint-set3'), 'id' =>
    'multiPrintFormSet3', 'params' => $params])
    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-print-set3'), 'id' =>
    'singlePrintFormSet3', 'params' => $params_single])

    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-setpdf'), 'id' =>
    'multiPdfForm', 'params' => $params])
    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-pdf'), 'id' =>
    'singlePdfForm', 'params' => $params_single])

    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-setpdf-vendor'), 'id' =>
    'multiPdfFormVendor', 'params' => $params])
    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-pdf-vendor'), 'id' =>
    'singlePdfFormVendor', 'params' => $params_single])

    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-setpdf-set1'), 'id' =>
    'multiPdfFormSet1', 'params' => $params])
    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-pdf-set1'), 'id' =>
    'singlePdfFormSet1', 'params' => $params_single])

    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-setpdf-set2'), 'id' =>
    'multiPdfFormSet2', 'params' => $params])
    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-pdf-set2'), 'id' =>
    'singlePdfFormSet2', 'params' => $params_single])

    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-setpdf-set3'), 'id' =>
    'multiPdfFormSet3', 'params' => $params])
    @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-pdf-set3'), 'id' =>
    'singlePdfFormSet3', 'params' => $params_single])
</div>


<div id="modal-content" class="modal-contents">
    <input type="hidden" value="" id="type">
    <div id="modal_open" class="p-print-modal">
        <header id="modal_header" style="text-align:right;">
            <button type="button" class="btn btn-default" data-dismiss="modal" id="modal-close"
                style="color:gray; font-weight:bold; font-size:30px; padding:0px; line-height:20px;background:none;">×</button>
        </header>
        <main id="modal_main">
            <p class="p-print-modal__title">レイアウトをお選びください。</p>
            <ul class="p-print-modal__menus d-flex">
                <li>
                    <p class="p-print-modal__menus-icon">
                        <a href="javascript:void(0);" class="btnPhotoPrint" data-n="4">
                            <span class="p-print-modal__menus-text">4枚ずつ</span>
                            <img src="/business/img/layout2x2.png" width="120">
                        </a>
                    </p>
                </li>
                <li>
                    <p class="p-print-modal__menus-icon">
                        <a href="javascript:void(0);" class="btnPhotoPrint" data-n="12">
                            <span class="p-print-modal__menus-text">12枚ずつ</span>
                            <img src="/business/img/layout3x4.png" width="120">
                        </a>
                    </p>
                </li>
                <li>
                    <p class="p-print-modal__menus-icon">
                        <a href="javascript:void(0);" class="btnPhotoPrint" data-n="24">
                            <span class="p-print-modal__menus-text">24枚ずつ</span>
                            <img src="/business/img/layout4x6.png" width="120">
                        </a>
                    </p>
                </li>
            </ul>
        </main>
        <footer id="modal_footer">
        </footer>
    </div>
</div>

@php
$url = Request::url();
$path = 'for-sale';
if(preg_match('/close/', $url) || $item->status == 4 || $item->status == 5) {
$path = 'close';
}
if(preg_match('/mansion/', $url)) {
$path = 'mansion';
}
@endphp
<form action="/business/{{$path}}" method="post" id="return_form">
    @foreach($params as $key => $value)
    @if(!is_array($value))
    <input type="hidden" name="{{$key}}" value="{{$value}}">
    @else
    @foreach($value as $v)
    <input type="hidden" name="{{$key}}[]" value="{{$v}}">
    @endforeach
    @endif
    @endforeach
    @csrf
</form>

@endsection
@push('scripts')
<script src="{{ asset('/business/js/buyer.js') }}"></script>
@endpush
