inventory.blade.php 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. @extends('layouts.app')
  2. @section('css')
  3. <link href="{!! env('APP_ASSETS') !!}css/dashboard.css" rel="stylesheet" type="text/css">
  4. <style type="text/css">
  5. .btn-toggle.btn-sm,.btn-toggle.btn-sm > .handle{
  6. border-radius: 16px;
  7. }
  8. .btn-toggle.btn-sm:focus, .btn-toggle.btn-sm.focus, .btn-toggle.btn-sm:focus.active, .btn-toggle.btn-sm.focus.active{
  9. box-shadow: none;
  10. }
  11. .btn-outlet{
  12. }
  13. .btn-toggle.active{
  14. color: white !important;
  15. background: #ffa505;
  16. }
  17. .fixed .content-wrapper{
  18. margin-left: 259px !important;
  19. }
  20. .margin-left-20{
  21. margin-left: 20px;
  22. }
  23. .margin-left-30{
  24. margin-left: 30px;
  25. }
  26. .margin-left-40{
  27. margin-left: 40px;
  28. }
  29. table.dataTable {
  30. clear: both;
  31. margin-top: 6px !important;
  32. margin-bottom: 6px !important;
  33. max-width: none !important;
  34. border-collapse: collapse !important;
  35. font-family: 'Open Sans';
  36. }
  37. /*table.dataTable td{
  38. border-width: 1px;
  39. }*/
  40. .theme-primary .pagination li a:hover {
  41. background-color: #000 !important;
  42. }
  43. .table > :not(:last-child) > :last-child > * {
  44. border-bottom-color: transparent;
  45. }
  46. table.dataTable th{font-weight: 700 !important;}
  47. .dataTables_paginate {
  48. width: 100%;
  49. text-align: center;
  50. }
  51. div.dataTables_wrapper div.dataTables_paginate ul.pagination{
  52. justify-content: center !important;
  53. }
  54. /*table tr:hover{
  55. background: #FFD684;
  56. }*/
  57. </style>
  58. @endsection
  59. @php
  60. $resto = \App\Models\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  61. $lang = $resto->default_lang;
  62. app()->setLocale($lang);
  63. if(session('app_lang') !==null){
  64. $lang = session('app_lang');
  65. app()->setLocale($lang);
  66. }
  67. @endphp
  68. @section('content')
  69. @php
  70. //$resto = \App\Models\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  71. $outlets = \App\Models\Outlets::whereNull('deleted_at')->where('resto_id',$resto->id)->get();
  72. $o = NULL;
  73. if(isset($outlets) && $outlets->count() > 0){
  74. foreach($outlets as $outlet){
  75. $o[] = array(
  76. 'outlet_name' => $outlet->name,
  77. 'orders'=>rand(100,999)
  78. );
  79. }
  80. }
  81. @endphp
  82. @php
  83. $restuarant1 = $resto;
  84. $resto_meta = isset($restuarant1->resto_metas)?$restuarant1->resto_metas:null;
  85. $resto_metas = [];
  86. $billing = [];
  87. if(isset($resto_meta)){
  88. foreach($resto_meta as $meta){
  89. // dump($meta->resto_meta_defs);
  90. if($meta->resto_meta_defs->meta_def_name=="BILLING_GATEWAY"){
  91. // dump($meta->resto_meta_defs->meta_def_name);
  92. // $resto_metas['BILLING_GATEWAY'][] = $meta->meta_val;
  93. $billing[] = array('id'=>$meta->meta_id,'value'=>$meta->meta_val);
  94. }
  95. $resto_metas[$meta->resto_meta_defs->meta_def_name] = $meta->meta_val;
  96. }
  97. }
  98. $resto_metas['BILLING_GATEWAY'] = $billing;
  99. $currency = isset($resto_metas['BUSSINESS_CCY'])?$resto_metas['BUSSINESS_CCY']:"IQD";
  100. @endphp
  101. <!-- Content Wrapper. Contains page content -->
  102. <div class="content-wrapper">
  103. <div class="container-full">
  104. <!-- Main content -->
  105. <section class="content">
  106. <div class="row ">
  107. <div class="col-md-10">
  108. <div class="m-15">
  109. <h3 class="title margin-left-20">{{__('label.inventory')}}</h3>
  110. </div>
  111. </div>
  112. </div>
  113. @php
  114. $outlets = \App\Models\Outlets::whereNull('deleted_at')->where('active',1)->where('resto_id',$restuarant1->id)->get();
  115. @endphp
  116. <div class="row ">
  117. <div class="col-md-6 ">
  118. <select class="form-control form-select margin-left-30" id="outlets">
  119. <option value="">{{__('label.outlets')}}</option>
  120. @if(isset($outlets) && $outlets->count() > 0)
  121. @foreach($outlets as $outlet)
  122. <option value="{!! $outlet->id !!}" @if(isset($_GET['outlet_id']) && $_GET['outlet_id']==$outlet->id) selected @endif>{!! $outlet->name !!}</option>
  123. @endforeach
  124. @endif
  125. </select>
  126. </div>
  127. <!--<div class="col-md-6">
  128. <button class="form-control btn btn-md shadow-none ">Launch marketing activity</button>
  129. </div>-->
  130. </div>
  131. <div class="row mt-2">
  132. <div class="col-sm-8">
  133. <input type="text" placeholder="{{__('label.search')}}" class="form-control col-md-6 margin-left-30">
  134. </div>
  135. <div class="col-sm-3"><p class="fw-bold text-end mt-2">{{__('label.availablity')}}</p></div>
  136. </div>
  137. <div class="row p-0 mt-4">
  138. <div class="col-sm-12">
  139. <table class="table table-borderless" id="recipe-lists">
  140. <thead>
  141. <tr>
  142. <td></td>
  143. <td></td>
  144. <td></td>
  145. <td></td>
  146. </tr>
  147. </thead>
  148. <tbody>
  149. @if(isset($_GET['outlet_id']) && !empty($_GET['outlet_id']))
  150. @if(isset($recipes) && $recipes->count() > 0)
  151. @foreach($recipes as $recipe)
  152. <tr>
  153. <td width="3%"></td>
  154. <td> <div style="height: 48px; width: 48px; background-image: url(@if(isset($recipe->main_images)) {!! $recipe->main_images->file_name !!} @else {!! env('APP_ASSETS') !!}img/user/1.png @endif); background-size: cover; background-position: center;"></div></td>
  155. <td width="80%">{!! $recipe->name !!}</td>
  156. <td>
  157. @php
  158. $ex = [];
  159. $exclude_outlets = $recipe->exclude_outlets;
  160. if(!empty($exclude_outlets)){
  161. $ex = explode(",",$exclude_outlets);
  162. }
  163. @endphp
  164. <button type="button" data-on-text="Open" data-off-text="Closed" class=" btn-toggle btn-sm btn-outlet @if(!in_array($_GET['outlet_id'],$ex)) active @endif switch-me" data-id="{!! $recipe->id !!}" data-outlet-id="{!! isset($_GET['outlet_id']) && !empty($_GET['outlet_id'])?$_GET['outlet_id']:0 !!}" data-bs-toggle="button" aria-pressed="true" autocomplete="off">
  165. <div class="handle"></div>
  166. </button>
  167. </td>
  168. </tr>
  169. @endforeach
  170. @endif
  171. @endif
  172. </tbody>
  173. </table>
  174. </div>
  175. </div>
  176. </section>
  177. <!-- /.content -->
  178. </div>
  179. </div>
  180. <!-- /.content-wrapper -->
  181. @endsection
  182. @section('js')
  183. <script type="text/javascript">
  184. $(function(){
  185. $("#outlets").on('change',function(){
  186. if($(this).val()=="")
  187. window.location.href = "{!! env('APP_URL') !!}inventory";
  188. else
  189. window.location.href = "{!! env('APP_URL') !!}inventory?outlet_id="+$(this).val();
  190. });
  191. $("body").on("click",".switch-me",function () {
  192. var is_active = $(this).attr("aria-pressed");
  193. var id = $(this).data('id');
  194. var outlet_id = $(this).data('outlet-id');
  195. is_active = $.trim(is_active);
  196. var _this = $(this);
  197. var status = 0;
  198. $.ajax({
  199. url:"{!! env('APP_URL') !!}exclude/recipe/outlet",
  200. type:"POST",
  201. data:{
  202. recipe_id:id,
  203. outlet_id:outlet_id,
  204. is_exclude:is_active,
  205. "_token":'{!! csrf_token() !!}'
  206. },
  207. success:function(){
  208. }
  209. });
  210. });
  211. $('#recipe-lists').DataTable({
  212. "bSort": true,
  213. "searching": false,
  214. "paging": true,
  215. "info": false,
  216. "bLengthChange": false,
  217. language: {
  218. @if($lang=='ar')
  219. url:`{{asset('public/assets/js/dataTablear.json')}}`,
  220. @endif
  221. paginate: {
  222. next: '<img src="{!! env("APP_ASSETS") !!}images/icons/next.png">', // or '→'
  223. previous: '<img src="{!! env("APP_ASSETS") !!}images/icons/preivew.png">' // or '←'
  224. }
  225. },
  226. });
  227. $("td nav").addClass('d-flex justify-content-center');
  228. })
  229. </script>
  230. @endsection