Booking edit v3

This commit is contained in:
Kevin Adametz 2021-06-18 15:00:12 +02:00
parent 6706d28f51
commit 6880c7e989
20 changed files with 691 additions and 97 deletions

View file

@ -10,61 +10,77 @@
<tr>
<th>Veranstalter</th>
<th>Bezeichnung</th>
<th>Abreisedatum</th>
<th>Reisepreis inkl. MwSt</th>
<th>Rabatt</th>
<th>Erzielte Provision</th>
<th>Datum</th>
<th>Preis inkl. MwSt </th>
<th>Rabatt </th>
<th>Erzielte Provision </th>
<th>Lock</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
@if($booking->booking_service_items)
@foreach($booking->booking_service_items as $item)
<tr>
<th scope="row">
{{$item->travel_company->name}}
<!--<a href="#" target="_blank" class="badge badge-md badge-primary">
</a>-->
{{ Form::select('booking_service_item['.$item->id.'][travel_company_id]', \App\Services\Model::getTravelCompanyArray(false) , $item->travel_company_id, array('class'=>'custom-select', 'id'=>'booking_service_item_'.$item->id.'_travel_company_id')) }}
</th>
<td>{{$item->name}}</td>
<td>{{\App\Services\Util::_format_date($item->travel_data, 'date')}}</td>
<td>{{$item->service_price}}</td>
<td>{{$item->commission}}</td>
<td>{{$item->service_price_refund}}</td>
<td>
{{ Form::text('booking_service_item['.$item->id.'][name]', $item->name, array('placeholder'=>__('Bezeichnung'), 'class'=>'form-control', 'id'=>'booking_service_item_'.$item->id.'_name')) }}
</td>
<td>
{{ Form::text('booking_service_item['.$item->id.'][travel_date]', _format_date($item->travel_date), array('placeholder'=>__('Datum'), 'class'=>'form-control datepicker-base', 'id'=>'booking_service_item_'.$item->id.'_travel_date')) }}
</td>
<td>
{{ Form::text('booking_service_item['.$item->id.'][service_price]', $item->service_price, array('placeholder'=>__('in Euro'), 'class'=>'form-control calculate_refund_service_price', 'data-bsi-id'=>$item->id, 'data-bsi-percentage'=>$item->travel_company->getPercentageRaw(), 'id'=>'booking_service_item_'.$item->id.'_service_price')) }}
</td>
<td>
{{ Form::text('booking_service_item['.$item->id.'][commission]', $item->commission, array('placeholder'=>__('in Euro'), 'class'=>'form-control', 'id'=>'booking_service_item_'.$item->id.'_commission')) }}
</td>
<td>
{{ Form::text('booking_service_item['.$item->id.'][service_price_refund]', $item->service_price_refund, array('placeholder'=>__('in Euro'), 'class'=>'form-control', 'id'=>'booking_service_item_'.$item->id.'_service_price_refund')) }}
</td>
<td>
<label class="custom-control custom-checkbox mt-2">
{!! Form::checkbox('booking_service_item['.$item->id.']', 1, $item->is_commission_locked, ['class'=>'custom-control-input', 'disabled']) !!}
<span class="custom-control-label"></span>
{!! Form::checkbox('booking_service_item['.$item->id.'][is_commission_locked]', 1, $item->is_commission_locked, ['class'=>'custom-control-input calculate_refund_service_price', 'data-bsi-id'=>$item->id, 'data-bsi-percentage'=>$item->travel_company->getPercentageRaw(), 'id'=>'booking_service_item_'.$item->id.'_locked']) !!}
<span class="custom-control-label">{{ $item->travel_company->percentage }}%</span>
</label>
</td>
<td>
<i class="fa fa-trash-alt"></i>
{{--<a class="btn text-danger" href="#" onclick="return confirm('{{__('Wirklich löschen?')}}');"><i class="fa fa-trash-alt"></i></a> --}}
<a class="btn btn-sm text-danger" href="{{ route('booking_delete', [$item->id, 'booking_service_item']) }}" onclick="return confirm('{{__('Wirklich löschen?')}}');"><i class="fa fa-trash-alt"></i></a>
</td>
</tr>
@endforeach
@endif
</tbody>
</table>
</div>
{{--
<div class="text-right d-block w-100">
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal"
data-target="#modals-load-content"
data-id="new-file"
data-model="bookingFile"
data-action="modal-upload-booking-file"
data-url=""
data-redirect="back"
data-booking_id="{{$booking->id}}"
data-route="#"><i class="ion ion-md-cloud-upload"></i>&nbsp;Datei hinzufügen</button>
</div>
--}}
<div class="col-12">
<hr>
<div class="text-left mt-3">
<button type="submit" name="action" value="update_booking_service_item" class="btn btn-sm btn-secondary">{{ __('save changes') }}</button>&nbsp;
<a href="{{route('bookings')}}" class="btn btn-sm btn-default">{{ __('zur Übersicht') }}</a>
<a href="{{route('booking_action', ['booking_service_item_add', $booking->id])}}" class="btn btn-sm btn-primary float-right ml-2"><i class="fa fa-plus-circle"></i> {{ __('Neue Leistung') }}</a>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function() {
$('input.calculate_refund_service_price').on('change', function(){
var _bsi_id = $(this).data('bsi-id');
var _percentage = $(this).data('bsi-percentage');
if($('#booking_service_item_'+_bsi_id+'_locked').is(':checked')){
var _service_price = _floatNumber($('#booking_service_item_'+_bsi_id+'_service_price').val());
var eur = 0;
if(_service_price > 0){
eur = _service_price / 100 * _percentage;
}
$('#booking_service_item_'+_bsi_id+'_service_price_refund').val(_formatNumber(eur));
}
});
});
</script>