<tr>
    <th>
        アットホーム入稿用画像<br />（内外観・地図・周辺写真・その他）<br />
        <strong class="@if(count($portal_athome_image)>40) alart @endif">{{ count($portal_athome_image) }}/40枚</strong><br />
        <p class="text-color-red mt10">※画像１は間取図（平面図）を<br />ご登録ください。<br />画像２は外観を推奨しています。</p>
        <p class="kt-color-5 mt10">※「メインに設定」にチェック<br />を入れると、ATBB物件一覧の<br />サムネイルとして使用されます。</p>
        <p class="text-color-red kt-bg-icon mt10">ドラッグ＆ドロップで<br />並べ替えができます</p>
        @if($portal_athome_status == 1)
            <a href="javascript:imageFileUploadPortal({{ $article_id }}, 'all', '', 'athome')" class="modal-open-portal kt-bt kt-bg-4 mt-4">画像をセット（すべて）</a>
        @else
            <button type="button" class="modal-open-portal kt-bt kt-bg-4 mt-4" data-n="3" autocomplete="off">物件画像をセット（すべて）</button>
        @endif
        <button type="button" class="modal-portal-detail kt-bt kt-bg-5 mt-2" data-n="4" autocomplete="off">物件画像をセット（一部）</button>

    </th>
    <td class="athome-images">
        <div id="sortable_article_image" class="p-regist__sorttable portal_image_trash_group">
            @include('admin.objects.components.hidden', ['name' => 'athome_del_photo_id', 'value' => '', 'class' => 'delete_portal_image_input'])
            <div id="image_list_portal" class="row portal_sorttable">
                @php $stt = 0; @endphp
                @foreach($portal_athome_image as $photo)
                    @php $stt++; @endphp
                    <div class="col-2 mt10 mb10 sorttable_item @if($stt>40)line-red @endif">
                        <span class="bg-non-dark position-relative fontsize12 title_number mb10">画像{{ $stt }} <span class="box__status"><input type="radio" @if($photo->status == 1) checked @endif name="status{{ $stt }}" value="1"> メインに設定</span></span>
                        <label class="p-portalupload w-100 file_multiple_label" data-id="{{ $stt }}" for="fileMutilInputAthome{{ $stt }}">
                            <img class="p-img-size" src="{{ $photo->storageLink.'?v='.strtotime(now()) }}">
                            <canvas width="0" height="0"></canvas>
                            <p class="p-imgupload__text">クリックまたは<br>ドラッグ&amp;ドロップ</p>
                            <input id="fileMutilInputAthome{{ $stt }}" type="file" accept="image/png, image/gif, image/jpeg" name="athome_file_input[{{ $stt }}]" class="file_multiple_input d-none">
                            <input type="hidden" name="athome_file_path{{ $stt }}" value="{{ $photo->file_path }}">
                        </label>
                        <div class="w-100 position-relative mt10">
                            <label class="require-portal float-left">必須</label>
                            @include('admin.objects.components.selectbox', ['class'  =>  'w100 position-relative', 'name' => 'athome_property_sub'.$stt, 'options' => $photo_property_athome, 'selected' => selectedPhotoPropertyAthome($photo->facility, $photo->property_sub, $article_property, $photo->type_upload, $photo->mansion)])
                        </div>
                        <div class="w-100 position-relative mt10">
                            @include('admin.objects.components.input', ['name' => 'athome_photo_created_at'.$stt, 'class' => 'cal_picker_maxdate w-100', 'placeholder' => '撮影日', 'value' => \Carbon\Carbon::parse($photo->created_at)->format('Y/m/d')] )
                        </div>
                        @include('admin.objects.components.textarea_house', ['name' => 'athome_photo_comment'.$stt, 'class' => 'img_text mt10 position-relative', 'count' => 50, 'site' => 1, 'placeholder' => '画像コメント', 'value' => $photo->memo])

                        <div class="mt10 w-100">
                            @include('admin.objects.components.hidden', ['name' => 'athome_photo_id'.$stt, 'value' => $photo->id])
                            @include('admin.objects.components.hidden', ['name' => 'athome_facility'.$stt, 'value' => $photo->facility])
                            @include('admin.objects.components.hidden', ['name' => 'athome_order'.$stt, 'value' => '', 'class' => 'portal_order'])
                            @include('admin.objects.components.btn', ['name' => 'athome_del_photo_portal', 'class' => 'btn_imagedel w-100 position-relative delete_portal_image_btn', 'title' => '削除', 'type' => 'button', 'dataPhoto' => $photo->id])
                        </div>
                    </div>
                @endforeach
                @if($stt < 40)
                    @for($j = $stt+1; $j <= 40;$j++)
                        <div class="col-2 mt10 mb10 sorttable_item">
                            <span class="bg-non-dark title_number mb10">画像{{ $j }} <span class="box__status"><input type="radio" name="status{{ $j }}" value="1"> メインに設定</span></span>
                            <label class="p-portalupload w-100 file_multiple_label" data-id="{{ $j }}" for="fileMutilInputAthome{{ $j }}">
                                <canvas width="0" height="0"></canvas>
                                <p class="p-imgupload__text">クリックまたは<br>ドラッグ&amp;ドロップ</p>
                                <input id="fileMutilInputAthome{{ $j }}" type="file" accept="image/png, image/gif, image/jpeg" name="athome_file_input[{{ $j }}]" class="file_multiple_input d-none">
                                <input type="hidden" name="athome_file_path{{ $j }}" value="">
                            </label>

                            <div class="w-100 position-relative mt10">
                                <label class="require-portal float-left">必須</label>
                                @include('admin.objects.components.selectbox', ['class'  =>  'w100 position-relative', 'name' => 'athome_property_sub'.$j, 'options' => $photo_property_athome, 'selected' => ''])
                            </div>
                            <div class="w-100 position-relative mt10">
                                @include('admin.objects.components.input', ['name' => 'athome_photo_created_at'.$j, 'class' => 'cal_picker_maxdate w-100', 'placeholder' => '撮影日'] )
                            </div>
                            @include('admin.objects.components.textarea_house', ['name' => 'athome_photo_comment'.$j, 'class' => 'img_text mt10 position-relative', 'count' => 50, 'site' => 1, 'placeholder' => '画像コメント', 'value' => ''])

                            <div class="mt10 w-100 position-relative">
                                @include('admin.objects.components.hidden', ['name' => 'athome_photo_id'.$j, 'value' => ''])
                                @include('admin.objects.components.hidden', ['name' => 'athome_facility'.$j, 'value' => ''])
                                @include('admin.objects.components.hidden', ['name' => 'athome_order'.$j, 'value' => '', 'class' => 'portal_order'])
                                @include('admin.objects.components.btn', ['name' => 'athome_del_photo_portal', 'class' => 'btn_imagedel w-100', 'title' => '削除', 'type' => 'button'])
                            </div>
                        </div>
                    @endfor
                @endif
            </div>
        </div>
        @if(count($portal_athome_image_del) > 0)
            <div class="button_bar pt-close">
                <a class="p-search-common__collapse-link p-search-common__collapse-link--open" data-toggle="collapse" href="#athome_image_del" role="button" aria-expanded="true" aria-controls="athome_image_del">前回のデータ</a>
            </div>
            <div id="athome_image_del" class="p-regist__sorttable portal_image_delete_group collapse">
                <div id="image_list_portal" class="row portal_sorttable">
                    @php
                        $num_portal_athome = count($portal_athome_image_del) > 40 ? count($portal_athome_image_del) : 40;
                        $stt = $num_portal_athome
                    @endphp
                    @foreach($portal_athome_image_del as $photo)
                        @php $stt++; @endphp
                        <div class="col-2 mt10 mb10 sorttable_item">
                            <span class="bg-non-dark position-relative fontsize12 title_number mb10">画像{{ $stt - $num_portal_athome }} <span class="box__status"><input type="radio" @if($photo->status == 1) checked @endif name="status{{ $stt }}" value="1"> メインに設定</span></span>
                            <label class="p-portalupload w-100 file_multiple_label" data-id="{{ $stt }}" for="fileMutilInputAthome{{ $stt }}">
                                <img class="p-img-size" src="{{ $photo->storageLink }}">
                                <canvas width="0" height="0"></canvas>
                                <p class="p-imgupload__text">クリックまたは<br>ドラッグ&amp;ドロップ</p>
                                <input id="fileMutilInputAthome{{ $stt }}" type="file" accept="image/png, image/gif, image/jpeg" name="athome_file_input[{{ $stt }}]" class="file_multiple_input d-none">
                                <input type="hidden" name="athome_file_path{{ $stt }}" value="{{ $photo->file_path }}">
                            </label>
                            <div class="w-100 position-relative mt10">
                                <label class="require-portal float-left">必須</label>
                                @include('admin.objects.components.selectbox', ['class'  =>  'w100 position-relative', 'name' => 'athome_property_sub'.$stt, 'options' => $photo_property_athome, 'selected' => selectedPhotoPropertyAthome($photo->facility, $photo->property_sub, $article_property, $photo->type_upload, $photo->mansion)])
                            </div>
                            <div class="w-100 position-relative mt10">
                                @include('admin.objects.components.input', ['name' => 'athome_photo_created_at'.$stt, 'class' => 'cal_picker_maxdate w-100', 'placeholder' => '撮影日', 'value'=>\Carbon\Carbon::parse($photo->created_at)->format('Y/m/d')] )
                            </div>
                            @include('admin.objects.components.textarea_house', ['name' => 'athome_photo_comment'.$stt, 'class' => 'img_text mt10 position-relative', 'count' => 50, 'site' => 1, 'placeholder' => '自社HP：100文字まで', 'value' => $photo->memo])

                            <div class="mt10 w-100">
                                @include('admin.objects.components.hidden', ['name' => 'athome_photo_id'.$stt, 'value' => $photo->id, 'class' => 'portal_photo_id'])
                                @include('admin.objects.components.hidden', ['name' => 'athome_facility'.$stt, 'value' => $photo->facility])
                                @include('admin.objects.components.hidden', ['name' => 'athome_order'.$stt, 'value' => '', 'class' => 'portal_order'])
                                @include('admin.objects.components.btn', ['name' => '', 'class' => 'btn_imagedel w-100 position-relative delete_portal_image_btn', 'title' => '削除', 'type' => 'button', 'dataPhoto' => $photo->id])
                            </div>
                        </div>
                    @endforeach
                    <div class="col-4 mt10 mb10 item-center">
                        <a href="javascript:void(0)" class="restore_portal_image_btn saved_del" data-photo="{{ implode(',', $portal_athome_image_del->pluck('id')->toArray()) }}">この内容で上枠内を上書きする</a>
                    </div>
                </div>
            </div>
        @endif
    </td>
</tr>
