Selaa lähdekoodia

Finished bug 1491

bugfix/1491
Djordje Mitrovic 3 vuotta sitten
vanhempi
commit
71862df4aa

+ 11
- 5
src/components/Cards/ProfileCard/EditProfile/EditProfile.js Näytä tiedosto

@@ -35,7 +35,7 @@ import FirmNameField from "./FirmNameField/FirmNameField";
import PIBField from "./PIBField/PIBField";
import LocationField from "./LocationField/LocationField";
import WebsiteField from "./WebsiteField/WebsiteField";
import AppLinkField from "./AppLinkField/AppLinkField";
// import AppLinkField from "./AppLinkField/AppLinkField";
import PhoneField from "./PhoneField/PhoneField";
import FormikErrorMessage from "./FormikErrorMessage/FormikErrorMessage";
import {
@@ -48,7 +48,10 @@ import {
PROFILE_PAGE,
} from "../../../../constants/pages";
import { selectIsLoadingByActionType } from "../../../../store/selectors/loadingSelectors";
import { PROFILE_EDIT_ADMIN_SCOPE, PROFILE_EDIT_SCOPE } from "../../../../store/actions/profile/profileActionConstants";
import {
PROFILE_EDIT_ADMIN_SCOPE,
PROFILE_EDIT_SCOPE,
} from "../../../../store/actions/profile/profileActionConstants";
import { closeModal } from "../../../../store/actions/modal/modalActions";

const EditProfile = (props) => {
@@ -160,12 +163,15 @@ const EditProfile = (props) => {
{showDetails && (
<DetailsInfo>
<WebsiteField formik={formik} />
<AppLinkField formik={formik} />
{/* <AppLinkField formik={formik} /> */}
<PhoneField formik={formik} />
</DetailsInfo>
)}

<FormikErrorMessage formik={formik} />
<FormikErrorMessage
formik={formik}
showBasic={showBasic}
showDetails={showDetails}
/>

<ButtonsContainer>
{isMobile && (

+ 7
- 2
src/components/Cards/ProfileCard/EditProfile/EditProfile.styled.js Näytä tiedosto

@@ -9,12 +9,13 @@ import { PrimaryAnimatedButton } from "../../../Styles/globalStyleComponents";
export const EditProfileContainer = styled(Box)`
background-color: #fff;
position: fixed;
top: 5vh;
top: calc(50vh - 390px);
left: calc(50% - 310px);
z-index: 150;
padding: 36px 144px;
width: 623px;
max-height: 90vh;
min-height: 781px;
max-height: 802px;
overflow-y: auto;
&::-webkit-scrollbar {
width: 5px;
@@ -27,6 +28,10 @@ export const EditProfileContainer = styled(Box)`
}
scrollbar-width: thin;
scrollbar-color: #ddd;
@media (max-height: 800px) {
height: 90vh;
top: 5vh;
}

@media screen and (max-width: 600px) {
height: 100vh;

+ 22
- 9
src/components/Cards/ProfileCard/EditProfile/FormikErrorMessage/FormikErrorMessage.js Näytä tiedosto

@@ -5,15 +5,26 @@ import { ErrorMessage } from "./FormikErrorMessage.styled";
const FormikErrorMessage = (props) => {
return (
<>
{props.formik.errors.firmName && props.formik.touched.firmName ? (
<ErrorMessage>{props.formik.errors.firmName}</ErrorMessage>
) : props.formik.errors.firmPIB && props.formik.touched.firmPIB ? (
<ErrorMessage>{props.formik.errors.firmPIB}</ErrorMessage>
) : props.formik.errors.firmLocation &&
props.formik.touched.firmLocation ? (
<ErrorMessage>{props.formik.errors.firmLocation}</ErrorMessage>
) : props.formik.errors.firmPhone && props.formik.touched.firmPhone ? (
<ErrorMessage>{props.formik.errors.firmPhone}</ErrorMessage>
{props.showBasic ? (
props.formik.errors.firmName && props.formik.touched.firmName ? (
<ErrorMessage>{props.formik.errors.firmName}</ErrorMessage>
) : props.formik.errors.firmPIB && props.formik.touched.firmPIB ? (
<ErrorMessage>{props.formik.errors.firmPIB}</ErrorMessage>
) : (
props.formik.errors.firmLocation &&
props.formik.touched.firmLocation && (
<ErrorMessage>{props.formik.errors.firmLocation}</ErrorMessage>
)
)
) : props.showDetails ? (
props.formik.errors.firmWebsite && props.formik.touched.firmWebsite ? (
<ErrorMessage>{props.formik.errors.firmWebsite}</ErrorMessage>
) : (
props.formik.errors.firmPhone &&
props.formik.touched.firmPhone && (
<ErrorMessage>{props.formik.errors.firmPhone}</ErrorMessage>
)
)
) : (
<></>
)}
@@ -23,6 +34,8 @@ const FormikErrorMessage = (props) => {

FormikErrorMessage.propTypes = {
formik: PropTypes.any,
showDetails: PropTypes.bool,
showBasic: PropTypes.bool,
};

export default FormikErrorMessage;

+ 1
- 0
src/components/Cards/ProfileCard/EditProfile/LocationField/LocationField.js Näytä tiedosto

@@ -27,6 +27,7 @@ const LocationField = (props) => {
editLocation
data={locations.map((item) => ({ name: item.city }))}
value={props.formik.values.firmLocation}
error={props.formik.errors.firmLocation}
onChange={(event, { newValue }) =>
props.formik.setFieldValue("firmLocation", newValue)
}

+ 1
- 0
src/components/Cards/ProfileCard/EditProfile/WebsiteField/WebsiteField.js Näytä tiedosto

@@ -15,6 +15,7 @@ const WebsiteField = (props) => {
name="firmWebsite"
value={props.formik.values.firmWebsite}
onChange={props.formik.handleChange}
error={props.formik.errors.firmWebsite}
margin="normal"
fullWidth
/>

+ 1
- 1
src/i18n/resources/rs.js Näytä tiedosto

@@ -252,7 +252,7 @@ export default {
tooltip: "Pošalji poruku",
},
editProfile: {
website: "Web Sajt*",
website: "Web Sajt",
applink: "App Link*",
phoneNumber: "Broj Telefona",
saveChanges: "Sačuvaj Promene",

+ 10
- 7
src/validations/editProfileValidation.js Näytä tiedosto

@@ -7,13 +7,16 @@ export default (locations) =>
// .required(i18n.t("editProfile.labelPIBRequired"))
.min(9, i18n.t("register.PIBnoOfCharacters"))
.max(9, i18n.t("register.PIBnoOfCharacters")),
firmLocation: Yup.string().oneOf(
locations.map((l) => l.city),
i18n.t("editProfile.labelLocationValid")
),
firmWebsite: Yup.string(),
firmApplink: Yup.string(),
firmLocation: Yup.string()
.oneOf(
locations.map((l) => l.city),
i18n.t("editProfile.labelLocationValid")
)
.required(i18n.t("register.labelLocationRequired")),
firmWebsite: Yup.string().required(i18n.t("register.websiteRequired")),
// firmApplink: Yup.string(),
firmPhone: Yup.string()
.min(6, i18n.t("editProfile.labelPhoneValid"))
.max(14, i18n.t("editProfile.labelPhoneValid")),
.max(14, i18n.t("editProfile.labelPhoneValid"))
.required(i18n.t("register.phoneNumberRequired")),
});

Loading…
Peruuta
Tallenna