Skip to content

Firefly III: a personal finances manager

9.1 KB
Raw Blame

@foreach($piggyBanks as $objectGroupOrder => $objectGroup)
    <div class="row">
        <div class="col-lg-12 col-md-12 col-sm-12">
            <div class="card mb-2">
                <x-elements.card-header-with-menu :cardTitle="$objectGroup['object_group_title']" :route="route('piggy-banks.create')" :linkTitle="__('firefly.create_new_piggy_bank')" />
                <div class="card-body p-0">

<table class="table table-valign-middle table-hover table-sm piggy-sortable">
    <thead>
    <tr>
        <th class="w-4">&nbsp;</th>
        <th class="w-4 d-lg-none"></th> {{-- mobile handlers --}}
        <th class="w-25" style="width:30%;">{{ __('firefly.piggy_bank') }}</th>
        <th class="w-10 text-end">{{ __('firefly.saved_so_far') }}</th>
        <th class="d-none d-lg-table-cell"></th>
        <th class="d-none d-lg-table-cell"></th>
        <th class="d-none d-lg-table-cell"></th>
        <th class="w-10 text-end">{{ __('firefly.target_amount') }}</th>
        <th class="w-10 text-end d-none d-lg-table-cell">{{ __('firefly.left_to_save') }}</th>
        <th class="w-15 text-end d-none d-xxl-table-cell">{{ __('firefly.suggested_savings_per_month') }}</th>
        <th class="w-4">&nbsp;</th>
    </tr>
    </thead>
    @if(count($objectGroup['piggy_banks']) > 0)
    <tbody class="piggy-connected-list" @if(0 !== $objectGroupOrder)data-title="{{ $objectGroup['object_group_title'] }}"@else data-title=""@endif>
    @foreach($objectGroup['piggy_banks'] as $piggy)
    <tr class="piggy-sortable" data-id="{{ $piggy['id'] }}" data-name="{{ $piggy['name'] }}" data-order="{{ $piggy['order'] }}">
        <td class="">
            <a class="btn btn-outline-secondary btn-sm bi bi-list piggy-handle"></a>
            <span class="loadSpin"></span>
        </td>
        <td class="d-lg-none"> <!-- mobile buttons -->
            <div class="btn-group btn-group-sm">
                <a href="{{ route('piggy-banks.remove-money-mobile', $piggy['id']) }}" class="btn btn-outline-danger btn-sm"><span class="bi bi-dash"></span></a>
                <a href="{{ route('piggy-banks.add-money-mobile', $piggy['id']) }}" class="btn btn-outline-success btn-sm"><span class="bi bi-plus"></span></a>
            </div>
        </td>
        <td>
            <a href="{{ route('piggy-banks.show', $piggy['id']) }}" title="{{ $piggy['name'] }}">{{ $piggy['name'] }}</a>
            @if(count($piggy['attachments']) > 0)
                <span class="bi bi-paperclip"></span>
            @endif
        </td>
        <td class="text-end piggySaved">
                    <span title="Saved so far" class="text-end">
                        {!! format_amount_by_symbol($piggy['current_amount'],$piggy['currency_symbol'],$piggy['currency_decimal_places']) !!}
                        @if($convertToPrimary and $piggy['currency_id'] !== $primaryCurrency->id && null !== $piggy['pc_current_amount'])
                            ({!! format_amount_by_symbol($piggy['pc_current_amount'],$primaryCurrency->symbol,$primaryCurrency->decimal_places) !!})
                        @endif
                    </span>
        </td>
        <td class="d-none d-lg-table-cell" style="width:40px;">
            @if($piggy['current_amount'] > 0)
            <a href="{{ route('piggy-banks.remove-money', $piggy['id']) }}" class="btn btn-secondary btn-sm removeMoney" data-id="{{ $piggy['id'] }}">
                <span data-id="{{ $piggy['id'] }}" class="bi bi-dash"></span></a>
            @endif
        </td>

        <td class="d-none d-lg-table-cell piggyBar">
            @if(null !== $piggy['percentage'])
                <div class="progress"
                    style="height: 21px" role="progressbar" aria-valuenow="{{ round(max(30, $piggy['percentage'])) }}" aria-valuemin="0" aria-valuemax="100">
                    <div
                        @if(100 === $piggy['percentage'])
                            class="progress-bar progress-bar-striped bg-success w-{{ round(max(30, $piggy['percentage'])) }}"
                        @elseif(0 === $piggy['percentage'])
                            class="progress-bar progress-bar-striped bg-warning w-{{ round(max(30, $piggy['percentage'])) }}"
                        @else
                            class="progress-bar progress-bar-striped bg-info w-{{ round(max(30, $piggy['percentage'])) }}"
                        @endif
                        ></div>
                </div>
            @endif



        </td>


        <td class="d-none d-lg-table-cell">
            @if($piggy['left_to_save'] > 0 || null === $piggy['left_to_save'])
            <a href="{{ route('piggy-banks.add-money', $piggy['id']) }}" class="btn btn-secondary btn-sm addMoney" data-id="{{ $piggy['id'] }}">
                <span data-id="{{ $piggy['id'] }}" class="b bi-plus"></span></a>
            @endif
        </td>
        <td class="text-end">
            @if(null !== $piggy['target_amount'] && 0 !== $piggy['target_amount'])
            <span title="{{ __('firefly.target_amount') }}">{!! format_amount_by_symbol($piggy['target_amount'],$piggy['currency_symbol'],$piggy['currency_decimal_places']) !!}</span>
            @if($convertToPrimary && $piggy['currency_id'] !== $primaryCurrency->id && null !== $piggy['pc_target_amount'])
            (<span title="{{ __('firefly.target_amount') }}">{!! format_amount_by_symbol($piggy['pc_target_amount'],$primaryCurrency->symbol, $primaryCurrency->decimal_places)  !!}</span>)
            @endif
            @endif
        </td>
        <td class="text-end d-none d-lg-table-cell">
            @if($piggy['left_to_save'] > 0)
            <span title="{{ __('firefly.left_to_save') }}">{!! format_amount_by_symbol($piggy['left_to_save'],$piggy['currency_symbol'],$piggy['currency_decimal_places']) !!}</span>
                @if($convertToPrimary && $piggy['currency_id'] !== $primaryCurrency->id && null !== $piggy['pc_left_to_save'])
            (<span title="{{ __('firefly.left_to_save') }}">{!! format_amount_by_symbol($piggy['pc_left_to_save'], $primaryCurrency->symbol,$primaryCurrency->decimal_places) !!}</span>)
            @endif
            @endif
        </td>
        <td class="text-end d-none d-xxl-table-cell">
            @if(null !== $piggy['target_date'] && null !== $piggy['save_per_month'])
            {!! format_amount_by_symbol($piggy['save_per_month'], $piggy['currency_symbol'], $piggy['currency_decimal_places']) !!}
                @if($convertToPrimary && $piggy['currency_id'] !== $primaryCurrency->id && null !== $piggy['pc_save_per_month'])
            ({!! format_amount_by_symbol($piggy['pc_save_per_month'], $primaryCurrency->symbol, $primaryCurrency->decimal_places) !!})
            @endif
            @endif
        </td>
        <td class="text-end">
            <div class="dropdown">
                <button class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
                    {{__('firefly.actions')}}
                </button>
                <ul class="dropdown-menu">
                    <li><a class="dropdown-item" href="{{ route('piggy-banks.edit', $piggy['id']) }}?_from={{ urlencode($FF3_FROM) }}"><span class="bi bi-pencil"></span> {{ __('firefly.edit') }}</a></li>
                    <li><a class="dropdown-item text-danger" href="{{ route('piggy-banks.delete', $piggy['id']) }}?_from={{ urlencode($FF3_FROM) }}"><span class="bi bi-trash"></span> {{ __('firefly.delete') }}</a></li>
                </ul>
            </div>
        </td>
    </tr>
    @endforeach
    <tr>
        <td class="">&nbsp;</td> {{-- handle --}}
        <td class="d-lg-none ">&nbsp;</td> {{-- mobile buttons --}}
        <td>&nbsp;</td> {{-- title --}}
        <td class="text-end">
            @foreach($objectGroup['sums'] as $sum)
            {!! format_amount_by_symbol($sum['saved'], $sum['currency_symbol'], $sum['currency_decimal_places']) !!}<br />
            @endforeach
        </td>
        <td class="d-none d-lg-table-cell">&nbsp;</td> {{-- remove money --}}
        <td class="d-none d-lg-table-cell">&nbsp;</td> {{-- progress --}}
        <td class="d-none d-lg-table-cell">&nbsp;</td> {{-- add money --}}
        <td class="text-end">

            @foreach($objectGroup['sums'] as $sum)
            {!! format_amount_by_symbol($sum['target'], $sum['currency_symbol'], $sum['currency_decimal_places']) !!}<br />
            @endforeach
        </td>
        <td class="text-end d-none d-lg-table-cell">
            @foreach($objectGroup['sums'] as $sum)
            {!! format_amount_by_symbol($sum['left_to_save'], $sum['currency_symbol'], $sum['currency_decimal_places']) !!}<br />
            @endforeach
        </td>
        <td class="text-end d-none d-xxl-table-cell">
            @foreach($objectGroup['sums'] as $sum)
            {!! format_amount_by_symbol($sum['save_per_month'], $sum['currency_symbol'], $sum['currency_decimal_places']) !!}<br />
            @endforeach
        </td>
        <td>&nbsp;</td> {{-- normal buttons --}}

    </tr>
    </tbody>
    @endif
</table>
                </div>
                <x-elements.card-footer-with-menu :route="route('piggy-banks.create')" :linkTitle="__('firefly.create_new_piggy_bank')" />
            </div>
        </div>
    </div>

@endforeach