@extends('master')
@section('content')
<link rel="stylesheet" type="text/css" href="{{ url('css/mui.css') }}" />
<div id="wrapper">
   <div id="page-wrapper">
      <div class="container-fluid">
         <div class="white-box">
            <div class="row">
               <div class="col-md-12 ">
                  <ol class="breadcrumb breadcrumbs" >
                     <li><a href="{{ URL::to('admin/facilitylist') }}">Home</a></li>
                     <li class="active">Add Payment</li>
                  </ol>
                  <div class="panel panel-default" >
                     <div class="panel-body" style="padding-top:10px;">
                        <div class="row">
                           <div class="col-md-6 col-md-offset-3 col-sm-12 col-xs-12 form-box ">
                              <div class="f1-steps">
                                 <div class="f1-progress">
                                    <div class="f1-progress-line" data-now-value="16.66" data-number-of-steps="3" style="width:0%;"></div>
                                 </div>
                                 <div class="f1-step active ">
                                    <div class="f1-step-icon"><i class="fa fa-check"></i></div>
                                    <p>Selection</p>
                                 </div>
                                 <div class="f1-step text-center ">
                                    <div class="f1-step-icon "><i class="fa fa-usd"></i></div>
                                    <p>Payment Method</p>
                                 </div>
                                 <div class="f1-step text-right">
                                    <div class="f1-step-icon"><i class="fa fa-check-square-o"></i></div>
                                    <p>Order Review</p>
                                 </div>
                              </div>
                           </div>
                        </div>
                     </div>
                  </div>
                  <div class="well">
                     <div class="row">
                        <div class="col-md-12">
                           <form role="search" class="app-search hidden-sm hidden-xs m-r-10">
                              <input type="text" class="pull-right form-control" id="myInput" onkeyup="myFunction()" name="search" placeholder="Search"><a href=""><i class="fa fa-search"></i></a>
                           </form>
                           <h2 style="margin-bottom: 2%;">Payment List <span style="color: black; font-size: 12px; " >(Showing {{ isset($payment_count)?$payment_count:'' }} entries)</span>
                           </h2>
                           <form action="{{url('admin/paymentreview')}}" method="post" name="Payment_chk">
                              {{csrf_field()}}
                              <div class="panel-heading" style="" >
                                 <h4>
                                    Select Payment Facility
                                 </h4>
                              </div>
                              <div class="table-responsive">
                                 <table class="table table-striped" style="border: solid 1px;" id="myTable">
                                    <tbody>
                                       @foreach($add_paymentlist as $facilitys)
                                       <tr class="advance-table-row">
                                          <td style="padding-left: 2%;" width="40%">
                                             <div class="col-md-12">
                                                <h5>{{ $facilitys->Name }}</h5>
                                             </div>
                                             <div class="col-md-12 col-xs-12">
                                                <div class="col-md-5 col-xs-4">
                                                   @if($facilitys->USSBOA_Paid_Service__c == 1)
                                                   <i class="fa fa-thumbs-o-up fa-2x" data-toggle="tooltip" data-placement="top" title="Paid" aria-hidden="true" style="
                                                      color: green;"></i>
                                                   <label for="checkbox_1">USSBOA</label>
                                                   @else
                                                   <div class="checkbox checkbox-circle checkbox-info">
                                                      <input name="ussboa[]" id="checkbox7" onchange="isChecked(this, 'sub1')" value="{{ $facilitys->FID__c }}" type="checkbox">
                                                      <label for="checkbox_1">USSBOA</label>
                                                   </div>
                                                   @endif
                                                </div>
                                                <div class="col-md-5 col-xs-6">
                                                   @if($facilitys->MGT_Paid_Service__c == 1)
                                                   <i class="fa fa-thumbs-o-up fa-2x" data-toggle="tooltip" data-placement="top" title="Paid" aria-hidden="true" style="
                                                      color: green; "></i>
                                                   <label for="checkbox_1"> MGT</label>
                                                   @else
                                                   <div class="checkbox checkbox-circle checkbox-info">
                                                      <input name="mgt[]" id="checkbox8" onchange="isChecked(this, 'sub1')" type="checkbox" value="{{ $facilitys->FID__c }}">
                                                      <label for="checkbox_2"> MGT</label>
                                                   </div>
                                                   @endif
                                                </div>
                                             </div>
                                          </td>
                                          <td width="15%">
                                             <div>FID</div>
                                             <h5>{{ $facilitys->FID__c }}</h5>
                                          </td>
                                          <td>
                                             <div>Address</div>
                                             <h5><b>{{ $facilitys->BillingAddress->street}},{{$facilitys->BillingAddress->city}},{{$facilitys->BillingAddress->country}},{{$facilitys->BillingAddress->postalCode}}</b></h5>
                                          </td>
                                          <input name="f_id[]" type="hidden" value="{{ $facilitys->FID__c }}">
                                       </tr>
                                       @endforeach
                                    </tbody>
                                 </table>
                              </div>
                              <div class="p-10 row" style="margin-bottom: 2%;">
                                 <div class="col-sm-8">
                                 </div>
                                 <div class="col-sm-2 pull-right m-t-10">
                                    <button type="submit" class="btn btn-block p-10 " id="sub1" disabled="disabled" style="background-color: #02529B;"><span style="color: white;">Proceed</span><i class="ti-arrow-right m-l-5" style="color: white;"></i>
                                    </button>
                                    <b id="cnt_id" style="width:20px;" class="col-md-offset-4"></b>
                                 </div>
                              </div>
                           </form>
                           <div class="panel">
                              <form role="search" class="app-search hidden-sm hidden-xs m-r-10">
                                 <input type="text" class="pull-right form-control" id="myInput2" onkeyup="myFunction2()" name="search" placeholder="Search"><a href=""><i class="fa fa-search"></i></a>
                              </form>
                              <h2>Payment History <span style="color: black; font-size: 12px" >(Showing {{count( isset($chargent_order)?$chargent_order:'')}} entries)</span>
                              </h2>
                              <div class="panel-wrapper collapse in" aria-expanded="true">
                                 <div class="panel-body" style="padding:5px 0;">
                                    <div class="col-md-12" style="padding:0px;">
                                       <div class="table-responsive">
                                          <span class="counter pull-right"></span>
                                          <table class="table table-responsive" id="myTable2" style="border: solid 1px;">
                                             <thead>
                                                <tr style="background-color: #F35B3F; color:#ffffff">
                                                   <th style="background-color: #F35B3F; color:#ffffff">Facility Name</th>
                                                   <th style="background-color: #F35B3F; color:#ffffff">Order Id</th>
                                                   <th style="background-color: #F35B3F; color:#ffffff">Billing Name</th>
                                                   <th style="background-color: #F35B3F; color:#ffffff">Payment Method</th>
                                                   <th style="background-color: #F35B3F; color:#ffffff">Card Type</th>
                                                   <th style="background-color: #F35B3F; color:#ffffff">Payment Status</th>
                                                   <th style="background-color: #F35B3F; color:#ffffff">Last Payment Date</th>
                                                </tr>
                                             </thead>
                                             <tbody>
                                                @foreach($chargent_order as $orders)
                                                <tr>
                                                   <td>{{$orders->ChargentOrders__Account__r->Name}}</td>
                                                   <td>{{ $orders->Name }}</td>
                                                   <td><?php if(isset($orders->ChargentOrders__Billing_First_Name__c)) echo $orders->ChargentOrders__Billing_First_Name__c;   ?></td>
                                                   <td><?php if(isset($orders->ChargentOrders__Payment_Method__c)) echo $orders->ChargentOrders__Payment_Method__c;  ?></td>
                                                   <td><?php if(isset($orders->ChargentOrders__Card_Type__c )) echo $orders->ChargentOrders__Card_Type__c;  ?></td>
                                                   <td><?php if(isset($orders->ChargentOrders__Payment_Status__c)) echo $orders->ChargentOrders__Payment_Status__c; ?> </td>
                                                   <td><?php if(isset($orders->ChargentOrders__Date__c))  echo date('d-M-Y ,h:i:A',strtotime($orders->ChargentOrders__Date__c)); ?> </td>
                                                </tr>
                                                @endforeach
                                             </tbody>
                                          </table>
                                       </div>
                                    </div>
                                 </div>
                              </div>
                           </div>
                        </div>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </div>
</div>
</div>
<script> $('#unblockbtn5').click(function() {
   $('div.block5').unblock();
   });
   $(document).ready(function() {
   $("#search").keyup(function () {
   alert(dsadsd);
   var searchTerm = $(".search").val();
   var listItem = $('.results tbody').children('tr');
   var searchSplit = searchTerm.replace(/ /g, "'):containsi('")
   $.extend($.expr[':'], {'containsi': function(elem, i, match, array){
   return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
   }
   });
   $(".results tbody tr").not(":containsi('" + searchSplit + "')").each(function(e){
   $(this).attr('visible','false');
   });
   $(".results tbody tr:containsi('" + searchSplit + "')").each(function(e){
   $(this).attr('visible','true');
   });
   var jobCount = $('.results tbody tr[visible="true"]').length;
   $('.counter').text(jobCount + ' item');
   if(jobCount == '0') {$('.no-result').show();}
   else {$('.no-result').hide();}
   });
   });
</script>
<script type="text/javascript">
   function isChecked(checkbox, sub1) {
    
    var cnt = $('input[type="checkbox"]:checked').length;
    if(cnt != 0){
       $("#sub1").prop("disabled",false);
    }
    else if(cnt ==0 ){
      $("#sub1").prop("disabled",true);
    }
    cnt1 = cnt+' Selected';
    $('#cnt_id').html(cnt1);
   }
   function isChecked(checkbox, sub1) {
   
    var cnt = $('input[type="checkbox"]:checked').length;
     if(cnt != 0){
       $("#sub1").prop("disabled",false);
    }
    else if(cnt ==0 ){
      $("#sub1").prop("disabled",true);
    }
    cnt1 = cnt+' Selected';
    $('#cnt_id').html(cnt1);
    
   }
   function myFunction() {
   
     var input, filter, table, tr, td, i,h5;
     input = document.getElementById("myInput");
     filter = input.value.toUpperCase();
     table = document.getElementById("myTable");
     tr = table.getElementsByTagName("tr");
     for (i = 0; i < tr.length; i++) {
       td = tr[i].getElementsByTagName("h5")[0];
       if (td) {
         if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
           tr[i].style.display = "";
         } else {
               td1 = tr[i].getElementsByTagName("h5")[1];
       if (td1) {
         if (td1.innerHTML.toUpperCase().indexOf(filter) > -1) {
           tr[i].style.display = "";
         } else {
           tr[i].style.display = "none";
         }
       } 
         }
       }   
         
     }
   }
   function myFunction2() {
     var input, filter, table, tr, td, i;
     input = document.getElementById("myInput2");
     filter = input.value.toUpperCase();
     table = document.getElementById("myTable2");
     tr = table.getElementsByTagName("tr");
     for (i = 0; i < tr.length; i++) {
       td = tr[i].getElementsByTagName("td")[0];
       if (td) {
         if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
           tr[i].style.display = "";
         } else {
           td1 = tr[i].getElementsByTagName("td")[1];
       if (td1) {
         if (td1.innerHTML.toUpperCase().indexOf(filter) > -1) {
           tr[i].style.display = "";
         } else {
          td2 = tr[i].getElementsByTagName("td")[3];
       if (td2) {
         if (td2.innerHTML.toUpperCase().indexOf(filter) > -1) {
           tr[i].style.display = "";
         } else { 
          td3 = tr[i].getElementsByTagName("td")[6];
       if (td3) {
         if (td3.innerHTML.toUpperCase().indexOf(filter) > -1) {
           tr[i].style.display = "";
         } else {
           tr[i].style.display = "none";
         }
       }
         }
       }
         }
       }
         }
       }
     }
   }
</script>
@stop

