diff --git a/components/ReportsSection.jsx b/components/ReportsSection.jsx index 9242073..efb1668 100644 --- a/components/ReportsSection.jsx +++ b/components/ReportsSection.jsx @@ -314,6 +314,19 @@ const ReportsSection = ({ e.preventDefault() setReportModalShow(false) } + + const handleDetailChange = async (e) => { + e.preventDefault() + let reportId = reportModalId + if (e.target.value !== report['detail']) { + const docRef = doc(db, 'reports', reportId) + await updateDoc(docRef, { detail: e.target.value }) + setUpdate(e.target.value) + } else { + setUpdate('') + } + } + const handleNoteChange = async (e) => { e.preventDefault() let reportId = reportModalId @@ -914,6 +927,7 @@ const ReportsSection = ({ setReportModalShow={setReportModalShow} reportModalId={reportModalId} onNoteChange={handleNoteChange} + onDetailChange={handleDetailChange} onLabelChange={handleLabelChange} selectedLabel={selectedLabel} activeLabels={activeLabels} diff --git a/components/modals/ReportModal.jsx b/components/modals/ReportModal.jsx index 6047653..ed5eeef 100644 --- a/components/modals/ReportModal.jsx +++ b/components/modals/ReportModal.jsx @@ -1,21 +1,21 @@ -import React, { useEffect, useState } from "react" import { Switch } from "@material-tailwind/react"; -import ButtonEmailSend from "../partials/ButtonEmailSend" -import ShareReportModal from "../partials/modals/ShareReportModal" -import { MdMarkAsUnread, MdMarkEmailRead } from "react-icons/md" -import Link from "next/link" -import Image from "next/image" -import {Tooltip} from "react-tooltip"; +import Image from "next/image"; +import Link from "next/link"; +import React, { useEffect, useState } from "react"; +import { MdMarkAsUnread, MdMarkEmailRead } from "react-icons/md"; +import { Tooltip } from "react-tooltip"; +import ButtonEmailSend from "../partials/ButtonEmailSend"; +import ShareReportModal from "../partials/modals/ShareReportModal"; // icons -import { RiMessage2Fill } from "react-icons/ri" -import { BiEditAlt } from "react-icons/bi" +import { BiEditAlt } from "react-icons/bi"; +import { RiMessage2Fill } from "react-icons/ri"; // import { BsShareFill } from "react-icons/bs" +import { AiOutlineFieldTime, AiOutlineUser } from "react-icons/ai"; import { BiLinkExternal } from "react-icons/bi"; -import { AiOutlineFieldTime, AiOutlineUser } from "react-icons/ai" // import { MdOutlineLocalPhone } from "react-icons/md"; -import { IoClose, IoTrash, IoLocation, IoBusinessOutline } from "react-icons/io5" import { useTranslation } from 'next-i18next'; +import { IoBusinessOutline, IoClose, IoLocation, IoTrash } from "react-icons/io5"; const ReportModal = ({ customClaims, setReportModalShow, @@ -38,6 +38,7 @@ const ReportModal = ({ // read status END postedDate, reportLocation, + onDetailChange, onNoteChange, onReportDelete, changeStatus, @@ -82,20 +83,20 @@ const ReportModal = ({ // useEffect(() => { // console.log(customClaims); // }, [reportModalId]) - + return (
setReportModalShow(false)}>
{ e.stopPropagation() }}>
-
-
+
+
Report Information
@@ -114,7 +115,7 @@ const ReportModal = ({ <> {/* Title */}
Title
-
+
{report.title || ( No Title )} @@ -167,61 +168,61 @@ const ReportModal = ({
{" "} {/* END left side */} -
+
{/* Sources & tags */} -
+
-
+
Tag
-
{report.topic}
+
{report.topic}
-
+
-
+
Sources / Media
-
+
{report.hearFrom}
{/* Date */} -
+
-
+
Date / Time
-
{postedDate}
+
{postedDate}
{/* City state */} -
+
-
+
City, State
-
{reportLocation}
+
{reportLocation}
{/* Agency */} {report.agency && ( <> -
+
-
+
Agency
-
+
{report.agency}
)} {reportSubmitBy.contact && ( -
+
-
- Reported by{" "} +
+ Reported by{" "} {reportSubmitBy.name} ( )} {/* {reportSubmitBy.contact && reportSubmitBy.phone && -
+ {/* Images */} -
+
Images
-
+
{report.images ? report.images.map((image, i) => { return ( @@ -281,7 +282,7 @@ const ReportModal = ({
{/* Newsroom Edits */} -
+
{/* Notes */}
Newsroom's Notes
@@ -291,7 +292,7 @@ const ReportModal = ({ placeholder='No notes yet...' className={note ? style.textarea : style.textarea + ` italic`} rows='6' - readOnly={customClaims.admin ? true : false} + readOnly={customClaims.admin ? false : true} defaultValue={note}>
{/* label read share & save */} @@ -303,7 +304,7 @@ const ReportModal = ({ id='labels' onChange={onLabelChange} value={selectedLabel || ''} - className='text-sm inline-block px-8 border-none bg-yellow-400 py-1 rounded-2xl shadow hover:shadow-none'> + className='inline-block px-8 py-1 text-sm bg-yellow-400 border-none shadow rounded-2xl hover:shadow-none'> {/* Default option representing no label */} @@ -315,13 +316,13 @@ const ReportModal = ({ ))} {changeStatus && ( - + {changeStatus} )}
{/* Read/Unread */} -
+
{checked ? ( @@ -345,15 +346,15 @@ const ReportModal = ({ setShareReportModal(true)} />
-
+
{/* Delete button */} -
+