@extends('business.layouts.base')


{{-- header --}}
@section('contents-header')
    @include('business.objects.projects.search-results-header', ['title' => '成約物件', 'isForSale' => true])
@endsection

@php
$buttons = [
    //['id'=>'notHold', 'title' => '「済・保」除外', 'class' => 'notCondition'],
    //['id'=>'notClosed', 'title' => '「済」除外', 'class' => 'notCondition'],
    //['id'=>'notEtc', 'title' => '「済等」除外', 'class' => 'notCondition'],
    ['id'=>'stopSelling', 'title' => '「売りやめ」除外', 'class' => 'notCondition'],
    ['id'=>'btnAllDisp', 'title' => '全物件表示', 'class' => '']
];

// 並び替えデータ
$sorts = $sorts ?? [];
/*
$sort = new stdClass();
$sort->name = '新着順';
$sort->class = 'new';
array_push($sorts, $sort);

$sort = new stdClass();
$sort->name = '新価格';
$sort->class = 'newprice';
array_push($sorts, $sort);
*/
$sort = new stdClass();
$sort->name = '価格が安い順';
$sort->class = 'inexpensive';
array_push($sorts, $sort);

$sort = new stdClass();
$sort->name = '駅近い順';
$sort->class = 'station';
array_push($sorts, $sort);

$sort = new stdClass();
$sort->name = '築年浅い順';
$sort->class = 'age';
array_push($sorts, $sort);

$sort = new stdClass();
$sort->name = '土地面積広い順';
$sort->class = 'land';
array_push($sorts, $sort);

$sort = new stdClass();
$sort->name = '延べ床面積広い順';
$sort->class = 'floor';
array_push($sorts, $sort);
/*
$sort = new stdClass();
$sort->name = '物件種別順';
$sort->class = 'property';
array_push($sorts, $sort);

$sort = new stdClass();
$sort->name = '所在地順';
$sort->class = 'address';
array_push($sorts, $sort);

$sort = new stdClass();
$sort->name = '沿線・駅順';
$sort->class = 'line';
array_push($sorts, $sort);

$sort = new stdClass();
$sort->name = '業者順';
$sort->class = 'vendor';
array_push($sorts, $sort);
*/
@endphp


@section('contents')
{{-- 画像有/リスト切り替え、除外ボタンリスト --}}
@include('business.objects.projects.results-switching', ['buttons' => $buttons])

{{-- 現在の検索条件 --}}
@include('business.objects.projects.results-current-condition', ['title' => '成約物件'])
{{-- 並び替え --}}
@include('business.objects.projects.results-sort', ['sorts' => $sorts])

@include('business.objects.projects.form-to-other', ['action' => route('business-close-detail', ['id' => '']), 'id' => 'link_detail', 'params' => $params])

@include('business.objects.components.loading')
<div class="d-none" id="url-ajax-pagination" url="{{ route('business.ajax.close') }}"></div>

{{-- 検索結果一覧 ※tab-img-or-list.bladeと連動 --}}
<div class="tab-content mt-3">
  <div class="tab-pane u-bg-default {{ !isset($type_page) || (isset($type_page) && $type_page == 1) ? "active" : "" }}" id="nav-image" role="tabpanel" aria-labell edby="nav-image-tab">
    @include('business.objects.projects.results-image', [
        'type' => 'close',
        'flag' => 2,
        'isShowOwnCompany' => true,
    ])
  </div>
  <div class="tab-pane u-bg-default {{ (isset($type_page) && $type_page == 2) ? "active" : "" }}" id="nav-list" role="tabpanel" aria-labelledby="nav-list-tab">
    @include('business.objects.projects.results-noimage', [
        'data' => $article_list,
        'flag' => 2,
        'isShowOwnCompany' => true,
    ])
  </div>
    @if(count($article_list) > 0)
        @include('business.objects.components.btn_more')
    @endif
    <div id="all-items" items="{{ $article_list_id ?? "" }}"></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])
@include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-setprint-set1'), 'id' => 'multiPrintFormSet1', 'params' => $params])
<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">４枚ずつ</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="8">
                            <span class="p-print-modal__menus-text">８枚ずつ</span>
                            <img src="/business/img/layout2x4.png" width="120">
                        </a>
                    </p>
                </li>
                <li>
                    <p class="p-print-modal__menus-icon">
                        <a href="javascript:void(0);" class="btnPhotoPrint" data-n="18">
                            <span class="p-print-modal__menus-text">１８枚ずつ</span>
                            <img src="/business/img/layout3x6.png" width="120">
                        </a>
                    </p>
                </li>
            </ul>
        </main>
        <footer id="modal_footer">
        </footer>
    </div>
</div>
<form action="{{route('search_again', ['path' => 'close'])}}" method="post" id="search_again_form">
    @if(!isset($params['search_sort']))
        <input type="hidden" name="search_sort" value="{{ !empty(request()->get('search_sort')) ? request()->get('search_sort') : "desc" }}">
    @endif
    @csrf
    @foreach($params as $k => $v)
        @if(is_array($v))
            @foreach($v as $vv)
                <input type="hidden" name="{{$k}}[]" value="{{$vv}}">
            @endforeach
        @else
            <input type="hidden" name="{{$k}}" value="{{$v}}">
        @endif
    @endforeach
</form>
<script>
    $(document).ready(function () {

        $(".cal_picker").datepicker({
            format: "yyyy-mm-dd",
            locale: 'ja',
            language: 'ja',
            weekStart: 1,
            todayHighlight: true,
            autoclose: true,
        });

    })
</script>
@endsection
