feat(admin-ui, medusa, medusa-react, medusa-js): Price List UI revamp (#5233)
* progress on cleanup * rm forceMount * close modal on succesful submit * fix: invalidate price list query on useAdminCreatePriceListPrices * sync translation keys * add last translations * sync translation keys * improve tabbing between cells * add comment * fix: remove double variant, set collision boundary on column dropdown * add widgets * update lock file * decrease details info size, and add missing status update function * sync translation keys * add snapshots and remove min/max * add missing filter menu for customer groups table * add translation keys for filter menu * rm unused code * Create tall-apricots-run.md * Update tall-apricots-run.md * fix: discard invalid paste values * add translation keys * bump snapshots + minor fixes * rm console.log * bump snapshots * bump ui packages, and add missing tax inclusive display in New form * update lock file * fix filter menu * update snapshot * update ui package and fix sub menu position --------- Co-authored-by: Sebastian Rindom <skrindom@gmail.com> Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
co-authored by
Sebastian Rindom
Oli Juhl
parent
4ca70a0d0c
commit
0f34e0f381
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
AdminDeletePriceListPricesPricesReq,
|
||||
AdminDeletePriceListsPriceListProductsPricesBatchReq,
|
||||
AdminPostPriceListPricesPricesReq,
|
||||
AdminPostPriceListsPriceListPriceListReq,
|
||||
AdminPostPriceListsPriceListReq,
|
||||
@@ -11,8 +12,8 @@ import {
|
||||
} from "@medusajs/medusa"
|
||||
import { Response } from "@medusajs/medusa-js"
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationOptions,
|
||||
useMutation,
|
||||
useQueryClient,
|
||||
} from "@tanstack/react-query"
|
||||
import { useMedusa } from "../../../contexts/medusa"
|
||||
@@ -33,7 +34,7 @@ export const useAdminCreatePriceList = (
|
||||
return useMutation(
|
||||
(payload: AdminPostPriceListsPriceListReq) =>
|
||||
client.admin.priceLists.create(payload),
|
||||
buildOptions(queryClient, adminPriceListKeys.lists(), options)
|
||||
buildOptions(queryClient, [adminPriceListKeys.lists()], options)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -95,7 +96,11 @@ export const useAdminCreatePriceListPrices = (
|
||||
client.admin.priceLists.addPrices(id, payload),
|
||||
buildOptions(
|
||||
queryClient,
|
||||
[adminPriceListKeys.lists(), adminPriceListKeys.detailProducts(id)],
|
||||
[
|
||||
adminPriceListKeys.detail(id),
|
||||
adminPriceListKeys.lists(),
|
||||
adminPriceListKeys.detailProducts(id),
|
||||
],
|
||||
options
|
||||
)
|
||||
)
|
||||
@@ -127,6 +132,28 @@ export const useAdminDeletePriceListPrices = (
|
||||
)
|
||||
}
|
||||
|
||||
export const useAdminDeletePriceListProductsPrices = (
|
||||
id: string,
|
||||
options?: UseMutationOptions<
|
||||
Response<AdminPriceListDeleteBatchRes>,
|
||||
Error,
|
||||
AdminDeletePriceListsPriceListProductsPricesBatchReq
|
||||
>
|
||||
) => {
|
||||
const { client } = useMedusa()
|
||||
const queryClient = useQueryClient()
|
||||
|
||||
return useMutation(
|
||||
(payload: AdminDeletePriceListsPriceListProductsPricesBatchReq) =>
|
||||
client.admin.priceLists.deleteProductsPrices(id, payload),
|
||||
buildOptions(
|
||||
queryClient,
|
||||
[adminPriceListKeys.detail(id), adminPriceListKeys.lists()],
|
||||
options
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
export const useAdminDeletePriceListProductPrices = (
|
||||
id: string,
|
||||
productId: string,
|
||||
|
||||
Reference in New Issue
Block a user