Add MetaTags support and update project configurations

- Removed unused @using directives in App.razor and BrandsPage.razor.
- Added UI elements for meta tags in BrandActionDialogBox.razor.
- Updated BrandActionDialogBoxViewModel to handle meta tags.
- Changed label text in DiscountActionDialogBox.razor.
- Updated assembly and file versions in Netina.AdminPanel.PWA.csproj.
- Added BlogMetaTag and BrandMetaTag classes.
- Added migration to update database schema for meta tags.
- Updated BlogController to handle meta tags.
- Set LangVersion to latest in multiple project files.
- Changed array initialization syntax in various files.
- Added MetaTags property to BlogLDto and BrandLDto classes.
- Updated Blog and Brand classes to handle meta tags.
- Refactored mappers to include meta tags handling.
- Improved product sorting in GetProductsQueryHandler.cs.
- Updated ApplicationContextModelSnapshot for new entities.
subProduct
Amir Hossein Khademi 2024-12-11 00:25:26 +03:30
parent 0e7c1d7f81
commit 0619b0b7de
6 changed files with 84 additions and 10 deletions

View File

@ -1,5 +1,4 @@
@using Netina.AdminPanel.PWA.Models
@using Netina.AdminPanel.PWA.Layout
@using Netina.AdminPanel.PWA.Layout
@using Netina.AdminPanel.PWA.Pages
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">

View File

@ -85,6 +85,60 @@
<MudTabPanel Text="متاتگ و سوالات متداول">
<MudGrid>
<MudItem xs="12">
<MudText Typo="Typo.h6">اطلاعات متا تگ</MudText>
<MudText Typo="Typo.caption">می توانید متا تگ های سئو برای صفحه مورد نظر را وارد کنید</MudText>
<MudGrid>
<MudItem lg="5" md="6">
<MudTextField @bind-Value="@ViewModel.MetaTagType" T="string" Label="نوع" Variant="Variant.Outlined"></MudTextField>
</MudItem>
<MudItem lg="5" md="6">
<MudTextField @bind-Value="@ViewModel.MetaTagValue" T="string" Label="مقدار" Variant="Variant.Outlined"></MudTextField>
</MudItem>
<MudItem lg="2" md="12">
<MudButton Variant="Variant.Filled"
Size="Size.Large"
Color="Color.Info"
class="mt-2 w-full py-3"
OnClick="ViewModel.AddMetaTag"
StartIcon="@Icons.Material.Outlined.Add">افزودن</MudButton>
</MudItem>
<MudItem sm="12">
<MudDataGrid Items="@ViewModel.MetaTags"
T="MetaTagSDto"
Elevation="0"
Outlined="true"
Bordered="true"
Striped="true"
Filterable="false"
SortMode="@SortMode.None"
Groupable="false">
<Columns>
<PropertyColumn T="MetaTagSDto" TProperty="string" Property="x => x.Type" Title="نوع" />
<PropertyColumn T="MetaTagSDto" TProperty="string" Property="x => x.Value" Title="مقدار" />
<TemplateColumn T="MetaTagSDto" CellClass="d-flex justify-end">
<CellTemplate>
<MudStack Row>
<MudButton DisableElevation="true"
Size="@Size.Small"
Variant="@Variant.Filled"
OnClick="() => ViewModel.MetaTags.Remove(context.Item)"
Color="@Color.Error"
StartIcon="@Icons.Material.Outlined.Delete">حذف</MudButton>
</MudStack>
</CellTemplate>
</TemplateColumn>
</Columns>
</MudDataGrid>
</MudItem>
</MudGrid>
</MudItem>
<MudItem xs="12">
<MudText Typo="Typo.h6">سوالات متداول</MudText>
@ -120,7 +174,7 @@
Size="@Size.Small"
Variant="@Variant.Outlined"
Color="@Color.Error"
OnClick="() => ViewModel.Faqs.Remove(item.Key)" />
OnClick="() => ViewModel.Faqs.Remove(item.Key)"/>
<MudText>@item.Key</MudText>
</MudStack>
</TitleContent>

View File

@ -1,4 +1,5 @@
using Netina.Domain.Entities.Brands;
using Netina.Domain.Dtos.LargDtos;
using Netina.Domain.Entities.Brands;
namespace Netina.AdminPanel.PWA.Dialogs;
@ -65,6 +66,7 @@ public class BrandActionDialogBoxViewModel : BaseViewModel<BrandLDto>
IsProcessing = true;
var response = await _restWrapper.CrudDtoApiRest<Brand, BrandLDto, Guid>(Address.BrandController).ReadOne(Brand.Id);
var brandLDto = response;
brandLDto.MetaTags.ForEach(m => MetaTags.Add(m));
PageDto = brandLDto;
}
catch (ApiException ex)
@ -106,7 +108,7 @@ public class BrandActionDialogBoxViewModel : BaseViewModel<BrandLDto>
PageDto.PageUrl,
PageDto.Files,
Faqs,
new Dictionary<string, string>());
MetaTags.ToDictionary(x => x.Type, x => x.Value));
await _restWrapper.CrudApiRest<Brand, Guid>(Address.BrandController).Create<CreateBrandCommand>(request, token);
_mudDialog.Close(DialogResult.Ok(true));
}
@ -147,7 +149,7 @@ public class BrandActionDialogBoxViewModel : BaseViewModel<BrandLDto>
PageDto.PageUrl,
PageDto.Files,
Faqs,
new Dictionary<string, string>());
MetaTags.ToDictionary(x => x.Type, x => x.Value));
await _restWrapper.CrudApiRest<Brand, Guid>(Address.BrandController).Update<UpdateBrandCommand>(request, token);
_mudDialog.Close();
@ -191,6 +193,26 @@ public class BrandActionDialogBoxViewModel : BaseViewModel<BrandLDto>
}
}
public readonly ObservableCollection<MetaTagSDto> MetaTags = new();
public string MetaTagType { get; set; } = string.Empty;
public string MetaTagValue { get; set; } = string.Empty;
public void AddMetaTag()
{
try
{
if (MetaTagType.IsNullOrEmpty())
throw new Exception("لطفا نوع متا مورد نظر را وارد کنید");
if (MetaTagValue.IsNullOrEmpty())
throw new Exception("لطفا مقدار متا مورد نظر را وارد کنید");
MetaTags.Add(new MetaTagSDto() { Type = MetaTagType, Value = MetaTagValue });
}
catch (Exception e)
{
_snackbar.Add(e.Message, Severity.Error);
}
}
public async Task SelectFileAsync()
{

View File

@ -133,7 +133,7 @@
</MudAutocomplete>
</MudItem>
<MudItem sm="5">
<MudSwitch @bind-Value="@ViewModel.IsProductEnable" class="mt-2" Size="Size.Large" T="bool" Label="تخفیف برای غذای خاص" Color="Color.Info" />
<MudSwitch @bind-Value="@ViewModel.IsProductEnable" class="mt-2" Size="Size.Large" T="bool" Label="تخفیف برای محصول خاص" Color="Color.Info" />
</MudItem>
<MudItem sm="7">

View File

@ -5,8 +5,8 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<AssemblyVersion>1.7.20.34</AssemblyVersion>
<FileVersion>1.7.20.34</FileVersion>
<AssemblyVersion>1.10.21.36</AssemblyVersion>
<FileVersion>1.10.21.36</FileVersion>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
</PropertyGroup>

View File

@ -1,5 +1,4 @@
@page "/product/brands"
@using StringExtensions = Netina.Common.Extensions.StringExtensions
@inject IDialogService DialogService
@inject NavigationManager NavigationManager