diff --git a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html index 68811b99a..362dcbf2a 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html +++ b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.html @@ -553,7 +553,7 @@ type="button" mat-icon-button matTooltip="{{ 'Create final print template' | translate }}" - *ngIf="motion.state.isFinalState && !motion.modified_final_version" + *ngIf="showCreateFinalVersionButton" (click)="createModifiedFinalVersion()" > file_copy @@ -564,6 +564,7 @@ type="button" mat-icon-button *ngIf="isRecoMode(ChangeRecoMode.ModifiedFinal) && !isFinalEdit" + matTooltip="{{ 'Edit final print template' | translate }}" (click)="editModifiedFinal()" > edit @@ -574,6 +575,7 @@ *ngIf="isRecoMode(ChangeRecoMode.ModifiedFinal) && isFinalEdit" mat-icon-button [disabled]="!finalVersionEdited" + matTooltip="{{ 'Save final print template' | translate }}" (click)="onSubmitFinalVersion()" > save @@ -583,6 +585,7 @@ type="button" *ngIf="isRecoMode(ChangeRecoMode.ModifiedFinal) && isFinalEdit" mat-icon-button + matTooltip="{{ 'Cancel editing without saving' | translate }}" (click)="cancelFinalVersionEdit()" > close diff --git a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts index d41415a0d..3041cfff4 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts +++ b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts @@ -171,6 +171,17 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit, return this.motion.showPreamble; } + public get showCreateFinalVersionButton(): boolean { + if ( + this.motion.isParagraphBasedAmendment() || + !this.motion.state.isFinalState || + this.motion.modified_final_version + ) { + return false; + } + return true; + } + /** * Saves the target motion. Accessed via the getter and setter. */ @@ -1267,6 +1278,9 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit, * Sets the modified final version to the final version. */ public async createModifiedFinalVersion(): Promise { + if (this.motion.isParagraphBasedAmendment()) { + throw new Error('Cannot create a final version of an amendment.'); + } // Get the final version and remove line numbers const changes: ViewUnifiedChange[] = Object.assign([], this.getChangesForFinalMode()); let finalVersion = this.repo.formatMotion(