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

491 lines
29 KiB
PHP

<div class="card mb-4">
<h5 class="card-header">
<div class="row">
<div class="col-xs-12 col-sm-6">
{{ __('customer.customer_billing_address') }}
</div>
<div class="col-xs-12 col-sm-6">
<span class="text-tiny float-right">* {{trans('register.required_fields')}}</span>
<span class="d-none d-lg-inline">{{ __('Delivery address') }}</span>
</div>
</div>
</h5>
<div class="card-body">
<div class="row">
<div class="col-12 col-lg-6">
<div class="form-row">
<div class="form-group col-md-12">
<label for="billing_company" class="form-label">{{ __('Company name') }} ({{__('optional')}})</label>
{{ Form::text('billing_company', $shopping_user->billing_company, array('placeholder'=>__('Company name'), 'class'=>'form-control', 'id'=>'billing_company', 'tabindex' => 1)) }}
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6 {{ $errors->has('billing_salutation') ? 'has-error' : '' }}">
<label class="form-label">{{ __('Salutation') }}*</label>
<select class="selectpicker" data-style="btn-light" name="billing_salutation" id="billing_salutation" required tabindex="2">
{!! HTMLHelper::getSalutation($shopping_user->billing_salutation) !!}
</select>
@if ($errors->has('billing_salutation'))
<span class="help-block">
<strong>{{ $errors->first('billing_salutation') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6 {{ $errors->has('billing_firstname') ? 'has-error' : '' }}">
<label class="form-label" for="billing_firstname">{{ __('First name') }}*</label>
{{ Form::text('billing_firstname', $shopping_user->billing_firstname, array('placeholder'=>__('First name'), 'class'=>'form-control', 'id'=>'billing_firstname', 'required'=>true, 'tabindex' => 4)) }}
@if ($errors->has('billing_firstname'))
<span class="help-block">
<strong>{{ $errors->first('billing_firstname') }}</strong>
</span>
@endif
</div>
<div class="form-group col-md-6 {{ $errors->has('billing_lastname') ? 'has-error' : '' }}">
<label class="form-label" for="billing_lastname">{{ __('Last name') }}*</label>
{{ Form::text('billing_lastname', $shopping_user->billing_lastname, array('placeholder'=>__('Last name'), 'class'=>'form-control', 'id'=>'billing_lastname', 'required'=>true, 'tabindex' => 5)) }}
@if ($errors->has('billing_lastname'))
<span class="help-block">
<strong>{{ $errors->first('billing_lastname') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12 {{ $errors->has('billing_address') ? 'has-error' : '' }}">
<label class="form-label" for="billing_address">{{ __('Street') }} / {{ __('House number') }}*</label>
{{ Form::text('billing_address', $shopping_user->billing_address, array('placeholder'=>__('Street'), 'class'=>'form-control', 'required'=>true, 'id'=>'billing_address', 'tabindex' => 6)) }}
@if ($errors->has('billing_address'))
<span class="help-block">
<strong>{{ $errors->first('billing_address') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12 {{ $errors->has('billing_address_2') ? 'has-error' : '' }}">
<label class="form-label" for="billing_address_2">{{ __('Flat Building optional') }}</label>
{{ Form::text('billing_address_2', $shopping_user->billing_address_2, array('placeholder'=>__('Flat Building optional'), 'class'=>'form-control', 'id'=>'billing_address_2', 'tabindex' => 6)) }}
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6 {{ $errors->has('billing_zipcode') ? 'has-error' : '' }}">
<label class="form-label" for="billing_zipcode">{{ __('Postcode') }}*</label>
{{ Form::text('billing_zipcode', $shopping_user->billing_zipcode, array('placeholder'=>__('Postcode'), 'class'=>'form-control', 'required'=>true, 'id'=>'billing_zipcode', 'tabindex' => 7)) }}
@if ($errors->has('billing_zipcode'))
<span class="help-block">
<strong>{{ $errors->first('billing_zipcode') }}</strong>
</span>
@endif
</div>
<div class="form-group col-md-6 {{ $errors->has('billing_city') ? 'has-error' : '' }}">
<label class="form-label" for="billing_city">{{ __('City') }}*</label>
{{ Form::text('billing_city', $shopping_user->billing_city, array('placeholder'=>__('City'), 'class'=>'form-control', 'required'=>true, 'id'=>'billing_city', 'tabindex' => 8)) }}
@if ($errors->has('billing_city'))
<span class="help-block">
<strong>{{ $errors->first('billing_city') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12 {{ $errors->has('billing_country_id') ? 'has-error' : '' }}">
<label class="form-label">{{ __('Country') }}*</label>
<select class="selectpicker" name="billing_country_id" id="billing_country_id" data-style="btn-light" data-live-search="true" required tabindex="9">
{!! HTMLHelper::getContriesWithMore($shopping_user->billing_country_id) !!}
</select>
@if ($errors->has('billing_country_id'))
<span class="help-block">
<strong>{{ $errors->first('billing_country_id') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12 {{ $errors->has('billing_phone') ? 'has-error' : '' }}">
<label class="form-label" for="billing_phone">{{ __('Phone') }}</label>
{{ Form::text('billing_phone', $shopping_user->billing_phone, array('placeholder'=>__('Phone'), 'class'=>'form-control', 'id'=>'billing_phone', 'tabindex' => 11)) }}
</div>
</div>
</div>
<div class="col-12 col-lg-6">
<div class="d-md-block d-lg-none">
<hr>
<h5 class="mt-4">{{ __('Delivery address') }}</h5>
</div>
<div id="show_shipping_address" style="@if($shopping_user->same_as_billing) display:none @endif">
<div class="form-row">
<div class="form-group col-md-12">
<label for="shipping_company" class="form-label">{{ __('Company name') }} ({{__('optional')}})</label>
{{ Form::text('shipping_company', $shopping_user->shipping_company, array('placeholder'=>__('Company name'), 'class'=>'form-control', 'id'=>'shipping_company', 'tabindex' => 16)) }}
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6 {{ $errors->has('shipping_salutation') ? 'has-error' : '' }}">
<label class="form-label">{{ __('Salutation') }}*</label>
<select class="selectpicker" data-style="btn-light" name="shipping_salutation" id="shipping_salutation" required tabindex="17">
{!! HTMLHelper::getSalutation($shopping_user->shipping_salutation) !!}
</select>
@if ($errors->has('shipping_salutation'))
<span class="help-block">
<strong>{{ $errors->first('shipping_salutation') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6 {{ $errors->has('shipping_firstname') ? 'has-error' : '' }}">
<label class="form-label" for="shipping_firstname">{{ __('First name') }}*</label>
{{ Form::text('shipping_firstname', $shopping_user->shipping_firstname, array('placeholder'=>__('First name'), 'class'=>'form-control', 'required'=>true, 'id'=>'shipping_firstname', 'tabindex' => 18)) }}
@if ($errors->has('shipping_firstname'))
<span class="help-block">
<strong>{{ $errors->first('shipping_firstname') }}</strong>
</span>
@endif
</div>
<div class="form-group col-md-6 {{ $errors->has('shipping_lastname') ? 'has-error' : '' }}">
<label class="form-label" for="shipping_lastname">{{ __('Last name') }}*</label>
{{ Form::text('shipping_lastname', $shopping_user->shipping_lastname, array('placeholder'=>__('Last name'), 'class'=>'form-control', 'required'=>true, 'id'=>'shipping_lastname', 'tabindex' => 19)) }}
@if ($errors->has('shipping_lastname'))
<span class="help-block">
<strong>{{ $errors->first('shipping_lastname') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12 {{ $errors->has('shipping_address') ? 'has-error' : '' }}">
<label class="form-label" for="shipping_address">{{ __('Street') }} / {{ __('House number') }}*</label>
{{ Form::text('shipping_address', $shopping_user->shipping_address, array('placeholder'=>__('Street'), 'class'=>'form-control', 'required'=>true, 'id'=>'shipping_address', 'tabindex' => 20)) }}
@if ($errors->has('shipping_address'))
<span class="help-block">
<strong>{{ $errors->first('shipping_address') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12 {{ $errors->has('shipping_address_2') ? 'has-error' : '' }}">
<label class="form-label" for="shipping_address_2">{{ __('Flat Building optional') }}</label>
{{ Form::text('shipping_address_2', $shopping_user->shipping_address_2, array('placeholder'=>__('Flat Building optional'), 'class'=>'form-control', 'id'=>'shipping_address_2', 'tabindex' => 21)) }}
@if ($errors->has('shipping_address_2'))
<span class="help-block">
<strong>{{ $errors->first('shipping_address_2') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6 {{ $errors->has('shipping_zipcode') ? 'has-error' : '' }}">
<label class="form-label" for="shipping_zipcode">{{ __('Postcode') }}*</label>
{{ Form::text('shipping_zipcode', $shopping_user->shipping_zipcode, array('placeholder'=>__('Postcode'), 'class'=>'form-control', 'required'=>true, 'id'=>'shipping_zipcode', 'tabindex' => 22)) }}
@if ($errors->has('shipping_zipcode'))
<span class="help-block">
<strong>{{ $errors->first('shipping_zipcode') }}</strong>
</span>
@endif
</div>
<div class="form-group col-md-6 {{ $errors->has('shipping_city') ? 'has-error' : '' }}">
<label class="form-label" for="shipping_city">{{ __('City') }}*</label>
{{ Form::text('shipping_city', $shopping_user->shipping_city, array('placeholder'=>__('City'), 'class'=>'form-control', 'required'=>true, 'id'=>'shipping_city', 'tabindex' => 23)) }}
@if ($errors->has('shipping_city'))
<span class="help-block">
<strong>{{ $errors->first('shipping_city') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12 {{ $errors->has('shipping_country_id') ? 'has-error' : '' }}">
<label class="form-label">{{ __('Country') }}*</label>
<select class="selectpicker" name="shipping_country_id" id="shipping_country_id" data-style="btn-light" data-live-search="true" required tabindex="24">
{!! HTMLHelper::getContriesWithMore($shopping_user->shipping_country_id) !!}
</select>
@if ($errors->has('shipping_country_id'))
<span class="help-block">
<strong>{{ $errors->first('shipping_country_id') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label class="form-label" for="shipping_phone">{{ __('Phone') }}</label>
{{ Form::text('shipping_phone', $shopping_user->shipping_phone, array('placeholder'=>__('Phone'), 'class'=>'form-control', 'id'=>'shipping_phone', 'tabindex' => 26)) }}
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label class="form-label" for="shipping_postnumber">{{ __('payment.dhl_postnumber') }} <small class="text-muted">({{ __('optional') }})</small></label>
{{ Form::text('shipping_postnumber', $shopping_user->shipping_postnumber, array('placeholder'=>'12345678', 'class'=>'form-control', 'id'=>'shipping_postnumber', 'maxlength'=>'20', 'tabindex' => 27)) }}
<small class="form-text text-muted">{{ __('payment.packstation_info') }}</small>
</div>
</div>
{{-- Alert-Box für Packstation-Hinweis --}}
<div class="alert alert-warning alert-dismissible fade show" id="packstation-alert" style="display: @if($shopping_user->shipping_postnumber) block @else none @endif;">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h6 class="alert-heading"><i class="fa fa-exclamation-triangle"></i> <strong>{{ __('payment.packstation_alert_title') }}</strong></h6>
<hr>
<p class="mb-2"><strong>{{ __('payment.packstation_alert_intro') }}</strong></p>
<ul class="mb-2 pl-3">
<li><strong>{{ __('Street') }} / {{ __('House number') }}:</strong> {{ __('payment.packstation_alert_street') }} <em>({{ __('payment.packstation_alert_street_example') }})</em></li>
<li><strong>{{ __('Postcode') }} / {{ __('City') }}:</strong> {{ __('payment.packstation_alert_location') }} <em>({{ __('payment.packstation_alert_not_home') }})</em></li>
</ul>
<p class="mb-0 small text-muted">
<i class="fa fa-info-circle"></i> {{ __('payment.packstation_alert_footer') }}
</p>
</div>
</div>
<div class="form-group">
<label class="custom-control custom-checkbox m-0">
<input type="checkbox" class="custom-control-input" name="same_as_billing" id="same_as_billing" @if($shopping_user->same_as_billing) checked="checked" @endif>
<span class="custom-control-label">{{__('Shipping to the same address')}}</span>
</label>
</div>
<hr>
</div>
</div>
@if($isView === 'customer')
@endif
<div class="card mb-4">
<div class="card-body">
<div class="form-group">
<label class="custom-control custom-checkbox m-0">
<input type="checkbox" class="custom-control-input" name="has_buyed" id="has_buyed" @if($shopping_user->has_buyed) checked="checked" @endif>
<span class="custom-control-label">{{ __('customer.customer_has_already_buy') }}</span>
</label>
</div>
<div class="alert alert-warning mt-3" id="show_has_buyed" style="display: @if($shopping_user->has_buyed) block @else none @endif;">
<label class="custom-control custom-checkbox m-0">
<input type="checkbox" class="custom-control-input" name="subscribed" id="subscribed" @if($shopping_user->subscribed) checked="checked" @endif >
<span class="custom-control-label">{{ __('customer.newsletter_subscribed_copy1') }}</span>
</label>
</div>
</div>
</div>
<hr>
<div class="form-row">
<div class="form-group col-md-12">
<label class="form-label" for="remarks">{{ __('Comments') }}</label>
{{ Form::textarea('remarks', $shopping_user->remarks, array('placeholder'=>__('Comments'), 'class'=>'form-control', 'rows'=>4, 'id'=>'remarks')) }}
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label class="form-label" for="language">{{ __('account.preferred_language') }}</label>
<select class="selectpicker" name="language" id="language" data-style="btn-light">
@foreach(\App\Models\ShoppingUser::getAvailableLanguages() as $code => $label)
<option value="{{ $code }}" {{ $shopping_user->language === $code ? 'selected' : '' }}>
{{ $label }}
</option>
@endforeach
</select>
<p class="badge badge-default mt-2">{{ __('customer.language_hint') }}</p>
</div>
</div>
<hr>
{{ Form::hidden('faker_mail', $shopping_user->faker_mail) }}
@if($isView === 'customer-add')
{{ Form::hidden('billing_email_1', $billing_email) }}
{{ Form::hidden('billing_email-confirm_1', $billing_email) }}
@if($shopping_user->faker_mail)
{{ Form::hidden('billing_email', $billing_email) }}
{{ Form::hidden('billing_email-confirm', $billing_email) }}
@else
<div class="form-row">
<div class="form-group col-md-6">
<label class="form-label" for="billing_email">{{ __('E-Mail Address') }}*</label>
{{ Form::text('billing_email', $billing_email, array('placeholder'=>'E-Mail', 'class'=>'form-control', 'id'=>'billing_email', 'readonly')) }}
</div>
<div class="form-group col-md-6">
<label class="form-label" for="billing_email-confirm">{{ __('Confirm E-Mail') }}*</label>
{{ Form::text('billing_email-confirm', $billing_email, array('placeholder'=>__('Confirm E-Mail'), 'class'=>'form-control', 'id'=>'billing_email-confirm', 'readonly')) }}
</div>
</div>
@endif
@else
@if($shopping_user->faker_mail)
{{ Form::hidden('billing_email', $shopping_user->billing_email) }}
{{ Form::hidden('billing_email-confirm', $shopping_user->billing_email) }}
@if($isAdmin != 1)
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
<h6 class="card-header bg-light">
<a href="#" class="" data-toggle="collapse" data-target="#collapseNewMailAddress" aria-expanded="@if($errors->has('new_email_address')) true @else false @endif" aria-controls="collapseNewMailAddress">
<i class="fa fa-caret-expand"></i> {{ __('E-Mail Address') }} {{ __('add') }}
</a>
</h6>
<div class="collapse @if($errors->has('new_email_address')) show @endif" id="collapseNewMailAddress">
<div class="form-row mt-2 mb-0">
<div class="form-group col-md-12 {{ $errors->has('new_email_address') ? 'has-error' : '' }}">
<label class="form-label" for="new_email_address">{{ __('E-Mail Address') }}*</label>
{{ Form::text('new_email_address', '', array('placeholder'=>__('E-Mail Address'), 'class'=>'form-control', 'id'=>'new_email_address', 'required'=>true ,'tabindex' => 1)) }}
@if ($errors->has('new_email_address'))
<span class="help-block">
<strong>{{ $errors->first('new_email_address') }}</strong>
</span>
@endif
<p class="mt-2">{{ __('customer.customer_sovereignty_info1') }}</p>
<button type="submit" class="btn btn-secondary btn-sm" name="action" value="add-mail-shopping-user-store">{{ __('E-Mail Address') }} {{ __('customer.check_and_save') }}</button>
</div>
</div>
</div>
@endif
@else
<div class="form-row">
<div class="form-group col-md-6">
<label class="form-label" for="billing_email">{{ __('E-Mail Address') }}*</label>
{{ Form::text('billing_email', $shopping_user->billing_email, array('placeholder'=>'E-Mail', 'class'=>'form-control', 'id'=>'billing_email')) }}
</div>
<div class="form-group col-md-6">
<label class="form-label" for="billing_email-confirm">{{ __('Confirm E-Mail') }}</label>
{{ Form::text('billing_email-confirm', $shopping_user->billing_email, array('placeholder'=>__('Confirm E-Mail'), 'class'=>'form-control', 'id'=>'billing_email-confirm')) }}
</div>
</div>
@endif
@endif
</div>
</div>
<script type="application/javascript">
$( document ).ready(function() {
$('input#has_buyed').on('change', function () {
if($(this).prop('checked')){
$('input#subscribed').prop('checked', true);
$('#show_has_buyed').show('slow');
}else{
$('input#subscribed').prop('checked', false);
$('#show_has_buyed').hide('slow');
}
});
// Shipping Address show|hide
$("#same_as_billing").on("change", function () {
$('#show_shipping_address').slideToggle(200, function () {
// scroll down to shipping area.
if ($('#show_shipping_address').is(":visible")) {
_scrollTo('#show_shipping_address', 20);
}
});
});
// Packstation Alert show|hide
function togglePackstationAlert() {
var postnumber = $('#shipping_postnumber').val();
if (postnumber && postnumber.trim() !== '') {
$('#packstation-alert').slideDown(300);
} else {
$('#packstation-alert').slideUp(300);
}
}
// Bei Eingabe im Postnummer-Feld
$('#shipping_postnumber').on('input', function() {
togglePackstationAlert();
});
// Bei Seitenladen prüfen
togglePackstationAlert();
$.extend( $.validator.messages, {
required: "{{__('account.validator_required')}}",
maxlength: $.validator.format( "{{__('account.validator_maxlength')}}" ),
minlength: $.validator.format( "{{__('account.validator_minlength')}}" ),
rangelength: $.validator.format( "{{__('account.validator_rangelength')}}" ),
email: "{{__('account.validator_email')}}",
url: "{{__('account.validator_url')}}",
date: "{{__('account.validator_date')}}",
number: "{{__('account.validator_number')}}",
digits: "{{__('account.validator_digits')}}",
equalTo: "{{__('account.validator_equalTo')}}",
range: $.validator.format( "{{__('account.validator_range')}}" ),
max: $.validator.format( "{{__('account.validator_max')}}" ),
min: $.validator.format( "{{__('account.validator_min')}}" ),
creditcard: "{{__('account.validator_creditcard')}}"
});
// Set up validator
$('#lead-form-validation').validate({
rules: {
'billing_email-confirm': {
required: true,
equalTo: "#billing_email"
},
},
errorPlacement: function errorPlacement(error, element) {
$(element).parents('.form-group').append(
error.addClass('invalid-feedback small d-block')
)
},
highlight: function (element) {
if ($(element).hasClass('selectpicker')) {
$(element).parent().addClass('is-invalid');
}
$(element).addClass('is-invalid');
},
unhighlight: function (element) {
$(element).removeClass('is-invalid');
$(element).parents('.form-group').find('.is-invalid').removeClass('is-invalid');
},
messages : {
required: "{{__('This field is required.')}}",
country_id : {
required: "{{__('This field is required.')}}",
},
salutation : {
required: "{{__('please specify')}}",
},
first_name : {
required: "{{__('This field is required.')}}",
},
last_name : {
required: "{{__('This field is required.')}}",
},
zipcode : {
required: "{{__('This field is required.')}}",
},
address : {
required: "{{__('This field is required.')}}",
},
city : {
required: "{{__('This field is required.')}}",
},
equalTo : "{{__('Please enter the same value again.')}}",
'billing_email-confirm' : {
equalTo : "{{__('Please enter the same value again.')}}",
required: "{{__('This field is required.')}}",
},
billing_email: {
required : "{{__('This field is required.')}}",
email: "{{ __('Please enter a valid email address.') }}",
remote : "{{ __('This E-mail is already in use.') }}"
},
},
onkeyup: false
});
});
</script>