Update
This commit is contained in:
35
src/BackOffice/Common/BaseComponents/BasePageComponent.razor
Normal file
35
src/BackOffice/Common/BaseComponents/BasePageComponent.razor
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
<MudStack Row="true" AlignItems="AlignItems.Center" Class="pa-2 pr-4 rounded" Style="height:85vh;">
|
||||||
|
<MudItem xs="2">
|
||||||
|
<MudPaper Height="85vh" Style="overflow:hidden; position:relative;" Outlined="true" Class="rounded-lg">
|
||||||
|
<MudStack Class="pa-5" Style="height:100%;">
|
||||||
|
<MudStack Row="true" AlignItems="AlignItems.Center">
|
||||||
|
<MudText Typo="Typo.subtitle2">فیلتر ها</MudText>
|
||||||
|
<MudSpacer />
|
||||||
|
@if (IsFilterd)
|
||||||
|
{
|
||||||
|
<MudButton Color="Color.Error" Variant="Variant.Text" Size="Size.Small" OnClick="@(async () => await OnClearFilterClick.InvokeAsync())">خذف فیلتر</MudButton>
|
||||||
|
}
|
||||||
|
</MudStack>
|
||||||
|
<MudItem Style="height:100%;">
|
||||||
|
<MudStack StretchItems="StretchItems.None" Class="filter-item" Style="height:100%;">
|
||||||
|
<MudStack>
|
||||||
|
@Filters
|
||||||
|
</MudStack>
|
||||||
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small" FullWidth="true" Class="mt-auto" OnClick="@(async () => await OnSubmitClick.InvokeAsync())">جستجو</MudButton>
|
||||||
|
</MudStack>
|
||||||
|
</MudItem>
|
||||||
|
</MudStack>
|
||||||
|
|
||||||
|
</MudPaper>
|
||||||
|
|
||||||
|
</MudItem>
|
||||||
|
<MudItem xs="10">
|
||||||
|
<MudPaper Height="85vh" Style="overflow:hidden; position:relative;" Outlined="true" Class="rounded-lg">
|
||||||
|
|
||||||
|
@Content
|
||||||
|
</MudPaper>
|
||||||
|
</MudItem>
|
||||||
|
</MudStack>
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace BackOffice.Common.BaseComponents;
|
||||||
|
public partial class BasePageComponent
|
||||||
|
{
|
||||||
|
[Parameter] public RenderFragment Filters { get; set; }
|
||||||
|
[Parameter] public RenderFragment Content { get; set; }
|
||||||
|
[Parameter] public bool IsFilterd { get; set; }
|
||||||
|
[Parameter] public EventCallback OnSubmitClick { get; set; }
|
||||||
|
[Parameter] public EventCallback OnClearFilterClick { get; set; }
|
||||||
|
private bool _open = true;
|
||||||
|
|
||||||
|
private void ToggleDrawer()
|
||||||
|
{
|
||||||
|
_open = !_open;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
@using BackOffice.BFF.Package.Protobuf.Protos.Package
|
|
||||||
@using BackOffice.Common.BaseComponents
|
|
||||||
@using DataModel = BackOffice.BFF.Package.Protobuf.Protos.Package.GetAllPackageByFilterResponseModel
|
|
||||||
|
|
||||||
<MudExpansionPanels>
|
|
||||||
<MudExpansionPanel Text="فیلترها" Expanded="true">
|
|
||||||
<MudStack Justify="Justify.SpaceAround">
|
|
||||||
<MudItem>
|
|
||||||
<MudGrid>
|
|
||||||
<MudItem xs="6">
|
|
||||||
<MudTextField T="string" Clearable="true" DebounceInterval="500" OnDebounceIntervalElapsed="SearchTitle" Label="عنوان" Variant="Variant.Outlined" Adornment="Adornment.End" AdornmentIcon="@Icons.Material.Filled.Search" />
|
|
||||||
</MudItem>
|
|
||||||
|
|
||||||
</MudGrid>
|
|
||||||
</MudItem>
|
|
||||||
</MudStack>
|
|
||||||
</MudExpansionPanel>
|
|
||||||
</MudExpansionPanels>
|
|
||||||
|
|
||||||
<MudDataGrid T="DataModel" ServerData="@(new Func<GridState<DataModel>, Task<GridData<DataModel>>>(ServerReload))"
|
|
||||||
Hover="true" @ref="_gridData" Height="72vh">
|
|
||||||
<ColGroup>
|
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
<col style="width: 58px;" />
|
|
||||||
</ColGroup>
|
|
||||||
<Columns>
|
|
||||||
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
|
||||||
|
|
||||||
<PropertyColumn Property="x => x.Title" Title="عنوان" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
|
||||||
<CellTemplate>
|
|
||||||
<MudStack Row="true" AlignItems="AlignItems.Center">
|
|
||||||
<Image Src="@context.Item.ImagePath" Width="25" Height="25" ObjectPosition="ObjectPosition.Center" ObjectFit="ObjectFit.Fill" />
|
|
||||||
@if (string.IsNullOrWhiteSpace(context.Item.Title))
|
|
||||||
{
|
|
||||||
<MudText Typo="Typo.inherit">-</MudText>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
<MudTooltip Text="@(context.Item.Title)" Arrow="true" Style="@($"{(context.Item.Title.Length < 70 ? string.Empty : "width:600px;")}")">
|
|
||||||
<MudText Typo="Typo.inherit" Style="text-wrap: nowrap;">
|
|
||||||
@(context.Item.Title.Truncate(20, true))
|
|
||||||
</MudText>
|
|
||||||
</MudTooltip>
|
|
||||||
}
|
|
||||||
</MudStack>
|
|
||||||
|
|
||||||
</CellTemplate>
|
|
||||||
</PropertyColumn>
|
|
||||||
<PropertyColumn Property="x => x.Description" Title="توضیحات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
|
||||||
<CellTemplate>
|
|
||||||
@if (string.IsNullOrWhiteSpace(context.Item.Description))
|
|
||||||
{
|
|
||||||
<MudText Typo="Typo.inherit">-</MudText>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
<MudTooltip Text="@(context.Item.Description.HtmlToText())" Arrow="true" Style="@($"{(context.Item.Description.Length < 70 ? string.Empty : "width:600px;")}")">
|
|
||||||
<MudText Typo="Typo.inherit" Style="text-wrap: nowrap;">
|
|
||||||
@(context.Item.Description.HtmlToText().Truncate(20, true))
|
|
||||||
</MudText>
|
|
||||||
</MudTooltip>
|
|
||||||
}
|
|
||||||
</CellTemplate>
|
|
||||||
</PropertyColumn>
|
|
||||||
|
|
||||||
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
|
||||||
<CellTemplate>
|
|
||||||
<MudStack Row="true" AlignItems="AlignItems.Center">
|
|
||||||
<MudTooltip Text="ویرایش">
|
|
||||||
<MudIconButton Icon="@Icons.Material.Filled.EditNote" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => Update(context.Item.Adapt<DataModel>()))" Style="cursor:pointer;" />
|
|
||||||
</MudTooltip>
|
|
||||||
|
|
||||||
<MudTooltip Text="آرشیو">
|
|
||||||
<MudIconButton Icon="@Icons.Material.Filled.DeleteOutline" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => OnDelete(context.Item))" Style="cursor:pointer;" />
|
|
||||||
</MudTooltip>
|
|
||||||
</MudStack>
|
|
||||||
</CellTemplate>
|
|
||||||
</TemplateColumn>
|
|
||||||
</Columns>
|
|
||||||
<PagerContent>
|
|
||||||
<MudDataGridPager T="DataModel" PageSizeOptions=@(new int[] { 30, 60, 90 }) InfoFormat="سطر {first_item} تا {last_item} از {all_items}" RowsPerPageString="تعداد سطرهای صفحه" />
|
|
||||||
</PagerContent>
|
|
||||||
</MudDataGrid>
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2,35 +2,95 @@
|
|||||||
|
|
||||||
@using BackOffice.BFF.Package.Protobuf.Protos.Package
|
@using BackOffice.BFF.Package.Protobuf.Protos.Package
|
||||||
@using BackOffice.Pages.Package.Components
|
@using BackOffice.Pages.Package.Components
|
||||||
|
@using BackOffice.Common.BaseComponents
|
||||||
|
@using DataModel = BackOffice.BFF.Package.Protobuf.Protos.Package.GetAllPackageByFilterResponseModel
|
||||||
|
|
||||||
<MudStack>
|
<BackOffice.Common.BaseComponents.BasePageComponent @ref="_basePage" OnClearFilterClick="OnFilterCleard" OnSubmitClick="OnFilterSubmit">
|
||||||
<MudPaper Elevation="1" Class="pa-4">
|
<Filters>
|
||||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
<MudTextField T="string" Clearable="true" Label="عنوان" @bind-Value="@_request.Filter.Title" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||||
|
</Filters>
|
||||||
|
<Content>
|
||||||
|
<MudDataGrid T="DataModel" ServerData="@(new Func<GridState<DataModel>, Task<GridData<DataModel>>>(ServerReload))"
|
||||||
|
Hover="true" @ref="_gridData" Height="72vh">
|
||||||
|
<ColGroup>
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
<col style="width: 58px;" />
|
||||||
|
</ColGroup>
|
||||||
|
<ToolBarContent>
|
||||||
<MudText>مدیریت پکیج</MudText>
|
<MudText>مدیریت پکیج</MudText>
|
||||||
|
<MudSpacer />
|
||||||
<MudStack Spacing="2" Row="true" Justify="Justify.Center" AlignItems="AlignItems.Center">
|
<MudStack Spacing="2" Row="true" Justify="Justify.Center" AlignItems="AlignItems.Center">
|
||||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Large" ButtonType="ButtonType.Button" OnClick="CreateNew" Style="cursor:pointer;">افزودن</MudButton>
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Large" ButtonType="ButtonType.Button" OnClick="CreateNew" Style="cursor:pointer;">افزودن</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
</MudStack>
|
</ToolBarContent>
|
||||||
</MudPaper>
|
<Columns>
|
||||||
<BackOffice.Pages.Package.Components.PackageDataTable @ref="_table" />
|
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
||||||
|
|
||||||
|
<PropertyColumn Property="x => x.Title" Title="عنوان" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudStack Row="true" AlignItems="AlignItems.Center">
|
||||||
|
<Image Src="@context.Item.ImagePath" Width="25" Height="25" ObjectPosition="ObjectPosition.Center" ObjectFit="ObjectFit.Fill" />
|
||||||
|
@if (string.IsNullOrWhiteSpace(context.Item.Title))
|
||||||
|
{
|
||||||
|
<MudText Typo="Typo.inherit">-</MudText>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
<MudTooltip Text="@(context.Item.Title)" Arrow="true" Style="@($"{(context.Item.Title.Length < 70 ? string.Empty : "width:600px;")}")">
|
||||||
|
<MudText Typo="Typo.inherit" Style="text-wrap: nowrap;">
|
||||||
|
@(context.Item.Title.Truncate(20, true))
|
||||||
|
</MudText>
|
||||||
|
</MudTooltip>
|
||||||
|
}
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
|
||||||
|
</CellTemplate>
|
||||||
@code {
|
</PropertyColumn>
|
||||||
|
<PropertyColumn Property="x => x.Description" Title="توضیحات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
||||||
private PackageDataTable _table;
|
<CellTemplate>
|
||||||
|
@if (string.IsNullOrWhiteSpace(context.Item.Description))
|
||||||
public async Task CreateNew()
|
|
||||||
{
|
{
|
||||||
var dialog = await DialogService.ShowAsync<CreateDialog>($"افزودن پکیج", new DialogParameters<CreateDialog>() { { x => x.Model, new CreateNewPackageRequest() } }, new DialogOptions() { CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.Small });
|
<MudText Typo="Typo.inherit">-</MudText>
|
||||||
var result = await dialog.Result;
|
}
|
||||||
if (!result.Canceled)
|
else
|
||||||
{
|
{
|
||||||
_table.ReLoadData();
|
|
||||||
Snackbar.Add("عملیات با موفقیت انجام شد", Severity.Success);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
<MudTooltip Text="@(context.Item.Description.HtmlToText())" Arrow="true" Style="@($"{(context.Item.Description.Length < 70 ? string.Empty : "width:600px;")}")">
|
||||||
|
<MudText Typo="Typo.inherit" Style="text-wrap: nowrap;">
|
||||||
|
@(context.Item.Description.HtmlToText().Truncate(20, true))
|
||||||
|
</MudText>
|
||||||
|
</MudTooltip>
|
||||||
}
|
}
|
||||||
|
</CellTemplate>
|
||||||
|
</PropertyColumn>
|
||||||
|
|
||||||
|
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudStack Row="true" AlignItems="AlignItems.Center">
|
||||||
|
<MudTooltip Text="ویرایش">
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.EditNote" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => Update(context.Item.Adapt<DataModel>()))" Style="cursor:pointer;" />
|
||||||
|
</MudTooltip>
|
||||||
|
|
||||||
|
<MudTooltip Text="آرشیو">
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.DeleteOutline" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => OnDelete(context.Item))" Style="cursor:pointer;" />
|
||||||
|
</MudTooltip>
|
||||||
|
</MudStack>
|
||||||
|
</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
</Columns>
|
||||||
|
<PagerContent>
|
||||||
|
<MudDataGridPager T="DataModel" PageSizeOptions=@(new int[] { 30, 60, 90 }) InfoFormat="سطر {first_item} تا {last_item} از {all_items}" RowsPerPageString="تعداد سطرهای صفحه" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudDataGrid>
|
||||||
|
</Content>
|
||||||
|
</BackOffice.Common.BaseComponents.BasePageComponent>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,18 @@
|
|||||||
using BackOffice.BFF.Package.Protobuf.Protos.Package;
|
using BackOffice.BFF.Package.Protobuf.Protos.Package;
|
||||||
using Google.Protobuf.WellKnownTypes;
|
using BackOffice.Common.BaseComponents;
|
||||||
using HtmlAgilityPack;
|
using BackOffice.Pages.Package.Components;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using MudBlazor;
|
using MudBlazor;
|
||||||
using static Google.Rpc.Context.AttributeContext.Types;
|
|
||||||
using DataModel = BackOffice.BFF.Package.Protobuf.Protos.Package.GetAllPackageByFilterResponseModel;
|
using DataModel = BackOffice.BFF.Package.Protobuf.Protos.Package.GetAllPackageByFilterResponseModel;
|
||||||
|
|
||||||
namespace BackOffice.Pages.Package.Components;
|
namespace BackOffice.Pages.Package;
|
||||||
|
public partial class PackageMainPage
|
||||||
public partial class PackageDataTable
|
|
||||||
{
|
{
|
||||||
|
|
||||||
[Inject] public PackageContract.PackageContractClient PackageContract { get; set; }
|
[Inject] public PackageContract.PackageContractClient PackageContract { get; set; }
|
||||||
private bool _isLoading = true;
|
private bool _isLoading = true;
|
||||||
private MudDataGrid<DataModel> _gridData;
|
private MudDataGrid<DataModel> _gridData;
|
||||||
|
BasePageComponent _basePage;
|
||||||
private GetAllPackageByFilterRequest _request = new() { Filter = new() };
|
private GetAllPackageByFilterRequest _request = new() { Filter = new() };
|
||||||
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
|
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
|
||||||
{
|
{
|
||||||
@@ -70,12 +67,31 @@ public partial class PackageDataTable
|
|||||||
if (_gridData != null)
|
if (_gridData != null)
|
||||||
await _gridData.ReloadServerData();
|
await _gridData.ReloadServerData();
|
||||||
}
|
}
|
||||||
private async Task SearchTitle(string? title)
|
|
||||||
|
public async Task CreateNew()
|
||||||
{
|
{
|
||||||
_request.Filter ??= new();
|
var dialog = await DialogService.ShowAsync<CreateDialog>($"افزودن پکیج", new DialogParameters<CreateDialog>() { { x => x.Model, new CreateNewPackageRequest() } }, new DialogOptions() { CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.Small });
|
||||||
_request.Filter.Title = string.IsNullOrWhiteSpace(title) ? default : title;
|
var result = await dialog.Result;
|
||||||
|
if (!result.Canceled)
|
||||||
|
{
|
||||||
|
ReLoadData();
|
||||||
|
Snackbar.Add("عملیات با موفقیت انجام شد", Severity.Success);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task OnFilterSubmit()
|
||||||
|
{
|
||||||
|
_basePage.IsFilterd = true;
|
||||||
|
StateHasChanged();
|
||||||
ReLoadData();
|
ReLoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task OnFilterCleard()
|
||||||
|
{
|
||||||
|
_basePage.IsFilterd = false;
|
||||||
|
StateHasChanged();
|
||||||
|
_request = new() { Filter = new() { } };
|
||||||
|
ReLoadData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
@using BackOffice.BFF.Role.Protobuf.Protos.Role
|
|
||||||
@using BackOffice.Common.BaseComponents
|
|
||||||
@using DataModel = BackOffice.BFF.Role.Protobuf.Protos.Role.GetAllRoleByFilterResponseModel
|
|
||||||
|
|
||||||
|
|
||||||
<MudDataGrid T="DataModel" ServerData="@(new Func<GridState<DataModel>, Task<GridData<DataModel>>>(ServerReload))"
|
|
||||||
Hover="true" @ref="_gridData" Height="72vh">
|
|
||||||
<ColGroup>
|
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
<col style="width: 58px;" />
|
|
||||||
</ColGroup>
|
|
||||||
<Columns>
|
|
||||||
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
|
||||||
<PropertyColumn Property="x => x.Title" Title="عنوان" />
|
|
||||||
<PropertyColumn Property="x => x.Name" Title="عنوان لاتین" />
|
|
||||||
|
|
||||||
|
|
||||||
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
|
||||||
<CellTemplate>
|
|
||||||
<MudStack Row="true" AlignItems="AlignItems.Center">
|
|
||||||
<MudTooltip Text="ویرایش">
|
|
||||||
<MudIconButton Icon="@Icons.Material.Filled.EditNote" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => Update(context.Item.Adapt<DataModel>()))" Style="cursor:pointer;" />
|
|
||||||
</MudTooltip>
|
|
||||||
|
|
||||||
<MudTooltip Text="آرشیو">
|
|
||||||
<MudIconButton Icon="@Icons.Material.Filled.DeleteOutline" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => OnDelete(context.Item))" Style="cursor:pointer;" />
|
|
||||||
</MudTooltip>
|
|
||||||
</MudStack>
|
|
||||||
</CellTemplate>
|
|
||||||
</TemplateColumn>
|
|
||||||
</Columns>
|
|
||||||
<PagerContent>
|
|
||||||
<MudDataGridPager T="DataModel" PageSizeOptions=@(new int[] { 30, 60, 90 }) InfoFormat="سطر {first_item} تا {last_item} از {all_items}" RowsPerPageString="تعداد سطرهای صفحه" />
|
|
||||||
</PagerContent>
|
|
||||||
</MudDataGrid>
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2,35 +2,59 @@
|
|||||||
|
|
||||||
@using BackOffice.BFF.Role.Protobuf.Protos.Role
|
@using BackOffice.BFF.Role.Protobuf.Protos.Role
|
||||||
@using BackOffice.Pages.Role.Components
|
@using BackOffice.Pages.Role.Components
|
||||||
|
@using BackOffice.Common.BaseComponents
|
||||||
|
@using DataModel = BackOffice.BFF.Role.Protobuf.Protos.Role.GetAllRoleByFilterResponseModel
|
||||||
|
|
||||||
<MudStack>
|
<BackOffice.Common.BaseComponents.BasePageComponent @ref="_basePage" OnClearFilterClick="OnFilterCleard" OnSubmitClick="OnFilterSubmit">
|
||||||
<MudPaper Elevation="1" Class="pa-4">
|
<Filters>
|
||||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
<MudTextField T="string" Clearable="true" Label="عنوان" @bind-Value="@_request.Filter.Title" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||||
|
</Filters>
|
||||||
|
<Content>
|
||||||
|
<MudDataGrid T="DataModel" ServerData="@(new Func<GridState<DataModel>, Task<GridData<DataModel>>>(ServerReload))"
|
||||||
|
Hover="true" @ref="_gridData" Height="72vh">
|
||||||
|
<ColGroup>
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
<col style="width: 58px;" />
|
||||||
|
</ColGroup>
|
||||||
|
<ToolBarContent>
|
||||||
<MudText>مدیریت نقش</MudText>
|
<MudText>مدیریت نقش</MudText>
|
||||||
|
<MudSpacer />
|
||||||
<MudStack Spacing="2" Row="true" Justify="Justify.Center" AlignItems="AlignItems.Center">
|
<MudStack Spacing="2" Row="true" Justify="Justify.Center" AlignItems="AlignItems.Center">
|
||||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Large" ButtonType="ButtonType.Button" OnClick="CreateNew" Style="cursor:pointer;">افزودن</MudButton>
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Large" ButtonType="ButtonType.Button" OnClick="CreateNew" Style="cursor:pointer;">افزودن</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
</ToolBarContent>
|
||||||
|
<Columns>
|
||||||
|
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
||||||
|
<PropertyColumn Property="x => x.Title" Title="عنوان" />
|
||||||
|
<PropertyColumn Property="x => x.Name" Title="عنوان لاتین" />
|
||||||
|
|
||||||
|
|
||||||
|
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudStack Row="true" AlignItems="AlignItems.Center">
|
||||||
|
<MudTooltip Text="ویرایش">
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.EditNote" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => Update(context.Item.Adapt<DataModel>()))" Style="cursor:pointer;" />
|
||||||
|
</MudTooltip>
|
||||||
|
|
||||||
|
<MudTooltip Text="آرشیو">
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.DeleteOutline" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => OnDelete(context.Item))" Style="cursor:pointer;" />
|
||||||
|
</MudTooltip>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
</MudPaper>
|
</CellTemplate>
|
||||||
<BackOffice.Pages.Role.Components.RoleDataTable @ref="_table" />
|
</TemplateColumn>
|
||||||
</MudStack>
|
</Columns>
|
||||||
|
<PagerContent>
|
||||||
|
<MudDataGridPager T="DataModel" PageSizeOptions=@(new int[] { 30, 60, 90 }) InfoFormat="سطر {first_item} تا {last_item} از {all_items}" RowsPerPageString="تعداد سطرهای صفحه" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudDataGrid>
|
||||||
|
</Content>
|
||||||
|
</BackOffice.Common.BaseComponents.BasePageComponent>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@code {
|
|
||||||
|
|
||||||
private RoleDataTable _table;
|
|
||||||
|
|
||||||
public async Task CreateNew()
|
|
||||||
{
|
|
||||||
var dialog = await DialogService.ShowAsync<CreateDialog>($"افزودن نقش", new DialogParameters<CreateDialog>() { { x => x.Model, new CreateNewRoleRequest() } }, new DialogOptions() { CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.Small });
|
|
||||||
var result = await dialog.Result;
|
|
||||||
if (!result.Canceled)
|
|
||||||
{
|
|
||||||
_table.ReLoadData();
|
|
||||||
Snackbar.Add("عملیات با موفقیت انجام شد", Severity.Success);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,26 @@
|
|||||||
using BackOffice.BFF.Role.Protobuf.Protos.Role;
|
using BackOffice.BFF.Role.Protobuf.Protos.Role;
|
||||||
using Google.Protobuf.WellKnownTypes;
|
using BackOffice.Common.BaseComponents;
|
||||||
using HtmlAgilityPack;
|
using BackOffice.Pages.Role.Components;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using MudBlazor;
|
using MudBlazor;
|
||||||
using static Google.Rpc.Context.AttributeContext.Types;
|
|
||||||
using DataModel = BackOffice.BFF.Role.Protobuf.Protos.Role.GetAllRoleByFilterResponseModel;
|
using DataModel = BackOffice.BFF.Role.Protobuf.Protos.Role.GetAllRoleByFilterResponseModel;
|
||||||
|
|
||||||
namespace BackOffice.Pages.Role.Components;
|
namespace BackOffice.Pages.Role;
|
||||||
|
public partial class RoleMainPage
|
||||||
public partial class RoleDataTable
|
|
||||||
{
|
{
|
||||||
|
BasePageComponent _basePage;
|
||||||
|
|
||||||
|
public async Task CreateNew()
|
||||||
|
{
|
||||||
|
var dialog = await DialogService.ShowAsync<CreateDialog>($"افزودن نقش", new DialogParameters<CreateDialog>() { { x => x.Model, new CreateNewRoleRequest() } }, new DialogOptions() { CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.Small });
|
||||||
|
var result = await dialog.Result;
|
||||||
|
if (!result.Canceled)
|
||||||
|
{
|
||||||
|
ReLoadData();
|
||||||
|
Snackbar.Add("عملیات با موفقیت انجام شد", Severity.Success);
|
||||||
|
}
|
||||||
|
}
|
||||||
[Inject] public RoleContract.RoleContractClient RoleContract { get; set; }
|
[Inject] public RoleContract.RoleContractClient RoleContract { get; set; }
|
||||||
private bool _isLoading = true;
|
private bool _isLoading = true;
|
||||||
private MudDataGrid<DataModel> _gridData;
|
private MudDataGrid<DataModel> _gridData;
|
||||||
@@ -70,5 +79,18 @@ public partial class RoleDataTable
|
|||||||
if (_gridData != null)
|
if (_gridData != null)
|
||||||
await _gridData.ReloadServerData();
|
await _gridData.ReloadServerData();
|
||||||
}
|
}
|
||||||
|
public async Task OnFilterSubmit()
|
||||||
|
{
|
||||||
|
_basePage.IsFilterd = true;
|
||||||
|
StateHasChanged();
|
||||||
|
ReLoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OnFilterCleard()
|
||||||
|
{
|
||||||
|
_basePage.IsFilterd = false;
|
||||||
|
StateHasChanged();
|
||||||
|
_request = new() { Filter = new() { } };
|
||||||
|
ReLoadData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
@using BackOffice.BFF.User.Protobuf.Protos.User
|
|
||||||
@using BackOffice.Common.BaseComponents
|
|
||||||
@using DataModel = BackOffice.BFF.User.Protobuf.Protos.User.GetAllUserByFilterResponseModel
|
|
||||||
|
|
||||||
<MudExpansionPanels>
|
|
||||||
<MudExpansionPanel Text="فیلترها" Expanded="true">
|
|
||||||
<MudStack Justify="Justify.SpaceAround">
|
|
||||||
<MudItem>
|
|
||||||
<MudGrid>
|
|
||||||
<MudItem xs="6">
|
|
||||||
<MudTextField T="string" Clearable="true" DebounceInterval="500" OnDebounceIntervalElapsed="Searchfirstname" Label="نام" Variant="Variant.Outlined" Adornment="Adornment.End" AdornmentIcon="@Icons.Material.Filled.Search" />
|
|
||||||
</MudItem>
|
|
||||||
<MudItem xs="6">
|
|
||||||
<MudTextField T="string" Clearable="true" DebounceInterval="500" OnDebounceIntervalElapsed="Searchlastname" Label="نام خانوادگی" Variant="Variant.Outlined" Adornment="Adornment.End" AdornmentIcon="@Icons.Material.Filled.Search" />
|
|
||||||
</MudItem>
|
|
||||||
<MudItem xs="6">
|
|
||||||
<MudTextField T="string" Clearable="true" DebounceInterval="500" OnDebounceIntervalElapsed="SearchNationalCode" Label="کد ملی" Variant="Variant.Outlined" Adornment="Adornment.End" AdornmentIcon="@Icons.Material.Filled.Search" />
|
|
||||||
</MudItem>
|
|
||||||
<MudItem xs="6">
|
|
||||||
<MudTextField T="string" Clearable="true" DebounceInterval="500" OnDebounceIntervalElapsed="SearchMobile" Label="شماره موبایل" Variant="Variant.Outlined" Adornment="Adornment.End" AdornmentIcon="@Icons.Material.Filled.Search" />
|
|
||||||
</MudItem>
|
|
||||||
</MudGrid>
|
|
||||||
</MudItem>
|
|
||||||
</MudStack>
|
|
||||||
</MudExpansionPanel>
|
|
||||||
</MudExpansionPanels>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<MudDataGrid T="DataModel" ServerData="@(new Func<GridState<DataModel>, Task<GridData<DataModel>>>(ServerReload))"
|
|
||||||
Hover="true" @ref="_gridData" Height="72vh">
|
|
||||||
<ColGroup>
|
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
<col style="width: 58px;" />
|
|
||||||
</ColGroup>
|
|
||||||
<Columns>
|
|
||||||
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
|
||||||
<PropertyColumn Property="x => x.Mobile" Title="موبایل" />
|
|
||||||
<PropertyColumn Property="x => x.FirstName" Title="نام و نام خانوادگی" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
|
||||||
<CellTemplate>
|
|
||||||
<MudText Typo="Typo.inherit">@($"{context.Item.FirstName} {context.Item.LastName}")</MudText>
|
|
||||||
|
|
||||||
</CellTemplate>
|
|
||||||
</PropertyColumn>
|
|
||||||
<PropertyColumn Property="x => x.NationalCode" Title="کدملی" />
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
|
||||||
<CellTemplate>
|
|
||||||
<MudStack Row="true" AlignItems="AlignItems.Center">
|
|
||||||
<MudMenu Icon="@Icons.Material.Filled.MoreVert"
|
|
||||||
AriaLabel="Open user menu">
|
|
||||||
<MudMenuItem OnClick="@(() => Navigation.NavigateTo($"{RouteConstance.UserOrder}{context.Item.Id}"))">فاکتور ها</MudMenuItem>
|
|
||||||
<MudMenuItem OnClick="@(() => Navigation.NavigateTo($"{RouteConstance.UserAddress}{context.Item.Id}"))">آدرس ها</MudMenuItem>
|
|
||||||
<MudMenuItem OnClick="@(async() => await OnclickUserRoleDialog(context.Item.Id))">مدیریت نقش</MudMenuItem>
|
|
||||||
<MudMenuItem OnClick="() => OnDelete(context.Item)">آرشیو</MudMenuItem>
|
|
||||||
</MudMenu>
|
|
||||||
</MudStack>
|
|
||||||
</CellTemplate>
|
|
||||||
</TemplateColumn>
|
|
||||||
</Columns>
|
|
||||||
<PagerContent>
|
|
||||||
<MudDataGridPager T="DataModel" PageSizeOptions=@(new int[] { 30, 60, 90 }) InfoFormat="سطر {first_item} تا {last_item} از {all_items}" RowsPerPageString="تعداد سطرهای صفحه" />
|
|
||||||
</PagerContent>
|
|
||||||
</MudDataGrid>
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2,21 +2,66 @@
|
|||||||
|
|
||||||
@using BackOffice.BFF.User.Protobuf.Protos.User
|
@using BackOffice.BFF.User.Protobuf.Protos.User
|
||||||
@using BackOffice.Pages.User.Components
|
@using BackOffice.Pages.User.Components
|
||||||
|
@using BackOffice.Common.BaseComponents
|
||||||
|
@using DataModel = BackOffice.BFF.User.Protobuf.Protos.User.GetAllUserByFilterResponseModel
|
||||||
|
|
||||||
<MudStack>
|
<BackOffice.Common.BaseComponents.BasePageComponent @ref="_basePage" OnClearFilterClick="OnFilterCleard" OnSubmitClick="OnFilterSubmit">
|
||||||
<MudPaper Elevation="1" Class="pa-4">
|
<Filters>
|
||||||
|
<MudTextField T="string" Clearable="true" Label="نام" @bind-Value="@_request.Filter.FirstName" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||||
|
<MudTextField T="string" Clearable="true" Label="نام خانوادگی" @bind-Value="@_request.Filter.LastName" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||||
|
<MudTextField T="string" Clearable="true" Label="موبایل" @bind-Value="@_request.Filter.Mobile" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||||
|
<MudTextField T="string" Clearable="true" Label="کدملی" @bind-Value="@_request.Filter.NationalCode" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||||
|
</Filters>
|
||||||
|
<Content>
|
||||||
|
<MudDataGrid T="DataModel" ServerData="@(new Func<GridState<DataModel>, Task<GridData<DataModel>>>(ServerReload))"
|
||||||
|
Hover="true" @ref="_gridData" Height="72vh">
|
||||||
|
<ColGroup>
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
<col style="width: 58px;" />
|
||||||
|
</ColGroup>
|
||||||
|
<ToolBarContent>
|
||||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
||||||
<MudText>مدیریت کاربر</MudText>
|
<MudText>مدیریت کاربر</MudText>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
</MudPaper>
|
</ToolBarContent>
|
||||||
<BackOffice.Pages.User.Components.UserDataTable @ref="_table" />
|
<Columns>
|
||||||
|
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
||||||
|
<PropertyColumn Property="x => x.Mobile" Title="موبایل" />
|
||||||
|
<PropertyColumn Property="x => x.FirstName" Title="نام و نام خانوادگی" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudText Typo="Typo.inherit">@($"{context.Item.FirstName} {context.Item.LastName}")</MudText>
|
||||||
|
|
||||||
|
</CellTemplate>
|
||||||
|
</PropertyColumn>
|
||||||
|
<PropertyColumn Property="x => x.NationalCode" Title="کدملی" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudStack Row="true" AlignItems="AlignItems.Center">
|
||||||
|
<MudMenu Icon="@Icons.Material.Filled.MoreVert"
|
||||||
|
AriaLabel="Open user menu">
|
||||||
|
<MudMenuItem OnClick="@(() => Navigation.NavigateTo($"{RouteConstance.UserOrder}{context.Item.Id}"))">فاکتور ها</MudMenuItem>
|
||||||
|
<MudMenuItem OnClick="@(() => Navigation.NavigateTo($"{RouteConstance.UserAddress}{context.Item.Id}"))">آدرس ها</MudMenuItem>
|
||||||
|
<MudMenuItem OnClick="@(async () => await OnclickUserRoleDialog(context.Item.Id))">مدیریت نقش</MudMenuItem>
|
||||||
|
<MudMenuItem OnClick="() => OnDelete(context.Item)">آرشیو</MudMenuItem>
|
||||||
|
</MudMenu>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
</Columns>
|
||||||
|
<PagerContent>
|
||||||
|
<MudDataGridPager T="DataModel" PageSizeOptions=@(new int[] { 30, 60, 90 }) InfoFormat="سطر {first_item} تا {last_item} از {all_items}" RowsPerPageString="تعداد سطرهای صفحه" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudDataGrid>
|
||||||
|
|
||||||
|
</Content>
|
||||||
|
</BackOffice.Common.BaseComponents.BasePageComponent>
|
||||||
|
|
||||||
|
|
||||||
@code {
|
|
||||||
|
|
||||||
private UserDataTable _table;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,17 @@
|
|||||||
using BackOffice.BFF.User.Protobuf.Protos.User;
|
using BackOffice.BFF.User.Protobuf.Protos.User;
|
||||||
using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole;
|
using BackOffice.Common.BaseComponents;
|
||||||
using Google.Protobuf.WellKnownTypes;
|
using BackOffice.Pages.User.Components;
|
||||||
using HtmlAgilityPack;
|
|
||||||
using Mapster;
|
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using MudBlazor;
|
using MudBlazor;
|
||||||
using static Google.Rpc.Context.AttributeContext.Types;
|
|
||||||
using static MudBlazor.CategoryTypes;
|
|
||||||
using DataModel = BackOffice.BFF.User.Protobuf.Protos.User.GetAllUserByFilterResponseModel;
|
using DataModel = BackOffice.BFF.User.Protobuf.Protos.User.GetAllUserByFilterResponseModel;
|
||||||
|
|
||||||
namespace BackOffice.Pages.User.Components;
|
namespace BackOffice.Pages.User;
|
||||||
|
public partial class UserMainPage
|
||||||
public partial class UserDataTable
|
|
||||||
{
|
{
|
||||||
|
|
||||||
[Inject] public UserContract.UserContractClient UserContract { get; set; }
|
[Inject] public UserContract.UserContractClient UserContract { get; set; }
|
||||||
private bool _isLoading = true;
|
private bool _isLoading = true;
|
||||||
private MudDataGrid<DataModel> _gridData;
|
private MudDataGrid<DataModel> _gridData;
|
||||||
|
BasePageComponent _basePage;
|
||||||
private GetAllUserByFilterRequest _request = new() { Filter = new() };
|
private GetAllUserByFilterRequest _request = new() { Filter = new() };
|
||||||
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
|
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
|
||||||
{
|
{
|
||||||
@@ -91,4 +85,18 @@ public partial class UserDataTable
|
|||||||
Snackbar.Add("عملیات با موفقیت انجام شد", Severity.Success);
|
Snackbar.Add("عملیات با موفقیت انجام شد", Severity.Success);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public async Task OnFilterSubmit()
|
||||||
|
{
|
||||||
|
_basePage.IsFilterd = true;
|
||||||
|
StateHasChanged();
|
||||||
|
ReLoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OnFilterCleard()
|
||||||
|
{
|
||||||
|
_basePage.IsFilterd = false;
|
||||||
|
StateHasChanged();
|
||||||
|
_request = new() { Filter = new() { } };
|
||||||
|
ReLoadData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
@using BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress
|
|
||||||
@using BackOffice.Common.BaseComponents
|
|
||||||
@using DataModel = BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress.GetAllUserAddressByFilterResponseModel
|
|
||||||
|
|
||||||
|
|
||||||
<MudDataGrid T="DataModel" ServerData="@(new Func<GridState<DataModel>, Task<GridData<DataModel>>>(ServerReload))"
|
|
||||||
Hover="true" @ref="_gridData" Height="72vh">
|
|
||||||
<ColGroup>
|
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
<col style="width: 58px;" />
|
|
||||||
</ColGroup>
|
|
||||||
<Columns>
|
|
||||||
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
|
||||||
<PropertyColumn Property="x => x.Title" Title="عنوان" />
|
|
||||||
<PropertyColumn Property="x => x.Address" Title="آدرس" />
|
|
||||||
<PropertyColumn Property="x => x.PostalCode" Title="کد پستی" />
|
|
||||||
|
|
||||||
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
|
||||||
<CellTemplate>
|
|
||||||
<MudStack Row="true" AlignItems="AlignItems.Center">
|
|
||||||
<MudTooltip Text="ویرایش">
|
|
||||||
<MudIconButton Icon="@Icons.Material.Filled.EditNote" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => Update(context.Item.Adapt<DataModel>()))" Style="cursor:pointer;" />
|
|
||||||
</MudTooltip>
|
|
||||||
|
|
||||||
<MudTooltip Text="آرشیو">
|
|
||||||
<MudIconButton Icon="@Icons.Material.Filled.DeleteOutline" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => OnDelete(context.Item))" Style="cursor:pointer;" />
|
|
||||||
</MudTooltip>
|
|
||||||
</MudStack>
|
|
||||||
</CellTemplate>
|
|
||||||
</TemplateColumn>
|
|
||||||
</Columns>
|
|
||||||
<PagerContent>
|
|
||||||
<MudDataGridPager T="DataModel" PageSizeOptions=@(new int[] { 30, 60, 90 }) InfoFormat="سطر {first_item} تا {last_item} از {all_items}" RowsPerPageString="تعداد سطرهای صفحه" />
|
|
||||||
</PagerContent>
|
|
||||||
</MudDataGrid>
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2,35 +2,56 @@
|
|||||||
|
|
||||||
@using BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress
|
@using BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress
|
||||||
@using BackOffice.Pages.UserAddress.Components
|
@using BackOffice.Pages.UserAddress.Components
|
||||||
|
@using BackOffice.Common.BaseComponents
|
||||||
|
@using DataModel = BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress.GetAllUserAddressByFilterResponseModel
|
||||||
|
|
||||||
<MudStack>
|
<BackOffice.Common.BaseComponents.BasePageComponent @ref="_basePage" OnClearFilterClick="OnFilterCleard" OnSubmitClick="OnFilterSubmit">
|
||||||
<MudPaper Elevation="1" Class="pa-4">
|
<Filters>
|
||||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
<MudTextField T="string" Clearable="true" Label="عنوان" @bind-Value="@_request.Filter.Title" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||||
|
</Filters>
|
||||||
|
<Content>
|
||||||
|
<MudDataGrid T="DataModel" ServerData="@(new Func<GridState<DataModel>, Task<GridData<DataModel>>>(ServerReload))"
|
||||||
|
Hover="true" @ref="_gridData" Height="72vh">
|
||||||
|
<ColGroup>
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
<col style="width: 58px;" />
|
||||||
|
</ColGroup>
|
||||||
|
<ToolBarContent>
|
||||||
<MudText>مدیریت آدرس</MudText>
|
<MudText>مدیریت آدرس</MudText>
|
||||||
|
<MudSpacer />
|
||||||
<MudStack Spacing="2" Row="true" Justify="Justify.Center" AlignItems="AlignItems.Center">
|
<MudStack Spacing="2" Row="true" Justify="Justify.Center" AlignItems="AlignItems.Center">
|
||||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Large" ButtonType="ButtonType.Button" OnClick="CreateNew" Style="cursor:pointer;">افزودن</MudButton>
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Large" ButtonType="ButtonType.Button" OnClick="CreateNew" Style="cursor:pointer;">افزودن</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
</ToolBarContent>
|
||||||
|
<Columns>
|
||||||
|
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
||||||
|
<PropertyColumn Property="x => x.Title" Title="عنوان" />
|
||||||
|
<PropertyColumn Property="x => x.Address" Title="آدرس" />
|
||||||
|
<PropertyColumn Property="x => x.PostalCode" Title="کد پستی" />
|
||||||
|
|
||||||
|
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudStack Row="true" AlignItems="AlignItems.Center">
|
||||||
|
<MudTooltip Text="ویرایش">
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.EditNote" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => Update(context.Item.Adapt<DataModel>()))" Style="cursor:pointer;" />
|
||||||
|
</MudTooltip>
|
||||||
|
|
||||||
|
<MudTooltip Text="آرشیو">
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.DeleteOutline" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => OnDelete(context.Item))" Style="cursor:pointer;" />
|
||||||
|
</MudTooltip>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
</MudPaper>
|
</CellTemplate>
|
||||||
<BackOffice.Pages.UserAddress.Components.UserAddressDataTable @ref="_table" />
|
</TemplateColumn>
|
||||||
</MudStack>
|
</Columns>
|
||||||
|
<PagerContent>
|
||||||
|
<MudDataGridPager T="DataModel" PageSizeOptions=@(new int[] { 30, 60, 90 }) InfoFormat="سطر {first_item} تا {last_item} از {all_items}" RowsPerPageString="تعداد سطرهای صفحه" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudDataGrid>
|
||||||
|
|
||||||
|
</Content>
|
||||||
|
</BackOffice.Common.BaseComponents.BasePageComponent>
|
||||||
|
|
||||||
|
|
||||||
@code {
|
|
||||||
[Parameter] public long UserId { get; set; }
|
|
||||||
private UserAddressDataTable _table;
|
|
||||||
|
|
||||||
public async Task CreateNew()
|
|
||||||
{
|
|
||||||
var dialog = await DialogService.ShowAsync<CreateDialog>($"افزودن آدرس", new DialogParameters<CreateDialog>() { { x => x.Model, new CreateNewUserAddressRequest() { UserId = UserId } } }, new DialogOptions() { CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.Small });
|
|
||||||
var result = await dialog.Result;
|
|
||||||
if (!result.Canceled)
|
|
||||||
{
|
|
||||||
_table.ReLoadData();
|
|
||||||
Snackbar.Add("عملیات با موفقیت انجام شد", Severity.Success);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,19 @@
|
|||||||
using BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress;
|
using BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress;
|
||||||
using Google.Protobuf.WellKnownTypes;
|
using BackOffice.Common.BaseComponents;
|
||||||
using HtmlAgilityPack;
|
using BackOffice.Pages.UserAddress.Components;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using MudBlazor;
|
using MudBlazor;
|
||||||
using static Google.Rpc.Context.AttributeContext.Types;
|
|
||||||
using DataModel = BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress.GetAllUserAddressByFilterResponseModel;
|
using DataModel = BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress.GetAllUserAddressByFilterResponseModel;
|
||||||
|
|
||||||
namespace BackOffice.Pages.UserAddress.Components;
|
namespace BackOffice.Pages.UserAddress;
|
||||||
|
public partial class UserAddressMainPage
|
||||||
public partial class UserAddressDataTable
|
|
||||||
{
|
{
|
||||||
[Parameter] public long UserId { get; set; }
|
[Parameter] public long UserId { get; set; }
|
||||||
[Inject] public UserAddressContract.UserAddressContractClient UserAddressContract { get; set; }
|
[Inject] public UserAddressContract.UserAddressContractClient UserAddressContract { get; set; }
|
||||||
private bool _isLoading = true;
|
private bool _isLoading = true;
|
||||||
private MudDataGrid<DataModel> _gridData;
|
private MudDataGrid<DataModel> _gridData;
|
||||||
|
BasePageComponent _basePage;
|
||||||
private GetAllUserAddressByFilterRequest _request = new() { Filter = new() };
|
private GetAllUserAddressByFilterRequest _request = new() { Filter = new() };
|
||||||
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
|
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
|
||||||
{
|
{
|
||||||
@@ -73,5 +71,28 @@ public partial class UserAddressDataTable
|
|||||||
if (_gridData != null)
|
if (_gridData != null)
|
||||||
await _gridData.ReloadServerData();
|
await _gridData.ReloadServerData();
|
||||||
}
|
}
|
||||||
|
public async Task CreateNew()
|
||||||
|
{
|
||||||
|
var dialog = await DialogService.ShowAsync<CreateDialog>($"افزودن آدرس", new DialogParameters<CreateDialog>() { { x => x.Model, new CreateNewUserAddressRequest() { UserId = UserId } } }, new DialogOptions() { CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.Small });
|
||||||
|
var result = await dialog.Result;
|
||||||
|
if (!result.Canceled)
|
||||||
|
{
|
||||||
|
ReLoadData();
|
||||||
|
Snackbar.Add("عملیات با موفقیت انجام شد", Severity.Success);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public async Task OnFilterSubmit()
|
||||||
|
{
|
||||||
|
_basePage.IsFilterd = true;
|
||||||
|
StateHasChanged();
|
||||||
|
ReLoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OnFilterCleard()
|
||||||
|
{
|
||||||
|
_basePage.IsFilterd = false;
|
||||||
|
StateHasChanged();
|
||||||
|
_request = new() { Filter = new() { } };
|
||||||
|
ReLoadData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,51 +1,2 @@
|
|||||||
@using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder
|
|
||||||
@using BackOffice.Common.BaseComponents
|
|
||||||
@using DataModel = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder.GetAllUserOrderByFilterResponseModel
|
|
||||||
|
|
||||||
|
|
||||||
<MudDataGrid T="DataModel" ServerData="@(new Func<GridState<DataModel>, Task<GridData<DataModel>>>(ServerReload))"
|
|
||||||
Hover="true" @ref="_gridData" Height="72vh">
|
|
||||||
<ColGroup>
|
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
<col style="width: 58px;" />
|
|
||||||
</ColGroup>
|
|
||||||
<Columns>
|
|
||||||
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
|
||||||
<PropertyColumn Property="x => x.Price" Title="مبلغ" />
|
|
||||||
<PropertyColumn Property="x => x.PaymentStatus" Title="وضعیت پرداخت">
|
|
||||||
<CellTemplate>
|
|
||||||
@if (context.Item.PaymentStatus)
|
|
||||||
{
|
|
||||||
<MudChip T="string" Color="Color.Success">پرداخت شده</MudChip>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<MudChip T="string" Color="Color.Error">پرداخت نشده</MudChip>
|
|
||||||
}
|
|
||||||
</CellTemplate>
|
|
||||||
</PropertyColumn>
|
|
||||||
<PropertyColumn Property="x => x.TransactionId" Title="شناسه پرداخت" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;" />
|
|
||||||
<PropertyColumn Property="x => x.PaymentDate" Title="تاریخ پرداخت" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;" />
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
|
||||||
<CellTemplate>
|
|
||||||
<MudStack Row="true" AlignItems="AlignItems.Center">
|
|
||||||
|
|
||||||
|
|
||||||
<MudTooltip Text="آرشیو">
|
|
||||||
<MudIconButton Icon="@Icons.Material.Filled.DeleteOutline" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => OnDelete(context.Item))" Style="cursor:pointer;" />
|
|
||||||
</MudTooltip>
|
|
||||||
</MudStack>
|
|
||||||
</CellTemplate>
|
|
||||||
</TemplateColumn>
|
|
||||||
</Columns>
|
|
||||||
<PagerContent>
|
|
||||||
<MudDataGridPager T="DataModel" PageSizeOptions=@(new int[] { 30, 60, 90 }) InfoFormat="سطر {first_item} تا {last_item} از {all_items}" RowsPerPageString="تعداد سطرهای صفحه" />
|
|
||||||
</PagerContent>
|
|
||||||
</MudDataGrid>
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,50 +13,6 @@ public partial class UserOrderDataTable
|
|||||||
{
|
{
|
||||||
[Parameter] public long UserId { get; set; }
|
[Parameter] public long UserId { get; set; }
|
||||||
|
|
||||||
[Inject] public UserOrderContract.UserOrderContractClient UserOrderContract { get; set; }
|
|
||||||
private bool _isLoading = true;
|
|
||||||
private MudDataGrid<DataModel> _gridData;
|
|
||||||
|
|
||||||
private GetAllUserOrderByFilterRequest _request = new() { Filter = new() };
|
|
||||||
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
|
|
||||||
{
|
|
||||||
_request.Filter ??= new();
|
|
||||||
_request.PaginationState ??= new();
|
|
||||||
_request.PaginationState.PageNumber = state.Page + 1;
|
|
||||||
_request.PaginationState.PageSize = state.PageSize;
|
|
||||||
|
|
||||||
_request.Filter.UserId = UserId;
|
|
||||||
|
|
||||||
var result = await UserOrderContract.GetAllUserOrderByFilterAsync(_request);
|
|
||||||
if (result != null && result.Models != null && result.Models.Any())
|
|
||||||
{
|
|
||||||
return new GridData<DataModel>() { Items = result.Models.ToList(), TotalItems = (int)result.MetaData.TotalCount };
|
|
||||||
}
|
|
||||||
|
|
||||||
return new GridData<DataModel>();
|
|
||||||
}
|
|
||||||
private async Task OnDelete(DataModel model)
|
|
||||||
{
|
|
||||||
var options = new DialogOptions { CloseOnEscapeKey = true, MaxWidth = MaxWidth.Small };
|
|
||||||
bool? result = await DialogService.ShowMessageBox(
|
|
||||||
"اخطار",
|
|
||||||
"آیا از حذف این مورد مطمئن هستید؟",
|
|
||||||
yesText: "حذف", cancelText: "لغو",
|
|
||||||
options: options);
|
|
||||||
if (result != null && result.Value)
|
|
||||||
{
|
|
||||||
await UserOrderContract.DeleteUserOrderAsync(new()
|
|
||||||
{
|
|
||||||
Id = model.Id
|
|
||||||
});
|
|
||||||
ReLoadData();
|
|
||||||
}
|
|
||||||
StateHasChanged();
|
|
||||||
}
|
|
||||||
public async void ReLoadData()
|
|
||||||
{
|
|
||||||
if (_gridData != null)
|
|
||||||
await _gridData.ReloadServerData();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,22 +2,67 @@
|
|||||||
|
|
||||||
@using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder
|
@using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder
|
||||||
@using BackOffice.Pages.UserOrder.Components
|
@using BackOffice.Pages.UserOrder.Components
|
||||||
|
@using BackOffice.Common.BaseComponents
|
||||||
|
@using DataModel = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder.GetAllUserOrderByFilterResponseModel
|
||||||
|
|
||||||
<MudStack>
|
<BackOffice.Common.BaseComponents.BasePageComponent @ref="_basePage" OnClearFilterClick="OnFilterCleard" OnSubmitClick="OnFilterSubmit">
|
||||||
<MudPaper Elevation="1" Class="pa-4">
|
<Filters>
|
||||||
|
<MudNumericField HideSpinButtons="true" T="long?" Clearable="true" Label="قیمت" @bind-Value="@_request.Filter.Price" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||||
|
</Filters>
|
||||||
|
<Content>
|
||||||
|
<MudDataGrid T="DataModel" ServerData="@(new Func<GridState<DataModel>, Task<GridData<DataModel>>>(ServerReload))"
|
||||||
|
Hover="true" @ref="_gridData" Height="72vh">
|
||||||
|
<ColGroup>
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
<col style="width: 58px;" />
|
||||||
|
</ColGroup>
|
||||||
|
<ToolBarContent>
|
||||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
||||||
<MudText>فاکتور</MudText>
|
<MudText>فاکتور</MudText>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
</MudPaper>
|
</ToolBarContent>
|
||||||
<BackOffice.Pages.UserOrder.Components.UserOrderDataTable UserId="UserId" @ref="_table" />
|
<Columns>
|
||||||
</MudStack>
|
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
||||||
|
<PropertyColumn Property="x => x.Price" Title="مبلغ" />
|
||||||
|
<PropertyColumn Property="x => x.PaymentStatus" Title="وضعیت پرداخت">
|
||||||
@code {
|
<CellTemplate>
|
||||||
[Parameter] public long UserId { get; set; }
|
@if (context.Item.PaymentStatus)
|
||||||
|
{
|
||||||
private UserOrderDataTable _table;
|
<MudChip T="string" Color="Color.Success">پرداخت شده</MudChip>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudChip T="string" Color="Color.Error">پرداخت نشده</MudChip>
|
||||||
|
}
|
||||||
|
</CellTemplate>
|
||||||
|
</PropertyColumn>
|
||||||
|
<PropertyColumn Property="x => x.TransactionId" Title="شناسه پرداخت" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;" />
|
||||||
|
<PropertyColumn Property="x => x.PaymentDate" Title="تاریخ پرداخت" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudStack Row="true" AlignItems="AlignItems.Center">
|
||||||
|
|
||||||
|
|
||||||
|
<MudTooltip Text="آرشیو">
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.DeleteOutline" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => OnDelete(context.Item))" Style="cursor:pointer;" />
|
||||||
|
</MudTooltip>
|
||||||
|
</MudStack>
|
||||||
|
</CellTemplate>
|
||||||
|
</TemplateColumn>
|
||||||
|
</Columns>
|
||||||
|
<PagerContent>
|
||||||
|
<MudDataGridPager T="DataModel" PageSizeOptions=@(new int[] { 30, 60, 90 }) InfoFormat="سطر {first_item} تا {last_item} از {all_items}" RowsPerPageString="تعداد سطرهای صفحه" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudDataGrid>
|
||||||
|
|
||||||
|
</Content>
|
||||||
|
</BackOffice.Common.BaseComponents.BasePageComponent>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
71
src/BackOffice/Pages/UserOrder/UserOrderMainPage.razor.cs
Normal file
71
src/BackOffice/Pages/UserOrder/UserOrderMainPage.razor.cs
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
|
||||||
|
using BackOffice.Common.BaseComponents;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using MudBlazor;
|
||||||
|
using DataModel = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder.GetAllUserOrderByFilterResponseModel;
|
||||||
|
|
||||||
|
namespace BackOffice.Pages.UserOrder;
|
||||||
|
public partial class UserOrderMainPage
|
||||||
|
{
|
||||||
|
[Parameter] public long UserId { get; set; }
|
||||||
|
[Inject] public UserOrderContract.UserOrderContractClient UserOrderContract { get; set; }
|
||||||
|
private bool _isLoading = true;
|
||||||
|
private MudDataGrid<DataModel> _gridData;
|
||||||
|
BasePageComponent _basePage;
|
||||||
|
|
||||||
|
private GetAllUserOrderByFilterRequest _request = new() { Filter = new() };
|
||||||
|
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
|
||||||
|
{
|
||||||
|
_request.Filter ??= new();
|
||||||
|
_request.PaginationState ??= new();
|
||||||
|
_request.PaginationState.PageNumber = state.Page + 1;
|
||||||
|
_request.PaginationState.PageSize = state.PageSize;
|
||||||
|
|
||||||
|
_request.Filter.UserId = UserId;
|
||||||
|
|
||||||
|
var result = await UserOrderContract.GetAllUserOrderByFilterAsync(_request);
|
||||||
|
if (result != null && result.Models != null && result.Models.Any())
|
||||||
|
{
|
||||||
|
return new GridData<DataModel>() { Items = result.Models.ToList(), TotalItems = (int)result.MetaData.TotalCount };
|
||||||
|
}
|
||||||
|
|
||||||
|
return new GridData<DataModel>();
|
||||||
|
}
|
||||||
|
private async Task OnDelete(DataModel model)
|
||||||
|
{
|
||||||
|
var options = new DialogOptions { CloseOnEscapeKey = true, MaxWidth = MaxWidth.Small };
|
||||||
|
bool? result = await DialogService.ShowMessageBox(
|
||||||
|
"اخطار",
|
||||||
|
"آیا از حذف این مورد مطمئن هستید؟",
|
||||||
|
yesText: "حذف", cancelText: "لغو",
|
||||||
|
options: options);
|
||||||
|
if (result != null && result.Value)
|
||||||
|
{
|
||||||
|
await UserOrderContract.DeleteUserOrderAsync(new()
|
||||||
|
{
|
||||||
|
Id = model.Id
|
||||||
|
});
|
||||||
|
ReLoadData();
|
||||||
|
}
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
public async void ReLoadData()
|
||||||
|
{
|
||||||
|
if (_gridData != null)
|
||||||
|
await _gridData.ReloadServerData();
|
||||||
|
}
|
||||||
|
public async Task OnFilterSubmit()
|
||||||
|
{
|
||||||
|
_basePage.IsFilterd = true;
|
||||||
|
StateHasChanged();
|
||||||
|
ReLoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OnFilterCleard()
|
||||||
|
{
|
||||||
|
_basePage.IsFilterd = false;
|
||||||
|
StateHasChanged();
|
||||||
|
_request = new() { Filter = new() { } };
|
||||||
|
ReLoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
@using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole
|
|
||||||
@using BackOffice.Common.BaseComponents
|
|
||||||
@using DataModel = BackOffice.BFF.UserRole.Protobuf.Protos.UserRole.GetAllUserRoleByFilterResponseModel
|
|
||||||
|
|
||||||
|
|
||||||
<MudDataGrid T="DataModel" ServerData="@(new Func<GridState<DataModel>, Task<GridData<DataModel>>>(ServerReload))"
|
|
||||||
Hover="true" @ref="_gridData" Height="72vh">
|
|
||||||
<ColGroup>
|
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
<col style="width: 58px;" />
|
|
||||||
</ColGroup>
|
|
||||||
<Columns>
|
|
||||||
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
|
||||||
<PropertyColumn Property="x => x.RoleId" Title="نقش">
|
|
||||||
<CellTemplate>
|
|
||||||
<RoleTitleColumn RoleId="@context.Item.RoleId" />
|
|
||||||
</CellTemplate>
|
|
||||||
</PropertyColumn>
|
|
||||||
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
|
||||||
<CellTemplate>
|
|
||||||
<MudStack Row="true" AlignItems="AlignItems.Center">
|
|
||||||
<MudTooltip Text="ویرایش">
|
|
||||||
<MudIconButton Icon="@Icons.Material.Filled.EditNote" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => Update(context.Item.Adapt<DataModel>()))" Style="cursor:pointer;" />
|
|
||||||
</MudTooltip>
|
|
||||||
|
|
||||||
<MudTooltip Text="آرشیو">
|
|
||||||
<MudIconButton Icon="@Icons.Material.Filled.DeleteOutline" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => OnDelete(context.Item))" Style="cursor:pointer;" />
|
|
||||||
</MudTooltip>
|
|
||||||
</MudStack>
|
|
||||||
</CellTemplate>
|
|
||||||
</TemplateColumn>
|
|
||||||
</Columns>
|
|
||||||
<PagerContent>
|
|
||||||
<MudDataGridPager T="DataModel" PageSizeOptions=@(new int[] { 30, 60, 90 }) InfoFormat="سطر {first_item} تا {last_item} از {all_items}" RowsPerPageString="تعداد سطرهای صفحه" />
|
|
||||||
</PagerContent>
|
|
||||||
</MudDataGrid>
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2,36 +2,55 @@
|
|||||||
|
|
||||||
@using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole
|
@using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole
|
||||||
@using BackOffice.Pages.UserRole.Components
|
@using BackOffice.Pages.UserRole.Components
|
||||||
|
@using BackOffice.Common.BaseComponents
|
||||||
|
@using DataModel = BackOffice.BFF.UserRole.Protobuf.Protos.UserRole.GetAllUserRoleByFilterResponseModel
|
||||||
|
|
||||||
<MudStack>
|
<BackOffice.Common.BaseComponents.BasePageComponent @ref="_basePage" OnClearFilterClick="OnFilterCleard" OnSubmitClick="OnFilterSubmit">
|
||||||
<MudPaper Elevation="1" Class="pa-4">
|
<Filters>
|
||||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
<MudNumericField T="long?" HideSpinButtons="true" Clearable="true" Label="شناسه" @bind-Value="@_request.Filter.Id" Variant="Variant.Outlined" Margin="Margin.Dense" />
|
||||||
|
</Filters>
|
||||||
|
<Content>
|
||||||
|
<MudDataGrid T="DataModel" ServerData="@(new Func<GridState<DataModel>, Task<GridData<DataModel>>>(ServerReload))"
|
||||||
|
Hover="true" @ref="_gridData" Height="72vh">
|
||||||
|
<ColGroup>
|
||||||
|
<col />
|
||||||
|
<col />
|
||||||
|
<col style="width: 58px;" />
|
||||||
|
</ColGroup>
|
||||||
|
<ToolBarContent>
|
||||||
<MudText>مدیریت نقش های کاربر</MudText>
|
<MudText>مدیریت نقش های کاربر</MudText>
|
||||||
<MudStack Spacing="2" Row="true" Justify="Justify.Center" AlignItems="AlignItems.Center">
|
<MudStack Spacing="2" Row="true" Justify="Justify.Center" AlignItems="AlignItems.Center">
|
||||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Large" ButtonType="ButtonType.Button" OnClick="CreateNew" Style="cursor:pointer;">افزودن</MudButton>
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" Size="Size.Large" ButtonType="ButtonType.Button" OnClick="CreateNew" Style="cursor:pointer;">افزودن</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
</ToolBarContent>
|
||||||
|
<Columns>
|
||||||
|
<PropertyColumn Property="x => x.Id" Title="شناسه" />
|
||||||
|
<PropertyColumn Property="x => x.RoleId" Title="نقش">
|
||||||
|
<CellTemplate>
|
||||||
|
<RoleTitleColumn RoleId="@context.Item.RoleId" />
|
||||||
|
</CellTemplate>
|
||||||
|
</PropertyColumn>
|
||||||
|
<TemplateColumn StickyLeft="true" Title="عملیات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
|
||||||
|
<CellTemplate>
|
||||||
|
<MudStack Row="true" AlignItems="AlignItems.Center">
|
||||||
|
<MudTooltip Text="ویرایش">
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.EditNote" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => Update(context.Item.Adapt<DataModel>()))" Style="cursor:pointer;" />
|
||||||
|
</MudTooltip>
|
||||||
|
|
||||||
|
<MudTooltip Text="آرشیو">
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.DeleteOutline" Size="Size.Small" ButtonType="ButtonType.Button" OnClick="@(() => OnDelete(context.Item))" Style="cursor:pointer;" />
|
||||||
|
</MudTooltip>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
</MudPaper>
|
</CellTemplate>
|
||||||
<BackOffice.Pages.UserRole.Components.UserRoleDataTable @ref="_table" UserId="UserId" />
|
</TemplateColumn>
|
||||||
</MudStack>
|
</Columns>
|
||||||
|
<PagerContent>
|
||||||
|
<MudDataGridPager T="DataModel" PageSizeOptions=@(new int[] { 30, 60, 90 }) InfoFormat="سطر {first_item} تا {last_item} از {all_items}" RowsPerPageString="تعداد سطرهای صفحه" />
|
||||||
|
</PagerContent>
|
||||||
|
</MudDataGrid>
|
||||||
|
</Content>
|
||||||
|
</BackOffice.Common.BaseComponents.BasePageComponent>
|
||||||
|
|
||||||
|
|
||||||
@code {
|
|
||||||
[Parameter] public long UserId { get; set; }
|
|
||||||
|
|
||||||
private UserRoleDataTable _table;
|
|
||||||
|
|
||||||
public async Task CreateNew()
|
|
||||||
{
|
|
||||||
var dialog = await DialogService.ShowAsync<CreateDialog>($"افزودن نقش های کاربر", new DialogParameters<CreateDialog>() { { x => x.Model, new CreateNewUserRoleRequest() { UserId = UserId } } }, new DialogOptions() { CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.Small });
|
|
||||||
var result = await dialog.Result;
|
|
||||||
if (!result.Canceled)
|
|
||||||
{
|
|
||||||
_table.ReLoadData();
|
|
||||||
Snackbar.Add("عملیات با موفقیت انجام شد", Severity.Success);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,19 @@
|
|||||||
using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole;
|
using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole;
|
||||||
using Google.Protobuf.WellKnownTypes;
|
using BackOffice.Common.BaseComponents;
|
||||||
using HtmlAgilityPack;
|
using BackOffice.Pages.UserRole.Components;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using MudBlazor;
|
using MudBlazor;
|
||||||
using static Google.Rpc.Context.AttributeContext.Types;
|
|
||||||
using DataModel = BackOffice.BFF.UserRole.Protobuf.Protos.UserRole.GetAllUserRoleByFilterResponseModel;
|
using DataModel = BackOffice.BFF.UserRole.Protobuf.Protos.UserRole.GetAllUserRoleByFilterResponseModel;
|
||||||
|
|
||||||
namespace BackOffice.Pages.UserRole.Components;
|
namespace BackOffice.Pages.UserRole;
|
||||||
|
public partial class UserRoleMainPage
|
||||||
public partial class UserRoleDataTable
|
|
||||||
{
|
{
|
||||||
[Parameter] public long UserId { get; set; }
|
[Parameter] public long UserId { get; set; }
|
||||||
[Inject] public UserRoleContract.UserRoleContractClient UserRoleContract { get; set; }
|
[Inject] public UserRoleContract.UserRoleContractClient UserRoleContract { get; set; }
|
||||||
private bool _isLoading = true;
|
private bool _isLoading = true;
|
||||||
private MudDataGrid<DataModel> _gridData;
|
private MudDataGrid<DataModel> _gridData;
|
||||||
|
BasePageComponent _basePage;
|
||||||
private GetAllUserRoleByFilterRequest _request = new() { Filter = new() };
|
private GetAllUserRoleByFilterRequest _request = new() { Filter = new() };
|
||||||
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
|
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
|
||||||
{
|
{
|
||||||
@@ -73,4 +71,28 @@ public partial class UserRoleDataTable
|
|||||||
await _gridData.ReloadServerData();
|
await _gridData.ReloadServerData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task CreateNew()
|
||||||
|
{
|
||||||
|
var dialog = await DialogService.ShowAsync<CreateDialog>($"افزودن نقش های کاربر", new DialogParameters<CreateDialog>() { { x => x.Model, new CreateNewUserRoleRequest() { UserId = UserId } } }, new DialogOptions() { CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.Small });
|
||||||
|
var result = await dialog.Result;
|
||||||
|
if (!result.Canceled)
|
||||||
|
{
|
||||||
|
ReLoadData();
|
||||||
|
Snackbar.Add("عملیات با موفقیت انجام شد", Severity.Success);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public async Task OnFilterSubmit()
|
||||||
|
{
|
||||||
|
_basePage.IsFilterd = true;
|
||||||
|
StateHasChanged();
|
||||||
|
ReLoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OnFilterCleard()
|
||||||
|
{
|
||||||
|
_basePage.IsFilterd = false;
|
||||||
|
StateHasChanged();
|
||||||
|
_request = new() { Filter = new() { } };
|
||||||
|
ReLoadData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
3
src/BackOffice/Pages/_Imports.razor
Normal file
3
src/BackOffice/Pages/_Imports.razor
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
@using BackOffice.BFF.Package.Protobuf.Protos.Package
|
||||||
|
@using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder
|
||||||
|
@using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
</Authorized>
|
</Authorized>
|
||||||
</AuthorizeView>
|
</AuthorizeView>
|
||||||
</MudAppBar>
|
</MudAppBar>
|
||||||
<MudDrawer @bind-Open="@_drawerOpen" Breakpoint="Breakpoint.Lg" Elevation="1" Variant="@DrawerVariant.Responsive">
|
<MudDrawer @bind-Open="@_drawerOpen" Breakpoint="Breakpoint.Lg" Elevation="1" Variant="@DrawerVariant.Temporary" >
|
||||||
<NavMenu />
|
<NavMenu />
|
||||||
</MudDrawer>
|
</MudDrawer>
|
||||||
<MudMainContent>
|
<MudMainContent>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using MudBlazor;
|
|||||||
namespace BackOffice.Shared;
|
namespace BackOffice.Shared;
|
||||||
public partial class MainLayout
|
public partial class MainLayout
|
||||||
{
|
{
|
||||||
bool _drawerOpen = true;
|
bool _drawerOpen = false;
|
||||||
private string Details { get; set; }
|
private string Details { get; set; }
|
||||||
|
|
||||||
void DrawerToggle()
|
void DrawerToggle()
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 78 KiB |
@@ -4,7 +4,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>مدیریت آفرینو</title>
|
<title>مدیریت فرصت</title>
|
||||||
<base href="/" />
|
<base href="/" />
|
||||||
<link href="css/app.css" rel="stylesheet" />
|
<link href="css/app.css" rel="stylesheet" />
|
||||||
<link rel="icon" type="image/png" href="favicon.png" />
|
<link rel="icon" type="image/png" href="favicon.png" />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Afrino",
|
"name": "Foursat",
|
||||||
"short_name": "Afrino",
|
"short_name": "Foursat",
|
||||||
"start_url": "./",
|
"start_url": "./",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"background_color": "#ffffff",
|
"background_color": "#ffffff",
|
||||||
|
|||||||
Reference in New Issue
Block a user