Skip to content

Commit

Permalink
Refined manager logged-in to display informative empty if no assigned…
Browse files Browse the repository at this point in the history
… buildings/apartment/appointments/events/messages.
  • Loading branch information
tuanh00 committed Dec 2, 2024
1 parent ff111cd commit 84fa61b
Show file tree
Hide file tree
Showing 16 changed files with 166 additions and 119 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified .vs/prjRentalManagement/v17/.suo
Binary file not shown.
12 changes: 11 additions & 1 deletion prjRentalManagement/Views/Apartment/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
@Html.ActionLink("Create New Apartment", "Create", null, new { @class = "btn btn-primary" })
</p>
}
@if (!Model.Any())
{
<div class="alert alert-info mt-3">
<strong>No assigned apartments found!</strong> There are currently no assigned apartments to display. Please check back later or refine your search.
</div>
}
else
{
<table class="table">
<tr>
<th>
Expand All @@ -51,7 +59,7 @@
<th>
@Html.DisplayNameFor(model => model.building.postalCode)
</th>
<th>Actions</th>
<th>Actions</th>
</tr>

@foreach (var item in Model)
Expand Down Expand Up @@ -98,3 +106,5 @@
</tr>
}
</table>
}

122 changes: 66 additions & 56 deletions prjRentalManagement/Views/Appointment/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,64 +11,74 @@
@Html.ActionLink("Create New", "Create", null, new { @class = "btn btn-primary" })
</p>
}

<table class="table">
<thead>
<tr>
<th>@Html.DisplayNameFor(model => model.appointmentDate)</th>
<th>@Html.DisplayNameFor(model => model.description)</th>
@if (Session["manager"] == null)
{
<th>@Html.DisplayNameFor(model => model.manager.name)</th>
}
@if (Session["tenant"] == null)
{
<th>@Html.DisplayNameFor(model => model.tenant.name)</th>
}
<th>Actions</th>
</tr>
</thead>
<tbody>
@if (Session["tenant"] != null)
{
// Show appointments for logged-in tenant
foreach (var item in Model.Where(i => i.tenantId == Convert.ToInt32(Session["tenant"])))
@if (!Model.Any())
{
<div class="alert alert-info mt-3">
<strong>No appointments found!</strong> There are no appointments to display at the moment.
</div>
}
else
{
<table class="table">
<thead>
<tr>
<th>@Html.DisplayNameFor(model => model.appointmentDate)</th>
<th>@Html.DisplayNameFor(model => model.description)</th>
@if (Session["manager"] == null)
{
<th>@Html.DisplayNameFor(model => model.manager.name)</th>
}
@if (Session["tenant"] == null)
{
<th>@Html.DisplayNameFor(model => model.tenant.name)</th>
}
<th>Actions</th>
</tr>
</thead>
<tbody>
@if (Session["tenant"] != null)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.appointmentDate)</td>
<td>@Html.DisplayFor(modelItem => item.description)</td>
@if (Session["manager"] == null)
{
<td>@Html.DisplayFor(modelItem => item.manager.name)</td>
}
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.appointmentId }, new { @class = "btn btn-warning btn-sm" }) |
@Html.ActionLink("Details", "Details", new { id = item.appointmentId }, new { @class = "btn btn-info btn-sm" }) |
@Html.ActionLink("Delete", "Delete", new { id = item.appointmentId }, new { @class = "btn btn-danger btn-sm" })
</td>
</tr>
// Show appointments for logged-in tenant
foreach (var item in Model.Where(i => i.tenantId == Convert.ToInt32(Session["tenant"])))
{
<tr>
<td>@Html.DisplayFor(modelItem => item.appointmentDate)</td>
<td>@Html.DisplayFor(modelItem => item.description)</td>
@if (Session["manager"] == null)
{
<td>@Html.DisplayFor(modelItem => item.manager.name)</td>
}
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.appointmentId }, new { @class = "btn btn-warning btn-sm" }) |
@Html.ActionLink("Details", "Details", new { id = item.appointmentId }, new { @class = "btn btn-info btn-sm" }) |
@Html.ActionLink("Delete", "Delete", new { id = item.appointmentId }, new { @class = "btn btn-danger btn-sm" })
</td>
</tr>
}
}
}
else if (Session["manager"] != null)
{
// Show appointments for logged-in manager
foreach (var item in Model.Where(i => i.managerId == Convert.ToInt32(Session["manager"])))
else if (Session["manager"] != null)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.appointmentDate)</td>
<td>@Html.DisplayFor(modelItem => item.description)</td>
// Show appointments for logged-in manager
foreach (var item in Model.Where(i => i.managerId == Convert.ToInt32(Session["manager"])))
{
<tr>
<td>@Html.DisplayFor(modelItem => item.appointmentDate)</td>
<td>@Html.DisplayFor(modelItem => item.description)</td>

@if (Session["tenant"] == null)
{
<td>@Html.DisplayFor(modelItem => item.tenant.name)</td>
}
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.appointmentId }, new { @class = "btn btn-warning btn-sm" }) |
@Html.ActionLink("Details", "Details", new { id = item.appointmentId }, new { @class = "btn btn-info btn-sm" }) |
@Html.ActionLink("Delete", "Delete", new { id = item.appointmentId }, new { @class = "btn btn-danger btn-sm" })
</td>
</tr>
@if (Session["tenant"] == null)
{
<td>@Html.DisplayFor(modelItem => item.tenant.name)</td>
}
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.appointmentId }, new { @class = "btn btn-warning btn-sm" }) |
@Html.ActionLink("Details", "Details", new { id = item.appointmentId }, new { @class = "btn btn-info btn-sm" }) |
@Html.ActionLink("Delete", "Delete", new { id = item.appointmentId }, new { @class = "btn btn-danger btn-sm" })
</td>
</tr>
}
}
}
</tbody>
</table>
</tbody>
</table>
}


129 changes: 69 additions & 60 deletions prjRentalManagement/Views/Building/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -24,66 +24,75 @@
@Html.ActionLink("Create New Building", "Create", null, new { @class = "btn btn-primary" })
</p>
}

<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.address)
</th>
<th>
@Html.DisplayNameFor(model => model.city)
</th>
<th>
@Html.DisplayNameFor(model => model.province)
</th>
<th>
@Html.DisplayNameFor(model => model.postalCode)
</th>
<th>
@Html.DisplayNameFor(model => model.manager.name)
</th>
<th>
@Html.DisplayNameFor(model => model.owner.name)
</th>
<th>Actions</th>
</tr>

@foreach (var item in Model)
{
@if (!Model.Any())
{
<div class="alert alert-info mt-3">
<strong>No assigned buildings found!</strong> There are currently no assigned buildings to display. Please check back later or refine your search.
</div>
}
else
{
<table class="table">
<tr>
<td>
@Html.DisplayFor(modelItem => item.address)
</td>
<td>
@Html.DisplayFor(modelItem => item.city)
</td>
<td>
@Html.DisplayFor(modelItem => item.province)
</td>
<td>
@Html.DisplayFor(modelItem => item.postalCode)
</td>
<td>
@Html.DisplayFor(modelItem => item.manager.name)
</td>
<td>
@Html.DisplayFor(modelItem => item.owner.name)
</td>
<td>
@if (Session["manager"] != null)
{
@Html.ActionLink("Edit", "Edit", new { id = item.buildingId }, new { @class = "btn btn-warning btn-sm" })
@: |
@Html.ActionLink("Details", "Details", new { id = item.buildingId }, new { @class = "btn btn-info btn-sm" })
@: |
@Html.ActionLink("Delete", "Delete", new { id = item.buildingId }, new { @class = "btn btn-danger btn-sm" })
}
else if (Session["owner"] != null)
{
@Html.ActionLink("Details", "Details", new { id = item.buildingId }, new { @class = "btn btn-info btn-sm" })
}
</td>
<th>
@Html.DisplayNameFor(model => model.address)
</th>
<th>
@Html.DisplayNameFor(model => model.city)
</th>
<th>
@Html.DisplayNameFor(model => model.province)
</th>
<th>
@Html.DisplayNameFor(model => model.postalCode)
</th>
<th>
@Html.DisplayNameFor(model => model.manager.name)
</th>
<th>
@Html.DisplayNameFor(model => model.owner.name)
</th>
<th>Actions</th>
</tr>
}

</table>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.address)
</td>
<td>
@Html.DisplayFor(modelItem => item.city)
</td>
<td>
@Html.DisplayFor(modelItem => item.province)
</td>
<td>
@Html.DisplayFor(modelItem => item.postalCode)
</td>
<td>
@Html.DisplayFor(modelItem => item.manager.name)
</td>
<td>
@Html.DisplayFor(modelItem => item.owner.name)
</td>
<td>
@if (Session["manager"] != null)
{
@Html.ActionLink("Edit", "Edit", new { id = item.buildingId }, new { @class = "btn btn-warning btn-sm" })
@: |
@Html.ActionLink("Details", "Details", new { id = item.buildingId }, new { @class = "btn btn-info btn-sm" })
@: |
@Html.ActionLink("Delete", "Delete", new { id = item.buildingId }, new { @class = "btn btn-danger btn-sm" })
}
else if (Session["owner"] != null)
{
@Html.ActionLink("Details", "Details", new { id = item.buildingId }, new { @class = "btn btn-info btn-sm" })
}
</td>
</tr>
}

</table>
}

11 changes: 10 additions & 1 deletion prjRentalManagement/Views/MessageManager/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@
@Html.ActionLink("Create New", "Create", null, new { @class = "btn btn-primary" })
</p>
}

@if (!Model.Any())
{
<div class="alert alert-info mt-3">
<strong>No messages found!</strong> There are no messages to display at the moment.
</div>
}
else
{
<table class="table">
<tr>
<th>@Html.DisplayNameFor(model => model.message)</th>
Expand Down Expand Up @@ -92,3 +99,5 @@
}
}
</table>
}

11 changes: 10 additions & 1 deletion prjRentalManagement/Views/MessageOwner/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@
@Html.ActionLink("Create New", "Create", null, new { @class = "btn btn-primary" })
</p>
}

@if (!Model.Any())
{
<div class="alert alert-info mt-3">
<strong>No messages found!</strong> There are no messages to display at the moment.
</div>
}
else
{
<table class="table">
<tr>
<th>@Html.DisplayNameFor(model => model.message)</th>
Expand Down Expand Up @@ -92,3 +99,5 @@
}
}
</table>
}

Binary file modified prjRentalManagement/bin/prjRentalManagement.dll
Binary file not shown.
Binary file modified prjRentalManagement/bin/prjRentalManagement.pdb
Binary file not shown.
Binary file modified prjRentalManagement/obj/Debug/prjRentalManagement.dll
Binary file not shown.
Binary file modified prjRentalManagement/obj/Debug/prjRentalManagement.pdb
Binary file not shown.

0 comments on commit 84fa61b

Please sign in to comment.