disabled states select if template has no states

This commit is contained in:
Edi Cziszter 2022-02-15 12:51:24 +02:00
parent 36b1ec2557
commit d410e9ed49
4 changed files with 17 additions and 11 deletions

View File

@ -55,14 +55,7 @@
<div class="flex fields-container">
<div class="iqser-input-group w-300">
<label translate="edit-dossier-dialog.general-info.form.dossier-status.label"></label>
<mat-select
[placeholder]="
currentStatus
? currentStatus.name
: ('edit-dossier-dialog.general-info.form.dossier-status.placeholder' | translate)
"
formControlName="dossierStatusId"
>
<mat-select [placeholder]="statusPlaceholder" [disabled]="states.length === 0" formControlName="dossierStatusId">
<mat-option *ngFor="let state of states" [value]="state.dossierStatusId">
<div class="flex-align-items-center">
<redaction-small-chip [color]="state.color"></redaction-small-chip>

View File

@ -16,6 +16,7 @@ import { DossierStatsService } from '@services/entity-services/dossier-stats.ser
import { firstValueFrom } from 'rxjs';
import { DossierStateService } from '@services/entity-services/dossier-state.service';
import { DOSSIER_TEMPLATE_ID } from '@utils/constants';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'redaction-edit-dossier-general-info',
@ -44,6 +45,7 @@ export class EditDossierGeneralInfoComponent implements OnInit, EditDossierSecti
private readonly _router: Router,
private readonly _editDossierDialogRef: MatDialogRef<EditDossierDialogComponent>,
private readonly _toaster: Toaster,
private readonly _translateService: TranslateService,
) {}
get changed(): boolean {
@ -71,7 +73,17 @@ export class EditDossierGeneralInfoComponent implements OnInit, EditDossierSecti
return this.hasDueDate && this.form.get('dueDate').value === null;
}
async ngOnInit() {
get statusPlaceholder(): string {
if (this.states.length === 0) {
return this._translateService.instant('edit-dossier-dialog.general-info.form.dossier-status.no-status-placeholder');
} else if (this.currentStatus) {
return this.currentStatus.name;
} else {
return this._translateService.instant('edit-dossier-dialog.general-info.form.dossier-status.placeholder');
}
}
ngOnInit() {
this.#filterInvalidDossierTemplates();
this.form = this.#getForm();
if (!this.permissionsService.canEditDossier(this.dossier)) {

View File

@ -418,7 +418,7 @@
},
"suggestion": "Would you like to replace the states of the Dossiers with another status?",
"title": "Delete Dossier Status",
"warning": "The {name} status is assigned to {count} Dossiers."
"warning": "The {name} status is assigned to {count} {count, plural, one{Dossier} other{Dossiers}}."
},
"confirm-delete-file-attribute": {
"cancel": "Keep {type, select, single{Attribute} bulk{Attributes} other{}}",
@ -1010,6 +1010,7 @@
},
"dossier-status": {
"label": "Dossier Status",
"no-status-placeholder": "This dossier template has no states",
"placeholder": "Undefined"
},
"due-date": "Due Date",

@ -1 +1 @@
Subproject commit d4b1bb5c07594dbce9d78cf56d26f75334116aaf
Subproject commit f54374859ec75ea73921b9e6a934bd3747f9721d