| 1234567891011121314151617181920212223242526272829303132333435 |
- import { Inertia } from '@inertiajs/inertia'
- import { useDialog } from 'primevue/usedialog'
- import { dialogStyle } from './config'
- import CustomerCreate from './Components/Dialog/CustomerCreate.vue'
-
- export function useCustomerAutoComplete(form) {
- const dialog = useDialog()
-
- const customerOnComplete = (event) => {
- Inertia.reload({
- data: { customer: event.query },
- only: ['customers'],
- })
- }
-
- const customerOnSelected = (event) => {
- form.customer = event.value
- }
-
- const showCreateCustomer = () => {
- dialog.open(CustomerCreate, {
- props: {
- header: 'Tambah Pelanggan',
- ...dialogStyle,
- },
- })
- }
-
- return {
- customerOnComplete,
- customerOnSelected,
- showCreateCustomer,
- }
- }
|