PageRenderTime 33ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/resources/views/admin/user/list.blade.php

https://bitbucket.org/coredeveloper2013/navipi-test
PHP | 107 lines | 91 code | 5 blank | 11 comment | 0 complexity | 4eff6f82db8896ecfbc98b9709dcedc5 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, LGPL-2.1
  1. <?php
  2. /**
  3. * Page resource built upon CoC
  4. * You can leave this as it is
  5. * or feel free to remove these configuration and customize
  6. */
  7. $resource = 'user';
  8. $resource_pl = str_plural($resource);
  9. $page_title = ucfirst($resource_pl);
  10. ?>
  11. @extends('admin.layouts.app')
  12. @section('pageTitle', 'Dashboard')
  13. @section('content')
  14. <!-- Content Wrapper. Contains page content -->
  15. <div class="content-wrapper">
  16. <!-- Content Header (Page header) -->
  17. <section class="content-header">
  18. <h1>
  19. {{ $page_title }}
  20. <small>List</small>
  21. </h1>
  22. <ol class="breadcrumb">
  23. <li><a href="javascript:void(0);"><i class="fa fa-home"></i> Home</a></li>
  24. <li><a href="{!! url('admin/dashboard') !!}"><i class="fa fa-dashboard"></i> Dashboard</a></li>
  25. <li class="active">{{ $page_title }}</li>
  26. </ol>
  27. </section>
  28. <!-- Main content -->
  29. <section class="content">
  30. <div class="row">
  31. <div class="col-xs-12">
  32. <div class="box">
  33. <div class="box-header">
  34. <h3 class="box-title">All {{ $resource }} list</h3>
  35. </div><!-- /.box-header -->
  36. <div class="box-body">
  37. @if(session('success'))
  38. <div class="alert alert-success">
  39. {!! session('success') !!}
  40. </div>
  41. @endif
  42. <table id="list_table" class="table table-bordered table-striped">
  43. <thead>
  44. <tr> <th><input type="checkbox" id="bulkDelete" /> <button id="deleteTriger">Bulk Delete</button></th>
  45. <th>Name</th>
  46. <th>Email</th>
  47. <th>Created On</th>
  48. <th>Action</th>
  49. </tr>
  50. </thead>
  51. <tbody>
  52. @if(${$resource_pl} !== null)
  53. @foreach($users as $ky=>$row) <tr> <td><input type="checkbox" class="deleteRow" value="{{$row->id}}" /> #{!!$ky+1!!} </td>
  54. <td>{!! $row->first_name . ' ' . $row->last_name !!}</td>
  55. <td>{!! $row->email !!}</td>
  56. <td>{!! date('d-m-Y',strtotime($row->created_at)) !!}</td>
  57. <?php
  58. /*<td>
  59. <select class="status">
  60. <option data-id="{{ $row->id }}" class="bg-green-active color-palette" value="Y" {{ $row->status == 'Y'?'selected':'' }}>Active</option>
  61. <option data-id="{{ $row->id }}" class="bg-red-active color-palette" value="N" {{ $row->status == 'N'?'selected':'' }}>Block</option>
  62. <option data-id="{{ $row->id }}" class="bg-orange-active color-palette" value="E" {{ $row->status == 'E'?'selected':'' }}>Pending</option>
  63. </select>
  64. </td> */ ?>
  65. <td>
  66. <a href="{!! admin_url('user/' . $row->id . '/edit') !!}" class="btn btn-sm btn-warning td-btn"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit</a> <form method="POST" action="{!! admin_url('user/block') !!}" onsubmit="return confirm('Are you sure to {{$row->status=='Y'?'block':'unblock'}} {!! $row->first_name !!}?');"> <input name="uid" type="hidden" value="{{$row->id}}">{{ csrf_field() }} <button class="btn btn-sm btn-{{$row->status=='Y'?'success':'danger'}} td-btn" type="submit"><i class="fa fa-ban" aria-hidden="true"></i> {{$row->status=='Y'?'Unblocked':'Blocked'}}</button> </form>
  67. <form method="POST" action="{!! admin_url('user/' . $row->id) !!}"
  68. onsubmit="return confirm('Are you sure to remove {!! $row->first_name !!}?');">
  69. <input name="_method" type="hidden" value="DELETE">{{ csrf_field() }}
  70. <button class="btn btn-sm btn-danger td-btn" type="submit"><i class="fa fa-trash" aria-hidden="true"></i> Delete</button>
  71. </form>
  72. </td>
  73. </tr>
  74. @endforeach
  75. @else
  76. <tr>
  77. <td colspan="5">No user Found..</td>
  78. </tr>
  79. @endif
  80. </tbody>
  81. </table>
  82. </div><!-- /.box-body -->
  83. <div class="paginationDiv">
  84. {!! ${$resource_pl}->render() !!}
  85. </div>
  86. </div><!-- /.box -->
  87. </div>
  88. </div>
  89. </section>
  90. <!-- /.content -->
  91. </div><!-- /.content-wrapper -->
  92. @endsection
  93. @section('customScript')
  94. <script type="text/javascript">
  95. $(function () {
  96. $("#list_table").DataTable({
  97. "paging": false,
  98. "ordering": false
  99. }); $(document).on('click',"#bulkDelete",function() { var status = this.checked; $(".deleteRow").each( function() { $(this).prop("checked",status); }); }); $('#deleteTriger').on("click", function(event){ if( $('.deleteRow:checked').length > 0 ){ var ids = []; $('.deleteRow').each(function(){ if($(this).is(':checked')) { ids.push($(this).val()); } }); var ids_string = ids.toString(); $.ajax({ type: "POST", headers: {'X-CSRF-TOKEN': "{!! csrf_token() !!}"}, url: "{{url('admin/user-delete-all')}}", data: {data_ids:ids_string}, success: function(result) { location.reload(); }, async:false }); } });
  100. });
  101. </script>
  102. @endsection