147 lines
7.8 KiB
PHP
147 lines
7.8 KiB
PHP
<?php
|
|
|
|
use humhub\modules\donations\models\DonationSubscription;
|
|
use humhub\modules\donations\models\DonationTransaction;
|
|
use humhub\modules\donations\models\DonationWebhookEvent;
|
|
use humhub\modules\space\models\Space;
|
|
use yii\helpers\Html;
|
|
|
|
/* @var string|null $subNav */
|
|
/* @var DonationTransaction[] $transactions */
|
|
/* @var DonationSubscription[] $subscriptions */
|
|
/* @var DonationWebhookEvent[] $webhookEvents */
|
|
/* @var Space $space */
|
|
?>
|
|
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading"><?= Yii::t('DonationsModule.base', '<strong>Donations</strong> History') ?></div>
|
|
|
|
<?php if (!empty($subNav)): ?>
|
|
<?= $subNav ?>
|
|
<?php endif; ?>
|
|
|
|
<div class="panel-body">
|
|
<div style="margin-bottom:12px;">
|
|
<?= Html::a(
|
|
Yii::t('DonationsModule.base', 'Back to Donations Settings'),
|
|
$space->createUrl('/donations/settings'),
|
|
['class' => 'btn btn-default btn-sm']
|
|
) ?>
|
|
|
|
<?= Html::beginForm($space->createUrl('/donations/settings/reconcile-pending'), 'post', ['style' => 'display:inline-block;margin-left:8px;']) ?>
|
|
<?= Html::submitButton(
|
|
Yii::t('DonationsModule.base', 'Reconcile Pending Transactions'),
|
|
[
|
|
'class' => 'btn btn-primary btn-sm',
|
|
'data-confirm' => Yii::t('DonationsModule.base', 'Attempt reconciliation for pending transactions in this space now?'),
|
|
]
|
|
) ?>
|
|
<?= Html::endForm() ?>
|
|
</div>
|
|
|
|
<h4 style="margin-top:0;"><?= Yii::t('DonationsModule.base', 'Transactions') ?></h4>
|
|
<?php if (empty($transactions)): ?>
|
|
<div class="alert alert-info"><?= Yii::t('DonationsModule.base', 'No transactions found.') ?></div>
|
|
<?php else: ?>
|
|
<div class="table-responsive" style="margin-bottom:14px;">
|
|
<table class="table table-condensed table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Provider') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Mode') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Status') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Amount') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Goal') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Checkout ID') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Payment ID') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Created') ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($transactions as $transaction): ?>
|
|
<tr>
|
|
<td><?= (int)$transaction->id ?></td>
|
|
<td><?= Html::encode($transaction->provider) ?></td>
|
|
<td><?= Html::encode($transaction->mode) ?></td>
|
|
<td><?= Html::encode($transaction->status) ?></td>
|
|
<td><?= number_format((float)$transaction->amount, 2) ?> <?= Html::encode($transaction->currency) ?></td>
|
|
<td>#<?= (int)$transaction->goal_id ?></td>
|
|
<td style="max-width:180px;word-break:break-all;"><?= Html::encode((string)$transaction->provider_checkout_id) ?></td>
|
|
<td style="max-width:180px;word-break:break-all;"><?= Html::encode((string)$transaction->provider_payment_id) ?></td>
|
|
<td><?= Html::encode((string)$transaction->created_at) ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<h4><?= Yii::t('DonationsModule.base', 'Subscriptions') ?></h4>
|
|
<?php if (empty($subscriptions)): ?>
|
|
<div class="alert alert-info"><?= Yii::t('DonationsModule.base', 'No subscriptions found.') ?></div>
|
|
<?php else: ?>
|
|
<div class="table-responsive" style="margin-bottom:14px;">
|
|
<table class="table table-condensed table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Provider') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Status') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Amount') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Interval') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Subscription ID') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Created') ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($subscriptions as $subscription): ?>
|
|
<tr>
|
|
<td><?= (int)$subscription->id ?></td>
|
|
<td><?= Html::encode($subscription->provider) ?></td>
|
|
<td><?= Html::encode($subscription->status) ?></td>
|
|
<td><?= number_format((float)$subscription->amount, 2) ?> <?= Html::encode($subscription->currency) ?></td>
|
|
<td><?= Html::encode((string)$subscription->interval_count) ?> <?= Html::encode((string)$subscription->interval_unit) ?></td>
|
|
<td style="max-width:220px;word-break:break-all;"><?= Html::encode((string)$subscription->provider_subscription_id) ?></td>
|
|
<td><?= Html::encode((string)$subscription->created_at) ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<h4><?= Yii::t('DonationsModule.base', 'Recent Webhook Events (Global)') ?></h4>
|
|
<?php if (empty($webhookEvents)): ?>
|
|
<div class="alert alert-info" style="margin-bottom:0;"><?= Yii::t('DonationsModule.base', 'No webhook events found.') ?></div>
|
|
<?php else: ?>
|
|
<div class="table-responsive" style="margin-bottom:0;">
|
|
<table class="table table-condensed table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Provider') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Event Type') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Event ID') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Processed') ?></th>
|
|
<th><?= Yii::t('DonationsModule.base', 'Created') ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($webhookEvents as $event): ?>
|
|
<tr>
|
|
<td><?= (int)$event->id ?></td>
|
|
<td><?= Html::encode($event->provider) ?></td>
|
|
<td><?= Html::encode((string)$event->event_type) ?></td>
|
|
<td style="max-width:220px;word-break:break-all;"><?= Html::encode((string)$event->provider_event_id) ?></td>
|
|
<td><?= (int)$event->is_processed === 1 ? Yii::t('DonationsModule.base', 'Yes') : Yii::t('DonationsModule.base', 'No') ?></td>
|
|
<td><?= Html::encode((string)$event->created_at) ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|