haikal/templates/ledger/journal_entry/journal_entry_txs.html
2025-06-12 21:01:13 +03:00

99 lines
5.6 KiB
HTML

{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% load crispy_forms_tags %}
{% block content %}
<div class="row justify-content-center">
<div class="col-12">
{% include 'ledger/journal_entry/includes/card_journal_entry.html' with journal_entry=journal_entry %}
</div>
<div class="col-12">
<div class="card">
<div class="card-body">
<form action="{{ view.request.path }}" method="post">
{% csrf_token %}
<div class="row">
<div class="col-12">
{% if txs_formset.non_form_errors %}
<div class="alert alert-subtle-warning" role="alert">
{{ txs_formset.non_form_errors }}
</div>
{% endif %}
{{ txs_formset.management_form|crispy }}
</div>
<div class="col-12">
<table class="table table-bordered">
<thead>
<tr>
<th>Account</th>
<th>TX Type</th>
<th>Amount</th>
<th>Description</th>
{% if txs_formset.can_delete %}
<th>Delete</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for f in txs_formset %}
<tr>
<td class="px-2">
{% for hidden_field in f.hidden_fields %}
{{ hidden_field }}
{% endfor %}
{{ f.account|as_crispy_field }}
</td>
<td>{{ f.tx_type|as_crispy_field }}</td>
<td>{{ f.amount|as_crispy_field }}</td>
<td>{{ f.description|as_crispy_field }}</td>
<td>
{% if txs_formset.can_delete %}
{{ f.DELETE|as_crispy_field }}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="col-12 text-center">
<button class="btn btn-phoenix-primary">
{% trans 'Save' %}
</button>
<a class="btn btn-phoenix-secondary"
href="{% url 'journalentry_list' journal_entry.ledger_id %}">
{% trans 'Done' %}
</a>
{% if journal_entry.can_lock %}
<a class="btn btn-phoenix-danger"
href="{{ journal_entry.get_action_lock_url }}?next={% url 'journalentry_txs' journal_entry.entity_slug journal_entry.ledger_id journal_entry.pk %}">
{% trans 'Lock' %}
</a>
{% endif %}
{% if journal_entry.can_unlock %}
<a class="btn btn-phoenix-warning"
href="{{ journal_entry.get_action_unlock_url }}?next={% url 'journalentry_txs' journal_entry.entity_slug journal_entry.ledger_id journal_entry.pk %}">
{% trans 'UnLock' %}
</a>
{% endif %}
{% if journal_entry.can_post %}
<a class="btn btn-phoenix-danger"
href="{{ journal_entry.get_action_post_url }}?next={% url 'journalentry_txs' journal_entry.entity_slug journal_entry.ledger_id journal_entry.pk %}">
{% trans 'Post' %}
</a>
{% endif %}
{% if journal_entry.can_unpost %}
<a class="btn btn-phoenix-warning"
href="{{ journal_entry.get_action_unpost_url }}?next={% url 'journalentry_txs' journal_entry.entity_slug journal_entry.ledger_id journal_entry.pk %}">
{% trans 'UnPost' %}
</a>
{% endif %}
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}