{% extends 'admin/layout.html.twig' %} {% block title %}{{ is_new ? 'New' : 'Edit' }} Income - KitscoApp{% endblock %} {% block page_title %}{{ is_new ? 'New Income' : 'Edit: ' ~ income.referenceNumber }}{% endblock %} {% block content %}
Back to Income
{% if income.isAutoGenerated %}
This is an auto-generated income entry from an invoice payment. Only notes and reconciliation status can be modified.
{% endif %}

Income Details

{{ form_start(form) }}
{# Category dropdown #}
{% set category_options = [] %} {% for choice in form.category.vars.choices %} {% set category_options = category_options|merge([{value: choice.value, label: choice.label}]) %} {% endfor %} {% include 'components/_select_dropdown.html.twig' with { id: form.category.vars.id, name: form.category.vars.full_name, value: form.category.vars.value, label: 'Category', options: category_options, placeholder: 'Select category...', searchable: true, searchPlaceholder: 'Search categories...', required: true } %} {% do form.category.setRendered %}
{{ form_row(form.incomeDate) }}
{{ form_row(form.description) }}
{# Currency and Exchange Rate with Stimulus controller #}
{{ form_row(form.amount) }}
{# Currency dropdown #}
{% set currency_options = [] %} {% for choice in form.currency.vars.choices %} {% set currency_options = currency_options|merge([{value: choice.value, label: choice.label}]) %} {% endfor %} {% include 'components/_select_dropdown.html.twig' with { id: form.currency.vars.id, name: form.currency.vars.full_name, value: form.currency.vars.value, label: 'Currency', options: currency_options, placeholder: 'Select currency...', required: true, extra_attrs: {'data-exchange-rate-target': 'currency', 'data-action': 'change->exchange-rate#toggle'} } %} {% do form.currency.setRendered %}
{# Exchange Rate field - shown only for foreign currencies #}

How many TZS equals 1 unit of the selected currency

{% do form.exchangeRate.setRendered %}
{# Account dropdown #}
{% set account_options = [] %} {% for choice in form.account.vars.choices %} {% set account_options = account_options|merge([{value: choice.value, label: choice.label}]) %} {% endfor %} {% include 'components/_select_dropdown.html.twig' with { id: form.account.vars.id, name: form.account.vars.full_name, value: form.account.vars.value, label: 'Account', options: account_options, placeholder: 'Select account...', required: true } %} {% do form.account.setRendered %}
{# Customer dropdown #}
{% set customer_options = [] %} {% for choice in form.customer.vars.choices %} {% set customer_options = customer_options|merge([{value: choice.value, label: choice.label}]) %} {% endfor %} {% include 'components/_select_dropdown.html.twig' with { id: form.customer.vars.id, name: form.customer.vars.full_name, value: form.customer.vars.value, label: 'Customer', options: customer_options, placeholder: 'Select customer (optional)...', searchable: true, searchPlaceholder: 'Search customers...', required: false } %} {% do form.customer.setRendered %}
{{ form_row(form.notes) }}
{{ form_row(form.isReconciled) }}
{% if not is_new and not income.isAutoGenerated %} {% else %}
{% endif %}
Cancel
{{ form_end(form) }} {% if not is_new and not income.isAutoGenerated %} {% endif %}
{% endblock %}