
@extends('layouts.dashboard', ['title' => 'Beneficiaries'])

@section('content')
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
      <!-- Main content -->
<!-- Main content -->
    <section class="content">

        <!-- /.row -->
        <!-- Main row -->
        <div class="">
            <br><br>
            @include('inc.messages')
          <!-- Left col -->

          <!-- /.Left col -->
          <!-- right col (We are only adding the ID to make the widgets sortable)-->
          <section class="col-lg-12 connectedSortable">

            <!-- Map card -->
            <div class="card">
              <div class="card-header no-border">
                <h3 class="card-title">
                  All Users
                </h3>
                <!-- card tools -->

                <!-- /.card-tools -->
              </div>
              <div class="card-body">


                 <br>
              <div class="float-right">
                <button class="btn btn-primary btn-sm  custom-button float-right"
                              data-toggle="modal" data-target="#createB">
                              Add User
                              <i class="fa fa-plus-circle font-icon" aria-hidden="true"></i>
                             </button>
              </div>

              <br><br><br>

              <div class="table-responsive">
                  <table id="dataTable" width="100%" class="table-bordered table-striped table-sm dataTable no-footer">
                      <thead>
                      <tr>
                        <th>ID</th>
                        <th>Name</th>
                        <th>Email</th>

                        <th></th>
                      </tr>
                      </thead>
                      <tbody>
                        @foreach($users as $item)
                        <tr>
                            <td>{{ $loop->iteration }}</td>
                            <td>{{ $item->firstname }} {{ $item->lastname }}</td>
                            <td>{{ $item->email }}</td>

                            <td>
                                <?php
                                            $parameter = Crypt::encrypt($item->id);
                                            ?>
                                <div class="btn-group">
                                    <button type="button" class="btn btn-warning dropdown-toggle" data-toggle="dropdown" aria-expanded="true">
                                      Options
                                    </button>
                                    <div class="dropdown-menu" style="">





                                <!-- <a class="dropdown-item"  href="{{ URL::to('user/edit/'.$parameter )}}">Edit</a> -->


                                <!-- <a class="dropdown-item"  href="{{ URL::to('user/view/'.$parameter )}}">Preview</a> -->
                                  </div>
                                  </div>

                            </td>
                        </tr>
                        @endforeach

                       </tbody>

                    </table>
              </div>
            </div>
            <!-- /.card -->


        </div>
        <!-- /.modal-dialog -->
      </div>
      <!-- /.create modal -->

            <!-- /.card -->
          </section>
          <!-- right col -->
        </div>

    <!-- /.content -->

    <!-- /.create branch modal -->
    <div class="modal fade" id="createB">
        <div class="modal-dialog  mw-100 w-75">
          <div class="modal-content">
            <div class="modal-header">
              <h4 class="modal-title">Add User</h4>
              <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
              </button>
            </div>
            <div class="modal-body">
                <div class="card card-primary">
                    <div class="card-header">
                    </div>
                    <!-- /.card-header -->
                    <!-- form start -->
                    <form method="POST" action="/create/user" role="form" enctype="multipart/form-data" class="form-prevent-multiple-submits">
                      @csrf
                      <div class="card-body">

                          <h4>Account Details</h4><hr>
                            <div class="row">
                                <div class="col-md-6">
                                    <div style="border: 2px solid lightgray;padding: 35px;height: 400px;">


                                    <div class="form-group">
                                        <label for="location">First Name</label>
                                        <input required type="text" name="firstname" class="form-control" id="" placeholder="Enter  First Name">
                                      </div>

                                      <div class="form-group">
                                        <label for="location">Last name</label>
                                        <input required type="text" name="lastname" class="form-control" id="" placeholder="Enter Last Name">
                                      </div>

                                      <div class="form-group">
                                        <label for="location">Email Address</label>
                                        <input required type="text" name="email" class="form-control" id="" placeholder="Enter User Email Address">
                                      </div>

                                      <div class="form-group">
                                        <label for="employee_-id">Password </label>
                                        <input required type="password" name="password" class="form-control" id="" placeholder="Enter Password">
                                    </div>





                                    </div>
                                </div>
                                <div class="col-md-6">





                                </div>

                            </div>
                            <br>


                      </div>
                      <!-- /.card-body -->
                      <div class="card-footer">
                      </div>
                  </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="submit" class="btn btn-primary button-prevent-multiple-submits float-right" style="margin-left: 10px;"><i class="fa fa-spinner fa-spin font-icon spinner" aria-hidden="true"></i> Submit</button>
            </div>
          </div>
         </form>
          <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
      </div>
      <!-- /.create modal -->



    @include('inc.copyright')
@endsection
