Skip to content

Commit

Permalink
Add more group infos
Browse files Browse the repository at this point in the history
  • Loading branch information
strifel committed Jun 29, 2024
1 parent fdf145d commit 8fb26ff
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
18 changes: 17 additions & 1 deletion Components/Pages/GroupOverview.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
@if (Group != null)
{
<h1>Group Overview: @Group?.GroupName</h1>

<p>@Group?.Description</p>

<table class="table">
<thead>
Expand All @@ -24,6 +26,9 @@
<th>
Price
</th>
<th>
Actions
</th>
</tr>
</thead>
<tbody>
Expand All @@ -37,7 +42,13 @@
@order.Food
</td>
<td>
@(order.Price / 100).@(System.String.Format("{0:D2}", order.Price % 100))
@getPrice(order)
</td>
<td>
@if (Group.PaypalUsername != null)
{
<a style="text-decoration: none" target="_blank" href="https://www.paypal.com/paypalme/@Group.PaypalUsername/@getPrice(order)">💳</a>
}
</td>
</tr>
}
Expand Down Expand Up @@ -90,5 +101,10 @@

Loading = false;
}

private String getPrice(Order order)
{
return (order.Price / 100) + "." + System.String.Format("{0:D2}", order.Price % 100);
}

}
28 changes: 17 additions & 11 deletions Components/Pages/Home.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,28 @@
@inject NavigationManager NavigationManager


<PageTitle>Mamp.Link</PageTitle>
<PageTitle>Mampf.Link</PageTitle>

Welcome to Mamp.Link!<br/>
Welcome to Mampf.Link!<br/>
Create a new Group here or use an link to join an existing one.<br/><br/>


<form method="post" @onsubmit="Submit" @formname="group-create-form">
<AntiforgeryToken />
<div>
<label>
Name:
<InputText @bind-Value="Model!.GroupName" />
</label>
<AntiforgeryToken/>
<div class="form-group">
<label>Name:</label>
<InputText class="form-control" required @bind-Value="Model!.GroupName"/>
</div>
<div class="form-group">
<label>Description (optional):</label>
<InputTextArea class="form-control" @bind-Value="Model!.Description"/>
</div>
<div class="form-group">
<label>Your Paypal Username (optional):</label>
<InputText class="form-control" @bind-Value="Model!.PaypalUsername"/>
</div><br/>
<div>
<button type="submit">Submit</button>
<button class="btn btn-primary" type="submit">Submit</button>
</div>
</form>

Expand All @@ -38,8 +44,8 @@ Create a new Group here or use an link to join an existing one.<br/><br/>
Model!.GroupSlug = RandomNumberGenerator.GetHexString(10);
context.Add(Model);
context.SaveChanges();

NavigationManager.NavigateTo($"/group/{Model!.GroupSlug}?admin={Model!.AdminCode}");
}

}
}

0 comments on commit 8fb26ff

Please sign in to comment.