diff --git a/src/components/actions.tsx b/src/components/actions.tsx index b2e090e..79ce5e2 100644 --- a/src/components/actions.tsx +++ b/src/components/actions.tsx @@ -4,5 +4,5 @@ import { useHorizontalSpacing } from "@/styles"; export const Actions = (props: HTMLProps) => { const classes = useHorizontalSpacing(2); - return
+ return
} diff --git a/src/components/proposalPreview.tsx b/src/components/proposalPreview.tsx index f57798f..1b8a46a 100644 --- a/src/components/proposalPreview.tsx +++ b/src/components/proposalPreview.tsx @@ -33,7 +33,6 @@ export const ProposalPreview = ({ proposal }: ProposalPreviewProps) => { const { t } = useTranslation(); const classes = useVerticalSpacing(3); - const duration = moment.duration(proposal.endDate.diff(proposal.startDate)); return
diff --git a/src/pages/internship/proposal.tsx b/src/pages/internship/proposal.tsx index 3e92aea..176f6d9 100644 --- a/src/pages/internship/proposal.tsx +++ b/src/pages/internship/proposal.tsx @@ -1,9 +1,22 @@ import { Page } from "@/pages/base"; -import { Button, Container, Link, Typography } from "@material-ui/core"; +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 from "react"; +import React, { useState } from "react"; import { ProposalComment } from "@/pages/steps/proposal"; import { useTranslation } from "react-i18next"; import { ProposalPreview } from "@/components/proposalPreview"; @@ -13,7 +26,7 @@ import { AppState } from "@/state/reducer"; import { internshipSerializationTransformer } from "@/serialization"; import { Actions } from "@/components"; import { InternshipProposalActions, useDispatch } from "@/state/actions"; -import { StickerCheckOutline, StickerRemoveOutline } from "mdi-material-ui/index"; +import { MenuDown, StickerCheckOutline, StickerRemoveOutline } from "mdi-material-ui/index"; import { useVerticalSpacing } from "@/styles"; export const InternshipProposalFormPage = () => { @@ -39,13 +52,49 @@ export const InternshipProposalPreviewPage = () => { 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: null }); + dispatch({ type: InternshipProposalActions.Approve, comment }); history.push(route("home")); } const handleDiscard = () => { - dispatch({ type: InternshipProposalActions.Decline, comment: "Well..." }); + 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 handleAcceptWithoutComments = () => { + dispatch({ type: InternshipProposalActions.Approve, comment: null }); history.push(route("home")); } @@ -68,15 +117,54 @@ export const InternshipProposalPreviewPage = () => { { t('go-back') } - + + + + - + + { t("internship.discard.title") } + + { t("internship.discard.info") } + setComment(ev.target.value) } fullWidth label={ t("comments") }/> + + + + + + + + + { t("internship.accept.title") } + + { t("internship.accept.info") } + setComment(ev.target.value) } fullWidth label={ t("comments") }/> + + + + + + + } diff --git a/translations/pl.yaml b/translations/pl.yaml index 1f35c9d..d13ce82 100644 --- a/translations/pl.yaml +++ b/translations/pl.yaml @@ -20,6 +20,9 @@ comments: Zgłoszone uwagi send-again: wyślij ponownie cancel: anuluj +accept: zaakceptuj +accept-with-comments: zaakceptuj z uwagami +discard: zgłoś uwagi dropzone: "Przeciągnij i upuść plik bądź kliknij, aby wybrać" @@ -71,7 +74,12 @@ internship: place: "Miejsce odbywania praktyki" kind: "Rodzaj i program praktyki" mentor: "Zakładowy opiekun praktyki" - + discard: + title: "Odrzuć zgłoszenie praktyki" + info: "Poniższa informacja zostanie przekazana praktykantowi w celu poprawy zgłoszenia." + accept: + title: "Zaakceptuj zgłoszenie praktyki" + info: "Poniższa informacja zostanie przekazana praktykantowi." steps: personal-data: