Blame view

src/pages/Administrator/bulkImport.vue 18.7 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">
68d742034   Neeraj Sharma   implement new des...
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">
68d742034   Neeraj Sharma   implement new des...
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">
68d742034   Neeraj Sharma   implement new des...
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">
68d742034   Neeraj Sharma   implement new des...
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
286
      bookStudentName: "",
      token: ""
1c69557ac   Neeraj Sharma   implement design ...
287
288
289
290
291
    }),
    methods: {
      pickFile() {
        this.$refs.file.click();
      },
6fe35f887   Neeraj Sharma   implement bilk im...
292
293
294
295
296
297
298
299
300
      pickParentFile() {
        this.$refs.parentfile.click();
      },
      pickUserFile() {
        this.$refs.userfile.click();
      },
      pickBookFile() {
        this.$refs.bookfile.click();
      },
f9b486fe1   Neeraj Sharma   implemrent all task
301
302
303
      pickStudentFile() {
        this.$refs.studentfile.click();
      },
748acd1a6   Neeraj Sharma   solve bugs in pro...
304
      convertFile(e) {
6fe35f887   Neeraj Sharma   implement bilk im...
305
        const input = document.getElementById("fileInput");
6fe35f887   Neeraj Sharma   implement bilk im...
306
        this.teacherFileName = input.files[0].name;
748acd1a6   Neeraj Sharma   solve bugs in pro...
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
        // 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]);
        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...
331
      },
748acd1a6   Neeraj Sharma   solve bugs in pro...
332
      parentFile(e) {
6fe35f887   Neeraj Sharma   implement bilk im...
333
        const input = document.getElementById("parentInput");
6fe35f887   Neeraj Sharma   implement bilk im...
334
        this.parentFileName = input.files[0].name;
748acd1a6   Neeraj Sharma   solve bugs in pro...
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
        console.log("this.parentFileName", this.parentFileName);
        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.parentFileJson = array;
        };
        reader.readAsArrayBuffer(f);
6fe35f887   Neeraj Sharma   implement bilk im...
351
      },
748acd1a6   Neeraj Sharma   solve bugs in pro...
352
      userFile(e) {
6fe35f887   Neeraj Sharma   implement bilk im...
353
        const input = document.getElementById("userInput");
6fe35f887   Neeraj Sharma   implement bilk im...
354
        this.userFileName = input.files[0].name;
748acd1a6   Neeraj Sharma   solve bugs in pro...
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
        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...
370
      },
748acd1a6   Neeraj Sharma   solve bugs in pro...
371
      bookFile(e) {
6fe35f887   Neeraj Sharma   implement bilk im...
372
        const input = document.getElementById("bookInput");
6fe35f887   Neeraj Sharma   implement bilk im...
373
        this.bookFileName = input.files[0].name;
748acd1a6   Neeraj Sharma   solve bugs in pro...
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
        console.log("this.bookFileName", this.bookFileName);
        var files = e.target.files,
          f = files[0];
        console.log("this.bookFileName", files);
        var reader = new FileReader();
        console.log("reader================", reader);
        let array = [];
        let _this = this;
        reader.onload = function(e) {
          console.log("data", e.target.result);
          var data = new Uint8Array(e.target.result);
          console.log("data", data);
          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;
          console.log("this.bookFileJson ", _this.bookFileJson);
        };
        reader.readAsArrayBuffer(f);
6fe35f887   Neeraj Sharma   implement bilk im...
395
      },
748acd1a6   Neeraj Sharma   solve bugs in pro...
396
      studentFile(e) {
f9b486fe1   Neeraj Sharma   implemrent all task
397
        const input = document.getElementById("studentInput");
f9b486fe1   Neeraj Sharma   implemrent all task
398
        this.bookStudentName = input.files[0].name;
748acd1a6   Neeraj Sharma   solve bugs in pro...
399
400
401
402
403
404
405
        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);
080d88547   Shikha Mishra   issues solved
406
          var workbook = XLSX.read(data, { type: "array", cellDates: true });
748acd1a6   Neeraj Sharma   solve bugs in pro...
407
408
409
410
411
412
413
          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
414
      },
748acd1a6   Neeraj Sharma   solve bugs in pro...
415
416
417
      // csvJSON(csv) {
      //   var lines = csv.split("
  ");
f9b486fe1   Neeraj Sharma   implemrent all task
418

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

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

748acd1a6   Neeraj Sharma   solve bugs in pro...
426
427
428
429
430
431
      //     for (var j = 0; j < headers.length; j++) {
      //       obj[headers[j]] = currentline[j];
      //     }
      //     this.teacherFileJson.push(obj);
      //   }
      // },
6fe35f887   Neeraj Sharma   implement bilk im...
432
433
434
435
436
437
438
439
440
441
442
      importTeacher() {
        this.loading = true;
        var teacherfile = {};
        teacherfile.teacherData = this.teacherFileJson;
        http()
          .post("/importTeacherData", teacherfile, {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.snackbar = true;
            this.text = response.data.message;
f9b486fe1   Neeraj Sharma   implemrent all task
443
            this.color = "green";
6fe35f887   Neeraj Sharma   implement bilk im...
444
445
446
447
448
            this.loading = false;
          })
          .catch(error => {
            this.snackbar = true;
            this.text = error.response.data.message;
f9b486fe1   Neeraj Sharma   implemrent all task
449
            this.color = "red";
6fe35f887   Neeraj Sharma   implement bilk im...
450
451
452
453
            this.loading = false;
          });
      },
      importParent() {
748acd1a6   Neeraj Sharma   solve bugs in pro...
454
        this.parentLoading = true;
6fe35f887   Neeraj Sharma   implement bilk im...
455
456
457
458
459
460
461
462
463
        var parentfile = {};
        parentfile.parentData = this.parentFileJson;
        http()
          .post("/importParentData", parentfile, {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.snackbar = true;
            this.text = response.data.message;
f9b486fe1   Neeraj Sharma   implemrent all task
464
            this.color = "green";
748acd1a6   Neeraj Sharma   solve bugs in pro...
465
            this.parentLoading = false;
6fe35f887   Neeraj Sharma   implement bilk im...
466
467
468
469
          })
          .catch(error => {
            this.snackbar = true;
            this.text = error.response.data.message;
748acd1a6   Neeraj Sharma   solve bugs in pro...
470
            this.parentLoading = false;
f9b486fe1   Neeraj Sharma   implemrent all task
471
            this.color = "red";
6fe35f887   Neeraj Sharma   implement bilk im...
472
473
474
          });
      },
      importUser() {
748acd1a6   Neeraj Sharma   solve bugs in pro...
475
        this.userLoading = true;
6fe35f887   Neeraj Sharma   implement bilk im...
476
477
478
479
480
481
482
483
484
        var userfile = {};
        userfile.userData = this.userFileJson;
        http()
          .post("/importUserData", userfile, {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.snackbar = true;
            this.text = response.data.message;
f9b486fe1   Neeraj Sharma   implemrent all task
485
            this.color = "green";
748acd1a6   Neeraj Sharma   solve bugs in pro...
486
            this.userLoading = false;
6fe35f887   Neeraj Sharma   implement bilk im...
487
488
489
490
          })
          .catch(error => {
            this.snackbar = true;
            this.text = error.response.data.message;
748acd1a6   Neeraj Sharma   solve bugs in pro...
491
            this.userLoading = false;
f9b486fe1   Neeraj Sharma   implemrent all task
492
            this.color = "red";
6fe35f887   Neeraj Sharma   implement bilk im...
493
494
495
          });
      },
      importBook() {
748acd1a6   Neeraj Sharma   solve bugs in pro...
496
        this.BookLoading = true;
6fe35f887   Neeraj Sharma   implement bilk im...
497
498
499
500
501
502
503
504
505
        var bookfile = {};
        bookfile.bookData = this.bookFileJson;
        http()
          .post("/importBookData", bookfile, {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.snackbar = true;
            this.text = response.data.message;
f9b486fe1   Neeraj Sharma   implemrent all task
506
            this.color = "green";
748acd1a6   Neeraj Sharma   solve bugs in pro...
507
            this.BookLoading = false;
f9b486fe1   Neeraj Sharma   implemrent all task
508
509
510
511
512
          })
          .catch(error => {
            this.snackbar = true;
            this.text = error.response.data.message;
            this.color = "red";
748acd1a6   Neeraj Sharma   solve bugs in pro...
513
            this.BookLoading = false;
f9b486fe1   Neeraj Sharma   implemrent all task
514
515
516
          });
      },
      importStudent() {
748acd1a6   Neeraj Sharma   solve bugs in pro...
517
        this.studentLoading = true;
f9b486fe1   Neeraj Sharma   implemrent all task
518
        var studentfile = {};
080d88547   Shikha Mishra   issues solved
519
        console.log('this.studentFileJson', this.studentFileJson);
f9b486fe1   Neeraj Sharma   implemrent all task
520
521
522
523
524
525
526
527
528
        studentfile.studentData = this.studentFileJson;
        http()
          .post("/importStudentData", studentfile, {
            headers: { Authorization: "Bearer " + this.token }
          })
          .then(response => {
            this.snackbar = true;
            this.text = response.data.message;
            this.color = "green";
748acd1a6   Neeraj Sharma   solve bugs in pro...
529
            this.studentLoading = false;
6fe35f887   Neeraj Sharma   implement bilk im...
530
531
532
533
          })
          .catch(error => {
            this.snackbar = true;
            this.text = error.response.data.message;
f9b486fe1   Neeraj Sharma   implemrent all task
534
            this.color = "red";
748acd1a6   Neeraj Sharma   solve bugs in pro...
535
            this.studentLoading = false;
6fe35f887   Neeraj Sharma   implement bilk im...
536
          });
1c69557ac   Neeraj Sharma   implement design ...
537
538
539
      }
    },
    mounted() {
6fe35f887   Neeraj Sharma   implement bilk im...
540
      this.token = this.$store.state.token;
f9b486fe1   Neeraj Sharma   implemrent all task
541

1c69557ac   Neeraj Sharma   implement design ...
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
      /** 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;
    }
  };
6fe35f887   Neeraj Sharma   implement bilk im...
563
  </script>
68d742034   Neeraj Sharma   implement new des...
564
565
566
567
568
569
  <style>
  .card-styles {
    background: #7f62f8 !important;
    border-color: #7f62f8 !important;
  }
  </style>