index.blade.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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/payroll_head/add') }}" class="btn btn-sm btn-info pull-right"><i class="fa fa-plus"></i> Add Payroll Head</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>head 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/payroll_head/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/payroll_head/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 type="text/javascript">
  84. $(document).ready(function(){
  85. $('[data-toggle="tooltip"]').tooltip();
  86. $("input[type='checkbox']").rcSwitcher();
  87. });
  88. $(document).ready(function() {
  89. $('body').on('hidden.bs.modal', '.modal', function () {
  90. $(this).removeData('bs.modal');
  91. });
  92. var table=$("#example").DataTable({
  93. "searching": true,
  94. "lengthChange": true,
  95. "ordering": true,
  96. stateSave: true
  97. });
  98. $("input[type='checkbox']").rcSwitcher().on({'toggle.rcSwitcher': function( e, dataObj, changeType ){
  99. var id = $(this).data('id');
  100. var urll="{{ url('admin/payroll_head/status') }}/"+id;
  101. var msg_success = 'Status Updated Successfully.';
  102. var msg_error = 'Something went wrong!';
  103. $.ajax({
  104. url:urll,
  105. success: function(data){
  106. notify('success',msg_success);
  107. },
  108. error: function (data) {
  109. notify('error',msg_error);
  110. }
  111. });
  112. }
  113. });
  114. });
  115. </script>
  116. @stop
  117. @if(Session::has('msg'))
  118. <div class="alert alert-success center-block msg_alt" >
  119. <a class="close" data-dismiss="alert" href="#">&times;</a>
  120. <strong><i class="fa fa-check"></i></strong>&nbsp;
  121. {{Session::get('msg')}}
  122. </div>
  123. @endif