Ngiler SH3LL 360
Home
Information
Create File
Create Folder
:
/
home
/
tbf
/
curs.tbf.ro
/
src
/
components
/
Modals
/
Information Server
MySQL :
OFF
Perl :
OFF
CURL :
ON
WGET :
OFF
PKEXEC :
OFF
Directive
Local Value
IP Address
89.40.16.97
System
Linux server.atelieruldeit.ro 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64
User
tbf
PHP Version
7.3.33
Software
Apache
Doc root
Writable
close
Edit File :
Notifications.vue
| Size :
7.94
KB
Copy
<template> <div class="modal-sidebar notifications"> <div class="fe-btn-translation" @click="$root.$emit('open_modal_translation', 'Notifications', arrayTranslations)" v-if="globalTranslate">OPEN TRANSLATION</div> <div class="top"> <h1>{{ $t('notifications.title') }}</h1> <div class="btn-default-tbf close-btn" @click="closeModal"><icon-plus class="icon-close" /></div> </div> <div class="notification-header" v-if="loaded"> <p v-bind:class="{active: active_tab == 'activity'}" @click="changeTab('activity')">{{ $t('notifications.activity') }}</p> <p v-bind:class="{active: active_tab == 'new'}" @click="changeTab('new')">{{ $t('notifications.new') }} (<span class="clickable-unread-counter">{{ countUnread }}</span>)</p> </div> <!-- Activitatea companiei --> <div class="notification-list clickable-notification-list" v-if="loaded && active_tab == 'activity'"> <div class="notification-box" :id="'notification-box-'+notification.id" v-for="notification in activity_notifications" v-bind:class="{'is-link': notification.need_link}"> <div class="left-side" v-if="$resize && $mq.above(600)"><icon-arrow :id="'notification-' + notification.id" class="icon-arrow right"/></div> <div class="center" @click="notification.need_link ? viewObjective(notification.objective_slug, notification, 'clickable', 'activity') : ''"> <img v-if="notification.avatar != null && notification.type != 'objective_percent'" :src="notification.avatar" class="img-responsabile"> <div class="bell" v-else><bell /></div> <div class="content-notification"> <p v-html="notification.name"></p> <span class="date">{{notification.created_at | moment("D MMMM YYYY")}}</span> </div> </div> <div class="right-side" v-if="$resize && $mq.above(600)"> </div> </div> <infinite-loading :identifier="1" @infinite="infiniteNotificationsActivity"><div slot="no-more"></div><div slot="no-results"></div></infinite-loading> </div> <div class="no-notifications" v-if="Object.keys(activity_notifications).length == 0 && loaded && active_tab == 'activity'"> <img src="/build/icons/bell2.svg" class="icon"> <p>{{ $t('notifications.all-good') }}</p> <span>{{ $t('notifications.no-notifications') }}</span> </div> <!-- Notificari click-uibile --> <div class="notification-list clickable-notification-list" v-if="loaded && active_tab == 'new'"> <div class="notification-box" :id="'notification-box-'+notification.id" v-for="notification in notifications" v-bind:class="{'is-link': notification.need_link}"> <div class="left-side" v-if="$resize && $mq.above(600)"><icon-arrow :id="'notification-' + notification.id" class="icon-arrow right"/></div> <div class="center" @click="notification.need_link ? viewObjective(notification.objective_slug, notification, 'clickable', 'personal') : ''"> <img v-if="notification.avatar != null && notification.type != 'objective_percent'" :src="notification.avatar" class="img-responsabile"> <div class="bell" v-else><bell /></div> <div class="content-notification" v-bind:class="{new: !notification.seen}"> <p v-html="notification.name"></p> <span class="date">{{notification.created_at | moment("D MMMM YYYY")}}</span> </div> </div> <div class="right-side" v-if="$resize && $mq.above(600)"> </div> </div> <infinite-loading :identifier="2" @infinite="infiniteNotifications"><div slot="no-more"></div><div slot="no-results"></div></infinite-loading> </div> <div class="no-notifications" v-if="Object.keys(notifications).length == 0 && loaded && active_tab == 'new'"> <img src="/build/icons/bell2.svg" class="icon"> <p>{{ $t('notifications.all-good') }}</p> <span>{{ $t('notifications.no-notifications') }}</span> </div> </div> </template> <script type="text/javascript"> import IconPlus from "../Icons/Plus" import Bell from "../Icons/Bell" import IconArrow from '../Icons/Arrow' import IconEditDots from '../Icons/EditDots' import IconLargeBell from '../Icons/LargeBell' import InfiniteLoading from 'vue-infinite-loading' export default { data() { return { loaded: false, notifications: {}, activity_notifications: {}, countUnread: 0, // read_notifications: {}, active_tab: 'new', view_more: 20, counter: 1, viewMoreUnread: 20, counterUnread: 1, arrayTranslations: [ 'notifications.title', 'notifications.activity', 'notifications.new', 'notifications.all-good', 'notifications.no-notifications', ] }; }, props:{ }, components: { InfiniteLoading, IconPlus, Bell, IconArrow, IconEditDots, IconLargeBell }, async mounted() { // await this.getReadNotifications(); await this.getNotifications(); await this.getActivityNotifications(); this.$root.$emit('clear_notifications'); this.$root.$on("updateNotificationsList", (parsedData) => { if(parsedData.for_activity){ this.activity_notifications.unshift(parsedData); } if(parsedData.for_personal){ this.notifications.unshift(parsedData); } }); }, methods: { async getNotifications(){ await axios.get('/notification-list').then(({data}) => { this.notifications = data.data.unread this.countUnread = data.data.count_unread this.loaded = true; }) }, async getActivityNotifications(){ await axios.get('/notification-list?type=activity').then(({data}) => { this.activity_notifications = data.data.activity this.loaded = true; }) }, infiniteNotifications($state2){ axios.get('/notification-list', {params: {view_more: this.viewMoreUnread }}).then(({data}) => { if(data.data.unread.length){ this.counterUnread++ this.viewMoreUnread = 20 * this.counterUnread this.activity_notifications.push(...data.data.unread) $state2.loaded() }else{ $state2.complete() } }) }, infiniteNotificationsActivity($state){ axios.get('/notification-list', {params: {type: 'activity', view_more: this.view_more }}).then(({data}) => { if(data.data.activity.length){ this.counter++ this.view_more = 20 * this.counter this.activity_notifications.push(...data.data.activity) $state.loaded() }else{ $state.complete() } }) }, markAsRead(notification, tab_type){ axios.patch('/notifications/' + notification.id, {}).then(({data}) => { this.getReadNotifications(); this.getNotifications(); }).catch(error => { }); }, closeModal(){ this.$emit("close_modal"); }, viewObjective(objectiveSlug, notification, notification_type, column){ var modal_type_kr = '' if(notification.frontend_type == 'key_results' || notification.frontend_type == 'logs'){ modal_type_kr = 'actualizari' this.$router.push({ name: 'show-objective-modal', params: { slug: objectiveSlug, krId: notification.key_result_id, modalType: modal_type_kr }}) }else if(notification.frontend_type == 'comments'){ modal_type_kr = 'comentarii' this.$router.push({ name: 'show-objective-modal', params: { slug: objectiveSlug, krId: notification.key_result_id, modalType: modal_type_kr }}) }else{ this.$router.push({ name: 'show-objective', params: { slug: objectiveSlug }}) } if(column == "personal"){ this.markAsRead(notification, notification_type); } this.closeModal(); }, changeTab(val) { this.active_tab = val; }, showDropdown(itemId){ if(itemId == this.hoverTag){ $('#dropdownEditNotif' + this.hoverTag).dropdown('toggle'); setTimeout(() => { this.hoverTag = '' }, 0) }else{ this.hoverTag = itemId setTimeout(() => { $('#dropdownEditNotif' + this.hoverTag).dropdown('toggle'); }, 0) } }, hideDropdown(){ if(this.hoverTag != ''){ $('#dropdownEditNotif' + this.hoverTag).dropdown('toggle'); setTimeout(() => { this.hoverTag = '' }, 0) } } } }; </script>
Back