Convert CGT assets report to Tailwind CSS

This commit is contained in:
RunasSudo 2024-04-04 17:41:49 +11:00
parent 27c6087a53
commit 4b3ecc8320
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -1,5 +1,5 @@
{# DrCr: Web-based double-entry bookkeeping framework
Copyright (C) 2022–2023 Lee Yingtong Li (RunasSudo)
Copyright (C) 2022–2024 Lee Yingtong Li (RunasSudo)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@ -15,52 +15,62 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
#}
{% extends 'base.html' %}
{% extends 'base_tailwind.html' %}
{% block title %}CGT assets{% endblock %}
{% block content %}
<h1 class="h2 mt-4">CGT assets</h1>
<h1 class="text-3xl text-gray-900">
CGT assets
</h1>
<table class="table">
<table class="min-w-full">
<thead>
<tr>
<th style="border-bottom-width:0"></th>
<th style="border-bottom-width:0"></th>
<th style="border-bottom-width:0"></th>
<th style="border-left-width:1px" colspan="2">Acquisition</th>
<th style="border-left-width:1px" colspan="2">Adjustment</th>
<th class="d-print-none"></th>
<th style="border-left-width:1px" colspan="2">Disposal</th>
<th style="border-bottom-width:0;border-left-width:1px"></th>
<th></th>
<th></th>
<th></th>
<th class="py-0.5 px-1 text-gray-900 font-semibold text-start border-l border-gray-300" colspan="2">Acquisition</th>
<th class="py-0.5 px-1 text-gray-900 font-semibold text-start border-l border-gray-300" colspan="2">Adjustment</th>
<th class="print:hidden"></th>
<th class="py-0.5 px-1 text-gray-900 font-semibold text-start border-l border-gray-300" colspan="2">Disposal</th>
<th class="border-l border-gray-300"></th>
</tr>
<tr>
<th>Account</th>
<th>Asset</th>
<th class="text-end">Units</th>
<th style="border-left-width:1px">Date</th>
<th class="text-end">Value</th>
<th style="border-left-width:1px" class="text-end">b/f&nbsp;</th>
<th class="text-end">{{ eofy_date.year }}</th>
<th class="d-print-none"></th>
<th style="border-left-width:1px">Date</th>
<th class="text-end">Value</th>
<th style="border-left-width:1px" class="text-end">Gain&nbsp;</th>
<th class="py-0.5 text-gray-900 font-semibold text-start">Account</th>
<th class="py-0.5 text-gray-900 font-semibold text-start">Asset</th>
<th class="py-0.5 px-1 text-gray-900 font-semibold text-end">Units</th>
<th class="py-0.5 px-1 text-gray-900 font-semibold text-start border-l border-gray-300">Date</th>
<th class="py-0.5 px-1 text-gray-900 font-semibold text-end">Value</th>
<th class="py-0.5 px-1 text-gray-900 font-semibold text-end border-l border-gray-300">b/f&nbsp;</th>
<th class="py-0.5 px-1 text-gray-900 font-semibold text-end">{{ eofy_date.year }}</th>
<th class="print:hidden"></th>
<th class="py-0.5 px-1 text-gray-900 font-semibold text-start border-l border-gray-300">Date</th>
<th class="py-0.5 px-1 text-gray-900 font-semibold text-end">Value</th>
<th class="py-0.5 pl-1 text-gray-900 font-semibold text-end border-l border-gray-300">Gain&nbsp;</th>
</tr>
</thead>
<tbody>
{% for asset in assets %}
<tr>
<td><a href="{{ url_for('account_transactions', account=asset.account, commodity_detail=1) }}">{{ asset.account }}</a></td>
<td>{{ asset.commodity_name() }}</td>
<td class="text-end">{{ asset.format('hide') }}</td>
<td style="border-left-width:1px">{{ asset.acquisition_date.strftime('%Y-%m-%d') }}</td>
<td class="text-end">{{ asset.as_cost().format() }}</td>
<td style="border-left-width:1px" class="text-end">{{ asset.cost_adjustment_brought_forward().format_accounting(link=url_for('cgt_adjustments', account=asset.account, commodity=asset.commodity, quantity=asset.quantity, acquisition_date=asset.acquisition_date.strftime('%Y-%m-%d'))) if asset.cost_adjustment_brought_forward().quantity != 0 }}</td>
<td class="text-end">{{ asset.cost_adjustment_current_period().format_accounting(link=url_for('cgt_adjustments', account=asset.account, commodity=asset.commodity, quantity=asset.quantity, acquisition_date=asset.acquisition_date.strftime('%Y-%m-%d'))) if asset.cost_adjustment_current_period().quantity != 0 }}</td>
<td class="text-center d-print-none"><a href="{{ url_for('cgt_adjustment_new', account=asset.account, asset=asset.quantity_string(), acquisition_date=asset.acquisition_date.strftime('%Y-%m-%d')) }}"><i class="bi bi-plus-lg text-muted"></i></a></td>
<td style="border-left-width:1px">{{ asset.disposal_date.strftime('%Y-%m-%d') if asset.disposal_date else '' }}</td>
<td class="text-end">{{ asset.disposal_value.format() if asset.disposal_value else '' }}</td>
<td style="border-left-width:1px" class="text-end">{% if asset.disposal_date %}{{ asset.gain().format_accounting() }}{% endif %}</td>
<tr class="border-t border-gray-300">
<td class="py-0.5 pr-1 text-gray-900">
<a href="{{ url_for('account_transactions', account=asset.account, commodity_detail=1) }}" class="hover:text-blue-700 hover:underline">{{ asset.account }}</a>
</td>
<td class="py-0.5 px-1 text-gray-900">{{ asset.commodity_name() }}</td>
<td class="py-0.5 px-1 text-gray-900 text-end">{{ asset.format('hide') }}</td>
<td class="py-0.5 px-1 text-gray-900 border-l border-gray-300">{{ asset.acquisition_date.strftime('%Y-%m-%d') }}</td>
<td class="py-0.5 px-1 text-gray-900 text-end">{{ asset.as_cost().format() }}</td>
<td class="py-0.5 px-1 text-gray-900 text-end border-l border-gray-300">{{ asset.cost_adjustment_brought_forward().format_accounting(link=url_for('cgt_adjustments', account=asset.account, commodity=asset.commodity, quantity=asset.quantity, acquisition_date=asset.acquisition_date.strftime('%Y-%m-%d'))) if asset.cost_adjustment_brought_forward().quantity != 0 }}</td>
<td class="py-0.5 px-1 text-gray-900 text-end">{{ asset.cost_adjustment_current_period().format_accounting(link=url_for('cgt_adjustments', account=asset.account, commodity=asset.commodity, quantity=asset.quantity, acquisition_date=asset.acquisition_date.strftime('%Y-%m-%d'))) if asset.cost_adjustment_current_period().quantity != 0 }}</td>
<td class="py-0.5 px-1 text-gray-900 text-center print:hidden">
<a href="{{ url_for('cgt_adjustment_new', account=asset.account, asset=asset.quantity_string(), acquisition_date=asset.acquisition_date.strftime('%Y-%m-%d')) }}" class="text-gray-500 hover:text-gray-700">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
</svg>
</a>
</td>
<td class="py-0.5 px-1 text-gray-900 border-l border-gray-300">{{ asset.disposal_date.strftime('%Y-%m-%d') if asset.disposal_date else '' }}</td>
<td class="py-0.5 px-1 text-gray-900 text-end">{{ asset.disposal_value.format() if asset.disposal_value else '' }}</td>
<td class="py-0.5 pl-1 text-gray-900 text-end border-l border-gray-300">{% if asset.disposal_date %}{{ asset.gain().format_accounting() }}{% endif %}</td>
</tr>
{% endfor %}
</tbody>