-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(admin-ui): Display calculated price when custom price strategy used
Relates to #2506
- Loading branch information
1 parent
b2cb011
commit 09c66fe
Showing
25 changed files
with
150 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...src/components/variant-price-strategy-detail/variant-price-strategy-detail.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div *ngIf="calculatedPriceDiffersFromInputPrice()" class="price-strategy-detail"> | ||
<vdr-form-item | ||
[label]="'catalog.calculated-price' | translate" | ||
[tooltip]="'catalog.calculated-price-tooltip' | translate" | ||
for="price" | ||
> | ||
</vdr-form-item> | ||
<div class="form-grid mt-2"> | ||
<vdr-form-item [label]="'common.price' | translate"> | ||
{{ variant.price | localeCurrency : variant.currencyCode }} | ||
</vdr-form-item> | ||
<vdr-form-item [label]="'common.price-with-tax' | translate"> | ||
{{ variant.priceWithTax | localeCurrency : variant.currencyCode }} | ||
</vdr-form-item> | ||
</div> | ||
</div> |
9 changes: 9 additions & 0 deletions
9
...src/components/variant-price-strategy-detail/variant-price-strategy-detail.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
:host { | ||
display: block; | ||
} | ||
|
||
.price-strategy-detail { | ||
margin-top: calc(var(--space-unit)* 2); | ||
padding-top: calc(var(--space-unit)* 2); | ||
border-top: 1px solid var(--color-weight-150); | ||
} |
31 changes: 31 additions & 0 deletions
31
...g/src/components/variant-price-strategy-detail/variant-price-strategy-detail.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; | ||
import { | ||
CurrencyCode, | ||
ProductVariantDetailQueryProductVariantFragmentFragment, | ||
} from '@vendure/admin-ui/core'; | ||
|
||
@Component({ | ||
selector: 'vdr-variant-price-strategy-detail', | ||
templateUrl: './variant-price-strategy-detail.component.html', | ||
styleUrls: ['./variant-price-strategy-detail.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class VariantPriceStrategyDetailComponent { | ||
@Input() channelPriceIncludesTax: boolean; | ||
@Input() variant: ProductVariantDetailQueryProductVariantFragmentFragment; | ||
@Input() channelDefaultCurrencyCode: CurrencyCode; | ||
|
||
calculatedPriceDiffersFromInputPrice(): boolean { | ||
const defaultPrice = | ||
this.variant.prices.find(p => p.currencyCode === this.channelDefaultCurrencyCode) ?? | ||
this.variant.prices[0]; | ||
if (!defaultPrice) { | ||
return false; | ||
} | ||
if (this.channelPriceIncludesTax) { | ||
return this.variant.priceWithTax !== defaultPrice.price; | ||
} else { | ||
return this.variant.price !== defaultPrice.price; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.