view_compare.blade.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. @extends('frontend.layouts.app')
  2. @section('content')
  3. <section class="pt-4 mb-4">
  4. <div class="container text-center">
  5. <div class="row">
  6. <div class="col-lg-6 text-center text-lg-left">
  7. <h1 class="fw-600 h4">{{ translate('Compare')}}</h1>
  8. </div>
  9. <div class="col-lg-6">
  10. <ul class="breadcrumb bg-transparent p-0 justify-content-center justify-content-lg-end">
  11. <li class="breadcrumb-item opacity-50">
  12. <a class="text-reset" href="{{ route('home') }}">{{ translate('Home')}}</a>
  13. </li>
  14. <li class="text-dark fw-600 breadcrumb-item">
  15. <a class="text-reset" href="{{ route('compare.reset') }}">"{{ translate('Compare')}}"</a>
  16. </li>
  17. </ul>
  18. </div>
  19. </div>
  20. </div>
  21. </section>
  22. <section class="mb-4">
  23. <div class="container text-left">
  24. <div class="bg-white shadow-sm rounded">
  25. <div class="p-3 border-bottom d-flex justify-content-between align-items-center">
  26. <div class="fs-15 fw-600">{{ translate('Comparison')}}</div>
  27. <a href="{{ route('compare.reset') }}" style="text-decoration: none;" class="btn btn-soft-primary btn-sm fw-600">{{ translate('Reset Compare List')}}</a>
  28. </div>
  29. @if(Session::has('compare'))
  30. @if(count(Session::get('compare')) > 0)
  31. <div class="p-3">
  32. <table class="table table-responsive table-bordered mb-0">
  33. <thead>
  34. <tr>
  35. <th scope="col" style="width:16%" class="font-weight-bold">
  36. {{ translate('Name')}}
  37. </th>
  38. @foreach (Session::get('compare') as $key => $item)
  39. <th scope="col" style="width:28%" class="font-weight-bold">
  40. <a class="text-reset fs-15" href="{{ route('product', \App\Models\Product::find($item)->slug) }}">{{ \App\Models\Product::find($item)->getTranslation('name') }}</a>
  41. </th>
  42. @endforeach
  43. </tr>
  44. </thead>
  45. <tbody>
  46. <tr>
  47. <th scope="row">{{ translate('Image')}}</th>
  48. @foreach (Session::get('compare') as $key => $item)
  49. <td>
  50. <img loading="lazy" src="{{ uploaded_asset(\App\Models\Product::find($item)->thumbnail_img) }}" alt="{{ translate('Product Image') }}" class="img-fluid py-4">
  51. </td>
  52. @endforeach
  53. </tr>
  54. <tr>
  55. <th scope="row">{{ translate('Price')}}</th>
  56. @foreach (Session::get('compare') as $key => $item)
  57. @php
  58. $product = \App\Models\Product::find($item);
  59. @endphp
  60. <td>
  61. @if(home_base_price($product) != home_discounted_base_price($product))
  62. <del class="fw-600 opacity-50 mr-1">{{ home_base_price($product) }}</del>
  63. @endif
  64. <span class="fw-700 text-primary">{{ home_discounted_base_price($product) }}</span>
  65. </td>
  66. @endforeach
  67. </tr>
  68. <tr>
  69. <th scope="row">{{ translate('Brand')}}</th>
  70. @foreach (Session::get('compare') as $key => $item)
  71. <td>
  72. @if (\App\Models\Product::find($item)->brand != null)
  73. {{ \App\Models\Product::find($item)->brand->getTranslation('name') }}
  74. @endif
  75. </td>
  76. @endforeach
  77. </tr>
  78. <tr>
  79. <th scope="row">{{ translate('Category')}}</th>
  80. @foreach (Session::get('compare') as $key => $item)
  81. <td>
  82. @if (\App\Models\Product::find($item)->category != null)
  83. {{ \App\Models\Product::find($item)->category->getTranslation('name') }}
  84. @endif
  85. </td>
  86. @endforeach
  87. </tr>
  88. <tr>
  89. <th scope="row"></th>
  90. @foreach (Session::get('compare') as $key => $item)
  91. <td class="text-center py-4">
  92. <button type="button" class="btn btn-primary fw-600" onclick="showAddToCartModal({{ $item }})">
  93. {{ translate('Add to cart')}}
  94. </button>
  95. </td>
  96. @endforeach
  97. </tr>
  98. </tbody>
  99. </table>
  100. </div>
  101. @endif
  102. @else
  103. <div class="text-center p-4">
  104. <p class="fs-17">{{ translate('Your comparison list is empty')}}</p>
  105. </div>
  106. @endif
  107. </div>
  108. </div>
  109. </section>
  110. @endsection