Store Customer, Store Booking details

This commit is contained in:
Kevin Adametz 2021-05-19 18:04:31 +02:00
parent b362b93bca
commit 6706d28f51
33 changed files with 1048 additions and 257 deletions

View file

@ -0,0 +1,171 @@
<div class="card mb-2 border-primary">
<h6 class="card-header bg-primary text-white py-2" data-toggle="collapse" data-target="#collapseCustomerBooking" aria-expanded="false" aria-controls="collapseCustomerBooking">
<strong style="line-height: 1.6em">Anfragen
<span class="badge badge-secondary">{{ $customer->leads->count()}} </span> |
</strong>
<strong style="line-height: 1.6em">Buchung
<span class="badge badge-secondary">{{ $customer->bookings->count()}} </span> |
</strong>
<strong style="line-height: 1.6em">Gutscheine
<span class="badge badge-secondary">{{ $customer->coupons->count()}} </span>
</strong>
</h6>
<div class="collapse" id="collapseCustomerBooking">
<div class="card-body">
<div class="row">
<div class="col-sm-12">
<table class="table table-striped table-sm">
<thead>
<tr>
<th style="max-width: 60px;">AnfrageID</th>
<th>{{__('Sachbearbeiter')}}</th>
<th>{{__('Status')}}</th>
<th>{{__('Anfrage-Datum')}}</th>
</tr>
</thead>
<tbody>
@if($customer->leads)
@foreach ($customer->leads as $lead)
<tr>
<td>
<a href="{{ route('lead_detail', [$lead->id]) }}" class="btn icon-btn btn-sm btn-primary">
<span class="fa fa-edit"></span>
</a>
{{ $lead->id }}
</td>
<td>
@if($lead->sf_guard_user_id && $lead->sf_guard_user)
{{ $lead->sf_guard_user->first_name }} {{ $lead->sf_guard_user->last_name }}
@endif
</td>
<td>
{!! $lead->getStatusBadge() !!}
</td>
<td>
{{ _format_date($lead->request_date) }}
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
<hr class="mt-3 mb-3">
<table class="table table-striped table-sm">
<thead>
<tr>
<th style="max-width: 60px;">BuchnungsID</th>
<th>{{__('Reiseland')}}</th>
<th>{{__('Programm')}}</th>
<th>{{__('Anreise')}}</th>
<th>{{__('Abreise')}}</th>
<th>{{__('Sachbearbeiter')}}</th>
<th>{{__('Status')}}</th>
<th>{{__('Datum')}}</th>
</tr>
</thead>
<tbody>
@if($customer->bookings)
@foreach ($customer->bookings as $booking)
<tr>
<td>
<a href="{{ route('booking_detail', [$booking->id]) }}" class="btn icon-btn btn-sm btn-primary">
<span class="fa fa-edit"></span>
</a>
{{ $booking->id }}
</td>
<td>
@if($booking->travel_country_id && $booking->travel_country)
{{ $booking->travel_country->name }}
@endif
</td>
<td>
@if($booking->travelagenda_id && $booking->travel_agenda)
{{ $booking->travel_agenda->name }}
@endif
</td>
<td>{{ _format_date($booking->start_date) }}</td>
<td>{{ _format_date($booking->end_date) }}</td>
<td>
@if($booking->sf_guard_user_id && $booking->sf_guard_user)
{{ $booking->sf_guard_user->first_name }} {{ $booking->sf_guard_user->last_name }}
@endif
</td>
<td>
@if($booking->lead)
{!! $booking->lead->getStatusBadge($booking) !!}
@endif
</td>
<td>
{{ _format_date($booking->booking_date) }}
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
<hr class="mt-3 mb-3">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>{{__('Gutschein')}}</th>
<th>{{__('Wert')}}</th>
<th>{{__('Ausstellungsdatum')}}</th>
<th>{{__('Gültig bis')}}</th>
<th>{{__('Eingelöst')}}</th>
<th>{{__('#')}}</th>
</tr>
</thead>
<tbody>
@if($customer->coupons)
@foreach ($customer->coupons as $coupon)
<tr>
<td>
<a href="{{ route('customer_file_show', ['coupon', $coupon->id]) }}" target="_blank" class="badge badge-md badge-warning">
<i class="fa fa-file-pdf mr-1"></i> Gutschein {{$coupon->number}}
</a>
</td>
<td>
{{ \App\Services\Util::_number_format($coupon->value)}} &euro;
</td>
<td>
{{\App\Services\Util::_format_date($coupon->issue_date, 'date')}}
</td>
<td>
{{\App\Services\Util::_format_date($coupon->valid_date, 'date')}}
</td>
<td>
@if($coupon->is_redeemed)
<i class="fa fa-check-circle text-success"></i> {{\App\Services\Util::_format_date($coupon->redeem_date, 'date')}}
@else
<i class="fa fa-times-circle text-danger"></i>
@endif
</td>
<td>
<a href="{{ route('customer_file_show', ['coupon', $coupon->id, true]) }}" class="btn btn-xs btn-default"
title="Download" data-placement="left" rel="tooltip">
<i class="fa fa-download"></i>
</a>
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,77 @@
<div class="card mb-2 border-primary">
<h6 class="card-header bg-primary text-white py-2" data-toggle="collapse" data-target="#collapseCustomerDetail" aria-expanded="false" aria-controls="collapseCustomerDetail">
<strong style="line-height: 1.6em">Kunde</strong>
</h6>
<div class="collapse" id="collapseCustomerDetail">
<div class="card-body">
@if($customer->count())
<div class="form-row">
<div class="form-group col-sm-6">
<label class="form-label" for="customer_id">{{ __('Kunden ID') }}</label>
{{ Form::text('customer_id', $customer->id, array('placeholder'=>__('Kunden ID'), 'class'=>'form-control', 'id'=>'customer_id', 'readonly')) }}
</div>
</div>
<div class="form-row">
<div class="form-group col-sm-3">
<label for="salutation_id" class="form-label">{{ __('Anrede') }}*</label>
{{ Form::select('salutation_id', \App\Models\Customer::$salutationType , $customer->salutation_id, array('class'=>'custom-select', 'required'=>true)) }}
</div>
<div class="form-group col-sm-4">
<label class="form-label" for="firstname">{{ __('Vorname') }}*</label>
{{ Form::text('firstname', $customer->firstname, array('placeholder'=>__('Vorname'), 'class'=>'form-control', 'id'=>'firstname', 'required'=>true)) }}
</div>
<div class="form-group col-sm-5">
<label class="form-label" for="name">{{ __('Nachname') }}*</label>
{{ Form::text('name', $customer->name, array('placeholder'=>__('Nachname'), 'class'=>'form-control', 'id'=>'name', 'required'=>true)) }}
</div>
<div class="form-group col-sm-12">
<label class="form-label" for="street">{{ __('Straße') }}</label>
{{ Form::text('street', $customer->street, array('placeholder'=>__('Straße'), 'class'=>'form-control', 'id'=>'street')) }}
</div>
<div class="form-group col-sm-3">
<label class="form-label" for="zip">{{ __('PLZ') }}</label>
{{ Form::text('zip', $customer->zip, array('placeholder'=>__('PLZ'), 'class'=>'form-control', 'id'=>'zip')) }}
</div>
<div class="form-group col-sm-4">
<label class="form-label" for="city">{{ __('Stadt') }}</label>
{{ Form::text('city', $customer->city, array('placeholder'=>__('Stadt'), 'class'=>'form-control', 'id'=>'city')) }}
</div>
<div class="form-group col-sm-5">
<label class="form-label" for="country_id">{{ __('Land') }}*</label>
{{ Form::select('country_id', \App\Models\Customer::getCustomerCountriesArray() , $customer->country_id, array('class'=>'custom-select', 'required'=>true)) }}
</div>
<div class="form-group col-sm-6">
<label class="form-label" for="phone">{{ __('Telefon') }}</label>
{{ Form::text('phone', $customer->phone, array('placeholder'=>__('Telefon'), 'class'=>'form-control', 'id'=>'phone')) }}
</div>
<div class="form-group col-sm-6">
<label class="form-label" for="phonemobile">{{ __('Telefon Mobil') }}</label>
{{ Form::text('phonemobile', $customer->phonemobile, array('placeholder'=>__('Telefon Mobil'), 'class'=>'form-control', 'id'=>'phonemobile')) }}
</div>
<div class="form-group col-sm-12">
<label class="form-label" for="email">{{ __('E-Mail') }}*</label>
{{ Form::text('email', $customer->email, array('placeholder'=>__('E-Mail'), 'class'=>'form-control', 'id'=>'email', 'required'=>true)) }}
</div>
<div class="col-sm-12">
<div class="text-left mt-2">
<button type="submit" name="action" value="saveCustomer" class="btn btn-sm btn-secondary">Änderungen speichern</button>&nbsp;
<a href="{{route('customers')}}" class="btn btn-sm btn-default">{{ __('zur Übersicht') }}</a>
</div>
</div>
</div>
@endif
</div>
</div>
</div>

View file

@ -4,12 +4,6 @@
<style>
body {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.btn-xs {
line-height: 1.3em;
@ -32,40 +26,104 @@
.input-group-text {
padding: 0.438rem 0.475rem;
}
</style>
<div class="float-right mt-3">
<a href="{{route('customers')}}" class="btn btn-sm btn-default">{{ __('zur Übersicht') }}</a>
<a href="{{ make_old_url('/index.php/customer/'.$customer->id.'/edit') }}" class="btn btn-sm btn-default float-right">{{ __('zurück ins CRM v2') }}</a>
</div>
<h4 class="font-weight-bold py-3 mb-1">
Kunden verwalten
</h4>
{!! Form::open(['url' => route('customer_detail', [$id]), 'class' => 'form-horizontal', 'id'=>'lead-form-validation']) !!}
<ul class="nav nav-sm nav-tabs nav-justified tabs-alt mb-3" id="top-nav-quick-jump">
<li class="nav-item">
<a class="nav-link" href="javascript:void(0)" data-collapse="#collapseCustomerDetail">
Kunde
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="javascript:void(0)" data-collapse="#collapseCustomerBooking">
Anfrage / Buchung
</a>
</li>
</ul>
{!! Form::open(['url' => route('customer_detail', [$id]), 'class' => 'form-horizontal', 'id'=>'customer-form-validation']) !!}
<input type="hidden" name="id" id="id" value="{{$id}}">
<!-- Kunde -->
@include('customer._detail_customer')
<!-- draft -->
<div class="card mb-2">
<div class="card-body row">
<div class="form-group col-sm-6">
<label class="form-label" for="customer_id">{{ __('Nr.') }}*</label>
{{ Form::text('id', $customer->id, array('placeholder'=>__('Nr.'), 'class'=>'form-control', 'id'=>'customer_id', 'readonly')) }}
</div>
</div>
</div>
<div class="text-left mt-3">
<button type="submit" name="action" value="saveAll" class="btn btn-submit">{{ __('save changes') }}</button>&nbsp;
<a href="{{route('customers')}}" class="btn btn-default">{{ __('zur Übersicht') }}</a>
<a href="{{ make_old_url('/index.php/customer/'.$customer->id.'/edit') }}" class="btn btn-default float-right">{{ __('zurück ins CRM v2') }}</a>
@if($id !== "new" && $customer)
@include('customer._detail_booking')
@endif
<div class="float-right mt-3">
<a href="{{route('customers')}}" class="btn btn-sm btn-default">{{ __('zur Übersicht') }}</a>
<a href="{{ make_old_url('/index.php/customer/'.$customer->id.'/edit') }}" class="btn btn-sm btn-default float-right">{{ __('zurück ins CRM v2') }}</a>
</div>
{!! Form::close() !!}
<script>
$(document).ready(function() {
var collapseHashValue = null;
$('[rel="tooltip"]').tooltip({trigger: "hover"});
$('#top-nav-quick-jump .nav-link').on('click', function (e) {
e.preventDefault();
$('#top-nav-quick-jump .nav-link').removeClass('active');
$(this).addClass('active');
var collapse_id = $(this).data('collapse');
//console.log(collapse_id);
$(collapse_id).collapse('show');
// animate
$('html, body').animate({
scrollTop: $(collapse_id).parent('.card').offset().top
}, 300, function(){
// when done, add hash to url
// (default click behaviour)
window.location.hash = collapse_id;
});
});
$(".collapse").on('shown.bs.collapse', function (){
if(collapseHashValue){
$('a[data-collapse="#'+collapseHashValue+'"]').click();
collapseHashValue = null;
}
CookiesAddJSONValue('customer_collapse', $(this).attr('id'));
window.location.hash = "#"+$(this).attr('id');
});
$(".collapse").on('hidden.bs.collapse', function (){
CookiesRemoveJSONValue('customer_collapse', $(this).attr('id'));
});
function init_site(){
if(window.location.hash){
value = $(window.location.hash).attr('id');
if(value){
collapseHashValue = value;
CookiesAddJSONValue('customer_collapse', value);
}
}
var customer_collapses = Cookies.get('customer_collapse');
if (customer_collapses != null)
{
customer_collapses = JSON.parse(customer_collapses);
for (var customer_collapse in customer_collapses){
$("#"+customer_collapses[customer_collapse]).collapse("show");
}
}
}
init_site();
});
</script>