From aeef9d9d348be1a1c17a998d9b92d92d25e89bc3 Mon Sep 17 00:00:00 2001
From: pdg16 <pdg16@inf.ufpr.br>
Date: Tue, 28 Jan 2020 11:41:58 -0300
Subject: [PATCH] add fields select, radio and checkbox

---
 src/App.js | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/src/App.js b/src/App.js
index 119012d..ffe8a70 100644
--- a/src/App.js
+++ b/src/App.js
@@ -122,6 +122,36 @@ function App() {
           "type": 0, // question type = 0
           "validation": []
         });
+      } else if(x.type === "select") {
+        json.inputs.push({
+          "placement": index-1,
+          "description": "Adicionar esse campo no front",
+          "question": x.question,
+          "enabled": x.required,
+          "type": 3, // select type = 3
+          "validation": [],
+          "sugestions": x.options.map(function(y, index) { return {value: y, placement: index} })
+        });
+      } else if(x.type === "checkbox") {
+        json.inputs.push({
+          "placement": index-1,
+          "description": "Adicionar esse campo no front",
+          "question": x.question,
+          "enabled": x.required,
+          "type": 1, // checkbox type = 1
+          "validation": [],
+          "sugestions": x.options.map(function(y, index) { return {value: y, placement: index} })
+        });
+      } else if(x.type === "radio") {
+        json.inputs.push({
+          "placement": index-1,
+          "description": "Adicionar esse campo no front",
+          "question": x.question,
+          "enabled": x.required,
+          "type": 2, // radio type = 2
+          "validation": [],
+          "sugestions": x.options.map(function(y, index) { return {value: y, placement: index} })
+        });
       }
     });
     
-- 
GitLab