mein-sterntours/resources/views/booking/_detail_company.blade.php
Kevin Adametz 881fc84207 08 2024
2024-08-05 11:58:09 +02:00

86 lines
5.9 KiB
PHP
Executable file

<div class="card mb-2">
<h6 class="card-header bg-primary text-white py-2" data-toggle="collapse" data-target="#collapseBookingCompany" aria-expanded="false" aria-controls="collapseBookingCompany">
<strong style="line-height: 1.6em">Reiseveranstalter</strong>
</h6>
<div class="collapse" id="collapseBookingCompany">
<div class="card-body row">
<div class="table-responsive" id="booking_files_table">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>Veranstalter</th>
<th>Bezeichnung</th>
<th>Datum</th>
<th>Preis inkl. MwSt </th>
<th>Rabatt </th>
<th>Erzielte Provision </th>
<th>Lock</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
@if($booking->booking_service_items)
@foreach($booking->booking_service_items as $item)
<tr>
<th scope="row">
{{ 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>
{{ 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.'][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>
<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="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('requests')}}" 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>
<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>