Viewing file: index.blade.php (4.25 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
@extends('layouts.admin')
@section('title') Devices @endsection
@section('extra-css') <link rel="stylesheet" href="{{asset('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css')}}"> <link rel="stylesheet" href="{{asset('plugins/datatables-responsive/css/responsive.bootstrap4.min.css')}}"> <style> #devices_filter{ display: none !important; } </style> @endsection
@section('content') <!-- Main content --> <section class="content"> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-header"> <h2 class="card-title">@lang('Device List')</h2> <div class="float-right"> <div class="form-group"> <select class="form-control select_device" multiple="multiple" name="customer_select" id="search_customer_select"> @if (isset($customers) && $customers) @foreach ($customers as $customer) <option value="{{$customer->id}}" class="input-group">{{$customer->full_name}}</option> @endforeach @endif </select> </div> </div> </div> <!-- /.card-header --> <div class="card-body table-body"> <table id="devices" class="table table-striped table-bordered dt-responsive nowrap"> <thead> <tr> <th>@lang('Customer Name')</th> <th>@lang('admin.device_name')</th> <th>@lang('admin.created_at')</th> <th>@lang('admin.status')</th> </tr> </thead>
</table> </div> <!-- /.card-body --> </div> <!-- /.card --> </div> <!-- /.col --> </div> <!-- /.row --> </section> <!-- /.content --> @endsection
@section('extra-scripts') <script src="{{asset('plugins/datatables/jquery.dataTables.min.js')}}"></script> <script src="{{asset('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js')}}"></script> <script src="{{asset('plugins/datatables-responsive/js/dataTables.responsive.min.js')}}"></script> <script src="{{asset('plugins/datatables-responsive/js/responsive.bootstrap4.min.js')}}"></script> <script src="{{asset('js/readmore.min.js')}}"></script>
<script> "use strict"; var getDevices = $('#devices').DataTable({ processing: true, serverSide: true, responsive:true, ajax: { url:"{{route('admin.device.get.all')}}", type:'GET', data: function(d) { let customer_ids = $('#search_customer_select').val(); d.customer_id=[]; $.each(customer_ids, function(index, value) { d.customer_id[index]=value; }); } }, columns: [ { "data": "customer_name" }, { "data": "device_name" }, { "data": "created_at" }, { "data": "status" }, ], fnInitComplete: function(oSettings, json) { $(".show-more").css('overflow', 'hidden').readmore({collapsedHeight: 20,moreLink: '<a href="#">More</a>',lessLink: '<a href="#">Less</a>'}); } }); $(document).on('change', '#search_customer_select', function (e) { getDevices.ajax.reload(); }); $('#search_customer_select').select2({ placeholder: "Search By Customer", multiple: true, allowClear: false, tags:false, }) </script> @endsection
|