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": "ایمیل نامعتبر است",
"typography_edit_profile": "ویرایش پروفایل",
"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 t = useTranslations();
const { user, token, getUser, changeUser } = useUser();
console.log(user);
const { directionApp } = useDirection();
const editAvatar = async (avatar) => {
@@ -97,11 +98,22 @@ const DashboardEditProfile = () => {
};
const initialValues = {
expert_avatar: null,
expert_email: user.expert_email,
change_avatar: false,
username: user.username,
name: user.name,
email: user.email,
province_name: user.province_name,
position: user.position,
};
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 (
@@ -145,10 +157,11 @@ const DashboardEditProfile = () => {
<Field
as={TextField}
name="username"
label={t("text_field_username")}
label={t("UpdateProfile.text_field_username")}
variant="outlined"
margin="normal"
size="small"
disabled={true}
error={
props.touched.username && props.errors.username
? true
@@ -168,10 +181,11 @@ const DashboardEditProfile = () => {
<Field
as={TextField}
name="name"
label={t("text_field_name")}
label={t("UpdateProfile.text_field_name")}
variant="outlined"
margin="normal"
size="small"
disabled={true}
error={
props.touched.name && props.errors.name
? true
@@ -189,17 +203,18 @@ const DashboardEditProfile = () => {
<Field
as={TextField}
name="email"
label={t("text_field_name")}
label={t("UpdateProfile.text_field_email")}
variant="outlined"
margin="normal"
size="small"
disabled={true}
error={
props.touched.name && props.errors.name
props.touched.email && props.errors.email
? true
: false
}
helperText={
props.touched.name ? props.errors.name : null
props.touched.email ? props.errors.email : null
}
sx={{
width: "100%",
@@ -210,20 +225,21 @@ const DashboardEditProfile = () => {
<Grid item xs={12} sm={6}>
<Field
as={TextField}
name="position"
label={t("text_field_phone_number")}
name="province_name"
label={t("UpdateProfile.text_field_province_name")}
variant="outlined"
margin="normal"
size="small"
disabled={true}
error={
props.touched.phone_number &&
props.errors.phone_number
props.touched.province_name &&
props.errors.province_name
? true
: false
}
helperText={
props.touched.phone_number
? props.errors.phone_number
props.touched.province_name
? props.errors.province_name
: null
}
sx={{
@@ -234,20 +250,20 @@ const DashboardEditProfile = () => {
<Grid item xs={12} sm={6}>
<Field
as={TextField}
name="province_name"
label={t("text_field_national_id_code")}
name="position"
label={t("UpdateProfile.text_field_position")}
variant="outlined"
margin="normal"
size="small"
disabled={true}
error={
props.touched.national_id_code &&
props.errors.national_id_code
props.touched.position && props.errors.position
? true
: false
}
helperText={
props.touched.national_id_code
? props.errors.national_id_code
props.touched.position
? props.errors.position
: null
}
sx={{
@@ -256,18 +272,19 @@ const DashboardEditProfile = () => {
/>
</Grid>
</Grid>
<Button
{/* <Button
type="submit"
fullWidth
variant="contained"
color="primary"
size="large"
disabled={props.isSubmitting}
display="none"
>
{props.isSubmitting
? t("SubmitButton.button_while_submit")
: t("SubmitButton.button_submit")}
</Button>
</Button> */}
</Stack>
</Paper>
</StyledForm>

View File

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