Fix bug when total less than camp coupon, update strings, lower submit error timeout

This commit is contained in:
Skylar Ittner 2025-05-21 21:16:18 -06:00
parent 36013e692f
commit 31e35184f0
6 changed files with 10 additions and 17 deletions

View File

@ -1,9 +0,0 @@
<#if licenseFirst??>
${licenseFirst}
</#if>
${licensePrefix}This Source Code Form is subject to the terms of the Mozilla Public
${licensePrefix}License, v. 2.0. If a copy of the MPL was not distributed with this
${licensePrefix}file, You can obtain one at http://mozilla.org/MPL/2.0/.
<#if licenseLast??>
${licenseLast}
</#if>

View File

@ -1,7 +1,5 @@
auxiliary.org-netbeans-modules-html-editor-lib.default-html-public-id=-//W3C//DTD HTML 4.01 Transitional//EN
include.path=${php.global.include.path}
php.version=PHP_70
project.licensePath=./nbproject/mplheader.txt
php.version=PHP_82
source.encoding=UTF-8
src.dir=.
tags.asp=false

View File

@ -3,7 +3,7 @@
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>CampPortal</name>
<name>PPDCampRegistrationPortal</name>
</data>
</configuration>
</project>

View File

@ -211,7 +211,7 @@ if (isset($_SESSION['familyid']) && $database->has('families', ['familyid' => $_
</div>
<div class="col-12 col-md-4">
<div class="form-group">
<label for="campcoupons">Camp Coupons or Scout Bucks:</label>
<label for="campcoupons">Camp Credits or Scout Bucks:</label>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">

View File

@ -406,7 +406,7 @@ if (isset($personid) && $database->has('people', ['personid' => $personid])) {
</div>
<?php if ($type == "camper") { ?>
<div>
<i class="fas fa-info-circle"></i> Tigers (boys entering the first grade in the Fall) must be accompanied by a parent or guardian.
<i class="fas fa-info-circle"></i> Tigers (scouts entering the first grade in the Fall) must be accompanied by a parent or guardian.
</div>
<?php } ?>
</div>

View File

@ -119,6 +119,10 @@ function updateTotal() {
}).length * prices.tshirt;
var couponcharge = ($("input[name=campcoupons]").val() * 1.0);
if (couponcharge > totalcharge) {
couponcharge = totalcharge;
$("input[name=campcoupons]").val(couponcharge);
}
var cardcharge = Math.max(totalcharge - couponcharge, 0);
if (prices.add_stripe_fees && cardcharge > 0) {
cardcharge = (cardcharge + 0.3) / (1 - 0.029);
@ -127,7 +131,7 @@ function updateTotal() {
totalcharge = Math.max(cardcharge + couponcharge, 0).toFixed(2);
// The server will refuse to finish the registration if this doesn't match
// the backend-calculated amount, don't bother being a haxxor
// the backend-calculated amount
$("#total").text(totalcharge);
$("input[name=totalcharge]").val(totalcharge);
if (totalcharge <= 0) {
@ -216,7 +220,7 @@ $("#registrationform").on("submit", function (event) {
$("#savebutton-text").removeClass("d-none");
$("#savebutton-wait").addClass("d-none");
}
}, 1000 * 60);
}, 1000 * 15);
} else {
console.log("Submitting without card...");
document.getElementById('registrationform').submit();