admin_dashboard.blade.php_1 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. @extends('layouts.app')
  2. @section('css')
  3. <link href="{!! env('APP_ASSETS') !!}css/dashboard.css" rel="stylesheet" type="text/css">
  4. @endsection
  5. @section('content')
  6. <div class="content-wrapper">
  7. <div class="container-full">
  8. <section class="content">
  9. <div class="row">
  10. <div class="col-xl-4 col-md-6">
  11. <div class="card bg-primary text-white mb-4">
  12. <div class="card-body">{!! \App\Restaurants::whereNull('deleted_at')->count() !!} Restaurants!</div>
  13. <div class="card-footer d-flex align-items-center justify-content-between">
  14. <a class="small text-white stretched-link" href="{!! env('APP_URL') !!}restaurants">View List</a>
  15. <div class="small text-white"><i class="fas fa-angle-right"></i></div>
  16. </div>
  17. </div>
  18. </div>
  19. <div class="col-xl-4 col-md-6">
  20. <div class="card bg-warning text-white mb-4">
  21. <div class="card-body">{!! \App\Recipes::whereNull('deleted_at')->count() !!} Recipes!</div>
  22. <div class="card-footer d-flex align-items-center justify-content-between">
  23. <a class="small text-white stretched-link" href="{!! env('APP_URL') !!}restaurants">View Details</a>
  24. <div class="small text-white"><i class="fas fa-angle-right"></i></div>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="col-xl-4 col-md-6">
  29. <div class="card bg-success text-white mb-4">
  30. <div class="card-body">11 New Reviews!</div>
  31. <div class="card-footer d-flex align-items-center justify-content-between">
  32. <a class="small text-white stretched-link" href="#!">View Details</a>
  33. <div class="small text-white"><i class="fas fa-angle-right"></i></div>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="card mb-4">
  39. <div class="card-header">
  40. <i class="fas fa-table mr-1"></i>
  41. Recent Restaurants
  42. </div>
  43. <div class="card-body">
  44. <div class="table-responsive">
  45. <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
  46. <thead>
  47. <tr class="text-uppercase">
  48. <th>Resto</th>
  49. <th width="10%">Resto Name</th>{{--
  50. <th>Short Description</th>--}}
  51. <th width="30%">Address</th>
  52. {{-- <th>Phone</th>--}}
  53. <th>Total Recipe</th>
  54. <td>Action?</td>
  55. <th>Action</th>
  56. </tr>
  57. </thead>
  58. <tbody>
  59. @php
  60. $restaurants = \App\Restaurants::whereNull('deleted_at')->limit(10)->orderBy('created_at','DESC')->get();
  61. @endphp
  62. <!----><!---->
  63. @if(isset($restaurants) && $restaurants->count() > 0)
  64. @foreach($restaurants as $restaurant)
  65. <tr>
  66. <td>
  67. @if(isset($restaurant->photos))
  68. <img class="img-profile rounded-circle" width="40px" src="{!! $restaurant->photos->file_name !!}">
  69. @else
  70. <img class="img-profile rounded-circle" src="{!! env('APP_ASSETS') !!}img/user/1.png">
  71. @endif
  72. </td>
  73. <td> {!! $restaurant->name !!} </td>{{--
  74. <td>{!! $restaurant->short_description !!}</td>--}}
  75. <td>{!! nl2br($restaurant->address) !!}</td>
  76. {{-- <td>{!! $restaurant->phone !!}</td>--}}
  77. <td>{!! isset($restaurant->recipes)?$restaurant->recipes->count():0 !!}</td>
  78. <td>{!! $restaurant->active?'<span class="badge badge-success">Active</span>':'<span class="badge badge-danger">In-active</span>' !!}</td>
  79. <td>
  80. <!-- <a href="{!! env('APP_URL') !!}restaurant/show/{!! \App\Helpers\CommonMethods::encrypt($restaurant->id) !!}" class="btn btn-success btn-sm" data-toggle="tooltip" data-placement="top" title="View"><i class="feather-eye"></i></a> -->
  81. <a href="{!! env('APP_URL') !!}restaurant/edit/{!! \App\Helpers\CommonMethods::encrypt($restaurant->id) !!}" class="btn btn-sm btn-primary" data-toggle="tooltip" data-placement="top" title="Edit"><i class="glyphicon glyphicon-edit"></i></a>
  82. <a href="javascript:;" data-id="{!! $restaurant->id !!}" class="btn btn-sm btn-danger delete-restaurant" data-toggle="tooltip" data-placement="top" title="Delete"><i class="glyphicon glyphicon-trash"></i></a>
  83. <a href="#!" class="btn btn-sm btn-info create-credentials" data-id="{!! $restaurant->id !!}" data-toggle="tooltip" data-placement="top" title="New Credentials"><i class="feather-lock"></i></a>
  84. </td>
  85. </tr>
  86. @endforeach
  87. @endif
  88. </tbody>
  89. </table>
  90. </div>
  91. </div>
  92. </div>
  93. </section>
  94. </div>
  95. </div>
  96. <div class="modal" id="create-credentials" tabindex="-1" role="dialog">
  97. <div class="modal-dialog" role="document">
  98. <div class="modal-content">
  99. <div class="modal-header">
  100. <h5 class="modal-title">Modal title</h5>
  101. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  102. <span aria-hidden="true">&times;</span>
  103. </button>
  104. </div>
  105. <div class="modal-body">
  106. <table border="0" style="width: 100%">
  107. <tr>
  108. <th width="30%">Username</th>
  109. <td id="username"></td>
  110. </tr>
  111. <tr>
  112. <th>Password</th>
  113. <td id="password"></td>
  114. </tr>
  115. </table>
  116. <div class="alert alert-success" style="display: none;">Credentails are created successfully.</div>
  117. </div>
  118. <div class="modal-footer">
  119. <button type="button" class="btn btn-primary save-credentails">Save Credentails</button>
  120. <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. @endsection
  126. @section('js')
  127. <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js" crossorigin="anonymous"></script>
  128. <!-- Chart Js -->
  129. <script src="{!! env('APP_ASSETS') !!}assets/demo/chart-area-demo.js"></script>
  130. <script src="{!! env('APP_ASSETS') !!}assets/demo/chart-bar-demo.js"></script>
  131. <script src="{!! env('APP_ASSETS') !!}assets/demo/chart-pie-demo.js"></script>
  132. <!-- Datatable Js -->
  133. <script src="{!! env('APP_ASSETS') !!}vendor/dataTables/dataTables/js/jquery.dataTables.min.js"></script>
  134. <script src="{!! env('APP_ASSETS') !!}vendor/dataTables/dataTables/js/dataTables.bootstrap.min.js"></script>
  135. <script src="{!! env('APP_ASSETS') !!}assets/demo/datatables-demo.js"></script>
  136. <script>
  137. var resto_id = 0;
  138. $(function () {
  139. $('#dataTable').DataTable({
  140. "bSort": true,
  141. "searching": false,
  142. "paging": false,
  143. "info": false,
  144. "bLengthChange": false,
  145. language: {
  146. paginate: {
  147. next: '<img src="{!! env("APP_ASSETS") !!}images/icons/next.png">', // or '→'
  148. previous: '<img src="{!! env("APP_ASSETS") !!}images/icons/preivew.png">' // or '←'
  149. }
  150. },
  151. });
  152. $("body").on('click','.delete-restaurant',function () {
  153. var id = $(this).data('id');
  154. $.ajax({
  155. url:"{!! env('APP_URL') !!}restaurant/delete/"+id,
  156. success:function (response) {
  157. location.reload();
  158. }
  159. });
  160. });
  161. $("body").on('click','.create-credentials',function () {
  162. var id = $(this).data('id');
  163. resto_id = id;
  164. $.ajax({
  165. url:"{!! env('APP_URL') !!}restaurant/get/credentials/"+id,
  166. success:function (response) {
  167. $("#username").html(response.username);
  168. $("#password").html(response.password);
  169. $("#create-credentials").modal('show');
  170. }
  171. });
  172. });
  173. $("body").on('click','.save-credentails',function () {
  174. var password = $("#password").html();
  175. $.ajax({
  176. url:"{!! env('APP_URL') !!}update/password",
  177. type:"POST",
  178. data:{
  179. resto_id:resto_id,
  180. password:password,
  181. '_token':"{!! csrf_token() !!}"
  182. },
  183. success:function (response) {
  184. $("#create-credentials .alert").show();
  185. setTimeout(function () {
  186. location.reload();
  187. },1500)
  188. }
  189. });
  190. });
  191. })
  192. </script>
  193. @endsection