@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'];
            }
        }
    }
@endphp

@extends('business.layouts.print-layout')

@section('print-content')

    <style>
        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_12 li {
            width: 25%;
            overflow: hidden;
        }
        .list_pictures_12 li div {
            position: relative;
            width: 100%;
            border:1px solid #ccc
        }
        .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 img {
            width:auto;
            max-width:100%;
            height:auto;
            max-height:100%;
            margin:auto;
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
        }
        .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;
        }
    </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="mt-4">
        @include('business.objects.components.count-article-print', ['totalArt' => $totalArt ?? ""])
    </div>
    <div class="p-print">
        <div class="p-detail-main-sheet">

            @foreach($result as $key => $val)
                        <h3>{{$val['item']['article_name']}}
                            <!--（{{$val['item']['main_traffic_station']}} 駅）{{$val['item']['property_name']}}-->
                        </h3>
                    <div class="sheet sheet_pictures">
                        @if(count($val['photos']) == 0)
                            <img width="100%" src="{{url('img/noimage2.jpg')}}"/>
                        @else
                            <ul class="pictures list_pictures_{{request('number')}}">
                                @foreach($val['photos'] as $index => $p)
                                    @if($index % request('number') == 0 && $index != 0)
                                        <div class="clear"></div>
                            </ul>
                    </div>
                    <div class="sheet">
                        <ul class="pictures list_pictures_{{request('number')}}">
                            @endif
                            <li>
                                <div><img width="100%" src="{{url($p->disp_file_path)}}"></div>
                            </li>
                            @endforeach
                            @if(isset($photoOutdoor))
                                @foreach($photosOutdoor as $index => $p)
                                    @if($index % request('number') == 0 && $index != 0)
                                        <div class="clear"></div>
                        </ul>
                    </div>
                    <div class="sheet">
                        <ul class="pictures list_pictures_{{request('number')}}">
                            @endif
                            <li>
                                <div><img width="100%" src="{{url($p->disp_file_path)}}"></div>
                            </li>
                            @endforeach
                            @endif
                            <div class="clear"></div>
                        </ul>
                        @endif
                    </div>
            @endforeach
        </div>
    </div>
@endsection
