@extends('layouts.app')
@section('title', '[東京都|〇〇駐輪場] 決済トランザクション')
@section('content')
    <div class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-lg-6">
                    <h1 class="m-0 text-dark">{{__('決済トランザクション')}}</h1>
                </div><!-- /.col -->
                <div class="col-lg-6">
                    <ol class="breadcrumb float-sm-right text-sm">
                        <li class="breadcrumb-item"><a href="{{route('home')}}">{{__('ホーム')}}</a></li>
                        <li class="breadcrumb-item active">{{__('決済トランザクション')}}</li>
                    </ol>
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->

    <!-- Main content -->
    <section class="content">
        <div class="container-fluid">
            <!-- SELECT2 EXAMPLE -->


            <div class="row">
                <form action="{{route('settlement_transactions')}}" method='post' id='list-form'>
                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                    <input type="hidden" value="{{$sort}}" name="sort" id="sort">
                    <input type="hidden" value="{{$sort_type}}" name="sort_type" id="sort_type">
                </form>

                <div class="container-fluid mb20">
                    <button type="submit" class="btn btn-sm btn-default mr10" name="delete"
                            id="delete">{{__('削除')}}</button>
                    <button type="submit" class="btn btn-sm btn-default mr10" name="import_csv" id="import_csv" action="{{route('settlement_transactions_import')}}">{{__('インポート')}}</button>
                    <button type="submit" class="btn btn-sm btn-default mr10" name="export_csv" id="export_csv" action="{{route('settlement_transactions_export')}}">{{__('CSV出力')}}</button>
                    {{ $list->appends(['sort' => $sort,'sort_type'=>$sort_type])->links('pagination') }}
                </div>
                <div class="form col-lg-12">
                    @if(Session::has('success'))
                        <div class="alert alert-success alert-dismissible" role="alert">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                            {{ Session::get('success') }}
                        </div>
                    @elseif(Session::has('error'))
                        <div class="alert alert-danger alert-dismissible">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                            <h4><i class="icon fa fa-ban"></i> {{__('誤差')}}:</h4>
                            {!! Session::get('error') !!}
                        </div>
                    @elseif(isset($errorMsg))
                        <div class="alert alert-danger alert-dismissible">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                            <h4><i class="icon fa fa-ban"></i> {{__('誤差')}}:</h4>
                            {!! $errorMsg !!}
                        </div>
                    @endif
                </div>
                <div class="col-lg-12 row sample03-wrapper no_padding_right mb20">
                    <div class="col-xl-2 col-lg-2 col-md-2 col-sm-3 col-xs-3 table_left">
                        <form action="{{route('settlement_transactions_delete')}}" method="post" id="form_delete">
                            <input type="hidden" name="_token" value="{{ csrf_token() }}">
                            <table class="table dataTable">
                                <thead>
                                <tr>
                                    <th>
                                        <input type="checkbox" class="minimal m-0" id="checkbox_all">
                                    </th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $item)
                                    <tr role="row">
                                        <td>
                                            <input type="checkbox" class="minimal m-0 checkbox"
                                                   value="{{$item->settlement_transaction_id}}" name="pk[]">
                                            <div class="btn_action">
                                                {{--<a href="{{route('settlement_transaction_add')}}" class="btn btn-sm btn-default">詳細</a>--}}
                                                <a href="{{route('settlement_transaction_info',['pk'=>$item->settlement_transaction_id])}}"
                                                   class="btn btn-sm btn-default ml10">{{__('編集')}}</a>
                                            </div>
                                        </td>

                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </form>
                    </div>
                    <div class="col-lg-10 col-xl-10 col-md-10 col-sm-9 col-xs-9 table_right no_padding_right">
                        <div class="scroll">
                            <table class="table dataTable">
                                <thead>
                                <tr>
                                    <!-- 決済トランザクションID -->
                                    <th class="sorting @if($sort=="settlement_transaction_id"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="settlement_transaction_id">
                                        <span>{{__('validation.attributes.settlement_transaction_id')}}</span>
                                    </th>
                                    <!-- 定期契約ID -->
                                    <th class="sorting @if($sort=="contract_id"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="contract_id"><span>{{__('validation.attributes.contract_id')}}</span>
                                    </th>
                                    <!-- ステータス -->
                                    <th class="sorting @if($sort=="status"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="status"><span>{{__('validation.attributes.status')}}</span>
                                    </th>
                                    <!-- 支払いコード -->
                                    <th><span>{{__('validation.attributes.pay_code')}}</span>
                                    </th>
                                    <!-- 受付番号 -->
                                    <th><span>{{__('validation.attributes.contract_payment_number')}}</span>
                                    </th>
                                    <!-- 企業コード -->
                                    <th class="sorting @if($sort=="corp_code"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="corp_code"><span>{{__('validation.attributes.corp_code')}}</span>
                                    </th>
                                    <!-- MMS予約照会日時 -->
                                    <th class="sorting @if($sort=="mms_date"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="mms_date"><span>{{__('validation.attributes.mms_date')}}</span>
                                    </th>
                                    <!-- CVS本部コード -->
                                    <th class="sorting @if($sort=="cvs_code"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="cvs_code"><span>{{__('validation.attributes.cvs_code')}}</span>
                                    </th>
                                    <!-- 店舗コード -->
                                    <th class="sorting @if($sort=="shop_code"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="shop_code"><span>{{__('validation.attributes.shop_code')}}</span>
                                    </th>
                                    <!-- 入金日時 -->
                                    <th class="sorting @if($sort=="pay_date"){{$sort_type == 'asc'?'sorting_asc':'sorting_desc'}}@endif"
                                        sort="pay_date"><span>{{__('validation.attributes.pay_date')}}</span>
                                    </th>
                                    <!-- 決済金額 -->
                                    <th><span>{{__('validation.attributes.settlement_amount')}}</span></th>
                                    <!-- 印紙貼付フラグ -->
                                    <th><span>{{__('validation.attributes.stamp_flag')}}</span></th>
                                    <!-- MD5ハッシュ値 -->
                                    <th><span>{{__('validation.attributes.md5_string')}}</span></th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $item)
                                    <tr>
                                        <!-- 決済トランザクションID -->
                                        <td class='sm-item text-left'>
                                            <span>{{mb_substr($item->settlement_transaction_id, 0, 10)}}</span></td>
                                        <!-- 定期契約ID -->
                                        <td class='sm-item text-left'>
                                            <span>{{mb_substr($item->contract_id, 0, 10)}}</span></td>
                                        <!-- ステータス -->
                                        <td class='sm-item text-right'><span>{{mb_substr($item->status, 0, 10)}}</span>
                                        </td>
                                        <!-- 支払いコード -->
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->pay_code, 0, 10)}}</span></td>
                                        <!-- 受付番号 -->
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->contract_payment_number, 0, 10)}}</span></td>
                                        <!-- 企業コード -->
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->corp_code, 0, 10)}}</span></td>
                                        <!-- MMS予約照会日時 -->
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->mms_date, 0, 10)}}</span></td>
                                        <!-- CVS本部コード -->
                                        <td class='sm-item text-right'><span>{{mb_substr($item->cvs_code, 0, 10)}}</span>
                                        </td>
                                        <!-- 店舗コード -->
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->shop_code, 0, 10)}}</span></td>
                                        <!-- 入金日時 -->
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->pay_date, 0, 10)}}</span></td>
                                        <!-- 決済金額 -->
                                        <td class='sm-item text-left'>
                                            <span>{{mb_substr($item->settlement_amount, 0, 10)}}</span></td>
                                        <!-- 印紙貼付フラグ -->
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->stamp_flag, 0, 10)}}</span></td>
                                        <!-- MD5ハッシュ値 -->
                                        <td class='sm-item text-right'>
                                            <span>{{mb_substr($item->md5_string, 0, 10)}}</span></td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

            </div>
            <!-- /.row -->
        </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->

@endsection