@extends('layouts/layoutMaster')
@php
use Carbon\Carbon;
$pageConfigs = [
'myLayout' => 'blank',
'navbarType' => 'hidden',
'menuFixed' => false,
'contentLayout' => 'compact',
];
$locale = app()->getLocale();
$rawBalance = (float) ($wallet['balance'] ?? 0);
$balanceFormatted = number_format($rawBalance, 2, ',', '.');
$currency = $wallet['currency'] ?? 'EUR';
$transactions = collect($wallet['transactions'] ?? [])->map(function ($transaction) use ($locale) {
$createdAt = $transaction->created_at?->copy()->locale($locale);
$description = $transaction->description ?: ($transaction->type === 'credit' ? 'Ingreso a monedero' : 'Cargo en monedero');
return [
'id' => $transaction->id,
'type' => $transaction->type,
'type_label' => $transaction->type === 'credit' ? 'Ingreso' : 'Cargo',
'amount' => (float) $transaction->amount,
'amount_formatted' => number_format((float) $transaction->amount, 2, ',', '.'),
'description' => $description,
'balance_before' => (float) $transaction->balance_before,
'balance_after' => (float) $transaction->balance_after,
'balance_after_formatted' => number_format((float) $transaction->balance_after, 2, ',', '.'),
'created_at' => $transaction->created_at?->toIsoString(),
'date_label' => $createdAt ? $createdAt->isoFormat('D MMM YYYY · HH:mm') : '',
'relative_label' => $createdAt ? $createdAt->diffForHumans(null, null, 2) : '',
];
});
$lastTransaction = $transactions->first();
$lastMovementText = $lastTransaction
? (($lastTransaction['type'] === 'credit' ? '+' : '-') . $lastTransaction['amount_formatted'] . ' ' . $currency . ' · ' . $lastTransaction['description'])
: 'Tu monedero registrará aquí tus ingresos y cargos.';
$lastMovementHint = $lastTransaction
? ($lastTransaction['relative_label'] ? 'Último movimiento ' . $lastTransaction['relative_label'] : 'Último movimiento')
: 'Sin movimientos recientes';
$lastMovementClass = $lastTransaction
? ($lastTransaction['type'] === 'credit' ? 'positive' : 'negative')
: 'neutral';
$initialTransactions = $transactions->values();
@endphp
@section('title')
Monedero
@endsection
@section('page-style')
@endsection
@section('content')
Saldo actual en moneda base ({{ $currency }}).
Los movimientos se registran de forma automática cuando se liquidan horas, bonos o ajustes.
isNotEmpty()) hidden @endif>
Aún no registramos movimientos en tu monedero. En cuanto recibas un ajuste o pago aparecerá aquí.
isEmpty()) hidden @endif>
@foreach($initialTransactions as $transaction)
@php
$modifier = $transaction['type'] === 'credit' ? 'credit' : 'debit';
$sign = $transaction['type'] === 'credit' ? '+' : '-';
@endphp
-
{{ $transaction['description'] }}
{{ $transaction['date_label'] }}
{{ $sign }}{{ $transaction['amount_formatted'] }} {{ $currency }}
Saldo tras movimiento: {{ $transaction['balance_after_formatted'] }} {{ $currency }}
@endforeach
@include('rider.partials.nav', [
'navActive' => 'wallet',
'navItems' => ['home', 'wallet', 'tips', 'profile'],
])
@endsection
@section('page-script')
@endsection