<script lang="ts">
	import { enhance } from '$app/forms';
	import type { PageProps } from './$types';

	let { data, form }: PageProps = $props();
</script>

<div class="base-container">
	<div class="content">
		<div class="elevated separator-borders m-4 rounded">
			<div class="bottom-border flex place-content-between">
				<div class="p-3 font-semibold">Create new company</div>
			</div>
			<form autocomplete="off" class="px-4" method="POST" use:enhance>
				<div class="mt-4 text-sm font-semibold">
					Name <span class="text-red-500">*</span>
					<input
						class="w-full rounded font-normal"
						id="name"
						name="name"
						placeholder="Name"
						required
						type="text"
					/>
				</div>
				<div class="mt-4 text-sm font-semibold">
					Description <span class="text-red-500">*</span>
					<textarea
						class="w-full rounded font-normal"
						id="description"
						name="description"
						placeholder="Description"
						required
						rows="4"
					></textarea>
				</div>
				<div class="mt-4 text-sm font-semibold">
					Website <span class="text-red-500">*</span>
					<input
						class="w-full rounded font-normal"
						id="website"
						name="website"
						placeholder="Website"
						required
						type="text"
					/>
				</div>

				{#if form?.errorMessage}
					<div class="mb-2 text-red-500">{form.errorMessage}</div>
				{/if}
				<button
					class="dull-primary-bg-color mb-4 mt-6 rounded px-2 py-1"
					formaction="?/submit"
					type="submit"
					>Create company
				</button>
			</form>
		</div>
	</div>
</div>
