{#  DrCr: Web-based double-entry bookkeeping framework
    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
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
#}

{% extends 'base.html' %}
{% block title %}Multiple CGT adjustments{% endblock %}

{% block content %}
	<div class="max-w-lg mx-auto px-4">
		<h1 class="page-heading mb-4">
			Multiple CGT adjustments
		</h1>
		
		<form method="POST">
			<div class="grid grid-cols-[max-content_1fr] space-y-2 mb-4 items-baseline">
				<h2 class="col-span-2 text-xl text-gray-900 font-semibold">CGT assets</h2>
				
				<label for="account" class="block text-gray-900 pr-4">Account</label>
				<div class="relative combobox">
					<input type="text" class="bordered-field peer" name="account" id="account" value="{{ account or '' }}" autocomplete="off">
					{% include 'components/accounts_combobox_inner.html' %}
				</div>
				<label for="commodity" class="block text-gray-900 pr-4">Commodity</label>
				<div>
					<input type="text" class="bordered-field" 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="bordered-field" 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="bordered-field" 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">{{ reporting_commodity }}</span>
					</div>
					<input type="number" class="bordered-field pl-7" name="cost_adjustment" id="cost_adjustment" step="0.01" value="{{ cost_adjustment or '' }}" placeholder="0.00">
				</div>
			</div>
			
			<div class="text-end">
				<button type="submit" class="btn-primary">Save</button>
			</div>
		</form>
	</div>
{% endblock %}

{% block scripts %}
	<script src="{{ url_for('static', filename='js/combobox.js') }}"></script>
{% endblock %}