@php
$ad_conf = [
    ['code' => 0, 'name' => ''],
    ['code' => 1, 'name' => '未'],
    ['code' => 2, 'name' => '可'],
    ['code' => 3, 'name' => '不可'],
];
@endphp
@extends('admin.layouts.base')

@section('contents')

<div class="mt5">
    @include('admin.objects.components.hp-tab', ['title' => '賃貸物件', 'type' => 'lease'])
    @include('admin.objects.components.regist-band', ['title' => '賃貸物件'])
    <p class="mt-3 mb-3 recommend_text float-left">登録数　{{ $leases->count() }}件</p>
    <span class="mt-4 mb-2 d-inline-block p-results-current-condition__panel--title">ドラッグ＆ドロップで並べ替えができます。</span>
    <div class="reform_list" id="lease-page">
        <table id="sortable_lease">
            <thead>
            <tr>
                <th class="w80">No.</th>
                <th class="w200 text-left">物件名 / 物件種別</th>
                <th class="text-left">所在地 / 交通</th>
                <th class="w120">賃料 / 面積</th>
                <th class="w120">公開/非公開</th>
                <th class="w250"></th>
            </tr>
            </thead>
            @foreach($leases as $item)
            <tbody class="@if($loop->iteration % 2 == 0) even @else odd @endif">
            <tr>
                <td align="center" class="rank_td" rowspan="2"><span class="rank">{{$loop->iteration}}</span></td>
                <td>
                    {{ $item->name }}
                </td>
                <td>
                    {{ $item->address }}
                </td>
                <td>
                    <strong style="color: #FF007C; font-weight: 500; font-size: 17px">{{ $item->chinryo/10000 }}</strong>万円
                </td>
                <td rowspan="2" class="text-center">@include('admin.objects.components.switch-disp', ['name' => 'lease_display', 'checked' => $item->display])</td>
                <td rowspan="2">
                        @include('admin.objects.components.hidden', ['name' => 'lease_id', 'value' => $item->id])
                        @include('admin.objects.components.link-btn-nostyle', ['url' => route('lease-edit', ['id' => $item->id]), 'title' => '編集', 'class' => 'edit_news_btn'])
                        <button class="del_news_btn unset-modal-overlay" name="" data-toggle="modal" data-target="#deleteModal{{ $item->id }}">削除</button>
                        <form action="{{ route('lease-delete', $item->id) }}" method="post">
                            @csrf
                            @include('admin.objects.components.modal_confirm_delete', ['id' => $item->id, 'message' => 'この賃貸物件を削除しますがよろしいですか。'])
                        </form>
                </td>
            </tr>
            <tr>
                <td>
                    {{ $item->type }}
                </td>
                <td>
                    {{ $item->main_traffic }}<br />{{ $item->sub_traffic1 }}<br />{{ $item->sub_traffic2 }}
                </td>
                <td>
                    {{ $item->area_val }}㎡
                </td>
            </tr>
            </tbody>
            @endforeach
        </table>
    </div>
</div>
@endsection
@section('footer-script')
    <script src="/admin/js/add-cp3.js"></script>
@endsection
