2023-12-21 19:31:14 +01:00
< script lang = "ts" >
2023-12-12 19:40:39 +01:00
import UserFormInput from "../../components/userform/UserFormInput.svelte";
import ArrowBack from "../../components/svg/ArrowBack.svelte";
2023-12-14 19:31:08 +01:00
import ButtonComponent from "../../components/userform/inputs/ButtonComponent.svelte";
2024-01-04 18:23:45 +01:00
import { postUserformData } from "../../api/postUserformData";
2024-01-04 19:40:37 +01:00
import { getUserQuestions } from "../../api/getUserQuestions";
import { goto } from "$app/navigation";
2023-12-21 19:31:14 +01:00
let age: string = "18-20"
let education: string = "PhD"
let healthcare_personnel: string = "Ja"
let gender: string = "Mann"
2024-01-04 18:23:45 +01:00
2024-01-04 19:40:37 +01:00
let firstUserQuestion: number = 0
2024-01-04 18:23:45 +01:00
const handleUserformSubmit = async (age: string, education: string, healthcare_personnel: string, gender: string) => {
2024-01-05 18:11:34 +01:00
localStorage.clear()
2024-01-04 18:23:45 +01:00
const response = await postUserformData(age, education, healthcare_personnel, gender)
2024-01-04 19:40:37 +01:00
const userQuestions = await getUserQuestions(response.respondentID)
2024-01-04 19:40:37 +01:00
2024-01-04 19:40:37 +01:00
goto("form/0")
2024-01-04 18:23:45 +01:00
}
2023-12-12 19:40:39 +01:00
< / script >
< div class = "flex flex-col justify-center gap-20 h-full " >
< a class = "ml-32" href = "/" >
< ArrowBack width = "2rem" / >
< / a >
< div class = "flex h-4/5 " >
< div class = "flex flex-col justify-center w-2/4 gap-4 px-32 " >
2023-12-23 17:03:57 +01:00
< h1 class = "text-3xl text-primary font-bold" > Informasjon om deltaker< / h1 >
< p > Til undersøkelsen trenger vi opplysninger om din aldersgruppe, utdanningsgrad, kjønn og bekreftelse på at du er helsepersonell.< / p >
< p > Vi vil igjen minne om at denne undersøkelsen er helt anonym. Se < a href = "/personvern" class = "text-primary font-bold" > Personvern< / a > for mer informasjon.< / p >
2023-12-12 19:40:39 +01:00
< / div >
< div class = "flex flex-col justify-start items-center w-2/4" >
2023-12-21 19:31:14 +01:00
< UserFormInput formData = { age } on:update= {( e ) => age = e . detail } inputType = "radio" label = "Alder" options = {[ "18-20" , "20-30" , "30-40" , "40-50" , "50-60" ]} / >
< UserFormInput formData = { education } on:update= {( e ) => education = e . detail } inputType = "select" label = "Utdanningsgrad" options = {[ "PhD" , "Master" , "Fagbrev" , "Bachelor" ]} / >
< UserFormInput formData = { healthcare_personnel } on:update= {( e ) => healthcare_personnel = e . detail } inputType = "radio" label = "Helsepersonell" options = {[ "Ja" , "Nei" ]} / >
< UserFormInput formData = { gender } on:update= {( e ) => gender = e . detail } inputType = "radio" label = "Kjønn" options = {[ "Mann" , "Kvinne" , "Annet" ]} / >
2023-12-12 19:40:39 +01:00
< / div >
< / div >
< div class = "flex justify-center items-center gap-8 text-primary font-bold" >
2024-01-04 19:40:37 +01:00
< ButtonComponent text = "Start undersøkelse" filled = { true } onclick= {() => handleUserformSubmit ( age , education , healthcare_personnel , gender )} />
2023-12-12 19:40:39 +01:00
< / div >
< / div >
< style lang = "postcss" >
:root {
color: theme(colors.content);
}
li {
list-style-type: disc;
margin-left: 2rem;
font-size: large;
}
p {
font-size: large;
}
< / style >