-
{name}
-
{email}
+
+
+
+
+ {displayName}
+
+
{email}
+ {tenantName && (
+
+ {tenantName}
+
+ )}
diff --git a/ui/src/services/platformApi.service.ts b/ui/src/services/platformApi.service.ts
index 2ab5520..50d3de7 100644
--- a/ui/src/services/platformApi.service.ts
+++ b/ui/src/services/platformApi.service.ts
@@ -95,6 +95,7 @@ platformApiService.interceptors.response.use(
authority: [tokenDetails?.role],
name: `${tokenDetails?.given_name} ${tokenDetails?.family_name}`.trim(),
role: 'teacher',
+ tenantId: tokenDetails?.tenantid,
},
})
setIsRefreshing(false)
diff --git a/ui/src/store/auth.model.ts b/ui/src/store/auth.model.ts
index c37c7b4..00fd1f7 100644
--- a/ui/src/store/auth.model.ts
+++ b/ui/src/store/auth.model.ts
@@ -21,6 +21,7 @@ export interface AuthStoreModel {
name: string
avatar?: string
role: string
+ tenantId?: string
}
tenant?: {
tenantId?: string
@@ -59,6 +60,7 @@ export const initialState: AuthStoreModel = {
name: '',
avatar: '',
role: 'teacher',
+ tenantId: '',
},
tenant: {
tenantId: '',
@@ -82,7 +84,8 @@ export const authModel: AuthModel = {
state.user.userName = payload.user.userName
state.user.authority = payload.user.authority
state.user.email = payload.user.email
- state.user.avatar = AVATAR_URL(payload.user.id, state.tenant?.tenantId) + `?${dayjs().unix()}`
+ state.user.tenantId = payload.user.tenantId
+ state.user.avatar = AVATAR_URL(payload.user.id, state.user?.tenantId) + `?${dayjs().unix()}`
}),
signOut: action(() => ({ ...initialState })),
// signOut: action((state) => ({ ...initialState, tenantId: state.tenant?.tenantId })),
diff --git a/ui/src/utils/hooks/useAuth.ts b/ui/src/utils/hooks/useAuth.ts
index daae2ca..ea6adc9 100644
--- a/ui/src/utils/hooks/useAuth.ts
+++ b/ui/src/utils/hooks/useAuth.ts
@@ -35,6 +35,7 @@ function useAuth() {
expiresIn: number
}) => {
const tokenDetails: any = jwtDecode(token)
+
signInStore({
session: { token, refreshToken, expiresIn, expire: tokenDetails?.exp, signedIn: true },
user: {
@@ -44,6 +45,7 @@ function useAuth() {
authority: [tokenDetails?.role],
name: `${tokenDetails?.given_name} ${tokenDetails?.family_name}`.trim(),
role: 'teacher',
+ tenantId: tokenDetails?.tenantid,
},
})
}
diff --git a/ui/src/views/admin/profile/Profile.tsx b/ui/src/views/admin/profile/Profile.tsx
index 900e2e2..e5852e2 100644
--- a/ui/src/views/admin/profile/Profile.tsx
+++ b/ui/src/views/admin/profile/Profile.tsx
@@ -5,6 +5,7 @@ import { APP_NAME } from '@/constants/app.constant'
import { useLocalization } from '@/utils/hooks/useLocalization'
import { Suspense, lazy, useState } from 'react'
import { Helmet } from 'react-helmet'
+import { FaCheckCircle, FaCompressAlt, FaNode, FaUser } from 'react-icons/fa'
import { useLocation, useNavigate } from 'react-router-dom'
type AccountSetting = {
@@ -35,19 +36,23 @@ const Profile = () => {
{
label: string
path: string
+ icon?: JSX.Element
}
> = {
general: {
label: translate('::Abp.Identity.Profile.General'),
path: 'general',
+ icon:
,
},
password: {
label: translate('::Abp.Identity.Password'),
path: 'password',
+ icon:
,
},
notificationSettings: {
label: translate('::Abp.Identity.NotificationSettings'),
path: 'notification-settings',
+ icon:
,
},
}
@@ -78,6 +83,9 @@ const Profile = () => {
{Object.keys(settingsMenu).map((key) => (
+ {settingsMenu[key].icon && (
+ {settingsMenu[key].icon}
+ )}
{settingsMenu[key].label}
))}
diff --git a/ui/src/views/admin/profile/components/General.tsx b/ui/src/views/admin/profile/components/General.tsx
index 982e3a2..a8e276b 100644
--- a/ui/src/views/admin/profile/components/General.tsx
+++ b/ui/src/views/admin/profile/components/General.tsx
@@ -1,13 +1,12 @@
-import { Input, Upload } from '@/components/ui'
+import { Input, Select, Upload } from '@/components/ui'
import Button from '@/components/ui/Button'
-import { FormContainer } from '@/components/ui/Form'
+import { FormContainer, FormItem } from '@/components/ui/Form'
import Notification from '@/components/ui/Notification'
import toast from '@/components/ui/toast'
import { AVATAR_URL } from '@/constants/app.constant'
import { useStoreActions, useStoreState } from '@/store'
import { useLocalization } from '@/utils/hooks/useLocalization'
import dayjs from 'dayjs'
-import type { FieldProps } from 'formik'
import { Field, Form, Formik } from 'formik'
import { useEffect, useRef, useState } from 'react'
@@ -26,13 +25,15 @@ import {
FaUserCircle,
FaPhone,
FaPlus,
+ FaHome,
+ FaUniversity,
} from 'react-icons/fa'
import * as Yup from 'yup'
import isEmpty from 'lodash/isEmpty'
-import FormRow from '@/views/shared/FormRow'
-import FormDesription from '@/views/shared/FormDesription'
import { ProfileDto, UpdateProfileDto } from '@/proxy/account/models'
import { getProfile, updateProfile } from '@/services/account.service'
+import { CountryDto, getCountry } from '@/services/home.service'
+import { SelectBoxOption } from '@/types/shared'
const schema = Yup.object().shape({
name: Yup.string().min(3).max(50).required(),
@@ -44,6 +45,7 @@ const General = () => {
const [profileData, setProfileData] = useState()
const [formData, setFormData] = useState()
const [image, setImage] = useState()
+ const [countries, setCountries] = useState([])
const auth = useStoreState((state) => state.auth)
const { setUser } = useStoreActions((actions) => actions.auth.user)
@@ -54,8 +56,9 @@ const General = () => {
const fetchData = async () => {
setLoading(true)
- const response = await getProfile()
+ const [response, countryResponse] = await Promise.all([getProfile(), getCountry()])
setProfileData(response.data)
+ setCountries(countryResponse.data)
setImage(auth.user.avatar)
setFormData({
name: response.data.name,
@@ -150,6 +153,69 @@ const General = () => {
}
})
+ const getProfileExtraValue = (key: string) => {
+ const extraProperties = profileData?.extraProperties
+ const value =
+ extraProperties?.[key] ?? extraProperties?.[`${key.charAt(0).toLowerCase()}${key.slice(1)}`]
+
+ return typeof value === 'string' || typeof value === 'number' ? String(value) : undefined
+ }
+
+ const getSelectValue = (options: SelectBoxOption[], value?: string) => {
+ if (!value) {
+ return null
+ }
+
+ return options.find((option) => option.value === value) ?? { value, label: value }
+ }
+
+ const nationalityOptions: SelectBoxOption[] = countries.map((country) => ({
+ value: country.name,
+ label: country.name,
+ }))
+
+ const educationOptions: SelectBoxOption[] = [
+ {
+ value: 'İlkokul',
+ label: translate('::App.EducationLevel.Primary') || 'İlkokul',
+ },
+ {
+ value: 'Ortaokul',
+ label: translate('::App.EducationLevel.MiddleSchool') || 'Ortaokul',
+ },
+ {
+ value: 'Lise',
+ label: translate('::App.EducationLevel.HighSchool') || 'Lise',
+ },
+ {
+ value: 'Ön Lisans',
+ label: translate('::App.EducationLevel.Associate') || 'Ön Lisans',
+ },
+ {
+ value: 'Lisans',
+ label: translate('::App.EducationLevel.Bachelor') || 'Lisans',
+ },
+ {
+ value: 'Yüksek Lisans',
+ label: translate('::App.EducationLevel.Master') || 'Yüksek Lisans',
+ },
+ {
+ value: 'Doktora',
+ label: translate('::App.EducationLevel.PhD') || 'Doktora',
+ },
+ ]
+
+ const bloodTypeOptions: SelectBoxOption[] = [
+ { value: 'A Rh+', label: 'A Rh+' },
+ { value: 'A Rh-', label: 'A Rh-' },
+ { value: 'B Rh+', label: 'B Rh+' },
+ { value: 'B Rh-', label: 'B Rh-' },
+ { value: 'AB Rh+', label: 'AB Rh+' },
+ { value: 'AB Rh-', label: 'AB Rh-' },
+ { value: '0 Rh+', label: '0 Rh+' },
+ { value: '0 Rh-', label: '0 Rh-' },
+ ]
+
if (loading) {
return <>>
}
@@ -165,134 +231,173 @@ const General = () => {
}}
>
{({ touched, errors, isSubmitting, resetForm }) => {
- const validatorProps = { touched, errors }
return (