230 lines
11 KiB
PHP
230 lines
11 KiB
PHP
@extends('layouts.layout-2')
|
||
|
||
@section('content')
|
||
|
||
<style>
|
||
.td-entry-table-margin {
|
||
padding-bottom: 6px;
|
||
border-bottom: 1px solid rgb(221, 221, 221);
|
||
margin-bottom: 6px;
|
||
}
|
||
</style>
|
||
|
||
<div class="card">
|
||
<h5 class="card-header">
|
||
Guthaben offen
|
||
<div class="float-right">
|
||
<button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#modals-load-content"
|
||
data-id="new"
|
||
data-action="add-user-credit"
|
||
data-back="{{url()->current()}}"
|
||
data-route="{{ route('modal_load') }}"><span class="far fa-plus-circle"></span> Guthaben hinzufügen
|
||
</button>
|
||
</div>
|
||
</h5>
|
||
|
||
@if(isset($add_credit_error) && $add_credit_error)
|
||
<div class="col-sm-12">
|
||
<div class="alert alert-danger p-2 mt-2">
|
||
<ul>
|
||
<li>{{ $add_credit_error }}</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
@endif
|
||
|
||
<div class="card-datatable table-responsive pt-0">
|
||
<table class="datatables-style table table-striped table-bordered">
|
||
<thead>
|
||
<tr>
|
||
<th>{{__('Account ID')}}</th>
|
||
<th>{{__('Vorname')}}</th>
|
||
<th>{{__('Nachname') }}</th>
|
||
<th>{{__('E-Mail') }}</th>
|
||
<th>{{__('Betrag') }}</th>
|
||
<th>{{__('Guthaben')}}</th>
|
||
<th>{{__('#')}}</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
@foreach ($user_credit_items as $user_credit_item)
|
||
<tr>
|
||
<td>{{ $user_credit_item['m_account'] }}</td>
|
||
<td>{{ $user_credit_item['first_name'] }}</td>
|
||
<td>{{ $user_credit_item['last_name'] }}</td>
|
||
<td>{{ $user_credit_item['email'] }}</td>
|
||
<td>{!! formatNumber($user_credit_item['sum']) !!} €</td>
|
||
<td>
|
||
@foreach ($user_credit_item['entries'] as $key => $credit)
|
||
<div class="td-entry-table-margin">
|
||
<i class="fa fa-plus-circle text-secondary"></i>
|
||
{!! formatNumber($credit->credit) !!} € |
|
||
{!! nl2br($credit->message) !!}
|
||
/ {{ $credit->created_at->format("d.m.Y") }}
|
||
@if($deleteTime = $credit->deleteTime())
|
||
/ <span class="no-line-break">
|
||
<a class="btn btn-danger btn-xs" href="{{ route('admin_payments_credit_delete', [$credit->id, 'user_credit_item']) }}" onclick="return confirm('Wirklich löschen?');">
|
||
<i class="ion ion-ios-trash"></i>
|
||
</a> noch {{ $deleteTime }} min.
|
||
</span>
|
||
@endif
|
||
</div>
|
||
@endforeach
|
||
</td>
|
||
<td>
|
||
<button type="button" class="btn btn-sm btn-secondary" data-toggle="modal" data-target="#modals-credit"
|
||
data-userid="{{ $user_credit_item['user_id'] }}"
|
||
data-email="{{ $user_credit_item['email'] }}"
|
||
data-back="{{url()->current()}}"
|
||
data-action="create_credit">
|
||
<span class="fa fa-dollar-sign"></span> <strong>Guthaben auszahlen</strong>
|
||
</button>
|
||
</td>
|
||
</tr>
|
||
@endforeach
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
<div class="card mt-3">
|
||
<h5 class="card-header">
|
||
Gutschriften / Auszahlungen
|
||
</h5>
|
||
<div class="card-body p-0">
|
||
{!! Form::open(['url' => route('admin_payments_invoice'), 'class' => 'form-horizontal', 'id'=>'form_filter_payment_invoices']) !!}
|
||
|
||
<div class="form-row align-items-center px-4 pb-2 pt-3">
|
||
<div class="col-12 col-sm-4 col-md-4 col-lg-4 mb-1">
|
||
<input class="form-control on_keyup_invoice" name="credit_filter_name" type="text" value="{{session('credit_filter_name')}}" placeholder="Name">
|
||
</div>
|
||
|
||
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
|
||
<select class="custom-select on_change_invoice" name="credit_filter_month">
|
||
@foreach($filter_months as $key=>$value)
|
||
<option value="{{$key}}" @if(session('credit_filter_month') == $key) selected @endif>{{$value}}</option>
|
||
@endforeach
|
||
</select>
|
||
</div>
|
||
<div class="col-6 col-sm-4 col-md-4 col-lg-4 mb-1">
|
||
<select class="custom-select on_change_invoice" name="credit_filter_year">
|
||
@foreach($filter_years as $key=>$value)
|
||
<option value="{{$value}}" @if(session('credit_filter_year') == $value) selected @endif>{{$value}}</option>
|
||
@endforeach
|
||
</select>
|
||
</div>
|
||
</div>
|
||
{!! Form::close() !!}
|
||
|
||
<div class="card-datatable table-responsive pt-0">
|
||
<table class="datatables-style table table-striped table-bordered" id="datatable-credit">
|
||
<thead>
|
||
<tr>
|
||
<th>ID</th>
|
||
<th>{{__('G.Nr.')}}</th>
|
||
<th>{{__('Gutschrift')}}</th>
|
||
<th>{{__('Vorname')}}</th>
|
||
<th>{{__('Nachname') }}</th>
|
||
<th>{{__('E-Mail') }}</th>
|
||
<th>{{__('Betrag') }}</th>
|
||
<th>{{__('Datum') }}</th>
|
||
<th>{{__('Zahlung')}}</th>
|
||
<th>{{__('aus Guthaben')}}</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="modal fade" id="modals-credit">
|
||
<div class="modal-dialog">
|
||
<form class="modal-content form-prevent-multiple-submits" action="{{ route('admin_payments_credit_create') }}" method="post">
|
||
@csrf
|
||
<input type="hidden" name="userid" value="">
|
||
<input type="hidden" name="action" value="create_credit">
|
||
<input type="hidden" name="back" value="{{url()->current()}}">
|
||
<div class="modal-header">
|
||
<h5 class="modal-title">{{__('Gutschrift')}}</h5>
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="form-group col-sm-12">
|
||
|
||
{{ Form::select('credit_option', ['create'=>'Gutschrift erstellen'], false, array('data-live-search'=>'false', 'class'=>'selectpicker')) }}
|
||
</div>
|
||
<div class="form-group col-sm-12">
|
||
<label class="form-label" for="credit_date">{{ __('Gutschriftsdatum') }}</label>
|
||
{!! Form::text('credit_date', \Carbon::now()->format("d.m.Y"), ['class'=>'form-control datepicker-base']) !!}
|
||
</div>
|
||
<div class="form-group col-sm-12">
|
||
<label class="form-label" for="credit_number">{{ __('Gutschriftsnummer') }}</label>
|
||
{!! Form::text('credit_number', App\Services\Credit::getCreditNumber(), ['class'=>'form-control', 'disabled']) !!}
|
||
<em> nächste Gutschriftsnummer <a href="{{ route('admin_settings') }}"><i class="fa fa-edit"></i></a></em>
|
||
</div>
|
||
<div class="form-group col-sm-12">
|
||
<label class="custom-control custom-checkbox">
|
||
{!! Form::checkbox('credit_send_mail', 1, true, ['class'=>'custom-control-input']) !!}
|
||
<span class="custom-control-label">Gutschrift an <span id="set_credit_send_mail">mail</span></span>
|
||
</label>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default" data-dismiss="modal">{{__('close')}}</button>
|
||
<button type="submit" class="btn btn-primary button-prevent-multiple-submits"><i class="spinner fa fa-spinner fa-spin"></i> {{ __('save')}}</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<script>
|
||
$( document ).ready(function() {
|
||
var oTable = $('#datatable-credit').DataTable({
|
||
"processing": true,
|
||
"serverSide": true,
|
||
ajax: {
|
||
url: '{!! route( 'admin_payments_credit_datatable') !!}',
|
||
data: function(d) {
|
||
d.filter_sales_year = $('select[name=filter_sales_year]').val();
|
||
}
|
||
},
|
||
"order": [[0, "desc" ]],
|
||
"columns": [
|
||
{ data: 'id', searchable: false },
|
||
{ data: 'full_number', name: 'full_number' },
|
||
{ data: 'view', name: 'view' },
|
||
{ data: 'user.account.first_name', name: 'user.account.first_name', orderable: false },
|
||
{ data: 'user.account.last_name', name: 'user.account.last_name', orderable: false },
|
||
{ data: 'user.email', name: 'user.email', orderable: false },
|
||
{ data: 'total', name: 'total' },
|
||
{ data: 'date', name: 'date' },
|
||
{ data: 'status', name: 'status', searchable: false },
|
||
{ data: 'credits', name: 'credits', orderable: false },
|
||
],
|
||
"bLengthChange": false,
|
||
"iDisplayLength": 100,
|
||
"language": {
|
||
"url": "/js/German.json"
|
||
}
|
||
});
|
||
$('#filter_sales_year').on('change', function(){
|
||
oTable.draw();
|
||
});
|
||
|
||
$( document ).ready(function() {
|
||
$('#modals-credit').on('show.bs.modal', function (event) {
|
||
var button = $(event.relatedTarget);
|
||
if(event.relatedTarget){
|
||
$(this).find(".modal-content input[name='userid']").val(button.data('userid'));
|
||
$(this).find(".modal-body #set_credit_send_mail").html(button.data('email'));
|
||
}
|
||
|
||
});
|
||
});
|
||
});
|
||
</script>
|
||
|
||
@endsection
|