minor edits

This commit is contained in:
Dimitar Byalkov
2023-06-09 05:39:06 +02:00
parent d81450ed21
commit f90e73d544
9 changed files with 88 additions and 30 deletions

View File

@@ -19,12 +19,12 @@
<input type="hidden" name="handler" value="filter" /> <input type="hidden" name="handler" value="filter" />
<input type="text" name="s" /> <input type="text" name="s" />
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<label class="form-check-label" for="asc">Sort by ascending order</label> <label class="form-check-label" for="true">Sort by ascending order</label>
<input class="form-check-input" type="radio" name="asc" value="true" /> <input class="form-check-input" type="radio" name="asc" value="true" />
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<label class="form-check-label" for="des">Sort by descending order</label> <label class="form-check-label" for="false">Sort by descending order</label>
<input class="form-check-input" type="radio" name="des" value="true" /> <input class="form-check-input" type="radio" name="asc" value="false" />
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<label class="form-check-label" for="imp">Only important</label> <label class="form-check-label" for="imp">Only important</label>

View File

@@ -34,7 +34,7 @@ namespace WebApp.Pages
ViewData.Add("count", c); ViewData.Add("count", c);
ViewData.Add("allCount", AnnouncementManager.GetAllAnnouncements().Count); ViewData.Add("allCount", AnnouncementManager.GetAllAnnouncements().Count);
} }
public void OnGetFilter(string s, bool asc, bool des, bool imp) // search, ascending, descending order, isImportant public void OnGetFilter(string s, bool asc, bool imp) // search, ascending/descending order, isImportant
{ {
AnnouncementManager = new AnnouncementManager(_announcementRepository); AnnouncementManager = new AnnouncementManager(_announcementRepository);
List<Announcement> announcements = new List<Announcement>(); List<Announcement> announcements = new List<Announcement>();
@@ -46,15 +46,17 @@ namespace WebApp.Pages
{ {
announcements = AnnouncementManager.GetAllAnnouncements(); announcements = AnnouncementManager.GetAllAnnouncements();
} }
if (imp) if (imp)
{ {
announcements = announcements.Where(x => x.IsImportant).ToList(); announcements = announcements.Where(x => x.IsImportant).ToList();
} }
if (asc) if (asc)
{ {
announcements = announcements.OrderBy(x => x.PublishDate).ToList(); announcements = announcements.OrderBy(x => x.PublishDate).ToList();
} }
else if (des) else
{ {
announcements = announcements.OrderByDescending(x => x.PublishDate).ToList(); announcements = announcements.OrderByDescending(x => x.PublishDate).ToList();
} }

View File

@@ -0,0 +1,13 @@
@page
@model WebApp.Pages.Error.UnexpectedModel
@{
ViewData["Title"] = "Unexpected error";
}
<div class="text-center">
<h1 class="display-4">Uh oh! An unexpected error has occured.</h1>
<img src="https://images.pexels.com/photos/96938/pexels-photo-96938.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1" />
<p>
Contact your system admistrator if this cat appears too often on your screen.
</p>
</div>
<p>Photo: <a href="https://pexels.com">pexels.com</a></p>

View File

@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace WebApp.Pages.Error
{
public class UnexpectedModel : PageModel
{
public void OnGet()
{
}
}
}

View File

@@ -7,7 +7,7 @@
<div class="bg-image text-white shadow-1-strong p-5 text-center bg-body-tertiary rounded-3" style="background: url(https://images.pexels.com/photos/1036804/pexels-photo-1036804.jpeg?h=800) no-repeat center center; background-size: 100%;"> <div class="bg-image text-white shadow-1-strong p-5 text-center bg-body-tertiary rounded-3" style="background: url(https://images.pexels.com/photos/1036804/pexels-photo-1036804.jpeg?h=800) no-repeat center center; background-size: 100%;">
<h1 class="text-body-emphasis">Student House Dashboard</h1> <h1 class="text-body-emphasis">Student House Dashboard</h1>
<p class="lead"> <p class="lead">
The student square for housemates! This site is currently under construction. Welcome to the student square for housemates!
</p> </p>
@if (!User.Identity.IsAuthenticated) @if (!User.Identity.IsAuthenticated)
{ {
@@ -16,6 +16,14 @@
else else
{ {
<a class="btn btn-primary" asp-page="Announcements">Announcements</a> <a class="btn btn-primary" asp-page="Announcements">Announcements</a>
<a class="btn btn-primary" asp-page="Complaints">Complaints</a>
} }
</div> </div>
<a>Image: pexels.com</a>
<a>Image: pexels.com</a>
<div class="card mt-3 text-center">
<h3>Newest update</h3>
<p>Now you can search for announcements on a specific date using the search bar and the keyword "date:"</p>
<p>Example: <b>date:2023-05-13</b></p>
</div>

View File

@@ -24,6 +24,9 @@ namespace WinForms
this.currentUser = currentUser; this.currentUser = currentUser;
dtpPublishDate.Enabled = false; dtpPublishDate.Enabled = false;
tbTitle.Enabled = false;
tbDescription.Enabled = false;
foreach (var item in Enum.GetValues(typeof(ComplaintStatus))) foreach (var item in Enum.GetValues(typeof(ComplaintStatus)))
{ {
cbStatus.Items.Add(item); cbStatus.Items.Add(item);
@@ -32,11 +35,10 @@ namespace WinForms
{ {
cbSeverity.Items.Add(item); cbSeverity.Items.Add(item);
} }
if (readOnly) if (readOnly)
{ {
btnSave.Enabled = false; btnSave.Enabled = false;
tbTitle.Enabled = false;
tbDescription.Enabled = false;
cbStatus.Enabled = false; cbStatus.Enabled = false;
cbSeverity.Enabled = false; cbSeverity.Enabled = false;
} }

View File

@@ -45,12 +45,13 @@
btnEditAnnouncement = new Button(); btnEditAnnouncement = new Button();
lbAnnouncements = new ListBox(); lbAnnouncements = new ListBox();
tpComplaints = new TabPage(); tpComplaints = new TabPage();
tpEvents = new TabPage();
lbComplaints = new ListBox();
panelComplaintFunctions = new Panel(); panelComplaintFunctions = new Panel();
btnArchiveComplaint = new Button(); btnArchiveComplaint = new Button();
btnViewComplaint = new Button(); btnViewComplaint = new Button();
btnEditComplaint = new Button(); btnEditComplaint = new Button();
lbComplaints = new ListBox();
tpEvents = new TabPage();
btnLogout = new Button();
tabControl1.SuspendLayout(); tabControl1.SuspendLayout();
tpUsers.SuspendLayout(); tpUsers.SuspendLayout();
panelUserFunctions.SuspendLayout(); panelUserFunctions.SuspendLayout();
@@ -243,25 +244,6 @@
tpComplaints.Text = "Complaints"; tpComplaints.Text = "Complaints";
tpComplaints.UseVisualStyleBackColor = true; tpComplaints.UseVisualStyleBackColor = true;
// //
// tpEvents
//
tpEvents.Location = new Point(4, 24);
tpEvents.Name = "tpEvents";
tpEvents.Size = new Size(723, 340);
tpEvents.TabIndex = 3;
tpEvents.Text = "Events";
tpEvents.UseVisualStyleBackColor = true;
//
// lbComplaints
//
lbComplaints.Dock = DockStyle.Top;
lbComplaints.FormattingEnabled = true;
lbComplaints.ItemHeight = 15;
lbComplaints.Location = new Point(0, 0);
lbComplaints.Name = "lbComplaints";
lbComplaints.Size = new Size(723, 289);
lbComplaints.TabIndex = 0;
//
// panelComplaintFunctions // panelComplaintFunctions
// //
panelComplaintFunctions.Controls.Add(btnArchiveComplaint); panelComplaintFunctions.Controls.Add(btnArchiveComplaint);
@@ -303,11 +285,41 @@
btnEditComplaint.UseVisualStyleBackColor = true; btnEditComplaint.UseVisualStyleBackColor = true;
btnEditComplaint.Click += btnEditComplaint_Click; btnEditComplaint.Click += btnEditComplaint_Click;
// //
// lbComplaints
//
lbComplaints.Dock = DockStyle.Top;
lbComplaints.FormattingEnabled = true;
lbComplaints.ItemHeight = 15;
lbComplaints.Location = new Point(0, 0);
lbComplaints.Name = "lbComplaints";
lbComplaints.Size = new Size(723, 289);
lbComplaints.TabIndex = 0;
//
// tpEvents
//
tpEvents.Location = new Point(4, 24);
tpEvents.Name = "tpEvents";
tpEvents.Size = new Size(723, 340);
tpEvents.TabIndex = 3;
tpEvents.Text = "Events";
tpEvents.UseVisualStyleBackColor = true;
//
// btnLogout
//
btnLogout.Location = new Point(651, 0);
btnLogout.Name = "btnLogout";
btnLogout.Size = new Size(75, 23);
btnLogout.TabIndex = 7;
btnLogout.Text = "Log out";
btnLogout.UseVisualStyleBackColor = true;
btnLogout.Click += btnLogout_Click;
//
// Dashboard // Dashboard
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(731, 368); ClientSize = new Size(731, 368);
Controls.Add(btnLogout);
Controls.Add(lblUserStatus); Controls.Add(lblUserStatus);
Controls.Add(tabControl1); Controls.Add(tabControl1);
Name = "Dashboard"; Name = "Dashboard";
@@ -349,5 +361,6 @@
private Button btnArchiveComplaint; private Button btnArchiveComplaint;
private Button btnViewComplaint; private Button btnViewComplaint;
private Button btnEditComplaint; private Button btnEditComplaint;
private Button btnLogout;
} }
} }

View File

@@ -236,5 +236,13 @@ namespace WinForms
RefreshLists(); RefreshLists();
} }
} }
private void btnLogout_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Do you want to log out?", "Log out", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Close();
}
}
} }
} }

Binary file not shown.