index.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. @extends('layouts.app')
  2. @section('page-title')| {{__('label.discounts')}} @endsection
  3. @section('css')
  4. <link href="{!! env('APP_ASSETS') !!}css/discounts.css" rel="stylesheet" type="text/css">
  5. @endsection
  6. @php
  7. $resto = \App\Models\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  8. $lang = $resto->default_lang;
  9. app()->setLocale($lang);
  10. if(session('app_lang') !==null){
  11. $lang = session('app_lang');
  12. app()->setLocale($lang);
  13. }
  14. @endphp
  15. @section('content')
  16. <style>
  17. @-webkit-keyframes special {
  18. from { background-color: rgba(255, 121, 77, 0.27); }
  19. to { background-color: inherit; }
  20. }
  21. @-moz-keyframes special {
  22. from { background-color: rgba(255, 121, 77, 0.27);; }
  23. to { background-color: inherit; }
  24. }
  25. @-o-keyframes special {
  26. from { background-color: rgba(255, 121, 77, 0.27);; }
  27. to { background-color: inherit; }
  28. }
  29. @keyframes special {
  30. from { background-color: rgba(255, 121, 77, 0.27);; }
  31. to { background-color: inherit; }
  32. }
  33. .special {
  34. -webkit-animation: special 1s infinite; /* Safari 4+ */
  35. -moz-animation: special 1s infinite; /* Fx 5+ */
  36. -o-animation: special 1s infinite; /* Opera 12+ */
  37. animation: special 1s infinite; /* IE 10+ */
  38. }
  39. .btn-toggle.btn-sm,.btn-toggle.btn-sm > .handle{
  40. border-radius: 16px;
  41. }
  42. </style>
  43. <!-- Content Wrapper. Contains page content -->
  44. <div class="content-wrapper">
  45. <div class="container-full">
  46. <!-- Main content -->
  47. <section class="content">
  48. <div class="row ">
  49. <div class="col-md-6">
  50. <div class="m-15">
  51. <h3 class="title">{{__('label.paymentlinks')}}</h3>
  52. </div>
  53. </div>
  54. @php
  55. $restuarant1 = $resto;
  56. $resto_meta = isset($restuarant1->resto_metas)?$restuarant1->resto_metas:null;
  57. //dump($resto_meta);
  58. $resto_metas = [];
  59. $billing = [];
  60. if(isset($resto_meta)){
  61. foreach($resto_meta as $meta){
  62. $index_name = isset($meta->resto_meta_defs->parents)?$meta->resto_meta_defs->parents->meta_def_name:$meta->resto_meta_defs->meta_def_name;
  63. // dump($meta->resto_meta_defs);
  64. if($index_name=="BILLING_GATEWAY"){
  65. // dump($meta->resto_meta_defs->meta_def_name);
  66. // $resto_metas['BILLING_GATEWAY'][] = $meta->meta_val;
  67. $billing[] = array('id'=>$meta->meta_id,'value'=>$meta->meta_val);
  68. }
  69. $resto_metas[$index_name] = $meta->meta_val;
  70. }
  71. }
  72. $resto_metas['BILLING_GATEWAY'] = $billing;
  73. $currency = isset($resto_metas['BUSSINESS_CCY'])?$resto_metas['BUSSINESS_CCY']:"IQD";
  74. $business_type = isset($resto_metas['BUSSINESS_TYPE'])?$resto_metas['BUSSINESS_TYPE']:"Restaurants";
  75. @endphp
  76. <div class="col-md-5">
  77. <a style="width: 200px" href="{!! env('APP_URL') !!}payment/link/new" class="form-control btn btn-primary btn-md add-discount text-center">
  78. <i class="fa fa-plus mr-2"></i>
  79. <!-- <i class="mdi mdi-plus-circle"></i> --> {{__('label.add_payment_link')}}
  80. </a>
  81. </div>
  82. </div>
  83. <div class="row">
  84. <div class="col-12 mt-4">
  85. <div class="table-responsive">
  86. <table class="table table-striped" id="discount-table">
  87. <thead>
  88. <tr>
  89. <th></th>
  90. <th scope="col">{{__('label.purpose')}}</th>
  91. <th scope="col">{{__('label.outletname')}}</th>
  92. <th scope="col">{{__('label.amount')}}</th>
  93. <th scope="col">{{__('label.usage')}}</th>
  94. <th scope="col">{{__('label.creation_date')}}</th>
  95. <th scope="col"></th>
  96. </tr>
  97. </thead>
  98. <tbody>
  99. @if(isset($payment_links) && $payment_links->count() > 0)
  100. @foreach($payment_links as $payment_link)
  101. <tr>
  102. <td>
  103. <button type="button" data-on-text="Open" data-off-text="Closed" class="btn btn-toggle btn-sm btn-success @if($payment_link->status=="active") active @endif switch-me" data-id="{!! $payment_link->unique_key !!}" data-bs-toggle="button" aria-pressed="@if($payment_link->status=="active") true @else false @endif" autocomplete="off">
  104. <div class="handle"></div>
  105. </button> {{__('label.active')}}
  106. </td>
  107. <td>
  108. {!! $payment_link->purpose_payment !!}
  109. </td>
  110. <td>{!! $payment_link->outlet_id !!}</td>
  111. <td>{!! $payment_link->amount !!}</td>
  112. <td>{!! $payment_link->number_of_uses !!}</td>
  113. <td>{!! \Carbon\Carbon::parse($payment_link->created_at)->format('d, M Y') !!}</td>
  114. <td>
  115. <a href="{!! env('APP_URL') !!}payment/link/{!! $payment_link->unique_id !!}" class="waves-effect waves-circle btn btn-circle btn-success btn-xs mb-5"><i class="mdi mdi-eye"></i></a>
  116. <a type="button" data-id="{!! $payment_link->id !!}" class="waves-effect waves-circle btn btn-circle delete-payment-link btn-danger btn-xs mb-5"><i class="mdi mdi-delete"></i></a>
  117. </td>
  118. </tr>
  119. @endforeach
  120. @endif
  121. </tbody>
  122. </table>
  123. </div>
  124. </div>
  125. </div>
  126. </section>
  127. <!-- /.content -->
  128. </div>
  129. </div>
  130. <!-- /.content-wrapper -->
  131. @endsection
  132. @section('js')
  133. <script>
  134. $(function () {
  135. $("body").on("click",".switch-me",function (e) {
  136. var is_active = $(this).attr("aria-pressed");
  137. var id = $(this).data('id');
  138. is_active = $.trim(is_active);
  139. var status = 0;
  140. if(is_active=="false"){
  141. status = 0;
  142. }else{
  143. status = 1;
  144. }
  145. $.ajax({
  146. url:"{!! env('APP_URL') !!}payment/update/status",
  147. type:"POST",
  148. data:{
  149. id:id,
  150. status:status,
  151. "_token":'{!! csrf_token() !!}'
  152. },
  153. success:function () {
  154. if(is_active=="false"){
  155. $.toast({
  156. heading: "{{__('label.discount_status')}}",
  157. text: "{{__('label.discount_deactive')}}",
  158. position: 'top-right',
  159. loaderBg: '#ff6849',
  160. icon: 'error',
  161. hideAfter: 3000,
  162. stack: 1
  163. });
  164. }else{
  165. $.toast({
  166. heading: "{{__('label.discount_status')}}",
  167. text: "{{__('label.discount_deactive')}}",
  168. position: 'top-right',
  169. loaderBg: '#ff6849',
  170. icon: 'success',
  171. hideAfter: 3000,
  172. stack: 1
  173. });
  174. }
  175. }
  176. });
  177. e.preventDefault();
  178. e.stopPropagation();
  179. });
  180. $('.table').DataTable({
  181. paging: true,
  182. bLengthChange:false,
  183. searching: false,
  184. language: {
  185. @if($lang=='ar')
  186. url:`{{asset('public/assets/js/dataTablear.json')}}`,
  187. @endif
  188. },
  189. });
  190. $("body").on("click",".delete-discount",function(e){
  191. var id = $(this).data('id');
  192. var _this = $(this);
  193. swal({
  194. title: " Confirm?",
  195. text: "Do you want delete?",
  196. type: "error",
  197. showCancelButton: true,
  198. confirmButtonClass: "btn-danger",
  199. confirmButtonText: " Confirm, delete it!",
  200. cancelButtonText: "No, cancel please!",
  201. closeOnConfirm: true,
  202. closeOnCancel: true
  203. },
  204. function(isConfirm) {
  205. if (isConfirm) {
  206. $.ajax({
  207. url:"{!! env('APP_URL') !!}delete/discount/"+id,
  208. success:function(){
  209. _this.parent('tr').remove();
  210. }
  211. });
  212. }
  213. });
  214. e.preventDefault();
  215. e.stopPropagation();
  216. });
  217. })
  218. </script>
  219. @endsection