Kundenhoheit

This commit is contained in:
Kevin Adametz 2020-05-06 15:43:53 +02:00
parent d8b5206031
commit dc63fa9fb2
52 changed files with 2436 additions and 557 deletions

View file

@ -0,0 +1,326 @@
<div class="card">
<!-- Info -->
<div class="card-body pb-1">
<div class="row">
<div class="col-md-4 mb-3">
<div class="text-muted small">Datum</div>
{{$shopping_user->created_at->format("d.m.Y H:i")}}
</div>
<div class="col-md-4 mb-3">
<div class="text-muted small">Kundennummer</div>
{{$shopping_user->number}}
</div>
<div class="col-md-4 mb-3">
<div class="text-muted small">ist Berater</div>
@if($shopping_user->auth_user)
<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>
<a class="btn btn-xs btn-outline-primary" href="{{route('admin_lead_edit', [$shopping_user->auth_user->id])}}"><i class="ion ion-ios-contacts"></i></a>
{{$shopping_user->auth_user->getFullName()}} <span class="text-muted">#{{$shopping_user->auth_user->number}}</span>
@else
<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>
@endif
</div>
</div>
</div>
<hr class="m-0">
<!-- / Info -->
@if($isAdmin)
<!-- Member -->
<div class="card-body pb-1">
<div class="row">
<div class="col-md-8 mb-3">
@if(isset($change_member_error) && $change_member_error)
<div class="row">
<div class="col-sm-12">
<div class="alert alert-danger p-2">
<ul>
<li>{{ $change_member_error }}</li>
</ul>
</div>
</div>
</div>
@endif
<div class="text-muted small">Zugewiesener Berater</div>
@if($shopping_user->is_like)
<button type="button" class="btn btn-xs btn-outline-info" data-toggle="modal" data-target="#modals-load-content"
data-id="{{$shopping_user->id}}"
data-action="shopping-user-is-like-member"
data-back="{{route('admin_customer_edit', [$shopping_user->id])}}"
data-modal="modal-xl"
data-route="{{route('modal_load')}}"><span class="fa fa-edit"></span> Berater zuordnen</button>
@else
@if($shopping_user->member)
<a class="btn btn-xs btn-outline-primary" href="{{route('admin_lead_edit', [$shopping_user->member->id])}}"><i class="ion ion-ios-contacts"></i></a>
{{$shopping_user->member->getFullName()}} <span class="text-muted">#{{$shopping_user->member->number}}</span>
@endif
<button type="button" class="btn btn-xs btn-outline-secondary" data-toggle="modal" data-target="#modals-load-content"
data-id="{{ $shopping_user->id }}"
data-action="shopping-user-change-member"
data-view="customer"
data-route="{{ route('modal_load') }}"><span class="fa fa-edit"></span></button>
@endif
</div>
<div class="col-md-4 mb-3">
<div class="text-muted small">Über Shop</div>
@if($shopping_user->shopping_order)
@if($shopping_user->shopping_order->user_shop->user->isActive() && $shopping_user->shopping_order->user_shop->user->isActiveShop())
<a href="{{$shopping_user->shopping_order->user_shop->getSubdomain(false)}}" class="badge badge-success" target="_blank">{{$shopping_user->shopping_order->user_shop->getSubdomain(false)}}</a>
@else
<span class="badge badge-danger" target="_blank">{{$shopping_user->shopping_order->user_shop->getSubdomain(false)}}</span>
@endif
@endif
</div>
</div>
</div>
<hr class="m-0">
<!-- / Member -->
@endif
<!-- Billing -->
<div class="card-body">
<h6 class="small font-weight-semibold">
Rechnungsadresse
</h6>
<div class="row">
@if($shopping_user->billing_company)
<div class="col-md-12 mb-3">
<div class="text-muted small">Firma</div>
{{ $shopping_user->billing_company }}
</div>
@endif
<div class="col-md-3 mb-3">
<div class="text-muted small">Anrede</div>
{{ \App\Services\HTMLHelper::getSalutationLang($shopping_user->billing_salutation) }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Vorname</div>
{{ $shopping_user->billing_firstname }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Nachname</div>
{{ $shopping_user->billing_lastname }}
</div>
</div>
<div class="row">
<div class="col-md-3 mb-3">
<div class="text-muted small">Straße</div>
{{ $shopping_user->billing_address }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Zusatz</div>
{{ $shopping_user->billing_address_2 }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">PLZ</div>
{{ $shopping_user->billing_zipcode }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Stadt</div>
{{ $shopping_user->billing_city }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">E-Mail</div>
{{ $shopping_user->billing_email }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Telefon</div>
{{ $shopping_user->billing_phone }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Land</div>
{{ $shopping_user->billing_country->getLocated() }}
</div>
</div>
</div>
<hr class="m-0">
<!-- / Billing -->
<!-- Shipping -->
<div class="card-body">
<h6 class="small font-weight-semibold">
Lieferadresse
</h6>
@if($shopping_user->same_as_billing)
{{__('email.checkout_mail_same_address')}}
@else
<div class="row">
@if($shopping_user->shipping_company)
<div class="col-md-12 mb-3">
<div class="text-muted small">Firma</div>
{{ $shopping_user->shipping_company }}
</div>
@endif
<div class="col-md-3 mb-3">
<div class="text-muted small">Anrede</div>
{{ \App\Services\HTMLHelper::getSalutationLang($shopping_user->shipping_salutation) }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Vorname</div>
{{ $shopping_user->shipping_firstname }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Nachname</div>
{{ $shopping_user->shipping_lastname }}
</div>
</div>
<div class="row">
<div class="col-md-3 mb-3">
<div class="text-muted small">Straße</div>
{{ $shopping_user->shipping_address }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Zusatz</div>
{{ $shopping_user->shipping_address_2 }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">PLZ</div>
{{ $shopping_user->shipping_zipcode }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Stadt</div>
{{ $shopping_user->shipping_city }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">E-Mail</div>
{{ $shopping_user->shipping_email }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Telefon</div>
{{ $shopping_user->shipping_phone }}
</div>
<div class="col-md-3 mb-3">
<div class="text-muted small">Land</div>
{{ $shopping_user->shipping_country->getLocated() }}
</div>
</div>
@endif
</div>
<hr class="m-0">
<!-- / Shipping -->
<!-- Order -->
<div class="card-body">
<h6 class="small font-weight-semibold">
Bestellung
</h6>
<div class="table-responsive">
<table class="table table-bordered m-0" style="min-width:550px;">
<tbody>
<tr>
<th>Produkt</th>
<th>Anzahl</th>
<th>Preis</th>
</tr>
@if($shopping_user->shopping_order)
@foreach($shopping_user->shopping_order->shopping_order_items as $shopping_order_item)
<tr>
<td class="px-3 py-2">
<div class="media align-items-center">
@if($shopping_order_item->product->images)
@if($image = $shopping_order_item->product->images->first())
<img src="{{ route('product_image', [$image->slug]) }}" class="d-block ui-w-80 mr-4" alt>
@endif
@endif
<div class="media-body">
<a href="{{route('admin_product_edit', [$shopping_order_item->product->id])}}" class="d-block">{{ $shopping_order_item->product->name }}
<span class="text-muted">#{{ $shopping_order_item->product->number }}</span></a>
<small>
<span class="text-muted">Inhalt: </span> {{ $shopping_order_item->product->contents }}<br>
<span class="text-muted">Gewicht: </span> {{ $shopping_order_item->product->weight }} g<br>
<span class="text-muted">Points: </span> {{ $shopping_order_item->product->points }}
</small>
</div>
</div>
</td>
<!-- Set column width -->
<td class="align-middle px-3 py-2" style="width: 66px;">
{{ $shopping_order_item->qty }}
</td>
<!-- Set column width -->
<td class="text-right font-weight-semibold align-middle px-3 py-2" style="width: 100px;">
{{ $shopping_order_item->getFormattedPrice() }} &euro;
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
</div>
<hr class="m-0">
<!-- / Payment -->
<div class="card-body">
<h6 class="small font-weight-semibold">
Zahlung
</h6>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="min-width: 60px">#</th>
<th>Zahlungsart</th>
@if($isAdmin)<th>Referenznummer</th>@endif
<th>Gesamt</th>
<th>Status</th>
<th>Datum</th>
</tr>
</thead>
<tbody>
@php($count=0)
@if($shopping_user->shopping_order)
@foreach($shopping_user->shopping_order->shopping_payments as $shopping_payment)
<tr>
<th scope="row">{{++$count}}</th>
<td>{{$shopping_payment->getPaymentType()}}</td>
@if($isAdmin)<td>{{$shopping_payment->reference}}</td>@endif
<td>{{$shopping_payment->getPaymentAmount()}}</td>
<td>{!! \App\Services\Payment::getShoppingPaymentBadge($shopping_payment) !!}</td>
<td>{{$shopping_payment->created_at->format("d.m.Y H:i")}}</td>
</tr>
@if($isAdmin && $shopping_payment->payment_transactions)
@php($ccount=0)
<tr>
<th scope="row" class="m-0">{{$count}}.{{++$ccount}}</th>
<td colspan="5" class="m-0 p-0">
<table class="table table-info table-borderless mb-0 small">
<thead>
<tr>
<th style="min-width: 80px">Request</th>
<th style="min-width: 80px">Status</th>
<th style="min-width: 200px">TX-Action</th>
<th style="min-width: 120px">Datum</th>
</tr>
</thead>
<tbody>
@foreach($shopping_payment->payment_transactions as $payment_transaction)
<tr>
<td>{{$payment_transaction->request}}</td>
<td>{{$payment_transaction->status}}</td>
<td>{{$payment_transaction->txaction}} {{$payment_transaction->errormessage}}</td>
<td>{{$payment_transaction->created_at->format("d.m.Y H:i")}}</td>
</tr>
@endforeach
</tbody>
</table>
</td>
</tr>
@endif
@endforeach
@endif
</tbody>
</table>
</div>
</div>
</div>

View file

@ -0,0 +1,12 @@
@extends('layouts.layout-2')
@section('content')
<h4 class="font-weight-bold py-2 mb-2">
<a href="{{route('admin_customers')}}" class="btn btn-sm btn-default float-right">zurück</a>
{{ __('Kunden Details') }} <span class="text-muted">#{{$shopping_user->id}}</span>
</h4>
@include('admin.customer._detail')
<a href="{{route('admin_customers')}}" class="btn btn-sm btn-default mt-2 float-right">zurück</a>
@endsection

View file

@ -0,0 +1,120 @@
@extends('layouts.layout-2')
@section('content')
<h4 class="font-weight-bold py-2 mb-2">
{{ __('Kunden') }}
</h4>
<div class="card">
<div class="card-header">
<div class="form-row align-items-center">
{{-- <div class="col-sm-5 mb-2">
<label class="form-label" for="filter_user_shop_id">Filter Kunden/Berater</label>
<select class="custom-select" name="filter_customer_member" id="filter_customer_member">
<option value="">Filter aus</option>
<option value="customers" @if(get_user_attr('filter_customer_member') === 'customers') selected @endif>Kunden</option>
<option value="members" @if(get_user_attr('filter_customer_member') === 'members') selected @endif>Berater</option>
</select>
</div>--}}
<div class="col-sm-10 mb-2">
<label class="form-label" for="filter_user_shop_id">Filter zugewiesener Berater</label>
<select class="custom-select" name="filter_member_id" id="filter_member_id">
<option value="">Filter aus</option>
@foreach($filter_members as $member)
<option value="{{$member->id}}" @if(get_user_attr('filter_member_id') == $member->id) selected @endif>{{$member->first_name}} {{$member->last_name}} |{{$member->email}}</option>
@endforeach
</select>
</div>
<div class="col-2 col-sm-2 mb-2 mt-4">
<a href="{{ route('admin_customers') }}?reset=filter" data-toggle="tooltip" data-placement="top" title="Reset Filter" class="btn icon-btn btn-sm btn-outline-dark float-right">
<span class="fa fa-sync"></span>
</a>
</div>
</div>
</div>
<div class="card-datatable table-responsive">
<div class="ml-4">
<!--<a href="{{ route('admin_lead_edit', ['new']) }}" class="btn btn-sm btn-primary">{{__('Neuen Berater erstellen')}}</a> -->
</div>
<table class="datatables-customers table table-striped table-bordered" id="datatables-customers">
<thead>
<tr>
<th>#</th>
<th>{{__('Nummer')}}</th>
<th>{{__('E-Mail')}}</th>
<th>{{__('ist Berater')}}</th>
<th>{{__('Anrede')}}</th>
<th>{{__('Firma')}}</th>
<th>{{__('Vorname')}}</th>
<th>{{__('Nachname')}}</th>
<th>{{__('PLZ')}}</th>
<th>{{__('Stadt')}}</th>
<th>{{__('Land')}}</th>
<th>{{__('Käufe')}}</th>
<th>{{__('zugewiesener Berater')}}</th>
<th>{{__('Datum')}}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div class="mt-4 ml-4">
<!-- <a href="{{ route('admin_lead_edit', ['new']) }}" class="btn btn-sm btn-primary">{{__('Neuen Berater erstellen')}}</a> -->
</div>
</div>
</div>
<script>
$( document ).ready(function() {
var oTable = $('#datatables-customers').DataTable({
"processing": true,
"serverSide": true,
ajax: {
url: '{!! route( 'admin_customer_datatable') !!}',
data: function(d) {
d.filter_member_id = $('select[name=filter_member_id]').val();
d.filter_customer_member = $('select[name=filter_customer_member]').val();
}
},
"order": [[0, "desc" ]],
"columns": [
{ data: 'id', searchable: false},
{ data: 'number', name: 'number'},
{ data: 'billing_email', name: 'billing_email' },
{ data: 'isMember', name: 'isMember' },
{ data: 'billing_salutation', name: 'billing_salutation' },
{ data: 'billing_company', name: 'billing_company' },
{ data: 'billing_firstname', name: 'billing_firstname' },
{ data: 'billing_lastname', name: 'billing_lastname' },
{ data: 'billing_zipcode', name: 'billing_zipcode' },
{ data: 'billing_city', name: 'billing_city' },
{ data: 'billing_country_id', name: 'billing_country_id' },
{ data: 'orders', name: 'orders' },
{ data: 'member_id', name: 'member_id', searchable: false, orderable: false },
{ data: 'created_at', name: 'created_at' },
],
"bLengthChange": false,
"iDisplayLength": 50,
"language": {
"url": "/js/German.json"
}
});
$('#filter_member_id').on('change', function(){
oTable.draw();
});
$('#filter_customer_member').on('change', function(){
oTable.draw();
});
});
</script>
@endsection