diff --git a/quasar.config.ts b/quasar.config.ts index facd6ea2..9ce93693 100644 --- a/quasar.config.ts +++ b/quasar.config.ts @@ -38,7 +38,7 @@ export default configure((ctx) => { }, framework: { config: {}, - plugins: ['Dark', 'Dialog'], + plugins: ['Dark', 'Dialog', 'Notify'], iconSet: 'mdi-v7', cssAddon: true, }, diff --git a/src/i18n/en-US/index.ts b/src/i18n/en-US/index.ts index 59c909c6..c9f98e53 100644 --- a/src/i18n/en-US/index.ts +++ b/src/i18n/en-US/index.ts @@ -74,6 +74,7 @@ export default { use: 'In Use', notUse: 'Not Use', orderNumber: 'Order Number', + saveSuccessful: 'Save Successful', ...status, ...main, ...address, diff --git a/src/i18n/th-th/index.ts b/src/i18n/th-th/index.ts index a3c77553..576821e5 100644 --- a/src/i18n/th-th/index.ts +++ b/src/i18n/th-th/index.ts @@ -76,6 +76,7 @@ export default { use: 'ใช้งาน', notUse: 'ไม่ใช้งาน', orderNumber: 'ลําดับ', + saveSuccessful: 'บันทึกข้อมูลสำเร็จ', ...status, ...main, ...address, diff --git a/src/stores/utils/index.ts b/src/stores/utils/index.ts index c3a15b43..5eed9e96 100644 --- a/src/stores/utils/index.ts +++ b/src/stores/utils/index.ts @@ -1,4 +1,4 @@ -import { Dialog, QSelect } from 'quasar'; +import { Dialog, QSelect, Notify, QNotifyCreateOptions } from 'quasar'; import GlobalDialog from 'components/GlobalDialog.vue'; import { ComposerTranslation, useI18n } from 'vue-i18n'; import { defineStore } from 'pinia'; @@ -46,6 +46,36 @@ export function dialogWarningClose( }); } +export function notify( + type: 'create', + message?: string, + opts?: QNotifyCreateOptions | string, +) { + if (type === 'create') { + Notify.create({ + icon: 'mdi-check-circle', + iconColor: 'white', + iconSize: '42px', + color: 'positive', + message: message, + position: 'bottom', + timeout: 1000, + group: false, + actions: [ + { + icon: 'mdi-close', + color: 'white', + round: true, + handler: () => {}, + }, + ], + }); + } + if (opts) { + Notify.create(opts); + } +} + export function moveItemUp(items: unknown[], index: number) { if (index > 0) { const temp = items[index];