sidebar_resto_right.blade.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <!-- Content Right Sidebar -->
  2. @php
  3. $resto = isset(\Illuminate\Support\Facades\Auth::user()->restaurants)?\Illuminate\Support\Facades\Auth::user()->restaurants:NULL;
  4. @endphp
  5. <div class="right-bar">
  6. <div id="sidebarRight">
  7. <div class="right-bar-inner">
  8. <div class="text-end position-relative">
  9. <a href="#" class="d-inline-block d-xl-none btn right-bar-btn waves-effect waves-circle btn btn-circle btn-danger btn-sm">
  10. <i class="mdi mdi-close"></i>
  11. </a>
  12. </div>
  13. <div class="right-bar-content">
  14. <div class="box no-shadow box-bordered border-light">
  15. <div class="box-body">
  16. <div class="d-flex justify-content-between align-items-center">
  17. @php
  18. $totalOnlineOrders = \App\Restaurants::totalOnlineOrders($resto->id);
  19. $totalRevenue = \App\Restaurants::totalRevenue($resto->id);
  20. @endphp
  21. <div>
  22. <h5>Total Sale</h5>
  23. <h2 class="mb-0">IQD {!! isset($totalRevenue)?number_format($totalRevenue[0]->total_price):0 !!}</h2>
  24. </div>
  25. <div class="p-10">
  26. <div id="chart-spark1"></div>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="box-footer">
  31. <div class="d-flex align-items-center justify-content-between">
  32. <h5 class="my-0">{!! isset($totalOnlineOrders)?($totalOnlineOrders[0]->total_orders):0 !!} total orders</h5>
  33. <a href="#" class="mb-0">View Report</a>
  34. </div>
  35. </div>
  36. </div>
  37. @php
  38. $current_page = strtolower(Route::currentRouteName());
  39. @endphp
  40. @if($current_page=="dashboard" || $current_page=="orderlisting")
  41. @php
  42. $today = \Carbon\Carbon::today()->format('Y-m-d');
  43. ;
  44. $orders = \App\Orders::where('resto_id',$resto->id)->where('created_at','Like','%'.$today.'%')->orderBy('created_at','DESC')->get()->take(5);
  45. @endphp
  46. <div class="box no-shadow box-bordered border-light">
  47. <div class="box-header">
  48. <h4 class="box-title">Todays Orders</h4>
  49. </div>
  50. <div class="box-body p-5">
  51. <div class="media-list media-list-hover">
  52. @if(isset($orders) && $orders->count() > 0)
  53. @foreach($orders as $order)
  54. <a class="media media-single mb-10 p-0 rounded-0" href="{!! env('APP_URL') !!}order/show/{!! $order->id !!}">
  55. <h4 style="width: 80px" class=" text-gray fw-500">{!! date('h:i a',strtotime($order->created_at)) !!}</h4>
  56. <div class="media-body ps-15 bs-5 rounded border-primary">
  57. <p> Order ID {!! $order->order_ref !!}</p>
  58. <span class="text-fade">{!! $order->customer_name !!}<br /> {!! isset($order->customers)?(str_replace(env('COUNTRY_CODE'),'',$order->customers->users->email)):"" !!}</span>
  59. </div>
  60. </a>
  61. @endforeach
  62. @endif
  63. </div>
  64. </div>
  65. </div>
  66. @endif
  67. @if($current_page=="show_order")
  68. @php
  69. $activities = \App\OrderActivities::where('order_id',$order->id)->get();
  70. $custom_status = ['Placed'=>'Placed','Send_to_Kitchen'=>'Send to Kitchen','Send to Kitchen'=>'Send to Kitchen','On_Road'=>'On the Way','On Road'=>'On Road', 'Has_Delivered'=>'Delivered', 'Delivered'=>'Delivered','Cancelled_by_Customer'=>'Cancelled','Accepted'=>'Accepted','Rejected'=>'Rejected', 'Rejected_by_User'=>'Rejected by User'];
  71. @endphp
  72. <div class="box no-shadow box-bordered border-light">
  73. <div class="box-header">
  74. <h4 class="box-title">Order Activities</h4>
  75. </div>
  76. <div class="box-body p-5">
  77. <div class="media-list media-list-hover">
  78. @if(isset($activities) && $activities->count() > 0)
  79. @foreach($activities as $activity)
  80. @php
  81. $classname = "border-primary";
  82. if(strtolower($activity->status)=="placed")
  83. $classname = "border-info";
  84. if(strtolower($activity->status)=="send_to_kitchen")
  85. $classname = "border-warning";
  86. if(strtolower($activity->status)=="rejected" || strtolower($activity->status)=="cancelled_by_customer" || strtolower($activity->status)=="rejected_by_user")
  87. $classname = "border-danger";
  88. if(strtolower($activity->status)=="on_road")
  89. $classname = "border-warning";
  90. if(strtolower($activity->status)=="has_delivered")
  91. $classname = "border-success";
  92. @endphp
  93. <a class="media media-single mb-10 p-0 rounded-0" href="#">
  94. <h4 style="width: 80px" class=" text-gray fw-500">{!! date('h:i a',strtotime($activity->created_at)) !!}</h4>
  95. <div class="media-body ps-15 bs-5 rounded {!! $classname !!}">
  96. <p>{!! isset($custom_status[$activity->status])?$custom_status[$activity->status]:"" !!}</p>
  97. <span class="text-fade">by {!! $resto->name !!}</span>
  98. </div>
  99. </a>
  100. @endforeach
  101. @endif
  102. </div>
  103. </div>
  104. </div>
  105. @endif
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. <!-- /.Content Right Sidebar -->