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({ ...@@ -18,7 +18,7 @@ const props = defineProps({
aria-valuemin="0" aria-valuemin="0"
aria-valuemax="100"/> aria-valuemax="100"/>
</div> </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> </div>
</template> </template>
......
...@@ -46,15 +46,22 @@ const handleSubmit = async () => { ...@@ -46,15 +46,22 @@ const handleSubmit = async () => {
formRef.value.classList.add("was-validated") formRef.value.classList.add("was-validated")
const form = formRef.value; const form = formRef.value;
if (form.checkValidity()) { if (form.checkValidity()) {
errorMsg.value = '';
try { try {
await AccountControllerService.getAccountsByBban({bban: Number(checkingAccount.value)}) await AccountControllerService.getAccountsByBban({bban: Number(checkingAccount.value)})
} catch (error) {
errorMsg.value = "Fant ikke forbrukskonto"
return
}
try {
await AccountControllerService.getAccountsByBban({bban: Number(savingsAccount.value)}) await AccountControllerService.getAccountsByBban({bban: Number(savingsAccount.value)})
} catch (error) {
errorMsg.value = "Fant ikke sparekonto"
return
}
useConfigurationStore().setChekingAccountBBAN(Number(checkingAccount.value)) useConfigurationStore().setChekingAccountBBAN(Number(checkingAccount.value))
useConfigurationStore().setSavingsAccountBBAN(Number(savingsAccount.value)) useConfigurationStore().setSavingsAccountBBAN(Number(savingsAccount.value))
await router.push("/commitment") await router.push("/commitment")
} catch (error) {
errorMsg.value = handleUnknownError(error)
}
} }
} }
</script> </script>
...@@ -73,7 +80,7 @@ const handleSubmit = async () => { ...@@ -73,7 +80,7 @@ const handleSubmit = async () => {
type="number" type="number"
min="10000000000" min="10000000000"
max="99999999999" max="99999999999"
label="Brukskonto" label="Forbrukskonto"
placeholder="Skriv inn din brukskonto" placeholder="Skriv inn din brukskonto"
invalid-message="Vennligst skriv inn din brukskonto (11 siffer)"/> invalid-message="Vennligst skriv inn din brukskonto (11 siffer)"/>
......
...@@ -44,24 +44,24 @@ const handleSubmit = () => { ...@@ -44,24 +44,24 @@ const handleSubmit = () => {
<div class="container"> <div class="container">
<div> <div>
<h3 class="d-flex align-items-center justify-content-center"> <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> </h3>
</div> </div>
<form class="btn-group-vertical" ref="formRef"> <form class="btn-group-vertical" ref="formRef">
<input ref="beginnerRef" type="radio" class="btn-check" name="experience" id="btn-check-outlined" autocomplete="off" required> <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> <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> <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> </form>
<p class="text-danger">{{ errorMsg }}</p> <p class="text-danger">{{ errorMsg }}</p>
<div class="confirm-button-container"> <div class="confirm-button-container">
<BaseButton id="confirmButton" @click="handleSubmit" button-text="Continue"/> <BaseButton id="confirmButton" @click="handleSubmit" button-text="Fortsett"/>
</div> </div>
</div> </div>
</template> </template>
......
...@@ -101,10 +101,10 @@ const handleSumInputEvent = (newSum: number) => { ...@@ -101,10 +101,10 @@ const handleSumInputEvent = (newSum: number) => {
<div class="container"> <div class="container">
<div> <div>
<h3 class="d-flex align-items-center justify-content-center"> <h3 class="d-flex align-items-center justify-content-center">
Now it remains only one step Nå gjenstår det kun ett steg
</h3> </h3>
<h5 class="d-flex align-items-center justify-content-center"> <h5 class="d-flex align-items-center justify-content-center">
Create your first saving goal Lag ditt første sparemål
</h5> </h5>
</div> </div>
...@@ -113,15 +113,15 @@ const handleSumInputEvent = (newSum: number) => { ...@@ -113,15 +113,15 @@ const handleSumInputEvent = (newSum: number) => {
@input-change-event="handleTitleInputEvent" @input-change-event="handleTitleInputEvent"
id="titleInput" id="titleInput"
input-id="title" input-id="title"
label="Title" label="Navn"
placeholder="Enter the title of the saving goal"/> placeholder="Oppgi navnet på sparemålet"/>
<div> <div>
<label for="description">Description</label> <label for="description">Description</label>
<textarea v-model="descriptionRef" <textarea v-model="descriptionRef"
type="text" type="text"
maxlength="150" maxlength="150"
class="form-control" class="form-control"
placeholder="Enter description of the saving goal here (optional)" placeholder="Oppgi en beskrivelse på sparemålet her (valgfritt)"
id="description"/> id="description"/>
</div> </div>
<BaseInput :model-value="dateRef" <BaseInput :model-value="dateRef"
...@@ -130,19 +130,19 @@ const handleSumInputEvent = (newSum: number) => { ...@@ -130,19 +130,19 @@ const handleSumInputEvent = (newSum: number) => {
input-id="dueDate" input-id="dueDate"
type="date" type="date"
:min="getTodayDate()" :min="getTodayDate()"
label="Due date"/> label="Utløpsdato"/>
<BaseInput :model-value="sumRef" <BaseInput :model-value="sumRef"
@input-change-event="handleSumInputEvent" @input-change-event="handleSumInputEvent"
id="sumToSaveInput" id="sumToSaveInput"
input-id="sumToSpareInput" input-id="sumToSpareInput"
type="number" type="number"
label="Sum to save" label="Sum"
min="0" min="0"
placeholder="Enter the sum you would like to spare (kr)"/> placeholder="Oppgi summen du ønsker å spare (kr)"/>
</form> </form>
<div class="confirm-button-container"> <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>
<div style="color: red"> <div style="color: red">
{{ errorMessage }} {{ errorMessage }}
...@@ -153,6 +153,10 @@ const handleSumInputEvent = (newSum: number) => { ...@@ -153,6 +153,10 @@ const handleSumInputEvent = (newSum: number) => {
<style scoped> <style scoped>
#titleInput, #description, #dueDateInput, #sumToSaveInput {
margin-top: 5px;
}
#description { #description {
resize: none; resize: none;
height: auto; height: auto;
......
...@@ -21,6 +21,28 @@ let errorMsg = ref('') ...@@ -21,6 +21,28 @@ let errorMsg = ref('')
// Represents a list of available challenges. // 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'] 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. * Handles the event when a challenge is selected or deselected.
* @param {Array} value - An array containing the challenge value and its checked status. * @param {Array} value - An array containing the challenge value and its checked status.
...@@ -39,16 +61,6 @@ const onChangedChallengeEvent = (value: never) => { ...@@ -39,16 +61,6 @@ const onChangedChallengeEvent = (value: never) => {
console.log(chosenChallenges.value) 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. * Retrieves user configuration and signup information, sends a signup request to the backend.
* *
...@@ -121,7 +133,7 @@ const handleSubmit = async () => { ...@@ -121,7 +133,7 @@ const handleSubmit = async () => {
<div class="challenge-container row justify-content-center"> <div class="challenge-container row justify-content-center">
<ChallangeCheckBox v-for="(item, index) in challenges" <ChallangeCheckBox v-for="(item, index) in challenges"
:id="String(index)" :id="String(index)"
:text="convertEnumToText(item)" :text="challengeMapper[item]"
:enum-value="item" :enum-value="item"
@challengeChangedEvent="onChangedChallengeEvent"/> @challengeChangedEvent="onChangedChallengeEvent"/>
</div> </div>
...@@ -129,7 +141,7 @@ const handleSubmit = async () => { ...@@ -129,7 +141,7 @@ const handleSubmit = async () => {
<p class="text-danger">{{ errorMsg }}</p> <p class="text-danger">{{ errorMsg }}</p>
<div class="confirm-button-container"> <div class="confirm-button-container">
<BaseButton id="confirmButton" @click="handleSubmit" button-text="Continue"/> <BaseButton id="confirmButton" @click="handleSubmit" button-text="Fortsett"/>
</div> </div>
</div> </div>
</template> </template>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment