CoursesSideBar.vue 2.18 KB
<template>
  <div>
    <!-- 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>

    <v-container class="pt-0">
      <div class="side-bar-color font-weight-bold title">Courses</div>

      <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>
            {{course.courseName}}
          </div>
        </v-btn>
      </div>
    </v-container>
  </div>
</template>
<script>
import AllApiCalls from "@/Services/AllApiCalls.js";
export default {
  mixins: [AllApiCalls],
  data() {
    return {};
  },
  methods: {
    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");
      }
    }
  },
  async created() {
    /* getStudentCourses - to get courseData - defined in GetApis.js*/
    await this.getStudentCourses({
      classId: localStorage.getItem("parentClassId"),
      studentId: localStorage.getItem("parentStudentId")
    });
  }
};
</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>