init project portal web
This commit is contained in:
102
lib/price-plan/store/form-store.ts
Normal file
102
lib/price-plan/store/form-store.ts
Normal file
@ -0,0 +1,102 @@
|
||||
import { makeAutoObservable } from "mobx";
|
||||
|
||||
export class PricePlanFormStore {
|
||||
// --- Private state ---
|
||||
private isOpen = false;
|
||||
private offerType = "";
|
||||
private offerName = "";
|
||||
private applyLevel = "";
|
||||
private serviceType = "S";
|
||||
private pricePlanCode = "";
|
||||
private remarks = "";
|
||||
private copyFrom = "";
|
||||
private sourceFrom = "";
|
||||
private effType = "";
|
||||
private baseValidPeriod: Date | undefined = undefined;
|
||||
private versionValidPeriod: Date | undefined = undefined;
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
|
||||
// --- Getters ---
|
||||
getIsOpen = () => this.isOpen;
|
||||
getOfferType = () => this.offerType;
|
||||
getOfferName = () => this.offerName;
|
||||
getApplyLevel = () => this.applyLevel;
|
||||
getServiceType = () => this.serviceType;
|
||||
getPricePlanCode = () => this.pricePlanCode;
|
||||
getRemarks = () => this.remarks;
|
||||
getCopyFrom = () => this.copyFrom;
|
||||
getSourceFrom = () => this.sourceFrom;
|
||||
getEffType = () => this.effType;
|
||||
getBaseValidPeriod = () => this.baseValidPeriod;
|
||||
getVersionValidPeriod = () => this.versionValidPeriod;
|
||||
|
||||
// --- Setters ---
|
||||
setIsOpen = (val: boolean) => {
|
||||
this.isOpen = val;
|
||||
};
|
||||
|
||||
setOfferType = (val: string) => {
|
||||
this.offerType = val;
|
||||
};
|
||||
|
||||
setOfferName = (val: string) => {
|
||||
this.offerName = val;
|
||||
};
|
||||
|
||||
setApplyLevel = (val: string) => {
|
||||
this.applyLevel = val;
|
||||
};
|
||||
|
||||
setServiceType = (val: string) => {
|
||||
this.serviceType = val;
|
||||
};
|
||||
|
||||
setPricePlanCode = (val: string) => {
|
||||
this.pricePlanCode = val;
|
||||
};
|
||||
|
||||
setRemarks = (val: string) => {
|
||||
this.remarks = val;
|
||||
};
|
||||
|
||||
setCopyFrom = (val: string) => {
|
||||
this.copyFrom = val;
|
||||
};
|
||||
|
||||
setSourceFrom = (val: string) => {
|
||||
this.sourceFrom = val;
|
||||
};
|
||||
|
||||
setEffType = (val: string) => {
|
||||
this.effType = val;
|
||||
};
|
||||
|
||||
setBaseValidPeriod = (val: Date | undefined) => {
|
||||
this.baseValidPeriod = val;
|
||||
};
|
||||
|
||||
setVersionValidPeriod = (val: Date | undefined) => {
|
||||
this.versionValidPeriod = val;
|
||||
};
|
||||
|
||||
resetForm = () => {
|
||||
this.isOpen = false;
|
||||
this.offerType = "";
|
||||
this.offerName = "";
|
||||
this.applyLevel = "";
|
||||
this.serviceType = "S";
|
||||
this.pricePlanCode = "";
|
||||
this.remarks = "";
|
||||
this.copyFrom = "";
|
||||
this.sourceFrom = "";
|
||||
this.effType = "";
|
||||
this.baseValidPeriod = undefined;
|
||||
this.versionValidPeriod = undefined;
|
||||
};
|
||||
}
|
||||
|
||||
const pricePlanFormStore = new PricePlanFormStore();
|
||||
export default pricePlanFormStore;
|
||||
55
lib/price-plan/store/index.ts
Normal file
55
lib/price-plan/store/index.ts
Normal file
@ -0,0 +1,55 @@
|
||||
import { makeAutoObservable } from "mobx";
|
||||
|
||||
class PricePlanStore {
|
||||
private currentPage = 0;
|
||||
private size = 10;
|
||||
private type = "";
|
||||
private isAlertOpen = false;
|
||||
private priceplanId = "";
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
|
||||
getCurrentPage = () => this.currentPage
|
||||
|
||||
getSize = () => this.size
|
||||
|
||||
getType = () => this.type
|
||||
|
||||
getIsAlertOpen = () => this.isAlertOpen
|
||||
|
||||
getPricePlanId = () => this.priceplanId
|
||||
|
||||
setPricePlanId = (id: string) => {
|
||||
this.priceplanId = id;
|
||||
};
|
||||
|
||||
setIsAlertOpen = (isOpen: boolean) => {
|
||||
this.isAlertOpen = isOpen;
|
||||
};
|
||||
|
||||
setCurrentPage = (page: number) => {
|
||||
this.currentPage = page;
|
||||
};
|
||||
|
||||
setSize = (size: number) => {
|
||||
this.size = size;
|
||||
};
|
||||
|
||||
setType = (type: string) => {
|
||||
this.type = type;
|
||||
};
|
||||
|
||||
reset = () => {
|
||||
this.currentPage = 0;
|
||||
this.size = 10;
|
||||
this.type = "";
|
||||
this.isAlertOpen = false;
|
||||
this.priceplanId = "";
|
||||
}
|
||||
}
|
||||
|
||||
const pricePlanStore = new PricePlanStore();
|
||||
|
||||
export default pricePlanStore;
|
||||
Reference in New Issue
Block a user