Commit 76f4f9c781bb07e672274fb1e07915a9c74ee372

Authored by Neeraj Sharma
1 parent 05b51389ce

all api add in section Page and Time Table and other changes

src/Services/http.js
... ... @@ -3,7 +3,7 @@ import store from '@/store/store'
3 3  
4 4 export default () => {
5 5 return axios.create({
6   - baseURL:'http://192.168.2.221:3002/v1',
  6 + baseURL:'http://192.168.4.220:3002/v1',
7 7 headers: {
8 8 Authorization: `Bearer ${store.state.token}`
9 9 }
... ...
src/pages/Section/section.vue
... ... @@ -0,0 +1,707 @@
  1 +<template>
  2 +<v-app id="pages-dasboard">
  3 + <v-toolbar
  4 + class="fixcolors"
  5 + fixed
  6 + app
  7 + >
  8 + <v-toolbar-title class="ml-0 pl-3">
  9 + <v-toolbar-side-icon @click.stop="handleDrawerToggle" class="hide"></v-toolbar-side-icon>
  10 + </v-toolbar-title>
  11 +<!-- ****** SEARCH ALL EXISTING SECTION ****** -->
  12 + <v-flex xs7 sm3 class="userSearch">
  13 + <v-text-field
  14 + flat
  15 + append-icon="search"
  16 + label="Find your Teachers"
  17 + v-model="search"
  18 + color="white"
  19 + dark
  20 + >
  21 + </v-text-field>
  22 + </v-flex>
  23 + <v-spacer></v-spacer>
  24 + <v-menu offset-y origin="center center" :nudge-bottom="10" transition="scale-transition">
  25 + <v-btn icon large flat slot="activator">
  26 + <v-avatar size="40px">
  27 + <img src="/static/icon/user.png"/>
  28 + </v-avatar>
  29 + </v-btn>
  30 + <v-list class="pa-0">
  31 + <v-list-tile v-for="(item,index) in items" :to="!item.href ? { name: item.name } : null" :href="item.href" @click="item.click" ripple="ripple" :disabled="item.disabled" :target="item.target" rel="noopener" :key="index">
  32 + <v-list-tile-action v-if="item.icon">
  33 + <v-icon>{{ item.icon }}</v-icon>
  34 + </v-list-tile-action>
  35 + <v-list-tile-content>
  36 + <v-list-tile-title>{{ item.title }}</v-list-tile-title>
  37 + </v-list-tile-content>
  38 + </v-list-tile>
  39 + </v-list>
  40 + </v-menu>
  41 + </v-toolbar>
  42 + <v-tabs grow slider-color="black">
  43 + <v-tab
  44 + ripple
  45 + @click="activeTab('existing')"
  46 + v-bind:class="{ active: isActive }"
  47 + id="tab"
  48 + class="subheading"
  49 + >Existing Section</v-tab>
  50 + <v-tab
  51 + ripple
  52 + @click="activeTab('new')"
  53 + v-bind:class="{ active: newActive }"
  54 + id="tab1"User
  55 + class="subheading"
  56 + >Add New Section</v-tab>
  57 +
  58 +<!-- ****** EDIT SECTION ****** -->
  59 + <v-tab-item>
  60 + <v-snackbar
  61 + :timeout="timeout"
  62 + :top="y === 'top'"
  63 + :right="x === 'right'"
  64 + :vertical="mode === 'vertical'"
  65 + v-model="snackbar"
  66 + color="success"
  67 + >{{ text }}</v-snackbar>
  68 + <v-dialog v-model="dialog" max-width="500px">
  69 + <v-toolbar color="white">
  70 + <v-spacer></v-spacer>
  71 + <v-toolbar-title>Edit Section</v-toolbar-title>
  72 + <v-spacer></v-spacer>
  73 + </v-toolbar>
  74 + <v-card>
  75 + <v-card-text>
  76 + <v-container>
  77 + <v-layout wrap justify-center>
  78 + <v-flex xs12 sm9>
  79 + <v-form ref="forms" v-model="validEdit" lazy-validation>
  80 + <v-layout style="position:relative;">
  81 + <v-flex xs4 class="pt-4 subheading">
  82 + <label>Class Name:</label>
  83 + </v-flex>
  84 + <v-flex xs8>
  85 + <v-autocomplete
  86 + :items="addclass"
  87 + :label="editedItem.classData.classNum"
  88 + v-model="select"
  89 + item-text="classNum"
  90 + :rules="classRules"
  91 + item-value="_id"
  92 + name="Select Class"
  93 + ></v-autocomplete>
  94 + </v-flex>
  95 + </v-layout>
  96 + <v-layout style="position:relative;">
  97 + <v-flex xs4 class="pt-4 subheading">
  98 + <label>Section Name:</label>
  99 + </v-flex>
  100 + <v-flex xs8>
  101 + <v-text-field
  102 + v-model="editedItem.name"
  103 + placeholder="fill your Section Name"
  104 + type="text"
  105 + required
  106 + ></v-text-field>
  107 + </v-flex>
  108 +
  109 + </v-layout>
  110 + <v-card-actions>
  111 + <v-btn round dark @click.native="close">Cancel</v-btn>
  112 + <v-spacer></v-spacer>
  113 + <v-btn round dark @click="save">Save</v-btn>
  114 + </v-card-actions>
  115 + </v-form>
  116 + </v-flex>
  117 + </v-layout>
  118 + </v-container>
  119 + </v-card-text>
  120 + </v-card>
  121 + </v-dialog>
  122 +
  123 +<!-- ****** PROFILE VIEW SECTION DATA ****** -->
  124 +
  125 + <v-dialog v-model="dialog1" max-width="600px">
  126 + <v-toolbar color="white">
  127 + <v-spacer></v-spacer>
  128 + <v-toolbar-title>Section</v-toolbar-title>
  129 + <v-spacer></v-spacer>
  130 + <v-icon @click="close1">close</v-icon>
  131 + </v-toolbar>
  132 + <v-card>
  133 + <v-flex align-center justify-center layout text-xs-center>
  134 + <v-avatar size="50px" style="position:absolute; top:20px;">
  135 + <img src="/static/icon/user.png">
  136 + </v-avatar>
  137 + </v-flex>
  138 + <v-card-text>
  139 + <v-container grid-list-md>
  140 + <v-layout wrap>
  141 + <v-flex><br><br>
  142 + <v-layout>
  143 + <v-flex xs5 sm6>
  144 + <h5 class="right my-1">Class Name:</h5>
  145 + </v-flex>
  146 + <v-flex sm6 xs8>
  147 + <h5 class="my-1">{{ editedItem.classData.classNum }}</h5>
  148 + </v-flex>
  149 + </v-layout>
  150 + <v-layout>
  151 + <v-flex xs5 sm6>
  152 + <h5 class="right my-1">Section Name:</h5>
  153 + </v-flex>
  154 + <v-flex sm6 xs8>
  155 + <h5 class="my-1">{{ editedItem.name }}</h5>
  156 + </v-flex>
  157 + </v-layout>
  158 + </v-flex>
  159 + </v-layout>
  160 + </v-container>
  161 + </v-card-text>
  162 + </v-card>
  163 + </v-dialog>
  164 +
  165 + <v-snackbar
  166 + :timeout="timeout"
  167 + :top="y === 'top'"
  168 + :right="x === 'right'"
  169 + :vertical="mode === 'vertical'"
  170 + v-model="snackbar"
  171 + color="success"
  172 + >{{ text }}</v-snackbar>
  173 +
  174 +<!-- ****** EXISTING-USERS StudentS Table ****** -->
  175 +
  176 + <v-data-table
  177 + :headers="headers"
  178 + :items="desserts"
  179 + :pagination.sync="pagination"
  180 + :search="search"
  181 + >
  182 + <template slot="items" slot-scope="props">
  183 + <td id="td" class="text-xs-center">{{ props.index}}</td>
  184 + <td id="td" class="text-xs-center">{{ props.item.classData.classNum}}</td>
  185 + <td id="td" class="text-xs-center">{{ props.item.name}}</td>
  186 + <td class="text-xs-center">
  187 + <span>
  188 + <img
  189 + style="cursor:pointer; width:25px; height:18px; "
  190 + class="mr-5"
  191 + @click="profile(props.item)"
  192 + src="/static/icon/eye1.png"
  193 + >
  194 + <img
  195 + style="cursor:pointer; width:20px; height:18px; "
  196 + class="mr-5"
  197 + @click="editItem(props.item)"
  198 + src="/static/icon/edit1.png"
  199 + >
  200 + <img
  201 + style="cursor:pointer; height:20px; "
  202 + class="mr-5"
  203 + @click="deleteItem(props.item)"
  204 + src="/static/icon/delete1.png"
  205 + >
  206 + </span>
  207 + </td>
  208 + </template>
  209 + <v-alert
  210 + slot="no-results"
  211 + :value="true"
  212 + color="error"
  213 + icon="warning"
  214 + >Your search for "{{ search }}" found no results.</v-alert>
  215 + </v-data-table>
  216 + </v-tab-item>
  217 +
  218 +<!-- ****** ADD multiple Students ****** -->
  219 +
  220 + <v-tab-item>
  221 + <v-container>
  222 + <v-snackbar
  223 + :timeout="timeout"
  224 + :top="y === 'top'"
  225 + :right="x === 'right'"
  226 + :vertical="mode === 'vertical'"
  227 + v-model="snackbar"
  228 + color="success"
  229 + >{{ text }}</v-snackbar>
  230 + <v-flex xs12 sm8 offset-sm2 class="top">
  231 + <v-card flat>
  232 + <v-container fluid fill-height>
  233 + <v-layout align-center>
  234 + <v-flex xs12>
  235 + <v-flex offset-xs5>
  236 + <v-avatar size="55px">
  237 + <img src="/static/icon/user.png">
  238 + </v-avatar>
  239 + </v-flex>
  240 + <v-form ref="form" v-model="valid" lazy-validation>
  241 + <v-layout>
  242 + <v-flex xs4 class="pt-4 subheading">
  243 + <label class="right">Section Name:</label>
  244 + </v-flex>
  245 + <v-flex xs6 class="ml-3">
  246 + <v-text-field
  247 + v-model="editedItem.name"
  248 + placeholder="fill your Section Name"
  249 + name="name"
  250 + type="text"
  251 + :rules="nameRules"
  252 + required
  253 + ></v-text-field>
  254 + </v-flex>
  255 + </v-layout>
  256 + <v-layout>
  257 + <v-flex xs4 class="pt-4 subheading">
  258 + <label class="right">Select Class:</label>
  259 + </v-flex>
  260 + <v-flex xs6 class="ml-3">
  261 + <v-autocomplete
  262 + :items="addclass"
  263 + label="Select Class"
  264 + v-model="select"
  265 + item-text="classNum"
  266 + item-value="_id"
  267 + name="Select Class"
  268 + :rules="classRules"
  269 + required
  270 + ></v-autocomplete>
  271 + </v-flex>
  272 + </v-layout>
  273 + <v-layout>
  274 + <v-flex xs4 class="pt-4 subheading">
  275 + <label class="right">Session:</label>
  276 + </v-flex>
  277 + <v-flex xs6 class="ml-3">
  278 + <v-text-field
  279 + v-model="editedItem.session"
  280 + placeholder="fill your Session"
  281 + name="name"
  282 + type="text"
  283 + :rules="sessionRules"
  284 + required
  285 + ></v-text-field>
  286 + </v-flex>
  287 + </v-layout>
  288 + <v-layout>
  289 + <v-flex xs12 sm9 offset-sm2>
  290 + <v-card-actions>
  291 + <v-btn @click="clear" round dark>clear</v-btn>
  292 + <v-spacer></v-spacer>
  293 + <v-btn @click="submit" round dark :loading="loading">Add</v-btn>
  294 + </v-card-actions>
  295 + </v-flex>
  296 + </v-layout>
  297 + </v-form>
  298 + </v-flex>
  299 + </v-layout>
  300 + </v-container>
  301 + </v-card>
  302 + </v-flex>
  303 + </v-container>
  304 + </v-tab-item>
  305 + </v-tabs>
  306 + <div class="loader" v-if="showLoader">
  307 + <v-progress-circular indeterminate color="white"></v-progress-circular>
  308 + </div>
  309 +</v-app>
  310 +</template>
  311 +
  312 +<script>
  313 +import http from "@/Services/http.js";
  314 +import Util from "@/util";
  315 +
  316 +export default {
  317 + data: () => ({
  318 + snackbar: false,
  319 + y: "top",
  320 + x: "right",
  321 + mode: "",
  322 + timeout: 3000,
  323 + text: "",
  324 + showLoader:false,
  325 + loading: false,
  326 + date:null,
  327 + search: '',
  328 + menu: false,
  329 + menu1:false,
  330 + dialog: false,
  331 + dialog1: false,
  332 + valid: true,
  333 + validEdit:true,
  334 + isActive: true,
  335 + newActive: false,
  336 + details: [],
  337 + AddUsercredentials: {},
  338 + pagination: {
  339 + rowsPerPage: 15
  340 + },
  341 + nameRules: [v => !!v || " Section Name is required"],
  342 + classRules: [v => !!v || " Class Name is required"],
  343 + sessionRules: [v => !!v || " Session is required"],
  344 + headers: [
  345 + {
  346 + text: "No",
  347 + align: "center",
  348 + sortable: false,
  349 + value: "No"
  350 + },
  351 + { text: "Class Name", value: "name", sortable: false, align: "center" },
  352 + { text: "Section Name", value: "sectionName", sortable: false, align: "center" },
  353 + { text: "Action", value: "", sortable: false, align: "center" }
  354 + ],
  355 + desserts: [],
  356 + addclass:[],
  357 + // addIncharge:[],
  358 + // selectIncharge:'',
  359 + select:'',
  360 + selectId:'',
  361 + editedIndex: -1,
  362 + editedItem: {
  363 + classData:{
  364 + classNum:"",
  365 + },
  366 + name:'',
  367 + session:new Date().getFullYear()
  368 +
  369 + },
  370 + items: [
  371 + {
  372 + href: "/changepassword",
  373 + title: "Change Password",
  374 + click: e => {
  375 + console.log(e);
  376 + }
  377 + },
  378 + {
  379 + href: "#",
  380 + title: "Logout",
  381 + click: e => {
  382 + window.getApp.$emit("APP_LOGOUT");
  383 + }
  384 + }
  385 + ]
  386 + }),
  387 + watch: {
  388 + menu (val) {
  389 + val && this.$nextTick(() => (this.$refs.picker.activePicker = 'YEAR'))
  390 + },
  391 + menu1 (val) {
  392 + val && this.$nextTick(() => (this.$refs.picker.activePicker = 'YEAR'))
  393 + }
  394 + },
  395 + methods: {
  396 + getSectionList() {
  397 + this.showLoader = true;
  398 + var token = this.$store.state.token;
  399 + http()
  400 + .get("/getAllSections", {
  401 + headers: { Authorization: "Bearer " + token }
  402 + })
  403 + .then(response => {
  404 + this.desserts = response.data.data;
  405 + this.showLoader = false;
  406 + // console.log("getAllSections=====>",response.data.data)
  407 +
  408 + })
  409 + .catch(err => {
  410 + // console.log("err====>", err);
  411 + this.showLoader = false;
  412 + this.$router.replace({ path: '/' });
  413 + });
  414 + },
  415 + editItem(item) {
  416 + this.editedIndex = this.desserts.indexOf(item);
  417 + this.editedItem = Object.assign({}, item);
  418 + console.log(this.editedItem)
  419 + this.dialog = true;
  420 + },
  421 + profile(item) {
  422 + this.editedIndex = this.desserts.indexOf(item);
  423 + this.editedItem = Object.assign({}, item);
  424 + this.dialog1 = true;
  425 + },
  426 + deleteItem(item) {
  427 + let deleteStudent = {
  428 + sectionId: item._id
  429 + };
  430 + http()
  431 + .delete("/deleteSection", confirm('Are you sure you want to delete this?') && { params: deleteStudent })
  432 + .then(response => {
  433 + // console.log("deleteUers",deleteStudent)
  434 + if ((this.snackbar = true)) {
  435 + this.text = "Successfully delete Existing User";
  436 + }
  437 + this.getSectionList();
  438 + })
  439 + .catch(error => {
  440 + // console.log(error);
  441 + });
  442 + },
  443 + activeTab(type) {
  444 + switch (type) {
  445 + case "existing":
  446 + this.newActive = false;
  447 + this.isActive = true;
  448 + break;
  449 +
  450 + default:
  451 + this.newActive = true;
  452 + this.isActive = false;
  453 + break;
  454 + }
  455 + },
  456 + close() {
  457 + this.dialog = false;
  458 + setTimeout(() => {
  459 + this.editedItem = Object.assign({}, this.defaultItem);
  460 + this.editedIndex = -1;
  461 + }, 300);
  462 + },
  463 + close1() {
  464 + this.dialog1 = false;
  465 + },
  466 + close2() {
  467 + this.dialog2 = false;
  468 + },
  469 + submit() {
  470 + if (this.$refs.forms.validate()) {
  471 + let addSection = {
  472 + name: this.editedItem.name,
  473 + classId: this.select,
  474 + session:this.editedItem.session
  475 + };
  476 + console.log(addSection)
  477 + http()
  478 + .post("/createSection", addSection)
  479 + .then(response => {
  480 + console.log(addSection)
  481 + // this.getStudentList();
  482 + if (this.snackbar = true) {
  483 + this.text = "New user added successfully";
  484 + }
  485 +
  486 + this.clear();
  487 + })
  488 + .catch(error => {
  489 + // console.log(error);
  490 + if (this.snackbar = true) {
  491 + this.text = error.response.data.message;
  492 + }
  493 + });
  494 + }
  495 + },
  496 + mail() {
  497 + },
  498 + download() {
  499 + },
  500 + clear() {
  501 + this.$refs.form.reset();
  502 + },
  503 + save() {
  504 + // if (this.$refs.form.validate()) {
  505 + let editStudent = {
  506 + name: this.editedItem.name,
  507 + classId: this.select,
  508 + sectionId: this.editedItem._id
  509 + };
  510 + http()
  511 + .put("/updateSection", editStudent)
  512 + .then(response => {
  513 + // console.log("editStudent",editStudent);
  514 + if ((this.snackbar = true)) {
  515 + this.text = "Successfully Edit Existing User";
  516 + }
  517 + this.getSectionList();
  518 + // this.showLoader = false;
  519 + })
  520 + .catch(error => {
  521 + this.text = error.response.data.message;
  522 + // console.log(error);
  523 + });
  524 + this.close();
  525 + // }
  526 + },
  527 + handleDrawerToggle() {
  528 + window.getApp.$emit("APP_DRAWER_TOGGLED");
  529 + },
  530 + handleFullScreen() {
  531 + Util.toggleFullScreen();
  532 + }
  533 + },
  534 + mounted() {
  535 + this.getSectionList();
  536 +
  537 + var token = this.$store.state.token;
  538 + http()
  539 + .get("/getClassesList", {
  540 + headers: { Authorization: "Bearer " + token }
  541 + })
  542 + .then(response => {
  543 + this.addclass = response.data.data;
  544 + console.log("getClassesList=====>",this.addclass)
  545 +
  546 + })
  547 + .catch(err => {
  548 + // console.log("err====>", err);
  549 + this.$router.replace({ path: '/' });
  550 + });
  551 + },
  552 +
  553 + computed:{
  554 + toolbarColor() {
  555 + return this.$vuetify.options.extra.mainNav;
  556 + }
  557 + }
  558 +};
  559 +</script>
  560 +<style scoped>
  561 +.v-tabs__div {
  562 + text-transform: none;
  563 +}
  564 +.v-input__prepend-outer {
  565 + margin-right: 0px !important;
  566 +}
  567 +.v-card__actions .v-btn {
  568 + margin: 0 15px;
  569 + min-width: 120px;
  570 +}
  571 + .primary {
  572 + background-color: #aaa !important;
  573 + border-color: #aaa !important;
  574 +}
  575 +h4 {
  576 + background-repeat: no-repeat;
  577 + padding: 8px;
  578 + margin: auto;
  579 + font-size: 25px;
  580 +}
  581 +#name {
  582 + position: absolute;
  583 + left: 100px;
  584 + top: 17px;
  585 +}
  586 +#icon {
  587 + position: absolute;
  588 + right: 8px;
  589 + top: 8px;
  590 +}
  591 +#m {
  592 + position: relative;
  593 + left: 135px;
  594 + top: -15px;
  595 +}
  596 +#G {
  597 + position: absolute;
  598 + top: 38px;
  599 + color: white;
  600 +}
  601 +#bt {
  602 + position: relative;
  603 + top: -20px;
  604 + left: 115px;
  605 +}
  606 +#e {
  607 + position: relative;
  608 + top: 5px;
  609 + right: -30px;
  610 + height: 17px;
  611 + cursor: pointer;
  612 +}
  613 +#d {
  614 + position: relative;
  615 + top: 5px;
  616 + right: -70px;
  617 + height: 17px;
  618 + cursor: pointer;
  619 +}
  620 +#td {
  621 + border: 1px solid #dddddd;
  622 + text-align: left;
  623 + padding: 8px;
  624 +}
  625 +#dialog {
  626 + height: 550px;
  627 +}
  628 +.active {
  629 + background-color: black;
  630 + color: white !important;
  631 +}
  632 +.activebtn {
  633 + color: black !important;
  634 +}
  635 +#flex {
  636 + height: 300px;
  637 +}
  638 +.top{
  639 + margin-top:100px;
  640 +}
  641 +.v-tabs__item a{
  642 + font-size:16px !important;
  643 +}
  644 +@media screen and (max-width: 769px){
  645 + .top{
  646 + margin-top:0 !important;
  647 + }
  648 + .userSearch .v-icon {
  649 + font-size: 20px !important;
  650 + margin-left: 20px ;
  651 + }
  652 +}
  653 +@media screen and (max-width: 380px) {
  654 +.right {
  655 + float: none !important;
  656 +}
  657 +.subheading {
  658 + font-size: 14px !important;
  659 +}
  660 +.v-card__actions .v-btn{
  661 + margin: 0 0px;
  662 + min-width: 100px;
  663 +}
  664 +/* .searchIcon .v-icon {
  665 + font-size: 20px;
  666 + margin-left: 20px;
  667 +} */
  668 +.subheading {
  669 + font-size: 12px !important;
  670 +}
  671 +h5 {
  672 + font-size: 13px;
  673 +}
  674 +}
  675 +.v-icon{
  676 + font-size:30px;
  677 +}
  678 +@media screen and (min-width: 1270px){
  679 +.hide{
  680 + display: none;
  681 +}
  682 +/* }
  683 +@media screen and (max-width: 962px) {
  684 +.imglogo{
  685 + position: absolute;
  686 + top: 13px;
  687 + left: 13px !important;
  688 + width: 70px;
  689 + height: 24px;
  690 +} */
  691 +}
  692 +@media screen and (max-width: 420px){
  693 +.userSearch .v-text-field .v-label{
  694 + line-height: 24px !important;
  695 +}
  696 +.userSearch .v-label{
  697 + font-size: 13px !important;
  698 +}
  699 +.v-list__tile {
  700 + font-size:14px;
  701 + padding: 0 10px;
  702 +}
  703 +.name{
  704 + font-size:15px;
  705 +}
  706 +}
  707 +</style>
0 708 \ No newline at end of file
... ...
src/pages/Teachers/teachers.vue
... ... @@ -767,13 +767,13 @@
767 767 v-model="imageName"
768 768 prepend-icon="attach_file"
769 769 ></v-text-field>
770   - <input
771   - type="file"
772   - style="display: none"
773   - ref="image"
774   - accept="image/*"
775   - @change="onFilePicked"
776   - >
  770 + <input
  771 + type="file"
  772 + style="display: none"
  773 + ref="image"
  774 + accept="image/*"
  775 + @change="onFilePicked"
  776 + >
777 777 </v-flex>
778 778 </v-layout>
779 779 </v-flex>
... ...
src/pages/TimeTable/timeTable.vue
... ... @@ -0,0 +1,1240 @@
  1 +<template>
  2 + <v-app id="pages-dasboard">
  3 + <v-toolbar class="fixcolors" fixed app>
  4 + <v-toolbar-title class="ml-0 pl-3">
  5 + <v-toolbar-side-icon @click.stop="handleDrawerToggle" class="hide"></v-toolbar-side-icon>
  6 + </v-toolbar-title>
  7 + <!-- ****** SEARCH ALL EXISTING TIME-TABLE ****** -->
  8 + <v-flex xs7 sm3 class="userSearch">
  9 + <v-text-field
  10 + flat
  11 + append-icon="search"
  12 + label="Find your Teachers"
  13 + v-model="search"
  14 + color="white"
  15 + dark
  16 + ></v-text-field>
  17 + </v-flex>
  18 + <v-spacer></v-spacer>
  19 + <v-menu offset-y origin="center center" :nudge-bottom="10" transition="scale-transition">
  20 + <v-btn icon large flat slot="activator">
  21 + <v-avatar size="40px">
  22 + <img src="/static/icon/user.png">
  23 + </v-avatar>
  24 + </v-btn>
  25 + <v-list class="pa-0">
  26 + <v-list-tile
  27 + v-for="(item,index) in items"
  28 + :to="!item.href ? { name: item.name } : null"
  29 + :href="item.href"
  30 + @click="item.click"
  31 + ripple="ripple"
  32 + :disabled="item.disabled"
  33 + :target="item.target"
  34 + rel="noopener"
  35 + :key="index"
  36 + >
  37 + <v-list-tile-action v-if="item.icon">
  38 + <v-icon>{{ item.icon }}</v-icon>
  39 + </v-list-tile-action>
  40 + <v-list-tile-content>
  41 + <v-list-tile-title>{{ item.title }}</v-list-tile-title>
  42 + </v-list-tile-content>
  43 + </v-list-tile>
  44 + </v-list>
  45 + </v-menu>
  46 + </v-toolbar>
  47 + <v-tabs grow slider-color="black">
  48 + <v-tab
  49 + ripple
  50 + @click="activeTab('existing')"
  51 + v-bind:class="{ active: isActive }"
  52 + id="tab"
  53 + class="subheading"
  54 + >Existing Time Table</v-tab>
  55 + <v-tab
  56 + ripple
  57 + @click="activeTab('new')"
  58 + v-bind:class="{ active: newActive }"
  59 + id="tab1"
  60 + User
  61 + class="subheading"
  62 + >Add New Time Table</v-tab>
  63 +
  64 + <!-- ****** EDITS TIME-TABLE****** -->
  65 +
  66 + <v-tab-item>
  67 + <v-snackbar
  68 + :timeout="timeout"
  69 + :top="y === 'top'"
  70 + :right="x === 'right'"
  71 + :vertical="mode === 'vertical'"
  72 + v-model="snackbar"
  73 + color="success"
  74 + >{{ text }}</v-snackbar>
  75 + <v-dialog v-model="dialog" max-width="1000px">
  76 + <v-flex xs12 sm12 class>
  77 + <v-toolbar color="white">
  78 + <v-spacer></v-spacer>
  79 + <v-toolbar-title>Edit Time Table</v-toolbar-title>
  80 + <v-spacer></v-spacer>
  81 + </v-toolbar>
  82 + <v-card flat>
  83 + <v-form ref="form">
  84 + <v-container fluid>
  85 + <v-layout>
  86 + <v-flex
  87 + xs12
  88 + class="text-xs-center text-sm-center text-md-center text-lg-center mr-4"
  89 + >
  90 + <v-avatar size="100px">
  91 + <img src="/static/icon/user.png" v-if="!imageUrl">
  92 + </v-avatar>
  93 + <input
  94 + type="file"
  95 + style="display: none"
  96 + ref="image"
  97 + accept="image/*"
  98 + @change="onFilePicked"
  99 + >
  100 + <img
  101 + :src="imageData.imageUrl"
  102 + height="150"
  103 + v-if="imageUrl"
  104 + style="border-radius:50%; width:200px"
  105 + >
  106 + </v-flex>
  107 + </v-layout>
  108 + <v-flex xs12 sm12>
  109 + <v-layout>
  110 + <v-flex xs4 class="pt-4 subheading">
  111 + <label class="right">class No:</label>
  112 + </v-flex>
  113 + <v-flex xs12 sm5 class="ml-3">
  114 + <v-select
  115 + :items="addclass"
  116 + label="Select Class"
  117 + v-model="editedItem.classNum"
  118 + item-text="classNum"
  119 + item-value= "_id"
  120 + @change="getSections(editedItem.classNum)"
  121 + ></v-select>
  122 + </v-flex>
  123 + </v-layout>
  124 + </v-flex>
  125 + <v-flex xs12 sm12>
  126 + <v-layout>
  127 + <v-flex xs4 class="pt-4 subheading">
  128 + <label class="right">Section Name:</label>
  129 + </v-flex>
  130 + <v-flex xs5 class="ml-3">
  131 + <v-select
  132 + :items="addSection"
  133 + label="Select Section"
  134 + v-model="editedItem.selectSection"
  135 + item-text="name"
  136 + item-value="_id"
  137 + ></v-select>
  138 + </v-flex>
  139 + </v-layout>
  140 + </v-flex>
  141 + <v-layout>
  142 + <v-flex xs12 sm8 offset-sm2>
  143 + <v-card-actions>
  144 + <v-btn round dark @click.native="close">Cancel</v-btn>
  145 + <v-spacer></v-spacer>
  146 + <v-btn round dark @click="save">Save</v-btn>
  147 + </v-card-actions>
  148 + </v-flex>
  149 + </v-layout>
  150 + </v-container>
  151 + </v-form>
  152 + </v-card>
  153 + </v-flex>
  154 + </v-dialog>
  155 +
  156 + <!-- ****** ADD LECTURES TIME-TABLE ****** -->
  157 +
  158 + <v-dialog v-model="dialogAddLecture" max-width="1000px">
  159 + <v-flex xs12 sm12 class>
  160 + <v-toolbar color="white">
  161 + <v-spacer></v-spacer>
  162 + <v-toolbar-title>Add Lecture</v-toolbar-title>
  163 + <v-spacer></v-spacer>
  164 + </v-toolbar>
  165 + <v-card flat>
  166 + <v-form ref="form" v-model="valid" lazy-validation>
  167 + <v-container fluid>
  168 + <v-flex xs12 sm12>
  169 + <v-layout>
  170 + <v-flex xs4 class="pt-4 subheading">
  171 + <label class="right">Subject Name:</label>
  172 + </v-flex>
  173 + <v-flex xs5 class="ml-3">
  174 + <v-text-field
  175 + v-model="addlectures.subjectName"
  176 + :rules="subjectNameRules"
  177 + placeholder="fill your Subject Name"
  178 + type="text"
  179 + ></v-text-field>
  180 + </v-flex>
  181 + </v-layout>
  182 + </v-flex>
  183 + <v-flex xs12 sm12>
  184 + <v-layout>
  185 + <v-flex xs4 class="pt-4 subheading">
  186 + <label class="right">Time In:</label>
  187 + </v-flex>
  188 + <v-flex xs5 class="ml-3">
  189 + <v-text-field
  190 + v-model="addlectures.timeIn"
  191 + :rules="timeInRules"
  192 + placeholder="fill your Time In"
  193 + type="text"
  194 + ></v-text-field>
  195 + </v-flex>
  196 + </v-layout>
  197 + </v-flex>
  198 + <v-flex xs12 sm12>
  199 + <v-layout>
  200 + <v-flex xs4 class="pt-4 subheading">
  201 + <label class="right">Time Out:</label>
  202 + </v-flex>
  203 + <v-flex xs5 class="ml-3">
  204 + <v-text-field
  205 + v-model="addlectures.timeOut"
  206 + :rules="timeOutRules"
  207 + placeholder="fill your Time Out"
  208 + type="text"
  209 + ></v-text-field>
  210 + </v-flex>
  211 + </v-layout>
  212 + </v-flex>
  213 + <v-flex xs12 sm12>
  214 + <v-layout>
  215 + <v-flex xs4 class="pt-4 subheading">
  216 + <label class="right">Select Teacher:</label>
  217 + </v-flex>
  218 + <v-flex xs5 class="ml-3">
  219 + <v-select
  220 + :items="addTeachers"
  221 + label="Select Teacher"
  222 + v-model="addlectures.teacherId"
  223 + :rules="subjectNameRules"
  224 + item-text="name"
  225 + item-value="_id"
  226 + required
  227 + ></v-select>
  228 + </v-flex>
  229 + </v-layout>
  230 + </v-flex>
  231 + <v-layout>
  232 + <v-flex xs12 sm8 offset-sm2>
  233 + <v-card-actions>
  234 + <v-btn round dark @click.native="closedialogLecture">Cancel</v-btn>
  235 + <v-spacer></v-spacer>
  236 + <!-- <v-btn round dark @click="updateParticularTable">Save</v-btn> -->
  237 + <v-btn round dark @click="AddLecture">Save</v-btn>
  238 +
  239 + </v-card-actions>
  240 + </v-flex>
  241 + </v-layout>
  242 + </v-container>
  243 + </v-form>
  244 + </v-card>
  245 + </v-flex>
  246 + </v-dialog>
  247 +
  248 + <!-- ****** EDIT LECTURES TIME-TABLE ****** -->
  249 +
  250 + <v-dialog v-model="dialogUpdateLectures" max-width="1000px">
  251 + <v-flex xs12 sm12 class>
  252 + <v-toolbar color="white">
  253 + <v-spacer></v-spacer>
  254 + <v-toolbar-title>Edit Lecture</v-toolbar-title>
  255 + <v-spacer></v-spacer>
  256 + </v-toolbar>
  257 + <v-card flat>
  258 + <v-form ref="form">
  259 + <v-container fluid>
  260 + <v-flex xs12 sm12>
  261 + <v-layout>
  262 + <v-flex xs4 class="pt-4 subheading">
  263 + <label class="right">Subject Name:</label>
  264 + </v-flex>
  265 + <v-flex xs5 class="ml-3">
  266 + <v-text-field
  267 + v-model="updateLectures.subjectName"
  268 + placeholder="fill your Subject Name"
  269 + type="text"
  270 + ></v-text-field>
  271 + </v-flex>
  272 + </v-layout>
  273 + </v-flex>
  274 + <v-flex xs12 sm12>
  275 + <v-layout>
  276 + <v-flex xs4 class="pt-4 subheading">
  277 + <label class="right">Time In:</label>
  278 + </v-flex>
  279 + <v-flex xs5 class="ml-3">
  280 + <v-text-field
  281 + v-model="updateLectures.timeIn"
  282 + placeholder="fill your Time In"
  283 + type="text"
  284 + ></v-text-field>
  285 + </v-flex>
  286 + </v-layout>
  287 + </v-flex>
  288 + <v-flex xs12 sm12>
  289 + <v-layout>
  290 + <v-flex xs4 class="pt-4 subheading">
  291 + <label class="right">Time Out:</label>
  292 + </v-flex>
  293 + <v-flex xs5 class="ml-3">
  294 + <v-text-field
  295 + v-model="updateLectures.timeOut"
  296 + placeholder="fill your Time Out"
  297 + type="text"
  298 + ></v-text-field>
  299 + </v-flex>
  300 + </v-layout>
  301 + </v-flex>
  302 + <v-flex xs12 sm12>
  303 + <v-layout>
  304 + <v-flex xs4 class="pt-4 subheading">
  305 + <label class="right">Select Teacher:</label>
  306 + </v-flex>
  307 + <v-flex xs5 class="ml-3">
  308 + <v-select
  309 + :items="addTeachers"
  310 + label="Select Teacher"
  311 + v-model="updateLectures.teacherId"
  312 + item-text="name"
  313 + item-value="_id"
  314 + required
  315 + ></v-select>
  316 + </v-flex>
  317 + </v-layout>
  318 + </v-flex>
  319 + <v-layout>
  320 + <v-flex xs12 sm8 offset-sm2>
  321 + <v-card-actions>
  322 + <v-btn round dark @click.native="closeUpdateLectures">Cancel</v-btn>
  323 + <v-spacer></v-spacer>
  324 + <v-btn round dark @click="updateParticularTable">Save</v-btn>
  325 +
  326 + </v-card-actions>
  327 + </v-flex>
  328 + </v-layout>
  329 + </v-container>
  330 + </v-form>
  331 + </v-card>
  332 + </v-flex>
  333 + </v-dialog>
  334 +
  335 + <v-snackbar
  336 + :timeout="timeout"
  337 + :top="y === 'top'"
  338 + :right="x === 'right'"
  339 + :vertical="mode === 'vertical'"
  340 + v-model="snackbar"
  341 + color="success"
  342 + >{{ text }}</v-snackbar>
  343 +
  344 + <!-- ****** EXISTING-USERS TIME-TABLE ****** -->
  345 + <v-flex xs12>
  346 + <v-data-table :headers="headers" :items="desserts" item-key="_id">
  347 + <template slot="items" slot-scope="props">
  348 + <tr
  349 + style="cursor: pointer;"
  350 + @click="getTimeTable(props.item), props.expanded = !props.expanded"
  351 + >
  352 + <td class="text-xs-center">{{ props.index }}</td>
  353 + <td class="text-xs-center">{{ props.item.classData.classNum}}</td>
  354 + <td class="text-xs-center">{{ props.item.sectionData.name }}</td>
  355 + <td class="text-xs-center">
  356 + <span>
  357 + <img
  358 + style="cursor:pointer; width:20px; height:18px; "
  359 + class="mr-5"
  360 + @click="editItem(props.item)"
  361 + src="/static/icon/edit1.png"
  362 + >
  363 + <img
  364 + style="cursor:pointer; height:20px; "
  365 + class="mr-5"
  366 + @click="deleteItem(props.item)"
  367 + src="/static/icon/delete1.png"
  368 + >
  369 + </span>
  370 + </td>
  371 + </tr>
  372 + </template>
  373 + <template slot="expand" slot-scope="props">
  374 + <v-data-table
  375 + :items="timeTableList.schedule"
  376 + hide-actions
  377 + item-key="title"
  378 + style="width: auto;"
  379 + >
  380 + <template slot="items" slot-scope="props">
  381 + <tr>
  382 + <td class="text-xs-left subheading"> <b> {{ props.item.day }} </b> </td>
  383 + <td>
  384 + <b> Subject</b><br/>
  385 + <b> Time In</b><br/>
  386 + <b> Time Out</b>
  387 + </td>
  388 + <td v-for="list in props.item.lectures">
  389 + <b> {{ list.subjectName }} </b>
  390 + <img
  391 + style="cursor:pointer; width:20px; height:18px; "
  392 + class="mr-2 ml-2"
  393 + src="/static/icon/edit1.png"
  394 + @click="updateTimeTable(list, timeTableList)"
  395 + >
  396 + <img
  397 + style="cursor:pointer; height:20px; "
  398 + src="/static/icon/delete1.png"
  399 + @click="deleteTimeTable(list, timeTableList)"
  400 + >
  401 + <br/> {{list.timeIn.slice(0,16)}} <br/> {{list.timeOut.slice(0,16)}}
  402 + </td>
  403 + <td >
  404 + <v-icon
  405 + color="black"
  406 + @click="addLecture(props.item._id, timeTableList._id)"
  407 + >add_circle_outline</v-icon>
  408 + </td>
  409 + </tr>
  410 + </template>
  411 + </v-data-table>
  412 + </template>
  413 + </v-data-table>
  414 + <br>
  415 + <br>
  416 + </v-flex>
  417 + </v-tab-item>
  418 +
  419 + <!-- ****** ADD MULTIPLE TIME-TABLE ****** -->
  420 +
  421 + <v-tab-item>
  422 + <v-container>
  423 + <v-snackbar
  424 + :timeout="timeout"
  425 + :top="y === 'top'"
  426 + :right="x === 'right'"
  427 + :vertical="mode === 'vertical'"
  428 + v-model="snackbar"
  429 + color="success"
  430 + >{{ text }}</v-snackbar>
  431 + <v-flex xs12 sm12 class="my-4">
  432 + <v-card flat>
  433 + <v-form ref="form" v-model="valid" lazy-validation>
  434 + <v-container fluid>
  435 + <v-layout>
  436 + <v-flex
  437 + xs12
  438 + class="text-xs-center text-sm-center text-md-center text-lg-center my-4 mr-4"
  439 + >
  440 + <v-avatar size="100px">
  441 + <img src="/static/icon/user.png" v-if="!imageUrl">
  442 + </v-avatar>
  443 + <input
  444 + type="file"
  445 + style="display: none"
  446 + ref="image"
  447 + accept="image/*"
  448 + @change="onFilePicked"
  449 + >
  450 + <img
  451 + :src="imageData.imageUrl"
  452 + height="150"
  453 + v-if="imageUrl"
  454 + style="border-radius:50%; width:200px"
  455 + >
  456 + </v-flex>
  457 + </v-layout>
  458 + <v-flex xs12>
  459 + <v-layout>
  460 + <v-flex xs4 class="pt-4 subheading">
  461 + <label class="right">Select Class:</label>
  462 + </v-flex>
  463 + <v-flex xs4 class="ml-3">
  464 + <v-select
  465 + :items="addclass"
  466 + label="Select Class"
  467 + v-model="timeTable.select"
  468 + item-text="classNum"
  469 + item-value="_id"
  470 + @change="getSections(timeTable.select)"
  471 + required
  472 + ></v-select>
  473 + </v-flex>
  474 + </v-layout>
  475 + </v-flex>
  476 + <v-flex xs12>
  477 + <v-layout>
  478 + <v-flex xs4 class="pt-4 subheading">
  479 + <label class="right">Select Section:</label>
  480 + </v-flex>
  481 + <v-flex xs4 class="ml-3">
  482 + <v-select
  483 + :items="addSection"
  484 + label="Select Section"
  485 + v-model="timeTable.selectSection"
  486 + item-text="name"
  487 + item-value="_id"
  488 + required
  489 + ></v-select>
  490 + </v-flex>
  491 + </v-layout>
  492 + </v-flex>
  493 + <v-flex xs12>
  494 + <v-layout>
  495 + <v-flex xs4 class="pt-4 subheading">
  496 + <label class="right">Select Teacher:</label>
  497 + </v-flex>
  498 + <v-flex xs4 class="ml-3">
  499 + <v-select
  500 + :items="addTeachers"
  501 + label="Select Teacher"
  502 + v-model="timeTable.selectTeacher"
  503 + item-text="name"
  504 + item-value="_id"
  505 + required
  506 + ></v-select>
  507 + </v-flex>
  508 + </v-layout>
  509 + </v-flex>
  510 + <v-flex xs12>
  511 + <v-layout>
  512 + <v-flex xs4 class="pt-4 subheading">
  513 + <label class="right">Select Day:</label>
  514 + </v-flex>
  515 + <v-flex xs4 class="ml-3">
  516 + <v-select
  517 + :items="addOneDay"
  518 + label="Select Day"
  519 + v-model="timeTable.selectDay"
  520 + item-text="name"
  521 + item-value="_id"
  522 + required
  523 + ></v-select>
  524 + </v-flex>
  525 + </v-layout>
  526 + </v-flex>
  527 + <v-flex xs12>
  528 + <v-layout>
  529 + <v-flex xs4 class="pt-4 subheading">
  530 + <label class="right">Time In:</label>
  531 + </v-flex>
  532 + <v-flex xs4 class="ml-3">
  533 + <v-text-field
  534 + v-model="timeTable.timeIn"
  535 + placeholder="fill your Time In"
  536 + type="text"
  537 + :rules="timeInRules"
  538 + required
  539 + ></v-text-field>
  540 + </v-flex>
  541 + </v-layout>
  542 + </v-flex>
  543 + <v-flex xs12>
  544 + <v-layout>
  545 + <v-flex xs4 class="pt-4 subheading">
  546 + <label class="right">Time Out:</label>
  547 + </v-flex>
  548 + <v-flex xs4 class="ml-3">
  549 + <v-text-field
  550 + placeholder="fill your Time Out"
  551 + :rules="timeOutRules"
  552 + v-model="timeTable.timeOut"
  553 + type="text"
  554 + required
  555 + ></v-text-field>
  556 + </v-flex>
  557 + </v-layout>
  558 + </v-flex>
  559 + <v-flex xs12>
  560 + <v-layout>
  561 + <v-flex xs4 class="pt-4 subheading">
  562 + <label class="right">Lecture No:</label>
  563 + </v-flex>
  564 + <v-flex xs4 class="ml-3">
  565 + <v-text-field
  566 + placeholder="fill your Lecture No"
  567 + :rules="lectureRules"
  568 + v-model="timeTable.lectureNum"
  569 + type="number"
  570 + required
  571 + ></v-text-field>
  572 + </v-flex>
  573 + </v-layout>
  574 + </v-flex>
  575 + <v-flex xs12>
  576 + <v-layout>
  577 + <v-flex xs4 class="pt-4 subheading">
  578 + <label class="right">Subject Name:</label>
  579 + </v-flex>
  580 + <v-flex xs4 class="ml-3">
  581 + <v-text-field
  582 + placeholder="fill your Subject Name"
  583 + :rules="subjectNameRules"
  584 + v-model="timeTable.subjectName"
  585 + type="text"
  586 + required
  587 + ></v-text-field>
  588 + </v-flex>
  589 + </v-layout>
  590 + </v-flex>
  591 + <v-layout>
  592 + <v-flex xs12 sm6 offset-sm3>
  593 + <v-card-actions>
  594 + <v-btn @click="clear" round dark>clear</v-btn>
  595 + <v-spacer></v-spacer>
  596 + <v-btn @click="submit" round dark :loading="loading">Add</v-btn>
  597 + </v-card-actions>
  598 + </v-flex>
  599 + </v-layout>
  600 + </v-container>
  601 + </v-form>
  602 + </v-card>
  603 + </v-flex>
  604 + </v-container>
  605 + </v-tab-item>
  606 + </v-tabs>
  607 + <div class="loader" v-if="showLoader">
  608 + <v-progress-circular indeterminate color="white"></v-progress-circular>
  609 + </div>
  610 + </v-app>
  611 +</template>
  612 +
  613 +<script>
  614 +import http from "@/Services/http.js";
  615 +import Util from "@/util";
  616 +
  617 +export default {
  618 + data: () => ({
  619 + y: "top",
  620 + x: "right",
  621 + mode: "",
  622 + timeout: 3000,
  623 + text: "",
  624 + search: "",
  625 + snackbar: false,
  626 + loading: false,
  627 + showLoader: false,
  628 + menu: false,
  629 + menu1: false,
  630 + dialog: false,
  631 + dialogAddLecture : false,
  632 + dialogUpdateLectures:false,
  633 + dialog1: false,
  634 + valid: true,
  635 + // validLeacture:true,
  636 + isActive: true,
  637 + newActive: false,
  638 + addclass: [],
  639 + addSection: [],
  640 + addTeachers: [],
  641 + gender: ["Male", "Female"],
  642 + AddUsercredentials: {},
  643 + pagination: {
  644 + rowsPerPage: 15
  645 + },
  646 + imageData: {},
  647 + imageName: "",
  648 + imageUrl: "",
  649 + imageFile: "",
  650 + timeInRules: [v => !!v || "Time In is required"],
  651 + timeOutRules: [v => !!v || "Time Out is required"],
  652 + lectureRules: [v => !!v || "Lecture No is required"],
  653 + subjectNameRules: [v => !!v || "Subject Name is required"],
  654 + headers: [
  655 + {
  656 + text: "No",
  657 + align: "center",
  658 + sortable: false,
  659 + value: "No"
  660 + },
  661 + {
  662 + text: "Class Name",
  663 + value: "subjectName",
  664 + sortable: false,
  665 + align: "center"
  666 + },
  667 + {
  668 + text: "Section Name",
  669 + value: "sectionData",
  670 + sortable: false,
  671 + align: "center"
  672 + },
  673 + { text: "Action", value: "", sortable: false, align: "center" }
  674 + ],
  675 + daysHeaders: [
  676 + { text: "Day", value: "dayday", sortable: false, align: "center" },
  677 + {
  678 + text: "Subject Name",
  679 + value: "subjectName",
  680 + sortable: false,
  681 + align: "center"
  682 + },
  683 + { text: "Time In", value: "timeIn", sortable: false, align: "center" },
  684 + { text: "Time Out", value: "timeOut", sortable: false, align: "center" }
  685 + ],
  686 + addOneDay: [
  687 + "Monday",
  688 + "Tuesday",
  689 + "Wednesday",
  690 + "Thursday",
  691 + "Friday",
  692 + "Saturday",
  693 + "Sunday"
  694 + ],
  695 + desserts: [],
  696 + timeTableList: [],
  697 + editedIndex: -1,
  698 + timeTable: {
  699 + select: "",
  700 + selectSection: "",
  701 + selectDay: "",
  702 + timeIn: "",
  703 + timeOut: "",
  704 + lectureNum: "",
  705 + subjectName: "",
  706 + selectTeacher: ""
  707 + },
  708 + editedItem: {
  709 + classNum:"",
  710 + selectSection: ""
  711 + },
  712 + addlectures: {
  713 + timeIn: "",
  714 + timeOut: "",
  715 + subjectName: "",
  716 + teacherId: "",
  717 + scheduleId:"",
  718 + timeTableId:""
  719 + },
  720 + updateLectures:{
  721 + timeIn: "",
  722 + timeOut: "",
  723 + subjectName: "",
  724 + teacherId: "",
  725 + lectureId:"",
  726 + scheduleId:"",
  727 + },
  728 + items: [
  729 + {
  730 + href: "/changepassword",
  731 + title: "Change Password",
  732 + click: e => {
  733 + console.log(e);
  734 + }
  735 + },
  736 + {
  737 + href: "#",
  738 + title: "Logout",
  739 + click: e => {
  740 + window.getApp.$emit("APP_LOGOUT");
  741 + }
  742 + }
  743 + ]
  744 + }),
  745 + watch: {
  746 + menu(val) {
  747 + val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR"));
  748 + },
  749 + menu1(val) {
  750 + val && this.$nextTick(() => (this.$refs.picker.activePicker = "YEAR"));
  751 + }
  752 + },
  753 + methods: {
  754 + getSections(_id) {
  755 + var token = this.$store.state.token;
  756 + http()
  757 + .get(
  758 + "/getSectionsList",
  759 + { params: { classId: _id } },
  760 + {
  761 + headers: { Authorization: "Bearer " + token }
  762 + }
  763 + )
  764 + .then(response => {
  765 + this.addSection = response.data.data;
  766 + // console.log("getSectionsList=====>", this.addSection);
  767 + })
  768 + .catch(err => {
  769 + // console.log("err====>", err);
  770 + });
  771 + },
  772 + getTimeTable(item) {
  773 + this.showLoader = true;
  774 + var token = this.$store.state.token;
  775 + http()
  776 + .get(
  777 + "/getParticularTimeTable",
  778 + { params: { timeTableId: item._id } },
  779 + {
  780 + headers: { Authorization: "Bearer " + token }
  781 + }
  782 + )
  783 + .then(response => {
  784 + this.timeTableList = response.data.data;
  785 + this.showLoader = false;
  786 + // console.log("getParticularTimeTable=====>", this.timeTableList);
  787 + })
  788 + .catch(err => {
  789 + this.showLoader = false;
  790 + // console.log("err====>", err);
  791 + });
  792 + },
  793 + pickFile() {
  794 + this.$refs.image.click();
  795 + },
  796 +
  797 + onFilePicked(e) {
  798 + // console.log(e)
  799 + const files = e.target.files;
  800 + this.imageData.upload = e.target.files[0];
  801 + if (files[0] !== undefined) {
  802 + this.imageName = files[0].name;
  803 + if (this.imageName.lastIndexOf(".") <= 0) {
  804 + return;
  805 + }
  806 + const fr = new FileReader();
  807 + fr.readAsDataURL(files[0]);
  808 + fr.addEventListener("load", () => {
  809 + this.imageUrl = fr.result;
  810 + this.imageFile = files[0]; // this is an image file that can be sent to server...
  811 + this.imageData.imageUrl = URL.createObjectURL(this.imageFile);
  812 + // console.log("upload=======>", this.imageData.imageUrl);
  813 + // console.log("imageFile", this.imageFile);
  814 + });
  815 + } else {
  816 + this.imageName = "";
  817 + this.imageFile = "";
  818 + this.imageUrl = "";
  819 + }
  820 + },
  821 + getTimeTableList() {
  822 + this.showLoader = true;
  823 + var token = this.$store.state.token;
  824 + http()
  825 + .get("/getTimeTablesList", {
  826 + headers: { Authorization: "Bearer " + token }
  827 + })
  828 + .then(response => {
  829 + this.desserts = response.data.data;
  830 + this.showLoader = false;
  831 + // console.log("getTimeTableList=====>", response.data.data);
  832 + })
  833 + .catch(err => {
  834 + // console.log("err====>", err);
  835 + this.showLoader = false;
  836 + this.$router.replace({ path: "/" });
  837 + });
  838 + },
  839 + editItem(item) {
  840 + this.editedIndex = this.desserts.indexOf(item);
  841 + this.editedItem = Object.assign({}, item);
  842 + this.dialog = true;
  843 + },
  844 + updateTimeTable(timeToUpdate, classToUpdate){
  845 + console.log('timeToUpdate, classToUpdate', timeToUpdate._id, classToUpdate.schedule);
  846 + for (let i = 0; i < classToUpdate.schedule.length; i++){
  847 + this.updateLectures.scheduleId = classToUpdate.schedule[i]._id;
  848 + }
  849 + this.updateLectures.lectureId = timeToUpdate._id,
  850 + this.updateLectures= timeToUpdate
  851 + this.dialogUpdateLectures = true;
  852 + },
  853 + addLecture(scheduleId, timeTableId){
  854 + // console.log('timeToAdd, classToAdd', scheduleId, timeTableId);
  855 + this.addlectures.scheduleId = scheduleId
  856 + this.addlectures.timeTableId = timeTableId
  857 + this.dialogAddLecture = true;
  858 + },
  859 + AddLecture(){
  860 + if (this.$refs.form.validate()) {
  861 + http()
  862 + .post("/addLecture", this.addlectures)
  863 + .then(response => {
  864 + // console.log("addTimeTable=====>", this.addlectures);
  865 + if ((this.snackbar = true)) {
  866 + this.text = "New Add Lecture successfully";
  867 + }
  868 + this.closedialogLecture();
  869 + })
  870 + .catch(error => {
  871 + if ((this.snackbar = true)) {
  872 + this.text = error.response.data.message;
  873 + }
  874 + });
  875 + }
  876 + },
  877 + updateParticularTable(){
  878 + let EditLecture = {
  879 + lectureId:this.updateLectures.lectureId,
  880 + scheduleId:this.updateLectures.scheduleId,
  881 + updatedLecture:{
  882 + timeIn:this.updateLectures.timeIn,
  883 + timeOut: this.updateLectures.timeOut,
  884 + subjectName: this.updateLectures.subjectName,
  885 + teacherId: this.updateLectures.teacherId,
  886 + }
  887 + }
  888 + console.log("updateLecture", EditLecture);
  889 + http()
  890 + .put("/updateLecture", EditLecture)
  891 + .then(response => {
  892 + console.log("updateLecture", EditLecture);
  893 + if ((this.snackbar = true)) {
  894 + this.text = "Successfully Edit Update Lecture";
  895 + }
  896 + this.$router.go(0)
  897 + })
  898 + .catch(error => {
  899 + // console.log(error);
  900 + });
  901 + this.closeUpdateLectures()
  902 + },
  903 + deleteItem(item) {
  904 + let deleteTimeTable = {
  905 + timeTableId: item._id
  906 + };
  907 + http()
  908 + .delete(
  909 + "/deleteTimeTable",
  910 + confirm("Are you sure you want to delete this?") && {
  911 + params: deleteTimeTable
  912 + }
  913 + )
  914 + .then(response => {
  915 + // console.log("deleteUers",deleteTimeTable)
  916 + if ((this.snackbar = true)) {
  917 + this.text = "Successfully delete Existing User";
  918 + }
  919 + this.getTimeTableList();
  920 + })
  921 + .catch(error => {
  922 + // console.log(error);
  923 + });
  924 + },
  925 + activeTab(type) {
  926 + switch (type) {
  927 + case "existing":
  928 + this.newActive = false;
  929 + this.isActive = true;
  930 + break;
  931 +
  932 + default:
  933 + this.newActive = true;
  934 + this.isActive = false;
  935 + break;
  936 + }
  937 + },
  938 + close() {
  939 + this.dialog = false;
  940 + setTimeout(() => {
  941 + this.editedItem = Object.assign({}, this.defaultItem);
  942 + this.editedIndex = -1;
  943 + }, 300);
  944 + },
  945 + close1() {
  946 + this.dialog1 = false;
  947 + },
  948 + closedialogLecture() {
  949 + this.dialogAddLecture = false;
  950 + this.$router.go(0)
  951 + },
  952 + closeUpdateLectures(){
  953 + this.dialogUpdateLectures = false;
  954 + },
  955 + submit() {
  956 + if (this.$refs.form.validate()) {
  957 + let imageData = new FormData();
  958 + imageData.append("upload", this.imageFile);
  959 + // console.log(imageData);
  960 + let addTimeTable = {
  961 + sectionId: this.timeTable.selectSection,
  962 + classId: this.timeTable.select,
  963 + schedule: [
  964 + {
  965 + day: this.timeTable.selectDay,
  966 + lectures: [
  967 + {
  968 + timeIn: this.timeTable.timeIn,
  969 + timeOut: this.timeTable.timeOut,
  970 + lectureNum: this.timeTable.lectureNum,
  971 + subjectName: this.timeTable.subjectName,
  972 + teacherId: this.timeTable.selectTeacher
  973 + }
  974 + ]
  975 + }
  976 + ]
  977 + };
  978 + http()
  979 + .post("/createTimeTable", addTimeTable)
  980 + .then(response => {
  981 + // console.log("addTimeTable=====>", addTimeTable);
  982 + if ((this.snackbar = true)) {
  983 + this.text = "New Time Table added successfully";
  984 + }
  985 + this.getTimeTableList();
  986 + this.clear();
  987 + })
  988 + .catch(error => {
  989 + // console.log(error);
  990 + if ((this.snackbar = true)) {
  991 + this.text = error.response.data.message;
  992 + }
  993 + });
  994 + }
  995 + },
  996 + mail() {},
  997 + download() {},
  998 + clear() {
  999 + this.$refs.form.reset();
  1000 + },
  1001 + save() {
  1002 + let imageData = new FormData();
  1003 + imageData.append("upload", this.imageFile);
  1004 + // console.log(imageData);
  1005 + let editTimeTable = {
  1006 + timeTableId: this.editedItem._id,
  1007 + classId: this.editedItem.classNum,
  1008 + sectionId: this.editedItem.selectSection
  1009 + // imageData
  1010 + };
  1011 + http()
  1012 + .put("/updateTimeTable", editTimeTable)
  1013 + .then(response => {
  1014 + console.log("editTimeTable",editTimeTable);
  1015 + if ((this.snackbar = true)) {
  1016 + this.text = "Successfully Edit Existing User";
  1017 + }
  1018 + this.getTimeTableList();
  1019 + })
  1020 + .catch(error => {
  1021 + // console.log(error);
  1022 + });
  1023 + this.close();
  1024 + },
  1025 + handleDrawerToggle() {
  1026 + window.getApp.$emit("APP_DRAWER_TOGGLED");
  1027 + },
  1028 + handleFullScreen() {
  1029 + Util.toggleFullScreen();
  1030 + },
  1031 + deleteTimeTable(timeToDelete){
  1032 + // console.log('timeToUpdate', timeToDelete._id);
  1033 + let deleteLecture = {
  1034 + lectureId: timeToDelete._id
  1035 + };
  1036 + http()
  1037 + .delete(
  1038 + "/deleteLecture",
  1039 + confirm("Are you sure you want to delete this?") && {
  1040 + params: deleteLecture
  1041 + }
  1042 + )
  1043 + .then(response => {
  1044 + // console.log("deleteLecture",deleteLecture)
  1045 + if ((this.snackbar = true)) {
  1046 + this.text = "Successfully delete Existing User";
  1047 + }
  1048 + this.$router.go(0)
  1049 + // this.getTimeTable();
  1050 + })
  1051 + .catch(error => {
  1052 + console.log(error);
  1053 + });
  1054 + },
  1055 + },
  1056 + mounted() {
  1057 + this.getTimeTableList();
  1058 + var token = this.$store.state.token;
  1059 + http()
  1060 + .get("/getClassesList", {
  1061 + headers: { Authorization: "Bearer " + token }
  1062 + })
  1063 + .then(response => {
  1064 + this.addclass = response.data.data;
  1065 + // console.log("getClassesList=====>",this.addclass)
  1066 + })
  1067 + .catch(err => {
  1068 + // console.log("err====>", err);
  1069 + });
  1070 +
  1071 + http()
  1072 + .get("/getTeachersList", {
  1073 + headers: { Authorization: "Bearer " + token }
  1074 + })
  1075 + .then(response => {
  1076 + this.addTeachers = response.data.data;
  1077 + // console.log("getClassesList=====>",this.addTeachers)
  1078 + })
  1079 + .catch(err => {
  1080 + // console.log("err====>", err);
  1081 + });
  1082 + },
  1083 + computed: {
  1084 + toolbarColor() {
  1085 + return this.$vuetify.options.extra.mainNav;
  1086 + }
  1087 + }
  1088 +};
  1089 +</script>
  1090 +<style scoped>
  1091 +.theme--light .v-label, .application .theme--light.v-label {
  1092 + color: black;
  1093 +}
  1094 +.v-tabs__div {
  1095 + text-transform: none;
  1096 +}
  1097 +.v-input__prepend-outer {
  1098 + margin-right: 0px !important;
  1099 +}
  1100 +.v-card__actions .v-btn {
  1101 + margin: 0 15px;
  1102 + min-width: 120px;
  1103 +}
  1104 +.primary {
  1105 + background-color: #aaa !important;
  1106 + border-color: #aaa !important;
  1107 +}
  1108 +h4 {
  1109 + background-repeat: no-repeat;
  1110 + padding: 8px;
  1111 + margin: auto;
  1112 + font-size: 25px;
  1113 +}
  1114 +#name {
  1115 + position: absolute;
  1116 + left: 100px;
  1117 + top: 17px;
  1118 +}
  1119 +#icon {
  1120 + position: absolute;
  1121 + right: 8px;
  1122 + top: 8px;
  1123 +}
  1124 +#m {
  1125 + position: relative;
  1126 + left: 135px;
  1127 + top: -15px;
  1128 +}
  1129 +#G {
  1130 + position: absolute;
  1131 + top: 38px;
  1132 + color: white;
  1133 +}
  1134 +#bt {
  1135 + position: relative;
  1136 + top: -20px;
  1137 + left: 115px;
  1138 +}
  1139 +#e {
  1140 + position: relative;
  1141 + top: 5px;
  1142 + right: -30px;
  1143 + height: 17px;
  1144 + cursor: pointer;
  1145 +}
  1146 +#d {
  1147 + position: relative;
  1148 + top: 5px;
  1149 + right: -70px;
  1150 + height: 17px;
  1151 + cursor: pointer;
  1152 +}
  1153 +#td {
  1154 + border: 1px solid #dddddd;
  1155 + text-align: left;
  1156 + padding: 8px;
  1157 +}
  1158 +#dialog {
  1159 + height: 550px;
  1160 +}
  1161 +.active {
  1162 + background-color: black;
  1163 + color: white !important;
  1164 +}
  1165 +.activebtn {
  1166 + color: black !important;
  1167 +}
  1168 +#flex {
  1169 + height: 300px;
  1170 +}
  1171 +.top {
  1172 + margin-top: 100px;
  1173 +}
  1174 +.v-tabs__item a {
  1175 + font-size: 16px !important;
  1176 +}
  1177 +@media screen and (max-width: 769px) {
  1178 + .top {
  1179 + margin-top: 0 !important;
  1180 + }
  1181 + .userSearch .v-icon {
  1182 + font-size: 20px !important;
  1183 + margin-left: 20px;
  1184 + }
  1185 +}
  1186 +@media screen and (max-width: 380px) {
  1187 + .right {
  1188 + float: none !important;
  1189 + }
  1190 + .subheading {
  1191 + font-size: 14px !important;
  1192 + }
  1193 + .v-card__actions .v-btn {
  1194 + margin: 0 0px;
  1195 + min-width: 100px;
  1196 + }
  1197 + /* .searchIcon .v-icon {
  1198 + font-size: 20px;
  1199 + margin-left: 20px;
  1200 +} */
  1201 + .subheading {
  1202 + font-size: 12px !important;
  1203 + }
  1204 + h5 {
  1205 + font-size: 13px;
  1206 + }
  1207 +}
  1208 +.v-icon {
  1209 + font-size: 30px;
  1210 +}
  1211 +@media screen and (min-width: 1270px) {
  1212 + .hide {
  1213 + display: none;
  1214 + }
  1215 + /* }
  1216 +@media screen and (max-width: 962px) {
  1217 +.imglogo{
  1218 + position: absolute;
  1219 + top: 13px;
  1220 + left: 13px !important;
  1221 + width: 70px;
  1222 + height: 24px;
  1223 +} */
  1224 +}
  1225 +@media screen and (max-width: 420px) {
  1226 + .userSearch .v-text-field .v-label {
  1227 + line-height: 24px !important;
  1228 + }
  1229 + .userSearch .v-label {
  1230 + font-size: 13px !important;
  1231 + }
  1232 + .v-list__tile {
  1233 + font-size: 14px;
  1234 + padding: 0 10px;
  1235 + }
  1236 + .name {
  1237 + font-size: 15px;
  1238 + }
  1239 +}
  1240 +</style>
0 1241 \ No newline at end of file
... ...
static/icon/delete1.png

682 Bytes