2024-04-17 16:19:43 +03:30
|
|
|
|
@inject ISnackbar Snackbar
|
2024-01-30 19:35:44 +03:30
|
|
|
|
@inject IRestWrapper RestWrapper
|
|
|
|
|
|
@inject IUserUtility UserUtility
|
|
|
|
|
|
@inject IDialogService DialogService
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<MudDialog class="mx-auto">
|
|
|
|
|
|
<DialogContent>
|
|
|
|
|
|
<MudContainer class="h-full">
|
|
|
|
|
|
<MudTabs Outlined="true" Elevation="0" Rounded="true" Centered="true">
|
|
|
|
|
|
<MudTabPanel class="h-full" Text="اطلاعات کلی" Icon="@Icons.Material.Outlined.Info">
|
|
|
|
|
|
<div class="h-full">
|
|
|
|
|
|
<MudStack Spacing="0" class="mt-4">
|
|
|
|
|
|
|
|
|
|
|
|
<MudText Typo="Typo.h6">اطلاعات کلی</MudText>
|
|
|
|
|
|
<MudText Typo="Typo.caption">اطلاعات کلی محصول را به دقت وارد کنید</MudText>
|
|
|
|
|
|
</MudStack>
|
|
|
|
|
|
<MudGrid>
|
|
|
|
|
|
|
|
|
|
|
|
<MudItem lg="4" md="6">
|
|
|
|
|
|
<MudTextField @bind-Value="@ViewModel.Title" T="string" Label="عنوان بلاگ" Variant="Variant.Outlined" />
|
|
|
|
|
|
</MudItem>
|
|
|
|
|
|
<MudItem lg="4" md="6">
|
|
|
|
|
|
|
|
|
|
|
|
<MudAutocomplete Required="true" ToStringFunc="dto => dto.Name" @bind-Value="@ViewModel.SelectedCategory"
|
|
|
|
|
|
SearchFunc="ViewModel.SearchBlogCategory"
|
|
|
|
|
|
T="BlogCategorySDto"
|
|
|
|
|
|
Label="دسته بندی"
|
|
|
|
|
|
Variant="Variant.Outlined">
|
|
|
|
|
|
<ProgressIndicatorInPopoverTemplate>
|
|
|
|
|
|
<MudList Clickable="false">
|
|
|
|
|
|
<MudListItem>
|
2024-06-08 22:51:09 +03:30
|
|
|
|
<div class="mx-auto flex w-full flex-row">
|
|
|
|
|
|
<MudProgressCircular class="my-auto -ml-4 mr-1" Size="Size.Small" Indeterminate="true" />
|
|
|
|
|
|
<p class="text-md mx-auto my-1 font-bold">منتظر بمانید</p>
|
2024-01-30 19:35:44 +03:30
|
|
|
|
</div>
|
|
|
|
|
|
</MudListItem>
|
|
|
|
|
|
</MudList>
|
|
|
|
|
|
</ProgressIndicatorInPopoverTemplate>
|
|
|
|
|
|
<ItemTemplate Context="e">
|
|
|
|
|
|
<p>@e.Name</p>
|
|
|
|
|
|
</ItemTemplate>
|
|
|
|
|
|
</MudAutocomplete>
|
|
|
|
|
|
</MudItem>
|
|
|
|
|
|
<MudItem lg="4" md="6">
|
|
|
|
|
|
<MudSelect T="bool" @bind-Value="@ViewModel.IsSuggested" Label="آیا پیشنهادویژه است ؟" ToStringFunc="b=>b.ToPersianString()" Variant="Variant.Outlined" AnchorOrigin="Origin.BottomCenter">
|
|
|
|
|
|
<MudSelectItem T="bool" Value="true" />
|
|
|
|
|
|
<MudSelectItem T="bool" Value="false" />
|
|
|
|
|
|
</MudSelect>
|
|
|
|
|
|
</MudItem>
|
|
|
|
|
|
<MudItem lg="12" md="12">
|
|
|
|
|
|
<MudStack>
|
|
|
|
|
|
<MudTextField @bind-Value="@ViewModel.Tags" T="string" Label="تگ ها" HelperText="تگ ها را با , میتوانید جدا کنید" HelperTextOnFocus="true" Variant="Variant.Outlined" />
|
|
|
|
|
|
</MudStack>
|
|
|
|
|
|
</MudItem>
|
|
|
|
|
|
<MudItem lg="12" md="12">
|
|
|
|
|
|
<MudTextField class="-mt-3" @bind-Value="@ViewModel.Summery" T="string" Label="توضیحاتــ کوتاه" Variant="Variant.Outlined"></MudTextField>
|
|
|
|
|
|
</MudItem>
|
|
|
|
|
|
</MudGrid>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</MudTabPanel>
|
|
|
|
|
|
<MudTabPanel Text="متن اصلی بلاگ" Icon="@Icons.Material.Outlined.Article">
|
|
|
|
|
|
|
|
|
|
|
|
<div class="min-h-[33rem]">
|
|
|
|
|
|
<MudStack class="mt-4" Spacing="0">
|
|
|
|
|
|
<MudText Typo="Typo.h6">متن بلاگ</MudText>
|
|
|
|
|
|
<MudText Typo="Typo.caption">می توانید کتن کامل بلاگــــ خود را کامل وارد کنید</MudText>
|
|
|
|
|
|
</MudStack>
|
|
|
|
|
|
<MudGrid>
|
2024-05-16 13:52:55 +03:30
|
|
|
|
<MudItem sm="12" class="!text-black max-h-[60vh] !overflow-y-scroll">
|
2024-02-22 20:34:52 +03:30
|
|
|
|
|
|
|
|
|
|
<RichTextEditorUi @bind-Text="@ViewModel.Content" />
|
2024-01-30 19:35:44 +03:30
|
|
|
|
|
|
|
|
|
|
</MudItem>
|
|
|
|
|
|
</MudGrid>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</MudTabPanel>
|
|
|
|
|
|
<MudTabPanel Text="تـــــصاویر" Icon="@Icons.Material.Outlined.ImageSearch">
|
|
|
|
|
|
|
|
|
|
|
|
<div class="min-h-[33rem]">
|
2024-06-08 22:51:09 +03:30
|
|
|
|
<MudStack class="mb-2 mt-4" Spacing="0">
|
2024-01-30 19:35:44 +03:30
|
|
|
|
|
|
|
|
|
|
<MudText Typo="Typo.h6">تصاویر محصول</MudText>
|
|
|
|
|
|
<MudText Typo="Typo.caption">می توانید برای محصول چند تصویر اپلود کنید</MudText>
|
|
|
|
|
|
</MudStack>
|
|
|
|
|
|
<MudStack Row="true">
|
|
|
|
|
|
<MudIconButton HtmlTag="label"
|
|
|
|
|
|
Color="Color.Info"
|
|
|
|
|
|
Variant="Variant.Outlined"
|
2024-06-08 22:51:09 +03:30
|
|
|
|
class="h-28 w-28"
|
2024-01-30 19:35:44 +03:30
|
|
|
|
Size="Size.Large"
|
|
|
|
|
|
Icon="@Icons.Material.Outlined.Wallpaper"
|
|
|
|
|
|
OnClick="async () => await ViewModel.SelectFileAsync()">
|
|
|
|
|
|
</MudIconButton>
|
|
|
|
|
|
@foreach (var item in ViewModel.Files)
|
|
|
|
|
|
{
|
2024-06-08 22:51:09 +03:30
|
|
|
|
<div class="h-28 w-28">
|
|
|
|
|
|
<MudImage Src="@item.GetLink()" Elevation="25" Class="absolute h-28 w-28 rounded-lg" />
|
2024-01-30 19:35:44 +03:30
|
|
|
|
|
|
|
|
|
|
<MudIconButton DisableElevation="true"
|
|
|
|
|
|
class="absolute m-1.5"
|
|
|
|
|
|
Size="@Size.Small"
|
|
|
|
|
|
Variant="@Variant.Filled"
|
|
|
|
|
|
OnClick="() => ViewModel.RemoveFile(item)"
|
|
|
|
|
|
Color="@Color.Error"
|
|
|
|
|
|
Icon="@Icons.Material.Outlined.Delete" />
|
|
|
|
|
|
@if (item.IsHeader)
|
|
|
|
|
|
{
|
2024-06-08 22:51:09 +03:30
|
|
|
|
<p class="absolute bottom-0 mr-2 rounded-lg bg-pink-500 px-1.5 py-0.5 text-white">هدر</p>
|
2024-01-30 19:35:44 +03:30
|
|
|
|
}
|
|
|
|
|
|
@if (item.IsPrimary)
|
|
|
|
|
|
{
|
2024-06-08 22:51:09 +03:30
|
|
|
|
<p class="absolute bottom-0 mr-2 rounded-lg bg-blue-500 px-1.5 py-0.5 text-white">اصلی</p>
|
2024-01-30 19:35:44 +03:30
|
|
|
|
}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</MudStack>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</MudTabPanel>
|
|
|
|
|
|
</MudTabs>
|
|
|
|
|
|
</MudContainer>
|
|
|
|
|
|
</DialogContent>
|
|
|
|
|
|
<DialogActions>
|
2024-06-08 22:51:09 +03:30
|
|
|
|
<MudStack Row="true" class="bottom-0 mx-4 h-fit w-full">
|
2024-01-30 19:35:44 +03:30
|
|
|
|
|
|
|
|
|
|
@if (ViewModel.IsEditing)
|
|
|
|
|
|
{
|
|
|
|
|
|
<BaseButtonUi class="w-64 rounded-md" IsProcessing="@ViewModel.IsProcessing"
|
|
|
|
|
|
Icon="@Icons.Material.Outlined.Check"
|
|
|
|
|
|
Variant="Variant.Filled" Color="Color.Success"
|
|
|
|
|
|
Content="ثبت ویرایش" OnClickCallback="ViewModel.SubmitEditAsync" />
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
<BaseButtonUi class="w-64 rounded-md" IsProcessing="@ViewModel.IsProcessing"
|
|
|
|
|
|
Icon="@Icons.Material.Outlined.Check"
|
|
|
|
|
|
Variant="Variant.Filled" Color="Color.Success"
|
|
|
|
|
|
Content="تایید" OnClickCallback="ViewModel.SubmitCreateAsync" />
|
|
|
|
|
|
}
|
|
|
|
|
|
<MudSpacer />
|
|
|
|
|
|
<MudButton Variant="Variant.Outlined" Size="Size.Large" Color="Color.Error" OnClick="ViewModel.Cancel">بستن</MudButton>
|
|
|
|
|
|
</MudStack>
|
|
|
|
|
|
</DialogActions>
|
|
|
|
|
|
</MudDialog>
|
|
|
|
|
|
@code
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
[CascadingParameter]
|
|
|
|
|
|
MudDialogInstance MudDialog { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
|
public BlogSDto? Blog { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public BlogActionDialogBoxViewModel ViewModel { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Blog == null)
|
|
|
|
|
|
ViewModel = new BlogActionDialogBoxViewModel(Snackbar, RestWrapper, UserUtility, DialogService, MudDialog);
|
|
|
|
|
|
else
|
|
|
|
|
|
ViewModel = new BlogActionDialogBoxViewModel(Snackbar, RestWrapper, UserUtility, DialogService, MudDialog, Blog);
|
|
|
|
|
|
await ViewModel.InitializeAsync();
|
|
|
|
|
|
await base.OnInitializedAsync();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|