Blame view

src/pages/Administrator/bulkImport.vue 19.8 KB
1c69557ac   Neeraj Sharma   implement design ...
1
2
3
  <template>
    <v-container fluid grid-list-md>
      <v-card flat>
68d742034   Neeraj Sharma   implement new des...
4
        <v-toolbar class="card-styles" dark flat>
1c69557ac   Neeraj Sharma   implement design ...
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
          <v-spacer></v-spacer>
          <v-toolbar-title>Import</v-toolbar-title>
          <v-spacer></v-spacer>
        </v-toolbar>
        <v-container fluid>
          <v-layout>
            <v-flex xs12>
              <v-layout wrap>
                <v-flex xs6 sm5 lg2 class="pt-4">
                  <label class="title right">Add Teacher:</label>
                </v-flex>
                <v-flex xs12 sm6 lg3>
                  <v-text-field v-model="teacherFileName" placeholder="Choose file" :disabled="true"></v-text-field>
                  <input
                    type="file"
                    style="display: none"
                    ref="file"
6fe35f887   Neeraj Sharma   implement bilk im...
22
23
                    @change="convertFile"
                    id="fileInput"
1c69557ac   Neeraj Sharma   implement design ...
24
25
26
                  />
                </v-flex>
                <v-flex xs6 sm4 lg2 class="mt-1">
68d742034   Neeraj Sharma   implement new des...
27
                  <v-btn class="open-dialog-button" round dark block @click="pickFile">
1c69557ac   Neeraj Sharma   implement design ...
28
29
30
31
                    <v-icon small class="pr-1">refresh</v-icon>Upload
                  </v-btn>
                </v-flex>
                <v-flex xs6 sm4 lg2 class="mt-1">
68d742034   Neeraj Sharma   implement new des...
32
33
34
35
36
37
38
39
                  <v-btn
                    class="add-button"
                    round
                    dark
                    block
                    @click="importTeacher()"
                    :loading="loading"
                  >import</v-btn>
1c69557ac   Neeraj Sharma   implement design ...
40
41
42
                </v-flex>
                <v-flex xs12 sm4 lg2 class="mt-1">
                  <download-csv :data="teacherData">
0655a532c   Shikha Mishra   change the patter...
43
                    <v-btn class="blue lighten-2" dark block round>
1c69557ac   Neeraj Sharma   implement design ...
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
                      <v-icon small class="pr-1">archive</v-icon>sample download
                    </v-btn>
                  </download-csv>
                </v-flex>
              </v-layout>
            </v-flex>
          </v-layout>
          <v-layout>
            <v-flex xs12>
              <v-layout wrap>
                <v-flex xs6 sm5 lg2 class="pt-4">
                  <label class="title right">Add Parent:</label>
                </v-flex>
                <v-flex xs12 sm6 lg3>
                  <v-text-field v-model="parentFileName" placeholder="Choose file" :disabled="true"></v-text-field>
6fe35f887   Neeraj Sharma   implement bilk im...
59
60
61
62
63
64
65
                  <input
                    type="file"
                    style="display: none"
                    ref="parentfile"
                    @change="parentFile"
                    id="parentInput"
                  />
1c69557ac   Neeraj Sharma   implement design ...
66
67
                </v-flex>
                <v-flex xs6 sm4 lg2 class="mt-1">
68d742034   Neeraj Sharma   implement new des...
68
                  <v-btn class="open-dialog-button" round dark block @click="pickParentFile">
1c69557ac   Neeraj Sharma   implement design ...
69
70
71
                    <v-icon small class="pr-1">refresh</v-icon>Upload
                  </v-btn>
                </v-flex>
748acd1a6   Neeraj Sharma   solve bugs in pro...
72
                <v-flex xs6 sm4 lg2 class="mt-1" @click="importParent" :loading="parentLoading">
68d742034   Neeraj Sharma   implement new des...
73
                  <v-btn class="add-button" round dark block>import</v-btn>
1c69557ac   Neeraj Sharma   implement design ...
74
75
76
                </v-flex>
                <v-flex xs12 sm4 lg2 class="mt-1">
                  <download-csv :data="parentData">
68d742034   Neeraj Sharma   implement new des...
77
                    <v-btn class="blue lighten-2" dark block round>
1c69557ac   Neeraj Sharma   implement design ...
78
79
80
81
82
83
84
85
86
87
88
89
90
91
                      <v-icon small class="pr-1">archive</v-icon>sample download
                    </v-btn>
                  </download-csv>
                </v-flex>
              </v-layout>
            </v-flex>
          </v-layout>
          <v-layout>
            <v-flex xs12>
              <v-layout wrap>
                <v-flex xs6 sm5 lg2 class="pt-4">
                  <label class="title right">Add User:</label>
                </v-flex>
                <v-flex xs12 sm6 lg3>
6fe35f887   Neeraj Sharma   implement bilk im...
92
93
94
95
96
97
98
99
                  <v-text-field placeholder="Choose file" v-model="userFileName" :disabled="true"></v-text-field>
                  <input
                    type="file"
                    style="display: none"
                    ref="userfile"
                    @change="userFile"
                    id="userInput"
                  />
1c69557ac   Neeraj Sharma   implement design ...
100
101
                </v-flex>
                <v-flex xs6 sm4 lg2 class="mt-1">
68d742034   Neeraj Sharma   implement new des...
102
                  <v-btn class="open-dialog-button" round dark block @click="pickUserFile">
1c69557ac   Neeraj Sharma   implement design ...
103
104
105
106
                    <v-icon small class="pr-1">refresh</v-icon>Upload
                  </v-btn>
                </v-flex>
                <v-flex xs6 sm4 lg2 class="mt-1">
68d742034   Neeraj Sharma   implement new des...
107
108
109
110
111
112
113
114
                  <v-btn
                    class="add-button"
                    round
                    dark
                    block
                    @click="importUser"
                    :loading="userLoading"
                  >import</v-btn>
1c69557ac   Neeraj Sharma   implement design ...
115
116
117
                </v-flex>
                <v-flex xs12 sm4 lg2 class="mt-1">
                  <download-csv :data="userData">
68d742034   Neeraj Sharma   implement new des...
118
                    <v-btn class="blue lighten-2" dark block round>
1c69557ac   Neeraj Sharma   implement design ...
119
120
121
122
123
124
125
126
127
128
129
130
131
132
                      <v-icon small class="pr-1">archive</v-icon>sample download
                    </v-btn>
                  </download-csv>
                </v-flex>
              </v-layout>
            </v-flex>
          </v-layout>
          <v-layout>
            <v-flex xs12>
              <v-layout wrap>
                <v-flex xs6 sm5 lg2 class="pt-4">
                  <label class="title right">Add Book:</label>
                </v-flex>
                <v-flex xs12 sm6 lg3>
6fe35f887   Neeraj Sharma   implement bilk im...
133
134
135
136
137
138
139
140
                  <v-text-field placeholder="Choose file" v-model="bookFileName" :disabled="true"></v-text-field>
                  <input
                    type="file"
                    style="display: none"
                    ref="bookfile"
                    @change="bookFile"
                    id="bookInput"
                  />
1c69557ac   Neeraj Sharma   implement design ...
141
142
                </v-flex>
                <v-flex xs6 sm4 lg2 class="mt-1">
0655a532c   Shikha Mishra   change the patter...
143
                  <v-btn class="open-dialog-button" round dark block @click="pickBookFile">
1c69557ac   Neeraj Sharma   implement design ...
144
145
146
147
                    <v-icon small class="pr-1">refresh</v-icon>Upload
                  </v-btn>
                </v-flex>
                <v-flex xs6 sm4 lg2 class="mt-1">
68d742034   Neeraj Sharma   implement new des...
148
149
150
151
152
153
154
155
                  <v-btn
                    class="add-button"
                    round
                    dark
                    block
                    @click="importBook"
                    :loading="BookLoading"
                  >import</v-btn>
1c69557ac   Neeraj Sharma   implement design ...
156
157
158
                </v-flex>
                <v-flex xs12 sm4 lg2 class="mt-1">
                  <download-csv :data="bookData">
0655a532c   Shikha Mishra   change the patter...
159
                    <v-btn class="blue lighten-2" dark block round>
1c69557ac   Neeraj Sharma   implement design ...
160
161
162
163
164
165
166
167
168
169
170
171
172
173
                      <v-icon small class="pr-1">archive</v-icon>sample download
                    </v-btn>
                  </download-csv>
                </v-flex>
              </v-layout>
            </v-flex>
          </v-layout>
          <v-layout>
            <v-flex xs12>
              <v-layout wrap>
                <v-flex xs6 sm5 lg2 class="pt-4">
                  <label class="title right">Add Student:</label>
                </v-flex>
                <v-flex xs12 sm6 lg3>
f9b486fe1   Neeraj Sharma   implemrent all task
174
175
176
177
178
179
180
181
                  <v-text-field placeholder="Choose file" v-model="bookStudentName" :disabled="true"></v-text-field>
                  <input
                    type="file"
                    style="display: none"
                    ref="studentfile"
                    @change="studentFile"
                    id="studentInput"
                  />
1c69557ac   Neeraj Sharma   implement design ...
182
183
                </v-flex>
                <v-flex xs6 sm4 lg2 class="mt-1">
0655a532c   Shikha Mishra   change the patter...
184
                  <v-btn class="open-dialog-button" round dark block @click="pickStudentFile">
1c69557ac   Neeraj Sharma   implement design ...
185
186
187
188
                    <v-icon small class="pr-1">refresh</v-icon>Upload
                  </v-btn>
                </v-flex>
                <v-flex xs6 sm4 lg2 class="mt-1">
748acd1a6   Neeraj Sharma   solve bugs in pro...
189
                  <v-btn
68d742034   Neeraj Sharma   implement new des...
190
191
                    class="add-button"
                    round
748acd1a6   Neeraj Sharma   solve bugs in pro...
192
193
194
195
196
                    dark
                    block
                    @click="importStudent()"
                    :loading="studentLoading"
                  >import</v-btn>
1c69557ac   Neeraj Sharma   implement design ...
197
198
199
                </v-flex>
                <v-flex xs12 sm4 lg2 class="mt-1">
                  <download-csv :data="studentData">
68d742034   Neeraj Sharma   implement new des...
200
                    <v-btn class="blue lighten-2" round dark block>
1c69557ac   Neeraj Sharma   implement design ...
201
202
203
204
205
206
207
                      <v-icon small class="pr-1">archive</v-icon>sample download
                    </v-btn>
                  </download-csv>
                </v-flex>
              </v-layout>
            </v-flex>
          </v-layout>
f9b486fe1   Neeraj Sharma   implemrent all task
208
          <!-- <v-layout>
1c69557ac   Neeraj Sharma   implement design ...
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
            <v-flex xs12>
              <v-layout wrap>
                <v-flex xs9 sm5 lg2 class="pt-4">
                  <label class="title right">Students & Parents:</label>
                </v-flex>
                <v-flex xs12 sm6 lg3>
                  <v-text-field placeholder="Choose file" :disabled="true"></v-text-field>
                </v-flex>
                <v-flex xs6 sm4 lg2 class="mt-1">
                  <v-btn class="grey" dark block>
                    <v-icon small class="pr-1">refresh</v-icon>Upload
                  </v-btn>
                </v-flex>
                <v-flex xs6 sm4 lg2 class="mt-1">
                  <v-btn class="grey" dark block>import</v-btn>
                </v-flex>
                <v-flex xs12 sm4 lg2 class="mt-1">
                  <v-btn class="blue lighten-2" dark block>
                    <v-icon small class="pr-1">archive</v-icon>sample download
                  </v-btn>
                </v-flex>
              </v-layout>
            </v-flex>
f9b486fe1   Neeraj Sharma   implemrent all task
232
          </v-layout>-->
1c69557ac   Neeraj Sharma   implement design ...
233
234
        </v-container>
      </v-card>
f9b486fe1   Neeraj Sharma   implemrent all task
235
236
237
238
239
240
      <v-snackbar
        :timeout="timeout"
        :top="y === 'top'"
        :right="x === 'right'"
        :vertical="mode === 'vertical'"
        v-model="snackbar"
748acd1a6   Neeraj Sharma   solve bugs in pro...
241
        :color="color"
f9b486fe1   Neeraj Sharma   implemrent all task
242
      >{{ text }}</v-snackbar>
1c69557ac   Neeraj Sharma   implement design ...
243
244
245
246
247
248
249
250
251
252
253
254
    </v-container>
  </template>
  
  
  <script>
  import http from "@/Services/http.js";
  import moment from "moment";
  import teacherData from "@/script/teachers.js";
  import studentData from "@/script/students.js";
  import parentData from "@/script/parents.js";
  import userData from "@/script/users.js";
  import bookData from "@/script/books.js";
748acd1a6   Neeraj Sharma   solve bugs in pro...
255
  import XLSX from "xlsx";
1c69557ac   Neeraj Sharma   implement design ...
256
257
258
  
  export default {
    data: () => ({
f9b486fe1   Neeraj Sharma   implemrent all task
259
      loading: false,
748acd1a6   Neeraj Sharma   solve bugs in pro...
260
261
262
263
      parentLoading: false,
      userLoading: false,
      BookLoading: false,
      studentLoading: false,
f9b486fe1   Neeraj Sharma   implemrent all task
264
265
266
267
268
269
270
      snackbar: false,
      y: "top",
      x: "right",
      mode: "",
      timeout: 3000,
      text: "",
      color: "",
1c69557ac   Neeraj Sharma   implement design ...
271
272
273
274
275
      teacherData: [],
      studentData: [],
      parentData: [],
      userData: [],
      bookData: [],
6fe35f887   Neeraj Sharma   implement bilk im...
276
277
278
279
      teacherFileJson: [],
      parentFileJson: [],
      userFileJson: [],
      bookFileJson: [],
f9b486fe1   Neeraj Sharma   implemrent all task
280
      studentFileJson: [],
1c69557ac   Neeraj Sharma   implement design ...
281
      teacherFileName: "",
1c69557ac   Neeraj Sharma   implement design ...
282
      parentFileName: "",
6fe35f887   Neeraj Sharma   implement bilk im...
283
284
      userFileName: "",
      bookFileName: "",
f9b486fe1   Neeraj Sharma   implemrent all task
285
      bookStudentName: "",
0655a532c   Shikha Mishra   change the patter...
286
287
288
289
      token: "",
      fileData: {},
      teacherDetail: {},
      userDetail: {},
1c69557ac   Neeraj Sharma   implement design ...
290
291
292
293
294
    }),
    methods: {
      pickFile() {
        this.$refs.file.click();
      },
6fe35f887   Neeraj Sharma   implement bilk im...
295
296
297
298
299
300
301
302
303
      pickParentFile() {
        this.$refs.parentfile.click();
      },
      pickUserFile() {
        this.$refs.userfile.click();
      },
      pickBookFile() {
        this.$refs.bookfile.click();
      },
f9b486fe1   Neeraj Sharma   implemrent all task
304
305
306
      pickStudentFile() {
        this.$refs.studentfile.click();
      },
748acd1a6   Neeraj Sharma   solve bugs in pro...
307
      convertFile(e) {
0655a532c   Shikha Mishra   change the patter...
308
309
        var form_data = new FormData();
        form_data.append("upload", e.target.files[0]);
860da881d   Shikha Mishra   comment all consoles
310

0655a532c   Shikha Mishra   change the patter...
311
        this.teacherDetail = form_data;
6fe35f887   Neeraj Sharma   implement bilk im...
312
        const input = document.getElementById("fileInput");
6fe35f887   Neeraj Sharma   implement bilk im...
313
        this.teacherFileName = input.files[0].name;
0655a532c   Shikha Mishra   change the patter...
314

748acd1a6   Neeraj Sharma   solve bugs in pro...
315
316
317
318
319
320
321
322
323
        // const reader = new FileReader();
        // console.log("reader", reader);
        // reader.onload = () => {
        //   let text = reader.result;
        //   //convert text to json here
        //   console.log("text", text);
        //   var json = this.csvJSON(text);
        // };
        // reader.readAsText(input.files[0]);
0655a532c   Shikha Mishra   change the patter...
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
        // var files = e.target.files,
        //   f = files[0];
        // var reader = new FileReader();
        // let array = [];
        // let _this = this;
        // reader.onload = function(e) {
        //   var data = new Uint8Array(e.target.result);
        //   var workbook = XLSX.read(data, { type: "array" });
        //   let sheetName = workbook.SheetNames[0];
        //   // /* DO SOMETHING WITH workbook HERE */
        //   let worksheet = workbook.Sheets[sheetName];
        //   array = XLSX.utils.sheet_to_json(worksheet);
        //   _this.teacherFileJson = array;
        // };
        // reader.readAsArrayBuffer(f);
6fe35f887   Neeraj Sharma   implement bilk im...
339
      },
748acd1a6   Neeraj Sharma   solve bugs in pro...
340
      parentFile(e) {
6fe35f887   Neeraj Sharma   implement bilk im...
341
        const input = document.getElementById("parentInput");
6fe35f887   Neeraj Sharma   implement bilk im...
342
        this.parentFileName = input.files[0].name;
860da881d   Shikha Mishra   comment all consoles
343
        //   console.log("this.parentFileName", this.parentFileName);
748acd1a6   Neeraj Sharma   solve bugs in pro...
344
345
346
347
348
        var files = e.target.files,
          f = files[0];
        var reader = new FileReader();
        let array = [];
        let _this = this;
860da881d   Shikha Mishra   comment all consoles
349
        reader.onload = function (e) {
748acd1a6   Neeraj Sharma   solve bugs in pro...
350
351
352
353
354
355
356
357
358
          var data = new Uint8Array(e.target.result);
          var workbook = XLSX.read(data, { type: "array" });
          let sheetName = workbook.SheetNames[0];
          // /* DO SOMETHING WITH workbook HERE */
          let worksheet = workbook.Sheets[sheetName];
          array = XLSX.utils.sheet_to_json(worksheet);
          _this.parentFileJson = array;
        };
        reader.readAsArrayBuffer(f);
6fe35f887   Neeraj Sharma   implement bilk im...
359
      },
748acd1a6   Neeraj Sharma   solve bugs in pro...
360
      userFile(e) {
0655a532c   Shikha Mishra   change the patter...
361
362
        var form_data = new FormData();
        form_data.append("upload", e.target.files[0]);
860da881d   Shikha Mishra   comment all consoles
363

0655a532c   Shikha Mishra   change the patter...
364
        this.userDetail = form_data;
6fe35f887   Neeraj Sharma   implement bilk im...
365
        const input = document.getElementById("userInput");
6fe35f887   Neeraj Sharma   implement bilk im...
366
        this.userFileName = input.files[0].name;
0655a532c   Shikha Mishra   change the patter...
367

0655a532c   Shikha Mishra   change the patter...
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
        // var files = e.target.files,
        //   f = files[0];
        // var reader = new FileReader();
        // let array = [];
        // let _this = this;
        // reader.onload = function(e) {
        //   var data = new Uint8Array(e.target.result);
        //   var workbook = XLSX.read(data, { type: "array" });
        //   let sheetName = workbook.SheetNames[0];
        //   // /* DO SOMETHING WITH workbook HERE */
        //   let worksheet = workbook.Sheets[sheetName];
        //   array = XLSX.utils.sheet_to_json(worksheet);
        //   _this.userFileJson = array;
        // };
        // reader.readAsArrayBuffer(f);
6fe35f887   Neeraj Sharma   implement bilk im...
383
      },
748acd1a6   Neeraj Sharma   solve bugs in pro...
384
      bookFile(e) {
6fe35f887   Neeraj Sharma   implement bilk im...
385
        const input = document.getElementById("bookInput");
6fe35f887   Neeraj Sharma   implement bilk im...
386
        this.bookFileName = input.files[0].name;
860da881d   Shikha Mishra   comment all consoles
387
        //   console.log("this.bookFileName", this.bookFileName);
748acd1a6   Neeraj Sharma   solve bugs in pro...
388
389
        var files = e.target.files,
          f = files[0];
860da881d   Shikha Mishra   comment all consoles
390
        //   console.log("this.bookFileName", files);
748acd1a6   Neeraj Sharma   solve bugs in pro...
391
        var reader = new FileReader();
748acd1a6   Neeraj Sharma   solve bugs in pro...
392
393
        let array = [];
        let _this = this;
860da881d   Shikha Mishra   comment all consoles
394
        reader.onload = function (e) {
748acd1a6   Neeraj Sharma   solve bugs in pro...
395
          var data = new Uint8Array(e.target.result);
860da881d   Shikha Mishra   comment all consoles
396
          // console.log("data", data);
748acd1a6   Neeraj Sharma   solve bugs in pro...
397
398
399
400
401
402
          var workbook = XLSX.read(data, { type: "array" });
          let sheetName = workbook.SheetNames[0];
          // /* DO SOMETHING WITH workbook HERE */
          let worksheet = workbook.Sheets[sheetName];
          array = XLSX.utils.sheet_to_json(worksheet);
          _this.bookFileJson = array;
860da881d   Shikha Mishra   comment all consoles
403
          // console.log("this.bookFileJson ", _this.bookFileJson);
748acd1a6   Neeraj Sharma   solve bugs in pro...
404
405
        };
        reader.readAsArrayBuffer(f);
6fe35f887   Neeraj Sharma   implement bilk im...
406
      },
0655a532c   Shikha Mishra   change the patter...
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
      // csvJSON(csv) {
      //   var lines = csv.split("
  ");
  
      //   var result = [];
  
      //   var headers = lines[0].split(",");
  
      //   for (var i = 1; i < lines.length; i++) {
      //     var obj = {};
      //     var currentline = lines[i].split(",");
  
      //     for (var j = 0; j < headers.length; j++) {
      //       obj[headers[j]] = currentline[j];
      //     }
  
      //     result.push(obj);
      //   }
  
      //   //return result; //JavaScript object
      //   return JSON.stringify(result); //JSON
      // },
748acd1a6   Neeraj Sharma   solve bugs in pro...
429
      studentFile(e) {
0655a532c   Shikha Mishra   change the patter...
430
431
        var form_data = new FormData();
        form_data.append("upload", e.target.files[0]);
860da881d   Shikha Mishra   comment all consoles
432

0655a532c   Shikha Mishra   change the patter...
433
        this.fileData = form_data;
f9b486fe1   Neeraj Sharma   implemrent all task
434
        const input = document.getElementById("studentInput");
f9b486fe1   Neeraj Sharma   implemrent all task
435
        this.bookStudentName = input.files[0].name;
0655a532c   Shikha Mishra   change the patter...
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
  
        // var files = e.target.files,
        //   f = files[0];
        // var reader = new FileReader();
        // let array = [];
        // let _this = this;
        // reader.onload = function(e) {
        //   var data = new Uint8Array(e.target.result);
        //   var workbook = XLSX.read(data, { type: "array", cellDates: true });
        //   let sheetName = workbook.SheetNames[0];
        //   // /* DO SOMETHING WITH workbook HERE */
        //   let worksheet = workbook.Sheets[sheetName];
        //   array = XLSX.utils.sheet_to_json(worksheet);
        //   _this.studentFileJson = array;
        // };
        // reader.readAsArrayBuffer(f);
f9b486fe1   Neeraj Sharma   implemrent all task
452
      },
860da881d   Shikha Mishra   comment all consoles
453

748acd1a6   Neeraj Sharma   solve bugs in pro...
454
455
456
      // csvJSON(csv) {
      //   var lines = csv.split("
  ");
f9b486fe1   Neeraj Sharma   implemrent all task
457

748acd1a6   Neeraj Sharma   solve bugs in pro...
458
459
      //   var result = [];
      //   var headers = lines[0].split(",");
f9b486fe1   Neeraj Sharma   implemrent all task
460

748acd1a6   Neeraj Sharma   solve bugs in pro...
461
462
463
      //   for (var i = 1; i < lines.length; i++) {
      //     var obj = {};
      //     var currentline = lines[i].split(",");
f9b486fe1   Neeraj Sharma   implemrent all task
464

748acd1a6   Neeraj Sharma   solve bugs in pro...
465
466
467
468
469
470
      //     for (var j = 0; j < headers.length; j++) {
      //       obj[headers[j]] = currentline[j];
      //     }
      //     this.teacherFileJson.push(obj);
      //   }
      // },
6fe35f887   Neeraj Sharma   implement bilk im...
471
472
473
474
475
      importTeacher() {
        this.loading = true;
        var teacherfile = {};
        teacherfile.teacherData = this.teacherFileJson;
        http()
0655a532c   Shikha Mishra   change the patter...
476
          .post("/importTeacherData", this.teacherDetail, {
860da881d   Shikha Mishra   comment all consoles
477
            headers: { Authorization: "Bearer " + this.token },
6fe35f887   Neeraj Sharma   implement bilk im...
478
          })
860da881d   Shikha Mishra   comment all consoles
479
          .then((response) => {
6fe35f887   Neeraj Sharma   implement bilk im...
480
481
            this.snackbar = true;
            this.text = response.data.message;
f9b486fe1   Neeraj Sharma   implemrent all task
482
            this.color = "green";
6fe35f887   Neeraj Sharma   implement bilk im...
483
484
            this.loading = false;
          })
860da881d   Shikha Mishra   comment all consoles
485
          .catch((error) => {
6fe35f887   Neeraj Sharma   implement bilk im...
486
487
            this.snackbar = true;
            this.text = error.response.data.message;
f9b486fe1   Neeraj Sharma   implemrent all task
488
            this.color = "red";
6fe35f887   Neeraj Sharma   implement bilk im...
489
490
491
492
            this.loading = false;
          });
      },
      importParent() {
748acd1a6   Neeraj Sharma   solve bugs in pro...
493
        this.parentLoading = true;
6fe35f887   Neeraj Sharma   implement bilk im...
494
495
496
497
        var parentfile = {};
        parentfile.parentData = this.parentFileJson;
        http()
          .post("/importParentData", parentfile, {
860da881d   Shikha Mishra   comment all consoles
498
            headers: { Authorization: "Bearer " + this.token },
6fe35f887   Neeraj Sharma   implement bilk im...
499
          })
860da881d   Shikha Mishra   comment all consoles
500
          .then((response) => {
6fe35f887   Neeraj Sharma   implement bilk im...
501
502
            this.snackbar = true;
            this.text = response.data.message;
f9b486fe1   Neeraj Sharma   implemrent all task
503
            this.color = "green";
748acd1a6   Neeraj Sharma   solve bugs in pro...
504
            this.parentLoading = false;
6fe35f887   Neeraj Sharma   implement bilk im...
505
          })
860da881d   Shikha Mishra   comment all consoles
506
          .catch((error) => {
6fe35f887   Neeraj Sharma   implement bilk im...
507
508
            this.snackbar = true;
            this.text = error.response.data.message;
748acd1a6   Neeraj Sharma   solve bugs in pro...
509
            this.parentLoading = false;
f9b486fe1   Neeraj Sharma   implemrent all task
510
            this.color = "red";
6fe35f887   Neeraj Sharma   implement bilk im...
511
512
513
          });
      },
      importUser() {
748acd1a6   Neeraj Sharma   solve bugs in pro...
514
        this.userLoading = true;
6fe35f887   Neeraj Sharma   implement bilk im...
515
516
517
        var userfile = {};
        userfile.userData = this.userFileJson;
        http()
0655a532c   Shikha Mishra   change the patter...
518
          .post("/importUserData", this.userDetail, {
860da881d   Shikha Mishra   comment all consoles
519
            headers: { Authorization: "Bearer " + this.token },
6fe35f887   Neeraj Sharma   implement bilk im...
520
          })
860da881d   Shikha Mishra   comment all consoles
521
          .then((response) => {
6fe35f887   Neeraj Sharma   implement bilk im...
522
523
            this.snackbar = true;
            this.text = response.data.message;
f9b486fe1   Neeraj Sharma   implemrent all task
524
            this.color = "green";
748acd1a6   Neeraj Sharma   solve bugs in pro...
525
            this.userLoading = false;
6fe35f887   Neeraj Sharma   implement bilk im...
526
          })
860da881d   Shikha Mishra   comment all consoles
527
          .catch((error) => {
6fe35f887   Neeraj Sharma   implement bilk im...
528
529
            this.snackbar = true;
            this.text = error.response.data.message;
748acd1a6   Neeraj Sharma   solve bugs in pro...
530
            this.userLoading = false;
f9b486fe1   Neeraj Sharma   implemrent all task
531
            this.color = "red";
6fe35f887   Neeraj Sharma   implement bilk im...
532
533
534
          });
      },
      importBook() {
748acd1a6   Neeraj Sharma   solve bugs in pro...
535
        this.BookLoading = true;
6fe35f887   Neeraj Sharma   implement bilk im...
536
537
538
539
        var bookfile = {};
        bookfile.bookData = this.bookFileJson;
        http()
          .post("/importBookData", bookfile, {
860da881d   Shikha Mishra   comment all consoles
540
            headers: { Authorization: "Bearer " + this.token },
6fe35f887   Neeraj Sharma   implement bilk im...
541
          })
860da881d   Shikha Mishra   comment all consoles
542
          .then((response) => {
6fe35f887   Neeraj Sharma   implement bilk im...
543
544
            this.snackbar = true;
            this.text = response.data.message;
f9b486fe1   Neeraj Sharma   implemrent all task
545
            this.color = "green";
748acd1a6   Neeraj Sharma   solve bugs in pro...
546
            this.BookLoading = false;
f9b486fe1   Neeraj Sharma   implemrent all task
547
          })
860da881d   Shikha Mishra   comment all consoles
548
          .catch((error) => {
f9b486fe1   Neeraj Sharma   implemrent all task
549
550
551
            this.snackbar = true;
            this.text = error.response.data.message;
            this.color = "red";
748acd1a6   Neeraj Sharma   solve bugs in pro...
552
            this.BookLoading = false;
f9b486fe1   Neeraj Sharma   implemrent all task
553
554
555
          });
      },
      importStudent() {
748acd1a6   Neeraj Sharma   solve bugs in pro...
556
        this.studentLoading = true;
f9b486fe1   Neeraj Sharma   implemrent all task
557
        var studentfile = {};
860da881d   Shikha Mishra   comment all consoles
558
        //   console.log("this.studentFileJson", this.studentFileJson);
f9b486fe1   Neeraj Sharma   implemrent all task
559
560
        studentfile.studentData = this.studentFileJson;
        http()
0655a532c   Shikha Mishra   change the patter...
561
          .post("/importStudentData", this.fileData, {
860da881d   Shikha Mishra   comment all consoles
562
            headers: { Authorization: "Bearer " + this.token },
f9b486fe1   Neeraj Sharma   implemrent all task
563
          })
860da881d   Shikha Mishra   comment all consoles
564
          .then((response) => {
f9b486fe1   Neeraj Sharma   implemrent all task
565
566
567
            this.snackbar = true;
            this.text = response.data.message;
            this.color = "green";
748acd1a6   Neeraj Sharma   solve bugs in pro...
568
            this.studentLoading = false;
6fe35f887   Neeraj Sharma   implement bilk im...
569
          })
860da881d   Shikha Mishra   comment all consoles
570
          .catch((error) => {
6fe35f887   Neeraj Sharma   implement bilk im...
571
572
            this.snackbar = true;
            this.text = error.response.data.message;
f9b486fe1   Neeraj Sharma   implemrent all task
573
            this.color = "red";
748acd1a6   Neeraj Sharma   solve bugs in pro...
574
            this.studentLoading = false;
6fe35f887   Neeraj Sharma   implement bilk im...
575
          });
860da881d   Shikha Mishra   comment all consoles
576
      },
1c69557ac   Neeraj Sharma   implement design ...
577
578
    },
    mounted() {
6fe35f887   Neeraj Sharma   implement bilk im...
579
      this.token = this.$store.state.token;
f9b486fe1   Neeraj Sharma   implemrent all task
580

1c69557ac   Neeraj Sharma   implement design ...
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
      /** TEACHERS SAMPLE CSV */
      const getTeacherData = teacherData();
      this.teacherData = getTeacherData;
  
      /** STUDENTS SAMPLE CSV */
      const getstudentData = studentData();
      this.studentData = getstudentData;
  
      /** PARENTS SAMPLE CSV */
      const getparentData = parentData();
      this.parentData = getparentData;
  
      /** USERS SAMPLE CSV */
      const getUserData = userData();
      this.userData = getUserData;
  
      /** BOOKS SAMPLE CSV */
      const getBookData = bookData();
      this.bookData = getBookData;
860da881d   Shikha Mishra   comment all consoles
600
    },
1c69557ac   Neeraj Sharma   implement design ...
601
  };
6fe35f887   Neeraj Sharma   implement bilk im...
602
  </script>
68d742034   Neeraj Sharma   implement new des...
603
604
605
606
607
608
  <style>
  .card-styles {
    background: #7f62f8 !important;
    border-color: #7f62f8 !important;
  }
  </style>