Commit add6421d55951776a8edf5c86d5ac309e0acf509

Authored by Shikha Mishra
1 parent d10c266324

Improve updateCourseDetail API and improve design in course detail screen

src/pages/Course/courseDetail.vue
... ... @@ -421,73 +421,77 @@
421 421 </v-dialog>
422 422  
423 423 <!-- ****** Course Detail TABLE ****** -->
424   - <v-container grid-list-lg class="pa-0">
425   - <v-layout row wrap>
426   - <!-- <v-btn
427   - fab
428   - dark
429   - class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only"
430   - small
431   - @click="addCourseDetailDialog = true"
432   - >
433   - <v-icon dark>add</v-icon>
434   - </v-btn>-->
435   - <v-flex xs12 sm4>
436   - <v-btn block round class="open-dialog-button" dark @click="addCourseDetailDialog = true">
437   - <v-icon class="white--text pr-1" size="20">add</v-icon>
  424 + <v-toolbar color="transparent" flat>
  425 + <!-- <v-flex xs1>
  426 + <v-btn round class="open-dialog-button" dark @click="addCourseDetailDialog = true">
  427 + <v-icon size="20">add</v-icon>
438 428 <span class="hidden-sm-and-down">Add Course Detail</span>
439 429 <span class="hidden-md-and-up">Add</span>
440 430 </v-btn>
441   - </v-flex>
  431 + </v-flex>-->
  432 + <v-btn
  433 + fab
  434 + dark
  435 + class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only"
  436 + small
  437 + @click="addCourseDetailDialog = true"
  438 + >
  439 + <v-icon dark>add</v-icon>
  440 + </v-btn>
  441 + <v-flex xs1 class="hidden-sm-only hidden-xs-only">
  442 + <v-btn round class="open-dialog-button" dark @click="addCourseDetailDialog = true">
  443 + <v-icon class="white--text pr-1" size="20">add</v-icon>Add Course Detail
  444 + </v-btn>
  445 + </v-flex>
  446 + <v-spacer></v-spacer>
  447 + <v-flex xs12 sm4 md2>
  448 + <v-select
  449 + :items="addclass"
  450 + label="Select Class"
  451 + v-model="getCourse.classId"
  452 + item-text="classNum"
  453 + item-value="_id"
  454 + name="Select Class"
  455 + @change="getCourses(getCourse.classId)"
  456 + required
  457 + ></v-select>
  458 + </v-flex>
  459 + <v-flex xs12 sm4 md2 class="ml-2">
  460 + <v-select
  461 + :items="courseData"
  462 + label="Select Course"
  463 + v-model="getCourse.courseId"
  464 + item-text="courseName"
  465 + item-value="_id"
  466 + required
  467 + @change="getCourseDetailsList(getCourse.courseId)"
  468 + ></v-select>
  469 + </v-flex>
442 470  
443   - <v-flex xs12 sm4 md2>
444   - <v-select
445   - :items="addclass"
446   - label="Select Class"
447   - v-model="getCourse.classId"
448   - item-text="classNum"
449   - item-value="_id"
450   - name="Select Class"
451   - @change="getCourses(getCourse.classId)"
452   - required
453   - ></v-select>
454   - </v-flex>
455   - <v-flex xs12 sm4 md2>
456   - <v-select
457   - :items="courseData"
458   - label="Select Course"
459   - v-model="getCourse.courseId"
460   - item-text="courseName"
461   - item-value="_id"
462   - required
463   - @change="getCourseDetailsList(getCourse.courseId)"
464   - ></v-select>
465   - </v-flex>
  471 + <v-flex xs12 sm1 v-if="show">
  472 + <v-btn icon large flat @click="show = false;showSearch = true;">
  473 + <v-avatar size="27">
  474 + <img src="/static/icon/search.png" alt="icon" />
  475 + </v-avatar>
  476 + </v-btn>
  477 + </v-flex>
466 478  
467   - <v-flex xs12 sm1 v-if="show">
468   - <v-btn icon large flat @click="show = false;showSearch = true;">
469   - <v-avatar size="27">
470   - <img src="/static/icon/search.png" alt="icon" />
471   - </v-avatar>
472   - </v-btn>
473   - </v-flex>
  479 + <v-flex xs12 sm3 md3 v-if="showSearch" class="ml-2">
  480 + <div style="display: inline-block;width: 70%;">
  481 + <v-text-field
  482 + autofocus
  483 + v-model="search"
  484 + label="Search"
  485 + prepend-inner-icon="search"
  486 + color="primary"
  487 + ></v-text-field>
  488 + </div>
  489 + <div style="display: inline-block;">
  490 + <v-icon @click="closeSearch" color="error">close</v-icon>
  491 + </div>
  492 + </v-flex>
  493 + </v-toolbar>
474 494  
475   - <v-flex xs12 sm3 md3 v-if="showSearch">
476   - <div style="display: inline-block;width: 70%;">
477   - <v-text-field
478   - autofocus
479   - v-model="search"
480   - label="Search"
481   - prepend-inner-icon="search"
482   - color="primary"
483   - ></v-text-field>
484   - </div>
485   - <div style="display: inline-block;">
486   - <v-icon @click="closeSearch" color="error">close</v-icon>
487   - </div>
488   - </v-flex>
489   - </v-layout>
490   - </v-container>
491 495 <v-data-table
492 496 :headers="headers"
493 497 :items="CourseDetailsList"
... ... @@ -1127,8 +1131,8 @@ export default {
1127 1131 save() {
1128 1132 var updateData = {
1129 1133 courseDetailId: this.editedCourse._id,
1130   - courseId: this.editedCourse.courseId,
1131   - classId: this.editedCourse.classId,
  1134 + courseId: this.editedCourse.courseId._id,
  1135 + classId: this.editedCourse.classId._id,
1132 1136 };
1133 1137 this.editLoading = true;
1134 1138 http()
... ...
src/pages/Report/admitCard.vue
... ... @@ -83,7 +83,6 @@
83 83 v-model="getReport.form"
84 84 item-text="name"
85 85 item-value="value"
86   -
87 86 required
88 87 ></v-autocomplete>
89 88 </v-flex>
... ... @@ -142,7 +141,7 @@
142 141 <p
143 142 style="font-size:24px;color: #700CE8;letter-spacing:1px;margin-bottom: 4px"
144 143 >{{ userData.name }}</p>
145   - <p>{{ userData.address }}, {{ userData.pinCode }}</p>
  144 + <p>{{ userData.address }} {{ userData.pinCode }}</p>
146 145 <div>
147 146 <h4>{{ getScheduleList.scheduleData[0].examId.examName }} Exam Admit Card</h4>
148 147 </div>
... ... @@ -157,18 +156,18 @@
157 156 v-if="!getScheduleList.studentData.profilePicUrl"
158 157 src="/static/icon/user.png"
159 158 style="widht:80px;"
160   - /> -->
  159 + />-->
161 160 <img
162   - src="/static/icon/user.png"
163   - v-if="!getScheduleList.studentData.profilePicUrl"
164   - width="80"
165   - />
166   - <img
167   - :src="getScheduleList.studentData.profilePicUrl"
168   - onerror="this.src='/static/icon/user.png';"
169   - v-if="getScheduleList.studentData.profilePicUrl"
170   - width="80"
171   - />
  161 + src="/static/icon/user.png"
  162 + v-if="!getScheduleList.studentData.profilePicUrl"
  163 + width="80"
  164 + />
  165 + <img
  166 + :src="getScheduleList.studentData.profilePicUrl"
  167 + onerror="this.src='/static/icon/user.png';"
  168 + v-if="getScheduleList.studentData.profilePicUrl"
  169 + width="80"
  170 + />
172 171 </v-flex>
173 172 </v-layout>
174 173 <v-layout>
... ... @@ -378,15 +377,15 @@ export default {
378 377 showTable: false,
379 378 showData: false,
380 379 hideprintAdmitReport: false,
381   - examRules: [v => !!v || "Exam Field is required"],
382   - classRules: [v => !!v || "Class Field Required"],
383   - sectionRules: [v => !!v || "Section Field is required"],
384   - studentRules: [v => !!v || "Student Field is required"],
385   - typeRules: [v => !!v || "Type Field is required"],
386   - backgroundRules: [v => !!v || "Background Field is required"],
  380 + examRules: [(v) => !!v || "Exam Field is required"],
  381 + classRules: [(v) => !!v || "Class Field Required"],
  382 + sectionRules: [(v) => !!v || "Section Field is required"],
  383 + studentRules: [(v) => !!v || "Student Field is required"],
  384 + typeRules: [(v) => !!v || "Type Field is required"],
  385 + backgroundRules: [(v) => !!v || "Background Field is required"],
387 386  
388 387 pagination: {
389   - rowsPerPage: 10
  388 + rowsPerPage: 10,
390 389 },
391 390 search: "",
392 391  
... ... @@ -403,12 +402,12 @@ export default {
403 402 typeList: [
404 403 {
405 404 name: "Front Part",
406   - value: "frontPart"
  405 + value: "frontPart",
407 406 },
408 407 {
409 408 name: "Back Part",
410   - value: "backPart"
411   - }
  409 + value: "backPart",
  410 + },
412 411 ],
413 412 backgroundList: ["Yes", "No"],
414 413 headers: [
... ... @@ -416,33 +415,33 @@ export default {
416 415 text: "No",
417 416 align: "",
418 417 sortable: false,
419   - value: "No"
  418 + value: "No",
420 419 },
421 420 {
422 421 text: "Exam Date",
423 422 align: "center",
424 423 sortable: false,
425   - value: "date"
  424 + value: "date",
426 425 },
427 426 {
428 427 text: "Start Time",
429 428 align: "center",
430 429 sortable: false,
431   - value: "timeFrom"
  430 + value: "timeFrom",
432 431 },
433 432 {
434 433 text: "End Time",
435 434 align: "center",
436 435 sortable: false,
437   - value: "timeTo"
  436 + value: "timeTo",
438 437 },
439 438 {
440 439 text: "Subject Name",
441 440 align: "center",
442 441 sortable: false,
443   - value: "subjectName"
444   - }
445   - ]
  442 + value: "subjectName",
  443 + },
  444 + ],
446 445 }),
447 446  
448 447 mounted() {
... ... @@ -458,14 +457,14 @@ export default {
458 457 this.loadingSearch = true;
459 458 http()
460 459 .get("/getExamsList", {
461   - headers: { Authorization: "Bearer " + this.token }
  460 + headers: { Authorization: "Bearer " + this.token },
462 461 })
463   - .then(response => {
  462 + .then((response) => {
464 463 this.examData = response.data.data;
465 464 this.showLoader = false;
466 465 this.loadingSearch = false;
467 466 })
468   - .catch(error => {
  467 + .catch((error) => {
469 468 this.showLoader = false;
470 469 this.loadingSearch = false;
471 470 this.snackbar = true;
... ... @@ -481,13 +480,13 @@ export default {
481 480 this.showLoader = true;
482 481 http()
483 482 .get("/getClassesList", {
484   - headers: { Authorization: "Bearer " + this.token }
  483 + headers: { Authorization: "Bearer " + this.token },
485 484 })
486   - .then(response => {
  485 + .then((response) => {
487 486 this.classList = response.data.data;
488 487 this.showLoader = false;
489 488 })
490   - .catch(error => {
  489 + .catch((error) => {
491 490 this.showLoader = false;
492 491 // console.log("err====>", err);
493 492 });
... ... @@ -499,14 +498,14 @@ export default {
499 498 "/getSectionsList",
500 499 { params: { classId: _id } },
501 500 {
502   - headers: { Authorization: "Bearer " + this.token }
  501 + headers: { Authorization: "Bearer " + this.token },
503 502 }
504 503 )
505   - .then(response => {
  504 + .then((response) => {
506 505 this.addSection = response.data.data;
507 506 this.showLoader = false;
508 507 })
509   - .catch(err => {
  508 + .catch((err) => {
510 509 this.showLoader = false;
511 510 // console.log("err====>", err);
512 511 });
... ... @@ -517,14 +516,14 @@ export default {
517 516 .get("/getStudentWithClass", {
518 517 params: {
519 518 classId: this.getReport.classId,
520   - sectionId: this.getReport.sectionId
521   - }
  519 + sectionId: this.getReport.sectionId,
  520 + },
522 521 })
523   - .then(response => {
  522 + .then((response) => {
524 523 this.getStudentsList = response.data.data;
525 524 this.showLoader = false;
526 525 })
527   - .catch(error => {
  526 + .catch((error) => {
528 527 console.log("err====>", error);
529 528 this.showLoader = false;
530 529 });
... ... @@ -538,16 +537,16 @@ export default {
538 537 examId: this.getReport.examId,
539 538 classId: this.getReport.classId,
540 539 sectionId: this.getReport.sectionId,
541   - studentId: this.getReport.studentId
542   - }
  540 + studentId: this.getReport.studentId,
  541 + },
543 542 })
544   - .then(response => {
  543 + .then((response) => {
545 544 this.showTable = true;
546 545 this.getScheduleList = response.data.data;
547 546 if (response.data.data.scheduleData.length === 0) {
548 547 this.showLoader = false;
549 548 this.snackbar = true;
550   - this.text = 'Data not found!';
  549 + this.text = "Data not found!";
551 550 this.color = "error";
552 551 return;
553 552 }
... ... @@ -562,7 +561,7 @@ export default {
562 561 }
563 562 this.showLoader = false;
564 563 })
565   - .catch(error => {
  564 + .catch((error) => {
566 565 this.showLoader = false;
567 566 });
568 567 }
... ... @@ -575,17 +574,17 @@ export default {
575 574 getUserData() {
576 575 http()
577 576 .get("/getParticularUserDetail")
578   - .then(response => {
  577 + .then((response) => {
579 578 this.userData = response.data.data;
580 579 })
581   - .catch(error => {
  580 + .catch((error) => {
582 581 if (error.response.status === 401) {
583 582 this.$router.replace({ path: "/" });
584 583 this.$store.dispatch("setToken", null);
585 584 this.$store.dispatch("Id", null);
586 585 }
587 586 });
588   - }
  587 + },
589 588 // created() {
590 589 // this.$root.$on("app:search", search => {
591 590 // this.search = search;
... ... @@ -595,7 +594,7 @@ export default {
595 594 // // dont forget to remove the listener
596 595 // this.$root.$off("app:search");
597 596 // }
598   - }
  597 + },
599 598 };
600 599 </script>
601 600 <style>
... ...