inventory.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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: 275px !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 > thead > tr > td[class*="sort"]:before,
  55. .table > thead > tr > td[class*="sort"]:after {
  56. content: "" !important;
  57. }
  58. /*table tr:hover{
  59. background: #FFD684;
  60. }*/
  61. #recipe-lists_wrapper{
  62. padding: 0 15px;
  63. }
  64. .text-align-ar-adjust{
  65. text-align: right;
  66. }
  67. #outlets{
  68. margin-top:8px;
  69. }
  70. html[dir="rtl"] .text-align-ar-adjust{
  71. text-align: left;
  72. margin-left:33px;
  73. }
  74. html[dir="rtl"] #recipe-lists_paginate ul{
  75. direction: ltr;
  76. }
  77. </style>
  78. @endsection
  79. @php
  80. $resto = \App\Models\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  81. $lang = $resto->default_lang;
  82. app()->setLocale($lang);
  83. if(session('app_lang') !==null){
  84. $lang = session('app_lang');
  85. app()->setLocale($lang);
  86. }
  87. @endphp
  88. @section('content')
  89. @php
  90. //$resto = \App\Models\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  91. $outlets = \App\Models\Outlets::whereNull('deleted_at')->where('resto_id',$resto->id)->get();
  92. $o = NULL;
  93. if(isset($outlets) && $outlets->count() > 0){
  94. foreach($outlets as $outlet){
  95. $o[] = array(
  96. 'outlet_name' => $outlet->name,
  97. 'orders'=>rand(100,999)
  98. );
  99. }
  100. }
  101. @endphp
  102. @php
  103. $restuarant1 = $resto;
  104. $resto_metas = \App\Helpers\CommonMethods::getRestoMetas($restuarant1);
  105. $imgix = isset($resto_metas['IMGIX_SOURCE']) && !empty($resto_metas['IMGIX_SOURCE'])?$resto_metas['IMGIX_SOURCE']:"https://meemappaws.imgix.net";
  106. $currency = isset($resto_metas['BUSSINESS_CCY'])?$resto_metas['BUSSINESS_CCY']:"IQD";
  107. @endphp
  108. <!-- Content Wrapper. Contains page content -->
  109. <div class="content-wrapper">
  110. <div class="container-full">
  111. <!-- Main content -->
  112. <section class="content">
  113. <div class="row ">
  114. <div class="col-md-10">
  115. <div class="page-top-title">
  116. <h3 class="title m-0">{{__('label.inventory')}}</h3>
  117. </div>
  118. </div>
  119. </div>
  120. @php
  121. $outlets = \App\Models\Outlets::whereNull('deleted_at')->where('active',1)->where('resto_id',$restuarant1->id)->get();
  122. @endphp
  123. <!--<div class="row m-0">
  124. <div class="col-md-6 ">
  125. <select class="form-control form-select" id="outlets">
  126. <option value="">{{__('label.outlets')}}</option>
  127. @if(isset($outlets) && $outlets->count() > 0)
  128. @foreach($outlets as $outlet)
  129. <option value="{!! $outlet->id !!}" @if(isset($_GET['outlet_id']) && $_GET['outlet_id']==$outlet->id) selected @endif>{!! $outlet->name !!}</option>
  130. @endforeach
  131. @endif
  132. </select>
  133. </div>
  134. <div class="col-md-6">
  135. <button class="form-control btn btn-md shadow-none ">Launch marketing activity</button>
  136. </div>
  137. </div>-->
  138. <div class="row m-0">
  139. {{-- <div class="col-sm-6 mt-2">--}}
  140. {{-- <input type="text" placeholder="{{__('label.search_for_item')}}" class="form-control col-md-6">--}}
  141. {{-- </div>--}}
  142. {{-- <div class="col-sm-6"><p class="fw-bold text-align-ar-adjust mt-2">{{__('label.availablity')}}</p></div>--}}
  143. </div>
  144. <div class="row p-0 mt-4">
  145. <div class="col-sm-12">
  146. <div class="table-responsive">
  147. <table class="table table-stripped" id="recipe-lists">
  148. <thead>
  149. <tr>
  150. <!-- <td></td> -->
  151. <td></td>
  152. <td></td>
  153. <td></td>
  154. </tr>
  155. </thead>
  156. <tbody>
  157. @if(isset($recipes) && $recipes->count() > 0)
  158. @foreach($recipes as $recipe)
  159. <tr>
  160. @php
  161. $filename = isset($recipe->main_images)?\App\Helpers\CommonMethods::changeImageLinkAWStoImgix(
  162. $recipe->main_images->file_name,
  163. $imgix,
  164. env('PRODUCT_THUMBNAIL_IMG_HEIGHT'),
  165. env('PRODUCT_THUMBNAIL_IMG_WIDTH'),
  166. 100
  167. ):"";
  168. @endphp
  169. <!-- <td width="3%"></td> -->
  170. <td> <div style="height: 48px; width: 48px; background-image: url(@if(isset($recipe->main_images)) {!! $filename !!} @else {!! env('APP_ASSETS') !!}img/user/1.png @endif); background-size: cover; background-position: center;"></div></td>
  171. <td width="80%">{!! $recipe->name !!} @if($recipe->inventory_options!="available") <small class="text-danger">( {!! ucwords(str_replace('_',' ',$recipe->inventory_options)) !!} )</small> @endif </td>
  172. <td>
  173. <button type="button" data-on-text="Open" data-off-text="Closed" class=" btn-toggle btn-sm btn-outlet @if($recipe->inventory_options=="available") active @endif switch-me" data-id="{!! $recipe->id !!}" data-bs-toggle="button" aria-pressed="true" autocomplete="off">
  174. <div class="handle"></div>
  175. </button>
  176. </td>
  177. </tr>
  178. @endforeach
  179. @endif
  180. </tbody>
  181. </table>
  182. </div>
  183. </div>
  184. </div>
  185. </section>
  186. <!-- /.content -->
  187. </div>
  188. </div>
  189. <div class="modal fade" id="inventory_option_modal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
  190. <div class="modal-dialog modal-lg">
  191. <div class="modal-content">
  192. <div class="modal-body">
  193. <table class="table table-borderless">
  194. <tr>
  195. <td id="recipe-image">
  196. </td>
  197. <td id="recipe-name"></td>
  198. <td>
  199. <select class="form-control" id="inventory-option">
  200. {{-- <option value="available">Available</option>--}}
  201. <option value="out_of_stock">Out of stock</option>
  202. <option value="not_available">Un-Available</option>
  203. </select>
  204. </td>
  205. </tr>
  206. </table>
  207. </div>
  208. <div class="modal-footer">
  209. <button type="button" class="btn btn-secondary close-me" data-bs-dismiss="modal">{!! __('label.close') !!}</button>
  210. <button type="button" class="btn btn-primary update-inventory-option">{!! __('label.update_inventory_option') !!}</button>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. <!-- /.content-wrapper -->
  216. @endsection
  217. @section('js')
  218. <script type="text/javascript">
  219. $(function(){
  220. var _selected_recipe_id = null;
  221. var _current_switch = null;
  222. $("body").on("click",".close-me",function(){
  223. _current_switch.addClass('active');
  224. _current_switch.attr('aria-pressed','true');
  225. });
  226. $("body").on("click",".update-inventory-option",function(){
  227. var _inventory_option = $("#inventory-option").val();
  228. $.ajax({
  229. url:"{!! env('APP_URL') !!}update/recipe/inventory",
  230. type:"POST",
  231. data:{
  232. "_token":'{!! csrf_token() !!}',
  233. recipe_id:_selected_recipe_id,
  234. inventory_option:_inventory_option
  235. },
  236. success:function(response){
  237. location.reload();
  238. }
  239. });
  240. });
  241. $("#outlets").on('change',function(){
  242. if($(this).val()=="")
  243. window.location.href = "{!! env('APP_URL') !!}inventory";
  244. else
  245. window.location.href = "{!! env('APP_URL') !!}inventory?outlet_id="+$(this).val();
  246. });
  247. $("body").on("click",".switch-me",function () {
  248. _current_switch = $(this);
  249. var is_active = $(this).attr("aria-pressed");
  250. var id = $(this).data('id');
  251. _selected_recipe_id = id;
  252. var outlet_id = $(this).data('outlet-id');
  253. is_active = $.trim(is_active);
  254. var _this = $(this);
  255. var status = 0;
  256. if(is_active=="true"){
  257. $.ajax({
  258. url:"{!! env('APP_URL') !!}update/recipe/inventory",
  259. type:"POST",
  260. data:{
  261. "_token":'{!! csrf_token() !!}',
  262. recipe_id:_selected_recipe_id,
  263. inventory_option:'available'
  264. },
  265. success:function(response){
  266. }
  267. });
  268. }else{
  269. var _parent = $(this).parents('tr');
  270. $("#recipe-image").html(_parent.find("td:eq(0)").html());
  271. $("#recipe-name").html(_parent.find("td:eq(1)").text());
  272. $("#inventory_option_modal").modal('show');
  273. }
  274. });
  275. $('#recipe-lists').DataTable({
  276. "bSort": true,
  277. "searching": true,
  278. "paging": true,
  279. "info": true,
  280. "bLengthChange": false,
  281. language: {
  282. @if($lang=='ar')
  283. url:`{{asset('public/assets/js/dataTablear.json')}}`,
  284. @endif
  285. paginate: {
  286. next: '<img src="{!! env("APP_ASSETS") !!}images/icons/next.png">', // or '→'
  287. previous: '<img src="{!! env("APP_ASSETS") !!}images/icons/preivew.png">' // or '←'
  288. }
  289. },
  290. });
  291. $("td nav").addClass('d-flex justify-content-center');
  292. })
  293. </script>
  294. @endsection