feat: 174 define an order property on structures

Merge request reports

Loading
+12 −0
Changes for src/app/features/admin/structure/components/presentationals/admin-structure-form/admin-structure-form.presentational.html: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -111,6 +111,18 @@
      <mat-error #errors></mat-error>
    </mat-form-field>

    <mat-form-field *ngIf="getFormControl(formDefinition.sortValue) as fd"
                    [appearance]="appearanceInputMaterial"
    >
      <mat-label>{{labelTranslateEnum.sort | translate}}</mat-label>
      <input matInput
             [solidifyValidation]="errors"
             [formControl]="fd"
             [required]="formValidationHelper.hasRequiredField(fd)"
      >
      <mat-error #errors></mat-error>
    </mat-form-field>

  </ng-template>

  <aou-shared-additional-information-panel-container *ngIf="model | isNotNullNorUndefined"
+3 −0
Changes for src/app/features/admin/structure/components/presentationals/admin-structure-form/admin-structure-form.presentational.ts: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ export class AdminStructureFormPresentational extends AbstractFormPresentational
      [this.formDefinition.dewey]: ["", [Validators.required, SolidifyValidator]],
      [this.formDefinition.validUntil]: ["", [SolidifyValidator]],
      [this.formDefinition.parentStructure]: ["", [SolidifyValidator]],
      [this.formDefinition.sortValue]: ["", [SolidifyValidator]],
    });
  }

@@ -86,6 +87,7 @@ export class AdminStructureFormPresentational extends AbstractFormPresentational
      [this.formDefinition.dewey]: [structure.dewey, [Validators.required, SolidifyValidator]],
      [this.formDefinition.validUntil]: [structure.validUntil, [SolidifyValidator]],
      [this.formDefinition.parentStructure]: [structure.parentStructure?.resId, [SolidifyValidator]],
      [this.formDefinition.sortValue]: [structure.sortValue, [SolidifyValidator]],
    });
  }

@@ -109,5 +111,6 @@ class FormComponentFormDefinition extends BaseFormDefinition {
  @PropertyName() cStruct: string;
  @PropertyName() dewey: string;
  @PropertyName() validUntil: string;
  @PropertyName() sortValue: string;
  @PropertyName() parentStructure: string;
}
+5 −1
Changes for src/app/features/admin/structure/stores/admin-structure.state.ts: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import {
  isNullOrUndefined,
  MARK_AS_TRANSLATABLE,
  NotificationService,
  OrderEnum,
  OverrideDefaultAction,
  QueryParameters,
  ResourceState,
@@ -49,7 +50,10 @@ export interface AdminStructureStateModel extends ResourceStateModel<Structure>
  name: StateEnum.admin_structure,
  defaults: {
    ...defaultResourceStateInitValue(),
    queryParameters: new QueryParameters(environment.defaultEnumValuePageSizeOption),
    queryParameters: new QueryParameters(environment.defaultEnumValuePageSizeOption, {
      field: "sortValue",
      order: OrderEnum.ascending,
    }),
  },
})
export class AdminStructureState extends ResourceState<AdminStructureStateModel, Structure> {
+9 −7
Changes for src/app/models/index.ts: 9 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ export interface Institution extends InstitutionPartial, BaseResource {

export interface Language extends LanguagePartial, BaseResource {
  labels?: Label[];
  sortValue?: number;
}

export interface License extends LicensePartial, BaseResource {
@@ -158,13 +159,14 @@ export interface Role extends RolePartial, BaseResource {
}

export interface Structure extends BaseResource {
  name: string;
  status: Enums.Structure.StatusEnum;
  cnStructC: string;
  cStruct: string;
  dewey: string;
  validUntil: string;
  parentStructure: Structure;
  name?: string;
  status?: Enums.Structure.StatusEnum;
  cnStructC?: string;
  cStruct?: string;
  dewey?: string;
  validUntil?: string;
  parentStructure?: Structure;
  sortValue?: number;
}

export interface SystemProperty extends SystemPropertyPartial, BaseResource {
+6 −2
Changes for src/app/shared/stores/structure/shared-structure.state.ts: 6 added lines, 2 removed lines.
Original line number Diff line number Diff line
import {Injectable} from "@angular/core";
import {ApiEnum} from "@app/shared/enums/api.enum";
import {StateEnum} from "../../enums/state.enum";
import {Structure} from "@models";
import {
  Actions,
@@ -13,12 +12,14 @@ import {
  ApiService,
  defaultResourceStateInitValue,
  NotificationService,
  OrderEnum,
  QueryParameters,
  ResourceState,
  ResourceStateModel,
  StoreUtil,
} from "solidify-frontend";
import {environment} from "../../../../environments/environment";
import {StateEnum} from "../../enums/state.enum";

export interface SharedStructureStateModel extends ResourceStateModel<Structure> {
}
@@ -28,7 +29,10 @@ export interface SharedStructureStateModel extends ResourceStateModel<Structure>
  name: StateEnum.shared_structure,
  defaults: {
    ...defaultResourceStateInitValue(),
    queryParameters: new QueryParameters(environment.defaultEnumValuePageSizeOption),
    queryParameters: new QueryParameters(environment.defaultEnumValuePageSizeOption, {
      field: "sortValue",
      order: OrderEnum.ascending,
    }),
  },
})
export class SharedStructureState extends ResourceState<SharedStructureStateModel, Structure> {
Loading