mivita/resources/views/admin/abo/_order_onetime_show.blade.php
Kevin 2269ce031f Abo Einmalprodukte und Bestätigung abschließen
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-05 15:28:08 +00:00

105 lines
6 KiB
PHP

@php
$one_time_items = $user_abo->one_time_items()->with('product')->get();
$hasOneTimeChanges = \App\Services\AboOneTimeService::hasUnconfirmedChanges($user_abo);
$hasConfirmedOneTimeItems = \App\Services\AboOneTimeService::hasConfirmedItems($user_abo);
$oneTimeGross = $summary['one_time']['gross'] ?? 0;
$nextDeliveryTotal = $summary['total_with_shipping'] ?? 0;
$oneTimeConfirmationState = $hasOneTimeChanges ? 'changed' : ($hasConfirmedOneTimeItems ? 'confirmed' : 'empty');
@endphp
@if(isset($error_message) && $error_message)
<div class="alert alert-danger mt-2" id="insert_onetime_error_message">{{ $error_message }}</div>
@endif
<div class="table-responsive">
<table class="table table-product m-0" style="min-width:550px;">
<thead>
<tr>
<th>#</th>
<th>{{ __('order.article') }}</th>
<th>{{ __('tables.quantity') }}</th>
<th class="text-right">{{ __('tables.price') }}</th>
</tr>
</thead>
<tbody>
@forelse($one_time_items as $one_time_item)
<tr>
<td>
@if($one_time_item->product && count($one_time_item->product->images))
<img class="img-fluid img-extra" alt="" src="{{ route('product_image', [$one_time_item->product->images->first()->slug]) }}">
@endif
</td>
<td class="min-width-80">
<strong>{{ $one_time_item->product?->getLang('name') }}</strong>
<span class="badge badge-pill badge-warning"><i class="fa fa-bolt"></i> {{ __('abo.onetime_badge') }}</span>
<div class="text-body">
<div>{{ __('order.content') }}: {{ $one_time_item->product?->contents }}</div>
<div>{{ __('order.art_no') }}: {{ $one_time_item->product?->number }}</div>
</div>
<div class="options">
<a href="#" class="auto-delete-product remove_onetime_from_cart product-tooltip" data-onetime-item-id="{{ $one_time_item->id }}"><i class="fa fa-times"></i> {{ __('order.article_remove') }}</a>
</div>
</td>
<td>
<div class="no-line-break input-group-min-w">
<div class="input-group d-inline-flex w-auto">
<span class="input-group-prepend">
<button type="button" class="btn btn-secondary icon-btn md-btn-extra onetime-remove-from-basket" data-onetime-item-id="{{ $one_time_item->id }}">-</button>
</span>
<input type="text" class="form-control text-center input-extra onetime-input-onchange" name="onetime_qty_{{ $one_time_item->id }}" data-onetime-item-id="{{ $one_time_item->id }}" value="{{ $one_time_item->qty }}">
<span class="input-group-append">
<button type="button" class="btn btn-secondary icon-btn md-btn-extra onetime-add-from-basket" data-onetime-item-id="{{ $one_time_item->id }}">+</button>
</span>
</div>
</div>
</td>
<td class="text-right font-weight-semibold align-top px-3 py-2" style="width: 100px;">
<div class="no-line-break">{{ $one_time_item->getFormattedTotalPrice() }} &euro;</div>
</td>
</tr>
@empty
<tr>
<td colspan="4" class="text-muted small py-3 text-center">{{ __('abo.onetime_empty') }}</td>
</tr>
@endforelse
</tbody>
<tfoot>
<tr>
<td colspan="4"><hr></td>
</tr>
<tr>
<td colspan="3" class="text-right small"><strong>{{ __('abo.onetime_subtotal') }}:</strong></td>
<td class="text-right small">{{ formatNumber($summary['one_time']['gross'] ?? 0) }} </td>
</tr>
@if($oneTimeGross > 0 || $hasOneTimeChanges || $hasConfirmedOneTimeItems)
<tr>
<td colspan="3" class="text-right small no-border-top"><strong>{{ __('abo.onetime_next_delivery_total') }}:</strong></td>
<td class="text-right small no-border-top">{{ formatNumber($nextDeliveryTotal) }} </td>
</tr>
@endif
</tfoot>
</table>
</div>
@if($oneTimeGross > 0 || $hasOneTimeChanges || $hasConfirmedOneTimeItems)
<div class="mt-3" id="onetime_confirmation_block" data-confirmation-state="{{ $oneTimeConfirmationState }}" aria-live="polite">
<p class="small text-muted mb-2">
{!! __('abo.onetime_legal_notice', [
'nextBillingDate' => $user_abo->next_date ?: __('abo.confirm_next_delivery_unknown'),
'agb' => '<a href="'.url('/agb').'" target="_blank">'.__('abo.confirm_terms_link').'</a>',
'withdrawal' => '<a href="'.asset('download/mivita_widerruf_formular.pdf').'" target="_blank">'.__('abo.confirm_withdrawal_link').'</a>',
]) !!}
</p>
@if($hasOneTimeChanges)
<div class="d-flex flex-wrap justify-content-end">
<button type="button" class="btn btn-default mr-2 mb-2 onetime-discard-changes">
{{ __('abo.onetime_discard_changes') }}
</button>
<button type="button" class="btn btn-primary mb-2 onetime-confirm-changes">
{{ __('abo.onetime_confirm_paid') }}
</button>
</div>
@elseif($hasConfirmedOneTimeItems)
<div class="alert alert-success small mb-0">
<span aria-hidden="true">&check;</span> {{ __('abo.onetime_confirm_success') }}
</div>
@endif
</div>
@endif