From dd1d1db199b41d3e537534d1660f873cf75a3e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dro=C5=84?= Date: Mon, 27 Nov 2023 10:59:05 +0100 Subject: [PATCH] Add prices in grant refund view (#4455) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix types * Add unit prices in grant refund view * Strict typing on ProductCard * Add changeset * Update schema * Build types * Update lockfile * Extract messages * Trigger deployment --------- Co-authored-by: Paweł Chyła Co-authored-by: wojteknowacki <124166231+wojteknowacki@users.noreply.github.com> --- .changeset/giant-lamps-wash.md | 5 +++++ introspection.json | 6 ++++++ locale/defaultMessages.json | 4 ++++ schema.graphql | 1 + src/graphql/types.generated.ts | 1 + .../components/ProductCard.tsx | 21 +++++++++++++------ .../OrderGrantRefundPage/messages.ts | 5 +++++ .../components/OrderGrantRefundPage/styles.ts | 4 ++++ 8 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 .changeset/giant-lamps-wash.md diff --git a/.changeset/giant-lamps-wash.md b/.changeset/giant-lamps-wash.md new file mode 100644 index 00000000000..7afdca69fc8 --- /dev/null +++ b/.changeset/giant-lamps-wash.md @@ -0,0 +1,5 @@ +--- +"saleor-dashboard": patch +--- + +Add prices in grant refund view diff --git a/introspection.json b/introspection.json index 832687c9be0..ff1317d63a2 100644 --- a/introspection.json +++ b/introspection.json @@ -95679,6 +95679,12 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "STOCK_ALREADY_EXISTS", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "UNIQUE", "description": null, diff --git a/locale/defaultMessages.json b/locale/defaultMessages.json index 923f26556b1..4d7c1a96bcb 100644 --- a/locale/defaultMessages.json +++ b/locale/defaultMessages.json @@ -3225,6 +3225,10 @@ "KRqgfo": { "string": "User is out of your permissions scope" }, + "KWXwFo": { + "context": "grant refund table, column header", + "string": "Unit price" + }, "KXkdMH": { "context": "order discount removed title", "string": "Order discount was removed by" diff --git a/schema.graphql b/schema.graphql index 1cbdbf620c9..1a55f04a6e9 100644 --- a/schema.graphql +++ b/schema.graphql @@ -24013,6 +24013,7 @@ enum ProductVariantBulkErrorCode { NOT_PRODUCTS_VARIANT PRODUCT_NOT_ASSIGNED_TO_CHANNEL REQUIRED + STOCK_ALREADY_EXISTS UNIQUE } diff --git a/src/graphql/types.generated.ts b/src/graphql/types.generated.ts index fd6ec6abee7..ddbbd0d5e93 100644 --- a/src/graphql/types.generated.ts +++ b/src/graphql/types.generated.ts @@ -5604,6 +5604,7 @@ export enum ProductVariantBulkErrorCode { NOT_PRODUCTS_VARIANT = 'NOT_PRODUCTS_VARIANT', PRODUCT_NOT_ASSIGNED_TO_CHANNEL = 'PRODUCT_NOT_ASSIGNED_TO_CHANNEL', REQUIRED = 'REQUIRED', + STOCK_ALREADY_EXISTS = 'STOCK_ALREADY_EXISTS', UNIQUE = 'UNIQUE' } diff --git a/src/orders/components/OrderGrantRefundPage/components/ProductCard.tsx b/src/orders/components/OrderGrantRefundPage/components/ProductCard.tsx index 59677499e9c..49fead0500b 100644 --- a/src/orders/components/OrderGrantRefundPage/components/ProductCard.tsx +++ b/src/orders/components/OrderGrantRefundPage/components/ProductCard.tsx @@ -1,4 +1,4 @@ -// @ts-strict-ignore +import Money from "@dashboard/components/Money"; import TableCellAvatar from "@dashboard/components/TableCellAvatar"; import TableRowLink from "@dashboard/components/TableRowLink"; import { OrderLineGrantRefundFragment } from "@dashboard/graphql"; @@ -75,6 +75,9 @@ export const ProductsCard: React.FC = ({ + + + @@ -86,19 +89,25 @@ export const ProductsCard: React.FC = ({ {renderCollection( lines, line => { + if (!line) { + return null; + } const stateLine = state.lines.get(line.id); return ( - +
- {line?.productName} + {line.productName} {line.variantName}
+ + + {line.quantity} @@ -109,11 +118,11 @@ export const ProductsCard: React.FC = ({ type="number" max={stateLine?.availableQuantity} min={0} - data-test-id={"quantityInput" + line?.id} + data-test-id={"quantityInput" + line.id} value={stateLine?.selectedQuantity ?? 0} onChange={getHandleAmountChange(line)} endAdornment={ - line?.quantity && ( + line.quantity && (