Blame view

src/components/questions/diet.vue 13.8 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
6
        <v-spacer></v-spacer>
        <v-dialog v-model="dialog" max-width="800px">
c17e4f0cd   Jatinder Singh   question changes
7
8
          <v-card>
            <v-card-title>
2a4dbc6e3   Neeraj Sharma   fix panel
9
10
              <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
11
12
13
14
15
16
              <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...
17
18
                  <span>
                    <p>
2a4dbc6e3   Neeraj Sharma   fix panel
19
20
                      <b>Ana Suggestion:</b>
                      Select Suggestion
a95d2830c   Neeraj Sharma   add country selec...
21
22
23
                    </p>
                  </span>
                  <h5>Select Category:</h5>
2a4dbc6e3   Neeraj Sharma   fix panel
24
25
26
27
28
29
30
31
32
33
34
                  <!-- <span>
                    <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>
                  </span>-->
                </v-card-text>
                <v-tabs color="white" show-arrows>
                  <v-tabs-slider color="black"></v-tabs-slider>
                  <v-tab>
a95d2830c   Neeraj Sharma   add country selec...
35
                    <v-btn color="grey darken-2" flat>Suggestion</v-btn>
2a4dbc6e3   Neeraj Sharma   fix panel
36
37
38
                  </v-tab>
                  <v-tab>
                    <v-btn color="grey darken-2" flat>Sex</v-btn>
afd329a86   Neeraj Sharma   add answer table ...
39
40
                  </v-tab>
                  <v-tab>
a95d2830c   Neeraj Sharma   add country selec...
41
                    <v-btn color="grey darken-2" flat>Health</v-btn>
afd329a86   Neeraj Sharma   add answer table ...
42
43
                  </v-tab>
                  <v-tab>
a95d2830c   Neeraj Sharma   add country selec...
44
                    <v-btn color="grey darken-2" flat>Skin & Beauty</v-btn>
afd329a86   Neeraj Sharma   add answer table ...
45
                  </v-tab>
2a4dbc6e3   Neeraj Sharma   fix panel
46
                  <v-tab>
a95d2830c   Neeraj Sharma   add country selec...
47
                    <v-btn color="grey darken-2" flat>Diet & Ex</v-btn>
afd329a86   Neeraj Sharma   add answer table ...
48
                  </v-tab>
2a4dbc6e3   Neeraj Sharma   fix panel
49
                </v-tabs>
a95d2830c   Neeraj Sharma   add country selec...
50
              </v-card>
c17e4f0cd   Jatinder Singh   question changes
51
52
            </v-flex>
            <v-card-text>
a95d2830c   Neeraj Sharma   add country selec...
53
54
55
56
57
58
59
60
61
62
              <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
63
64
65
                </v-layout>
              </v-container>
            </v-card-text>
c17e4f0cd   Jatinder Singh   question changes
66
            <v-card-actions>
a95d2830c   Neeraj Sharma   add country selec...
67
68
              <v-spacer></v-spacer>
              <v-btn dark large @click.native="save">Post Question</v-btn>
c17e4f0cd   Jatinder Singh   question changes
69
            </v-card-actions>
a95d2830c   Neeraj Sharma   add country selec...
70
71
          </v-card>
        </v-dialog>
2a4dbc6e3   Neeraj Sharma   fix panel
72
73
74
        <!-- Edit Question Dialog see answer -->
        <v-dialog v-model="dialog1" max-width="900px">
          <v-card height="700px">
a95d2830c   Neeraj Sharma   add country selec...
75
76
77
78
79
            <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...
80
81
            <v-card-text>
              <v-layout wrap>
2a4dbc6e3   Neeraj Sharma   fix panel
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
135
                <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
136
137
                </v-flex>
              </v-layout>
c17e4f0cd   Jatinder Singh   question changes
138
            </v-card-text>
a95d2830c   Neeraj Sharma   add country selec...
139
140
          </v-card>
        </v-dialog>
2a4dbc6e3   Neeraj Sharma   fix panel
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
        <!-- Forum Questions data-table -->
        <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>
                <td class="pa-4">
                  <span style="cursor:pointer" @click="dialog=true">
                    <v-icon class="outlined mb-2" medium>add_box</v-icon><span class="subheading"> Add New Question </span>
                  </span>
                </td>
                <td id="td">&nbsp;</td>
                <td id="td">&nbsp;</td>
              </tr>
              <tr>
                <td id="td" class="text-xs-center pa-4">{{ props.item.no }}</td>
                <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>
a95d2830c   Neeraj Sharma   add country selec...
184
      </v-card>
c17e4f0cd   Jatinder Singh   question changes
185
    </v-flex>
c17e4f0cd   Jatinder Singh   question changes
186
187
188
189
  </template>
  <script>
  export default {
    data: () => ({
a95d2830c   Neeraj Sharma   add country selec...
190
      question: "",
c17e4f0cd   Jatinder Singh   question changes
191
192
193
194
195
196
      AddQuestioncredentials: {},
      dialog: false,
      dialog1: false,
      isActive: true,
      newActive: false,
      pagination: {
a95d2830c   Neeraj Sharma   add country selec...
197
        rowsPerPage: 10
c17e4f0cd   Jatinder Singh   question changes
198
      },
2a4dbc6e3   Neeraj Sharma   fix panel
199
      getQuestion: [],
c17e4f0cd   Jatinder Singh   question changes
200
201
      headers: [
        {
a95d2830c   Neeraj Sharma   add country selec...
202
203
204
205
206
207
208
209
210
          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
211
          sortable: false,
a95d2830c   Neeraj Sharma   add country selec...
212
          align: "center"
c17e4f0cd   Jatinder Singh   question changes
213
        },
a95d2830c   Neeraj Sharma   add country selec...
214
        { text: "", value: "carbs", sortable: false, align: "center" }
c17e4f0cd   Jatinder Singh   question changes
215
216
217
218
      ],
      desserts: [],
      editedIndex: -1,
      editedItem: {
2a4dbc6e3   Neeraj Sharma   fix panel
219
220
        question: "",
        name: ''
c17e4f0cd   Jatinder Singh   question changes
221
222
223
      },
      defaultItem: {
        no: 0,
2a4dbc6e3   Neeraj Sharma   fix panel
224
        name: '',
a95d2830c   Neeraj Sharma   add country selec...
225
226
        question: "",
        res: 0
c17e4f0cd   Jatinder Singh   question changes
227
228
229
230
      }
    }),
  
    computed: {
a95d2830c   Neeraj Sharma   add country selec...
231
232
      formTitle() {
        return this.editedIndex === -1 ? "Create New Question" : "Edit Question";
c17e4f0cd   Jatinder Singh   question changes
233
234
235
236
      }
    },
  
    watch: {
a95d2830c   Neeraj Sharma   add country selec...
237
      dialog(val) {
c17e4f0cd   Jatinder Singh   question changes
238
239
240
        val || this.close();
      }
    },
a95d2830c   Neeraj Sharma   add country selec...
241
    created() {
c17e4f0cd   Jatinder Singh   question changes
242
      this.initialize();
2a4dbc6e3   Neeraj Sharma   fix panel
243
      this.initializeData()
c17e4f0cd   Jatinder Singh   question changes
244
245
246
    },
  
    methods: {
a95d2830c   Neeraj Sharma   add country selec...
247
      initialize() {
c17e4f0cd   Jatinder Singh   question changes
248
249
        this.desserts = [
          {
a95d2830c   Neeraj Sharma   add country selec...
250
            no: "1",
2a4dbc6e3   Neeraj Sharma   fix panel
251
252
            ques: "questions Diet &Ex",
            res: 21
a95d2830c   Neeraj Sharma   add country selec...
253
          }
c17e4f0cd   Jatinder Singh   question changes
254
        ];
a95d2830c   Neeraj Sharma   add country selec...
255
      },
2a4dbc6e3   Neeraj Sharma   fix panel
256
257
258
259
260
261
262
263
264
      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.'
c17e4f0cd   Jatinder Singh   question changes
265

2a4dbc6e3   Neeraj Sharma   fix panel
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
          },
          {
            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.'          
          },
          {
            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...
318
      editItem(item) {
c17e4f0cd   Jatinder Singh   question changes
319
320
321
322
        this.editedIndex = this.desserts.indexOf(item);
        this.editedItem = Object.assign({}, item);
        this.dialog1 = true;
      },
a95d2830c   Neeraj Sharma   add country selec...
323
      deleteItem(item) {
c17e4f0cd   Jatinder Singh   question changes
324
        const index = this.desserts.indexOf(item);
a95d2830c   Neeraj Sharma   add country selec...
325
326
        confirm("Are you sure you want to delete this item?") &&
          this.desserts.splice(index, 1);
c17e4f0cd   Jatinder Singh   question changes
327
      },
a95d2830c   Neeraj Sharma   add country selec...
328
      close() {
c17e4f0cd   Jatinder Singh   question changes
329
330
331
332
333
334
        this.dialog = false;
        setTimeout(() => {
          this.editedItem = Object.assign({}, this.defaultItem);
          this.editedIndex = -1;
        }, 300);
      },
a95d2830c   Neeraj Sharma   add country selec...
335
      close1() {
c17e4f0cd   Jatinder Singh   question changes
336
337
338
339
340
341
        this.dialog1 = false;
        setTimeout(() => {
          this.editedItem = Object.assign({}, this.defaultItem);
          this.editedIndex = -1;
        }, 300);
      },
a95d2830c   Neeraj Sharma   add country selec...
342
343
      save() {
        console.log("editedItem", this.editedItem);
c17e4f0cd   Jatinder Singh   question changes
344
345
346
347
348
349
350
        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...
351
352
      save1() {
        console.log("editedItem", this.editedItem);
c17e4f0cd   Jatinder Singh   question changes
353
354
355
356
357
358
359
        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...
360
    }
c17e4f0cd   Jatinder Singh   question changes
361
362
363
364
365
366
    // switchComponent (comp) {
    //   this.$emit('switchComp', comp);
    // }
  };
  </script>
  <style>
a95d2830c   Neeraj Sharma   add country selec...
367
368
369
370
  #td {
    border: 1px solid #dddddd;
    text-align: left;
    padding: 8px;
c17e4f0cd   Jatinder Singh   question changes
371
  }
2a4dbc6e3   Neeraj Sharma   fix panel
372
373
374
375
376
377
  .AnswerTable{
  height: 370px;overflow: auto;
  }
  .bottomAnswser{
  border-bottom:1px solid #aaa;
  }
c17e4f0cd   Jatinder Singh   question changes
378
  </style>