Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDS-327 - Use of promotion assignments #333

Merged
merged 3 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,15 @@
"PROMOTIONS": {
"ACTIVE": "Active",
"ACTIVE_DATES": "Active Dates",
"ADJUST_FORM_DETAILS": "Enter a new discount code and adjust any existing details to clone this promotion.",
"ALL_BUYERS": "All buyers",
"ALL_PROMOS_ORDERWIDE": "All promotions are order-wide at this point.",
"ALL_PROMOTIONS_ELIGIBLE": "All promotions are eligible to all buyers at this time.",
"APPLIES_TO": "Applies To",
"APPLIES_TO_RATES": "Applies to shipping rates under",
"BUYER_ELIGIBILITY": "Buyer Eligibility",
"CAN_BE_COMBINED": "Can be combined with other promotions",
"CLONE": "Clone",
"AUTOMATIC": "Automatic",
"AUTO_APPLY": "Automatically apply promotion",
"DISCARD_CHANGES": "Discard Changes",
Expand All @@ -402,7 +404,8 @@
},
"ELIGIBILITY": {
"FOR": "For",
"ALL_BUYERS": "all buyers"
"ALL_BUYERS": "all buyers",
"SELECTED_BUYERS": "selected buyers"
},
"USAGE": {
"LIMIT_OF": "Limit of",
Expand Down Expand Up @@ -442,6 +445,7 @@
"MORE_PROMOTIONS": "More Promotions",
"NAME": "Name",
"NO_INFO_ENTERED": "No information entered yet.",
"NO_RESULTS": "No results. Broaden your search and try again.",
"NONE": "None",
"PERCENTAGE": "Percentage",
"PERFORMANCE": "Performance",
Expand Down
1 change: 1 addition & 0 deletions src/UI/Seller/src/app/models/promo-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface PromotionXp {
MinReq?: HSPromoMinRequirement
MaxShipCost?: number
BOGO?: BOGOPromotion
Buyers?: string[]
}

export interface HSPromoMinRequirement {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ <h6 class="mb-0" translate>ADMIN.PROMOTIONS.APPLIES_TO</h6>
class="mr-3 w-100"
id="resource-search"
[placeholderText]="''"
[searchTermInput]="searchTerm"
(searched)="searchedResources($event)"
[searchTermInput]="buyerSearchTerm"
(searched)="searchedBuyerResources($event)"
>
</search-component>
<perfect-scrollbar
Expand Down Expand Up @@ -304,8 +304,9 @@ <h6 class="mb-0" translate>ADMIN.PROMOTIONS.APPLIES_TO</h6>
*ngIf="!products?.value?.length && searchTerm"
ngbDropdownItem
disabled
translate
>
No results. Broaden your search and try again.
ADMIN.PROMOTIONS.NO_RESULTS
</p>
</perfect-scrollbar>
</div>
Expand Down Expand Up @@ -516,54 +517,115 @@ <h6 class="mb-0" translate>ADMIN.PROMOTIONS.SHIPPING</h6>
</div>
<div class="card bg-white shadow-sm p-4 mt-3">
<h6 class="mb-0" translate>ADMIN.PROMOTIONS.BUYER_ELIGIBILITY</h6>
<small class="text-primary-light font-italic my-2">
<fa-icon class="mr-2" [icon]="faExclamationCircle"></fa-icon>
<span translate>ADMIN.PROMOTIONS.ALL_PROMOTIONS_ELIGIBLE</span>
</small>
<div class="form-check">
<input
class="form-check-input"
type="radio"
name="AllowAllBuyers"
id="AllowAllBuyers"
[value]="_promotionEditable?.AllowAllBuyers"
formControlName="AllowAllBuyers"
(input)="handleUpdatePromo($event, 'AllowAllBuyers')"
[checked]="_promotionEditable?.AllowAllBuyers"
/>
<label class="form-check-label" for="AllowAllBuyers" translate>
ADMIN.PROMOTIONS.ALL_BUYERS
</label>
</div>
<!-- Placeholder for future functionality -->
<div class="form-check">
<input
class="form-check-input"
type="radio"
name="SpecificBuyers"
id="SpecificBuyers"
value="SpecificBuyers"
disabled
[checked]="false"
/>
<label class="form-check-label" for="SpecificBuyers" translate>
ADMIN.PROMOTIONS.SPECIFIC_BUYERS
</label>
</div>
<div class="form-check">
<input
class="form-check-input"
type="radio"
name="SpecificBuyerGroups"
id="SpecificBuyerGroups"
value="SpecificBuyerGroups"
disabled
[checked]="false"
/>
<label class="form-check-label" for="SpecificBuyerGroups" translate>
ADMIN.PROMOTIONS.SPECIFIC_BUYER_GROUPS
</label>
<div class="row mt-3">
<div class="col-md-4">
<div class="form-group mb-0">
<div class="form-check">
<input
class="form-check-input"
type="radio"
name="AllowAllBuyers"
id="AllowAllBuyersTrue"
[value]="true"
formControlName="AllowAllBuyers"
(change)="handleUpdatePromo(true, 'AllowAllBuyers')"
/>
<label
class="form-check-label"
for="AllowAllBuyers"
translate
>
ADMIN.PROMOTIONS.ALL_BUYERS
</label>
</div>
<div class="form-check">
<input
class="form-check-input"
type="radio"
name="AllowAllBuyers"
id="AllowAllBuyersFalse"
[value]="false"
formControlName="AllowAllBuyers"
(change)="handleUpdatePromo(false, 'AllowAllBuyers')"
/>
<label
class="form-check-label"
for="SpecificBuyers"
translate
>
ADMIN.PROMOTIONS.SPECIFIC_BUYERS
</label>
</div>
</div>
</div>
<!-- START SPECIFIC BUYERS -->
<div class="col-md-8">
<ng-container *ngIf="!_promotionEditable?.AllowAllBuyers">
<div
id="buyersCollapsed"
[ngbCollapse]="buyersCollapsed"
aria-label="parent resource dropdown"
>
<search-component
class="mr-3 w-100"
id="buyer-search"
[placeholderText]="''"
[searchTermInput]="searchTerm"
(searched)="searchedResources($event)"
>
</search-component>
<perfect-scrollbar
class="
dropdown-ps
product-search-area
border border-light
shadow-sm
"
(psYReachEnd)="handleScrollEnd($event)"
>
<button
type="button"
ngbDropdownItem
*ngFor="let resource of buyers | async"
(click)="addBuyer(resource.ID)"
[disabled]="buyerAlreadySelected(resource.ID)"
aria-label="select your Buyer"
>
<div class="overflow-hidden">
<summary-resource-display-component
[resource]="resource"
[resourceType]="'buyers'"
>
</summary-resource-display-component>
</div>
</button>
<p
class="mb-0"
*ngIf="!buyers?.value?.length && searchTerm"
ngbDropdownItem
disabled
translate
>
ADMIN.PROMOTIONS.NO_RESULTS
</p>
</perfect-scrollbar>
</div>
<div class="chip-bag">
<div
class="chip chip-sm"
*ngFor="let buyerID of _promotionEditable?.xp?.Buyers"
>
{{ buyerID }}
<fa-icon
(click)="removeBuyer(buyerID)"
[icon]="faTimesCircle"
></fa-icon>
</div>
</div>
</ng-container>
</div>
</div>
<!-- END SPECIFIC BUYERS -->
</div>
<div class="card bg-white shadow-sm p-4 mt-3">
<h6 class="font-weight-medium" translate>
Expand Down
Loading