252 lines
7.1 KiB
Plaintext
252 lines
7.1 KiB
Plaintext
|
@model ThAmCo.Events.Models.EventDetailsModel
|
||
|
|
||
|
@{
|
||
|
ViewData["Title"] = "Details";
|
||
|
}
|
||
|
|
||
|
<h2>Details</h2>
|
||
|
|
||
|
<div>
|
||
|
<h4>Event</h4>
|
||
|
<hr />
|
||
|
<dl class="dl-horizontal venue-details">
|
||
|
<dt>
|
||
|
@Html.DisplayNameFor(model => model.Title)
|
||
|
</dt>
|
||
|
<dd>
|
||
|
@Html.DisplayFor(model => model.Title)
|
||
|
</dd>
|
||
|
<dt>
|
||
|
@Html.DisplayNameFor(model => model.Date)
|
||
|
</dt>
|
||
|
<dd>
|
||
|
@Html.DisplayFor(model => model.Date)
|
||
|
</dd>
|
||
|
<dt>
|
||
|
@Html.DisplayNameFor(model => model.Duration)
|
||
|
</dt>
|
||
|
<dd>
|
||
|
@Html.DisplayFor(model => model.Duration)
|
||
|
</dd>
|
||
|
<dt>
|
||
|
@Html.DisplayNameFor(model => model.TypeId)
|
||
|
</dt>
|
||
|
<dd>
|
||
|
@Html.DisplayFor(model => model.TypeId)
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="dl-horizontal venue-details">
|
||
|
<dt>
|
||
|
<h4><b><u>@Html.DisplayNameFor(model => model.Reservation)</u></b></h4>
|
||
|
</dt>
|
||
|
|
||
|
@if (Model.Reservation == null)
|
||
|
{
|
||
|
<dd>
|
||
|
<a asp-action="SelectVenue" asp-route-id="@Model.Id">Select Venue</a>
|
||
|
</dd>
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
<dd></dd>
|
||
|
<dt>
|
||
|
@Html.DisplayNameFor(model => model.Reservation.VenueCode)
|
||
|
</dt>
|
||
|
<dd>
|
||
|
@Html.DisplayFor(model => model.Reservation.VenueCode)
|
||
|
</dd>
|
||
|
<dt>
|
||
|
@Html.DisplayNameFor(model => model.Reservation.EventDate)
|
||
|
</dt>
|
||
|
<dd>
|
||
|
@Html.DisplayFor(model => model.Reservation.EventDate)
|
||
|
</dd>
|
||
|
<dt>
|
||
|
@Html.DisplayNameFor(model => model.Reservation.whenMade)
|
||
|
</dt>
|
||
|
<dd>
|
||
|
@Html.DisplayFor(model => model.Reservation.whenMade)
|
||
|
</dd>
|
||
|
<dt></dt>
|
||
|
<dd>
|
||
|
<a asp-action="FreeReservation" asp-route-id="@Model.Id">Remove Venue</a>
|
||
|
</dd>
|
||
|
}
|
||
|
</dl>
|
||
|
|
||
|
<dl class="dl-horizontal venue-details">
|
||
|
<dt>
|
||
|
<h4><b><u>@Html.DisplayNameFor(model => model.FoodReference)</u></b></h4>
|
||
|
</dt>
|
||
|
@if (Model.FoodReference == 0)
|
||
|
{
|
||
|
<dd>
|
||
|
<a asp-action="AddMenu" asp-route-id="@Model.Id">Select Menu</a>
|
||
|
</dd>
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
<dd></dd>
|
||
|
<dt>
|
||
|
Menu Number
|
||
|
</dt>
|
||
|
<dd>
|
||
|
@Html.DisplayFor(model => model.FoodReference)
|
||
|
</dd>
|
||
|
|
||
|
}
|
||
|
</dl>
|
||
|
|
||
|
</div>
|
||
|
<div>
|
||
|
<a asp-action="Edit" asp-route-id="@Model.Id">Edit</a> |
|
||
|
<a asp-action="Index">Back to List</a>
|
||
|
</div>
|
||
|
|
||
|
<div>
|
||
|
<a asp-action="AddCustomer" asp-route-id="@Model.Id">Add Customer</a>
|
||
|
</div>
|
||
|
|
||
|
<table class="table">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>
|
||
|
@Html.DisplayNameFor(model => model.Bookings.FirstOrDefault().Customer.Surname)
|
||
|
</th>
|
||
|
<th>
|
||
|
@Html.DisplayNameFor(model => model.Bookings.FirstOrDefault().Customer.FirstName)
|
||
|
</th>
|
||
|
<th>
|
||
|
@Html.DisplayNameFor(model => model.Bookings.FirstOrDefault().Customer.Email)
|
||
|
</th>
|
||
|
<th>
|
||
|
@Html.DisplayNameFor(model => model.Bookings.FirstOrDefault().Attended)
|
||
|
</th>
|
||
|
<th>
|
||
|
|
||
|
</th>
|
||
|
<th></th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
@foreach (var item in Model.Bookings)
|
||
|
{
|
||
|
<tr>
|
||
|
<td>
|
||
|
@Html.DisplayFor(modelItem => item.Customer.Surname)
|
||
|
</td>
|
||
|
<td>
|
||
|
@Html.DisplayFor(modelItem => item.Customer.FirstName)
|
||
|
</td>
|
||
|
<td>
|
||
|
@Html.DisplayFor(modelItem => item.Customer.Email)
|
||
|
</td>
|
||
|
<td>
|
||
|
@Html.DisplayFor(modelItem => item.Attended)
|
||
|
</td>
|
||
|
<td>
|
||
|
<button onclick="toggleAttendance(@item.Customer.Id, @Model.Id)">Toggle Attendance</button>
|
||
|
</td>
|
||
|
<td>
|
||
|
<form asp-action="RemoveCustomer">
|
||
|
<input type="hidden" asp-for="Id" />
|
||
|
@Html.Hidden("EventID", Model.Id)
|
||
|
@Html.Hidden("CustomerID", item.CustomerId)
|
||
|
<input type="submit" value="Remove" />
|
||
|
</form>
|
||
|
</td>
|
||
|
</tr>
|
||
|
}
|
||
|
</tbody>
|
||
|
</table>
|
||
|
|
||
|
Total Attendees: @Model.Bookings.Count
|
||
|
|
||
|
<div>
|
||
|
<a asp-action="AddStaff" asp-route-id="@Model.Id">Add Staff</a>
|
||
|
</div>
|
||
|
|
||
|
<table class="table">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>
|
||
|
@Html.DisplayNameFor(model => model.Staffing.FirstOrDefault().Staff.Surname)
|
||
|
</th>
|
||
|
<th>
|
||
|
@Html.DisplayNameFor(model => model.Staffing.FirstOrDefault().Staff.FirstName)
|
||
|
</th>
|
||
|
<th>
|
||
|
@Html.DisplayNameFor(model => model.Staffing.FirstOrDefault().Staff.Email)
|
||
|
</th>
|
||
|
<th>
|
||
|
@Html.DisplayNameFor(model => model.Staffing.FirstOrDefault().Staff.FirstAid)
|
||
|
</th>
|
||
|
<th>
|
||
|
|
||
|
</th>
|
||
|
<th></th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
@foreach (var item in Model.Staffing)
|
||
|
{
|
||
|
<tr>
|
||
|
<td>
|
||
|
@Html.DisplayFor(modelItem => item.Staff.Surname)
|
||
|
</td>
|
||
|
<td>
|
||
|
@Html.DisplayFor(modelItem => item.Staff.FirstName)
|
||
|
</td>
|
||
|
<td>
|
||
|
@Html.DisplayFor(modelItem => item.Staff.Email)
|
||
|
</td>
|
||
|
<td>
|
||
|
@Html.DisplayFor(modelItem => item.Staff.FirstAid)
|
||
|
</td>
|
||
|
<td>
|
||
|
<form asp-action="RemoveStaff">
|
||
|
<input type="hidden" asp-for="Id" />
|
||
|
@Html.Hidden("EventID", Model.Id)
|
||
|
@Html.Hidden("StaffID", item.StaffId)
|
||
|
<input type="submit" value="Remove" />
|
||
|
</form>
|
||
|
</td>
|
||
|
</tr>
|
||
|
}
|
||
|
</tbody>
|
||
|
</table>
|
||
|
|
||
|
<h4>
|
||
|
@if (Model.Staffing.Count < Math.Ceiling((double)Model.Bookings.Count / 10))
|
||
|
{
|
||
|
@Html.Raw("⚠ Only have " + Model.Staffing.Count + " staff members, " + Math.Ceiling((double)Model.Bookings.Count / 10) + " are required. <br>")
|
||
|
}
|
||
|
</h4>
|
||
|
<h4>
|
||
|
@if (Model.Staffing == null || !Model.Staffing.Any(s => s.Staff.FirstAid))
|
||
|
{
|
||
|
@Html.Raw("⚠ There is no first aid staff member.")
|
||
|
}
|
||
|
</h4>
|
||
|
|
||
|
|
||
|
|
||
|
@section Scripts {
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
function toggleAttendance(cID, eID)
|
||
|
{
|
||
|
$.ajax({
|
||
|
url: "http://localhost:22263/Events/RegisterAttendance?EventId=" + eID + "&CustomerId=" + cID,
|
||
|
type: "POST",
|
||
|
crossDomain: true,
|
||
|
success: function (result) { window.location.reload(false);},
|
||
|
failiure: function () { }
|
||
|
});
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
|
||
|
}
|