<div class="p-results-noimage">
    @foreach($data as $item)
        <div class="mb-3 target_list row-house">
            @if($item->event_category)
                <div class="p-results-image__event">
                    @if($item->event_category==1)
                        【現地見学会】
                    @elseif($item->event_category==2)
                        【現地案内会】
                    @elseif($item->event_category==3)
                        【現地販売会】
                    @elseif($item->event_category==4)
                        【オープンハウス】
                    @elseif($item->event_category==5)
                        【オープンルーム】
                    @endif
                    @if($item->event_schedule==1)
                        毎週土日祝
                    @elseif($item->event_schedule==2)
                        毎週土日
                    @elseif($item->event_schedule==3)
                        {{date('n/j', strtotime($item->event_day))}}
                    @elseif($item->event_schedule==4)
                        {{date('n/j', strtotime($item->from_event))}}〜{{date('n/j', strtotime($item->to_event))}}
                    @elseif($item->event_schedule==5)
                        公開中
                    @endif
                    @if($item->from_hour or $item->to_hour)
                        @if($item->from_hour){{$item->from_hour}}:{{sprintf('%02d', $item->from_minute)}}@endif〜@if($item->to_hour){{$item->to_hour}}:{{sprintf('%02d', $item->to_minute)}}@endif
                    @endif
                    @if($item->reservation==1)
                        ＜完全予約制＞
                    @endif
                </div>
            @endif
            <table class="p-results-noimage__tbl">
                <tr>
                    <td rowspan="3" class="p-results-noimage__tbl-num-date">
                        @if($item->status == 2)
                            <p class="mt-1 p-results-noimage__tbl-statusbox"><span class="p-results-noimage__tbl-status">商談中</span></p>
                        @elseif($item->status == 3)
                            <p class="mt-1 p-results-noimage__tbl-statusbox"><span class="p-results-noimage__tbl-status">契約予定</span></p>
                        @elseif($item->status == 4)
                            <p class="mt-1 p-results-noimage__tbl-statusbox"><span class="p-results-noimage__tbl-status">契約済</span></p>
                        @elseif($item->status == 5)
                            <p class="mt-1 p-results-noimage__tbl-statusbox"><span class="p-results-noimage__tbl-status">売りやめ</span></p>
                        @elseif($item->status == 6)
                            <p class="mt-1 p-results-noimage__tbl-statusbox"><span class="p-results-noimage__tbl-status">保留</span></p>
                        @endif
                        <p><span class="p-results-noimage__tbl-number">物件番号</span>{{$item->building_id}}</p>
                        <p class="mt-1">
                            <span class="p-results-noimage__tbl-date">物件登録日</span>
                            <br>
                            @if($item->created_at){{$item->created_at->format('Y/m/d')}}@endif
                        </p>
                    </td>
                    <th>物件名</th>
                    <td>
                        <div class="d-flex justify-content-between">
                            <p>{{$item->name}}</p>
                        </div>
                    </td>
                    <th>所在地</th>
                    <td class="p-results-noimage__tbl-address">
                        {{ $item->address_info }}
{{--                        @if($item->town_name!= null && !strstr($item->address,$item->town_name))--}}
{{--                            {{$item->pref_name}}{{$item->city_name}}{{$item->town_name}}{{$item->address}}--}}
{{--                        @else--}}
{{--                            {{$item->address}}--}}
{{--                        @endif--}}
                    </td>
                    <th>価格</th>
                    <td class="p-results-noimage__tbl-price">
                        @if($item->status == 4)
                            <p>
                                最終：
                                <span>
                                    {{number_format($item->price, 0, ",", ",")}}
                                </span>
                                万円
                            </p>
                            <p>
                                成約：
                                <span>
                                    @if($item->price_closing)
                                        {{number_format($item->price_closing, 0, ",", ",")}}
                                    @else
                                        -
                                    @endif
                                </span>
                                万円{{$item->close_date ? '（'.$item->close_date.'）' :'' }}
                            </p>
                        @else
                            <span>
                                {{number_format($item->price, 0, ",", ",")}}
                            </span>万円
                        @endif
                    </td>
                    <th>土地</th>
                    <td class="p-results-noimage__tbl-area">
                        @if(strstr($item->property_name,'マンション') or strstr($item->property_name,'タウンハウス'))
                            -
                        @else
                            {{$item->land_area_val?? "-"}}
                        @endif
                            m&sup2;
                    </td>
                </tr>
                <tr>
                    <th>種別</th>
                    <td>{{$item->property_name?? "-"}}</td>
                    <th rowspan="2">交通</th>
                    <td rowspan="2">
                        @include('business.objects.projects.traffic-info', ['article' => $mansion ?? $item])
                    </td>
                    @if($item->age_year == null && $item->age_month == null && $item->completed_contract_month != null)
                        <th>完成予定</th>
                        <td>契約後{{$item->completed_contract_month}}ヶ月</td>
                    @elseif($item->age_year > date("Y") || ($item->age_year == date("Y") && $item->age_month >= date("m") ))
                        <th>完成予定</th>
                        <td>{{$item->age_year?? "-"}}年{{$item->age_month?? "-"}}月</td>
                    @else
                        <th>築年月</th>
                        <td>{{$item->age_year?? "-"}}年{{$item->age_month?? "-"}}月</td>
                    @endif
                    <th>延床</th>
                    <td>{{$item->total_area_val?? "-"}}m&sup2;</td>
                </tr>
                <tr>
                    <th>校区</th>
                    <td>{{$item->primary_school_name?? "-"}}/{{$item->secondary_school_name?? "-"}}</td>
                    <th>階数</th>
                    <td>
                        @if($item->whereabouts or $item->maisonette==1)
                            @if($item->maisonette==1)
                                {{$item->maisonette_from ? $item->maisonette_from : ''}}
                                〜{{$item->maisonette_to ? $item->maisonette_to : ''}}階
                            @elseif($item->whereabouts)
                                {{$item->whereabouts?? "-"}}階
                            @else
                                -
                            @endif
                        @endif
                        @if($item->floor)
                            @if(optional($item)->underground)
                                /地上{{optional($item)->floor}}階 地下{{ optional($item)->underground }}階建
                            @elseif(optional($item)->floor)
                                /{{optional($item)->floor}}階建
                            @endif
                        @endif
                        @if(!$item->whereabouts and $item->maisonette!=1 and !$item->floor)
                            -
                        @endif
                    </td>
                    <th>間取り</th>
                    <td>{{$item->floor_plan_text?? "-"}}</td>
                </tr>
            </table>
        </div>
    @endforeach
</div>
