commit before consolodating payment methods
This commit is contained in:
@@ -224,28 +224,34 @@
|
||||
@endif
|
||||
|
||||
<div class="item-details">
|
||||
<h3>{{ $item['product']->name }}</h3>
|
||||
<h3>{{ $item['product']->name }}{{ $item['is_sample'] ? ' - Sample' : '' }}</h3>
|
||||
<p>{{ $item['product']->category->name }}</p>
|
||||
|
||||
@php
|
||||
$stockCost = 0;
|
||||
$stockUnit = $item['type'] === 'wallpaper' ? '/m' : '/m²';
|
||||
|
||||
if ($item['stock']) {
|
||||
if (!$item['is_sample'] && $item['stock']) {
|
||||
$stockCost = $item['type'] === 'wallpaper' ? $item['stock']->cost_per_meter : $item['stock']->cost_per_m2;
|
||||
}
|
||||
@endphp
|
||||
|
||||
@if($item['stock'])
|
||||
@if($item['is_sample'])
|
||||
<p style="font-size: 0.9rem; color: #666;">
|
||||
Sample - Fixed Price: <span class="item-price">R{{ number_format(\App\Services\ShippingService::getSampleCost(), 2) }}</span>
|
||||
</p>
|
||||
@elseif($item['stock'])
|
||||
<p style="font-size: 0.9rem; color: #666;">
|
||||
{{ $item['stock']->name }}: <span class="item-price">R{{ number_format($stockCost, 2) }}{{ $stockUnit }}</span>
|
||||
</p>
|
||||
@endif
|
||||
|
||||
@if($item['type'] === 'wallpaper')
|
||||
<p style="color: #666; font-size: 0.9rem;">Length: {{ $item['length'] }}m</p>
|
||||
@elseif($item['type'] === 'mural')
|
||||
<p style="color: #666; font-size: 0.9rem;">Dimensions: {{ $item['width'] }}m × {{ $item['height'] }}m ({{ number_format($item['width'] * $item['height'], 2) }}m²)</p>
|
||||
@if(!$item['is_sample'])
|
||||
@if($item['type'] === 'wallpaper')
|
||||
<p style="color: #666; font-size: 0.9rem;">Length: {{ $item['length'] }}m</p>
|
||||
@elseif($item['type'] === 'mural')
|
||||
<p style="color: #666; font-size: 0.9rem;">Dimensions: {{ $item['width'] }}m × {{ $item['height'] }}m ({{ number_format($item['width'] * $item['height'], 2) }}m²)</p>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
<p style="color: var(--primary-color); font-weight: 600;">Subtotal: R{{ number_format($item['subtotal'], 2) }}</p>
|
||||
@@ -277,20 +283,14 @@
|
||||
<span>Subtotal:</span>
|
||||
<span>R{{ number_format($total, 2) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="summary-row">
|
||||
<span>Shipping:</span>
|
||||
<span>Free</span>
|
||||
</div>
|
||||
|
||||
<div class="summary-row">
|
||||
<span>Tax:</span>
|
||||
<span>TBD</span>
|
||||
<span>{{ $shippingLabel }}:</span>
|
||||
<span>R {{ number_format($shippingFee, 2) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="summary-row total">
|
||||
<span>Total:</span>
|
||||
<span>R {{ number_format($total, 2) }}</span>
|
||||
<span>R {{ number_format($total + $shippingFee, 2) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="summary-actions">
|
||||
|
||||
@@ -234,30 +234,34 @@
|
||||
|
||||
@foreach($items as $item)
|
||||
<div class="order-item">
|
||||
<div class="order-item-name">{{ $item['product']->name }}</div>
|
||||
<div class="order-item-name">{{ $item['product']->name }}{{ $item['is_sample'] ? ' - Sample' : '' }}</div>
|
||||
|
||||
@php
|
||||
$stockCost = 0;
|
||||
$stockUnit = $item['type'] === 'wallpaper' ? '/m' : '/m²';
|
||||
|
||||
if ($item['stock']) {
|
||||
if (!$item['is_sample'] && $item['stock']) {
|
||||
$stockCost = $item['type'] === 'wallpaper' ? $item['stock']->cost_per_meter : $item['stock']->cost_per_m2;
|
||||
}
|
||||
@endphp
|
||||
|
||||
<div class="order-item-details">
|
||||
@if($item['stock'])
|
||||
@if($item['is_sample'])
|
||||
<strong>Sample - Fixed Price:</strong> R{{ number_format(\App\Services\ShippingService::getSampleCost(), 2) }}<br>
|
||||
@elseif($item['stock'])
|
||||
<strong>{{ $item['stock']->name }}:</strong> R{{ number_format($stockCost, 2) }}{{ $stockUnit }}<br>
|
||||
@endif
|
||||
|
||||
@if($item['type'] === 'wallpaper')
|
||||
<strong>Length:</strong> {{ $item['length'] }}m
|
||||
@elseif($item['type'] === 'mural')
|
||||
<strong>Dimensions:</strong> {{ $item['width'] }}m × {{ $item['height'] }}m ({{ number_format($item['width'] * $item['height'], 2) }}m²)
|
||||
@endif
|
||||
|
||||
@if($item['quantity'] > 1)
|
||||
<br><strong>Quantity:</strong> {{ $item['quantity'] }}
|
||||
@if(!$item['is_sample'])
|
||||
@if($item['type'] === 'wallpaper')
|
||||
<strong>Length:</strong> {{ $item['length'] }}m
|
||||
@elseif($item['type'] === 'mural')
|
||||
<strong>Dimensions:</strong> {{ $item['width'] }}m × {{ $item['height'] }}m ({{ number_format($item['width'] * $item['height'], 2) }}m²)
|
||||
@endif
|
||||
|
||||
@if($item['quantity'] > 1)
|
||||
<br><strong>Quantity:</strong> {{ $item['quantity'] }}
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
<div class="order-item-price">R{{ number_format($item['subtotal'], 2) }}</div>
|
||||
@@ -270,18 +274,13 @@
|
||||
</div>
|
||||
|
||||
<div class="summary-row">
|
||||
<span>Shipping:</span>
|
||||
<span>TBD at payment</span>
|
||||
</div>
|
||||
|
||||
<div class="summary-row">
|
||||
<span>Tax:</span>
|
||||
<span>TBD at payment</span>
|
||||
<span>{{ $shippingLabel }}:</span>
|
||||
<span>R{{ number_format($shippingFee, 2) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="summary-row total">
|
||||
<span>Total:</span>
|
||||
<span>R{{ number_format($total, 2) }}</span>
|
||||
<span>R{{ number_format($grandTotal, 2) }}</span>
|
||||
</div>
|
||||
|
||||
<a href="{{ route('cart') }}" class="back-link">← Back to Cart</a>
|
||||
|
||||
@@ -180,48 +180,62 @@
|
||||
@foreach($order->items as $item)
|
||||
<div class="item-row">
|
||||
<div class="item-info">
|
||||
<div class="item-name">{{ $item->product->name }}</div>
|
||||
<div class="item-name">{{ $item->product->name }}{{ $item->is_sample ? ' - Sample' : '' }}</div>
|
||||
<div class="item-qty">
|
||||
@php
|
||||
$stock = $item->printStock;
|
||||
$stockText = $stock ? "{$stock->name}" : "Standard";
|
||||
$stockCost = 0;
|
||||
|
||||
if ($stock) {
|
||||
$stockCost = $item->type === 'wallpaper' ? $stock->cost_per_meter : $stock->cost_per_m2;
|
||||
if (!$item->is_sample && $stock) {
|
||||
$stockCost = $item->type === 'wallpaper' ? $stock->cost_per_meter : $stock->cost_per_m2;
|
||||
}
|
||||
@endphp
|
||||
|
||||
@if($item->type === 'wallpaper')
|
||||
Length: {{ $item->length }}m | Finish: {{ $stockText }}<br>
|
||||
<small>Stock Cost: R{{ number_format($stockCost, 2) }}/m</small>
|
||||
@if($item->is_sample)
|
||||
Sample - Fixed Price: R{{ number_format(\App\Services\ShippingService::getSampleCost(), 2) }}
|
||||
@elseif($item->type === 'wallpaper')
|
||||
Length: {{ $item->length }}m | Finish: {{ $stockText }}<br>
|
||||
<small>Stock Cost: R{{ number_format($stockCost, 2) }}/m</small>
|
||||
@elseif($item->type === 'mural')
|
||||
Dimensions: {{ $item->width }}m × {{ $item->height }}m ({{ number_format($item->width * $item->height, 2) }}m²) | Finish: {{ $stockText }}<br>
|
||||
<small>Stock Cost: R{{ number_format($stockCost, 2) }}/m²</small>
|
||||
Dimensions: {{ $item->width }}m × {{ $item->height }}m ({{ number_format($item->width * $item->height, 2) }}m²) | Finish: {{ $stockText }}<br>
|
||||
<small>Stock Cost: R{{ number_format($stockCost, 2) }}/m²</small>
|
||||
@else
|
||||
<small>Price: R{{ number_format($stockCost, 2) }} per unit</small>
|
||||
<small>Price: R{{ number_format($stockCost, 2) }} per unit</small>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-price">
|
||||
R{{ number_format(
|
||||
$item->quantity * (
|
||||
$item->type === 'wallpaper'
|
||||
? $stockCost * $item->length
|
||||
: ($item->type === 'mural'
|
||||
? $stockCost * $item->width * $item->height
|
||||
: $stockCost
|
||||
)
|
||||
),
|
||||
$item->is_sample
|
||||
? \App\Services\ShippingService::getSampleCost() * $item->quantity
|
||||
: $item->quantity * (
|
||||
$item->type === 'wallpaper'
|
||||
? $stockCost * $item->length
|
||||
: ($item->type === 'mural'
|
||||
? $stockCost * $item->width * $item->height
|
||||
: $stockCost
|
||||
)
|
||||
),
|
||||
2
|
||||
) }}
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="total-row" style="justify-content: space-between; border-top: 1px solid #eee; padding-top: 1rem; margin-top: 1rem; font-size: 0.95rem; color: #666;">
|
||||
<span>Subtotal:</span>
|
||||
<span>R{{ number_format($order->total, 2) }}</span>
|
||||
</div>
|
||||
@if($order->shipping_fee)
|
||||
<div class="total-row" style="justify-content: space-between; border-top: none; padding-top: 0.5rem; margin-top: 0; font-size: 0.95rem; color: #666;">
|
||||
<span>Shipping:</span>
|
||||
<span>R{{ number_format($order->shipping_fee, 2) }}</span>
|
||||
</div>
|
||||
@endif
|
||||
<div class="total-row">
|
||||
<span>Order Total:</span>
|
||||
<span>R{{ number_format($order->total, 2) }}</span>
|
||||
<span>R{{ number_format($order->total + ($order->shipping_fee ?? 0), 2) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card--pink">
|
||||
|
||||
@@ -478,10 +478,29 @@
|
||||
<a href="{{ route('cart') }}" class="btn btn--secondary" style="flex: 1; text-align: center;">View Cart</a>
|
||||
</div>
|
||||
<div class="btn-group " style="margin-top: 1rem; gap: 1rem;">
|
||||
<button class="btn btn--secondary" style="flex: 1;">Order Sample</button>
|
||||
<button type="button" class="btn btn--secondary" style="flex: 1;" onclick="orderSample()">Order Sample</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Sample Order Form (Hidden) -->
|
||||
<form id="sampleForm" action="{{ route('order-sample', $product) }}" method="POST" style="display: none;">
|
||||
@csrf
|
||||
<input type="hidden" name="print_stock_id" id="sampleStockId">
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function orderSample() {
|
||||
const stockSelect = document.getElementById('print_stock_id');
|
||||
if (!stockSelect.value) {
|
||||
alert('Please select a stock option before ordering a sample.');
|
||||
stockSelect.focus();
|
||||
return;
|
||||
}
|
||||
document.getElementById('sampleStockId').value = stockSelect.value;
|
||||
document.getElementById('sampleForm').submit();
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
const productType = 'wallpaper' === 'wallpaper' ? 'wallpaper' : 'mural';
|
||||
const basePrice = {{ $product->price }};
|
||||
|
||||
Reference in New Issue
Block a user