diff --git a/components/Digitization/DigitizationContainerList.js b/components/Digitization/DigitizationContainerList.js new file mode 100644 index 0000000..836df55 --- /dev/null +++ b/components/Digitization/DigitizationContainerList.js @@ -0,0 +1,82 @@ +import React from 'react' +import PopupTable from "../../components/Tables/PopupTable"; +import {renderDigitalVersion} from "../../utils/renders/renderDigitalVersion"; +import {renderDigitalVersionResearchCloud} from "../../utils/renders/renderDigitalVersionResearchCloud"; +import {renderLevel} from "../../utils/renders/renderLevel" +import style from "./DigitizationContainerList.module.scss" + +export default function DigitizationContainerList() { + const renderContainerNo = (data, record) => { + return {data} + } + + const columns = [ + { + title: 'Container No.', + dataIndex: 'container_no', + key: 'container_no', + sorter: true, + width: 200, + render: renderContainerNo, + }, { + title: 'Barcode', + dataIndex: 'barcode', + key: 'barcode', + width: 140, + sorter: true + }, { + title: 'Research Cloud', + key: 'available_research_cloud', + width: 120, + className: 'centerColumn', + sorter: true, + render: renderDigitalVersionResearchCloud + }, { + title: 'Online', + dataIndex: 'available_online', + key: 'available_online', + width: 120, + className: 'centerColumn', + sorter: true, + render: renderDigitalVersion + }, { + title: 'Creation Date (Digital)', + dataIndex: 'creation_date', + key: 'creation_date', + className: 'centerColumn', + width: 150, + sorter: true + }, { + title: 'Level', + dataIndex: 'level', + key: 'level', + className: 'centerColumn', + width: 80, + render: renderLevel + }, { + title: 'Duration', + dataIndex: 'duration', + key: 'duration', + width: 100, + className: 'centerColumn', + }, { + title: 'Carrier Type', + dataIndex: 'carrier_type', + key: 'carrier_type', + className: 'centerColumn', + sorter: true + }, + ]; + + return ( + + ) +} diff --git a/components/Digitization/DigitizationContainerList.module.scss b/components/Digitization/DigitizationContainerList.module.scss new file mode 100644 index 0000000..2285282 --- /dev/null +++ b/components/Digitization/DigitizationContainerList.module.scss @@ -0,0 +1,9 @@ +.ContainerNo { + text-decoration: none; + color: inherit; + border-bottom: 1px dotted gray; + + &:hover { + color: #000; + } +} \ No newline at end of file diff --git a/components/Digitization/DigitizationFindingAidsList.js b/components/Digitization/DigitizationFindingAidsList.js new file mode 100644 index 0000000..8836fc2 --- /dev/null +++ b/components/Digitization/DigitizationFindingAidsList.js @@ -0,0 +1,65 @@ +import React from 'react' +import {Card} from "antd"; +import PopupTable from "../../components/Tables/PopupTable"; +import {renderDigitalVersion} from "../../utils/renders/renderDigitalVersion"; +import {renderDigitalVersionResearchCloud} from "../../utils/renders/renderDigitalVersionResearchCloud"; + +export default function DigitizationFindingAidsList() { + const columns = [ + { + title: 'Reference No.', + dataIndex: 'archival_reference_code', + key: 'archival_reference_code', + sorter: true, + width: 200 + }, { + title: 'Digital Version', + dataIndex: 'digital_version_exists', + key: 'digital_version_exists', + width: 150, + className: 'centerColumn', + sorter: true, + render: renderDigitalVersion + }, { + title: 'Research Cloud', + key: 'digital_version_research_cloud', + width: 150, + className: 'centerColumn', + sorter: true, + render: renderDigitalVersionResearchCloud + }, { + title: 'Online', + dataIndex: 'digital_version_online', + key: 'digital_version_online', + width: 150, + className: 'centerColumn', + sorter: true, + render: renderDigitalVersion + }, { + title: 'Creation Date', + dataIndex: 'digital_version_creation_date', + key: 'digital_version_creation_date', + className: 'centerColumn', + width: 150, + sorter: true + }, { + title: 'Primary Type', + dataIndex: 'primary_type', + key: 'primary_type', + className: 'centerColumn', + sorter: true + }, + ]; + + return ( + + ) +} diff --git a/components/Digitization/DigitizationLogView.js b/components/Digitization/DigitizationLogView.js new file mode 100644 index 0000000..b9db11b --- /dev/null +++ b/components/Digitization/DigitizationLogView.js @@ -0,0 +1,50 @@ +import React, {useState} from "react"; +import {Radio, Card} from "antd"; +import DigitizationContainerList from "./DigitizationContainerList"; +import DigitizationFindingAidsList from "./DigitizationFindingAidsList"; + + +const DigitazationLogView = () => { + const [view, setView] = useState('container'); + + const getTitle = () => { + switch (view) { + case 'container': + return 'Digitized Containers'; + case 'finding_aids': + return 'Digitized Finding Aids (Folders / Items)'; + default: + break; + } + }; + + const getView = () => { + switch (view) { + case 'container': + return (); + case 'finding_aids': + return (); + default: + break; + } + }; + + const onChange = (e) => { + setView(e.target.value); + }; + + const viewChange = () => ( + + Containers + Finding Aids (Folders / Items) + + ); + + return ( + + {getView()} + + ) +}; + +export default DigitazationLogView; diff --git a/components/Forms/ArchivalUnitSelectForm.js b/components/Forms/ArchivalUnitSelectForm.js index 9adc901..626d845 100644 --- a/components/Forms/ArchivalUnitSelectForm.js +++ b/components/Forms/ArchivalUnitSelectForm.js @@ -1,36 +1,44 @@ -import React, {useState} from 'react'; +import React, {useEffect, useState} from 'react'; import {Button, Card, Col, Form, Row} from "antd"; import style from "./Forms.module.css"; import FormRemoteSelect from "./components/FormRemoteSelect"; import { ContainerOutlined } from '@ant-design/icons'; import Link from "next/link"; import {renderArchivalUnitDropdown} from "../../utils/renders/renderArchivalUnitDropdown"; +import useStickyState from "../../utils/hooks/useStickyState"; export const ArchivalUnitSelectForm = () => { const [form] = Form.useForm(); - const [fonds, setFonds] = useState(undefined); - const [subfonds, setSubfonds] = useState(undefined); - const [series, setSeries] = useState(undefined); + const [ archivalUnitFormState, setArchivalUnitFormState ] = useStickyState({ + fonds: undefined, + subfonds: undefined, + series: undefined + }, 'ams-select-archival-unit-form') + const onValuesChange = (values) => { if (values.hasOwnProperty('fonds')) { form.setFieldsValue({subfonds: undefined}); form.setFieldsValue({series: undefined}); - setFonds(values['fonds']); - setSubfonds(undefined); - setSeries(undefined); + setArchivalUnitFormState({ + fonds: values['fonds'], subfonds: undefined, series: undefined + }) } if (values.hasOwnProperty('subfonds')) { form.setFieldsValue({series: undefined}); - setSubfonds(values['subfonds']); - setSeries(undefined); + + setArchivalUnitFormState({ + fonds: archivalUnitFormState['fonds'], subfonds: values['subfonds'], series: undefined + }) } if (values.hasOwnProperty('series')) { - setSeries(values['series']); + setArchivalUnitFormState({ + fonds: archivalUnitFormState['fonds'], subfonds: archivalUnitFormState['subfonds'], series: values['series'] + }) } }; @@ -40,6 +48,7 @@ export const ArchivalUnitSelectForm = () => { scrollToFirstError={true} form={form} onValuesChange={onValuesChange} + initialValues={archivalUnitFormState} layout={'vertical'} className={style.Form} > @@ -53,6 +62,7 @@ export const ArchivalUnitSelectForm = () => { selectAPI={'/v1/archival_unit/select/'} selectAPIParams={{level: 'F'}} placeholder={'- Select Fonds -'} + searchMinLength={0} /> @@ -62,8 +72,9 @@ export const ArchivalUnitSelectForm = () => { valueField={'id'} labelField={'title_full'} renderFunction={renderArchivalUnitDropdown} - selectAPI={fonds ? `/v1/archival_unit/select/${fonds}/` : undefined} + selectAPI={archivalUnitFormState['fonds'] ? `/v1/archival_unit/select/${archivalUnitFormState['fonds']}/` : undefined} placeholder={'- Select Subfonds -'} + searchMinLength={0} /> @@ -73,8 +84,9 @@ export const ArchivalUnitSelectForm = () => { valueField={'id'} labelField={'title_full'} renderFunction={renderArchivalUnitDropdown} - selectAPI={subfonds ? `/v1/archival_unit/select/${subfonds}/` : undefined} + selectAPI={archivalUnitFormState['subfonds'] ? `/v1/archival_unit/select/${archivalUnitFormState['subfonds']}/` : undefined} placeholder={'- Select Series -'} + searchMinLength={0} /> @@ -82,10 +94,10 @@ export const ArchivalUnitSelectForm = () => { - + diff --git a/components/Forms/ContainerCreateForm.js b/components/Forms/ContainerCreateForm.js index 952ad27..65aa9a1 100644 --- a/components/Forms/ContainerCreateForm.js +++ b/components/Forms/ContainerCreateForm.js @@ -1,16 +1,25 @@ -import {Button, Card, Col, Form, Input, notification, Row} from "antd"; +import {Button, Col, Form, Input, Row} from "antd"; import style from "./Forms.module.css"; import React, {useState} from "react"; import FormRemoteSelect from "./components/FormRemoteSelect"; import {useData} from "../../utils/hooks/useData"; import {post} from "../../utils/api"; +import {useUpdateEffect} from "react-use"; -export const ContainerCreateForm = ({seriesID, containerListRefresh}) => { +export const ContainerCreateForm = ({seriesID, containerListRefresh, deletedContainer}) => { const [loading, setLoading] = useState(false); const [form] = Form.useForm(); const {data, refresh} = useData(seriesID ? `/v1/container/precreate/${seriesID}/` : undefined); + useUpdateEffect(() => { + form.setFieldValue('container_no', data['container_no']) + }, [data]) + + useUpdateEffect(() => { + refresh() + }, [deletedContainer]) + const validateMessages = { required: 'This field is required!' }; diff --git a/components/Forms/FindingAidsForm.js b/components/Forms/FindingAidsForm.js index def21bd..861e5df 100644 --- a/components/Forms/FindingAidsForm.js +++ b/components/Forms/FindingAidsForm.js @@ -7,7 +7,7 @@ import {SimpleFormFooter} from "./SimpleFormFooter"; import {FindingAidsEntityForm} from "./fields/FindingAidsEntityForm"; import {useData} from "../../utils/hooks/useData"; -export const FindingAidsForm = ({type, recordID, containerID, seriesID, initialValues}) => { +export const FindingAidsForm = ({type, recordID, containerID, seriesID, onActiveTabChange, initialValues}) => { const [params, setParams] = useState({}); const router = useRouter(); @@ -83,6 +83,7 @@ export const FindingAidsForm = ({type, recordID, containerID, seriesID, initialV form={form} locale={locale} type={type} + onActiveTabChange={onActiveTabChange} /> diff --git a/components/Forms/FindingAidsTemplateForm.js b/components/Forms/FindingAidsTemplateForm.js index 6bb0227..a5ff331 100644 --- a/components/Forms/FindingAidsTemplateForm.js +++ b/components/Forms/FindingAidsTemplateForm.js @@ -9,6 +9,12 @@ import {useRouter} from "next/router"; export const FindingAidsTemplateForm = ({type, recordID, seriesID, initialValues}) => { const router = useRouter(); + const [activeTabKey, setActiveTabKey] = useState('') + + const onActiveTabChange = (activeKey) => { + setActiveTabKey(activeKey) + } + const getAPI = () => { switch (type) { case 'create': @@ -52,6 +58,7 @@ export const FindingAidsTemplateForm = ({type, recordID, seriesID, initialValues form={form} locale={locale} type={type} + onActiveTabChange={onActiveTabChange} /> diff --git a/components/Forms/Forms.module.css b/components/Forms/Forms.module.css index 42d46d2..72e5651 100644 --- a/components/Forms/Forms.module.css +++ b/components/Forms/Forms.module.css @@ -31,6 +31,7 @@ .FooterInfo { border-top: 0; + margin-top: 20px; margin-bottom: 0; } diff --git a/components/Forms/PopupForm.js b/components/Forms/PopupForm.js index f3df24d..c77a31a 100644 --- a/components/Forms/PopupForm.js +++ b/components/Forms/PopupForm.js @@ -1,5 +1,5 @@ import React, {useEffect} from "react"; -import {Form, Row, Col, Button, Input} from 'antd'; +import {Form, Row, Col, Button, Input, Divider} from 'antd'; import style from './Forms.module.css'; import {CarrierTypeForm} from "./fields/CarrierTypeForm"; import {CorporationForm} from "./fields/CorporationForm"; @@ -16,8 +16,8 @@ import {DonorForm} from "./fields/DonorForm"; import {useData} from "../../utils/hooks/useData"; import {fillManyFields} from "../../utils/functions/fillManyFields"; import {IsaarForm} from "./fields/IsaarForm"; -import {BarcodeForm} from "./fields/BarcodeForm"; -import {ContainerForm} from "./fields/ContainerForm"; +import {BarcodeForm} from "./fields/containers/BarcodeForm"; +import {ContainerForm} from "./fields/containers/ContainerForm"; import {ExtentUnitForm} from "./fields/ExtentUnitForm"; import {RoleForm} from "./fields/RoleForm"; import {useForm} from "../../utils/hooks/useForm"; @@ -27,10 +27,13 @@ import {MLRForm} from "./fields/MLRForm"; import {DigitizationForm} from "./fields/DigitizationForm"; import {RequestsForm} from "./fields/RequestsForm"; import {RequestItemForm} from "./fields/RequestsItemForm"; +import {NationalityForm} from "./fields/NationalityForm"; +import AuditLog from "./auditLog/AuditLog"; +import DigitalVersionsTable from "./fields/containers/DigitalVersionsTable"; -export const PopupForm = ({api, preCreateAPI, selectedRecord, module, type, field, label, onClose}) => { - const afterFinish = () => { - onClose(); +export const PopupForm = ({api, preCreateAPI, selectedRecord, module, type, field, label, hasMerge=true, onClose}) => { + const afterFinish = (data) => { + onClose(data); }; const {form, formLoading, errors, onFinish, renderErrors, onValuesChange} = @@ -38,7 +41,7 @@ export const PopupForm = ({api, preCreateAPI, selectedRecord, module, type, fiel const readOnly = type === 'view'; - const {data, loading} = useData(selectedRecord ? `${preCreateAPI ? preCreateAPI : api}${selectedRecord}/` : undefined); + const {data} = useData(selectedRecord ? `${preCreateAPI ? preCreateAPI : api}${selectedRecord}/` : undefined); useEffect(() => { form.setFieldsValue(data) @@ -59,7 +62,7 @@ export const PopupForm = ({api, preCreateAPI, selectedRecord, module, type, fiel case 'languages': return ; case 'people': - return ; + return ; case 'places': return ; case 'subjects': @@ -77,7 +80,7 @@ export const PopupForm = ({api, preCreateAPI, selectedRecord, module, type, fiel case 'donors': return ; case 'isaar': - return ; + return {}} />; case 'barcode': return ; case 'container': @@ -88,6 +91,8 @@ export const PopupForm = ({api, preCreateAPI, selectedRecord, module, type, fiel return ; case 'corporation_role': return ; + case 'nationality': + return ; case 'geo_role': return ; case 'finding-aids-quick-edit': @@ -100,6 +105,8 @@ export const PopupForm = ({api, preCreateAPI, selectedRecord, module, type, fiel return ; case 'request_item': return ; + case 'digital-versions': + return ''; default: return ( @@ -164,40 +171,72 @@ export const PopupForm = ({api, preCreateAPI, selectedRecord, module, type, fiel } }; - return ( - - { errors && renderErrors() } -
- - {renderFields()} - - - - { - type !== 'view' && - - } - - -
-
- ) + if (module === 'digital-versions') { + if (data && data.digital_versions && data.digital_versions.length > 0) { + return ( + <> + + + ) + } else { + return null; + } + } else { + return ( + + { errors && renderErrors() } +
+ + {renderFields()} + + + + { + type !== 'view' && + + } + + + {data && data.hasOwnProperty('date_created') && +
+ + +

+ Record created: + {data['date_created']} + {data['user_created'] ? ` by '${data['user_created']}'` : ''} +

+

+ Record updated: + {data['date_updated']} + {data['user_updated'] ? ` by '${data['user_updated']}'` : ''} +

+ + +
+
+ } +
+
+ ) + } + }; diff --git a/components/Forms/SimpleForm.js b/components/Forms/SimpleForm.js index 02900a2..08b34d2 100644 --- a/components/Forms/SimpleForm.js +++ b/components/Forms/SimpleForm.js @@ -18,10 +18,10 @@ const MODULES = { 'isaar': 'ISAAR-CPF', 'isad': 'ISAD(G)', 'researchers-db/researchers': 'Researcher', - 'researchers-db/requests': 'Request' + 'requests/list': 'Request' }; -export const SimpleForm = ({api, module, type, initialValues}) => { +export const SimpleForm = ({api, module, type, initialValues, onActiveTabChange}) => { const router = useRouter(); const afterFinish = () => { @@ -43,14 +43,14 @@ export const SimpleForm = ({api, module, type, initialValues}) => { case 'donors': return ; case 'isaar': - return ; + return ; case 'isad': - return ; + return ; case 'finding-aids': - return ; + return ; case 'researchers-db/researchers': return ; - case 'researchers-db/requests': + case 'requests/list': return ; default: break; diff --git a/components/Forms/SimpleFormFooter.js b/components/Forms/SimpleFormFooter.js index 0eab350..bfd9261 100644 --- a/components/Forms/SimpleFormFooter.js +++ b/components/Forms/SimpleFormFooter.js @@ -3,6 +3,7 @@ import style from "./Forms.module.css"; import React, {useState} from "react"; import {useRouter} from "next/router"; import Collapse from "@kunukn/react-collapse"; +import AuditLog from "./auditLog/AuditLog"; export const SimpleFormFooter = ({form, type, loading, module}) => { const router = useRouter(); @@ -53,6 +54,7 @@ export const SimpleFormFooter = ({form, type, loading, module}) => { {form.getFieldValue('date_updated')} {form.getFieldValue('user_updated') ? ` by '${form.getFieldValue('user_updated')}'` : ''}

+ diff --git a/components/Forms/auditLog/AuditLog.js b/components/Forms/auditLog/AuditLog.js new file mode 100644 index 0000000..82d0d4d --- /dev/null +++ b/components/Forms/auditLog/AuditLog.js @@ -0,0 +1,68 @@ +import React from "react"; +import {useData} from "../../../utils/hooks/useData"; +import moment from "moment"; + +const AuditLog = ({module, object_id}) => { + const getParams = () => { + let model = '' + + if (module.includes('finding-aids/container')) { + model ='FindingAidsEntity' + } else { + switch(module) { + case 'accessions': + model = 'Accession' + break; + case 'donor': + model = 'Donor' + break; + case 'isad': + model = 'Isad' + break; + case 'isaar': + model = 'Isaar' + break; + case 'container': + model = 'Container' + break; + } + } + + return { + model_name: model, + object_id: object_id + } + } + const { data, error } = useData(`/v1/audit_log/`, getParams()); + + const renderLogs = () => { + if (data.length > 0) { + return ( +
    + { + data.map(d => { + return
  • + {moment(d.timestamp).format('YYYY-MM-DD HH:mm:ss')} | [{d.action}] by {d.user}{d.changed_fields && <> | Fields: {d.changed_fields.join(', ')}} +
  • + }) + } +
+ ) + } + } + + if (data && data.length > 0) { + return ( + <> +
+ {`Audit Log (from 2024. November 18th):`} + {renderLogs()} + + ) + } else { + return '' + } + +} + +export default AuditLog; \ No newline at end of file diff --git a/components/Forms/auditLog/AuditLog.module.scss b/components/Forms/auditLog/AuditLog.module.scss new file mode 100644 index 0000000..e69de29 diff --git a/components/Forms/components/FormAuthoritySelect.js b/components/Forms/components/FormAuthoritySelect.js index 450574b..b3acf08 100644 --- a/components/Forms/components/FormAuthoritySelect.js +++ b/components/Forms/components/FormAuthoritySelect.js @@ -1,10 +1,11 @@ import {Button, Col, Form, Input, Tooltip, Row, Table} from "antd"; import React, {useState} from "react"; import { SelectOutlined } from '@ant-design/icons'; -import style from "./FormAuthoritySelect.module.css"; +import style from "./FormAuthoritySelect.module.scss"; import {useData} from "../../../utils/hooks/useData"; +import ReactHtmlParser from 'react-html-parser'; -const AuthoritySelectTable = ({tableColumnTitle, tableColumnField, dataSource, ...props}) => { +const AuthoritySelectTable = ({tableColumnTitle, tableColumnField, urlField, dataSource, ...props}) => { const renderSelectButton = (data) => { return( @@ -17,14 +18,19 @@ const AuthoritySelectTable = ({tableColumnTitle, tableColumnField, dataSource, . const renderTitle = (data) => { return( - {data} + + {data[tableColumnField]} + ) }; + const renderName = (data) => { + return (ReactHtmlParser(data)) + } + const columns = [ { title: tableColumnTitle, - dataIndex: tableColumnField, key: tableColumnField, width: 400, sorter: false, @@ -34,6 +40,7 @@ const AuthoritySelectTable = ({tableColumnTitle, tableColumnField, dataSource, . dataIndex: 'name', key: 'name', sorter: false, + render: renderName }, { title: 'Actions', width: 150, @@ -54,13 +61,15 @@ const AuthoritySelectTable = ({tableColumnTitle, tableColumnField, dataSource, . ) }; -export const FormAuthoritySelect = ({api, type, nameField='name', field, form, columnTitle, columnField}) => { +export const FormAuthoritySelect = ({api, type, nameField='name', field, form, columnTitle, columnField, + isWikidata=false, urlField}) => { const [searchValue, setSearchValue] = useState(''); - const {data, loading} = useData(api, {query: searchValue, type: type}); + const {data, loading} = useData(api, {query: searchValue, type: isWikidata ? undefined : type}); const onSearch = () => { const search = form.getFieldValue(nameField); + if (search !== '') { setSearchValue(search); } @@ -91,6 +100,7 @@ export const FormAuthoritySelect = ({api, type, nameField='name', field, form, c onSelect={(val) => form.setFieldsValue({[field]: val})} tableColumnTitle={columnTitle} tableColumnField={columnField} + urlField={urlField} /> diff --git a/components/Forms/components/FormAuthoritySelect.module.css b/components/Forms/components/FormAuthoritySelect.module.scss similarity index 74% rename from components/Forms/components/FormAuthoritySelect.module.css rename to components/Forms/components/FormAuthoritySelect.module.scss index 23740ed..0c26ab7 100644 --- a/components/Forms/components/FormAuthoritySelect.module.css +++ b/components/Forms/components/FormAuthoritySelect.module.scss @@ -1,5 +1,9 @@ .AuthorityTable { margin-top: 15px; + + :global .searchmatch { + background-color: yellow; + } } .SearchButton { diff --git a/components/Forms/components/FormDatePicker.js b/components/Forms/components/FormDatePicker.js new file mode 100644 index 0000000..7d89a8d --- /dev/null +++ b/components/Forms/components/FormDatePicker.js @@ -0,0 +1,28 @@ +import React from 'react'; +import {DatePicker} from "antd"; +import dayjs from "dayjs"; + + +const FormDatePicker = ({ format, disabled=false, value, onChange, ...props }) => { + + const handleChange = (dateObj, dateString) => { + if (dateString === '') { + onChange(null) + } else { + onChange(dateString) + } + } + + return ( + + ) +}; + +export default FormDatePicker; diff --git a/components/Forms/components/FormDuplications.js b/components/Forms/components/FormDuplications.js new file mode 100644 index 0000000..24e626a --- /dev/null +++ b/components/Forms/components/FormDuplications.js @@ -0,0 +1,142 @@ +import React, {useEffect, useState} from "react"; +import {get, post, remove} from "../../../utils/api"; +import style from "./FormDuplications.module.scss"; +import {LoadingOutlined, SaveOutlined, MergeOutlined } from "@ant-design/icons"; +import {Button, Modal, notification, Table, Tooltip} from "antd"; +import {renderURL} from "../../../utils/renders/renderURL"; +import {renderWikidataURL} from "../../../utils/renders/renderWikidataURL"; +import {renderSimilarity} from "../../../utils/renders/renderSimilarity"; +import {deleteAlert} from "../../Tables/functions/deleteAlert"; + + +const FormDuplications = ({api, selectedRecord, afterMergeFinish}) => { + const [loading, setLoading] = useState(true); + const [data, setData] = useState([]); + + const onMergeClick = (record) => { + const keep_id = selectedRecord; + const merge_id = record.id; + + const { confirm } = Modal; + + confirm({ + title: 'Are you sure you would merge the Person record into this one?', + okText: 'Yes', + okType: 'danger', + cancelText: 'No', + onOk() { + merge(keep_id, merge_id) + } + }); + } + + const onKeepClick = (record) => { + const keep_id = record.id; + const merge_id = selectedRecord; + + const { confirm } = Modal; + + confirm({ + title: 'Are you sure you would merge (and after that, delete) this record with the selected one?', + okText: 'Yes', + okType: 'danger', + cancelText: 'No', + onOk() { + merge(keep_id, merge_id) + afterMergeFinish() + } + }); + } + + const merge = (keep_id, merge_id) => { + post(`/v1/authority_list/people/merge/`, { + keep_id: keep_id, + merge_id: merge_id} + ).then(response => { + getDuplicationData() + notification.success({ + duration: 3, + message: 'Success!', + description: `Person records were merged, subject and contributor references were updated!`, + }); + }) + } + + const renderActionButtons = (record) => { + return ( + + +