coupons.blade.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. @extends('frontend.layouts.app')
  2. @section('content')
  3. <section id="coupons" class="bg-dark text-white pb-5">
  4. <div class="container">
  5. <h1 class="d-block text-center h2 my-5 fw-700">{{ translate('All coupons') }}</h1>
  6. <div class="row gutters-10">
  7. @foreach($coupons as $coupon)
  8. @if($coupon->type == 'product_base')
  9. @php
  10. $products = json_decode($coupon->details);
  11. $coupon_products = [];
  12. foreach($products as $product) {
  13. array_push($coupon_products, $product->product_id);
  14. }
  15. @endphp
  16. @else
  17. @php
  18. $order_discount = json_decode($coupon->details);
  19. @endphp
  20. @endif
  21. @php
  22. if($coupon->user->user_type != 'admin') {
  23. $shop = $coupon->user->shop;
  24. $name = $shop->name;
  25. }
  26. else {
  27. $name = get_setting('website_name');
  28. }
  29. @endphp
  30. @if($coupon->user->user_type == 'admin' || ($shop->verification_status && $shop != null))
  31. <div class="col-lg-6 mb-3">
  32. <div class="rounded bg-white h-100 overflow-hidden" style="border-color: #2d3748 !important">
  33. <div class="row no-gutters h-100">
  34. @if($coupon->type == 'product_base')
  35. <div class="col-md-8 text-dark align-self-center ">
  36. <div class="px-4 py-3">
  37. <div class="fs-20 mb-3 fw-700 text-truncate">{{ $name }}</div>
  38. <div class="row gutters-5">
  39. @php $products = App\Models\Product::whereIn('id', $coupon_products)->get(); @endphp
  40. @foreach($products as $key => $product)
  41. @if($product != null && $key < 3)
  42. <a href="{{ route('product', $product->slug) }}" class='col-4 text-center text-reset mb-3' target="_blank">
  43. <img
  44. class="img-fit mw-100 h-90px h-sm-120px h-lg-80px h-xl-100px h-xxl-130px mb-2 rounded"
  45. src="{{ uploaded_asset($product->thumbnail_img) }}"
  46. data-src="{{ uploaded_asset($product->thumbnail_img) }}"
  47. onerror="this.onerror=null;this.src='{{ static_asset('assets/img/placeholder.jpg') }}';"
  48. alt="">
  49. <div class="lh-1-2">
  50. <span class="fw-600 text-primary fs-16">{{ home_discounted_base_price($product) }}</span>
  51. @if(home_base_price($product) != home_discounted_base_price($product))
  52. <del class="fw-500 opacity-50 fs-14">{{ home_base_price($product) }}</del>
  53. @endif
  54. </div>
  55. </a>
  56. @endif
  57. @endforeach
  58. </div>
  59. </div>
  60. </div>
  61. <div class="col-md-4 bg-primary d-flex">
  62. <div class="align-self-center p-3 flex-grow-1 text-center">
  63. @if($coupon->discount_type == 'amount')
  64. <p class="fs-20 fw-700 mb-1">{{ single_price($coupon->discount) }} {{ translate('OFF') }}</p>
  65. @else
  66. <p class="fs-20 fw-700 mb-1">{{ $coupon->discount }}% {{ translate('OFF') }}</p>
  67. @endif
  68. <span class="fs-16 d-block mb-3">
  69. {{ translate('Code') }}:
  70. <span class="fw-600">{{ $coupon->code }}</span>
  71. </span>
  72. <a
  73. class="btn bg-white fw-700"
  74. @if($coupon->user->user_type != 'admin')
  75. href="{{ route('shop.visit', $shop->slug) }}"
  76. @else
  77. href="{{ route('inhouse.all') }}"
  78. @endif
  79. >
  80. {{ translate('Visit store') }}
  81. </a>
  82. </div>
  83. </div>
  84. @else
  85. <div class="col-md-8 text-dark align-self-center">
  86. <div class="px-4 py-3">
  87. <div class="fs-20 mb-3 fw-700 text-truncate">{{ $name }}</div>
  88. <span class="h5 text-center d-block m-auto bg-soft-info p-3 rounded">
  89. @if($coupon->discount_type == 'amount')
  90. {{ translate('Min Spend ') }} {{ single_price($order_discount->min_buy) }} {{ translate('from') }} {{ $name }} {{ translate('to get') }} {{ single_price($coupon->discount) }} {{ translate('OFF on total orders') }}
  91. @else
  92. {{ translate('Min Spend ') }} {{ single_price($order_discount->min_buy) }} {{ translate('from') }} {{ $name }} {{ translate('to get') }} {{ $coupon->discount }}% {{ translate('OFF on total orders') }}
  93. @endif
  94. </span>
  95. </div>
  96. </div>
  97. <div class="col-md-4 bg-primary d-flex">
  98. <div class="align-self-center p-3 flex-grow-1 text-center">
  99. <p class="fs-20 fw-700 mb-1">{{ translate('Max Discount') }}: {{ single_price($order_discount->max_discount) }}</p>
  100. <span class="fs-16 d-block mb-3">
  101. {{ translate('Code') }}:
  102. <span class="fw-600">{{ $coupon->code }}</span>
  103. </span>
  104. <a
  105. class="btn bg-white fw-700"
  106. @if($coupon->user->user_type != 'admin')
  107. href="{{ route('shop.visit', $shop->slug) }}"
  108. @else
  109. href="{{ route('inhouse.all') }}"
  110. @endif
  111. >
  112. {{ translate('Visit store') }}
  113. </a>
  114. </div>
  115. </div>
  116. @endif
  117. </div>
  118. </div>
  119. </div>
  120. @endif
  121. @endforeach
  122. </div>
  123. </div>
  124. </section>
  125. @endsection