From cd339cf78834fdf02da691021e96c9ab00c4073e Mon Sep 17 00:00:00 2001 From: Jan Date: Thu, 4 Apr 2024 15:13:50 +0200 Subject: [PATCH] CM-447: last adjustments --- src/components/BeneficiaryDuplicatesTable.js | 42 +++++++++++++------- src/translations/en.json | 3 +- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/components/BeneficiaryDuplicatesTable.js b/src/components/BeneficiaryDuplicatesTable.js index ab59491..9354598 100644 --- a/src/components/BeneficiaryDuplicatesTable.js +++ b/src/components/BeneficiaryDuplicatesTable.js @@ -34,6 +34,9 @@ const useStyles = makeStyles((theme) => ({ deactivatedRow: { opacity: 0.5, }, + strikethrough: { + textDecoration: 'line-through', + }, })); function BeneficiaryDuplicatesTable({ @@ -49,14 +52,14 @@ function BeneficiaryDuplicatesTable({ const filteredIds = rows .filter((row, index) => !dontMergeRows.includes(index)) .map((row) => row.beneficiaryId); - const parsedFieldValues = selectedCells.reduce((acc, cell) => { - acc[cell.header] = cell.value ?? ''; - return acc; + const parsedFieldValues = selectedCells.reduce((accumulation, cell) => { + accumulation[cell.header] = cell.value ?? ''; + return accumulation; }, {}); - setFieldValues(parsedFieldValues); const additionalData = ( - { values: fieldValues, beneficiaryIds: filteredIds } + { values: parsedFieldValues, beneficiaryIds: filteredIds } ); + setFieldValues(parsedFieldValues); // eslint-disable-next-line max-len const additionalDataString = `{\\"values\\": ${JSON.stringify(additionalData.values).replace(/"/g, '\\"')},\\"beneficiaryIds\\": ${JSON.stringify(additionalData.beneficiaryIds).replace(/"/g, '\\"')}}`; setAdditionalData(additionalDataString); @@ -141,6 +144,10 @@ function BeneficiaryDuplicatesTable({ // eslint-disable-next-line max-len const shouldHoverCell = (rowIndex, header) => !isCellSelected(rowIndex, header) && header !== 'individual' && !dontMergeRows.includes(rowIndex); const shouldDisableCell = (rowIndex) => dontMergeRows.includes(rowIndex); + const shouldCrossText = (rowIndex) => rows[rowIndex]?.is_deleted; + const isDontMereChecked = (rowIndex) => ( + (dontMergeRows.includes(rowIndex) && !completedData) || (completedData && !rows[rowIndex]?.is_deleted) + ); useEffect(() => { if (completedData) { @@ -174,12 +181,16 @@ function BeneficiaryDuplicatesTable({ className={classes.tableRow} > - handleMergeCheckboxChange(rowIndex)} - disabled={completedData} - /> + {rowIndex + ? ( + handleMergeCheckboxChange(rowIndex)} + disabled={completedData} + /> + ) + : } ( handleCellClick(rowIndex, header, row[header])} > {row[header]} diff --git a/src/translations/en.json b/src/translations/en.json index ab95256..6fd7c12 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -13,5 +13,6 @@ "deduplication.deduplicate.mutation.createTasks": "Deduplication tasks have been created.", "deduplication.BeneficiaryDuplicatesTable.checkbox.header": "Select all columns", "deduplication.BeneficiaryDuplicatesTable.merge.header": "Don't merge", - "deduplication.BeneficiaryDuplicatesTable.output": "OUTPUT:" + "deduplication.BeneficiaryDuplicatesTable.output": "OUTPUT:", + "deduplication.BeneficiaryDuplicatesTable.oldest": "Oldest" } \ No newline at end of file