add preview description template on plan upload dialog
This commit is contained in:
parent
93626f0260
commit
17f71b118f
|
@ -149,7 +149,7 @@ export class PlanBlueprintService {
|
||||||
filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteWithDefinitonLookup(searchQuery, null, null, [PlanBlueprintStatus.Finalized])).pipe(map(x => x.items)),
|
filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteWithDefinitonLookup(searchQuery, null, null, [PlanBlueprintStatus.Finalized])).pipe(map(x => x.items)),
|
||||||
getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteWithDefinitonLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])),
|
getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteWithDefinitonLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])),
|
||||||
displayFn: (item: PlanBlueprint) => item.label,
|
displayFn: (item: PlanBlueprint) => item.label,
|
||||||
subtitleFn: (item: PlanBlueprint) => this.language.instant('Plan-EDITOR.FIELDS.Plan-BLUEPRINT-VERSION') + ' '+ item.version,
|
subtitleFn: (item: PlanBlueprint) => this.language.instant('PLAN-EDITOR.FIELDS.PLAN-BLUEPRINT-VERSION') + ' '+ item.version,
|
||||||
titleFn: (item: PlanBlueprint) => item.label,
|
titleFn: (item: PlanBlueprint) => item.label,
|
||||||
valueAssign: (item: PlanBlueprint) => item.id,
|
valueAssign: (item: PlanBlueprint) => item.id,
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<mat-form-field class="w-100">
|
<mat-form-field class="w-100">
|
||||||
<mat-label>{{'PLAN-UPLOAD.FIELDS.DESCRIPTION-TEMPLATE' | translate}}</mat-label>
|
<mat-label>{{'PLAN-UPLOAD.FIELDS.DESCRIPTION-TEMPLATE' | translate}}</mat-label>
|
||||||
<app-single-auto-complete required="true" placeholder="{{'PLAN-UPLOAD.FIELDS.DESCRIPTION-TEMPLATE-PLACHOLDER' | translate}}" [formControl]="description.get('templateId')" [configuration]="descriptionTemplateSingleAutocompleteConfiguration"></app-single-auto-complete>
|
<app-single-auto-complete required="true" placeholder="{{'PLAN-UPLOAD.FIELDS.DESCRIPTION-TEMPLATE-PLACHOLDER' | translate}}" [formControl]="description.get('templateId')" (optionActionClicked)="onPreviewDescriptionTemplate($event, descriptionIndex)" [configuration]="descriptionTemplateSingleAutocompleteConfiguration"></app-single-auto-complete>
|
||||||
<mat-error *ngIf="description.get('templateId').hasError('backendError')">{{description.get('templateId').getError('backendError').message}}</mat-error>
|
<mat-error *ngIf="description.get('templateId').hasError('backendError')">{{description.get('templateId').getError('backendError').message}}</mat-error>
|
||||||
<mat-error *ngIf="description.get('templateId').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="description.get('templateId').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
|
@ -18,6 +18,8 @@ import { IsActive } from '@notification-service/core/enum/is-active.enum';
|
||||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
import { Guid } from '@common/types/guid';
|
||||||
|
import { DescriptionTemplatePreviewDialogComponent } from '@app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'plan-upload-dialog',
|
selector: 'plan-upload-dialog',
|
||||||
|
@ -162,6 +164,23 @@ export class PlanUploadDialogComponent extends BaseComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onPreviewDescriptionTemplate(event, descriptionIndex: number) {
|
||||||
|
const dialogRef = this.dialog.open(DescriptionTemplatePreviewDialogComponent, {
|
||||||
|
width: '590px',
|
||||||
|
minHeight: '200px',
|
||||||
|
restoreFocus: false,
|
||||||
|
data: {
|
||||||
|
descriptionTemplateId: event.id
|
||||||
|
},
|
||||||
|
panelClass: 'custom-modalbox'
|
||||||
|
});
|
||||||
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(groupId => {
|
||||||
|
if (groupId) {
|
||||||
|
(this.formGroup.get('descriptions') as UntypedFormArray).at(descriptionIndex).get('templateId').patchValue(event.id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
hasFile(): boolean {
|
hasFile(): boolean {
|
||||||
return this.files && this.files.length > 0;
|
return this.files && this.files.length > 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { NgxDropzoneModule } from 'ngx-dropzone';
|
||||||
import { PlanUploadDialogComponent } from './plan-upload-dialog.component';
|
import { PlanUploadDialogComponent } from './plan-upload-dialog.component';
|
||||||
import { ReactiveFormsModule } from '@angular/forms';
|
import { ReactiveFormsModule } from '@angular/forms';
|
||||||
import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module';
|
import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module';
|
||||||
|
import { DescriptionTemplatePreviewDialogModule } from '@app/ui/admin/description-template/description-template-preview/description-template-preview-dialog.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -14,7 +15,8 @@ import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.mod
|
||||||
FormattingModule,
|
FormattingModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
AutoCompleteModule,
|
AutoCompleteModule,
|
||||||
NgxDropzoneModule
|
NgxDropzoneModule,
|
||||||
|
DescriptionTemplatePreviewDialogModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
PlanUploadDialogComponent,
|
PlanUploadDialogComponent,
|
||||||
|
|
Loading…
Reference in New Issue