This commit is contained in:
mmrbnjd
2024-04-16 16:44:37 +03:30
parent 2d2f7ea3b2
commit 7cc8b3efde

View File

@@ -29,6 +29,8 @@
</div>
</div>
<div class="col-xl-7 col-lg-6">
<Toasts class="p-3" Messages="messages" AutoHide="true" Delay="6000" Placement="ToastsPlacement.TopRight" />
<div class="contact-form-right-warp">
<div class="postbox__comment-form">
<EditForm EditContext="editContext" OnValidSubmit="newTicket">
@@ -81,12 +83,7 @@
</div>
<Modal @ref="_modal"
title="Modal title"
OnShowing="OnModalShowing"
OnShown="OnModalShown"
OnHiding="OnModalHiding"
OnHidden="OnModalHidden"
OnHidePrevented="OnModalHidePrevented">
title="Modal title">
<BodyTemplate>
Modal body text goes here.
@@ -94,15 +91,15 @@
<FooterTemplate>
<Button Color="ButtonColor.Secondary" @onclick="OnHideModalClick">Close</Button>
<Button Color="ButtonColor.Primary">Save changes</Button>
<Button Color="ButtonColor.Primary" @onclick="testhand">Save changes</Button>
</FooterTemplate>
</Modal>
@code {
List<ToastMessage> messages = new List<ToastMessage>();
private Modal _modal = default!;
[Inject] ToastService ToastService { get; set; } = default!;
//-------------------------------
string type = "NewTicketNoAuthentication";
private EditContext? editContext;
@@ -140,38 +137,28 @@
}
}
private async Task testhand()
{
ShowMessage(ToastType.Warning);
}
private async Task OnShowModalClick()
{
await _modal.ShowAsync();
}
private async Task OnHideModalClick()
{
await _modal.HideAsync();
}
private void OnModalShowing()
{
ToastService.Notify(new(ToastType.Primary, $"Event: Showing called. DateTime: {DateTime.Now}"));
}
private void ShowMessage(ToastType toastType) => messages.Add(CreateToastMessage(toastType));
private void OnModalShown()
{
ToastService.Notify(new(ToastType.Success, $"Event: Show called. DateTime: {DateTime.Now}"));
}
private ToastMessage CreateToastMessage(ToastType toastType)
=> new ToastMessage
{
Type = toastType,
Title = "Blazor Bootstrap",
HelpText = $"{DateTime.Now}",
Message = $"Hello, world! This is a toast message. DateTime: {DateTime.Now}",
};
private void OnModalHiding()
{
ToastService.Notify(new(ToastType.Danger, $"Event: Hiding called. DateTime: {DateTime.Now}"));
}
private void OnModalHidden()
{
ToastService.Notify(new(ToastType.Warning, $"Event: Hide called. DateTime: {DateTime.Now}"));
}
private void OnModalHidePrevented()
{
ToastService.Notify(new(ToastType.Info, $"Event: Hide Prevented called. DateTime: {DateTime.Now}"));
}
}