@php
    $primary_school_name=$item->primary_school_name;
    if(!strstr($primary_school_name,'義務教育学校')){$primary_school_name=str_replace('学校','',$primary_school_name);}
    $primary_school_name2=$item->primary_school_name2;
    if(!strstr($primary_school_name2,'義務教育学校')){$primary_school_name2=str_replace('学校','',$primary_school_name2);}
    $primary_school_name3=$item->primary_school_name3;
    if(!strstr($primary_school_name3,'義務教育学校')){$primary_school_name3=str_replace('学校','',$primary_school_name3);}
    $secondary_school_name=$item->secondary_school_name;
    if(!strstr($secondary_school_name,'義務教育学校')){$secondary_school_name=str_replace('学校','',$secondary_school_name);}
    $secondary_school_name2=$item->secondary_school_name2;
    if(!strstr($secondary_school_name2,'義務教育学校')){$secondary_school_name2=str_replace('学校','',$secondary_school_name2);}
    $secondary_school_name3=$item->secondary_school_name3;
    if(!strstr($secondary_school_name3,'義務教育学校')){$secondary_school_name3=str_replace('学校','',$secondary_school_name3);}
@endphp
<div class="p-detail-main-sheet__right fright vertical-table-detail">
    <div>
        <table  class="p-detail-main-sheet__right-tbl table-striped custom-table">
        <tr>
            <th class="w-100">所在地</th>
        </tr>
        <tr>
            <td colspan="4" class="clearfix" style="height: auto">
                {{-- @if(isset($item->zip)) 〒{{$item->zip}} @endif --}}
                {{ $item->address_info }}

{{--                @if(isset($item->town_name) && !strstr($item->address,$item->town_name))--}}
{{--                    {{$item->pref_name}}{{$item->city_name}}{{$item->town_name}}{{$item->address}}--}}
{{--                @endif--}}
{{--                @if(isset($item->other_address))--}}
{{--                    {{$item->other_address}}--}}
{{--                @endif--}}

{{--                @if(isset($item->address) && $item->address != '')--}}
{{--                    {{$item->address}}--}}
{{--                @elseif(isset($item->other_address) && $item->other_address != '')--}}
{{--                    {{$item->other_address}}--}}
{{--                @else--}}
{{--                    -/---}}
{{--                @endif--}}


            </td>
        </tr>
        <tr>
            <th class="w-100 ">交通</th>
        </tr>
        <tr>
            <td colspan="4" class="p-detail-main-sheet__right-tbl-double">
                @include('business.objects.projects.traffic-info-other', ['article' => $mansion ?? $item])
            </td>
        </tr>
        <tr>
            <th class="w-50">間取り</th>
            <th class="w-50">所在・階数</th>
        </tr>
        <tr>
            <td class="w-50">{{$item->floor_plan}}{{$item->floor_plan_name}}</td>
            <td class="w-50">
                @if($item->maisonette==1)
                    {{$item->maisonette_from ? $item->maisonette_from : ''}}
                    〜{{$item->maisonette_to ? $item->maisonette_to : ''}}
                @else
                    {{$item->whereabouts ? $item->whereabouts : '-'}}
                @endif
                階/
                @if(optional($mansion)->underground>0)
{{--                        地上--}}
                @endif{{!empty(optional($mansion)->floor) ? optional($mansion)->floor : '-'}}階
                @if(optional($mansion)->underground>0)
{{--                    地下{{$mansion->underground ? $mansion->underground.'階' : ''}}--}}
                @endif建
            </td>
        </tr>
        <tr>
            <th class="w-50">構造</th>
            @if (empty($mansion))
                @if($item->age_year == null && $item->age_month == null && $item->completed_contract_month != null)
                    <th class="w-50">完成予定</th>
                @elseif($item->age_year > date("Y") || ($item->age_year == date("Y") && $item->age_month >= date("m") ))
                    <th class="w-50">完成予定</th>
                @else
                    <th class="w-50">築年月</th>
                @endif
            @else
                @if($mansion->age_year == null && $mansion->age_month == null)
                    <th class="w-50">築年月</th>
                @elseif($mansion->age_year > date("Y") || ($mansion->age_year == date("Y") && $mansion->age_month >= date("m") ))
                    <th class="w-50">完成予定</th>
                @else
                    <th class="w-50">築年月</th>
                @endif
            @endif
        </tr>

        <tr>
            <td class="w-50">{{$item->construction_name}}
{{--                @if($item->construction_sub_name != "")・{{$item->construction_sub_name}}--}}
                @if($item->construction_sub_name != "") 他@endif</td>
            @if (empty($mansion))
                @if($item->age_year == null && $item->age_month == null && $item->completed_contract_month != null)
                    <td class="w-50">契約後{{$item->completed_contract_month}}ヶ月</td>
                @elseif($item->age_year > date("Y") || ($item->age_year == date("Y") && $item->age_month >= date("m") ))
                    <td class="w-50">{{$item->age_year?? "-"}}
                        年{{$item->age_month?? "-"}}月
                    </td>
                @else
                    <td class="w-50">{{$item->age_year?? "-"}}
                        年{{$item->age_month?? "-"}}月
                    </td>
                @endif
            @else
                @if($mansion->age_year == null && $mansion->age_month == null)
                    <td class="w-50">-</td>
                @elseif($mansion->age_year > date("Y") || ($mansion->age_year == date("Y") && $mansion->age_month >= date("m") ))
                    <td class="w-50">{{$mansion->age_year?? "-"}}
                        年{{$mansion->age_month?? "-"}}月
                    </td>
                @else
                    <td class="w-50">{{$mansion->age_year?? "-"}}
                        年{{$mansion->age_month?? "-"}}月
                    </td>
                @endif
            @endif
        </tr>

        <tr>
            <th class="w-50">専有面積</th>
            <th  class="w-50">バルコニー</th>
        </tr>
        <tr>
            <td class="w-50">{{$item->total_area_val}}&nbsp;m&sup2;</td>
            <td class="w-50">{{$item->balcony_area_val}}&nbsp;m&sup2;
            </td>
        </tr>

        <tr>
            <th class="w-50">管理費</th>
            <th class="w-50">修繕積立金</th>
        </tr>
        <tr>
            <td class="w-50">
                @if($item->management_cost)
                    {{number_format($item->management_cost, 0, ",", ",")}}円／@if($item->management_cost_unit==1)
                        月
                    @else
                        年
                    @endif
                @else
                    -
                @endif</td>

            <td class="w-50">
                @if($item->repair_cost)
                    {{number_format($item->repair_cost, 0, ",", ",")}}円／@if($item->repair_cost_unit==1)
                        月
                    @else
                        年
                    @endif
                @else
                    -
                @endif</td>
        </tr>

        <tr>
            <th class="w-50">現況</th>
            <th class="w-50">引渡し</th>
        </tr>
        <tr>
            <td class="w-50">
                {{getCurrentStatusName($item->current_status, $item->property)}}
                @if(getCurrentStatusName($item->current_status, $item->property)=='賃貸中' and ($item->current_status_val or $item->current_status_rate))
                    （
                    @if($item->current_status_val)
                        賃料：{{number_format(is_numeric($item->current_status_val) ? $item->current_status_val : intval(str_replace(',', '', $item->current_status_val)), 0, ",", ",")}}円/月　
                    @endif
                    @if($item->current_status_rate)
                        利回り：{{$item->current_status_rate}}％
                    @endif
                    ）
                @endif
            </td>
            @if($item->property != null)
                <td class="w-50">
                    @if($item->land_delivery == 1)
                        即
                    @elseif($item->land_delivery == 3)
                        {{$item->delivery_year}}年{{$item->delivery_month}}月
                        @if($item->land_delivery_time == 1)
                            初旬
                        @elseif($item->land_delivery_time == 2)
                            上旬
                        @elseif($item->land_delivery_time == 3)
                            中旬
                        @elseif($item->land_delivery_time == 4)
                            下旬
                        @elseif($item->land_delivery_time == 5)
                            末
                        @endif
                    @else
                        -
                    @endif
                    {{-- @if($item->move_in_conditions)
                        ／{{$item->move_in_conditions}}
                    @endif --}}
                </td>
            @else
                <td class="w-50">
                    @if($item->move_in == 1)
                        即
                    @elseif($item->move_in == 2)
                        相談
                    @elseif($item->move_in == 3)
                        {{$item->move_in_year}}年{{$item->move_in_month}}月
                    @elseif($item->move_in == 4)
                        契約後{{$item->move_in_contract_month}}ヶ月
                    @elseif($item->move_in == 5)
                        不明
                    @else
                        -
                    @endif
                    {{-- @if($item->move_in_conditions)
                        ／{{$item->move_in_conditions}}
                    @endif --}}
                </td>
            @endif
        </tr>

        <tr>
            <th class="w-100">総戸数</th>
        </tr>
        <tr>
            <td>{{$item->total_unit}}戸</td>
        </tr>
        <tr>
            <th  class="w-100">用途地域</th>
        </tr>
        <tr>
            <td>
                {{$item->use_area_name??"-"}}@if($item->use_area_name != "" || $item->use_area_name != null)
                @endif

{{--                @if($item->use_area_name_sub != "")--}}
{{--                    ・{{$item->use_area_name_sub}}--}}
{{--                @endif--}}
{{--                @if($item->use_area_name_sub2 != "")--}}
{{--                    他--}}
{{--                @endif--}}
                @if($item->use_area_name_sub != "" || $item->use_area_name_sub2 != "")
                    ・他
                @endif
            </td>
        </tr>


    </table>
    </div>
</div>
