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;
|
||||
Reference in New Issue
Block a user