useDialog.js 812B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { useDialog as usePrimeDialog } from 'primevue/usedialog'
  2. import SupplierCreate from '../Components/SupplierCreate.vue'
  3. import ProductCreate from '../Components/ProductCreate.vue'
  4. export function useDialog() {
  5. const dialog = usePrimeDialog()
  6. const dialogStyle = {
  7. style: {
  8. width: '50vw',
  9. },
  10. breakpoints: {
  11. '960px': '75vw',
  12. '640px': '90vw',
  13. },
  14. modal: true,
  15. }
  16. const onShowCreateSupplier = () => {
  17. dialog.open(SupplierCreate, {
  18. props: {
  19. header: 'Tambah Supplier',
  20. ...dialogStyle,
  21. },
  22. })
  23. }
  24. const onShowCreateProduct = () => {
  25. dialog.open(ProductCreate, {
  26. props: {
  27. header: 'Tambah Produk',
  28. ...dialogStyle,
  29. },
  30. })
  31. }
  32. return {
  33. onShowCreateProduct,
  34. onShowCreateSupplier,
  35. }
  36. }