Convert balance assertion editor to Tailwind CSS

This commit is contained in:
RunasSudo 2024-04-04 18:09:42 +11:00
parent 4b3ecc8320
commit ac00748342
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

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,47 +15,48 @@
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 assertion else 'New' }} balance assertion{% endblock %} {% block title %}{{ 'Edit' if assertion else 'New' }} balance assertion{% endblock %}
{% block content %} {% block content %}
<h1 class="h2 my-4">{{ 'Edit' if assertion else 'New' }} balance assertion</h1> <div class="max-w-lg mx-auto px-4">
<h1 class="text-3xl text-gray-900 mb-4">
<form method="POST"> {{ 'Edit' if assertion else 'New' }} balance assertion
<div class="row mb-2"> </h1>
<label class="col-sm-2 col-form-label">Date</label>
<div class="col-sm-10"> <form method="POST">
<input type="date" class="form-control" name="dt" value="{{ assertion.dt.strftime('%Y-%m-%d') if assertion }}"> <div class="grid grid-cols-[max-content_1fr] space-y-2 mb-4 items-baseline">
</div> <label for="dt" class="block text-gray-900 pr-4">Date</label>
</div> <div>
<div class="row mb-2"> <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="{{ assertion.dt.strftime('%Y-%m-%d') if assertion else '' }}">
<label class="col-sm-2 col-form-label">Description</label> </div>
<div class="col-sm-10"> <label for="description" class="block text-gray-900 pr-4">Description</label>
<input type="text" class="form-control" name="description" value="{{ assertion.description if assertion }}"> <div>
</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="{{ assertion.description if assertion else '' }}">
</div> </div>
<div class="row mb-2"> <label for="account" class="block text-gray-900 pr-4">Account</label>
<label class="col-sm-2 col-form-label">Account</label> <div>
<div class="col-sm-10"> <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="{{ assertion.account if assertion else '' }}">
<input type="text" class="form-control" name="account" value="{{ assertion.account if assertion }}"> </div>
</div> <label for="amount" class="block text-gray-900 pr-4">Balance</label>
</div> <div class="relative shadow-sm">
<div class="row mb-4"> <div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
<label class="col-sm-2 col-form-label">Balance</label> <span class="text-gray-500">$</span>
<div class="col-sm-10"> </div>
<div class="input-group"> {# TODO: Display existing credit assertion as credit, not as negative debit #}
<div class="input-group-text">$</div> <input type="number" class="block w-full border-0 py-1 pl-7 pr-16 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="amount" step="0.01" value="{{ assertion.balance().quantity_string() if assertion else '' }}" placeholder="0.00">
<input type="number" class="form-control" name="amount" step="0.01" value="{{ assertion.balance().quantity_string() if assertion }}"> <div class="absolute inset-y-0 right-0 flex items-center">
<select class="form-select" name="sign"> <select class="h-full border-0 bg-transparent py-0 pl-2 pr-8 text-gray-900 focus:ring-2 focus:ring-inset focus:ring-indigo-600" name="sign">
<option value="dr">Dr</option> <option value="dr">Dr</option>
<option value="cr">Cr</option> <option value="cr">Cr</option>
</select> </select>
</div>
</div> </div>
</div> </div>
</div>
<div class="text-end">
<div class="text-end"> <button type="submit" class="bg-emerald-600 px-3 py-1 text-white shadow-sm hover:bg-emerald-700">Save</button>
<button type="submit" class="btn btn-primary">Save</button> </div>
</div> </form>
</form> </div>
{% endblock %} {% endblock %}