index.blade.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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">
  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/grade/add') }}" class="btn btn-sm btn-info pull-right"><i class="fa fa-plus"></i> Add Grade</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>Grade Name</th>
  29. <th>Amount</th>
  30. <th>Status</th>
  31. <th>Action</th>
  32. </tr>
  33. </thead>
  34. <tbody>
  35. @if($all)
  36. <?php $i=1; ?>
  37. @foreach($all as $row)
  38. <tr>
  39. <td>{{ $i++ }}</td>
  40. <td>{{ $row->name }}</td>
  41. <td>
  42. @if(!empty($row->gradeAmount))
  43. @php $amount = 0 @endphp
  44. @foreach($row->gradeAmount as $value)
  45. @php $amount = $amount+$value->amount @endphp
  46. @endforeach
  47. {{$amount}}
  48. @else
  49. N/A
  50. @endif
  51. </td>
  52. <td style="text-align: center;">
  53. <input type="checkbox" name="status{{ $row->id }}" @if($row->status == 1) {{ 'checked' }} @endif data-id="{{ $row->id }}">
  54. </td>
  55. <td>
  56. @if(\Auth::user()->utype==1)
  57. <a href="{{ url('admin/grade/edit') }}/{{ $row->id }}" class='btn btn-default btn-sm' data-toggle="tooltip" title="Edit" data-placement="top"><i class="fa fa-edit"></i></a>
  58. <a href="{{ url('admin/grade/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>
  59. @endif
  60. </td>
  61. </tr>
  62. @endforeach
  63. @endif
  64. </tbody>
  65. </table>
  66. </div>
  67. </div>
  68. <div class="modal fade" id="modalPreview">
  69. <div class="modal-dialog" style='width: 70%;'>
  70. </div>
  71. </div>
  72. @stop
  73. @section('style')
  74. <style>
  75. .modal-dialog {
  76. width: 70% !important;
  77. height: 70% !important;
  78. }
  79. .modal-content {
  80. height: auto;
  81. min-height: 70% !important;
  82. border-radius: 0;
  83. }
  84. </style>
  85. @stop
  86. @section('script')
  87. <script src="{{ asset('/assets/') }}/js/jquery.dataTables.min.js"></script>
  88. <script src="{{ asset('/assets/') }}/js/dataTables.bootstrap.min.js"></script>
  89. <script src="{{ asset('/assets/') }}/switch/rcswitcher.js"></script>
  90. <script src="{{ asset('/assets/') }}/alert/sweetalert.min.js"></script>
  91. <script src="{{ asset('/assets/') }}/alert/pnotify.js"></script>
  92. <script src="{{ asset('/assets/') }}/alert/notify.js"></script>
  93. <script type="text/javascript">
  94. $(document).ready(function(){
  95. $('[data-toggle="tooltip"]').tooltip();
  96. $("input[type='checkbox']").rcSwitcher();
  97. });
  98. $(document).ready(function() {
  99. $('body').on('hidden.bs.modal', '.modal', function () {
  100. $(this).removeData('bs.modal');
  101. });
  102. var table=$("#example").DataTable({
  103. "searching": true,
  104. "lengthChange": true,
  105. "ordering": true,
  106. stateSave: true
  107. });
  108. $("input[type='checkbox']").rcSwitcher().on({'toggle.rcSwitcher': function( e, dataObj, changeType ){
  109. var id = $(this).data('id');
  110. var urll="{{ url('admin/grade/status') }}/"+id;
  111. var msg_success = 'Status Updated Successfully.';
  112. var msg_error = 'Something went wrong!';
  113. $.ajax({
  114. url:urll,
  115. success: function(data){
  116. notify('success',msg_success);
  117. },
  118. error: function (data) {
  119. notify('error',msg_error);
  120. }
  121. });
  122. },
  123. });
  124. });
  125. </script>
  126. @stop
  127. @if(Session::has('msg'))
  128. <div class="alert alert-success center-block msg_alt" >
  129. <a class="close" data-dismiss="alert" href="#">&times;</a>
  130. <strong><i class="fa fa-check"></i></strong>&nbsp;
  131. {{Session::get('msg')}}
  132. </div>
  133. @endif