Merge pull request #586 from thabaum/patch-13

To/From Fields enabled/disabled, reply message fix
This commit is contained in:
Shaun Walker
2020-06-12 09:40:16 -04:00
committed by GitHub

View File

@ -9,56 +9,94 @@
<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>
<input class="form-control" @bind="@username" />
</td> </td>
@if (title == "From")
{
<td>
<input class="form-control" @bind="@username" readonly />
</td>
}
@if (title == "To")
{
<td>
<input class="form-control" @bind="@username" />
</td>
}
</tr> </tr>
<tr> <tr>
<td> <td>
<label class="control-label">Subject: </label> <label class="control-label">Subject: </label>
</td>
<td>
<input class="form-control" @bind="@subject" />
</td> </td>
@if (title == "From")
{
<td>
<input class="form-control" @bind="@subject" readonly />
</td>
}
@if (title == "To")
{
<td>
<input class="form-control" @bind="@subject" />
</td>
}
</tr> </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> </td>
</tr> </tr>
} }
<tr> @if (title == "From")
<td> {
<label class="control-label">Message: </label> <tr>
</td> <td>
<td> <label class="control-label">Message: </label>
<textarea class="form-control" @bind="@body" rows="5" /> </td>
</td> <td>
</tr> <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>
</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")
} {
<div class="control-group">
<label class="control-label">Original Message </label>
<textarea class="form-control" @bind="@reply" rows="5" readonly />
</div>
}
}
@code { @code {
private int notificationid; private int notificationid;
@ -124,8 +162,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();
} }
@ -165,5 +207,5 @@
AddModuleMessage("Error Adding Notification", MessageType.Error); AddModuleMessage("Error Adding Notification", MessageType.Error);
} }
} }
} }