- Live-Review-Gate: Einmalprodukte nur fuer VIP im Sales Center sichtbar, Portal ausgeblendet (AboHelper::isOneTimeFeatureVisible + Gates in Controllern) - Nur verbindlich bestaetigte Einmal-Artikel fliessen in die Lieferung; Service-Helfer confirmedItems/pendingItems/pendingGross - Footer-Layout der Einmalprodukt-Liste: bestaetigte Summe + Gesamtbetrag, Trennstrich, offener Betrag und neue Gesamtsumme (dunkelgruen) - Uebersetzungen DE/EN/ES/FR (onetime_new_total u.a.), Tests angepasst/ergaenzt Co-authored-by: Cursor <cursoragent@cursor.com>
165 lines
8.4 KiB
PHP
165 lines
8.4 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);
|
|
$hasBindingConfirmed = \App\Services\AboOneTimeService::confirmedItems($user_abo)->isNotEmpty();
|
|
$confirmedGross = $summary['one_time']['gross'] ?? 0;
|
|
$pendingGross = \App\Services\AboOneTimeService::pendingGross($user_abo);
|
|
$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>
|
|
@if ($one_time_item->isConfirmed())
|
|
<span class="badge badge-pill badge-success"><i class="fa fa-check"></i>
|
|
{{ __('abo.onetime_status_confirmed') }}</span>
|
|
@else
|
|
<span class="badge badge-pill badge-secondary"><i class="fa fa-clock"></i>
|
|
{{ __('abo.onetime_status_pending') }}</span>
|
|
@endif
|
|
<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() }} €</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>
|
|
@if ($hasBindingConfirmed)
|
|
<tr>
|
|
<td colspan="3" class="text-right small">
|
|
<strong>{{ __('abo.onetime_confirmed_subtotal') }}:</strong>
|
|
</td>
|
|
<td class="text-right small">{{ formatNumber($confirmedGross) }} €</td>
|
|
</tr>
|
|
<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
|
|
@if ($pendingGross > 0)
|
|
@if ($hasBindingConfirmed)
|
|
<tr>
|
|
<td colspan="4">
|
|
<hr>
|
|
</td>
|
|
</tr>
|
|
@endif
|
|
<tr>
|
|
<td colspan="3" class="text-right small no-border-top text-danger">
|
|
<strong>{{ __('abo.onetime_pending_subtotal') }}:</strong>
|
|
</td>
|
|
<td class="text-right small no-border-top text-danger">+
|
|
{{ formatNumber($pendingGross) }} €</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3" class="text-right no-border-top text-danger">
|
|
<strong>{{ __('abo.onetime_new_total') }}:</strong>
|
|
</td>
|
|
<td class="text-right no-border-top font-weight-bold text-danger">
|
|
{{ formatNumber(($hasBindingConfirmed ? $confirmedGross : 0) + $pendingGross) }} €</td>
|
|
</tr>
|
|
@endif
|
|
</tfoot>
|
|
</table>
|
|
</div>
|
|
@if ($one_time_items->count() > 0)
|
|
<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">✓</span> {{ __('abo.onetime_confirm_success') }}
|
|
</div>
|
|
@endif
|
|
@if ($hasOneTimeChanges && $hasConfirmedOneTimeItems)
|
|
<hr>
|
|
<div class="alert alert-info small mb-2">{{ __('abo.onetime_pending_hint') }}</div>
|
|
@endif
|
|
</div>
|
|
@endif
|