@extends('layouts.admin')

@section('content')
    <div class="row">
        <div class="col-md-12 col-sm-12 col-xs-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h1>Client Recurring List</h1>
                </div>
                <div class="panel-body">
                    <div class="row">
                        <form action="{{route('recurring.data') }}" method="post">
                            @csrf
                        <div class="col-md-3 col-xs-12">
                            <div class="form-group">
                                <label>Client Name</label>
                                <input id="clientName"
                                       type="text"
                                       class="form-control" name="clientName" autocomplete="off">

                            </div>
                        </div>
                        <div class="col-md-3 col-xs-12">
                            <div class="form-group">
                                <label>From Date</label>
                                <input id="fdate"
                                       type="text"
                                       class="form-control " name="fdate" autocomplete="off">
                            </div>
                        </div>
                        <div class="col-md-3 col-xs-12">
                            <div class="form-group">
                                <label>To Date</label>
                                <input id="tdate"
                                       type="text"
                                       class="form-control" name="tdate" autocomplete="off">
                            </div>
                        </div>
                        <div class="col-md-3 col-xs-12">
                            <div class="form-group" style="margin-top: 25px;">
                               <button class="btn btn-outline-info" type="submit">Search</button>
                            </div>
                        </div>
                        </form>
                    </div>
                    <hr/>
                    <div class="row">
                        <div class="col-md-12 col-sm-12 col-xs-12">
                            <div class="x_panel">
                                <div class="x_content">
                                    <table id="datatable-responsive" class="table table-striped table-hover table-responsive dt-responsive nowrap" cellspacing="0" width="100%">
                                        <thead>
                                        <tr>
                                            <th>Client Id</th>
                                            <th>Client Name</th>
                                            <th>Email</th>
                                            <th>Subscription Id</th>
                                            <th>Transaction Status</th>
                                            <th>Transaction Id</th>
                                            <th>Plan Amount</th>
                                            <th>Month Frequency</th>
                                            <th>Day Of Month</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        @if(!empty($recurringInfo))
                                            @foreach ($recurringInfo as $key => $obj)
                                                @php
                                                    if(($obj->transaction_status==config('constant.API_SUCCESS_CODE')))
                                                        {
                                                            $label='Success';
                                                        }
                                                    else{
                                                         $label='Fail';
                                                    }
                                                @endphp
                                                <tr class="tr-height">
                                                    <td>{{$obj->user_id}}</td>
                                                    <td>{{$obj->name}}</td>
                                                    <td>{{ $obj->email}}</td>
                                                    <td>{{ $obj->subscription_id }}</td>
                                                    <td>{{ $label }}</td>
                                                    <td>{{ $obj->transaction_id}}</td>
                                                    <td>{{ $obj->plan_amount }}</td>
                                                    <td>{{ $obj->month_frequency}}</td>
                                                    <td>{{ $obj->day_of_month }}</td>
                                                </tr>
                                            @endforeach
                                        @endif
                                        </tbody>
                                    </table>
                                    <div id="pagination_panel">
                                        {{ $recurringInfo->links('basic.pagination') }}

                                    </div>
                                </div>


                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>

@endsection
@push('script')
    <script>
        $(document).ready(function() {
            $('#fdate,#tdate').val(common_helper.formatDate());
        })
        common_helper.datePicker('#fdate');
        common_helper.datePicker('#tdate');
    </script>
@endpush
