diff --git a/models/baseModels/CollectionRulesItems/CollectionRulesItems.ts b/models/baseModels/CollectionRulesItems/CollectionRulesItems.ts new file mode 100644 index 00000000..c468d818 --- /dev/null +++ b/models/baseModels/CollectionRulesItems/CollectionRulesItems.ts @@ -0,0 +1,8 @@ +import { Doc } from 'fyo/model/doc'; +import { Money } from 'pesa'; + +export class CollectionRulesItems extends Doc { + tierName?: string; + collectionFactor?: number; + minimumTotalSpent?: Money; +} diff --git a/models/baseModels/LoyaltyPointEntry/LoyaltyPointEntry.ts b/models/baseModels/LoyaltyPointEntry/LoyaltyPointEntry.ts new file mode 100644 index 00000000..4a71954d --- /dev/null +++ b/models/baseModels/LoyaltyPointEntry/LoyaltyPointEntry.ts @@ -0,0 +1,21 @@ +import { Doc } from 'fyo/model/doc'; +import { ListViewSettings } from 'fyo/model/types'; + +export class LoyaltyPointEntry extends Doc { + loyaltyProgram?: string; + customer?: string; + invoice?: string; + purchaseAmount?: number; + expiryDate?: Date; + + static override getListViewSettings(): ListViewSettings { + return { + columns: [ + 'loyaltyProgram', + 'customer', + 'purchaseAmount', + 'loyaltyPoints', + ], + }; + } +} diff --git a/models/baseModels/LoyaltyProgram/LoyaltyProgram.ts b/models/baseModels/LoyaltyProgram/LoyaltyProgram.ts new file mode 100644 index 00000000..4768c8e3 --- /dev/null +++ b/models/baseModels/LoyaltyProgram/LoyaltyProgram.ts @@ -0,0 +1,22 @@ +import { Doc } from 'fyo/model/doc'; +import { FiltersMap, ListViewSettings } from 'fyo/model/types'; +import { CollectionRulesItems } from '../CollectionRulesItems/CollectionRulesItems'; +import { AccountRootTypeEnum } from '../Account/types'; + +export class LoyaltyProgram extends Doc { + collectionRules?: CollectionRulesItems[]; + expiryDuration?: number; + + static filters: FiltersMap = { + expenseAccount: () => ({ + rootType: AccountRootTypeEnum.Liability, + isGroup: false, + }), + }; + + static getListViewSettings(): ListViewSettings { + return { + columns: ['name', 'fromDate', 'toDate', 'expiryDuration'], + }; + } +}