donation-amount-heading.php
4 years ago
header.php
4 years ago
icon-defs.php
4 years ago
loading.php
4 years ago
receipt.php
4 years ago
receipt.php
129 lines
| 1 | <?php |
| 2 | |
| 3 | use Give\Helpers\Form\Template; |
| 4 | use Give\Receipt\DonationReceipt; |
| 5 | use Give\Receipt\LineItem; |
| 6 | use Give\Receipt\Section; |
| 7 | use Give\Session\SessionDonation\DonationAccessor; |
| 8 | use Give\Views\IframeContentView; |
| 9 | |
| 10 | $template = Give()->templates->getTemplate(); |
| 11 | $receipt = $template->getReceiptDetails(( new DonationAccessor() )->getDonationId()); |
| 12 | $option = function ($name) use ($template) { |
| 13 | static $options = []; |
| 14 | |
| 15 | if (empty($options)) { |
| 16 | $options = Template::getOptions()[ 'donation_receipt' ]; |
| 17 | } |
| 18 | |
| 19 | if (isset($options[ $name ])) { |
| 20 | return $options[ $name ]; |
| 21 | } |
| 22 | |
| 23 | return ''; |
| 24 | }; |
| 25 | |
| 26 | $donorDashboardUrl = get_permalink(give_get_option('donor_dashboard_page')); |
| 27 | |
| 28 | ob_start(); |
| 29 | ?> |
| 30 | <?php include __DIR__ . '/icon-defs.php'; ?> |
| 31 | <article class="give-receipt-classic"> |
| 32 | <div class="give-form-header"> |
| 33 | <div class="give-form-header-top-wrap"> |
| 34 | <aside class="give-form-secure-badge"> |
| 35 | <svg class="give-form-secure-icon"> |
| 36 | <use href="#give-icon-checkmark"/> |
| 37 | </svg> |
| 38 | <?= esc_html__('Success', 'give'); ?>! |
| 39 | </aside> |
| 40 | <h1 class="give-receipt-title"> |
| 41 | <?= $receipt->heading; ?> |
| 42 | </h1> |
| 43 | <p class="give-form-description"> |
| 44 | <?= $receipt->message; ?> |
| 45 | </p> |
| 46 | </div> |
| 47 | </div> |
| 48 | |
| 49 | <?php if ('enabled' === $option('social_sharing')) : ?> |
| 50 | <div class="social-sharing"> |
| 51 | <p class="instruction"> |
| 52 | <?= esc_html__($option('sharing_instructions')); ?> |
| 53 | </p> |
| 54 | <div class="btn-row"> |
| 55 | <button class="give-btn social-btn facebook-btn" onclick="GiveClassicTemplate.share(this);"> |
| 56 | <?= esc_html__('Share on Facebook', 'give'); ?> |
| 57 | <i class="fab fa-facebook"></i> |
| 58 | </button> |
| 59 | <button class="give-btn social-btn twitter-btn" onclick="GiveClassicTemplate.share(this);"> |
| 60 | <?= esc_html__('Share on Twitter', 'give'); ?> |
| 61 | <i class="fab fa-twitter"></i> |
| 62 | </button> |
| 63 | </div> |
| 64 | </div> |
| 65 | <?php endif; ?> |
| 66 | |
| 67 | <div class="receipt-sections"> |
| 68 | |
| 69 | <?php |
| 70 | foreach ($receipt as $section) : |
| 71 | /* @var Section $section */ |
| 72 | if (! $section->getLineItems() || 'PDFReceipt' === $section->id) { |
| 73 | continue; |
| 74 | } |
| 75 | ?> |
| 76 | |
| 77 | <div class="details"> |
| 78 | <?php if ($section->label) : ?> |
| 79 | <h2 class="headline"> |
| 80 | <?= $section->label; ?> |
| 81 | </h2> |
| 82 | <?php endif; ?> |
| 83 | <dl class="details-table"> |
| 84 | |
| 85 | <?php |
| 86 | foreach ($section as $lineItem) : |
| 87 | /* @var LineItem $lineItem */ |
| 88 | if (! $lineItem->value) { |
| 89 | continue; |
| 90 | } |
| 91 | |
| 92 | $class = ''; |
| 93 | if (DonationReceipt::DONATIONSECTIONID === $section->id) { |
| 94 | $class = 'totalAmount' === $lineItem->id ? 'total' : ''; |
| 95 | } |
| 96 | ?> |
| 97 | |
| 98 | <div class="details-row details-row--<?= $lineItem->id ?>"> |
| 99 | <?= $lineItem->icon ?> |
| 100 | <dt class="detail"><?= $lineItem->label ?></dt> |
| 101 | <dd class="value"><?= $lineItem->value ?></dd> |
| 102 | </div> |
| 103 | <?php endforeach; ?> |
| 104 | |
| 105 | </dl> |
| 106 | </div> |
| 107 | |
| 108 | <?php endforeach; ?> |
| 109 | </div> |
| 110 | |
| 111 | <div class="dashboard-link-container"> |
| 112 | <a class="dashboard-link" href="<?= esc_url($donorDashboardUrl); ?>" target="_parent"> |
| 113 | <?= esc_html__('Go to my Donor Dashboard', 'give'); ?><i class="fas fa-long-arrow-alt-right"></i> |
| 114 | </a> |
| 115 | <?php if (isset($section[ 'receiptLink' ])) : ?> |
| 116 | <div class="give-btn download-btn"> |
| 117 | <?= $section[ 'receiptLink' ]->value; ?> |
| 118 | </div> |
| 119 | <?php endif; ?> |
| 120 | </div> |
| 121 | </article> |
| 122 | |
| 123 | <?php |
| 124 | |
| 125 | echo ( new IframeContentView() ) |
| 126 | ->setTitle(esc_html__('Donation Receipt', 'give')) |
| 127 | ->setBody(ob_get_clean()) |
| 128 | ->renderBody(); |
| 129 |