package views

templ LoginPage(errorMsg string) {
	@Layout("Anmelden") {
		<div class="min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8">
			<div class="max-w-md w-full space-y-8">
				<div>
					<h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900">
						Bei WhereIsMyMoney anmelden
					</h2>
					<p class="mt-2 text-center text-sm text-gray-600">
						Oder 
						<a href="/register" class="font-medium text-indigo-600 hover:text-indigo-500">
							neues Konto erstellen
						</a>
					</p>
				</div>
				
				if errorMsg != "" {
					<div class="rounded-md bg-red-50 p-4">
						<div class="flex">
							<div class="flex-shrink-0">
								<svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
									<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" />
								</svg>
							</div>
							<div class="ml-3">
								<h3 class="text-sm font-medium text-red-800">
									{ errorMsg }
								</h3>
							</div>
						</div>
					</div>
				}
				
				<form class="mt-8 space-y-6" action="/login" method="POST">
					<div class="rounded-md shadow-sm -space-y-px">
						<div>
							<label for="email" class="sr-only">E-Mail-Adresse</label>
							<input id="email" name="email" type="email" required class="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-t-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm" placeholder="E-Mail-Adresse"/>
						</div>
						<div>
							<label for="password" class="sr-only">Passwort</label>
							<input id="password" name="password" type="password" required class="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm" placeholder="Passwort"/>
						</div>
					</div>

					<div class="flex items-center justify-between">
						<div class="flex items-center">
							<input id="remember_me" name="remember_me" type="checkbox" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded"/>
							<label for="remember_me" class="ml-2 block text-sm text-gray-900">
								Angemeldet bleiben
							</label>
						</div>
					</div>

					<div>
						<button type="submit" class="group relative w-full flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
							Anmelden
						</button>
					</div>
				</form>
			</div>
		</div>
	}
}
