feat: quasar notify

This commit is contained in:
puriphatt 2024-08-07 04:18:04 +00:00
parent ceb906724c
commit f958714445
4 changed files with 34 additions and 2 deletions

View file

@ -38,7 +38,7 @@ export default configure((ctx) => {
},
framework: {
config: {},
plugins: ['Dark', 'Dialog'],
plugins: ['Dark', 'Dialog', 'Notify'],
iconSet: 'mdi-v7',
cssAddon: true,
},

View file

@ -74,6 +74,7 @@ export default {
use: 'In Use',
notUse: 'Not Use',
orderNumber: 'Order Number',
saveSuccessful: 'Save Successful',
...status,
...main,
...address,

View file

@ -76,6 +76,7 @@ export default {
use: 'ใช้งาน',
notUse: 'ไม่ใช้งาน',
orderNumber: 'ลําดับ',
saveSuccessful: 'บันทึกข้อมูลสำเร็จ',
...status,
...main,
...address,

View file

@ -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];