|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Template that prints the invoice history page. |
|
4
|
|
|
* |
|
5
|
|
|
* This template can be overridden by copying it to yourtheme/invoicing/invoice-history.php. |
|
6
|
|
|
* |
|
7
|
|
|
* @version 1.0.19 |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
defined( 'ABSPATH' ) || exit; |
|
11
|
|
|
|
|
12
|
|
|
// Current page. |
|
13
|
|
|
$current_page = empty( $_GET['page'] ) ? 1 : absint( $_GET['page'] ); |
|
14
|
|
|
|
|
15
|
|
|
// Fires before displaying user invoices. |
|
16
|
|
|
do_action( 'wpinv_before_user_invoices', $invoices->invoices, $invoices->total, $invoices->max_num_pages, $post_type ); |
|
17
|
|
|
|
|
18
|
|
|
wpinv_print_errors(); |
|
19
|
|
|
|
|
20
|
|
|
?> |
|
21
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
<div class="table-responsive"> |
|
24
|
|
|
<table class="table table-bordered table-hover getpaid-user-invoices <?php echo esc_attr( $post_type ); ?>"> |
|
25
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
<thead> |
|
28
|
|
|
<tr> |
|
29
|
|
|
|
|
30
|
|
|
<?php foreach ( wpinv_get_user_invoices_columns( $post_type ) as $column_id => $column_name ) : ?> |
|
31
|
|
|
<th class="<?php echo esc_attr( $column_id ); ?> <?php echo ( ! empty( $column_name['class'] ) ? sanitize_html_class( $column_name['class'] ) : ''); ?> border-bottom-0"> |
|
32
|
|
|
<span class="nobr"><?php echo esc_html( $column_name['title'] ); ?></span> |
|
33
|
|
|
</th> |
|
34
|
|
|
<?php endforeach; ?> |
|
35
|
|
|
|
|
36
|
|
|
</tr> |
|
37
|
|
|
</thead> |
|
38
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
|
|
41
|
|
|
<tbody> |
|
42
|
|
|
<?php foreach ( $invoices->invoices as $invoice ) : ?> |
|
43
|
|
|
|
|
44
|
|
|
<tr class="wpinv-item wpinv-item-<?php echo esc_attr( $invoice->get_status() ); ?>"> |
|
45
|
|
|
<?php |
|
46
|
|
|
|
|
47
|
|
|
foreach ( wpinv_get_user_invoices_columns( $post_type ) as $column_id => $column_name ) : |
|
48
|
|
|
|
|
49
|
|
|
$column_id = sanitize_html_class( $column_id ); |
|
50
|
|
|
$class = empty( $column_name['class'] ) ? '' : sanitize_html_class( $column_name['class'] ); |
|
51
|
|
|
|
|
52
|
|
|
echo "<td class='" . esc_attr( $column_id . ' ' . $class ) . "'>"; |
|
53
|
|
|
switch ( $column_id ) { |
|
54
|
|
|
|
|
55
|
|
|
case 'invoice-number': |
|
56
|
|
|
echo wp_kses_post( wpinv_invoice_link( $invoice ) ); |
|
57
|
|
|
break; |
|
58
|
|
|
|
|
59
|
|
|
case 'created-date': |
|
60
|
|
|
echo esc_html( getpaid_format_date_value( $invoice->get_date_created() ) ); |
|
61
|
|
|
break; |
|
62
|
|
|
|
|
63
|
|
|
case 'payment-date': |
|
64
|
|
|
if ( $invoice->needs_payment() ) { |
|
65
|
|
|
echo '—'; |
|
66
|
|
|
} else { |
|
67
|
|
|
echo esc_html( getpaid_format_date_value( $invoice->get_date_completed() ) ); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
break; |
|
71
|
|
|
|
|
72
|
|
|
case 'invoice-status': |
|
73
|
|
|
echo wp_kses_post( $invoice->get_status_label_html() ); |
|
74
|
|
|
|
|
75
|
|
|
break; |
|
76
|
|
|
|
|
77
|
|
|
case 'invoice-total': |
|
78
|
|
|
wpinv_the_price( $invoice->get_total(), $invoice->get_currency() ); |
|
79
|
|
|
|
|
80
|
|
|
break; |
|
81
|
|
|
|
|
82
|
|
|
case 'invoice-actions': |
|
83
|
|
|
$actions = array( |
|
84
|
|
|
|
|
85
|
|
|
'pay' => array( |
|
86
|
|
|
'url' => $invoice->get_checkout_payment_url(), |
|
87
|
|
|
'name' => __( 'Pay Now', 'invoicing' ), |
|
88
|
|
|
'class' => 'btn-success', |
|
89
|
|
|
), |
|
90
|
|
|
|
|
91
|
|
|
'print' => array( |
|
92
|
|
|
'url' => $invoice->get_view_url(), |
|
93
|
|
|
'name' => __( 'View', 'invoicing' ), |
|
94
|
|
|
'class' => 'btn-secondary', |
|
95
|
|
|
'attrs' => 'target="_blank"', |
|
96
|
|
|
), |
|
97
|
|
|
); |
|
98
|
|
|
|
|
99
|
|
|
if ( ! $invoice->needs_payment() ) { |
|
100
|
|
|
unset( $actions['pay'] ); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
if ( $invoice->needs_payment() ) { |
|
104
|
|
|
$actions['delete'] = array( |
|
105
|
|
|
'url' => getpaid_get_authenticated_action_url( 'delete_invoice', add_query_arg( 'invoice_id', $invoice->get_id() ) ), |
|
106
|
|
|
'name' => __( 'Delete', 'invoicing' ), |
|
107
|
|
|
'class' => 'btn-danger', |
|
108
|
|
|
); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
$actions = apply_filters( 'wpinv_user_invoices_actions', $actions, $invoice, $post_type ); |
|
112
|
|
|
|
|
113
|
|
|
foreach ( $actions as $key => $action ) { |
|
114
|
|
|
$class = ! empty( $action['class'] ) ? sanitize_html_class( $action['class'] ) : ''; |
|
115
|
|
|
echo '<a href="' . esc_url( $action['url'] ) . '" class="btn btn-sm btn-block ' . esc_attr( $class . ' ' . sanitize_html_class( $key ) ) . '" ' . ( ! empty( $action['attrs'] ) ? esc_html( $action['attrs'] ) : '' ) . '>' . esc_attr( $action['name'] ) . '</a>'; |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
break; |
|
119
|
|
|
|
|
120
|
|
|
default: |
|
121
|
|
|
do_action( "wpinv_user_invoices_column_$column_id", $invoice ); |
|
122
|
|
|
break; |
|
123
|
|
|
|
|
124
|
|
|
|
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
do_action( "wpinv_user_invoices_column_after_$column_id", $invoice ); |
|
128
|
|
|
|
|
129
|
|
|
echo '</td>'; |
|
130
|
|
|
|
|
131
|
|
|
endforeach; |
|
132
|
|
|
?> |
|
133
|
|
|
</tr> |
|
134
|
|
|
|
|
135
|
|
|
<?php endforeach; ?> |
|
136
|
|
|
|
|
137
|
|
|
</tbody> |
|
138
|
|
|
</table> |
|
139
|
|
|
</div> |
|
140
|
|
|
|
|
141
|
|
|
<?php do_action( 'wpinv_before_user_invoices_pagination' ); ?> |
|
142
|
|
|
|
|
143
|
|
|
<?php if ( 1 < $invoices->max_num_pages ) : ?> |
|
144
|
|
|
<div class="invoicing-Pagination"> |
|
145
|
|
|
<?php |
|
146
|
|
|
$big = 999999; |
|
147
|
|
|
|
|
148
|
|
|
echo wp_kses_post( |
|
149
|
|
|
paginate_links( |
|
|
|
|
|
|
150
|
|
|
array( |
|
151
|
|
|
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
152
|
|
|
'format' => '?paged=%#%', |
|
153
|
|
|
'total' => $invoices->max_num_pages, |
|
154
|
|
|
) |
|
155
|
|
|
) |
|
156
|
|
|
); |
|
157
|
|
|
?> |
|
158
|
|
|
</div> |
|
159
|
|
|
<?php endif; ?> |
|
160
|
|
|
|
|
161
|
|
|
<?php do_action( 'wpinv_after_user_invoices', $invoices->invoices, $invoices->total, $invoices->max_num_pages, $post_type ); ?> |
|
162
|
|
|
|