Commit 068907f66022bca7e4db943693aeab11eaf27b17

Authored by Shikha Mishra
1 parent 57263a8904

improve subject ui

src/pages/Academic/subject.vue
... ... @@ -0,0 +1,793 @@
  1 +<template>
  2 + <v-container fluid class="body-color">
  3 + <!-- ****** EDIT Subject ****** -->
  4 + <v-dialog v-model="editSubjectDialog" max-width="600px">
  5 + <v-card flat class="card-style pa-2" dark>
  6 + <v-layout>
  7 + <v-flex xs12>
  8 + <label class="title text-xs-center">Edit Subject</label>
  9 + <v-icon size="24" class="right" @click="editSubjectDialog = false">cancel</v-icon>
  10 + </v-flex>
  11 + </v-layout>
  12 + <v-container fluid>
  13 + <v-form ref="formEditSubject" v-model="validEditSubject" lazy-validation>
  14 + <v-layout>
  15 + <v-flex xs4 class="pt-4 subheading">
  16 + <label class="right">Class:</label>
  17 + </v-flex>
  18 + <v-flex xs8 class="ml-3">
  19 + <v-select
  20 + v-model="editedItem.classId"
  21 + label="Select your class"
  22 + type="text"
  23 + :items="classList"
  24 + item-text="classNum"
  25 + item-value="_id"
  26 + :rules="classRules"
  27 + required
  28 + ></v-select>
  29 + </v-flex>
  30 + </v-layout>
  31 + <v-layout>
  32 + <v-flex xs4 sm4 class="pt-4 subheading">
  33 + <label class="right">Teacher Name :</label>
  34 + </v-flex>
  35 + <v-flex xs8 sm8 class="ml-3">
  36 + <v-select
  37 + v-model="editedItem.teacherId"
  38 + label="Select your teacher"
  39 + type="text"
  40 + :items="teacherList"
  41 + item-text="name"
  42 + item-value="_id"
  43 + :rules="teacherRules"
  44 + required
  45 + ></v-select>
  46 + </v-flex>
  47 + </v-layout>
  48 + <v-layout>
  49 + <v-flex xs4 sm4 class="pt-4 sybheading">
  50 + <label class="right">Type :</label>
  51 + </v-flex>
  52 + <v-flex xs8 sm8 class="ml-3">
  53 + <v-select
  54 + v-model="editedItem.type"
  55 + :items="type"
  56 + label="Select your Type"
  57 + :rules="typeRules"
  58 + required
  59 + ></v-select>
  60 + </v-flex>
  61 + </v-layout>
  62 + <v-layout>
  63 + <v-flex xs4 sm4 class="pt-4 subheading">
  64 + <label class="right">Pass Mark :</label>
  65 + </v-flex>
  66 + <v-flex xs8 sm8 class="ml-3">
  67 + <v-text-field
  68 + label="Fill your Pass Mark"
  69 + name="name"
  70 + type="text"
  71 + :rules="markRules"
  72 + v-model="editedItem.passMarks"
  73 + required
  74 + ></v-text-field>
  75 + </v-flex>
  76 + </v-layout>
  77 + <v-layout>
  78 + <v-flex xs4 sm4 class="pt-4 subheading">
  79 + <label class="right">Final Mark :</label>
  80 + </v-flex>
  81 + <v-flex xs8 sm8 class="ml-3">
  82 + <v-text-field
  83 + label="Fill your final mark"
  84 + name="name"
  85 + type="text"
  86 + :rules="finalRules"
  87 + v-model="editedItem.finalMarks"
  88 + required
  89 + ></v-text-field>
  90 + </v-flex>
  91 + </v-layout>
  92 + <v-layout>
  93 + <v-flex xs4 class="pt-4 subheading">
  94 + <label class="right">Subject:</label>
  95 + </v-flex>
  96 + <v-flex xs8 class="ml-3">
  97 + <v-text-field
  98 + placeholder="fill your Subject"
  99 + v-model="editedItem.subjectName"
  100 + :rules="subjectRules"
  101 + type="text"
  102 + name="email"
  103 + required
  104 + ></v-text-field>
  105 + </v-flex>
  106 + </v-layout>
  107 + <v-layout>
  108 + <v-flex xs4 sm4 class="pt-4 subheading">
  109 + <label class="right">Subject Author :</label>
  110 + </v-flex>
  111 + <v-flex xs8 sm8 class="ml-3">
  112 + <v-text-field
  113 + v-model="editedItem.subjectAuthor"
  114 + placeholder="fill your Subject Author"
  115 + name="name"
  116 + type="text"
  117 + ></v-text-field>
  118 + </v-flex>
  119 + </v-layout>
  120 + <v-layout>
  121 + <v-flex xs4 sm4 class="pt-4 subheading">
  122 + <label class="right">Subject Code:</label>
  123 + </v-flex>
  124 + <v-flex xs8 sm8 class="ml-3">
  125 + <v-text-field
  126 + v-model="editedItem.subjectCode"
  127 + placeholder="fill your Subject Code"
  128 + name="name"
  129 + type="text"
  130 + ></v-text-field>
  131 + </v-flex>
  132 + </v-layout>
  133 + <v-flex xs12 sm12>
  134 + <v-card-actions>
  135 + <v-spacer></v-spacer>
  136 + <v-btn round dark @click="save" :loading="editLoading" class="add-button">Update Subject</v-btn>
  137 + </v-card-actions>
  138 + </v-flex>
  139 + </v-form>
  140 + </v-container>
  141 + </v-card>
  142 + </v-dialog>
  143 +
  144 + <!-- ****** VIEW PROFIL NOTICE BOARD ****** -->
  145 +
  146 + <v-dialog v-model="viewSubjectDialog" max-width="500px">
  147 + <v-card flat class="card-style pa-3" dark>
  148 + <v-layout>
  149 + <v-flex xs12>
  150 + <label class="title text-xs-center">View Subject</label>
  151 + <v-icon size="24" class="right" @click="viewSubjectDialog = false">cancel</v-icon>
  152 + </v-flex>
  153 + </v-layout>
  154 + <v-card-text>
  155 + <v-container grid-list-md>
  156 + <v-layout wrap>
  157 + <v-flex>
  158 + <v-layout>
  159 + <v-flex xs6 sm4>
  160 + <h5 class="right my-1">
  161 + <b>Subject Name:</b>
  162 + </h5>
  163 + </v-flex>
  164 + <v-flex sm8 xs6>
  165 + <h5 class="my-1">{{ editedItem.subjectName }}</h5>
  166 + </v-flex>
  167 + </v-layout>
  168 + <v-layout>
  169 + <v-flex xs6 sm4>
  170 + <h5 class="right my-1">
  171 + <b>Subject Author:</b>
  172 + </h5>
  173 + </v-flex>
  174 + <v-flex sm8 xs6>
  175 + <h5 class="my-1">{{ editedItem.subjectAuthor }}</h5>
  176 + </v-flex>
  177 + </v-layout>
  178 + <v-layout>
  179 + <v-flex xs6 sm4>
  180 + <h5 class="right my-1">
  181 + <b>Subject :</b>
  182 + </h5>
  183 + </v-flex>
  184 + <v-flex sm8 xs6>
  185 + <h5 class="my-1">{{ editedItem.subjectCode }}</h5>
  186 + </v-flex>
  187 + </v-layout>
  188 + <!-- <v-layout>
  189 + <v-flex xs6 sm4>
  190 + <h5 class="right my-1">
  191 + <b>Teacher :</b>
  192 + </h5>
  193 + </v-flex>
  194 + <v-flex sm8 xs6>
  195 + <h5 class="my-1">{{ editedItem.teacherId }}</h5>
  196 + </v-flex>
  197 + </v-layout>-->
  198 + <v-layout>
  199 + <v-flex xs6 sm4>
  200 + <h5 class="right my-1">
  201 + <b>Pass Marks :</b>
  202 + </h5>
  203 + </v-flex>
  204 + <v-flex sm8 xs6>
  205 + <h5 class="my-1">{{ editedItem.passMarks }}</h5>
  206 + </v-flex>
  207 + </v-layout>
  208 + <v-layout>
  209 + <v-flex xs6 sm4>
  210 + <h5 class="right my-1">
  211 + <b>Final Marks :</b>
  212 + </h5>
  213 + </v-flex>
  214 + <v-flex sm8 xs6>
  215 + <h5 class="my-1">{{ editedItem.finalMarks }}</h5>
  216 + </v-flex>
  217 + </v-layout>
  218 + <v-layout>
  219 + <v-flex xs6 sm4>
  220 + <h5 class="right my-1">
  221 + <b>Type :</b>
  222 + </h5>
  223 + </v-flex>
  224 + <v-flex sm8 xs6>
  225 + <h5 class="my-1">{{ editedItem.type }}</h5>
  226 + </v-flex>
  227 + </v-layout>
  228 + </v-flex>
  229 + </v-layout>
  230 + </v-container>
  231 + </v-card-text>
  232 + </v-card>
  233 + </v-dialog>
  234 +
  235 + <!-- ****** EXISTING SUBJECTS TABLE ****** -->
  236 + <v-toolbar color="transparent" flat>
  237 + <v-btn
  238 + fab
  239 + dark
  240 + class="open-dialog-button hidden-xl-only hidden-md-only hidden-lg-only"
  241 + small
  242 + @click="addSubjectDialog = true"
  243 + >
  244 + <v-icon dark>add</v-icon>
  245 + </v-btn>
  246 + <v-flex xs1 class="hidden-sm-only hidden-xs-only">
  247 + <v-btn
  248 + round
  249 + class="open-dialog-button"
  250 + dark
  251 + @click="addSubjectDialog = true"
  252 + v-if="role != 'TEACHER' "
  253 + >
  254 + <v-icon class="white--text pr-1" size="20">add</v-icon>Add Subject
  255 + </v-btn>
  256 + </v-flex>
  257 + <v-spacer></v-spacer>
  258 + <v-flex lg2 md2 xs12 v-show="show">
  259 + <v-select
  260 + :items="classList"
  261 + label="Select Your Class"
  262 + v-model="addSubject.classId"
  263 + item-text="classNum"
  264 + item-value="_id"
  265 + name="Select Class"
  266 + :rules="classRules"
  267 + @change="getClassSubject"
  268 + class="pl-2"
  269 + required
  270 + ></v-select>
  271 + </v-flex>
  272 + <v-card-title class="body-1" v-show="show">
  273 + <v-btn icon flat @click="displaySearch">
  274 + <v-avatar size="27">
  275 + <img src="/static/icon/search.png" alt="icon" />
  276 + </v-avatar>
  277 + </v-btn>
  278 + </v-card-title>
  279 + <v-flex xs9 sm9 md2 lg2 xl2 v-show="showSearch">
  280 + <v-layout>
  281 + <v-text-field
  282 + v-model="search"
  283 + label="Search"
  284 + prepend-inner-icon="search"
  285 + color="primary"
  286 + style="transition: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); !important"
  287 + ></v-text-field>
  288 + <v-icon @click="closeSearch" color="error">close</v-icon>
  289 + </v-layout>
  290 + </v-flex>
  291 + </v-toolbar>
  292 + <v-data-table
  293 + :headers="headers"
  294 + :items="subjectList.subjects"
  295 + :pagination.sync="pagination"
  296 + :search="search"
  297 + >
  298 + <template slot="items" slot-scope="props">
  299 + <tr class="tr">
  300 + <td class="td-row td">{{ props.index + 1 }}</td>
  301 + <td class="text-xs-center td td-row">{{ props.item.subjectName }}</td>
  302 + <td class="text-xs-center td td-row">{{ props.item.subjectAuthor }}</td>
  303 + <td class="text-xs-center td td-row">{{ props.item.subjectCode }}</td>
  304 + <!-- <td class="text-xs-center td td-row">{{ props.item.teacherId }}</td> -->
  305 + <td class="text-xs-center td td-row">{{ props.item.passMarks }}</td>
  306 + <td class="text-xs-center td td-row">{{ props.item.finalMarks }}</td>
  307 + <td class="text-xs-center td td-row">{{ props.item.type }}</td>
  308 +
  309 + <td class="text-xs-center td td-row">
  310 + <span>
  311 + <!-- <v-tooltip top>
  312 + <img
  313 + slot="activator"
  314 + style="cursor:pointer; width:25px; height:25px; "
  315 + class="mr-3"
  316 + @click="profile(props.item)"
  317 + src="/static/icon/view.png"
  318 + />
  319 + <span>View</span>
  320 + </v-tooltip>-->
  321 + <v-tooltip top>
  322 + <img
  323 + slot="activator"
  324 + style="cursor:pointer; width:20px; height:18px; "
  325 + class="mr-3"
  326 + @click="editItem(props.item)"
  327 + src="/static/icon/edit.png"
  328 + />
  329 + <span>Edit</span>
  330 + </v-tooltip>
  331 + <v-tooltip top>
  332 + <img
  333 + slot="activator"
  334 + style="cursor:pointer; width:20px; height:20px; "
  335 + class="mr-3"
  336 + @click="deleteItem(props.item)"
  337 + src="/static/icon/delete.png"
  338 + />
  339 + <span>Delete</span>
  340 + </v-tooltip>
  341 + </span>
  342 + </td>
  343 + </tr>
  344 + </template>
  345 + <v-alert
  346 + slot="no-results"
  347 + :value="true"
  348 + color="error"
  349 + icon="warning"
  350 + >Your search for "{{ search }}" found no results.</v-alert>
  351 + </v-data-table>
  352 + <!-- ****** ADD MULTIPLE Subject ****** -->
  353 + <v-snackbar
  354 + :timeout="timeout"
  355 + :top="y === 'top'"
  356 + :right="x === 'right'"
  357 + :vertical="mode === 'vertical'"
  358 + v-model="snackbar"
  359 + :color="color"
  360 + >{{ text }}</v-snackbar>
  361 + <v-dialog v-model="addSubjectDialog" max-width="600px">
  362 + <v-card flat class="card-style pa-2" dark>
  363 + <v-layout>
  364 + <v-flex xs12>
  365 + <label class="title text-xs-center">Add Subject</label>
  366 + <v-icon size="24" class="right" @click="addSubjectDialog = false">cancel</v-icon>
  367 + </v-flex>
  368 + </v-layout>
  369 + <v-container fluid fill-height>
  370 + <v-layout align-center>
  371 + <v-flex xs12>
  372 + <v-form ref="form" v-model="valid" lazy-validation>
  373 + <v-layout>
  374 + <v-flex xs4 sm4 class="pt-4 subheading">
  375 + <label class="right">Class Name :</label>
  376 + </v-flex>
  377 + <v-flex xs8 sm8 class="ml-3">
  378 + <v-select
  379 + v-model="addSubject.classId"
  380 + label="Select your class"
  381 + type="text"
  382 + :items="classList"
  383 + item-text="classNum"
  384 + item-value="_id"
  385 + :rules="classRules"
  386 + required
  387 + ></v-select>
  388 + </v-flex>
  389 + </v-layout>
  390 + <v-layout>
  391 + <v-flex xs4 sm4 class="pt-4 subheading">
  392 + <label class="right">Teacher Name :</label>
  393 + </v-flex>
  394 + <v-flex xs8 sm8 class="ml-3">
  395 + <v-select
  396 + v-model="addSubject.teacherId"
  397 + label="Select your teacher"
  398 + type="text"
  399 + :items="teacherList"
  400 + item-text="name"
  401 + item-value="_id"
  402 + :rules="teacherRules"
  403 + required
  404 + ></v-select>
  405 + </v-flex>
  406 + </v-layout>
  407 + <v-layout>
  408 + <v-flex xs4 sm4 class="pt-4 sybheading">
  409 + <label class="right">Type :</label>
  410 + </v-flex>
  411 + <v-flex xs8 sm8 class="ml-3">
  412 + <v-select
  413 + v-model="addSubject.type"
  414 + :items="type"
  415 + label="Select your Type"
  416 + :rules="typeRules"
  417 + required
  418 + ></v-select>
  419 + </v-flex>
  420 + </v-layout>
  421 + <v-layout>
  422 + <v-flex xs4 sm4 class="pt-4 subheading">
  423 + <label class="right">Pass Mark :</label>
  424 + </v-flex>
  425 + <v-flex xs8 sm8 class="ml-3">
  426 + <v-text-field
  427 + label="Fill your Pass Mark"
  428 + name="name"
  429 + type="text"
  430 + :rules="markRules"
  431 + v-model="addSubject.passMarks"
  432 + required
  433 + ></v-text-field>
  434 + </v-flex>
  435 + </v-layout>
  436 + <v-layout>
  437 + <v-flex xs4 sm4 class="pt-4 subheading">
  438 + <label class="right">Final Mark :</label>
  439 + </v-flex>
  440 + <v-flex xs8 sm8 class="ml-3">
  441 + <v-text-field
  442 + label="Fill your final mark"
  443 + name="name"
  444 + type="text"
  445 + :rules="finalRules"
  446 + v-model="addSubject.finalMarks"
  447 + required
  448 + ></v-text-field>
  449 + </v-flex>
  450 + </v-layout>
  451 + <v-layout>
  452 + <v-flex xs4 sm4 class="pt-4 subheading">
  453 + <label class="right">Subject :</label>
  454 + </v-flex>
  455 + <v-flex xs8 sm8 class="ml-3">
  456 + <v-text-field
  457 + v-model="addSubject.subjectName"
  458 + placeholder="fill your Subject Name"
  459 + name="name"
  460 + type="text"
  461 + :rules="subjectRules"
  462 + required
  463 + ></v-text-field>
  464 + </v-flex>
  465 + </v-layout>
  466 + <v-layout>
  467 + <v-flex xs4 sm4 class="pt-4 subheading">
  468 + <label class="right">Subject Author :</label>
  469 + </v-flex>
  470 + <v-flex xs8 sm8 class="ml-3">
  471 + <v-text-field
  472 + v-model="addSubject.subjectAuthor"
  473 + placeholder="fill your Subject Author"
  474 + name="name"
  475 + type="text"
  476 + ></v-text-field>
  477 + </v-flex>
  478 + </v-layout>
  479 + <v-layout>
  480 + <v-flex xs4 sm4 class="pt-4 subheading">
  481 + <label class="right">Subject Code:</label>
  482 + </v-flex>
  483 + <v-flex xs8 sm8 class="ml-3">
  484 + <v-text-field
  485 + v-model="addSubject.subjectCode"
  486 + placeholder="fill your Subject Code"
  487 + name="name"
  488 + type="text"
  489 + ></v-text-field>
  490 + </v-flex>
  491 + </v-layout>
  492 + <v-layout>
  493 + <v-flex xs12 sm12>
  494 + <v-card-actions>
  495 + <v-spacer></v-spacer>
  496 + <v-btn
  497 + @click="submit"
  498 + round
  499 + dark
  500 + :loading="addLoading"
  501 + class="add-button"
  502 + >Add Subject</v-btn>
  503 + </v-card-actions>
  504 + </v-flex>
  505 + </v-layout>
  506 + </v-form>
  507 + </v-flex>
  508 + </v-layout>
  509 + </v-container>
  510 + </v-card>
  511 + </v-dialog>
  512 + <div class="loader" v-if="showLoader">
  513 + <v-progress-circular indeterminate color="white"></v-progress-circular>
  514 + </div>
  515 + </v-container>
  516 +</template>
  517 +
  518 +<script>
  519 +import http from "@/Services/http.js";
  520 +import Util from "@/util";
  521 +
  522 +export default {
  523 + data: () => ({
  524 + snackbar: false,
  525 + y: "top",
  526 + x: "right",
  527 + role: "",
  528 + mode: "",
  529 + timeout: 3000,
  530 + text: "",
  531 + color: "",
  532 + show: true,
  533 + showSearch: false,
  534 + showLoader: false,
  535 + loading: false,
  536 + editLoading: false,
  537 + addLoading: false,
  538 + date: null,
  539 + search: "",
  540 + viewSubjectDialog: false,
  541 + editSubjectDialog: false,
  542 + valid: true,
  543 + validEditSubject: true,
  544 + addSubjectDialog: false,
  545 + // isActive: true,
  546 + // newActive: false,
  547 + type: ["Optional", "Mandatory"],
  548 + pagination: {
  549 + rowsPerPage: 10
  550 + },
  551 + token: "",
  552 + classRules: [v => !!v || " Class Name is required"],
  553 + teacherRules: [v => !!v || " Teacher Name is required"],
  554 + typeRules: [v => !!v || "Type is required"],
  555 + markRules: [v => !!v || " Pass Mark is required"],
  556 + finalRules: [v => !!v || "Final MArk is required"],
  557 + subjectRules: [v => !!v || " Subject Name is required"],
  558 + headers: [
  559 + {
  560 + text: "No",
  561 + align: "",
  562 + sortable: false,
  563 + value: "No"
  564 + },
  565 + {
  566 + text: "Subject Name",
  567 + value: "subjectName",
  568 + sortable: false,
  569 + align: "center"
  570 + },
  571 + {
  572 + text: "Subject Author",
  573 + value: "subjectAuthor",
  574 + sortable: false,
  575 + align: "center"
  576 + },
  577 + {
  578 + text: "Subject Code",
  579 + value: "subjectCode",
  580 + sortable: false,
  581 + align: "center"
  582 + },
  583 + // {
  584 + // text: "Teacher",
  585 + // value: "teacherId",
  586 + // sortable: false,
  587 + // align: "center"
  588 + // },
  589 + {
  590 + text: "Pass Marks",
  591 + value: "passMarks",
  592 + sortable: false,
  593 + align: "center"
  594 + },
  595 + {
  596 + text: "Final Marks",
  597 + value: "finalMarks",
  598 + sortable: false,
  599 + align: "center"
  600 + },
  601 + {
  602 + text: "Type",
  603 + value: "type",
  604 + sortable: false,
  605 + align: "center"
  606 + },
  607 + { text: "Action", value: "", sortable: false, align: "center" }
  608 + ],
  609 + subjectList: [],
  610 + classList: [],
  611 + teacherList: [],
  612 + editedIndex: -1,
  613 + addSubject: {},
  614 +
  615 + editedItem: {
  616 + // subjectName: "",
  617 + // subjectAuthor: ""
  618 + }
  619 + }),
  620 + methods: {
  621 + pickFile() {
  622 + this.$refs.image.click();
  623 + },
  624 + editItem(item) {
  625 + this.editedIndex = this.subjectList.subjects;
  626 + this.editedItem = Object.assign({}, item);
  627 + this.dialog = true;
  628 + this.editSubjectDialog = true;
  629 + },
  630 + profile(item) {
  631 + this.editedIndex = this.subjectList.subjects;
  632 + this.editedItem = Object.assign({}, item);
  633 + this.dialog1 = true;
  634 + this.viewSubjectDialog = true;
  635 + },
  636 + deleteItem(item) {
  637 + let deleteSubject = {
  638 + classId: this.addSubject.classId,
  639 + subjectId: item._id
  640 + };
  641 + http()
  642 + .delete(
  643 + "/deleteSubject",
  644 + confirm("Are you sure you want to delete this?") && {
  645 + params: deleteSubject
  646 + }
  647 + )
  648 + .then(response => {
  649 + this.snackbar = true;
  650 + this.color = "green";
  651 + this.text = "Successfully delete Existing Subject";
  652 + this.getClassSubject(this.addSubject.classId);
  653 + })
  654 + .catch(error => {
  655 + // this.snackbar = true;
  656 + // this.text = error.response.data.message;
  657 + // this.color = "error";
  658 + console.log("error", error);
  659 + });
  660 + },
  661 + close() {
  662 + this.editSubjectDialog = false;
  663 + },
  664 + close1() {
  665 + this.viewSubjectDialog = false;
  666 + },
  667 + submit() {
  668 + if (this.$refs.form.validate()) {
  669 + this.addLoading = true;
  670 + http()
  671 + .post("/addSubject", this.addSubject)
  672 + .then(response => {
  673 + this.snackbar = true;
  674 + this.text = "New Subject added successfully";
  675 + this.color = "green";
  676 + this.addLoading = false;
  677 + this.addSubjectDialog = false;
  678 + this.getClassSubject(_id);
  679 + })
  680 + .catch(error => {
  681 + this.addLoading = false;
  682 + });
  683 + }
  684 + },
  685 + clear() {
  686 + this.$refs.form.reset();
  687 + },
  688 + save() {
  689 + if (this.$refs.formEditSubject.validate()) {
  690 + let editSubject = {
  691 + classId: this.editedItem.classId,
  692 + subjectId: this.editedItem._id,
  693 + teacherId: this.editedItem.teacherId,
  694 + type: this.editedItem.type,
  695 + passMarks: this.editedItem.passMarks,
  696 + finalMarks: this.editedItem.finalMarks,
  697 + subjectAuthor: this.editedItem.subjectAuthor,
  698 + subjectCode: this.editedItem.subjectCode,
  699 + subjectName: this.editedItem.subjectName
  700 + };
  701 + this.editLoading = true;
  702 + http()
  703 + .put("/updateSubject", editSubject)
  704 + .then(response => {
  705 + this.snackbar = true;
  706 + this.text = "Successfully Edit Existing Subject";
  707 + this.color = "green";
  708 + this.editLoading = false;
  709 + this.editSubjectDialog = false;
  710 + this.getClassSubject(this.editedItem.classId);
  711 + })
  712 + .catch(error => {
  713 + this.editLoading = false;
  714 +
  715 + // console.log(error);
  716 + });
  717 + }
  718 + },
  719 + getClassSubject(_id) {
  720 + this.showLoader = true;
  721 + console.log("class", _id);
  722 + // this.classId = this.classId;
  723 + http()
  724 + .get(
  725 + "/getParticularClass",
  726 + { params: { classId: _id } },
  727 + {
  728 + headers: { Authorization: "Bearer " + this.token }
  729 + }
  730 + )
  731 + .then(response => {
  732 + this.subjectList = response.data.data;
  733 + this.showLoader = false;
  734 + })
  735 + .catch(err => {
  736 + this.showLoader = false;
  737 + });
  738 + },
  739 + getClass() {
  740 + http()
  741 + .get("/getClassesList", {
  742 + headers: { Authorization: "Bearer " + this.token }
  743 + })
  744 + .then(response => {
  745 + this.classList = response.data.data;
  746 + })
  747 + .catch(error => {
  748 + if (error.response.status === 401) {
  749 + this.$router.replace({ path: "/" });
  750 + this.$store.dispatch("setToken", null);
  751 + this.$store.dispatch("Id", null);
  752 + }
  753 + });
  754 + },
  755 + getTeacherList() {
  756 + this.showLoader = true;
  757 + var token = this.$store.state.token;
  758 + http()
  759 + .get("/getTeachersList", {
  760 + headers: { Authorization: "Bearer " + token }
  761 + })
  762 + .then(response => {
  763 + this.teacherList = response.data.data;
  764 + this.showLoader = false;
  765 + // console.log("getTeacherList=====>",this.desserts)
  766 + })
  767 + .catch(error => {
  768 + this.showLoader = false;
  769 + if (error.response.status === 401) {
  770 + this.$router.replace({ path: "/" });
  771 + this.$store.dispatch("setToken", null);
  772 + this.$store.dispatch("Id", null);
  773 + }
  774 + });
  775 + },
  776 + displaySearch() {
  777 + (this.show = false), (this.showSearch = true);
  778 + },
  779 + closeSearch() {
  780 + this.showSearch = false;
  781 + this.show = true;
  782 + this.search = "";
  783 + }
  784 + },
  785 + mounted() {
  786 + this.token = this.$store.state.token;
  787 + // this.getNoticeDataList();
  788 + this.getClass();
  789 + this.getTeacherList();
  790 + this.role = this.$store.state.role;
  791 + }
  792 +};
  793 +</script>
0 794 \ No newline at end of file
... ...
src/router/paths.js
... ... @@ -201,18 +201,18 @@ export default [{
201 201 `@/pages/Parent/parents.vue`
202 202 )
203 203 },
204   - {
205   - path: '/subject',
206   - meta: {},
207   - name: 'Subject',
208   - props: (route) => ({ type: route.query.type }),
209   - component: () =>
210   - import (
211   - /* webpackChunkName: "routes" */
212   - /* webpackMode: "lazy-once" */
213   - `@/pages/Subjects/subjects.vue`
214   - )
215   - },
  204 + // {
  205 + // path: '/subject',
  206 + // meta: {},
  207 + // name: 'Subject',
  208 + // props: (route) => ({ type: route.query.type }),
  209 + // component: () =>
  210 + // import (
  211 + // /* webpackChunkName: "routes" */
  212 + // /* webpackMode: "lazy-once" */
  213 + // `@/pages/Subjects/subjects.vue`
  214 + // )
  215 + // },
216 216 {
217 217 path: '/dashboard',
218 218 meta: {},
... ...