-
Notifications
You must be signed in to change notification settings - Fork 195
/
Copy pathview-payment-details.php
1033 lines (932 loc) · 38.5 KB
/
view-payment-details.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* View Donation Details
*
* @package Give
* @subpackage Admin/Payments
* @copyright Copyright (c) 2016, GiveWP
* @license https://opensource.org/licenses/gpl-license GNU Public License
* @since 1.0
*/
use Give\Donations\Models\Donation;
use Give\Donations\ValueObjects\DonationMetaKeys;
use Give\Donors\Models\Donor;
// Exit if accessed directly.
if (!defined('ABSPATH')) {
exit;
}
if (!current_user_can('view_give_payments')) {
wp_die(
__('Sorry, you are not allowed to access this page.', 'give'),
__('Error', 'give'),
array(
'response' => 403,
)
);
}
/**
* View donation details page
*
* @since 3.9.0 Add donor phone number to the view
* @since 1.0
* @return void
*/
if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
}
// Setup the variables
$payment_id = absint( $_GET['id'] );
$payment = new Give_Payment( $payment_id );
// Sanity check... fail if donation ID is invalid
$payment_exists = $payment->ID;
if ( empty( $payment_exists ) ) {
wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
}
$number = $payment->number;
$payment_meta = $payment->get_meta();
$company_name = ! empty( $payment_meta['_give_donation_company'] ) ? esc_attr( $payment_meta['_give_donation_company'] ) : '';
$transaction_id = esc_attr( $payment->transaction_id );
$user_id = $payment->user_id;
$donor_id = $payment->customer_id;
$payment_date = strtotime( $payment->date );
$user_info = give_get_payment_meta_user_info( $payment_id );
$address = $payment->address;
$currency_code = $payment->currency;
$gateway = $payment->gateway;
$currency_code = $payment->currency;
$payment_mode = $payment->mode;
$base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
$donation_phone_number = Donation::find($payment_id)->phone;
$donor_phone_number = Donor::find($donor_id)->phone;
?>
<div class="wrap give-wrap">
<h1 id="transaction-details-heading" class="wp-heading-inline">
<?php
printf(
/* translators: %s: donation number */
esc_html__( 'Donation %s', 'give' ),
$number
);
if ( $payment_mode == 'test' ) {
echo Give()->tooltips->render_span(
array(
'label' => __( 'This donation was made in test mode.', 'give' ),
'tag_content' => __( 'Test Donation', 'give' ),
'position' => 'right',
'attributes' => array(
'id' => 'test-payment-label',
'class' => 'give-item-label give-item-label-orange',
),
)
);
}
?>
</h1>
<?php
/**
* Fires in donation details page, before the page content and after the H1 title output.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_before', $payment_id );
?>
<hr class="wp-header-end">
<form id="give-edit-order-form" method="post">
<?php
/**
* Fires in donation details page, in the form before the order details.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_form_top', $payment_id );
?>
<div id="poststuff" class="give-clearfix">
<div id="give-dashboard-widgets-wrap">
<div id="post-body" class="metabox-holder columns-2">
<div id="postbox-container-1" class="postbox-container">
<div id="side-sortables" class="meta-box-sortables ui-sortable">
<?php
/**
* Fires in donation details page, before the sidebar.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_sidebar_before', $payment_id );
?>
<div id="give-order-update" class="postbox give-order-data">
<div class="give-order-top">
<h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3>
<?php
if ( current_user_can( 'view_give_payments' ) ) {
echo sprintf(
'<span class="delete-donation" id="delete-donation-%d"><a class="delete-single-donation delete-donation-button dashicons dashicons-trash" href="%s" aria-label="%s"></a></span>',
$payment_id,
esc_url(
wp_nonce_url(
add_query_arg(
array(
'give-action' => 'delete_payment',
'purchase_id' => $payment_id,
),
$base_url
),
'give_donation_nonce'
)
),
sprintf( __( 'Delete Donation %s', 'give' ), $payment_id )
);
}
?>
</div>
<div class="inside">
<div class="give-admin-box">
<?php
/**
* Fires in donation details page, before the sidebar update-payment metabox.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_totals_before', $payment_id );
?>
<div class="give-admin-box-inside">
<p>
<label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label>
<select id="give-payment-status" name="give-payment-status" class="medium-text">
<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
<?php endforeach; ?>
</select>
<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
</p>
</div>
<div class="give-admin-box-inside">
<?php $date_format = give_date_format(); ?>
<p>
<label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label>
<input type="text" id="give-payment-date" name="give-payment-date" data-standard-date="<?php echo esc_attr( date( 'Y-m-d', $payment_date ) ); ?>" value="<?php echo esc_attr( date_i18n( $date_format, $payment_date ) ); ?>" autocomplete="off" class="medium-text give_datepicker" placeholder="<?php _e( 'Date', 'give' ); ?>"/>
</p>
</div>
<div class="give-admin-box-inside">
<p>
<label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label>
<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> :
<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
</p>
</div>
<?php
/**
* Fires in donation details page, in the sidebar update-payment metabox.
*
* Allows you to add new inner items.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_update_inner', $payment_id );
?>
<div class="give-order-payment give-admin-box-inside">
<p>
<label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label>
<?php echo give_currency_symbol( $payment->currency ); ?>
<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( array( 'donation_id' => $payment_id ) ) ); ?>"/>
</p>
</div>
<?php
/**
* Fires in donation details page, after the sidebar update-donation metabox.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_totals_after', $payment_id );
?>
</div>
<!-- /.give-admin-box -->
</div>
<!-- /.inside -->
<div class="give-order-update-box give-admin-box">
<?php
/**
* Fires in donation details page, before the sidebar update-payment metabox actions buttons.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_update_before', $payment_id );
?>
<div id="major-publishing-actions">
<div id="publishing-action">
<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/>
<?php
if ( give_is_payment_complete( $payment_id ) ) {
$url = add_query_arg(
array(
'give-action' => 'email_links',
'purchase_id' => $payment_id,
),
admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id )
);
echo sprintf(
'<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>',
esc_url( $url ),
esc_html__( 'Resend Receipt', 'give' )
);
}
?>
</div>
<div class="clear"></div>
</div>
<?php
/**
* Fires in donation details page, after the sidebar update-payment metabox actions buttons.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_update_after', $payment_id );
?>
</div>
<!-- /.give-order-update-box -->
</div>
<!-- /#give-order-data -->
<div id="give-order-details" class="postbox give-order-data">
<h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3>
<div class="inside">
<div class="give-admin-box">
<?php
/**
* Fires in donation details page, before the donation-meta metabox.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_payment_meta_before', $payment_id );
$gateway = give_get_payment_gateway( $payment_id );
if ( $gateway ) :
?>
<div class="give-order-gateway give-admin-box-inside">
<p>
<strong><?php _e( 'Gateway:', 'give' ); ?></strong>
<?php echo give_get_gateway_admin_label( $gateway ); ?>
</p>
</div>
<?php endif; ?>
<div class="give-order-payment-key give-admin-box-inside">
<p>
<strong><?php _e( 'Key:', 'give' ); ?></strong>
<?php echo give_get_payment_key( $payment_id ); ?>
</p>
</div>
<div class="give-order-ip give-admin-box-inside">
<p>
<strong><?php _e( 'IP:', 'give' ); ?></strong>
<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
</p>
</div>
<?php
// Display the transaction ID present.
// The transaction ID is the charge ID from the gateway.
// For instance, stripe "ch_BzvwYCchqOy5Nt".
if ( $transaction_id != $payment_id ) :
?>
<div class="give-order-tx-id give-admin-box-inside">
<p>
<strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway ); ?>"></span></strong>
<?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
</p>
</div>
<?php endif; ?>
<?php
/**
* Fires in donation details page, after the donation-meta metabox.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_payment_meta_after', $payment_id );
?>
<div class="give-admin-box-inside">
<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?>
<a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor »', 'give' ); ?></a>
</p>
</div>
</div>
<!-- /.column-container -->
</div>
<!-- /.inside -->
</div>
<!-- /#give-order-data -->
<?php
/**
* Fires in donation details page, after the sidebar.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_sidebar_after', $payment_id );
?>
</div>
<!-- /#side-sortables -->
</div>
<!-- /#postbox-container-1 -->
<div id="postbox-container-2" class="postbox-container">
<div id="normal-sortables" class="meta-box-sortables ui-sortable">
<?php
/**
* Fires in donation details page, before the main area.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_main_before', $payment_id );
?>
<?php $column_count = 'columns-3'; ?>
<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
<h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3>
<div class="inside">
<div class="column-container">
<div class="column">
<p>
<strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br>
<?php
if ( $payment->form_id ) :
printf(
'<a href="%1$s">%2$s</a>',
admin_url( 'post.php?action=edit&post=' . $payment->form_id ),
$payment->form_id
);
endif;
?>
</p>
<p>
<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
<?php
echo Give()->html->forms_dropdown(
array(
'selected' => $payment->form_id,
'name' => 'give-payment-form-select',
'id' => 'give-payment-form-select',
'chosen' => true,
'placeholder' => '',
)
);
?>
</p>
<p>
<strong><?php
esc_html_e('Campaign:', 'give'); ?></strong><br>
<?php
$donation = Donation::find($payment->ID);
echo Give()->html->campaigns_dropdown(
[
'selected' => $donation->campaignId,
'name' => 'give-payment-campaign-select',
'id' => 'give-payment-campaign-select',
'chosen' => true,
'placeholder' => '',
]
);
?>
</p>
</div>
<div class="column">
<p>
<strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br>
<?php echo date_i18n( give_date_format(), $payment_date ); ?>
</p>
<p>
<strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br>
<span class="give-donation-level">
<?php
$var_prices = give_has_variable_prices( $payment->form_id );
if ( empty( $var_prices ) ) {
_e( 'n/a', 'give' );
} else {
$prices_atts = array();
if ( $variable_prices = give_get_variable_prices( $payment->form_id ) ) {
foreach ( $variable_prices as $variable_price ) {
$prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) );
}
}
// Variable price dropdown options.
$variable_price_dropdown_option = array(
'id' => $payment->form_id,
'name' => 'give-variable-price',
'chosen' => true,
'show_option_all' => '',
'show_option_none' => ( '' === $payment->price_id ? __( 'None', 'give' ) : '' ),
'select_atts' => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ),
'selected' => $payment->price_id,
);
// Render variable prices select tag html.
give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
}
?>
</span>
</p>
</div>
<div class="column">
<p>
<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
<?php echo give_donation_amount( $payment, true ); ?>
</p>
<?php if ( give_is_anonymous_donation_field_enabled( $payment->form_id ) ) : ?>
<div>
<strong><?php esc_html_e( 'Anonymous Donation:', 'give' ); ?></strong>
<ul class="give-radio-inline">
<li>
<label>
<input
name="give_anonymous_donation"
value="1"
type="radio"
<?php checked( 1, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ); ?>
><?php _e( 'Yes', 'give' ); ?>
</label>
</li>
<li>
<label>
<input
name="give_anonymous_donation"
value="0"
type="radio"
<?php checked( 0, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ); ?>
><?php _e( 'No', 'give' ); ?>
</label>
</li>
</ul>
</div>
<?php endif; ?>
<p>
<?php
/**
* Fires in donation details page, in the donation-information metabox, before the head elements.
*
* Allows you to add new TH elements at the beginning.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_donation_details_thead_before', $payment_id );
/**
* Fires in donation details page, in the donation-information metabox, after the head elements.
*
* Allows you to add new TH elements at the end.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_donation_details_thead_after', $payment_id );
/**
* Fires in donation details page, in the donation-information metabox, before the body elements.
*
* Allows you to add new TD elements at the beginning.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_donation_details_tbody_before', $payment_id );
/**
* Fires in donation details page, in the donation-information metabox, after the body elements.
*
* Allows you to add new TD elements at the end.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_donation_details_tbody_after', $payment_id );
?>
</p>
</div>
</div>
</div>
<!-- /.inside -->
</div>
<!-- /#give-donation-overview -->
<?php
/**
* Fires on the donation details page.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_donor_detail_before', $payment_id );
?>
<div id="give-donor-details" class="postbox">
<h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3>
<div class="inside">
<?php $donor = new Give_Donor( $donor_id ); ?>
<div class="column-container donor-info">
<div class="column">
<p>
<strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br>
<?php
if ( ! empty( $donor->id ) ) {
printf(
'<a href="%1$s">%2$s</a>',
esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ),
intval( $donor->id )
);
}
?>
<span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>)</span>
</p>
<p>
<strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br>
<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ); ?>
</p>
</div>
<div class="column">
<p>
<strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
<?php
$donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' );
$donor_name = give_get_donor_name_by( $donor_id, 'donor' );
// Check whether the donor name and WP_User name is same or not.
if ( $donor_billing_name !== $donor_name ) {
// Donors can be deleted by the user, but we can show the donor billing name from donation details.
if ( empty( $donor_name ) ) {
echo esc_html( $donor_billing_name );
} else {
echo sprintf(
'%1$s (<a href="%2$s" target="_blank">%3$s</a>)',
esc_html( $donor_billing_name ),
esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ),
esc_html( $donor_name )
);
}
} else {
echo esc_html( $donor_name );
}
?>
</p>
<p>
<strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br>
<?php
// Show Donor donation email first and Primary email on parenthesis if not match both email.
echo ( empty( $donor->email ) || hash_equals( $donor->email, $payment->email ) )
? $payment->email
: sprintf(
'%1$s (<a href="%2$s" target="_blank">%3$s</a>)',
$payment->email,
esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ),
$donor->email
);
?>
</p>
<p>
<?php
if ( ! empty($donation_phone_number)) {
?>
<strong><?php
esc_html_e('Donor Phone:', 'give'); ?></strong><br>
<?php
// Show Donor donation phone first and Primary phone on parenthesis if not match both phone.
echo (empty($donor_phone_number) ||
hash_equals($donor_phone_number, $donation_phone_number))
? $donation_phone_number :
sprintf(
'%1$s (<a href="%2$s" target="_blank">%3$s</a>)',
$donation_phone_number,
esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}")),
$donor_phone_number
);
}
?>
</p>
</div>
<div class="column">
<p>
<strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br>
<?php
echo Give()->html->donor_dropdown(
array(
'selected' => $donor->id,
'name' => 'donor-id',
)
);
?>
</p>
<p>
<?php
if ( ! empty( $company_name ) ) {
?>
<strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br>
<?php
echo $company_name;
}
?>
</p>
</div>
</div>
<div class="column-container new-donor" style="display: none">
<div class="column">
<p>
<label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label>
<input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/>
</p>
</div>
<div class="column">
<p>
<label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label>
<input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/>
</p>
</div>
<div class="column">
<p>
<label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label>
<input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/>
</p>
</div>
<div class="column">
<p>
<input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/>
<input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/>
<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a>
<br>
<em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
</p>
</div>
</div>
<?php
/**
* Fires on the donation details page, in the donor-details metabox.
*
* The hook is left here for backwards compatibility.
*
* @since 1.7
*
* @param array $payment_meta Payment meta.
* @param array $user_info User information.
*/
do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
/**
* Fires on the donation details page, in the donor-details metabox.
*
* @since 1.7
*
* @param int $payment_id Payment id.
*/
do_action( 'give_payment_view_details', $payment_id );
?>
</div>
<!-- /.inside -->
</div>
<!-- /#give-donor-details -->
<?php
/**
* Fires on the donation details page, before the billing metabox.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_billing_before', $payment_id );
?>
<div id="give-billing-details" class="postbox">
<h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3>
<div class="inside">
<div id="give-order-address">
<div class="order-data-address">
<div class="data column-container">
<?php
$address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() );
$address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' );
// Get the country list that does not have any states init.
$no_states_country = give_no_states_country_list();
?>
<div class="row">
<div id="give-order-address-country-wrap">
<label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label>
<?php
echo Give()->html->select(
array(
'options' => give_get_country_list(),
'name' => 'give-payment-address[0][country]',
'selected' => $address['country'],
'show_option_all' => false,
'show_option_none' => false,
'chosen' => true,
'placeholder' => esc_attr__( 'Select a country', 'give' ),
'data' => array( 'search-type' => 'no_ajax' ),
'autocomplete' => 'country',
)
);
?>
</div>
</div>
<div class="row">
<div class="give-wrap-address-line1">
<label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label>
<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
</div>
</div>
<div class="row">
<div class="give-wrap-address-line2">
<label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label>
<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
</div>
</div>
<div class="row">
<div class="give-wrap-address-city">
<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
</div>
</div>
<?php
$state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false );
?>
<div class="row">
<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state">
<div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>">
<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
<?php
$states = give_get_states( $address['country'] );
if ( ! empty( $states ) ) {
echo Give()->html->select(
array(
'options' => $states,
'name' => 'give-payment-address[0][state]',
'selected' => $address['state'],
'show_option_all' => false,
'show_option_none' => false,
'chosen' => true,
'placeholder' => esc_attr__( 'Select a state', 'give' ),
'data' => array( 'search-type' => 'no_ajax' ),
'autocomplete' => 'address-level1',
)
);
} else {
?>
<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" autocomplete="address-line1" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
<?php
}
?>
</div>
</div>
<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip">
<div class="give-wrap-address-zip">
<label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label>
<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /#give-order-address -->
<?php
/**
* Fires in donation details page, in the billing metabox, after all the fields.
*
* Allows you to insert new billing address fields.
*
* @since 1.7
*
* @param int $payment_id Payment id.
*/
do_action( 'give_payment_billing_details', $payment_id );
?>
</div>
<!-- /.inside -->
</div>
<!-- /#give-billing-details -->
<?php
/**
* Fires on the donation details page, after the billing metabox.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_billing_after', $payment_id );
?>
<div id="give-payment-notes" class="postbox">
<h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3>
<div class="inside">
<div id="give-payment-notes-inner">
<?php
$notes = give_get_payment_notes( $payment_id );
if ( ! empty( $notes ) ) {
$no_notes_display = ' style="display:none;"';
foreach ( $notes as $note ) :
echo give_get_payment_note_html( $note, $payment_id );
endforeach;
} else {
$no_notes_display = '';
}
echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>';
?>
</div>
<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
<div class="give-clearfix">
<p>
<label for="donation_note_type" class="screen-reader-text"><?php _e( 'Note type', 'give' ); ?></label>
<select name="donation_note_type" id="donation_note_type">
<option value=""><?php _e( 'Private note', 'give' ); ?></option>
<option value="donor"><?php _e( 'Note to donor', 'give' ); ?></option>
</select>
<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button>
</p>
</div>
</div>
<!-- /.inside -->
</div>
<!-- /#give-payment-notes -->
<?php
/**
* Fires on the donation details page, after the main area.
*
* @since 2.27.0 Change to read comment from donations meta table
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_main_after', $payment_id );
?>
<?php if ( give_is_donor_comment_field_enabled( $payment->form_id ) ) : ?>
<div id="give-payment-donor-comment" class="postbox">
<h3 class="hndle"><?php _e( 'Donor Comment', 'give' ); ?></h3>
<div class="inside">
<div id="give-payment-donor-comment-inner">
<p>
<?php
echo sprintf(
'<textarea name="give_comment" id="give_comment" placeholder="%s" class="large-text">%s</textarea>',
__( 'Add a comment', 'give' ),
$payment->get_meta(DonationMetaKeys::COMMENT) ?? ''
);
?>
</p>
</div>
</div>
<!-- /.inside -->
</div>
<?php endif; ?>
<!-- /#give-payment-notes -->
<?php
/**
* Fires on the donation details page, after the main area.
*
* @since 1.0
*
* @param int $payment_id Payment id.
*/
do_action( 'give_view_donation_details_main_after', $payment_id );
?>
</div>
<!-- /#normal-sortables -->
</div>
<!-- #postbox-container-2 -->