Current File : //home/tradevaly/text.tradevaly.com.bd/resources/views/backend/pages/users/index.blade.php
@extends('backend.ayaan.master')

@section('title') Users List @endsection
@section('css')
    <!-- DataTables -->
    <link href="{{ asset('/assets/libs/datatables/datatables.min.css') }}" rel="stylesheet" type="text/css" />
@endsection
@section('content')

    @component('components.breadcrumb')
        @slot('li_1') Dashboards @endslot
        @slot('title') Users List @endslot
    @endcomponent
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header">
                    User Filter
                </div>
                <div class="card-body">
                    <form action="https://www.tradevaly.com.bd/b2b/users/index" method="get">
                        <div class="row">
                            <div class="col-lg-3">
                                <div class="form-group">
                                    <select class="form-select" name="user_type">
                                        <option value="">Select User Type</option>
                                        <option value="seller">Seller</option>
                                        <option value="buyer">Buyer</option>
                                    </select>
                                </div>
                            </div>
                            <div class="col-lg-3">
                                <div class="form-group">
                                    <select class="form-select" name="country_id">
                                        <option value="">Select A Country</option>
                                        @foreach($countries as  $country)
                                        <option value="{{ $country->id }}">{{ $country->name }}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>
                            <div class="col-lg-3">
                                <div class="form-group">
                                    <select class="form-select" name="category_id">
                                        <option value="">Select A Category</option>
                                        @foreach($categories as $category)
                                        <option value="{{ $category->id }}">{{ $category->name }}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>
                            <div class="col-lg-3">
                                <div class="form-group">
                                    <button type="submit" class="btn btn-info w-100">Search</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class="col-12">
        <div class="card">
        <div class="card-header py-4" style="text-align:right"><a class="btn btn-primary"  href="{{route("admin.addUser")}}">Add User</a></div>
        <div class="card-body">
          <div class="table-responsive">
            <table class="table dt-table">
              <thead>
                <tr>
                  <th class="text-center">#</th>
                  <th>{{translate("Name")}}</th>
                  <th>{{translate("Company")}}</th>
                  <th>{{translate("Phone")}}</th>
                  <th>{{translate("Email")}}</th>
                   <th>{{translate("Package")}}</th>
                  <th>{{translate("Type")}}</th>
                  <th>{{translate("View")}}</th>
                </tr>
              </thead>
              
            </table>
          </div>
                    
                </div>
            </div>
        </div>
    </div>
@endsection
@section('script')
    <!-- Required datatable js -->
    <script src="{{ asset('/assets/libs/datatables/datatables.min.js') }}"></script>
    <script src="{{ asset('/assets/libs/jszip/jszip.min.js') }}"></script>
    <script src="{{ asset('/assets/libs/pdfmake/pdfmake.min.js') }}"></script>
    <!-- Datatable init js -->
     
    <script type="text/javascript">
  $(function () {
    
    
    
    
    $(document).ready(function () {
        let params = "{{ Request::get('user_type') }}"
        console.log(params);
        let url =  "{{ route('admin.users.index') }}";
        if(params != ''){
            url += "?user_type="+params;
        }
  var table = $('.dt-table').DataTable({
    lengthChange: false,
    processing: true,
    dom: 'Bfrtip',
        serverSide: true,
        ajax: url,
        columns: [
            {data: 'DT_RowIndex', name: 'DT_RowIndex'},
            {data: 'name', name: 'name'},
            {data: 'company', name: 'company'},
            {data: 'phone', name: 'phone'},
            {data: 'email', name: 'email'},
            {data: 'pack', name: 'pack'},
            {data: 'type', name: 'type'},
            {data: 'action', name: 'action'},
        ],
    buttons: ['copy', 'excel', 'pdf', 'colvis']
  });
  table.buttons().container().appendTo('#datatable-buttons_wrapper .col-md-6:eq(0)');
  $(".dataTables_length select").addClass('form-select form-select-sm');
});
});
</script>
@endsection