@extends('views.layouts.master')

<link rel="stylesheet" href="{{ csset('/themes/pro/modunawa/resources/css/invoice.css') }}">

@section('content')

    @php
        $sorder = $listType1Book['Book'][0]['Page'][0];
        $sorderBdPage = $listType1Book['Book'][1]['Page'];
    @endphp

<!--=====================================
                    BANNER PART START
        =======================================-->
        <section class="inner-section single-banner" style="background: url(images/single-banner.jpg) no-repeat center;">
            <div class="container">
                <h2>결제완료</h2>
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="index.html">Home</a></li>
                    <!--
					<li class="breadcrumb-item"><a href="shop-4column.html">shop grid</a></li>
                    <li class="breadcrumb-item"><a href="product-video.html">product details</a></li>
                    <li class="breadcrumb-item"><a href="checkout.html">checkout</a></li>
					-->
                    <li class="breadcrumb-item active" aria-current="page">결제완료</li>
                </ol>
            </div>
        </section>
        <!--=====================================
                    BANNER PART END
        =======================================-->


        <!--=====================================
                    INVOICE PART START
        =======================================-->
        <section class="inner-section invoice-part">
            <div class="container">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="alert-info">
							<img src="{{ '/themes/pro/modunawa/resources/images/invoice_img1.png'}}">
                            <p>감사합니다. 결제가 무사히 완료되었습니다.</p>
                        </div>
                    </div>
                    <div class="col-lg-12">
                        <div class="account-card">
                            <div class="account-title">
                                <h4>주문정보</h4>
                            </div>
                            <div class="account-content">
                                <div class="invoice-recieved">
                                    <h6>주문번호 <span>{{ $sorder['C1'] }}</span></h6>
                                    <h6>주문날짜 <span>{{ DataConverter::createFromTimestamp($sorder['C3'], 'Y-m-d') }}</span></h6>
                                    <h6>합계 <span>{{ number_format($sorderCharge['total']) }}원</span></h6>
                                    <h6>결제방법 <span>{{ DataConverter::execute($sorder['C8'], "paymethod('sorder')") }}</span></h6>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-6">
                        <div class="account-card">
                            <div class="account-title">
                                <h4>주문 상세정보</h4>
                            </div>
                            <div class="account-content">
                                <ul class="invoice-details">
                                    <li>
                                        <h6>주문번호</h6>
                                        <p>{{ $sorder['C1'] }}</p>
                                    </li>
                                    <li>
                                        <h6>주문시간</h6>
                                        <p>{{ DataConverter::createFromTimestamp($sorder['C3'], 'Y-m-d H:i:s') }}</p>
                                    </li>
                                    <li>
                                        <h6>배송방법</h6>
                                        <p></p>
                                    </li>
                                    <li>
                                        <h6>연락처</h6>
                                        <p>{{ $sorder['C5'] }}</p>
                                    </li>
                                    <li>
                                        <h6>배송지</h6>
                                        <p>{{ $sorder['C6'] }}</p>
                                    </li>
                                    <li>
                                        <h6>배송사항</h6>
                                        <p>{{ $sorder['C7'] }}</p>
                                    </li>
                                    <li>
                                        <h6>결제방법</h6>
                                        <p>{{ DataConverter::execute($sorder['C8'], "paymethod('sorder')") }} @if ($sorder['C8'] === 'Remit') [{{ $sorder['C10'] }}] @endif</p>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-6">
                        <div class="account-card">
                            <div class="account-title">
                                <h4>결제 정보</h4>
                            </div>
                            <div class="account-content">
                                <ul class="invoice-details">
                                    <li>
                                        <h6>상품합계</h6>
                                        <p>{{ number_format($sorderCharge['sub_total']) }}원</p>
                                    </li>
                                    <li>
                                        <h6>배송비</h6>
                                        <p>{{ number_format($sorder['D7']) }}원</p>
                                    </li>
                                    <li>
                                        <h6>쿠폰사용액</h6>
                                        <p>{{ number_format($sorder['D2']) }}원</p>
                                    </li>
                                    <li>
                                        <h6>할인금액</h6>
                                        <p>{{ number_format($sorder['D4']) }}원</p>
                                    </li>
                                    <li>
                                        <h6>적립금 사용액</h6>
                                        <p>{{ number_format($sorder['D5']) }}원</p>
                                    </li>
                                    <li>
                                        <h6>총 합계<small>(VAT포함)</small></h6>
                                        <p>{{ number_format($sorderCharge['total']) }}원</p>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-12">
                        <div class="table-scroll">
                            <table class="table-list">
                                <thead>
                                    <tr>
                                        <th scope="col">Serial</th>
                                        <th scope="col">Product</th>
                                        <th scope="col">Name</th>
                                        <th scope="col">Price</th>
                                        <th scope="col">brand</th>
                                        <th scope="col">quantity</th>
                                    </tr>
                                </thead>
                                <tbody>
                                @forelse ($sorderBdPage ?? [] as $index => $sorderBd)
                                    <tr>
                                        <td class="table-serial"><h6>{{ $sorderBd['C3'] }}</h6></td>
                                        <td class="table-image"><img src="{{ env('MEDIA_URL') . $sorderBd['C2'] }}" alt="product"></td>
                                        <td class="table-name"><h6>{{ $sorderBd['C4'] }}</h6></td>
                                        <td class="table-price"><h6>{{ number_format($sorderBd['C6']) }}원</h6></td>
                                        <td class="table-brand"><h6>{{ $sorderBd['C5'] }}</h6></td>
                                        <td class="table-quantity"><h6>{{ (int)$sorderBd['C7'] }}</h6></td>
                                    </tr>
                                    @empty
                                        <tr>
                                            <td class="text-center" colspan="7">쇼핑카트가 비어있습니다</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-lg-12 text-center mt-5">
                        <a class="btn btn-inline" href="{{ route('my-page.order-list') }}">
                            <i class="icofont-download"></i>
                            <span>주문내역 보기</span>
                        </a>
                        <div class="back-home">
                            <a href="/">메인으로 가기</a>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!--=====================================
                    INVOICE PART END
        =======================================-->

@endsection
