2
0
mirror of https://github.com/frappe/books.git synced 2024-12-22 10:58:59 +00:00

feat: loyalty program models

This commit is contained in:
AbleKSaju 2024-08-22 15:02:29 +05:30
parent a6688fb682
commit 9bfcbbfc5e
3 changed files with 51 additions and 0 deletions

View File

@ -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;
}

View File

@ -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',
],
};
}
}

View File

@ -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'],
};
}
}