@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 d-flex">
                @if(!empty($item->top_file_path))
                    <div class="p-results-image__image-box"><img src="{{$item->top_file_path}}"/></div>
                @else
                    <div class="p-results-image__image-box"><img src="{{root('img/noimage2.jpg')}}"/></div>
                @endif

                @if(!empty($item->floor_file_path))
                    <div class="p-results-image__image-box"><img src="{{$item->floor_file_path}}"/></div>
                @else
                    <div class="p-results-image__image-box"><img src="{{root('img/noimage2.jpg')}}"/></div>
                @endif

            </div>
            <table class="p-results-image__main-info">
                <tr class="p-results-image__main-info-search">
                    <th>売出物件</th>
                    <td colspan="5">
                        @if($item->room_count)
                            <a href="javascript:void(0);" class="disp_room">{{$item->room_count}}<span>件</span><i
                                    class="fa fa-caret-down"></i></a>
                        @else
                            <span class="disp_room">{{$item->room_count}}<span>件</span></span>
                        @endif
                    </td>
                </tr>
                <tr>
                    <th class="p-results-image__main-info-address">所在地</th>
                    <td colspan="5">
                        {{ $item->address_info }}
                    </td>
                </tr>
                <tr class="p-results-image__main-info-access">
                    <th>交通</th>
                    <td colspan="5">
                        @include('business.objects.projects.traffic-info-summary', ['article' => $item])
                    </td>
                </tr>
                <tr>
                    <th style="width:20%;">マンション番号</th>
                    <td style="width:10%;"><span class="id_target">{{$item->building_id}}</span></td>
                    <th style="width:12%;">築年月</th>
                    <td style="width:20%;">{{$item->age_year?? "-"}}年{{$item->age_month?? "-"}}月</td>
                    <th style="width:12%;">階数</th>
                    <td>
                        @if($item->underground)
                            地上{{$item->floor}}階 地下{{$item->underground}}階建
                        @elseif($item->floor)
                            {{$item->floor}}階建
                        @else
                            -
                        @endif
                    </td>
                </tr>
                <tr>
                    <th style="width:12%;">総戸数</th>
                    <td style="width:15%;">{{$item->total_unit?? "-"}}戸</td>
                    <th>学校区</th>
                    <td colspan="3">
                        @if(isset($item->primary_school_name) || isset($item->secondary_school_name))
                            {{$item->primary_school_name?? "-"}}/{{$item->secondary_school_name?? "-"}}
                        @elseif(isset($item->other_primary_school_2) || isset($item->other_secondary_school_2))
                            {{$item->other_primary_school_2 ?? "-"}}/{{$item->other_secondary_school_2 ?? "-"}}
                        @else
                            -/-
                        @endif
                    </td>
                </tr>
            </table>
            <p class="p-results-image__info-photo align-self-end">
                <img src="../../business/img/icon_camera.png"
                     alt="写真">外{{$item->file_count}}<!--/{{$item->rooms_file_count}}枚--></p>
        </div>
        @foreach($item->room_list as $room)
            <div @if($item->show_ite == true) class="p-mansion-room p-mansion-room-show" @else class="p-mansion-room"
                 @endif @if(isset($is_open) && $is_open == $room->building_id) style="display: block" @endif>
                <input type="hidden" class="session-article-id" value="{{$room->building_id}}">
                <table class="p-mansion-room__tbl">
                    <tr>
                        <td class="p-mansion-room__tbl-number w90">物件番号<br/><span
                                class="room_building_id">{{$room->building_id}}</span></td>
                        <th>部屋</th>
                        <td class="w190">{{$room->room_num?? '-'}}</td>
                        <th>価格</th>
                        <td class="w160">
                            {{ number_format($room->price, 0, ",", ",") }}
                            <span>万円@if($room->tax==2)
                                    （税込）
                                @endif</span></td>
                        <th>専有</th>
                        <td class="w120">{{$room->total_area_val?? '-'}}m&sup2;</td>
                        <th>間取り</th>
                        <td class="w90">{{$room->floor_plan_text?? '-'}}</td>
                        <th>階数</th>
                        <td class="w90">@if($room->maisonette == 1)
                                {{$room->maisonette_from?? '-'}}階〜{{$room->maisonette_to?? '-'}}階
                            @else
                                {{$room->whereabouts?? '-'}}階
                            @endif</td>
                        <td class="w90"><img src="/business/img/icon_camera.png" alt="写真">内{{$room->file_count}}</td>
                        <td colspan="3">
                            <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'.$room->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>
                </table>
                {{-- 確認ボタンクリック時に表示する --}}
                @include('business.objects.projects.form-check-mansion', ['data_num' => $room->building_id, 'history_count' => count($room->history)])
                @include('business.objects.projects.modal-history', ['history' => $room->history, 'data_num' => $room->building_id])
            </div>
        @endforeach
    </li>
@endforeach
