<template>
  <div class="q-pa-md q-gutter-y-md">
    <div
      class="flex justify-between items-center bg-white q-pa-md rounded-borders"
    >
      <div class="column justify-center text-h5">
        {{ $t('notifications.notificationsConstructor') }}
      </div>
      <div class="q-gutter-sm">
        <q-btn
          color="primary"
          icon="receipt"
          label="Шаблоны сообщений"
          :to="{ name: 'notificationTemplates' }"
        />
        <q-btn
          color="primary"
          icon="create"
          :label="$t('notifications.create')"
          @click="createNotification"
        />
      </div>
    </div>
    <div class="bg-white rounded-borders">
      <BaseTable
        v-model="inputSearch"
        :columns="columns"
        :onlyMy.sync="model.onlyMy"
        :data="model.notifications"
        :loading="model.loading"
        :pagination.sync="model.pagination"
        :visible-columns="model.visibleColumns"
        :title="$t('notifications.title')"
        @requestTable="init"
        @update="init"
      >
        <template #search>
          <notifications-search-bar
            :query="searchQuery"
            @save-data="saveData"
            @query="fetch"
          />
        </template>
      </BaseTable>
    </div>
  </div>
</template>

<script lang="ts" src="./index.ts"></script>
