first commit

This commit is contained in:
2026-03-22 00:29:34 +01:00
commit c16b4e3933
1729 changed files with 162013 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
<div class="col">
<div class="card rounded-3 employee-card">
<div class="card-header py-3">
<h4>@Employee.FirstName @Employee.LastName</h4>
</div>
<div class="card=body employee-card text-center">
<div class="mb-3">
<img src="@Employee.ImageName" class="employee-img" />
</div>
<div class="container">
<div class="row justify-content-center">
<button class="btn btn-primary btn-sm mb-1 col-auto" @onclick="@(async () => await EmployeeQuickViewClicked.InvokeAsync(Employee))">Quick View</button>
<a class="btn btn-secondary btn-sm mb-1 ms-1 col-auto" href="@($"/employeedetail/{Employee.EmployeeId}")">Details</a>
<a class="btn btn-secondary btn-sm mb-1 ms-1 col-auto" href="@($"/employeeedit/{Employee.EmployeeId}")">Edit</a>
</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1,21 @@
using BethanysPieShopHRM.Shared.Domain;
using Microsoft.AspNetCore.Components;
namespace Webshop.App.Components
{
public partial class EmployeeCard
{
[Parameter]
public Employee Employee { get; set; } = default! ;
[Parameter]
public EventCallback<Employee> EmployeeQuickViewClicked { get; set; }
protected override void OnInitialized()
{
if (string.IsNullOrEmpty(Employee.LastName))
{
throw new Exception("Last Name can't be empty");
}
}
}
}
@@ -0,0 +1,2 @@
<h4>@MessageCount message(s)</h4>
@@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Components;
namespace Webshop.App.Components
{
public partial class InboxCounter
{
private int MessageCount;
[Inject]
public ApplicationState? ApplicationState { get; set; }
protected override void OnInitialized()
{
MessageCount = new Random().Next(10);
ApplicationState.NumberOfMessages = MessageCount;
}
}
}
@@ -0,0 +1,3 @@
<div class="profile-picture">
@ChildContent
</div>
@@ -0,0 +1,10 @@
using Microsoft.AspNetCore.Components;
namespace Webshop.App.Components
{
public partial class ProfilePicture
{
[Parameter]
public RenderFragment? ChildContent { get; set; }
}
}
@@ -0,0 +1,56 @@
@if (_employee != null)
{
<div class="modal fade show d-block" id="exampleModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="titleLabel">Employee Quick View</h5>
<button @onclick="Close" type="button" class="close btn btn-lg" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="col row">
<div class="col-12 col-sm-8">
<div class="form-group row">
<label class="col-sm-5 col-form-label">Employee ID</label>
<div class="col-sm-7">
<label type="text" class="form-control-plaintext">@_employee.EmployeeId</label>
</div>
</div>
<div class="form-group row">
<label class="col-sm-5 col-form-label">First name</label>
<div class="col-sm-7">
<label type="text" readonly class="form-control-plaintext">@_employee.FirstName</label>
</div>
</div>
<div class="form-group row">
<label class="col-sm-5 col-form-label">Last name</label>
<div class="col-sm-7">
<label type="text" readonly class="form-control-plaintext">@_employee.LastName</label>
</div>
</div>
<div class="form-group row">
<label class="col-sm-5 col-form-label">Birthdate</label>
<div class="col-sm-7">
<label type="text" readonly class="form-control-plaintext">@_employee.BirthDate.ToShortDateString()</label>
</div>
</div>
<div class="form-group row">
<label class="col-sm-5 col-form-label">Email</label>
<div class="col-sm-7">
<label type="text" readonly class="form-control-plaintext">@_employee.Email</label>
</div>
</div>
</div>
</div>
<button type="button" class="btn btn-outline-primary" @onclick="Close">Close</button>
</div>
</div>
</div>
</div>
}
@@ -0,0 +1,23 @@
using BethanysPieShopHRM.Shared.Domain;
using Microsoft.AspNetCore.Components;
namespace Webshop.App.Components
{
public partial class QuickViewPopup
{
[Parameter]
public Employee Employee { get; set; } = default!;
private Employee? _employee;
protected override void OnParametersSet()
{
base.OnParametersSet();
_employee = Employee;
}
public void Close()
{
_employee = null;
}
}
}
@@ -0,0 +1,7 @@
<h3>Employee Counter</h3>
<h3>There are currently @EmployeeCounter employees working at Bethany's Pie Shop!</h3>
<br />
<br />
@@ -0,0 +1,24 @@
using Microsoft.AspNetCore.Components;
using Webshop.App.Services;
namespace Webshop.App.Components.Widgets
{
public partial class EmployeeCountWidget
{
[Inject]
public IEmployeeDataService EmployeeDataService { get; set; } = default!;
public int EmployeeCounter { get; set; }
protected async override Task OnInitializedAsync()
{
EmployeeCounter = await RetrieveNumberOfEmployees();
}
public async Task<int> RetrieveNumberOfEmployees()
{
var employees = await EmployeeDataService.GetAllEmployees();
return employees.Count();
}
}
}
@@ -0,0 +1,13 @@
<h3>Inbox</h3>
@if (@MessageCount > 0)
{
<h4>You currently have @MessageCount questions from employees!</h4>
}
else
{
<h4>No questions from employees! All good!</h4>
}
<br />
<br />
@@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Components;
namespace Webshop.App.Components.Widgets
{
public partial class InboxWidget
{
[Inject]
public ApplicationState? ApplicationState { get; set; }
public int MessageCount { get; set; } = 0;
protected override void OnInitialized()
{
MessageCount = ApplicationState.NumberOfMessages;
}
}
}