diff --git a/client/src/components/note-upsert-modal/note-upsert-modal.container.jsx b/client/src/components/note-upsert-modal/note-upsert-modal.container.jsx index a5ff684f7..d4c57c403 100644 --- a/client/src/components/note-upsert-modal/note-upsert-modal.container.jsx +++ b/client/src/components/note-upsert-modal/note-upsert-modal.container.jsx @@ -34,7 +34,7 @@ export function NoteUpsertModalContainer({ const [updateNote] = useMutation(UPDATE_NOTE); const { visible, context, actions } = noteUpsertModal; - const { jobId, existingNote } = context; + const { jobId, existingNote, text } = context; const { refetch } = actions; const [form] = Form.useForm(); @@ -45,8 +45,12 @@ export function NoteUpsertModalContainer({ form.setFieldsValue(existingNote); } else if (!existingNote && visible) { form.resetFields(); + + if (text) { + form.setFieldValue("text", text); + } } - }, [existingNote, form, visible]); + }, [existingNote, form, visible, text]); const handleFinish = async (formValues) => { const { relatedros, ...values } = formValues; diff --git a/client/src/components/production-list-columns/production-list-columns.productionnote.component.jsx b/client/src/components/production-list-columns/production-list-columns.productionnote.component.jsx index 5ff201972..217be5205 100644 --- a/client/src/components/production-list-columns/production-list-columns.productionnote.component.jsx +++ b/client/src/components/production-list-columns/production-list-columns.productionnote.component.jsx @@ -1,12 +1,23 @@ import Icon from "@ant-design/icons"; import { useMutation } from "@apollo/client"; -import { Button, Input, Popover } from "antd"; +import { Button, Input, Popover, Space } from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { FaRegStickyNote } from "react-icons/fa"; import { logImEXEvent } from "../../firebase/firebase.utils"; import { UPDATE_JOB } from "../../graphql/jobs.queries"; -export default function ProductionListColumnProductionNote({ record }) { +import { setModalContext } from "../../redux/modals/modals.actions"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; + +const mapStateToProps = createStructuredSelector({}); + +const mapDispatchToProps = (dispatch) => ({ + setNoteUpsertContext: (context) => + dispatch(setModalContext({ context: context, modal: "noteUpsert" })), +}); + +function ProductionListColumnProductionNote({ record, setNoteUpsertContext }) { const { t } = useTranslation(); const [note, setNote] = useState( @@ -60,12 +71,26 @@ export default function ProductionListColumnProductionNote({ record }) { // onPressEnter={handleSaveNote} autoFocus allowClear + style={{ marginBottom: "1em" }} /> -
- -
+ + } trigger={["click"]} @@ -85,3 +110,8 @@ export default function ProductionListColumnProductionNote({ record }) { ); } + +export default connect( + mapStateToProps, + mapDispatchToProps +)(ProductionListColumnProductionNote);