 @extends('admin.layouts.main-layout')
 @section('content')
<div class="card">
        <div class="card-header">
            <h3 class="card-title">Single Digit Summary List</h3>
        </div>
        <div align="left">
            <!-- <a href="{{ url('admin/stores/create') }}" class="btn btn-info">Add New </a> -->
        </div>
        <!-- /.card-header -->
        <div class="card-body">
            @if(session()->has('message'))
                <div class="alert alert-success">
                    {{ session()->get('message') }}
                </div>
            @endif
            <div id="example1_wrapper" class="dt-bootstrap4">
                <div class="row">
                    <div class="col-sm-12">
                        <table id="example1" class="table table-bordered table-striped dataTable" role="grid"
                               aria-describedby="example1_info">
                            <thead>
                            <tr role="row">
                                <th class="sorting_asc" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                                    aria-sort="ascending"
                                    aria-label="Rendering engine: activate to sort column descending"
                                    style="width: 60px;">#
                                </th>
                               
                                 <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                                    aria-label="Browser: activate to sort column ascending" style="width: 207px;">
                                   Store Name
                                </th>
                                 <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                                    aria-label="Browser: activate to sort column ascending" style="width: 207px;">
                                   Open Time
                                </th>
                                
                                <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                                    aria-label="Browser: activate to sort column ascending" style="width: 207px;">
                                   Bit Place
                                </th>
                                <th class="sorting" tabindex="0" aria-controls="example1" rowspan="1" colspan="1"
                                    aria-label="Platform(s): activate to sort column ascending" style="width: 183px;">
                                   Total Amount
                                </th>
                             
                                
                            </tr>
                            </thead>
                            <tbody>
                              @php 
                    $page=1;
                    if(Request::input('page'))
                    $page=Request::input('page');
                    $sort = $lists->perPage();
                  @endphp
                  @forelse($lists as $key => $list)

                  @foreach($list->SingleDigitBit as $key=>$SingleDigitBit)
                  @if($key==0)
                        <tr>
                          <td rowspan="{{count($list->SingleDigitBit)}}" scope="column">{{ $sort*($page-1)+($key+1) }}</td>
                           <td rowspan="{{count($list->SingleDigitBit)}}" scope="column">{{$list->store->name}}</td>
                           <td rowspan="{{count($list->SingleDigitBit)}}" scope="column">{{$list->open_time}}</td>

                           <td>{{$SingleDigitBit->bit_place}}</td>
                          <td>{{$SingleDigitBit->amount}}</td>
                        </tr>
                        @else
                        <tr>
                           <td>{{$SingleDigitBit->bit_place}}</td>
                          <td>{{$SingleDigitBit->amount}}</td>
                        </tr>
                        @endif
                    @endforeach
                    <tr>
                    <th colspan="4" scope="row" style="text-align: right;">Grand Amt</th>
                          <td> <i class="fa fa-inr" aria-hidden="true"></i>  {{$list->amount}}</td>
                    </tr>
                         @empty
                  <tr>
                    <td colspan="7">Record not found </td>
                  </tr>
                  @endforelse
                            </tbody>
                   </table>
                    <div class="row">
              <div class="col-md-6 text-left" style="margin: 20px 0px;">
                Showing  {{$lists->firstItem()}} to {{$lists->lastItem()}} of {{$lists->total()}}
              </div>
              <div class="col-md-6 text-right">
                {!! $lists->appends(request()->input())->links() !!}
              </div>
            </div>
                  </div>
                </div>
              </div>
            </div>
          </div>


 @endsection
@section('js-content')
@endsection