chat
This commit is contained in:
@@ -4,6 +4,27 @@
|
||||
@using Shared.DTOs.Serch
|
||||
@layout PanelLayout
|
||||
@inject HttpClientController hc;
|
||||
@inject UserAuthenticationDTO userinfo
|
||||
<Modal @ref="modal" title="تیکت جدید" IsVerticallyCentered="true">
|
||||
<BodyTemplate>
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<label for="exampleFormControlInput1">عنوان</label>
|
||||
<InputText @bind-Value="newTitle" type="text" class="form-control" />
|
||||
</div>
|
||||
<br />
|
||||
<div class="form-group">
|
||||
<label for="exampleFormControlTextarea1">توضیحات بیشتر</label>
|
||||
<InputTextArea @bind-Value="newtext" class="form-control" rows="3" />
|
||||
</div>
|
||||
</form>
|
||||
</BodyTemplate>
|
||||
<FooterTemplate>
|
||||
<Button Color="ButtonColor.Secondary" @onclick="OnHideModalClick">Close</Button>
|
||||
<Button Color="ButtonColor.Primary" @onclick="OnClickNewTicket">ثبت</Button>
|
||||
</FooterTemplate>
|
||||
</Modal>
|
||||
|
||||
<div class="container-xxl flex-grow-1 container-p-y">
|
||||
<h4 class="fw-bold py-3 mb-4">
|
||||
<span class="text-muted fw-light">متفرقه /</span> پشتیبانی
|
||||
@@ -25,7 +46,7 @@
|
||||
<ul class="list-group fa-padding" style="border: 2px solid #0d6efd">
|
||||
<li class="list-group-item" data-toggle="modal" data-target="#issue">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-2">
|
||||
<div class="col-md-2">
|
||||
<InputText @bind-Value="TicketID" placeholder="شناسه" style="text-align:center;" class="form-control" type="text" id="EconomicCode" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
@@ -33,24 +54,24 @@
|
||||
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
|
||||
<button type="submit" onclick="@Submit" class="btn btn-primary">جستجو</button>
|
||||
|
||||
<button type="submit" @onclick="Submit" class="btn btn-primary">جستجو</button>
|
||||
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
|
||||
<button type="submit" onclick="@Submit" class="btn btn-primary">جدید</button>
|
||||
<button type="submit" @onclick="OnShowModalClick" class="btn btn-primary">جدید</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<ul class="list-group fa-padding">
|
||||
@@ -90,16 +111,20 @@
|
||||
|
||||
|
||||
@code {
|
||||
private Modal modal = default!;
|
||||
// alert
|
||||
AlertColor alertColor = AlertColor.Primary;
|
||||
IconName alertIconName = IconName.CheckCircleFill;
|
||||
bool Hidealert = true;
|
||||
string alertMessage = "";
|
||||
|
||||
|
||||
#region bind
|
||||
public string? TicketID { get; set; }
|
||||
public string? Title { get; set; }
|
||||
|
||||
public string? newTitle { get; set; }
|
||||
public string? newtext { get; set; }
|
||||
#endregion
|
||||
[Parameter, SupplyParameterFromQuery]
|
||||
public int? PageIndex { get; set; }
|
||||
|
||||
@@ -108,35 +133,76 @@
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (PageIndex == null) PageIndex = 1;
|
||||
request = new PagingDto<TicketDTO>(2, 10, new List<TicketDTO>()
|
||||
{
|
||||
new TicketDTO
|
||||
{
|
||||
CreateDate="1402/08/05",
|
||||
CreateTime="20:10:10",
|
||||
EndDate="1402/08/08",
|
||||
EndTime="08:10:10",
|
||||
MsgStatus="خوانده شده/ در حال بررسی",
|
||||
Status=StatusTicket.optout,
|
||||
TicketID=1,
|
||||
Title="این یک تست برای یک تیکت است"
|
||||
},
|
||||
new TicketDTO
|
||||
{
|
||||
CreateDate="1402/08/05",
|
||||
CreateTime="20:10:10",
|
||||
EndDate="1402/08/08",
|
||||
EndTime="08:10:10",
|
||||
MsgStatus="خوانده شده/ در حال بررسی",
|
||||
Status=StatusTicket.optout,
|
||||
TicketID=1,
|
||||
Title="این یک تست برای یک تیکت است"
|
||||
}
|
||||
});
|
||||
await Search(PageIndex.Value);
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
private async Task Submit()
|
||||
{
|
||||
var eeee = Title + " " + Title;
|
||||
await Search(1);
|
||||
}
|
||||
}
|
||||
@functions {
|
||||
private void ShowSuccessAlert(string msg)
|
||||
{
|
||||
Hidealert = false;
|
||||
alertColor = AlertColor.Success;
|
||||
alertIconName = IconName.CheckCircleFill;
|
||||
alertMessage = msg;
|
||||
}
|
||||
|
||||
private void ShowDangerAlert(string msg)
|
||||
{
|
||||
Hidealert = false;
|
||||
alertColor = AlertColor.Danger;
|
||||
alertIconName = IconName.ExclamationTriangleFill;
|
||||
alertMessage = msg;
|
||||
}
|
||||
private async Task Search(int pi)
|
||||
{
|
||||
var rsp = await hc.Post<ItemSerchGetTicket>("Ticket/GetAll", new ItemSerchGetTicket
|
||||
{
|
||||
PageIndex = pi,
|
||||
PageSize = 10,
|
||||
TicketID = string.IsNullOrEmpty(TicketID) ? null : Convert.ToInt32(TicketID),
|
||||
Title = Title
|
||||
|
||||
});
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
request = await rsp.Content.ReadFromJsonAsync<PagingDto<TicketDTO>>();
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
}
|
||||
}
|
||||
private async Task OnShowModalClick()
|
||||
{
|
||||
await modal.ShowAsync();
|
||||
}
|
||||
private async Task OnHideModalClick()
|
||||
{
|
||||
await modal.HideAsync();
|
||||
}
|
||||
private async Task OnClickNewTicket()
|
||||
{
|
||||
var rsp = await hc.Post<CTicketDto>("Ticket/NewTicket", new CTicketDto
|
||||
{
|
||||
CompanyID = userinfo.Company.ID.ToString(),
|
||||
Text = newtext,
|
||||
Title = newTitle
|
||||
});
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
ShowSuccessAlert("درخواست شما با موفقیت ثبت شد");
|
||||
newtext = newTitle = string.Empty;
|
||||
await Search(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
||||
}
|
||||
await modal.HideAsync();
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user