@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 class="w-100" 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 class="w-100">
                @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->underground)
                    地上{{$item->floor ? $item->floor.'階' : ''}}地下{{$item->underground ? $item->underground.'階' : ''}}建
                @else
                    {{$item->floor ? $item->floor.'階' : ''}}建
                @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}}@endif</td>--}}
                @if($item->construction_sub_name != "")他@endif</td>
            </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?? "-"}}月{{$item->completed_text??''}}</td>
                @else
                    <td class="w-50">{{$item->age_year?? "-"}}年{{$item->age_month?? "-"}}月{{$item->completed_text??''}}</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?? "-"}}月{{$item->completed_text??''}}</td>
                @else
                    <td class="w-50">{{$mansion->age_year?? "-"}}年{{$mansion->age_month?? "-"}}月{{$item->completed_text??''}}</td>
                @endif
            @endif
        </tr>

        <tr>
            <th class="w-50 ">土地面積</th>
            <th class="w-50 ">建物面積</th>
        </tr>
        <tr>
            <td class="w-50">{{$item->land_area_val}}&nbsp;m&sup2;</td>
            <td class="w-50">{{$item->total_area_val}}&nbsp;m&sup2;</td>
        </tr>



        <tr>
            <th class="w-50 ">建ぺい率</th>
            <th class="w-50 ">容積率</th>

        </tr>
        <tr>
            <td class="w-50">{{$item->building_rate?? '-'}}%</td>
            <td class="w-50">{{$item->volume_rate?? '-'}}%</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>
            <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>
        </tr>

        @if($item->property_sub === \App\Models\MstPropertyType::NEW)
            <tr>
                <th class="w-50 ">私道負担</th>
                <th class="w-50 ">建築確認</th>
            </tr>
            <tr>
                <td class="w-50">{{ $item->getRoadBurdenName() }}</td>
                <td class="w-50">{{ $item->architecture_no ?? '-' }} </td>
            </tr>
        @else
            <tr>
                <th class="w-100">私道負担</th>
            </tr>
            <tr>
                <td class="w-100">{{ $item->getRoadBurdenNamePrint() }}</td>
            </tr>
        @endif

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

{{--                old ver--}}
{{--                @if($item->use_area_name_sub != "")--}}
{{--                    ・{{$item->use_area_name_sub}}--}}
{{--                @endif--}}
{{--                @if($item->use_area_name_sub2 != "")--}}
{{--                    他--}}
{{--                @endif--}}
{{--                new ver--}}

                @if($item->use_area_name_sub != "" || $item->use_area_name_sub2 != "")
                    ・他
                @endif

            </td>
        </tr>
    </table>
    </div>
</div>
