employee.blade.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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/employee/add') }}" class="btn btn-sm btn-info pull-right"><i class="fa fa-plus"></i> Add Employee</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>Name</th>
  29. <th>Email Address</th>
  30. <th>Phone Number</th>
  31. <th>Present Address</th>
  32. <th>Status</th>
  33. <th width="25%">Action</th>
  34. </tr>
  35. </thead>
  36. <tbody>
  37. @if($all)
  38. <?php $i=1;?>
  39. @foreach($all as $row)
  40. <tr>
  41. <td>{{ $i++ }}</td>
  42. <td>{{ $row->name }}</td>
  43. <td>{{ $row->personal_email }}</td>
  44. <td>{{ $row->phone }}</td>
  45. <td>{{ $row->present_address }}</td>
  46. <td style="text-align: center;">
  47. @if($row->status == 4)
  48. <label class="label label-primary"> Resigned</label>
  49. @else
  50. <label class="label label-success"> Present</label>
  51. @endif
  52. </td>
  53. <td class="parent-action-cls">
  54. <a href="{{ url('admin/employee/show') }}/{{ $row->id }}" class='btn btn-default btn-sm' data-toggle="tooltip" title="View" data-placement="top"><i class="fa fa-eye"></i></a>
  55. @if(Auth::user()->utype==1)
  56. <a href="{{ url('admin/employee/edit_employee') }}/{{ $row->id }}" class='btn btn-default btn-sm' data-toggle="tooltip" title="Edit" data-placement="top"><i class="fa fa-edit"></i></a>
  57. <a href="{{ url('admin/employee/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>
  58. @if($row->id == @$row->user->employee_id)
  59. <input type="text" name="" class="hidden" value="{{ $row->user['id'] }}" />
  60. <button class='btn btn-default btn-sm change-pass' data-toggle="modal" data-target="#change_password" ><i class="fa fa-key"></i> Change Password</button>
  61. @else
  62. <a href="{{ url('admin/employee/add_user') }}/{{ $row->id }}" class='btn btn-info btn-sm edit-btn' data-toggle="tooltip" title="Employee To User Create" data-placement="top" ><i class="fa fa-plus"></i> Add a User</a>
  63. @endif
  64. @endif
  65. </td>
  66. </tr>
  67. @endforeach
  68. @endif
  69. </tbody>
  70. </table>
  71. </div>
  72. </div>
  73. <!-- Change password start -->
  74. <div class="modal fade" id="change_password" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel">
  75. <div class="modal-dialog" role="document">
  76. <div class="modal-content">
  77. <div class="modal-header">
  78. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  79. <h4 class="modal-title" id="gridSystemModalLabel">Change password</h4>
  80. </div>
  81. <div class="modal-body">
  82. <form action="{{url('admin/employee/change_password')}}" method="POST">
  83. {{ csrf_field() }}
  84. <input type="hidden" name="emp_id" value="" class="change-pass-user-id">
  85. <div class="form-group">
  86. <label for="password">Password</label>
  87. <input type="password" name="password" class="form-control" id="" placeholder="Password" required="">
  88. </div>
  89. <div class="form-group">
  90. <label for="password_confirmation">Confirm Password</label>
  91. <input type="password" name="password_confirmation" class="form-control" id="password_confirmation" placeholder="Confirm Password" required="">
  92. </div>
  93. </div>
  94. <div class="modal-footer">
  95. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  96. <button type="submit" class="btn btn-primary">Submit</button>
  97. </div>
  98. </form>
  99. </div>
  100. </div>
  101. </div>
  102. <!-- Change password end -->
  103. @stop
  104. @section('style')
  105. <style>
  106. .modal-dialog {
  107. width: 40% !important;
  108. height: 40% !important;
  109. }
  110. .modal-content {
  111. height: auto;
  112. min-height: 40% !important;
  113. border-radius: 0;
  114. }
  115. </style>
  116. @stop
  117. @section('script')
  118. <script src="{{ asset('/assets/') }}/js/jquery.dataTables.min.js"></script>
  119. <script src="{{ asset('/assets/') }}/js/dataTables.bootstrap.min.js"></script>
  120. <script src="{{ asset('/assets/') }}/switch/rcswitcher.js"></script>
  121. <script src="{{ asset('/assets/') }}/alert/sweetalert.min.js"></script>
  122. <script src="{{ asset('/assets/') }}/alert/pnotify.js"></script>
  123. <script src="{{ asset('/assets/') }}/alert/notify.js"></script>
  124. <script type="text/javascript">
  125. $(document).ready(function(){
  126. $('[data-toggle="tooltip"]').tooltip();
  127. $("input[type='checkbox']").rcSwitcher();
  128. });
  129. $(document).ready(function() {
  130. $('body').on('hidden.bs.modal', '.modal', function () {
  131. $(this).removeData('bs.modal');
  132. });
  133. var table=$("#example").DataTable({
  134. "searching": true,
  135. "lengthChange": true,
  136. "ordering": true,
  137. stateSave: true
  138. });
  139. $('.change-pass').click(function(event) {
  140. var id = $(this).parent('.parent-action-cls').children('input').val();
  141. $('.change-pass-user-id').val(id);
  142. });
  143. $("input[type='checkbox']").rcSwitcher().on({'toggle.rcSwitcher': function( e, dataObj, changeType ){
  144. var id = $(this).data('id');
  145. var urll="{{ url('admin/employee/status') }}/"+id;
  146. var msg_success = 'Status Updated Successfully.';
  147. var msg_error = 'Something went wrong!';
  148. $.ajax({
  149. url:urll,
  150. success: function(data){
  151. notify('success',msg_success);
  152. },
  153. error: function (data) {
  154. notify('error',msg_error);
  155. }
  156. });
  157. }
  158. });
  159. });
  160. </script>
  161. @stop
  162. @if(Session::has('msg'))
  163. <div class="alert alert-success center-block msg_alt" >
  164. <a class="close" data-dismiss="alert" href="#">&times;</a>
  165. <strong><i class="fa fa-check"></i></strong>&nbsp;
  166. {{Session::get('msg')}}
  167. </div>
  168. @endif