@php
    $ad_conf = [
//        ['code' => '', 'name' => ''],
        ['code' => 1, 'name' => '未'],
        ['code' => 2, 'name' => '可'],
        ['code' => 3, 'name' => '不可'],
    ];

    $print = [
        ['code' => 1, 'name' => ''],
    ];

    $all_check = [
        ['code' => 1, 'name' => '全件チェック'],
    ];

    $change_price = [
        ['code' => 1, 'name' => '価格変更'],
    ];

@endphp
@php
    $searchArt = true;

    // 並び替えデータ
    $sorts = $sorts ?? [];
    /*
    $sort = new stdClass();
    $sort->name = '新着順';
    $sort->class = 'new';
    array_push($sorts, $sort);

    $sort = new stdClass();
    $sort->name = '新価格';
    $sort->class = 'newprice';
    array_push($sorts, $sort);
    */
    $sort = new stdClass();
    $sort->name = '業者名';
    $sort->class = 'vendor';
    array_push($sorts, $sort);


    $sort = new stdClass();
    $sort->name = '電話番号';
    $sort->class = 'phone_num';
    array_push($sorts, $sort);
    /*
    $sort = new stdClass();
    $sort->name = '物件種別順';
    $sort->class = 'property';
    array_push($sorts, $sort);

    $sort = new stdClass();
    $sort->name = '所在地順';
    $sort->class = 'address';
    array_push($sorts, $sort);

    $sort = new stdClass();
    $sort->name = '沿線・駅順';
    $sort->class = 'line';
    array_push($sorts, $sort);

    $sort = new stdClass();
    $sort->name = '業者順';
    $sort->class = 'vendor';
    array_push($sorts, $sort);
    */

    if(!isset($searchArt)) {
        request()->merge(['url_search' => url()->current()]);
        session(['search_request' => json_encode(request()->all())]);
    }
@endphp
@extends('admin.layouts.base')



@section('contents')
    {{-- 並び替え --}}
    <div class="mt5">
        <input type="hidden" name="" id="url-delete-vendor" value="{{ route('vendor-delete') }}">
        @include('admin.objects.components.vendor-tab', ['title' => '業者管理'])
        @include('admin.objects.components.regist-band', ['title' => '検索一覧'])
        <div class="result_vendor">
            <div class="d-flex justify-content-between pager mt10">
                <div class="m-2"><span class="pager-total">検索結果&nbsp;{{$list->total()}}</span><span>件中&nbsp; {{$first}}〜{{$last}}件表示</span>
                </div>
                <div class="mt-2">{{ $list->appends($params)->links() }}</div>
            </div>
            @include('admin.objects.projects.results-sort', ['sorts' => $sorts, 'multipleSort' => false])
            @include('business.objects.projects.form-to-other', ['action' => route('business-for-sale-detail', ['id' => '']), 'id' => 'link_detail', 'params' => $params])
            <div class="d-flex mb10">
                <div class="pt-3 pl-2">
                    @include('admin.objects.components.checkbox', ['name' => 'all_check_vendor', 'checkbox' => $all_check])
                </div>
                <form method="POST" action="{{ route('vendor-print') }}?{{ http_build_query($params) }}"
                      target="_blank">
                    {{ csrf_field() }}
                    @if(!empty($params))
                        @foreach($params as $key => $vl)
                            <input type="hidden" name="{{ $key }}" value="{{ $vl }}">
                        @endforeach
                    @endif
                    @include('admin.objects.components.btn', ['name' => 'print_fax', 'type' => 'button', 'class' => 'w300i btn_allcheck', 'title' => 'チェックした業者へ一括FAX'])
                    @include('admin.objects.components.hidden', ['name' => 'print_id_list'])
                    @include('admin.objects.components.hidden', ['name' => 'target_shop', 'value' => $search_shop])
                </form>
            </div>
            @foreach($list as $row)
                @if($disp_flag)
                    <table class="p-vendor-list">
                        <tr class="p-vendor-list__headline">
                            <td rowspan="{{count($row->article)+1}}" class="parent_td p-vendor-list__checkarea">
                                @include('admin.objects.components.checkbox', ['name' => 'print', 'checkbox' => $print])
                                @include('admin.objects.components.hidden', ['name' => 'print_id', 'value' => $row->id])
                            </td>
                            <td class="w80">
                                <p>登録数</p>
                                <span><a href="#searchPanel" name="" class="target_link_id p-vendor-list__displink">{{ count($row->article) }}件</a></span>
                            </td>
                            <td class="w80">
                                <p>業者番号</p>
                                <span><a href="/admin/editVendor/{{$row->id}}"
                                         class="target_link_id">{{$row->id}}</a></span>
                            </td>
                            <td class="td_title">業者名</td>
                            <td class="w280">{{$row->name}}</td>
                            <td class="td_title">電話</td>
                            <td class="w150">{{$row->vendor_tel1}}</td>
                            <td class="td_title">FAX</td>
                            <td class="w150">{{$row->vendor_fax}}</td>
                            <td>
                                <div class="d-flex justify-content-center">
                                    <a href="/admin/editVendor/{{$row->id}}" class="edit_vendor_btn "
                                       name="edit_vendor">編集</a>
                                    @if (auth()->user()->isAdministrator())
                                        <button class="del_vendor_btn delete_vendor unset-modal-overlay" name=""
                                                data-toggle="modal" data-target="#deleteModal{{ $row->id }}">削除
                                        </button>
                                        <div class="delete-vendor-item">
                                            @csrf
                                            @include('admin.objects.components.modal_confirm_delete', ['id' => $row->id, 'message' => 'この業者を削除しますがよろしいですか？'])
                                        </div>
                                        {{--                        <form action="{{ route('vendor-delete', $row->id) }}" method="post">--}}
                                        {{--                            @csrf--}}
                                        {{--                            @include('admin.objects.components.modal_confirm_delete', ['id' => $row->id, 'message' => 'この業者を削除しますがよろしいですか？'])--}}
                                        {{--                        </form>--}}
                                    @endif
                                </div>
                            </td>
                        </tr>
                        @foreach($row->article as $article)
                            <tr class="child row-house">
                                <td colspan="9" class="article_list p-0" style="display: none;">
                                    <form>
                                        @include('admin.objects.components.hidden', ['name' => 'article_id', 'value' => $article->building_id])
                                        @include('admin.objects.components.hidden', ['name' => 'vendor_id', 'value' => $row->id])
                                        <table class="p-vendor-list__subtbl">
                                            <tr>
                                                <td rowspan="6" class="w30 p-vendor-list__subtbl-nm">
                                                    <span class="row_iteration">{{$loop->iteration}}</span><br>
                                                </td>
                                                <td rowspan="6" class="w85">
                                                    物件番号<br>
                                                    <a href="
                                    @if($article->property == null)
                                    {{ route('showEditRoom', ['mid' => $article->mansion_id, 'id' => $article->building_id]) }}
                                    @elseif($article->property == 1)
                                    {{ route('showEditLand', ['id' => $article->building_id]) }}
                                    @elseif($article->property == 2)
                                    {{ route('showEditLand', ['id' => $article->building_id]) }}
                                    @elseif($article->property == 3)
                                    {{ route('showEditLand', ['id' => $article->building_id]) }}
                                    @elseif($article->property == 4)
                                    {{ route('showEditHouse', ['id' => $article->building_id]) }}
                                    @elseif($article->property == 5)
                                    {{ route('showEditHouse', ['id' => $article->building_id]) }}
                                    @elseif($article->property == 6)
                                    {{ route('showEditMansion', ['id' => $article->building_id]) }}
                                    @elseif($article->property == 7)
                                    {{ route('showEditMansion', ['id' => $article->building_id]) }}
                                    @endif
                                    " class="target_link_id" target="_blank">{{$article->building_id}}</a><br>
                                                    物件登録日<br>
                                                    <span
                                                        class="p-vendor-list__subtbl__createdtext">{{$article->created_at}}</span>
                                                    <span>{{$article->shop_name}}</span>
                                                    <div class="p-vendor-list__subtbl__savearea_ad">
                                                        <span class="p-vendor-list__subtbl__select">物件確認日</span><br>
                                                        @php $acd = $article->conf_day; @endphp
                                                        @include('admin.objects.components.input', ['name' => 'article_conf_day', 'class' => 'cal_picker w115', 'placeholder' => '0000/00/00', 'value' => $acd])
                                                    </div>
                                                    <input type="button" value="保存" class="p-vendor-list__subtbl__btn">
                                                </td>

                                                <th>物件名</th>
                                                <td class="w220">{{$article->name}}</td>
                                                <th>所在地</th>
                                                <td colspan="2">{{ $article->address_info }}</td>

                                                <th>価格</th>
                                                <td class="w120">{{number_format($article->newPrice, 0, ",", ",")}}万円
                                                </td>
                                                <th>土地</th>
                                                <td class="w120">{{$article->land_area_val}}m&sup2;</td>
                                            </tr>
                                            <tr>
                                                <th>種別</th>
                                                <td>
                                                    @if($article->property == 1)
                                                        土地
                                                    @elseif($article->property == 2)
                                                        土地（借地権）
                                                    @elseif($article->property == 3)
                                                        土地（底地権）
                                                    @elseif($article->property == 4)
                                                        @if($article->property_sub == 1)
                                                            新築一戸建て
                                                        @else
                                                            中古一戸建て
                                                        @endif
                                                    @elseif($article->property == 5)
                                                        @if($article->property_sub == 1)
                                                            新築テラスハウス
                                                        @else
                                                            中古テラスハウス
                                                        @endif
                                                    @elseif(isset($article->mansion) && $article->propertyMansion == 6 && $article->propertySubMansion == 1)
                                                        新築マンション
                                                    @elseif(isset($article->mansion) && $article->propertyMansion == 6 && $article->propertySubMansion == 2)
                                                        中古マンション
                                                    @elseif(isset($article->mansion) && $article->propertyMansion == 7 && $article->propertySubMansion == 1)
                                                        新築タウンハウス
                                                    @elseif(isset($article->mansion) && $article->propertyMansion == 7 && $article->propertySubMansion == 2)
                                                        中古タウンハウス
                                                        {{--                                @elseif($article->property == null)--}}
                                                        {{--                                    マンションー部屋--}}
                                                    @endif
                                                </td>
                                                <th rowspan="2">交通</th>
                                                <td rowspan="2" colspan="2">
                                                    @if(!empty($article->main_traffic_line) and !empty($article->main_traffic_station) and ($article->main_traffic == 1 and $article->main_traffic_time or ($article->main_traffic == 2 and ($article->main_traffic_bus_time or $article->main_traffic_bus_walk))))
                                                        {{$article->main_traffic_line}}
                                                        「{{$article->main_traffic_station}}」駅　
                                                        @if($article->main_traffic == 1)
                                                            徒歩{{$article->main_traffic_time}}分
                                                        @else
                                                            バス{{$article->main_traffic_bus_time}}分
                                                            @if($article->main_traffic_bus)
                                                                「{{$article->main_traffic_bus}}」
                                                            @endif
                                                            停歩{{$article->main_traffic_bus_walk}}分
                                                        @endif
                                                        @if(!empty($article->sub_traffic1_line) and !empty($article->sub_traffic1_station) and ($article->sub_traffic1 == 1 and $article->sub_traffic1_time or ($article->sub_traffic1 == 2 and ($article->sub_traffic1_bus_time or $article->sub_traffic1_bus_walk))))
                                                            <br/>{{$article->sub_traffic1_line}}
                                                            「{{$article->sub_traffic1_station}}」駅　
                                                            @if($article->sub_traffic1 == 1)
                                                                徒歩{{$article->sub_traffic1_time}}分
                                                            @else
                                                                バス{{$article->sub_traffic1_bus_time}}分
                                                                @if($article->sub_traffic1_bus)
                                                                    「{{$article->sub_traffic1_bus}}」
                                                                @endif
                                                                停歩{{$article->sub_traffic1_bus_walk}}分
                                                            @endif
                                                        @endif
                                                        @if(!empty($article->sub_traffic2_line) and !empty($article->sub_traffic2_station) and ($article->sub_traffic2 == 1 and $article->sub_traffic2_time or ($article->sub_traffic2 == 2 and ($article->sub_traffic2_bus_time or $article->sub_traffic2_bus_walk))))
                                                            <br/>{{$article->sub_traffic2_line}}
                                                            「{{$article->sub_traffic2_station}}」駅　
                                                            @if($article->sub_traffic2 == 1)
                                                                徒歩{{$article->sub_traffic2_time}}分
                                                            @else
                                                                バス{{$article->sub_traffic2_bus_time}}分
                                                                @if($article->sub_traffic2_bus)
                                                                    「{{$article->sub_traffic2_bus}}」
                                                                @endif
                                                                停歩{{$article->sub_traffic2_bus_walk}}分
                                                            @endif
                                                        @endif
                                                    @elseif(!empty($article->else_traffic_line) and !empty($article->else_traffic_station) and ($article->else_traffic == 1 and $article->else_traffic_time or ($article->else_traffic == 2 and ($article->else_traffic_bus_time or $article->else_traffic_bus_walk))))
                                                        {{$article->else_traffic_line}}
                                                        「{{$article->else_traffic_station}}」駅　
                                                        @if($article->else_traffic == 1)
                                                            徒歩{{$article->else_traffic_time}}分
                                                        @else
                                                            バス{{$article->else_traffic_bus_time}}分
                                                            @if($article->else_traffic_bus)
                                                                「{{$article->else_traffic_bus}}」
                                                            @endif
                                                            停歩{{$article->else_traffic_bus_walk}}分
                                                        @endif
                                                    @endif
                                                </td>
                                                <th>築年月</th>
                                                <td>
                                                    @if(isset($article->age_year))
                                                        {{$article->age_year}}/{{$article->age_month}}
                                                    @else
                                                        -
                                                    @endif
                                                </td>
                                                <th>延床</th>
                                                <td>
                                                    {{$article->total_area_val?? '-'}}m&sup2;
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>校区</th>
                                                <td>
                                                    @if(isset($article->primary_school_name) || isset($article->secondary_school_name))
                                                        {{$article->primary_school_name?? "-"}}/{{$article->secondary_school_name?? "-"}}
                                                    @elseif(isset($article->other_primary_school_2) || isset($article->other_secondary_school_2))
                                                        {{$article->other_primary_school_2 ?? "-"}}/{{$article->other_secondary_school_2 ?? "-"}}
                                                    @else
                                                        -/-
                                                    @endif
                                                </td>
                                                <th>階数</th>
                                                <td>
                                                    @if($article->property==1 || $article->property==2 || $article->property==3)
                                                        -
                                                    @elseif($article->property==4 || $article->property==5)
                                                        {{$article->floor?? "-"}}階建
                                                    @else
                                                        @if($article->maisonette==1)
                                                            {{$article->maisonette_from ? $article->maisonette_from : ''}}
                                                            〜{{$article->maisonette_to ? $article->maisonette_to : ''}}
                                                        @else
                                                            {{$article->whereabouts?? "-"}}
                                                        @endif
                                                        階/{{$article->floor?? "-"}}階建
                                                    @endif
                                                </td>
                                                <th>間取り</th>
                                                <td>
                                                    @if(isset($article->floor_plan))
                                                        {{$article->floor_plan}}@if($article->floor_plan_type != null)
                                                            {{$floor_type[$article->floor_plan_type]}}
                                                        @endif
                                                    @else
                                                        -
                                                    @endif
                                                </td>
                                            </tr>
                                            <tr class="p-vendor-list__subtbl__savearea">
                                                <td colspan="4" rowspan="2">

                                                    <div class="d-flex">
                                                        <div class="p-vendor-list__subtbl__savearea__ad">
                                                            <span class="p-vendor-list__subtbl__select">チラシ</span><br>
                                                            @include('admin.objects.components.selectbox', ['name' => 'flyer', 'options' => $ad_conf, 'selected' => $article->flyer])
                                                        </div>
                                                        <div class="p-vendor-list__subtbl__savearea__ad">
                                                            <span class="p-vendor-list__subtbl__select">情報誌</span><br>
                                                            @include('admin.objects.components.selectbox', ['name' => 'freepaper', 'options' => $ad_conf, 'selected' => $article->freepaper])
                                                        </div>
                                                        <div class="p-vendor-list__subtbl__savearea__ad">
                                                            <span class="p-vendor-list__subtbl__select">自社HP</span><br>
                                                            @include('admin.objects.components.selectbox', ['name' => 'house_hp', 'options' => $ad_conf, 'selected' => $article->house_hp])
                                                        </div>
                                                        <div class="p-vendor-list__subtbl__savearea__ad">
                                                            <span class="p-vendor-list__subtbl__select">ポータル</span><br>
                                                            @include('admin.objects.components.selectbox', ['name' => 'portal', 'options' => $ad_conf, 'selected' => $article->portal])
                                                        </div>
                                                        <div class="p-vendor-list__subtbl__savearea__ad">
                                                            <span class="p-vendor-list__subtbl__select">現地看板</span><br>
                                                            @include('admin.objects.components.selectbox', ['name' => 'signboard', 'options' => $ad_conf, 'selected' => $article->signboard])
                                                        </div>
                                                        <div class="">
                                                            <span class="p-vendor-list__subtbl__select">確認手法</span><br>
                                                            @include('admin.objects.components.selectbox', ['name' => 'ad_conf', 'options' => $method_conf, 'selected' => $article->ad_conf])
                                                        </div>
                                                        <div>
                                                            <span class="p-vendor-list__subtbl__select">広告確認日</span><br>
                                                            @include('admin.objects.components.input', ['name' => 'ad_conf_day', 'class' => 'cal_picker w115', 'placeholder' => '0000/00/00', 'value' => $article->ad_conf_day])
                                                        </div>
                                                    </div>
                                                </td>
                                                <td class="w125">
                                                    @include('admin.objects.components.input', ['name' => 'charge', 'value' => $article->charge, 'placeholder' => '', 'class' => 'w125','placeholder' => '担当'])
                                                </td>
                                                <td colspan="4">
                                                    @include('admin.objects.components.checkbox', ['name' => 'change_flag', 'checkbox' => [['code' => 1, 'name' => '価格変更', 'data_id' => $article->building_id]]])
                                                    <span class="box-price-history-{{$article->building_id}}"
                                                          style="display: none">
                                        @include('admin.objects.components.input', ['name' => 'change_price', 'placeholder' => '価格変更', 'class' => 'w65' ])万円
                                        @include('admin.objects.components.input', ['name' => 'change_price_date', 'class' => 'cal_picker w115', 'placeholder' => '価格変更日'])
                                                        @include('business.objects.components.link', ['url' => '', 'title' => '履歴('.(count($article->history)?? 0).')',
                                                    'class' => 'modal-open-history p-form-check__tbl-link-history', 'history_count' => count($article->history)?? 0, 'data_num' => $article->id??'', 'history_price_change' => 'room_building_id'])
                                    </span>
                                                </td>
                                            </tr>
                                            <tr class="p-vendor-list__subtbl__savearea">
                                                <td>
                                                    @include('admin.objects.components.selectbox', ['name' => 'manner', 'options' => $manner, 'title' => '取引態様', 'selected' => $article->manner])
                                                </td>
                                                <td colspan="4">
                                                    @include('admin.objects.components.selectbox', ['name' => 'status', 'options' => $statuses, 'selected' => $article->status])
                                                    @include('admin.objects.components.input', ['name' => 'price_closing', 'value' => $article->price_closing, 'placeholder' => '成約価格', 'class' => 'w65', 'value' => $article->price_closing])
                                                    万円
                                                    @include('admin.objects.components.input', ['name' => 'close_date', 'value' => $article->price_closing, 'class' => 'cal_picker w115', 'value' => $article->close_date, 'placeholder' => '成約日'])
                                                </td>
                                            </tr>
                                            <tr>
                                                <th>備考</th>
                                                <td colspan="8">
                                                    @include('admin.objects.components.input', ['name' => 'home_note', 'value' => $article->home_note ,'placeholder' => '備考', 'class' => 'w-100' ])
                                                </td>
                                            </tr>
                                        </table>
                                    </form>
                                    @include('admin.objects.projects.modal-history', ['history' => $article->history, 'data_num' => $article->id])
                                </td>
                            </tr>

                        @endforeach
                    </table>
                @else
                    @if($row->count > 0 && count($row->article)>0)
                        <table class="p-vendor-list">
                            <tr>
                                <td rowspan="{{count($row->article)+1}}" class="parent_td p-vendor-list__checkarea">
                                    @include('admin.objects.components.checkbox', ['name' => 'print', 'checkbox' => $print])
                                    @include('admin.objects.components.hidden', ['name' => 'print_id', 'value' => $row->id])
                                </td>
                                <td class="w80">
                                    <p>登録数</p>
                                    <span><a href="#searchPanel" name="" class="target_link_id p-vendor-list__displink">{{$row->count}}件</a></span>
                                </td>
                                <td class="w80">
                                    <p>業者番号</p>
                                    <span><a href="/admin/editVendor/{{$row->id}}"
                                             class="target_link_id">{{$row->id}}</a></span>
                                </td>
                                <td class="td_title">業者名</td>
                                <td>{{$row->name}}</td>
                                <td class="td_title">電話</td>
                                <td class="w200">{{$row->vendor_tel1}}</td>
                                <td class="td_title">FAX</td>
                                <td class="w200">{{$row->vendor_fax}}</td>
                            </tr>
                            @foreach($row->article as $article)
                                <tr class="child row-house">
                                    <td colspan="8" class="article_list p-0" style="display: none;">
                                        <form>
                                            @include('admin.objects.components.hidden', ['name' => 'article_id', 'value' => $article->building_id])
                                            @include('admin.objects.components.hidden', ['name' => 'vendor_id', 'value' => $row->id])
                                            <table class="p-vendor-list__subtbl">
                                                <tr>
                                                    <td rowspan="6" class="w30 p-vendor-list__subtbl-nm">
                                                        <span class="row_iteration">{{$loop->iteration}}</span><br>
                                                    </td>
                                                    <td rowspan="6" class="w85">
                                                        物件番号<br>
                                                        <a href="
                                    @if($article->property == null)
                                    {{ route('showEditRoom', ['mid' => $article->mansion_id, 'id' => $article->building_id]) }}
                                    @elseif($article->property == 1)
                                    {{ route('showEditLand', ['id' => $article->building_id]) }}
                                    @elseif($article->property == 2)
                                    {{ route('showEditLand', ['id' => $article->building_id]) }}
                                    @elseif($article->property == 3)
                                    {{ route('showEditLand', ['id' => $article->building_id]) }}
                                    @elseif($article->property == 4)
                                    {{ route('showEditHouse', ['id' => $article->building_id]) }}
                                    @elseif($article->property == 5)
                                    {{ route('showEditHouse', ['id' => $article->building_id]) }}
                                    @elseif($article->property == 6)
                                    {{ route('showEditMansion', ['id' => $article->building_id]) }}
                                    @elseif($article->property == 7)
                                    {{ route('showEditMansion', ['id' => $article->building_id]) }}
                                    @endif
                                    " class="target_link_id" target="_blank">{{$article->building_id}}</a><br>
                                                        物件登録日<br>
                                                        <span
                                                            class="p-vendor-list__subtbl__createdtext">{{$article->created_at}}</span>
                                                        <span>{{$article->shop_name}}</span>
                                                        <div class="p-vendor-list__subtbl__savearea_ad">
                                                            物件確認日<br>
                                                            @include('admin.objects.components.input', ['name' => 'article_conf_day', 'class' => 'cal_picker w115', 'placeholder' => '0000/00/00', 'value' => $article->conf_day])
                                                        </div>
                                                        <input type="button" value="保存"
                                                               class="p-vendor-list__subtbl__btn">
                                                    </td>

                                                    <th>物件名</th>
                                                    <td class="w220">{{$article->name}}</td>
                                                    <th>所在地</th>
                                                    <td colspan="2">{{ $article->address_info }}</td>

                                                    <th>価格</th>
                                                    <td class="w120">{{$article->price}}万円</td>
                                                    <th>土地</th>
                                                    <td class="w120">{{$article->land_area_val}}m&sup2;</td>
                                                </tr>
                                                <tr>
                                                    <th>種別</th>
                                                    <td>
                                                        @if($article->property == 1)
                                                            土地
                                                        @elseif($article->property == 2)
                                                            土地（借地権）
                                                        @elseif($article->property == 3)
                                                            土地（底地権）
                                                        @elseif($article->property == 4)
                                                            @if($article->property_sub == 1)
                                                                新築一戸建て
                                                            @else
                                                                中古一戸建て
                                                            @endif
                                                        @elseif($article->property == 5)
                                                            @if($article->property_sub == 1)
                                                                新築テラスハウス
                                                            @else
                                                                中古テラスハウス
                                                            @endif
                                                        @elseif(isset($article->mansion) && $article->propertyMansion == 6 && $article->propertySubMansion == 1)
                                                            新築マンション
                                                        @elseif(isset($article->mansion) && $article->propertyMansion == 6 && $article->propertySubMansion == 2)
                                                            中古マンション
                                                        @elseif(isset($article->mansion) && $article->propertyMansion == 7 && $article->propertySubMansion == 1)
                                                            新築タウンハウス
                                                        @elseif(isset($article->mansion) && $article->propertyMansion == 7 && $article->propertySubMansion == 2)
                                                            中古タウンハウス
                                                            {{--                                @elseif($article->property == null)--}}
                                                            {{--                                    マンションー部屋--}}
                                                        @endif
                                                    </td>
                                                    <th rowspan="2">交通</th>
                                                    <td rowspan="2" colspan="2">
                                                        @if(!empty($article->main_traffic_line) and !empty($article->main_traffic_station) and ($article->main_traffic == 1 and $article->main_traffic_time or ($article->main_traffic == 2 and ($article->main_traffic_bus_time or $article->main_traffic_bus_walk))))
                                                            {{$article->main_traffic_line}}
                                                            「{{$article->main_traffic_station}}」駅　
                                                            @if($article->main_traffic == 1)
                                                                徒歩{{$article->main_traffic_time}}分
                                                            @else
                                                                バス{{$article->main_traffic_bus_time}}分
                                                                @if($article->main_traffic_bus)
                                                                    「{{$article->main_traffic_bus}}」
                                                                @endif
                                                                停歩{{$article->main_traffic_bus_walk}}分
                                                            @endif
                                                            @if(!empty($article->sub_traffic1_line) and !empty($article->sub_traffic1_station) and ($article->sub_traffic1 == 1 and $article->sub_traffic1_time or ($article->sub_traffic1 == 2 and ($article->sub_traffic1_bus_time or $article->sub_traffic1_bus_walk))))
                                                                <br/>{{$article->sub_traffic1_line}}
                                                                「{{$article->sub_traffic1_station}}」駅　
                                                                @if($article->sub_traffic1 == 1)
                                                                    徒歩{{$article->sub_traffic1_time}}分
                                                                @else
                                                                    バス{{$article->sub_traffic1_bus_time}}分
                                                                    @if($article->sub_traffic1_bus)
                                                                        「{{$article->sub_traffic1_bus}}」
                                                                    @endif
                                                                    停歩{{$article->sub_traffic1_bus_walk}}分
                                                                @endif
                                                            @endif
                                                            @if(!empty($article->sub_traffic2_line) and !empty($article->sub_traffic2_station) and ($article->sub_traffic2 == 1 and $article->sub_traffic2_time or ($article->sub_traffic2 == 2 and ($article->sub_traffic2_bus_time or $article->sub_traffic2_bus_walk))))
                                                                <br/>{{$article->sub_traffic2_line}}
                                                                「{{$article->sub_traffic2_station}}」駅　
                                                                @if($article->sub_traffic2 == 1)
                                                                    徒歩{{$article->sub_traffic2_time}}分
                                                                @else
                                                                    バス{{$article->sub_traffic2_bus_time}}分
                                                                    @if($article->sub_traffic2_bus)
                                                                        「{{$article->sub_traffic2_bus}}」
                                                                    @endif
                                                                    停歩{{$article->sub_traffic2_bus_walk}}分
                                                                @endif
                                                            @endif
                                                        @elseif(!empty($article->else_traffic_line) and !empty($article->else_traffic_station) and ($article->else_traffic == 1 and $article->else_traffic_time or ($article->else_traffic == 2 and ($article->else_traffic_bus_time or $article->else_traffic_bus_walk))))
                                                            {{$article->else_traffic_line}}
                                                            「{{$article->else_traffic_station}}」駅　
                                                            @if($article->else_traffic == 1)
                                                                徒歩{{$article->else_traffic_time}}分
                                                            @else
                                                                バス{{$article->else_traffic_bus_time}}分
                                                                @if($article->else_traffic_bus)
                                                                    「{{$article->else_traffic_bus}}」
                                                                @endif
                                                                停歩{{$article->else_traffic_bus_walk}}分
                                                            @endif
                                                        @endif
                                                    </td>
                                                    <th>築年月</th>
                                                    <td>
                                                        @if(isset($article->age_year))
                                                            {{$article->age_year}}/{{$article->age_month}}
                                                        @else
                                                            -
                                                        @endif
                                                    </td>
                                                    <th>延床</th>
                                                    <td>
                                                        {{$article->total_area_val?? '-'}}m&sup2;
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <th>校区</th>
                                                    <td>
                                                        @if(isset($article->primary_school_name) || isset($article->secondary_school_name))
                                                            {{$article->primary_school_name?? "-"}}/{{$article->secondary_school_name?? "-"}}
                                                        @elseif(isset($article->other_primary_school_2) || isset($article->other_secondary_school_2))
                                                            {{$article->other_primary_school_2 ?? "-"}}/{{$article->other_secondary_school_2 ?? "-"}}
                                                        @else
                                                            -/-
                                                        @endif
                                                    </td>
                                                    <th>階数</th>
                                                    <td>
                                                        @if($article->property==1 || $article->property==2 || $article->property==3)
                                                            -
                                                        @elseif($article->property==4 || $article->property==5)
                                                            {{$article->floor?? "-"}}階建
                                                        @else
                                                            @if($article->maisonette==1)
                                                                {{$article->maisonette_from ? $article->maisonette_from : ''}}
                                                                〜{{$article->maisonette_to ? $article->maisonette_to : ''}}
                                                            @else
                                                                {{$article->whereabouts?? "-"}}
                                                            @endif
                                                            階/{{$article->floor?? "-"}}階建
                                                        @endif
                                                    </td>
                                                    <th>間取り</th>
                                                    <td>
                                                        @if(isset($article->floor_plan))
                                                            {{$article->floor_plan}}@if($article->floor_plan_type != null)
                                                                {{$floor_type[$article->floor_plan_type]??'-'}}
                                                            @endif
                                                        @else
                                                            -
                                                        @endif
                                                    </td>
                                                </tr>
                                                <tr class="p-vendor-list__subtbl__savearea">
                                                    <td colspan="4" rowspan="2">

                                                        <div class="d-flex">
                                                            <div class="p-vendor-list__subtbl__savearea__ad">
                                                                <span
                                                                    class="p-vendor-list__subtbl__select">チラシ</span><br>
                                                                @include('admin.objects.components.selectbox', ['name' => 'flyer', 'options' => $ad_conf, 'selected' => $article->flyer])
                                                            </div>
                                                            <div class="p-vendor-list__subtbl__savearea__ad">
                                                                <span
                                                                    class="p-vendor-list__subtbl__select">情報誌</span><br>
                                                                @include('admin.objects.components.selectbox', ['name' => 'freepaper', 'options' => $ad_conf, 'selected' => $article->freepaper])
                                                            </div>
                                                            <div class="p-vendor-list__subtbl__savearea__ad">
                                                                <span
                                                                    class="p-vendor-list__subtbl__select">自社HP</span><br>
                                                                @include('admin.objects.components.selectbox', ['name' => 'house_hp', 'options' => $ad_conf, 'selected' => $article->house_hp])
                                                            </div>
                                                            <div class="p-vendor-list__subtbl__savearea__ad">
                                                                <span
                                                                    class="p-vendor-list__subtbl__select">ポータル</span><br>
                                                                @include('admin.objects.components.selectbox', ['name' => 'portal', 'options' => $ad_conf, 'selected' => $article->portal])
                                                            </div>
                                                            <div class="p-vendor-list__subtbl__savearea__ad">
                                                                <span
                                                                    class="p-vendor-list__subtbl__select">現地看板</span><br>
                                                                @include('admin.objects.components.selectbox', ['name' => 'signboard', 'options' => $ad_conf, 'selected' => $article->signboard])
                                                            </div>
                                                            <div class="">
                                                                <span
                                                                    class="p-vendor-list__subtbl__select">確認手法</span><br>
                                                                @include('admin.objects.components.selectbox', ['name' => 'ad_conf', 'options' => $method_conf, 'selected' => $article->ad_conf])
                                                            </div>
                                                            <div>
                                                                <span class="p-vendor-list__subtbl__select">広告確認日</span><br>
                                                                @include('admin.objects.components.input', ['name' => 'ad_conf_day', 'class' => 'cal_picker w115', 'placeholder' => '0000/00/00', 'value' => $article->ad_conf_day])
                                                            </div>
                                                        </div>
                                                    </td>
                                                    <td class="w125">
                                                        @include('admin.objects.components.input', ['name' => 'charge', 'value' => $article->charge, 'placeholder' => '', 'class' => 'w125'])
                                                    </td>
                                                    <td colspan="4">
                                                        @include('admin.objects.components.checkbox', ['name' => 'change_flag', 'checkbox' => $change_price])
                                                        @include('admin.objects.components.input', ['name' => 'change_price', 'placeholder' => '価格変更', 'class' => 'w65' ])
                                                        万円
                                                        @include('admin.objects.components.input', ['name' => 'change_price_date', 'class' => 'cal_picker w115', 'placeholder' => '価格変更日'])

                                                        @include('business.objects.components.link', ['url' => '', 'title' => '履歴('.(count($article->history)?? 0).')',
                                                              'class' => 'modal-open-history p-form-check__tbl-link-history', 'history_count' => count($article->history)?? 0, 'data_num' => $article->id??'', 'history_price_change' => 'room_building_id'])
                                                    </td>
                                                </tr>
                                                <tr class="p-vendor-list__subtbl__savearea">
                                                    <td>
                                                        @include('admin.objects.components.selectbox', ['name' => 'manner', 'options' => $manner, 'selected' => $article->manner])
                                                    </td>
                                                    <td colspan="4">
                                                        @include('admin.objects.components.selectbox', ['name' => 'status', 'options' => $statuses, 'selected' => $article->status])
                                                        @include('admin.objects.components.input', ['name' => 'price_closing', 'value' => $article->price_closing, 'placeholder' => '成約価格', 'class' => 'w65', 'value' => $article->price_closing])
                                                        万円
                                                        @include('admin.objects.components.input', ['name' => 'close_date', 'value' => $article->price_closing, 'class' => 'cal_picker w115', 'value' => $article->close_date, 'placeholder' => '成約日'])
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <th>備考</th>
                                                    <td colspan="8">
                                                        @include('admin.objects.components.input', ['name' => 'home_note', 'value' => $article->home_note ,'placeholder' => '備考', 'class' => 'w-100' ])
                                                    </td>
                                                </tr>
                                            </table>
                                        </form>
                                        @include('admin.objects.projects.modal-history', ['history' => $article->history, 'data_num' => $article->id])
                                    </td>
                                </tr>
                            @endforeach

                        </table>
                    @endif
                @endif
            @endforeach
            <div class="d-flex justify-content-between pager mt10">
                <div class="m-2"><span class="pager-total">検索結果&nbsp;{{$list->total()}}</span><span>件中&nbsp; {{$first}}〜{{$last}}件表示</span>
                </div>
                <div class="mt-2">{{ $list->appends($params)->links() }}</div>
            </div>
        </div>
    </div>
    @include('admin.objects.projects.modal-message')
@endsection
