@extends('admin.layouts.app')
@section('subject') {{ $subject }} @endsection

@section('content')

<div id="configSettingContainer">
    @include('admin.messages')

    <div class="alert alert-info" role="alert">
        한국수출입은행이 제공하는 환율정보입니다.<br/>
        현재 환율을 실시간으로 제공합니다.<br/>
        비영업일의 혹은 영업당일 11시 이전에 해당일의 환율 정보 제공안함.
    </div>

    <div class="search-section">
        <form name="f_admin_search" id="fAdminSearch" action="/admin/exchange" method="get">
            @csrf

            <div class="row g-2">
                <label for="searchDate" class="col-sm-1 col-form-label">검색일</label>
                <div class="col-sm-3">
                    <input type="text" name="search_date" id="searchDate" class="form-control date-picker" value="{{ $searchDate }}" />
                </div>
                <div class="col">
                    <button type="submit" class="btn btn-dark">검색</button>
                </div>
            </div>
        </form>
    </div>

    <div class="row search-section">
        <div class="col">
            <label>전체 : {{ $exchangeRows }}</label>
        </div>
    </div>

    <form name="f_admin_list" id="fAdminList" method="post" enctype="multipart/form-data">
        @csrf
        <div class="table-responsive">
            <table class="table table-hover table-bordered table-nowrap">
                <thead>
                    <tr>
                        <th rowspan="2">통화코드</th>
                        <th rowspan="2">국가/통화명</th>
                        <th colspan="2">전신환(송금)</th>
                        <th rowspan="2">매매 기준율</th>
                        <th rowspan="2">장부 가격</th>
                        <th rowspan="2">년환가료율</th>
                        <th rowspan="2">10일환가료율</th>
                        <th colspan="2">서울외국환중개</th>
                    </tr>
                    <tr>
                        <th>받으실때</th>
                        <th>보내실때</th>
                        <th>매매기준율</th>
                        <th>장부가격</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    if($exchangeRows > 0) {
                        foreach($exchangeList as $exchange) {
                    ?>
                        <tr>
                            <td>{{ $exchange['cur_unit'] }}</td>
                            <td>{{ $exchange['cur_nm'] }}</td>
                            <td>{{ $exchange['ttb'] }}</td>
                            <td>{{ $exchange['tts'] }}</td>
                            <td>{{ $exchange['deal_bas_r'] }}</td>
                            <td>{{ $exchange['bkpr'] }}</td>
                            <td>{{ $exchange['yy_efee_r'] }}</td>
                            <td>{{ $exchange['ten_dd_efee_r'] }}</td>
                            <td>{{ $exchange['kftc_deal_bas_r'] }}</td>
                            <td>{{ $exchange['kftc_bkpr'] }}</td>
                        </tr>
                    <?php } }else{ ?>
                        <tr>
                            <td colspan="10">
                                No data.
                            </td>
                        </tr>
                    <?php } ?>
                </tbody>
            </table>
        </div>
    </form>

</div>

@endsection
