import { AuditOutlined, DeleteFilled, EditFilled, EyeInvisibleFilled, WarningFilled, } from "@ant-design/icons"; import { Button, Card, Form, Input, Space, Table } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectJobReadOnly } from "../../redux/application/application.selectors"; import { setModalContext } from "../../redux/modals/modals.actions"; import { DateTimeFormatter } from "../../utils/DateFormatter"; import { TemplateList } from "../../utils/TemplateConstants"; import LayoutFormRow from "../layout-form-row/layout-form-row.component"; import NoteUpsertModal from "../note-upsert-modal/note-upsert-modal.container"; import PrintWrapperComponent from "../print-wrapper/print-wrapper.component"; const mapStateToProps = createStructuredSelector({ jobRO: selectJobReadOnly, }); const mapDispatchToProps = (dispatch) => ({ setNoteUpsertContext: (context) => dispatch(setModalContext({ context: context, modal: "noteUpsert" })), }); export function JobNotesComponent({ jobRO, loading, data, refetch, handleNoteDelete, jobId, setNoteUpsertContext, deleteLoading, ro_number, relatedRos, }) { const { t } = useTranslation(); const Templates = TemplateList("job_special", { ro_number, }); const columns = [ { title: "", dataIndex: "icons", key: "icons", width: 80, render: (text, record) => ( {record.critical ? ( ) : null} {record.private ? : null} {record.audit ? : null} ), }, { title: t("notes.fields.text"), dataIndex: "text", key: "text", ellipsis: true, render: (text, record) => ( {text} ), }, { title: t("notes.fields.updatedat"), dataIndex: "updated_at", key: "updated_at", defaultSortOrder: "descend", width: 200, sorter: (a, b) => new Date(a.updated_at) - new Date(b.updated_at), render: (text, record) => ( {record.updated_at} ), }, { title: t("notes.fields.createdby"), dataIndex: "created_by", key: "created_by", width: 200, }, { title: t("notes.actions.actions"), dataIndex: "actions", key: "actions", width: 150, render: (text, record) => ( ), }, ]; return (
{ setNoteUpsertContext({ actions: { refetch: refetch }, context: { jobId: jobId, relatedRos: relatedRos, }, }); }} > {t("notes.actions.new")} } > ); } export default connect(mapStateToProps, mapDispatchToProps)(JobNotesComponent);