Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create new dropdown option from popup config window #2040

Merged
merged 12 commits into from
Nov 19, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { EntityAbility } from "../../permissions/ability/entity-ability";
export class ConfigurableEnumService {
private enums = new Map<string, ConfigurableEnum>();

enumEntity: ConfigurableEnum;

constructor(
private entityMapper: EntityMapperService,
private ability: EntityAbility,
Expand Down Expand Up @@ -47,4 +49,10 @@ export class ConfigurableEnumService {
}
return this.enums.get(entityId);
}
private addNewOption(name: string) {
const option = { id: name, label: name };
this.enumEntity.values.push(option);
this.entityMapper.save(this.enumEntity);
return option;
}
sleidig marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,25 @@ <h1 matDialogTitle i18n="title of dropdown options popup dialog">
</button>
</mat-form-field>
</mat-dialog-content>
<div><mat-form-field
cdkDrag
class="full-width"
appearance="fill"
>
<fa-icon
icon="grip-vertical"
matIconPrefix
class="grab-icon margin-right-small"
></fa-icon>
<button mat-icon-button matIconSuffix > <fa-icon icon="trash"></fa-icon>
</button>
</mat-form-field>
<mat-form-field>
<mat-label>Input</mat-label>
<input matInput placeholder="Ex.Howrah"/></mat-form-field>

<button mat-raised-button onclick="Option">Add New Option</button></div>
<mat-dialog-actions>
<button mat-raised-button mat-dialog-close i18n="Close popup">Close</button>
<button mat-raised-button mat-dialog-close i18n="Close popup">Close</button>
</mat-dialog-actions>

Loading