@php
    if(!isset($relation_facilities)) {
        $relation_facilities = $item->relation_facilities;
    }
    $mansion = $item->getMansion();
@endphp
@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-summary">
    <h3 class="p-detail-summary__title">{{$item->article_name}}<!--（{{$item->main_traffic_station}}
        駅）{{$item->property_name}}-->
        @if($item->price and $item->status!=4 and $item->status!=5)
        <span
            class="p-detail-summary__price"><span>{{number_format($item->price, 0, ",", ",")}}</span>万円@if($item->tax==2)<!--（税込）-->@endif</span>
        @endif
        <span class="p-detail-summary__id">No.{{$item->building_id}}</span>
      </h3>
    <table class="p-detail-summary__catch">
        <tr>
            <th>キャッチコピー</th>
            <td colspan="3">{{$item->catchcopy}}</td>
        </tr>
        <tr>
            <th>ポイント</th>
            <td colspan="3">{{$item->point}}</td>
        </tr>
        <tr>
            <th>営業担当者コメント</th>
            <td colspan="3">{{$item->comment}}</td>
        </tr>
        <tr>
            <th>営業担当者（HP記載用）</th>
            <td>{{$item->hp_charge_name}}</td>
            <th>広告掲載指示</th>
            <td>自社HP：@if($item->own_company == 2) 入稿 @else 未 @endif/SUMMO：@if($item->suumo == 2) 入稿 @else 未 @endif
                /HOMES：@if($item->homes == 2) 入稿 @else 未 @endif/athome：@if($item->athome == 2) 入稿 @else 未 @endif</td>
        </tr>
    </table>
    <div class="p-detail-summary__tbl justify-content-between">
        <div class="p-detail-summary__tbl-left fleft">
            <h4>基本情報</h4>
            <table>
                @if($item->property == 1 || $item->property == 2 || $item->property == 3 || $item->property == 4 || $item->property == 5)
                    <tr>
                        <th>物件番号</th>
                        <td>{{$item->building_id}}</td>
                    </tr>
                    <tr>
                        <th>物件種別</th>
                        <td>{{$item->property_name}}</td>
                    </tr>
                    <tr>
                        <th>物件名</th>
                        <td>{{$item->name}}</td>
                    </tr>
                @elseif($item->property == 6 || $item->property == 7 || $item->property == null)
                    <tr>
                        <th>マンション建物番号</th>
                        <td>{{$item->mansion_id}}</td>
                    </tr>
                    <tr>
                        <th>マンション名</th>
                        <td>{{$item->article_name}}<!--（{{$item->main_traffic_station}}駅）{{$item->property_name}}--></td>
                    </tr>
                    <tr>
                        <th>物件番号</th>
                        <td>{{$item->building_id}}</td>
                    </tr>
                <!--<tr>
          <th>物件種別</th><td>{{$item->property_name}}</td>
        </tr>
        <tr>
          <th>物件名</th><td>{{$item->name}}</td>
        </tr>-->
                    <tr>
                        <th>部屋番号</th>
                        <td>{{$item->room_num}}号室</td>
                    </tr>
                @endif
                @if (!in_array($item->property, [1,2,3]))
                <tr>
                    <th>未入居</th>
                    <td>{{ (int)$item->occupied ? '〇' : '-'}}</td>
                </tr>
                @endif
                <tr>
                    <th>収益物件</th>
                    <td>{{(int)$item->revenue ? '〇' : '-'}}</td>
                </tr>
                <tr>
                    <th>ステータス</th>
                    <td>{{getStatus($item->status)}}</td>
                </tr>
                <tr>
                    <th>物件取扱店舗名</th>
                    <td>@if(isset($shop_name)){{ $shop_name }}@endif</td>
                </tr>
                <tr>
                    <th>所在地</th>
                    <td colspan="2">
                        @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>物件位置情報</th>
                    <td>緯度：{{$item->lat}}　経度：{{$item->lng}}</td>
                </tr>
                <tr>
                    <th>交通</th>
                    <td>
                        @include('business.objects.projects.traffic-info-summary', ['article' => $mansion?? $item])
                    </td>
                </tr>
                <tr>
                    <th>学校区</th>
{{--                    <td>{{$item['primary_school_name']?? "-"}}／{{$item['secondary_school_name']?? "-"}}</td>--}}
                    <td>
                        @if(!isset($item->primary_school_name) and !isset($item->secondary_school_name) && !isset($item->other_secondary_school_2) && !isset($item->other_primary_school_2))
                            -
                        @endif
                        @if(isset($item->primary_school_name))
                            {{$primary_school_name}} @if(isset($item->primary_school_distance))
                                約{{$item->primary_school_distance}}m
                            @endif @if(isset($item->primary_school_time))
                                /&nbsp;徒歩{{$item->primary_school_time}}分
                            @endif
                        @endif
                        @if(isset($item->primary_school_name2))
                            {{$primary_school_name2}} @if(isset($item->primary_school2_distance))
                                約{{$item->primary_school2_distance}}m
                            @endif @if(isset($item->primary_school_time2))
                                /&nbsp;徒歩{{$item->primary_school_time2}}分
                            @endif
                        @endif
                        @if(isset($item->primary_school_name3))
                            {{$primary_school_name3}} @if(isset($item->primary_school3_distance))
                                約{{$item->primary_school3_distance}}m
                            @endif @if(isset($item->primary_school_time3))
                                /&nbsp;徒歩{{$item->primary_school_time3}}分
                            @endif
                        @endif
                        @if(isset($item->secondary_school_name))
                            {{$secondary_school_name}} @if(isset($item->secondary_school_distance))
                                約{{$item->secondary_school_distance}}m
                            @endif @if(isset($item->secondary_school_time))
                                /&nbsp;徒歩{{$item->secondary_school_time}}分
                            @endif
                        @endif
                        @if(isset($item->secondary_school_name2))
                            {{$secondary_school_name2}} @if(isset($item->secondary_school2_distance))
                                約{{$item->secondary_school2_distance}}m
                            @endif @if(isset($item->secondary_school_time2))
                                /&nbsp;徒歩{{$item->secondary_school_time2}}分
                            @endif
                        @endif
                        @if(isset($item->secondary_school_name3))
                            {{$secondary_school_name3}} @if(isset($item->secondary_school3_distance))
                                約{{$item->secondary_school3_distance}}m
                            @endif @if(isset($item->secondary_school_time3))
                                /&nbsp;徒歩{{$item->secondary_school_time3}}分
                            @endif
                        @endif

                        @if(isset($item->other_primary_school_2))
                            {{$item->other_primary_school_2}}約{{$item->other_primary_school_3}}m
                            @if(isset($item->other_primary_school_3))
                                /徒歩{{ceil($item->other_primary_school_3/80)}}分　
                            @endif<br>
                        @endif
                        @if(isset($item->other_secondary_school_2))
                            {{$item->other_secondary_school_2}}約{{$item->other_secondary_school_3}}m
                            @if(isset($item->other_secondary_school_3))
                                /徒歩{{ceil($item->other_secondary_school_3/80)}}分　
                            @endif<br>
                        @endif
                    </td>
                </tr>
{{--                <tr>--}}
{{--                    <th>レインズ番号</th>--}}
{{--                    <td>{{$item->rains_id}}</td>--}}
{{--                </tr>--}}
<tr>
    <th>備考1（社内用）</th>
    <td>{{$item->memo1 ?? '-'}}</td>
</tr>
<tr>
    <th>備考2（社内用）</th>
    <td>{{$item->memo2 ?? '-'}}</td>
</tr>
<!--<tr>
    <th>備考</th>
    <td>{{$item->memo_business ?? '-'}}</td>
</tr>-->
                @foreach($customs as $custom)
                    <tr>
                        <th>
                            <div class="search_target_title">【オリジナル】<br />{{ $custom->name }}</div>
                        </th>

                        <td>
                            @switch($custom->type)
                                @case(1)
                                {{ empty(optional($item->customs()->where("code", $custom->code)->first())->contents) ? "-" : "〇" }}
                                @break
                                @case(2)
                                @if(implode(", ", $item->customs()->where("code", $custom->code)->get()->pluck("contents")->toArray())==0)0
                                @else
                                {{  implode(", ", $item->customs()->where("code", $custom->code)->get()->pluck("contents")->toArray()) }}
                                @endif
                                @break
                                @case(3)
                                {{  implode(", ", $item->customs()->where("code", $custom->code)->get()->pluck("contents")->toArray()) }}
                                @break
                            @endswitch
                        </td>
                    </tr>
                @endforeach
                <tr>
                  <th>取引態様</th>
                  <td>{{$manner_name}}</td>
                </tr>
            </table>

            <h4>価格</h4>
            <table>
              @if($item->status == 4)
              <tr>
                  <th>成約価格</th>
                  <td>
                    @if($item->price_closing)
                  {{number_format($item->price_closing, 0, ",", ",")}}<span>万円@if($item->tax==2)<!--（税込）-->@endif</span>@if($item->close_date != null) / {{date('Y年m月d日', strtotime($item->close_date))}}@endif
                    @else
                    -
                    @endif
                  </td>
              </tr>
              <tr>
                  <th>最終物件価格</th>
                  <td>{{number_format($item->price, 0, ",", ",")}}万円</td>
              </tr>
              @else
                <tr>
                    <th>物件価格</th>
                    <td>{{number_format($item->price, 0, ",", ",")}}万円</td>
                </tr>
                @endif
                <!--<tr>
                    <th>有線放送に係る費用</th>
                    <td>
                        @if ($item->broadcasting == 1)
                            <span>
                                初期費用：
                                @switch($item->broadcasting_presence)
                                    @case(0)
                                        無
                                        @break
                                    @case(1)
                                        有（{{ $item->broadcasting_cost }}円）
                                        @break
                                    @case(2)
                                        有（金額未定）
                                        @break
                                @endswitch
                            </span>
                            <br>
                            <span>
                                定額費用：
                                @switch($item->broadcasting_fixed_presence)
                                    @case(0)
                                    無
                                    @break
                                    @case(1)
                                    有（{{ $item->broadcasting_fixed_cost }}円/{{ $item->broadcasting_fixed_cost_unit == 1 ? "月" : "年" }}）
                                    @break
                                    @case(2)
                                    有（金額未定）
                                    @break
                                @endswitch
                            </span>
                        @elseif ($item->broadcasting == 2)
                            未選択
                        @else
                            無
                        @endif
                    </td>
                </tr>
                <tr>
                    <th>CATVに係る費用</th>
                    <td>
                        @if ($item->catv == 1)
                            <span>
                                初期費用：
                                @switch($item->catv_presence)
                                    @case(0)
                                    無
                                    @break
                                    @case(1)
                                    有（{{ $item->catv_cost }}円）
                                    @break
                                    @case(2)
                                    共有
                                    @break
                                @endswitch
                            </span>
                            <br>
                            <span>
                                定額費用：
                                @switch($item->catv_fixed_presence)
                                    @case(0)
                                    無
                                    @break
                                    @case(1)
                                    有（{{ $item->catv_fixed_cost }}円/{{ $item->catv_fixed_cost_unit == 1 ? "月" : "年" }}）
                                    @break
                                    @case(2)
                                    共有
                                    @break
                                @endswitch
                            </span>
                        @elseif ($item->catv == 2)
                            未選択
                        @else
                            無
                        @endif
                    </td>
                </tr>-->
                <tr>
                    <th>物件価格変更履歴</th>
                    <td>
                        @foreach($item->price_histories as $key => $p)
                            @if($key > 0)
                                変更：{{number_format($p->price, 0)}}万円 @if(!empty($p->regist_date)) ({{ date('Y/m/d', strtotime($p->regist_date))}}) @endif
                            @else
                                登録：{{number_format($p->price, 0)}}万円 @if(!empty($p->regist_date)) ({{ date('Y/m/d', strtotime($p->regist_date))}}) @endif
                            @endif
                            <br>
                        @endforeach
{{--                        0000/00/00 0,000万円<br>0000/00/00 0,000万円<br>0000/00/00 0,000万円--}}
                    </td>
                </tr>
                @if($item->property == 6 || $item->property == 7 || $item->property == null)
                    <tr>
                        <th>管理費</th>
                        <td>{{number_format($item->management_cost, 0, ",", ",")}}円/@if($item->management_cost_unit==1)月@else年@endif</td>
                    </tr>
                    <tr>
                        <th>修繕積立金</th>
                        <td>{{number_format($item->repair_cost, 0, ",", ",")}}円/@if($item->repair_cost_unit==1)月@else年@endif</td>
                    </tr>
                    <tr>
                        <th>修繕積立基金</th>
                        <td>
                          @if($item->repair_fund==1)
                          {{number_format($item->repair_fund_unit, 0, ",", ",")}}円/一括
                          @elseif($item->repair_fund==2)
                          -
                          @else
                          無
                          @endif
                        </td>
                    </tr>
                    <tr>
                        <th>駐車場（敷地内）</th>
                        <td>{{$item->getParkingText()}}</td>
                    </tr>
                    <tr>
                        <th>駐車場（敷地外）</th>
                        <td>{{$item->getParkingOutText()}}</td>
                    </tr>
                @endif

                {{--        <tr>--}}
                {{--          <th>駐車場（敷地外）</th><td>無</td>--}}
                {{--        </tr>--}}

                <!--@if(!in_array($item->property, [1,2,3,4]))
                    <tr>
                        <th>インターネットに係る費用</th>
                        <td>
                            @php
                                if($item->internet != null) {
                                    $bstNames = ['無', '有', '未設定'];
                                    $text = $bstNames[$item->internet] ?? '';
                                    if($item->internet == 1) {
                                        $text .= '<br>';
                                        $names = ['無', '有', '有（金額未定）'];
                                        if($item->internet_presence != null) {
                                            $text .= '- '.($names[$item->internet_presence] ?? '');
                                            if($item->internet_presence == 1) {
                                                $text .= ': '.($item->internet_cost).'円';
                                            }
                                        }
                                        if($item->internet_fixed_presence != null) {
                                            $text .= '<br>- '.($names[$item->internet_fixed_presence] ?? '');
                                            if($item->internet_fixed_presence == 1) {
                                                $text .= ': '.($item->internet_fixed_presence).'円/'.($item->internet_fixed_cost_unit == 1) ? '月' : '年';
                                            }
                                        }
                                    }
                                    echo $text;
                                }
                            @endphp
                        </td>
                    </tr>
                @endif
                <tr>
                    <th>町会費など</th>
                    <td>{{!empty($item->council) ? getCouncilName($item) : '-'}}</td>
                </tr>
                <tr>
                    <th>温泉</th>
                    <td>{{!empty($item->spring) ? getSpringName($item) : '-'}}</td>
                </tr>-->
                <tr>
                  <th>その他費用</th>
                  <td>
                    @if($item->another_cost1)
                    {{getAnotherCost($item, [1])}}
                    @endif
                    @if($item->another_cost2)
                    <br />{{getAnotherCost($item, [2])}}
                    @endif
                    @if($item->another_cost3)
                    <br />{{$item->another_cost3}}
                    @endif
                    @if(!$item->another_cost1 and !$item->another_cost2 and !$item->another_cost3)
                    -
                    @endif
                  </td>
                    <!--<th>その他諸費用1</th>
                    <td>{{getAnotherCost($item, [1])}}</td>
                </tr>
                <tr>
                    <th>その他諸費用2</th>
                    <td>{{getAnotherCost($item, [2])}}</td>
                </tr>
                <tr>
                    <th>その他諸費用3</th>
                    <td>{{$item->another_cost3}}</td>-->
{{--                    <td>{{getAnotherCost($item, [3])}}</td>--}}
                </tr>
                <tr>
                    <th>
                        <div class="search_target_title">価格備考</div>
                    </th>
                <td>{{ $item->price_note ?? "-"}}</td>
              </tr>
            </table>
            <h4>制限事項</h4>
            <table>
                <tr>
                    <th>法令上の制限</th>
                    @if (empty($mansion))
                        <td>{!! ($tmpLaws = $item->getLowRestrictionName()) ? $tmpLaws : '-' !!}</td>
                    @else
                        <td>{!! ($tmpLaws = $mansion->getLowRestrictionName()) ? $tmpLaws : '-' !!}</td>
                    @endif
                </tr>
                <tr>
                    <th>その他制限事項</th>
                    @if (empty($mansion))
                        <td>{!! ($tmpLaws = $item->getOtherRestriction()) ? $tmpLaws : '-' !!}</td>
                    @else
                        <td>{!! ($tmpLaws = $mansion->getOtherRestriction()) ? $tmpLaws : '-' !!}</td>
                    @endif
                </tr>
            </table>
        </div>
        <div class="p-detail-summary__tbl-right fright">
            <h4>物件概要</h4>
            <table>
                <tr>
                    <th>土地権利</th>
                    @php
                        $dataLand = $item;
                        if ($mansion = $item->getMansion())
                            $dataLand = $mansion;
                    @endphp
                    <td>
                      @if($dataLand->land_right==1)
                      所有権
                      @elseif($dataLand->land_right==2)
                      <span>借地権のみ</span>
                      @elseif($dataLand->land_right==3)
                      <span>所有権・借地権混在</span>
                      @else
                      -
                      @endif
                        @include('business.objects.components.land-right')
                    </td>
                </tr>
            </table>

            <h4>土地情報</h4>
            <table>
              @if($item->property == 1 || $item->property == 2 || $item->property == 3 || $item->property == 4 || $item->property == 5)
                <tr>
                    <th>土地面積</th>
                    <td>{{$item->land_area_val?? '-'}}&nbsp;m&sup2;</td>
                </tr>
                <tr>
                    <th>土地条件</th>
                    <td>
                      @if($item->land_condition1 or $item->land_condition_2 or $item->land_condition3)
                        @if($item->land_condition_area1)
                            傾斜部分&nbsp;{{$item->land_condition_area1}}@if($item->land_condition_unit1==2)m&sup2;@elseif($item->land_condition_unit1==3)％ @endif
                            <br>
                        @endif
                        @if($item->land_condition_area2)
                            路地上部分&nbsp;{{$item->land_condition_area2}}@if($item->land_condition_unit2==2)m&sup2;@elseif($item->land_condition_unit2==3)％@endif
                            <br>
                        @endif
                        @if($item->land_condition_area3)
                            高圧線下{{$item->land_condition_area3}}m&sup2;
                        @endif
                      @else
                      -
                      @endif
                    </td>
                </tr>
                <tr>
                    <th>引渡し</th>
                    <td>
                        @php
                            $propertyArticleLand = [1,2,3];
                            $isArticleLand = in_array($item->property, $propertyArticleLand);
                        @endphp
                            @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>
                <tr>
                    <th>再建築</th>
                    <td>
                      @if($item->land_not==1)
                        再建築不可
                      @else
                        -
                      @endif
                    </td>
                </tr>
                @if($item->property == 1 || $item->property == 2 || $item->property == 3)
                <tr>
                  <th>現況</th>
                  <td>
                    {{getCurrentStatusName($item->current_status)}}
                    @if($item->current_status==3)
                    @if($item->comp_year)
                    （造成工事完了予定年月：{{$item->comp_year}}年
                    @if($item->comp_month){{$item->comp_month}}月@endif
                    ）
                    @endif
                    @endif
                  </td>
                </tr>
                <tr>
                  <th>建築条件</th>
                  <td>
                    {{$item->getLanConditionName()}}
                    @if($item->land_condition==1)
                    @if($item->land_condition_not==1)
                    （条件外し：可）
                    @endif
                    @if($item->building_plan_place or $item->building_plan_area)
                    <br />【建物プラン】
                    @if($item->building_plan_place)建物価格：{{number_format($item->building_plan_place, 0, ",", ",")}}万円@endif
                    @if($item->building_plan_area)建物面積：{{$item->building_plan_area}}m²@endif
                    @endif
                    @endif
                  </td>
                </tr>
                @endif
                <tr>
                  <th>地目</th>
                  <td>{{$item->getGroundName()}}</td>
                </tr>
                <tr>
                  <th>私道負担</th>
                  <td>{{ $item->getRoadBurdenName() }}</td>
                </tr>
                <tr>
                  <th>地役権</th>
                  <td>{{$item->getEasement()}}</td>
                </tr>
                <tr>
                  <th>接道</th>
                  <td>@if($item->getLanDirectionName()){!! $item->getLanDirectionName() !!}@else-@endif</td>
                </tr>
                @if($item->property == 1 || $item->property == 2 || $item->property == 3 || $item->property == 4 || $item->property == 5)
                <tr>
                  <th>上水道</th>
                  <td>{{getWaterSupplyName($item->water_supply)}}</td>
                </tr>
                <tr>
                  <th>下水道</th>
                  <td>{{$item->getSewerageName()}}</td>
                </tr>
                @endif
                <tr>
                  <th>ガス・オール電化</th>
                  @if (empty($mansion))
                      <td>{{ $item->getGasName() }}</td>
                  @else
                      <td>{{ $mansion->getGasName() }}</td>
                  @endif
                </tr>
                @if($item->property == 1 || $item->property == 2 || $item->property == 3)
                <tr>
                  <th>車庫</th>
                  <td>{{$item->garage == 1 ? '掘込車庫' : '-'}}</td>
                </tr>
                @endif
                <tr>
                  <th>セットバック</th>
                  <td>{{$item->getSetPropName()}}</td>
                </tr>
                @endif
                @if($item->property != null)
                <tr>
                    <th>建ぺい率</th>
                    <td>{{intval($item->building_rate)?? '-'}}%</td>
                </tr>
                <tr>
                    <th>容積率</th>
                    <td>{{intval($item->volume_rate)?? '-'}}%</td>
                </tr>
                @endif
                <tr>
                    <th>用途地域</th>
                    <td>
                        <!--{{ Config::get('const.USE_AREA_NAME')[$item->use_area_name] ?? '-' }}@if($item->use_area_name != "" || $item->use_area_name != null)
                            <br> @endif
                        @if($item->use_area_name_sub != "" && $item->use_area_name_sub != "その他")
                            一部 {{ Config::get('const.USE_AREA_NAME')[$item->use_area_name_sub] ?? "" }}を含む<br>
                        @endif
                        @if($item->use_area_name_sub2 != "" && $item->use_area_name_sub2 != "その他")
                            一部 {{ Config::get('const.USE_AREA_NAME')[$item->use_area_name_sub2] ?? "" }}を含む<br>
                        @endif-->
                        {{$item->use_area_name??'-'}}@if($item->use_area_name != "" || $item->use_area_name != null)
                            <br> @endif
                        @if($item->use_area_name_sub != "")
                            一部 {{$item->use_area_name_sub}}を含む<br>
                        @endif
                        @if($item->use_area_name_sub2 != "")
                            一部 {{$item->use_area_name_sub2}}を含む<br>
                        @endif
                    </td>
                </tr>
                <tr>
                    <th>都市計画</th>
                    <td>
                        @if ($dataLand->city_plan == 2)
                            {{ $dataLand->getCityPlanName() }}<br>
                            建築許可理由 {{ $dataLand->getCityPlanReasonName() }}
                        @else
                            {{ $dataLand->getCityPlanName() }}
                        @endif
                    </td>
                </tr>
                @if($item->property == 1 || $item->property == 2 || $item->property == 3)
                <tr>
                    <th>総区画数</th>
                    <td>
                        {{$item->section?? '-'}}区画
                    </td>
                </tr>
                @endif
                @if (! is_null($item->property))
                      <tr>
                          <th>
                              <div class="search_target_title">土地備考</div>
                          </th>
                          <td>{{ $item->land_note ?? "-"}}</td>
                      </tr>
                  @endif
            </table>
            @if($item->property == 4 || $item->property == 5)
                <h4>建物情報</h4>
                <table>
                <tr>
                    <th>建物面積</th>
                    <td>{{$item->total_area_val?? '-'}}&nbsp;m&sup2;</td>
                </tr>
                <tr>
                    <th>建物条件</th>
                    <td>{!! $item->getBuildingCondition() !!}</td>
                </tr>
                <tr>
                    <th>間取り</th>
                    <td>{{$item->getFloorPlan()}}</td>
                </tr>
                <tr>
                    <th>総戸数</th>
                    <td>{{$item->total_unit}}戸</td>
                </tr>
                <tr>
                    @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?? "-"}}月{{$item->completed_text??''}}</td>
                    @else
                        <th>築年月</th>
                        <td>{{$item->age_year?? "-"}}年{{$item->age_month?? "-"}}月{{$item->completed_text??''}}</td>
                    @endif
{{--                    <th>築年月（完成時期）</th>--}}
{{--                    <td>{{$item->age_year}}年{{$item->age_month}}月</td>--}}
                </tr>
                <tr>
                    <th>引渡し</th>
                    <td>
                        @php
                            $deliveryNames = ['未選択', '即', '相談', '指定有'];
                            echo isset($deliveryNames[$item->land_delivery]) ? $deliveryNames[$item->land_delivery] : '-';
                        @endphp
                        @if($item->move_in_conditions)／{{$item->move_in_conditions}}@endif
                    </td>
                </tr>
                <tr>
                    <th>現況</th>
                    <td>
                      {{getCurrentStatusName($item->current_status)}}
                      @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>
                </tr>
                <tr>
                    <th>構造</th>
                    <td>
                        {{$item->construction_name}}
                        @if($item->construction_sub_name != "")・一部{{$item->construction_sub_name}}@endif
                    </td>
                </tr>
                <tr>
                    <th>階数</th>
                    <td>
                      @if($item->underground)
                        地上{{$item->floor ? $item->floor.'階' : ''}}地下{{$item->underground ? $item->underground.'階' : ''}}建
                      @else
                        {{$item->floor ? $item->floor.'階' : ''}}建
                      @endif
                    </td>
                </tr>
                <tr>
                    <th>駐車場/可能台数</th>
                    <td>
                        <?php
                            $parNames = ['未設定', '無'];
                            $parNames[8] = '掘込車庫';
                            $parNames[9] = '車庫';
                            $parNames[10] = '地下車庫';
                            $parNames[11] = 'カースペース';
                            $parNames[12] = 'カーポート';
                        ?>
                        @if($item->parking != null)
                            {{$parNames[$item->parking] ?? ''}}{{ !empty($item->parking_num) ? '/'.$item->parking_num.'台' : '' }}
                        @else
                            -
                        @endif
                    </td>
                </tr>
                <tr>
                    <th>建築確認番号</th>
                    <td>{{$item->architecture_no ?? '-'}}</td>
                </tr>
                <tr>
                    <th>リフォーム（外装）</th>
                    <td>
                        {!! $item->getExteriorHTML() !!}
                    </td>
                </tr>
                <tr>
                    <th>リフォーム（内装）</th>
                    <td>
                        {!! $item->getInteriorHTML() !!}
                    </td>
                </tr>
                @if (strpos(request()->url(), route('business-for-sale-detail', $item->building_id)) !== false || strpos(request()->url(), route('business-close-detail', $item->building_id)) !== false)
                    @if (! in_array($item->property, [1, 2, 3]))
                        <tr>
                            <th>建物備考</th>
                            <td>{{ $item->build_note ?? "-"}}</td>
                        </tr>
                    @endif
                @endif
                </table>
            @endif
            {{--   Tao nha biet thu         --}}
            @if($item->property == 6 || $item->property == 7 || $item->property == null)
                <h4>マンション建物情報</h4>
                <table>
                    <tr>
                        <th>専有面積</th>
                        <td>{{$item->total_area_val}}&nbsp;m&sup2;</td>
                    </tr>
                    <tr>
                        <th>間取り</th>
                        <td>{{$item->floor_plan}}{{$item->floor_plan_name}}</td>
                    </tr>
                    @if($item->property != null)
                        <tr>
                            <th>LDK</th>
                            <td>{{$item->original4 == 1 ? 'はい' : '番号'}}</td>
                        </tr>
                    @endif
                    <tr>
                        <th>バルコニー面積</th>
                        <td>@if($item->balcony_direction){{ $item->getDirectionName($item->balcony_direction) }}向き @endif{{$item->balcony_area_val??'-'}}&nbsp;m&sup2;</td>
                    </tr>
                    <tr>
                        <th>ルーフバルコニー面積</th>
                        <td>
                            @if($item->loof_balcony_area_val)
                                {{$item->loof_balcony_area_val}}&nbsp;m&sup2;
                                （{{number_format($item->loof_balcony_area_cost, 0, ",", ",")}}円／{{ $item->loof_balcony_area_unit == 1 ? "月" : "年" }}）
                            @else
                                -
                            @endif
                        </td>
                    </tr>
                    <tr>
                        <th>専用庭面積</th>
                        <td>
                            @if($item->garden_area_val)
                                {{$item->garden_area_val}}&nbsp;m&sup2;
                                （{{number_format($item->garden_area_cost, 0, ",", ",")}}円／{{ $item->garden_area_unit == 1 ? "月" : "年" }}）
                            @else
                                -
                            @endif
                        </td>
                    </tr>
                    <tr>
                        <th>テラス面積</th>
                        <td>
                            @if($item->terrace_area_val)
                                <!--{{ $item->getDirectionName($item->terrace_direction) }} -->{{$item->terrace_area_val}}&nbsp;m&sup2;
                                （{{number_format($item->terrace_area_cost, 0, ",", ",")}}円／{{ $item->terrace_area_unit == 1 ? "月" : "年" }}）
                            @else
                                -
                            @endif
                        </td>
                    </tr>
                    <tr>
                        <th>引渡し</th>
{{--                        入居予定--}}
                        <td>
                            @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>
                    <tr>
                        <th>階数</th>
                        <td>
                          @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>リフォーム（内装）</th>
                        <td>{{$item->getInteriorText()}}</td>
                    </tr>
                    <tr>
                        <th>総戸数</th>
                        <td>{{$item->total_unit}}戸</td>
                    </tr>
                    <tr>
{{--                        <th>築年月</th>--}}
{{--                        @if (empty($mansion))--}}
{{--                            <td>{{$item->age_year}}年{{$item->age_month}}月</td>--}}
{{--                        @else--}}
{{--                            <td>{{$mansion->age_year}}年{{  $mansion->age_month }}月</td>--}}
{{--                        @endif--}}
                        @if (empty($mansion))
                            @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
                        @else
                            @if($mansion->age_year == null && $mansion->age_month == null)
                                <th>築年月</th>
                                <td>-</td>
                            @elseif($mansion->age_year > date("Y") || ($mansion->age_year == date("Y") && $mansion->age_month >= date("m") ))
                                <th>完成予定</th>
                                <td>{{$mansion->age_year?? "-"}}年{{$mansion->age_month?? "-"}}月</td>
                            @else
                                <th>築年月</th>
                                <td>{{$mansion->age_year?? "-"}}年{{$mansion->age_month?? "-"}}月</td>
                            @endif
                        @endif
                    </tr>
                    <tr>
                        <th>構造</th>
                        <td>
                            {{$item->construction_name}}
                            @if($item->construction_sub_name != "")・一部{{$item->construction_sub_name}}@endif
                        </td>
                    </tr>
                    <tr>
                        <th>敷地面積</th>
                        <td>{{$item->land_area_val}}&nbsp;m&sup2;</td>
                    </tr>
                    <tr>
                        <th>分譲会社</th>
                        @if (empty($mansion))
                            <td>{{ $item->sales_company }}</td>
                        @else
                            <td>{{ $mansion->sales_company }}</td>
                        @endif
                    </tr>
                    <tr>
                        <th>施工会社</th>
                        @if (empty($mansion))
                            <td>{{ $item->construction_company }}</td>
                        @else
                            <td>{{ $mansion->construction_company }}</td>
                        @endif
                    </tr>
                    <tr>
                        <th>管理会社</th>
                        @if (empty($mansion))
                            <td>@if($item->management_company){{$item->management_company}}@else-@endif</td>
                        @else
                            <td>@if($mansion->management_company){{$mansion->management_company}}@else-@endif</td>
                        @endif
                    </tr>
                    <tr>
                        <th>管理形態</th>
                        <td>@if($item->management_name){{$item->management_name}}@else-@endif</td>
                    </tr>
                    <tr>
                        <th>共用部</th>
                        <td>{{$item->shared_text}}</td>
                    </tr>
                    <tr>
                        <th>ペット飼育</th>
                        <td>
                            <?php
                            if($item->pet != null) {
                                $pNames = ['未設定', '不可', '可', '相談'];
                                echo $pNames[$item->pet] ?? '';
                            }
                            if($item->pet_num){
                              echo '（'.$item->pet_num.'匹）<br />※匹数をお客様にお伝えする際には、管理規約を確認してください。';
                            }
                            ?>
                        </td>
                    </tr>

                    {{--  add on line 40  --}}
                    <tr>
                        <th>現況</th>
                        <td>
                          {{getCurrentStatusName($item->current_status)}}
                          @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>
                    </tr>
                    <tr>
                        <th>ガス・オール電化</th>
                        @if (empty($mansion))
                            <td>{{ $item->getGasName() }}</td>
                        @else
                            <td>{{ $mansion->getGasName() }}</td>
                        @endif
                    </tr>
                    {{--  end add more --}}
                    @if (strpos(request()->url(), route('business-for-sale-detail', $item->building_id)) !== false || strpos(request()->url(), route('business-close-detail', $item->building_id)) !== false)
                        <tr>
                            <th>建物備考</th>
                            <td>{{ $item->build_note ?? "-"}}</td>
                        </tr>
                    @endif
                </table>
            @endif
            <!--<h4>周辺施設</h4>
            <table>
              <tr>
                  <th>施設</th>
                  <td>
                      @if(!$relation_facilities->isEmpty())
                          @foreach($relation_facilities as $facility)
                              施設　徒歩{{ $facility->time ?? '-' }}分（約{{ $facility->distance ?? '-' }}m)
                              {!! !$loop->last ? '<br>' : null !!}
                          @endforeach
                      @else
                          -
                      @endif
                  </td>
              </tr>
            </table>-->
            <h4>投資・事業用</h4>
            <table>
                <tr>
                    <th>区分</th>
                    <td>
                      @if($item->classfication == 1)
                      居住用
                      @elseif($item->classfication == 2)
                      事業用
                      @else
                      投資用
                      @endif
                      </td>
                </tr>
                @if($item->classfication != 1)
                @if($item->property == 4 || $item->property == 5)
                <tr>
                    <th>売買区分</th>
                    <td>
                        @if($item->classfication == 1)
                            -
                        @else
                           {{$item->trading_classfication == 1 ? '一棟売' : '一括売'}}
                        @endif
                    </td>
                </tr>
                @elseif(empty($item->property))
                <tr>
                    <th>売買区分</th>
                    <td>
                        @if($item->classfication == 1)
                            -
                        @else
                           {{$item->trading_classfication == 1 ? '一室売' : '一括売'}}
                        @endif
                    </td>
                </tr>
                @endif
                @if($item->classfication == 2)
                <tr>
                    <th>事業用用途</th>
                    <td>
                        @if($item->classfication == 1 || $item->classfication == 3)
                            -
                        @else
                            {{!empty($item->use_method) && $item->classfication == 2 ? $item->getUserMethod() : '-'}}
                        @endif
                    </td>
                </tr>
                @if($item->property != 1 and $item->property != 2 and $item->property != 3)
                <tr>
                    <th>事業用引渡し状態</th>
                    <td>
                        @if(false)
                            -
                        @else
                            @php
                                $names = ['-', '造作譲渡あり', '造作譲渡なし', '設備無償譲渡', 'スケルトン渡し'];
                                echo $names[$item->business_status] ?? '';
                            @endphp
                        @endif
                    </td>
                </tr>
                @endif
                @endif
                @if($item->classfication == 3)
                <tr>
                    <th>投資用現況</th>
                    <td>
                      @php
                        echo $item->getInvestmentPerformance();
                      @endphp
                        <!--
                        @if($item->investment_performance)
                        <br />投資用収入実績：{{number_format($item->investment_performance, 0, ",", ",")}}円/{{ $item->investment_performance_unit == 1 ? "月" : "年" }}
                        @endif
                        @if($item->investment_interest)
                        <br />投資用年利回り：{{$item->investment_interest}}%
                        @endif
                      -->
                    </td>
                </tr>
                @endif
                @endif
            </table>

            <h4>イベント</h4>
            <table>
                <tr>
                    <th>カテゴリ</th>
                    <td>{{!empty($item->event_category) ? $item->getEventCategoryName() : '-'}}</td>
                </tr>
                <tr>
                    <th>日程</th>
                    <td>{{!empty($item->event_category) && !empty($item->event_schedule) ? $item->getEventScheduleName() : '-'}}</td>
                </tr>
                <tr>
                    <th>時間</th>
                    <td>
                        @if(!empty($item->from_hour) or $item->to_hour)
                            @if($item->from_hour){{$item->from_hour}}：{{ ($item->from_minute > 9) ? $item->from_minute : '0'.$item->from_minute }}〜@endif
                            @if($item->to_hour){{$item->to_hour}}：{{ ($item->to_minute > 9) ? $item->to_minute : '0'.$item->to_minute }}@endif
                        @else
                            -
                        @endif
                    </td>
                </tr>
                <tr>
                    <th>予約</th>
                    <td>{{ $item->reservation ? '完全予約制' : '-' }}</td>
                </tr>
                <tr>
                    <th>イベント備考</th>
                    <td>{{$item->event_comment ?? "-"}}</td>
                </tr>
            </table>
        </div>
        <div class="clear"></div>
    </div>
</div>
