Commit c17e4f0cd99872a69ca6593042abb45bd0735936
1 parent
ab72cb6280
Exists in
master
and in
3 other branches
question changes
Showing
7 changed files
with
1214 additions
and
213 deletions
Show diff stats
src/components/questions/diet.vue
File was created | 1 | <template> | |
2 | <v-container grid-list-xl> | ||
3 | <v-flex> | ||
4 | <v-card> | ||
5 | <v-spacer></v-spacer> | ||
6 | <v-dialog v-model="dialog" max-width="800px"> | ||
7 | |||
8 | <v-card> | ||
9 | <v-card-title> | ||
10 | <span class="headline">{{ formTitle }}</span> | ||
11 | <v-spacer></v-spacer> | ||
12 | <v-icon @click="close">close</v-icon> | ||
13 | </v-card-title> | ||
14 | <v-flex> | ||
15 | <v-card> | ||
16 | <v-card-text> | ||
17 | <span> | ||
18 | <p><b>Ana Suggestion:</b> Select Suggestion</p></span> | ||
19 | <h5>Select Category:</h5> | ||
20 | <span> | ||
21 | <v-btn color="grey darken-2" flat>Suggestion</v-btn> | ||
22 | <v-btn color="grey darken-2" flat>Sex</v-btn> | ||
23 | <v-btn color="grey darken-2" flat>Health</v-btn> | ||
24 | <v-btn color="grey darken-2" flat>Skin & Beauty</v-btn> | ||
25 | <v-btn color="grey darken-2" flat>Diet & Ex</v-btn> | ||
26 | </span> | ||
27 | </v-card-text> | ||
28 | </v-card> | ||
29 | </v-flex> | ||
30 | <v-card-text> | ||
31 | |||
32 | <v-container grid-list-md> | ||
33 | <v-layout wrap> | ||
34 | <v-flex xs12 sm6 md12> | ||
35 | <v-textarea | ||
36 | solo | ||
37 | v-model="AddQuestioncredentials.question" | ||
38 | name="input-7-4" | ||
39 | label="Type Question" | ||
40 | ></v-textarea> | ||
41 | </v-flex> | ||
42 | </v-layout> | ||
43 | </v-container> | ||
44 | </v-card-text> | ||
45 | |||
46 | <v-card-actions> | ||
47 | <v-spacer></v-spacer> | ||
48 | <v-btn dark large @click.native="save">Post Question</v-btn> | ||
49 | </v-card-actions> | ||
50 | </v-card> | ||
51 | </v-dialog> | ||
52 | |||
53 | |||
54 | |||
55 | <v-dialog v-model="dialog1" max-width="800px"> | ||
56 | <v-card> | ||
57 | <v-card-title> | ||
58 | <span class="headline">Edit Question</span> | ||
59 | <v-spacer></v-spacer> | ||
60 | <v-icon @click="close1">close</v-icon> | ||
61 | </v-card-title> | ||
62 | |||
63 | <v-card-text> | ||
64 | <v-layout wrap> | ||
65 | <v-flex xs12 sm6 md12> | ||
66 | <v-text-field outline v-model="editedItem.ques" label="Question"></v-text-field> | ||
67 | </v-flex> | ||
68 | </v-layout> | ||
69 | <span><p> <b>Ana suggestion:</b> Abnormal Uterine Bleeding <br> | ||
70 | Diagnosis 1,Diagnosis 2,Diagnosis 3 | ||
71 | <v-btn dark large @click.native="save1" style="position:absolute; top:163px; right:5px;">Save Edit</v-btn></p></span> | ||
72 | </v-card-text> | ||
73 | </v-card> | ||
74 | </v-dialog> | ||
75 | <v-data-table | ||
76 | :headers="headers" | ||
77 | :items="desserts" | ||
78 | class="elevation-1" | ||
79 | :pagination.sync="pagination" | ||
80 | > | ||
81 | <template slot="items" slot-scope="props"> | ||
82 | <tr v-if="props.index === 0"> | ||
83 | <td id="td"> </td> | ||
84 | <td> | ||
85 | <span style="cursor:pointer" @click="dialog=true"> <v-icon>add</v-icon>Add New Question</span> | ||
86 | </td> | ||
87 | <td id="td"> </td> | ||
88 | <td id="td"> </td> | ||
89 | </tr> | ||
90 | <tr> | ||
91 | <td id="td" class="text-xs-center">{{ props.item.no }}</td> | ||
92 | <td id="td">{{ props.item.ques }}</td> | ||
93 | <td id="td" class="text-xs-center">{{ props.item.res }}</td> | ||
94 | <td class="text-xs-center"> | ||
95 | <span> | ||
96 | <img style="cursor:pointer; height:18px; " class="mr-5" @click="editItem(props.item)" src="/static/icon/edit1.png"/> | ||
97 | <img style="cursor:pointer; height:20px; " class="mr-5" @click="deleteItem(props.item)" src="/static/icon/delete1.png"/> | ||
98 | </span> | ||
99 | </td> | ||
100 | </tr> | ||
101 | </template> | ||
102 | </v-data-table> | ||
103 | </v-card> | ||
104 | </v-flex> | ||
105 | |||
106 | </v-container> | ||
107 | </template> | ||
108 | <script> | ||
109 | export default { | ||
110 | data: () => ({ | ||
111 | question: '', | ||
112 | AddQuestioncredentials: {}, | ||
113 | dialog: false, | ||
114 | dialog1: false, | ||
115 | isActive: true, | ||
116 | newActive: false, | ||
117 | pagination: { | ||
118 | rowsPerPage: 10, | ||
119 | }, | ||
120 | headers: [ | ||
121 | { | ||
122 | text: 'No.', | ||
123 | align: 'center', | ||
124 | sortable: false, | ||
125 | value: 'name' | ||
126 | }, | ||
127 | { text: 'Posts', value: 'posts', sortable: false, align: 'center' }, | ||
128 | { text: 'Responses', value: 'responses', sortable: false, align: 'center' }, | ||
129 | { text: '', value: 'carbs', sortable: false, align: 'center' }, | ||
130 | ], | ||
131 | desserts: [], | ||
132 | editedIndex: -1, | ||
133 | editedItem: { | ||
134 | question: '', | ||
135 | |||
136 | }, | ||
137 | defaultItem: { | ||
138 | no: 0, | ||
139 | question: '', | ||
140 | res: 0, | ||
141 | |||
142 | } | ||
143 | }), | ||
144 | |||
145 | computed: { | ||
146 | formTitle () { | ||
147 | return this.editedIndex === -1 ? 'Create New Question' : 'Edit Question'; | ||
148 | } | ||
149 | }, | ||
150 | |||
151 | watch: { | ||
152 | dialog (val) { | ||
153 | val || this.close(); | ||
154 | } | ||
155 | }, | ||
156 | |||
157 | created () { | ||
158 | this.initialize(); | ||
159 | }, | ||
160 | |||
161 | methods: { | ||
162 | initialize () { | ||
163 | this.desserts = [ | ||
164 | { | ||
165 | no: '1', | ||
166 | ques: 'questions diet', | ||
167 | res: 12, | ||
168 | }, | ||
169 | ]; | ||
170 | }, | ||
171 | |||
172 | editItem (item) { | ||
173 | this.editedIndex = this.desserts.indexOf(item); | ||
174 | this.editedItem = Object.assign({}, item); | ||
175 | this.dialog1 = true; | ||
176 | }, | ||
177 | |||
178 | deleteItem (item) { | ||
179 | const index = this.desserts.indexOf(item); | ||
180 | confirm('Are you sure you want to delete this item?') && this.desserts.splice(index, 1); | ||
181 | }, | ||
182 | |||
183 | close () { | ||
184 | this.dialog = false; | ||
185 | setTimeout(() => { | ||
186 | this.editedItem = Object.assign({}, this.defaultItem); | ||
187 | this.editedIndex = -1; | ||
188 | }, 300); | ||
189 | }, | ||
190 | close1 () { | ||
191 | this.dialog1 = false; | ||
192 | setTimeout(() => { | ||
193 | this.editedItem = Object.assign({}, this.defaultItem); | ||
194 | this.editedIndex = -1; | ||
195 | }, 300); | ||
196 | }, | ||
197 | save () { | ||
198 | console.log('editedItem', this.editedItem); | ||
199 | if (this.editedIndex > -1) { | ||
200 | Object.assign(this.desserts[this.editedIndex], this.editedItem); | ||
201 | } else { | ||
202 | this.desserts.push(this.editedItem); | ||
203 | } | ||
204 | this.close(); | ||
205 | }, | ||
206 | save1 () { | ||
207 | console.log('editedItem', this.editedItem); | ||
208 | if (this.editedIndex > -1) { | ||
209 | Object.assign(this.desserts[this.editedIndex], this.editedItem); | ||
210 | } else { | ||
211 | this.desserts.push(this.editedItem); | ||
212 | } | ||
213 | this.close1(); | ||
214 | } | ||
215 | }, | ||
216 | // switchComponent (comp) { | ||
217 | // this.$emit('switchComp', comp); | ||
218 | // } | ||
219 | }; | ||
220 | </script> | ||
221 | <style> | ||
222 | #td{ | ||
223 | border: 1px solid #dddddd; | ||
224 | text-align: left; | ||
225 | padding: 8px; | ||
226 | |||
227 | } | ||
228 | </style> | ||
229 |
src/components/questions/health.vue
File was created | 1 | <template> | |
2 | <v-container grid-list-xl> | ||
3 | <v-flex> | ||
4 | <v-card> | ||
5 | <v-spacer></v-spacer> | ||
6 | <v-dialog v-model="dialog" max-width="800px"> | ||
7 | |||
8 | <v-card> | ||
9 | <v-card-title> | ||
10 | <span class="headline">{{ formTitle }}</span> | ||
11 | <v-spacer></v-spacer> | ||
12 | <v-icon @click="close">close</v-icon> | ||
13 | </v-card-title> | ||
14 | <v-flex> | ||
15 | <v-card> | ||
16 | <v-card-text> | ||
17 | <span> | ||
18 | <p><b>Ana Suggestion:</b> Select Suggestion</p></span> | ||
19 | <h5>Select Category:</h5> | ||
20 | <span> | ||
21 | <v-btn color="grey darken-2" flat>Suggestion</v-btn> | ||
22 | <v-btn color="grey darken-2" flat>Sex</v-btn> | ||
23 | <v-btn color="grey darken-2" flat>Health</v-btn> | ||
24 | <v-btn color="grey darken-2" flat>Skin & Beauty</v-btn> | ||
25 | <v-btn color="grey darken-2" flat>Diet & Ex</v-btn> | ||
26 | </span> | ||
27 | </v-card-text> | ||
28 | </v-card> | ||
29 | </v-flex> | ||
30 | <v-card-text> | ||
31 | |||
32 | <v-container grid-list-md> | ||
33 | <v-layout wrap> | ||
34 | <v-flex xs12 sm6 md12> | ||
35 | <v-textarea | ||
36 | solo | ||
37 | v-model="AddQuestioncredentials.question" | ||
38 | name="input-7-4" | ||
39 | label="Type Question" | ||
40 | ></v-textarea> | ||
41 | </v-flex> | ||
42 | </v-layout> | ||
43 | </v-container> | ||
44 | </v-card-text> | ||
45 | |||
46 | <v-card-actions> | ||
47 | <v-spacer></v-spacer> | ||
48 | <v-btn dark large @click.native="save">Post Question</v-btn> | ||
49 | </v-card-actions> | ||
50 | </v-card> | ||
51 | </v-dialog> | ||
52 | |||
53 | |||
54 | |||
55 | <v-dialog v-model="dialog1" max-width="800px"> | ||
56 | <v-card> | ||
57 | <v-card-title> | ||
58 | <span class="headline">Edit Question</span> | ||
59 | <v-spacer></v-spacer> | ||
60 | <v-icon @click="close1">close</v-icon> | ||
61 | </v-card-title> | ||
62 | |||
63 | <v-card-text> | ||
64 | <v-layout wrap> | ||
65 | <v-flex xs12 sm6 md12> | ||
66 | <v-text-field outline v-model="editedItem.ques" label="Question"></v-text-field> | ||
67 | </v-flex> | ||
68 | </v-layout> | ||
69 | <span><p> <b>Ana suggestion:</b> Abnormal Uterine Bleeding <br> | ||
70 | Diagnosis 1,Diagnosis 2,Diagnosis 3 | ||
71 | <v-btn dark large @click.native="save1" style="position:absolute; top:163px; right:5px;">Save Edit</v-btn></p></span> | ||
72 | </v-card-text> | ||
73 | </v-card> | ||
74 | </v-dialog> | ||
75 | <v-data-table | ||
76 | :headers="headers" | ||
77 | :items="desserts" | ||
78 | class="elevation-1" | ||
79 | :pagination.sync="pagination" | ||
80 | > | ||
81 | <template slot="items" slot-scope="props"> | ||
82 | <tr v-if="props.index === 0"> | ||
83 | <td id="td"> </td> | ||
84 | <td> | ||
85 | <span style="cursor:pointer" @click="dialog=true"> <v-icon>add</v-icon>Add New Question</span> | ||
86 | </td> | ||
87 | <td id="td"> </td> | ||
88 | <td id="td"> </td> | ||
89 | </tr> | ||
90 | <tr> | ||
91 | <td id="td" class="text-xs-center">{{ props.item.no }}</td> | ||
92 | <td id="td">{{ props.item.ques }}</td> | ||
93 | <td id="td" class="text-xs-center">{{ props.item.res }}</td> | ||
94 | <td class="text-xs-center"> | ||
95 | <span> | ||
96 | <img style="cursor:pointer; height:18px; " class="mr-5" @click="editItem(props.item)" src="/static/icon/edit1.png"/> | ||
97 | <img style="cursor:pointer; height:20px; " class="mr-5" @click="deleteItem(props.item)" src="/static/icon/delete1.png"/> | ||
98 | </span> | ||
99 | </td> | ||
100 | </tr> | ||
101 | </template> | ||
102 | </v-data-table> | ||
103 | </v-card> | ||
104 | </v-flex> | ||
105 | |||
106 | </v-container> | ||
107 | </template> | ||
108 | <script> | ||
109 | export default { | ||
110 | data: () => ({ | ||
111 | question: '', | ||
112 | AddQuestioncredentials: {}, | ||
113 | dialog: false, | ||
114 | dialog1: false, | ||
115 | isActive: true, | ||
116 | newActive: false, | ||
117 | pagination: { | ||
118 | rowsPerPage: 10, | ||
119 | }, | ||
120 | headers: [ | ||
121 | { | ||
122 | text: 'No.', | ||
123 | align: 'center', | ||
124 | sortable: false, | ||
125 | value: 'name' | ||
126 | }, | ||
127 | { text: 'Posts', value: 'posts', sortable: false, align: 'center' }, | ||
128 | { text: 'Responses', value: 'responses', sortable: false, align: 'center' }, | ||
129 | { text: '', value: 'carbs', sortable: false, align: 'center' }, | ||
130 | ], | ||
131 | desserts: [], | ||
132 | editedIndex: -1, | ||
133 | editedItem: { | ||
134 | question: '', | ||
135 | |||
136 | }, | ||
137 | defaultItem: { | ||
138 | no: 0, | ||
139 | question: '', | ||
140 | res: 0, | ||
141 | |||
142 | } | ||
143 | }), | ||
144 | |||
145 | computed: { | ||
146 | formTitle () { | ||
147 | return this.editedIndex === -1 ? 'Create New Question' : 'Edit Question'; | ||
148 | } | ||
149 | }, | ||
150 | |||
151 | watch: { | ||
152 | dialog (val) { | ||
153 | val || this.close(); | ||
154 | } | ||
155 | }, | ||
156 | |||
157 | created () { | ||
158 | this.initialize(); | ||
159 | }, | ||
160 | |||
161 | methods: { | ||
162 | initialize () { | ||
163 | this.desserts = [ | ||
164 | { | ||
165 | no: '1', | ||
166 | ques: 'questions health', | ||
167 | res: 11, | ||
168 | }, | ||
169 | ]; | ||
170 | }, | ||
171 | |||
172 | editItem (item) { | ||
173 | this.editedIndex = this.desserts.indexOf(item); | ||
174 | this.editedItem = Object.assign({}, item); | ||
175 | this.dialog1 = true; | ||
176 | }, | ||
177 | |||
178 | deleteItem (item) { | ||
179 | const index = this.desserts.indexOf(item); | ||
180 | confirm('Are you sure you want to delete this item?') && this.desserts.splice(index, 1); | ||
181 | }, | ||
182 | |||
183 | close () { | ||
184 | this.dialog = false; | ||
185 | setTimeout(() => { | ||
186 | this.editedItem = Object.assign({}, this.defaultItem); | ||
187 | this.editedIndex = -1; | ||
188 | }, 300); | ||
189 | }, | ||
190 | close1 () { | ||
191 | this.dialog1 = false; | ||
192 | setTimeout(() => { | ||
193 | this.editedItem = Object.assign({}, this.defaultItem); | ||
194 | this.editedIndex = -1; | ||
195 | }, 300); | ||
196 | }, | ||
197 | save () { | ||
198 | console.log('editedItem', this.editedItem); | ||
199 | if (this.editedIndex > -1) { | ||
200 | Object.assign(this.desserts[this.editedIndex], this.editedItem); | ||
201 | } else { | ||
202 | this.desserts.push(this.editedItem); | ||
203 | } | ||
204 | this.close(); | ||
205 | }, | ||
206 | save1 () { | ||
207 | console.log('editedItem', this.editedItem); | ||
208 | if (this.editedIndex > -1) { | ||
209 | Object.assign(this.desserts[this.editedIndex], this.editedItem); | ||
210 | } else { | ||
211 | this.desserts.push(this.editedItem); | ||
212 | } | ||
213 | this.close1(); | ||
214 | } | ||
215 | }, | ||
216 | // switchComponent (comp) { | ||
217 | // this.$emit('switchComp', comp); | ||
218 | // } | ||
219 | }; | ||
220 | </script> | ||
221 | <style> | ||
222 | #td{ | ||
223 | border: 1px solid #dddddd; | ||
224 | text-align: left; | ||
225 | padding: 8px; | ||
226 | |||
227 | } | ||
228 | </style> | ||
229 |
src/components/questions/sex.vue
File was created | 1 | <template> | |
2 | <v-container grid-list-xl> | ||
3 | <v-flex> | ||
4 | <v-card> | ||
5 | <v-spacer></v-spacer> | ||
6 | <v-dialog v-model="dialog" max-width="800px"> | ||
7 | |||
8 | <v-card> | ||
9 | <v-card-title> | ||
10 | <span class="headline">{{ formTitle }}</span> | ||
11 | <v-spacer></v-spacer> | ||
12 | <v-icon @click="close">close</v-icon> | ||
13 | </v-card-title> | ||
14 | <v-flex> | ||
15 | <v-card> | ||
16 | <v-card-text> | ||
17 | <span> | ||
18 | <p><b>Ana Suggestion:</b> Select Suggestion</p></span> | ||
19 | <h5>Select Category:</h5> | ||
20 | <span> | ||
21 | <v-btn color="grey darken-2" flat>Suggestion</v-btn> | ||
22 | <v-btn color="grey darken-2" flat>Sex</v-btn> | ||
23 | <v-btn color="grey darken-2" flat>Health</v-btn> | ||
24 | <v-btn color="grey darken-2" flat>Skin & Beauty</v-btn> | ||
25 | <v-btn color="grey darken-2" flat>Diet & Ex</v-btn> | ||
26 | </span> | ||
27 | </v-card-text> | ||
28 | </v-card> | ||
29 | </v-flex> | ||
30 | <v-card-text> | ||
31 | |||
32 | <v-container grid-list-md> | ||
33 | <v-layout wrap> | ||
34 | <v-flex xs12 sm6 md12> | ||
35 | <v-textarea | ||
36 | solo | ||
37 | v-model="AddQuestioncredentials.question" | ||
38 | name="input-7-4" | ||
39 | label="Type Question" | ||
40 | ></v-textarea> | ||
41 | </v-flex> | ||
42 | </v-layout> | ||
43 | </v-container> | ||
44 | </v-card-text> | ||
45 | |||
46 | <v-card-actions> | ||
47 | <v-spacer></v-spacer> | ||
48 | <v-btn dark large @click.native="save">Post Question</v-btn> | ||
49 | </v-card-actions> | ||
50 | </v-card> | ||
51 | </v-dialog> | ||
52 | |||
53 | |||
54 | |||
55 | <v-dialog v-model="dialog1" max-width="800px"> | ||
56 | <v-card> | ||
57 | <v-card-title> | ||
58 | <span class="headline">Edit Question</span> | ||
59 | <v-spacer></v-spacer> | ||
60 | <v-icon @click="close1">close</v-icon> | ||
61 | </v-card-title> | ||
62 | |||
63 | <v-card-text> | ||
64 | <v-layout wrap> | ||
65 | <v-flex xs12 sm6 md12> | ||
66 | <v-text-field outline v-model="editedItem.ques" label="Question"></v-text-field> | ||
67 | </v-flex> | ||
68 | </v-layout> | ||
69 | <span><p> <b>Ana suggestion:</b> Abnormal Uterine Bleeding <br> | ||
70 | Diagnosis 1,Diagnosis 2,Diagnosis 3 | ||
71 | <v-btn dark large @click.native="save1" style="position:absolute; top:163px; right:5px;">Save Edit</v-btn></p></span> | ||
72 | </v-card-text> | ||
73 | </v-card> | ||
74 | </v-dialog> | ||
75 | <v-data-table | ||
76 | :headers="headers" | ||
77 | :items="desserts" | ||
78 | class="elevation-1" | ||
79 | :pagination.sync="pagination" | ||
80 | > | ||
81 | <template slot="items" slot-scope="props"> | ||
82 | <tr v-if="props.index === 0"> | ||
83 | <td id="td"> </td> | ||
84 | <td> | ||
85 | <span style="cursor:pointer" @click="dialog=true"> <v-icon>add</v-icon>Add New Question</span> | ||
86 | </td> | ||
87 | <td id="td"> </td> | ||
88 | <td id="td"> </td> | ||
89 | </tr> | ||
90 | <tr> | ||
91 | <td id="td" class="text-xs-center">{{ props.item.no }}</td> | ||
92 | <td id="td">{{ props.item.ques }}</td> | ||
93 | <td id="td" class="text-xs-center">{{ props.item.res }}</td> | ||
94 | <td class="text-xs-center"> | ||
95 | <span> | ||
96 | <img style="cursor:pointer; height:18px; " class="mr-5" @click="editItem(props.item)" src="/static/icon/edit1.png"/> | ||
97 | <img style="cursor:pointer; height:20px; " class="mr-5" @click="deleteItem(props.item)" src="/static/icon/delete1.png"/> | ||
98 | </span> | ||
99 | </td> | ||
100 | </tr> | ||
101 | </template> | ||
102 | </v-data-table> | ||
103 | </v-card> | ||
104 | </v-flex> | ||
105 | |||
106 | </v-container> | ||
107 | </template> | ||
108 | <script> | ||
109 | export default { | ||
110 | data: () => ({ | ||
111 | question: '', | ||
112 | AddQuestioncredentials: {}, | ||
113 | dialog: false, | ||
114 | dialog1: false, | ||
115 | isActive: true, | ||
116 | newActive: false, | ||
117 | pagination: { | ||
118 | rowsPerPage: 10, | ||
119 | }, | ||
120 | headers: [ | ||
121 | { | ||
122 | text: 'No.', | ||
123 | align: 'center', | ||
124 | sortable: false, | ||
125 | value: 'name' | ||
126 | }, | ||
127 | { text: 'Posts', value: 'posts', sortable: false, align: 'center' }, | ||
128 | { text: 'Responses', value: 'responses', sortable: false, align: 'center' }, | ||
129 | { text: '', value: 'carbs', sortable: false, align: 'center' }, | ||
130 | ], | ||
131 | desserts: [], | ||
132 | editedIndex: -1, | ||
133 | editedItem: { | ||
134 | question: '', | ||
135 | |||
136 | }, | ||
137 | defaultItem: { | ||
138 | no: 0, | ||
139 | question: '', | ||
140 | res: 0, | ||
141 | |||
142 | } | ||
143 | }), | ||
144 | |||
145 | computed: { | ||
146 | formTitle () { | ||
147 | return this.editedIndex === -1 ? 'Create New Question' : 'Edit Question'; | ||
148 | } | ||
149 | }, | ||
150 | |||
151 | watch: { | ||
152 | dialog (val) { | ||
153 | val || this.close(); | ||
154 | } | ||
155 | }, | ||
156 | |||
157 | created () { | ||
158 | this.initialize(); | ||
159 | }, | ||
160 | |||
161 | methods: { | ||
162 | initialize () { | ||
163 | this.desserts = [ | ||
164 | { | ||
165 | no: '1', | ||
166 | ques: 'questions sex', | ||
167 | res: 8, | ||
168 | }, | ||
169 | ]; | ||
170 | }, | ||
171 | |||
172 | editItem (item) { | ||
173 | this.editedIndex = this.desserts.indexOf(item); | ||
174 | this.editedItem = Object.assign({}, item); | ||
175 | this.dialog1 = true; | ||
176 | }, | ||
177 | |||
178 | deleteItem (item) { | ||
179 | const index = this.desserts.indexOf(item); | ||
180 | confirm('Are you sure you want to delete this item?') && this.desserts.splice(index, 1); | ||
181 | }, | ||
182 | |||
183 | close () { | ||
184 | this.dialog = false; | ||
185 | setTimeout(() => { | ||
186 | this.editedItem = Object.assign({}, this.defaultItem); | ||
187 | this.editedIndex = -1; | ||
188 | }, 300); | ||
189 | }, | ||
190 | close1 () { | ||
191 | this.dialog1 = false; | ||
192 | setTimeout(() => { | ||
193 | this.editedItem = Object.assign({}, this.defaultItem); | ||
194 | this.editedIndex = -1; | ||
195 | }, 300); | ||
196 | }, | ||
197 | save () { | ||
198 | console.log('editedItem', this.editedItem); | ||
199 | if (this.editedIndex > -1) { | ||
200 | Object.assign(this.desserts[this.editedIndex], this.editedItem); | ||
201 | } else { | ||
202 | this.desserts.push(this.editedItem); | ||
203 | } | ||
204 | this.close(); | ||
205 | }, | ||
206 | save1 () { | ||
207 | console.log('editedItem', this.editedItem); | ||
208 | if (this.editedIndex > -1) { | ||
209 | Object.assign(this.desserts[this.editedIndex], this.editedItem); | ||
210 | } else { | ||
211 | this.desserts.push(this.editedItem); | ||
212 | } | ||
213 | this.close1(); | ||
214 | } | ||
215 | }, | ||
216 | // switchComponent (comp) { | ||
217 | // this.$emit('switchComp', comp); | ||
218 | // } | ||
219 | }; | ||
220 | </script> | ||
221 | <style> | ||
222 | #td{ | ||
223 | border: 1px solid #dddddd; | ||
224 | text-align: left; | ||
225 | padding: 8px; | ||
226 | |||
227 | } | ||
228 | </style> | ||
229 |
src/components/questions/skin.vue
File was created | 1 | <template> | |
2 | <v-container grid-list-xl> | ||
3 | <v-flex> | ||
4 | <v-card> | ||
5 | <v-spacer></v-spacer> | ||
6 | <v-dialog v-model="dialog" max-width="800px"> | ||
7 | |||
8 | <v-card> | ||
9 | <v-card-title> | ||
10 | <span class="headline">{{ formTitle }}</span> | ||
11 | <v-spacer></v-spacer> | ||
12 | <v-icon @click="close">close</v-icon> | ||
13 | </v-card-title> | ||
14 | <v-flex> | ||
15 | <v-card> | ||
16 | <v-card-text> | ||
17 | <span> | ||
18 | <p><b>Ana Suggestion:</b> Select Suggestion</p></span> | ||
19 | <h5>Select Category:</h5> | ||
20 | <span> | ||
21 | <v-btn color="grey darken-2" flat>Suggestion</v-btn> | ||
22 | <v-btn color="grey darken-2" flat>Sex</v-btn> | ||
23 | <v-btn color="grey darken-2" flat>Health</v-btn> | ||
24 | <v-btn color="grey darken-2" flat>Skin & Beauty</v-btn> | ||
25 | <v-btn color="grey darken-2" flat>Diet & Ex</v-btn> | ||
26 | </span> | ||
27 | </v-card-text> | ||
28 | </v-card> | ||
29 | </v-flex> | ||
30 | <v-card-text> | ||
31 | |||
32 | <v-container grid-list-md> | ||
33 | <v-layout wrap> | ||
34 | <v-flex xs12 sm6 md12> | ||
35 | <v-textarea | ||
36 | solo | ||
37 | v-model="AddQuestioncredentials.question" | ||
38 | name="input-7-4" | ||
39 | label="Type Question" | ||
40 | ></v-textarea> | ||
41 | </v-flex> | ||
42 | </v-layout> | ||
43 | </v-container> | ||
44 | </v-card-text> | ||
45 | |||
46 | <v-card-actions> | ||
47 | <v-spacer></v-spacer> | ||
48 | <v-btn dark large @click.native="save">Post Question</v-btn> | ||
49 | </v-card-actions> | ||
50 | </v-card> | ||
51 | </v-dialog> | ||
52 | |||
53 | |||
54 | |||
55 | <v-dialog v-model="dialog1" max-width="800px"> | ||
56 | <v-card> | ||
57 | <v-card-title> | ||
58 | <span class="headline">Edit Question</span> | ||
59 | <v-spacer></v-spacer> | ||
60 | <v-icon @click="close1">close</v-icon> | ||
61 | </v-card-title> | ||
62 | |||
63 | <v-card-text> | ||
64 | <v-layout wrap> | ||
65 | <v-flex xs12 sm6 md12> | ||
66 | <v-text-field outline v-model="editedItem.ques" label="Question"></v-text-field> | ||
67 | </v-flex> | ||
68 | </v-layout> | ||
69 | <span><p> <b>Ana suggestion:</b> Abnormal Uterine Bleeding <br> | ||
70 | Diagnosis 1,Diagnosis 2,Diagnosis 3 | ||
71 | <v-btn dark large @click.native="save1" style="position:absolute; top:163px; right:5px;">Save Edit</v-btn></p></span> | ||
72 | </v-card-text> | ||
73 | </v-card> | ||
74 | </v-dialog> | ||
75 | <v-data-table | ||
76 | :headers="headers" | ||
77 | :items="desserts" | ||
78 | class="elevation-1" | ||
79 | :pagination.sync="pagination" | ||
80 | > | ||
81 | <template slot="items" slot-scope="props"> | ||
82 | <tr v-if="props.index === 0"> | ||
83 | <td id="td"> </td> | ||
84 | <td> | ||
85 | <span style="cursor:pointer" @click="dialog=true"> <v-icon>add</v-icon>Add New Question</span> | ||
86 | </td> | ||
87 | <td id="td"> </td> | ||
88 | <td id="td"> </td> | ||
89 | </tr> | ||
90 | <tr> | ||
91 | <td id="td" class="text-xs-center">{{ props.item.no }}</td> | ||
92 | <td id="td">{{ props.item.ques }}</td> | ||
93 | <td id="td" class="text-xs-center">{{ props.item.res }}</td> | ||
94 | <td class="text-xs-center"> | ||
95 | <span> | ||
96 | <img style="cursor:pointer; height:18px; " class="mr-5" @click="editItem(props.item)" src="/static/icon/edit1.png"/> | ||
97 | <img style="cursor:pointer; height:20px; " class="mr-5" @click="deleteItem(props.item)" src="/static/icon/delete1.png"/> | ||
98 | </span> | ||
99 | </td> | ||
100 | </tr> | ||
101 | </template> | ||
102 | </v-data-table> | ||
103 | </v-card> | ||
104 | </v-flex> | ||
105 | |||
106 | </v-container> | ||
107 | </template> | ||
108 | <script> | ||
109 | export default { | ||
110 | data: () => ({ | ||
111 | question: '', | ||
112 | AddQuestioncredentials: {}, | ||
113 | dialog: false, | ||
114 | dialog1: false, | ||
115 | isActive: true, | ||
116 | newActive: false, | ||
117 | pagination: { | ||
118 | rowsPerPage: 10, | ||
119 | }, | ||
120 | headers: [ | ||
121 | { | ||
122 | text: 'No.', | ||
123 | align: 'center', | ||
124 | sortable: false, | ||
125 | value: 'name' | ||
126 | }, | ||
127 | { text: 'Posts', value: 'posts', sortable: false, align: 'center' }, | ||
128 | { text: 'Responses', value: 'responses', sortable: false, align: 'center' }, | ||
129 | { text: '', value: 'carbs', sortable: false, align: 'center' }, | ||
130 | ], | ||
131 | desserts: [], | ||
132 | editedIndex: -1, | ||
133 | editedItem: { | ||
134 | question: '', | ||
135 | |||
136 | }, | ||
137 | defaultItem: { | ||
138 | no: 0, | ||
139 | question: '', | ||
140 | res: 0, | ||
141 | |||
142 | } | ||
143 | }), | ||
144 | |||
145 | computed: { | ||
146 | formTitle () { | ||
147 | return this.editedIndex === -1 ? 'Create New Question' : 'Edit Question'; | ||
148 | } | ||
149 | }, | ||
150 | |||
151 | watch: { | ||
152 | dialog (val) { | ||
153 | val || this.close(); | ||
154 | } | ||
155 | }, | ||
156 | |||
157 | created () { | ||
158 | this.initialize(); | ||
159 | }, | ||
160 | |||
161 | methods: { | ||
162 | initialize () { | ||
163 | this.desserts = [ | ||
164 | { | ||
165 | no: '1', | ||
166 | ques: 'questions skin', | ||
167 | res: 16, | ||
168 | }, | ||
169 | ]; | ||
170 | }, | ||
171 | |||
172 | editItem (item) { | ||
173 | this.editedIndex = this.desserts.indexOf(item); | ||
174 | this.editedItem = Object.assign({}, item); | ||
175 | this.dialog1 = true; | ||
176 | }, | ||
177 | |||
178 | deleteItem (item) { | ||
179 | const index = this.desserts.indexOf(item); | ||
180 | confirm('Are you sure you want to delete this item?') && this.desserts.splice(index, 1); | ||
181 | }, | ||
182 | |||
183 | close () { | ||
184 | this.dialog = false; | ||
185 | setTimeout(() => { | ||
186 | this.editedItem = Object.assign({}, this.defaultItem); | ||
187 | this.editedIndex = -1; | ||
188 | }, 300); | ||
189 | }, | ||
190 | close1 () { | ||
191 | this.dialog1 = false; | ||
192 | setTimeout(() => { | ||
193 | this.editedItem = Object.assign({}, this.defaultItem); | ||
194 | this.editedIndex = -1; | ||
195 | }, 300); | ||
196 | }, | ||
197 | save () { | ||
198 | console.log('editedItem', this.editedItem); | ||
199 | if (this.editedIndex > -1) { | ||
200 | Object.assign(this.desserts[this.editedIndex], this.editedItem); | ||
201 | } else { | ||
202 | this.desserts.push(this.editedItem); | ||
203 | } | ||
204 | this.close(); | ||
205 | }, | ||
206 | save1 () { | ||
207 | console.log('editedItem', this.editedItem); | ||
208 | if (this.editedIndex > -1) { | ||
209 | Object.assign(this.desserts[this.editedIndex], this.editedItem); | ||
210 | } else { | ||
211 | this.desserts.push(this.editedItem); | ||
212 | } | ||
213 | this.close1(); | ||
214 | } | ||
215 | }, | ||
216 | // switchComponent (comp) { | ||
217 | // this.$emit('switchComp', comp); | ||
218 | // } | ||
219 | }; | ||
220 | </script> | ||
221 | <style> | ||
222 | #td{ | ||
223 | border: 1px solid #dddddd; | ||
224 | text-align: left; | ||
225 | padding: 8px; | ||
226 | |||
227 | } | ||
228 | </style> | ||
229 |
src/components/questions/suggestion.vue
File was created | 1 | <template> | |
2 | <v-container grid-list-xl> | ||
3 | <v-flex> | ||
4 | <v-card> | ||
5 | <v-spacer></v-spacer> | ||
6 | <v-dialog v-model="dialog" max-width="800px"> | ||
7 | |||
8 | <v-card> | ||
9 | <v-card-title> | ||
10 | <span class="headline">{{ formTitle }}</span> | ||
11 | <v-spacer></v-spacer> | ||
12 | <v-icon @click="close">close</v-icon> | ||
13 | </v-card-title> | ||
14 | <v-flex> | ||
15 | <v-card> | ||
16 | <v-card-text> | ||
17 | <span> | ||
18 | <p><b>Ana Suggestion:</b> Select Suggestion</p></span> | ||
19 | <h5>Select Category:</h5> | ||
20 | <span> | ||
21 | <v-btn color="grey darken-2" flat>Suggestion</v-btn> | ||
22 | <v-btn color="grey darken-2" flat>Sex</v-btn> | ||
23 | <v-btn color="grey darken-2" flat>Health</v-btn> | ||
24 | <v-btn color="grey darken-2" flat>Skin & Beauty</v-btn> | ||
25 | <v-btn color="grey darken-2" flat>Diet & Ex</v-btn> | ||
26 | </span> | ||
27 | </v-card-text> | ||
28 | </v-card> | ||
29 | </v-flex> | ||
30 | <v-card-text> | ||
31 | |||
32 | <v-container grid-list-md> | ||
33 | <v-layout wrap> | ||
34 | <v-flex xs12 sm6 md12> | ||
35 | <v-textarea | ||
36 | solo | ||
37 | v-model="AddQuestioncredentials.question" | ||
38 | name="input-7-4" | ||
39 | label="Type Question" | ||
40 | ></v-textarea> | ||
41 | </v-flex> | ||
42 | </v-layout> | ||
43 | </v-container> | ||
44 | </v-card-text> | ||
45 | |||
46 | <v-card-actions> | ||
47 | <v-spacer></v-spacer> | ||
48 | <v-btn dark large @click.native="save">Post Question</v-btn> | ||
49 | </v-card-actions> | ||
50 | </v-card> | ||
51 | </v-dialog> | ||
52 | |||
53 | |||
54 | |||
55 | <v-dialog v-model="dialog1" max-width="800px"> | ||
56 | <v-card> | ||
57 | <v-card-title> | ||
58 | <span class="headline">Edit Question</span> | ||
59 | <v-spacer></v-spacer> | ||
60 | <v-icon @click="close1">close</v-icon> | ||
61 | </v-card-title> | ||
62 | |||
63 | <v-card-text> | ||
64 | <v-layout wrap> | ||
65 | <v-flex xs12 sm6 md12> | ||
66 | <v-text-field outline v-model="editedItem.ques" label="Question"></v-text-field> | ||
67 | </v-flex> | ||
68 | </v-layout> | ||
69 | <span><p> <b>Ana suggestion:</b> Abnormal Uterine Bleeding <br> | ||
70 | Diagnosis 1,Diagnosis 2,Diagnosis 3 | ||
71 | <v-btn dark large @click.native="save1" style="position:absolute; top:163px; right:5px;">Save Edit</v-btn></p></span> | ||
72 | </v-card-text> | ||
73 | </v-card> | ||
74 | </v-dialog> | ||
75 | <v-card> | ||
76 | <v-data-table | ||
77 | :headers="headers" | ||
78 | :items="desserts" | ||
79 | class="elevation-1" | ||
80 | :pagination.sync="pagination" | ||
81 | > | ||
82 | <template slot="items" slot-scope="props"> | ||
83 | <tr v-if="props.index === 0"> | ||
84 | <td id="td"> </td> | ||
85 | <td> | ||
86 | <span style="cursor:pointer" @click="dialog=true"> <v-icon>add</v-icon>Add New Question</span> | ||
87 | </td> | ||
88 | <td id="td"> </td> | ||
89 | <td id="td"> </td> | ||
90 | </tr> | ||
91 | <tr> | ||
92 | <td id="td" class="text-xs-center">{{ props.item.no }}</td> | ||
93 | <td id="td">{{ props.item.ques }}</td> | ||
94 | <td id="td" class="text-xs-center">{{ props.item.res }}</td> | ||
95 | <td class="text-xs-center"> | ||
96 | <span> | ||
97 | <img style="cursor:pointer; height:18px; " class="mr-5" @click="editItem(props.item)" src="/static/icon/edit1.png"/> | ||
98 | <img style="cursor:pointer; height:20px; " class="mr-5" @click="deleteItem(props.item)" src="/static/icon/delete1.png"/> | ||
99 | </span> | ||
100 | </td> | ||
101 | </tr> | ||
102 | </template> | ||
103 | </v-data-table></v-card> | ||
104 | </v-card> | ||
105 | </v-flex> | ||
106 | |||
107 | </v-container> | ||
108 | </template> | ||
109 | <script> | ||
110 | export default { | ||
111 | data: () => ({ | ||
112 | question: '', | ||
113 | AddQuestioncredentials: {}, | ||
114 | dialog: false, | ||
115 | dialog1: false, | ||
116 | isActive: true, | ||
117 | newActive: false, | ||
118 | pagination: { | ||
119 | rowsPerPage: 10, | ||
120 | }, | ||
121 | headers: [ | ||
122 | { | ||
123 | text: 'No.', | ||
124 | align: 'center', | ||
125 | sortable: false, | ||
126 | value: 'name' | ||
127 | }, | ||
128 | { text: 'Posts', value: 'posts', sortable: false, align: 'center' }, | ||
129 | { text: 'Responses', value: 'responses', sortable: false, align: 'center' }, | ||
130 | { text: '', value: 'carbs', sortable: false, align: 'center' }, | ||
131 | ], | ||
132 | desserts: [], | ||
133 | editedIndex: -1, | ||
134 | editedItem: { | ||
135 | question: '', | ||
136 | |||
137 | }, | ||
138 | defaultItem: { | ||
139 | no: 0, | ||
140 | question: '', | ||
141 | res: 0, | ||
142 | |||
143 | } | ||
144 | }), | ||
145 | |||
146 | computed: { | ||
147 | formTitle () { | ||
148 | return this.editedIndex === -1 ? 'Create New Question' : 'Edit Question'; | ||
149 | } | ||
150 | }, | ||
151 | |||
152 | watch: { | ||
153 | dialog (val) { | ||
154 | val || this.close(); | ||
155 | } | ||
156 | }, | ||
157 | |||
158 | created () { | ||
159 | this.initialize(); | ||
160 | }, | ||
161 | |||
162 | methods: { | ||
163 | initialize () { | ||
164 | this.desserts = [ | ||
165 | { | ||
166 | no: '1', | ||
167 | ques: 'questions suggestion', | ||
168 | res: 21, | ||
169 | }, | ||
170 | ]; | ||
171 | }, | ||
172 | |||
173 | editItem (item) { | ||
174 | this.editedIndex = this.desserts.indexOf(item); | ||
175 | this.editedItem = Object.assign({}, item); | ||
176 | this.dialog1 = true; | ||
177 | }, | ||
178 | |||
179 | deleteItem (item) { | ||
180 | const index = this.desserts.indexOf(item); | ||
181 | confirm('Are you sure you want to delete this item?') && this.desserts.splice(index, 1); | ||
182 | }, | ||
183 | |||
184 | close () { | ||
185 | this.dialog = false; | ||
186 | setTimeout(() => { | ||
187 | this.editedItem = Object.assign({}, this.defaultItem); | ||
188 | this.editedIndex = -1; | ||
189 | }, 300); | ||
190 | }, | ||
191 | close1 () { | ||
192 | this.dialog1 = false; | ||
193 | setTimeout(() => { | ||
194 | this.editedItem = Object.assign({}, this.defaultItem); | ||
195 | this.editedIndex = -1; | ||
196 | }, 300); | ||
197 | }, | ||
198 | save () { | ||
199 | console.log('editedItem', this.editedItem); | ||
200 | if (this.editedIndex > -1) { | ||
201 | Object.assign(this.desserts[this.editedIndex], this.editedItem); | ||
202 | } else { | ||
203 | this.desserts.push(this.editedItem); | ||
204 | } | ||
205 | this.close(); | ||
206 | }, | ||
207 | save1 () { | ||
208 | console.log('editedItem', this.editedItem); | ||
209 | if (this.editedIndex > -1) { | ||
210 | Object.assign(this.desserts[this.editedIndex], this.editedItem); | ||
211 | } else { | ||
212 | this.desserts.push(this.editedItem); | ||
213 | } | ||
214 | this.close1(); | ||
215 | } | ||
216 | }, | ||
217 | // switchComponent (comp) { | ||
218 | // this.$emit('switchComp', comp); | ||
219 | // } | ||
220 | }; | ||
221 | </script> | ||
222 | <style> | ||
223 | #td{ | ||
224 | border: 1px solid #dddddd; | ||
225 | text-align: left; | ||
226 | padding: 8px; | ||
227 | |||
228 | } | ||
229 | </style> | ||
230 |
src/pages/Provider.vue
1 | <template> | 1 | <template> |
2 | <v-container grid-list-md> | 2 | <v-container grid-list-md> |
3 | <v-flex> | 3 | <v-flex> |
4 | <v-card> | 4 | <v-card> |
5 | <v-card-title> | 5 | <v-card-title> |
6 | <b><h5> Healthcare Providers </h5></b> | 6 | <b><h5> Healthcare Providers </h5></b> |
7 | <v-spacer></v-spacer> | 7 | <v-spacer></v-spacer> |
8 | <v-flex xs6 sm4> | 8 | <v-flex xs6 sm4> |
9 | <v-text-field justify-right | 9 | <v-text-field justify-right |
10 | prepend-icon="search" | 10 | prepend-icon="search" |
11 | v-model="search" | 11 | v-model="search" |
12 | label="Find Yours Users" | 12 | label="Find Yours Users" |
13 | color="black" | 13 | color="black" |
14 | ></v-text-field></v-flex> | 14 | ></v-text-field></v-flex> |
15 | </v-card-title> | 15 | </v-card-title> |
16 | 16 | ||
17 | <v-dialog v-model="dialog" max-width="500px"> | 17 | <v-dialog v-model="dialog" max-width="500px"> |
18 | <v-toolbar color="white"> | 18 | <v-toolbar color="white"> |
19 | <v-spacer></v-spacer> | 19 | <v-spacer></v-spacer> |
20 | <v-toolbar-title>Edit Profile</v-toolbar-title> | 20 | <v-toolbar-title>Edit Profile</v-toolbar-title> |
21 | <v-spacer></v-spacer> | 21 | <v-spacer></v-spacer> |
22 | </v-toolbar> | 22 | </v-toolbar> |
23 | <v-card> | 23 | <v-card> |
24 | <v-flex align-center justify-center layout text-xs-center> | 24 | <v-flex align-center justify-center layout text-xs-center> |
25 | <v-avatar size="50px" style="position:absolute; top:10px; "> | 25 | <v-avatar size="50px" style="position:absolute; top:10px; "> |
26 | <img src="/static/icon/user.png"/> </v-avatar> | 26 | <img src="/static/icon/user.png"/> </v-avatar> |
27 | </v-flex> | 27 | </v-flex> |
28 | <v-card-text> | 28 | <v-card-text> |
29 | <v-container grid-list-md> | 29 | <v-container grid-list-md> |
30 | <v-layout wrap justify-center> | 30 | <v-layout wrap justify-center> |
31 | <v-flex xs12 sm9> | 31 | <v-flex xs12 sm9> |
32 | <v-form> | 32 | <v-form> |
33 | <v-layout style="position:relative; top:15px; "> | 33 | <v-layout style="position:relative; top:15px; "> |
34 | <v-flex xs4 class="pt-4 subheading"> | 34 | <v-flex xs4 class="pt-4 subheading"> |
35 | <label>First Name: </label> | 35 | <label>First Name: </label> |
36 | </v-flex> | 36 | </v-flex> |
37 | <v-flex xs8> | 37 | <v-flex xs8> |
38 | <v-text-field | 38 | <v-text-field |
39 | v-model="editedItem.Name" | 39 | v-model="editedItem.Name" |
40 | :rules="nameRules" | 40 | :rules="nameRules" |
41 | required | 41 | required |
42 | ></v-text-field> | 42 | ></v-text-field> |
43 | </v-flex> | 43 | </v-flex> |
44 | </v-layout> | 44 | </v-layout> |
45 | <v-layout> | 45 | <v-layout> |
46 | <v-flex xs4 class="pt-4 subheading"> | 46 | <v-flex xs4 class="pt-4 subheading"> |
47 | <label>Last Name: </label> | 47 | <label>Last Name: </label> |
48 | </v-flex> | 48 | </v-flex> |
49 | <v-flex xs8> | 49 | <v-flex xs8> |
50 | <v-text-field | 50 | <v-text-field |
51 | v-model="editedItem.LName" | 51 | v-model="editedItem.LName" |
52 | :rules="lnameRules" | 52 | :rules="lnameRules" |
53 | required | 53 | required |
54 | ></v-text-field> | 54 | ></v-text-field> |
55 | </v-flex> | 55 | </v-flex> |
56 | </v-layout> | 56 | </v-layout> |
57 | |||
58 | <v-layout> | 57 | <v-layout> |
59 | <v-flex xs4 class="pt-4 subheading"> | 58 | <v-flex xs4 class="pt-4 subheading"> |
60 | <label>Email ID: </label> | 59 | <label>Email ID: </label> |
61 | </v-flex> | 60 | </v-flex> |
62 | <v-flex xs8> | 61 | <v-flex xs8> |
63 | <v-text-field | 62 | <v-text-field |
64 | v-model="editedItem.Email" | 63 | v-model="editedItem.Email" |
65 | :rules="emailRules" | 64 | :rules="emailRules" |
66 | data-vv-name="E-mail" | 65 | data-vv-name="E-mail" |
67 | required | 66 | required |
68 | ></v-text-field></v-flex></v-layout> | 67 | ></v-text-field></v-flex></v-layout> |
69 | <v-layout> | 68 | <v-layout> |
70 | <v-flex xs4 class="pt-4 subheading"> | 69 | <v-flex xs4 class="pt-4 subheading"> |
71 | <label>Date of Birth: </label> | 70 | <label>Date of Birth: </label> |
72 | </v-flex> | 71 | </v-flex> |
73 | <v-flex xs8> | 72 | <v-flex xs8> |
74 | <v-text-field | 73 | <v-text-field |
75 | v-model="editedItem.DOB" | 74 | v-model="editedItem.DOB" |
76 | :rules="[rules.required, rules.min]" | 75 | :rules="[rules.required, rules.min]" |
77 | ></v-text-field></v-flex></v-layout> | 76 | ></v-text-field></v-flex></v-layout> |
78 | <v-card-actions> | 77 | <v-card-actions> |
79 | <v-btn round dark @click.native="close">Cancel</v-btn> | 78 | <v-btn round dark @click.native="close">Cancel</v-btn> |
80 | <v-spacer></v-spacer> | 79 | <v-spacer></v-spacer> |
81 | <v-btn round dark @click.native="save">Save</v-btn> | 80 | <v-btn round dark @click.native="save">Save</v-btn> |
82 | 81 | ||
83 | </v-card-actions> | 82 | </v-card-actions> |
84 | </v-form> | 83 | </v-form> |
85 | </v-flex> | 84 | </v-flex> |
86 | </v-layout> | 85 | </v-layout> |
87 | </v-container> | 86 | </v-container> |
88 | </v-card-text> | 87 | </v-card-text> |
89 | </v-card> | 88 | </v-card> |
90 | </v-dialog> | 89 | </v-dialog> |
91 | 90 | ||
92 | <v-dialog v-model="dialog1" max-width="500px"> | 91 | <v-dialog v-model="dialog1" max-width="500px"> |
93 | <v-toolbar color="white"> | 92 | <v-toolbar color="white"> |
94 | <v-spacer></v-spacer> | 93 | <v-spacer></v-spacer> |
95 | <v-toolbar-title>Profile</v-toolbar-title> | 94 | <v-toolbar-title>Profile</v-toolbar-title> |
96 | <v-spacer></v-spacer> | 95 | <v-spacer></v-spacer> |
97 | <v-icon @click="close1">close</v-icon> | 96 | <v-icon @click="close1">close</v-icon> |
98 | </v-toolbar> | 97 | </v-toolbar> |
99 | 98 | ||
100 | 99 | ||
101 | <v-card> | 100 | <v-card> |
102 | <v-flex align-center justify-center layout text-xs-center> | 101 | <v-flex align-center justify-center layout text-xs-center> |
103 | <v-avatar size="50px" style="position:absolute; top:10px;"> | 102 | <v-avatar size="50px" style="position:absolute; top:10px;"> |
104 | <img src="/static/icon/user.png"/> </v-avatar> | 103 | <img src="/static/icon/user.png"/> </v-avatar> |
105 | </v-flex> | 104 | </v-flex> |
106 | <v-card-text> | 105 | <v-card-text> |
107 | <v-container grid-list-md> | 106 | <v-container grid-list-md> |
108 | <v-layout wrap justify-center> | 107 | <v-layout wrap justify-center> |
109 | <v-flex offset-xs3> | 108 | <v-flex offset-xs3> |
110 | 109 | ||
111 | <br><br> | 110 | <br><br> |
112 | <table> | 111 | <table> |
113 | <th> | 112 | <th> |
114 | <tr><h5><b>First Name:</b></h5></tr><br> | 113 | <tr><h5><b>First Name:</b></h5></tr><br> |
115 | <tr><h5><b>Last Name:</b></h5></tr><br> | 114 | <tr><h5><b>Last Name:</b></h5></tr><br> |
116 | <tr><h5><b>Email:</b></h5></tr><br> | 115 | <tr><h5><b>Email:</b></h5></tr><br> |
117 | <tr><h5><b>Date Of Birth:</b></h5></tr> | 116 | <tr><h5><b>Date Of Birth:</b></h5></tr> |
118 | </th> | 117 | </th> |
119 | <th> | 118 | <th> |
120 | <tr><td><h5><b>{{ editedItem.Name }}</b></h5></td></tr><br> | 119 | <tr><td><h5><b>{{ editedItem.Name }}</b></h5></td></tr><br> |
121 | <tr> <td><h5><b>{{ editedItem.LName }}</b></h5></td></tr><br> | 120 | <tr> <td><h5><b>{{ editedItem.LName }}</b></h5></td></tr><br> |
122 | <tr><td><h5><b>{{ editedItem.Email }}</b></h5></td></tr><br> | 121 | <tr><td><h5><b>{{ editedItem.Email }}</b></h5></td></tr><br> |
123 | <tr><td><h5><b>{{ editedItem.DOB }}</b></h5></td></tr> | 122 | <tr><td><h5><b>{{ editedItem.DOB }}</b></h5></td></tr> |
124 | </th> | 123 | </th> |
125 | 124 | ||
126 | 125 | ||
127 | </table> | 126 | </table> |
128 | </v-flex> | 127 | </v-flex> |
129 | </v-layout> | 128 | </v-layout> |
130 | </v-container> | 129 | </v-container> |
131 | </v-card-text> | 130 | </v-card-text> |
132 | </v-card> | 131 | </v-card> |
133 | </v-dialog> | 132 | </v-dialog> |
134 | <v-data-table | 133 | <v-data-table |
135 | :headers="headers" | 134 | :headers="headers" |
136 | :items="desserts" | 135 | :items="desserts" |
137 | :search="search" | 136 | :search="search" |
138 | class="elevation-1" | 137 | class="elevation-1" |
139 | :pagination.sync="pagination" | 138 | :pagination.sync="pagination" |
140 | > | 139 | > |
141 | 140 | ||
142 | <template slot="items" slot-scope="props"> | 141 | <template slot="items" slot-scope="props"> |
143 | <td id="td" class="text-xs-center">{{ props.item.No }}</td> | 142 | <td id="td" class="text-xs-center">{{ props.item.No }}</td> |
144 | <td id="td" class="text-xs-center">{{ props.item.Name+' '+props.item.LName }}</td> | 143 | <td id="td" class="text-xs-center">{{ props.item.Name+' '+props.item.LName }}</td> |
145 | <td id="td" class="text-xs-center">{{ props.item.Email }}</td> | 144 | <td id="td" class="text-xs-center">{{ props.item.Email }}</td> |
146 | <td id="td" class="text-xs-center"> | 145 | <td id="td" class="text-xs-center"> |
147 | <v-flex xs6 sm6> | 146 | <v-flex xs6 sm6> |
148 | <v-select | 147 | <v-select |
149 | :items="status" | 148 | :items="status" |
150 | v-model="props.item.e1" | 149 | v-model="props.item.e1" |
151 | menu-props="auto" | 150 | menu-props="auto" |
152 | label="Select" | 151 | label="Select" |
153 | hide-details | 152 | hide-details |
154 | single-line | 153 | single-line |
155 | ></v-select> | 154 | ></v-select> |
156 | </v-flex> | 155 | </v-flex> |
157 | </td> | 156 | </td> |
158 | <td class="text-xs-center"> | 157 | <td class="text-xs-center"> |
159 | <span> | 158 | <span> |
160 | <img style="cursor:pointer; width:25px; height:18px; " class="mr-5" @click="profile(props.item)" src="/static/icon/eye1.png"/> | 159 | <img style="cursor:pointer; width:25px; height:18px; " class="mr-5" @click="profile(props.item)" src="/static/icon/eye1.png"/> |
161 | <img style="cursor:pointer; width:20px; height:18px; " class="mr-5" @click="editItem(props.item)" src="/static/icon/edit1.png"/> | 160 | <img style="cursor:pointer; width:20px; height:18px; " class="mr-5" @click="editItem(props.item)" src="/static/icon/edit1.png"/> |
162 | <img style="cursor:pointer; height:20px; " class="mr-2" @click="deleteItem(props.item)" src="/static/icon/delete1.png"/> | 161 | <img style="cursor:pointer; height:20px; " class="mr-2" @click="deleteItem(props.item)" src="/static/icon/delete1.png"/> |
163 | </span> | 162 | </span> |
164 | </td> | 163 | </td> |
165 | 164 | ||
166 | </template> | 165 | </template> |
167 | </v-data-table> | 166 | </v-data-table> |
168 | 167 | ||
169 | </v-card> | 168 | </v-card> |
170 | </v-flex> | 169 | </v-flex> |
171 | </v-container> | 170 | </v-container> |
172 | </template> | 171 | </template> |
173 | <script> | 172 | <script> |
174 | export default { | 173 | export default { |
175 | data: () => ({ | 174 | data: () => ({ |
176 | Name: '', | 175 | Name: '', |
177 | LName: '', | 176 | LName: '', |
178 | DOB: '', | 177 | DOB: '', |
179 | email: '', | 178 | email: '', |
180 | dialog: false, | 179 | dialog: false, |
181 | dialog1: false, | 180 | dialog1: false, |
182 | status: ['Pending', 'Approved', 'Declined'], | 181 | status: ['Pending', 'Approved', 'Declined'], |
183 | search: '', | 182 | search: '', |
184 | e1: '', | 183 | e1: '', |
185 | rules: { | 184 | rules: { |
186 | required: value => !!value || 'This field is Required.', | 185 | required: value => !!value || 'This field is Required.', |
187 | min: v => (/^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/).test(v) && v.length > 0 || 'Please enter a date in the format dd/mm/yyyy' | 186 | min: v => (/^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/).test(v) && v.length > 0 || 'Please enter a date in the format dd/mm/yyyy' |
188 | }, | 187 | }, |
189 | nameRules: [v => !!v || ' First Name is required'], | 188 | nameRules: [v => !!v || ' First Name is required'], |
190 | lnameRules: [v => !!v || ' First Name is required'], | 189 | lnameRules: [v => !!v || ' First Name is required'], |
191 | emailRules: [ | 190 | emailRules: [ |
192 | v => !!v || 'E-mail is required', | 191 | v => !!v || 'E-mail is required', |
193 | v => /.+@.+/.test(v) || 'E-mail must be valid' | 192 | v => /.+@.+/.test(v) || 'E-mail must be valid' |
194 | ], | 193 | ], |
195 | pagination: { | 194 | pagination: { |
196 | rowsPerPage: 10, | 195 | rowsPerPage: 10, |
197 | 196 | ||
198 | }, | 197 | }, |
199 | headers: [ | 198 | headers: [ |
200 | { | 199 | { |
201 | text: 'No', | 200 | text: 'No', |
202 | align: 'center', | 201 | align: 'center', |
203 | sortable: false, | 202 | sortable: false, |
204 | value: 'no' | 203 | value: 'no' |
205 | }, | 204 | }, |
206 | { text: 'Name', value: 'Name', sortable: false, align: 'center' }, | 205 | { text: 'Name', value: 'Name', sortable: false, align: 'center' }, |
207 | { text: 'Email', value: 'Email', sortable: false, align: 'center' }, | 206 | { text: 'Email', value: 'Email', sortable: false, align: 'center' }, |
208 | { text: 'Status', value: 'Status', sortable: false, align: 'center' }, | 207 | { text: 'Status', value: 'Status', sortable: false, align: 'center' }, |
209 | { text: '', value: '', sortable: false }, | 208 | { text: '', value: '', sortable: false }, |
210 | 209 | ||
211 | ], | 210 | ], |
212 | desserts: [], | 211 | desserts: [], |
213 | editedIndex: -1, | 212 | editedIndex: -1, |
214 | editedItem: { | 213 | editedItem: { |
215 | No: '', | 214 | No: '', |
216 | Name: '', | 215 | Name: '', |
217 | LName: '', | 216 | LName: '', |
218 | Email: '', | 217 | Email: '', |
219 | }, | 218 | }, |
220 | defaultItem: { | 219 | defaultItem: { |
221 | No: '', | 220 | No: '', |
222 | Name: '', | 221 | Name: '', |
223 | LName: '', | 222 | LName: '', |
224 | Email: '', | 223 | Email: '', |
225 | }, | 224 | }, |
226 | }), | 225 | }), |
227 | watch: { | 226 | watch: { |
228 | dialog (val) { | 227 | dialog (val) { |
229 | val || this.close(); | 228 | val || this.close(); |
230 | } | 229 | } |
231 | }, | 230 | }, |
232 | 231 | ||
233 | created () { | 232 | created () { |
234 | this.initialize(); | 233 | this.initialize(); |
235 | }, | 234 | }, |
236 | methods: { | 235 | methods: { |
237 | initialize () { | 236 | initialize () { |
238 | this.desserts = [ | 237 | this.desserts = [ |
239 | { | 238 | { |
240 | No: 1, | 239 | No: 1, |
241 | Name: 'Amit', | 240 | Name: 'Amit', |
242 | LName: 'goyal', | 241 | LName: 'goyal', |
243 | Email: 'jsi@gmail.com', | 242 | Email: 'jsi@gmail.com', |
244 | DOB: '22/09/1996' | 243 | DOB: '22/09/1996' |
245 | }, | 244 | }, |
246 | { | 245 | { |
247 | No: 2, | 246 | No: 2, |
248 | Name: 'Sumit', | 247 | Name: 'Sumit', |
249 | LName: 'kumar', | 248 | LName: 'kumar', |
250 | Email: 'aasi@gmail.com', | 249 | Email: 'aasi@gmail.com', |
251 | DOB: '16/09/1997' | 250 | DOB: '16/09/1997' |
252 | } | 251 | } |
253 | 252 | ||
254 | ]; | 253 | ]; |
255 | }, | 254 | }, |
256 | 255 | ||
257 | editItem (item) { | 256 | editItem (item) { |
258 | this.editedIndex = this.desserts.indexOf(item); | 257 | this.editedIndex = this.desserts.indexOf(item); |
259 | this.editedItem = Object.assign({}, item); | 258 | this.editedItem = Object.assign({}, item); |
260 | this.dialog = true; | 259 | this.dialog = true; |
261 | }, | 260 | }, |
262 | profile (item) { | 261 | profile (item) { |
263 | this.editedIndex = this.desserts.indexOf(item); | 262 | this.editedIndex = this.desserts.indexOf(item); |
264 | this.editedItem = Object.assign({}, item); | 263 | this.editedItem = Object.assign({}, item); |
265 | this.dialog1 = true; | 264 | this.dialog1 = true; |
266 | }, | 265 | }, |
267 | 266 | ||
268 | deleteItem (item) { | 267 | deleteItem (item) { |
269 | const index = this.desserts.indexOf(item); | 268 | const index = this.desserts.indexOf(item); |
270 | confirm('Are you sure you want to delete this item?') && | 269 | confirm('Are you sure you want to delete this item?') && |
271 | this.desserts.splice(index, 1); | 270 | this.desserts.splice(index, 1); |
272 | }, | 271 | }, |
273 | 272 | ||
274 | close () { | 273 | close () { |
275 | this.dialog = false; | 274 | this.dialog = false; |
276 | setTimeout(() => { | 275 | setTimeout(() => { |
277 | this.editedItem = Object.assign({}, this.defaultItem); | 276 | this.editedItem = Object.assign({}, this.defaultItem); |
278 | this.editedIndex = -1; | 277 | this.editedIndex = -1; |
279 | }, 300); | 278 | }, 300); |
280 | }, | 279 | }, |
281 | close1 () { | 280 | close1 () { |
282 | this.dialog1 = false; | 281 | this.dialog1 = false; |
283 | }, | 282 | }, |
284 | 283 | ||
285 | save () { | 284 | save () { |
286 | console.log('editedItem', this.editedItem); | 285 | console.log('editedItem', this.editedItem); |
287 | if (this.editedIndex > -1) { | 286 | if (this.editedIndex > -1) { |
288 | Object.assign(this.desserts[this.editedIndex], this.editedItem); | 287 | Object.assign(this.desserts[this.editedIndex], this.editedItem); |
289 | } else { | 288 | } else { |
290 | this.desserts.push(this.editedItem); | 289 | this.desserts.push(this.editedItem); |
291 | } | 290 | } |
292 | this.close(); | 291 | this.close(); |
293 | } | 292 | } |
294 | }, | 293 | }, |
295 | }; | 294 | }; |
296 | </script> | 295 | </script> |
297 | <style scoped> | 296 | <style scoped> |
298 | .v-card__actions .v-btn { | 297 | .v-card__actions .v-btn { |
299 | margin: 0px; | 298 | margin: 0px; |
300 | min-width: 120px; | 299 | min-width: 120px; |
301 | } | 300 | } |
302 | #td { | 301 | #td { |
303 | border: 1px solid #dddddd; | 302 | border: 1px solid #dddddd; |
304 | text-align: left; | 303 | text-align: left; |
305 | padding: 8px; | 304 | padding: 8px; |
306 | } | 305 | } |
307 | 306 | ||
308 | </style> | 307 | </style> |
src/pages/questions.vue
1 | <template> | 1 | <template> |
2 | <v-container grid-list-xl> | 2 | <v-container grid-list-xl> |
3 | <v-flex> | 3 | <v-flex> |
4 | <v-card> | 4 | <v-card> |
5 | <v-toolbar flat color="white"> | 5 | <v-toolbar flat color="white"> |
6 | <v-card-title> | 6 | <v-card-title> |
7 | <h3 style="position:relative; left:px; top:-5px;"><b>Forum Questions</b></h3> | 7 | <h3 style="position:relative; left:px; top:-5px;"><b>Forum Questions</b></h3> |
8 | <h5 style="position:relative; left:40px; top:-15px;">Select Category</h5> | 8 | <h5 style="position:relative; left:40px; top:-15px;">Select Category</h5> |
9 | <span style="position:relative; left:-95px; top:10px;"> | 9 | <span style="position:relative; left:-95px; top:10px;"> |
10 | <v-btn color="grey darken-2" flat>Suggestion</v-btn> | ||
11 | <v-btn color="grey darken-2" flat>Sex</v-btn> | ||
12 | <v-btn color="grey darken-2" flat>Health</v-btn> | ||
13 | <v-btn color="grey darken-2" flat>Skin & Beauty</v-btn> | ||
14 | <v-btn color="grey darken-2" flat>Diet & Ex</v-btn> | ||
15 | </span> | ||
16 | |||
17 | </v-card-title> | ||
18 | |||
19 | <v-spacer></v-spacer> | ||
20 | <v-dialog v-model="dialog" max-width="800px"> | ||
21 | |||
22 | <v-card> | ||
23 | <v-card-title> | ||
24 | <span class="headline">{{ formTitle }}</span> | ||
25 | <v-spacer></v-spacer> | ||
26 | <v-icon @click="close">close</v-icon> | ||
27 | </v-card-title> | ||
28 | <v-flex> | ||
29 | <v-card> | ||
30 | <v-card-text> | ||
31 | <span> | ||
32 | <p><b>Ana Suggestion:</b> Select Suggestion</p></span> | ||
33 | <h5>Select Category:</h5> | ||
34 | <span> | ||
35 | <v-btn color="grey darken-2" flat>Suggestion</v-btn> | ||
36 | <v-btn color="grey darken-2" flat>Sex</v-btn> | ||
37 | <v-btn color="grey darken-2" flat>Health</v-btn> | ||
38 | <v-btn color="grey darken-2" flat>Skin & Beauty</v-btn> | ||
39 | <v-btn color="grey darken-2" flat>Diet & Ex</v-btn> | ||
40 | </span> | ||
41 | </v-card-text> | ||
42 | </v-card> | ||
43 | </v-flex> | ||
44 | <v-card-text> | ||
45 | |||
46 | <v-container grid-list-md> | ||
47 | <v-layout wrap> | ||
48 | <v-flex xs12 sm6 md12> | ||
49 | <v-textarea | ||
50 | solo | ||
51 | v-model="AddQuestioncredentials.question" | ||
52 | name="input-7-4" | ||
53 | label="Type Question" | ||
54 | ></v-textarea> | ||
55 | </v-flex> | ||
56 | </v-layout> | ||
57 | </v-container> | ||
58 | </v-card-text> | ||
59 | 10 | ||
60 | <v-card-actions> | 11 | <v-btn color="grey darken-2" v-on:click="component='suggestion' , activebtn('existing')" v-bind:class="{ activebtn: isActivebtn }" flat>Suggestion</v-btn> |
61 | <v-spacer></v-spacer> | 12 | |
62 | <v-btn dark large @click.native="save">Post Question</v-btn> | 13 | <v-btn color="grey darken-2" v-on:click="component='sex' , activebtn('new')" v-bind:class="{ activebtn: Activebtn1 }" flat>Sex</v-btn> |
63 | </v-card-actions> | ||
64 | </v-card> | ||
65 | </v-dialog> | ||
66 | 14 | ||
67 | 15 | <v-btn color="grey darken-2" v-on:click="component='health' , activebtn('new1')" v-bind:class="{ activebtn: Activebtn2 }" flat>Health</v-btn> | |
68 | |||
69 | <v-dialog v-model="dialog1" max-width="800px"> | ||
70 | <v-card> | ||
71 | <v-card-title> | ||
72 | <span class="headline">Edit Question</span> | ||
73 | <v-spacer></v-spacer> | ||
74 | <v-icon @click="close1">close</v-icon> | ||
75 | </v-card-title> | ||
76 | 16 | ||
77 | <v-card-text> | 17 | <v-btn color="grey darken-2" v-on:click="component='skin' , activebtn('new2')" v-bind:class="{ activebtn: Activebtn3 }" flat>Skin & Beauty</v-btn> |
78 | <v-layout wrap> | 18 | |
79 | <v-flex xs12 sm6 md12> | 19 | <v-btn color="grey darken-2" v-on:click="component='diet' , activebtn('new3')" v-bind:class="{ activebtn: Activebtn4 }" flat>Diet & Ex</v-btn> |
80 | <v-text-field outline v-model="editedItem.ques" label="Question"></v-text-field> | 20 | |
81 | </v-flex> | 21 | </span> |
82 | </v-layout> | 22 | </v-card-title> |
83 | <span><p> <b>Ana suggestion:</b> Abnormal Uterine Bleeding <br> | 23 | |
84 | Diagnosis 1,Diagnosis 2,Diagnosis 3 | ||
85 | <v-btn dark large @click.native="save1" style="position:absolute; top:163px; right:5px;">Save Edit</v-btn></p></span> | ||
86 | </v-card-text> | ||
87 | </v-card> | ||
88 | </v-dialog> | ||
89 | </v-toolbar> | 24 | </v-toolbar> |
90 | <v-data-table | 25 | <component v-bind:is="component"></component> |
91 | :headers="headers" | 26 | </v-card></v-flex> |
92 | :items="desserts" | ||
93 | class="elevation-1" | ||
94 | :pagination.sync="pagination" | ||
95 | > | ||
96 | <template slot="items" slot-scope="props"> | ||
97 | <tr v-if="props.index === 0"> | ||
98 | <td id="td"> </td> | ||
99 | <td> | ||
100 | <span style="cursor:pointer" @click="dialog=true"> <v-icon>add</v-icon>Add New Question</span> | ||
101 | </td> | ||
102 | <td id="td"> </td> | ||
103 | <td id="td"> </td> | ||
104 | </tr> | ||
105 | <tr> | ||
106 | <td id="td" class="text-xs-center">{{ props.item.no }}</td> | ||
107 | <td id="td">{{ props.item.ques }}</td> | ||
108 | <td id="td" class="text-xs-center">{{ props.item.res }}</td> | ||
109 | <td class="text-xs-center"> | ||
110 | <span> | ||
111 | <img style="cursor:pointer; height:18px; " class="mr-5" @click="editItem(props.item)" src="/static/icon/edit1.png"/> | ||
112 | <img style="cursor:pointer; height:20px; " class="mr-5" @click="deleteItem(props.item)" src="/static/icon/delete1.png"/> | ||
113 | </span> | ||
114 | </td> | ||
115 | </tr> | ||
116 | </template> | ||
117 | </v-data-table> | ||
118 | </v-card> | ||
119 | </v-flex> | ||
120 | 27 | ||
121 | </v-container> | 28 | </v-container> |
122 | </template> | 29 | </template> |
123 | <script> | 30 | <script> |
31 | import suggestion from '@/components/questions/suggestion.vue'; | ||
32 | import sex from '@/components/questions/sex.vue'; | ||
33 | import health from '@/components/questions/health.vue'; | ||
34 | import skin from '@/components/questions/skin.vue'; | ||
35 | import diet from '@/components/questions/diet.vue'; | ||
124 | export default { | 36 | export default { |
37 | components: { | ||
38 | 'suggestion': suggestion, | ||
39 | 'sex': sex, | ||
40 | 'health': health, | ||
41 | 'skin': skin, | ||
42 | 'diet': diet, | ||
43 | }, | ||
125 | data: () => ({ | 44 | data: () => ({ |
126 | question: '', | 45 | component: 'suggestion', |
127 | AddQuestioncredentials: {}, | 46 | isActivebtn: true, |
128 | dialog: false, | 47 | Activebtn1: false, |
129 | dialog1: false, | 48 | Activebtn2: false, |
130 | isActive: true, | 49 | Activebtn3: false, |
131 | newActive: false, | 50 | Activebtn4: false, |
132 | pagination: { | ||
133 | rowsPerPage: 10, | ||
134 | }, | ||
135 | headers: [ | ||
136 | { | ||
137 | text: 'No.', | ||
138 | align: 'center', | ||
139 | sortable: false, | ||
140 | value: 'name' | ||
141 | }, | ||
142 | { text: 'Posts', value: 'posts', sortable: false, align: 'center' }, | ||
143 | { text: 'Responses', value: 'responses', sortable: false, align: 'center' }, | ||
144 | { text: '', value: 'carbs', sortable: false, align: 'center' }, | ||
145 | ], | ||
146 | desserts: [], | ||
147 | editedIndex: -1, | ||
148 | editedItem: { | ||
149 | question: '', | ||
150 | |||
151 | }, | ||
152 | defaultItem: { | ||
153 | no: 0, | ||
154 | question: '', | ||
155 | res: 0, | ||
156 | |||
157 | } | ||
158 | }), | 51 | }), |
159 | |||
160 | computed: { | ||
161 | formTitle () { | ||
162 | return this.editedIndex === -1 ? 'Create New Question' : 'Edit Question'; | ||
163 | } | ||
164 | }, | ||
165 | |||
166 | watch: { | ||
167 | dialog (val) { | ||
168 | val || this.close(); | ||
169 | } | ||
170 | }, | ||
171 | |||
172 | created () { | ||
173 | this.initialize(); | ||
174 | }, | ||
175 | |||
176 | methods: { | 52 | methods: { |
177 | initialize () { | 53 | activebtn (type) { |
178 | this.desserts = [ | 54 | switch (type) { |
179 | { | 55 | case 'existing': |
180 | no: '1', | 56 | this.Activebtn4 = false; |
181 | ques: 'questions', | 57 | this.Activebtn3 = false; |
182 | res: 9.0, | 58 | this.Activebtn2 = false; |
183 | }, | 59 | this.Activebtn1 = false; |
184 | ]; | 60 | this.isActivebtn = true; |
185 | }, | 61 | break; |
186 | 62 | case 'new': | |
187 | editItem (item) { | 63 | this.Activebtn4 = false; |
188 | this.editedIndex = this.desserts.indexOf(item); | 64 | this.Activebtn3 = false; |
189 | this.editedItem = Object.assign({}, item); | 65 | this.Activebtn2 = false; |
190 | this.dialog1 = true; | 66 | this.Activebtn1 = true; |
191 | }, | 67 | this.isActivebtn = false; |
192 | 68 | break; | |
193 | deleteItem (item) { | 69 | case 'new1': |
194 | const index = this.desserts.indexOf(item); | 70 | this.Activebtn4 = false; |
195 | confirm('Are you sure you want to delete this item?') && this.desserts.splice(index, 1); | 71 | this.Activebtn3 = false; |
196 | }, | 72 | this.Activebtn2 = true; |
197 | 73 | this.Activebtn1 = false; | |
198 | close () { | 74 | this.isActivebtn = false; |
199 | this.dialog = false; | 75 | break; |
200 | setTimeout(() => { | 76 | case 'new2': |
201 | this.editedItem = Object.assign({}, this.defaultItem); | 77 | this.Activebtn4 = false; |
202 | this.editedIndex = -1; | 78 | this.Activebtn3 = true; |
203 | }, 300); | 79 | this.Activebtn2 = false; |
204 | }, | 80 | this.Activebtn1 = false; |
205 | close1 () { | 81 | this.isActivebtn = false; |
206 | this.dialog1 = false; | 82 | break; |
207 | setTimeout(() => { | 83 | default: |
208 | this.editedItem = Object.assign({}, this.defaultItem); | 84 | this.Activebtn4 = true; |
209 | this.editedIndex = -1; | 85 | this.Activebtn3 = false; |
210 | }, 300); | 86 | this.Activebtn2 = false; |
211 | }, | 87 | this.Activebtn1 = false; |
212 | save () { | 88 | this.isActivebtn = false; |
213 | console.log('editedItem', this.editedItem); | 89 | break; |
214 | if (this.editedIndex > -1) { | ||
215 | Object.assign(this.desserts[this.editedIndex], this.editedItem); | ||
216 | } else { | ||
217 | this.desserts.push(this.editedItem); | ||
218 | } | 90 | } |
219 | this.close(); | ||
220 | }, | 91 | }, |
221 | save1 () { | 92 | } |
222 | console.log('editedItem', this.editedItem); | ||
223 | if (this.editedIndex > -1) { | ||
224 | Object.assign(this.desserts[this.editedIndex], this.editedItem); | ||
225 | } else { | ||
226 | this.desserts.push(this.editedItem); | ||
227 | } | ||
228 | this.close1(); | ||
229 | } | ||
230 | }, | ||
231 | // switchComponent (comp) { | ||
232 | // this.$emit('switchComp', comp); |