From 47896444a6a5f71bf726e481675fe9f66eda88bd Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Thu, 4 Jul 2024 17:38:28 +0200 Subject: [PATCH 01/12] Make `ItDatePicker` component --- .../components/onboarding/PersonalAddress.vue | 38 +----------- .../personalProfile/ProfileEdit.vue | 4 ++ client/src/components/ui/ItDatePicker.vue | 59 +++++++++++++++++++ 3 files changed, 65 insertions(+), 36 deletions(-) create mode 100644 client/src/components/ui/ItDatePicker.vue diff --git a/client/src/components/onboarding/PersonalAddress.vue b/client/src/components/onboarding/PersonalAddress.vue index e40dd405..c4fcbeea 100644 --- a/client/src/components/onboarding/PersonalAddress.vue +++ b/client/src/components/onboarding/PersonalAddress.vue @@ -1,10 +1,9 @@ + + + + From d56c346512fb33f889496f6c5df9b678a6de8381 Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Tue, 16 Jul 2024 10:58:58 +0200 Subject: [PATCH 02/12] Add more editable profile fields --- .../personalProfile/ProfileEdit.vue | 48 +++++++++- .../personalProfile/ProfileView.vue | 95 ++++++++++++------- client/src/components/ui/ItDatePicker.vue | 1 + client/src/pages/StyleGuidePage.vue | 9 ++ server/vbv_lernwelt/core/models.py | 3 +- 5 files changed, 121 insertions(+), 35 deletions(-) diff --git a/client/src/components/personalProfile/ProfileEdit.vue b/client/src/components/personalProfile/ProfileEdit.vue index 6a928e1b..e668857a 100644 --- a/client/src/components/personalProfile/ProfileEdit.vue +++ b/client/src/components/personalProfile/ProfileEdit.vue @@ -3,6 +3,8 @@ import { useEntities } from "@/services/entities"; import AvatarImage from "@/components/ui/AvatarImage.vue"; import { ref } from "vue"; import { type User, useUserStore } from "@/stores/user"; +import ItDatePicker from "@/components/ui/ItDatePicker.vue"; +import { normalizeSwissPhoneNumber } from "@/utils/phone"; const emit = defineEmits(["cancel", "save"]); @@ -26,6 +28,7 @@ const formData = ref({ birth_date: user.birth_date, organisation: user.organisation, + organisation_detail_name: user.organisation_detail_name, organisation_street: user.organisation_street, organisation_street_number: user.organisation_street_number, organisation_postal_code: user.organisation_postal_code, @@ -35,7 +38,8 @@ const formData = ref({ }); async function save() { - const { country_code, organisation_country_code, ...profileData } = formData.value; + const { country_code, organisation_country_code, phone_number, ...profileData } = + formData.value; const typedProfileData: Partial = { ...profileData }; typedProfileData.country = countries.value.find( @@ -45,6 +49,10 @@ async function save() { (c) => c.country_code === organisation_country_code ); + if (phone_number) { + typedProfileData.phone_number = normalizeSwissPhoneNumber(phone_number); + } + await user.updateUserProfile(typedProfileData); emit("save"); } @@ -130,6 +138,28 @@ async function avatarUpload(e: Event) { disabled class="disabled:bg-gray-50 mb-4 block w-full border-0 py-1.5 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 disabled:cursor-not-allowed disabled:text-gray-500 disabled:ring-gray-200 sm:max-w-sm sm:text-sm sm:leading-6" /> + + +
+ +
+ + +
+ +
+ @@ -268,6 +298,22 @@ async function avatarUpload(e: Event) { {{ $t("a.Firmenanschrift") }} +
+
+ + + +
+
+
{{ user.email }}
+ +
+ + {{ displaySwissPhoneNumber(user.phone_number) }} + + {{ $t("a.Keine Angabe") }} +
+ +
+ + {{ dayjs(user.birth_date).format("DD.MM.YYYY") }} + + {{ $t("a.Keine Angabe") }} +
- +
+ + {{ line }} +
+
+
{{ $t("a.Keine Angabe") }}
@@ -94,9 +119,13 @@ const invoiceAddress = computed(() => { {{ $t("a.Firmenanschrift") }}
- + +
+ + {{ line }} +
+
+
{{ $t("a.Keine Angabe") }}
diff --git a/client/src/components/ui/ItDatePicker.vue b/client/src/components/ui/ItDatePicker.vue index 4ded7f00..4c44f46d 100644 --- a/client/src/components/ui/ItDatePicker.vue +++ b/client/src/components/ui/ItDatePicker.vue @@ -1,6 +1,7 @@ diff --git a/client/src/pages/onboarding/vv/CheckoutAddress.vue b/client/src/pages/onboarding/vv/CheckoutAddress.vue index f8ff17ef..76e5a6ed 100644 --- a/client/src/pages/onboarding/vv/CheckoutAddress.vue +++ b/client/src/pages/onboarding/vv/CheckoutAddress.vue @@ -13,6 +13,12 @@ import DatatransCembraDeviceFingerprint from "@/components/onboarding/DatatransC import { getLocalSessionKey } from "@/statistics"; import log from "loglevel"; import { normalizeSwissPhoneNumber, validatePhoneNumber } from "@/utils/phone"; +import { + ORGANISATION_NO_COMPANY_ID, + ORGANISATION_OTHER_BROKER_ID, + ORGANISATION_OTHER_HEALTH_INSURANCE_ID, + ORGANISATION_OTHER_PRIVATE_INSURANCE_ID, +} from "@/consts"; const props = defineProps({ courseType: { @@ -31,11 +37,14 @@ const userOrganisationName = computed(() => { } // Those IDs do not represent a company - // 1: Other broker - // 2: Other insurance - // 3: Other private insurance - // 31: No company relation - if ([1, 2, 3, 31].includes(user.organisation)) { + if ( + [ + ORGANISATION_OTHER_BROKER_ID, + ORGANISATION_OTHER_HEALTH_INSURANCE_ID, + ORGANISATION_OTHER_PRIVATE_INSURANCE_ID, + ORGANISATION_NO_COMPANY_ID, + ].includes(user.organisation) + ) { return null; } diff --git a/client/src/services/onboarding.ts b/client/src/services/onboarding.ts index 24b59a48..9c59ef48 100644 --- a/client/src/services/onboarding.ts +++ b/client/src/services/onboarding.ts @@ -1,4 +1,9 @@ import { isString, startsWith } from "lodash"; +import { + ORGANISATION_OTHER_BROKER_ID, + ORGANISATION_OTHER_HEALTH_INSURANCE_ID, + ORGANISATION_OTHER_PRIVATE_INSURANCE_ID, +} from "@/consts"; export function profileNextRoute(courseType: string | string[]) { if (courseType === "uk") { @@ -10,3 +15,11 @@ export function profileNextRoute(courseType: string | string[]) { } return ""; } + +export function isOtherOrganisation(orgId: number) { + return [ + ORGANISATION_OTHER_BROKER_ID, + ORGANISATION_OTHER_HEALTH_INSURANCE_ID, + ORGANISATION_OTHER_PRIVATE_INSURANCE_ID, + ].includes(orgId); +} diff --git a/server/vbv_lernwelt/course/consts.py b/server/vbv_lernwelt/course/consts.py index a0dd7b27..a9949458 100644 --- a/server/vbv_lernwelt/course/consts.py +++ b/server/vbv_lernwelt/course/consts.py @@ -28,3 +28,10 @@ UK_COURSE_IDS = [ COURSE_UK_TRAINING_FR, COURSE_UK_TRAINING_IT, ] + + +# Organization IDs +ORGANISATION_OTHER_BROKER_ID = 1 +ORGANISATION_OTHER_HEALTH_INSURANCE_ID = 2 +ORGANISATION_OTHER_PRIVATE_INSURANCE_ID = 3 +ORGANISATION_NO_COMPANY_ID = 31 From aa30dadfd788f78acb1d866030eb3b922ddf59ef Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Tue, 16 Jul 2024 15:20:25 +0200 Subject: [PATCH 04/12] Update cypress tests --- .../personalProfile/ProfileEdit.vue | 4 +- .../personalProfile/ProfileView.vue | 23 ++-- client/src/consts.ts | 2 +- client/src/pages/StyleGuidePage.vue | 8 -- .../src/pages/onboarding/AccountProfile.vue | 2 +- .../personalProfile/PersonalProfilePage.vue | 6 +- cypress/e2e/checkout-vv/checkout.cy.js | 121 +++++++++++++----- cypress/e2e/profile/profile.cy.js | 85 ++++++++++++ cypress/support/commands.js | 11 ++ server/vbv_lernwelt/core/serializers.py | 6 + 10 files changed, 212 insertions(+), 56 deletions(-) create mode 100644 cypress/e2e/profile/profile.cy.js diff --git a/client/src/components/personalProfile/ProfileEdit.vue b/client/src/components/personalProfile/ProfileEdit.vue index e668857a..398e363a 100644 --- a/client/src/components/personalProfile/ProfileEdit.vue +++ b/client/src/components/personalProfile/ProfileEdit.vue @@ -301,7 +301,7 @@ async function avatarUpload(e: Event) {
{{ $t("general.cancel") }} -
diff --git a/client/src/components/personalProfile/ProfileView.vue b/client/src/components/personalProfile/ProfileView.vue index b41779c7..ac2e494c 100644 --- a/client/src/components/personalProfile/ProfileView.vue +++ b/client/src/components/personalProfile/ProfileView.vue @@ -71,17 +71,21 @@ const invoiceAddress = computed(() => {

{{ $t("a.Persönliche Informationen") }}

-
{{ user.first_name }}
+
+ {{ user.first_name }} +
-
{{ user.last_name }}
+
+ {{ user.last_name }} +
-
{{ user.email }}
+
{{ user.email }}
-
+
{{ displaySwissPhoneNumber(user.phone_number) }} @@ -90,7 +94,7 @@ const invoiceAddress = computed(() => { -
+
{{ dayjs(user.birth_date).format("DD.MM.YYYY") }} @@ -99,7 +103,7 @@ const invoiceAddress = computed(() => { -
+
{{ line }} @@ -114,13 +118,14 @@ const invoiceAddress = computed(() => {

{{ $t("a.Geschäftsdaten") }}

-
{{ organisationName }}
+
+ {{ organisationName }} +
- -
+
{{ line }}
diff --git a/client/src/consts.ts b/client/src/consts.ts index 25801247..656714c7 100644 --- a/client/src/consts.ts +++ b/client/src/consts.ts @@ -16,4 +16,4 @@ export const COURSE_MOTORFAHRZEUG_PRUEFUNG_ID = -13; export const ORGANISATION_OTHER_BROKER_ID = 1; export const ORGANISATION_OTHER_HEALTH_INSURANCE_ID = 2; export const ORGANISATION_OTHER_PRIVATE_INSURANCE_ID = 3; -export const ORGANISATION_NO_COMPANY_ID = 31; \ No newline at end of file +export const ORGANISATION_NO_COMPANY_ID = 31; diff --git a/client/src/pages/StyleGuidePage.vue b/client/src/pages/StyleGuidePage.vue index 26f791bb..25ff5db5 100644 --- a/client/src/pages/StyleGuidePage.vue +++ b/client/src/pages/StyleGuidePage.vue @@ -13,7 +13,6 @@ import VerticalBarChart from "@/components/ui/VerticalBarChart.vue"; import LearningPathCircle from "@/pages/learningPath/learningPathPage/LearningPathCircle.vue"; import logger from "loglevel"; import { reactive, ref } from "vue"; -import VueDatePicker from "@vuepic/vue-datepicker"; import "@vuepic/vue-datepicker/dist/main.css"; const state = reactive({ @@ -36,8 +35,6 @@ const state = reactive({ }, }); -const birtDate = ref("1982-06-15"); - const dropdownData = [ { title: "Option 1", @@ -415,11 +412,6 @@ function log(data: any) { > {{ state.dropdownSelected }} -

Date Picker

-
- -
-

Checkbox

-