Compare commits

..

1 Commits

Author SHA1 Message Date
Allan Carr
f5b16394f9 IO-3590 Admin Save Buttons
Signed-off-by: Allan Carr <allan@imexsystems.ca>
2026-03-06 18:16:36 -08:00
6 changed files with 36 additions and 60 deletions

View File

@@ -69,7 +69,9 @@ export function JobsAdminClass({ bodyshop, job }) {
</Form>
<Popconfirm title={t("jobs.labels.changeclass")} onConfirm={() => form.submit()}>
<Button loading={loading}>{t("general.actions.save")}</Button>
<Button loading={loading} type="primary">
{t("general.actions.save")}
</Button>
</Popconfirm>
</div>
);

View File

@@ -157,7 +157,7 @@ export function JobsAdminDatesChange({ insertAuditTrail, job }) {
</LayoutFormRow>
</Form>
<Button loading={loading} onClick={() => form.submit()}>
<Button loading={loading} type="primary" onClick={() => form.submit()}>
{t("general.actions.save")}
</Button>
</div>

View File

@@ -54,7 +54,7 @@ export default function JobAdminOwnerReassociate({ job }) {
</Form.Item>
</Form>
<div>{t("jobs.labels.associationwarning")}</div>
<Button loading={loading} onClick={() => form.submit()}>
<Button loading={loading} type="primary" onClick={() => form.submit()}>
{t("general.actions.save")}
</Button>
</div>

View File

@@ -54,7 +54,7 @@ export default function JobAdminOwnerReassociate({ job }) {
</Form.Item>
</Form>
<div>{t("jobs.labels.associationwarning")}</div>
<Button loading={loading} onClick={() => form.submit()}>
<Button loading={loading} type="primary" onClick={() => form.submit()}>
{t("general.actions.save")}
</Button>
</div>

View File

@@ -1,7 +1,7 @@
import Icon from "@ant-design/icons";
import { useMutation } from "@apollo/client/react";
import { Button, Input, Popover, Tooltip } from "antd";
import { useState, useRef } from "react";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { FaRegStickyNote } from "react-icons/fa";
import { UPDATE_JOB } from "../../graphql/jobs.queries";
@@ -9,10 +9,10 @@ import { logImEXEvent } from "../../firebase/firebase.utils";
export default function ProductionListColumnComment({ record, usePortal = false }) {
const { t } = useTranslation();
const [note, setNote] = useState(record.comment || "");
const [open, setOpen] = useState(false);
const textAreaRef = useRef(null);
const rafIdRef = useRef(null);
const [updateAlert] = useMutation(UPDATE_JOB);
@@ -38,35 +38,23 @@ export default function ProductionListColumnComment({ record, usePortal = false
};
const handleOpenChange = (flag) => {
if (rafIdRef.current) {
cancelAnimationFrame(rafIdRef.current);
rafIdRef.current = null;
}
setOpen(flag);
if (flag) {
setNote(record.comment || "");
rafIdRef.current = requestAnimationFrame(() => {
rafIdRef.current = null;
if (textAreaRef.current?.focus) {
try {
textAreaRef.current.focus({ preventScroll: true });
} catch {
textAreaRef.current.focus();
}
}
});
}
if (flag) setNote(record.comment || "");
};
const content = (
<div style={{ width: "30em" }} onClick={(e) => e.stopPropagation()} onPointerDown={(e) => e.stopPropagation()}>
<div
style={{ width: "30em" }}
onClick={(e) => e.stopPropagation()}
onPointerDown={(e) => e.stopPropagation()}
>
<Input.TextArea
id={`job-comment-${record.id}`}
name="comment"
rows={5}
value={note}
onChange={handleChange}
ref={textAreaRef}
autoFocus
allowClear
style={{ marginBottom: "1em" }}
/>
@@ -79,13 +67,13 @@ export default function ProductionListColumnComment({ record, usePortal = false
);
return (
<Popover
onOpenChange={handleOpenChange}
open={open}
content={content}
trigger="click"
<Popover
onOpenChange={handleOpenChange}
open={open}
content={content}
trigger="click"
destroyOnHidden
styles={{ body: { padding: "12px" } }}
styles={{ body: { padding: '12px' } }}
{...(usePortal ? { getPopupContainer: (trigger) => trigger.parentElement || document.body } : {})}
>
<div

View File

@@ -1,7 +1,7 @@
import Icon from "@ant-design/icons";
import { useMutation } from "@apollo/client/react";
import { Button, Input, Popover, Space } from "antd";
import { useCallback, useRef, useState } from "react";
import { useCallback, useState } from "react";
import { useTranslation } from "react-i18next";
import { FaRegStickyNote } from "react-icons/fa";
import { logImEXEvent } from "../../firebase/firebase.utils";
@@ -20,8 +20,6 @@ function ProductionListColumnProductionNote({ record, setNoteUpsertContext, useP
const { t } = useTranslation();
const [note, setNote] = useState(record.production_vars?.note || "");
const [open, setOpen] = useState(false);
const textAreaRef = useRef(null);
const rafIdRef = useRef(null);
const [updateAlert] = useMutation(UPDATE_JOB);
@@ -54,37 +52,25 @@ function ProductionListColumnProductionNote({ record, setNoteUpsertContext, useP
const handleOpenChange = useCallback(
(flag) => {
if (rafIdRef.current) {
cancelAnimationFrame(rafIdRef.current);
rafIdRef.current = null;
}
setOpen(flag);
if (flag) {
setNote(record.production_vars?.note || "");
rafIdRef.current = requestAnimationFrame(() => {
rafIdRef.current = null;
if (textAreaRef.current?.focus) {
try {
textAreaRef.current.focus({ preventScroll: true });
} catch {
textAreaRef.current.focus();
}
}
});
}
if (flag) setNote(record.production_vars?.note || "");
},
[record]
);
const content = (
<div style={{ width: "30em" }} onClick={(e) => e.stopPropagation()} onPointerDown={(e) => e.stopPropagation()}>
<div
style={{ width: "30em" }}
onClick={(e) => e.stopPropagation()}
onPointerDown={(e) => e.stopPropagation()}
>
<Input.TextArea
id={`job-production-note-${record.id}`}
name="production_note"
rows={5}
value={note}
onChange={handleChange}
ref={textAreaRef}
autoFocus
allowClear
style={{ marginBottom: "1em" }}
/>
@@ -110,13 +96,13 @@ function ProductionListColumnProductionNote({ record, setNoteUpsertContext, useP
);
return (
<Popover
onOpenChange={handleOpenChange}
open={open}
content={content}
trigger="click"
<Popover
onOpenChange={handleOpenChange}
open={open}
content={content}
trigger="click"
destroyOnHidden
styles={{ body: { padding: "12px" } }}
styles={{ body: { padding: '12px' } }}
{...(usePortal ? { getPopupContainer: (trigger) => trigger.parentElement || document.body } : {})}
>
<div