Book appointment page
This commit is contained in:
parent
6388899f8b
commit
a107386ecd
|
@ -1,30 +1,23 @@
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Optimization;
|
using System.Web.Optimization;
|
||||||
|
|
||||||
namespace FIT5032_Assignment
|
namespace FIT5032_Assignment {
|
||||||
{
|
public class BundleConfig {
|
||||||
public class BundleConfig
|
// For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
|
||||||
{
|
public static void RegisterBundles(BundleCollection bundles) {
|
||||||
// For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
|
bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/Scripts/jquery-{version}.js"));
|
||||||
public static void RegisterBundles(BundleCollection bundles)
|
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include("~/Scripts/jquery.validate*"));
|
||||||
{
|
|
||||||
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
|
|
||||||
"~/Scripts/jquery-{version}.js"));
|
|
||||||
|
|
||||||
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
|
// Use the development version of Modernizr to develop with and learn from. Then, when you're
|
||||||
"~/Scripts/jquery.validate*"));
|
// ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
|
||||||
|
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include("~/Scripts/modernizr-*"));
|
||||||
|
bundles.Add(new Bundle("~/bundles/bootstrap").Include("~/Scripts/bootstrap.js"));
|
||||||
|
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/bootstrap.css", "~/Content/site.css"));
|
||||||
|
|
||||||
// Use the development version of Modernizr to develop with and learn from. Then, when you're
|
// Bootstrap.v3.Datetimepicker.CSS
|
||||||
// ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
|
bundles.Add(new StyleBundle("~/bundles/datetimepicker.style").Include("~/Content/bootstrap-datetimepicker.min.css"));
|
||||||
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
|
bundles.Add(new ScriptBundle("~/bundles/moment").Include("~/Scripts/moment.min.js"));
|
||||||
"~/Scripts/modernizr-*"));
|
bundles.Add(new Bundle("~/bundles/datetimepicker").Include("~/Scripts/bootstrap-datetimepicker.min.js"));
|
||||||
|
|
||||||
bundles.Add(new Bundle("~/bundles/bootstrap").Include(
|
|
||||||
"~/Scripts/bootstrap.js"));
|
|
||||||
|
|
||||||
bundles.Add(new StyleBundle("~/Content/css").Include(
|
|
||||||
"~/Content/bootstrap.css",
|
|
||||||
"~/Content/site.css"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,22 +22,28 @@ namespace FIT5032_Assignment.Controllers {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: Appointments/Create
|
// GET: Appointments/Create
|
||||||
public ActionResult Create() {
|
public ActionResult Create(string id) {
|
||||||
// Pass a dropdown list for all doctors
|
if (id == null) {
|
||||||
List<Doctors> doctors = db.Doctors.ToList();
|
// Pass a dropdown list for all doctors
|
||||||
// Create a tuple for put uuid and displayName into it
|
List<Doctors> doctors = db.Doctors.ToList();
|
||||||
List<Tuple<string, string>> doctorsList = new List<Tuple<string, string>>();
|
List<Tuple<Users, Doctors>> usersList = new List<Tuple<Users, Doctors>>();
|
||||||
List<Users> users = db.Users.ToList();
|
foreach (var doctor in doctors) {
|
||||||
for (int i = 0; i < doctors.Count; i++) {
|
// Fetch the user obj
|
||||||
// Get displayName from users table
|
Users user = db.Users.Find(doctor.user);
|
||||||
string displayName = users.Find(user => user.uuid == doctors[i].user).displayName;
|
usersList.Add(new Tuple<Users, Doctors>(user, doctor));
|
||||||
Tuple<string, string> doctor = new Tuple<string, string>(doctors[i].user, displayName);
|
}
|
||||||
doctorsList.Add(doctor);
|
ViewBag.doctorsList = usersList;
|
||||||
|
} else {
|
||||||
|
ViewBag.doctorId = id;
|
||||||
|
// Fetch doctor profile
|
||||||
|
ViewBag.doctor = db.Doctors.Where(d => d.user == id);
|
||||||
|
ViewBag.doctorUser = db.Users.Find(id);
|
||||||
}
|
}
|
||||||
ViewBag.doctorsList = new SelectList(doctorsList, "Item1", "Item2");
|
|
||||||
return View();
|
return View();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// POST: Appointments/Create
|
// POST: Appointments/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Create(FormCollection collection) {
|
public ActionResult Create(FormCollection collection) {
|
||||||
|
|
|
@ -295,6 +295,10 @@
|
||||||
<Content Include="Scripts\jquery.validate.unobtrusive.js" />
|
<Content Include="Scripts\jquery.validate.unobtrusive.js" />
|
||||||
<Content Include="Scripts\jquery.validate.unobtrusive.min.js" />
|
<Content Include="Scripts\jquery.validate.unobtrusive.min.js" />
|
||||||
<Content Include="Scripts\modernizr-2.8.3.js" />
|
<Content Include="Scripts\modernizr-2.8.3.js" />
|
||||||
|
<Content Include="Scripts\moment-with-locales.js" />
|
||||||
|
<Content Include="Scripts\moment-with-locales.min.js" />
|
||||||
|
<Content Include="Scripts\moment.js" />
|
||||||
|
<Content Include="Scripts\moment.min.js" />
|
||||||
<Content Include="Web.config" />
|
<Content Include="Web.config" />
|
||||||
<Content Include="Web.Debug.config">
|
<Content Include="Web.Debug.config">
|
||||||
<DependentUpon>Web.config</DependentUpon>
|
<DependentUpon>Web.config</DependentUpon>
|
||||||
|
@ -318,6 +322,7 @@
|
||||||
<Content Include="Views\Home\ImageUpload.cshtml" />
|
<Content Include="Views\Home\ImageUpload.cshtml" />
|
||||||
<Content Include="Views\Appointments\Index.cshtml" />
|
<Content Include="Views\Appointments\Index.cshtml" />
|
||||||
<Content Include="Views\Appointments\Create.cshtml" />
|
<Content Include="Views\Appointments\Create.cshtml" />
|
||||||
|
<Content Include="Views\Appointments\CreateByDoctor.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Views\Default\" />
|
<Folder Include="Views\Default\" />
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<WebStackScaffolding_LayoutPageFile>~/Views/Shared/_Layout.cshtml</WebStackScaffolding_LayoutPageFile>
|
<WebStackScaffolding_LayoutPageFile>~/Views/Shared/_Layout.cshtml</WebStackScaffolding_LayoutPageFile>
|
||||||
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
|
<WebStackScaffolding_IsLayoutPageSelected>True</WebStackScaffolding_IsLayoutPageSelected>
|
||||||
<WebStackScaffolding_IsPartialViewSelected>False</WebStackScaffolding_IsPartialViewSelected>
|
<WebStackScaffolding_IsPartialViewSelected>False</WebStackScaffolding_IsPartialViewSelected>
|
||||||
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>True</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
|
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>False</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
|
||||||
<WebStackScaffolding_DbContextTypeFullName>FIT5032_Assignment.Models.Database1Entities</WebStackScaffolding_DbContextTypeFullName>
|
<WebStackScaffolding_DbContextTypeFullName>FIT5032_Assignment.Models.Database1Entities</WebStackScaffolding_DbContextTypeFullName>
|
||||||
<WebStackScaffolding_IsViewGenerationSelected>False</WebStackScaffolding_IsViewGenerationSelected>
|
<WebStackScaffolding_IsViewGenerationSelected>False</WebStackScaffolding_IsViewGenerationSelected>
|
||||||
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
|
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
|
||||||
|
|
7263
FIT5032-Assignment/Scripts/bootstrap.js
vendored
7263
FIT5032-Assignment/Scripts/bootstrap.js
vendored
File diff suppressed because it is too large
Load Diff
11
FIT5032-Assignment/Scripts/bootstrap.min.js
vendored
11
FIT5032-Assignment/Scripts/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
9792
FIT5032-Assignment/Scripts/moment-with-locales.js
Normal file
9792
FIT5032-Assignment/Scripts/moment-with-locales.js
Normal file
File diff suppressed because it is too large
Load Diff
10
FIT5032-Assignment/Scripts/moment-with-locales.min.js
vendored
Normal file
10
FIT5032-Assignment/Scripts/moment-with-locales.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3043
FIT5032-Assignment/Scripts/moment.js
Normal file
3043
FIT5032-Assignment/Scripts/moment.js
Normal file
File diff suppressed because it is too large
Load Diff
7
FIT5032-Assignment/Scripts/moment.min.js
vendored
Normal file
7
FIT5032-Assignment/Scripts/moment.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,40 +1,65 @@
|
||||||
@model FIT5032_Assignment.Models.Appointments
|
@model FIT5032_Assignment.Models.Appointments
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewBag.Title = "Create";
|
ViewBag.Title = "Book an appointment";
|
||||||
Layout = "~/Views/Shared/_Layout.cshtml";
|
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h2>Create</h2>
|
<h2>Book an appointment</h2>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
@using (Html.BeginForm()) {
|
@if (ViewBag.doctorId == null) {
|
||||||
@Html.AntiForgeryToken()
|
<h3>Which doctor do you prefer?</h3>
|
||||||
|
<!-- List doctors -->
|
||||||
<div class="form-horizontal">
|
<!-- ViewBag.doctorsList-->
|
||||||
<h4>Appointments</h4>
|
<!-- List all doctors into grid view -->
|
||||||
<hr />
|
foreach (var doctor in ViewBag.doctorsList) {
|
||||||
<!-- Dropdown menu for select a doctor -->
|
<div class="col-md-3 card">
|
||||||
|
<a href='@Url.Action("Create", "Appointments", new {id = doctor.Item1.uuid})' style="color: black; text-decoration: none;">
|
||||||
|
<div class="card-body">
|
||||||
|
<img src="@doctor.Item1.avatar" style="width: 50px;" />
|
||||||
|
<h5 class="card-title" style="margin-top: 10px;">@doctor.Item1.displayName</h5>
|
||||||
|
<p class="card-text">
|
||||||
|
@if (doctor.Item2.bio != "") {@doctor.Item2.bio } else { <i>No bio yet.</i>}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@Html.ActionLink("Cancel", "Index")
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
<h3>Book an appointment with @ViewBag.doctorUser.displayName</h3>
|
||||||
|
<form>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@Html.LabelFor(model => model.responsibleBy, "Select a doctor", htmlAttributes: new { @class = "control-label col-md-2" })
|
<label for="datepicker">Select the appointment date</label>
|
||||||
<div class="col-md-10">
|
<div class='input-group'>
|
||||||
@Html.DropDownList("user.displayName", @ViewBag.doctorsList as SelectList, htmlAttributes: new { @class = "form-control" })
|
<input data-provide="datepicker" id="datepicker" class="form-control" />
|
||||||
@Html.ValidationMessageFor(model => model.responsibleBy, "", new { @class = "text-danger" })
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-2 col-md-10">
|
|
||||||
<input type="submit" value="Create" class="btn btn-default" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
|
</form>
|
||||||
|
<div>
|
||||||
|
@Html.ActionLink("Choose another doctor", "Create", "Appointments", new { id = "" }, null)
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div>
|
|
||||||
@Html.ActionLink("Back to List", "Index")
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@section Scripts {
|
@section Scripts {
|
||||||
@Scripts.Render("~/bundles/jqueryval")
|
@Scripts.Render("~/bundles/jqueryval")
|
||||||
}
|
@Scripts.Render("https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.10.0/js/bootstrap-datepicker.min.js")
|
||||||
|
@Styles.Render("https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.10.0/css/bootstrap-datepicker.standalone.min.css")
|
||||||
|
<script type="text/javascript">
|
||||||
|
$("#datepicker").val(() => {
|
||||||
|
// Return dd/mm/yyyy
|
||||||
|
let date = new Date()
|
||||||
|
return date.getDate() + "/" + (date.getMonth() + 1) + "/" + date.getFullYear();
|
||||||
|
}).datepicker({
|
||||||
|
format: "dd/mm/yyyy",
|
||||||
|
startDate: new Date(),
|
||||||
|
autoclose: true,
|
||||||
|
todayHighlight: true
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
}
|
|
@ -3,6 +3,7 @@
|
||||||
<package id="Antlr" version="3.5.0.2" targetFramework="net48" />
|
<package id="Antlr" version="3.5.0.2" targetFramework="net48" />
|
||||||
<package id="BCrypt.Net-Next" version="4.0.3" targetFramework="net48" />
|
<package id="BCrypt.Net-Next" version="4.0.3" targetFramework="net48" />
|
||||||
<package id="bootstrap" version="5.2.3" targetFramework="net48" />
|
<package id="bootstrap" version="5.2.3" targetFramework="net48" />
|
||||||
|
<package id="bootstrap.less" version="3.4.1" targetFramework="net48" />
|
||||||
<package id="BouncyCastle" version="1.8.9" targetFramework="net48" />
|
<package id="BouncyCastle" version="1.8.9" targetFramework="net48" />
|
||||||
<package id="EntityFramework" version="6.4.4" targetFramework="net48" />
|
<package id="EntityFramework" version="6.4.4" targetFramework="net48" />
|
||||||
<package id="jQuery" version="3.4.1" targetFramework="net48" />
|
<package id="jQuery" version="3.4.1" targetFramework="net48" />
|
||||||
|
@ -21,6 +22,7 @@
|
||||||
<package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.11" targetFramework="net48" />
|
<package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.2.11" targetFramework="net48" />
|
||||||
<package id="Microsoft.Web.Infrastructure" version="2.0.1" targetFramework="net48" />
|
<package id="Microsoft.Web.Infrastructure" version="2.0.1" targetFramework="net48" />
|
||||||
<package id="Modernizr" version="2.8.3" targetFramework="net48" />
|
<package id="Modernizr" version="2.8.3" targetFramework="net48" />
|
||||||
|
<package id="Moment.js" version="2.9.0" targetFramework="net48" />
|
||||||
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net48" />
|
<package id="Newtonsoft.Json" version="13.0.2" targetFramework="net48" />
|
||||||
<package id="RestSharp" version="110.2.0" targetFramework="net48" />
|
<package id="RestSharp" version="110.2.0" targetFramework="net48" />
|
||||||
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
|
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user