|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Invoice Payment Meta |
|
5
|
|
|
* |
|
6
|
|
|
* Display the invoice data meta box. |
|
7
|
|
|
* |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
if ( ! defined( 'ABSPATH' ) ) { |
|
11
|
|
|
exit; // Exit if accessed directly |
|
12
|
|
|
} |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* GetPaid_Meta_Box_Invoice_Payment_Meta Class. |
|
16
|
|
|
*/ |
|
17
|
|
|
class GetPaid_Meta_Box_Invoice_Payment_Meta { |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Output the metabox. |
|
21
|
|
|
* |
|
22
|
|
|
* @param WP_Post $post |
|
23
|
|
|
*/ |
|
24
|
|
|
public static function output( $post ) { |
|
25
|
|
|
|
|
26
|
|
|
// Prepare the invoice. |
|
27
|
|
|
$invoice = new WPInv_Invoice( $post ); |
|
28
|
|
|
|
|
29
|
|
|
?> |
|
30
|
|
|
|
|
31
|
|
|
<style> |
|
32
|
|
|
#wpinv-payment-meta label { |
|
33
|
|
|
margin-bottom: 3px; |
|
34
|
|
|
font-weight: 600; |
|
35
|
|
|
} |
|
36
|
|
|
</style> |
|
37
|
|
|
<div class="bsui" style="margin-top: 1.5rem"> |
|
38
|
|
|
|
|
39
|
|
|
<div id="gdmbx2-metabox-wpinv-payment-meta" class="wpinv-payment-meta"> |
|
40
|
|
|
|
|
41
|
|
|
<?php |
|
42
|
|
|
|
|
43
|
|
|
// Invoice key. |
|
44
|
|
|
echo aui()->input( |
|
45
|
|
|
array( |
|
46
|
|
|
'type' => 'text', |
|
47
|
|
|
'id' => 'wpinv_key', |
|
48
|
|
|
'name' => 'wpinv_key', |
|
49
|
|
|
'label' => __( 'Invoice Key:', 'invoicing' ), |
|
50
|
|
|
'label_type' => 'vertical', |
|
51
|
|
|
'class' => 'form-control-sm', |
|
52
|
|
|
'value' => $invoice->get_key( 'edit' ), |
|
53
|
|
|
'extra_attributes' => array( |
|
54
|
|
|
'onclick' => 'this.select();', |
|
55
|
|
|
'readonly' => 'true', |
|
56
|
|
|
), |
|
57
|
|
|
) |
|
58
|
|
|
); |
|
59
|
|
|
|
|
60
|
|
|
// View URL. |
|
61
|
|
|
if ( ! $invoice->is_draft() ) { |
|
62
|
|
|
echo aui()->input( |
|
63
|
|
|
array( |
|
64
|
|
|
'type' => 'text', |
|
65
|
|
|
'id' => 'wpinv_view_url', |
|
66
|
|
|
'name' => 'wpinv_view_url', |
|
67
|
|
|
'label' => __( 'Invoice URL:', 'invoicing' ), |
|
68
|
|
|
'label_type' => 'vertical', |
|
69
|
|
|
'class' => 'form-control-sm', |
|
70
|
|
|
'value' => $invoice->get_view_url(), |
|
71
|
|
|
'extra_attributes' => array( |
|
72
|
|
|
'onclick' => 'this.select();', |
|
73
|
|
|
'readonly' => 'true', |
|
74
|
|
|
), |
|
75
|
|
|
) |
|
76
|
|
|
); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
// If the invoice is paid... |
|
80
|
|
|
if ( $invoice->is_paid() || $invoice->is_refunded() ) { |
|
81
|
|
|
|
|
82
|
|
|
// Payment date. |
|
83
|
|
|
echo aui()->input( |
|
84
|
|
|
array( |
|
85
|
|
|
'type' => 'datepicker', |
|
86
|
|
|
'id' => 'wpinv_date_completed', |
|
87
|
|
|
'name' => 'date_completed', |
|
88
|
|
|
'label' => __( 'Payment Date:', 'invoicing' ), |
|
89
|
|
|
'label_type' => 'vertical', |
|
90
|
|
|
'placeholder' => 'YYYY-MM-DD 00:00', |
|
91
|
|
|
'class' => 'form-control-sm', |
|
92
|
|
|
'value' => $invoice->get_date_completed( 'edit' ), |
|
93
|
|
|
'extra_attributes' => array( |
|
94
|
|
|
'data-enable-time' => 'true', |
|
95
|
|
|
'data-time_24hr' => 'true', |
|
96
|
|
|
'data-allow-input' => 'true', |
|
97
|
|
|
), |
|
98
|
|
|
) |
|
99
|
|
|
); |
|
100
|
|
|
|
|
101
|
|
|
// Gateway. |
|
102
|
|
|
echo aui()->input( |
|
103
|
|
|
array( |
|
104
|
|
|
'type' => 'text', |
|
105
|
|
|
'id' => 'wpinv_gateway', |
|
106
|
|
|
'name' => 'wpinv_gateway', |
|
107
|
|
|
'label' => __( 'Gateway:', 'invoicing' ), |
|
108
|
|
|
'label_type' => 'vertical', |
|
109
|
|
|
'class' => 'form-control-sm', |
|
110
|
|
|
'value' => wpinv_get_gateway_admin_label( $invoice->get_gateway( 'edit' ) ), |
|
111
|
|
|
'extra_attributes' => array( |
|
112
|
|
|
'onclick' => 'this.select();', |
|
113
|
|
|
'readonly' => 'true', |
|
114
|
|
|
), |
|
115
|
|
|
) |
|
116
|
|
|
); |
|
117
|
|
|
|
|
118
|
|
|
// Transaction ID. |
|
119
|
|
|
echo aui()->input( |
|
120
|
|
|
array( |
|
121
|
|
|
'type' => 'text', |
|
122
|
|
|
'id' => 'wpinv_transaction_id', |
|
123
|
|
|
'name' => 'wpinv_transaction_id', |
|
124
|
|
|
'label' => __( 'Transaction ID:', 'invoicing' ), |
|
125
|
|
|
'label_type' => 'vertical', |
|
126
|
|
|
'class' => 'form-control-sm', |
|
127
|
|
|
'value' => $invoice->get_transaction_id( 'edit' ), |
|
128
|
|
|
'help_text' => apply_filters( 'wpinv_invoice_transaction_link_' . $invoice->get_gateway( 'edit' ), '', $invoice->get_transaction_id(), $invoice ), |
|
129
|
|
|
'extra_attributes' => array( |
|
130
|
|
|
'onclick' => 'this.select();', |
|
131
|
|
|
'readonly' => 'true', |
|
132
|
|
|
), |
|
133
|
|
|
) |
|
134
|
|
|
); |
|
135
|
|
|
|
|
136
|
|
|
// Currency. |
|
137
|
|
|
echo aui()->input( |
|
138
|
|
|
array( |
|
139
|
|
|
'type' => 'text', |
|
140
|
|
|
'id' => 'wpinv_currency', |
|
141
|
|
|
'name' => 'wpinv_currency', |
|
142
|
|
|
'label' => __( 'Currency:', 'invoicing' ), |
|
143
|
|
|
'label_type' => 'vertical', |
|
144
|
|
|
'class' => 'form-control-sm', |
|
145
|
|
|
'value' => $invoice->get_currency( 'edit' ), |
|
146
|
|
|
'extra_attributes' => array( |
|
147
|
|
|
'onclick' => 'this.select();', |
|
148
|
|
|
'readonly' => 'true', |
|
149
|
|
|
), |
|
150
|
|
|
) |
|
151
|
|
|
); |
|
152
|
|
|
|
|
153
|
|
|
} else { |
|
154
|
|
|
|
|
155
|
|
|
// Payment URL. |
|
156
|
|
|
if ( ! $invoice->is_draft() ) { |
|
157
|
|
|
echo aui()->input( |
|
158
|
|
|
array( |
|
159
|
|
|
'type' => 'text', |
|
160
|
|
|
'id' => 'wpinv_payment_url', |
|
161
|
|
|
'name' => 'wpinv_payment_url', |
|
162
|
|
|
'label' => __( 'Payment URL:', 'invoicing' ), |
|
163
|
|
|
'label_type' => 'vertical', |
|
164
|
|
|
'class' => 'form-control-sm', |
|
165
|
|
|
'value' => $invoice->get_checkout_payment_url(), |
|
166
|
|
|
'extra_attributes' => array( |
|
167
|
|
|
'onclick' => 'this.select();', |
|
168
|
|
|
'readonly' => 'true', |
|
169
|
|
|
), |
|
170
|
|
|
) |
|
171
|
|
|
); |
|
172
|
|
|
} |
|
173
|
|
|
|
|
174
|
|
|
// Set gateway. |
|
175
|
|
|
echo aui()->select( |
|
176
|
|
|
array( |
|
177
|
|
|
'id' => 'wpinv_gateway', |
|
178
|
|
|
'name' => 'wpinv_gateway', |
|
179
|
|
|
'label' => __( 'Gateway:', 'invoicing' ), |
|
180
|
|
|
'label_type' => 'vertical', |
|
181
|
|
|
'placeholder' => __( 'Select Gateway', 'invoicing' ), |
|
182
|
|
|
'value' => $invoice->get_gateway( 'edit' ), |
|
183
|
|
|
'select2' => true, |
|
184
|
|
|
'data-allow-clear' => 'false', |
|
185
|
|
|
'options' => wp_list_pluck( wpinv_get_enabled_payment_gateways( true ), 'admin_label' ), |
|
186
|
|
|
) |
|
187
|
|
|
); |
|
188
|
|
|
|
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
?> |
|
192
|
|
|
</div> |
|
193
|
|
|
</div> |
|
194
|
|
|
|
|
195
|
|
|
<?php |
|
196
|
|
|
} |
|
197
|
|
|
} |
|
198
|
|
|
|