mivita/resources/views/admin/abo/_change_history.blade.php
2026-02-20 17:55:06 +01:00

62 lines
2.9 KiB
PHP

@php
$changeHistory = $user_abo->getChangeHistory();
$priceLabel = $user_abo->is_for === 'me' ? __('abo_history.price_net') : __('abo_history.price_gross');
@endphp
<div class="card-body">
<div class="d-flex justify-content-between align-items-center mb-3">
<h5 class="font-weight-semibold mb-0">
<i class="fas fa-history"></i> {{ __('abo_history.change_history') }}
</h5>
@if(isset($isAdmin) && $isAdmin && $user_abo->getInitialItems()->isNotEmpty())
{{-- <form action="{{ route('admin_abos_rollback', [$user_abo->id]) }}" method="POST"
onsubmit="return confirm('{{ __('abo_history.rollback_confirm') }}')">
@csrf
<button type="submit" class="btn btn-sm btn-outline-danger">
<i class="fas fa-undo"></i> {{ __('abo_history.rollback_btn') }}
</button>
</form>
--}}
@endif
</div>
@if($changeHistory->isEmpty())
<p class="text-muted mb-0">
<i class="fas fa-info-circle"></i> {{ __('abo_history.no_changes') }}
</p>
@else
<div class="table-responsive">
<table class="table table-sm table-striped mb-0">
<thead>
<tr>
<th>{{ __('abo_history.col_date') }}</th>
<th>{{ __('abo_history.col_action') }}</th>
<th>{{ __('abo_history.col_product') }}</th>
<th>{{ __('abo_history.col_details') }}</th>
<th class="text-right">{{ __('tables.price') }} <small class="text-muted">({{ $priceLabel }})</small></th>
<th>{{ __('abo_history.col_changed_by') }}</th>
<th>{{ __('abo_history.col_channel') }}</th>
</tr>
</thead>
<tbody>
@foreach($changeHistory as $entry)
<tr>
<td class="text-nowrap small">{{ $entry->getFormattedDate() }}</td>
<td>{!! $entry->getActionBadge() !!}</td>
<td>
<strong>{{ $entry->product_name }}</strong>
@if($entry->product_number)
<br><small class="text-muted">{{ $entry->product_number }}</small>
@endif
</td>
<td class="small">{{ $entry->getChangeDescription() }}</td>
<td class="text-right text-nowrap">{{ $entry->getFormattedTotalPrice() }} &euro;</td>
<td class="small">{{ $entry->changed_by_name }}</td>
<td>{!! $entry->getChannelBadge() !!}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
</div>