feat: rating component
This commit is contained in:
35
frontend/src/utils/dialogs.js
Normal file
35
frontend/src/utils/dialogs.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import { Dialog, ErrorMessage } from 'frappe-ui'
|
||||
import { h, reactive, ref } from 'vue'
|
||||
|
||||
let dialogs = ref([])
|
||||
|
||||
export let Dialogs = {
|
||||
name: 'Dialogs',
|
||||
render() {
|
||||
return dialogs.value.map((dialog) => {
|
||||
return h(
|
||||
Dialog,
|
||||
{
|
||||
options: dialog,
|
||||
modelValue: dialog.show,
|
||||
'onUpdate:modelValue': (val) => (dialog.show = val),
|
||||
},
|
||||
() => [
|
||||
h(
|
||||
'p',
|
||||
{ class: 'text-p-base text-gray-700' },
|
||||
dialog.message
|
||||
),
|
||||
h(ErrorMessage, { class: 'mt-2', message: dialog.error }),
|
||||
]
|
||||
)
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
export function createDialog(options) {
|
||||
let dialog = reactive(options)
|
||||
dialog.key = `dialog-${Math.random().toString(36).slice(2, 9)}`
|
||||
dialogs.value.push(dialog)
|
||||
dialog.show = true
|
||||
}
|
||||
8
frontend/src/utils/index.js
Normal file
8
frontend/src/utils/index.js
Normal file
@@ -0,0 +1,8 @@
|
||||
import { toast } from 'frappe-ui'
|
||||
|
||||
export function createToast(options) {
|
||||
toast({
|
||||
position: 'bottom-right',
|
||||
...options,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user