File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
src/apps/wallet-admin/src
lib/components/payment-edit Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -208,8 +208,10 @@ const ListView: FC<ListViewProps> = (props: ListViewProps) => {
208208 }
209209
210210 if ( paymentStatus ) updates . paymentStatus = paymentStatus
211- if ( updateObj . releaseDate !== undefined ) updates . releaseDate = updateObj . releaseDate . toISOString ( )
212- if ( updateObj . netAmount !== undefined ) updates . paymentAmount = updateObj . netAmount
211+ if ( paymentStatus !== 'CANCELLED' ) {
212+ if ( updateObj . releaseDate !== undefined ) updates . releaseDate = updateObj . releaseDate . toISOString ( )
213+ if ( updateObj . netAmount !== undefined ) updates . paymentAmount = updateObj . netAmount
214+ }
213215
214216 toast . success ( 'Updating payment' , { position : toast . POSITION . BOTTOM_RIGHT } )
215217 try {
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ const PaymentEdit: React.FC<PaymentEditFormProps> = (props: PaymentEditFormProps
3131 const [ netAmountErrorString , setNetAmountErrorString ] = useState ( '' )
3232 const [ auditNote , setAuditNote ] = useState ( '' )
3333 const [ dirty , setDirty ] = useState ( false )
34+ const [ disableEdits , setDisableEdits ] = useState ( false )
3435
3536 const initialValues = useMemo ( ( ) => ( {
3637 auditNote : '' ,
@@ -184,6 +185,7 @@ const PaymentEdit: React.FC<PaymentEditFormProps> = (props: PaymentEditFormProps
184185 name = 'netPayment'
185186 label = 'Net Payment'
186187 type = 'number'
188+ disabled = { disableEdits }
187189 placeholder = 'Modify Net Payment'
188190 dirty
189191 tabIndex = { 0 }
@@ -203,11 +205,14 @@ const PaymentEdit: React.FC<PaymentEditFormProps> = (props: PaymentEditFormProps
203205 { label : 'Cancel' , value : 'Cancel' } ,
204206 ] }
205207 value = { paymentStatus }
206- onChange = { e => handleInputChange ( 'paymentStatus' , e . target . value ) }
208+ onChange = { e => {
209+ setDisableEdits ( e . target . value === 'Cancel' )
210+ handleInputChange ( 'paymentStatus' , e . target . value )
211+ } }
207212 />
208213 < InputDatePicker
209214 tabIndex = { - 2 }
210- disabled = { false }
215+ disabled = { disableEdits }
211216 error = 'Something wrong'
212217 label = 'Release Date'
213218 minDate = { min ( [ new Date ( ) , new Date ( props . payment . releaseDateObj ) ] ) }
You can’t perform that action at this time.
0 commit comments