{{ $savings->name }}

{{$savings->type}}

{{--

{{$savings->members->count()}} members

--}}

{{$savings->end_date->diffInDays()}} days left

{{-- End savings modal --}}
{{-- only admin can end savings --}} @if ($is_admin && $savings->status == 'active') End savings @endif

Close savings Account

Closing this account will transfer the balance to your wallet and the account will become inactive.

Close Account
{{-- edit savings --}} @if ($savings->status !== 'closed' && $is_admin)

Edit Savings

Update Savings
@endif
{{-- invite friends --}}
@if ( $savings->status == 'active') @endif

Invite Code

Invite your friends to join your savings account

{{ $savings->hash_id}}

Copy Code
@if ($savings->status === 'closed')

Group Savings Closed

@else @if ($savings->type === 'flexible')

Target Amount

{{formatNumber($savings->target_amount)}}

@endif

Wallet Balance

{{formatNumber($savings->balance)}}

{{-- add money modal --}}
Add Money

Add money to Savings

Wallet Balance: {{formatNumber(auth()->user()->wallet_balance)}}

Add Money
{{-- withdraw money modal --}}
{{-- only admin can withdraw --}} @if ($is_admin) Withdraw @endif

Withdraw money to wallet

Withdrawal attracts a fee of {{$withdrawal_fee}}

Withdraw Money
@endif
{{-- savings members --}}
@foreach ($members as $user)

{{$user->name}} @if ($user->id == auth()->id()) .You @endif

@if ($user && $user->pivot)

{{$user?->pivot->status}}

@endif
@if ($savings->type === 'strict')

Member Estimated Amount:

{{formatNumber($savings->member_target_amount)}}

@endif

Active Savings:

{{formatNumber($savings->donations()->where('user_id', $user->id)->sum('amount'))}}

@if ( $user && $user->pivot && $user->pivot->status === 'active' && $savings->status == 'active')
@if ($savings->members->find($user->id)->pivot->role === 'member' && $savings->members->find(Auth::user()->id)->pivot->role === 'admin') {{-- make admin modal --}}
Make Admin

Make Admin

Are you sure you want to make this user an admin?
The user will have the same privileges as you.

Yes, Make Admin
@endif {{-- remove member --}} @if ($user->id !== auth()->id())
@if ($savings->members->find(auth()->user()->id)->pivot->role === 'admin' && $savings->status == 'active') Remove Member @endif

Remove Member

Remove Member
@endif
@endif
@endforeach
{{-- savings activities --}}
@forelse ($activities as $activity)

{{$activity->message}}

{{$activity->created_at->diffForHumans()}}

@empty
No activities yet.
@endforelse