@extends('layouts.app1')

@section('content')

<!-- page content -->
<div class="right_col" role="main">
          <div class="">
            <div class="page-title">
              <div class="title_left">
                <h3>Recharge Comission</h3>
              </div>

              <div class="title_right">
                <div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
                  <div class="input-group">
                    <input type="text" class="form-control" placeholder="Search for...">
                    <span class="input-group-btn">
                      <button class="btn btn-secondary" type="button">Go!</button>
                    </span>
                  </div>
                </div>
              </div>
            </div>
            
            <div class="clearfix"></div>

            <div class="panel-body">
            
            </div>

            
                <form action="/setting/savePPRecharge" method="POST">
					 @csrf
                    @if(request()->role=="")
                    <table class="table table-bordered" style="background: #fff;">
                        <thead>
                            <tr>
                                <th>Package Type</th>
                                <th>#</th>
                                <th>Filter Your Records</th>                                
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>
                                    <select required onchange="redirectToMemberPPRechargeSetting(this)" name="package"
                                        id="package" class="form-control">
                                        <option data-code="" value="">Select Member</option>
                                        @foreach ($members as $member)
                                        <option data-code="{{$member->code}}" {{$memberCode==$member->code?"selected":""}}
                                            value="{{$member->id}}">{{$member->name}}
                                        </option>
                                        @endforeach
                                    </select>
                                </td>
                                <td><button type="submit" class="btn btn-success">Save</button></td>
                                <td><input type="text" onkeyup="filterSearch(this)" name="" placeholder="Type.." id="" class="form-control"></td>
                                
                            </tr>
                        </tbody>
                    </table>               
                    @endif

            <div class="row">
              <div class="col-md-12 col-sm-12 ">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Set <small>Commision</small> </h2>
                    
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                      <div class="row">
                          <div class="col-sm-12">
                            <div class="card-box table-responsive">
                    
					
                    <table id="datatable-responsive" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%" style="white-space: nowrap">
                      <thead>
                        <tr>
                            <th>S.N.</th>
                            <th>Operator Name</th>
                            <th>Service Type</th>
                            <th>Comission </th>
							<th>Tds </th>
                            <th>Is Flat </th>
                        </tr>
                      </thead>
                      <tbody>  
                      @foreach ($rechargeAgencyList as $key=> $List)
                                @php
                                $totalComissionResp=
                                \App\Http\Controllers\Setting::getPPMemberComission($memberId->id,$List->id)
                                @endphp
                                <tr>
                                    <td>{{$key+1}}</td>
                                    <td>{{$List->operator_name}}</td>
                                    <td>{{$List->service_type}}</td>
                                    <input type="hidden" name="rechargeId[]" value="{{$List->id}}" id="">
                                    <td>
                                        @if(request()->role=='')
                                        <input type="text" value="{{$totalComissionResp[0]}}" name="comission[]">
                                        @else
                                        {{$totalComissionResp[0]}}
                                        @endif
                                    </td>
									<td>
                                        @if(request()->role=='')
                                        <input type="text" value="{{$totalComissionResp[2]}}" name="tds[]">
                                        @else
                                        {{$totalComissionResp[0]}}
                                        @endif
                                    </td>
                                    <td>
                                        @if(request()->role=='')
                                        <input type="checkbox" {{$totalComissionResp[1]==0?"checked":''}}
                                            value="{{$key}}" name="is_flat[]" id="">
                                        @else
                                        {{$totalComissionResp[1]==0?"Yes":"No"}}
                                        @endif
                                    </td>

                                </tr>

                                @endforeach

                                             
                      </tbody>
                      

                    </table>
					
					
                  </div>
                </div>
              </div>
            </div>
            </form>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!-- /page content -->
<style>
  .fade:not(.show){
    opacity: 1;
  }
</style>
@endsection