Original Record
Total Amount:
MWK {{ number_format($editLog['original_total'], 2) }}
Payment Method:
@if($editLog['original_payment_method'] === 'split' && isset($editLog['original_payments']) && count($editLog['original_payments']) > 0)
@foreach($editLog['original_payments'] as $payment)
{{ ucfirst($payment['method']) }}: MWK {{ number_format($payment['amount'], 2) }}
@endforeach
@else
{{ ucfirst($editLog['original_payment_method']) }}
@endif
Items Count:
{{ count($editLog['original_items']) }}
Updated Record
New Total:
MWK {{ number_format($editLog['new_total'], 2) }}
Payment Method:
@if($editLog['new_payment_method'] === 'split' && isset($editLog['new_payments']) && count($editLog['new_payments']) > 0)
@foreach($editLog['new_payments'] as $payment)
{{ ucfirst($payment['method']) }}: MWK {{ number_format($payment['amount'], 2) }}
@endforeach
@else
{{ ucfirst($editLog['new_payment_method']) }}
@endif
Items Count:
{{ count($editLog['new_items']) }}
@if($editLog['total_change'] != 0)
Financial Adjustment
The total amount was {{ $editLog['total_change'] > 0 ? 'increased' : 'decreased' }} by MWK {{ number_format(abs($editLog['total_change']), 2) }}.
@endif
@if(isset($editLog['original_items']) && isset($editLog['new_items']))
Detailed Item Changes
| Product |
Orig. Qty |
New Qty |
Orig. Price |
New Price |
@php
$originalItems = collect($editLog['original_items'])->keyBy('product_id');
$newItems = collect($editLog['new_items'])->keyBy('product_id');
$allProducts = $originalItems->keys()->merge($newItems->keys())->unique();
@endphp
@foreach($allProducts as $productId)
@php
$original = $originalItems->get($productId);
$new = $newItems->get($productId);
$productName = $original['product_name'] ?? $new['product_name'] ?? 'Unknown';
// Handle different possible key names in the log structure
$originalQty = $original['quantity'] ?? $original['original_quantity'] ?? 0;
$newQty = $new['quantity'] ?? $new['new_quantity'] ?? 0;
$originalPrice = $original['price'] ?? $original['original_price'] ?? 0;
$newPrice = $new['price'] ?? $new['new_price'] ?? 0;
$hasChange = $originalQty != $newQty || $originalPrice != $newPrice;
@endphp
| {{ $productName }} |
{{ $originalQty }} |
{{ $newQty }} |
MWK {{ number_format($originalPrice, 2) }} |
MWK {{ number_format($newPrice, 2) }} |
@endforeach
@endif