<?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.hp-tab', ['title' => 'HP管理ーお知らせ', 'type' => 'news'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
    <?php echo $__env->make('admin.objects.components.regist-band', ['title' => 'お知らせ一覧'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
    <div class="d-flex justify-content-end">
        <a href="<?php echo e(route('news-regist')); ?>" class="btn_imagesave w120 news_new_btn">新規登録</a>
    </div>
    <div class="news_list">
        <table>
            <tr>
                <th class="w150">写真画像</th>
                <th class="w150">日付/カテゴリ</th>
                <th class="w300">見出し</th>
                <th class="w200">リンク先</th>
                <th class="w125">公開</th>
                <th class=""></th>
            </tr>
            <?php $__currentLoopData = $news; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <tr>
                <td>
                    <?php if(!empty($item->file_path)): ?>
                        <?php if(substr($item->file_path, -4) == '.pdf'): ?>
                            <iframe src="<?php echo e($item->file_path); ?>" width="150" height="150" frameborder="0" marginwidth="0" marginheight="0" scrolling=""  allowfullscreen> </iframe>
                        <?php else: ?>
                            <img src="<?php echo e($item->file_path); ?>" width="150" />
                        <?php endif; ?>
                    <?php else: ?>
                    <img src="<?php echo e(root('img/noimage2.jpg')); ?>" width="150" />
                    <?php endif; ?>

                </td>
                <td><?php echo e($item->news_date); ?>/<?php echo e($item->category_name); ?></td>
                <td><?php echo e($item->news_title); ?></td>
                <td>
                    <?php if($item->news_link == 0): ?>
                    -
                    <?php else: ?>
                        <?php if($item->news_link_target == 1): ?>
                            URL/<br><a href="<?php echo e($item->news_link_target_url); ?>"><?php echo e($item->news_link_target_url); ?></a>
                        <?php else: ?>
                            <?php
                            $target = 'https://www.micnavi.jp'.$item->news_link_target_url;
                            if (auth()->user()->company_id === 3){
                                $target = 'https://www.oneder.jp'.$item->news_link_target_url;
                            }
                            ?>
                            <?php if(!auth()->user()->isOwnerOfSaiKyoto()): ?>
                                新規ページ/<br><a href="<?php echo e($target); ?>"><?php echo e($target); ?></a>
                            <?php endif; ?>
                        <?php endif; ?>
                    <?php endif; ?>
                </td>
                <td class="text-center"><?php echo $__env->make('admin.objects.components.switch-disp', ['name' => 'news_disp', 'checked' => $item->disp], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?></td>
                <td>
                        <?php echo $__env->make('admin.objects.components.hidden', ['name' => 'news_id', 'value' => $item->news_id], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                        <?php echo $__env->make('admin.objects.components.link-btn-nostyle', ['url' => route('news-edit', ['id' => $item->news_id]), 'title' => '編集', 'class' => 'edit_news_btn'], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                        <button class="del_news_btn unset-modal-overlay" name="" data-toggle="modal" data-target="#deleteModal<?php echo e($item->news_id); ?>">削除</button>
                        <form action="<?php echo e(route('news-delete', $item->news_id)); ?>" method="post">
                            <?php echo csrf_field(); ?>
                            <?php echo $__env->make('admin.objects.components.modal_confirm_delete', ['id' => $item->news_id], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                        </form>
                </td>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </table>
    </div>
</div>
<?php $__env->stopSection(); ?>

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