Blame view

src/components/questions/skin.vue 13.8 KB
c17e4f0cd   Jatinder Singh   question changes
1
  <template>
2a4dbc6e3   Neeraj Sharma   fix panel
2
3
4
  <!-- Add Question dialog  -->
    <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>
2a4dbc6e3   Neeraj Sharma   fix panel
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
                  <span>
                    <p>
                      <b>Ana Suggestion:</b>
                      Select Suggestion
                    </p>
                  </span>
                  <h5>Select Category:</h5>
                  <!-- <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>
                    <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>
afd329a86   Neeraj Sharma   add answer table ...
49
                </v-tabs>
2a4dbc6e3   Neeraj Sharma   fix panel
50
              </v-card>
c17e4f0cd   Jatinder Singh   question changes
51
52
            </v-flex>
            <v-card-text>
2a4dbc6e3   Neeraj Sharma   fix panel
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>
2a4dbc6e3   Neeraj Sharma   fix panel
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>
2a4dbc6e3   Neeraj Sharma   fix panel
70
71
72
73
74
75
76
77
78
79
80
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
135
          </v-card>
        </v-dialog>
        <!-- Edit Question Dialog see answer -->
        <v-dialog v-model="dialog1" max-width="900px">
          <v-card height="700px">
            <v-card-title>
              <span class="headline">Edit Question</span>
              <v-spacer></v-spacer>
              <v-icon @click="close1">close</v-icon>
            </v-card-title>
            <v-card-text>
              <v-layout wrap>
                <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>
2a4dbc6e3   Neeraj Sharma   fix panel
139
140
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
184
          </v-card>
        </v-dialog>
        <!-- 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>
      </v-card>
c17e4f0cd   Jatinder Singh   question changes
185
    </v-flex>
c17e4f0cd   Jatinder Singh   question changes
186
187
188
189
  </template>
  <script>
  export default {
    data: () => ({
2a4dbc6e3   Neeraj Sharma   fix panel
190
      question: "",
c17e4f0cd   Jatinder Singh   question changes
191
192
193
194
195
196
      AddQuestioncredentials: {},
      dialog: false,
      dialog1: false,
      isActive: true,
      newActive: false,
      pagination: {
2a4dbc6e3   Neeraj Sharma   fix panel
197
        rowsPerPage: 10
c17e4f0cd   Jatinder Singh   question changes
198
      },
2a4dbc6e3   Neeraj Sharma   fix panel
199
      getQuestion: [],
c17e4f0cd   Jatinder Singh   question changes
200
201
      headers: [
        {
2a4dbc6e3   Neeraj Sharma   fix panel
202
203
          text: "No.",
          align: "center",
c17e4f0cd   Jatinder Singh   question changes
204
          sortable: false,
2a4dbc6e3   Neeraj Sharma   fix panel
205
          value: "name"
c17e4f0cd   Jatinder Singh   question changes
206
        },
2a4dbc6e3   Neeraj Sharma   fix panel
207
208
209
210
211
212
213
214
        { text: "Posts", value: "posts", sortable: false, align: "center" },
        {
          text: "Responses",
          value: "responses",
          sortable: false,
          align: "center"
        },
        { 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
225
226
        name: '',
        question: "",
        res: 0
c17e4f0cd   Jatinder Singh   question changes
227
228
229
230
      }
    }),
  
    computed: {
2a4dbc6e3   Neeraj Sharma   fix panel
231
232
      formTitle() {
        return this.editedIndex === -1 ? "Create New Question" : "Edit Question";
c17e4f0cd   Jatinder Singh   question changes
233
234
235
236
      }
    },
  
    watch: {
2a4dbc6e3   Neeraj Sharma   fix panel
237
      dialog(val) {
c17e4f0cd   Jatinder Singh   question changes
238
239
240
        val || this.close();
      }
    },
2a4dbc6e3   Neeraj Sharma   fix panel
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: {
2a4dbc6e3   Neeraj Sharma   fix panel
247
      initialize() {
c17e4f0cd   Jatinder Singh   question changes
248
249
        this.desserts = [
          {
2a4dbc6e3   Neeraj Sharma   fix panel
250
251
252
253
            no: "1",
            ques: "questions Skin & Beauty",
            res: 21
          }
c17e4f0cd   Jatinder Singh   question changes
254
        ];
2a4dbc6e3   Neeraj Sharma   fix panel
255
256
257
258
259
260
261
262
263
264
265
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
      },
      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.'
  
          },
          {
            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.'
c17e4f0cd   Jatinder Singh   question changes
297

2a4dbc6e3   Neeraj Sharma   fix panel
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
          },
          {
            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)
      },
      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;
      },
2a4dbc6e3   Neeraj Sharma   fix panel
323
      deleteItem(item) {
c17e4f0cd   Jatinder Singh   question changes
324
        const index = this.desserts.indexOf(item);
2a4dbc6e3   Neeraj Sharma   fix panel
325
326
        confirm("Are you sure you want to delete this item?") &&
          this.desserts.splice(index, 1);
c17e4f0cd   Jatinder Singh   question changes
327
      },
2a4dbc6e3   Neeraj Sharma   fix panel
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);
      },
2a4dbc6e3   Neeraj Sharma   fix panel
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);
      },
2a4dbc6e3   Neeraj Sharma   fix panel
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();
      },
2a4dbc6e3   Neeraj Sharma   fix panel
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();
      }
2a4dbc6e3   Neeraj Sharma   fix panel
360
    }
c17e4f0cd   Jatinder Singh   question changes
361
362
363
364
365
366
    // switchComponent (comp) {
    //   this.$emit('switchComp', comp);
    // }
  };
  </script>
  <style>
2a4dbc6e3   Neeraj Sharma   fix panel
367
368
369
370
371
372
373
374
375
376
  #td {
    border: 1px solid #dddddd;
    text-align: left;
    padding: 8px;
  }
  .AnswerTable{
  height: 370px;overflow: auto;
  }
  .bottomAnswser{
  border-bottom:1px solid #aaa;
c17e4f0cd   Jatinder Singh   question changes
377
378
  }
  </style>