@medusajs/dashboard 2.10.4-snapshot-20250929174531 → 2.10.4-snapshot-20250930123356
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-campaign-promotions-3BB3BLFD.mjs → add-campaign-promotions-YATCZFPA.mjs} +3 -3
- package/dist/{api-key-management-detail-ZQLQKGYF.mjs → api-key-management-detail-6URA7AKM.mjs} +1 -2
- package/dist/app.js +152 -74
- package/dist/app.mjs +3 -4
- package/dist/{campaign-create-CQ3XBHSY.mjs → campaign-create-SGLXQU2F.mjs} +3 -2
- package/dist/{campaign-detail-LASOFZ2O.mjs → campaign-detail-6WW6QFB2.mjs} +5 -6
- package/dist/{categories-metadata-HUIY6V4F.mjs → categories-metadata-LISTDI2Y.mjs} +1 -2
- package/dist/{category-detail-ZJJBYVFX.mjs → category-detail-K3GNLMQZ.mjs} +2 -3
- package/dist/{category-products-7N4TITQ4.mjs → category-products-EGGFU5IA.mjs} +2 -3
- package/dist/{chunk-5WMJLYEP.mjs → chunk-4KGC42TY.mjs} +1 -1
- package/dist/{chunk-NFQXNOP7.mjs → chunk-55PVXDDC.mjs} +1 -1
- package/dist/{chunk-7DFTLGA5.mjs → chunk-7PAOPX4A.mjs} +102 -102
- package/dist/{chunk-U4R5MBF2.mjs → chunk-ASFB7W5A.mjs} +1 -1
- package/dist/{chunk-DKOCYXB5.mjs → chunk-CLIAKOWC.mjs} +10 -2
- package/dist/{chunk-AXXGAOQL.mjs → chunk-ENN7KGKR.mjs} +9 -4
- package/dist/{chunk-CY33DS7K.mjs → chunk-GOJZH5OP.mjs} +52 -1
- package/dist/{chunk-IP2QPPWC.mjs → chunk-HGAQ6CRN.mjs} +1 -1
- package/dist/{chunk-PAG2HG6I.mjs → chunk-LFSI4NJU.mjs} +94 -22
- package/dist/{chunk-7JJTWGHU.mjs → chunk-S34JJVBQ.mjs} +7 -0
- package/dist/{chunk-QPLPGRYF.mjs → chunk-TR3FWQXE.mjs} +1 -1
- package/dist/{chunk-CXTAH75K.mjs → chunk-VLNUSUNX.mjs} +1 -1
- package/dist/{chunk-RBDAWRFF.mjs → chunk-W4JWOYEI.mjs} +1 -1
- package/dist/{chunk-XR7I5HGZ.mjs → chunk-WKSE3SCT.mjs} +1 -1
- package/dist/{chunk-VWQYN2RW.mjs → chunk-ZEED3CMI.mjs} +1 -1
- package/dist/{collection-add-products-WKMNYPLS.mjs → collection-add-products-3FN6PUXN.mjs} +2 -3
- package/dist/{collection-detail-NONKXELG.mjs → collection-detail-3XJA3YAW.mjs} +2 -3
- package/dist/{collection-list-3ZHLS2LP.mjs → collection-list-SDEPSNRJ.mjs} +2 -3
- package/dist/{collection-metadata-J6P3K7U6.mjs → collection-metadata-U3U5IAXY.mjs} +1 -2
- package/dist/{customer-detail-5Y7ICDMA.mjs → customer-detail-3LRBZ3JI.mjs} +1 -2
- package/dist/{customer-group-detail-PXP73BFA.mjs → customer-group-detail-PSWUMSNT.mjs} +1 -2
- package/dist/{customer-group-list-3DB643XQ.mjs → customer-group-list-CWMPWYDT.mjs} +1 -2
- package/dist/{customers-add-customer-group-BVUVU46N.mjs → customers-add-customer-group-B2A4NE3V.mjs} +1 -2
- package/dist/{edit-rules-3MSTPCE5.mjs → edit-rules-5IC62HEP.mjs} +1 -2
- package/dist/{inventory-create-NEYX7PZJ.mjs → inventory-create-W5TWRGTB.mjs} +1 -2
- package/dist/{inventory-detail-66HDQL3W.mjs → inventory-detail-NA3TYSDI.mjs} +1 -2
- package/dist/{inventory-metadata-OSTUWM23.mjs → inventory-metadata-IHX3PKUU.mjs} +1 -2
- package/dist/{inventory-stock-XY2OCAY3.mjs → inventory-stock-N63HVL4Y.mjs} +1 -2
- package/dist/{location-detail-UZHD3IKW.mjs → location-detail-LTPCPYBB.mjs} +1 -2
- package/dist/{location-fulfillment-providers-D4RMKQXU.mjs → location-fulfillment-providers-D7RUW43H.mjs} +2 -3
- package/dist/{location-service-zone-shipping-option-create-OASLL2K7.mjs → location-service-zone-shipping-option-create-7OWIMXRU.mjs} +1 -2
- package/dist/{login-LQRL2ZDY.mjs → login-35YVS44T.mjs} +1 -2
- package/dist/{order-create-claim-7UF734QH.mjs → order-create-claim-IL5IJQDA.mjs} +1 -2
- package/dist/{order-create-edit-MZHUVTGE.mjs → order-create-edit-MZZBDG2K.mjs} +1 -2
- package/dist/{order-create-exchange-2UGEF65S.mjs → order-create-exchange-CWS4HFYS.mjs} +1 -2
- package/dist/{order-create-fulfillment-HGJ2YPUB.mjs → order-create-fulfillment-I22AFZNL.mjs} +1 -2
- package/dist/{order-create-refund-CJDKVBSE.mjs → order-create-refund-MGNKZZU7.mjs} +18 -79
- package/dist/{order-create-shipment-3FDVQ6WT.mjs → order-create-shipment-DQ2MGT73.mjs} +1 -2
- package/dist/{order-detail-SEPCRJW5.mjs → order-detail-G3IQFZ4U.mjs} +4 -8
- package/dist/{order-edit-billing-address-J75NQFRY.mjs → order-edit-billing-address-LBI4BH2D.mjs} +1 -2
- package/dist/{order-edit-email-ABFQKE6A.mjs → order-edit-email-LZIAGMIQ.mjs} +1 -2
- package/dist/{order-edit-shipping-address-OXW7TAJD.mjs → order-edit-shipping-address-7ASMMZHB.mjs} +1 -2
- package/dist/{order-metadata-5NF3ICQL.mjs → order-metadata-WKPBFYBS.mjs} +1 -2
- package/dist/{order-receive-return-IM65P7XQ.mjs → order-receive-return-5NEE4MCK.mjs} +1 -2
- package/dist/{order-request-transfer-LZ25KEDA.mjs → order-request-transfer-3VT2ZUA7.mjs} +1 -2
- package/dist/{price-list-create-EC5VGCMW.mjs → price-list-create-RSXHRPDW.mjs} +2 -3
- package/dist/{price-list-detail-CRTJA5O4.mjs → price-list-detail-27WN2S6M.mjs} +2 -3
- package/dist/{price-list-prices-add-HYCM4QDY.mjs → price-list-prices-add-P76O76X3.mjs} +2 -3
- package/dist/{product-attributes-WVQRK3GQ.mjs → product-attributes-XSMFVMPL.mjs} +4 -5
- package/dist/{product-create-PWSPOVUS.mjs → product-create-IGZFHXVZ.mjs} +4 -5
- package/dist/{product-create-variant-V2QGXFEF.mjs → product-create-variant-3A7UARG7.mjs} +1 -2
- package/dist/{product-detail-EBPCCBI4.mjs → product-detail-CW42KVKT.mjs} +4 -5
- package/dist/{product-edit-5E6D43KE.mjs → product-edit-EXLC7FN7.mjs} +4 -5
- package/dist/{product-export-VFC3I5DK.mjs → product-export-EIIBIYBL.mjs} +2 -3
- package/dist/{product-import-V7EZJ2TU.mjs → product-import-WXFKSQMH.mjs} +1 -2
- package/dist/{product-list-FFZO57JG.mjs → product-list-KEND4NTM.mjs} +2 -3
- package/dist/{product-media-TRKQTA4G.mjs → product-media-NJZ6JSA7.mjs} +2 -2
- package/dist/{product-metadata-VYQ65KYI.mjs → product-metadata-6WVU7KCL.mjs} +1 -2
- package/dist/{product-organization-OCVSTKEK.mjs → product-organization-V2LE3CYO.mjs} +4 -5
- package/dist/{product-shipping-profile-SG6NDHF4.mjs → product-shipping-profile-K4FB5YNC.mjs} +4 -5
- package/dist/{product-stock-LJRYRSKN.mjs → product-stock-EYYSNQN6.mjs} +1 -2
- package/dist/{product-tag-create-EB5CVUOP.mjs → product-tag-create-LZJJQDDN.mjs} +1 -2
- package/dist/{product-tag-detail-V5CZY4R4.mjs → product-tag-detail-IZWWHAL4.mjs} +4 -5
- package/dist/{product-tag-edit-YATSW5OK.mjs → product-tag-edit-GJ7T5EWE.mjs} +1 -2
- package/dist/{product-tag-list-2LFGEFGL.mjs → product-tag-list-CT5SDORF.mjs} +4 -5
- package/dist/{product-tag-metadata-R5P5FWAZ.mjs → product-tag-metadata-2PE6F6PT.mjs} +1 -2
- package/dist/{product-type-detail-BZNI5GJ5.mjs → product-type-detail-X7TH5D5P.mjs} +2 -3
- package/dist/{product-type-metadata-SUQHWLWA.mjs → product-type-metadata-UBVJNWEL.mjs} +1 -2
- package/dist/{product-variant-detail-W2JHQQQJ.mjs → product-variant-detail-IUAHUIF3.mjs} +1 -2
- package/dist/{product-variant-edit-DSY77FF4.mjs → product-variant-edit-7QDJ2IRD.mjs} +1 -2
- package/dist/{product-variant-metadata-HE3MRTJB.mjs → product-variant-metadata-VNDDDM3T.mjs} +1 -2
- package/dist/{promotion-add-campaign-YOUUM6RB.mjs → promotion-add-campaign-SOGZKDNX.mjs} +2 -2
- package/dist/{promotion-create-NBFV4XQV.mjs → promotion-create-DRWLH3CY.mjs} +8 -5
- package/dist/{promotion-detail-247QD6DA.mjs → promotion-detail-VHNQCTRH.mjs} +3 -4
- package/dist/{promotion-list-WDHOSD55.mjs → promotion-list-6KMDX6OB.mjs} +3 -3
- package/dist/{refund-reason-create-45ZZOX7F.mjs → refund-reason-create-77GSQ4W5.mjs} +38 -3
- package/dist/{refund-reason-edit-E2HDAQZI.mjs → refund-reason-edit-UHR7VTDK.mjs} +49 -1
- package/dist/{refund-reason-list-WI7NHRDS.mjs → refund-reason-list-WIIPT75C.mjs} +3 -4
- package/dist/{region-metadata-3JIGHAUI.mjs → region-metadata-6VLWB5VQ.mjs} +1 -2
- package/dist/{reservation-detail-FENCNQDA.mjs → reservation-detail-3ATQ33U7.mjs} +1 -2
- package/dist/{reservation-metadata-DQ3A7MHU.mjs → reservation-metadata-2SVXKSIC.mjs} +1 -2
- package/dist/{reset-password-LCVV4NOA.mjs → reset-password-AOR576NC.mjs} +1 -1
- package/dist/{return-reason-list-FW7OYUOW.mjs → return-reason-list-T7KQHIYV.mjs} +1 -1
- package/dist/{sales-channel-add-products-G4EUOCWY.mjs → sales-channel-add-products-UFRCO4JR.mjs} +2 -3
- package/dist/{sales-channel-detail-NT7PEVVH.mjs → sales-channel-detail-4B6KT7EU.mjs} +2 -3
- package/dist/{sales-channel-list-REV2RETE.mjs → sales-channel-list-3KAKOZV7.mjs} +1 -2
- package/dist/{sales-channel-metadata-O5O6ADG5.mjs → sales-channel-metadata-VWG77T3Y.mjs} +1 -2
- package/dist/{shipping-option-type-create-7FSJNHHA.mjs → shipping-option-type-create-ZSUEJDPC.mjs} +1 -2
- package/dist/{shipping-option-type-detail-6UQST7RY.mjs → shipping-option-type-detail-LUIV6WLP.mjs} +2 -3
- package/dist/{shipping-option-type-edit-B475WRRR.mjs → shipping-option-type-edit-MC4UYHRM.mjs} +1 -2
- package/dist/{shipping-option-type-list-DTETSFSA.mjs → shipping-option-type-list-AA3VLD4U.mjs} +2 -3
- package/dist/{shipping-profile-metadata-PRINFNSY.mjs → shipping-profile-metadata-37X46LSP.mjs} +1 -2
- package/dist/{store-detail-QKF2TVNW.mjs → store-detail-PGMGDA2T.mjs} +1 -2
- package/dist/{store-metadata-M6GIKI5P.mjs → store-metadata-DPM7CH4C.mjs} +1 -2
- package/dist/{tax-region-create-4DTM3RTZ.mjs → tax-region-create-EFDLXWCS.mjs} +2 -3
- package/dist/{tax-region-detail-SLCI3JYL.mjs → tax-region-detail-S5R5D4KY.mjs} +2 -3
- package/dist/{tax-region-edit-CJ63JXFQ.mjs → tax-region-edit-ECTOKAGZ.mjs} +1 -2
- package/dist/{tax-region-province-detail-BGL2USQF.mjs → tax-region-province-detail-7DEEXMWA.mjs} +1 -2
- package/dist/{tax-region-tax-override-create-L4WOTSBO.mjs → tax-region-tax-override-create-6EHKZAZ4.mjs} +4 -5
- package/dist/{tax-region-tax-override-edit-2JAVNE37.mjs → tax-region-tax-override-edit-AZBQQPYI.mjs} +4 -5
- package/dist/{user-metadata-DFTGB46F.mjs → user-metadata-HPKKLNTP.mjs} +1 -2
- package/dist/{workflow-execution-detail-YNT2RKIP.mjs → workflow-execution-detail-Z6JEL2HO.mjs} +1 -2
- package/package.json +9 -9
- package/src/hooks/table/columns/use-refund-reason-table-columns.tsx +7 -0
- package/src/i18n/translations/$schema.json +36 -2
- package/src/i18n/translations/en.json +10 -2
- package/src/routes/campaigns/campaign-create/components/create-campaign-form/create-campaign-form.tsx +7 -2
- package/src/routes/campaigns/campaign-detail/components/campaign-budget/campaign-budget.tsx +5 -1
- package/src/routes/campaigns/common/components/create-campaign-form-fields/create-campaign-form-fields.tsx +50 -1
- package/src/routes/campaigns/common/constants.ts +1 -0
- package/src/routes/orders/order-create-refund/components/create-refund-form/create-refund-form.tsx +12 -76
- package/src/routes/orders/order-detail/components/order-summary-section/order-summary-section.tsx +1 -5
- package/src/routes/promotions/promotion-create/components/create-promotion-form/create-promotion-form.tsx +7 -0
- package/src/routes/refund-reasons/refund-reason-create/components/refund-reason-create-form/refund-reason-create-form.tsx +46 -0
- package/src/routes/refund-reasons/refund-reason-edit/components/refund-reason-edit-form/refund-reason-edit-form.tsx +23 -1
- package/dist/chunk-5U3FFMC7.mjs +0 -84
package/src/routes/orders/order-create-refund/components/create-refund-form/create-refund-form.tsx
CHANGED
@@ -1,14 +1,7 @@
|
|
1
1
|
import { zodResolver } from "@hookform/resolvers/zod"
|
2
2
|
import { HttpTypes } from "@medusajs/types"
|
3
|
-
import {
|
4
|
-
|
5
|
-
CurrencyInput,
|
6
|
-
Label,
|
7
|
-
Select,
|
8
|
-
Textarea,
|
9
|
-
toast,
|
10
|
-
} from "@medusajs/ui"
|
11
|
-
import { useEffect, useMemo, useState } from "react"
|
3
|
+
import { Button, CurrencyInput, Select, Textarea, toast } from "@medusajs/ui"
|
4
|
+
import { useMemo, useState } from "react"
|
12
5
|
import { formatValue } from "react-currency-input-field"
|
13
6
|
import { useForm } from "react-hook-form"
|
14
7
|
import { useTranslation } from "react-i18next"
|
@@ -20,7 +13,6 @@ import { KeyboundForm } from "../../../../../components/utilities/keybound-form"
|
|
20
13
|
import { useRefundPayment, useRefundReasons } from "../../../../../hooks/api"
|
21
14
|
import { currencies } from "../../../../../lib/data/currencies"
|
22
15
|
import { formatCurrency } from "../../../../../lib/format-currency"
|
23
|
-
import { formatProvider } from "../../../../../lib/format-provider"
|
24
16
|
import { getLocaleAmount } from "../../../../../lib/money-amount-helpers"
|
25
17
|
import { getPaymentsFromOrder } from "../../../../../lib/orders"
|
26
18
|
import { useDocumentDirection } from "../../../../../hooks/use-document-direction"
|
@@ -63,29 +55,10 @@ export const CreateRefundForm = ({ order }: CreateRefundFormProps) => {
|
|
63
55
|
value: paymentAmount.toFixed(currency.decimal_digits),
|
64
56
|
float: paymentAmount,
|
65
57
|
},
|
66
|
-
note: "",
|
67
|
-
refund_reason_id: "",
|
68
58
|
},
|
69
59
|
resolver: zodResolver(CreateRefundSchema),
|
70
60
|
})
|
71
61
|
|
72
|
-
useEffect(() => {
|
73
|
-
const pendingDifference = order.summary.pending_difference as number
|
74
|
-
const paymentAmount = (payment?.amount || 0) as number
|
75
|
-
const pendingAmount =
|
76
|
-
pendingDifference < 0
|
77
|
-
? Math.min(Math.abs(pendingDifference), paymentAmount)
|
78
|
-
: paymentAmount
|
79
|
-
|
80
|
-
const normalizedAmount =
|
81
|
-
pendingAmount < 0 ? pendingAmount * -1 : pendingAmount
|
82
|
-
|
83
|
-
form.setValue("amount", {
|
84
|
-
value: normalizedAmount.toFixed(currency.decimal_digits),
|
85
|
-
float: normalizedAmount,
|
86
|
-
})
|
87
|
-
}, [payment?.id || ""])
|
88
|
-
|
89
62
|
const { mutateAsync, isPending } = useRefundPayment(order.id, payment?.id!)
|
90
63
|
|
91
64
|
const handleSubmit = form.handleSubmit(async (data) => {
|
@@ -123,53 +96,16 @@ export const CreateRefundForm = ({ order }: CreateRefundFormProps) => {
|
|
123
96
|
>
|
124
97
|
<RouteDrawer.Body className="flex-1 overflow-auto">
|
125
98
|
<div className="flex flex-col gap-y-4">
|
126
|
-
<
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
<
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
<Select.Trigger>
|
138
|
-
<Select.Value
|
139
|
-
placeholder={t("orders.payment.selectPaymentToRefund")}
|
140
|
-
/>
|
141
|
-
</Select.Trigger>
|
142
|
-
|
143
|
-
<Select.Content>
|
144
|
-
{payments.map((payment) => {
|
145
|
-
const totalRefunded = payment.refunds.reduce(
|
146
|
-
(acc, next) => next.amount + acc,
|
147
|
-
0
|
148
|
-
)
|
149
|
-
|
150
|
-
return (
|
151
|
-
<Select.Item
|
152
|
-
value={payment!.id}
|
153
|
-
key={payment.id}
|
154
|
-
disabled={
|
155
|
-
!!payment.canceled_at || totalRefunded >= payment.amount
|
156
|
-
}
|
157
|
-
className="flex items-center justify-center"
|
158
|
-
>
|
159
|
-
<span>
|
160
|
-
{getLocaleAmount(
|
161
|
-
payment.amount as number,
|
162
|
-
payment.currency_code
|
163
|
-
)}
|
164
|
-
{" - "}
|
165
|
-
</span>
|
166
|
-
<span>{formatProvider(payment.provider_id)}</span>
|
167
|
-
<span> - (#{payment.id.substring(23)})</span>
|
168
|
-
</Select.Item>
|
169
|
-
)
|
170
|
-
})}
|
171
|
-
</Select.Content>
|
172
|
-
</Select>
|
99
|
+
<div className="flex items-center">
|
100
|
+
<span>
|
101
|
+
{getLocaleAmount(
|
102
|
+
payment.amount as number,
|
103
|
+
payment.currency_code
|
104
|
+
)}
|
105
|
+
</span>
|
106
|
+
<span> - </span>
|
107
|
+
<span>(#{payment.id.substring(23)})</span>
|
108
|
+
</div>
|
173
109
|
|
174
110
|
<Form.Field
|
175
111
|
control={form.control}
|
package/src/routes/orders/order-detail/components/order-summary-section/order-summary-section.tsx
CHANGED
@@ -853,10 +853,6 @@ const DiscountAndTotalBreakdown = ({
|
|
853
853
|
.split("-")
|
854
854
|
.join(" ")
|
855
855
|
|
856
|
-
const prettyReferenceId = creditLine.reference_id ? (
|
857
|
-
<DisplayId id={creditLine.reference_id} />
|
858
|
-
) : null
|
859
|
-
|
860
856
|
return (
|
861
857
|
<div
|
862
858
|
key={creditLine.id}
|
@@ -899,7 +895,7 @@ const DiscountAndTotalBreakdown = ({
|
|
899
895
|
leading="compact"
|
900
896
|
className="txt-small text-ui-fg-subtle capitalize"
|
901
897
|
>
|
902
|
-
({prettyReference}
|
898
|
+
({prettyReference})
|
903
899
|
</Text>
|
904
900
|
</div>
|
905
901
|
<div className="relative flex-1">
|
@@ -139,6 +139,13 @@ export const CreatePromotionForm = () => {
|
|
139
139
|
}))
|
140
140
|
}
|
141
141
|
|
142
|
+
if (data.campaign) {
|
143
|
+
data.campaign.budget.attribute = data.campaign.budget.attribute || null
|
144
|
+
data.campaign.budget.type = data.campaign.budget.attribute
|
145
|
+
? "use_by_attribute"
|
146
|
+
: data.campaign.budget.type
|
147
|
+
}
|
148
|
+
|
142
149
|
createPromotion(
|
143
150
|
{
|
144
151
|
...promotionData,
|
@@ -13,6 +13,7 @@ import { useCreateRefundReason } from "../../../../../hooks/api"
|
|
13
13
|
|
14
14
|
const RefundReasonCreateSchema = z.object({
|
15
15
|
label: z.string().min(1),
|
16
|
+
code: z.string().min(1),
|
16
17
|
description: z.string().optional(),
|
17
18
|
})
|
18
19
|
|
@@ -23,11 +24,20 @@ export const RefundReasonCreateForm = () => {
|
|
23
24
|
const form = useForm<z.infer<typeof RefundReasonCreateSchema>>({
|
24
25
|
defaultValues: {
|
25
26
|
label: "",
|
27
|
+
code: "",
|
26
28
|
description: "",
|
27
29
|
},
|
28
30
|
resolver: zodResolver(RefundReasonCreateSchema),
|
29
31
|
})
|
30
32
|
|
33
|
+
const generateCodeFromLabel = (label: string) => {
|
34
|
+
return label
|
35
|
+
.toLowerCase()
|
36
|
+
.replace(/[^a-z0-9]/g, "_")
|
37
|
+
.replace(/_+/g, "_")
|
38
|
+
.replace(/^_|_$/g, "")
|
39
|
+
}
|
40
|
+
|
31
41
|
const { mutateAsync, isPending } = useCreateRefundReason()
|
32
42
|
|
33
43
|
const handleSubmit = form.handleSubmit(async (data) => {
|
@@ -81,6 +91,42 @@ export const RefundReasonCreateForm = () => {
|
|
81
91
|
placeholder={t(
|
82
92
|
"refundReasons.fields.label.placeholder"
|
83
93
|
)}
|
94
|
+
onChange={(e) => {
|
95
|
+
if (
|
96
|
+
!form.getFieldState("code").isTouched ||
|
97
|
+
!form.getValues("code")
|
98
|
+
) {
|
99
|
+
form.setValue(
|
100
|
+
"code",
|
101
|
+
generateCodeFromLabel(e.target.value)
|
102
|
+
)
|
103
|
+
}
|
104
|
+
field.onChange(e)
|
105
|
+
}}
|
106
|
+
/>
|
107
|
+
</Form.Control>
|
108
|
+
<Form.ErrorMessage />
|
109
|
+
</Form.Item>
|
110
|
+
)
|
111
|
+
}}
|
112
|
+
/>
|
113
|
+
</div>
|
114
|
+
<div className="grid gap-4 md:grid-cols-2">
|
115
|
+
<Form.Field
|
116
|
+
control={form.control}
|
117
|
+
name="code"
|
118
|
+
render={({ field }) => {
|
119
|
+
return (
|
120
|
+
<Form.Item>
|
121
|
+
<Form.Label>
|
122
|
+
{t("refundReasons.fields.code.label")}
|
123
|
+
</Form.Label>
|
124
|
+
<Form.Control>
|
125
|
+
<Input
|
126
|
+
{...field}
|
127
|
+
placeholder={t(
|
128
|
+
"refundReasons.fields.code.placeholder"
|
129
|
+
)}
|
84
130
|
/>
|
85
131
|
</Form.Control>
|
86
132
|
<Form.ErrorMessage />
|
@@ -8,7 +8,7 @@ import { z } from "zod"
|
|
8
8
|
import { Form } from "../../../../../components/common/form"
|
9
9
|
import { RouteDrawer, useRouteModal } from "../../../../../components/modals"
|
10
10
|
import { KeyboundForm } from "../../../../../components/utilities/keybound-form"
|
11
|
-
import { useUpdateRefundReason } from "../../../../../hooks/api
|
11
|
+
import { useUpdateRefundReason } from "../../../../../hooks/api"
|
12
12
|
|
13
13
|
type RefundReasonEditFormProps = {
|
14
14
|
refundReason: HttpTypes.AdminRefundReason
|
@@ -16,6 +16,7 @@ type RefundReasonEditFormProps = {
|
|
16
16
|
|
17
17
|
const RefundReasonEditSchema = z.object({
|
18
18
|
label: z.string().min(1),
|
19
|
+
code: z.string().min(1),
|
19
20
|
description: z.string().optional(),
|
20
21
|
})
|
21
22
|
|
@@ -28,6 +29,7 @@ export const RefundReasonEditForm = ({
|
|
28
29
|
const form = useForm<z.infer<typeof RefundReasonEditSchema>>({
|
29
30
|
defaultValues: {
|
30
31
|
label: refundReason.label,
|
32
|
+
code: refundReason.code,
|
31
33
|
description: refundReason.description ?? undefined,
|
32
34
|
},
|
33
35
|
resolver: zodResolver(RefundReasonEditSchema),
|
@@ -78,6 +80,26 @@ export const RefundReasonEditForm = ({
|
|
78
80
|
)
|
79
81
|
}}
|
80
82
|
/>
|
83
|
+
<Form.Field
|
84
|
+
control={form.control}
|
85
|
+
name="code"
|
86
|
+
render={({ field }) => {
|
87
|
+
return (
|
88
|
+
<Form.Item>
|
89
|
+
<Form.Label>
|
90
|
+
{t("refundReasons.fields.code.label")}
|
91
|
+
</Form.Label>
|
92
|
+
<Form.Control>
|
93
|
+
<Input
|
94
|
+
{...field}
|
95
|
+
placeholder={t("refundReasons.fields.code.placeholder")}
|
96
|
+
/>
|
97
|
+
</Form.Control>
|
98
|
+
<Form.ErrorMessage />
|
99
|
+
</Form.Item>
|
100
|
+
)
|
101
|
+
}}
|
102
|
+
/>
|
81
103
|
<Form.Field
|
82
104
|
control={form.control}
|
83
105
|
name="description"
|
package/dist/chunk-5U3FFMC7.mjs
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
queryClient
|
3
|
-
} from "./chunk-FXYH54JP.mjs";
|
4
|
-
import {
|
5
|
-
queryKeysFactory
|
6
|
-
} from "./chunk-774WSTCC.mjs";
|
7
|
-
import {
|
8
|
-
sdk
|
9
|
-
} from "./chunk-DEQUVHHE.mjs";
|
10
|
-
|
11
|
-
// src/hooks/api/refund-reasons.tsx
|
12
|
-
import {
|
13
|
-
useMutation,
|
14
|
-
useQuery
|
15
|
-
} from "@tanstack/react-query";
|
16
|
-
var REFUND_REASONS_QUERY_KEY = "refund_reasons";
|
17
|
-
var refundReasonsQueryKeys = queryKeysFactory(REFUND_REASONS_QUERY_KEY);
|
18
|
-
var useRefundReasons = (query, options) => {
|
19
|
-
const { data, ...rest } = useQuery({
|
20
|
-
queryFn: () => sdk.admin.refundReason.list(query),
|
21
|
-
queryKey: refundReasonsQueryKeys.list(query),
|
22
|
-
...options
|
23
|
-
});
|
24
|
-
return { ...data, ...rest };
|
25
|
-
};
|
26
|
-
var useRefundReason = (id, query, options) => {
|
27
|
-
const { data, ...rest } = useQuery({
|
28
|
-
queryFn: () => sdk.admin.refundReason.retrieve(id, query),
|
29
|
-
queryKey: refundReasonsQueryKeys.detail(id),
|
30
|
-
...options
|
31
|
-
});
|
32
|
-
return { ...data, ...rest };
|
33
|
-
};
|
34
|
-
var useCreateRefundReason = (query, options) => {
|
35
|
-
return useMutation({
|
36
|
-
mutationFn: async (data) => sdk.admin.refundReason.create(data, query),
|
37
|
-
onSuccess: (data, variables, context) => {
|
38
|
-
queryClient.invalidateQueries({
|
39
|
-
queryKey: refundReasonsQueryKeys.lists()
|
40
|
-
});
|
41
|
-
options?.onSuccess?.(data, variables, context);
|
42
|
-
},
|
43
|
-
...options
|
44
|
-
});
|
45
|
-
};
|
46
|
-
var useUpdateRefundReason = (id, options) => {
|
47
|
-
return useMutation({
|
48
|
-
mutationFn: async (data) => sdk.admin.refundReason.update(id, data),
|
49
|
-
onSuccess: (data, variables, context) => {
|
50
|
-
queryClient.invalidateQueries({
|
51
|
-
queryKey: refundReasonsQueryKeys.lists()
|
52
|
-
});
|
53
|
-
queryClient.invalidateQueries({
|
54
|
-
queryKey: refundReasonsQueryKeys.detail(data.refund_reason.id)
|
55
|
-
});
|
56
|
-
options?.onSuccess?.(data, variables, context);
|
57
|
-
},
|
58
|
-
...options
|
59
|
-
});
|
60
|
-
};
|
61
|
-
var useDeleteRefundReasonLazy = (options) => {
|
62
|
-
return useMutation({
|
63
|
-
mutationFn: (id) => sdk.admin.refundReason.delete(id),
|
64
|
-
onSuccess: (data, variables, context) => {
|
65
|
-
queryClient.invalidateQueries({
|
66
|
-
queryKey: refundReasonsQueryKeys.lists()
|
67
|
-
});
|
68
|
-
queryClient.invalidateQueries({
|
69
|
-
queryKey: refundReasonsQueryKeys.details()
|
70
|
-
});
|
71
|
-
options?.onSuccess?.(data, variables, context);
|
72
|
-
},
|
73
|
-
...options
|
74
|
-
});
|
75
|
-
};
|
76
|
-
|
77
|
-
export {
|
78
|
-
refundReasonsQueryKeys,
|
79
|
-
useRefundReasons,
|
80
|
-
useRefundReason,
|
81
|
-
useCreateRefundReason,
|
82
|
-
useUpdateRefundReason,
|
83
|
-
useDeleteRefundReasonLazy
|
84
|
-
};
|