Blame view

src/pages/Dashboard/CourseDetails.vue 5.95 KB
fe15ee8b4   Amber Dev   added course chap...
1
2
  <template>
    <div>
6f7cf8cf5   Amber Dev   added discussion ...
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
      <!-- LOADER -->
      <div class="loader" v-if="showLoader">
        <v-progress-circular indeterminate color="white"></v-progress-circular>
      </div>
  
      <!-- SNACKBAR -->
      <v-snackbar
        :timeout="timeout"
        :top="y === 'top'"
        :right="x === 'right'"
        :vertical="mode === 'vertical'"
        v-model="snackbar"
        :color="snackbarColor"
      >
        {{ text }}
        <v-spacer></v-spacer>
        <v-btn flat text @click="snackbar = false">X</v-btn>
      </v-snackbar>
fe15ee8b4   Amber Dev   added course chap...
21
      <v-container class="pt-0">
6f7cf8cf5   Amber Dev   added discussion ...
22
        <v-layout row class="mt-1">
fe15ee8b4   Amber Dev   added course chap...
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
          <v-flex xs8>
            <div
              class="title side-bar-color font-weight-bold"
            >Welcome to the {{courseDetails[0].courseId.coursrName}} Course for {{courseDetails[0].classId.classNum}} class</div>
            <v-flex xs12 class="subheading mt-2">
              Lorem Ipsum sdjjkhsdf sdklfjs dkfjskdjfk fjsdklf sdjfksljf sdfkls fljlkj kl
              jkhjkfhjksd sdfjkhsdjk fsdjkl sfkljkl ldkfjkl kjlfs dlkjlskd fljsldk fklj
              lksjdfljklsdj flkjs dflkjsd flkjsd lfkjsd lfjsdjf lkj kl
            </v-flex>
            <div class="mt-5">
              <v-icon>question_answer</v-icon>
              <span class="grey--text lighten-1">Announcement</span>
            </div>
            <div>
              <span
                style="cursor: pointer;"
6f7cf8cf5   Amber Dev   added discussion ...
39
                @click="$router.push({name: 'Course Discussion Forum', query:{courseId: $route.query.courseId}})"
fe15ee8b4   Amber Dev   added course chap...
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
                class="grey--text lighten-1"
              >
                <v-icon>question_answer</v-icon>Course discussion forum
              </span>
            </div>
            <!-- CHAPTERS -->
            <v-layout column class="mt-5">
              <v-flex
                v-for="(chapter,index) in courseDetails[0].chapters"
                :key="index"
                style="cursor: pointer;"
                @click="routeToChapterInfo(chapter._id)"
              >
                <v-card class="mt-2 elevation-0 card-border">
                  <v-container class="pt-0">
                    <div class="title side-bar-color font-weight-bold">{{chapter.chapterName}}</div>
                    <div class="grey--text lighten-1 subheading">{{chapter.description}}</div>
                    <div
                      v-for="(point,index) in chapter.chapterPoints"
                      :key="index"
                      class="ml-2 mt-2"
                    >
                      <span class="grey--text lighten-1 subheading">{{index +1}}. {{point}}</span>
                    </div>
                  </v-container>
                </v-card>
              </v-flex>
            </v-layout>
          </v-flex>
          <v-spacer></v-spacer>
          <!-- COURSES -->
          <v-flex xs3>
            <v-card class="elevation-0 card-border" height="100%">
              <v-container class="pt-0">
                <div class="side-bar-color font-weight-bold title">Courses</div>
  
                <div v-for="(course,index) in courseData">
6f7cf8cf5   Amber Dev   added discussion ...
77
78
79
80
81
82
83
84
85
86
87
88
                  <v-btn
                    flat
                    class="subheading text-xs-start justify-left"
                    style="cursor: pointer;"
                    block
                    @click="routeToCourseDetails(course._id)"
                  >
                    <div style="width: 100%;text-align: left;">
                      <v-icon style="color: red;padding-bottom: 3px;" size="15">play_arrow</v-icon>
                      {{course.coursrName}}
                    </div>
                  </v-btn>
fe15ee8b4   Amber Dev   added course chap...
89
90
91
92
93
94
95
96
97
98
99
100
101
                </div>
                <!-- <v-expansion-panel focusable class="elevation-0">
                  <v-expansion-panel-content v-for="(item,i) in courseData" :key="i">
                    <template v-slot:header>
                      <div class="subheading">{{item.coursrName}}</div>
                    </template>
                  </v-expansion-panel-content>
                </v-expansion-panel>-->
              </v-container>
            </v-card>
          </v-flex>
        </v-layout>
      </v-container>
fe15ee8b4   Amber Dev   added course chap...
102
103
104
    </div>
  </template>
  <script>
6f7cf8cf5   Amber Dev   added discussion ...
105
  import AllApiCalls from "@/Services/AllApiCalls.js";
fe15ee8b4   Amber Dev   added course chap...
106
107
108
  import http from "@/Services/http.js";
  import moment from "moment";
  export default {
6f7cf8cf5   Amber Dev   added discussion ...
109
    mixins: [AllApiCalls],
fe15ee8b4   Amber Dev   added course chap...
110
111
112
113
114
    data() {
      return {
        showLoader: false,
        courseDetails: [{ courseId: {}, classId: {} }],
        chapterIds: [],
6f7cf8cf5   Amber Dev   added discussion ...
115
        // courseData: [],
fe15ee8b4   Amber Dev   added course chap...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
        courseDataTree: []
      };
    },
    methods: {
      routeToChapterInfo(chapterId) {
        /* set value of present chapter selected, and other chapters ids in the obj */
        let obj = {};
        for (var i = 0; i < this.courseDetails[0].chapters.length; i++) {
          obj[
            this.courseDetails[0].chapters[i].chapterName
          ] = this.courseDetails[0].chapters[i]._id;
        }
        obj.chapterId = chapterId;
        obj.courseDetailId = this.courseDetails[0]._id;
        this.$router.push({
          name: "Chapter Info",
          query: obj
        });
6f7cf8cf5   Amber Dev   added discussion ...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
      },
      async routeToCourseDetails(courseId) {
        /* getParticularCourseDetail- To get courseDetail - defined in GetApis.js*/
        let response = await this.getParticularCourseDetail(courseId);
  
        /* If the response is null then dont route */
        if (response.data.data.length > 0) {
          this.$router.push({
            name: "Course Details",
            query: { courseId: courseId }
          });
        } else {
          this.seeSnackbar("No Data Available", "warning");
        }
fe15ee8b4   Amber Dev   added course chap...
148
149
      }
    },
6f7cf8cf5   Amber Dev   added discussion ...
150
151
152
153
154
155
    async created() {
      /* getParticularCourseDetail- To get courseDetail - defined in GetApis.js*/
      let response = await this.getParticularCourseDetail(
        this.$route.query.courseId
      );
      this.courseDetails = response.data.data;
fe15ee8b4   Amber Dev   added course chap...
156

6f7cf8cf5   Amber Dev   added discussion ...
157
158
159
160
161
      /* getStudentCourses - to get courseData - defined in GetApis.js*/
      await this.getStudentCourses({
        classId: localStorage.getItem("parentClassId"),
        studentId: localStorage.getItem("parentStudentId")
      });
fe15ee8b4   Amber Dev   added course chap...
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
    }
  };
  </script>
  <style scoped>
  .side-bar-color {
    color: #827bfa !important;
    /* border-top-right-radius: 74px !important; */
  }
  .card-border {
    border: 1px #bdbdbd solid;
    border-radius: 3px;
  }
  /* .v-treeview-node__toggle {
    color: red !important;
  } */
  </style>