JavaScript is required to complete your payment.
diff --git a/public/parts/template_person.php b/public/parts/template_person.php
index 24b5ea6..38fdcae 100644
--- a/public/parts/template_person.php
+++ b/public/parts/template_person.php
@@ -175,8 +175,46 @@ if (isset($personid) && $database->has('people', ['personid' => $personid])) {
]);
}
if ($type == "adult" || $type == "youth") {
- // TODO: camp days selection
- // TODO: help area selection
+ if ($type == "adult") {
+ $positions = [
+ "None" => "No Preference",
+ "Den Walker" => "Den Walker",
+ "Station Leader" => "Station Leader",
+ "Tot Lot" => "Tot Lot",
+ "First Aid" => "First Aid",
+ "Floater" => "Floater"
+ ];
+ } else {
+ $positions = [
+ "None" => "No Preference",
+ "Den Chief" => "Den Chief",
+ "Station" => "Station",
+ "Tot Lot" => "Tot Lot",
+ "Floater" => "Floater"
+ ];
+ }
+ $textboxes = array_merge($textboxes, [
+ [
+ "label" => "Available Days",
+ "name" => "days",
+ "type" => "checkboxes",
+ "options" => [
+ "Tu" => "Tuesday",
+ "We" => "Wednesday",
+ "Th" => "Thursday",
+ "Fr" => "Friday",
+ ],
+ "error" => "Choose at least one day."
+ ],
+ [
+ "label" => "Preferred Position",
+ "name" => "position",
+ "type" => "select",
+ "width" => 5,
+ "options" => $positions,
+ "error" => "Choose a position."
+ ]
+ ]);
}
$textboxes = array_merge($textboxes, [
[
@@ -206,7 +244,7 @@ if (isset($personid) && $database->has('people', ['personid' => $personid])) {
\ No newline at end of file
diff --git a/public/static/signup.js b/public/static/signup.js
index 937bb6f..a8be2a8 100644
--- a/public/static/signup.js
+++ b/public/static/signup.js
@@ -58,12 +58,25 @@ $("#camper_list").on("change", "input[name=firstname]", function () {
updateTotal();
});
+$("#adult_list").on("change", "input[name=days]", function () {
+ updateTotal();
+});
+
function updateTotal() {
totalcharge = $(".person-list-item[data-persontype=camper] input[name=firstname]").filter(function () {
return $(this).val() != '';
}).length * 50.0;
+ totalcharge = totalcharge - $(".person-list-item[data-persontype=adult] input[name=days]:checked").filter(function () {
+ return $(this).val() != '';
+ }).length * 10.0;
+
+ totalcharge = Math.max(totalcharge, 0);
+
+ // The server will refuse to finish the registration if this doesn't match
+ // the backend-calculated amount, don't bother being a haxxor
$("#total").text(totalcharge);
+ $("input[name=totalcharge]").val(totalcharge);
}
// Create a Stripe client.