admin_dashboard.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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\Models\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\Models\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>Orders</th>
  54. <td>Action?</td>
  55. <th>Action</th>
  56. </tr>
  57. </thead>
  58. <tbody>
  59. @php
  60. $restaurants = \App\Models\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>
  78. <span class="badge badge-success">Today : {!! isset($restaurant->today_placed_orders)?$restaurant->today_placed_orders->count():0 !!} </span>
  79. <span class="badge badge-info">Placed : {!! isset($restaurant->placed_orders)?$restaurant->placed_orders->count():0 !!} </span>
  80. <span class="badge badge-danger">Delivered : {!! isset($restaurant->delivered_orders)?$restaurant->delivered_orders->count():0 !!} </span>
  81. </td>
  82. <td>{!! $restaurant->active?'<span class="badge badge-success">Active</span>':'<span class="badge badge-danger">In-active</span>' !!}</td>
  83. <td>
  84. <!-- <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> -->
  85. <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>
  86. <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>
  87. <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="glyphicon glyphicon-lock"></i></a>
  88. </td>
  89. </tr>
  90. @endforeach
  91. @endif
  92. </tbody>
  93. </table>
  94. </div>
  95. </div>
  96. </div>
  97. </section>
  98. </div>
  99. </div>
  100. <div class="modal" id="create-credentials" tabindex="-1" role="dialog">
  101. <div class="modal-dialog" role="document">
  102. <div class="modal-content">
  103. <div class="modal-header">
  104. <h5 class="modal-title">Modal title</h5>
  105. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  106. <span aria-hidden="true">&times;</span>
  107. </button>
  108. </div>
  109. <div class="modal-body">
  110. <table border="0" style="width: 100%">
  111. <tr>
  112. <th width="30%">Username</th>
  113. <td id="username"></td>
  114. </tr>
  115. <tr>
  116. <th>Password</th>
  117. <td id="password"></td>
  118. </tr>
  119. </table>
  120. <div class="alert alert-success" style="display: none;">Credentails are created successfully.</div>
  121. </div>
  122. <div class="modal-footer">
  123. <button type="button" class="btn btn-primary save-credentails">Save Credentails</button>
  124. <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. @endsection
  130. @section('js')
  131. <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js" crossorigin="anonymous"></script>
  132. <!-- Chart Js -->
  133. <script src="{!! env('APP_ASSETS') !!}assets/demo/chart-area-demo.js"></script>
  134. <script src="{!! env('APP_ASSETS') !!}assets/demo/chart-bar-demo.js"></script>
  135. <script src="{!! env('APP_ASSETS') !!}assets/demo/chart-pie-demo.js"></script>
  136. <!-- Datatable Js -->
  137. <script src="{!! env('APP_ASSETS') !!}vendor/dataTables/dataTables/js/jquery.dataTables.min.js"></script>
  138. <script src="{!! env('APP_ASSETS') !!}vendor/dataTables/dataTables/js/dataTables.bootstrap.min.js"></script>
  139. <script src="{!! env('APP_ASSETS') !!}assets/demo/datatables-demo.js"></script>
  140. <script>
  141. var resto_id = 0;
  142. $(function () {
  143. $('#dataTable').DataTable({
  144. "bSort": true,
  145. "searching": false,
  146. "paging": false,
  147. "info": false,
  148. "bLengthChange": false,
  149. language: {
  150. paginate: {
  151. next: '<img src="{!! env("APP_ASSETS") !!}images/icons/next.png">', // or '→'
  152. previous: '<img src="{!! env("APP_ASSETS") !!}images/icons/preivew.png">' // or '←'
  153. }
  154. },
  155. });
  156. $("body").on('click','.delete-restaurant',function () {
  157. var id = $(this).data('id');
  158. $.ajax({
  159. url:"{!! env('APP_URL') !!}restaurant/delete/"+id,
  160. success:function (response) {
  161. location.reload();
  162. }
  163. });
  164. });
  165. $("body").on('click','.create-credentials',function () {
  166. var id = $(this).data('id');
  167. resto_id = id;
  168. $.ajax({
  169. url:"{!! env('APP_URL') !!}restaurant/get/credentials/"+id,
  170. success:function (response) {
  171. $("#username").html(response.username);
  172. $("#password").html(response.password);
  173. $("#create-credentials").modal('show');
  174. }
  175. });
  176. });
  177. $("body").on('click','.save-credentails',function () {
  178. var password = $("#password").html();
  179. $.ajax({
  180. url:"{!! env('APP_URL') !!}update/password",
  181. type:"POST",
  182. data:{
  183. resto_id:resto_id,
  184. password:password,
  185. '_token':"{!! csrf_token() !!}"
  186. },
  187. success:function (response) {
  188. $("#create-credentials .alert").show();
  189. setTimeout(function () {
  190. location.reload();
  191. },1500)
  192. }
  193. });
  194. });
  195. })
  196. </script>
  197. @endsection