Commit 04da746 1 parent 022f883 commit 04da746 Copy full SHA for 04da746
File tree 1 file changed +13
-2
lines changed
packages/invoice-dashboard/src/lib/dashboard
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 100
100
101
101
let isSigningTransaction = false ;
102
102
103
+ let initialPaymentCheck = false ;
104
+
105
+ let showPaymentButton = true ;
106
+
103
107
const generateDetailParagraphs = (info : any ) => {
104
108
const fullName = [info ?.firstName , info ?.lastName ]
105
109
.filter (Boolean )
154
158
$ : {
155
159
if (request ?.requestId !== previousRequestId ) {
156
160
previousRequestId = request ?.requestId ;
161
+ initialPaymentCheck =
162
+ request ?.state === " paid" ||
163
+ request ?.state === " overpaid" ||
164
+ status === " paid" ||
165
+ status === " overpaid" ||
166
+ request ?.balance ?.balance >= request ?.expectedAmount ;
157
167
checkInvoice ();
158
168
}
159
169
}
345
355
isPaid = true ;
346
356
status = checkStatus (requestData );
347
357
isRequestPayed = true ;
358
+ showPaymentButton = false ; // Hide the button after successful payment
348
359
} catch (err ) {
349
360
console .error (" Something went wrong while paying : " , err );
350
361
857
868
{/each }
858
869
{/if }
859
870
</div >
860
- {#if ! isPaid && ! isPayee }
871
+ {#if ! isPayee && ! initialPaymentCheck }
861
872
<div class =" status-container" >
862
873
<div class =" statuses" >
863
874
{#if statuses ?.length > 0 }
920
931
</div >
921
932
{/if }
922
933
<div class =" invoice-view-actions" >
923
- {#if ! isPayee && ! unsupportedNetwork && ! isPaid && ! isRequestPayed && ! isSigningTransaction && ! unknownCurrency }
934
+ {#if showPaymentButton && ! isPayee && ! unsupportedNetwork && ! isSigningTransaction && ! unknownCurrency && ! initialPaymentCheck }
924
935
{#if ! hasEnoughBalance && correctChain }
925
936
<div class =" balance-warning" >
926
937
Insufficient funds: {Number (userBalance ).toFixed (4 )}
You can’t perform that action at this time.
0 commit comments