Merge branch 'feature/show_profile' into 'develop'

Feature/show profile

See merge request witel3/loan-facilities-expert!19
This commit is contained in:
yasaman aliakbari
2023-07-12 10:42:49 +00:00
3 changed files with 47 additions and 24 deletions

View File

@@ -69,6 +69,12 @@
"error_invalid_email": "ایمیل نامعتبر است", "error_invalid_email": "ایمیل نامعتبر است",
"typography_edit_profile": "ویرایش پروفایل", "typography_edit_profile": "ویرایش پروفایل",
"text_field_email": "ایمیل", "text_field_email": "ایمیل",
"text_field_enter_your_password": "رمز عبور خود را وارد کنید" "text_field_enter_your_password": "رمز عبور خود را وارد کنید",
"text_field_username":"نام کاربری",
"text_field_name":"نام",
"text_field_phone_number":"شماره تماس",
"text_field_position":"سمت",
"text_field_province_name":"نام استان",
"error_message_required": "اجباری !"
} }
} }

View File

@@ -25,6 +25,7 @@ import ImageResizer from "@/core/components/ImageConvertor";
const DashboardEditProfile = () => { const DashboardEditProfile = () => {
const t = useTranslations(); const t = useTranslations();
const { user, token, getUser, changeUser } = useUser(); const { user, token, getUser, changeUser } = useUser();
console.log(user);
const { directionApp } = useDirection(); const { directionApp } = useDirection();
const editAvatar = async (avatar) => { const editAvatar = async (avatar) => {
@@ -97,11 +98,22 @@ const DashboardEditProfile = () => {
}; };
const initialValues = { const initialValues = {
expert_avatar: null, expert_avatar: null,
expert_email: user.expert_email, username: user.username,
change_avatar: false, name: user.name,
email: user.email,
province_name: user.province_name,
position: user.position,
}; };
const validationSchema = Yup.object().shape({ const validationSchema = Yup.object().shape({
expert_email: Yup.string().email(t("UpdateProfile.error_invalid_email")), // username: Yup.string().required(t("UpdateProfile.error_message_required")),
// name: Yup.string().required(t("UpdateProfile.error_message_required")),
// email: Yup.string()
// .email(t("UpdateProfile.error_invalid_email"))
// .required(t("UpdateProfile.error_message_required")),
// province_name: Yup.string().required(
// t("UpdateProfile.error_message_required")
// ),
// position: Yup.string().required(t("UpdateProfile.error_message_required")),
}); });
return ( return (
@@ -145,10 +157,11 @@ const DashboardEditProfile = () => {
<Field <Field
as={TextField} as={TextField}
name="username" name="username"
label={t("text_field_username")} label={t("UpdateProfile.text_field_username")}
variant="outlined" variant="outlined"
margin="normal" margin="normal"
size="small" size="small"
disabled={true}
error={ error={
props.touched.username && props.errors.username props.touched.username && props.errors.username
? true ? true
@@ -168,10 +181,11 @@ const DashboardEditProfile = () => {
<Field <Field
as={TextField} as={TextField}
name="name" name="name"
label={t("text_field_name")} label={t("UpdateProfile.text_field_name")}
variant="outlined" variant="outlined"
margin="normal" margin="normal"
size="small" size="small"
disabled={true}
error={ error={
props.touched.name && props.errors.name props.touched.name && props.errors.name
? true ? true
@@ -189,17 +203,18 @@ const DashboardEditProfile = () => {
<Field <Field
as={TextField} as={TextField}
name="email" name="email"
label={t("text_field_name")} label={t("UpdateProfile.text_field_email")}
variant="outlined" variant="outlined"
margin="normal" margin="normal"
size="small" size="small"
disabled={true}
error={ error={
props.touched.name && props.errors.name props.touched.email && props.errors.email
? true ? true
: false : false
} }
helperText={ helperText={
props.touched.name ? props.errors.name : null props.touched.email ? props.errors.email : null
} }
sx={{ sx={{
width: "100%", width: "100%",
@@ -210,20 +225,21 @@ const DashboardEditProfile = () => {
<Grid item xs={12} sm={6}> <Grid item xs={12} sm={6}>
<Field <Field
as={TextField} as={TextField}
name="position" name="province_name"
label={t("text_field_phone_number")} label={t("UpdateProfile.text_field_province_name")}
variant="outlined" variant="outlined"
margin="normal" margin="normal"
size="small" size="small"
disabled={true}
error={ error={
props.touched.phone_number && props.touched.province_name &&
props.errors.phone_number props.errors.province_name
? true ? true
: false : false
} }
helperText={ helperText={
props.touched.phone_number props.touched.province_name
? props.errors.phone_number ? props.errors.province_name
: null : null
} }
sx={{ sx={{
@@ -234,20 +250,20 @@ const DashboardEditProfile = () => {
<Grid item xs={12} sm={6}> <Grid item xs={12} sm={6}>
<Field <Field
as={TextField} as={TextField}
name="province_name" name="position"
label={t("text_field_national_id_code")} label={t("UpdateProfile.text_field_position")}
variant="outlined" variant="outlined"
margin="normal" margin="normal"
size="small" size="small"
disabled={true}
error={ error={
props.touched.national_id_code && props.touched.position && props.errors.position
props.errors.national_id_code
? true ? true
: false : false
} }
helperText={ helperText={
props.touched.national_id_code props.touched.position
? props.errors.national_id_code ? props.errors.position
: null : null
} }
sx={{ sx={{
@@ -256,18 +272,19 @@ const DashboardEditProfile = () => {
/> />
</Grid> </Grid>
</Grid> </Grid>
<Button {/* <Button
type="submit" type="submit"
fullWidth fullWidth
variant="contained" variant="contained"
color="primary" color="primary"
size="large" size="large"
disabled={props.isSubmitting} disabled={props.isSubmitting}
display="none"
> >
{props.isSubmitting {props.isSubmitting
? t("SubmitButton.button_while_submit") ? t("SubmitButton.button_while_submit")
: t("SubmitButton.button_submit")} : t("SubmitButton.button_submit")}
</Button> </Button> */}
</Stack> </Stack>
</Paper> </Paper>
</StyledForm> </StyledForm>

View File

@@ -1,6 +1,6 @@
import DashboardEditProfile from "@/components/dashboard/edit-profile"; import DashboardEditProfile from "@/components/dashboard/edit-profile";
import TitlePage from "@/core/components/TitlePage"; import TitlePage from "@/core/components/TitlePage";
import WithAuthMiddleware from "@/middlewares/WithoutAuth"; import WithAuthMiddleware from "@/middlewares/WithAuth";
import { parse } from "next-useragent"; import { parse } from "next-useragent";
export default function LoanFollowUp() { export default function LoanFollowUp() {