Update
This commit is contained in:
@@ -22,6 +22,16 @@
|
||||
<PackageReference Include="Foursat.BackOffice.BFF.Otp.Protobuf" Version="0.0.111" />
|
||||
|
||||
<PackageReference Include="FourSat.BackOffice.BFF.Package.Protobuf" Version="0.0.111" />
|
||||
|
||||
<PackageReference Include="Foursat.BackOffice.BFF.Role.Protobuf" Version="0.0.111" />
|
||||
|
||||
<PackageReference Include="Foursat.BackOffice.BFF.User.Protobuf" Version="0.0.111" />
|
||||
|
||||
<PackageReference Include="Foursat.BackOffice.BFF.UserAddress.Protobuf" Version="0.0.111" />
|
||||
|
||||
<PackageReference Include="Foursat.BackOffice.BFF.UserOrder.Protobuf" Version="0.0.111" />
|
||||
|
||||
<PackageReference Include="Foursat.BackOffice.BFF.UserRole.Protobuf" Version="0.0.111" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.12.1" />
|
||||
<PackageReference Include="DateTimeConverterCL" Version="1.0.0" />
|
||||
<PackageReference Include="Grpc.Core" Version="2.46.6" />
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
|
||||
using BackOffice.BFF.Otp.Protobuf.Protos.Otp;
|
||||
using BackOffice.BFF.Package.Protobuf.Protos.Package;
|
||||
using BackOffice.BFF.Role.Protobuf.Protos.Role;
|
||||
using BackOffice.BFF.User.Protobuf.Protos.User;
|
||||
using BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress;
|
||||
using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
|
||||
using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole;
|
||||
using BackOffice.Common.Utilities;
|
||||
using Blazored.LocalStorage;
|
||||
using Google.Protobuf.Reflection;
|
||||
@@ -54,8 +60,13 @@ public static class ConfigureServices
|
||||
|
||||
|
||||
|
||||
services.AddTransient(sp => new OtpContract.OtpContractClient(channel));
|
||||
services.AddTransient(sp => new PackageContract.PackageContractClient(channel));
|
||||
//services.AddTransient(sp => new OtpContract.OtpContractClient(channel));
|
||||
services.AddTransient(sp => new RoleContract.RoleContractClient(channel));
|
||||
services.AddTransient(sp => new UserContract.UserContractClient(channel));
|
||||
services.AddTransient(sp => new UserAddressContract.UserAddressContractClient(channel));
|
||||
services.AddTransient(sp => new UserOrderContract.UserOrderContractClient(channel));
|
||||
services.AddTransient(sp => new UserRoleContract.UserRoleContractClient(channel));
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
@@ -6,4 +6,9 @@ public static class RouteConstance
|
||||
public const string Login = "/Login/";
|
||||
public const string VerifyCodePage = "/VerifyCodePage/";
|
||||
public const string Package = "/PackagePage/";
|
||||
public const string Role = "/RolePage/";
|
||||
public const string UserPage = "/UserPage/";
|
||||
public const string UserOrder = "/UserOrderPage/";
|
||||
public const string UserRole = "/UserRolePage/";
|
||||
public const string UserAddress = "/UserAddressPage/";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
@using BackOffice.BFF.Role.Protobuf.Protos.Role
|
||||
|
||||
<MudAutocomplete T="GetAllRoleByFilterResponseModel"
|
||||
Label="@Label"
|
||||
Value="@_item"
|
||||
DebounceInterval="700"
|
||||
ValueChanged="@((e) => OnSelected(e))"
|
||||
ToStringFunc="@(e=> e == null ? null : $"{e.Title} {e.Name}")"
|
||||
SearchFunc="@Search"
|
||||
Variant="Variant.Outlined"
|
||||
Clearable="true"
|
||||
ShowProgressIndicator="true"
|
||||
CoerceText="false"
|
||||
OnClearButtonClick="()=> OnSelected(null)"/>
|
||||
@@ -0,0 +1,75 @@
|
||||
using BackOffice.BFF.Role.Protobuf.Protos.Role;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace BackOffice.Pages.AutoComplete;
|
||||
|
||||
public partial class RoleAutoComplete
|
||||
{
|
||||
[Inject] public RoleContract.RoleContractClient RoleService { get; set; }
|
||||
[Parameter] public long? Value { get; set; }
|
||||
[Parameter] public string? Label { get; set; } = "نقش";
|
||||
[Parameter] public EventCallback<long?> ValueChanged { get; set; }
|
||||
private List<GetAllRoleByFilterResponseModel> _items = new();
|
||||
private GetAllRoleByFilterResponseModel _item;
|
||||
protected override async void OnParametersSet()
|
||||
{
|
||||
await base.OnParametersSetAsync();
|
||||
if (Value > 0)
|
||||
{
|
||||
var getAll = await RoleService.GetAllRoleByFilterAsync(new()
|
||||
{
|
||||
Filter = new()
|
||||
{
|
||||
Id = Value
|
||||
},
|
||||
PaginationState = new()
|
||||
{
|
||||
PageNumber = 1,
|
||||
PageSize = 1
|
||||
}
|
||||
});
|
||||
if (getAll != null && getAll.Models != null && getAll.Models.Any())
|
||||
{
|
||||
_item = getAll.Models.First();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
private async Task OnSelected(GetAllRoleByFilterResponseModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
_item = null;
|
||||
await ValueChanged.InvokeAsync(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
_item = model;
|
||||
await ValueChanged.InvokeAsync(model.Id);
|
||||
}
|
||||
}
|
||||
private async Task<IEnumerable<GetAllRoleByFilterResponseModel>> Search(string value, CancellationToken token)
|
||||
{
|
||||
var getAll = await RoleService.GetAllRoleByFilterAsync(new()
|
||||
{
|
||||
Filter = new()
|
||||
{
|
||||
Title = value
|
||||
},
|
||||
PaginationState = new()
|
||||
{
|
||||
PageNumber = 1,
|
||||
PageSize = 9
|
||||
}
|
||||
});
|
||||
if (getAll != null && getAll.Models != null)
|
||||
_items = getAll.Models.ToList();
|
||||
|
||||
return _items;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,20 @@
|
||||
@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">
|
||||
|
||||
@@ -70,5 +70,12 @@ public partial class PackageDataTable
|
||||
if (_gridData != null)
|
||||
await _gridData.ReloadServerData();
|
||||
}
|
||||
private async Task SearchTitle(string? title)
|
||||
{
|
||||
_request.Filter ??= new();
|
||||
_request.Filter.Title = string.IsNullOrWhiteSpace(title) ? default : title;
|
||||
ReLoadData();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
@using BackOffice.BFF.Package.Protobuf.Protos.Package
|
||||
@using BackOffice.Common.BaseComponents
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Tizzani.MudBlazor.HtmlEditor
|
||||
|
||||
<MudDialog>
|
||||
<DialogContent>
|
||||
<MudStack>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" @bind-Value="Model.Title" Disabled="_isLoading" Label="عنوان" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" @bind-Value="Model.Name" Disabled="_isLoading" Label="عنوان لاتین" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
</MudStack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<MudButton OnClick="Cancel" Disabled="_isLoading">لغو</MudButton>
|
||||
<MudButton Color="Color.Primary" OnClick="CallCreateMethod" Disabled="_isLoading">ثبت </MudButton>
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,39 @@
|
||||
@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>
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
using BackOffice.BFF.Role.Protobuf.Protos.Role;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using HtmlAgilityPack;
|
||||
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
|
||||
{
|
||||
|
||||
[Inject] public RoleContract.RoleContractClient RoleContract { get; set; }
|
||||
private bool _isLoading = true;
|
||||
private MudDataGrid<DataModel> _gridData;
|
||||
|
||||
private GetAllRoleByFilterRequest _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;
|
||||
|
||||
var result = await RoleContract.GetAllRoleByFilterAsync(_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>();
|
||||
}
|
||||
public async Task Update(DataModel model)
|
||||
{
|
||||
var parameters = new DialogParameters<UpdateDialog> { { x => x.Model, model.Adapt<UpdateRoleRequest>() } };
|
||||
|
||||
var dialog = await DialogService.ShowAsync<UpdateDialog>($"ویرایش نقش", parameters, new DialogOptions() { CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.Small });
|
||||
var result = await dialog.Result;
|
||||
|
||||
if (!result.Canceled)
|
||||
{
|
||||
ReLoadData();
|
||||
//Reload Data
|
||||
Snackbar.Add("عملیات با موفقیت انجام شد", Severity.Success);
|
||||
|
||||
}
|
||||
}
|
||||
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 RoleContract.DeleteRoleAsync(new()
|
||||
{
|
||||
Id = model.Id
|
||||
});
|
||||
ReLoadData();
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
public async void ReLoadData()
|
||||
{
|
||||
if (_gridData != null)
|
||||
await _gridData.ReloadServerData();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
@using BackOffice.BFF.Package.Protobuf.Protos.Package
|
||||
@using BackOffice.Common.BaseComponents
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Tizzani.MudBlazor.HtmlEditor
|
||||
|
||||
|
||||
<MudDialog>
|
||||
<DialogContent>
|
||||
<MudStack>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" @bind-Value="Model.Title" Disabled="_isLoading" Label="عنوان" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" @bind-Value="Model.Name" Disabled="_isLoading" Label="عنوان لاتین" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
</MudStack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<MudButton OnClick="Cancel" Disabled="_isLoading">لغو</MudButton>
|
||||
<MudButton Color="Color.Primary" OnClick="CallUpdateMethod" Disabled="_isLoading">ثبت</MudButton>
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
using BackOffice.BFF.Role.Protobuf.Protos.Role;
|
||||
using Google.Protobuf;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using MudBlazor;
|
||||
|
||||
namespace BackOffice.Pages.Role.Components
|
||||
{
|
||||
public partial class UpdateDialog
|
||||
{
|
||||
private bool _isLoading = false;
|
||||
[Inject] public RoleContract.RoleContractClient RoleContract { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public UpdateRoleRequest Model { get; set; } = new();
|
||||
|
||||
[CascadingParameter]
|
||||
MudDialogInstance MudDialog { get; set; }
|
||||
|
||||
public async void CallUpdateMethod()
|
||||
{
|
||||
_isLoading = true;
|
||||
StateHasChanged();
|
||||
if (string.IsNullOrWhiteSpace(Model.Title))
|
||||
{
|
||||
Snackbar.Add("لطفا عنوان را وارد کنید!", Severity.Warning);
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(Model.Name))
|
||||
{
|
||||
Snackbar.Add("لطفا عنوان لاتین را وارد کنید!", Severity.Warning);
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
await RoleContract.UpdateRoleAsync(Model);
|
||||
Submit();
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Snackbar.Add("خطای سرور", Severity.Error);
|
||||
}
|
||||
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
void Submit() => MudDialog.Close(DialogResult.Ok(true));
|
||||
void Cancel() => MudDialog.Cancel();
|
||||
}
|
||||
}
|
||||
36
src/BackOffice/BackOffice/Pages/Role/RoleMainPage.razor
Normal file
36
src/BackOffice/BackOffice/Pages/Role/RoleMainPage.razor
Normal file
@@ -0,0 +1,36 @@
|
||||
@attribute [Route(RouteConstance.Role)]
|
||||
|
||||
@using BackOffice.BFF.Role.Protobuf.Protos.Role
|
||||
@using BackOffice.Pages.Role.Components
|
||||
|
||||
<MudStack>
|
||||
<MudPaper Elevation="1" Class="pa-4">
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
||||
<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>
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
<BackOffice.Pages.Role.Components.RoleDataTable @ref="_table" />
|
||||
</MudStack>
|
||||
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
@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>
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
using BackOffice.BFF.User.Protobuf.Protos.User;
|
||||
using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using HtmlAgilityPack;
|
||||
using Mapster;
|
||||
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
|
||||
{
|
||||
|
||||
[Inject] public UserContract.UserContractClient UserContract { get; set; }
|
||||
private bool _isLoading = true;
|
||||
private MudDataGrid<DataModel> _gridData;
|
||||
|
||||
private GetAllUserByFilterRequest _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;
|
||||
|
||||
var result = await UserContract.GetAllUserByFilterAsync(_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 UserContract.DeleteUserAsync(new()
|
||||
{
|
||||
Id = model.Id
|
||||
});
|
||||
ReLoadData();
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
public async void ReLoadData()
|
||||
{
|
||||
if (_gridData != null)
|
||||
await _gridData.ReloadServerData();
|
||||
}
|
||||
private async Task Searchfirstname(string? firstname)
|
||||
{
|
||||
_request.Filter ??= new();
|
||||
_request.Filter.FirstName = string.IsNullOrWhiteSpace(firstname) ? default : firstname;
|
||||
ReLoadData();
|
||||
}
|
||||
private async Task Searchlastname(string? lastname)
|
||||
{
|
||||
_request.Filter ??= new();
|
||||
_request.Filter.LastName = string.IsNullOrWhiteSpace(lastname) ? default : lastname;
|
||||
ReLoadData();
|
||||
}
|
||||
private async Task SearchNationalCode(string? nationalcode)
|
||||
{
|
||||
_request.Filter ??= new();
|
||||
_request.Filter.NationalCode = string.IsNullOrWhiteSpace(nationalcode) ? default : nationalcode;
|
||||
ReLoadData();
|
||||
}
|
||||
private async Task SearchMobile(string? mobile)
|
||||
{
|
||||
_request.Filter ??= new();
|
||||
_request.Filter.Mobile = string.IsNullOrWhiteSpace(mobile) ? default : mobile;
|
||||
ReLoadData();
|
||||
}
|
||||
public async Task OnclickUserRoleDialog(long userid)
|
||||
{
|
||||
var dialog = await DialogService.ShowAsync<UserRoleDialog>($"نقش های کاربر", new DialogParameters<UserRoleDialog>() { { x => x.UserId, userid } }, new DialogOptions() { CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.Small });
|
||||
var result = await dialog.Result;
|
||||
if (!result.Canceled)
|
||||
{
|
||||
ReLoadData();
|
||||
Snackbar.Add("عملیات با موفقیت انجام شد", Severity.Success);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
@using BackOffice.BFF.Role.Protobuf.Protos.Role
|
||||
<MudDialog>
|
||||
<DialogContent>
|
||||
@if (_isFirstLoad)
|
||||
{
|
||||
<MudStack Justify="Justify.Center" AlignItems="AlignItems.Center">
|
||||
<MudProgressCircular Color="Color.Primary" Indeterminate="true" />
|
||||
</MudStack>
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudStack>
|
||||
@foreach (var item in _roleresponse.Models.OrderBy(x=>x.Name).ToList())
|
||||
{
|
||||
|
||||
<MudCheckBox T="bool" Label="@item.Name" LabelPosition="LabelPosition.End" Color="Color.Primary" Value="@(_selectedRole.Any(x=>x == item.Id))" ValueChanged="(e)=>OnChackedChange(e,item.Id)"></MudCheckBox>
|
||||
}
|
||||
</MudStack>
|
||||
}
|
||||
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<MudButton Color="Color.Primary" OnClick="Cancel">بستن</MudButton>
|
||||
<MudButton Color="Color.Primary" Variant="Variant.Filled" Disabled="_isLoading" OnClick="@(async () => await AddItem())">ثبت</MudButton>
|
||||
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
@@ -0,0 +1,68 @@
|
||||
using BackOffice.BFF.Role.Protobuf.Protos.Role;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
using BackOffice.BFF.User.Protobuf.Protos.User;
|
||||
using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole;
|
||||
|
||||
namespace BackOffice.Pages.User.Components;
|
||||
public partial class UserRoleDialog
|
||||
{
|
||||
[Parameter] public long UserId { get; set; }
|
||||
[CascadingParameter] MudDialogInstance MudDialog { get; set; }
|
||||
MudForm _form;
|
||||
private bool _isLoading;
|
||||
private bool _isFirstLoad = true;
|
||||
[Inject] public RoleContract.RoleContractClient RoleService { get; set; }
|
||||
[Inject] public UserRoleContract.UserRoleContractClient UserRoleService { get; set; }
|
||||
private GetAllUserRoleByFilterResponse _userRoleresponse = new();
|
||||
private GetAllRoleByFilterResponse _roleresponse = new();
|
||||
private List<long> _selectedRole = new();
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
|
||||
_roleresponse = await RoleService.GetAllRoleByFilterAsync(new());
|
||||
_userRoleresponse = await UserRoleService.GetAllUserRoleByFilterAsync(new() { Filter = new() { UserId = UserId } });
|
||||
|
||||
_selectedRole.AddRange(_userRoleresponse.Models.Select(s => s.RoleId));
|
||||
|
||||
_isFirstLoad = false;
|
||||
}
|
||||
private async Task AddItem()
|
||||
{
|
||||
_isLoading = true;
|
||||
StateHasChanged();
|
||||
if (_userRoleresponse != null && _userRoleresponse.Models != null && _userRoleresponse.Models.Any())
|
||||
{
|
||||
foreach (var item in _userRoleresponse.Models)
|
||||
{
|
||||
await UserRoleService.DeleteUserRoleAsync(new() { Id = item.Id });
|
||||
|
||||
}
|
||||
}
|
||||
foreach (var item in _selectedRole)
|
||||
{
|
||||
await UserRoleService.CreateNewUserRoleAsync(new() { UserId = UserId, RoleId = item });
|
||||
|
||||
}
|
||||
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
|
||||
MudDialog.Close(DialogResult.Ok(true));
|
||||
}
|
||||
private void OnChackedChange(bool check, long id)
|
||||
{
|
||||
if (check)
|
||||
{
|
||||
if (!_selectedRole.Any(x => x == id))
|
||||
_selectedRole.Add(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_selectedRole.Any(x => x == id))
|
||||
_selectedRole.Remove(id);
|
||||
}
|
||||
}
|
||||
void Cancel() => MudDialog.Cancel();
|
||||
}
|
||||
22
src/BackOffice/BackOffice/Pages/User/UserMainPage.razor
Normal file
22
src/BackOffice/BackOffice/Pages/User/UserMainPage.razor
Normal file
@@ -0,0 +1,22 @@
|
||||
@attribute [Route(RouteConstance.UserPage)]
|
||||
|
||||
@using BackOffice.BFF.User.Protobuf.Protos.User
|
||||
@using BackOffice.Pages.User.Components
|
||||
|
||||
<MudStack>
|
||||
<MudPaper Elevation="1" Class="pa-4">
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
||||
<MudText>مدیریت کاربر</MudText>
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
<BackOffice.Pages.User.Components.UserDataTable @ref="_table" />
|
||||
</MudStack>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
private UserDataTable _table;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
@using BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress
|
||||
@using BackOffice.Common.BaseComponents
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Tizzani.MudBlazor.HtmlEditor
|
||||
|
||||
<MudDialog>
|
||||
<DialogContent>
|
||||
<MudStack>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" @bind-Value="Model.Title" Disabled="_isLoading" Label="عنوان" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" @bind-Value="Model.Address" Disabled="_isLoading" Label="آدرس" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" @bind-Value="Model.PostalCode" Disabled="_isLoading" Label="کد پستی" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudSwitch @bind-Value="Model.IsDefault" Color="Color.Primary" Label="ایا پیش فرض است" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
|
||||
</MudStack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<MudButton OnClick="Cancel" Disabled="_isLoading">لغو</MudButton>
|
||||
<MudButton Color="Color.Primary" OnClick="CallCreateMethod" Disabled="_isLoading">ثبت </MudButton>
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
using BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress;
|
||||
using Google.Protobuf;
|
||||
using Grpc.Core;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using MudBlazor;
|
||||
|
||||
namespace BackOffice.Pages.UserAddress.Components;
|
||||
|
||||
public partial class CreateDialog
|
||||
{
|
||||
[Inject] public UserAddressContract.UserAddressContractClient UserAddressContract { get; set; }
|
||||
[Parameter] public CreateNewUserAddressRequest Model { get; set; } = new();
|
||||
[CascadingParameter] MudDialogInstance MudDialog { get; set; }
|
||||
|
||||
private bool _isLoading = false;
|
||||
|
||||
public async void CallCreateMethod()
|
||||
{
|
||||
_isLoading = true;
|
||||
StateHasChanged();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(Model.Title))
|
||||
{
|
||||
Snackbar.Add("لطفا عنوان را وارد کنید!", Severity.Warning);
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(Model.Address))
|
||||
{
|
||||
Snackbar.Add("لطفا ادرس را وارد کنید!", Severity.Warning);
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(Model.PostalCode))
|
||||
{
|
||||
Snackbar.Add("لطفا کد پستی را وارد کنید!", Severity.Warning);
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
await UserAddressContract.CreateNewUserAddressAsync(Model);
|
||||
Submit();
|
||||
|
||||
}
|
||||
catch (RpcException ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
Snackbar.Add("خطای سرور", Severity.Error);
|
||||
}
|
||||
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
void Submit() => MudDialog.Close(DialogResult.Ok(true));
|
||||
void Cancel() => MudDialog.Cancel();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
@using BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress
|
||||
@using BackOffice.Common.BaseComponents
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Tizzani.MudBlazor.HtmlEditor
|
||||
|
||||
|
||||
<MudDialog>
|
||||
<DialogContent>
|
||||
<MudStack>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" @bind-Value="Model.Title" Disabled="_isLoading" Label="عنوان" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" @bind-Value="Model.Address" Disabled="_isLoading" Label="آدرس" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField T="string" @bind-Value="Model.PostalCode" Disabled="_isLoading" Label="کد پستی" Variant="Variant.Outlined" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudSwitch @bind-Value="Model.IsDefault" Color="Color.Primary" Label="ایا پیش فرض است" LabelPosition="LabelPosition.End" />
|
||||
</MudItem>
|
||||
</MudStack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<MudButton OnClick="Cancel" Disabled="_isLoading">لغو</MudButton>
|
||||
<MudButton Color="Color.Primary" OnClick="CallUpdateMethod" Disabled="_isLoading">ثبت</MudButton>
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
using BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress;
|
||||
using Google.Protobuf;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using MudBlazor;
|
||||
|
||||
namespace BackOffice.Pages.UserAddress.Components
|
||||
{
|
||||
public partial class UpdateDialog
|
||||
{
|
||||
private bool _isLoading = false;
|
||||
[Inject] public UserAddressContract.UserAddressContractClient UserAddressContract { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public UpdateUserAddressRequest Model { get; set; } = new();
|
||||
|
||||
[CascadingParameter]
|
||||
MudDialogInstance MudDialog { get; set; }
|
||||
public async void CallUpdateMethod()
|
||||
{
|
||||
_isLoading = true;
|
||||
StateHasChanged();
|
||||
if (string.IsNullOrWhiteSpace(Model.Title))
|
||||
{
|
||||
Snackbar.Add("لطفا عنوان را وارد کنید!", Severity.Warning);
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(Model.Address))
|
||||
{
|
||||
Snackbar.Add("لطفا ادرس را وارد کنید!", Severity.Warning);
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(Model.PostalCode))
|
||||
{
|
||||
Snackbar.Add("لطفا کد پستی را وارد کنید!", Severity.Warning);
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await UserAddressContract.UpdateUserAddressAsync(Model);
|
||||
Submit();
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Snackbar.Add("خطای سرور", Severity.Error);
|
||||
}
|
||||
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
void Submit() => MudDialog.Close(DialogResult.Ok(true));
|
||||
void Cancel() => MudDialog.Cancel();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
@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>
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
using BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using HtmlAgilityPack;
|
||||
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
|
||||
{
|
||||
[Parameter] public long UserId { get; set; }
|
||||
[Inject] public UserAddressContract.UserAddressContractClient UserAddressContract { get; set; }
|
||||
private bool _isLoading = true;
|
||||
private MudDataGrid<DataModel> _gridData;
|
||||
|
||||
private GetAllUserAddressByFilterRequest _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 UserAddressContract.GetAllUserAddressByFilterAsync(_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>();
|
||||
}
|
||||
public async Task Update(DataModel model)
|
||||
{
|
||||
var parameters = new DialogParameters<UpdateDialog> { { x => x.Model, model.Adapt<UpdateUserAddressRequest>() } };
|
||||
|
||||
var dialog = await DialogService.ShowAsync<UpdateDialog>($"ویرایش آدرس", parameters, new DialogOptions() { CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.Small });
|
||||
var result = await dialog.Result;
|
||||
|
||||
if (!result.Canceled)
|
||||
{
|
||||
ReLoadData();
|
||||
//Reload Data
|
||||
Snackbar.Add("عملیات با موفقیت انجام شد", Severity.Success);
|
||||
|
||||
}
|
||||
}
|
||||
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 UserAddressContract.DeleteUserAddressAsync(new()
|
||||
{
|
||||
Id = model.Id
|
||||
});
|
||||
ReLoadData();
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
public async void ReLoadData()
|
||||
{
|
||||
if (_gridData != null)
|
||||
await _gridData.ReloadServerData();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
@attribute [Route(RouteConstance.UserAddress+"{UserId:long}")]
|
||||
|
||||
@using BackOffice.BFF.UserAddress.Protobuf.Protos.UserAddress
|
||||
@using BackOffice.Pages.UserAddress.Components
|
||||
|
||||
<MudStack>
|
||||
<MudPaper Elevation="1" Class="pa-4">
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
||||
<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>
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
<BackOffice.Pages.UserAddress.Components.UserAddressDataTable @ref="_table" />
|
||||
</MudStack>
|
||||
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
@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>
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using HtmlAgilityPack;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
using static Google.Rpc.Context.AttributeContext.Types;
|
||||
using DataModel = BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder.GetAllUserOrderByFilterResponseModel;
|
||||
|
||||
namespace BackOffice.Pages.UserOrder.Components;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
@attribute [Route(RouteConstance.UserOrder + "{UserId:long}")]
|
||||
|
||||
@using BackOffice.BFF.UserOrder.Protobuf.Protos.UserOrder
|
||||
@using BackOffice.Pages.UserOrder.Components
|
||||
|
||||
<MudStack>
|
||||
<MudPaper Elevation="1" Class="pa-4">
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
||||
<MudText>فاکتور</MudText>
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
<BackOffice.Pages.UserOrder.Components.UserOrderDataTable UserId="UserId" @ref="_table" />
|
||||
</MudStack>
|
||||
|
||||
|
||||
@code {
|
||||
[Parameter] public long UserId { get; set; }
|
||||
|
||||
private UserOrderDataTable _table;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
@using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole
|
||||
@using BackOffice.Common.BaseComponents
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Tizzani.MudBlazor.HtmlEditor
|
||||
|
||||
<MudDialog>
|
||||
<DialogContent>
|
||||
<MudStack>
|
||||
|
||||
<MudItem xs="12">
|
||||
<BackOffice.Pages.AutoComplete.RoleAutoComplete ValueChanged="@(x=> Model.RoleId = x.Value )" />
|
||||
</MudItem>
|
||||
|
||||
</MudStack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<MudButton OnClick="Cancel" Disabled="_isLoading">لغو</MudButton>
|
||||
<MudButton Color="Color.Primary" OnClick="CallCreateMethod" Disabled="_isLoading">ثبت </MudButton>
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole;
|
||||
using Google.Protobuf;
|
||||
using Grpc.Core;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using MudBlazor;
|
||||
|
||||
namespace BackOffice.Pages.UserRole.Components;
|
||||
|
||||
public partial class CreateDialog
|
||||
{
|
||||
[Inject] public UserRoleContract.UserRoleContractClient UserRoleContract { get; set; }
|
||||
[Parameter] public CreateNewUserRoleRequest Model { get; set; } = new();
|
||||
[CascadingParameter] MudDialogInstance MudDialog { get; set; }
|
||||
|
||||
private bool _isLoading = false;
|
||||
|
||||
public async void CallCreateMethod()
|
||||
{
|
||||
_isLoading = true;
|
||||
StateHasChanged();
|
||||
|
||||
if (Model.RoleId <= 0)
|
||||
{
|
||||
Snackbar.Add("لطفا نقش را وارد کنید!", Severity.Warning);
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
await UserRoleContract.CreateNewUserRoleAsync(Model);
|
||||
Submit();
|
||||
|
||||
}
|
||||
catch (RpcException ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
Snackbar.Add("خطای سرور", Severity.Error);
|
||||
}
|
||||
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
void Submit() => MudDialog.Close(DialogResult.Ok(true));
|
||||
void Cancel() => MudDialog.Cancel();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
@if (getRoleResponse == null || getRoleResponse.Id < 0)
|
||||
{
|
||||
if (_isLoading)
|
||||
{
|
||||
<MudSkeleton Height="70" Width="50" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudText>-</MudText>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
<MudText Style="text-wrap: nowrap;" Typo="Typo.inherit">@($"{getRoleResponse.Title}")</MudText>
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using BackOffice.BFF.Role.Protobuf.Protos.Role;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace BackOffice.Pages.UserRole.Components;
|
||||
public partial class RoleTitleColumn
|
||||
{
|
||||
[Parameter]
|
||||
public long RoleId { get; set; }
|
||||
|
||||
[Inject] public RoleContract.RoleContractClient RoleService { get; set; }
|
||||
|
||||
private GetRoleResponse getRoleResponse = new();
|
||||
private bool _isLoading = true;
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
await base.OnAfterRenderAsync(firstRender);
|
||||
if (firstRender)
|
||||
{
|
||||
|
||||
getRoleResponse = await RoleService.GetRoleAsync(new()
|
||||
{
|
||||
Id = RoleId
|
||||
});
|
||||
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
@using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole
|
||||
@using BackOffice.Common.BaseComponents
|
||||
@using Microsoft.AspNetCore.Components.Forms
|
||||
@using Tizzani.MudBlazor.HtmlEditor
|
||||
|
||||
|
||||
<MudDialog>
|
||||
<DialogContent>
|
||||
<MudStack>
|
||||
|
||||
<MudItem xs="12">
|
||||
<BackOffice.Pages.AutoComplete.RoleAutoComplete ValueChanged="@(x => Model.RoleId = x.Value)" />
|
||||
</MudItem>
|
||||
</MudStack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<MudButton OnClick="Cancel" Disabled="_isLoading">لغو</MudButton>
|
||||
<MudButton Color="Color.Primary" OnClick="CallUpdateMethod" Disabled="_isLoading">ثبت</MudButton>
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole;
|
||||
using Google.Protobuf;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using MudBlazor;
|
||||
|
||||
namespace BackOffice.Pages.UserRole.Components
|
||||
{
|
||||
public partial class UpdateDialog
|
||||
{
|
||||
private bool _isLoading = false;
|
||||
[Inject] public UserRoleContract.UserRoleContractClient UserRoleContract { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public UpdateUserRoleRequest Model { get; set; } = new();
|
||||
|
||||
[CascadingParameter]
|
||||
MudDialogInstance MudDialog { get; set; }
|
||||
|
||||
public async void CallUpdateMethod()
|
||||
{
|
||||
_isLoading = true;
|
||||
StateHasChanged();
|
||||
if (Model.RoleId <= 0)
|
||||
{
|
||||
Snackbar.Add("لطفا نقش را وارد کنید!", Severity.Warning);
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await UserRoleContract.UpdateUserRoleAsync(Model);
|
||||
Submit();
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Snackbar.Add("خطای سرور", Severity.Error);
|
||||
}
|
||||
|
||||
_isLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
void Submit() => MudDialog.Close(DialogResult.Ok(true));
|
||||
void Cancel() => MudDialog.Cancel();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
@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>
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using HtmlAgilityPack;
|
||||
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
|
||||
{
|
||||
[Parameter] public long UserId { get; set; }
|
||||
[Inject] public UserRoleContract.UserRoleContractClient UserRoleContract { get; set; }
|
||||
private bool _isLoading = true;
|
||||
private MudDataGrid<DataModel> _gridData;
|
||||
|
||||
private GetAllUserRoleByFilterRequest _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 UserRoleContract.GetAllUserRoleByFilterAsync(_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>();
|
||||
}
|
||||
public async Task Update(DataModel model)
|
||||
{
|
||||
var parameters = new DialogParameters<UpdateDialog> { { x => x.Model, model.Adapt<UpdateUserRoleRequest>() } };
|
||||
|
||||
var dialog = await DialogService.ShowAsync<UpdateDialog>($"ویرایش کاربر", parameters, new DialogOptions() { CloseButton = true, FullWidth = true, MaxWidth = MaxWidth.Small });
|
||||
var result = await dialog.Result;
|
||||
|
||||
if (!result.Canceled)
|
||||
{
|
||||
ReLoadData();
|
||||
//Reload Data
|
||||
Snackbar.Add("عملیات با موفقیت انجام شد", Severity.Success);
|
||||
|
||||
}
|
||||
}
|
||||
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 UserRoleContract.DeleteUserRoleAsync(new()
|
||||
{
|
||||
Id = model.Id
|
||||
});
|
||||
ReLoadData();
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
public async void ReLoadData()
|
||||
{
|
||||
if (_gridData != null)
|
||||
await _gridData.ReloadServerData();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
@attribute [Route(RouteConstance.UserRole + "{UserId:long}")]
|
||||
|
||||
@using BackOffice.BFF.UserRole.Protobuf.Protos.UserRole
|
||||
@using BackOffice.Pages.UserRole.Components
|
||||
|
||||
<MudStack>
|
||||
<MudPaper Elevation="1" Class="pa-4">
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
||||
<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>
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
<BackOffice.Pages.UserRole.Components.UserRoleDataTable @ref="_table" UserId="UserId" />
|
||||
</MudStack>
|
||||
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
<AuthorizeView Roles="Administrator">
|
||||
<Authorized>
|
||||
<MudNavLink Match="NavLinkMatch.Prefix" Href="@(RouteConstance.Package)">مدیریت پکیج</MudNavLink>
|
||||
<MudNavLink Match="NavLinkMatch.Prefix" Href="@(RouteConstance.UserPage)">مدیریت کاربر</MudNavLink>
|
||||
<MudNavLink Match="NavLinkMatch.Prefix" Href="@(RouteConstance.Role)">مدیریت نقش</MudNavLink>
|
||||
|
||||
</Authorized>
|
||||
</AuthorizeView>
|
||||
|
||||
Reference in New Issue
Block a user