feature/IO-3103-Ant5-Notifications

This commit is contained in:
Dave Richer
2025-01-21 17:20:46 -08:00
parent 0e218abbf4
commit 85d25862eb
161 changed files with 759 additions and 354 deletions

View File

@@ -9,6 +9,7 @@ import { handleUpload } from "./documents-local-upload.utility";
import { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component";
import LockWrapperComponent from "../lock-wrapper/lock-wrapper.component";
import { useTranslation } from "react-i18next";
import { useNotification } from "../../contexts/Notifications/notificationContext.jsx";
const mapStateToProps = createStructuredSelector({
currentUser: selectCurrentUser,
@@ -27,6 +28,8 @@ export function DocumentsLocalUploadComponent({
}) {
const [fileList, setFileList] = useState([]);
const { t } = useTranslation();
const notification = useNotification();
const handleDone = (uid) => {
setTimeout(() => {
setFileList((fileList) => fileList.filter((x) => x.uid !== uid));
@@ -53,7 +56,8 @@ export function DocumentsLocalUploadComponent({
vendorid,
invoice_number,
callback: callbackAfterUpload
}
},
notification
})
}
{...(!allowAllTypes && {

View File

@@ -2,10 +2,9 @@ import cleanAxios from "../../utils/CleanAxios";
import { store } from "../../redux/store";
import { addMediaForJob } from "../../redux/media/media.actions";
import normalizeUrl from "normalize-url";
import { notification } from "antd";
import i18n from "i18next";
export const handleUpload = async ({ ev, context }) => {
export const handleUpload = async ({ ev, context, notification }) => {
const { onError, onSuccess, onProgress, file } = ev;
const { jobid, invoice_number, vendorid, callbackAfterUpload } = context;
@@ -43,11 +42,15 @@ export const handleUpload = async ({ ev, context }) => {
}
} else {
onSuccess && onSuccess(file);
notification.open({
type: "success",
key: "docuploadsuccess",
message: i18n.t("documents.successes.insert")
});
if (notification) {
notification.open({
type: "success",
key: "docuploadsuccess",
message: i18n.t("documents.successes.insert")
});
} else {
console.error("No notification context found in document local upload utility.");
}
store.dispatch(
addMediaForJob({
jobid,