Add vegetarian dinner option
Change-Id: Ibcda53e07467957f12ccbaf5bc8dc02b9944365f
diff --git a/User.php b/User.php
index 790af5a..aa7357c 100644
--- a/User.php
+++ b/User.php
@@ -25,6 +25,7 @@
public $participation_confirmed_at;
public bool $student;
public bool $conference_dinner;
+ public bool $vegetarian_dinner;
public $registered_at;
public bool $earlybird_registration;
public $lunch_day_1;
@@ -56,6 +57,7 @@
$this->participation_confirmed_at = "";
$this->student = false;
$this->conference_dinner = false;
+ $this->vegetarian_dinner = false;
$this->registered_at = date("Y-m-d H:i:s") . "UTC";
$this->earlybird_registration = false;
$this->total_due = 0.0;
diff --git a/create_user_table.sql b/create_user_table.sql
index 5e1f9b3..daa42d6 100644
--- a/create_user_table.sql
+++ b/create_user_table.sql
@@ -24,6 +24,7 @@
lunch_day_1 varchar(16) not null default '',
lunch_day_2 varchar(16) not null default '',
lunch_day_3 varchar(16) not null default '',
+ vegetarian_dinner boolean,
total_due decimal(10,2) not null default 0.00,
registered_at timestamp default '0000-00-00 00:00:00',
updated_at timestamp default now() on update now(),
diff --git a/invoice.php b/invoice.php
index 6c2f57b..3b73799 100644
--- a/invoice.php
+++ b/invoice.php
@@ -36,7 +36,7 @@
$invoice->addItem( $SERVICE_ACRONYM . ' Registration', $SERVICE_NAME, 1, false, $REGULAR_CONFERENCE_FEE, false, $REGULAR_CONFERENCE_FEE);
if($user->student) $invoice->addItem('Student Discount', 'Student discount', 1, false, - $STUDENT_DISCOUNT, false, -$STUDENT_DISCOUNT);
if($user->conference_dinner) {
- $invoice->addItem('Conference Dinner', 'The conference dinner will take place on 20 July.', 1, false, $CONFERENCE_DINNER, $CONFERENCE_DINNER * $FULL_VAT, $CONFERENCE_DINNER);
+ $invoice->addItem('Conference Dinner' . ($user->vegetarian_dinner ? " (vegetarian option)" : ""), 'The conference dinner will take place on 20 July.', 1, false, $CONFERENCE_DINNER, $CONFERENCE_DINNER * $FULL_VAT, $CONFERENCE_DINNER);
$vat_sum += $CONFERENCE_DINNER * $FULL_VAT;
}
$lunch_count = 0;
diff --git a/static/main.js b/static/main.js
index 7ed582c..3f8c7ac 100644
--- a/static/main.js
+++ b/static/main.js
@@ -23,7 +23,13 @@
function update_total_due() {
var costs = 0;
+ var vegetarian_dinner = $("#vegetarian_dinner");
+ if ($('#conference_dinner').is(":checked")) {
+ vegetarian_dinner.removeAttr('disabled');
+ } else {
+ vegetarian_dinner.attr('disabled', 'disabled');
+ }
if ($('#participate').is(":checked")) {
costs += parseInt($("#conference_fee").text(), 10);
diff --git a/templates/register.htm b/templates/register.htm
index b62493e..c35dcf4 100644
--- a/templates/register.htm
+++ b/templates/register.htm
@@ -495,9 +495,13 @@
<label class="form-label fw-bold" for="conference_dinner">Conference Dinner</label>
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="conference_dinner" id="conference_dinner" <?php echo isset($_POST[ 'conference_dinner']) ? 'checked' : '' ?> oninput="update_total_due()" value="conference_dinner">
- <label class="form-check-label fs-4" for="conference_dinner">I will be attending the conference dinner on 20 July at 8pm at the Rheinterrassen for the price of <strong>€ <span id="conference_dinner_price"><?php echo $CONFERENCE_DINNER; ?></span></strong>.
+ <label class="form-check-label fs-4" for="conference_dinner">I will be attending the conference dinner on 20 July at 8pm at the <a target="iclc10-rheinterrassen" href="https://www.rheinterrassen.info/">Rheinterrassen</a> for the price of <strong>€ <span id="conference_dinner_price"><?php echo $CONFERENCE_DINNER; ?></span></strong>.
</label>
</div>
+ <div class="form-group form-check pl-3" style="padding-left: 3.5em">
+ <input type="checkbox" class="form-check-input" name="vegetarian_dinner" id="vegetarian_dinner" disabled <?php echo isset($_POST[ 'vegetarian_dinner']) ? 'checked' : '' ?> oninput="update_total_due()" value="vegetarian_dinner">
+ <label class="form-check-label fs-4" for="vegetarian_dinner">I choose the vegetarian dinner option</label>
+ </div>
</div>
<label class="form-label fw-bold" for="participate">Lunch Options</label>