Convert CGT adjustment forms to Tailwind CSS

This commit is contained in:
RunasSudo 2024-04-04 19:07:53 +11:00
parent dbc1287321
commit c7ab25b203
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
2 changed files with 99 additions and 94 deletions

View File

@ -1,5 +1,5 @@
{# DrCr: Web-based double-entry bookkeeping framework {# 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 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 it under the terms of the GNU Affero General Public License as published by
@ -15,57 +15,54 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
#} #}
{% extends 'base.html' %} {% extends 'base_tailwind.html' %}
{% block title %}{{ 'Edit' if adjustment else 'New' }} CGT adjustment{% endblock %} {% block title %}{{ 'Edit' if adjustment else 'New' }} CGT adjustment{% endblock %}
{% block content %} {% block content %}
<h1 class="h2 my-4">{{ 'Edit' if adjustment else 'New' }} CGT adjustment</h1> <div class="max-w-lg mx-auto px-4">
<h1 class="text-3xl text-gray-900 mb-4">
<form method="POST"> {{ 'Edit' if adjustment else 'New' }} CGT adjustment
<h2 class="h3">CGT asset</h2> </h1>
<div class="row mb-2"> <form method="POST">
<label class="col-sm-2 col-form-label">Acquisition date</label> <div class="grid grid-cols-[max-content_1fr] space-y-2 mb-4 items-baseline">
<div class="col-sm-10"> <h2 class="col-span-2 text-xl text-gray-900 font-semibold">CGT asset</h2>
<input type="date" class="form-control" name="acquisition_date" value="{{ adjustment.acquisition_date.strftime('%Y-%m-%d') if adjustment else request.args.get('acquisition_date', '') }}">
<label for="acquisition_date" class="block text-gray-900 pr-4">Acquisition date</label>
<div>
<input type="date" class="block w-full border-0 py-1 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-emerald-600" name="acquisition_date" id="acquisition_date" value="{{ adjustment.acquisition_date.strftime('%Y-%m-%d') if adjustment else request.args.get('acquisition_date', '') }}">
</div>
<label for="account" class="block text-gray-900 pr-4">Account</label>
<div>
<input type="text" class="block w-full border-0 py-1 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-emerald-600" name="account" id="account" value="{{ adjustment.account if adjustment else request.args.get('account', '') }}">
</div>
<label for="asset" class="block text-gray-900 pr-4">Asset</label>
<div>
<input type="text" class="block w-full border-0 py-1 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-emerald-600" name="asset" id="asset" value="{{ adjustment.asset().quantity_string() if adjustment else request.args.get('asset', '') }}">
</div>
<h2 class="col-span-2 text-xl text-gray-900 font-semibold pt-4">CGT adjustment</h2>
<label for="dt" class="block text-gray-900 pr-4">Adjustment date</label>
<div>
<input type="date" class="block w-full border-0 py-1 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-emerald-600" name="dt" id="dt" value="{{ adjustment.dt.strftime('%Y-%m-%d') if adjustment else '' }}">
</div>
<label for="description" class="block text-gray-900 pr-4">Description</label>
<div>
<input type="text" class="block w-full border-0 py-1 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-emerald-600" name="description" id="description" value="{{ adjustment.description if adjustment else '' }}">
</div>
<label for="cost_adjustment" class="block text-gray-900 pr-4">Cost adjustment</label>
<div class="relative shadow-sm">
<div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
<span class="text-gray-500">$</span>
</div>
<input type="number" class="block w-full border-0 py-1 pl-7 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-emerald-600" name="cost_adjustment" id="cost_adjustment" step="0.01" value="{{ adjustment.cost_adjustment_amount().quantity_string() if adjustment else '' }}" placeholder="0.00">
</div>
</div> </div>
</div>
<div class="row mb-2"> <div class="text-end">
<label class="col-sm-2 col-form-label">Account</label> <button type="submit" class="bg-emerald-600 px-3 py-1 text-white shadow-sm hover:bg-emerald-700">Save</button>
<div class="col-sm-10">
<input type="text" class="form-control" name="account" value="{{ adjustment.account if adjustment else request.args.get('account', '') }}">
</div> </div>
</div> </form>
<div class="row mb-2"> </div>
<label class="col-sm-2 col-form-label">Asset</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="asset" value="{{ adjustment.asset().quantity_string() if adjustment else request.args.get('asset', '') }}">
</div>
</div>
<h2 class="h3 mt-4">CGT adjustment</h2>
<div class="row mb-2">
<label class="col-sm-2 col-form-label">Adjustment date</label>
<div class="col-sm-10">
<input type="date" class="form-control" name="dt" value="{{ adjustment.dt.strftime('%Y-%m-%d') if adjustment }}">
</div>
</div>
<div class="row mb-2">
<label class="col-sm-2 col-form-label">Description</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="description" value="{{ adjustment.description if adjustment }}">
</div>
</div>
<div class="row mb-4">
<label class="col-sm-2 col-form-label">Cost adjustment</label>
<div class="col-sm-10">
<input type="number" class="form-control" name="cost_adjustment" step="0.01" value="{{ adjustment.cost_adjustment_amount().quantity_string() if adjustment }}">
</div>
</div>
<div class="text-end">
<button type="submit" class="btn btn-primary">Save</button>
</div>
</form>
{% endblock %} {% endblock %}

View File

@ -1,5 +1,5 @@
{# DrCr: Web-based double-entry bookkeeping framework {# 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 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 it under the terms of the GNU Affero General Public License as published by
@ -15,55 +15,63 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
#} #}
{% extends 'base.html' %} {% extends 'base_tailwind.html' %}
{% block title %}Multiple CGT adjustments{% endblock %} {% block title %}Multiple CGT adjustments{% endblock %}
{% block content %} {% block content %}
<h1 class="h2 my-4">Multiple CGT adjustments</h1> <div class="max-w-lg mx-auto px-4">
<h1 class="text-3xl text-gray-900 mb-4">
<form method="POST"> Multiple CGT adjustments
<h2 class="h3">CGT assets</h2> </h1>
<div class="row mb-2"> <form method="POST">
<label class="col-sm-2 col-form-label">Account</label> <div class="grid grid-cols-[max-content_1fr] space-y-2 mb-4 items-baseline">
<div class="col-sm-10"> <h2 class="col-span-2 text-xl text-gray-900 font-semibold">CGT assets</h2>
<input type="text" class="form-control" name="account" value="{{ account or '' }}">
<label for="account" class="block text-gray-900 pr-4">Account</label>
<div>
<input type="text" class="block w-full border-0 py-1 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-emerald-600" name="account" id="account" value="{{ account or '' }}">
</div>
<label for="commodity" class="block text-gray-900 pr-4">Commodity</label>
<div>
<input type="text" class="block w-full border-0 py-1 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-emerald-600" name="commodity" id="commodity" value="{{ commodity or '' }}">
</div>
<div class="rounded-md bg-blue-50 p-4 col-span-2">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-blue-400" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3 flex-1">
<p class="text-sm text-blue-700">The total cost adjustment will be distributed proportionally across all matching CGT assets.</p>
</div>
</div>
</div>
<h2 class="col-span-2 text-xl text-gray-900 font-semibold pt-4">CGT adjustment</h2>
<label for="dt" class="block text-gray-900 pr-4">Adjustment date</label>
<div>
<input type="date" class="block w-full border-0 py-1 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-emerald-600" name="dt" id="dt" value="{{ dt or '' }}">
</div>
<label for="description" class="block text-gray-900 pr-4">Description</label>
<div>
<input type="text" class="block w-full border-0 py-1 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-emerald-600" name="description" id="description" value="{{ description or '' }}">
</div>
<label for="cost_adjustment" class="block text-gray-900 pr-4">Total cost adjustment</label>
<div class="relative shadow-sm">
<div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
<span class="text-gray-500">$</span>
</div>
<input type="number" class="block w-full border-0 py-1 pl-7 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-emerald-600" name="cost_adjustment" id="cost_adjustment" step="0.01" value="{{ cost_adjustment or '' }}" placeholder="0.00">
</div>
</div> </div>
</div>
<div class="row mb-2"> <div class="text-end">
<label class="col-sm-2 col-form-label">Commodity</label> <button type="submit" class="bg-emerald-600 px-3 py-1 text-white shadow-sm hover:bg-emerald-700">Save</button>
<div class="col-sm-10">
<input type="text" class="form-control" name="commodity" value="{{ commodity or '' }}">
</div> </div>
</div> </form>
</div>
<div class="alert alert-info" role="alert">
The total cost adjustment will be distributed proportionally across all matching CGT assets.
</div>
<h2 class="h3 mt-4">CGT adjustment</h2>
<div class="row mb-2">
<label class="col-sm-2 col-form-label">Adjustment date</label>
<div class="col-sm-10">
<input type="date" class="form-control" name="dt" value="{{ dt or '' }}">
</div>
</div>
<div class="row mb-2">
<label class="col-sm-2 col-form-label">Description</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="description" value="{{ description or '' }}">
</div>
</div>
<div class="row mb-4">
<label class="col-sm-2 col-form-label">Total cost adjustment</label>
<div class="col-sm-10">
<input type="number" class="form-control" name="cost_adjustment" step="0.01" value="{{ cost_adjustment or '' }}">
</div>
</div>
<div class="text-end">
<button type="submit" class="btn btn-primary">Save</button>
</div>
</form>
{% endblock %} {% endblock %}