<input type="hidden" name="" id="url-change-library" value="<?php echo e(route('change.library')); ?>">
<style>
    .action-box {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .action-box .action-btn {
        width: 47%;
        margin: 0;
        padding: 0;
    }

    .action-box .action-btn-pd {
        padding: 0;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

</style>

<div class="p-results-noimage">
    <!--<?php echo $__env->make("admin.objects.components.delete-multi-control", \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>-->
    <?php $__currentLoopData = $article_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <div class="mb-3 mansion-list">
            <table class="p-results-noimage__tbl">
                <tr>
                    <!--<td rowspan="2" style="width: 30px">
                    <input type="checkbox" onclick="clickElementDelete(this)" class="cb-delete" name="article_id[]" value="<?php echo e($item->id); ?>">
                </td>-->
                    <td rowspan="2" class="p-results-noimage__tbl-num-date">
                        <p><span class="p-results-noimage__tbl-number">マンションID</span><br><a
                                href="/admin/editMansion/<?php echo e($item->building_id); ?>"
                                class="target_link_id"><?php echo e($item->building_id); ?></a></p>
                        <p class="mt-1">
                            <?php if($item["room_count"]): ?>
                                <a href="/admin/editMansion/<?php echo e($item->building_id); ?>"
                                   class="p-results-current-condition__panel--btn-delete disp_room_noimage"
                                   name="show_room_btn">売出(<?php echo e($item["room_count"]); ?>) <i class="fa fa-caret-down"></i></a>
                            <?php else: ?>
                                <span class="p-results-current-condition__panel--btn-delete disp_room_noimage">売出(<?php echo e($item["room_count"]); ?>)</span>
                            <?php endif; ?>
                        </p>
                    </td>
                    <th>物件名</th>
                    <td colspan="2" width="20%" class="">
                        <div class="d-flex justify-content-between">
                            <p><?php echo e($item->name); ?></p>
                            <a href="/admin/editMansion/<?php echo e($item->building_id); ?>"
                               class="p-results-noimage__tbl-link-mansion">
                                <img src="../../admin/img/toroku.png">
                            </a>
                        </div>
                    </td>
                    <th>所在地</th>
                    <td colspan="2"><?php echo e($item->address_info); ?></td>
                    <th>築年月</th>
                    <td class="w100"><?php echo e($item->age_year?? "-"); ?>年<?php echo e($item->age_month?? "-"); ?>月</td>
                    <th>校区</th>
                    <td class="w150">
                        <?php if(isset($item->primary_school_name) || isset($item->secondary_school_name)): ?>
                            <?php echo e($item->primary_school_name?? "-"); ?>/<?php echo e($item->secondary_school_name?? "-"); ?>

                        <?php elseif(isset($item->other_primary_school_2) || isset($item->other_secondary_school_2)): ?>
                            <?php if(strlen($item->other_primary_school_2.$item->other_secondary_school_2) >= 18): ?>
                                <?php echo e($item->other_primary_school_2 ?? '-'); ?> <br>
                                / <?php echo e($item->other_secondary_school_2 ?? '-'); ?>

                            <?php else: ?>
                                <?php echo e($item->other_primary_school_2 ?? '-'); ?>/ <?php echo e($item->other_secondary_school_2 ?? '-'); ?>

                            <?php endif; ?>
                        <?php else: ?>
                            -/-
                        <?php endif; ?>
                    </td>
                    <td rowspan="2" style="width: 130px">
      <span class="p-results-noimage__tbl-photo">
        <?php if(!$item->file_count): ?>
              <img src="/admin/img/icon_camera.png" alt="写真"> 外0
          <?php else: ?>
              <img src="/admin/img/icon_camera.png" alt="写真"> 外<?php echo e($item->file_count); ?>

          <?php endif; ?>
      </span>
                        <?php if(auth()->user()->isAdministrator()): ?>
                            <div class="action-box mt-2">
                                <a href="/admin/editMansion/<?php echo e($item->building_id); ?>"
                                   class="edit_btn action-btn action-btn-pd">編集</a>
                                <form action="<?php echo e(route("admin-mansion-delete", $item)); ?>" method="POST"
                                      onsubmit="return submitDelete(this)" class="action-btn">
                                    <?php echo csrf_field(); ?>
                                    <?php echo method_field("DELETE"); ?>
                                    <button class="del_btn w-100 m-0 action-btn-pd">削除</button>
                                </form>
                            </div>
                            <div class="c-switch mt-2">
                                <label class="c-switch__label">
                                    <input type="checkbox" class="c-switch__input library_input" name="library"
                                           value="1"
                                           <?php echo e($item->library == 1 ?  'checked' : ''); ?> mbuilding-id="<?php echo e($item->building_id); ?>">
                                    <span class="c-switch__content"></span>
                                    <span class="c-switch__circle"></span>
                                    <span class="c-switch__text">未公開</span>
                                    <span class="c-switch__textdisp">公開中</span>
                                </label>
                            </div>
                        <?php endif; ?>
                    </td>
                </tr>
                <tr>
                    <th>種別</th>
                    <td colspan="2">
                        <?php if($item->property == 6): ?>
                            <?php if($item->property_sub == 1): ?>
                                新築
                            <?php else: ?>
                                中古
                            <?php endif; ?>
                            マンション
                        <?php elseif($item->property == 7): ?>
                            <?php if($item->property_sub == 1): ?>
                                新築
                            <?php else: ?>
                                中古
                            <?php endif; ?>
                            タウンハウス
                        <?php endif; ?>
                    </td>
                    <th>交通</th>
                    <td colspan="2">
                        <?php echo $__env->make("admin.objects.components.for-sale-traffic", \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                    </td>
                    <th>総戸数</th>
                    <td><?php echo e($item->total_unit?? "-"); ?>戸</td>
                    <th>階数</th>
                    <td><?php echo e($item->floor); ?>階建</td>
                </tr>
            </table>
            <?php $__currentLoopData = $item->room_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $room): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div class="p-mansion-room">
                    <table class="p-mansion-room__tbl">
                        <tr>
                            <td class="p-mansion-room__tbl__w90">物件番号<br/>　
                                <?php echo $__env->make('business.objects.components.link', ['url' => '/admin/editRoom/'.$room->mansion_id.'/'.$room->building_id, 'title' => $room->building_id, 'class' => 'p-form-check__tbl-link-id', 'blank' => '_blank'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                            </td>
                            <th>部屋</th>
                            <td class="p-mansion-room__tbl__w90"><?php echo e($room->room_num?? '-'); ?></td>
                            <th>価格</th>
                            <td class="p-mansion-room__tbl__w120"><?php echo e(number_format($room->price, 0, ",", ",")); ?><span>万円<?php if($room->tax==2): ?>
                                        <br/>（税込）
                                    <?php endif; ?></span></td>
                            <th>専有</th>
                            <td class="p-mansion-room__tbl__w90"><?php echo e($room->total_area_val?? '-'); ?>m&sup2;</td>
                            <th>間取り</th>
                            <td class="p-mansion-room__tbl__w90"><?php echo e($room->floor_plan_text?? '-'); ?></td>
                            <th>階数</th>
                            <td class="p-mansion-room__tbl__w90"><?php if($room->maisonette == 1): ?>
                                    <?php echo e($room->maisonette_from?? '-'); ?>階〜<?php echo e($room->maisonette_to?? '-'); ?>階部分
                                <?php else: ?>
                                    <?php echo e($room->whereabouts?? '-'); ?>階
                                <?php endif; ?></td>
                            <td class="p-mansion-room__tbl__w90"><img src="/admin/img/icon_camera.png"
                                                                      alt="写真">内<?php echo e($room->file_count); ?></td>
                            <td colspan="3">
                                <ul class="p-results-image__li-btns d-flex justify-content-end list-unstyled">
                                    <li>
                                        <?php echo $__env->make('admin.objects.components.circle-btn-mansion',
                                            ['id' => 'btnCheck', 'class' => 'c-circle-btn__check-mansion_noimage', 'linkUrl' => '#',
                                            'img' => '../../admin/img/icon_check.png', 'title' => '確認'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                                    </li>
                                    <li>
                                        <?php echo $__env->make('admin.objects.components.circle-btn-mansion',
                                            ['id' => 'btnDetail'.$item->building_id, 'class' => 'c-circle-btn__detail', 'linkUrl' => '/admin/editRoom/'.$room->mansion_id.'/'.$room->building_id,
                                            'img' => '../../admin/img/toroku.png', 'title' => '編集'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                                    </li>
                                </ul>
                            </td>
                        </tr>
                    </table>

                    <?php
                        $uuid = \Ramsey\Uuid\Uuid::uuid4();
                    ?>
                    
                    <?php echo $__env->make('admin.objects.projects.form-check-mansion', ['data_num' => $uuid, 'history_count' => count($room->history)], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                    <?php echo $__env->make('admin.objects.projects.modal-history', ['history' => $room->history, 'data_num' => $uuid], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
