Blame view

src/pages/questions.vue 6.6 KB
04e3fbc56   Jatinder Singh   minor fix
1
2
3
4
5
  <template>
  <v-container grid-list-xl>
      <v-flex>
    <v-card>
      <v-toolbar flat color="white">
a259e694f   Jatinder Singh   minor change
6
        <v-card-title>
c1fd43e24   Jatinder Singh   changes
7
8
9
        <h3 style="position:relative; left:px; top:-5px;"><b>Forum Questions</b></h3>
        <h5 style="position:relative; left:40px; top:-15px;">Select Category</h5>
        <span style="position:relative; left:-95px; top:10px;">
f84ff8f5a   Jatinder Singh   report page changes
10
11
12
13
14
              <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>
a259e694f   Jatinder Singh   minor change
15
16
17
        </span>
        
        </v-card-title>
e2e46164f   Jatinder Singh   edit profile changes
18
      
250d1e021   Jatinder Singh   datatable change
19
        <v-spacer></v-spacer>
04e3fbc56   Jatinder Singh   minor fix
20
        <v-dialog v-model="dialog" max-width="800px">
f84ff8f5a   Jatinder Singh   report page changes
21
      
04e3fbc56   Jatinder Singh   minor fix
22
23
24
25
26
27
28
29
          <v-card>
            <v-card-title>
              <span class="headline">{{ formTitle }}</span>
              <v-spacer></v-spacer>
              <v-icon @click="close">close</v-icon>
            </v-card-title>
            <v-flex>
              <v-card>
250d1e021   Jatinder Singh   datatable change
30
                <v-card-text>
04e3fbc56   Jatinder Singh   minor fix
31
32
33
34
            <span>
            <p><b>Ana Suggestion:</b> Select Suggestion</p></span>
            <h5>Select Category:</h5>
            <span>
f84ff8f5a   Jatinder Singh   report page changes
35
36
37
38
39
              <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>
04e3fbc56   Jatinder Singh   minor fix
40
              </span>
250d1e021   Jatinder Singh   datatable change
41
                </v-card-text>
04e3fbc56   Jatinder Singh   minor fix
42
43
44
            </v-card>
            </v-flex>
            <v-card-text>
ab72cb628   Jatinder Singh   report changes
45
               
04e3fbc56   Jatinder Singh   minor fix
46
47
            <v-container grid-list-md>
              <v-layout wrap>
ab72cb628   Jatinder Singh   report changes
48
              <v-flex xs12 sm6 md12>    
04e3fbc56   Jatinder Singh   minor fix
49
50
            <v-textarea
             solo
defcc5da3   Jatinder Singh   report page
51
             v-model="AddQuestioncredentials.question"
04e3fbc56   Jatinder Singh   minor fix
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
            name="input-7-4"
            label="Type Question"
          ></v-textarea>
                </v-flex>
                </v-layout>
              </v-container>
            </v-card-text>
  
            <v-card-actions>
            <v-spacer></v-spacer>
            <v-btn dark large @click.native="save">Post Question</v-btn>
            </v-card-actions>
            </v-card>
            </v-dialog>
  
          
          
          <v-dialog v-model="dialog1" max-width="800px">
          <v-card>
          <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 sm6 md12>
                  <v-text-field outline v-model="editedItem.ques" label="Question"></v-text-field>
                </v-flex>
              </v-layout>
              <span><p> <b>Ana suggestion:</b> Abnormal Uterine Bleeding <br>
              Diagnosis 1,Diagnosis 2,Diagnosis 3
              <v-btn dark large @click.native="save1" style="position:absolute; top:163px; right:5px;">Save Edit</v-btn></p></span>
            </v-card-text>
04e3fbc56   Jatinder Singh   minor fix
87
88
89
90
91
92
93
           </v-card>
         </v-dialog>
      </v-toolbar>
      <v-data-table
        :headers="headers"
        :items="desserts"
        class="elevation-1"
5ac5570a9   Jatinder Singh   datatable changes
94
        :pagination.sync="pagination"
04e3fbc56   Jatinder Singh   minor fix
95
96
      >
      <template slot="items" slot-scope="props">
5ac5570a9   Jatinder Singh   datatable changes
97
        <tr v-if="props.index === 0">
250d1e021   Jatinder Singh   datatable change
98
99
100
101
102
103
104
105
          <td id="td">&nbsp;</td>
          <td>
          <span style="cursor:pointer" @click="dialog=true"> <v-icon>add</v-icon>Add New Question</span>
          </td>
          <td id="td">&nbsp;</td>
            <td id="td">&nbsp;</td>
        </tr>
        <tr>
e2e46164f   Jatinder Singh   edit profile changes
106
          <td id="td" class="text-xs-center">{{ props.item.no }}</td>
7e8044568   Jatinder Singh   table header changes
107
          <td id="td">{{ props.item.ques }}</td>
e2e46164f   Jatinder Singh   edit profile changes
108
109
          <td id="td" class="text-xs-center">{{ props.item.res }}</td>
          <td class="text-xs-center">
269061695   Jatinder Singh   changes
110
            <span>
e2e46164f   Jatinder Singh   edit profile changes
111
            <img style="cursor:pointer; height:18px; " class="mr-5" @click="editItem(props.item)" src="/static/icon/edit1.png"/>
7e8044568   Jatinder Singh   table header changes
112
            <img style="cursor:pointer; height:20px; " class="mr-5" @click="deleteItem(props.item)" src="/static/icon/delete1.png"/>
269061695   Jatinder Singh   changes
113
            </span>
04e3fbc56   Jatinder Singh   minor fix
114
          </td>
250d1e021   Jatinder Singh   datatable change
115
        </tr>
04e3fbc56   Jatinder Singh   minor fix
116
        </template>
04e3fbc56   Jatinder Singh   minor fix
117
      </v-data-table>
04e3fbc56   Jatinder Singh   minor fix
118
119
    </v-card>
    </v-flex>
f84ff8f5a   Jatinder Singh   report page changes
120

04e3fbc56   Jatinder Singh   minor fix
121
122
123
124
125
    </v-container>
  </template>
  <script>
  export default {
    data: () => ({
defcc5da3   Jatinder Singh   report page
126
127
      question: '',
      AddQuestioncredentials: {},
04e3fbc56   Jatinder Singh   minor fix
128
129
      dialog: false,
      dialog1: false,
f84ff8f5a   Jatinder Singh   report page changes
130
131
      isActive: true,
      newActive: false,
5ac5570a9   Jatinder Singh   datatable changes
132
133
134
      pagination: {
        rowsPerPage: 10,
      },
04e3fbc56   Jatinder Singh   minor fix
135
136
137
      headers: [
        {
          text: 'No.',
e2e46164f   Jatinder Singh   edit profile changes
138
          align: 'center',
04e3fbc56   Jatinder Singh   minor fix
139
140
141
          sortable: false,
          value: 'name'
        },
e2e46164f   Jatinder Singh   edit profile changes
142
143
144
        { text: 'Posts', value: 'posts', sortable: false, align: 'center' },
        { text: 'Responses', value: 'responses', sortable: false, align: 'center' },
        { text: '', value: 'carbs', sortable: false, align: 'center' },
04e3fbc56   Jatinder Singh   minor fix
145
146
147
148
      ],
      desserts: [],
      editedIndex: -1,
      editedItem: {
defcc5da3   Jatinder Singh   report page
149
150
        question: '',
        
04e3fbc56   Jatinder Singh   minor fix
151
152
      },
      defaultItem: {
defcc5da3   Jatinder Singh   report page
153
154
155
156
        no: 0,
        question: '',
        res: 0,
        
04e3fbc56   Jatinder Singh   minor fix
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
      }
    }),
  
    computed: {
      formTitle () {
        return this.editedIndex === -1 ? 'Create New Question' : 'Edit Question';
      }
    },
  
    watch: {
      dialog (val) {
        val || this.close();
      }
    },
  
    created () {
      this.initialize();
    },
  
    methods: {
      initialize () {
        this.desserts = [
          {
            no: '1',
7e8044568   Jatinder Singh   table header changes
181
            ques: 'questions',
04e3fbc56   Jatinder Singh   minor fix
182
            res: 9.0,
04e3fbc56   Jatinder Singh   minor fix
183
          },
04e3fbc56   Jatinder Singh   minor fix
184
        ];
4413a8d93   Jatinder Singh   changes
185
      },    
04e3fbc56   Jatinder Singh   minor fix
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
  
      editItem (item) {
        this.editedIndex = this.desserts.indexOf(item);
        this.editedItem = Object.assign({}, item);
        this.dialog1 = true;
      },
  
      deleteItem (item) {
        const index = this.desserts.indexOf(item);
        confirm('Are you sure you want to delete this item?') && this.desserts.splice(index, 1);
      },
  
      close () {
        this.dialog = false;
        setTimeout(() => {
          this.editedItem = Object.assign({}, this.defaultItem);
          this.editedIndex = -1;
        }, 300);
      },
      close1 () {
        this.dialog1 = false;
        setTimeout(() => {
          this.editedItem = Object.assign({}, this.defaultItem);
          this.editedIndex = -1;
        }, 300);
      },
      save () {
defcc5da3   Jatinder Singh   report page
213
        console.log('editedItem', this.editedItem);
04e3fbc56   Jatinder Singh   minor fix
214
215
216
217
218
219
220
221
        if (this.editedIndex > -1) {
          Object.assign(this.desserts[this.editedIndex], this.editedItem);
        } else {
          this.desserts.push(this.editedItem);
        }
        this.close();
      },
      save1 () {
defcc5da3   Jatinder Singh   report page
222
        console.log('editedItem', this.editedItem);
04e3fbc56   Jatinder Singh   minor fix
223
224
225
226
227
228
229
        if (this.editedIndex > -1) {
          Object.assign(this.desserts[this.editedIndex], this.editedItem);
        } else {
          this.desserts.push(this.editedItem);
        }
        this.close1();
      }
defcc5da3   Jatinder Singh   report page
230
    },
f84ff8f5a   Jatinder Singh   report page changes
231
232
233
    // switchComponent (comp) {
    //   this.$emit('switchComp', comp);
    // }
04e3fbc56   Jatinder Singh   minor fix
234
  };
269061695   Jatinder Singh   changes
235
236
  </script>
  <style>
7e8044568   Jatinder Singh   table header changes
237
  #td{
269061695   Jatinder Singh   changes
238
239
      border: 1px solid #dddddd;
      text-align: left;
8fc85e8ec   Jatinder Singh   data table changes
240
      padding: 8px;
f84ff8f5a   Jatinder Singh   report page changes
241
     
269061695   Jatinder Singh   changes
242
243
  }
  </style>