@extends('layouts.admin') @section('content')
<div class="card mb-3">
  <div class="card-body pt-0">
    <div class="col-lg-4 pt-3 pt-lg-0">
      <div class="d-flex flex-between-center mb-3">
        <div class="d-flex align-items-center">
          <div class="icon-item icon-item-sm bg-soft-primary shadow-none me-2 bg-soft-success"><span class="fas fa-calendar-week text-success"></span></div>
          <h6 class="mb-0">Search Per Date</h6>
        </div>
      </div>
      <div class="d-flex">
        <div class="d-flex">
          <form class="form-material" method="POST" action="{{ url ('/search_date_member')}}">
            @csrf
            Cover:
            <select required name="cover" class="form-control">
              <option disabled selected>--Select Option--</option>
              <option>All</option>
              @foreach ($covers as $cover1)
              <option value="{{$cover1->id}}">{{$cover1->name}}</a></option>
              @endforeach
            </select>
            <br>
            <input type="date" value="<?php echo date('Y-m-d'); ?>" required class="form-control" name="date1" id=""><br>
            <input type="date" value="<?php echo date('Y-m-d'); ?>" required class="form-control" name="date2" id="">
            <br>
            <button type="submit" class="btn btn-primary btn-sm" aria-placeholder="Search"><i class="fas fa-search"></i> Preview</button>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="card mb-3">
  <div class="card-header">
    <div class="row flex-between-end">
      <div class="col-auto align-self-center">
        <form class="form-material" method="POST" action="{{ url ('/search_member')}}">
          @csrf
          <input type="text" required class="form-control" name="search" id="search">
          <br><button type="submit" class="btn btn-primary btn-sm" aria-placeholder="Search"><i class="fas fa-search"></i> Advanced Search</button>
           &nbsp;
         <!-- <a href="{{url ('allstatus')}}" class="btn btn-success btn-sm"> Update Status</a>-->
          <br>
          <br>
          <h5 class="mb-0" data-anchor="data-anchor">List of all members</h5>
        </form>
      </div>
    </div>
  </div>
  <div class="card-body pt-0">
    <div class="dt-responsive table-sm table-responsive">
      <small>
        <table id="basic-btn" class="table table-sm text-sm table-striped table-bordered nowrap">
          <thead class="bg-200 text-900">
            <tr>       
              <th>Name</th>
              <th>Surname</th>
              <th>National ID</th>
              <th>Cover Name</th>
               <th>Cover Amount</th>
                 </tr>
          </thead>
          <tbody>
            @foreach ($members as $member)
            <tr>              
              <td>{{$member->name}}</td>
              <td>{{$member->surname}}</td>
              <td>{{$member->national_id}}</td>
              <td>{{$member->cover}}</td>
                <td>{{$member->amount}}</td>
            </tr>
            @endforeach
          </tbody>
        </table>
      </small>
    </div>


  </div>

</div>

<script>
  var deleteLinks = document.querySelectorAll('.delete');

  for (var i = 0; i < deleteLinks.length; i++) {
    deleteLinks[i].addEventListener('click', function(event) {
      event.preventDefault();

      var choice = confirm(this.getAttribute('data-confirm'));

      if (choice) {
        window.location.href = this.getAttribute('href');
      }
    });
  }
</script>

@endsection