src/app/core/admin/admin-entity-public-forms/admin-entity-public-forms-component.ts

Metadata

Relationships

Index

Properties
Inputs

Inputs

entityConstructor
Type : EntityConstructor
Required :  true

The entity type for which to display public forms for.

Properties

Protected dummyEntity
Type : unknown
Default value : computed( () => ({ getId: () => this.entityConstructor().ENTITY_TYPE, getType: () => this.entityConstructor().ENTITY_TYPE, }) as Entity, )

Fake entity instance to correctly filter/link related PublicFormConfigs using the standard related-entities component.

import {
  ChangeDetectionStrategy,
  Component,
  computed,
  input,
} from "@angular/core";
import { Entity, EntityConstructor } from "app/core/entity/model/entity";
import { ViewTitleComponent } from "../../common-components/view-title/view-title.component";
import { RelatedEntitiesComponent } from "../../entity-details/related-entities/related-entities.component";
import { HintBoxComponent } from "#src/app/core/common-components/hint-box/hint-box.component";

@Component({
  selector: "app-admin-entity-public-forms-component",
  templateUrl: "./admin-entity-public-forms-component.html",
  styleUrls: ["./admin-entity-public-forms-component.scss"],
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [ViewTitleComponent, RelatedEntitiesComponent, HintBoxComponent],
})
export class AdminEntityPublicFormsComponent {
  /**
   * The entity type for which to display public forms for.
   */
  entityConstructor = input.required<EntityConstructor>();

  /**
   * Fake entity instance to correctly filter/link related PublicFormConfigs
   * using the standard related-entities component.
   */
  protected dummyEntity = computed(
    () =>
      ({
        getId: () => this.entityConstructor().ENTITY_TYPE,
        getType: () => this.entityConstructor().ENTITY_TYPE,
      }) as Entity,
  );
}
<app-hint-box i18n>
  You can share the link to a "Public Form" with people who do not have an
  account or embed it in your website. People can submit new records through
  this form without logging in. For example, you can let participants
  self-register this way and then review their data later.
</app-hint-box>

<app-view-title [disableBackButton]="true" [displayInPlace]="true" i18n>
  Public Forms
</app-view-title>

<div>
  <app-related-entities
    entityType="PublicFormConfig"
    property="entity"
    [columns]="['title', 'route', 'description']"
    [entity]="dummyEntity()"
    clickMode="popup-details"
  ></app-related-entities>
</div>

<div class="padding-regular" i18n>
  You can also create forms for <strong>"related records"</strong> (e.g. a
  survey that links back to the participant's record who has submitted the
  form). For this, create a form for the "related record's type" (e.g. the
  survey record) and enable the setting to create custom, individualized form
  links there.
</div>

./admin-entity-public-forms-component.scss

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""