init project portal web

This commit is contained in:
Sweli Giri
2025-04-15 13:56:54 +07:00
parent 9a25243035
commit 8b15dcebf8
122 changed files with 13965 additions and 1 deletions

View File

@ -0,0 +1,42 @@
interface Props {
parentName: string;
pricePlanTypeDto: Array<PricePlanMenuItem>;
}
export interface PricePlanMenuItem {
id: string;
pricePlanTypeName: string;
}
export class PricePlanMenuModel {
private parentName: string
private pricePlanTypeDto: Array<PricePlanMenuItem>
constructor({
parentName,
pricePlanTypeDto,
}: Props) {
this.parentName = parentName
this.pricePlanTypeDto = pricePlanTypeDto
}
getParentName(): string {
return this.parentName
}
getPricePlanTypeDto(): Array<PricePlanMenuItem> {
return this.pricePlanTypeDto
}
static fromJSON = (data: any) => {
return data.data.map((item: {
parentName: string,
pricePlanTypeDto: Array<PricePlanMenuItem>,
}) => {
return new PricePlanMenuModel({
parentName: item.parentName,
pricePlanTypeDto: item.pricePlanTypeDto,
})
})
}
}

View File

@ -0,0 +1,59 @@
interface Props {
id: string
name: string
type: string
code: string
validPeriod: string
}
export default class PricePlanModel {
private id: string
private name: string
private type: string
private code: string
private validPeriod: string
constructor({ id, name, type, code, validPeriod }: Props) {
this.id = id
this.name = name
this.type = type
this.code = code
this.validPeriod = validPeriod
}
getId() { return this.id}
getName() { return this.name }
getType() { return this.type }
getCode() { return this.code }
getValidPeriod() { return this.validPeriod }
static fromJSON(data: any): PricePlanModel[] {
return data.data.content.map((item: {
id: string
pricePlanName: string,
pricePlanType: string,
pricePlanCode: string,
validPeriod: string,
}) => {
return new PricePlanModel({
id: item.id,
name: item.pricePlanName,
type: item.pricePlanType,
code: item.pricePlanCode,
validPeriod: item.validPeriod,
})
})
}
static toJsonList = (list: PricePlanModel[]): Props[] => {
return list.map((item: PricePlanModel) => {
return {
id: item.getId(),
name: item.getName(),
type: item.getType(),
code: item.getCode(),
validPeriod: item.getValidPeriod(),
}
})
}
}