<!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> <i class="fa fa-file-text-o"></i> {!! trans('search::searches.name') !!} <small> {!! trans('app.manage') !!} {!! trans('search::searches.names') !!}</small> </h1> <ol class="breadcrumb"> <li><a href="{!! guard_url('/') !!}"><i class="fa fa-dashboard"></i> {!! trans('app.home') !!} </a></li> <li class="active">{!! trans('search::searches.names') !!}</li> </ol> </section> <!-- Main content --> <section class="content"> <div id='search-searches-entry'> </div> <div class="nav-tabs-custom"> <ul class="nav nav-tabs"> <li class="{!!(request('status') == '')?'active':'';!!}"><a href="{!!guard_url('search/searches')!!}">{!! trans('search::searches.names') !!}</a></li> <li class="{!!(request('status') == 'archive')?'active':'';!!}"><a href="{!!guard_url('search/searches?status=archive')!!}">Archived</a></li> <li class="{!!(request('status') == 'deleted')?'active':'';!!}"><a href="{!!guard_url('search/searches?status=deleted')!!}">Trashed</a></li> <li class="pull-right"> <span class="actions"> <!-- <a class="btn btn-xs btn-purple" href="{!!guard_url('search/searches/reports')!!}"><i class="fa fa-bar-chart" aria-hidden="true"></i><span class="hidden-sm hidden-xs"> Reports</span></a> @include('search::admin.searches.partial.actions') --> @include('search::admin.searches.partial.filter') @include('search::admin.searches.partial.column') </span> </li> </ul> <div class="tab-content"> <table id="search-searches-list" class="table table-striped data-table"> <thead class="list_head"> <th style="text-align: right;" width="1%"><a class="btn-reset-filter" href="#Reset" style="display:none; color:#fff;"><i class="fa fa-filter"></i></a> <input type="checkbox" id="search-searches-check-all"></th> <th data-field="module">{!! trans('search::searches.label.module')!!}</th> <th data-field="search">{!! trans('search::searches.label.search')!!}</th> </thead> </table> </div> </div> </section> </div> <script type="text/javascript"> var oTable; var oSearch; $(document).ready(function(){ app.load('#search-searches-entry', '{!!guard_url('search/searches/0')!!}'); oTable = $('#search-searches-list').dataTable( { 'columnDefs': [{ 'targets': 0, 'searchable': false, 'orderable': false, 'className': 'dt-body-center', 'render': function (data, type, full, meta){ return '<input type="checkbox" name="id[]" value="' + data.id + '">'; } }], "responsive" : true, "order": [[1, 'asc']], "bProcessing": true, "sDom": 'R<>rt<ilp><"clear">', "bServerSide": true, "sAjaxSource": '{!! guard_url('search/searches') !!}', "fnServerData" : function ( sSource, aoData, fnCallback ) { $.each(oSearch, function(key, val){ aoData.push( { 'name' : key, 'value' : val } ); }); app.dataTable(aoData); $.ajax({ 'dataType' : 'json', 'data' : aoData, 'type' : 'GET', 'url' : sSource, 'success' : fnCallback }); }, "columns": [ {data :'id'}, {data :'module'}, {data :'search'}, ], "pageLength": 25 }); $('#search-searches-list tbody').on( 'click', 'tr', function () { oTable.$('tr.selected').removeClass('selected'); $(this).addClass('selected'); var d = $('#search-searches-list').DataTable().row( this ).data(); $('#search-searches-entry').load('{!!guard_url('search/searches')!!}' + '/' + d.id); }); $('#search-searches-list tbody').on( 'change', "input[name^='id[]']", function (e) { e.preventDefault(); aIds = []; $(".child").remove(); $(this).parent().parent().removeClass('parent'); $("input[name^='id[]']:checked").each(function(){ aIds.push($(this).val()); }); }); $("#search-searches-check-all").on( 'change', function (e) { e.preventDefault(); aIds = []; if ($(this).prop('checked')) { $("input[name^='id[]']").each(function(){ $(this).prop('checked',true); aIds.push($(this).val()); }); return; }else{ $("input[name^='id[]']").prop('checked',false); } }); $(".reset_filter").click(function (e) { e.preventDefault(); $("#form-search")[ 0 ].reset(); $('#form-search input,#form-search select').each( function () { oTable.search( this.value ).draw(); }); $('#search-searches-list .reset_filter').css('display', 'none'); }); // Add event listener for opening and closing details $('#search-searches-list tbody').on('click', 'td.details-control', function (e) { e.preventDefault(); var tr = $(this).closest('tr'); var row = table.row( tr ); if ( row.child.isShown() ) { // This row is already open - close it row.child.hide(); tr.removeClass('shown'); } else { // Open this row row.child( format(row.data()) ).show(); tr.addClass('shown'); } }); }); </script>