diff --git a/src/qqq/pages/records/view/RecordView.tsx b/src/qqq/pages/records/view/RecordView.tsx
index e8388a3..34367c5 100644
--- a/src/qqq/pages/records/view/RecordView.tsx
+++ b/src/qqq/pages/records/view/RecordView.tsx
@@ -49,11 +49,13 @@ import Tooltip from "@mui/material/Tooltip/Tooltip";
import QContext from "QContext";
import colors from "qqq/assets/theme/base/colors";
import AuditBody from "qqq/components/audits/AuditBody";
-import {QActionsMenuButton, QCancelButton, QDeleteButton, QEditButton} from "qqq/components/buttons/DefaultButtons";
+import {QActionsMenuButton, QCancelButton, QDeleteButton, QEditButton, standardWidth} from "qqq/components/buttons/DefaultButtons";
import EntityForm from "qqq/components/forms/EntityForm";
+import MDButton from "qqq/components/legacy/MDButton";
import {GotoRecordButton} from "qqq/components/misc/GotoRecordDialog";
import HelpContent, {hasHelpContent} from "qqq/components/misc/HelpContent";
import QRecordSidebar from "qqq/components/misc/RecordSidebar";
+import ShareModal from "qqq/components/sharing/ShareModal";
import DashboardWidgets from "qqq/components/widgets/DashboardWidgets";
import BaseLayout from "qqq/layouts/BaseLayout";
import ProcessRun from "qqq/pages/processes/ProcessRun";
@@ -82,6 +84,10 @@ RecordView.defaultProps =
const TABLE_VARIANT_LOCAL_STORAGE_KEY_ROOT = "qqq.tableVariant";
+
+/*******************************************************************************
+ ** Record View Screen component.
+ *******************************************************************************/
function RecordView({table, launchProcess}: Props): JSX.Element
{
const {id} = useParams();
@@ -117,6 +123,9 @@ function RecordView({table, launchProcess}: Props): JSX.Element
const [launchingProcess, setLaunchingProcess] = useState(launchProcess);
const [showEditChildForm, setShowEditChildForm] = useState(null as any);
const [showAudit, setShowAudit] = useState(false);
+ const [showShareModal, setShowShareModal] = useState(false);
+
+ const [isDeleteSubmitting, setIsDeleteSubmitting] = useState(false);
const openActionsMenu = (event: any) => setActionsMenu(event.currentTarget);
const closeActionsMenu = () => setActionsMenu(null);
@@ -622,6 +631,7 @@ function RecordView({table, launchProcess}: Props): JSX.Element
const handleClickDeleteButton = () =>
{
setDeleteConfirmationOpen(true);
+ setIsDeleteSubmitting(false);
};
const handleDeleteConfirmClose = () =>
@@ -631,6 +641,7 @@ function RecordView({table, launchProcess}: Props): JSX.Element
const handleDelete = (event: { preventDefault: () => void }) =>
{
+ setIsDeleteSubmitting(true);
event?.preventDefault();
(async () =>
{
@@ -639,11 +650,13 @@ function RecordView({table, launchProcess}: Props): JSX.Element
await qController.delete(tableName, id)
.then(() =>
{
+ setIsDeleteSubmitting(false);
const path = pathParts.slice(0, -1).join("/");
navigate(path, {state: {deleteSuccess: true}});
})
.catch((error) =>
{
+ setIsDeleteSubmitting(false);
setDeleteConfirmationOpen(false);
console.log("Caught:");
console.log(error);
@@ -759,6 +772,44 @@ function RecordView({table, launchProcess}: Props): JSX.Element
);
+
+ /*******************************************************************************
+ ** function to open the sharing modal
+ *******************************************************************************/
+ const openShareModal = () =>
+ {
+ setShowShareModal(true);
+ };
+
+
+ /*******************************************************************************
+ ** function to close the sharing modal
+ *******************************************************************************/
+ const closeShareModal = () =>
+ {
+ setShowShareModal(false);
+ };
+
+
+ /*******************************************************************************
+ ** render the share button (if allowed for table)
+ *******************************************************************************/
+ const renderShareButton = () =>
+ {
+ if (tableMetaData && (tableMetaData.name == "savedReport" || tableMetaData.name == "savedView")) // todo - not just based on name
+ {
+ const shareDisabled = false; // todo - only share if you're the owner? or do that in the modal?
+ return (
+ openShareModal()} fullWidth startIcon={share} disabled={shareDisabled}>
+ Share
+
+ );
+ }
+
+ return ();
+ };
+
+
const openModalProcess = (process: QProcessMetaData = null) =>
{
navigate(process.name);
@@ -914,6 +965,7 @@ function RecordView({table, launchProcess}: Props): JSX.Element
+ {renderShareButton()}
{renderActionsMenu}
@@ -962,7 +1014,7 @@ function RecordView({table, launchProcess}: Props): JSX.Element
-
@@ -1010,6 +1062,11 @@ function RecordView({table, launchProcess}: Props): JSX.Element
}
+ {
+ showShareModal && tableMetaData && record &&
+
+ }
+
}