diff --git a/client/src/components/production-list-columns/production-list-columns.date.component.jsx b/client/src/components/production-list-columns/production-list-columns.date.component.jsx index bd75f8c45..282fd3812 100644 --- a/client/src/components/production-list-columns/production-list-columns.date.component.jsx +++ b/client/src/components/production-list-columns/production-list-columns.date.component.jsx @@ -1,102 +1,111 @@ -import { useMutation } from "@apollo/client"; -import { Button, Card, Dropdown, TimePicker } from "antd"; +import {useMutation} from "@apollo/client"; +import {Button, Card, Dropdown, TimePicker} from "antd"; import dayjs from "../../utils/day"; -import React, { useState } from "react"; -import { useTranslation } from "react-i18next"; -import { logImEXEvent } from "../../firebase/firebase.utils"; -import { UPDATE_JOB } from "../../graphql/jobs.queries"; -import { DateFormatter } from "../../utils/DateFormatter"; +import React, {useState} from "react"; +import {useTranslation} from "react-i18next"; +import {logImEXEvent} from "../../firebase/firebase.utils"; +import {UPDATE_JOB} from "../../graphql/jobs.queries"; +import {DateFormatter} from "../../utils/DateFormatter"; import FormDatePicker from "../form-date-picker/form-date-picker.component"; export default function ProductionListDate({ - record, - field, - time, - pastIndicator, -}) { - const [updateAlert] = useMutation(UPDATE_JOB); - const [open, setOpen] = useState(false); - const { t } = useTranslation(); + record, + field, + time, + pastIndicator, + }) { + const [updateAlert] = useMutation(UPDATE_JOB); + const [open, setOpen] = useState(false); + const {t} = useTranslation(); - const handleChange = (date) => { - logImEXEvent("product_toggle_date", { field }); - // if (date.isSame(record[field] && dayjs(record[field]))) { - // return; - // } + const handleChange = (date) => { + logImEXEvent("product_toggle_date", {field}); + // if (date.isSame(record[field] && dayjs(record[field]))) { + // return; + // } - //e.stopPropagation(); + //e.stopPropagation(); - updateAlert({ - variables: { - jobId: record.id, - job: { - [field]: date, - }, - }, - optimisticResponse: { - update_jobs: { - [field]: date, - }, - }, - }).then(() => { - if (record.refetch) record.refetch(); - if (!time) { - setOpen(false); - } - }); - }; + updateAlert({ + variables: { + jobId: record.id, + job: { + [field]: date, + }, + }, + optimisticResponse: { + update_jobs: { + [field]: date, + }, + }, + }).then(() => { + if (record.refetch) record.refetch(); + if (!time) { + setOpen(false); + } + }); + }; - let className = ""; - if (pastIndicator) { - className = - !!record[field] && - ((dayjs().isSameOrAfter(dayjs(record[field]), "day") && - "production-completion-past") || - (dayjs().add(1, "day").isSame(dayjs(record[field]), "day") && - "production-completion-soon")); - } - // TODO - Client Update = Why is the overlay a card? - return ( - setOpen(v)} - open={open} - style={{ - height: "19px", - }} - overlay={ - e.stopPropagation()}> - e.stopPropagation()} - value={(record[field] && dayjs(record[field])) || null} - onChange={handleChange} - format="MM/DD/YYYY" - isDateOnly={!time} - /> - {time && ( - e.stopPropagation()} - value={(record[field] && dayjs(record[field])) || null} - onChange={handleChange} - minuteStep={15} - format="hh:mm a" - /> - )} - - - } - > -
setOpen(true)} - style={{ - height: "19px", - }} - className={className} - > - {record[field]} -
-
- ); + let className = ""; + if (pastIndicator) { + className = + !!record[field] && + ((dayjs().isSameOrAfter(dayjs(record[field]), "day") && + "production-completion-past") || + (dayjs().add(1, "day").isSame(dayjs(record[field]), "day") && + "production-completion-soon")); + } + // TODO - Client Update = Why is the overlay a card? + + const overlayMenu = { + items: [ + { + key: 'overlayItem1', + label: + e.stopPropagation()}> + e.stopPropagation()} + value={(record[field] && dayjs(record[field])) || null} + onChange={handleChange} + format="MM/DD/YYYY" + isDateOnly={!time} + /> + {time && ( + e.stopPropagation()} + value={(record[field] && dayjs(record[field])) || null} + onChange={handleChange} + minuteStep={15} + format="hh:mm a" + /> + )} + + + } + ] + } + + return ( + setOpen(v)} + open={open} + style={{ + height: "19px", + }} + menu={overlayMenu} + > +
setOpen(true)} + style={{ + height: "19px", + }} + className={className} + > + {record[field]} +
+
+ ); } diff --git a/client/src/components/production-list-columns/production-list-columns.lastcontacted.component.jsx b/client/src/components/production-list-columns/production-list-columns.lastcontacted.component.jsx index 8d3abf5ea..2292540d6 100644 --- a/client/src/components/production-list-columns/production-list-columns.lastcontacted.component.jsx +++ b/client/src/components/production-list-columns/production-list-columns.lastcontacted.component.jsx @@ -89,7 +89,45 @@ export function ProductionLastContacted({ currentUser, record }) { } }, [open, form, record.date_last_contacted]); - // TODO - Client Update - Why is this a card? + const overlayMenu = { + items: [ + { + key: 'overlay-item-1', + label: + e.stopPropagation()} + > +
+ + + + + + + + + + + + + +
+
+ } + ] + } + return (
e.stopPropagation()} - > -
- - - - - - - - - - - - - -
- - } + menu={overlayMenu} >
setOpen(true)}