users.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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. <button class="btn btn-success btn-sm pull-right" data-toggle="modal" data-target="#id_add_user"><i class="fa fa-plus"></i> Add user</button>
  18. </div>
  19. </header>
  20. <div class="panel-body">
  21. <div class="clearfix"></div>
  22. <table class="table table-bordered" id="example">
  23. <thead>
  24. <tr>
  25. <th>
  26. #
  27. </th>
  28. <th>
  29. Name
  30. </th>
  31. <th>
  32. Email
  33. </th>
  34. <th>
  35. Mobile
  36. </th>
  37. <th>
  38. Address
  39. </th>
  40. <!-- <th width="5%">
  41. Company
  42. </th> -->
  43. <th>
  44. User type
  45. </th>
  46. <th>
  47. Status
  48. </th>
  49. <th width="22%">
  50. Action
  51. </th>
  52. </tr>
  53. </thead>
  54. <tbody>
  55. @if($all)
  56. <?php $i=1;?>
  57. @foreach($all as $row)
  58. <tr>
  59. <td>
  60. {{$i++}}
  61. </td>
  62. <td>
  63. {{$row->name}}
  64. </td>
  65. <td>
  66. {{$row->email}}
  67. </td>
  68. <td>
  69. {{$row->mob}}
  70. </td>
  71. <td>
  72. {{$row->address}}
  73. </td>
  74. <!-- <td>
  75. {{$row->company}}
  76. </td> -->
  77. <td>
  78. @if($row->utype == 1)
  79. <span class="label label-success">{{"Admin"}}</span>
  80. @elseif($row->utype == 2)
  81. <span class="label label-primary">{{"User"}}</span>
  82. @elseif($row->utype == 3)
  83. <span class="label label-default">{{"Client"}}</span>
  84. @endif
  85. </td>
  86. <td style="text-align: center;">
  87. <input type="checkbox" name="status{{ $row->id }}" @if($row->active == 1) {{ 'checked' }} @endif data-id="{{ $row->id }}">
  88. </td>
  89. <td class="parent-action-cls">
  90. <a href="{{ url('admin/user_profile') }}/{{ $row->id }}" class='btn btn-default btn-sm' data-toggle="tooltip" title="View" data-placement="top"><i class="fa fa-eye"></i></a>
  91. @if(Auth::user()->utype==1)
  92. <a href="#" class='btn btn-default btn-sm' data-toggle="tooltip" title="Edit" data-placement="top"><i class="fa fa-edit"></i></a>
  93. <a href="#" 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>
  94. <input type="text" name="" class="hidden" value="{{ $row->id }}" />
  95. <a class='btn btn-info btn-sm change-pass' data-toggle="modal" data-target="#change_password"><i class="fa fa-key" data-toggle="tooltip" title="Change Password" data-placement="top" ></i> </a>
  96. @endif
  97. </td>
  98. </tr>
  99. @endforeach
  100. @endif
  101. </tbody>
  102. </table>
  103. </div>
  104. </div>
  105. <!-- Modal Add User -->
  106. <div class="modal fade" id="id_add_user" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel">
  107. <div class="modal-dialog" role="document">
  108. <div class="modal-content">
  109. <div class="modal-header">
  110. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  111. <h4 class="modal-title" id="gridSystemModalLabel">Add user</h4>
  112. </div>
  113. <div class="modal-body">
  114. <form action="{{url('admin/add_user')}}" method="POST">
  115. {{ csrf_field() }}
  116. <div class="form-group">
  117. <label for="exampleInputEmail1">Name*</label>
  118. <input type="text" name="name" class="form-control" id="" placeholder="Name" required="">
  119. </div>
  120. <div class="form-group">
  121. <label for="exampleInputEmail1">Employee ID*</label>
  122. <input type="text" name="e_id" class="form-control" id="exampleInputEmail1" placeholder="Employee ID" required="">
  123. </div>
  124. <div class="form-group">
  125. <label for="exampleInputEmail1">Designation*</label>
  126. <input type="text" name="designation" class="form-control" id="exampleInputEmail1" placeholder="Designation" required="">
  127. </div>
  128. <div class="form-group">
  129. <label for="exampleInputEmail1">Email address*</label>
  130. <input type="email" name="email" class="form-control" id="exampleInputEmail1" placeholder="Email" required="">
  131. </div>
  132. <div class="form-group">
  133. <label for="exampleInputEmail1">Mobile*</label>
  134. <input type="text" name="mob" class="form-control" id="" placeholder="Mobile" required="">
  135. </div>
  136. <div class="form-group">
  137. <label for="exampleInputEmail1">Address*</label>
  138. <input type="text" name="address" class="form-control" id="" placeholder="Address" required="">
  139. </div>
  140. <div class="form-group">
  141. <label for="exampleInputEmail1">Company</label>
  142. <select class="form-control" name="company" placeholder="Company">
  143. <option>Select A Company</option>
  144. @foreach($client_list as $client)
  145. <option value="{{ $client->id }}">{{ $client->name }}</option>
  146. @endforeach
  147. </select>
  148. </div>
  149. <div class="form-group">
  150. <label for="exampleInputEmail1">Website</label>
  151. <input type="text" name="website" class="form-control" id="" placeholder="Website">
  152. </div>
  153. <div class="form-group">
  154. <label for="exampleInputEmail1">User type*</label>
  155. <select class="form-control" name="user_type">
  156. <option value="2">User</option>
  157. <option value="1">Admin</option>
  158. <option value="3">Client</option>
  159. </select>
  160. </div>
  161. <div class="form-group">
  162. <label for="permission">Assign User Role* </label>
  163. <select class="form-control" name="role" required="">
  164. <option disabled selected value>Choose One</option>
  165. @foreach($roles as $info)
  166. <option value="{{ $info->id }}">{{ $info->display_name }}</option>
  167. @endforeach
  168. </select>
  169. </div>
  170. <div class="form-group">
  171. <label for="exampleInputPassword1">Password*</label>
  172. <input type="password" name="password" class="form-control" id="exampleInputPassword1" placeholder="Password" value="123456" required="">
  173. </div>
  174. </div>
  175. <div class="modal-footer">
  176. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  177. <button type="submit" class="btn btn-primary">Submit</button>
  178. </div>
  179. </form>
  180. </div><!-- /.modal-content -->
  181. </div><!-- /.modal-dialog -->
  182. </div>
  183. <!-- Change password start -->
  184. <div class="modal fade" id="change_password" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel">
  185. <div class="modal-dialog" role="document">
  186. <div class="modal-content">
  187. <div class="modal-header">
  188. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  189. <h4 class="modal-title" id="gridSystemModalLabel">Change password</h4>
  190. </div>
  191. <div class="modal-body">
  192. <form action="{{url('admin/change_user_pass')}}" method="POST">
  193. {{ csrf_field() }}
  194. <input type="hidden" name="user_id" value="" class="change-pass-user-id">
  195. <div class="form-group">
  196. <label for="exampleInputPassword1">Password</label>
  197. <input type="password" name="password" class="form-control" id="exampleInputPassword1" placeholder="Password" required="">
  198. </div>
  199. <div class="form-group">
  200. <label for="exampleInputPassword1">Confirm Password</label>
  201. <input type="password" name="password_confirmation" class="form-control" id="exampleInputPassword1" placeholder="Password" required="">
  202. </div>
  203. </div>
  204. <div class="modal-footer">
  205. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  206. <button type="submit" class="btn btn-primary">Submit</button>
  207. </div>
  208. </form>
  209. </div>
  210. </div>
  211. </div>
  212. <!-- Change password end -->
  213. @stop
  214. @section('style')
  215. <style>
  216. .modal-dialog {
  217. width: 40% !important;
  218. height: 40% !important;
  219. }
  220. .modal-content {
  221. height: auto;
  222. min-height: 40% !important;
  223. border-radius: 0;
  224. }
  225. </style>
  226. @stop
  227. @section('script')
  228. <script src="{{ asset('/assets/') }}/js/jquery.dataTables.min.js"></script>
  229. <script src="{{ asset('/assets/') }}/js/dataTables.bootstrap.min.js"></script>
  230. <script src="{{ asset('/assets/') }}/switch/rcswitcher.js"></script>
  231. <script src="{{ asset('/assets/') }}/alert/sweetalert.min.js"></script>
  232. <script src="{{ asset('/assets/') }}/alert/pnotify.js"></script>
  233. <script src="{{ asset('/assets/') }}/alert/notify.js"></script>
  234. <script type="text/javascript">
  235. $(document).ready(function(){
  236. $('[data-toggle="tooltip"]').tooltip();
  237. $("input[type='checkbox']").rcSwitcher();
  238. });
  239. $(document).ready(function() {
  240. $('body').on('hidden.bs.modal', '.modal', function () {
  241. $(this).removeData('bs.modal');
  242. });
  243. var table=$("#example").DataTable({
  244. "searching": true,
  245. "lengthChange": true,
  246. "ordering": true,
  247. stateSave: true
  248. });
  249. $("input[type='checkbox']").rcSwitcher().on({'toggle.rcSwitcher': function( e, dataObj, changeType ){
  250. var id = $(this).data('id');
  251. var urll="{{ url('admin/user_active') }}/"+id;
  252. var msg_success = 'Status Updated Successfully.';
  253. var msg_error = 'Something went wrong!';
  254. $.ajax({
  255. url:urll,
  256. success: function(data){
  257. notify('success',msg_success);
  258. },
  259. error: function (data) {
  260. notify('error',msg_error);
  261. }
  262. });
  263. }
  264. });
  265. $('.change-pass').click(function(event) {
  266. var id = $(this).parent('.parent-action-cls').children('input').val();
  267. $('.change-pass-user-id').val(id);
  268. });
  269. });
  270. </script>
  271. @stop
  272. @if ($message = Session::get('success'))
  273. <script type="text/javascript">
  274. $(document).ready(function(){
  275. var msg = "{{ $message }}";
  276. notify('success',msg);
  277. });
  278. </script>
  279. @endif