feat: implement VAT management service and integrate VAT calculations across components
This commit is contained in:
@@ -77,18 +77,51 @@ else
|
||||
@* </MudStack> *@
|
||||
@* } *@
|
||||
<MudDivider Class="my-2"/>
|
||||
<MudText Typo="Typo.h5" Color="Color.Primary">@FormatPrice(_product.Price)</MudText>
|
||||
<MudStack Spacing="1">
|
||||
<MudText Typo="Typo.h5" Color="Color.Primary">@FormatPrice(_product.Price)</MudText>
|
||||
@if (VAT.IsEnabled)
|
||||
{
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">
|
||||
(شامل @VAT.VatPercentage% مالیات بر ارزش افزوده)
|
||||
</MudText>
|
||||
}
|
||||
</MudStack>
|
||||
|
||||
<!-- نمایش وضعیت موجودی -->
|
||||
@if (IsInStock)
|
||||
{
|
||||
<MudChip T="string" Color="Color.Success" Variant="Variant.Filled" Size="Size.Small">
|
||||
<MudIcon Icon="@Icons.Material.Filled.CheckCircle" Size="Size.Small" Class="me-1" />
|
||||
موجود در انبار (@_product.RemainingCount عدد)
|
||||
</MudChip>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudChip T="string" Color="Color.Error" Variant="Variant.Filled" Size="Size.Small">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Cancel" Size="Size.Small" Class="me-1" />
|
||||
ناموجود
|
||||
</MudChip>
|
||||
}
|
||||
|
||||
<!-- Desktop/tablet actions -->
|
||||
<MudHidden Breakpoint="Breakpoint.MdAndUp" Invert="true">
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
|
||||
<MudNumericField T="int" @bind-Value="_qty" Min="@MinQty" Max="@MaxQty" Immediate="true"
|
||||
HideSpinButtons="true" Style="max-width:120px"/>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Filled.AddShoppingCart" OnClick="AddToCart">افزودن به
|
||||
سبد
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
@if (IsInStock)
|
||||
{
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
|
||||
<MudNumericField T="int" @bind-Value="_qty" Min="@MinQty" Max="@MaxQty" Immediate="true"
|
||||
HideSpinButtons="true" Style="max-width:120px"/>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Filled.AddShoppingCart" OnClick="AddToCart">افزودن به
|
||||
سبد
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudAlert Severity="Severity.Warning" Variant="Variant.Outlined" Dense="true">
|
||||
این محصول در حال حاضر موجود نیست.
|
||||
</MudAlert>
|
||||
}
|
||||
</MudHidden>
|
||||
|
||||
<!-- Mobile actions use sticky bar rendered below -->
|
||||
@@ -103,51 +136,58 @@ else
|
||||
<MudPaper Class="mud-width-full mud-elevation-3 pa-3"
|
||||
Style="position:sticky;bottom:0;left:0;z-index:9;border-top-left-radius:1rem;border-top-right-radius:1rem;">
|
||||
|
||||
<MudGrid Class="align-center" Justify="Justify.SpaceBetween">
|
||||
<MudItem xs="6">
|
||||
<MudStack Spacing="1">
|
||||
@if (HasDiscount && OriginalPrice is not null)
|
||||
{
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="1">
|
||||
<MudText Typo="Typo.caption"
|
||||
Class="mud-text-secondary mud-line-through">@FormatPrice(OriginalPrice.Value)</MudText>
|
||||
<MudChip T="string" Color="Color.Error" Variant="Variant.Filled" Size="Size.Small"
|
||||
Label="true">@($"٪{_product!.Discount}")</MudChip>
|
||||
</MudStack>
|
||||
}
|
||||
<MudText Typo="Typo.h6" Color="Color.Primary">@FormatPrice(TotalPrice)</MudText>
|
||||
</MudStack>
|
||||
</MudItem>
|
||||
|
||||
@if (IsInCart)
|
||||
{
|
||||
<MudItem xs="5" Class="">
|
||||
<MudPaper Class="mud-width-full d-flex align-center justify-space-between px-2"
|
||||
Elevation="1" Style="border-radius:1rem;">
|
||||
<MudIconButton
|
||||
Icon="@(CurrentCartQuantity == 1 ? Icons.Material.Filled.Delete : Icons.Material.Filled.Remove)"
|
||||
Color="Color.Error" Variant="Variant.Text" OnClick="RemoveFromCart"/>
|
||||
<MudText Typo="Typo.subtitle2" Class="mud-font-weight-bold">@CurrentCartQuantity</MudText>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Add" Color="Color.Primary"
|
||||
Variant="Variant.Text" Disabled="@(CurrentCartQuantity >= MaxQty)"
|
||||
OnClick="AddToCart"/>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudItem xs="6" >
|
||||
@if (IsInStock)
|
||||
{
|
||||
<MudGrid Class="align-center" Justify="Justify.SpaceBetween">
|
||||
<MudItem xs="6">
|
||||
<MudStack Spacing="1">
|
||||
|
||||
<MudButton Variant="Variant.Filled" Size="Size.Large" Color="Color.Error" Class="mud-width-full"
|
||||
StartIcon="@Icons.Material.Filled.AddShoppingCart" OnClick="AddToCart">
|
||||
افزودن به سبد
|
||||
</MudButton>
|
||||
@if (HasDiscount && OriginalPrice is not null)
|
||||
{
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="1">
|
||||
<MudText Typo="Typo.caption"
|
||||
Class="mud-text-secondary mud-line-through">@FormatPrice(OriginalPrice.Value)</MudText>
|
||||
<MudChip T="string" Color="Color.Error" Variant="Variant.Filled" Size="Size.Small"
|
||||
Label="true">@($"٪{_product!.Discount}")</MudChip>
|
||||
</MudStack>
|
||||
}
|
||||
<MudText Typo="Typo.h6" Color="Color.Primary">@FormatPrice(TotalPrice)</MudText>
|
||||
</MudStack>
|
||||
</MudItem>
|
||||
}
|
||||
</MudGrid>
|
||||
|
||||
@if (IsInCart)
|
||||
{
|
||||
<MudItem xs="5" Class="">
|
||||
<MudPaper Class="mud-width-full d-flex align-center justify-space-between px-2"
|
||||
Elevation="1" Style="border-radius:1rem;">
|
||||
<MudIconButton
|
||||
Icon="@(CurrentCartQuantity == 1 ? Icons.Material.Filled.Delete : Icons.Material.Filled.Remove)"
|
||||
Color="Color.Error" Variant="Variant.Text" OnClick="RemoveFromCart"/>
|
||||
<MudText Typo="Typo.subtitle2" Class="mud-font-weight-bold">@CurrentCartQuantity</MudText>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Add" Color="Color.Primary"
|
||||
Variant="Variant.Text" Disabled="@(CurrentCartQuantity >= MaxQty)"
|
||||
OnClick="AddToCart"/>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudItem xs="6" >
|
||||
<MudStack Spacing="1">
|
||||
<MudButton Variant="Variant.Filled" Size="Size.Large" Color="Color.Error" Class="mud-width-full"
|
||||
StartIcon="@Icons.Material.Filled.AddShoppingCart" OnClick="AddToCart">
|
||||
افزودن به سبد
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
</MudItem>
|
||||
}
|
||||
</MudGrid>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudAlert Severity="Severity.Warning" Variant="Variant.Filled" Dense="true" Class="mb-0">
|
||||
این محصول ناموجود است
|
||||
</MudAlert>
|
||||
}
|
||||
|
||||
</MudPaper>
|
||||
</MudHidden>
|
||||
|
||||
Reference in New Issue
Block a user