cart.blade.php 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <div class="aiz-pos-cart-list mb-4 mt-3 c-scrollbar-light">
  2. @php
  3. $subtotal = 0;
  4. $tax = 0;
  5. @endphp
  6. @if (Session::has('pos.cart'))
  7. <ul class="list-group list-group-flush">
  8. @forelse (Session::get('pos.cart') as $key => $cartItem)
  9. @php
  10. $stock = \App\Models\ProductStock::find($cartItem['stock_id']);
  11. if ($stock){
  12. $subtotal += $cartItem['price']*$cartItem['quantity'];
  13. $tax += $cartItem['tax']*$cartItem['quantity'];
  14. }
  15. @endphp
  16. @if ($stock)
  17. <li class="list-group-item py-0 pl-2">
  18. <div class="row gutters-5 align-items-center">
  19. <div class="col-auto w-60px">
  20. <div class="row no-gutters align-items-center flex-column aiz-plus-minus">
  21. <button class="btn col-auto btn-icon btn-sm fs-15" type="button" data-type="plus" data-field="qty-{{ $key }}">
  22. <i class="las la-plus"></i>
  23. </button>
  24. <input type="text" name="qty-{{ $key }}" id="qty-{{ $key }}" class="col border-0 text-center flex-grow-1 fs-16 input-number" placeholder="1" value="{{ $cartItem['quantity'] }}" min="{{ $stock->product->min_qty }}" max="{{ $stock->qty }}" onchange="updateQuantity({{ $key }})">
  25. <button class="btn col-auto btn-icon btn-sm fs-15" type="button" data-type="minus" data-field="qty-{{ $key }}">
  26. <i class="las la-minus"></i>
  27. </button>
  28. </div>
  29. </div>
  30. <div class="col">
  31. <div class="text-truncate-2">{{ $stock->product->name }}</div>
  32. <span class="span badge badge-inline fs-12 badge-soft-secondary">{{ $cartItem['variant'] }}</span>
  33. </div>
  34. <div class="col-auto">
  35. <div class="fs-12 opacity-60">{{ single_price($cartItem['price']) }} x {{ $cartItem['quantity'] }}</div>
  36. <div class="fs-15 fw-600">{{ single_price($cartItem['price']*$cartItem['quantity']) }}</div>
  37. </div>
  38. <div class="col-auto">
  39. <button type="button" class="btn btn-circle btn-icon btn-sm btn-soft-danger ml-2 mr-0" onclick="removeFromCart({{ $key }})">
  40. <i class="las la-trash-alt"></i>
  41. </button>
  42. </div>
  43. </div>
  44. </li>
  45. @endif
  46. @empty
  47. <li class="list-group-item">
  48. <div class="text-center">
  49. <i class="las la-frown la-3x opacity-50"></i>
  50. <p>{{ translate('No Product Added') }}</p>
  51. </div>
  52. </li>
  53. @endforelse
  54. </ul>
  55. @else
  56. <div class="text-center">
  57. <i class="las la-frown la-3x opacity-50"></i>
  58. <p>{{ translate('No Product Added') }}</p>
  59. </div>
  60. @endif
  61. </div>
  62. <div>
  63. <div class="d-flex justify-content-between fw-600 mb-2 opacity-70">
  64. <span>{{translate('Sub Total')}}</span>
  65. <span>{{ single_price($subtotal) }}</span>
  66. </div>
  67. <div class="d-flex justify-content-between fw-600 mb-2 opacity-70">
  68. <span>{{translate('Tax')}}</span>
  69. <span>{{ single_price($tax) }}</span>
  70. </div>
  71. <div class="d-flex justify-content-between fw-600 mb-2 opacity-70">
  72. <span>{{translate('Shipping')}}</span>
  73. <span>{{ single_price(Session::get('pos.shipping', 0)) }}</span>
  74. </div>
  75. <div class="d-flex justify-content-between fw-600 mb-2 opacity-70">
  76. <span>{{translate('Discount')}}</span>
  77. <span>{{ single_price(Session::get('pos.discount', 0)) }}</span>
  78. </div>
  79. <div class="d-flex justify-content-between fw-600 fs-18 border-top pt-2">
  80. <span>{{translate('Total')}}</span>
  81. <span>{{ single_price($subtotal+$tax+Session::get('pos.shipping', 0) - Session::get('pos.discount', 0)) }}</span>
  82. </div>
  83. </div>