mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-22 16:48:36 +02:00
157 lines
7.6 KiB
HTML
157 lines
7.6 KiB
HTML
{% load i18n %}
|
|
{% load currency_display %}
|
|
<div class="tw-border-s-6 tw-border-e-0 tw-border-t-0 tw-border-b-0 border-bottom
|
|
hover:tw-bg-zinc-900 p-2 {% if transaction.account.is_asset %}tw-border-dashed{% else %}tw-border-solid{% endif %}
|
|
{% if transaction.type == "EX" %}tw-border-red-500{% else %}tw-border-green-500{% endif %} transaction tw-relative
|
|
my-3"
|
|
_="on mouseover remove .tw-invisible from the first .transaction-actions in me end
|
|
on mouseout add .tw-invisible to the first .transaction-actions in me end">
|
|
<div class="row font-monospace tw-text-sm align-items-center">
|
|
<div class="col-lg-1 col-12 d-flex align-items-center tw-text-2xl lg:tw-text-xl text-lg-center pay-button">
|
|
<a class="text-decoration-none my-2 w-100"
|
|
role="button"
|
|
hx-get="{% url 'transaction_pay' transaction_id=transaction.id %}"
|
|
hx-target="closest .transaction"
|
|
hx-swap="outerHTML"
|
|
_="on paid
|
|
js
|
|
paidSound.pause()
|
|
paidSound.currentTime = 0
|
|
paidSound.play()
|
|
end
|
|
end
|
|
on unpaid
|
|
js
|
|
unpaidSound.pause()
|
|
unpaidSound.currentTime = 0
|
|
unpaidSound.play()
|
|
end
|
|
end">
|
|
{% if transaction.is_paid %}<i class="fa-regular fa-circle-check tw-text-green-400"></i>{% else %}<i
|
|
class="fa-regular fa-circle tw-text-red-400"></i>{% endif %}
|
|
</a>
|
|
</div>
|
|
<div class="col-lg-8 col-12">
|
|
{# Date#}
|
|
<div class="mb-1 tw-text-gray-400">
|
|
<i class="fa-solid fa-calendar fa-fw me-1 fa-xs"></i>{{ transaction.date|date:"SHORT_DATE_FORMAT" }}</div>
|
|
<div class="mb-1 text-white tw-text-base">{{ transaction.description }}</div>
|
|
<div class="tw-text-gray-400 tw-text-sm">
|
|
{# Notes#}
|
|
{% if transaction.notes %}
|
|
<div class="mb-1 tw-text-gray-400">
|
|
<i class="fa-solid fa-align-left fa-fw me-1 fa-xs"></i>{{ transaction.notes | linebreaksbr }}
|
|
</div>
|
|
{% endif %}
|
|
{% if transaction.category %}
|
|
<div class="mb-1">
|
|
{% spaceless %}
|
|
<i class="fa-solid fa-icons fa-fw me-1 fa-xs"></i>
|
|
<span class="">{{ transaction.category.name }}</span>
|
|
{% endspaceless %}
|
|
</div>
|
|
{% endif %}
|
|
{# Tags#}
|
|
{% with transaction.tags.all as tags %}
|
|
{% if tags %}
|
|
<div class="mb-1">
|
|
{% for tag in tags %}
|
|
<span><i class="fa-solid fa-hashtag fa-fw fa-xs"></i>{{ tag.name }}</span>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
{% endwith %}
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-3 col-12 text-lg-end align-self-end">
|
|
<div class="{% if transaction.type == "EX" %}tw-text-red-400{% else %}tw-text-green-400{% endif %}">
|
|
<div class="amount" data-original-value="{% transaction_amount transaction %}"></div>
|
|
</div>
|
|
{# Exchange Rate#}
|
|
{% with exchanged=transaction.exchanged_amount %}
|
|
{% if exchanged %}
|
|
<div class="tw-text-gray-500 amount"
|
|
data-original-value="{% currency_display amount=exchanged.amount prefix=exchanged.prefix suffix=exchanged.suffix decimal_places=exchanged.decimal_places %}">
|
|
</div>
|
|
{% endif %}
|
|
{% endwith %}
|
|
<div>{{ transaction.account.name }}</div>
|
|
</div>
|
|
<div>
|
|
{# Item actions#}
|
|
<div class="transaction-actions !tw-absolute tw-left-2/4 tw--top-6 tw-invisible d-none
|
|
d-xl-flex flex-xl-row tw-text-base card">
|
|
<a class="text-decoration-none tw-text-gray-400 p-2 transaction-action"
|
|
role="button"
|
|
data-bs-toggle="tooltip"
|
|
data-bs-title="{% translate "Edit" %}"
|
|
hx-get="{% url 'transaction_edit' transaction_id=transaction.id %}"
|
|
hx-target="#generic-offcanvas"
|
|
_="install tooltip">
|
|
<i class="fa-solid fa-pencil fa-fw"></i></a>
|
|
<a class="text-danger text-decoration-none p-2 transaction-action"
|
|
role="button"
|
|
data-bs-toggle="tooltip"
|
|
data-bs-title="{% translate "Delete" %}"
|
|
hx-delete="{% url 'transaction_delete' transaction_id=transaction.id %}"
|
|
hx-trigger='delete_confirmed'
|
|
_="install tooltip
|
|
on click
|
|
if event.ctrlKey trigger delete_confirmed
|
|
else
|
|
call Swal.fire({title: '{% translate 'Are you sure?' %}',
|
|
text: '{% blocktranslate %}You won\'t be able to revert this!{% endblocktranslate %}',
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
cancelButtonText: '{% blocktranslate %}Cancel{% endblocktranslate %}',
|
|
confirmButtonText: '{% blocktranslate %}Yes, delete it!{% endblocktranslate %}',
|
|
customClass: {
|
|
confirmButton: 'btn btn-primary me-3',
|
|
cancelButton: 'btn btn-danger'
|
|
},
|
|
buttonsStyling: false})
|
|
if result.isConfirmed trigger delete_confirmed"><i class="fa-solid fa-trash fa-fw"></i></a>
|
|
</div>
|
|
{# Item actions dropdown fallback for mobile#}
|
|
<div class="dropdown !tw-absolute tw-top-0 tw-right-0 xl:tw-invisible">
|
|
<a class="btn tw-text-2xl lg:tw-text-sm lg:tw-border-none text-light" type="button"
|
|
data-bs-toggle="dropdown"
|
|
aria-expanded="false">
|
|
<i class="fa-solid fa-ellipsis fa-fw"></i>
|
|
</a>
|
|
<ul class="dropdown-menu tw-text-base">
|
|
<li><a class="dropdown-item"
|
|
role="button"
|
|
hx-get="{% url 'transaction_edit' transaction_id=transaction.id %}"
|
|
hx-target="#generic-offcanvas">
|
|
<i class="fa-solid fa-pencil me-3"></i>{% translate "Edit" %}
|
|
</a></li>
|
|
<li><a class="dropdown-item"
|
|
role="button"
|
|
hx-delete="{% url 'transaction_delete' transaction_id=transaction.id %}"
|
|
hx-trigger='delete_confirmed'
|
|
_="on click
|
|
call Swal.fire({title: '{% translate 'Are you sure?' %}',
|
|
text: '{% blocktranslate %}You won\'t be able to revert this!{% endblocktranslate %}',
|
|
icon: 'warning',
|
|
showCancelButton: true,
|
|
confirmButtonColor: '#3085d6',
|
|
cancelButtonColor: '#d33',
|
|
cancelButtonText: '{% blocktranslate %}Cancel{% endblocktranslate %}',
|
|
confirmButtonText: '{% blocktranslate %}Yes, delete it!{% endblocktranslate %}',
|
|
customClass: {
|
|
confirmButton: 'btn btn-primary me-3',
|
|
cancelButton: 'btn btn-danger'
|
|
},
|
|
buttonsStyling: false})
|
|
if result.isConfirmed trigger delete_confirmed">
|
|
<i class="fa-solid fa-trash me-3"></i>{% translate "Delete" %}
|
|
</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|