diff --git a/docker-compose.yml b/docker-compose.yml index 1c26262a..88ed6c48 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,4 +9,4 @@ services: ports: - ${HOST_PORT}:3000 environment: - - PORT=3000 \ No newline at end of file + - PORT=3000 diff --git a/src/AppRouter.js b/src/AppRouter.js index 9ac4b935..18b1e140 100644 --- a/src/AppRouter.js +++ b/src/AppRouter.js @@ -38,6 +38,8 @@ import EditOfferPage from "./pages/EditOfferPage"; import PrivacyPolicyPage from "./pages/PrivacyPolicyPage"; import TermsAndConditionsPage from "./pages/TermsAndConditionsPage"; import ChangeLogPage from "./pages/ChangeLogPage"; +import EditCompanyProfilePage from "./pages/EditCompanyProfilePage"; +import { EditCompanyController } from "./components/Company/Edit/EditCompanyProfileForm"; /** * @@ -188,6 +190,23 @@ const AppRouter = () => ( + !!(user?.company || user?.isAdmin)} + // controller={EditCompanyController} + > + + + + ({ + submitBtn: { + marginTop: theme.spacing(2) + } +})); + +export const EditCompanyController = () => { + +}; + +const EditCompanyProfileForm = ({ title }) => { + const isMobile = useMobile(); + const formCardClasses = useOfferFormStyles(isMobile)(); + + const classes = useStyles(); + + const { id } = useParams(); + const { company } = useCompany(id); + + const { control } = useForm({ + mode: "all", + resolver: yupResolver(EditCompanySchema), + reValidateMode: "onChange", + }); + + const { fields, append, remove } = useContacts({ control }); + + const getContacts = useCallback(() => { + if (!company) return [{}]; + + const contacts = company.contacts; + + const result = []; + for (let i = 0; i < contacts.length; i++) { + result.push({ + id: i, + value: contacts[i], + }); + } + + return result; + }, [company]); + + const Content = isMobile ? DialogContent : CardContent; + + return <> +
+ + + + + + + + + + + + + + + + ( + )} + control={control} + /> + + + +
+ * Required fields +
+
+
+ + ; +}; + +EditCompanyProfileForm.propTypes = { + title: PropTypes.string +} + +export default EditCompanyProfileForm; diff --git a/src/components/Company/Registration/Finish/BioForm.js b/src/components/Company/Registration/Finish/BioForm.js index 682836bc..4ce41d26 100644 --- a/src/components/Company/Registration/Finish/BioForm.js +++ b/src/components/Company/Registration/Finish/BioForm.js @@ -5,7 +5,6 @@ import { Controller, useWatch } from "react-hook-form"; import { FinishCompanyRegistrationConstants } from "./FinishCompanyRegistrationUtils"; export const useBio = ({ control }) => { - const bio = useWatch({ name: "bio", control, @@ -15,8 +14,8 @@ export const useBio = ({ control }) => { return { validateStep, }; - }; + const BioForm = () => { const { control, errors } = useContext(FinishCompanyRegistrationControllerContext); return ( diff --git a/src/components/Company/Registration/Finish/ReviewForm.js b/src/components/Company/Registration/Finish/ReviewForm.js index 3014f01f..d1848d82 100644 --- a/src/components/Company/Registration/Finish/ReviewForm.js +++ b/src/components/Company/Registration/Finish/ReviewForm.js @@ -8,7 +8,7 @@ import getCroppedImg from "../../../utils/image/cropImage"; import { getHumanError } from "./FinishCompanyRegistrationUtils"; import { FinishCompanyRegistrationControllerContext } from "./FinishCompanyRegistrationWidget"; -const useStyles = (isMobile) => makeStyles((theme) => ({ +export const useStyles = (isMobile) => makeStyles((theme) => ({ companyCard: { display: "flex", width: isMobile ? "90vw" : "600px", diff --git a/src/components/HomePage/SearchResultsArea/Offer/OfferDetails.js b/src/components/HomePage/SearchResultsArea/Offer/OfferDetails.js index e4dd1c9c..b14dc298 100644 --- a/src/components/HomePage/SearchResultsArea/Offer/OfferDetails.js +++ b/src/components/HomePage/SearchResultsArea/Offer/OfferDetails.js @@ -38,6 +38,8 @@ const OfferDetails = ({ handleError, }) => { + console.log("fds: ", offer.ownerLogo); + const { data, isValidating, error, isLoggedIn } = useSession(); const sessionData = (!isValidating && !error && isLoggedIn) ? data : null; const classes = useSearchResultsWidgetStyles({ isMobile, isPage, loading, hasApplyButton: !!offer?.applyURL }); diff --git a/src/components/utils/form/MultiOptionTextField.js b/src/components/utils/form/MultiOptionTextField.js index 107c685c..14ad4569 100644 --- a/src/components/utils/form/MultiOptionTextField.js +++ b/src/components/utils/form/MultiOptionTextField.js @@ -44,13 +44,14 @@ const MultiOptionTextField = ({ id, }) => { const classes = useMultiOptionTextFieldStyle(); + return ( <> {label} - {values.map(({ id }, i) => ( + {values.map(({ id, value }, i) => ( )} control={control} - defaultValue={getValues(`${controllerName}.${i}.value`) || ""} + defaultValue={getValues ? (getValues(`${controllerName}.${i}.value`) || "") : value} /> ))}