@@ -19,6 +19,14 @@ <h1>{% block heading %}{% trans 'Finish Payout' %}{% endblock heading %}</h1>
1919
2020< form method ="post ">
2121
22+ < div class ="d-flex justify-content-between align-items-start mb-3 ">
23+ < h5 class ="mb-0 "> {% trans 'Payout Details' %}</ h5 >
24+ < button type ="button " class ="btn btn-sm btn-outline-primary " id ="copy-payout-info " title ="{% trans 'Copy payout information' %} ">
25+ < span class ="fa fa-copy mr-1 " aria-hidden ="true "> </ span >
26+ < span id ="copy-btn-text "> {% trans 'Copy Info' %}</ span >
27+ </ button >
28+ </ div >
29+
2230 < dl >
2331 < dt > {% trans 'Publisher' %}</ dt >
2432 < dd > {{ payout.publisher }}</ dd >
@@ -30,7 +38,7 @@ <h1>{% block heading %}{% trans 'Finish Payout' %}{% endblock heading %}</h1>
3038
3139 {% if payout.publisher.paypal_email %}
3240 < dt > {% trans 'User' %}</ dt >
33- < dd >
41+ < dd id =" payout-email " >
3442 {{ payout.publisher.paypal_email }}
3543 </ dd >
3644 {% endif %}
@@ -39,10 +47,10 @@ <h1>{% block heading %}{% trans 'Finish Payout' %}{% endblock heading %}</h1>
3947 < dd > {{ payout.get_status_display }}</ dd >
4048
4149 < dt > {% trans 'Amount' %}</ dt >
42- < dd > ${{ payout.amount|floatformat:2|intcomma }}</ dd >
50+ < dd id =" payout-amount " > ${{ payout.amount|floatformat:2|intcomma }}</ dd >
4351
4452 < dt > {% trans 'Subject' %}</ dt >
45- < dd > {% trans "EthicalAds Payout" %} - {{ payout.publisher.name }}</ dd >
53+ < dd id =" payout-subject " > {% trans "EthicalAds Payout" %} - {{ payout.publisher.name }}</ dd >
4654
4755 < dt > {% trans 'Action' %}</ dt >
4856 < dd >
@@ -85,4 +93,62 @@ <h1>{% block heading %}{% trans 'Finish Payout' %}{% endblock heading %}</h1>
8593
8694</ div >
8795
96+ < script >
97+ ( function ( ) {
98+ document . getElementById ( 'copy-payout-info' ) . addEventListener ( 'click' , function ( ) {
99+ // Get the payout information
100+ var amount = document . getElementById ( 'payout-amount' ) . textContent . trim ( ) ;
101+ var subject = document . getElementById ( 'payout-subject' ) . textContent . trim ( ) ;
102+ var emailElement = document . getElementById ( 'payout-email' ) ;
103+ var email = emailElement ? emailElement . textContent . trim ( ) : '' ;
104+
105+ // Format the text to copy
106+ var textToCopy = 'Amount: ' + amount + '\n' ;
107+ if ( email ) {
108+ textToCopy += 'Email: ' + email + '\n' ;
109+ }
110+ textToCopy += 'Subject: ' + subject ;
111+
112+ // Copy to clipboard
113+ if ( navigator . clipboard && navigator . clipboard . writeText ) {
114+ navigator . clipboard . writeText ( textToCopy ) . then ( function ( ) {
115+ // Show success feedback
116+ var btnText = document . getElementById ( 'copy-btn-text' ) ;
117+ var originalText = btnText . textContent ;
118+ btnText . textContent = '{% trans "Copied!" %}' ;
119+
120+ setTimeout ( function ( ) {
121+ btnText . textContent = originalText ;
122+ } , 2000 ) ;
123+ } ) . catch ( function ( err ) {
124+ console . error ( 'Failed to copy text: ' , err ) ;
125+ alert ( 'Failed to copy to clipboard' ) ;
126+ } ) ;
127+ } else {
128+ // Fallback for older browsers
129+ var textArea = document . createElement ( 'textarea' ) ;
130+ textArea . value = textToCopy ;
131+ textArea . style . position = 'fixed' ;
132+ textArea . style . left = '-999999px' ;
133+ document . body . appendChild ( textArea ) ;
134+ textArea . select ( ) ;
135+ try {
136+ document . execCommand ( 'copy' ) ;
137+ var btnText = document . getElementById ( 'copy-btn-text' ) ;
138+ var originalText = btnText . textContent ;
139+ btnText . textContent = '{% trans "Copied!" %}' ;
140+
141+ setTimeout ( function ( ) {
142+ btnText . textContent = originalText ;
143+ } , 2000 ) ;
144+ } catch ( err ) {
145+ console . error ( 'Fallback: Failed to copy text: ' , err ) ;
146+ alert ( 'Failed to copy to clipboard' ) ;
147+ }
148+ document . body . removeChild ( textArea ) ;
149+ }
150+ } ) ;
151+ } ) ( ) ;
152+ </ script >
153+
88154{% endblock content_container %}
0 commit comments