| | |
| | | </div> |
| | | <div class="pam-header__action-bar"> |
| | | <i |
| | | v-if="currentRole" |
| | | v-if="isShowNotification" |
| | | class="icon-bell text--dark-blue cursor--pointer fix-chrome-click--issue" |
| | | @click="$router.push('/notification')" |
| | | ></i> |
| | |
| | | |
| | | <script lang="ts"> |
| | | import { Vue, Component } from 'vue-property-decorator'; |
| | | import { namespace } from 'nuxt-property-decorator'; |
| | | import { Action, namespace, State, Watch } from 'nuxt-property-decorator'; |
| | | import { Role } from '~/shared/models/enum/Role'; |
| | | import * as _ from 'lodash'; |
| | | import { NotificationList } from '~/shared/models/reviews.model'; |
| | | import { AppointmentLog } from '~/shared/models/appointment.model'; |
| | | |
| | | const roleStorage = namespace('localStorage'); |
| | | @Component |
| | |
| | | |
| | | @roleStorage.Getter |
| | | isAdminLogin!: boolean; |
| | | |
| | | @roleStorage.Getter |
| | | isUserLogin!: boolean; |
| | | |
| | | @Action |
| | | storeMyPersonalNotification!: () => void; |
| | | |
| | | @State |
| | | notificationList!: NotificationList[]; |
| | | |
| | | @Action |
| | | storeMyAppointmentReviewLog!: () => void; |
| | | |
| | | @State |
| | | unReviewLogList!: AppointmentLog[]; |
| | | |
| | | isOpenDropdown = false; |
| | | |
| | |
| | | |
| | | ////////////////////////////////////////////////////////////////////// |
| | | |
| | | @Watch('$route', {immediate: true}) |
| | | onRouterChange() { |
| | | this.getNotificationAndReviewLog(); |
| | | } |
| | | |
| | | private getNotificationAndReviewLog() { |
| | | if (this.isUserLogin) { |
| | | this.storeMyPersonalNotification(); |
| | | this.storeMyAppointmentReviewLog(); |
| | | } |
| | | |
| | | if (this.isAdminLogin) { |
| | | this.storeMyPersonalNotification(); |
| | | } |
| | | } |
| | | |
| | | ////////////////////////////////////////////////////////////////////// |
| | | |
| | | routerNavigateTo(url: string): void { |
| | | (this.$refs.dropdown as any).hide(); |
| | | _.isEqual(url,'') |
| | |
| | | return this.idToken && this.currentRole ? (this.currentRole as Role): Role.NOT_LOGIN; |
| | | } |
| | | |
| | | get isShowNotification() { |
| | | if (this.isUserLogin) { |
| | | return this.notificationList.length || this.unReviewLogList.length; |
| | | } |
| | | if (this.isAdminLogin) { |
| | | return this.notificationList.length |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | </script> |