description ui changes (add next button)

This commit is contained in:
amentis 2024-04-22 16:02:51 +03:00
parent 218fab4fd1
commit e6309a8885
4 changed files with 35 additions and 143 deletions

View File

@ -111,8 +111,8 @@
<div>{{'DESCRIPTION-EDITOR.TOC.NEXT' | translate}}</div> <div>{{'DESCRIPTION-EDITOR.TOC.NEXT' | translate}}</div>
<span class="material-icons">chevron_right</span> <span class="material-icons">chevron_right</span>
</div> </div>
<button [disabled]="saving" (click)="save(saveAnd.addNew)" *ngIf="(step === maxStep) && !isLocked && formGroup.get('descriptionTemplateId').value && !viewOnly" mat-raised-button type="button" class="col-auto stepper-btn add-description-btn ml-auto"> <button [disabled]="saving" (click)="saveAndClose()" *ngIf="(step === maxStep) && !isLocked && formGroup.get('descriptionTemplateId').value && !viewOnly" mat-raised-button type="button" class="col-auto stepper-btn add-description-btn ml-auto">
{{ 'DESCRIPTION-EDITOR.ACTIONS.SAVE-AND-ADD-NEW' | translate }} {{ 'DESCRIPTION-EDITOR.ACTIONS.SAVE' | translate }}
</button> </button>
</div> </div>
<div class="col-auto pr-0"> <div class="col-auto pr-0">

View File

@ -806,6 +806,37 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
} }
} }
get maxStep() {
return this.visibleFieldSets.length;
}
public nextStep() {
if (this.step < this.maxStep) {//view is changing
this.step = Math.floor(this.step + 1);
let entry = this.visibleFieldSets[this.step - 1];
this.table0fContents.onToCentrySelected(entry, false);
this.scroll(entry);
}
}
public previousStep() {
if (this.step > 0) {
this.step = Math.ceil(this.step - 1);
if (this.step >= 1) {
let entry = this.visibleFieldSets[this.step - 1];
this.table0fContents.onToCentrySelected(entry, false);
this.scroll(entry);
} else {
this.table0fContents.onToCentrySelected(null, false);
this.resetScroll();
}
}
}
private scroll(entry: ToCEntry) {
document.getElementById(entry.id).scrollIntoView();
}
private resetScroll() { private resetScroll() {
document.getElementById('description-editor-form').scrollTop = 0; document.getElementById('description-editor-form').scrollTop = 0;
} }
@ -1968,56 +1999,6 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
// } // }
// hasNotReversableStatus(): boolean {
// if (this.formGroup.get('dmp').value && !this.publicMode) {
// return (this.formGroup.get('dmp').value.status == DmpStatus.Finalized && this.formGroup.get('status').value == DescriptionStatus.Finalized);
// } else {
// return false;
// }
// }
// reverse() {
// this.dialog.open(ConfirmationDialogComponent, {
// data: {
// message: this.language.instant('DATASET-WIZARD.ACTIONS.UNDO-FINALIZATION-QUESTION'),
// confirmButton: this.language.instant('DATASET-WIZARD.ACTIONS.CONFIRM'),
// cancelButton: this.language.instant('DATASET-WIZARD.ACTIONS.REJECT'),
// },
// maxWidth: '30em'
// })
// .afterClosed()
// .pipe(
// filter(x => x),
// takeUntil(this._destroyed)
// ).subscribe(result => {
// if (result) {
// // if (!this.isFormValid()) { return; }
// this.formGroup.get('status').setValue(DescriptionStatus.Draft);
// this.submit(SaveType.finalize, () => {
// this.viewOnly = false;
// this.descriptionModel.status = DescriptionStatus.Draft;
// setTimeout(x => {
// this.formGroup = null;
// });
// setTimeout(x => {
// this.formGroup = this.descriptionModel.buildForm();
// this.registerFormListeners();
// });
// }, () => {
// this.formGroup.get('status').setValue(DescriptionStatus.Finalized);
// this.viewOnly = true;
// });
// } else {
// this.saving = false;
// }
// });
// }
// saveFinalize() { // saveFinalize() {
// // this.formService.touchAllFormFields(this.formGroup); // // this.formService.touchAllFormFields(this.formGroup);
// this.saving = true; // this.saving = true;
@ -2125,43 +2106,6 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
// }); // });
// } // }
// downloadPDF(id: string): void {
// this.descriptionService.downloadPDF(id)
// .pipe(takeUntil(this._destroyed))
// .subscribe(response => {
// const blob = new Blob([response.body], { type: 'application/pdf' });
// const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
// FileSaver.saveAs(blob, filename);
// this.matomoService.trackDownload('descriptions', "pdf", id);
// });
// }
// downloadDOCX(id: string): void {
// this.descriptionService.downloadDOCX(id)
// .pipe(takeUntil(this._destroyed))
// .subscribe(response => {
// const blob = new Blob([response.body], { type: 'application/msword' });
// const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
// FileSaver.saveAs(blob, filename);
// this.matomoService.trackDownload('descriptions', "docx", id);
// });
// }
// downloadXML(id: string): void {
// this.descriptionService.downloadXML(id)
// .pipe(takeUntil(this._destroyed))
// .subscribe(response => {
// const blob = new Blob([response.body], { type: 'application/xml' });
// const filename = this.fileUtils.getFilenameFromContentDispositionHeader(response.headers.get('Content-Disposition'));
// FileSaver.saveAs(blob, filename);
// this.matomoService.trackDownload('descriptions', "xml", id);
// });
// }
// // advancedClicked() { // // advancedClicked() {
// // const dialogRef = this.dialog.open(ExportMethodDialogComponent, { // // const dialogRef = this.dialog.open(ExportMethodDialogComponent, {
// // maxWidth: '500px', // // maxWidth: '500px',
@ -2326,53 +2270,6 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
// } // }
// } // }
// public changeStep(selected: ToCEntry = null, execute: boolean = true) {
// if (execute) {
// if (selected) {
// let fieldSet = this.getFirstFieldSet(selected);
// let index = this.visibleFieldSets.findIndex(entry => entry.id === fieldSet.id);
// this.step = index + (selected.type === ToCEntryType.FieldSet ? 1 : 0.5);
// } else {
// this.step = 0;
// this.resetScroll();
// }
// }
// }
// get maxStep() {
// return this.visibleFieldSets.length;
// }
// public nextStep() {
// if (this.step < this.maxStep) {//view is changing
// this.step = Math.floor(this.step + 1);
// let entry = this.visibleFieldSets[this.step - 1];
// this.table0fContents.onToCentrySelected(entry, false);
// this.scroll(entry);
// }
// }
// public previousStep() {
// if (this.step > 0) {
// this.step = Math.ceil(this.step - 1);
// if (this.step >= 1) {
// let entry = this.visibleFieldSets[this.step - 1];
// this.table0fContents.onToCentrySelected(entry, false);
// this.scroll(entry);
// } else {
// this.table0fContents.onToCentrySelected(null, false);
// this.resetScroll();
// }
// }
// }
// private resetScroll() {
// document.getElementById('description-editor-form').scrollTop = 0;
// }
// private scroll(entry: ToCEntry) {
// document.getElementById(entry.id).scrollIntoView();
// }
// isDirty() { // isDirty() {
// return this.formGroup.dirty && this.hasChanges; // do we need this.formGroup.dirty // return this.formGroup.dirty && this.hasChanges; // do we need this.formGroup.dirty
@ -2411,11 +2308,6 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
// this.location.go(url); // this.location.go(url);
// } // }
// backToDmp(id: string) {
// this.router.navigate(['/plans', 'edit', id]);
// }
// getLinks(currentLinks: Link[]) { // getLinks(currentLinks: Link[]) {
// this.links = currentLinks; // this.links = currentLinks;

View File

@ -13,7 +13,7 @@
</div> </div>
</div> </div>
<div *ngIf="!fieldSet?.multiplicity?.tableView" class="col-12"> <div *ngIf="!fieldSet?.multiplicity?.tableView" class="col-12">
<div class="row" *ngFor="let fieldSetItemPropertiesControl of propertiesFormGroup?.get('items')?.controls"> <div class="row" *ngFor="let fieldSetItemPropertiesControl of propertiesFormGroup?.get('items')?.controls; let i=index;">
<div class="col" *ngIf="visibilityRulesService && visibilityRulesService.isVisibleMap[fieldSet.id + '_' + fieldSetItemPropertiesControl.get('ordinal').value] ?? true"> <div class="col" *ngIf="visibilityRulesService && visibilityRulesService.isVisibleMap[fieldSet.id + '_' + fieldSetItemPropertiesControl.get('ordinal').value] ?? true">
<div class="row"> <div class="row">
<div *ngFor="let field of fieldSet.fields; let i = index;" class="col-12"> <div *ngFor="let field of fieldSet.fields; let i = index;" class="col-12">

View File

@ -107,7 +107,7 @@
</ng-container> </ng-container>
<ng-container *ngSwitchCase="descriptionTemplateFieldTypeEnum.UPLOAD"> <ng-container *ngSwitchCase="descriptionTemplateFieldTypeEnum.UPLOAD">
<div class="col-12 d-flex justify-content-center"> <div class="col-12 d-flex justify-content-center">
<ngx-dropzone class="drop-file col-12" (change)="fileChangeEvent($event, true)" [multiple]="false" [accept]="typesToString()" [disabled]="propertiesFormGroup?.get(field.id).get('textValue').disabled"> <ngx-dropzone #drop class="drop-file col-12" (change)="fileChangeEvent($event, true)" [multiple]="false" [accept]="typesToString()" [disabled]="propertiesFormGroup?.get(field.id).get('textValue').disabled">
<ngx-dropzone-preview *ngIf="propertiesFormGroup?.get(field.id).get('textValue').value" class="file-preview" [removable]="true" (removed)="onRemove()"> <ngx-dropzone-preview *ngIf="propertiesFormGroup?.get(field.id).get('textValue').value" class="file-preview" [removable]="true" (removed)="onRemove()">
<ngx-dropzone-label class="file-label">{{ fileNameDisplay }}</ngx-dropzone-label> <ngx-dropzone-label class="file-label">{{ fileNameDisplay }}</ngx-dropzone-label>
</ngx-dropzone-preview> </ngx-dropzone-preview>