✨ new form-options
Co-authored-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
parent
71354a1827
commit
a6929b34a8
3 changed files with 23 additions and 8 deletions
|
@ -6,10 +6,14 @@ export const postUserformData = (
|
|||
age: string,
|
||||
education: string,
|
||||
healthcare_personnel: string,
|
||||
gender: string
|
||||
gender: string,
|
||||
has_answered_before: string,
|
||||
county: string,
|
||||
submit_date: string
|
||||
): Promise<postUserformDataReponse> => {
|
||||
let url = "http://localhost:8080/submituserform";
|
||||
let personnel = healthcare_personnel == "Ja" ? true : false;
|
||||
let answered_before = has_answered_before == "Ja" ? true : false;
|
||||
|
||||
const response = fetch(url, {
|
||||
method: "POST",
|
||||
|
@ -18,6 +22,9 @@ export const postUserformData = (
|
|||
education: education,
|
||||
healthcare_personnel: personnel,
|
||||
gender: gender,
|
||||
answered_before: answered_before,
|
||||
county: county,
|
||||
submit_date: submit_date,
|
||||
}),
|
||||
})
|
||||
.then((response) => {
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
<li><strong>Empati:</strong> Evnen til å oppdage og erkjenne andres følelser og tanker.</li>
|
||||
<li><strong>Kunnskap:</strong> Nøyaktighet og relevans av den medisinske informasjonen gitt.</li>
|
||||
<li><strong>Hjelpsomhet:</strong> Evnen til å gi nyttig og praktisk råd eller støtte.</li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="flex justify-center items-center w-2/5">
|
||||
<a href="/userform">
|
||||
|
@ -36,8 +37,8 @@
|
|||
margin-left: 2rem;
|
||||
font-size: large;
|
||||
}
|
||||
p {
|
||||
font-size: large;
|
||||
p, li{
|
||||
font-size: larger;
|
||||
}
|
||||
button {
|
||||
font-size: large;
|
||||
|
|
|
@ -11,12 +11,17 @@
|
|||
let education: string = "PhD"
|
||||
let healthcare_personnel: string = "Ja"
|
||||
let gender: string = "Mann"
|
||||
let has_answered_before: string = "Nei"
|
||||
let county: string = "Vestland"
|
||||
|
||||
let firstUserQuestion: number = 0
|
||||
|
||||
const handleUserformSubmit = async (age: string, education: string, healthcare_personnel: string, gender: string) => {
|
||||
const handleUserformSubmit = async (age: string, education: string, healthcare_personnel: string, gender: string, has_answered_before: string, county: string) => {
|
||||
localStorage.clear()
|
||||
const response = await postUserformData(age, education, healthcare_personnel, gender)
|
||||
|
||||
const submitDate = new Date().toISOString()
|
||||
|
||||
const response = await postUserformData(age, education, healthcare_personnel, gender, has_answered_before, county, submitDate)
|
||||
const userQuestions = await getUserQuestions(response.respondentID)
|
||||
|
||||
goto("form/0")
|
||||
|
@ -36,12 +41,14 @@
|
|||
<div class="flex flex-col justify-start items-center w-2/4">
|
||||
<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={county} on:update={(e) => county = e.detail} inputType="select" label="Fylke" options={["Vestland", "Rogaland", "Møre og Romsdal", "Oslo", "Viken", "Nordland", "Trøndelag", "Innlandet", "Troms og Finnmark", "Vestfold og Telemark", "Agder"]}/>
|
||||
<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"]}/>
|
||||
<UserFormInput formData={has_answered_before} on:update={(e) => has_answered_before = e.detail} inputType="radio" label="Jeg har svart på denne undersøkelsen tidligere" options={["Ja", "Nei"]}/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-center items-center gap-8 text-primary font-bold">
|
||||
<ButtonComponent text="Start undersøkelse" filled={true} onclick={() => handleUserformSubmit(age, education, healthcare_personnel, gender)} />
|
||||
<ButtonComponent text="Start undersøkelse" filled={true} onclick={() => handleUserformSubmit(age, education, healthcare_personnel, gender, has_answered_before, county)} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -56,6 +63,6 @@
|
|||
font-size: large;
|
||||
}
|
||||
p {
|
||||
font-size: large;
|
||||
font-size: larger;
|
||||
}
|
||||
</style>
|
Reference in a new issue