@extends('layouts.app')

@section('content')
    <!-- Datatables -->
    <link href="{{ url('/') }}/vendors/datatables.net-bs/css/dataTables.bootstrap.min.css" rel="stylesheet">
    <link href="{{ url('/') }}/vendors/datatables.net-buttons-bs/css/buttons.bootstrap.min.css" rel="stylesheet">
    <link href="{{ url('/') }}/vendors/datatables.net-fixedheader-bs/css/fixedHeader.bootstrap.min.css" rel="stylesheet">
    <link href="{{ url('/') }}/vendors/datatables.net-responsive-bs/css/responsive.bootstrap.min.css" rel="stylesheet">
    <link href="{{ url('/') }}/vendors/datatables.net-scroller-bs/css/scroller.bootstrap.min.css" rel="stylesheet">

  <body class="nav-md">
    <div class="container body">
      <div class="main_container">
        @include('partials.sidebar')

        @include('partials.topmenu')

        <!-- page content -->
        <div class="right_col" role="main">
          @if (Session::get('message') != '')
            <div class="alert alert-success alert-dismissible fade in" role="alert">
              <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
              </button>
              <strong>{{ Session::get('message') }}</strong>
            </div>
          @endif
          

          <div class="row">
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Bitcoin Payment Approval <small></small></h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
              </div>
              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Pending Bitcoin Approvals</h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <table id="datatable-fixed-header" class="table table-striped table-bordered">
                      <thead>
                        <tr>
                          <th>Bitcoin Address</th>
                          <th>Username</th>
                          <th>Amount</th>
                          <th>Created at</th>
                          <th>Approve</th>
                          <th>Disapprove</th>
                        </tr>
                      </thead>


                      <tbody>
                      @foreach ($bitcoin_approvals_pending as $bitcoin)
                        <tr>
                          <td>{{ $bitcoin->bitcoin_addr }}</td>
                          <td>{{ $bitcoin->username }}</td>
                          <td>{{ $bitcoin->amount }}</td>
                          <td>{{ $bitcoin->created_at }}</td>
                          <td>
                            <form id="demo-form2" action="{{ url('/cp/bitcoin_payment_approval') }}" method="post">
                              <input name="bitcoin_id" type="hidden" value="{{$bitcoin->bitcoin_id}}">
                              <input name="approval_id" type="hidden" value="{{$bitcoin->id}}">
                              <input name="amount" type="hidden" value="{{$bitcoin->amount}}">
                              <input name="user_id" type="hidden" value="{{$bitcoin->user_id}}">
                              <input name="username" type="hidden" value="{{$bitcoin->username}}">
                              <input name="approved" type="hidden" value="1">
                              {{ csrf_field() }}
                              <button type="submit" class="btn btn-success">Approve</button>
                            </form>
                          </td>
                          <td>
                            <form id="demo-form2" action="{{ url('/cp/bitcoin_payment_approval') }}" method="post">
                              <input name="approval_id" type="hidden" value="{{$bitcoin->id}}">
                              <input name="deleted" type="hidden" value="1">
                              {{ csrf_field() }}
                              <button type="submit" class="btn btn-danger">Disapprove</button>
                            </form>
                          </td>
                        </tr>
                      @endforeach
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>


              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Approved Bitcoin Approvals</h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <table id="datatable-fixed-header" class="table table-striped table-bordered">
                      <thead>
                        <tr>
                          <th>Bitcoin Address</th>
                          <th>Username</th>
                          <th>Amount</th>
                          <th>Created at</th>
                          <th>Disapprove</th>
                        </tr>
                      </thead>


                      <tbody>
                      @foreach ($bitcoin_approvals_approved as $bitcoin)
                        <tr>
                          <td>{{ $bitcoin->bitcoin_addr }}</td>
                          <td>{{ $bitcoin->username }}</td>
                          <td>{{ $bitcoin->amount }}</td>
                          <td>{{ $bitcoin->created_at }}</td>
                          <td>
                            <form id="demo-form2" action="{{ url('/cp/bitcoin_payment_approval') }}" method="post">
                              <input name="approval_id" type="hidden" value="{{$bitcoin->id}}">
                              <input name="deleted" type="hidden" value="1">
                              {{ csrf_field() }}
                              <button type="submit" class="btn btn-danger">Disapprove</button>
                            </form>
                          </td>
                        </tr>
                      @endforeach
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>


              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Deleted Bitcoin Approvals</h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <table id="datatable-fixed-header" class="table table-striped table-bordered">
                      <thead>
                        <tr>
                          <th>Bitcoin Address</th>
                          <th>Username</th>
                          <th>Amount</th>
                          <th>Created at</th>
                          <th>Approve</th>
                        </tr>
                      </thead>


                      <tbody>
                      @foreach ($bitcoin_approvals_disapproved as $bitcoin)
                        <tr>
                          <td>{{ $bitcoin->bitcoin_addr }}</td>
                          <td>{{ $bitcoin->username }}</td>
                          <td>{{ $bitcoin->amount }}</td>
                          <td>{{ $bitcoin->created_at }}</td>
                          <td>
                            <form id="demo-form2" action="{{ url('/cp/bitcoin_payment_approval') }}" method="post">
                              <input name="bitcoin_id" type="hidden" value="{{$bitcoin->bitcoin_id}}">
                              <input name="approval_id" type="hidden" value="{{$bitcoin->id}}">
                              <input name="amount" type="hidden" value="{{$bitcoin->amount}}">
                              <input name="user_id" type="hidden" value="{{$bitcoin->user_id}}">
                              <input name="username" type="hidden" value="{{$bitcoin->username}}">
                              <input name="approved" type="hidden" value="1">
                              {{ csrf_field() }}
                              <button type="submit" class="btn btn-success">Approve</button>
                            </form>
                          </td>
                        </tr>
                      @endforeach
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>


              
            </div>
          </div>
        </div>
        <!-- /page content -->
        @include('partials.footer')
      </div>
    </div>

    <!-- jQuery -->
    <!-- jQuery -->
    <script src="{{ url('/') }}/vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="{{ url('/') }}/vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <script src="{{ url('/') }}/vendors/fastclick/lib/fastclick.js"></script>
    <!-- NProgress -->
    <script src="{{ url('/') }}/vendors/nprogress/nprogress.js"></script>
    <!-- iCheck -->
    <script src="{{ url('/') }}/vendors/iCheck/icheck.min.js"></script>
    <!-- Datatables -->
    <script src="{{ url('/') }}/vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="{{ url('/') }}/vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="{{ url('/') }}/vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="{{ url('/') }}/vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="{{ url('/') }}/vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="{{ url('/') }}/vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="{{ url('/') }}/vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="{{ url('/') }}/vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="{{ url('/') }}/vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="{{ url('/') }}/vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="{{ url('/') }}/vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="{{ url('/') }}/vendors/datatables.net-scroller/js/dataTables.scroller.min.js"></script>
    <script src="{{ url('/') }}/vendors/jszip/dist/jszip.min.js"></script>
    <script src="{{ url('/') }}/vendors/pdfmake/build/pdfmake.min.js"></script>
    <script src="{{ url('/') }}/vendors/pdfmake/build/vfs_fonts.js"></script>
    <!-- bootstrap-daterangepicker -->
    <script src="{{ url('/') }}/js/moment/moment.min.js"></script>
    <script src="{{ url('/') }}/js/datepicker/daterangepicker.js"></script>
    <!-- Custom Theme Scripts -->
    <script src="{{ url('/') }}/build/js/custom.min.js"></script>
    <!-- Datatables -->
    <script>
      $(document).ready(function() {

        //$('#single_cal1').daterangepicker({
        //  singleDatePicker: true,
        //  calender_style: "picker_1",
        //  minDate: 0,
        //  daysOfWeekDisabled: [0,2,3,4,5,6]
        //}, function(start, end, label) {
        //  console.log(start.toISOString(), end.toISOString(), label);
        //});

        $('#datatable-fixed-header').DataTable({
          fixedHeader: true
        });
      });
    </script>
    <!-- /Datatables -->
  </body>
@endsection
