@extends('mobile.layouts.app')

@section('content')
<div id="search" class="container-fluid">
    <div class="row">
        <div class="col text-center">
            <h3>검색 결과</h3>
            <hr/>
        </div>
    </div>

    <div class="row">
        @if(isset($products['data']))
            @foreach($products['data']['productData'] as $row)
                <div class="col-6 col-sm-4 col-md-3 col-lg-2 col-xxl-2">
                    <figure class="figure">
                        <a href="{{ $row['productUrl'] }}" target="_blank">
                            <img src="{{ $row['productImage'] }}" class="figure-img img-fluid rounded" alt="{{ $row['productName'] }}"/>
                        </a>
                        <figcaption class="figure-caption">
                            <a href="{{ $row['productUrl'] }}" target="_blank">{{ $row['productName'] }}</a>
                        </figcaption>
                        <p>{{ number_format($row['productPrice']) }} <small>원</small></p>
                        <div class="row g-2">
                            @if($row['isRocket'])
                            <div class="col-auto">
                                <span class="badge text-bg-info text-light">
                                    <i class="bi bi-rocket-takeoff"></i> 로켓배송
                                </span>
                            </div>
                            @endif
                            @if($row['isFreeShipping'])
                            <div class="col-auto">
                                <span class="badge text-bg-warning">
                                    <i class="bi bi-truck"></i> 무료배송
                                </span>
                            </div>
                            @endif
                        </div>
                    </figure>
                </div>
            @endforeach
        @else
            <div class="col p-5 text-center">
                조회 결과가 없습니다.
            </div>
        @endif
    </div>
</div>
@endsection
