@@ -110,7 +110,12 @@ const PaymentView: React.FC<PaymentViewProps> = (props: PaymentViewProps) => {
110
110
111
111
< div className = { styles . infoItem } >
112
112
< span className = { styles . label } > Net Payment</ span >
113
- < p className = { styles . value } > { props . payment . netPaymentNumber . toLocaleString ( undefined , { currency : 'USD' , style : 'currency' } ) } </ p >
113
+ < p className = { styles . value } >
114
+ { props . payment . netPaymentNumber . toLocaleString ( undefined , {
115
+ currency : 'USD' ,
116
+ style : 'currency' ,
117
+ } ) }
118
+ </ p >
114
119
</ div >
115
120
116
121
< div className = { styles . infoItem } >
@@ -124,18 +129,14 @@ const PaymentView: React.FC<PaymentViewProps> = (props: PaymentViewProps) => {
124
129
</ div >
125
130
126
131
{ props . payment . datePaid !== '-' && (
127
- (
128
- < div className = { styles . infoItem } >
129
- < span className = { styles . label } > Date Paid</ span >
130
- < p className = { styles . value } > { props . payment . datePaid } </ p >
131
- </ div >
132
- ) ) }
132
+ < div className = { styles . infoItem } >
133
+ < span className = { styles . label } > Date Paid</ span >
134
+ < p className = { styles . value } > { props . payment . datePaid } </ p >
135
+ </ div >
136
+ ) }
133
137
134
138
< div className = { styles . infoItem } >
135
- < Button
136
- onClick = { ( ) => handleToggleView ( 'audit' ) }
137
- label = 'View Audit'
138
- />
139
+ < Button onClick = { ( ) => handleToggleView ( 'audit' ) } label = 'View Audit' />
139
140
{ props . payment . status . toUpperCase ( ) === 'PAID' && (
140
141
< Button
141
142
onClick = { ( ) => handleToggleView ( 'external_transaction' ) }
@@ -149,127 +150,121 @@ const PaymentView: React.FC<PaymentViewProps> = (props: PaymentViewProps) => {
149
150
{ view === 'audit' && (
150
151
< >
151
152
< div className = { styles . auditSection } >
152
- { auditLines && auditLines . length > 0 && auditLines . map ( line => (
153
- < Collapsible
154
- key = { line . id }
155
- header = { (
156
- < h3 >
157
- {
158
- new Date ( line . createdAt )
159
- . toLocaleString ( )
160
- }
161
- </ h3 >
162
- ) }
163
- containerClass = { styles . container }
164
- contentClass = { styles . content }
165
- >
166
- < div className = { styles . auditItem } >
167
- < div >
168
- < p >
169
- < strong > User:</ strong >
170
- { ' ' }
171
- { line . userId }
172
- </ p >
173
- < p >
174
- < strong > Action:</ strong >
175
- { ' ' }
176
- { formatAction ( line . action ) }
177
- </ p >
178
- < p >
179
- < strong > Note:</ strong >
180
- { ' ' }
181
- { line . note }
182
- </ p >
183
- </ div >
184
- </ div >
185
- </ Collapsible >
186
- ) ) }
187
- { ( auditLines === undefined || auditLines . length === 0 )
188
- && (
189
- < div className = { styles . auditItem } >
190
- < p > No audit data available</ p >
191
- </ div >
192
- ) }
193
- </ div >
194
- < div className = { styles . infoItem } >
195
- < Button
196
- onClick = { ( ) => handleToggleView ( 'details' ) }
197
- label = 'Back to Details'
198
- />
199
- </ div >
200
- </ >
201
- ) }
202
-
203
- { view === 'external_transaction' && (
204
- < >
205
- < div className = { styles . auditSection } >
206
- { externalTransactionAudit && externalTransactionAudit . length > 0 && externalTransactionAudit . map ( ( externalTransaction : PayoutAudit , index : number ) => (
207
- < >
153
+ { auditLines
154
+ && auditLines . length > 0
155
+ && auditLines . map ( line => (
208
156
< Collapsible
209
- key = { `internal-record${ index } ` }
210
- header = { (
211
- < h3 > Internal Record</ h3 >
212
- ) }
157
+ key = { line . id }
158
+ header = {
159
+ (
160
+ < h3 >
161
+ {
162
+ new Date ( line . createdAt )
163
+ . toLocaleString ( )
164
+ }
165
+ </ h3 >
166
+ )
167
+ }
213
168
containerClass = { styles . container }
214
169
contentClass = { styles . content }
215
170
>
216
171
< div className = { styles . auditItem } >
217
172
< div >
218
173
< p >
219
- < strong > Provider Used:</ strong >
220
- { ' ' }
221
- { externalTransaction . paymentMethodUsed }
174
+ < strong > User:</ strong >
175
+ { line . userId }
222
176
</ p >
223
177
< p >
224
- < strong > Status:</ strong >
225
- { ' ' }
226
- { externalTransaction . status }
178
+ < strong > Action:</ strong >
179
+ { formatAction ( line . action ) }
227
180
</ p >
228
181
< p >
229
- < strong > Processed At:</ strong >
230
- { ' ' }
231
- { externalTransaction . createdAt }
182
+ < strong > Note:</ strong >
183
+ { line . note }
232
184
</ p >
233
- < p >
234
- < strong > Totl Amount Processed:</ strong >
235
- { ' ' }
236
- { externalTransaction . totalNetAmount }
237
- </ p >
238
- </ div >
239
- </ div >
240
- </ Collapsible >
241
- < Collapsible
242
- key = { `external-record${ index } ` }
243
- header = { (
244
- < h3 > External Record</ h3 >
245
- ) }
246
- containerClass = { styles . container }
247
- contentClass = { styles . content }
248
- >
249
- < div className = { styles . auditItem } >
250
- < div >
251
- < pre > { JSON . stringify ( externalTransaction . externalTransactionDetails , undefined , 2 ) } </ pre >
252
185
</ div >
253
186
</ div >
254
187
</ Collapsible >
255
- </ >
256
- ) ) }
257
- { ( externalTransactionAudit === undefined )
258
- && (
259
- < div className = { styles . auditItem } >
260
- < p > No external transaction data is available</ p >
261
- </ div >
262
- ) }
188
+ ) ) }
189
+ { ( auditLines === undefined || auditLines . length === 0 ) && (
190
+ < div className = { styles . auditItem } >
191
+ < p > No audit data available</ p >
192
+ </ div >
193
+ ) }
263
194
</ div >
264
195
< div className = { styles . infoItem } >
265
- < Button
266
- onClick = { ( ) => handleToggleView ( 'details' ) }
267
- label = 'Back to Details'
268
- />
196
+ < Button onClick = { ( ) => handleToggleView ( 'details' ) } label = 'Back to Details' />
269
197
</ div >
270
198
</ >
271
199
) }
272
200
201
+ { view === 'external_transaction' && (
202
+ < >
203
+ < div className = { styles . auditSection } >
204
+ { externalTransactionAudit
205
+ && externalTransactionAudit . length > 0
206
+ && externalTransactionAudit . map ( ( externalTransaction : PayoutAudit , index : number ) => (
207
+ < >
208
+ < Collapsible
209
+ key = { `internal-record${ index } ` }
210
+ header = { < h3 > Internal Record</ h3 > }
211
+ containerClass = { styles . container }
212
+ contentClass = { styles . content }
213
+ >
214
+ < div className = { styles . auditItem } >
215
+ < div >
216
+ < p >
217
+ < strong > Provider Used:</ strong >
218
+ { ' ' }
219
+ { externalTransaction . paymentMethodUsed }
220
+ </ p >
221
+ < p >
222
+ < strong > Status:</ strong >
223
+ { externalTransaction . status }
224
+ </ p >
225
+ < p >
226
+ < strong > Processed At:</ strong >
227
+ { externalTransaction . createdAt }
228
+ </ p >
229
+ < p >
230
+ < strong > Total Amount Processed:</ strong >
231
+ { ' ' }
232
+ { externalTransaction . totalNetAmount }
233
+ </ p >
234
+ </ div >
235
+ </ div >
236
+ </ Collapsible >
237
+ < Collapsible
238
+ key = { `external-record${ index } ` }
239
+ header = { < h3 > External Record</ h3 > }
240
+ containerClass = { styles . container }
241
+ contentClass = { styles . content }
242
+ >
243
+ < div className = { styles . auditItem } >
244
+ < div >
245
+ < pre >
246
+ { JSON . stringify (
247
+ externalTransaction . externalTransactionDetails ,
248
+ undefined ,
249
+ 2 ,
250
+ ) }
251
+ </ pre >
252
+ </ div >
253
+ </ div >
254
+ </ Collapsible >
255
+ </ >
256
+ ) ) }
257
+ { externalTransactionAudit === undefined && (
258
+ < div className = { styles . auditItem } >
259
+ < p > No external transaction data is available</ p >
260
+ </ div >
261
+ ) }
262
+ </ div >
263
+ < div className = { styles . infoItem } >
264
+ < Button onClick = { ( ) => handleToggleView ( 'details' ) } label = 'Back to Details' />
265
+ </ div >
266
+ </ >
267
+ ) }
273
268
</ div >
274
269
</ div >
275
270
)
0 commit comments