NotificationsAdminPage.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <div class="notifications-page">
  3. <DefaultHeaderPage />
  4. <div class="row q-gutter-xs q-mb-md flex-wrap">
  5. <div
  6. v-for="tab in tabs"
  7. :key="tab.name"
  8. :class="['cat-chip', activeTab === tab.name ? 'cat-chip--selected' : 'cat-chip--default']"
  9. @click="activeTab = tab.name"
  10. >
  11. {{ tab.label }}
  12. </div>
  13. </div>
  14. <q-tab-panels v-model="activeTab" animated>
  15. <q-tab-panel name="nova" class="q-pa-none">
  16. <NewNotificationPanel @sent="onNotificationSent" />
  17. </q-tab-panel>
  18. <q-tab-panel name="historico" class="q-pa-none">
  19. <NotificationHistoryPanel ref="historyPanelRef" />
  20. </q-tab-panel>
  21. </q-tab-panels>
  22. </div>
  23. </template>
  24. <script setup>
  25. import { ref, computed } from "vue";
  26. import { useI18n } from "vue-i18n";
  27. import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
  28. import NewNotificationPanel from "./components/NewNotificationPanel.vue";
  29. import NotificationHistoryPanel from "./components/NotificationHistoryPanel.vue";
  30. const { t } = useI18n();
  31. const activeTab = ref("historico");
  32. const historyPanelRef = ref(null);
  33. const tabs = computed(() => [
  34. { name: "nova", label: t("notification.new") },
  35. { name: "historico", label: t("notification.history") },
  36. ]);
  37. const onNotificationSent = async () => {
  38. activeTab.value = "historico";
  39. await historyPanelRef.value?.refresh();
  40. };
  41. </script>
  42. <style scoped lang="scss">
  43. .cat-chip {
  44. display: inline-flex;
  45. align-items: center;
  46. justify-content: center;
  47. height: 28px;
  48. padding: 0 12px;
  49. border-radius: 5px;
  50. font-size: 12px;
  51. font-weight: 500;
  52. cursor: pointer;
  53. user-select: none;
  54. transition: background 0.15s, color 0.15s;
  55. &--default {
  56. background: #c9a3dc;
  57. color: #fff;
  58. }
  59. &--selected {
  60. background: #4d1658;
  61. color: #fff;
  62. }
  63. }
  64. </style>