136 lines
6.2 KiB
PHP
136 lines
6.2 KiB
PHP
{!! 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']}}">
|
||
|
||
@if(!App\Services\AboHelper::canEditAbo($user_abo, $data['view']))
|
||
<div class="alert alert-danger">
|
||
Unauthorized action. Is not my abo
|
||
</div>
|
||
@else
|
||
|
||
<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>
|
||
{!! HTMLHelper::getAboDeliveryOptions($user_abo->abo_interval) !!}
|
||
</select>
|
||
</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>
|