2024-05-01 17:11:13 +03:30
|
|
|
|
@page "/Ticket"
|
2024-05-02 20:18:26 +03:30
|
|
|
|
@using Front.Services
|
|
|
|
|
@using Shared.DTOs
|
|
|
|
|
@using Shared.DTOs.Serch
|
2024-05-01 17:11:13 +03:30
|
|
|
|
@layout PanelLayout
|
2024-05-02 20:18:26 +03:30
|
|
|
|
@inject HttpClientController hc;
|
2024-05-03 18:18:38 +03:30
|
|
|
|
@inject UserAuthenticationDTO userinfo
|
2024-05-04 23:13:26 +03:30
|
|
|
|
<PageTitle>پشتیبانی</PageTitle>
|
2024-05-03 18:18:38 +03:30
|
|
|
|
<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>
|
|
|
|
|
|
2024-05-02 20:18:26 +03:30
|
|
|
|
<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> پشتیبانی
|
|
|
|
|
</h4>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<Alert hidden="@Hidealert" Color="@alertColor" Dismissable="false">
|
|
|
|
|
<Icon Name="@alertIconName" class="me-2"></Icon>
|
|
|
|
|
@alertMessage
|
|
|
|
|
</Alert>
|
2024-05-01 17:11:13 +03:30
|
|
|
|
|
2024-05-02 20:18:26 +03:30
|
|
|
|
</div>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-md-6">
|
|
|
|
|
<div class="card mb-4">
|
|
|
|
|
<h5 class="card-header">تیکت ها</h5>
|
2024-05-01 17:11:13 +03:30
|
|
|
|
|
2024-05-02 20:18:26 +03:30
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-md-12">
|
|
|
|
|
<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">
|
2024-05-03 18:18:38 +03:30
|
|
|
|
<div class="col-md-2">
|
2024-05-02 20:18:26 +03:30
|
|
|
|
<InputText @bind-Value="TicketID" placeholder="شناسه" style="text-align:center;" class="form-control" type="text" id="EconomicCode" />
|
2024-05-01 17:11:13 +03:30
|
|
|
|
</div>
|
2024-05-02 20:18:26 +03:30
|
|
|
|
<div class="col-md-6">
|
|
|
|
|
<InputText style="text-align:center;" placeholder="عنوان" @bind-Value="Title" class="form-control" type="text" id="UniqeMemory" />
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-auto">
|
2024-05-03 18:18:38 +03:30
|
|
|
|
|
|
|
|
|
<button type="submit" @onclick="Submit" class="btn btn-primary">جستجو</button>
|
2024-05-02 20:18:26 +03:30
|
|
|
|
|
2024-05-01 17:11:13 +03:30
|
|
|
|
</div>
|
2024-05-02 20:18:26 +03:30
|
|
|
|
<div class="col-auto">
|
|
|
|
|
|
2024-05-03 18:18:38 +03:30
|
|
|
|
<button type="submit" @onclick="OnShowModalClick" class="btn btn-primary">جدید</button>
|
2024-05-02 20:18:26 +03:30
|
|
|
|
|
2024-05-01 17:11:13 +03:30
|
|
|
|
</div>
|
2024-05-02 20:18:26 +03:30
|
|
|
|
</div>
|
2024-05-03 18:18:38 +03:30
|
|
|
|
|
2024-05-01 17:11:13 +03:30
|
|
|
|
</li>
|
2024-05-03 18:18:38 +03:30
|
|
|
|
|
2024-05-01 17:11:13 +03:30
|
|
|
|
</ul>
|
2024-05-02 20:18:26 +03:30
|
|
|
|
|
2024-05-01 17:11:13 +03:30
|
|
|
|
</div>
|
2024-05-02 20:18:26 +03:30
|
|
|
|
</div>
|
2024-05-03 18:18:38 +03:30
|
|
|
|
|
2024-05-02 20:18:26 +03:30
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-md-12">
|
|
|
|
|
<ul class="list-group fa-padding">
|
|
|
|
|
@for (int i = 0; i < request?.list.Count; i++)
|
|
|
|
|
{
|
2024-05-04 02:53:36 +03:30
|
|
|
|
|
|
|
|
|
<LTicket OnMultipleOfThree=@Search Ticket="request?.list[i]" />
|
2024-05-02 20:18:26 +03:30
|
|
|
|
}
|
|
|
|
|
</ul>
|
|
|
|
|
<nav aria-label="Page navigation">
|
|
|
|
|
<br />
|
|
|
|
|
<ul class="pagination justify-content-center">
|
|
|
|
|
@for (int page = 1; page <= request?.PageCount; page++)
|
|
|
|
|
{
|
|
|
|
|
if (page == PageIndex)
|
|
|
|
|
{
|
|
|
|
|
<li class="page-item disabled">
|
|
|
|
|
<a class="page-link" href="@hc._nav.GetUriWithQueryParameter("PageIndex",page)">@(page)</a>
|
|
|
|
|
</li>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<li class="page-item">
|
|
|
|
|
<a class="page-link" href="@hc._nav.GetUriWithQueryParameter("PageIndex",page)">@(page)</a>
|
|
|
|
|
</li>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
</nav>
|
2024-05-01 17:11:13 +03:30
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-05-02 20:18:26 +03:30
|
|
|
|
|
2024-05-01 17:11:13 +03:30
|
|
|
|
</div>
|
|
|
|
|
|
2024-05-02 20:18:26 +03:30
|
|
|
|
|
|
|
|
|
@code {
|
2024-05-04 02:53:36 +03:30
|
|
|
|
LTicket child;
|
|
|
|
|
|
2024-05-03 18:18:38 +03:30
|
|
|
|
private Modal modal = default!;
|
2024-05-02 20:18:26 +03:30
|
|
|
|
// alert
|
|
|
|
|
AlertColor alertColor = AlertColor.Primary;
|
|
|
|
|
IconName alertIconName = IconName.CheckCircleFill;
|
|
|
|
|
bool Hidealert = true;
|
|
|
|
|
string alertMessage = "";
|
|
|
|
|
|
2024-05-03 18:18:38 +03:30
|
|
|
|
#region bind
|
2024-05-02 20:18:26 +03:30
|
|
|
|
public string? TicketID { get; set; }
|
|
|
|
|
public string? Title { get; set; }
|
|
|
|
|
|
2024-05-03 18:18:38 +03:30
|
|
|
|
public string? newTitle { get; set; }
|
|
|
|
|
public string? newtext { get; set; }
|
|
|
|
|
#endregion
|
2024-05-02 20:18:26 +03:30
|
|
|
|
[Parameter, SupplyParameterFromQuery]
|
|
|
|
|
public int? PageIndex { get; set; }
|
|
|
|
|
|
|
|
|
|
public Shared.DTOs.PagingDto<TicketDTO>? request { get; set; }
|
|
|
|
|
|
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
|
|
|
{
|
|
|
|
|
if (PageIndex == null) PageIndex = 1;
|
2024-05-03 18:18:38 +03:30
|
|
|
|
await Search(PageIndex.Value);
|
|
|
|
|
await base.OnParametersSetAsync();
|
|
|
|
|
}
|
|
|
|
|
private async Task Submit()
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
2024-05-04 02:53:36 +03:30
|
|
|
|
public async Task Search(int pi)
|
2024-05-02 20:18:26 +03:30
|
|
|
|
{
|
2024-05-04 02:53:36 +03:30
|
|
|
|
|
2024-05-03 18:18:38 +03:30
|
|
|
|
var rsp = await hc.Post<ItemSerchGetTicket>("Ticket/GetAll", new ItemSerchGetTicket
|
|
|
|
|
{
|
|
|
|
|
PageIndex = pi,
|
2024-05-04 02:53:36 +03:30
|
|
|
|
PageSize = 5,
|
2024-05-03 18:18:38 +03:30
|
|
|
|
TicketID = string.IsNullOrEmpty(TicketID) ? null : Convert.ToInt32(TicketID),
|
|
|
|
|
Title = Title
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
if (rsp.IsSuccessStatusCode)
|
2024-05-02 20:18:26 +03:30
|
|
|
|
{
|
2024-05-03 18:18:38 +03:30
|
|
|
|
request = await rsp.Content.ReadFromJsonAsync<PagingDto<TicketDTO>>();
|
|
|
|
|
}
|
|
|
|
|
else
|
2024-05-02 20:18:26 +03:30
|
|
|
|
{
|
2024-05-03 18:18:38 +03:30
|
|
|
|
ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
|
2024-05-02 20:18:26 +03:30
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-03 18:18:38 +03:30
|
|
|
|
private async Task OnShowModalClick()
|
2024-05-02 20:18:26 +03:30
|
|
|
|
{
|
2024-05-03 18:18:38 +03:30
|
|
|
|
await modal.ShowAsync();
|
2024-05-02 20:18:26 +03:30
|
|
|
|
}
|
2024-05-03 18:18:38 +03:30
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|