<app-common-dialog [dialogContent]="dialogContent" [limitTitle]="true" [dialogRef]="dialogRef">
  <ng-template #dialogContent>
    <p [class.hide]="!hideOptions" i18n>End-user email notifications are disabled for ticket's support department.</p>
    <form [formGroup]="closeTicketForm" layoutDirection="column" [class.hide]="hideOptions">
      <app-form-errors #formErrors [formGroup]="closeTicketForm"></app-form-errors>
      <mat-checkbox formControlName="send_notification" [color]="'primary'" i18n>
        Send email notification
      </mat-checkbox>
      <ng-container *ngIf="closeTicketForm.controls.send_notification.value">
        <mat-form-field appFlex="100" class="fl-margin-top">
          <mat-label i18n>End-user message template</mat-label>
          <mat-select formControlName="end_user_custom_template_name" placeholder="End-user message template" i18n-placeholder>
            <mat-option *ngFor="let template of templates" [value]="template.name">
              {{template.name}}
            </mat-option>
          </mat-select>
        </mat-form-field>
        <div *ngIf="selectedMessageTemplate && formattedTemplate && formattedTemplate?.title">
          <p class="fl-bold">{{formattedTemplate.title}}</p>
          <div class="message-body" [innerHTML]="formattedTemplate.content"></div>
        </div>
      </ng-container>
    </form>
  </ng-template>
</app-common-dialog>
