diff --git a/src/components/Configuration/ConfigurationProgressBar.vue b/src/components/Configuration/ConfigurationProgressBar.vue index 4b014e3a40da0bf01680831f2a9382738739c5a2..3f846982e581645e15c00c0cd4a46f4287df07d3 100644 --- a/src/components/Configuration/ConfigurationProgressBar.vue +++ b/src/components/Configuration/ConfigurationProgressBar.vue @@ -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> diff --git a/src/components/Configuration/ConfigurationSteps/BankAccount.vue b/src/components/Configuration/ConfigurationSteps/BankAccount.vue index ed454804e18f437a9d0f8be2bcc51797088e9bff..7c25f6068f7067ba91f3504d4d26aa8fbcb535f3 100644 --- a/src/components/Configuration/ConfigurationSteps/BankAccount.vue +++ b/src/components/Configuration/ConfigurationSteps/BankAccount.vue @@ -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)"/> diff --git a/src/components/Configuration/ConfigurationSteps/ConfigurationExperience.vue b/src/components/Configuration/ConfigurationSteps/ConfigurationExperience.vue index 2118af6a65afe5d0c8e6abe29f990db7416a595f..a481e313db0fbd72e911e898fe8cf2338f1f382a 100644 --- a/src/components/Configuration/ConfigurationSteps/ConfigurationExperience.vue +++ b/src/components/Configuration/ConfigurationSteps/ConfigurationExperience.vue @@ -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> diff --git a/src/components/Configuration/ConfigurationSteps/ConfigurationSavingGoal.vue b/src/components/Configuration/ConfigurationSteps/ConfigurationSavingGoal.vue index 57abfe4a6e5729ebee3361f767098daaf13070bc..66e57f6eff167de937da6d2091ac47104d78b6f8 100644 --- a/src/components/Configuration/ConfigurationSteps/ConfigurationSavingGoal.vue +++ b/src/components/Configuration/ConfigurationSteps/ConfigurationSavingGoal.vue @@ -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; diff --git a/src/components/Configuration/ConfigurationSteps/SuitableChallenges.vue b/src/components/Configuration/ConfigurationSteps/SuitableChallenges.vue index c852366d7968ba196afc7a7d8cbdf6b94a033bda..e7ee258697099a7d81aeb0b2e63a9697461cd493 100644 --- a/src/components/Configuration/ConfigurationSteps/SuitableChallenges.vue +++ b/src/components/Configuration/ConfigurationSteps/SuitableChallenges.vue @@ -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>