Make period start/begin date, etc. interchangeable in home page input sync

This commit is contained in:
RunasSudo 2020-03-23 00:44:32 +11:00
parent c5a34d8559
commit 74313108ed
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -24,47 +24,47 @@
<ul>
<li><form action="{{ url_for('trial') }}">
<button type="submit">Trial balance</button>
<label>Date: <input name="date" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
<label>Period start: <input name="pstart" value="{{ pstart.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
<label>Compare <input name="compare" value="0" style="width: 2em;" oninput="txtc(this)"> periods</label>
<label><input name="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>
<label>Date: <input name="date" data-inputgroup="date" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
<label>Period start: <input name="pstart" data-inputgroup="pstart" value="{{ pstart.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
<label>Compare <input name="compare" data-inputgroup="compare" value="0" style="width: 2em;" oninput="txtc(this)"> periods</label>
<label><input name="cash" data-inputgroup="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>
</form></li>
<li><form action="{{ url_for('balance') }}">
<button type="submit">Balance sheet</button>
<label>Date: <input name="date" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
<label>Period start: <input name="pstart" value="{{ pstart.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
<label>Compare <input name="compare" value="0" style="width: 2em;" oninput="txtc(this)"> periods</label>
<label><input name="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>
<label>Date: <input name="date" data-inputgroup="date" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
<label>Period start: <input name="pstart" data-inputgroup="pstart" value="{{ pstart.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
<label>Compare <input name="compare" data-inputgroup="compare" value="0" style="width: 2em;" oninput="txtc(this)"> periods</label>
<label><input name="cash" data-inputgroup="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>
</form></li>
<li><form action="{{ url_for('pandl') }}">
<button type="submit">Income statement</button>
<label>Begin date: <input name="date_beg" value="{{ pstart.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
<label>End date: <input name="date_end" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
<label>Compare <input name="compare" value="0" style="width: 2em;" oninput="txtc(this)"> periods</label>
<label><input name="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>
<label>Begin date: <input name="date_beg" data-inputgroup="pstart" value="{{ pstart.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
<label>End date: <input name="date_end" data-inputgroup="date" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
<label>Compare <input name="compare" data-inputgroup="compare" value="0" style="width: 2em;" oninput="txtc(this)"> periods</label>
<label><input name="cash" data-inputgroup="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>
</form></li>
<li><form action="{{ url_for('transactions') }}">
<button type="submit">General ledger</button>
<label>Date: <input name="date" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
<label>Date: <input name="date" data-inputgroup="date" value="{{ date.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
<label>Period start: <input name="pstart" value="{{ pstart.strftime('%Y-%m-%d') }}" style="width: 6em;" oninput="txtc(this)"></label>
<label><input name="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>
<label><input name="cash" data-inputgroup="cash" type="checkbox" oninput="chbc(this)"> Cash basis</label>
</form></li>
</ul>
<script>
// Called whenever a text input changes - update others to match
function txtc(el) {
for (var e2 of document.querySelectorAll('input[name="' + el.name + '"]')) {
for (var e2 of document.querySelectorAll('input[data-inputgroup="' + el.dataset['inputgroup'] + '"]')) {
e2.value = el.value;
}
}
// Ditto for checkboxes
function chbc(el) {
for (var e2 of document.querySelectorAll('input[name="' + el.name + '"]')) {
for (var e2 of document.querySelectorAll('input[data-inputgroup="' + el.dataset['inputgroup'] + '"]')) {
e2.checked = el.checked;
}
}