<?php
$ad_conf = [
    ['code' => 0, 'name' => ''],
    ['code' => 1, 'name' => '未'],
    ['code' => 2, 'name' => '可'],
    ['code' => 3, 'name' => '不可'],
];
?>


<?php $__env->startSection('contents'); ?>

<div class="mt5">
    <?php echo $__env->make('admin.objects.components.regist-tab-mansion', ['title' => '物件登録ー分譲地'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
    <?php echo $__env->make('admin.objects.components.regist-band-mansion', ['title' => '分譲地検索'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
    <div class="search_vendor">
        <form method="POST" action="<?php echo e(route('search-lot',request()->only(['address1','address2','address3','aText']))); ?>">
        <?php echo e(csrf_field()); ?>

        <div>
            <?php echo $__env->make('admin.objects.components.hidden', ['name' => 'property', 'value' => 99], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
        <dl class="d-flex search_vendor__con justify-content-center">
            <dt>分譲地名</dt>
            <dd><?php echo $__env->make('admin.objects.components.input', ['name' => 'name', 'class' => 'w125', 'value' => $search['name']?? ''], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?></dd>
            <dt>分譲地番号</dt>
            <dd><?php echo $__env->make('admin.objects.components.input', ['name' => 'id', 'class' => 'w175', 'value' => $search['id']?? ''], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?></dd>
        </dl>
        <dl class="d-flex search_vendor__con justify-content-center">
            <dt>所在地</dt>
            <dd class="top-lot-address-select">
            <?php echo $__env->make('admin.objects.components.selectbox', ['name' => 'address1', 'class' => 'mb-2', 'options' => $pref, 'title' => '都道府県', 'selected' => Config::get('const.DEFAULT_PREF')], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
            <?php echo $__env->make('admin.objects.components.selectbox', ['name' => 'address2', 'class' => 'mb-2', 'options' => $city, 'title' => '市区郡', 'selected' => $search['address2']?? ''], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
            <?php echo $__env->make('admin.objects.components.selectbox', ['name' => 'address3', 'class' => 'mb-2', 'options' => $town, 'title' => '町村', 'selected' => $search['address3']?? ''], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
            </dd>
        </dl>
        </div>

        <div class="search_vendor__btn">
        <?php echo $__env->make('admin.objects.components.btn', ['title' => '検索', 'class'=> 'btn_search w120'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
        <a href="<?php echo e(route('regist-lot',request()->only(['address1','address2','address3','aText']))); ?>" class="btn_imagesave top-btn-regist w120" >新規登録</a>
        </div>
        </form>
    </div>

</div>
<?php if(isset($list)): ?>
        <div class="lot_list mt10">
            <table class="lot_info">
                <tr>
                    <th class="w150">分譲地番号</th>
                    <th class="w350">分譲地名/総区画数/所在地</th>
                    <th  class=""></th>
                </tr>
                <?php $__currentLoopData = $list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                <tr >
                    <td rowspan="2"><a class="target_link_id" href="<?php echo e(route('showEditLot', ['id' => $row->building_id])); ?>"><?php echo e($row->building_id); ?></a></td>
                    <td><?php echo e($row->name); ?><br><br>
                        <?php echo e($row->address_info); ?>

                    </td>
                    <td>
                        <div class="">
                            <?php echo $__env->make('admin.objects.components.hidden', ['name' => 'lot_id', 'value' => $row->building_id], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                            <div class="d-flex justify-content-between">
                                <?php echo $__env->make('admin.objects.components.link-btn', ['name' => '', 'url' => '/admin/editLot/'.$row['building_id'], 'class' => 'btn_imagesave w200i', 'title' => '分譲地データを編集'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                                <a href="<?php echo e(route('showCopyLand')); ?>?copy=<?php echo e($row->building_id); ?>" class="btn_imagesave w200i" target="_blank">土地を新規登録</a>
                                <a href="<?php echo e(route('showCopyHouse')); ?>?copy=<?php echo e($row->building_id); ?>" class="btn_imagesave w200i" target="_blank">戸建を新規登録</a>
                            </div>
                            <div class="d-flex">
                                <?php echo $__env->make('admin.objects.components.link-btn', ['name' => 'open_table', 'url' => 'javascript:void(0);', 'class' => 'btn_addvendor w200i', 'title' => '物件を見る('.$row->count.')'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="article_td">
                        <table class="article_info">
                            <tr>
                                <th>物件番号</th>
                                <th>物件種別</th>
                                <th>号地</th>
                                <th>価格</th>
                                <th>ステータス</th>
                                <th>土地面積</th>
                                <th>建物面積</th>
                                <th>業者</th>
                                <th>更新日</th>
                                <th><a href="javascript:void(0);" name="close_table" class="close_article_list">閉じる</a></th>
                            </tr>
                            <?php $__currentLoopData = $row->relation_article; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $info): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td>
                                <a class="target_link_id <?php echo e($info->property); ?>" href="
                                <?php if($info->property == null): ?>
                                <?php echo e(route('editRoom', ['mid' => $info->mansion_id, 'id' => $info->building_id])); ?>

                                <?php elseif($info->property == 1): ?>
                                <?php echo e(route('showEditLand', ['id' => $info->building_id])); ?>

                                <?php elseif($info->property == 2): ?>
                                <?php echo e(route('showEditLand', ['id' => $info->building_id])); ?>

                                <?php elseif($info->property == 3): ?>
                                <?php echo e(route('showEditLand', ['id' => $info->building_id])); ?>

                                <?php elseif($info->property == 4): ?>
                                <?php echo e(route('showEditHouse', ['id' => $info->building_id])); ?>

                                <?php elseif($info->property == 5): ?>
                                <?php echo e(route('showEditHouse', ['id' => $info->building_id])); ?>

                                <?php elseif($info->property == 6): ?>
                                <?php echo e(route('editMansion', ['id' => $info->building_id])); ?>

                                <?php elseif($info->property == 7): ?>
                                <?php echo e(route('editMansion', ['id' => $info->building_id])); ?>

                                <?php endif; ?>
                                "><?php echo e($info->building_id); ?></a>
                                </td>
                                <td>
                                <?php if($info->property == 1): ?>
						土地
                    <?php elseif($info->property == 2): ?>
                        土地（借地権）
                    <?php elseif($info->property == 3): ?>
                        土地（底地権）
                    <?php elseif($info->property == 4): ?>
                        戸建
                    <?php elseif($info->property == 5): ?>
                        テラスハウス
                    <?php elseif($info->property == 6): ?>
                        マンション
                    <?php elseif($info->property == 7): ?>
						タウンハウス
					<?php endif; ?>
                                </td>
                                <td><?php echo e($info->name_gouchi); ?></td>
                                <td><?php echo e($info->price); ?>万円</td>
                                <td><?php echo e($info->status_name); ?></td>
                                <td><?php echo e($info->land_area_val); ?>m&sup2;</td>
                                <td><?php echo e($info->total_area_val); ?>m&sup2;</td>
                                <td><?php echo e($info->vendor); ?></td>
                                <td><?php echo e($info->updated_at->format('Y/m/d')); ?></td>
                                <td><div class="d-flex"><?php echo $__env->make('admin.objects.components.link-btn', ['name' => '', 'url' => $info->url, 'class' => 'edit_building_btn', 'title' => '編集', 'blank' => true], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?></div></td>
                            </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </table>
                    </td>
                </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </table>
        </div>
    <?php endif; ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('footer-script'); ?>
    <script>
        $(document).ready(function () {
            window.ADD_EDIT.initAdminTopLotAddressEvent()
        })
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.base', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>