connect-admin/app/pages/page/page-form.component.html

44 lines
2.3 KiB
HTML

<form [formGroup]="myForm">
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.route.valid && myForm.controls.route.dirty}">
<label for="pageRouteTag">Page Route</label>
<input type="text" class="form-control" formControlName="route" id="pageRouteTag" placeholder="Page Route">
</div>
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.name.valid && myForm.controls.name.dirty}">
<label for="pageNameTag">Page Name</label>
<input type="text" class="form-control" formControlName="name" id="pageNameTag" placeholder="Page Name">
</div>
<div *ngIf="!type" class="form-group" [ngClass]="{'has-error':!myForm.controls.type.valid && myForm.controls.type.dirty}">
<label for="typeTag">Select Type</label>
<select formControlName="type" id="typeTag" class="form-control">
<option [value]="'search'">search</option>
<option [value]="'link'">link</option>
<option [value]="'share'">share</option>
</select>
</div>
<div formArrayName="entities" class="form-group">
<label for="entityNameTag">Entity Name</label>
<div id="entityNameTag">
<pre class="card card-block card-header"><span *ngFor="let entity of myForm.value.entities; let i=index">{{entity.name}}<span *ngIf="i<(myForm.value.entities.length-1)">, </span></span></pre>
<button type="button" (click)="toggle()">Add / Remove entities</button>
<ng-container *ngIf="!myForm.value.isCollapsed" >
<div *ngFor="let entity of getKeys(allEntities)">
<span>
<span *ngIf="allEntities.get(entity)" class="activated" >
<input (click)="toggleEntity(false,[entity._id], entity)" class="deactivate" src="imgs/delete-icon.png" title="Disable" width="20" type="image" height="20">
</span>
<span *ngIf="!allEntities.get(entity)" class="deactivated" >
<input (click)="toggleEntity(true,[entity._id], entity)" class="deactivate" src="imgs/add-icon.png" title="Enable" width="20" type="image" height="20">
</span>
{{entity.name}}
</span>
</div>
</ng-container>
</div>
</div>
<input type="hidden" formControlName="_id">
</form>