mivita/resources/views/admin/abo/modal_abo_update.blade.php
Kevin 65b867f8ee Abo Einmalprodukte: Phasen 5-7, konfigurierbare Sperrfristen, Lokalisierung & Dashboard
Rechnung/Lieferschein:
- PDF-Gruppierung Abo- vs. Einmal-Artikel (is_abo_addon), rueckwaertskompatibel
- Vorschau-Command sales:preview-invoice (umgeht Test-System-Gate, ohne Rechnungsnummer)

Reminder-Mail (vorbereitet, Cron inaktiv):
- MailAboExecutionReminder + Template, abo:send-execution-reminder, Spalte onetime_reminder_sent_for
- Berater -> Sales Center, Kunde -> Portal; Vorschau abo:preview-reminder
- Datum-Fix: formatDateDB() statt formatDate() (ICU-Format)

Sperrfristen konfigurierbar (Admin-Settings):
- abo-lock-days-change (Liefertag + Abo-Produkte), abo-lock-days-pause-cancel
- Meldungen mit :lock-Platzhalter; Pausieren/Kuendigen vom Change-Lock entkoppelt
- Abo-Produkt-Aenderungen im Lock-Fenster server- + clientseitig eingefroren
- Selbstbedienung: Add-only/Lock nach $view (kein Admin-Bypass), Stale-Cache-Fix beim Mengen-Update

Dashboard:
- Einmalprodukte-Card + Team-Abo-KPI-Card, News-Card responsiv (col-xl-6)

Lokalisierung:
- Sprachdateien en/es/fr vollstaendig mit de synchronisiert (inkl. marketingplan/portal)
- LocalizationSyncTest sichert Key-Gleichheit ab

Tests: AboOneTimeInvoiceGrouping, AboExecutionReminder, AboLockDaysSetting,
AboOnetimeDashboardAndMail, PreviewInvoiceCommand, TeamAboOverview + erweiterte View-Tests

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 13:38:11 +00:00

154 lines
7.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{!! Form::open(['action' => $route, 'class' => 'modal-content', 'enctype' => 'multipart/form-data']) !!}
<div class="modal-header">
<h5 class="modal-title">
{{ __('abo.abo_settings') }} <span class="text-muted">{{ '#'.$user_abo->payone_userid }}</span>
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
</div>
<div class="modal-body">
<input type="hidden" name="action" value="{{$data['action']}}">
<input type="hidden" name="id" value="{{$data['id']}}">
<input type="hidden" name="view" value="{{$data['view']}}">
@php
$aboChangeLocked = App\Services\AboHelper::isAboChangeLocked($user_abo, $data['view']);
@endphp
@if(!App\Services\AboHelper::canEditAbo($user_abo, $data['view']))
<div class="alert alert-danger">
Unauthorized action. Is not my abo
</div>
@else
@if($aboChangeLocked)
<div class="alert alert-warning">
{{ __('abo.error_change_locked', [
'days' => (int) now()->diffInDays(\Carbon\Carbon::parse($user_abo->next_date), false),
'lock' => App\Repositories\AboRepository::getLockDaysChange(),
]) }}
</div>
@endif
<div class="form-row">
<div class="col-sm-6">
<label for="abo_interval" class="form-label">{{ __('tables.abo_delivery_day') }}*</label>
<select class="custom-select" name="abo_interval" id="abo_interval" required {{ $aboChangeLocked ? 'disabled' : '' }}>
{!! HTMLHelper::getAboDeliveryOptions($user_abo->abo_interval) !!}
</select>
@if($aboChangeLocked)
{{-- Deaktiviertes Select sendet keinen Wert: aktuellen Liefertag mitsenden,
damit andere Aktionen (z. B. Kündigen) nicht an der Liefertag-Validierung scheitern. --}}
<input type="hidden" name="abo_interval" value="{{ $user_abo->abo_interval }}">
@endif
</div>
@if($data['view'] === 'admin')
@php
$selectedNextMonth = $user_abo->getRawOriginal('next_date')
? \Carbon\Carbon::parse($user_abo->getRawOriginal('next_date'))->format('Y-m')
: now()->format('Y-m');
@endphp
<div class="col-sm-6">
<label for="abo_next_month" class="form-label">{{ __('validation.attributes.month') }}*</label>
<select class="custom-select" name="abo_next_month" id="abo_next_month" required>
@foreach(range(0, 3) as $monthOffset)
@php
$executionMonth = now()->copy()->startOfMonth()->addMonths($monthOffset);
@endphp
<option value="{{ $executionMonth->format('Y-m') }}" @if($executionMonth->format('Y-m') === $selectedNextMonth) selected @endif>
{{ \App\Services\HTMLHelper::getMonth($executionMonth->month) }} {{ $executionMonth->year }}
</option>
@endforeach
</select>
</div>
@endif
<div class="col-sm-12 mt-1">
<i class="text-muted">
@if($data['view'] === 'admin')
{{ __('abo.admin_abo_copy_next_date') }}
@else
{{ __('abo.abo_copy_abo_interval') }}
@endif
</i>
</div>
</div>
{{--
<div class="form-row">
<div class="col-sm-6">
<label for="next_date" class="form-label">{{ __('tables.next_date') }} ({{ $user_abo->next_date }})</label>
{!! Form::text('next_date', $user_abo->next_date, ['class'=>'form-control datepicker-base']) !!}
</div>
<div class="form-group col-sm-12 mt-1">
<i class="text-muted">{{ __('abo.abo_copy_next_date') }}</i>
</div>
</div>
<hr>
--}}
@php
$canCancel = App\Services\AboHelper::canCancelAbo($user_abo, $data['view']);
@endphp
<hr>
@if($canCancel || $data['view'] == 'admin')
<div class="form-row">
<div class="col-sm-12">
<label class="switcher switcher-primary">
<input type="checkbox" class="switcher-input" name="abo_is_active" value="true" @if($user_abo->active) checked @endif>
<span class="switcher-indicator">
<span class="switcher-yes"></span>
<span class="switcher-no"></span>
</span>
<span class="switcher-label">{{ __('abo.abo_is_active') }}</span>
</label>
</div>
<div class="col-sm-12 mt-1">
<i class="text-muted">{{ __('abo.abo_copy_active') }}</i>
</div>
@if($data['view'] !== 'admin')
<div class="col-sm-12 mt-3">
<button type="submit" name="abo_cancel" value="true" class="btn btn-danger btn-sm" onclick="return confirm('{{ __('abo.confirm_cancel') }}')">
<i class="ion ion-ios-trash"></i> {{ __('abo.cancel_abo') }}
</button>
</div>
@endif
</div>
@else
<input type="hidden" name="abo_is_active" value="{{ $user_abo->active }}">
<div class="mt-1">
<div class="alert alert-warning">
{{ __('abo.info_min_duration_orders_left', ['count' => App\Services\AboHelper::getAboMinDuration() - $user_abo->getCountPaidOrders()]) }}
</div>
</div>
@endif
@endif
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">{{ __('close') }}</button>
<button type="submit" class="btn btn-primary">{{__('speichern')}}</button>
</div>
{!! Form::close() !!}
<script type="text/javascript">
$( document ).ready(function() {
$('.datepicker-base').datepicker({
orientation: 'auto right',
calendarWeeks: true,
todayBtn: 'linked',
//daysOfWeekDisabled: '1',
todayHighlight: true,
multidate: false,
daysOfWeekHighlighted: '0,6',
autoclose: true,
format: 'dd.mm.yyyy',
language: '{{ \App::getLocale() }}',
clearBtn: true,
}).on('clearDate', function(e) {
$('.datepicker-base').datepicker('update', '{{ $user_abo->next_date }}');
});
});
</script>