165 lines
6.6 KiB
Plaintext
165 lines
6.6 KiB
Plaintext
@using Front.Pages
|
|
@using Shared.DTOs
|
|
@inject HttpClient _hc
|
|
@inject NavigationManager nav
|
|
<div class="contact-info-area pb-90" id="contact">
|
|
<div class="container">
|
|
<div class="row">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="contact-form-area pb-120">
|
|
<div class="container">
|
|
<div class="row gx-0">
|
|
<div class="col-xl-5 col-lg-6">
|
|
<div class="contact-form-left">
|
|
<div class="contact-form-section-box pb-80">
|
|
<h5 class="inner-section-subtitle">ارتباط با ما</h5>
|
|
<h4 class="tp-section-title pb-10">
|
|
ما مشتاقانه منتظر <br> نظرات شما هستیم
|
|
|
|
</h4>
|
|
</div>
|
|
<div class="contact-form-social-box p-relative">
|
|
|
|
<div class="contact-form-section-img">
|
|
<img src="img/contact/contact-icon-sm-4.png" alt="">
|
|
</div>
|
|
</div>
|
|
</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">
|
|
<DataAnnotationsValidator />
|
|
<div class="postbox__comment-input mb-35">
|
|
<ValidationMessage For="()=>model.FullName" />
|
|
<ValidationMessage For="()=>model.Mobile" />
|
|
<ValidationMessage For="()=>model.Title" />
|
|
<ValidationMessage For="()=>model.Text" />
|
|
</div>
|
|
<div class="row gx-20">
|
|
<div class="col-12">
|
|
<div class="postbox__comment-input mb-30">
|
|
<InputText @bind-Value="model.FullName" id="FullName" type="text" class="inputText" required="" />
|
|
<span class="floating-label">نام شما</span>
|
|
</div>
|
|
</div>
|
|
<div class="col-12">
|
|
<div class="postbox__comment-input mb-35">
|
|
<InputText @bind-Value="model.Mobile" id="Mobile" type="text" class="inputText" required=""/>
|
|
<span class="floating-label">موبایل</span>
|
|
</div>
|
|
</div>
|
|
<div class="col-12">
|
|
<div class="postbox__comment-input mb-35">
|
|
<InputText @bind-Value="model.Title" id="Title" type="text" class="inputText" required=""/>
|
|
<span class="floating-label">عنوان</span>
|
|
</div>
|
|
</div>
|
|
<div class="col-xxl-12">
|
|
<div class="postbox__comment-input mb-30">
|
|
<InputText @bind-Value="model.Text" id="Text" class="textareaText" required=""></InputText>
|
|
<span class="floating-label-2">پیام شما ...</span>
|
|
</div>
|
|
</div>
|
|
<div class="col-xxl-12">
|
|
<div class="postbox__btn-box">
|
|
<button type="submit" class="submit-btn w-100">ارسال پیام</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</EditForm>
|
|
<Button Color="ButtonColor.Primary" @onclick="OnShowModalClick">Show Modal</Button>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<Modal @ref="_modal"
|
|
title="Modal title">
|
|
|
|
<BodyTemplate>
|
|
Modal body text goes here.
|
|
</BodyTemplate>
|
|
|
|
<FooterTemplate>
|
|
<Button Color="ButtonColor.Secondary" @onclick="OnHideModalClick">Close</Button>
|
|
<Button Color="ButtonColor.Primary" @onclick="testhand">Save changes</Button>
|
|
</FooterTemplate>
|
|
|
|
</Modal>
|
|
|
|
@code {
|
|
List<ToastMessage> messages = new List<ToastMessage>();
|
|
|
|
private Modal _modal = default!;
|
|
//-------------------------------
|
|
string type = "NewTicketNoAuthentication";
|
|
private EditContext? editContext;
|
|
[SupplyParameterFromForm]
|
|
private CTicketNoAuthenticationDto? model { get; set; } = new CTicketNoAuthenticationDto();
|
|
|
|
private ValidationMessageStore? messageStore;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
// modelTaxTools ??= new();
|
|
// editContext = new(modelTaxTools);
|
|
// editContext.OnValidationRequested += HandleValidationRequested;
|
|
// messageStore = new(editContext);
|
|
|
|
editContext = new EditContext(model);
|
|
messageStore = new(editContext);
|
|
}
|
|
}
|
|
@functions{
|
|
private async Task newTicket(){
|
|
|
|
var request = await _hc.PostAsJsonAsync("Ticket/NewTicketNoAuthentication", model);
|
|
if (request.IsSuccessStatusCode)
|
|
{
|
|
messageStore?.Clear();
|
|
var res = await request.Content.ReadFromJsonAsync<int>();
|
|
OnShowModalClick();
|
|
// nav.NavigateTo($"Verification/{res}");
|
|
}
|
|
else
|
|
{
|
|
var error = await request.Content.ReadFromJsonAsync<List<string>>();
|
|
messageStore?.Add(() => model.Mobile, error);
|
|
|
|
}
|
|
}
|
|
private async Task testhand()
|
|
{
|
|
ShowMessage(ToastType.Warning);
|
|
}
|
|
private async Task OnShowModalClick()
|
|
{
|
|
await _modal.ShowAsync();
|
|
}
|
|
private async Task OnHideModalClick()
|
|
{
|
|
await _modal.HideAsync();
|
|
}
|
|
|
|
private void ShowMessage(ToastType toastType) => messages.Add(CreateToastMessage(toastType));
|
|
|
|
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}",
|
|
};
|
|
|
|
}
|