|
@@ -5,6 +5,7 @@ import { API_HOST, get } from "../../../request";
|
|
|
import { UploadFile } from "antd/es/upload/interface";
|
|
import { UploadFile } from "antd/es/upload/interface";
|
|
|
import { IAttachmentResponse } from "../../api/Attachments";
|
|
import { IAttachmentResponse } from "../../api/Attachments";
|
|
|
import modal from "antd/lib/modal";
|
|
import modal from "antd/lib/modal";
|
|
|
|
|
+import { useIntl } from "react-intl";
|
|
|
|
|
|
|
|
interface INissayaEndingUpload {
|
|
interface INissayaEndingUpload {
|
|
|
filename: UploadFile<IAttachmentResponse>[];
|
|
filename: UploadFile<IAttachmentResponse>[];
|
|
@@ -26,17 +27,18 @@ interface IWidget {
|
|
|
onSuccess?: Function;
|
|
onSuccess?: Function;
|
|
|
}
|
|
}
|
|
|
const DataImportWidget = ({
|
|
const DataImportWidget = ({
|
|
|
- title = "upload",
|
|
|
|
|
|
|
+ title,
|
|
|
url,
|
|
url,
|
|
|
urlExtra,
|
|
urlExtra,
|
|
|
trigger = <>{"trigger"}</>,
|
|
trigger = <>{"trigger"}</>,
|
|
|
onSuccess,
|
|
onSuccess,
|
|
|
}: IWidget) => {
|
|
}: IWidget) => {
|
|
|
|
|
+ const intl = useIntl();
|
|
|
const [form] = Form.useForm<INissayaEndingUpload>();
|
|
const [form] = Form.useForm<INissayaEndingUpload>();
|
|
|
-
|
|
|
|
|
|
|
+ const formTitle = title ? title : intl.formatMessage({ id: "labels.upload" });
|
|
|
return (
|
|
return (
|
|
|
<ModalForm<INissayaEndingUpload>
|
|
<ModalForm<INissayaEndingUpload>
|
|
|
- title={title}
|
|
|
|
|
|
|
+ title={formTitle}
|
|
|
trigger={trigger}
|
|
trigger={trigger}
|
|
|
form={form}
|
|
form={form}
|
|
|
autoFocusFirstInput
|
|
autoFocusFirstInput
|
|
@@ -61,10 +63,7 @@ const DataImportWidget = ({
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const queryUrl = `${url}?filename=${_filename}&${urlExtra}`;
|
|
const queryUrl = `${url}?filename=${_filename}&${urlExtra}`;
|
|
|
- console.log("url", queryUrl);
|
|
|
|
|
const res = await get<INissayaEndingImportResponse>(queryUrl);
|
|
const res = await get<INissayaEndingImportResponse>(queryUrl);
|
|
|
-
|
|
|
|
|
- console.log("import", res);
|
|
|
|
|
if (res.ok) {
|
|
if (res.ok) {
|
|
|
if (res.data.fail > 0) {
|
|
if (res.data.fail > 0) {
|
|
|
modal.info({
|
|
modal.info({
|