🆙 Do not make have_offer static

This commit is contained in:
duckietm
2026-04-17 14:23:26 +02:00
parent 88117d937f
commit d3e6743fdf
5 changed files with 18 additions and 5 deletions
+5
View File
@@ -122,4 +122,9 @@ export class FurnitureOffer implements IPurchasableOffer
{
return String(this._furniData?.id ?? '');
}
public get haveOffer(): boolean
{
return false;
}
}
+1
View File
@@ -23,4 +23,5 @@ export interface IPurchasableOffer
isLazy: boolean;
products: IProduct[];
itemIds: string;
haveOffer: boolean;
}
+9 -2
View File
@@ -31,8 +31,9 @@ export class Offer implements IPurchasableOffer
private _badgeCode: string;
private _bundlePurchaseAllowed: boolean = false;
private _itemIds: string = '';
private _haveOffer: boolean = false;
constructor(offerId: number, localizationId: string, isRentOffer: boolean, priceInCredits: number, priceInActivityPoints: number, activityPointType: number, giftable: boolean, clubLevel: number, products: IProduct[], bundlePurchaseAllowed: boolean, itemIds: string = '')
constructor(offerId: number, localizationId: string, isRentOffer: boolean, priceInCredits: number, priceInActivityPoints: number, activityPointType: number, giftable: boolean, clubLevel: number, products: IProduct[], bundlePurchaseAllowed: boolean, itemIds: string = '', haveOffer: boolean = false)
{
this._offerId = offerId;
this._localizationId = localizationId;
@@ -45,6 +46,7 @@ export class Offer implements IPurchasableOffer
this._products = products;
this._bundlePurchaseAllowed = bundlePurchaseAllowed;
this._itemIds = itemIds || '';
this._haveOffer = haveOffer;
this.setPricingModelForProducts();
this.setPricingType();
@@ -181,6 +183,11 @@ export class Offer implements IPurchasableOffer
return this._itemIds;
}
public get haveOffer(): boolean
{
return this._haveOffer;
}
private setPricingModelForProducts(): void
{
const products = Product.stripAddonProducts(this._products);
@@ -243,7 +250,7 @@ export class Offer implements IPurchasableOffer
products.push(new Product(product.productType, product.productClassId, product.extraParam, product.productCount, productData, furnitureData));
}
const offer = new Offer(this.offerId, this.localizationId, this.isRentOffer, this.priceInCredits, this.priceInActivityPoints, this.activityPointType, this.giftable, this.clubLevel, products, this.bundlePurchaseAllowed, this.itemIds);
const offer = new Offer(this.offerId, this.localizationId, this.isRentOffer, this.priceInCredits, this.priceInActivityPoints, this.activityPointType, this.giftable, this.clubLevel, products, this.bundlePurchaseAllowed, this.itemIds, this.haveOffer);
offer.page = this.page;
@@ -61,7 +61,7 @@ export const CatalogAdminOfferEditView: FC<{}> = () =>
setAmount(editingOffer.product?.productCount || 1);
setClubOnly(editingOffer.clubLevel > 0 ? '1' : '0');
setExtradata(editingOffer.product?.extraParam || '');
setHaveOffer('1');
setHaveOffer(editingOffer.haveOffer ? '1' : '0');
setOfferIdGroup(editingOffer.offerId || -1);
setLimitedStack(0);
setOrderNumber(0);
+2 -2
View File
@@ -542,7 +542,7 @@ const useCatalogState = () =>
if(!products.length) continue;
const purchasableOffer = new Offer(offer.offerId, offer.localizationId, offer.rent, offer.priceCredits, offer.priceActivityPoints, offer.priceActivityPointsType, offer.giftable, offer.clubLevel, products, offer.bundlePurchaseAllowed, offer.itemIds);
const purchasableOffer = new Offer(offer.offerId, offer.localizationId, offer.rent, offer.priceCredits, offer.priceActivityPoints, offer.priceActivityPointsType, offer.giftable, offer.clubLevel, products, offer.bundlePurchaseAllowed, offer.itemIds, offer.haveOffer);
if((currentType === CatalogType.NORMAL) || ((purchasableOffer.pricingModel !== Offer.PRICING_MODEL_BUNDLE) && (purchasableOffer.pricingModel !== Offer.PRICING_MODEL_MULTI))) purchasableOffers.push(purchasableOffer);
}
@@ -609,7 +609,7 @@ const useCatalogState = () =>
products.push(new Product(product.productType, product.furniClassId, product.extraParam, product.productCount, productData, furnitureData, product.uniqueLimitedItem, product.uniqueLimitedSeriesSize, product.uniqueLimitedItemsLeft));
}
const offer = new Offer(offerData.offerId, offerData.localizationId, offerData.rent, offerData.priceCredits, offerData.priceActivityPoints, offerData.priceActivityPointsType, offerData.giftable, offerData.clubLevel, products, offerData.bundlePurchaseAllowed, offerData.itemIds);
const offer = new Offer(offerData.offerId, offerData.localizationId, offerData.rent, offerData.priceCredits, offerData.priceActivityPoints, offerData.priceActivityPointsType, offerData.giftable, offerData.clubLevel, products, offerData.bundlePurchaseAllowed, offerData.itemIds, offerData.haveOffer);
if(!((currentType === CatalogType.NORMAL) || ((offer.pricingModel !== Offer.PRICING_MODEL_BUNDLE) && (offer.pricingModel !== Offer.PRICING_MODEL_MULTI)))) return;