<script lang="ts">
	import AddProcess from '$lib/icons/Add-Process.svelte';
	import FileRect from '$lib/icons/File-rect.svelte';
	import ListIcon from '$lib/icons/List-icon.svelte';
	import Button from '$lib/components/Button.svelte';
	import ArrowRight from '$lib/icons/Arrow-right.svelte';

	import { ROUTE_NAMES } from '../index.js';

	export let data;
	export let form;
	export let outline = true;
</script>

{#if data.user?.admin}
<div
	class=" inset-x-0 top-0 -z-10 h-full flex items-center justify-center bg-white shadow-lg ring-1 ring-gray-900/5"
>
	<div class="mx-auto flex justify-center max-w-7xl py-10 px-8 w-full">
			<div class="group relative rounded-lg p-6 text-sm leading-6 hover:bg-gray-50 w-1/4">
				<div
					class="flex h-11 w-11 items-center justify-center rounded-lg bg-gray-50 group-hover:bg-white"
				>
					<ListIcon class=" group-hover:text-indigo-600" />
				</div>
				<a href="{ROUTE_NAMES.LIST}" class="mt-6 block font-semibold text-gray-900">
					Vorgänge
					<span class="absolute inset-0"></span>
				</a>
				<p class="mt-1 text-gray-600">
					Verschaffe Dir einen Überblick über alle gespeicherten Tatorte.
				</p>
			</div>
		<div class="group relative rounded-lg p-6 text-sm leading-6 hover:bg-gray-50 w-1/4">
			<div
				class="flex h-11 w-11 items-center justify-center rounded-lg bg-gray-50 group-hover:bg-white"
			>
				<FileRect class=" group-hover:text-indigo-600" {outline} />
			</div>
			<a href="{ROUTE_NAMES.USERMGMT}" class="mt-6 block font-semibold text-gray-900">
				Benutzerverwaltung
				<span class="absolute inset-0"></span>
			</a>
			<p class="mt-1 text-gray-600">Füge neue Benutzer hinzu oder entferne welche.</p>
		</div>
	</div>
</div>

{:else}

<div class="flex min-h-full flex-col justify-center px-6 py-12 lg:px-8">
	<div class="sm:mx-auto sm:w-full sm:max-w-sm">
		<img class="mx-auto h-10 w-auto" src="/Landeswappen_NI.svg" alt="Landeswappen Niedersachsen" />

		<h2 class="mt-10 text-center text-2xl font-bold leading-9 tracking-tight text-gray-900">
			Willkommen beim 3D Tatort
		</h2>
	</div>
	<div class="w-full max-w-sm mx-auto">
		<div class="relative mt-5 bg-gray-50 rounded-xl shadow-xl p-3 pt-1">
			<div class="mt-10">

<form action="{ROUTE_NAMES.LOGIN}" method="POST">
						<div>
							<label for="user" class="text-sm font-medium leading-6 text-gray-900">Name</label>
							<div class="mt-2">
								<input
									id="user"
									name="user"
									type="text"
									autocomplete="email"
									required
									class="rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
								/>
							</div>
						</div>

						<div>
							<label for="password" class="block text-sm font-medium leading-6 text-gray-900"
								>Passwort</label
							>
							<div class="mt-2">
								<input
									id="password"
									name="password"
									type="password"
									autocomplete="current-password"
									required
									class="block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6"
								/>
							</div>
						</div>
						{#if form?.incorrect}
							<p class="block text-sm leading-6 text-red-900 mt-2">{form.message}</p>
						{/if}
						<div class="flex justify-end">
							<Button type="submit" class="mt-5">Anmelden</Button>
						</div>
					</form>
			</div>
		</div>
	</div>
</div>

{/if}

<style>
</style>

