|
66 | 66 | @settle-cancelation="settleCancelation" |
67 | 67 | @update-booking-service="openUpdateBookingServiceDialog" |
68 | 68 | @open-customer="openCustomer" |
| 69 | + @update-booking-invoice="updateBookingInvoice" |
69 | 70 | ></booking-expansion-item> |
70 | 71 | </q-list> |
71 | 72 |
|
@@ -157,17 +158,18 @@ import CustomerSelect from '../../components/employee/CustomerSelect.vue' |
157 | 158 | import { |
158 | 159 | useAdminGetBookingEmailQuery, |
159 | 160 | useAdminGetBookingsQuery |
160 | | -} from 'src/queries/admin/booking.js' |
161 | | -import { useEmployeeGetBookingServiceQuery } from 'src/queries/employee/bookingService.js' |
162 | | -import { useAdminUpdateBookingServiceMutation } from 'src/mutations/admin/bookingService.js' |
| 161 | +} from '../../queries/admin/booking.js' |
| 162 | +import { useEmployeeGetBookingServiceQuery } from '../../queries/employee/bookingService.js' |
| 163 | +import { useAdminUpdateBookingServiceMutation } from '../../mutations/admin/bookingService.js' |
163 | 164 | import { |
164 | 165 | useAdminApproveBookingMutation, |
165 | 166 | useAdminBookingSettleCancellationMutation, |
166 | 167 | useAdminRejectBookingMutation, |
167 | 168 | useAdminReplyBookingMutation, |
168 | 169 | useAdminStandbyBookingMutation |
169 | | -} from 'src/mutations/admin/booking.js' |
170 | | -import { useEmployeeSearchCustomersQuery } from 'src/queries/employee/customer.js' |
| 170 | +} from '../../mutations/admin/booking.js' |
| 171 | +import { useEmployeeSearchCustomersQuery } from '../../queries/employee/customer.js' |
| 172 | +import { useEmployeeUpdateBookingInvoiceMutation } from '../../mutations/employee/booking.js' |
171 | 173 |
|
172 | 174 | type REPLY_TYPES = ['approve', 'reject', 'standby', 'reply'] |
173 | 175 |
|
@@ -216,6 +218,9 @@ const { mutateAsync: rejectBookingMutation } = useAdminRejectBookingMutation() |
216 | 218 | const { mutateAsync: replyBookingMutation } = useAdminReplyBookingMutation() |
217 | 219 | const { mutateAsync: standbyBookingMutation } = useAdminStandbyBookingMutation() |
218 | 220 |
|
| 221 | +const { mutateAsync: updateBookingInvoiceMutation } = |
| 222 | + useEmployeeUpdateBookingInvoiceMutation() |
| 223 | +
|
219 | 224 | const total = computed(() => data.value?.at(0)?.total || 0) |
220 | 225 | // const { pet, id: petId, refetch: refetchPet } = useEmployeeGetPetQuery() |
221 | 226 |
|
@@ -567,6 +572,24 @@ const settleCancelation: InstanceType< |
567 | 572 |
|
568 | 573 | // const filteredCustomers = ref<Customer[]>([]) |
569 | 574 |
|
| 575 | +const updateBookingInvoice: InstanceType< |
| 576 | + typeof BookingExpansionItem |
| 577 | +>['$props']['onUpdateBookingInvoice'] = async ({ data, done }) => { |
| 578 | + if (data.id) { |
| 579 | + try { |
| 580 | + await updateBookingInvoiceMutation(data.id) |
| 581 | + done(true) |
| 582 | + $q.notify({ |
| 583 | + icon: 'i-mdi-check-circle', |
| 584 | + color: 'positive', |
| 585 | + message: lang.value.booking.messages.invoiceSynchronized |
| 586 | + }) |
| 587 | + await executeBookings() |
| 588 | + } catch (e) { |
| 589 | + done(false) |
| 590 | + } |
| 591 | + } |
| 592 | +} |
570 | 593 | const onFilterCustomers: InstanceType< |
571 | 594 | typeof CustomerSelect |
572 | 595 | >['$props']['onFilter'] = async ({ searchPhrase, ids, done }) => { |
|
0 commit comments