mirror of
https://github.com/gosticks/complai.git
synced 2025-10-16 11:45:36 +00:00
feat: add simple register validation
This commit is contained in:
parent
8c1115dfe7
commit
0977bc9ca6
@ -18,6 +18,7 @@
|
||||
let nace: NaceEntry | undefined = undefined;
|
||||
let region: string | undefined = undefined;
|
||||
let size: string | undefined = undefined;
|
||||
let companyName: string | undefined = undefined;
|
||||
|
||||
let currentStep: number = 1;
|
||||
|
||||
@ -56,7 +57,8 @@
|
||||
const payload = {
|
||||
nace,
|
||||
region,
|
||||
size
|
||||
size,
|
||||
companyName
|
||||
};
|
||||
|
||||
// TODO: add correct api response here
|
||||
@ -117,6 +119,12 @@
|
||||
{:else if currentStep === 4}
|
||||
<div in:fly={{ x: -50, duration: 300, delay: 300 }} out:fly={{ x: 50, duration: 300 }}>
|
||||
<h2>Further company Information</h2>
|
||||
<label>
|
||||
<span>Company Name</span>
|
||||
<input type="text" placeholder="Company Name" bind:value={companyName} />
|
||||
</label>
|
||||
<br />
|
||||
<br />
|
||||
<Notification>
|
||||
<h3>This step is still Work in Progress</h3>
|
||||
<p>We will be gathering further location and company present infos here.</p>
|
||||
|
||||
52
frontend/src/routes/dashboard/+page.svelte
Normal file
52
frontend/src/routes/dashboard/+page.svelte
Normal file
@ -0,0 +1,52 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/Button.svelte';
|
||||
import Card from '$lib/components/Card.svelte';
|
||||
import Container from '$lib/components/Container.svelte';
|
||||
import type { NaceEntry } from '$lib/components/steps/types';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
type Company = {
|
||||
name: string;
|
||||
nace: NaceEntry;
|
||||
};
|
||||
|
||||
let registeredCompanies: Company[] = [];
|
||||
let updateFinished = true;
|
||||
|
||||
const updateCompanyData = async () => {
|
||||
if (!updateFinished) {
|
||||
return;
|
||||
}
|
||||
const payload = {};
|
||||
// TODO: adjust URL
|
||||
const resp = await fetch('/api/interpretLaw');
|
||||
|
||||
updateFinished = true;
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
updateCompanyData().finally(() => {
|
||||
updateFinished = true;
|
||||
});
|
||||
const interval = setInterval(updateCompanyData, 1000);
|
||||
|
||||
return () => {
|
||||
clearInterval(interval);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
<section>
|
||||
<br />
|
||||
<h1>Dashboard</h1>
|
||||
{#if registeredCompanies.length === 0}
|
||||
<Card
|
||||
><h3>Create your first company</h3>
|
||||
<p>Add a new company in 4 simple steps.</p></Card
|
||||
>
|
||||
{/if}
|
||||
{#each registeredCompanies as { nace, name }}{/each}
|
||||
<a href="/create"><Button>Add Company</Button></a>
|
||||
</section>
|
||||
</Container>
|
||||
@ -1,10 +1,22 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import Button from '$lib/components/Button.svelte';
|
||||
import Card from '$lib/components/Card.svelte';
|
||||
import Container from '$lib/components/Container.svelte';
|
||||
import Input from '$lib/components/Input.svelte';
|
||||
import Liquid from '$lib/components/Liquid.svelte';
|
||||
import Notification from '$lib/components/Notification.svelte';
|
||||
|
||||
let email: string | undefined = undefined;
|
||||
let code: string | undefined = undefined;
|
||||
|
||||
const onRegister = (evt: MouseEvent) => {
|
||||
if (!email || !code) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
return;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<Container centered>
|
||||
@ -17,9 +29,9 @@
|
||||
<form>
|
||||
<section>
|
||||
<h2>Register</h2>
|
||||
<input placeholder="E-Mail" />
|
||||
<input placeholder="Einladungs-Code" type="password" />
|
||||
<a href="/create"><Button>Register</Button></a>
|
||||
<input placeholder="E-Mail" bind:value={email} />
|
||||
<input placeholder="Einladungs-Code" type="password" bind:value={code} />
|
||||
<a href="/dashboard" on:click={onRegister}><Button>Register</Button></a>
|
||||
</section>
|
||||
</form>
|
||||
</Card>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user