import type { QuickEditModalBaseDisplayArgs } from './quick-edit-modal-base'; import PowerduckState from '../../app/powerduck-state'; import NotificationProvider from '../ui/notification'; import QuickEditModalBase from './quick-edit-modal-base'; interface QuickEditModalStatusBaseArgs {} export default abstract class QuickEditModalStatusBase extends QuickEditModalBase implements QuickEditModalStatusBaseArgs { abstract getFetchArgs(item): any; abstract getSaveModelArr(modelArr: any[]): any[]; abstract getModelFromSaveArgs(item: any): any; abstract getItemName(item): string; abstract getAttractionType(): string; status: string = null; causeId: number = null; show(args: QuickEditModalBaseDisplayArgs): void { this.status = null; this.causeId = null; super.show(args); } getSelectedStatus(): string { return this.status; } validate() { if (this.status != 'OPEN' && this.causeId == null) { NotificationProvider.showErrorMessage(PowerduckState.getResourceValue('errorsOnForm')); return false; } if (this.status == null) { NotificationProvider.showErrorMessage(PowerduckState.getResourceValue('errorsOnForm')); return false; } return true; } protected postProcessSaveData(saveArr: any[]) { if (this.status != null) { for (const saveItem of saveArr) { this.getModelFromSaveArgs(saveItem).status = this.status; } } if (this.causeId != null) { for (const saveItem of saveArr) { // this.getModelFromSaveArgs(saveItem).causeID = CauseHelper.getCauseId(this.causeId, this.status); } } } render(h) { return super.render(h); } renderBody(h) { return (
{/* { this.status = e; }} /> {this.getAttractionType() != null && this.status != "OPEN" && ( { this.causeId = e.id; }} /> )} */}
); } }