{% extends 'wfbo/_layout.html.twig' %} {% block title %}Deposits — WFBO{% endblock %} {% block wfbo_title %}Deposits{% endblock %} {% block wfbo_content %} {% set overdueParam = overdueMode ? 1 : null %} {# Flash messages #} {% for flash in app.flashes('success') %} {% endfor %} {# ── Today's totals ── #}

Total Deposits

Today

₱{{ depositsToday|number_format(2) }}

{{ depositsTodayCount }} approved deposit{{ depositsTodayCount != 1 ? 's' : '' }}

Pending: ₱{{ pendingDepositsSum|number_format(2) }} ({{ pendingDepositsCount }})

Total Withdrawals

Today

₱{{ withdrawalsToday|number_format(2) }}

{{ withdrawalsTodayCount }} approved withdrawal{{ withdrawalsTodayCount != 1 ? 's' : '' }}

Pending: ₱{{ pendingWithdrawalsSum|number_format(2) }} ({{ pendingWithdrawalsCount }})

{# ── Deposit trend (approved deposits grouped daily / weekly / monthly) ── #} {% if not overdueMode %} {% set dt = depositTrend %} {% set unit = dt.group %}

Deposit Trend

{% for key, label in trendPresets %} {{ label }} {% endfor %}

₱{{ dt.total|number_format(2) }} approved in the last {{ dt.window }} · avg ₱{{ dt.avg|number_format(2) }} per {{ unit }} · {% if dt.changePct is null %} no deposits in the previous {{ dt.window }} to compare {% else %} {{ dt.changePct >= 0 ? '▲' : '▼' }} {{ dt.changePct|abs|number_format(1) }}% vs previous {{ dt.window }} (₱{{ dt.prevTotal|number_format(2) }}) {% endif %}

{% endif %} {# ── Overdue pending alert ── #} {% if overdueMode %} {% else %} {% endif %} {# ── Search ── #}
{% if currentStatus %}{% endif %} {% if search %} Clear {% endif %}
{# ── Status filter tabs ── #}
{% set filters = [ {label: 'All', value: null}, {label: 'Pending', value: 'pending'}, {label: 'Approved', value: 'approved'}, {label: 'Rejected', value: 'rejected'}, ] %} {% for f in filters %} {{ f.label }} {% if f.value == 'pending' %} {{ pendingCount }} {% endif %} {% endfor %}
{# ── Total count + refresh ── #}

{{ total }} deposit{{ total != 1 ? 's' : '' }}{{ currentStatus ? ' (' ~ currentStatus ~ ')' : '' }}

↻ Refresh
{# ── Table ── #}
{% for deposit in deposits %} {% set paymentLabel = deposit.paymentDetail ? deposit.paymentDetail.label|upper : '' %} {% set paymentBank = deposit.paymentDetail ? deposit.paymentDetail.bankName|upper : '' %} {% if paymentLabel == 'GCASH' or paymentBank == 'GCASH' %} {% set rowClass = 'table-row--gcash' %} {% elseif paymentLabel == 'MAYA' or paymentBank == 'MAYA' %} {% set rowClass = 'table-row--maya' %} {% elseif paymentLabel == 'GOTYME' or paymentBank == 'GOTYME' %} {% set rowClass = 'table-row--gotyme' %} {% else %} {% set rowClass = 'table-row--other' %} {% endif %} {% else %} {% endfor %}
# User Amount Sent To Ref. No. Submitted Notes Status Actions
{{ deposit.id }}

{{ deposit.user.firstName }} {{ deposit.user.lastName }}

{{ deposit.user.userIdentifier }}

{{ deposit.amount|number_format(2) }}

{% if deposit.approvedAmount is not null %}

Approved: {{ deposit.approvedAmount|number_format(2) }}

{% endif %}
{% if deposit.paymentDetail %}

{{ deposit.paymentDetail.label }}

{{ deposit.paymentDetail.bankName }}

{{ deposit.paymentDetail.accountNumber }}

{% else %} — {% endif %}
{{ deposit.transactionReference ?? '—' }} {% if deposit.referenceFlagged %} {# Near-duplicate of an earlier request's reference (e.g. one digit edited) - see DepositReferenceSimilarityService. #}
⚠ Similar ref
{{ deposit.similarReferenceMatches|length }} similar request{{ deposit.similarReferenceMatches|length > 1 ? 's' : '' }}
    {% for match in deposit.similarReferenceMatches %} {% set other = similarDeposits[match.depositId] ?? null %}
  • {{ (match.similarity * 100)|round(0, 'floor') }}% #{{ match.depositId }} {% if other %} · {{ _self.ref_diff(other.transactionReference, deposit.transactionReference) }}
    {{ other.user.firstName }} {{ other.user.lastName }} · {{ other.amount|number_format(2) }} · {{ other.status|capitalize }} · {{ other.createdAt|date('M d, H:i') }} {% else %} (no longer available) {% endif %}
  • {% endfor %}
{% endif %}
{{ deposit.createdAt|date('M d, Y H:i') }} {{ deposit.notes ?? '—' }} {% if deposit.status == 'pending' %} Pending {% elseif deposit.status == 'approved' %} Approved {% set promo = promoByDepositId[deposit.id] ?? null %} {% if promo %} Promo +₱{{ promo.amount|number_format(2) }} {% endif %} {% if deposit.reviewNote %}

{{ deposit.reviewNote }}

{% endif %} {% else %} Rejected {% if deposit.reviewNote %}

{{ deposit.reviewNote }}

{% endif %} {% endif %}
{% set reviewHandler = deposit.paymentDetail ? deposit.paymentDetail.financeHandler : null %} {% set canReview = reviewHandler ? (reviewHandler.id == app.user.id) : is_granted('ROLE_ADMIN') %} {% set canTransfer = is_granted('ROLE_ADMIN') %} {% set currentPaymentDetailId = deposit.paymentDetail ? deposit.paymentDetail.id : null %} {% if deposit.status == 'pending' and not canReview and not canTransfer %}

{% if reviewHandler %}Assigned to {{ reviewHandler.firstName }} {{ reviewHandler.lastName }} {% else %}No handler assigned — admin only{% endif %}

{% elseif deposit.status == 'pending' %}
{% if canReview %} {# Approved amount override #} {# Review note #}
{# Approve #}
{# Reject #}
{% elseif reviewHandler %} {# Admin can Transfer even without being the review handler - keep the handler context visible since Approve/Reject are hidden here. #}

Assigned to {{ reviewHandler.firstName }} {{ reviewHandler.lastName }}

{% endif %} {% if canTransfer %} {# Transfer to another payment method's handler - admin only #}
{% endif %} {% if deposit.transactionImagePath %} {% set ext = deposit.transactionImagePath|split('.')|last|lower %} {% if ext in ['jpg', 'jpeg', 'png', 'gif', 'webp'] %} {% else %} View PDF {% endif %} {% endif %}
{% else %}
{% if deposit.reviewedBy %} By {{ deposit.reviewedBy.firstName }}
{{ deposit.reviewedAt|date('M d, Y h:i A') }} {% else %} — {% endif %}
{% if deposit.transactionImagePath %} {% set ext = deposit.transactionImagePath|split('.')|last|lower %} {% if ext in ['jpg', 'jpeg', 'png', 'gif', 'webp'] %} {% else %} View PDF {% endif %} {% endif %}
{% endif %}
No deposits found.
{# Pagination #} {% if totalPages > 1 %}

Page {{ currentPage }} of {{ totalPages }}

{% if currentPage > 1 %} ← Previous {% endif %} {% if currentPage < totalPages %} Next → {% endif %}
{% endif %} {# ── Transaction image popup modal ── #}
Transaction Image
Transaction Image
{% endblock %} {% block javascripts %} {{ parent() }} {% endblock %} {# Renders `ref`, highlighting each character that differs from `against` at the same position. Only meaningful for equal-length references (the typical "one digit edited" case); otherwise the reference is shown as-is. #} {% macro ref_diff(ref, against) %} {%- if ref|length == against|length and ref|length > 0 -%} {%- for i in 0..(ref|length - 1) -%} {%- set c = ref|slice(i, 1) -%} {%- if c != against|slice(i, 1) -%}{{ c }}{%- else -%}{{ c }}{%- endif -%} {%- endfor -%} {%- else -%} {{ ref }} {%- endif -%} {% endmacro %}