| @@ -93,8 +93,11 @@ | ||
| 93 | 93 | case 'completed': |
| 94 | 94 | echo 'bg-green-100 text-green-800'; |
| 95 | 95 | break; |
| 96 | 96 | case 'pending': |
| 97 | + case 'pending-bank': | |
| 98 | + case 'pending-cheque': | |
| 99 | + case 'pending_verification': | |
| 97 | 100 | echo 'bg-yellow-100 text-yellow-800'; |
| 98 | 101 | break; |
| 99 | 102 | case 'failed': |
| 100 | 103 | echo 'bg-red-100 text-red-800'; |
| @@ -102,9 +105,18 @@ | ||
| 102 | 105 | default: |
| 103 | 106 | echo 'bg-gray-100 text-gray-800'; |
| 104 | 107 | } |
| 105 | 108 | ?>"> |
| 106 | - <?php echo esc_html(ucfirst($payment->getStatus())); ?> | |
| 109 | + <?php | |
| 110 | + $ei_vs = (string) $payment->getStatus(); | |
| 111 | + if (in_array($ei_vs, \EasyInvoice\Services\OfflinePayments::pendingStatuses(), true)) { | |
| 112 | + esc_html_e('Awaiting confirmation', 'easy-invoice'); | |
| 113 | + } elseif ('rejected' === $ei_vs) { | |
| 114 | + esc_html_e('Rejected', 'easy-invoice'); | |
| 115 | + } else { | |
| 116 | + echo esc_html(ucfirst($ei_vs)); | |
| 117 | + } | |
| 118 | + ?> | |
| 107 | 119 | </span> |
| 108 | 120 | </dd> |
| 109 | 121 | </div> |
| 110 | 122 | <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"> |
| @@ -142,8 +154,60 @@ | ||
| 142 | 154 | <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"> |
| 143 | 155 | <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Notes', 'easy-invoice'); ?></dt> |
| 144 | 156 | <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2"> |
| 145 | 157 | <?php echo nl2br(esc_html($payment->getNotes())); ?> |
| 158 | + </dd> | |
| 159 | + </div> | |
| 160 | + <?php endif; ?> | |
| 161 | + <?php | |
| 162 | + // What the client told us when they submitted an offline payment, and what staff did with it. | |
| 163 | + $ei_pid = (int) $payment->getId(); | |
| 164 | + $ei_reference = (string) get_post_meta($ei_pid, \EasyInvoice\Services\OfflinePayments::META_REFERENCE, true); | |
| 165 | + $ei_has_proof = \EasyInvoice\Services\OfflinePayments::hasProof($ei_pid); | |
| 166 | + $ei_proof_nm = (string) get_post_meta($ei_pid, \EasyInvoice\Services\OfflinePayments::META_PROOF_NAME, true); | |
| 167 | + $ei_status = (string) $payment->getStatus(); | |
| 168 | + $ei_pending = in_array($ei_status, \EasyInvoice\Services\OfflinePayments::pendingStatuses(), true); | |
| 169 | + $ei_verified = (int) get_post_meta($ei_pid, '_verified_by', true); | |
| 170 | + $ei_rejected = (int) get_post_meta($ei_pid, '_rejected_by', true); | |
| 171 | + ?> | |
| 172 | + <?php if ('' !== $ei_reference) : ?> | |
| 173 | + <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"> | |
| 174 | + <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Reference given by the client', 'easy-invoice'); ?></dt> | |
| 175 | + <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2"><?php echo esc_html($ei_reference); ?></dd> | |
| 176 | + </div> | |
| 177 | + <?php endif; ?> | |
| 178 | + <?php if ($ei_has_proof) : ?> | |
| 179 | + <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"> | |
| 180 | + <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Receipt', 'easy-invoice'); ?></dt> | |
| 181 | + <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2"> | |
| 182 | + <a class="inline-flex items-center gap-1 font-medium text-indigo-600 hover:text-indigo-900" target="_blank" rel="noopener" href="<?php echo esc_url(\EasyInvoice\Services\OfflinePayments::proofUrl($ei_pid)); ?>"> | |
| 183 | + <?php echo esc_html('' !== $ei_proof_nm ? $ei_proof_nm : __('Open receipt', 'easy-invoice')); ?> | |
| 184 | + </a> | |
| 185 | + <span class="block text-xs text-gray-400"><?php esc_html_e('Only signed-in staff can open this file.', 'easy-invoice'); ?></span> | |
| 186 | + </dd> | |
| 187 | + </div> | |
| 188 | + <?php elseif ($ei_pending) : ?> | |
| 189 | + <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"> | |
| 190 | + <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Receipt', 'easy-invoice'); ?></dt> | |
| 191 | + <dd class="mt-1 text-sm text-gray-500 sm:mt-0 sm:col-span-2"><?php esc_html_e('None attached.', 'easy-invoice'); ?></dd> | |
| 192 | + </div> | |
| 193 | + <?php endif; ?> | |
| 194 | + <?php if ($ei_verified || $ei_rejected) : $ei_who = get_userdata($ei_verified ?: $ei_rejected); $ei_when = (string) get_post_meta($ei_pid, $ei_verified ? '_verified_at' : '_rejected_at', true); ?> | |
| 195 | + <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"> | |
| 196 | + <dt class="text-sm font-medium text-gray-500"><?php echo $ei_verified ? esc_html__('Confirmed by', 'easy-invoice') : esc_html__('Rejected by', 'easy-invoice'); ?></dt> | |
| 197 | + <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2"> | |
| 198 | + <?php echo esc_html($ei_who ? $ei_who->display_name : __('Unknown user', 'easy-invoice')); ?> | |
| 199 | + <?php if ('' !== $ei_when && strtotime($ei_when)) : ?> | |
| 200 | + <span class="text-gray-500">· <?php echo esc_html(date_i18n(get_option('date_format') . ' ' . get_option('time_format'), strtotime($ei_when))); ?></span> | |
| 201 | + <?php endif; ?> | |
| 202 | + </dd> | |
| 203 | + </div> | |
| 204 | + <?php endif; ?> | |
| 205 | + <?php if ($ei_pending && easy_invoice_user_can('ei_record_payment')) : ?> | |
| 206 | + <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"> | |
| 207 | + <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Decision', 'easy-invoice'); ?></dt> | |
| 208 | + <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2"> | |
| 209 | + <a href="<?php echo esc_url(admin_url('admin.php?page=easy-invoice-payments&status=pending')); ?>" class="font-medium text-indigo-600 hover:text-indigo-900"><?php esc_html_e('Confirm or reject it from the Payments list', 'easy-invoice'); ?></a> | |
| 146 | 210 | </dd> |
| 147 | 211 | </div> |
| 148 | 212 | <?php endif; ?> |
| 149 | 213 | </dl> |