{{-- 自社物件シート
    $type : 'for-sale', 'close', 'houses', 'mansion'のいずれかを設定。表示制御に利用。
--}}

@php
    $type = $type ?? 'for-sale';
@endphp


<style>
    .list-inline li {
        display: inline-block;
        margin-right: 10px;
    }

</style>
<div class="p-detail-main-sheet">
  <div class="justify-content-between">
    <div class="p-detail-main-sheet__left fleft">
      <div class="p-detail-main-sheet__left-name justify-content-between">
        <h3>{{$item->article_name}}</h3>
      </div>
      @if($item->sheet_file_type == 2)
      <div class="p-detail-main-sheet__left-box">
        <p class="p-detail-main-sheet__left-catch">{{$item->catchcopy}}</p>
        <ul class="p-detail-main-sheet__left-points">
            <li class="p-detail-main-sheet__left-point">{!! nl2br(e($item->point)) !!}</li>
        </ul>
        <div class="w-100 p-detail-main-sheet__left-imagesbox">
        <ul class="w-100 list-unstyled">
          <li class="p-detail-main-sheet__left-image">
            @if(!empty($item->disp_file))
            <img src="{{url($item->disp_file)}}"/>
            @else
            <img src="{{url('img/noimage2.jpg')}}"/>
            @endif
          </li>
        </ul>
      </div>
<!--        <table class="p-detail-main-sheet__left-etc">
          <tr>
            <th>周辺<br>施設</th>
            <td class="p-detail-main-sheet__left-etc-facility">
              <p></p>
            </td>
            <th>
                おすすめポイント
            </th>
            <td>{{$item->memo1}}</td>
          </tr>
        </table>-->
        <span class="p-detail-main-sheet__left-right">
        @if (empty($mansion) and $item->getLowRestrictionName())
        ■法令上の制限：{{str_replace('<br>',', ',$item->getLowRestrictionName())}}
        @elseif(!empty($mansion) && $mansion->getLowRestrictionName())
        ■法令上の制限：{{str_replace('<br>',', ',$mansion->getLowRestrictionName())}}
        @endif
        @if (empty($mansion) and $item->getOtherRestriction())
        ■その他制限事項：{{str_replace('<br>',', ',$item->getOtherRestriction())}}
        @elseif(!empty($mansion) && $mansion->getOtherRestriction())
        ■その他制限事項：{{str_replace('<br>',', ',$mansion->getOtherRestriction())}}
        @endif
        </span>
        <span class="p-detail-main-sheet__left-right">
          ■図面と現況が異なる場合は、現況優先とします。
        </span>
      </div>
      @else
      <div>
        <div class="w-100 p-detail-main-sheet__left-imagesbox">
        <ul class="w-100 list-unstyled">
          <li class="p-detail-main-sheet__left-image">
          @if(!empty($item->disp_file))
            <div class="p-detail-main-sheet__left-border"><img src="{{url($item->disp_file)}}"/></div>
            @else
            <div class="p-detail-main-sheet__left-noimage">
              <span>No Image</span>
            </div>
            @endif
          </li>
        </ul>
      </div>
      <span class="p-detail-main-sheet__left-right">
        @if (empty($mansion) and $item->getLowRestrictionName())
        ■法令上の制限：{{str_replace('<br>',', ',$item->getLowRestrictionName())}}
        @elseif(!empty($mansion) && $mansion->getLowRestrictionName())
        ■法令上の制限：{{str_replace('<br>',', ',$mansion->getLowRestrictionName())}}
        @endif
        @if (empty($mansion) and $item->getOtherRestriction())
        ■その他制限事項：{{str_replace('<br>',', ',$item->getOtherRestriction())}}
        @elseif(!empty($mansion) && $mansion->getOtherRestriction())
        ■その他制限事項：{{str_replace('<br>',', ',$mansion->getOtherRestriction())}}
        @endif
        </span>
        <span class="p-detail-main-sheet__left-right">
          ■図面と現況が異なる場合は、現況優先とします。
        </span>
      </div>
      @endif
    </div>
    <div class="p-detail-main-sheet__right fright">
      <table class="p-detail-main-sheet__right-tbl">
        <tr>
          <th>所在地</th>
          <td colspan="3" class="clearfix">{{ $item->address_info }}
              @if(!request('action'))
                <a class="ml-2 float-right p-detail-main-sheet__right-tbl-link" target="_blank" href="https://maps.google.co.jp/maps/search/{{ $item->address_info }}">&gt;Googleマップ</a>
              @endif
          </td>
        </tr>
        <tr>
          <th class="p-detail-main-sheet__right-tbl-double">主要交通</th>
          <td colspan="3" class="p-detail-main-sheet__right-tbl-double">
            @include('business.objects.projects.traffic-info-other', ['article' => $item])
          </td>
        </tr>
        <tr>
          <th>総区画数</th>
          <td colspan="3">@if($item->section){{$item->section}}区画@else-@endif</td>
        </tr>
        <!--<tr>
          <th>敷地面積</th>
          <td colspan="3"></td>
        </tr>-->
        <tr>
          <th>地目</th>
          <td colspan="3">@if($item->ground_name){{$item->ground_name}}@else-@endif</td>
        </tr>
        <tr>
          <th>建ぺい率</th>
          <td colspan="3">@if($item->building_rate){{$item->building_rate}}%@else-@endif</td>
        </tr>
        <tr>
          <th>容積率</th>
          <td colspan="3">@if($item->volume_rate){{$item->volume_rate}}%@else-@endif</td>
        </tr>
        <tr>
          <th>地役権</th>
          <td colspan="3">@if($item->easement_name){{$item->easement_name}} {{ ($item->easement != 0 && $item->easement!=1) ? $item->easement_area."m²" : "" }}@else-@endif</td>
        </tr>
        <!--<tr>
          <th>土地権利</th>
          <td colspan="3">@if($item->land_right_name){{$item->land_right_name}}@else-@endif</td>
        </tr>-->
        <tr>
            @php
                $use_area_name_arr = [
                    '1種低層' => '第一種低層専用地域',
                    '2種中高' => '第二種中高層専用地域',
                    '2種住居' => '第二種住居地域',
                    '近隣商業' => '近隣商業地域',
                    '商業' => '商業地域',
                    '準工業' => '準工業地域',
                    '工業' => '工業地域',
                    '工専' => '工業専用地域',
                    '2種低層' => '第二種低層専用地域',
                    '1種中高' => '第一種中高層専用地域',
                    '1種住居' => '第一種住居地域',
                    '準住居' => '準住居地域',
                    '田園住居地域' => '田園住居地域',
                    '無' => '-',
                ];
            @endphp
          <th class="p-detail-main-sheet__right-tbl-double">用途地域</th>
          <td colspan="3" class="p-detail-main-sheet__right-tbl-double">
            @if($item->use_area_name)
            {{ $use_area_name_arr[$item->use_area_name] ?? $item->use_area_name }}
            @if($item->use_area_name_sub != "")
            ・{{ $use_area_name_arr[$item->use_area_name_sub] ?? $item->use_area_name_sub }}
            @endif
            @if($item->use_area_name_sub2 != "")
            ・{{ $use_area_name_arr[$item->use_area_name_sub2] ?? $item->use_area_name_sub2 }}
            @endif
            @else
            -
            @endif
          </td>
        </tr>
        <tr>
          <th>都市計画</th>
          <td colspan="3">
            @if($item->city_plan_name)
              {{$item->city_plan_name}} <br>
              @if ($item->city_plan == 2 and $item->city_plan_reason_name)
                  建築許可理由 {{$item->city_plan_reason_name}}
              @endif
            @else
              -
            @endif
          </td>
        </tr>
        <!--<tr>
          <th>分譲会社</th><td colspan="3">{{$item->sales_company?? '-'}}</td>
        </tr>
        <tr>
          <th>施工会社</th><td colspan="3">{{$item->construction_company?? '-'}}</td>
        </tr>-->
        <!--<tr>
            <th>
               備考
            </th>
            <td colspan="3">@if($item->memo_business){{ $item->memo_business }}@else-@endif</td>
        </tr>-->
<!--        <tr>
          <th>備考1</th>
          <td colspan="3">{{$item->memo1}}</td>
        </tr>
          <tr>
              <th>備考2</th>
              <td colspan="3">{{$item->memo2}}</td>
          </tr>-->
{{--        <tr>--}}
{{--          <th>周辺施設</th>--}}
{{--          <td colspan="3">--}}
{{--              @if(!empty($tem->facilirty_few))--}}
{{--                @foreach($item->facilirty_few as $facility)--}}
{{--                    {{ $facility->name }}&nbsp;徒歩{{$facility->time}}分({{$facility->distance}}m)--}}
{{--                @endforeach--}}
{{--              @else--}}
{{--                ---}}
{{--              @endif--}}
{{--            </td>--}}
{{--          </tr>--}}
<tr>
    <th>開発許可</th>
    <td colspan="3">@if($item->develop_num){{$item->develop_num}}@else-@endif
    </td>
</tr>
<tr>
    <th>設備</th>
    <td colspan="3">
        上水道：{{getWaterSupplyName($item->water_supply)}} ／
        下水道：{{$item->getSewerageName()}} ／
        ガス：{{$item->getGasName()}}
    </td>
</tr>
<tr>
  <th class="p-detail-main-sheet__right-tbl-double">学校区</th>
  <td colspan="3" class="p-detail-main-sheet__right-tbl-double">
    @php
    $primary_school_name=str_replace('学校','',$item->primary_school_name);
    $primary_school_name2=str_replace('学校','',$item->primary_school_name2);
    $primary_school_name3=str_replace('学校','',$item->primary_school_name3);
    $secondary_school_name=str_replace('学校','',$item->secondary_school_name);
    $secondary_school_name2=str_replace('学校','',$item->secondary_school_name2);
    $secondary_school_name3=str_replace('学校','',$item->secondary_school_name3);
    @endphp
    @if(!isset($item->primary_school_name) and !isset($item->secondary_school_name))
    -
    @endif
{{--            {{$item->primary_school_name}} / {{$item->secondary_school_name}}--}}
      @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
  </td>
</tr>
          <tr>
              <td colspan="4" class="p-detail-main-sheet__right-tbl-lot">{{$item->comment ?? '-'}}</td>
          </tr>
      </table>
    </div>
    <div class="clear"></div>
  </div>
  <div class="p-detail-main-sheet__shop">
    <ul class="justify-content-between list-unstyled list-inline">
      <li>
        <p class="p-detail-main-sheet__shop-name">{{ auth()->user()->companyName }}　@if(auth()->user()->company_id!=2){{ $shop->name }}@endif</p>
        <p class="p-detail-main-sheet__shop-address">〒{{$shop->zip??''}}
          <span style="margin-left:10px; float: right; text-align: right;">{{ $shop->address_info }}</span></p>
      </li>
      <li>
        <p class="p-detail-main-sheet__shop-tel">
            TEL.{{$shop->freedial??''}}
        </p>
        <p class="p-detail-main-sheet__shop-subtel">
            @if(auth()->user()->company_id !== 3)
                Tel.{{$shop->tel??'-'}}
            @endif Fax.{{$shop->fax??''}}</p>
      </li>
      <li>
        <p class="p-detail-main-sheet__shop-etc"><?php echo nl2br($shop->obi)??''?></p>
      </li>
      <li class="p-detail-main-sheet__shop-number-type pr-4">
        <p class="mb-1">物件番号：<a href="/admin/editLot/{{$item->building_id}}" target="_blank">{{$item->building_id}}</a></p>
        <!--<p class="">取引態様：{{ !in_array($item->property, [4, 5]) ? '仲介（媒介）' : $manner_name ?? ""}}</p>-->
      </li>
    </ul>
  </div>
</div>

<!--@include("business.objects.components.store-info")-->
