Files
myprojplanet_vite/src/layouts/toolbar/notifPopover/notifPopover.vue

125 lines
4.4 KiB
Vue
Raw Normal View History

2022-07-10 01:24:54 +02:00
<template>
<div>
<q-btn flat round dense icon="fas fa-bell" class="q-mx-xs" @click="open = !open">
2022-07-21 00:20:48 +02:00
<q-badge v-if="num_notifs_unread > 0" floating color="red">{{ num_notifs_unread }}</q-badge>
</q-btn>
<q-btn v-if="false" flat round dense icon="fas fa-bell">
2022-07-21 00:20:48 +02:00
<q-badge v-if="num_notifs_unread > 0" floating color="red">{{ num_notifs_unread }}</q-badge>
</q-btn>
2022-07-10 01:24:54 +02:00
2022-07-21 00:20:48 +02:00
<q-drawer v-model="open" side="right" elevated class="text-black">
2022-07-10 01:24:54 +02:00
<q-bar class="bg-primary text-white">
{{ $t('notifs.notifs') }}
<q-space/>
2022-07-21 00:20:48 +02:00
<q-btn round dense icon="fas fa-pencil-alt" class="q-mx-xs">
<q-menu style="min-width: 200px">
<q-list style="">
<q-item clickable v-close-popup to="/notifs">
<q-item-section side>
<q-icon name="fas fa-cog"/>
</q-item-section>
<q-item-section>{{ $t('notifs.settings') }}</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="notifStore.setAllRead(username)">
<q-item-section side>
<q-icon name="fas fa-check"/>
</q-item-section>
<q-item-section>{{ $t('notifs.setallread') }}</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
<q-btn flat round color="white" icon="close" @click="open = false"></q-btn>
</q-bar>
2022-07-10 01:24:54 +02:00
2022-07-21 00:20:48 +02:00
<div class="row justify-center margin_buttons q-gutter-lg">
<q-btn-toggle
v-model="show_all"
class="my-custom-toggle"
no-caps
rounded
dense
unelevated
toggle-color="primary"
color="white"
text-color="primary"
:options="[
{label: t('notifs.all'), value: true},
{label: t('notifs.notread'), value: false}
]"
/>
</div>
2022-07-21 00:20:48 +02:00
<div class="clBorderSperator"></div>
<div class="q-ma-xs">
<q-list bordered class="rounded-borders">
2022-07-10 01:24:54 +02:00
2022-07-21 00:20:48 +02:00
<div v-if="num_notifs_unread === 0">
2022-07-10 01:24:54 +02:00
<q-item>
<q-item-label lines="1">{{ $t('notifs.nonotif') }}</q-item-label>
2022-07-10 01:24:54 +02:00
</q-item>
</div>
2022-07-21 00:20:48 +02:00
<q-item clickable v-for="(notif, index) in lasts_notifs" :key="index" @click="clickNotif(notif)">
2022-07-10 01:24:54 +02:00
2022-07-21 00:20:48 +02:00
<!--<q-item-section avatar>
2022-07-10 01:24:54 +02:00
<q-avatar>
<q-item-label lines="1">{{ getTypeNotif(notif) }}</q-item-label>
</q-avatar>
</q-item-section>-->
2022-07-21 00:20:48 +02:00
<q-item-section avatar>
<q-avatar>
<img :src="getImgByNotif(notif)" :alt="getUsernameChatByNotif(notif)">
</q-avatar>
</q-item-section>
<q-item-section v-ripple >
<q-item-label lines="1" :class="(!notif.read) ? 'unread' : 'read'">{{ getNotifText(notif, false) }}</q-item-label>
2022-07-10 01:24:54 +02:00
<q-item-label caption lines="2">
2022-07-21 00:20:48 +02:00
{{ tools.getstrDateTimeShort(notif.datenotif) }}
<!--{{ // getUsernameChatByNotif(notif) }}-->
2022-07-10 01:24:54 +02:00
</q-item-label>
</q-item-section>
2022-07-21 00:20:48 +02:00
<q-item-section side>
<q-item-label>
<q-btn rounded icon="fas fa-pencil-alt">
<q-menu>
<q-list style="min-width: 150px">
<q-item clickable v-close-popup @click="notifStore.deleteRec(notif._id)">
<q-item-section side>
<q-icon name="fas fa-trash-alt"/>
</q-item-section>
<q-item-section>{{ $t('notifs.delete_notif') }}</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="notifStore.deactivateRec(notif._id)">
<q-item-section side>
<q-icon name="fas fa-trash-alt"/>
</q-item-section>
<q-item-section>{{ $t('notifs.deactivate_notif') }}</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</q-item-label>
2022-07-10 01:24:54 +02:00
</q-item-section>
2022-07-21 00:20:48 +02:00
2022-07-10 01:24:54 +02:00
</q-item>
<q-separator/>
</q-list>
</div>
</q-drawer>
2022-07-10 01:24:54 +02:00
</div>
</template>
<script lang="ts" src="./notifPopover.ts">
</script>
2022-07-21 00:20:48 +02:00
<style lang="scss" scoped>
@import './notifPopover.scss';
</style>