11<template >
22 <div class =" vue-survey-builder-content vsb-content" >
33 <select class =" vsb-select" v-model =" selectedType" v-on:change =" questionTypeChanged(selectedType)" >
4- <option v-for =" (questionType, index) in questionTypes" :value =" questionType.value" :key =" index" :disabled =" questionType.value === 'DEFAULT'" :selected =" questionType.value === 'DEFAULT'" >{{questionType.label}}</option >
4+ <option v-for =" (questionType, index) in questionTypes" :value =" questionType.value" :key =" index" :disabled =" questionType.value === 'DEFAULT'" :selected =" questionType.value === 'DEFAULT'" >
5+ {{ questionType.label }}
6+ </option >
57 </select >
68 <div class =" question-section" v-if =" selectedType !== 'DEFAULT'" >
79 <div class =" pb-10" >
810 <div class =" vsb-choices-text" >Question</div >
9- <input type =" text" class =" " placeholder =" Enter question text" v-model =" question.body" >
11+ <input type =" text" class =" " placeholder =" Enter question text" v-model =" question.body" / >
1012 </div >
1113 <div class =" " v-if =" selectedType === 'BOOLEAN'" >
1214 <div class =" vsb-choices-text" >Answer Choices</div >
1315 <div class =" " v-for =" (option, index) in question.options" :key =" index" >
1416 <div class =" clear-both" >
15- <input type =" text" class =" width-100 float-left" placeholder =" Enter an answer choice" v-model =" option.body" >
17+ <input type =" text" class =" width-100 float-left" placeholder =" Enter an answer choice" v-model =" option.body" / >
1618 <button class =" vsb-btn-link color-red width-10 mt-10" v-on:click =" deleteQuestionOptionItem(question.options, index)" v-if =" index > 1" >Remove</button >
1719 </div >
1820 </div >
1921 </div >
2022 <div class =" " v-if =" selectedType === 'DATE'" >
2123 <div class =" " >
22- <label class =" vsb-block" ><input type =" radio" v-model =" question.dateFormat" value =" MM/DD/YY" > MM/DD/YY</label >
23- <label class =" vsb-block" ><input type =" radio" v-model =" question.dateFormat" value =" DD/MM/YY" > DD/MM/YY</label >
24- <label class =" vsb-block" ><input type =" radio" v-model =" question.dateFormat" value =" MM/DD/YYYY" > MM/DD/YYYY</label >
25- <label class =" vsb-block" ><input type =" radio" v-model =" question.dateFormat" value =" DD/MM/YYYY" > DD/MM/YYYY</label >
24+ <label class =" vsb-block" ><input type =" radio" v-model =" question.dateFormat" value =" MM/DD/YY" / > MM/DD/YY</label >
25+ <label class =" vsb-block" ><input type =" radio" v-model =" question.dateFormat" value =" DD/MM/YY" / > DD/MM/YY</label >
26+ <label class =" vsb-block" ><input type =" radio" v-model =" question.dateFormat" value =" MM/DD/YYYY" / > MM/DD/YYYY</label >
27+ <label class =" vsb-block" ><input type =" radio" v-model =" question.dateFormat" value =" DD/MM/YYYY" / > DD/MM/YYYY</label >
2628 </div >
2729 </div >
2830 <div class =" " v-if =" selectedType === 'MULTI_CHOICE'" >
2931 <div class =" vsb-choices-text" >Answer Choices</div >
3032 <div class =" " v-for =" (option, index) in question.options" :key =" index" >
3133 <div class =" clear-both" >
32- <input type =" text" class =" width-90 float-left" placeholder =" Enter an answer choice" v-model =" option.body" >
34+ <input type =" text" class =" width-90 float-left" placeholder =" Enter an answer choice" v-model =" option.body" / >
3335 <button class =" vsb-btn-link color-red width-10 mt-10" v-on:click =" deleteQuestionOptionItem(question.options, index)" v-if =" index > 1" >Remove</button >
3436 </div >
3537 </div >
4143 <div class =" " v-if =" selectedType === 'NUMBER'" >
4244 <label class =" display-block" >
4345 <input type =" checkbox" class =" " v-model =" question.hasUnits" name =" hasUnits" />
44- <span class =" " >Answer label <input type =" text" class =" width-10" placeholder =" ex. mins, lbs, days" v-model =" question.units" :disabled =" !question.hasUnits" ></span >
46+ <span class =" " >Answer label <input type =" text" class =" width-10" placeholder =" ex. mins, lbs, days" v-model =" question.units" :disabled =" !question.hasUnits" / ></span >
4547 </label >
4648 <label class =" display-block" >
4749 <input type =" checkbox" v-model =" question.hasMinMax" name =" subType" />
48- <span class =" " >Min/max value
49- <input type =" number" class =" width-10" v-model =" question.minValue" placeholder =" min" min =" 1" max =" 2048" :disabled =" !question.hasMinMax" >
50+ <span class =" "
51+ >Min/max value
52+ <input type =" number" class =" width-10" v-model =" question.minValue" placeholder =" min" min =" 1" max =" 2048" :disabled =" !question.hasMinMax" />
5053 <span class =" width-10" >to</span >
51- <input type =" number" class =" width-10" v-model =" question.maxValue" placeholder =" max" min =" 1" max =" 2048" :disabled =" !question.hasMinMax" >
54+ <input type =" number" class =" width-10" v-model =" question.maxValue" placeholder =" max" min =" 1" max =" 2048" :disabled =" !question.hasMinMax" / >
5255 </span >
5356 </label >
5457 <label class =" display-block" >
6164 <div class =" " >
6265 <div class =" display-inline-block" >Intervals</div >
6366 <div class =" intervals display-inline-block" >
64- <input type =" number" min =" 2" max =" 100" v-model =" question.intervals" v-on:change =" changeLabelsLength(question.intervals)" >
67+ <input type =" number" min =" 2" max =" 100" v-model =" question.intervals" v-on:change =" changeLabelsLength(question.intervals)" / >
6568 </div >
6669 <span class =" " v-if =" question.reportable" >Max of 100 intervals can be entered.</span >
6770 </div >
7073 <div v-if =" index === 0" >
7174 <div class =" width-10 float-left pt-10" >Top</div >
7275 <div class =" width-90" >
73- <input type =" text" class =" " placeholder =" Enter value" v-model =" question.labels[question.labels.length - index - 1]" >
76+ <input type =" text" class =" " placeholder =" Enter value" v-model =" question.labels[question.labels.length - index - 1]" / >
7477 </div >
7578 </div >
76- <div v-else-if =" question.labels && ( index === question.labels.length - 1) " >
79+ <div v-else-if =" question.labels && index === question.labels.length - 1" >
7780 <div class =" width-10 float-left pt-10" >Bottom</div >
7881 <div class =" width-90" >
79- <input type =" text" name =" vertical-labels" class =" " placeholder =" Enter value" v-model =" question.labels[question.labels.length - index - 1]" >
82+ <input type =" text" name =" vertical-labels" class =" " placeholder =" Enter value" v-model =" question.labels[question.labels.length - index - 1]" / >
8083 </div >
8184 </div >
82- <div class =" text-right" v-if =" question.labels && index !== 0 && ( index !== question.labels.length - 1) " >
85+ <div class =" text-right" v-if =" question.labels && index !== 0 && index !== question.labels.length - 1" >
8386 <div class =" width-90" >
84- <input type =" text" class =" " placeholder =" Enter value" v-model =" question.labels[question.labels.length - index - 1]" >
87+ <input type =" text" class =" " placeholder =" Enter value" v-model =" question.labels[question.labels.length - index - 1]" / >
8588 </div >
8689 </div >
8790 </div >
9194 <div class =" vsb-choices-text" >Answer Choices</div >
9295 <div class =" " v-for =" (option, index) in question.options" :key =" index" >
9396 <div class =" clear-both" >
94- <input type =" text" class =" width-90 float-left" placeholder =" Enter an answer choice" v-model =" option.body" >
97+ <input type =" text" class =" width-90 float-left" placeholder =" Enter an answer choice" v-model =" option.body" / >
9598 <button class =" vsb-btn-link color-red width-10 mt-10" v-on:click =" deleteQuestionOptionItem(question.options, index)" v-if =" index > 1" >Remove</button >
9699 </div >
97100 </div >
98- <div class =" display-block " >
99- <button class = " vsb-btn-link color-blue " v-on:click =" addAnotherAnswer()" >Add another answer</button >
101+ <div class =" vsb-add-answer-btn vsb-btn-link color-blue " >
102+ <a v-on:click =" addAnotherAnswer()" >Add another answer</a >
100103 </div >
101104 </div >
102105 <div class =" " v-if =" selectedType === 'TEXT'" >
103106 <label class =" " >
104107 <input type =" checkbox" v-model =" question.characterLimited" name =" characterLimited" />
105- <span class =" " >Character limit <input type =" number" class =" char-limit-input" v-model =" question.textLimit" placeholder =" " min =" 1" max =" 2048" :disabled =" !question.characterLimited" ></span >
108+ <span class =" " >Character limit <input type =" number" class =" char-limit-input" v-model =" question.textLimit" placeholder =" " min =" 1" max =" 2048" :disabled =" !question.characterLimited" / ></span >
106109 </label >
107110 </div >
108111 <div class =" " v-if =" selectedType === 'TIME'" >
109112 <div class =" " >
110- <label class =" " ><input type =" radio" v-model =" question.timeFormat" value =" 12" v-on:click =" timeFormatModified(question.timeFormat)" > 12 hrs</label >
111- <label class =" " ><input type =" radio" v-model =" question.timeFormat" value =" 24" v-on:click =" timeFormatModified(question.timeFormat)" > 24 hrs</label >
113+ <label class =" " ><input type =" radio" v-model =" question.timeFormat" value =" 12" v-on:click =" timeFormatModified(question.timeFormat)" / > 12 hrs</label >
114+ <label class =" " ><input type =" radio" v-model =" question.timeFormat" value =" 24" v-on:click =" timeFormatModified(question.timeFormat)" / > 24 hrs</label >
112115 </div >
113116 </div >
114117 <div class =" buttons-section" >
@@ -155,7 +158,10 @@ export default {
155158 this .question .type = this .selectedType ;
156159 switch (type) {
157160 case ' BOOLEAN' :
158- this .question .options = [{ body: ' Yes' , sequence: 1 }, { body: ' No' , sequence: 2 }];
161+ this .question .options = [
162+ { body: ' Yes' , sequence: 1 },
163+ { body: ' No' , sequence: 2 },
164+ ];
159165 break ;
160166 case ' SCALE' :
161167 this .question .labels .length = 2 ;
@@ -181,7 +187,7 @@ export default {
181187 if (! this .question .options ) {
182188 this .question .options = [];
183189 }
184- let maxSequence = Number (Math .max (... this .question .options .map (x => x .sequence )));
190+ let maxSequence = Number (Math .max (... this .question .options .map (( x ) => x .sequence )));
185191 if (! maxSequence) {
186192 maxSequence = this .question .options .length ;
187193 }
@@ -216,7 +222,7 @@ export default {
216222 */
217223 saveQuestion (question ) {
218224 question .id = question .id ? question .id : this .getGUID (); // eslint-disable-line
219- this .$root .$emit (' add-update-question' , question);
225+ this .$root .$emit (' add-update-question' , { question, operation : ' save ' } );
220226 this .question = { type: ' DEFAULT' };
221227 },
222228
@@ -308,11 +314,9 @@ $color-green: #48bf7a;
308314.vue-survey-builder-content {
309315 font-family : Arial , Helvetica , sans-serif ;
310316 font-weight : normal ;
311- border : 1px solid #ddd ;
312- padding : 10px ;
313- box-shadow : 1px 1px 5px 0px #ddd ;
314- background-color : $color-primary ;
315- border-radius : 2px ;
317+ padding : 12px ;
318+ box-shadow : 0 4px 8px 0 rgba (0 , 0 , 0 , 0.2 );
319+ border-radius : 4px ;
316320 margin : 12px 0 ;
317321
318322 input [type = ' text' ],
@@ -330,11 +334,10 @@ $color-green: #48bf7a;
330334 background-color : #fff ;
331335 }
332336 select {
333- -webkit-appearance : none ;
334- -moz-appearance : none ;
337+ // -webkit-appearance: none;
338+ // -moz-appearance: none;
335339 background-position : right 50% ;
336340 background-repeat : no-repeat ;
337- background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAMCAYAAABSgIzaAAAAGXRFWHRTb2Z0d2FyZQBBZG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