@extends('layouts/layoutMaster') @php use Carbon\Carbon; $pageConfigs = [ 'myLayout' => 'blank', 'navbarType' => 'hidden', 'menuFixed' => false, 'contentLayout' => 'compact', ]; $locale = app()->getLocale(); $summary = $summary ?? ['accrued' => 0, 'paid' => 0, 'pending' => 0, 'currency' => 'EUR']; $entries = ($entries ?? collect())->map(function ($entry) use ($locale, $summary) { $createdAt = $entry->entry_date?->copy()->locale($locale) ?? $entry->created_at?->copy()->locale($locale); $billingPeriod = optional(optional($entry->source)->billingPeriod); $periodLabel = $billingPeriod ? $billingPeriod->periodLabel() : null; return [ 'id' => $entry->id, 'type' => $entry->entry_type, 'is_payment' => $entry->entry_type === 'tip_payment', 'amount' => (float) $entry->amount, 'amount_formatted' => number_format((float) $entry->amount, 2, ',', '.'), 'currency' => $entry->currency ?? $summary['currency'], 'description' => $entry->description ?: ($entry->entry_type === 'tip_payment' ? __('Propinas abonadas en nómina') : __('Propinas registradas')), 'date_label' => $createdAt ? $createdAt->isoFormat('D MMM YYYY · HH:mm') : '', 'period_label' => $periodLabel, ]; }); $periods = ($periods ?? collect())->map(function ($period) use ($summary) { return [ 'billing_period_id' => $period['billing_period_id'], 'label' => $period['label'], 'tips_total' => number_format((float) $period['tips_total'], 2, ',', '.'), 'paid' => number_format((float) $period['paid'], 2, ',', '.'), 'pending' => number_format((float) $period['pending'], 2, ',', '.'), 'currency' => $period['currency'] ?? $summary['currency'], ]; }); @endphp @section('title') {{ __('Propinas') }} @endsection @section('page-style') @endsection @section('content')
{{ __('Resumen de propinas') }}

{{ __('Control de propinas') }}

{{ __('Consulta las propinas registradas por Glovo, lo que ya se liquidó en tu nómina y lo que queda pendiente para el siguiente pago.') }}

{{ __('Pendiente de pagar') }}

{{ number_format($summary['pending'], 2, ',', '.') }} {{ $summary['currency'] }}

{{ __('Se abonará en la próxima liquidación.') }}

{{ __('Propinas registradas') }}

{{ number_format($summary['accrued'], 2, ',', '.') }} {{ $summary['currency'] }}

{{ __('Sumatoria total de propinas generadas en tus pedidos.') }}

{{ __('Pagado en nómina') }}

{{ number_format($summary['paid'], 2, ',', '.') }} {{ $summary['currency'] }}

{{ __('Propinas ya abonadas en tus nóminas anteriores.') }}

{{ __('Últimos movimientos') }}

@if ($entries->isEmpty())

{{ __('Todavía no registramos propinas para tu cuenta. Cuando se importen cierres las verás aquí.') }}

@else
@foreach ($entries as $entry)
{{ $entry['description'] }}
{{ $entry['is_payment'] ? '+' : '' }}{{ $entry['amount_formatted'] }} {{ $entry['currency'] }}
{{ $entry['is_payment'] ? __('Pagado') : __('Registrado') }}
@endforeach
@endif
@if ($periods->isNotEmpty())

{{ __('Propinas por cierre') }}

@foreach ($periods as $period)

{{ $period['label'] }}

{{ __('Registradas') }}: {{ $period['tips_total'] }} {{ $period['currency'] }} {{ __('Pagado en nómina') }}: {{ $period['paid'] }} {{ $period['currency'] }} {{ __('Pendiente') }}: {{ $period['pending'] }} {{ $period['currency'] }}
@endforeach
@endif
@include('rider.partials.nav', [ 'navActive' => 'tips', 'navItems' => ['home', 'wallet', 'tips', 'profile'], ])
@endsection