diff --git a/app/config/tables/SkipLogic/definition.csv b/app/config/tables/SkipLogic/definition.csv new file mode 100644 index 000000000..6a22d74b8 --- /dev/null +++ b/app/config/tables/SkipLogic/definition.csv @@ -0,0 +1,12 @@ +_element_key,_element_name,_element_type,_list_child_element_keys +box,box,string,[] +flavor,flavor,string,[] +location,location,geopoint,"[""location_accuracy"",""location_altitude"",""location_latitude"",""location_longitude""]" +location_accuracy,accuracy,number,[] +location_altitude,altitude,number,[] +location_latitude,latitude,number,[] +location_longitude,longitude,number,[] +menu,menu,string,[] +name,name,string,[] +size,size,string,[] +state,state,string,[] diff --git a/app/config/tables/SkipLogic/forms/SkipLogic/SkipLogic.xlsx b/app/config/tables/SkipLogic/forms/SkipLogic/SkipLogic.xlsx new file mode 100644 index 000000000..33717917a Binary files /dev/null and b/app/config/tables/SkipLogic/forms/SkipLogic/SkipLogic.xlsx differ diff --git a/app/config/tables/SkipLogic/forms/SkipLogic/formDef.json b/app/config/tables/SkipLogic/forms/SkipLogic/formDef.json new file mode 100644 index 000000000..3ad219ac5 --- /dev/null +++ b/app/config/tables/SkipLogic/forms/SkipLogic/formDef.json @@ -0,0 +1,1713 @@ +{ + "xlsx": { + "properties": [ + { + "partition": "Table", + "aspect": "default", + "key": "defaultViewType", + "type": "string", + "value": "LIST", + "_row_num": 2 + }, + { + "partition": "Table", + "aspect": "default", + "key": "detailViewFileName", + "type": "string", + "value": "config/tables/SkipLogic/html/SkipLogic_detail.html", + "_row_num": 3 + }, + { + "partition": "Table", + "aspect": "default", + "key": "listViewFileName", + "type": "string", + "value": "config/tables/SkipLogic/html/SkipLogic_list.html", + "_row_num": 4 + } + ], + "settings": [ + { + "setting_name": "form_id", + "value": "SkipLogic", + "_row_num": 2 + }, + { + "setting_name": "form_version", + "value": 20210726, + "_row_num": 3 + }, + { + "setting_name": "table_id", + "value": "SkipLogic", + "_row_num": 4 + }, + { + "setting_name": "survey", + "display": { + "title": { + "text": "Skip Logic Example Form" + } + }, + "_row_num": 5 + } + ], + "survey": [ + { + "clause": "begin screen", + "_row_num": 2 + }, + { + "type": "text", + "name": "name", + "display": { + "prompt": { + "text": "What is your name?" + }, + "hint": { + "text": "Please enter your first and last name." + } + }, + "_row_num": 3 + }, + { + "type": "text", + "name": "state", + "display": { + "prompt": { + "text": "What state are you in?" + } + }, + "_row_num": 4 + }, + { + "type": "geopoint", + "name": "location", + "display": { + "prompt": { + "text": "Where is your location?" + } + }, + "_row_num": 5 + }, + { + "clause": "end screen", + "_row_num": 6 + }, + { + "type": "select_one", + "values_list": "order_list", + "name": "menu", + "display": { + "prompt": { + "text": "What would you like to get?" + } + }, + "_row_num": 7 + }, + { + "clause": "if", + "condition": "selected(data('menu'), 'doughnut') || selected(data('menu'), 'bread roll') || selected(data('menu'), 'cinnamon roll') || selected(data('menu'), 'croissant')", + "_row_num": 8 + }, + { + "type": "select_one", + "values_list": "box_list", + "name": "box", + "display": { + "prompt": { + "text": "What would you like?" + } + }, + "_row_num": 9 + }, + { + "clause": "end if", + "_row_num": 10 + }, + { + "clause": "if", + "condition": "selected(data('menu'), 'cake')", + "_row_num": 11 + }, + { + "clause": "begin screen", + "_row_num": 12 + }, + { + "type": "select_one", + "values_list": "size_list", + "name": "size", + "display": { + "prompt": { + "text": "What size of cake would you like?" + } + }, + "_row_num": 13 + }, + { + "type": "select_one", + "values_list": "flavor_list", + "name": "flavor", + "display": { + "prompt": { + "text": "What cake flavor would you like?" + } + }, + "_row_num": 14 + }, + { + "clause": "end screen", + "_row_num": 15 + }, + { + "clause": "end if", + "_row_num": 16 + }, + { + "clause": "if", + "condition": "selected(data('menu'), 'cupcake')", + "_row_num": 17 + }, + { + "clause": "begin screen", + "_row_num": 18 + }, + { + "type": "select_one", + "values_list": "box_list", + "name": "box", + "display": { + "prompt": { + "text": "What would you like?" + } + }, + "_row_num": 19 + }, + { + "type": "select_one", + "values_list": "flavor_list", + "name": "flavor", + "display": { + "prompt": { + "text": "What cake flavor would you like?" + } + }, + "_row_num": 20 + }, + { + "clause": "end screen", + "_row_num": 21 + }, + { + "clause": "end if", + "_row_num": 22 + }, + { + "clause": "begin screen", + "_row_num": 23 + }, + { + "type": "note", + "display": { + "prompt": { + "text": "

Order Summary for {{data.name}}

" + } + }, + "_row_num": 24 + }, + { + "type": "note", + "display": { + "prompt": { + "text": "
    1. {{data.menu}}, {{data.size}} {{data.flavor}} {{data.box}}
" + } + }, + "_row_num": 25 + }, + { + "clause": "end screen", + "_row_num": 26 + } + ], + "choices": [ + { + "choice_list_name": "order_list", + "data_value": "cupcake", + "display": { + "title": { + "text": "Cupcakes" + } + }, + "_row_num": 2 + }, + { + "choice_list_name": "order_list", + "data_value": "cinnamon roll", + "display": { + "title": { + "text": "Cinnamon Rolls" + } + }, + "_row_num": 3 + }, + { + "choice_list_name": "order_list", + "data_value": "croissant", + "display": { + "title": { + "text": "Croissants" + } + }, + "_row_num": 4 + }, + { + "choice_list_name": "order_list", + "data_value": "cake", + "display": { + "title": { + "text": "Cake" + } + }, + "_row_num": 5 + }, + { + "choice_list_name": "order_list", + "data_value": "doughnut", + "display": { + "title": { + "text": "Doughnuts" + } + }, + "_row_num": 6 + }, + { + "choice_list_name": "order_list", + "data_value": "bread roll", + "display": { + "title": { + "text": "Bread Rolls" + } + }, + "_row_num": 7 + }, + { + "choice_list_name": "box_list", + "data_value": "box of 4", + "display": { + "title": { + "text": "A box of 4" + } + }, + "_row_num": 8 + }, + { + "choice_list_name": "box_list", + "data_value": "box of 6", + "display": { + "title": { + "text": "A box of 6" + } + }, + "_row_num": 9 + }, + { + "choice_list_name": "box_list", + "data_value": "box of 8", + "display": { + "title": { + "text": "A box of 8" + } + }, + "_row_num": 10 + }, + { + "choice_list_name": "box_list", + "data_value": "box of 10", + "display": { + "title": { + "text": "A box of 10" + } + }, + "_row_num": 11 + }, + { + "choice_list_name": "size_list", + "data_value": "6\"", + "display": { + "title": { + "text": "6 inches" + } + }, + "_row_num": 12 + }, + { + "choice_list_name": "size_list", + "data_value": "8\"", + "display": { + "title": { + "text": "8 inches" + } + }, + "_row_num": 13 + }, + { + "choice_list_name": "size_list", + "data_value": "10\"", + "display": { + "title": { + "text": "10 inches" + } + }, + "_row_num": 14 + }, + { + "choice_list_name": "size_list", + "data_value": "12\"", + "display": { + "title": { + "text": "12 inches" + } + }, + "_row_num": 15 + }, + { + "choice_list_name": "flavor_list", + "data_value": "choc fudge", + "display": { + "title": { + "text": "Chocolate Fudge" + } + }, + "_row_num": 16 + }, + { + "choice_list_name": "flavor_list", + "data_value": "red velvet", + "display": { + "title": { + "text": "Red Velvet" + } + }, + "_row_num": 17 + }, + { + "choice_list_name": "flavor_list", + "data_value": "cheese", + "display": { + "title": { + "text": "Cheese Cake" + } + }, + "_row_num": 18 + }, + { + "choice_list_name": "flavor_list", + "data_value": "cookies and cream", + "display": { + "title": { + "text": "Cookies and Cream" + } + }, + "_row_num": 19 + }, + { + "choice_list_name": "flavor_list", + "data_value": "white choc", + "display": { + "title": { + "text": "White Chocolate" + } + }, + "_row_num": 20 + } + ] + }, + "specification": { + "column_types": { + "_screen_block": "function", + "condition": "formula", + "constraint": "formula", + "required": "formula", + "calculation": "formula", + "newRowInitialElementKeyToValueMap": "formula", + "openRowInitialElementKeyToValueMap": "formula", + "selectionArgs": "formula", + "url": "formula", + "uri": "formula", + "callback": "formula(context)", + "choice_filter": "formula(choice_item)", + "templatePath": "requirejs_path", + "hideInContents": "formula" + }, + "settings": { + "form_id": { + "setting_name": "form_id", + "value": "SkipLogic", + "_row_num": 2 + }, + "form_version": { + "setting_name": "form_version", + "value": 20210726, + "_row_num": 3 + }, + "table_id": { + "setting_name": "table_id", + "value": "SkipLogic", + "_row_num": 4 + }, + "survey": { + "setting_name": "survey", + "display": { + "title": { + "text": "Skip Logic Example Form" + } + }, + "_row_num": 5 + }, + "_locales": { + "setting_name": "_locales", + "_row_num": 5, + "value": [ + { + "display": { + "locale": { + "text": "default" + } + }, + "name": "default" + } + ] + }, + "_default_locale": { + "setting_name": "_default_locale", + "_row_num": 5, + "value": "default" + }, + "initial": { + "setting_name": "survey", + "display": { + "title": { + "text": "Skip Logic Example Form" + } + }, + "_row_num": 5 + } + }, + "choices": { + "order_list": [ + { + "choice_list_name": "order_list", + "data_value": "cupcake", + "display": { + "title": { + "text": "Cupcakes" + } + }, + "_row_num": 2 + }, + { + "choice_list_name": "order_list", + "data_value": "cinnamon roll", + "display": { + "title": { + "text": "Cinnamon Rolls" + } + }, + "_row_num": 3 + }, + { + "choice_list_name": "order_list", + "data_value": "croissant", + "display": { + "title": { + "text": "Croissants" + } + }, + "_row_num": 4 + }, + { + "choice_list_name": "order_list", + "data_value": "cake", + "display": { + "title": { + "text": "Cake" + } + }, + "_row_num": 5 + }, + { + "choice_list_name": "order_list", + "data_value": "doughnut", + "display": { + "title": { + "text": "Doughnuts" + } + }, + "_row_num": 6 + }, + { + "choice_list_name": "order_list", + "data_value": "bread roll", + "display": { + "title": { + "text": "Bread Rolls" + } + }, + "_row_num": 7 + } + ], + "box_list": [ + { + "choice_list_name": "box_list", + "data_value": "box of 4", + "display": { + "title": { + "text": "A box of 4" + } + }, + "_row_num": 8 + }, + { + "choice_list_name": "box_list", + "data_value": "box of 6", + "display": { + "title": { + "text": "A box of 6" + } + }, + "_row_num": 9 + }, + { + "choice_list_name": "box_list", + "data_value": "box of 8", + "display": { + "title": { + "text": "A box of 8" + } + }, + "_row_num": 10 + }, + { + "choice_list_name": "box_list", + "data_value": "box of 10", + "display": { + "title": { + "text": "A box of 10" + } + }, + "_row_num": 11 + } + ], + "size_list": [ + { + "choice_list_name": "size_list", + "data_value": "6\"", + "display": { + "title": { + "text": "6 inches" + } + }, + "_row_num": 12 + }, + { + "choice_list_name": "size_list", + "data_value": "8\"", + "display": { + "title": { + "text": "8 inches" + } + }, + "_row_num": 13 + }, + { + "choice_list_name": "size_list", + "data_value": "10\"", + "display": { + "title": { + "text": "10 inches" + } + }, + "_row_num": 14 + }, + { + "choice_list_name": "size_list", + "data_value": "12\"", + "display": { + "title": { + "text": "12 inches" + } + }, + "_row_num": 15 + } + ], + "flavor_list": [ + { + "choice_list_name": "flavor_list", + "data_value": "choc fudge", + "display": { + "title": { + "text": "Chocolate Fudge" + } + }, + "_row_num": 16 + }, + { + "choice_list_name": "flavor_list", + "data_value": "red velvet", + "display": { + "title": { + "text": "Red Velvet" + } + }, + "_row_num": 17 + }, + { + "choice_list_name": "flavor_list", + "data_value": "cheese", + "display": { + "title": { + "text": "Cheese Cake" + } + }, + "_row_num": 18 + }, + { + "choice_list_name": "flavor_list", + "data_value": "cookies and cream", + "display": { + "title": { + "text": "Cookies and Cream" + } + }, + "_row_num": 19 + }, + { + "choice_list_name": "flavor_list", + "data_value": "white choc", + "display": { + "title": { + "text": "White Chocolate" + } + }, + "_row_num": 20 + } + ] + }, + "table_specific_definitions": { + "_tokens": {} + }, + "queries": {}, + "calculates": {}, + "model": { + "name": { + "_defn": [ + { + "_row_num": 3, + "section_name": "survey" + } + ], + "type": "string", + "elementKey": "name" + }, + "state": { + "_defn": [ + { + "_row_num": 4, + "section_name": "survey" + } + ], + "type": "string", + "elementKey": "state" + }, + "location": { + "_defn": [ + { + "_row_num": 5, + "section_name": "survey" + } + ], + "type": "object", + "elementType": "geopoint", + "properties": { + "latitude": { + "type": "number", + "elementKey": "location_latitude" + }, + "longitude": { + "type": "number", + "elementKey": "location_longitude" + }, + "altitude": { + "type": "number", + "elementKey": "location_altitude" + }, + "accuracy": { + "type": "number", + "elementKey": "location_accuracy" + } + }, + "elementKey": "location" + }, + "menu": { + "_defn": [ + { + "_row_num": 7, + "section_name": "survey" + } + ], + "type": "string", + "valuesList": "order_list", + "elementKey": "menu" + }, + "box": { + "type": "string", + "valuesList": "box_list", + "_defn": [ + { + "_row_num": 9, + "section_name": "survey" + }, + { + "_row_num": 19, + "section_name": "survey" + } + ], + "elementKey": "box" + }, + "size": { + "_defn": [ + { + "_row_num": 13, + "section_name": "survey" + } + ], + "type": "string", + "valuesList": "size_list", + "elementKey": "size" + }, + "flavor": { + "type": "string", + "valuesList": "flavor_list", + "_defn": [ + { + "_row_num": 14, + "section_name": "survey" + }, + { + "_row_num": 20, + "section_name": "survey" + } + ], + "elementKey": "flavor" + } + }, + "section_names": [ + "initial", + "survey" + ], + "sections": { + "survey": { + "section_name": "survey", + "nested_sections": {}, + "reachable_sections": {}, + "prompts": [ + { + "type": "text", + "name": "name", + "display": { + "prompt": { + "text": "What is your name?" + }, + "hint": { + "text": "Please enter your first and last name." + } + }, + "_row_num": 3, + "__rowNum__": 2, + "_token_type": "prompt", + "_type": "text", + "_branch_label_enclosing_screen": "survey/_screen2", + "promptIdx": 0 + }, + { + "type": "text", + "name": "state", + "display": { + "prompt": { + "text": "What state are you in?" + } + }, + "_row_num": 4, + "__rowNum__": 3, + "_token_type": "prompt", + "_type": "text", + "_branch_label_enclosing_screen": "survey/_screen2", + "promptIdx": 1 + }, + { + "type": "geopoint", + "name": "location", + "display": { + "prompt": { + "text": "Where is your location?" + } + }, + "_row_num": 5, + "__rowNum__": 4, + "_token_type": "prompt", + "_type": "geopoint", + "_branch_label_enclosing_screen": "survey/_screen2", + "promptIdx": 2 + }, + { + "type": "select_one", + "values_list": "order_list", + "name": "menu", + "display": { + "prompt": { + "text": "What would you like to get?" + } + }, + "_row_num": 7, + "__rowNum__": 6, + "_token_type": "prompt", + "_type": "select_one", + "_branch_label_enclosing_screen": "survey/_screen7", + "promptIdx": 3 + }, + { + "type": "select_one", + "values_list": "box_list", + "name": "box", + "display": { + "prompt": { + "text": "What would you like?" + } + }, + "_row_num": 9, + "__rowNum__": 8, + "_token_type": "prompt", + "_type": "select_one", + "_branch_label_enclosing_screen": "survey/_screen9", + "promptIdx": 4 + }, + { + "type": "select_one", + "values_list": "size_list", + "name": "size", + "display": { + "prompt": { + "text": "What size of cake would you like?" + } + }, + "_row_num": 13, + "__rowNum__": 12, + "_token_type": "prompt", + "_type": "select_one", + "_branch_label_enclosing_screen": "survey/_screen12", + "promptIdx": 5 + }, + { + "type": "select_one", + "values_list": "flavor_list", + "name": "flavor", + "display": { + "prompt": { + "text": "What cake flavor would you like?" + } + }, + "_row_num": 14, + "__rowNum__": 13, + "_token_type": "prompt", + "_type": "select_one", + "_branch_label_enclosing_screen": "survey/_screen12", + "promptIdx": 6 + }, + { + "type": "select_one", + "values_list": "box_list", + "name": "box", + "display": { + "prompt": { + "text": "What would you like?" + } + }, + "_row_num": 19, + "__rowNum__": 18, + "_token_type": "prompt", + "_type": "select_one", + "_branch_label_enclosing_screen": "survey/_screen18", + "promptIdx": 7 + }, + { + "type": "select_one", + "values_list": "flavor_list", + "name": "flavor", + "display": { + "prompt": { + "text": "What cake flavor would you like?" + } + }, + "_row_num": 20, + "__rowNum__": 19, + "_token_type": "prompt", + "_type": "select_one", + "_branch_label_enclosing_screen": "survey/_screen18", + "promptIdx": 8 + }, + { + "type": "note", + "display": { + "prompt": { + "text": "

Order Summary for {{data.name}}

" + } + }, + "_row_num": 24, + "__rowNum__": 23, + "_token_type": "prompt", + "_type": "note", + "_branch_label_enclosing_screen": "survey/_screen23", + "promptIdx": 9 + }, + { + "type": "note", + "display": { + "prompt": { + "text": "
    1. {{data.menu}}, {{data.size}} {{data.flavor}} {{data.box}}
" + } + }, + "_row_num": 25, + "__rowNum__": 24, + "_token_type": "prompt", + "_type": "note", + "_branch_label_enclosing_screen": "survey/_screen23", + "promptIdx": 10 + }, + { + "_token_type": "prompt", + "type": "contents", + "_type": "contents", + "_row_num": 27, + "_branch_label_enclosing_screen": "survey/_screen27", + "promptIdx": 11 + } + ], + "validation_tag_map": { + "finalize": [] + }, + "operations": [ + { + "clause": "begin screen", + "_row_num": 2, + "__rowNum__": 1, + "_token_type": "begin_screen", + "_end_screen_clause": { + "clause": "end screen", + "_row_num": 6, + "__rowNum__": 5, + "_token_type": "end_screen" + }, + "_screen_block": "function() {var activePromptIndicies = [];\nactivePromptIndicies.push(0);\nactivePromptIndicies.push(1);\nactivePromptIndicies.push(2);\n\nreturn activePromptIndicies;\n}\n", + "operationIdx": 0 + }, + { + "_row_num": 7, + "_token_type": "begin_screen", + "_screen_block": "function() {var activePromptIndicies = [];\nactivePromptIndicies.push(3);\n\nreturn activePromptIndicies;\n}\n", + "operationIdx": 1 + }, + { + "clause": "if", + "condition": "selected(data('menu'), 'doughnut') || selected(data('menu'), 'bread roll') || selected(data('menu'), 'cinnamon roll') || selected(data('menu'), 'croissant')", + "_row_num": 8, + "__rowNum__": 7, + "_token_type": "goto_label", + "_branch_label": "_then8", + "operationIdx": 2 + }, + { + "clause": "end if", + "_token_type": "goto_label", + "_branch_label": "_else10", + "_row_num": 10, + "operationIdx": 3 + }, + { + "_row_num": 9, + "_token_type": "begin_screen", + "_screen_block": "function() {var activePromptIndicies = [];\nactivePromptIndicies.push(4);\n\nreturn activePromptIndicies;\n}\n", + "operationIdx": 4 + }, + { + "clause": "end if", + "_token_type": "goto_label", + "_branch_label": "_endif10", + "_row_num": 10, + "operationIdx": 5 + }, + { + "clause": "if", + "condition": "selected(data('menu'), 'cake')", + "_row_num": 11, + "__rowNum__": 10, + "_token_type": "goto_label", + "_branch_label": "_then11", + "operationIdx": 6 + }, + { + "clause": "end if", + "_token_type": "goto_label", + "_branch_label": "_else16", + "_row_num": 16, + "operationIdx": 7 + }, + { + "clause": "begin screen", + "_row_num": 12, + "__rowNum__": 11, + "_token_type": "begin_screen", + "_end_screen_clause": { + "clause": "end screen", + "_row_num": 15, + "__rowNum__": 14, + "_token_type": "end_screen" + }, + "_screen_block": "function() {var activePromptIndicies = [];\nactivePromptIndicies.push(5);\nactivePromptIndicies.push(6);\n\nreturn activePromptIndicies;\n}\n", + "operationIdx": 8 + }, + { + "clause": "end if", + "_token_type": "goto_label", + "_branch_label": "_endif16", + "_row_num": 16, + "operationIdx": 9 + }, + { + "clause": "if", + "condition": "selected(data('menu'), 'cupcake')", + "_row_num": 17, + "__rowNum__": 16, + "_token_type": "goto_label", + "_branch_label": "_then17", + "operationIdx": 10 + }, + { + "clause": "end if", + "_token_type": "goto_label", + "_branch_label": "_else22", + "_row_num": 22, + "operationIdx": 11 + }, + { + "clause": "begin screen", + "_row_num": 18, + "__rowNum__": 17, + "_token_type": "begin_screen", + "_end_screen_clause": { + "clause": "end screen", + "_row_num": 21, + "__rowNum__": 20, + "_token_type": "end_screen" + }, + "_screen_block": "function() {var activePromptIndicies = [];\nactivePromptIndicies.push(7);\nactivePromptIndicies.push(8);\n\nreturn activePromptIndicies;\n}\n", + "operationIdx": 12 + }, + { + "clause": "end if", + "_token_type": "goto_label", + "_branch_label": "_endif22", + "_row_num": 22, + "operationIdx": 13 + }, + { + "clause": "begin screen", + "_row_num": 23, + "__rowNum__": 22, + "_token_type": "begin_screen", + "_end_screen_clause": { + "clause": "end screen", + "_row_num": 26, + "__rowNum__": 25, + "_token_type": "end_screen" + }, + "_screen_block": "function() {var activePromptIndicies = [];\nactivePromptIndicies.push(9);\nactivePromptIndicies.push(10);\n\nreturn activePromptIndicies;\n}\n", + "operationIdx": 14 + }, + { + "_token_type": "exit_section", + "clause": "exit section", + "_row_num": 27, + "operationIdx": 15 + }, + { + "_row_num": 27, + "_token_type": "begin_screen", + "_screen_block": "function() {var activePromptIndicies = [];\nactivePromptIndicies.push(11);\n\nreturn activePromptIndicies;\n}\n", + "screen": { + "hideInBackHistory": true + }, + "operationIdx": 16 + }, + { + "_token_type": "resume", + "clause": "resume", + "_row_num": 27, + "operationIdx": 17 + } + ], + "branch_label_map": { + "_screen2": 0, + "_screen7": 1, + "_then8": 4, + "_screen9": 4, + "_else10": 6, + "_endif10": 6, + "_then11": 8, + "_screen12": 8, + "_else16": 10, + "_endif16": 10, + "_then17": 12, + "_screen18": 12, + "_else22": 14, + "_endif22": 14, + "_screen23": 14, + "_contents": 16, + "_screen27": 16 + } + }, + "initial": { + "section_name": "initial", + "nested_sections": { + "survey": true + }, + "reachable_sections": { + "survey": true + }, + "prompts": [ + { + "_row_num": 3, + "type": "opening", + "display": { + "text": "Edit form" + }, + "_token_type": "prompt", + "_type": "opening", + "_branch_label_enclosing_screen": "initial/_screen3", + "promptIdx": 0 + }, + { + "_row_num": 4, + "clause": "do section survey", + "_token_type": "prompt", + "_do_section_name": "survey", + "_type": "_section", + "promptIdx": 1, + "display": { + "title": { + "text": "Skip Logic Example Form" + } + }, + "_branch_label_enclosing_screen": "survey/0" + }, + { + "_row_num": 5, + "type": "finalize", + "display": { + "text": "Save form" + }, + "_token_type": "prompt", + "_type": "finalize", + "_branch_label_enclosing_screen": "initial/_screen5", + "promptIdx": 2 + }, + { + "_row_num": 7, + "type": "instances", + "display": { + "text": "Saved instances" + }, + "_token_type": "prompt", + "_type": "instances", + "_branch_label_enclosing_screen": "initial/_screen7", + "promptIdx": 3 + }, + { + "_token_type": "prompt", + "type": "contents", + "_type": "contents", + "_row_num": 9, + "_branch_label_enclosing_screen": "initial/_screen9", + "promptIdx": 4 + } + ], + "validation_tag_map": { + "finalize": [] + }, + "operations": [ + { + "_row_num": 2, + "clause": "if // start", + "condition": "(opendatakit.getCurrentInstanceId() != null)", + "_token_type": "goto_label", + "_tag_name": "start", + "_branch_label": "_then2", + "operationIdx": 0 + }, + { + "clause": "else // start", + "_token_type": "goto_label", + "_branch_label": "_else6", + "_row_num": 6, + "operationIdx": 1 + }, + { + "_row_num": 3, + "_token_type": "begin_screen", + "_screen_block": "function() {var activePromptIndicies = [];\nactivePromptIndicies.push(0);\n\nreturn activePromptIndicies;\n}\n", + "operationIdx": 2 + }, + { + "_row_num": 4, + "clause": "do section survey", + "_token_type": "do_section", + "_do_section_name": "survey", + "operationIdx": 3 + }, + { + "_row_num": 5, + "_token_type": "begin_screen", + "_screen_block": "function() {var activePromptIndicies = [];\nactivePromptIndicies.push(2);\n\nreturn activePromptIndicies;\n}\n", + "operationIdx": 4 + }, + { + "clause": "end if // start", + "_token_type": "goto_label", + "_branch_label": "_endif8", + "_row_num": 8, + "operationIdx": 5 + }, + { + "_row_num": 7, + "_token_type": "begin_screen", + "_screen_block": "function() {var activePromptIndicies = [];\nactivePromptIndicies.push(3);\n\nreturn activePromptIndicies;\n}\n", + "operationIdx": 6 + }, + { + "_token_type": "exit_section", + "clause": "exit section", + "_row_num": 9, + "operationIdx": 7 + }, + { + "_row_num": 9, + "_token_type": "begin_screen", + "_screen_block": "function() {var activePromptIndicies = [];\nactivePromptIndicies.push(4);\n\nreturn activePromptIndicies;\n}\n", + "screen": { + "hideInBackHistory": true + }, + "operationIdx": 8 + }, + { + "_token_type": "resume", + "clause": "resume", + "_row_num": 9, + "operationIdx": 9 + }, + { + "_token_type": "validate", + "clause": "validate finalize", + "_sweep_name": "finalize", + "_row_num": 9, + "screen": { + "hideInBackHistory": true + }, + "operationIdx": 10 + }, + { + "_token_type": "save_and_terminate", + "clause": "save and terminate", + "calculation": true, + "_row_num": 9, + "screen": { + "hideInBackHistory": true + }, + "operationIdx": 11 + }, + { + "_token_type": "resume", + "clause": "resume", + "_row_num": 9, + "operationIdx": 12 + } + ], + "branch_label_map": { + "_then2": 2, + "_screen3": 2, + "_screen5": 4, + "_else6": 6, + "_screen7": 6, + "_endif8": 7, + "_contents": 8, + "_screen9": 8, + "_finalize": 10 + } + } + }, + "dataTableModel": { + "name": { + "_defn": [ + { + "_row_num": 3, + "section_name": "survey" + } + ], + "type": "string", + "elementKey": "name", + "elementName": "name", + "elementSet": "data", + "elementPath": "name" + }, + "state": { + "_defn": [ + { + "_row_num": 4, + "section_name": "survey" + } + ], + "type": "string", + "elementKey": "state", + "elementName": "state", + "elementSet": "data", + "elementPath": "state" + }, + "location": { + "_defn": [ + { + "_row_num": 5, + "section_name": "survey" + } + ], + "type": "object", + "elementType": "geopoint", + "properties": { + "latitude": { + "type": "number", + "elementKey": "location_latitude", + "elementName": "latitude", + "elementSet": "data", + "elementPath": "location.latitude" + }, + "longitude": { + "type": "number", + "elementKey": "location_longitude", + "elementName": "longitude", + "elementSet": "data", + "elementPath": "location.longitude" + }, + "altitude": { + "type": "number", + "elementKey": "location_altitude", + "elementName": "altitude", + "elementSet": "data", + "elementPath": "location.altitude" + }, + "accuracy": { + "type": "number", + "elementKey": "location_accuracy", + "elementName": "accuracy", + "elementSet": "data", + "elementPath": "location.accuracy" + } + }, + "elementKey": "location", + "elementName": "location", + "elementSet": "data", + "elementPath": "location", + "listChildElementKeys": [ + "location_accuracy", + "location_altitude", + "location_latitude", + "location_longitude" + ], + "notUnitOfRetention": true + }, + "menu": { + "_defn": [ + { + "_row_num": 7, + "section_name": "survey" + } + ], + "type": "string", + "valuesList": "order_list", + "elementKey": "menu", + "elementName": "menu", + "elementSet": "data", + "elementPath": "menu" + }, + "box": { + "type": "string", + "valuesList": "box_list", + "_defn": [ + { + "_row_num": 9, + "section_name": "survey" + }, + { + "_row_num": 19, + "section_name": "survey" + } + ], + "elementKey": "box", + "elementName": "box", + "elementSet": "data", + "elementPath": "box" + }, + "size": { + "_defn": [ + { + "_row_num": 13, + "section_name": "survey" + } + ], + "type": "string", + "valuesList": "size_list", + "elementKey": "size", + "elementName": "size", + "elementSet": "data", + "elementPath": "size" + }, + "flavor": { + "type": "string", + "valuesList": "flavor_list", + "_defn": [ + { + "_row_num": 14, + "section_name": "survey" + }, + { + "_row_num": 20, + "section_name": "survey" + } + ], + "elementKey": "flavor", + "elementName": "flavor", + "elementSet": "data", + "elementPath": "flavor" + }, + "location_latitude": { + "type": "number", + "elementKey": "location_latitude", + "elementName": "latitude", + "elementSet": "data", + "elementPath": "location.latitude" + }, + "location_longitude": { + "type": "number", + "elementKey": "location_longitude", + "elementName": "longitude", + "elementSet": "data", + "elementPath": "location.longitude" + }, + "location_altitude": { + "type": "number", + "elementKey": "location_altitude", + "elementName": "altitude", + "elementSet": "data", + "elementPath": "location.altitude" + }, + "location_accuracy": { + "type": "number", + "elementKey": "location_accuracy", + "elementName": "accuracy", + "elementSet": "data", + "elementPath": "location.accuracy" + }, + "_id": { + "type": "string", + "isNotNullable": true, + "elementKey": "_id", + "elementName": "_id", + "elementSet": "instanceMetadata", + "elementPath": "_id" + }, + "_row_etag": { + "type": "string", + "isNotNullable": false, + "elementKey": "_row_etag", + "elementName": "_row_etag", + "elementSet": "instanceMetadata", + "elementPath": "_row_etag" + }, + "_sync_state": { + "type": "string", + "isNotNullable": true, + "elementKey": "_sync_state", + "elementName": "_sync_state", + "elementSet": "instanceMetadata", + "elementPath": "_sync_state" + }, + "_conflict_type": { + "type": "integer", + "isNotNullable": false, + "elementKey": "_conflict_type", + "elementName": "_conflict_type", + "elementSet": "instanceMetadata", + "elementPath": "_conflict_type" + }, + "_default_access": { + "type": "string", + "isNotNullable": false, + "elementKey": "_default_access", + "elementName": "_default_access", + "elementSet": "instanceMetadata", + "elementPath": "_default_access" + }, + "_form_id": { + "type": "string", + "isNotNullable": false, + "elementKey": "_form_id", + "elementName": "_form_id", + "elementSet": "instanceMetadata", + "elementPath": "_form_id" + }, + "_group_modify": { + "type": "string", + "isNotNullable": false, + "elementKey": "_group_modify", + "elementName": "_group_modify", + "elementSet": "instanceMetadata", + "elementPath": "_group_modify" + }, + "_group_privileged": { + "type": "string", + "isNotNullable": false, + "elementKey": "_group_privileged", + "elementName": "_group_privileged", + "elementSet": "instanceMetadata", + "elementPath": "_group_privileged" + }, + "_group_read_only": { + "type": "string", + "isNotNullable": false, + "elementKey": "_group_read_only", + "elementName": "_group_read_only", + "elementSet": "instanceMetadata", + "elementPath": "_group_read_only" + }, + "_locale": { + "type": "string", + "isNotNullable": false, + "elementKey": "_locale", + "elementName": "_locale", + "elementSet": "instanceMetadata", + "elementPath": "_locale" + }, + "_row_owner": { + "type": "string", + "isNotNullable": false, + "elementKey": "_row_owner", + "elementName": "_row_owner", + "elementSet": "instanceMetadata", + "elementPath": "_row_owner" + }, + "_savepoint_type": { + "type": "string", + "isNotNullable": false, + "elementKey": "_savepoint_type", + "elementName": "_savepoint_type", + "elementSet": "instanceMetadata", + "elementPath": "_savepoint_type" + }, + "_savepoint_timestamp": { + "type": "string", + "isNotNullable": true, + "elementKey": "_savepoint_timestamp", + "elementName": "_savepoint_timestamp", + "elementSet": "instanceMetadata", + "elementPath": "_savepoint_timestamp" + }, + "_savepoint_creator": { + "type": "string", + "isNotNullable": false, + "elementKey": "_savepoint_creator", + "elementName": "_savepoint_creator", + "elementSet": "instanceMetadata", + "elementPath": "_savepoint_creator" + } + }, + "properties": [ + { + "_partition": "Column", + "_aspect": "box", + "_key": "displayChoicesList", + "_type": "object", + "_value": "[{\"choice_list_name\":\"box_list\",\"data_value\":\"box of 4\",\"display\":{\"title\":{\"text\":\"A box of 4\"}},\"_row_num\":8},{\"choice_list_name\":\"box_list\",\"data_value\":\"box of 6\",\"display\":{\"title\":{\"text\":\"A box of 6\"}},\"_row_num\":9},{\"choice_list_name\":\"box_list\",\"data_value\":\"box of 8\",\"display\":{\"title\":{\"text\":\"A box of 8\"}},\"_row_num\":10},{\"choice_list_name\":\"box_list\",\"data_value\":\"box of 10\",\"display\":{\"title\":{\"text\":\"A box of 10\"}},\"_row_num\":11}]" + }, + { + "_partition": "Column", + "_aspect": "flavor", + "_key": "displayChoicesList", + "_type": "object", + "_value": "[{\"choice_list_name\":\"flavor_list\",\"data_value\":\"choc fudge\",\"display\":{\"title\":{\"text\":\"Chocolate Fudge\"}},\"_row_num\":16},{\"choice_list_name\":\"flavor_list\",\"data_value\":\"red velvet\",\"display\":{\"title\":{\"text\":\"Red Velvet\"}},\"_row_num\":17},{\"choice_list_name\":\"flavor_list\",\"data_value\":\"cheese\",\"display\":{\"title\":{\"text\":\"Cheese Cake\"}},\"_row_num\":18},{\"choice_list_name\":\"flavor_list\",\"data_value\":\"cookies and cream\",\"display\":{\"title\":{\"text\":\"Cookies and Cream\"}},\"_row_num\":19},{\"choice_list_name\":\"flavor_list\",\"data_value\":\"white choc\",\"display\":{\"title\":{\"text\":\"White Chocolate\"}},\"_row_num\":20}]" + }, + { + "_partition": "Column", + "_aspect": "menu", + "_key": "displayChoicesList", + "_type": "object", + "_value": "[{\"choice_list_name\":\"order_list\",\"data_value\":\"cupcake\",\"display\":{\"title\":{\"text\":\"Cupcakes\"}},\"_row_num\":2},{\"choice_list_name\":\"order_list\",\"data_value\":\"cinnamon roll\",\"display\":{\"title\":{\"text\":\"Cinnamon Rolls\"}},\"_row_num\":3},{\"choice_list_name\":\"order_list\",\"data_value\":\"croissant\",\"display\":{\"title\":{\"text\":\"Croissants\"}},\"_row_num\":4},{\"choice_list_name\":\"order_list\",\"data_value\":\"cake\",\"display\":{\"title\":{\"text\":\"Cake\"}},\"_row_num\":5},{\"choice_list_name\":\"order_list\",\"data_value\":\"doughnut\",\"display\":{\"title\":{\"text\":\"Doughnuts\"}},\"_row_num\":6},{\"choice_list_name\":\"order_list\",\"data_value\":\"bread roll\",\"display\":{\"title\":{\"text\":\"Bread Rolls\"}},\"_row_num\":7}]" + }, + { + "_partition": "Column", + "_aspect": "size", + "_key": "displayChoicesList", + "_type": "object", + "_value": "[{\"choice_list_name\":\"size_list\",\"data_value\":\"6\\\"\",\"display\":{\"title\":{\"text\":\"6 inches\"}},\"_row_num\":12},{\"choice_list_name\":\"size_list\",\"data_value\":\"8\\\"\",\"display\":{\"title\":{\"text\":\"8 inches\"}},\"_row_num\":13},{\"choice_list_name\":\"size_list\",\"data_value\":\"10\\\"\",\"display\":{\"title\":{\"text\":\"10 inches\"}},\"_row_num\":14},{\"choice_list_name\":\"size_list\",\"data_value\":\"12\\\"\",\"display\":{\"title\":{\"text\":\"12 inches\"}},\"_row_num\":15}]" + }, + { + "_partition": "FormType", + "_aspect": "default", + "_key": "FormType.formType", + "_type": "string", + "_value": "SURVEY" + }, + { + "_partition": "SurveyUtil", + "_aspect": "default", + "_key": "SurveyUtil.formId", + "_type": "string", + "_value": "SkipLogic" + }, + { + "_partition": "Table", + "_aspect": "default", + "_key": "defaultViewType", + "_type": "string", + "_value": "LIST" + }, + { + "_partition": "Table", + "_aspect": "default", + "_key": "detailViewFileName", + "_type": "string", + "_value": "config/tables/SkipLogic/html/SkipLogic_detail.html" + }, + { + "_partition": "Table", + "_aspect": "default", + "_key": "displayName", + "_type": "object", + "_value": "{\"text\":\"Skip Logic Example Form\"}" + }, + { + "_partition": "Table", + "_aspect": "default", + "_key": "listViewFileName", + "_type": "string", + "_value": "config/tables/SkipLogic/html/SkipLogic_list.html" + } + ] + } +} diff --git a/app/config/tables/SkipLogic/html/SkipLogic_detail.html b/app/config/tables/SkipLogic/html/SkipLogic_detail.html new file mode 100644 index 000000000..4c8dc0b14 --- /dev/null +++ b/app/config/tables/SkipLogic/html/SkipLogic_detail.html @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + +
+
+

Skip Logic Detail View

+

Order Detail

+ +
+
+
+ + + + + + + diff --git a/app/config/tables/SkipLogic/html/SkipLogic_list.html b/app/config/tables/SkipLogic/html/SkipLogic_list.html new file mode 100644 index 000000000..c4e086167 --- /dev/null +++ b/app/config/tables/SkipLogic/html/SkipLogic_list.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + +
+
+

Skip Logic List View

+ +
+
+
+ + + + + + + diff --git a/app/config/tables/SkipLogic/js/SkipLogic_detail.js b/app/config/tables/SkipLogic/js/SkipLogic_detail.js new file mode 100644 index 000000000..3f1c42c67 --- /dev/null +++ b/app/config/tables/SkipLogic/js/SkipLogic_detail.js @@ -0,0 +1,42 @@ +/* global odkData */ + +'use strict'; + +(function () { + var detailViewFields = { + name: 'Name', + state: 'State', + menu: 'Order', + size: 'Size', + flavor: 'Flavor', + box: 'Quantity', + }; + + var detailViewCallbackSuccess = function (result) { + var template = document.getElementById('skipLogicDetailTemplate'); + var fieldsContainer = document.getElementById('skipLogicDetailContainer'); + + Object.entries(detailViewFields).forEach(function (entry) { + var fieldValue = result.get(entry[0]); + + if (fieldValue !== undefined && fieldValue !== null) { + var detailField = document.importNode(template.content, true); + + detailField.querySelector('.skip-logic-detail-label').textContent = entry[1]; + detailField.querySelector('.skip-logic-detail-value').textContent = fieldValue; + + fieldsContainer.appendChild(detailField); + } + }); + }; + + var detailViewCallbackFailure = function (error) { + console.error(error); + }; + + document.addEventListener('DOMContentLoaded', function () { + odkData.getViewData(detailViewCallbackSuccess, detailViewCallbackFailure); + + document.getElementById('wrapper').classList.remove('d-none'); + }); +})(); diff --git a/app/config/tables/SkipLogic/js/SkipLogic_list.js b/app/config/tables/SkipLogic/js/SkipLogic_list.js new file mode 100644 index 000000000..ddd6f0229 --- /dev/null +++ b/app/config/tables/SkipLogic/js/SkipLogic_list.js @@ -0,0 +1,46 @@ +/* global odkTables, odkData */ + +'use strict'; + +(function () { + var openDetailViewOnClick = function (rowId) { + return function () { + odkTables.openDetailView(null, 'SkipLogic', rowId); + }; + }; + + var listViewCallbackSuccess = function (result) { + var resultCount = result.getCount(); + + var template = document.getElementById('skipLogicListTemplate'); + var listContainer = document.getElementById('skipLogicList'); + + for (var i = 0; i < resultCount; i++) { + var listItem = document.importNode(template.content, true); + + listItem + .querySelector('.skip-logic-list-name') + .textContent = result.getData(i, 'name'); + + listItem + .querySelector('.skip-logic-list-order') + .textContent = result.getData(i, 'menu'); + + listItem + .querySelector('.skip-logic-detail-view-link') + .addEventListener('click', openDetailViewOnClick(result.getRowId(i))); + + listContainer.appendChild(listItem); + } + }; + + var listViewCallbackFailure = function (error) { + console.error(error); + }; + + document.addEventListener('DOMContentLoaded', function () { + odkData.getViewData(listViewCallbackSuccess, listViewCallbackFailure); + + document.getElementById('wrapper').classList.remove('d-none'); + }); +})(); diff --git a/app/config/tables/SkipLogic/properties.csv b/app/config/tables/SkipLogic/properties.csv new file mode 100644 index 000000000..87aea7094 --- /dev/null +++ b/app/config/tables/SkipLogic/properties.csv @@ -0,0 +1,11 @@ +_partition,_aspect,_key,_type,_value +Column,box,displayChoicesList,object,"[{""choice_list_name"":""box_list"",""data_value"":""box of 4"",""display"":{""title"":{""text"":""A box of 4""}},""_row_num"":8},{""choice_list_name"":""box_list"",""data_value"":""box of 6"",""display"":{""title"":{""text"":""A box of 6""}},""_row_num"":9},{""choice_list_name"":""box_list"",""data_value"":""box of 8"",""display"":{""title"":{""text"":""A box of 8""}},""_row_num"":10},{""choice_list_name"":""box_list"",""data_value"":""box of 10"",""display"":{""title"":{""text"":""A box of 10""}},""_row_num"":11}]" +Column,flavor,displayChoicesList,object,"[{""choice_list_name"":""flavor_list"",""data_value"":""choc fudge"",""display"":{""title"":{""text"":""Chocolate Fudge""}},""_row_num"":16},{""choice_list_name"":""flavor_list"",""data_value"":""red velvet"",""display"":{""title"":{""text"":""Red Velvet""}},""_row_num"":17},{""choice_list_name"":""flavor_list"",""data_value"":""cheese"",""display"":{""title"":{""text"":""Cheese Cake""}},""_row_num"":18},{""choice_list_name"":""flavor_list"",""data_value"":""cookies and cream"",""display"":{""title"":{""text"":""Cookies and Cream""}},""_row_num"":19},{""choice_list_name"":""flavor_list"",""data_value"":""white choc"",""display"":{""title"":{""text"":""White Chocolate""}},""_row_num"":20}]" +Column,menu,displayChoicesList,object,"[{""choice_list_name"":""order_list"",""data_value"":""cupcake"",""display"":{""title"":{""text"":""Cupcakes""}},""_row_num"":2},{""choice_list_name"":""order_list"",""data_value"":""cinnamon roll"",""display"":{""title"":{""text"":""Cinnamon Rolls""}},""_row_num"":3},{""choice_list_name"":""order_list"",""data_value"":""croissant"",""display"":{""title"":{""text"":""Croissants""}},""_row_num"":4},{""choice_list_name"":""order_list"",""data_value"":""cake"",""display"":{""title"":{""text"":""Cake""}},""_row_num"":5},{""choice_list_name"":""order_list"",""data_value"":""doughnut"",""display"":{""title"":{""text"":""Doughnuts""}},""_row_num"":6},{""choice_list_name"":""order_list"",""data_value"":""bread roll"",""display"":{""title"":{""text"":""Bread Rolls""}},""_row_num"":7}]" +Column,size,displayChoicesList,object,"[{""choice_list_name"":""size_list"",""data_value"":""6\"""",""display"":{""title"":{""text"":""6 inches""}},""_row_num"":12},{""choice_list_name"":""size_list"",""data_value"":""8\"""",""display"":{""title"":{""text"":""8 inches""}},""_row_num"":13},{""choice_list_name"":""size_list"",""data_value"":""10\"""",""display"":{""title"":{""text"":""10 inches""}},""_row_num"":14},{""choice_list_name"":""size_list"",""data_value"":""12\"""",""display"":{""title"":{""text"":""12 inches""}},""_row_num"":15}]" +FormType,default,FormType.formType,string,SURVEY +SurveyUtil,default,SurveyUtil.formId,string,SkipLogic +Table,default,defaultViewType,string,LIST +Table,default,detailViewFileName,string,config/tables/SkipLogic/html/SkipLogic_detail.html +Table,default,displayName,object,"{""text"":""Skip Logic Example Form""}" +Table,default,listViewFileName,string,config/tables/SkipLogic/html/SkipLogic_list.html diff --git a/app/config/tables/SkipLogic/tableSpecificDefinitions.js b/app/config/tables/SkipLogic/tableSpecificDefinitions.js new file mode 100644 index 000000000..178c78ddc --- /dev/null +++ b/app/config/tables/SkipLogic/tableSpecificDefinitions.js @@ -0,0 +1,3 @@ +window.odkTableSpecificDefinitions = { + "_tokens": {} +} \ No newline at end of file