From d56c346512fb33f889496f6c5df9b678a6de8381 Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Tue, 16 Jul 2024 10:58:58 +0200 Subject: [PATCH] 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 @@