Blame view

src/components/questions/suggestion.vue 14.3 KB
c17e4f0cd   Jatinder Singh   question changes
1
  <template>
2a4dbc6e3   Neeraj Sharma   fix panel
2
  <!-- Add Question dialog  -->
a95d2830c   Neeraj Sharma   add country selec...
3
4
    <v-flex>
      <v-card>
c17e4f0cd   Jatinder Singh   question changes
5
        <v-dialog v-model="dialog" max-width="800px">
c17e4f0cd   Jatinder Singh   question changes
6
7
          <v-card>
            <v-card-title>
afd329a86   Neeraj Sharma   add answer table ...
8
9
              <span class="headline hidden-xs-only hidden-md-only hidden-sm-only">{{ formTitle }}</span>
              <h4 class="hidden-lg-only">{{ formTitle }}</h4>
c17e4f0cd   Jatinder Singh   question changes
10
11
12
13
14
15
              <v-spacer></v-spacer>
              <v-icon @click="close">close</v-icon>
            </v-card-title>
            <v-flex>
              <v-card>
                <v-card-text>
a95d2830c   Neeraj Sharma   add country selec...
16
17
                  <span>
                    <p>
afd329a86   Neeraj Sharma   add answer table ...
18
19
                      <b>Ana Suggestion:</b>
                      Select Suggestion
a95d2830c   Neeraj Sharma   add country selec...
20
21
22
                    </p>
                  </span>
                  <h5>Select Category:</h5>
afd329a86   Neeraj Sharma   add answer table ...
23
                  <!-- <span>
a95d2830c   Neeraj Sharma   add country selec...
24
25
26
27
28
                    <v-btn color="grey darken-2" flat>Suggestion</v-btn>
                    <v-btn color="grey darken-2" flat>Sex</v-btn>
                    <v-btn color="grey darken-2" flat>Health</v-btn>
                    <v-btn color="grey darken-2" flat>Skin & Beauty</v-btn>
                    <v-btn color="grey darken-2" flat>Diet & Ex</v-btn>
afd329a86   Neeraj Sharma   add answer table ...
29
                  </span>-->
c17e4f0cd   Jatinder Singh   question changes
30
                </v-card-text>
afd329a86   Neeraj Sharma   add answer table ...
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
                <v-tabs color="white" show-arrows>
                  <v-tabs-slider color="black"></v-tabs-slider>
                  <v-tab>
                    <v-btn color="grey darken-2" flat>Suggestion</v-btn>
                  </v-tab>
                  <v-tab>
                    <v-btn color="grey darken-2" flat>Sex</v-btn>
                  </v-tab>
                  <v-tab>
                    <v-btn color="grey darken-2" flat>Health</v-btn>
                  </v-tab>
                  <v-tab>
                    <v-btn color="grey darken-2" flat>Skin & Beauty</v-btn>
                  </v-tab>
                  <v-tab>
                    <v-btn color="grey darken-2" flat>Diet & Ex</v-btn>
                  </v-tab>
                </v-tabs>
a95d2830c   Neeraj Sharma   add country selec...
49
              </v-card>
c17e4f0cd   Jatinder Singh   question changes
50
51
            </v-flex>
            <v-card-text>
a95d2830c   Neeraj Sharma   add country selec...
52
53
54
55
56
57
58
59
60
61
              <v-container grid-list-md>
                <v-layout wrap>
                  <v-flex xs12 sm6 md12>
                    <v-textarea
                      solo
                      v-model="AddQuestioncredentials.question"
                      name="input-7-4"
                      label="Type Question"
                    ></v-textarea>
                  </v-flex>
c17e4f0cd   Jatinder Singh   question changes
62
63
64
                </v-layout>
              </v-container>
            </v-card-text>
c17e4f0cd   Jatinder Singh   question changes
65
            <v-card-actions>
a95d2830c   Neeraj Sharma   add country selec...
66
67
              <v-spacer></v-spacer>
              <v-btn dark large @click.native="save">Post Question</v-btn>
c17e4f0cd   Jatinder Singh   question changes
68
            </v-card-actions>
a95d2830c   Neeraj Sharma   add country selec...
69
70
          </v-card>
        </v-dialog>
2a4dbc6e3   Neeraj Sharma   fix panel
71
        <!-- Edit Question Dialog see answer -->
afd329a86   Neeraj Sharma   add answer table ...
72
73
        <v-dialog v-model="dialog1" max-width="900px">
          <v-card height="700px">
a95d2830c   Neeraj Sharma   add country selec...
74
75
76
77
78
            <v-card-title>
              <span class="headline">Edit Question</span>
              <v-spacer></v-spacer>
              <v-icon @click="close1">close</v-icon>
            </v-card-title>
a95d2830c   Neeraj Sharma   add country selec...
79
80
            <v-card-text>
              <v-layout wrap>
afd329a86   Neeraj Sharma   add answer table ...
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
                <v-flex xs12>
                  <v-textarea
                    solo
                    v-model="editedItem.question"
                    name="input-7-4"
                    label="Question"
                    value="The Woodman set to work at once, and so sharp was his axe that the tree was soon chopped nearly through."
                  ></v-textarea>
                </v-flex>
              </v-layout>
              <v-layout class="mt-4">
                <v-flex xs12 sm6>
                  <h5>
                    <span class="title">Ana suggestion:</span> Abnormal Uterine Bleeding
                  </h5>
                  <h5
                    class="subheading hidden-xs-only hidden-md-only hidden-sm-only"
                  >Diagnosis 1,Diagnosis 2,Diagnosis 3</h5>
                  <p class="hidden-lg-only">Diagnosis 1,Diagnosis 2,Diagnosis 3</p>
                </v-flex>
                <v-flex sm6 class="hidden-xs-only hidden-md-only hidden-sm-only">
                  <v-btn dark large class="right" @click.native="save1">Save Edit</v-btn>
                </v-flex>
              </v-layout>
              <v-layout>
                <v-flex xs12 class="hidden-lg-only">
                  <v-btn dark small @click.native="save1">Save Edit</v-btn>
                </v-flex>
              </v-layout>
              <v-layout class="mt-3 AnswerTable">
                <v-flex xs12>
                  <div>
                    <v-data-table :items="getQuestion" class="elevation-1" hide-actions hide-headers>
                      <template slot="items" slot-scope="props">
                        <v-layout>
                          <v-flex xs9 class="bottomAnswser">
                            <td class="pa-3">
                              <span class="subheading text--black font-weight-bold">{{ props.item.name }}</span>
                              <br>
                              {{ props.item.calories }}
                            </td>
                          </v-flex>
                          <v-flex xs3  class="bottomAnswser">
                            <td class="justify-center layout px -0 mt-4">
                              <v-icon medium @click="deleteAnswer(props.item)">delete</v-icon>
                            </td>
                          </v-flex>
                        </v-layout>
                      </template>
                      <template slot="no-data">
                        <v-btn color="primary" @click="initializeData">Reset</v-btn>
                      </template>
                    </v-data-table>
                  </div>
c17e4f0cd   Jatinder Singh   question changes
135
136
                </v-flex>
              </v-layout>
c17e4f0cd   Jatinder Singh   question changes
137
            </v-card-text>
a95d2830c   Neeraj Sharma   add country selec...
138
139
          </v-card>
        </v-dialog>
2a4dbc6e3   Neeraj Sharma   fix panel
140
        <!-- Forum Questions data-table -->
a95d2830c   Neeraj Sharma   add country selec...
141
142
143
144
145
146
147
148
149
150
        <v-card>
          <v-data-table
            :headers="headers"
            :items="desserts"
            class="elevation-1"
            :pagination.sync="pagination"
          >
            <template slot="items" slot-scope="props">
              <tr v-if="props.index === 0">
                <td id="td">&nbsp;</td>
afd329a86   Neeraj Sharma   add answer table ...
151
                <td class="pa-4">
a95d2830c   Neeraj Sharma   add country selec...
152
                  <span style="cursor:pointer" @click="dialog=true">
2a4dbc6e3   Neeraj Sharma   fix panel
153
                    <v-icon class="outlined mb-2" medium>add_box</v-icon><span class="subheading"> Add New Question </span>
a95d2830c   Neeraj Sharma   add country selec...
154
155
156
157
158
159
                  </span>
                </td>
                <td id="td">&nbsp;</td>
                <td id="td">&nbsp;</td>
              </tr>
              <tr>
afd329a86   Neeraj Sharma   add answer table ...
160
                <td id="td" class="text-xs-center pa-4">{{ props.item.no }}</td>
a95d2830c   Neeraj Sharma   add country selec...
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
                <td id="td">{{ props.item.ques }}</td>
                <td id="td" class="text-xs-center">{{ props.item.res }}</td>
                <td class="text-xs-center">
                  <span>
                    <img
                      style="cursor:pointer; height:18px; "
                      class="mr-5"
                      @click="editItem(props.item)"
                      src="/static/icon/edit1.png"
                    >
                    <img
                      style="cursor:pointer; height:20px; "
                      class="mr-5"
                      @click="deleteItem(props.item)"
                      src="/static/icon/delete1.png"
                    >
                  </span>
                </td>
              </tr>
            </template>
          </v-data-table>
        </v-card>
      </v-card>
c17e4f0cd   Jatinder Singh   question changes
184
    </v-flex>
c17e4f0cd   Jatinder Singh   question changes
185
186
187
188
  </template>
  <script>
  export default {
    data: () => ({
a95d2830c   Neeraj Sharma   add country selec...
189
      question: "",
c17e4f0cd   Jatinder Singh   question changes
190
191
192
193
194
195
      AddQuestioncredentials: {},
      dialog: false,
      dialog1: false,
      isActive: true,
      newActive: false,
      pagination: {
a95d2830c   Neeraj Sharma   add country selec...
196
        rowsPerPage: 10
c17e4f0cd   Jatinder Singh   question changes
197
      },
afd329a86   Neeraj Sharma   add answer table ...
198
      getQuestion: [],
c17e4f0cd   Jatinder Singh   question changes
199
200
      headers: [
        {
a95d2830c   Neeraj Sharma   add country selec...
201
202
203
204
205
206
207
208
209
          text: "No.",
          align: "center",
          sortable: false,
          value: "name"
        },
        { text: "Posts", value: "posts", sortable: false, align: "center" },
        {
          text: "Responses",
          value: "responses",
c17e4f0cd   Jatinder Singh   question changes
210
          sortable: false,
a95d2830c   Neeraj Sharma   add country selec...
211
          align: "center"
c17e4f0cd   Jatinder Singh   question changes
212
        },
a95d2830c   Neeraj Sharma   add country selec...
213
        { text: "", value: "carbs", sortable: false, align: "center" }
c17e4f0cd   Jatinder Singh   question changes
214
215
216
217
      ],
      desserts: [],
      editedIndex: -1,
      editedItem: {
afd329a86   Neeraj Sharma   add answer table ...
218
219
        question: "",
        name: ''
c17e4f0cd   Jatinder Singh   question changes
220
221
222
      },
      defaultItem: {
        no: 0,
afd329a86   Neeraj Sharma   add answer table ...
223
        name: '',
a95d2830c   Neeraj Sharma   add country selec...
224
225
        question: "",
        res: 0
c17e4f0cd   Jatinder Singh   question changes
226
227
228
229
      }
    }),
  
    computed: {
a95d2830c   Neeraj Sharma   add country selec...
230
231
      formTitle() {
        return this.editedIndex === -1 ? "Create New Question" : "Edit Question";
c17e4f0cd   Jatinder Singh   question changes
232
233
234
235
      }
    },
  
    watch: {
a95d2830c   Neeraj Sharma   add country selec...
236
      dialog(val) {
c17e4f0cd   Jatinder Singh   question changes
237
238
239
        val || this.close();
      }
    },
a95d2830c   Neeraj Sharma   add country selec...
240
    created() {
c17e4f0cd   Jatinder Singh   question changes
241
      this.initialize();
afd329a86   Neeraj Sharma   add answer table ...
242
      this.initializeData()
c17e4f0cd   Jatinder Singh   question changes
243
244
245
    },
  
    methods: {
a95d2830c   Neeraj Sharma   add country selec...
246
      initialize() {
c17e4f0cd   Jatinder Singh   question changes
247
248
        this.desserts = [
          {
a95d2830c   Neeraj Sharma   add country selec...
249
            no: "1",
afd329a86   Neeraj Sharma   add answer table ...
250
            ques: "questions suggestion ",
a95d2830c   Neeraj Sharma   add country selec...
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
            res: 21
          },
          {
            no: "1",
            ques: "questions",
            res: 21
          },
          {
            no: "1",
            ques: " suggestion",
            res: 21
          },
          {
            no: "1",
            ques: "questions",
            res: 21
c17e4f0cd   Jatinder Singh   question changes
267
          },
a95d2830c   Neeraj Sharma   add country selec...
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
          {
            no: "1",
            ques: "questions suggestion",
            res: 21
          },
          {
            no: "1",
            ques: "suggestion",
            res: 21
          },
          {
            no: "1",
            ques: "questions suggestion",
            res: 21
          }
c17e4f0cd   Jatinder Singh   question changes
283
        ];
a95d2830c   Neeraj Sharma   add country selec...
284
      },
afd329a86   Neeraj Sharma   add answer table ...
285
286
287
288
289
290
291
292
293
294
295
296
297
298
      initializeData () {
        this.getQuestion = [
          {
            name: 'Frozen Yogurt',
            calories: 'You can apply the hide-headers and hide-actions props to remove the default               header and footer respectively.You can apply the hide-headers and hide-actions props              to remove the default header and footer respectively.'
          },
          {
            name: 'Zogurt',
            calories: 'You can apply the hide-headers and hide-actions props to remove the default               header and footer respectively.You can apply the hide-headers and hide-actions props              to remove the default header and footer respectively.'
  
          },
          {
            name: 'Frozen Yogurt',
            calories: 'You can apply the hide-headers and hide-actions props to remove the default               header and footer respectively.You can apply the hide-headers and hide-actions props              to remove the default header and footer respectively.'
c17e4f0cd   Jatinder Singh   question changes
299

afd329a86   Neeraj Sharma   add answer table ...
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
          },
          {
            name: 'Cupcake',
            calories: 'You can apply the hide-headers and hide-actions props to remove the default               header and footer respectively.You can apply the hide-headers and hide-actions props              to remove the default header and footer respectively.'
          },
          {
            name: 'Gingerbread',
            calories: 'You can apply the hide-headers and hide-actions props to remove the default               header and footer respectively.You can apply the hide-headers and hide-actions props              to remove the default header and footer respectively.'
        
          },
          {
            name: 'Jelly bean',
            calories: 'You can apply the hide-headers and hide-actions props to remove the default               header and footer respectively.You can apply the hide-headers and hide-actions props              to remove the default header and footer respectively.'          
          },
          {
            name: 'Frozen Yogurt',
            calories: 'You can apply the hide-headers and hide-actions props to remove the default               header and footer respectively.You can apply the hide-headers and hide-actions props              to remove the default header and footer respectively.'
          },
          {
            name: 'Zogurt',
            calories: 'You can apply the hide-headers and hide-actions props to remove the default               header and footer respectively.You can apply the hide-headers and hide-actions props              to remove the default header and footer respectively.'
  
          },
          {
            name: 'Frozen Yogurt',
            calories: 'You can apply the hide-headers and hide-actions props to remove the default               header and footer respectively.You can apply the hide-headers and hide-actions props              to remove the default header and footer respectively.'
  
          },
          {
            name: 'Cupcake',
            calories: 'You can apply the hide-headers and hide-actions props to remove the default               header and footer respectively.You can apply the hide-headers and hide-actions props              to remove the default header and footer respectively.'
          },
          {
            name: 'Gingerbread',
            calories: 'You can apply the hide-headers and hide-actions props to remove the default               header and footer respectively.You can apply the hide-headers and hide-actions props              to remove the default header and footer respectively.'
        
          },
          {
            name: 'Jelly bean',
            calories: 'You can apply the hide-headers and hide-actions props to remove the default               header and footer respectively.You can apply the hide-headers and hide-actions props              to remove the default header and footer respectively.'          
          },
        ]
      },
      deleteAnswer (item) {
        const index = this.getQuestion.indexOf(item)
        confirm('Are you sure you want to delete this item?') && this.getQuestion.splice(index, 1)
      },
a95d2830c   Neeraj Sharma   add country selec...
347
      editItem(item) {
c17e4f0cd   Jatinder Singh   question changes
348
349
350
351
        this.editedIndex = this.desserts.indexOf(item);
        this.editedItem = Object.assign({}, item);
        this.dialog1 = true;
      },
a95d2830c   Neeraj Sharma   add country selec...
352
      deleteItem(item) {
c17e4f0cd   Jatinder Singh   question changes
353
        const index = this.desserts.indexOf(item);
a95d2830c   Neeraj Sharma   add country selec...
354
355
        confirm("Are you sure you want to delete this item?") &&
          this.desserts.splice(index, 1);
c17e4f0cd   Jatinder Singh   question changes
356
      },
a95d2830c   Neeraj Sharma   add country selec...
357
      close() {
c17e4f0cd   Jatinder Singh   question changes
358
359
360
361
362
363
        this.dialog = false;
        setTimeout(() => {
          this.editedItem = Object.assign({}, this.defaultItem);
          this.editedIndex = -1;
        }, 300);
      },
a95d2830c   Neeraj Sharma   add country selec...
364
      close1() {
c17e4f0cd   Jatinder Singh   question changes
365
366
367
368
369
370
        this.dialog1 = false;
        setTimeout(() => {
          this.editedItem = Object.assign({}, this.defaultItem);
          this.editedIndex = -1;
        }, 300);
      },
a95d2830c   Neeraj Sharma   add country selec...
371
372
      save() {
        console.log("editedItem", this.editedItem);
c17e4f0cd   Jatinder Singh   question changes
373
374
375
376
377
378
379
        if (this.editedIndex > -1) {
          Object.assign(this.desserts[this.editedIndex], this.editedItem);
        } else {
          this.desserts.push(this.editedItem);
        }
        this.close();
      },
a95d2830c   Neeraj Sharma   add country selec...
380
381
      save1() {
        console.log("editedItem", this.editedItem);
c17e4f0cd   Jatinder Singh   question changes
382
383
384
385
386
387
388
        if (this.editedIndex > -1) {
          Object.assign(this.desserts[this.editedIndex], this.editedItem);
        } else {
          this.desserts.push(this.editedItem);
        }
        this.close1();
      }
a95d2830c   Neeraj Sharma   add country selec...
389
    }
c17e4f0cd   Jatinder Singh   question changes
390
391
392
393
394
395
    // switchComponent (comp) {
    //   this.$emit('switchComp', comp);
    // }
  };
  </script>
  <style>
a95d2830c   Neeraj Sharma   add country selec...
396
397
398
399
  #td {
    border: 1px solid #dddddd;
    text-align: left;
    padding: 8px;
c17e4f0cd   Jatinder Singh   question changes
400
  }
afd329a86   Neeraj Sharma   add answer table ...
401
402
403
404
405
406
  .AnswerTable{
  height: 370px;overflow: auto;
  }
  .bottomAnswser{
  border-bottom:1px solid #aaa;
  }
c17e4f0cd   Jatinder Singh   question changes
407
  </style>