addToCart.blade.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <div class="modal-body p-4 c-scrollbar-light">
  2. <div class="row">
  3. <div class="col-lg-6">
  4. <div class="row gutters-10 flex-row-reverse">
  5. @php
  6. $photos = explode(',',$product->photos);
  7. @endphp
  8. <div class="col">
  9. <div class="aiz-carousel product-gallery" data-nav-for='.product-gallery-thumb' data-fade='true' data-auto-height='true'>
  10. @foreach ($photos as $key => $photo)
  11. <div class="carousel-box img-zoom rounded">
  12. <img
  13. class="img-fluid lazyload"
  14. src="{{ static_asset('assets/img/placeholder.jpg') }}"
  15. data-src="{{ uploaded_asset($photo) }}"
  16. onerror="this.onerror=null;this.src='{{ static_asset('assets/img/placeholder.jpg') }}';"
  17. >
  18. </div>
  19. @endforeach
  20. @foreach ($product->stocks as $key => $stock)
  21. @if ($stock->image != null)
  22. <div class="carousel-box img-zoom rounded">
  23. <img
  24. class="img-fluid lazyload"
  25. src="{{ static_asset('assets/img/placeholder.jpg') }}"
  26. data-src="{{ uploaded_asset($stock->image) }}"
  27. onerror="this.onerror=null;this.src='{{ static_asset('assets/img/placeholder.jpg') }}';"
  28. >
  29. </div>
  30. @endif
  31. @endforeach
  32. </div>
  33. </div>
  34. <div class="col-auto w-90px">
  35. <div class="aiz-carousel carousel-thumb product-gallery-thumb" data-items='5' data-nav-for='.product-gallery' data-vertical='true' data-focus-select='true'>
  36. @foreach ($photos as $key => $photo)
  37. <div class="carousel-box c-pointer border p-1 rounded">
  38. <img
  39. class="lazyload mw-100 size-60px mx-auto"
  40. src="{{ static_asset('assets/img/placeholder.jpg') }}"
  41. data-src="{{ uploaded_asset($photo) }}"
  42. onerror="this.onerror=null;this.src='{{ static_asset('assets/img/placeholder.jpg') }}';"
  43. >
  44. </div>
  45. @endforeach
  46. @foreach ($product->stocks as $key => $stock)
  47. @if ($stock->image != null)
  48. <div class="carousel-box c-pointer border p-1 rounded" data-variation="{{ $stock->variant }}">
  49. <img
  50. class="lazyload mw-100 size-50px mx-auto"
  51. src="{{ static_asset('assets/img/placeholder.jpg') }}"
  52. data-src="{{ uploaded_asset($stock->image) }}"
  53. onerror="this.onerror=null;this.src='{{ static_asset('assets/img/placeholder.jpg') }}';"
  54. >
  55. </div>
  56. @endif
  57. @endforeach
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. <div class="col-lg-6">
  63. <div class="text-left">
  64. <h2 class="mb-2 fs-20 fw-600">
  65. {{ $product->getTranslation('name') }}
  66. </h2>
  67. @if(home_price($product) != home_discounted_price($product))
  68. <div class="row no-gutters mt-3">
  69. <div class="col-2">
  70. <div class="opacity-50 mt-2">{{ translate('Price')}}:</div>
  71. </div>
  72. <div class="col-10">
  73. <div class="fs-20 opacity-60">
  74. <del>
  75. {{ home_price($product) }}
  76. @if($product->unit != null)
  77. <span>/{{ $product->getTranslation('unit') }}</span>
  78. @endif
  79. </del>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="row no-gutters mt-2">
  84. <div class="col-2">
  85. <div class="opacity-50">{{ translate('Discount Price')}}:</div>
  86. </div>
  87. <div class="col-10">
  88. <div class="">
  89. <strong class="h2 fw-600 text-primary">
  90. {{ home_discounted_price($product) }}
  91. </strong>
  92. @if($product->unit != null)
  93. <span class="opacity-70">/{{ $product->getTranslation('unit') }}</span>
  94. @endif
  95. </div>
  96. </div>
  97. </div>
  98. @else
  99. <div class="row no-gutters mt-3">
  100. <div class="col-2">
  101. <div class="opacity-50">{{ translate('Price')}}:</div>
  102. </div>
  103. <div class="col-10">
  104. <div class="">
  105. <strong class="h2 fw-600 text-primary">
  106. {{ home_discounted_price($product) }}
  107. </strong>
  108. <span class="opacity-70">/{{ $product->unit }}</span>
  109. </div>
  110. </div>
  111. </div>
  112. @endif
  113. @if (addon_is_activated('club_point') && $product->earn_point > 0)
  114. <div class="row no-gutters mt-4">
  115. <div class="col-2">
  116. <div class="opacity-50">{{ translate('Club Point') }}:</div>
  117. </div>
  118. <div class="col-10">
  119. <div class="d-inline-block club-point bg-soft-primary px-3 py-1 border">
  120. <span class="strong-700">{{ $product->earn_point }}</span>
  121. </div>
  122. </div>
  123. </div>
  124. @endif
  125. <hr>
  126. @php
  127. $qty = 0;
  128. foreach ($product->stocks as $key => $stock) {
  129. $qty += $stock->qty;
  130. }
  131. @endphp
  132. <form id="option-choice-form">
  133. @csrf
  134. <input type="hidden" name="id" value="{{ $product->id }}">
  135. <!-- Quantity + Add to cart -->
  136. @if($product->digital !=1)
  137. @if ($product->choice_options != null)
  138. @foreach (json_decode($product->choice_options) as $key => $choice)
  139. <div class="row no-gutters">
  140. <div class="col-2">
  141. <div class="opacity-50 mt-2 ">{{ \App\Models\Attribute::find($choice->attribute_id)->getTranslation('name') }}:</div>
  142. </div>
  143. <div class="col-10">
  144. <div class="aiz-radio-inline">
  145. @foreach ($choice->values as $key => $value)
  146. <label class="aiz-megabox pl-0 mr-2">
  147. <input
  148. type="radio"
  149. name="attribute_id_{{ $choice->attribute_id }}"
  150. value="{{ $value }}"
  151. @if($key == 0) checked @endif
  152. >
  153. <span class="aiz-megabox-elem rounded d-flex align-items-center justify-content-center py-2 px-3 mb-2">
  154. {{ $value }}
  155. </span>
  156. </label>
  157. @endforeach
  158. </div>
  159. </div>
  160. </div>
  161. @endforeach
  162. @endif
  163. @if (count(json_decode($product->colors)) > 0)
  164. <div class="row no-gutters">
  165. <div class="col-2">
  166. <div class="opacity-50 mt-2">{{ translate('Color')}}:</div>
  167. </div>
  168. <div class="col-10">
  169. <div class="aiz-radio-inline">
  170. @foreach (json_decode($product->colors) as $key => $color)
  171. <label class="aiz-megabox pl-0 mr-2" data-toggle="tooltip" data-title="{{ \App\Models\Color::where('code', $color)->first()->name }}">
  172. <input
  173. type="radio"
  174. name="color"
  175. value="{{ \App\Models\Color::where('code', $color)->first()->name }}"
  176. @if($key == 0) checked @endif
  177. >
  178. <span class="aiz-megabox-elem rounded d-flex align-items-center justify-content-center p-1 mb-2">
  179. <span class="size-30px d-inline-block rounded" style="background: {{ $color }};"></span>
  180. </span>
  181. </label>
  182. @endforeach
  183. </div>
  184. </div>
  185. </div>
  186. <hr>
  187. @endif
  188. <div class="row no-gutters">
  189. <div class="col-2">
  190. <div class="opacity-50 mt-2">{{ translate('Quantity')}}:</div>
  191. </div>
  192. <div class="col-10">
  193. <div class="product-quantity d-flex align-items-center">
  194. <div class="row no-gutters align-items-center aiz-plus-minus mr-3" style="width: 130px;">
  195. <button class="btn col-auto btn-icon btn-sm btn-circle btn-light" type="button" data-type="minus" data-field="quantity" disabled="">
  196. <i class="las la-minus"></i>
  197. </button>
  198. <input type="number" name="quantity" class="col border-0 text-center flex-grow-1 fs-16 input-number" placeholder="1" value="{{ $product->min_qty }}" min="{{ $product->min_qty }}" max="10" lang="en">
  199. <button class="btn col-auto btn-icon btn-sm btn-circle btn-light" type="button" data-type="plus" data-field="quantity">
  200. <i class="las la-plus"></i>
  201. </button>
  202. </div>
  203. <div class="avialable-amount opacity-60">
  204. @if($product->stock_visibility_state == 'quantity')
  205. (<span id="available-quantity">{{ $qty }}</span> {{ translate('available')}})
  206. @elseif($product->stock_visibility_state == 'text' && $qty >= 1)
  207. (<span id="available-quantity">{{ translate('In Stock') }}</span>)
  208. @endif
  209. </div>
  210. </div>
  211. </div>
  212. </div>
  213. <hr>
  214. @endif
  215. <div class="row no-gutters pb-3 d-none" id="chosen_price_div">
  216. <div class="col-2">
  217. <div class="opacity-50">{{ translate('Total Price')}}:</div>
  218. </div>
  219. <div class="col-10">
  220. <div class="product-price">
  221. <strong id="chosen_price" class="h4 fw-600 text-primary">
  222. </strong>
  223. </div>
  224. </div>
  225. </div>
  226. </form>
  227. <div class="mt-3">
  228. @if ($product->digital == 1)
  229. <button type="button" class="btn btn-primary buy-now fw-600 add-to-cart" onclick="addToCart()">
  230. <i class="la la-shopping-cart"></i>
  231. <span class="d-none d-md-inline-block">{{ translate('Add to cart')}}</span>
  232. </button>
  233. @elseif($qty > 0)
  234. @if ($product->external_link != null)
  235. <a type="button" class="btn btn-soft-primary mr-2 add-to-cart fw-600" href="{{ $product->external_link }}">
  236. <i class="las la-share"></i>
  237. <span class="d-none d-md-inline-block">{{ translate($product->external_link_btn)}}</span>
  238. </a>
  239. @else
  240. <button type="button" class="btn btn-primary buy-now fw-600 add-to-cart" onclick="addToCart()">
  241. <i class="la la-shopping-cart"></i>
  242. <span class="d-none d-md-inline-block">{{ translate('Add to cart')}}</span>
  243. </button>
  244. @endif
  245. @endif
  246. <button type="button" class="btn btn-secondary out-of-stock fw-600 d-none" disabled>
  247. <i class="la la-cart-arrow-down"></i>{{ translate('Out of Stock')}}
  248. </button>
  249. </div>
  250. </div>
  251. </div>
  252. </div>
  253. </div>
  254. <script type="text/javascript">
  255. $('#option-choice-form input').on('change', function () {
  256. getVariantPrice();
  257. });
  258. </script>