diff options
Diffstat (limited to 'src/Pages/App')
| -rw-r--r-- | src/Pages/App/Cabins.cshtml | 17 | ||||
| -rw-r--r-- | src/Pages/App/Cabins.cshtml.cs | 14 | ||||
| -rw-r--r-- | src/Pages/App/Index.cshtml | 22 | ||||
| -rw-r--r-- | src/Pages/App/Index.cshtml.cs | 12 | ||||
| -rw-r--r-- | src/Pages/App/Info.cshtml | 10 | ||||
| -rw-r--r-- | src/Pages/App/Info.cshtml.cs | 12 | ||||
| -rw-r--r-- | src/Pages/App/ReservationForm.cshtml | 88 | ||||
| -rw-r--r-- | src/Pages/App/ReservationForm.cshtml.cs | 24 | ||||
| -rw-r--r-- | src/Pages/App/Reservations.cshtml | 18 | ||||
| -rw-r--r-- | src/Pages/App/Reservations.cshtml.cs | 12 | ||||
| -rw-r--r-- | src/Pages/App/Terms.cshtml | 10 | ||||
| -rw-r--r-- | src/Pages/App/Terms.cshtml.cs | 12 | ||||
| -rw-r--r-- | src/Pages/App/Users.cshtml | 11 | ||||
| -rw-r--r-- | src/Pages/App/Users.cshtml.cs | 14 |
14 files changed, 276 insertions, 0 deletions
diff --git a/src/Pages/App/Cabins.cshtml b/src/Pages/App/Cabins.cshtml new file mode 100644 index 0000000..7387151 --- /dev/null +++ b/src/Pages/App/Cabins.cshtml @@ -0,0 +1,17 @@ +@page +@model IOL.Fagprove.Pages.App.Cabins + +@{ + ViewData["Title"] = "Hytter"; +} + +<div id="cabinGrid" + style="min-height: 100px"> +</div> +<div class="ui modal" + id="cabinModal"> +</div> +@section Scripts +{ + <script src="~/scripts/cabins.js" asp-append-version="true"></script> +}
\ No newline at end of file diff --git a/src/Pages/App/Cabins.cshtml.cs b/src/Pages/App/Cabins.cshtml.cs new file mode 100644 index 0000000..5a94c08 --- /dev/null +++ b/src/Pages/App/Cabins.cshtml.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace IOL.Fagprove.Pages.App +{ + public class Cabins : PageModel + { + public ActionResult OnGet() + { + if (!User.IsInRole("Administrator")) return Redirect("/app"); + return Page(); + } + } +}
\ No newline at end of file diff --git a/src/Pages/App/Index.cshtml b/src/Pages/App/Index.cshtml new file mode 100644 index 0000000..0599255 --- /dev/null +++ b/src/Pages/App/Index.cshtml @@ -0,0 +1,22 @@ +@page +@using System.Security.Claims +@using IOL.Fagprove.Utilities +@model IOL.Fagprove.Pages.App.Index +@{ + ViewData["Title"] = "Hjem"; +} +<div class="ui segment middle aligned"> + <h1>Hei @User.GetClaimValue(ClaimTypes.Name)</h1> + <a class="ui link" + href="/app/reservationform"> + Gå til reservasjonskjema + </a> + <div class="ui divider"></div> + <h2>Her kommer en oversikt over dine reservasjoner.</h2> +</div> + +@section Scripts +{ + <script asp-append-version="true" + src="~/scripts/reservations.js"></script> +} diff --git a/src/Pages/App/Index.cshtml.cs b/src/Pages/App/Index.cshtml.cs new file mode 100644 index 0000000..8f27af8 --- /dev/null +++ b/src/Pages/App/Index.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace IOL.Fagprove.Pages.App +{ + public class Index : PageModel + { + public void OnGet() + { + + } + } +}
\ No newline at end of file diff --git a/src/Pages/App/Info.cshtml b/src/Pages/App/Info.cshtml new file mode 100644 index 0000000..f4c1f3c --- /dev/null +++ b/src/Pages/App/Info.cshtml @@ -0,0 +1,10 @@ +@page +@model IOL.Fagprove.Pages.App.Info + +@{ + ViewData["Title"] = "Infoside"; +} +<div class="ui segment"> + <h1>Infoside</h1> + <p>Her kommer det noe snart...</p> +</div>
\ No newline at end of file diff --git a/src/Pages/App/Info.cshtml.cs b/src/Pages/App/Info.cshtml.cs new file mode 100644 index 0000000..541c090 --- /dev/null +++ b/src/Pages/App/Info.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace IOL.Fagprove.Pages.App +{ + public class Info : PageModel + { + public void OnGet() + { + + } + } +}
\ No newline at end of file diff --git a/src/Pages/App/ReservationForm.cshtml b/src/Pages/App/ReservationForm.cshtml new file mode 100644 index 0000000..87df337 --- /dev/null +++ b/src/Pages/App/ReservationForm.cshtml @@ -0,0 +1,88 @@ +@page +@using IOL.Fagprove.Data +@using IOL.Fagprove.Utilities +@model IOL.Fagprove.Pages.App.ReservationForm +@{ + ViewData["Title"] = "Ny reservasjon"; +} + +<div class="ui segment" + id="newReservationSteps"> + <h2>1. Velg hytten du vil reservere</h2> + <form class="ui form" + id="newReservationForm" + onsubmit="return false"> + <div> + @foreach (var field in StaticData.CabinFields.Where(field => Model.Cabins.Any(c => c.CategoryId == field.Id))) + { + <h3>@field.Name</h3> + <div class="ui cards"> + @foreach (var cabin in Model.Cabins.Where(c => c.CategoryId == field.Id)) + { + <div class="card"> + <div class="content"> + <div class="header"> + @cabin.Name + <i class="icon checkmark green card-title" + style="display: none"> + </i> + </div> + <div class="meta"> + @if (cabin.Capacity != null) + { + <span>Sengeplasser: @cabin.Capacity</span> + } + @if (cabin.Price.IsPresent()) + { + <span>Pris per natt: @cabin.Price</span> + } + </div> + @if (cabin.Description.IsPresent()) + { + <div class="description">@cabin.Description</div> + } + </div> + <div class="extra content"> + <button class="ui button choose-cabin-button" + onclick="pickCabin(this, '@cabin.Id')"> + Velg + </button> + </div> + </div> + } + </div> + } + </div> + <div class="ui divider"></div> + <div id="second-step" style="display: none"> + <h2>2. Velg dato for innsjekk/utsjekk</h2> + <div class="field"> + <div id="calendar"></div> + </div> + <div class="field"> + <label for="">Kommentar</label> + <textarea id="comment" style="max-width: 320px;"></textarea> + </div> + <div class="field"> + <div class="ui checkbox" + id="consent"> + <input name="consent" + type="checkbox"> + <label> + Jeg samtykker til + <a href="/app/terms">Bruksvilkårene</a>. + </label> + </div> + </div> + <button class="ui huge green button" + id="submitReservation"> + Send til godkjenning + </button> + </div> + </form> +</div> + +@section Scripts +{ + <script src="~/scripts/reservationForm.js"></script> +} diff --git a/src/Pages/App/ReservationForm.cshtml.cs b/src/Pages/App/ReservationForm.cshtml.cs new file mode 100644 index 0000000..e509a46 --- /dev/null +++ b/src/Pages/App/ReservationForm.cshtml.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Linq; +using IOL.Fagprove.Data; +using IOL.Fagprove.Data.Models; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace IOL.Fagprove.Pages.App +{ + public class ReservationForm : PageModel + { + public List<ReservationObject> Cabins { get; set; } + private readonly AppDbContext _context; + + public ReservationForm(AppDbContext context) + { + _context = context; + } + + public void OnGet() + { + Cabins = _context.Cabins.ToList(); + } + } +}
\ No newline at end of file diff --git a/src/Pages/App/Reservations.cshtml b/src/Pages/App/Reservations.cshtml new file mode 100644 index 0000000..867da6c --- /dev/null +++ b/src/Pages/App/Reservations.cshtml @@ -0,0 +1,18 @@ +@page +@model IOL.Fagprove.Pages.App.Reservations + +@{ + ViewData["Title"] = "Reservasjoner"; +} +<div id="reservationsGrid" + style="min-height: 100px"> +</div> +<div class="ui modal" + id="reservationModal"> +</div> + +@section Scripts +{ + <script src="~/scripts/reservations.js" + asp-append-version="true"></script> +}
\ No newline at end of file diff --git a/src/Pages/App/Reservations.cshtml.cs b/src/Pages/App/Reservations.cshtml.cs new file mode 100644 index 0000000..62775e1 --- /dev/null +++ b/src/Pages/App/Reservations.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace IOL.Fagprove.Pages.App +{ + public class Reservations : PageModel + { + public void OnGet() + { + + } + } +}
\ No newline at end of file diff --git a/src/Pages/App/Terms.cshtml b/src/Pages/App/Terms.cshtml new file mode 100644 index 0000000..e4d8449 --- /dev/null +++ b/src/Pages/App/Terms.cshtml @@ -0,0 +1,10 @@ +@page +@model IOL.Fagprove.Pages.App.Terms + +@{ + ViewData["Title"] = "Bruksvilkår"; +} +<div class="ui segment"> + <h1>Bruksvilkår</h1> + <p>Her kommer det noe snart...</p> +</div> diff --git a/src/Pages/App/Terms.cshtml.cs b/src/Pages/App/Terms.cshtml.cs new file mode 100644 index 0000000..2f05cc1 --- /dev/null +++ b/src/Pages/App/Terms.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace IOL.Fagprove.Pages.App +{ + public class Terms : PageModel + { + public void OnGet() + { + + } + } +}
\ No newline at end of file diff --git a/src/Pages/App/Users.cshtml b/src/Pages/App/Users.cshtml new file mode 100644 index 0000000..5a57e17 --- /dev/null +++ b/src/Pages/App/Users.cshtml @@ -0,0 +1,11 @@ +@page +@model IOL.Fagprove.Pages.App.Users + +@{ + ViewData["Title"] = "Brukere"; +} +<div id="usersGrid" style="min-height: 100px"></div> +@section Scripts +{ + <script src="~/scripts/users.js" asp-append-version="true"></script> +} diff --git a/src/Pages/App/Users.cshtml.cs b/src/Pages/App/Users.cshtml.cs new file mode 100644 index 0000000..e7a1ceb --- /dev/null +++ b/src/Pages/App/Users.cshtml.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace IOL.Fagprove.Pages.App +{ + public class Users : PageModel + { + public ActionResult OnGet() + { + if (!User.IsInRole("Administrator")) return Redirect("/app"); + return Page(); + } + } +}
\ No newline at end of file |
