From 9d311f97b55e223845e9377df912150f32315fc4 Mon Sep 17 00:00:00 2001
From: Alexandru Munteanu <alexandru.munteanu@thinslices.com>
Date: Tue, 16 Jan 2018 15:35:22 +0200
Subject: [PATCH] Add correct field ids to first 2 steps of wizard

---
 .../app/config/journal/declarations.js        | 12 +++----
 .../xpub-faraday/app/config/journal/index.js  |  1 +
 .../app/config/journal/issues-types.js        | 31 +++++++++++++++++++
 .../app/config/journal/submit-wizard.js       | 26 ++++++----------
 packages/xpub-faraday/config/validations.js   |  1 +
 5 files changed, 49 insertions(+), 22 deletions(-)
 create mode 100644 packages/xpub-faraday/app/config/journal/issues-types.js

diff --git a/packages/xpub-faraday/app/config/journal/declarations.js b/packages/xpub-faraday/app/config/journal/declarations.js
index 2f25fbee2..c5372cd6d 100644
--- a/packages/xpub-faraday/app/config/journal/declarations.js
+++ b/packages/xpub-faraday/app/config/journal/declarations.js
@@ -27,30 +27,30 @@ export default {
   ],
   options: [
     {
-      value: 'step2-1',
+      value: 'has-email',
       label: `I have the email addresses of all the co-authors of the manuscript.`,
     },
     {
-      value: 'step2-2',
+      value: 'has-manuscript',
       label:
         'I have the manuscript file in Microsoft Word or Adobe PDF format with the tables and figures integrated in the manuscript body.',
     },
     {
-      value: 'step2-3',
+      value: 'has-efiles',
       label:
         'I have the electronic files of any supplementary materials (e.g., datasets, images, audio, video) that I want to submit with the manuscript.',
     },
     {
-      value: 'step2-4',
+      value: 'ok-article-processing',
       label:
         'I am aware that accepted manuscripts are subject to Article Processing Charges.',
     },
     {
-      value: 'step2-5',
+      value: 'has-orcid',
       label: `I'm aware that an ORCID ID is required for the corresponding author before the article can be published (if accepted). The ORCID ID should added via your user account.`,
     },
     {
-      value: 'step2-6',
+      value: 'ok-institutional',
       label:
         'I am aware that if my submission is covered by an institutional membership, Hindawi will share details of the manuscript with the administrator of the membership.',
     },
diff --git a/packages/xpub-faraday/app/config/journal/index.js b/packages/xpub-faraday/app/config/journal/index.js
index 6f766fe01..505657754 100644
--- a/packages/xpub-faraday/app/config/journal/index.js
+++ b/packages/xpub-faraday/app/config/journal/index.js
@@ -8,3 +8,4 @@ export { default as articleTypes } from './article-types'
 export { default as editors } from './editors'
 export { default as roles } from './roles'
 export { default as wizard } from './submit-wizard'
+export { default as issueTypes } from './issues-types'
diff --git a/packages/xpub-faraday/app/config/journal/issues-types.js b/packages/xpub-faraday/app/config/journal/issues-types.js
new file mode 100644
index 000000000..d35ee4514
--- /dev/null
+++ b/packages/xpub-faraday/app/config/journal/issues-types.js
@@ -0,0 +1,31 @@
+export default [
+  { label: 'Regular Issues', value: 'regular-issue' },
+  {
+    label: 'Analytical Method for High Energy Physics',
+    value: 'analytical-method',
+  },
+  {
+    label:
+      'Cosmic Strings: Fields in Thier Space-Time and Their Cosmological Signatures',
+    value: 'cosmic-strings',
+  },
+  {
+    label:
+      'Neutrino Physics in the Frontiers of Intensities and Very High Sensitivities 2018',
+    value: 'neutrino-physics',
+  },
+  {
+    label: 'New Physics Landmarks: Dark Matters and Neutrino Masses',
+    value: 'new-physics-landmarks',
+  },
+  {
+    label:
+      'Properties of Chemical and Kinetic Freeze-Outs in High-Energy Nuclear Collisions',
+    value: 'properties-of-chemical',
+  },
+  {
+    label:
+      'Perspectives on Decay and Time Evolutions of Metastable States: From Particle Physics to Cosmology',
+    value: 'perspective-on-decay',
+  },
+]
diff --git a/packages/xpub-faraday/app/config/journal/submit-wizard.js b/packages/xpub-faraday/app/config/journal/submit-wizard.js
index 0c0f29a29..e15084176 100644
--- a/packages/xpub-faraday/app/config/journal/submit-wizard.js
+++ b/packages/xpub-faraday/app/config/journal/submit-wizard.js
@@ -8,11 +8,13 @@ import {
   Supplementary,
 } from '@pubsweet/ui'
 import uploadFile from 'xpub-upload'
-import { required, minChars } from 'xpub-validators'
+import { required, minChars, minSize } from 'xpub-validators'
 
-import { articleSections, declarations } from './'
+import { declarations } from './'
+import issueTypes from './issues-types'
 
 const min3Chars = minChars(3)
+const declarationsMinSize = minSize(declarations.options.length)
 const yesNoWithLabel = ({ label, ...rest }) => (
   <div>
     <label>{label}</label>
@@ -37,7 +39,7 @@ export default {
   steps: [
     {
       label: 'Journal details',
-      title: 'Jounal & Field Selection',
+      title: 'Journal & Field Selection',
       children: [
         {
           fieldId: 'metadata.journal',
@@ -48,19 +50,11 @@ export default {
           validate: [required],
         },
         {
-          fieldId: 'subject',
+          fieldId: 'metadata.issue',
           renderComponent: Menu,
-          label: 'Subject area',
-          options: articleSections,
-        },
-        {
-          fieldId: 'specialIssue',
-          renderComponent: Menu,
-          label: 'Special issue',
-          options: [
-            { label: 'Special 2.1', value: 'dd21' },
-            { label: 'Special 2.2', value: 'dd22' },
-          ],
+          label: 'Issue',
+          options: issueTypes,
+          validate: [required],
         },
       ],
     },
@@ -74,7 +68,7 @@ export default {
           fieldId: 'declarations',
           renderComponent: CheckboxGroup,
           options: declarations.options,
-          validate: [required],
+          validate: [required, declarationsMinSize],
         },
       ],
     },
diff --git a/packages/xpub-faraday/config/validations.js b/packages/xpub-faraday/config/validations.js
index d30f26928..5d302cd8c 100644
--- a/packages/xpub-faraday/config/validations.js
+++ b/packages/xpub-faraday/config/validations.js
@@ -18,6 +18,7 @@ module.exports = {
       source: Joi.string(), // TODO: move to a file
       metadata: Joi.object({
         journal: Joi.string(),
+        issue: Joi.string(),
         title: Joi.string(),
         abstract: Joi.string(),
         articleType: Joi.string(),
-- 
GitLab