Blame view

src/pages/Dashboard/ChapterInfo.vue 7.17 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
39
40
          <v-flex xs8>
            <!-- CHAPTER INFO -->
            <div class="title side-bar-color font-weight-bold">{{chapter.chapters[0].chapterName}}</div>
            <div class="subheading grey--text lighten-1">{{chapter.chapters[0].description}}</div>
            <div
              v-for="(point,index) in chapter.chapters[0].chapterPoints"
              :key="index"
              class="ml-2 mt-2"
            >
              <span class="subheading grey--text lighten-1">{{index +1}}. {{point}}</span>
            </div>
            <!-- ACTIVITIES -->
            <div class="mt-5">
              <v-icon>library_books</v-icon>
              <span class="subheading font-weight-bold">Activities</span>
            </div>
            <!-- OTHER OPTIONS -->
            <div class="mt-5">
ac24ec07a   Amber Dev   added live online
41
42
43
44
45
46
47
48
49
50
51
52
53
              <ul class="subheading" style="cursor: pointer">
                <li @click="$router.push({name: 'Live Online Class'})">
                  <v-btn flat>Live online classes solution</v-btn>
                </li>
                <!-- <li>
                  <v-btn flat>Tutorial-pharmacetutical</v-btn>
                </li>
                <li>
                  <v-btn flat>HSP Interactive content</v-btn>
                </li>
                <li>
                  <v-btn flat>Assessment</v-btn>
                </li>-->
fe15ee8b4   Amber Dev   added course chap...
54
55
              </ul>
            </div>
0e5675ffe   Amber Dev   added chapter nav...
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
            <!-- SELECT CHAPTERS -->
            <v-layout row class="mt-5">
              <!-- PREVIOUS CHAPTER -->
              <v-flex
                style="cursor: pointer;"
                class="subheading font-weight-bold text-xs-left"
                v-if="indexSelectedChapter > 0"
                @click="showSelectedChapter('back')"
              >
                <v-icon class="black--text" style="position:relative; top: 4px;">chevron_left</v-icon>
                {{chapterNames[indexSelectedChapter - 1]}}
              </v-flex>
              <v-spacer></v-spacer>
              <!-- NEXT CHAPTER -->
              <v-flex
                style="cursor: pointer;"
                class="subheading font-weight-bold text-xs-right"
                v-if="indexSelectedChapter < chapterNames.length -1"
                @click="showSelectedChapter('forward')"
              >
fe15ee8b4   Amber Dev   added course chap...
76
77
                {{chapterNames[indexSelectedChapter + 1]}}
                <v-icon class="black--text" style="position:relative; top: 4px;">chevron_right</v-icon>
0e5675ffe   Amber Dev   added chapter nav...
78
79
              </v-flex>
            </v-layout>
fe15ee8b4   Amber Dev   added course chap...
80
81
82
83
84
85
86
87
88
89
90
91
            <!-- <v-flex class="text-xs-right mt-5" v-else>
              <span class="subheading font-weight-bold">Return to chapter one</span>
            </v-flex>-->
          </v-flex>
  
          <v-spacer></v-spacer>
  
          <!-- COURSES - positioned to the right of the page -->
          <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>
6f7cf8cf5   Amber Dev   added discussion ...
92
93
94
95
96
97
98
99
100
101
                <div v-for="(course,index) in courseData" :key="index">
                  <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>
0a5256600   Amber Dev   added events
102
                      {{course.courseName}}
6f7cf8cf5   Amber Dev   added discussion ...
103
104
                    </div>
                  </v-btn>
fe15ee8b4   Amber Dev   added course chap...
105
106
107
108
109
110
                </div>
              </v-container>
            </v-card>
          </v-flex>
        </v-layout>
      </v-container>
fe15ee8b4   Amber Dev   added course chap...
111
112
113
114
    </div>
  </template>
  <script>
  import http from "@/Services/http.js";
6f7cf8cf5   Amber Dev   added discussion ...
115
  import AllApiCalls from "@/Services/AllApiCalls.js";
fe15ee8b4   Amber Dev   added course chap...
116
  export default {
6f7cf8cf5   Amber Dev   added discussion ...
117
    mixins: [AllApiCalls],
fe15ee8b4   Amber Dev   added course chap...
118
119
    data() {
      return {
6f7cf8cf5   Amber Dev   added discussion ...
120
        // courseData: [],
fe15ee8b4   Amber Dev   added course chap...
121
122
123
124
125
126
127
128
129
        showLoader: false,
        chapter: { chapters: [{}] },
        chapterNames: [],
        chapterIds: [],
        selectedChapterId: "",
        indexSelectedChapter: ""
      };
    },
    methods: {
0e5675ffe   Amber Dev   added chapter nav...
130
131
132
133
134
135
136
137
138
139
140
      showSelectedChapter(newChapter) {
        if (newChapter == "forward") {
          this.indexSelectedChapter += 1;
          this.selectedChapterId = this.chapterIds[this.indexSelectedChapter];
          this.getParticularChapterDetail();
        }
        if (newChapter == "back") {
          this.indexSelectedChapter -= 1;
          this.selectedChapterId = this.chapterIds[this.indexSelectedChapter];
          this.getParticularChapterDetail();
        }
fe15ee8b4   Amber Dev   added course chap...
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
      },
      getParticularChapterDetail() {
        http()
          .get("/getParticularChapterDetail", {
            params: {
              courseDetailId: this.$route.query.courseDetailId,
              chapterId: this.selectedChapterId
            }
          })
          .then(response => {
            this.chapter = response.data.data;
            console.log(" chapter data - ", this.chapter);
            this.showLoader = false;
          })
          .catch(err => {
            console.log("err====>", err);
            this.showLoader = false;
          });
6f7cf8cf5   Amber Dev   added discussion ...
159
160
161
162
163
164
165
166
167
168
169
170
171
172
      },
      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...
173
174
175
176
177
178
179
      }
    },
    // computed:{
    //   nextChapterIndex(){
  
    //   }
    // }
6f7cf8cf5   Amber Dev   added discussion ...
180
    async created() {
fe15ee8b4   Amber Dev   added course chap...
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
      console.log("route query - ", this.$route.query);
  
      this.selectedChapterId = this.$route.query.chapterId;
  
      /* set chapterNames array */
      this.chapterNames = Object.keys(this.$route.query);
      this.chapterNames.pop();
      this.chapterNames.pop();
      console.log("chapter names - ", this.chapterNames);
  
      /* set chapter Ids */
      this.chapterIds = Object.values(this.$route.query);
      this.chapterIds.pop();
      this.chapterIds.pop();
      console.log("chapter Ids - ", this.chapterIds);
  
      this.indexSelectedChapter = this.chapterIds.findIndex(id => {
        return id == this.selectedChapterId;
      });
      console.log(" index of selected chapter - ", this.indexSelectedChapter);
  
      /* get chapter clicked on using the id */
6f7cf8cf5   Amber Dev   added discussion ...
203
      await this.getParticularChapterDetail(this.selectedChapterId);
fe15ee8b4   Amber Dev   added course chap...
204

6f7cf8cf5   Amber Dev   added discussion ...
205
206
207
208
209
      /* 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...
210
211
212
213
214
215
216
217
218
219
220
221
222
    }
  };
  </script>
  <style scoped>
  .side-bar-color {
    color: #827bfa !important;
    /* border-top-right-radius: 74px !important; */
  }
  .card-border {
    border: 1px #bdbdbd solid;
    border-radius: 3px;
  }
  </style>