This commit is contained in:
King
2025-10-08 12:38:07 +03:30
parent 9ba4ea1815
commit 868c0dcc11
28 changed files with 614 additions and 555 deletions

View 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>

View File

@@ -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;
}
}

View File

@@ -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>

View File

@@ -2,35 +2,95 @@
@using BackOffice.BFF.Package.Protobuf.Protos.Package
@using BackOffice.Pages.Package.Components
@using BackOffice.Common.BaseComponents
@using DataModel = BackOffice.BFF.Package.Protobuf.Protos.Package.GetAllPackageByFilterResponseModel
<MudStack>
<MudPaper Elevation="1" Class="pa-4">
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
<BackOffice.Common.BaseComponents.BasePageComponent @ref="_basePage" OnClearFilterClick="OnFilterCleard" OnSubmitClick="OnFilterSubmit">
<Filters>
<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>
<MudSpacer />
<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>
</MudStack>
</ToolBarContent>
<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>
</MudPaper>
<BackOffice.Pages.Package.Components.PackageDataTable @ref="_table" />
</MudStack>
@code {
private PackageDataTable _table;
public async Task CreateNew()
</CellTemplate>
</PropertyColumn>
<PropertyColumn Property="x => x.Description" Title="توضیحات" CellStyle="text-wrap: nowrap;" HeaderStyle="text-wrap: nowrap;">
<CellTemplate>
@if (string.IsNullOrWhiteSpace(context.Item.Description))
{
var dialog = await DialogService.ShowAsync<CreateDialog>($"افزودن پکیج", new DialogParameters<CreateDialog>() { { x => x.Model, new CreateNewPackageRequest() } }, new DialogOptions() { CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.Small });
var result = await dialog.Result;
if (!result.Canceled)
<MudText Typo="Typo.inherit">-</MudText>
}
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>
}

View File

@@ -1,21 +1,18 @@
using BackOffice.BFF.Package.Protobuf.Protos.Package;
using Google.Protobuf.WellKnownTypes;
using HtmlAgilityPack;
using BackOffice.Common.BaseComponents;
using BackOffice.Pages.Package.Components;
using Mapster;
using Microsoft.AspNetCore.Components;
using MudBlazor;
using static Google.Rpc.Context.AttributeContext.Types;
using DataModel = BackOffice.BFF.Package.Protobuf.Protos.Package.GetAllPackageByFilterResponseModel;
namespace BackOffice.Pages.Package.Components;
public partial class PackageDataTable
namespace BackOffice.Pages.Package;
public partial class PackageMainPage
{
[Inject] public PackageContract.PackageContractClient PackageContract { get; set; }
private bool _isLoading = true;
private MudDataGrid<DataModel> _gridData;
BasePageComponent _basePage;
private GetAllPackageByFilterRequest _request = new() { Filter = new() };
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
{
@@ -70,12 +67,31 @@ public partial class PackageDataTable
if (_gridData != null)
await _gridData.ReloadServerData();
}
private async Task SearchTitle(string? title)
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 });
var result = await dialog.Result;
if (!result.Canceled)
{
_request.Filter ??= new();
_request.Filter.Title = string.IsNullOrWhiteSpace(title) ? default : title;
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();
}
}

View File

@@ -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>

View File

@@ -2,35 +2,59 @@
@using BackOffice.BFF.Role.Protobuf.Protos.Role
@using BackOffice.Pages.Role.Components
@using BackOffice.Common.BaseComponents
@using DataModel = BackOffice.BFF.Role.Protobuf.Protos.Role.GetAllRoleByFilterResponseModel
<MudStack>
<MudPaper Elevation="1" Class="pa-4">
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
<BackOffice.Common.BaseComponents.BasePageComponent @ref="_basePage" OnClearFilterClick="OnFilterCleard" OnSubmitClick="OnFilterSubmit">
<Filters>
<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>
<MudSpacer />
<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>
</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>
</MudPaper>
<BackOffice.Pages.Role.Components.RoleDataTable @ref="_table" />
</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 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);
}
}
}

View File

@@ -1,17 +1,26 @@
using BackOffice.BFF.Role.Protobuf.Protos.Role;
using Google.Protobuf.WellKnownTypes;
using HtmlAgilityPack;
using BackOffice.Common.BaseComponents;
using BackOffice.Pages.Role.Components;
using Mapster;
using Microsoft.AspNetCore.Components;
using MudBlazor;
using static Google.Rpc.Context.AttributeContext.Types;
using DataModel = BackOffice.BFF.Role.Protobuf.Protos.Role.GetAllRoleByFilterResponseModel;
namespace BackOffice.Pages.Role.Components;
public partial class RoleDataTable
namespace BackOffice.Pages.Role;
public partial class RoleMainPage
{
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; }
private bool _isLoading = true;
private MudDataGrid<DataModel> _gridData;
@@ -70,5 +79,18 @@ public partial class RoleDataTable
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();
}
}

View File

@@ -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>

View File

@@ -2,21 +2,66 @@
@using BackOffice.BFF.User.Protobuf.Protos.User
@using BackOffice.Pages.User.Components
@using BackOffice.Common.BaseComponents
@using DataModel = BackOffice.BFF.User.Protobuf.Protos.User.GetAllUserByFilterResponseModel
<MudStack>
<MudPaper Elevation="1" Class="pa-4">
<BackOffice.Common.BaseComponents.BasePageComponent @ref="_basePage" OnClearFilterClick="OnFilterCleard" OnSubmitClick="OnFilterSubmit">
<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">
<MudText>مدیریت کاربر</MudText>
</MudStack>
</MudPaper>
<BackOffice.Pages.User.Components.UserDataTable @ref="_table" />
</MudStack>
</ToolBarContent>
<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="کدملی" />
@code {
private UserDataTable _table;
<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>
</Content>
</BackOffice.Common.BaseComponents.BasePageComponent>
}

View File

@@ -1,23 +1,17 @@
using BackOffice.BFF.User.Protobuf.Protos.User;
using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole;
using Google.Protobuf.WellKnownTypes;
using HtmlAgilityPack;
using Mapster;
using BackOffice.Common.BaseComponents;
using BackOffice.Pages.User.Components;
using Microsoft.AspNetCore.Components;
using MudBlazor;
using static Google.Rpc.Context.AttributeContext.Types;
using static MudBlazor.CategoryTypes;
using DataModel = BackOffice.BFF.User.Protobuf.Protos.User.GetAllUserByFilterResponseModel;
namespace BackOffice.Pages.User.Components;
public partial class UserDataTable
namespace BackOffice.Pages.User;
public partial class UserMainPage
{
[Inject] public UserContract.UserContractClient UserContract { get; set; }
private bool _isLoading = true;
private MudDataGrid<DataModel> _gridData;
BasePageComponent _basePage;
private GetAllUserByFilterRequest _request = new() { Filter = new() };
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
{
@@ -91,4 +85,18 @@ public partial class UserDataTable
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();
}
}

View File

@@ -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>

View File

@@ -1,36 +1,57 @@
@attribute [Route(RouteConstance.UserAddress+"{UserId:long}")]
@attribute [Route(RouteConstance.UserAddress + "{UserId:long}")]
@using BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress
@using BackOffice.Pages.UserAddress.Components
@using BackOffice.Common.BaseComponents
@using DataModel = BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress.GetAllUserAddressByFilterResponseModel
<MudStack>
<MudPaper Elevation="1" Class="pa-4">
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
<BackOffice.Common.BaseComponents.BasePageComponent @ref="_basePage" OnClearFilterClick="OnFilterCleard" OnSubmitClick="OnFilterSubmit">
<Filters>
<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>
<MudSpacer />
<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>
</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>
</MudPaper>
<BackOffice.Pages.UserAddress.Components.UserAddressDataTable @ref="_table" />
</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 {
[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);
}
}
}

View File

@@ -1,21 +1,19 @@
using BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress;
using Google.Protobuf.WellKnownTypes;
using HtmlAgilityPack;
using BackOffice.Common.BaseComponents;
using BackOffice.Pages.UserAddress.Components;
using Mapster;
using Microsoft.AspNetCore.Components;
using MudBlazor;
using static Google.Rpc.Context.AttributeContext.Types;
using DataModel = BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress.GetAllUserAddressByFilterResponseModel;
namespace BackOffice.Pages.UserAddress.Components;
public partial class UserAddressDataTable
namespace BackOffice.Pages.UserAddress;
public partial class UserAddressMainPage
{
[Parameter] public long UserId { get; set; }
[Inject] public UserAddressContract.UserAddressContractClient UserAddressContract { get; set; }
private bool _isLoading = true;
private MudDataGrid<DataModel> _gridData;
BasePageComponent _basePage;
private GetAllUserAddressByFilterRequest _request = new() { Filter = new() };
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
{
@@ -73,5 +71,28 @@ public partial class UserAddressDataTable
if (_gridData != null)
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();
}
}

View File

@@ -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>


View File

@@ -13,50 +13,6 @@ public partial class UserOrderDataTable
{
[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();
}
}

View File

@@ -2,22 +2,67 @@
@using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder
@using BackOffice.Pages.UserOrder.Components
@using BackOffice.Common.BaseComponents
@using DataModel = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder.GetAllUserOrderByFilterResponseModel
<MudStack>
<MudPaper Elevation="1" Class="pa-4">
<BackOffice.Common.BaseComponents.BasePageComponent @ref="_basePage" OnClearFilterClick="OnFilterCleard" OnSubmitClick="OnFilterSubmit">
<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">
<MudText>فاکتور</MudText>
</MudStack>
</MudPaper>
<BackOffice.Pages.UserOrder.Components.UserOrderDataTable UserId="UserId" @ref="_table" />
</MudStack>
</ToolBarContent>
<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;" />
@code {
[Parameter] public long UserId { get; set; }
private UserOrderDataTable _table;
}
<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>

View 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();
}
}

View File

@@ -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>

View File

@@ -2,36 +2,55 @@
@using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole
@using BackOffice.Pages.UserRole.Components
@using BackOffice.Common.BaseComponents
@using DataModel = BackOffice.BFF.UserRole.Protobuf.Protos.UserRole.GetAllUserRoleByFilterResponseModel
<MudStack>
<MudPaper Elevation="1" Class="pa-4">
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
<BackOffice.Common.BaseComponents.BasePageComponent @ref="_basePage" OnClearFilterClick="OnFilterCleard" OnSubmitClick="OnFilterSubmit">
<Filters>
<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>
<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>
</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>
</MudPaper>
<BackOffice.Pages.UserRole.Components.UserRoleDataTable @ref="_table" UserId="UserId" />
</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 {
[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);
}
}
}

View File

@@ -1,21 +1,19 @@
using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole;
using Google.Protobuf.WellKnownTypes;
using HtmlAgilityPack;
using BackOffice.Common.BaseComponents;
using BackOffice.Pages.UserRole.Components;
using Mapster;
using Microsoft.AspNetCore.Components;
using MudBlazor;
using static Google.Rpc.Context.AttributeContext.Types;
using DataModel = BackOffice.BFF.UserRole.Protobuf.Protos.UserRole.GetAllUserRoleByFilterResponseModel;
namespace BackOffice.Pages.UserRole.Components;
public partial class UserRoleDataTable
namespace BackOffice.Pages.UserRole;
public partial class UserRoleMainPage
{
[Parameter] public long UserId { get; set; }
[Inject] public UserRoleContract.UserRoleContractClient UserRoleContract { get; set; }
private bool _isLoading = true;
private MudDataGrid<DataModel> _gridData;
BasePageComponent _basePage;
private GetAllUserRoleByFilterRequest _request = new() { Filter = new() };
private async Task<GridData<DataModel>> ServerReload(GridState<DataModel> state)
{
@@ -73,4 +71,28 @@ public partial class UserRoleDataTable
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();
}
}

View 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

View File

@@ -22,7 +22,7 @@
</Authorized>
</AuthorizeView>
</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 />
</MudDrawer>
<MudMainContent>

View File

@@ -5,7 +5,7 @@ using MudBlazor;
namespace BackOffice.Shared;
public partial class MainLayout
{
bool _drawerOpen = true;
bool _drawerOpen = false;
private string Details { get; set; }
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

View File

@@ -4,7 +4,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>مدیریت آفرینو</title>
<title>مدیریت فرصت</title>
<base href="/" />
<link href="css/app.css" rel="stylesheet" />
<link rel="icon" type="image/png" href="favicon.png" />

View File

@@ -1,6 +1,6 @@
{
"name": "Afrino",
"short_name": "Afrino",
"name": "Foursat",
"short_name": "Foursat",
"start_url": "./",
"display": "standalone",
"background_color": "#ffffff",