Skip to content
Snippets Groups Projects
Commit 4ce33258 authored by Jens Christian Aanestad's avatar Jens Christian Aanestad
Browse files

Merge branch 'refactor/Configuration' into 'main'

refactor/Tanslated configuration to norwegian

See merge request !103
parents ce9011f9 e3205058
No related branches found
No related tags found
1 merge request!103refactor/Tanslated configuration to norwegian
Pipeline #285302 passed with warnings
......@@ -18,7 +18,7 @@ const props = defineProps({
aria-valuemin="0"
aria-valuemax="100"/>
</div>
<label class="row text-info font-bold display-5">{{ Math.round(props.percentage*100) + '%' }} Completed</label>
<label class="row text-info font-bold display-5">{{ Math.round(props.percentage*100) + '%' }} Fullført</label>
</div>
</template>
......
......@@ -46,15 +46,22 @@ const handleSubmit = async () => {
formRef.value.classList.add("was-validated")
const form = formRef.value;
if (form.checkValidity()) {
errorMsg.value = '';
try {
await AccountControllerService.getAccountsByBban({bban: Number(checkingAccount.value)})
} catch (error) {
errorMsg.value = "Fant ikke forbrukskonto"
return
}
try {
await AccountControllerService.getAccountsByBban({bban: Number(savingsAccount.value)})
useConfigurationStore().setChekingAccountBBAN(Number(checkingAccount.value))
useConfigurationStore().setSavingsAccountBBAN(Number(savingsAccount.value))
await router.push("/commitment")
} catch (error) {
errorMsg.value = handleUnknownError(error)
errorMsg.value = "Fant ikke sparekonto"
return
}
useConfigurationStore().setChekingAccountBBAN(Number(checkingAccount.value))
useConfigurationStore().setSavingsAccountBBAN(Number(savingsAccount.value))
await router.push("/commitment")
}
}
</script>
......@@ -73,7 +80,7 @@ const handleSubmit = async () => {
type="number"
min="10000000000"
max="99999999999"
label="Brukskonto"
label="Forbrukskonto"
placeholder="Skriv inn din brukskonto"
invalid-message="Vennligst skriv inn din brukskonto (11 siffer)"/>
......
......@@ -44,24 +44,24 @@ const handleSubmit = () => {
<div class="container">
<div>
<h3 class="d-flex align-items-center justify-content-center">
How much experience do you have with saving money?
Hvor mye erfaring har du med å spare penger?
</h3>
</div>
<form class="btn-group-vertical" ref="formRef">
<input ref="beginnerRef" type="radio" class="btn-check" name="experience" id="btn-check-outlined" autocomplete="off" required>
<label class="btn btn-outline-primary d-flex align-items-center justify-content-center" for="btn-check-outlined">Beginner</label>
<label class="btn btn-outline-primary d-flex align-items-center justify-content-center" for="btn-check-outlined">Lite</label>
<input ref="someExperienceRef" type="radio" class="btn-check" name="experience" id="btn-check2-outlined" autocomplete="off" required>
<label class="btn btn-outline-primary d-flex align-items-center justify-content-center" for="btn-check2-outlined">Some experience</label>
<label class="btn btn-outline-primary d-flex align-items-center justify-content-center" for="btn-check2-outlined">Noe</label>
<input ref="expertRef" type="radio" class="btn-check" name="experience" id="btn-check3-outlined" autocomplete="off" required>
<label class="btn btn-outline-primary d-flex align-items-center justify-content-center" for="btn-check3-outlined">Expert</label>
<label class="btn btn-outline-primary d-flex align-items-center justify-content-center" for="btn-check3-outlined">Ekspert</label>
</form>
<p class="text-danger">{{ errorMsg }}</p>
<div class="confirm-button-container">
<BaseButton id="confirmButton" @click="handleSubmit" button-text="Continue"/>
<BaseButton id="confirmButton" @click="handleSubmit" button-text="Fortsett"/>
</div>
</div>
</template>
......
......@@ -101,10 +101,10 @@ const handleSumInputEvent = (newSum: number) => {
<div class="container">
<div>
<h3 class="d-flex align-items-center justify-content-center">
Now it remains only one step
Nå gjenstår det kun ett steg
</h3>
<h5 class="d-flex align-items-center justify-content-center">
Create your first saving goal
Lag ditt første sparemål
</h5>
</div>
......@@ -113,15 +113,15 @@ const handleSumInputEvent = (newSum: number) => {
@input-change-event="handleTitleInputEvent"
id="titleInput"
input-id="title"
label="Title"
placeholder="Enter the title of the saving goal"/>
label="Navn"
placeholder="Oppgi navnet på sparemålet"/>
<div>
<label for="description">Description</label>
<textarea v-model="descriptionRef"
type="text"
maxlength="150"
class="form-control"
placeholder="Enter description of the saving goal here (optional)"
placeholder="Oppgi en beskrivelse på sparemålet her (valgfritt)"
id="description"/>
</div>
<BaseInput :model-value="dateRef"
......@@ -130,19 +130,19 @@ const handleSumInputEvent = (newSum: number) => {
input-id="dueDate"
type="date"
:min="getTodayDate()"
label="Due date"/>
label="Utløpsdato"/>
<BaseInput :model-value="sumRef"
@input-change-event="handleSumInputEvent"
id="sumToSaveInput"
input-id="sumToSpareInput"
type="number"
label="Sum to save"
label="Sum"
min="0"
placeholder="Enter the sum you would like to spare (kr)"/>
placeholder="Oppgi summen du ønsker å spare (kr)"/>
</form>
<div class="confirm-button-container">
<BaseButton id="confirmButton" @click="handleSubmit" button-text="Continue"></BaseButton>
<BaseButton id="confirmButton" @click="handleSubmit" button-text="Fortsett"></BaseButton>
</div>
<div style="color: red">
{{ errorMessage }}
......@@ -153,6 +153,10 @@ const handleSumInputEvent = (newSum: number) => {
<style scoped>
#titleInput, #description, #dueDateInput, #sumToSaveInput {
margin-top: 5px;
}
#description {
resize: none;
height: auto;
......
......@@ -21,6 +21,28 @@ let errorMsg = ref('')
// Represents a list of available challenges.
const challenges: string[] = ['NO_COFFEE' , 'NO_CAR' , 'SHORTER_SHOWER' , 'SPEND_LESS_ON_FOOD' , 'BUY_USED_CLOTHES' , 'LESS_SHOPPING' , 'DROP_SUBSCRIPTION' , 'SELL_SOMETHING' , 'BUY_USED' , 'EAT_PACKED_LUNCH' , 'STOP_SHOPPING' , 'ZERO_SPENDING' , 'RENT_YOUR_STUFF' , 'MEATLESS' , 'SCREEN_TIME_LIMIT' , 'UNPLUGGED_ENTERTAINMENT']
/**
* Mapping between challenge enum and norwegian translation.
*/
const challengeMapper: any = {
"NO_COFFEE": "Droppe kaffe",
"NO_CAR": "Droppe bil",
"SHORTER_SHOWER": "Ta kortere dusjer",
"SPEND_LESS_ON_FOOD": "Bruk mindre penger på mat",
"BUY_USED_CLOTHES": "Kjøp brukte klær",
"LESS_SHOPPING": "Handle mindre",
"DROP_SUBSCRIPTION": "Si opp abonnement",
"SELL_SOMETHING": "Selg noe",
"BUY_USED": "Kjøp brukt",
"EAT_PACKED_LUNCH": "Lag niste",
"STOP_SHOPPING": "Shoppestopp",
"ZERO_SPENDING": "Null-forbruk",
"RENT_YOUR_STUFF": "Lei ut ting",
"MEATLESS": "Kjøttfritt",
"SCREEN_TIME_LIMIT": "Skjerm tidsgrense",
"UNPLUGGED_ENTERTAINMENT": "Strømløs underholdning"
}
/**
* Handles the event when a challenge is selected or deselected.
* @param {Array} value - An array containing the challenge value and its checked status.
......@@ -39,16 +61,6 @@ const onChangedChallengeEvent = (value: never) => {
console.log(chosenChallenges.value)
}
/**
* Converts the given enum value to a formatted text representation.
*
* @param {string} enumValue the enum value to be converted
* @return {string} The formatted text representation of the enum value
*/
const convertEnumToText = (enumValue: String): string => {
return enumValue.charAt(0).toUpperCase() + enumValue.slice(1).replace(/_/g, ' ').toLowerCase();
}
/**
* Retrieves user configuration and signup information, sends a signup request to the backend.
*
......@@ -121,7 +133,7 @@ const handleSubmit = async () => {
<div class="challenge-container row justify-content-center">
<ChallangeCheckBox v-for="(item, index) in challenges"
:id="String(index)"
:text="convertEnumToText(item)"
:text="challengeMapper[item]"
:enum-value="item"
@challengeChangedEvent="onChangedChallengeEvent"/>
</div>
......@@ -129,7 +141,7 @@ const handleSubmit = async () => {
<p class="text-danger">{{ errorMsg }}</p>
<div class="confirm-button-container">
<BaseButton id="confirmButton" @click="handleSubmit" button-text="Continue"/>
<BaseButton id="confirmButton" @click="handleSubmit" button-text="Fortsett"/>
</div>
</div>
</template>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment