Compare commits

..

3 Commits

Author SHA1 Message Date
Bayu Lukman Yusuf c204d6d834 Merge branch 'feature-product' into development
WMS API/ECOMMERCE/pipeline/head This commit looks good Details
2026-03-02 12:02:52 +07:00
Bayu Lukman Yusuf 484c2c23c5 update address map 2026-03-02 12:02:34 +07:00
Bayu Lukman Yusuf f93d237c79 fix cart price 2026-03-02 11:44:56 +07:00
7 changed files with 25 additions and 16 deletions

View File

@ -489,8 +489,14 @@ class ProductController extends Controller
$complete_look_products = collect($complete_look_products_data->items())->chunk(2);
$variants = $product->publishedItemVariants ?? [];
if (count($variants) == 0) {
$variants = collect([$product]);
}
return view('shop.product-fashion', [
'product' => $product,
'variants' => $variants,
'complete_look_products' => $complete_look_products,
]);

View File

@ -34,6 +34,6 @@ class Cart extends Model
public function getDisplayPriceAttribute()
{
return $this->itemVariant->reference->item->display_price;
return $this->itemReference->item->display_price;
}
}

View File

@ -178,8 +178,8 @@
<x-address.address-map
:latitude="null"
:longitude="null"
latitudeInputName="latitude"
longitudeInputName="longitude"
latitudeInputName="new-latitude"
longitudeInputName="new-longitude"
:searchPlaceholder="__('addresses.search_for_location')"
:searchButtonText="__('addresses.search')"
:mapLabel="__('addresses.select_location_on_map')"

View File

@ -85,7 +85,7 @@
<td class="py-3 ps-0">
<div class="d-flex align-items-center">
<a class="flex-shrink-0"
href="{{ $cart->itemVariant->item->slug != null ? route('product.detail', $cart->itemVariant->item->slug) : '#' }}">
href="{{ $cart->itemReference->item->slug != null ? route('product.detail', $cart->itemReference->item->slug) : '#' }}">
<img src="{{ $cart->itemReference->item->image_url ?? '' }}"
width="80" alt="{{ $cart->name ?? 'Product' }}">
</a>
@ -94,7 +94,7 @@
<div class="w-100 min-w-0 ps-2 ps-xl-3">
<h5 class="d-flex animate-underline mb-2">
<a class="d-block fs-sm fw-medium text-truncate animate-target"
href="{{ $cart->itemVariant->item->slug != null ? route('product.detail', [$cart->itemVariant->item->slug]) : '#' }}">{{ $cart->itemVariant->display_name ?? ($cart->itemVariant->description ?? 'Product Name') }}</a>
href="{{ $cart->itemReference->item->slug != null ? route('product.detail', $cart->itemReference->item->slug) : '#' }}">{{ $cart->itemReference->item->display_name ?? ($cart->itemReference->item->name ?? $cart->itemReference->item->description ?? 'Product Name') }}</a>
</h5>
{{-- <ul class="list-unstyled gap-1 fs-xs mb-0">
<li><span class="text-body-secondary">Color:</span> <span
@ -108,9 +108,9 @@
</ul> --}}
<input type="hidden" id="price_{{ $cart->id }}"
value="{{ $cart->itemVariant->display_price ?? 0 }}">
value="{{ $cart->itemReference->item->display_price ?? 0 }}">
Rp
{{ number_format($cart->itemVariant->display_price ?? 0, 0, ',', '.') }}
{{ number_format($cart->itemReference->item->display_price ?? 0, 0, ',', '.') }}
<div class="count-input rounded-2 d-md-none mt-3">
<button type="button" class="btn btn-sm btn-icon"
@ -145,7 +145,7 @@
</div>
</td>
<td class="h6 py-3 d-none d-md-table-cell total-row">Rp
{{ number_format(($cart->display_price ?? 0) * ($cart->qty ?? 1), 0, ',', '.') }}
{{ number_format(($cart->itemReference->item->display_price ?? 0) * ($cart->qty ?? 1), 0, ',', '.') }}
</td>
<td class="text-end py-3 px-0">
<form action="{{ route('cart.delete', $cart->id) }}" method="POST"

View File

@ -13,10 +13,10 @@
<div class="address-map-component">
<!-- Hidden inputs for latitude and longitude -->
<input type="hidden" name="{{ $latitudeInputName }}" id="{{ $latitudeInputName }}" value="{{ $latitude ?? '' }}"
class="address-latitude-input" step="0.000001">
class="address-latitude-input {{ $latitudeInputName }}" step="0.000001">
<input type="hidden" name="{{ $longitudeInputName }}" id="{{ $longitudeInputName }}" value="{{ $longitude ?? '' }}"
class="address-longitude-input" step="0.000001">
class="address-longitude-input {{ $longitudeInputName }}" step="0.000001">
<!-- Map interface -->
<div class="position-relative">

View File

@ -33,8 +33,8 @@
@endif
</div>
<div class="position-relative">
@if (($product->variants?->count() ?? 0) > 1)
<div class=" fs-xs text-body-secondary opacity-100">+{{ ($product->variants->count() ?? 0) - 1 }} Varian</div>
@if (($product->publishedItemVariants?->count() ?? 0) > 1)
<div class=" fs-xs text-body-secondary opacity-100">+{{ ($product->publishedItemVariants->count() ?? 0) - 1 }} Varian</div>
@endif
{{-- <div class="hover-effect-target fs-xs text-body-secondary opacity-100">+1 color</div> --}}
{{-- <div class="hover-effect-target d-flex gap-2 position-absolute top-0 start-0 opacity-0">

View File

@ -152,11 +152,13 @@
<!-- Color options -->
<div class="mb-4">
@if ($variants->count() > 1)
<label class="form-label fw-semibold pb-1 mb-2">Varian: <span class="text-body fw-normal"
id="variantOption">{{ $product->variants->first()->description ?? '' }}</span></label>
id="variantOption">{{ $variants->first()->description ?? '' }}</span></label>
@endif
<div class="d-flex flex-wrap gap-2" data-binded-label="#variantOption">
@foreach ($product->variants as $key => $variant)
@foreach ($variants as $key => $variant)
<input type="radio" class="btn-check" name="colors"
value="{{ $variant->reference->id }}" id="variant-id-{{ $variant->id }}"
{{ $key == 0 ? 'checked' : '' }}>
@ -208,8 +210,9 @@
</div> --}}
<!-- Count input + Add to cart button -->
@if ($product->variants->first()->reference)
<x-shop.add-to-cart :item_reference_id="$product->variants->first()->reference->id" />
@if ($variants?->first()?->reference != null)
<x-shop.add-to-cart :item_reference_id="$variants->first()->reference->id" />
@endif
<!-- Info list -->
{{-- <ul class="list-unstyled gap-3 pb-3 pb-lg-4 mb-3">