index.blade.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. @extends('layouts.master')
  2. @section('content')
  3. <!-- DataTables -->
  4. <link rel="stylesheet" href="{{ asset('/assets/') }}/css/dataTables.bootstrap.min.css">
  5. <link rel="stylesheet" href="{{ asset('/assets/') }}/switch/rcswitcher.css">
  6. <link rel="stylesheet" href="{{ asset('/assets/') }}/alert/pnotify.css">
  7. <link rel="stylesheet" href="{{ asset('/assets/') }}/alert/sweetalert.css">
  8. <link rel="stylesheet" href="{{ asset('/assets/') }}/alert/sweet-alert-animations.css">
  9. <div class="panel panel-default" style="min-height: 500px">
  10. <!-- Default panel contents -->
  11. <div class="panel-heading"></div>
  12. <header class="panel-heading" style="height:50px;">
  13. <div class="pull-left">
  14. {{$title}}
  15. </div>
  16. <div>
  17. @if(\Auth::user()->utype==1)
  18. <a href="{{ url('admin/designation/add') }}" class="btn btn-sm btn-info pull-right"><i class="fa fa-plus"></i> Add Designation</a> <br><br>
  19. @endif
  20. </div>
  21. </header>
  22. <div class="panel-body">
  23. <div class="clearfix"></div>
  24. <table class="table table-bordered " id="example">
  25. <thead>
  26. <tr>
  27. <th>#</th>
  28. <th>Designation Name</th>
  29. <th>Status</th>
  30. <th>Action</th>
  31. </tr>
  32. </thead>
  33. <tbody>
  34. @if($all)
  35. <?php $i=1; ?>
  36. @foreach($all as $row)
  37. <tr>
  38. <td>{{ $i++ }}</td>
  39. <td>{{ $row->name }}</td>
  40. <td style="text-align: center;">
  41. <input type="checkbox" name="status{{ $row->id }}" @if($row->status == 1) {{ 'checked' }} @endif data-id="{{ $row->id }}">
  42. </td>
  43. <td>
  44. @if(\Auth::user()->utype==1)
  45. <a href="{{ url('admin/designation/edit') }}/{{ $row->id }}" class='btn btn-default btn-sm' data-toggle="tooltip" title="Edit" data-placement="top"><i class="fa fa-edit"></i></a>
  46. <a href="{{ url('admin/designation/delete') }}/{{ $row->id }}" class='btn btn-default btn-sm' onclick="return confirm('Are you sure to delete this item ?')" data-toggle="tooltip" title="Delete" data-placement="top"><i class="fa fa-trash-o"></i></a>
  47. @endif
  48. </td>
  49. </tr>
  50. @endforeach
  51. @endif
  52. </tbody>
  53. </table>
  54. </div>
  55. </div>
  56. <div class="modal fade" id="modalPreview">
  57. <div class="modal-dialog" style='width: 70%;'>
  58. </div>
  59. </div>
  60. <div id"statusmsg">
  61. </div>
  62. @stop
  63. @section('style')
  64. <style>
  65. .modal-dialog {
  66. width: 70% !important;
  67. height: 70% !important;
  68. }
  69. .modal-content {
  70. height: auto;
  71. min-height: 70% !important;
  72. border-radius: 0;
  73. }
  74. </style>
  75. @stop
  76. @section('script')
  77. <script src="{{ asset('/assets/') }}/js/jquery.dataTables.min.js"></script>
  78. <script src="{{ asset('/assets/') }}/js/dataTables.bootstrap.min.js"></script>
  79. <script src="{{ asset('/assets/') }}/switch/rcswitcher.js"></script>
  80. <script src="{{ asset('/assets/') }}/alert/sweetalert.min.js"></script>
  81. <script src="{{ asset('/assets/') }}/alert/pnotify.js"></script>
  82. <script src="{{ asset('/assets/') }}/alert/notify.js"></script>
  83. </script>
  84. <script type="text/javascript">
  85. $(document).ready(function(){
  86. $('[data-toggle="tooltip"]').tooltip();
  87. $("input[type='checkbox']").rcSwitcher();
  88. });
  89. $(document).ready(function() {
  90. $('body').on('hidden.bs.modal', '.modal', function () {
  91. $(this).removeData('bs.modal');
  92. });
  93. var table=$("#example").DataTable({
  94. "searching": true,
  95. "lengthChange": true,
  96. "ordering": true,
  97. stateSave: true
  98. });
  99. $("input[type='checkbox']").rcSwitcher().on({'toggle.rcSwitcher': function( e, dataObj, changeType ){
  100. var id = $(this).data('id');
  101. var urll="{{ url('admin/designation/status') }}/"+id;
  102. var msg_success = 'Status Updated Successfully.';
  103. var msg_error = 'Something went wrong!';
  104. $.ajax({
  105. url:urll,
  106. success: function(data){
  107. notify('success',msg_success);
  108. },
  109. error: function (data) {
  110. notify('error',msg_error);
  111. }
  112. });
  113. }
  114. });
  115. });
  116. </script>
  117. @stop
  118. @if(Session::has('msg'))
  119. <div class="alert alert-success center-block msg_alt" >
  120. <a class="close" data-dismiss="alert" href="#">&times;</a>
  121. <strong><i class="fa fa-check"></i></strong>&nbsp;
  122. {{Session::get('msg')}}
  123. </div>
  124. @endif