|
10 | 10 | v-bind:progressbar="false" |
11 | 11 | v-bind:standalone="true" |
12 | 12 | > |
13 | | - <question |
14 | | - type="multipleChoice" |
15 | | - id="multiple_choice" |
16 | | - tagline="Welcome to our demo support page!" |
17 | | - title="Hi 👋, how can we help you today?" |
18 | | - v-bind:multiple="false" |
19 | | - v-bind:helpTextShow="false" |
20 | | - v-bind:options="[ |
21 | | - { |
22 | | - label: 'I have a technical issue', |
23 | | - value: 'technical_issue' |
24 | | - }, |
25 | | - { |
26 | | - label: 'I wish to check my ticket status', |
27 | | - value: 'enter_ticket' |
28 | | - }, |
29 | | - ]" |
30 | | - v-bind:jump="{ |
31 | | - technical_issue: 'technical_issue', |
32 | | - enter_ticket: 'enter_ticket' |
33 | | - }" |
34 | | - > |
35 | | - </question> |
36 | | - <question |
37 | | - type="multipleChoice" |
38 | | - id="technical_issue" |
39 | | - tagline="Submit issue > Step 1/3" |
40 | | - title="Have you read our technical FAQ?" |
41 | | - v-bind:multiple="false" |
42 | | - required |
43 | | - v-bind:helpTextShow="false" |
44 | | - description="Here you'll find answers to" |
45 | | - v-bind:descriptionLink="[ |
46 | | - { |
47 | | - url: '#', |
48 | | - text: 'FAQs', |
49 | | - target: '_self' |
50 | | - } |
51 | | - ]" |
52 | | - v-bind:options="[ |
53 | | - { |
54 | | - label: 'Yes, but I couldn’t find the answer', |
55 | | - value: 'faq_no' |
56 | | - } |
57 | | - ]" |
58 | | - v-bind:jump="{ |
59 | | - faq_no: 'faq_no' |
60 | | - }" |
61 | | - > |
62 | | - </question> |
63 | | - <question |
64 | | - type="text" |
65 | | - id="enter_ticket" |
66 | | - tagline="Support page > Ticket status" |
67 | | - title="Please enter your 6-digit code." |
68 | | - subtitle="You received this when you reported your problem." |
69 | | - v-bind:multiple="false" |
70 | | - required |
71 | | - mask="#-#-#-#-#-#" |
72 | | - placeholder="#-#-#-#-#-#" |
73 | | - v-bind:jump="{ |
74 | | - _other: '_submit' |
75 | | - }" |
76 | | - v-model="ticket" |
77 | | - > |
78 | | - </question> |
79 | | - <question |
80 | | - id="faq_no" |
81 | | - tagline="Submit issue > Step 2/3" |
82 | | - title="Please describe your problem." |
83 | | - type="longText" |
84 | | - required |
85 | | - placeholder="Start typing here..." |
86 | | - > |
87 | | - </question> |
| 13 | + <question v-for="(question, index) in questions" v-bind="question" v-bind:key="'m' + index" v-model="question.model"></question> |
88 | 14 |
|
89 | 15 | <!-- Custom content for the Complete/Submit screen slots in the FlowForm component --> |
90 | 16 | <template v-slot:complete> |
91 | 17 | <div class="f-section-wrap"> |
92 | | - <div v-if="answer === 'technical_issue'"> |
| 18 | + <div v-if="questions[0].model === 'technical_issue'"> |
93 | 19 | <span class="f-tagline">Submit issue > Step 3/3</span> |
94 | 20 | <div v-if="loading"> |
95 | 21 | <span class="fh2">Please wait, submitting...</span> |
|
101 | 27 | </div> |
102 | 28 | <div v-else> |
103 | 29 | <span class="f-tagline">Support page > Ticket status</span> |
104 | | - <span class="fh2">Good news - the wheels are turning, your ticket {{ ticket }} is being processed!😉</span> |
| 30 | + <span class="fh2">Good news - the wheels are turning, your ticket {{" No. " + formatTicket(questions[2].model) + " " }} is being processed!😉</span> |
105 | 31 | <p class="f-description"><span>Have a great day!</span></p> |
106 | 32 | </div> |
107 | 33 | </div> |
|
136 | 62 | loading: false, |
137 | 63 | completed: false, |
138 | 64 | language: new LanguageModel(), |
139 | | - answer: '', |
140 | | - ticket: '', |
| 65 | + questions: [ |
| 66 | + { |
| 67 | + type: 'multiplechoice', |
| 68 | + id: 'multiple_choice', |
| 69 | + tagline: 'Welcome to our demo support page!', |
| 70 | + title: 'Hi 👋, how can we help you today?', |
| 71 | + multiple: false, |
| 72 | + required: true, |
| 73 | + helpTextShow: false, |
| 74 | + options: [ |
| 75 | + { |
| 76 | + label: 'I have a technical issue', |
| 77 | + value: 'technical_issue' |
| 78 | + }, |
| 79 | + { |
| 80 | + label: 'I wish to check my ticket status', |
| 81 | + value: 'enter_ticket' |
| 82 | + }, |
| 83 | + ], |
| 84 | + jump: { |
| 85 | + technical_issue: 'technical_issue', |
| 86 | + enter_ticket: 'enter_ticket' |
| 87 | + }, |
| 88 | + model: null, |
| 89 | + }, |
| 90 | + { |
| 91 | + type: 'multiplechoice', |
| 92 | + id: 'technical_issue', |
| 93 | + tagline: 'Submit issue > Step 1/3', |
| 94 | + title: 'Have you read our technical FAQ?', |
| 95 | + multiple: false, |
| 96 | + required: true, |
| 97 | + helpTextShow: false, |
| 98 | + description: "Here you'll find answers to", |
| 99 | + descriptionLink: [ |
| 100 | + { |
| 101 | + url: '#', |
| 102 | + text: 'FAQs', |
| 103 | + target: '_self' |
| 104 | + } |
| 105 | + ], |
| 106 | + options: [ |
| 107 | + { |
| 108 | + label: 'Yes, but I couldn’t find the answer', |
| 109 | + value: 'faq_no' |
| 110 | + } |
| 111 | + ], |
| 112 | + jump: { |
| 113 | + faq_no: 'faq_no' |
| 114 | + }, |
| 115 | + model: null, |
| 116 | + }, |
| 117 | + { |
| 118 | + type: 'text', |
| 119 | + id: 'enter_ticket', |
| 120 | + tagline: 'Support page > Ticket status', |
| 121 | + title: 'Please enter your 6-digit code.', |
| 122 | + subtitle: 'You received this when you reported your problem.', |
| 123 | + multiple: false, |
| 124 | + required: true, |
| 125 | + mask: '#-#-#-#-#-#', |
| 126 | + placeholder: '#-#-#-#-#-#', |
| 127 | + jump: { |
| 128 | + _other: '_submit' |
| 129 | + }, |
| 130 | + model: null |
| 131 | + }, |
| 132 | + { |
| 133 | + type: 'longText', |
| 134 | + id: "faq_no", |
| 135 | + tagline: 'Submit issue > Step 2/3', |
| 136 | + title: 'Please describe your problem.', |
| 137 | + required: true, |
| 138 | + placeholder: 'Start typing here...', |
| 139 | + model: null |
| 140 | + } |
| 141 | + ] |
141 | 142 | } |
142 | 143 | }, |
143 | 144 | methods: { |
|
155 | 156 | |
156 | 157 | onSendData() { |
157 | 158 | const self = this |
158 | | - // const data = this.getData() |
| 159 | + const data = this.getData() |
159 | 160 |
|
160 | 161 | this.loading = true |
161 | 162 | |
|
175 | 176 | self.loading = false |
176 | 177 | }, 1500) |
177 | 178 | }, |
178 | | -/* |
| 179 | +
|
179 | 180 | getData() { |
180 | 181 | const data = { |
181 | 182 | questions: [], |
182 | 183 | answers: [] |
183 | 184 | } |
184 | | -
|
| 185 | + |
185 | 186 | this.questions.forEach(question => { |
186 | 187 | if (question.title) { |
187 | | - let answer = question.answer |
| 188 | + let answer = question.model |
188 | 189 | if (Array.isArray(answer)) { |
189 | 190 | answer = answer.join(', ') |
190 | 191 | } |
|
193 | 194 | data.answers.push(answer) |
194 | 195 | } |
195 | 196 | }) |
196 | | -
|
| 197 | + |
197 | 198 | return data |
198 | | - },*/ |
| 199 | + }, |
| 200 | +
|
| 201 | + formatTicket(ticket) { |
| 202 | + return ticket.replace(/-/g, '') |
| 203 | + }, |
199 | 204 |
|
200 | 205 | getTicket() { |
201 | 206 | return Math.floor(Math.random() * (999999 - 100000) + 100000).toString() |
|
0 commit comments