To/From Fields enabled/disabled, reply message fix

This commit is contained in:
Cody 2020-06-04 21:20:48 -07:00 committed by GitHub
parent 41348b285d
commit 7b9cd39cb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,15 +1,9 @@
@namespace Oqtane.Modules.Admin.UserProfile @if (PageState.User != null)
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IUserService UserService
@inject INotificationService NotificationService
@if (PageState.User != null)
{ {
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<td> <td>
<label class="control-label">@title: </label> <label class="control-label">@title: </label>
</td> </td>
<td> <td>
<input class="form-control" @bind="@username" /> <input class="form-control" @bind="@username" />
@ -17,47 +11,85 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<label class="control-label">Subject: </label> <label class="control-label">Subject: </label>
</td> </td>
<td> <td>
<input class="form-control" @bind="@subject" /> <input class="form-control" @bind="@subject" />
</td> </td>
</tr> </tr>
@if (title == "From")
{
<td>
<input class="form-control" @bind="@subject" readonly />
</td>
}
@if (title == "To")
{
<td>
<input class="form-control" @bind="@subject" />
</td>
</tr>}
@if (title == "From") @if (title == "From")
{ {
<tr> <tr>
<td> <td>
<label class="control-label">Date: </label> <label class="control-label">Date: </label>
</td> </td>
<td> <td>
<input class="form-control" @bind="@createdon" /> <input class="form-control" @bind="@createdon" readonly />
</td>
</tr>
}
@if (title == "From")
{
<tr>
<td>
<label class="control-label">Message: </label>
</td>
<td>
<textarea class="form-control" @bind="@body" rows="5" readonly />
</td>
</tr>
}
@if (title == "To")
{
<tr>
<td>
<label class="control-label">Message: </label>
</td>
<td>
<textarea class="form-control" @bind="@body" rows="5" />
</td> </td>
</tr> </tr>
} }
<tr>
<td>
<label class="control-label">Message: </label>
</td>
<td>
<textarea class="form-control" @bind="@body" rows="5" />
</td>
</tr>
</table> </table>
@if (reply != string.Empty) @if (reply != string.Empty)
{ {
<button type="button" class="btn btn-primary" @onclick="Send">Send</button> <button type="button" class="btn btn-primary" @onclick="Send">Send</button> }
}
else else
{ {
if (title == "From") if (title == "From")
{ {
<button type="button" class="btn btn-primary" @onclick="Reply">Reply</button> <button type="button" class="btn btn-primary" @onclick="Reply">Reply</button>}
}
} }
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink> <NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<br /> <br />
<br /> <br />
<p>@reply</p> @if (title == "To")
{
<table class="table table-borderless">
<tr>
<td>
<label class="control-label">Original Message: </label>
</td>
<td>
<textarea class="form-control" @bind="@reply" rows="5" readonly />
</td>
</tr>
</table>
}
} }
@code { @code {
@ -124,8 +156,12 @@
private void Reply() private void Reply()
{ {
title = "To"; title = "To";
subject = "RE: " + subject; if (!subject.Contains("RE:"))
{
subject = "RE: " + subject;
}
reply = body; reply = body;
body = "\n\n--------------------------------------------\nSent: " + createdon + "\nSubject: " + subject + "\n\n" + body;
StateHasChanged(); StateHasChanged();
} }