<?php
    $is_opended = isset($params['is_opended']) && $params['is_opended'] == '1';

    function outputSelected($val) {
        if($val == 2) {
            return '<span class="round-checked"></span>';
        }
        return '<span class="round-uncheck"></span>';
    }

    function getMannerName($manner, $vendor) {
        foreach ($manner as $m) {
            if($m['code'] == $vendor['manner']) {
                    return $m['name'];
            }
        }
    }
?>



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

    <style>
        @media  all and (max-width: 1366px){
            ul.pictures li div{
                height:100%;
            }
        }

        li.p-detail-main-sheet__left-image:first-child {
            width: calc(100% - 190px);
            float: left;
        }
        li.p-detail-main-sheet__left-image {
            display: inline-block;
            padding: 8px !important;
        }


        .justify-content-between li {
            display: inline-block;
        }

        .p-detail-main-sheet__left-image {
            width: 100% !important;
        }

        .pictures li {
            float: left;
            list-style: none;
            padding: 5px;
            box-sizing: border-box;
        }
        .list_pictures_4 li {
            width: 50%;
            height:auto;
            max-height:50%;
            overflow: hidden;
        }
        .list_pictures_4 li div {
            position: relative;
            width: 90%;
            border:1px solid #ccc;
        }
        .list_pictures_8 li{
            width: calc(100% / 4);
            overflow: hidden;
        }

        .list_pictures_8 li:nth-child(5){
            clear: left;
        }
        .list_pictures_12 li {
            width: 25%;
            overflow: hidden;
        }
        .list_pictures_12 li div {
            position: relative;
            width: 100%;
            border:1px solid #ccc
        }
        .list_pictures_18 li{
            width: calc(100% / 6);
            overflow: hidden;
        }
        .list_pictures_18 li:nth-child(7){
            clear: left;
        }
        .list_pictures_24 li {
            width: 16.6666666667%;
            overflow: hidden;
        }
        .list_pictures_24 li div {
            position: relative;
            width: 100%;
            border:1px solid #ccc
        }
        .list_pictures_0 li{
            margin:10% 25%;
            width: 50%;
            overflow: hidden;
        }
        /*.pictures li div:before {
            content:"";
            display: block;
            padding-top: 66%; !* 高さを幅の66%に固定 *!
        }*/
        .pictures li div{
            text-align: center;
        }
        .pictures li  div img {
            width:auto;
            max-width:100%;
            height:auto;
            max-height:100%;
            margin:auto;
            /* position: absolute; */
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            object-fit: cover;
        }
        .list_pictures_4 li div img {
            height: 280px;
        }
        .list_pictures_8 li div img, .list_pictures_12 li div img {
            height: 150px;
        }

        .list_pictures_18 li div img, .list_pictures_24 li div img {
            height: 95px;
        }
        .sheet {
            padding:9mm 0 0 0;
            width: 251mm;
            height: 177mm;
            margin:0;
            page-break-after: always;
        }
        _::-webkit-full-page-media, _:future, :root .sheet {
            padding-top:0;
        }
        .sheet_pictures {
            padding-top:0;
            width: 251mm;
            height: 165mm;
        }
        .p-print {
            margin:0 auto;
            padding:0;
        }
        h3{
            padding:9mm 0 0 0;
        }
        _::-webkit-full-page-media, _:future, :root h3 {
            padding:0 0 0 0;
        }
        .print_header{
            margin-top: 10px;
        }
        .f-left, .f-right{
            padding:5px 0
        }
    </style>

    <style type="text/css" media="print">
        @page
        {
            size: auto;   /* auto is the initial value */
            margin: 0mm;  /* this affects the margin in the printer settings */
        }
    </style>

    <div class="p-print">
        <div class="print_header">
            <p class="f-left"><b>
                    <?php if(strstr($_SERVER["REQUEST_URI"],'close')): ?>
                        成約物件
                    <?php else: ?>
                        売出物件
                    <?php endif; ?>
                </b></p>
            <?php
            if(!isset($total)){
                if(isset($count)){
                    $total = $count;
                }else{
                    $total = $article_list->total();
                }
            }
            if(isset($hide_items) && !empty($hide_items)){
                $hide_items = count($article_list->whereIn('building_id', $hide_items));
            }else{
                $hide_items = 0;
            }
            ?>
            <?php if(isset($set_count)): ?>
                <p class="f-right"><b>該当件数：1</b></p>
            <?php else: ?>
                <p class="f-right"><b>該当件数：<?php echo e($total - $hide_items); ?></b></p>
            <?php endif; ?>
            <div class="clear"></div>
            <hr>
        </div>
        <div class="p-detail-main-sheet">
            <?php $__currentLoopData = $article_list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <h3><?php echo e($item->article_name); ?><!--（<?php echo e($item->main_traffic_station); ?> 駅）<?php echo e($item->property_name); ?>--><span class="p-detail-summary__price"><?php echo e(number_format($item->price, 0, ",", ",")); ?>万円</span></h3>
                <?php if(count($item->photos) == 0): ?>
                <!--<ul class="pictures list_pictures_0">
                        <li>
                          <div class="p-detail-main-sheet__left-noimage"><span>No Image</span></div>
                        </li>
                    </ul>-->
                <?php else: ?>
                    <div class="sheet sheet_pictures">
                        <ul class="pictures list_pictures_<?php echo e(request('number')); ?> 1">
                        <?php $__currentLoopData = $item->photos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php if($index % request('number') == 0 && $index != 0): ?>
                                <!--<div class="clear"></div>-->
                        </ul>
                    </div>
                    <div class="sheet">
                        <ul class="pictures list_pictures_<?php echo e(request('number')); ?>">
                            <?php endif; ?>
                            <li>
                                <div><img src="<?php echo e(url($p->disp_file_path)); ?>"></div>
                            </li>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <div class="clear"></div>
                        </ul>
                    </div>
                <?php endif; ?>
                <?php if(isset($item->photos_mansion) && !empty($item->photos_mansion) && $item->photos_mansion!='[]'): ?>
                    <div class="sheet
                        <?php if(count($item->photos) == 0): ?>
                            sheet_pictures
<?php endif; ?>
                            ">
                        <ul class="pictures list_pictures_<?php echo e(request('number')); ?> 2">
                            <?php $arrCol = [
                                    4 => 6,
                                    12 => 3,
                                    24 => 2
                                ] ?>
                            <?php $__currentLoopData = $item->photos_mansion; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if($index % request('number') == 0 && $index != 0): ?>
                        </ul>
                    </div>
                    <div class="sheet">
                        <ul class="pictures list_pictures_<?php echo e(request('number')); ?>">
                            <?php endif; ?>
                            <li><div><img style="max-width: 100%" src="<?php echo e(url(str_replace('public', '/storage', $p->file_path))); ?>" /></div></li>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </ul>
                    </div>
                <?php endif; ?>
                <?php if(count($item->photos) == 0 and (!isset($item->photos_mansion) or empty($item->photos_mansion) or $item->photos_mansion=='[]')): ?>
                    <div class="sheet sheet_pictures">
                        <ul class="pictures list_pictures_0">
                            <li>
                                <div class="p-detail-main-sheet__left-noimage"><span>No Image</span></div>
                            </li>
                        </ul>
                    </div>
                <?php endif; ?>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
    </div>
<?php $__env->stopSection(); ?>

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