@extends('layouts.layout-2')

@section('content')
    <h4 class="font-weight-bold py-2 mb-2">
        {{ __('navigation.my_account') }} / {{ __('navigation.revenue') }}
    </h4>

    <div class="row">
        <div class="col-sm-6 mb-0 mt-2 mb-2">
            {!! Form::open(['url' => route('user_payment_revenue'), 'class' => 'form-horizontal', 'id'=>'form_filter_year']) !!}
            <label class="form-label" for="filter_year">Filter Jahr</label>
            <select class="custom-select" name="filter_year" id="filter_year">
                @foreach($years as $year)
                    <option value="{{$year}}" @if($active_year == $year) selected @endif>{{$year}}</option>
                @endforeach
            </select>
            {!! Form::close() !!}
        </div>
    </div>
    

    @foreach ($months as $month)

        @php($date = $active_year."-".$month."-01") 
            <div class="card mb-4">
            <h6 class="card-header py-1 px-3">
                <div class="card-header-title"> {{ App\Services\HTMLHelper::getMonth($month) }} {{ $active_year }}</div>
            </h6>
            <div class="card-body">
                <table class="table table-striped table-bordered">
                    <tr>
                        <td class="text-left font-weight-semibold">{{__('Umsatz gesamt')}}:</td>
                        <td class="text-right font-weight-bold">
                            {!! \App\Services\UserMarign::getMontlyPrice($user, $date, true) !!} &euro;*
                        </td>
                    </tr>
                    <tr>
                        <td class="text-left font-weight-semibold">{{__('Umsatz Staffelrabatt')}}:</td>
                        <td class="text-right font-weight-bold">
                            {!! \App\Services\UserMarign::getMontlyAmount($user, $date, true) !!} &euro;*
                        </td>
                    </tr>
                    {{-- <tr>
                        <td class="text-left font-weight-semibold">{{__('Umsatz Zahlung offen')}}:</td>
                        <td class="text-right font-weight-bold">
                            {!! \App\Services\UserMarign::getMontlyPriceOpen($user, $date, true) !!} &euro;*
                        </td>
                    </tr>
                    --}}
                </table>
                {{-- 
                <h6>{{__('Provision')}}</h6>
                <table class="table table-striped table-bordered">
                    <tr>
                        <td class="text-left font-weight-semibold">{{__('Vertriebspartner Provision')}} pending:</td>
                        <td class="text-right font-weight-bold">
                            {!! \App\Services\UserMarign::getMontlyPartnerCommissionPending($user, $date, true) !!} &euro;*
                        </td>
                    </tr>
                    <tr>
                        <td class="text-left font-weight-semibold">{{__('Vertriebspartner Provision')}} bestätigt:</td>
                        <td class="text-right font-weight-bold">
                            {!! \App\Services\UserMarign::getMontlyPartnerCommissionOpen($user, $date, true) !!} &euro;*
                        </td>
                    </tr>
                </table>
                --}}
            </div>
        </div>

  
        
    @endforeach

    <script>
        $( document ).ready(function() {

            $('#filter_year').on('change', function(){
                $('#form_filter_year').submit();
            });
        });
    </script>
@endsection
