feat(payment): Add isEdit prop to PaymentForm and disable fields when editing

This commit is contained in:
web@ppanel 2025-03-14 14:04:10 +07:00
parent f72df3a5e8
commit 85f55def2e
2 changed files with 4 additions and 0 deletions

View File

@ -45,6 +45,7 @@ interface PaymentFormProps<T> {
loading?: boolean;
initialValues?: T;
onSubmit: (values: T) => Promise<boolean>;
isEdit?: boolean;
}
export default function PaymentForm<T>({
@ -53,6 +54,7 @@ export default function PaymentForm<T>({
loading,
initialValues,
onSubmit,
isEdit,
}: PaymentFormProps<T>) {
const t = useTranslations('payment');
const { common } = useGlobalStore();
@ -317,6 +319,7 @@ export default function PaymentForm<T>({
}}
defaultValue={field.value}
value={field.value}
disabled={isEdit}
>
<FormControl>
<SelectTrigger>

View File

@ -136,6 +136,7 @@ export default function PaymentTable() {
actions={{
render: (row) => [
<PaymentForm<API.UpdatePaymentMethodRequest>
isEdit
key='edit'
trigger={<Button>{t('edit')}</Button>}
title={t('editPayment')}