plugin upload

This commit is contained in:
Rodolfo Martinez 2025-12-12 23:29:08 -05:00
parent 00e60ec1b7
commit c4905e952e
17 changed files with 1426 additions and 0 deletions

View file

@ -0,0 +1,38 @@
<?php
// templates/mortgage-calculator.php
$principal = isset($_POST['principal']) ? floatval($_POST['principal']) : 200000;
$interest_rate = isset($_POST['interest_rate']) ? floatval($_POST['interest_rate']) : 3.5;
$term_years = isset($_POST['term_years']) ? intval($_POST['term_years']) : 30;
$mortgage_results = maple_calculate_mortgage($principal, $interest_rate, $term_years);
?>
<div class="maple-calc mortgage-calculator <?php echo isset($attributes['align']) ? 'align' . esc_attr($attributes['align']) : 'alignnone'; ?>">
<h2>Mortgage Calculator</h2>
<form method="post">
<div class="form-group">
<label for="principal">Loan Amount ($):</label>
<input type="number" id="principal" name="principal" value="<?php echo isset($_POST['principal']) ? esc_attr($_POST['principal']) : '200000'; ?>" required>
</div>
<div class="form-group">
<label for="interest_rate">Interest Rate (%):</label>
<input type="number" step="0.01" id="interest_rate" name="interest_rate" value="<?php echo isset($_POST['interest_rate']) ? esc_attr($_POST['interest_rate']) : '3.5'; ?>" required>
</div>
<div class="form-group">
<label for="term_years">Loan Term (Years):</label>
<input type="number" id="term_years" name="term_years" value="<?php echo isset($_POST['term_years']) ? esc_attr($_POST['term_years']) : '30'; ?>" required>
</div>
<button type="submit" class="calculate-button">Calculate</button>
</form>
<?php if (isset($mortgage_results)): ?>
<div class="results">
<h3>Results</h3>
<p><strong>Monthly Payment:</strong> $<?php echo esc_html($mortgage_results['monthly_payment']); ?></p>
<p><strong>Total Payment:</strong> $<?php echo esc_html($mortgage_results['total_payment']); ?></p>
<p><strong>Total Interest:</strong> $<?php echo esc_html($mortgage_results['total_interest']); ?></p>
<div class="chart-container">
<canvas class="mortgage-chart" data-principal="<?php echo esc_attr($principal); ?>" data-interest="<?php echo esc_attr($mortgage_results['total_interest']); ?>"></canvas>
</div>
</div>
<?php endif; ?>
</div>