{#  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 %}Import statement{% endblock %}

{% block content %}
	<h1 class="page-heading mb-4">
		Import statement
	</h1>
	
	<h2 class="text-xl text-gray-900 font-semibold mb-1">OFX 1.x</h2>
	
	<form method="POST" enctype="multipart/form-data">
		<input type="hidden" name="format" value="ofx1">
		<div class="flex">
			<div class="grow mr-2 relative combobox">
				<input type="text" class="bordered-field peer" name="source-account" placeholder="Source account" autocomplete="off">
				{% include 'components/accounts_combobox_inner.html' %}
			</div>
			<div class="flex">
			</div>
			<div class="flex grow mr-2">
				<label for="file_ofx1" class="btn-primary bg-gray-600 hover:bg-gray-700">Browse</label>
				<input type="file" class="file:hidden block w-full border-0 py-1 px-2 text-gray-500 shadow-sm ring-1 ring-inset ring-gray-300" name="file" id="file_ofx1" accept=".ofx">
			</div>
			<div class="mr-2">
				<button type="submit" name="action" value="preview" class="btn-secondary">Preview</button>
			</div>
			<div>
				<button type="submit" name="action" value="import" class="btn-primary">Import</button>
			</div>
		</div>
	</form>
	
	<h2 class="text-xl text-gray-900 font-semibold mt-4 mb-1">OFX 2.x</h2>
	
	<form method="POST" enctype="multipart/form-data">
		<input type="hidden" name="format" value="ofx2">
		<div class="flex">
			<div class="grow mr-2 relative combobox">
				<input type="text" class="bordered-field peer" name="source-account" placeholder="Source account" autocomplete="off">
				{% include 'components/accounts_combobox_inner.html' %}
			</div>
			<div class="flex">
			</div>
			<div class="flex grow mr-2">
				<label for="file_ofx2" class="btn-primary bg-gray-600 hover:bg-gray-700">Browse</label>
				<input type="file" class="file:hidden block w-full border-0 py-1 px-2 text-gray-500 shadow-sm ring-1 ring-inset ring-gray-300" name="file" id="file_ofx2" accept=".ofx">
			</div>
			<div class="mr-2">
				<button type="submit" name="action" value="preview" class="btn-secondary">Preview</button>
			</div>
			<div>
				<button type="submit" name="action" value="import" class="btn-primary">Import</button>
			</div>
		</div>
	</form>
{% endblock %}

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