From 1704f26465ea2a618d80c8956ef464e4b6dae963 Mon Sep 17 00:00:00 2001 From: Jack Golding Date: Thu, 26 Sep 2024 13:29:14 +0100 Subject: [PATCH] fix: Initial value tweak More tweaks to bring initial values inline --- .../RulesetEditRoute/RulesetEditRoute.js | 18 +++++++++++++++++- translations/ui-serials-management/en.json | 3 ++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/routes/RulesetEditRoute/RulesetEditRoute.js b/src/routes/RulesetEditRoute/RulesetEditRoute.js index a55931b..da61623 100644 --- a/src/routes/RulesetEditRoute/RulesetEditRoute.js +++ b/src/routes/RulesetEditRoute/RulesetEditRoute.js @@ -35,6 +35,9 @@ const RulesetEditRoute = () => { .then(() => handleClose()); } ); + + console.log(ruleset); + // istanbul ignore next const handleSubmitValues = (values) => { const submitValues = { @@ -44,7 +47,20 @@ const RulesetEditRoute = () => { }; const getInitialValues = () => { - return ruleset; + const iv = { + ...ruleset, + patternType: ruleset?.recurrence?.rules?.[0]?.patternType?.value, + omission: { + ...ruleset?.omission, + patternType: ruleset?.omission?.rules?.[0]?.patternType?.value, + }, + combination: { + ...ruleset?.combination, + patternType: ruleset?.combination?.rules?.[0]?.patternType?.value, + }, + }; + console.log(iv); + return iv; }; // istanbul ignore next const submitRuleset = async (values) => { diff --git a/translations/ui-serials-management/en.json b/translations/ui-serials-management/en.json index cea2579..6ec77e0 100644 --- a/translations/ui-serials-management/en.json +++ b/translations/ui-serials-management/en.json @@ -205,7 +205,8 @@ "ruleset.pickList": "Pick list", "ruleset.templatePopover": "Templates are used to generate the values to be used in each predicted piece Display Summary.", "ruleset.templateTokensPopover": "Templates tokens are used in the Template to insert enumeration and chronology values in the predicted piece Display Summary.", - + "ruleset.editPublicationPattern": "Edit publication pattern", + "pieceSets": "Piece sets", "pieceSets.predictedPieceSets": "Predicted piece sets", "pieceSets.dateGenerated": "Date generated",