@foreach($article_list as $item)
    <li class="p-results-image__li" id="mansion_{{$item->id}}">
        <div class="p-results-image__li-head d-flex justify-content-between">
            <div>
                <div class="d-flex">
                    <p class="p-results-image__li-name">{{$item->name}}<!--（{{$item->main_traffic_station}}）--></p>
                </div>
            </div>
            <div class="p-results-image__li-btns d-flex justify-content-end list-unstyled">
                <a href="javascript:void(0);" class="c-circle-btn c-circle-btn__detail" data-id="{{$item->building_id}}" id="bttnParentDetail{{$item->building_id}}">
                    <p>詳細</p>
                    <img src="../../business/img/icon_detail.png">
                </a>
            </div>
        </div>
        <div class="p-results-image__image-area d-flex">
            <div class="p-results-image__image__lot">
                @if(!empty($item->disp_file))
                    <img src="{{$item->disp_file}}" />
                @else
                    <img src="{{root('img/noimage2.jpg')}}" />
                @endif
            </div>

            <table class="p-results-image__main-info p-results-image__main-lot1">
                <tr class="p-results-image__main-info-search">
                    <th>売出物件</th><td>
                        @if($item->lot_count)
                            <a href="javascript:void(0);" class="disp_room">{{$item->lot_count}}<span>件</span><i class="fa fa-caret-down"></i></a>
                        @else
                            <span class="disp_room">{{$item->lot_count}}<span>件</span></span>
                        @endif
                    </td>
                </tr>
                <tr>
                    <th class="p-results-image__main-info-address">所在地</th><td>{{$item->address}}</td>
                </tr>
                <tr class="p-results-image__main-info-access">
                    <th>交通</th><td>
                        @include('business.objects.projects.traffic-info-summary', ['article' => $item])
                    </td>
                </tr>
            </table>

            <table class="p-results-image__main-info p-results-image__main-lot2">
                <tr class="p-results-image__main-info-other">
                    <th>分譲地番号</th><td><span class="id_target">{{$item->building_id}}</span></td>
                </tr>
                <tr class="p-results-image__main-info-other">
                    <th>総区画数</th><td>@if($item->section){{$item->section}}区画@else-@endif</td>
                </tr>
                <tr class="p-results-image__main-info-other">
                    <th>学校区</th><td>
                        @if($item->primary_school_name or $item->secondary_school_name)
                            {{$item->primary_school_name?? "-"}}/{{$item->secondary_school_name?? "-"}}
                        @else
                            -
                        @endif
                    </td>
                </tr>
            </table>

        </div>
        <?php
        $arrLot = $item->lot_list->pluck('building_id')->toArray();
        ?>
        @foreach($item->lot_list as $lot)
            <div @if($item->show_ite == true) class="p-mansion-room p-mansion-room-show" @else class="p-mansion-room" @endif @if(isset($is_open) && in_array ($is_open, $arrLot)) style="display: block" @endif>
                <input type="hidden" class="session-article-id" value="{{$lot->building_id}}">
                <table class="p-mansion-room__tbl">
                    <tr>
                        <td class="p-mansion-room__tbl-number w90" rowspan="2">物件番号<br><span class="room_building_id">{{$lot->building_id}}</span></td>
                        <th>物件名</th>
                        <td class="p-mansion-room__tbl__w200">{{$lot->name}}</td>
                        <th>価格</th>
                        <td class="w160">{{number_format($lot->price, 0, ",", ",")}}<span>万円@if($lot->tax==2)（税込）@endif</span></td>
                        <th>土地</th>
                        <td class="w90">{{$lot->total_area_val?? '-'}}m&sup2;</td>
                        <th>間取り</th>
                        <td class="w90">{{$lot->floor_plan_text?? '-'}}</td>
                        <td colspan="2"></td>
                        <td colspan="3" rowspan="2">
                            <ul class="p-results-image__li-btns d-flex justify-content-end list-unstyled">
                                @if(!isset($print))
                                    <li>
                                        @include('business.objects.components.circle-btn-mansion',
                                            ['id' => 'btnCheck', 'class' => 'c-circle-btn__check-mansion', 'linkUrl' => '#',
                                            'img' => '../../business/img/icon_check.png', 'title' => '確認'])
                                    </li>
                                    <li>
                                        @include('business.objects.components.circle-btn-mansion',
                                            ['id' => 'btnDetail'.$lot->building_id, 'mansion_id' => $item->id , 'class' => 'c-circle-btn__detail', 'linkUrl' => 'javascript:void(0);',
                                            'img' => '../../business/img/icon_detail.png', 'title' => '詳細'])
                                    </li>
                            @endif
                            <!--<li>
                                @include('business.objects.components.circle-btn-mansion',
                                    ['id' => 'btnDisplay', 'class' => 'c-circle-btn__disp-mansion', 'linkUrl' => '#',
                                    'img' => '../../business/img/icon_display.png', 'title' => '表示'])
                                </li>-->
                            </ul>
                        </td>
                    </tr>
                    <tr>
                        <th>種別</th>
                        <td>{{$lot->property_name}}</td>
                        <th>築年月</th>
                        <td>{{$lot->age_year?? '-'}}年{{$lot->age_month?? '-'}}月</td>
                        <th>延床</th>
                        <td>{{$lot->total_area_val?? '-'}}m&sup2;</td>
                        <th>階数</th>
                        <td>{{$lot->whereabouts?? '-'}}</td>
                        <td colspan="2">
                            <p class="align-self-end">
                                <img src="../../business/img/icon_camera.png" alt="写真">
                                @if($lot->property < 4)
                                    {{$lot->file_count ?? 0}}
                                @else
                                    外{{ $lot->file_count_out ?? 0}}/内{{$lot->file_count ?? 0}}
                                @endif
                            </p>
                        </td>
                    </tr>
                </table>

                {{-- 確認ボタンクリック時に表示する --}}
                @include('business.objects.projects.form-check-lot', ['data_num' => $lot->building_id, 'history_count' => count($lot->history)])
                @include('business.objects.projects.modal-history', ['history' => $lot->history, 'data_num' => $lot->building_id])
            </div>
        @endforeach
    </li>
@endforeach
