import { Page } from "@/pages/base"; import { Button, ButtonGroup, Container, Dialog, DialogActions, DialogContent, DialogTitle, Link, Menu, MenuItem, TextField, Typography } from "@material-ui/core"; import { Link as RouterLink, useHistory } from "react-router-dom"; import { route } from "@/routing"; import { InternshipForm } from "@/forms/internship"; import React, { useState } from "react"; import { ProposalComment } from "@/pages/steps/proposal"; import { useTranslation } from "react-i18next"; import { ProposalPreview } from "@/components/proposalPreview"; import { useSelector } from "react-redux"; import { Internship } from "@/data"; import { AppState } from "@/state/reducer"; import { internshipSerializationTransformer } from "@/serialization"; import { Actions } from "@/components"; import { InternshipProposalActions, useDispatch } from "@/state/actions"; import { MenuDown, StickerCheckOutline, StickerRemoveOutline } from "mdi-material-ui/index"; import { useVerticalSpacing } from "@/styles"; export const InternshipProposalFormPage = () => { const { t } = useTranslation(); return { t("pages.my-internship.header") } { t("pages.proposal-form.header") } { t("pages.proposal-form.header") } } export const InternshipProposalPreviewPage = () => { const { t } = useTranslation(); const proposal = useSelector(state => state.proposal.proposal && internshipSerializationTransformer.reverseTransform(state.proposal.proposal)); const dispatch = useDispatch(); const history = useHistory(); const [isDiscardModalOpen, setDiscardModelOpen] = useState(false); const [isAcceptModalOpen, setAcceptModelOpen] = useState(false); const [comment, setComment] = useState(""); const [menuAnchor, setMenuAnchor] = useState(null); const handleAccept = () => { dispatch({ type: InternshipProposalActions.Approve, comment }); history.push(route("home")); } const handleDiscard = () => { dispatch({ type: InternshipProposalActions.Decline, comment }); history.push(route("home")); } const handleAcceptModalClose = () => { setAcceptModelOpen(false); } const handleDiscardModalClose = () => { setDiscardModelOpen(false); } const handleDiscardAction = () => { setDiscardModelOpen(true); } const handleAcceptMenuOpen = (ev: React.MouseEvent) => { setMenuAnchor(ev.currentTarget); } const handleAcceptMenuClose = () => { setMenuAnchor(null); } const handleAcceptWithComment = () => { setAcceptModelOpen(true); setMenuAnchor(null); } const handleAcceptWithoutComment = () => { dispatch({ type: InternshipProposalActions.Approve, comment: null }); history.push(route("home")); } const classes = useVerticalSpacing(3); return Moja praktyka Podgląd zgłoszenia Moje zgłoszenie { proposal && } { t("accept-without-comments") } { t("accept-with-comments") } { t("internship.discard.title") } { t("internship.discard.info") } setComment(ev.target.value) } fullWidth label={ t("comments") } rows={3}/> { t("internship.accept.title") } { t("internship.accept.info") } setComment(ev.target.value) } fullWidth label={ t("comments") } rows={3}/> } export default InternshipProposalFormPage;