diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 62007db3644c78d31a88d39256bfd2aeb84334fb..e126c3b70454bc024384bff6691b1b7f1b63439e 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -57,6 +57,15 @@ const routes: DlcmRoutes = [ }, canActivate: [ApplicationRoleGuardService], }, + { + path: AppRoutesEnum.order, + // @ts-ignore Dynamic import + loadChildren: () => import("./features/order/order.module").then(m => m.OrderModule), + data: { + breadcrumb: TRANSLATE("breadcrumb.order.root"), + }, + canActivate: [ApplicationRoleGuardService], + }, { path: AppRoutesEnum.root, redirectTo: AppRoutesEnum.homePage, diff --git a/src/app/components/presentationals/main-toolbar/abstract-main-toolbar/abstract-main-toolbar.presentational.ts b/src/app/components/presentationals/main-toolbar/abstract-main-toolbar/abstract-main-toolbar.presentational.ts index 241e64b658b3675ef2233c66f5cb9067fcc4296b..4b6fea1df804046942a12370381bb8f943ab265d 100644 --- a/src/app/components/presentationals/main-toolbar/abstract-main-toolbar/abstract-main-toolbar.presentational.ts +++ b/src/app/components/presentationals/main-toolbar/abstract-main-toolbar/abstract-main-toolbar.presentational.ts @@ -6,7 +6,10 @@ import {SharedAbstractPresentational} from "@app/shared/components/presentationa import {ApplicationRolePermissionEnum} from "@app/shared/enums/application-role-permission.enum"; import {ApplicationRoleEnum} from "@app/shared/enums/application-role.enum"; import {LanguagesEnum} from "@app/shared/enums/languages.enum"; -import {RoutesEnum} from "@app/shared/enums/routes.enum"; +import { + AppRoutesEnum, + RoutesEnum, +} from "@app/shared/enums/routes.enum"; import {ThemeEnum} from "@app/shared/enums/theme.enum"; import {PermissionUtil} from "@app/shared/utils/permission.util"; import {UserExtended} from "@shared/models/business/user-extended.model"; @@ -39,6 +42,9 @@ export abstract class AbstractMainToolbarPresentational extends SharedAbstractPr @Input() numberArchiveInCart: number = 0; + @Input() + numberNewOrderHistory: number = 0; + @Input() private userRoles: ApplicationRoleEnum[]; @@ -146,6 +152,10 @@ export abstract class AbstractMainToolbarPresentational extends SharedAbstractPr this._cartBS.next(); } + openOrder(): void { + this._navigateBS.next(AppRoutesEnum.order); + } + login(): void { this.oauthService.initAuthorizationCodeFlow(); } diff --git a/src/app/components/presentationals/main-toolbar/main-toolbar-desktop-vertical/main-toolbar-desktop-vertical.presentational.html b/src/app/components/presentationals/main-toolbar/main-toolbar-desktop-vertical/main-toolbar-desktop-vertical.presentational.html index f53b0b9c535ac1a85d1834c99f3cf2145c30a158..265ef6ec61de43b3c167e72dfab170c6b9e70e8e 100644 --- a/src/app/components/presentationals/main-toolbar/main-toolbar-desktop-vertical/main-toolbar-desktop-vertical.presentational.html +++ b/src/app/components/presentationals/main-toolbar/main-toolbar-desktop-vertical/main-toolbar-desktop-vertical.presentational.html @@ -34,6 +34,23 @@ </dlcm-theme-selector> <ul class="menu"> + <li *ngIf="logged" + class="cart" + [matTooltip]="'app.toolbar.orderHistory' | translate" + [matTooltipPosition]="'right'" + (click)="openOrder()" + > + <span [matBadge]="numberNewOrderHistory" + matBadgeColor="primary" + matBadgeSize="small" + [matBadgeHidden]="numberNewOrderHistory === 0" + matBadgeDescription="Counter of new order in order history" + > + <fa-icon icon="shipping-fast" + ></fa-icon> + </span> + </li> + <li *ngIf="logged" class="cart" [matTooltip]="'app.toolbar.cart' | translate" diff --git a/src/app/features/order/components/routables/order-home/order-home.routable.html b/src/app/features/order/components/routables/order-home/order-home.routable.html new file mode 100644 index 0000000000000000000000000000000000000000..6283cdd13f16c49be6cff9114f4d7a6663ca8606 --- /dev/null +++ b/src/app/features/order/components/routables/order-home/order-home.routable.html @@ -0,0 +1,18 @@ +<h1>{{'order.home.title' | translate}}</h1> + +<div class="cards-container"> + <mat-card *ngFor="let resource of getOrderResources()" + class="card" + (click)="navigate(resource.path)" + > + <mat-card-header class="card-header"> + <div class="avatar" + mat-card-avatar + > + <fa-icon [icon]="resource.avatarIcon"></fa-icon> + </div> + <mat-card-title>{{resource.titleToTranslate | translate}}</mat-card-title> + <mat-card-subtitle>{{resource.subtitleToTranslate | translate}}</mat-card-subtitle> + </mat-card-header> + </mat-card> +</div> diff --git a/src/app/features/order/components/routables/order-home/order-home.routable.scss b/src/app/features/order/components/routables/order-home/order-home.routable.scss new file mode 100644 index 0000000000000000000000000000000000000000..21970827372671e6de04b65f90ffa9efc6b97dba --- /dev/null +++ b/src/app/features/order/components/routables/order-home/order-home.routable.scss @@ -0,0 +1,55 @@ +@import "../sass/abstracts/variables"; +@import "../sass/abstracts/mixins"; + +$card-width: 300px; +$card-height: 85px; +$card-margin: 10px; + +.cards-container { + display: flex; + justify-content: center; + flex-wrap: wrap; + + .card { + cursor: pointer; + width: $card-width; + height: $card-height; + margin: $card-margin; + + @include respond-to-smaller-than-breakpoint("sm") { + width: 100%; + min-height: $card-height; + height: auto; + } + + transition-property: box-shadow; + transition-duration: 0.25s; + + &:hover { + box-shadow: 0px 2px 20px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 1px 3px 0px rgba(0, 0, 0, 0.12); + } + + .card-header { + display: flex; + flex: 1; + height: 100%; + align-items: center; + + .avatar { + display: flex; + justify-content: center; + align-items: center; + + fa-icon { + font-size: 30px; + } + } + + .mat-card-subtitle { + margin-bottom: 0; + } + } + } +} + +@include content(); diff --git a/src/app/features/order/components/routables/order-home/order-home.routable.ts b/src/app/features/order/components/routables/order-home/order-home.routable.ts new file mode 100644 index 0000000000000000000000000000000000000000..eb75e308e31d62954894318ca40bb82427032cb8 --- /dev/null +++ b/src/app/features/order/components/routables/order-home/order-home.routable.ts @@ -0,0 +1,62 @@ +import { + ChangeDetectionStrategy, + Component, +} from "@angular/core"; +import {SharedAbstractPresentational} from "@app/shared/components/presentationals/shared-abstract/shared-abstract.presentational"; +import {ApplicationRoleEnum} from "@app/shared/enums/application-role.enum"; +import {RoutesEnum} from "@app/shared/enums/routes.enum"; +import {LocalStateModel} from "@app/shared/models/local-state.model"; +import {Navigate} from "@ngxs/router-plugin"; +import {Store} from "@ngxs/store"; +import {ApplicationRolePermissionEnum} from "@shared/enums/application-role-permission.enum"; +import {PermissionUtil} from "@shared/utils/permission.util"; +import {TRANSLATE} from "solidify-frontend"; + +@Component({ + selector: "dlcm-order-home-routable", + templateUrl: "./order-home.routable.html", + styleUrls: ["./order-home.routable.scss"], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class OrderHomeRoutable extends SharedAbstractPresentational { + + userRolesObs: ApplicationRoleEnum[]; + + orderResources: OrderResource[] = [ + { + avatarIcon: "cart-arrow-down", + titleToTranslate: TRANSLATE("order.myOrder.home.title"), + subtitleToTranslate: TRANSLATE("order.myOrder.home.subtitle"), + path: RoutesEnum.orderAllOrder, + isVisible: () => true, + }, + { + avatarIcon: "cart-arrow-down", + titleToTranslate: TRANSLATE("order.allOrder.home.title"), + subtitleToTranslate: TRANSLATE("order.allOrder.home.subtitle"), + path: RoutesEnum.orderAllOrder, + isVisible: () => PermissionUtil.isUserHavePermission(true, ApplicationRolePermissionEnum.adminPermission, this.userRolesObs), + }, + ]; + + constructor(private store: Store) { + super(); + this.userRolesObs = this.store.selectSnapshot((state: LocalStateModel) => state.application.userRoles); + } + + navigate(path: RoutesEnum): void { + this.store.dispatch(new Navigate([path])); + } + + getOrderResources(): OrderResource[] { + return this.orderResources.filter((resource) => resource.isVisible() === true); + } +} + +interface OrderResource { + avatarIcon: string; + titleToTranslate: string; + subtitleToTranslate: string; + path: RoutesEnum; + isVisible: () => boolean; +} diff --git a/src/app/features/preservation/order/enums/order-status.enum.ts b/src/app/features/order/enums/order-status.enum.ts similarity index 100% rename from src/app/features/preservation/order/enums/order-status.enum.ts rename to src/app/features/order/enums/order-status.enum.ts diff --git a/src/app/features/order/features/all-order/components/dialogs/all-order-delete/order-all-order-delete.dialog.ts b/src/app/features/order/features/all-order/components/dialogs/all-order-delete/order-all-order-delete.dialog.ts new file mode 100644 index 0000000000000000000000000000000000000000..4f2e67c42bbfbb67f18e68b9ed18a23b59954a45 --- /dev/null +++ b/src/app/features/order/features/all-order/components/dialogs/all-order-delete/order-all-order-delete.dialog.ts @@ -0,0 +1,37 @@ +import {AdminLicenseStateModel} from "@admin/license/stores/admin-license.state"; +import { + ChangeDetectionStrategy, + Component, + Inject, +} from "@angular/core"; +import { + MAT_DIALOG_DATA, + MatDialogRef, +} from "@angular/material"; +import {License} from "@app/generated-api"; +import {Store} from "@ngxs/store"; +import {orderAllOrderActionNameSpace} from "@order/features/all-order/stores/order-all-order.action"; +import {SharedAbstractDeleteDialog} from "@shared/components/dialogs/shared-abstract-delete/shared-abstract-delete.dialog"; +import {LocalStateEnum} from "@shared/enums/local-state.enum"; +import {DeleteDialog} from "@shared/models/delete-dialog.model"; +import {TRANSLATE} from "solidify-frontend"; + +@Component({ + selector: "dlcm-order-all-order-delete-dialog", + templateUrl: "../../../../../../../shared/components/dialogs/shared-abstract-delete/shared-abstract-delete.dialog.html", + styleUrls: ["../../../../../../../shared/components/dialogs/shared-abstract-delete/shared-abstract-delete.dialog.scss"], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class OrderAllOrderDeleteDialog extends SharedAbstractDeleteDialog<License, AdminLicenseStateModel> { + public readonly KEY_TITLE: string = TRANSLATE("order.allOrder.dialog.delete.title"); + public readonly KEY_MESSAGE: string = TRANSLATE("order.allOrder.dialog.delete.message"); + public readonly KEY_CONFIRM_BUTTON: string = TRANSLATE("order.allOrder.dialog.delete.confirm"); + public readonly KEY_CANCEL_BUTTON: string = TRANSLATE("order.allOrder.dialog.delete.cancel"); + + constructor(protected store: Store, + protected dialogRef: MatDialogRef<OrderAllOrderDeleteDialog>, + @Inject(MAT_DIALOG_DATA) public data: DeleteDialog) { + super(store, dialogRef, data, LocalStateEnum.order_allOrder, orderAllOrderActionNameSpace); + } + +} diff --git a/src/app/features/preservation/order/components/presentationals/order-form/preservation-order-form.presentational.html b/src/app/features/order/features/all-order/components/presentationals/all-order-form/order-all-order-form.presentational.html similarity index 81% rename from src/app/features/preservation/order/components/presentationals/order-form/preservation-order-form.presentational.html rename to src/app/features/order/features/all-order/components/presentationals/all-order-form/order-all-order-form.presentational.html index fe7a6cf0ada3649f89f421e402f4badc32b18ae8..987dafe14476e47e2233a2a538f260ff8c350562 100644 --- a/src/app/features/preservation/order/components/presentationals/order-form/preservation-order-form.presentational.html +++ b/src/app/features/order/features/all-order/components/presentationals/all-order-form/order-all-order-form.presentational.html @@ -4,7 +4,7 @@ <ng-template [ngIf]="readonly"> <mat-form-field *ngIf="getFormControl(formDefinition.resId) as fd"> <input [formControl]="fd" - [placeholder]="'preservation.order.form.resId' | translate" + [placeholder]="'order.allOrder.form.resId' | translate" matInput > </mat-form-field> @@ -12,7 +12,7 @@ <mat-form-field *ngIf="getFormControl(formDefinition.name) as fd"> <input [formControl]="fd" - [placeholder]="'preservation.order.form.name' | translate" + [placeholder]="'order.allOrder.form.name' | translate" matInput [required]="formValidationHelper.hasRequiredField(fd)" > @@ -21,7 +21,7 @@ <ng-template [ngIf]="readonly"> <mat-form-field *ngIf="getFormControl(formDefinition.status) as fd"> - <mat-label>{{'preservation.order.form.status' | translate }}</mat-label> + <mat-label>{{'order.allOrder.form.status' | translate }}</mat-label> <mat-select [formControl]="fd" > <mat-option *ngFor="let status of orderStatusEnumValues" @@ -34,7 +34,7 @@ </ng-template> <mat-form-field *ngIf="getFormControl(formDefinition.queryType) as fd"> - <mat-label>{{'preservation.order.form.queryType' | translate }}</mat-label> + <mat-label>{{'order.allOrder.form.queryType' | translate }}</mat-label> <mat-select [formControl]="fd" [required]="formValidationHelper.hasRequiredField(fd)" > @@ -49,7 +49,7 @@ <mat-form-field *ngIf="getFormControl(formDefinition.query) as fd"> <input [formControl]="fd" - [placeholder]="'preservation.order.form.query' | translate" + [placeholder]="'order.allOrder.form.query' | translate" matInput [required]="formValidationHelper.hasRequiredField(fd)" > @@ -63,7 +63,7 @@ type="submit" [disabled]="!form.valid || !form.dirty" > - {{'preservation.order.form.button.submit' | translate }} + {{'order.allOrder.form.button.submit' | translate }} </button> </div> </form> diff --git a/src/app/features/order/features/all-order/components/presentationals/all-order-form/order-all-order-form.presentational.scss b/src/app/features/order/features/all-order/components/presentationals/all-order-form/order-all-order-form.presentational.scss new file mode 100644 index 0000000000000000000000000000000000000000..895e4f70c1be0fb1d82960619b2719890852824d --- /dev/null +++ b/src/app/features/order/features/all-order/components/presentationals/all-order-form/order-all-order-form.presentational.scss @@ -0,0 +1,3 @@ +@import "src/sass/abstracts/mixins"; +@import "src/sass/abstracts/variables"; +@import "src/app/shared/components/presentationals/shared-abstract-form/shared-abstract-form.presentational"; diff --git a/src/app/features/preservation/order/components/presentationals/order-form/preservation-order-form.presentational.ts b/src/app/features/order/features/all-order/components/presentationals/all-order-form/order-all-order-form.presentational.ts similarity index 56% rename from src/app/features/preservation/order/components/presentationals/order-form/preservation-order-form.presentational.ts rename to src/app/features/order/features/all-order/components/presentationals/all-order-form/order-all-order-form.presentational.ts index 021ff653f70c0d93c4b5ef7cc67c72b05775c860..e14f8e2c450db9668f58b06898c6dfacd5e31dda 100644 --- a/src/app/features/preservation/order/components/presentationals/order-form/preservation-order-form.presentational.ts +++ b/src/app/features/order/features/all-order/components/presentationals/all-order-form/order-all-order-form.presentational.ts @@ -2,59 +2,30 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, - Input, OnInit, - Output, } from "@angular/core"; import { FormBuilder, Validators, } from "@angular/forms"; -import {MatDialog} from "@angular/material/dialog"; -import { - License, - Order, -} from "@app/generated-api"; -import {SharedAbstractFormPresentational} from "@app/shared/components/presentationals/shared-abstract-form/shared-abstract-form.presentational"; -import {BaseFormDefinition} from "@app/shared/models/base-form-definition.model"; -import {environment} from "@environments/environment"; -import {OrderStatusEnumHelper} from "@preservation/order/enums/order-status.enum"; -import {OrderQueryTypeEnumHelper} from "@preservation/order/helpers/order-query-type-enum.helper"; -import {AccessLevelEnumHelper} from "@shared/enums/business/access-level-enum.helper"; -import { - PackageStatusEnum, - PackageStatusEnumHelper, -} from "@shared/enums/business/package-status.enum"; -import { - AppRoutesEnum, - DepositRoutesEnum, - PreservationPlanningRoutesEnum, - RoutesEnum, -} from "@shared/enums/routes.enum"; -import {Storage} from "@shared/models/storage.model"; -import {BreakpointService} from "@shared/services/breakpoint.service"; -import {sharedLicenseActionNameSpace} from "@shared/stores/license/shared-license.action"; -import {SharedLicenseState} from "@shared/stores/license/shared-license.state"; -import { - BehaviorSubject, - Observable, -} from "rxjs"; +import {Order} from "@app/generated-api"; +import {OrderStatusEnumHelper} from "@order/enums/order-status.enum"; +import {OrderQueryTypeEnumHelper} from "@order/helpers/order-query-type-enum.helper"; +import {SharedAbstractFormPresentational} from "@shared/components/presentationals/shared-abstract-form/shared-abstract-form.presentational"; +import {BaseFormDefinition} from "@shared/models/base-form-definition.model"; import { KeyValue, - ObservableUtil, PropertyName, - ResourceNameSpace, SolidifyValidator, - urlSeparator, } from "solidify-frontend"; @Component({ - selector: "dlcm-preservation-order-form", - templateUrl: "./preservation-order-form.presentational.html", - styleUrls: ["./preservation-order-form.presentational.scss"], + selector: "dlcm-order-all-order-form", + templateUrl: "./order-all-order-form.presentational.html", + styleUrls: ["./order-all-order-form.presentational.scss"], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class PreservationOrderFormPresentational extends SharedAbstractFormPresentational<Order> implements OnInit { +export class OrderAllOrderFormPresentational extends SharedAbstractFormPresentational<Order> implements OnInit { formDefinition: FormComponentFormDefinition = new FormComponentFormDefinition(); orderStatusEnumValues: KeyValue[] = OrderStatusEnumHelper.getListKeyValue(); diff --git a/src/app/features/order/features/all-order/components/routables/all-order-create/order-all-order-create.routable.html b/src/app/features/order/features/all-order/components/routables/all-order-create/order-all-order-create.routable.html new file mode 100644 index 0000000000000000000000000000000000000000..b41d0a2d047d14693e01ecc3d8e589c928b334ff --- /dev/null +++ b/src/app/features/order/features/all-order/components/routables/all-order-create/order-all-order-create.routable.html @@ -0,0 +1,15 @@ +<dlcm-button-toolbar-detail [mode]="'create'" + (backToListChange)="backToList()" +> +</dlcm-button-toolbar-detail> + +<div class="wrapper" + [dlcmSpinner]="isLoadingWithDependencyObs | async" +> + <dlcm-order-all-order-form #formPresentational + *ngIf="isReadyToBeDisplayedInCreateModeObs | async" + (submitChange)="create($event)" + (checkAvailableChange)="checkAvailable($event)" + (dirtyChange)="updateCanDeactivate($event)" + ></dlcm-order-all-order-form> +</div> diff --git a/src/app/features/preservation/order/components/routables/order-create/preservation-order-create.routable.ts b/src/app/features/order/features/all-order/components/routables/all-order-create/order-all-order-create.routable.ts similarity index 50% rename from src/app/features/preservation/order/components/routables/order-create/preservation-order-create.routable.ts rename to src/app/features/order/features/all-order/components/routables/all-order-create/order-all-order-create.routable.ts index 7efd18042318596bb2bbf8d6927851c6972eb777..0b32697e02d1862ddfd7a9832d4cc4c67c62505b 100644 --- a/src/app/features/preservation/order/components/routables/order-create/preservation-order-create.routable.ts +++ b/src/app/features/order/features/all-order/components/routables/all-order-create/order-all-order-create.routable.ts @@ -10,25 +10,25 @@ import { Select, Store, } from "@ngxs/store"; -import {preservationOrderActionNameSpace} from "@preservation/order/stores/preservation-order.action"; +import {orderAllOrderActionNameSpace} from "@order/features/all-order/stores/order-all-order.action"; import { - PreservationOrderState, - PreservationOrderStateModel, -} from "@preservation/order/stores/preservation-order.state"; + OrderAllOrderState, + OrderAllOrderStateModel, +} from "@order/features/all-order/stores/order-all-order.state"; import {SharedAbstractFormPresentational} from "@shared/components/presentationals/shared-abstract-form/shared-abstract-form.presentational"; import {SharedAbstractCreateRoutable} from "@shared/components/routables/shared-abstract-create/shared-abstract-create.routable"; import {LocalStateEnum} from "@shared/enums/local-state.enum"; import {Observable} from "rxjs"; @Component({ - selector: "dlcm-preservation-order-create-routable", - templateUrl: "./preservation-order-create.routable.html", - styleUrls: ["../../../../../../shared/components/routables/shared-abstract-create/shared-abstract-create.routable.scss"], + selector: "dlcm-order-all-order-create-routable", + templateUrl: "./order-all-order-create.routable.html", + styleUrls: ["../../../../../../../shared/components/routables/shared-abstract-create/shared-abstract-create.routable.scss"], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class PreservationOrderCreateRoutable extends SharedAbstractCreateRoutable<Order, PreservationOrderStateModel> { - @Select(PreservationOrderState.isLoadingWithDependency) isLoadingWithDependencyObs: Observable<boolean>; - @Select(PreservationOrderState.isReadyToBeDisplayedInCreateMode) isReadyToBeDisplayedInCreateModeObs: Observable<boolean>; +export class OrderAllOrderCreateRoutable extends SharedAbstractCreateRoutable<Order, OrderAllOrderStateModel> { + @Select(OrderAllOrderState.isLoadingWithDependency) isLoadingWithDependencyObs: Observable<boolean>; + @Select(OrderAllOrderState.isReadyToBeDisplayedInCreateMode) isReadyToBeDisplayedInCreateModeObs: Observable<boolean>; @ViewChild("formPresentational", {static: false}) readonly formPresentational: SharedAbstractFormPresentational<Order>; @@ -36,6 +36,6 @@ export class PreservationOrderCreateRoutable extends SharedAbstractCreateRoutabl constructor(protected readonly _store: Store, protected readonly _actions$: Actions, protected readonly _changeDetector: ChangeDetectorRef) { - super(_store, _actions$, _changeDetector, LocalStateEnum.preservation_order, preservationOrderActionNameSpace, LocalStateEnum.preservation); + super(_store, _actions$, _changeDetector, LocalStateEnum.order_allOrder, orderAllOrderActionNameSpace, LocalStateEnum.order); } } diff --git a/src/app/features/preservation/order/components/routables/order-detail-edit/preservation-order-detail-edit.routable.html b/src/app/features/order/features/all-order/components/routables/all-order-detail-edit/order-all-order-detail-edit.routable.html similarity index 78% rename from src/app/features/preservation/order/components/routables/order-detail-edit/preservation-order-detail-edit.routable.html rename to src/app/features/order/features/all-order/components/routables/all-order-detail-edit/order-all-order-detail-edit.routable.html index 82b944e892dd2f4e777677416aad66f13fd6f17d..e3aa2c1cac95922626066587b06a2ad31124f40e 100644 --- a/src/app/features/preservation/order/components/routables/order-detail-edit/preservation-order-detail-edit.routable.html +++ b/src/app/features/order/features/all-order/components/routables/all-order-detail-edit/order-all-order-detail-edit.routable.html @@ -15,15 +15,15 @@ <div class="wrapper" [dlcmSpinner]="(isLoadingWithDependencyObs | async)" > - <dlcm-preservation-order-form #formPresentational - *ngIf="isReadyToBeDisplayedObs | async" - [model]="currentObs| async" - [readonly]="!isEdit" - (submitChange)="update($event)" - (checkAvailableChange)="checkAvailable($event)" - (dirtyChange)="updateCanDeactivate($event)" + <dlcm-order-all-order-form #formPresentational + *ngIf="isReadyToBeDisplayedObs | async" + [model]="currentObs| async" + [readonly]="!isEdit" + (submitChange)="update($event)" + (checkAvailableChange)="checkAvailable($event)" + (dirtyChange)="updateCanDeactivate($event)" > - </dlcm-preservation-order-form> + </dlcm-order-all-order-form> <ng-template [ngIf]="(isReadyToBeDisplayedObs | async) && !isEdit"> <div *ngIf="(currentObs | async)?.status === orderStatusEnum.INPROGRESS" @@ -31,7 +31,7 @@ [dlcmSpinner]="(isLoadingOrderArchivesObs | async)" [dlcmSpinnerDiameter]="40" > - <h2>{{'preservation.order.section.matchingAIPs' | translate}}</h2> + <h2>{{'order.allOrder.section.matchingAIPs' | translate}}</h2> <mat-list> <mat-list-item *ngFor="let orderArchive of (listOrderArchivesObs | async)"> <ng-template [ngIf]="orderArchive.archive | isNullOrUndefined" @@ -53,7 +53,7 @@ [dlcmSpinner]="(isLoadingAipObs | async)" [dlcmSpinnerDiameter]="40" > - <h2>{{'preservation.order.section.selectedAIPs' | translate}}</h2> + <h2>{{'order.allOrder.section.selectedAIPs' | translate}}</h2> <mat-list> <mat-list-item *ngFor="let aip of (listAipObs | async)"> <span><a (click)="goToAipDownloaded(aip)">{{aip.info.name}}</a> - {{accessLevelEnumHelper.getLabel(aip.info.currentAccessLevel) | translate}}</span> @@ -67,7 +67,7 @@ [dlcmSpinner]="(isLoadingDipObs | async)" [dlcmSpinnerDiameter]="40" > - <h2>{{'preservation.order.section.availableDIPs' | translate}}</h2> + <h2>{{'order.allOrder.section.availableDIPs' | translate}}</h2> <mat-list> <mat-list-item *ngFor="let dip of (listDipObs | async)"> <a (click)="goToDip(dip)">{{dip.info.name}}</a> diff --git a/src/app/features/preservation/order/components/routables/order-detail-edit/preservation-order-detail-edit.routable.scss b/src/app/features/order/features/all-order/components/routables/all-order-detail-edit/order-all-order-detail-edit.routable.scss similarity index 70% rename from src/app/features/preservation/order/components/routables/order-detail-edit/preservation-order-detail-edit.routable.scss rename to src/app/features/order/features/all-order/components/routables/all-order-detail-edit/order-all-order-detail-edit.routable.scss index d2eaafc9101c5f24bec6a58523b1cbeeb3a798d4..b0e8099cdf0f416c269335b5dcc98fc7e0531e6d 100644 --- a/src/app/features/preservation/order/components/routables/order-detail-edit/preservation-order-detail-edit.routable.scss +++ b/src/app/features/order/features/all-order/components/routables/all-order-detail-edit/order-all-order-detail-edit.routable.scss @@ -1,6 +1,6 @@ -@import "../../../../../../../sass/abstracts/variables"; -@import "../../../../../../../sass/abstracts/mixins"; -@import "./../../../../../../shared/components/routables/shared-abstract-detail-edit-common/shared-abstract-detail-edit-common.routable"; +@import "src/sass/abstracts/variables"; +@import "src/sass/abstracts/mixins"; +@import "src/app/shared/components/routables/shared-abstract-detail-edit-common/shared-abstract-detail-edit-common.routable"; :host { .wrapper { diff --git a/src/app/features/preservation/order/components/routables/order-detail-edit/preservation-order-detail-edit.routable.ts b/src/app/features/order/features/all-order/components/routables/all-order-detail-edit/order-all-order-detail-edit.routable.ts similarity index 59% rename from src/app/features/preservation/order/components/routables/order-detail-edit/preservation-order-detail-edit.routable.ts rename to src/app/features/order/features/all-order/components/routables/all-order-detail-edit/order-all-order-detail-edit.routable.ts index 29c6c194d2c9b1368409c98ac323311964f43b54..73710d4d9cec1e7665fec6e7e8803870a5e20116 100644 --- a/src/app/features/preservation/order/components/routables/order-detail-edit/preservation-order-detail-edit.routable.ts +++ b/src/app/features/order/features/all-order/components/routables/all-order-detail-edit/order-all-order-detail-edit.routable.ts @@ -15,7 +15,6 @@ import { Dip, Order, } from "@app/generated-api"; -import {LocalStateEnum} from "@app/shared/enums/local-state.enum"; import {SearchScopeEnum} from "@home/enums/search-scope.enum"; import {Navigate} from "@ngxs/router-plugin"; import { @@ -23,26 +22,27 @@ import { Select, Store, } from "@ngxs/store"; -import {PreservationOrderFormPresentational} from "@preservation/order/components/presentationals/order-form/preservation-order-form.presentational"; -import {PreservationOrderAipAction} from "@preservation/order/stores/aip/preservation-order-aip.action"; -import {PreservationOrderAipState} from "@preservation/order/stores/aip/preservation-order-aip.state"; -import {PreservationOrderDipAction} from "@preservation/order/stores/dip/preservation-order-dip.action"; -import {PreservationOrderDipState} from "@preservation/order/stores/dip/preservation-order-dip.state"; -import {PreservationOrderOrderArchiveAction} from "@preservation/order/stores/order-archive/preservation-order-order-archive.action"; -import {PreservationOrderOrderArchiveState} from "@preservation/order/stores/order-archive/preservation-order-order-archive.state"; +import {OrderAllOrderFormPresentational} from "@order/features/all-order/components/presentationals/all-order-form/order-all-order-form.presentational"; +import {OrderAllOrderAipAction} from "@order/features/all-order/stores/aip/order-all-order-aip.action"; +import {OrderAllOrderAipState} from "@order/features/all-order/stores/aip/order-all-order-aip.state"; +import {OrderAllOrderDipAction} from "@order/features/all-order/stores/dip/order-all-order-dip.action"; +import {OrderAllOrderDipState} from "@order/features/all-order/stores/dip/order-all-order-dip.state"; import { - PreservationOrderAction, - preservationOrderActionNameSpace, -} from "@preservation/order/stores/preservation-order.action"; + OrderAllOrderAction, + orderAllOrderActionNameSpace, +} from "@order/features/all-order/stores/order-all-order.action"; import { - PreservationOrderState, - PreservationOrderStateModel, -} from "@preservation/order/stores/preservation-order.state"; -import {PreservationOrderStatusHistoryAction} from "@preservation/order/stores/status-history/preservation-order-status-history.action"; -import {PreservationOrderStatusHistoryState} from "@preservation/order/stores/status-history/preservation-order-status-history.state"; + OrderAllOrderState, + OrderAllOrderStateModel, +} from "@order/features/all-order/stores/order-all-order.state"; +import {OrderAllOrderOrderArchiveAction} from "@order/features/all-order/stores/order-archive/order-all-order-order-archive.action"; +import {OrderAllOrderOrderArchiveState} from "@order/features/all-order/stores/order-archive/order-all-order-order-archive.state"; +import {OrderAllOrderStatusHistoryAction} from "@order/features/all-order/stores/status-history/order-all-order-status-history.action"; +import {OrderAllOrderStatusHistoryState} from "@order/features/all-order/stores/status-history/order-all-order-status-history.state"; import {SharedHistoryDialog} from "@shared/components/dialogs/shared-history/shared-history.dialog"; import {SharedAbstractDetailEditCommonRoutable} from "@shared/components/routables/shared-abstract-detail-edit-common/shared-abstract-detail-edit-common.routable"; import {AccessLevelEnumHelper} from "@shared/enums/business/access-level-enum.helper"; +import {LocalStateEnum} from "@shared/enums/local-state.enum"; import { AppRoutesEnum, PreservationPlanningRoutesEnum, @@ -65,28 +65,28 @@ import { } from "solidify-frontend"; @Component({ - selector: "dlcm-preservation-order-detail-edit-routable", - templateUrl: "./preservation-order-detail-edit.routable.html", - styleUrls: ["./preservation-order-detail-edit.routable.scss"], + selector: "dlcm-order-all-order-detail-edit-routable", + templateUrl: "./order-all-order-detail-edit.routable.html", + styleUrls: ["./order-all-order-detail-edit.routable.scss"], }) -export class PreservationOrderDetailEditRoutable extends SharedAbstractDetailEditCommonRoutable<Order, PreservationOrderStateModel> implements OnInit, OnDestroy { - @Select(PreservationOrderState.isLoadingWithDependency) isLoadingWithDependencyObs: Observable<boolean>; - @Select(PreservationOrderState.isReadyToBeDisplayed) isReadyToBeDisplayedObs: Observable<boolean>; +export class OrderAllOrderDetailEditRoutable extends SharedAbstractDetailEditCommonRoutable<Order, OrderAllOrderStateModel> implements OnInit, OnDestroy { + @Select(OrderAllOrderState.isLoadingWithDependency) isLoadingWithDependencyObs: Observable<boolean>; + @Select(OrderAllOrderState.isReadyToBeDisplayed) isReadyToBeDisplayedObs: Observable<boolean>; - historyObs: Observable<StatusHistory[]> = MemoizedUtil.select(this._store, PreservationOrderStatusHistoryState, state => state.history); - isLoadingObs: Observable<boolean> = MemoizedUtil.isLoading(this._store, PreservationOrderStatusHistoryState); - queryParametersObs: Observable<QueryParameters> = MemoizedUtil.select(this._store, PreservationOrderStatusHistoryState, state => state.queryParameters); + historyObs: Observable<StatusHistory[]> = MemoizedUtil.select(this._store, OrderAllOrderStatusHistoryState, state => state.history); + isLoadingObs: Observable<boolean> = MemoizedUtil.isLoading(this._store, OrderAllOrderStatusHistoryState); + queryParametersObs: Observable<QueryParameters> = MemoizedUtil.select(this._store, OrderAllOrderStatusHistoryState, state => state.queryParameters); - listAipObs: Observable<Aip[]> = AssociationState.selected(this._store, PreservationOrderAipState); - isLoadingAipObs: Observable<boolean> = MemoizedUtil.isLoading(this._store, PreservationOrderAipState); - listDipObs: Observable<Aip[]> = AssociationState.selected(this._store, PreservationOrderDipState); - isLoadingDipObs: Observable<boolean> = MemoizedUtil.isLoading(this._store, PreservationOrderDipState); + listAipObs: Observable<Aip[]> = AssociationState.selected(this._store, OrderAllOrderAipState); + isLoadingAipObs: Observable<boolean> = MemoizedUtil.isLoading(this._store, OrderAllOrderAipState); + listDipObs: Observable<Aip[]> = AssociationState.selected(this._store, OrderAllOrderDipState); + isLoadingDipObs: Observable<boolean> = MemoizedUtil.isLoading(this._store, OrderAllOrderDipState); - listOrderArchivesObs: Observable<OrderArchive[]> = ResourceState.list(this._store, PreservationOrderOrderArchiveState); - isLoadingOrderArchivesObs: Observable<boolean> = MemoizedUtil.isLoading(this._store, PreservationOrderOrderArchiveState); + listOrderArchivesObs: Observable<OrderArchive[]> = ResourceState.list(this._store, OrderAllOrderOrderArchiveState); + isLoadingOrderArchivesObs: Observable<boolean> = MemoizedUtil.isLoading(this._store, OrderAllOrderOrderArchiveState); @ViewChild("formPresentational", {static: false}) - readonly formPresentational: PreservationOrderFormPresentational; + readonly formPresentational: OrderAllOrderFormPresentational; readonly KEY_PARAM_NAME: keyof Order & string = "name"; @@ -96,21 +96,21 @@ export class PreservationOrderDetailEditRoutable extends SharedAbstractDetailEdi icon: "done", displayCondition: current => !this.isEdit && !isNullOrUndefined(current) && current.status === Order.StatusEnum.INPROGRESS, callback: () => this.save(), - labelToTranslate: TRANSLATE("preservation.order.button.save"), + labelToTranslate: TRANSLATE("order.allOrder.button.save"), }, { color: "accent", icon: "done_all", displayCondition: current => !this.isEdit && !isNullOrUndefined(current) && current.status === Order.StatusEnum.INPROGRESS && current.aipNumber > 0, callback: () => this.submit(), - labelToTranslate: TRANSLATE("preservation.order.button.submit"), + labelToTranslate: TRANSLATE("order.allOrder.button.submit"), }, { color: "primary", icon: "play_circle_filled", displayCondition: current => !this.isEdit && !isNullOrUndefined(current) && current.status === Order.StatusEnum.INERROR, callback: () => this.resume(), - labelToTranslate: TRANSLATE("preservation.order.button.resume"), + labelToTranslate: TRANSLATE("order.allOrder.button.resume"), }, ]; @@ -137,7 +137,7 @@ export class PreservationOrderDetailEditRoutable extends SharedAbstractDetailEdi protected readonly _dialog: MatDialog, protected readonly _router: Router, private readonly _securityService: SecurityService) { - super(_store, _route, _actions$, _changeDetector, _dialog, LocalStateEnum.preservation_order, preservationOrderActionNameSpace, LocalStateEnum.preservation); + super(_store, _route, _actions$, _changeDetector, _dialog, LocalStateEnum.order_allOrder, orderAllOrderActionNameSpace, LocalStateEnum.order); } ngOnDestroy(): void { @@ -146,8 +146,8 @@ export class PreservationOrderDetailEditRoutable extends SharedAbstractDetailEdi } getSubResourceWithParentId(id: string): void { - this._store.dispatch(new PreservationOrderAipAction.GetAll(id)); - this._store.dispatch(new PreservationOrderDipAction.GetAll(id)); + this._store.dispatch(new OrderAllOrderAipAction.GetAll(id)); + this._store.dispatch(new OrderAllOrderDipAction.GetAll(id)); this.view(); } @@ -161,25 +161,25 @@ export class PreservationOrderDetailEditRoutable extends SharedAbstractDetailEdi statusHistory: this.historyObs, isLoading: this.isLoadingObs, queryParametersObs: this.queryParametersObs, - state: PreservationOrderStatusHistoryAction, + state: OrderAllOrderStatusHistoryAction, } as StatusHistoryDialog, }); } private submit(): void { - this._store.dispatch(new PreservationOrderAction.Submit(this._resId)); + this._store.dispatch(new OrderAllOrderAction.Submit(this._resId)); } private resume(): void { - this._store.dispatch(new PreservationOrderAction.Resume(this._resId)); + this._store.dispatch(new OrderAllOrderAction.Resume(this._resId)); } private view(): void { - this._store.dispatch(new PreservationOrderOrderArchiveAction.GetAll(this._resId)); + this._store.dispatch(new OrderAllOrderOrderArchiveAction.GetAll(this._resId)); } private save(): void { - this._store.dispatch(new PreservationOrderAction.Save(this._resId)); + this._store.dispatch(new OrderAllOrderAction.Save(this._resId)); } goToDip(dip: Dip): void { diff --git a/src/app/features/preservation/order/components/routables/order-list/preservation-order-list.routable.ts b/src/app/features/order/features/all-order/components/routables/all-order-list/order-all-order-list.routable.ts similarity index 55% rename from src/app/features/preservation/order/components/routables/order-list/preservation-order-list.routable.ts rename to src/app/features/order/features/all-order/components/routables/all-order-list/order-all-order-list.routable.ts index 65de809cea0034f64de5f2f7642161aed12ce4ad..61cc07e0c62829c45cb219a94bc4e2efbf2a2efb 100644 --- a/src/app/features/preservation/order/components/routables/order-list/preservation-order-list.routable.ts +++ b/src/app/features/order/features/all-order/components/routables/all-order-list/order-all-order-list.routable.ts @@ -7,32 +7,32 @@ import { import {MatDialog} from "@angular/material/dialog"; import {ActivatedRoute} from "@angular/router"; import {Order} from "@app/generated-api"; -import {SharedAbstractListRoutable} from "@app/shared/components/routables/shared-abstract-list/shared-abstract-list.routable"; -import {FieldTypeEnum} from "@app/shared/enums/field-type.enum"; -import {LocalStateEnum} from "@app/shared/enums/local-state.enum"; import { Actions, Store, } from "@ngxs/store"; -import {OrderStatusEnumHelper} from "@preservation/order/enums/order-status.enum"; -import {OrderQueryTypeEnumHelper} from "@preservation/order/helpers/order-query-type-enum.helper"; -import {preservationOrderActionNameSpace} from "@preservation/order/stores/preservation-order.action"; -import {PreservationOrderStateModel} from "@preservation/order/stores/preservation-order.state"; +import {OrderStatusEnumHelper} from "@order/enums/order-status.enum"; +import {orderAllOrderActionNameSpace} from "@order/features/all-order/stores/order-all-order.action"; +import {OrderAllOrderStateModel} from "@order/features/all-order/stores/order-all-order.state"; +import {OrderQueryTypeEnumHelper} from "@order/helpers/order-query-type-enum.helper"; +import {SharedAbstractListRoutable} from "@shared/components/routables/shared-abstract-list/shared-abstract-list.routable"; +import {FieldTypeEnum} from "@shared/enums/field-type.enum"; +import {LocalStateEnum} from "@shared/enums/local-state.enum"; import { OrderEnum, TRANSLATE, } from "solidify-frontend"; @Component({ - selector: "dlcm-preservation-order-list-routable", - templateUrl: "../../../../../../shared/components/routables/shared-abstract-list/shared-abstract-list.routable.html", - styleUrls: ["../../../../../../shared/components/routables/shared-abstract-list/shared-abstract-list.routable.scss"], + selector: "dlcm-order-all-order-list-routable", + templateUrl: "../../../../../../../shared/components/routables/shared-abstract-list/shared-abstract-list.routable.html", + styleUrls: ["../../../../../../../shared/components/routables/shared-abstract-list/shared-abstract-list.routable.scss"], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class PreservationOrderListRoutable extends SharedAbstractListRoutable<Order, PreservationOrderStateModel> implements OnInit { - readonly KEY_CREATE_BUTTON: string = TRANSLATE("preservation.order.create"); - readonly KEY_REFRESH_BUTTON: string = TRANSLATE("preservation.order.refresh"); - readonly KEY_BACK_BUTTON: string = TRANSLATE("preservation.order.back"); +export class OrderAllOrderListRoutable extends SharedAbstractListRoutable<Order, OrderAllOrderStateModel> implements OnInit { + readonly KEY_CREATE_BUTTON: string = TRANSLATE("order.allOrder.create"); + readonly KEY_REFRESH_BUTTON: string = TRANSLATE("order.allOrder.refresh"); + readonly KEY_BACK_BUTTON: string = TRANSLATE("order.allOrder.back"); readonly KEY_PARAM_NAME: keyof Order & string = "name"; constructor(protected readonly _store: Store, @@ -40,9 +40,9 @@ export class PreservationOrderListRoutable extends SharedAbstractListRoutable<Or protected readonly _route: ActivatedRoute, protected readonly _actions$: Actions, protected readonly _dialog: MatDialog) { - super(_store, _changeDetector, _route, _actions$, _dialog, LocalStateEnum.preservation_order, preservationOrderActionNameSpace, { + super(_store, _changeDetector, _route, _actions$, _dialog, LocalStateEnum.order_allOrder, orderAllOrderActionNameSpace, { canCreate: true, - }, LocalStateEnum.preservation); + }, LocalStateEnum.order); } conditionDisplayEditButton(model: Order | undefined): boolean { @@ -61,7 +61,7 @@ export class PreservationOrderListRoutable extends SharedAbstractListRoutable<Or this.columns = [ { field: "queryType", - header: TRANSLATE("preservation.order.table.header.queryType"), + header: TRANSLATE("order.allOrder.table.header.queryType"), type: FieldTypeEnum.singleSelect, order: OrderEnum.none, isFilterable: true, @@ -71,7 +71,7 @@ export class PreservationOrderListRoutable extends SharedAbstractListRoutable<Or }, { field: "name", - header: TRANSLATE("preservation.order.table.header.name"), + header: TRANSLATE("order.allOrder.table.header.name"), type: FieldTypeEnum.string, order: OrderEnum.none, isFilterable: true, @@ -79,7 +79,7 @@ export class PreservationOrderListRoutable extends SharedAbstractListRoutable<Or }, { field: "status", - header: TRANSLATE("preservation.order.table.header.status"), + header: TRANSLATE("order.allOrder.table.header.status"), type: FieldTypeEnum.singleSelect, order: OrderEnum.none, isFilterable: true, @@ -89,7 +89,7 @@ export class PreservationOrderListRoutable extends SharedAbstractListRoutable<Or }, { field: "creation.when" as any, - header: TRANSLATE("preservation.order.table.header.creation.when"), + header: TRANSLATE("order.allOrder.table.header.creation.when"), type: FieldTypeEnum.datetime, order: OrderEnum.none, isFilterable: true, @@ -97,7 +97,7 @@ export class PreservationOrderListRoutable extends SharedAbstractListRoutable<Or }, { field: "lastUpdate.when" as any, - header: TRANSLATE("preservation.order.table.header.lastUpdate.when"), + header: TRANSLATE("order.allOrder.table.header.lastUpdate.when"), type: FieldTypeEnum.datetime, order: OrderEnum.descending, isFilterable: true, diff --git a/src/app/features/order/features/all-order/order-all-order-routing.module.ts b/src/app/features/order/features/all-order/order-all-order-routing.module.ts new file mode 100644 index 0000000000000000000000000000000000000000..6564d572463a2cc400f19d165694fa3410fb17e8 --- /dev/null +++ b/src/app/features/order/features/all-order/order-all-order-routing.module.ts @@ -0,0 +1,52 @@ +import {NgModule} from "@angular/core"; +import {RouterModule} from "@angular/router"; +import {OrderAllOrderCreateRoutable} from "@order/features/all-order/components/routables/all-order-create/order-all-order-create.routable"; +import {OrderAllOrderDetailEditRoutable} from "@order/features/all-order/components/routables/all-order-detail-edit/order-all-order-detail-edit.routable"; +import {OrderAllOrderListRoutable} from "@order/features/all-order/components/routables/all-order-list/order-all-order-list.routable"; +import {OrderAllOrderState} from "@order/features/all-order/stores/order-all-order.state"; +import { + AppRoutesEnum, + OrderRoutesEnum, +} from "@shared/enums/routes.enum"; +import {DlcmRoutes} from "@shared/models/dlcm-route.model"; +import {CanDeactivateGuard} from "@shared/services/can-deactivate-guard.service"; +import {TRANSLATE} from "solidify-frontend"; + +const routes: DlcmRoutes = [ + { + path: AppRoutesEnum.root, + component: OrderAllOrderListRoutable, + data: {}, + }, + { + path: OrderRoutesEnum.allOrderDetail + AppRoutesEnum.separator + AppRoutesEnum.paramId, + component: OrderAllOrderDetailEditRoutable, + data: { + breadcrumbMemoizedSelector: OrderAllOrderState.currentTitle, + }, + children: [ + { + path: OrderRoutesEnum.allOrderEdit, + data: { + breadcrumb: TRANSLATE("breadcrumb.order.allOrder.edit"), + }, + canDeactivate: [CanDeactivateGuard], + }, + ], + }, + { + path: OrderRoutesEnum.allOrderCreate, + component: OrderAllOrderCreateRoutable, + data: { + breadcrumb: TRANSLATE("breadcrumb.order.allOrder.create"), + }, + canDeactivate: [CanDeactivateGuard], + }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class OrderAllOrderRoutingModule { +} diff --git a/src/app/features/order/features/all-order/order-all-order.module.ts b/src/app/features/order/features/all-order/order-all-order.module.ts new file mode 100644 index 0000000000000000000000000000000000000000..dcb02e5f4dfe2121d95c0c64bae48dd079a8ecd8 --- /dev/null +++ b/src/app/features/order/features/all-order/order-all-order.module.ts @@ -0,0 +1,58 @@ +import {NgModule} from "@angular/core"; +import {TranslateModule} from "@ngx-translate/core"; +import {NgxsModule} from "@ngxs/store"; +import {OrderAllOrderDeleteDialog} from "@order/features/all-order/components/dialogs/all-order-delete/order-all-order-delete.dialog"; +import {OrderAllOrderFormPresentational} from "@order/features/all-order/components/presentationals/all-order-form/order-all-order-form.presentational"; +import {OrderAllOrderCreateRoutable} from "@order/features/all-order/components/routables/all-order-create/order-all-order-create.routable"; +import {OrderAllOrderListRoutable} from "@order/features/all-order/components/routables/all-order-list/order-all-order-list.routable"; +import {OrderAllOrderRoutingModule} from "@order/features/all-order/order-all-order-routing.module"; +import {OrderAllOrderAipState} from "@order/features/all-order/stores/aip/order-all-order-aip.state"; +import {OrderAllOrderDipState} from "@order/features/all-order/stores/dip/order-all-order-dip.state"; +import {OrderAllOrderState} from "@order/features/all-order/stores/order-all-order.state"; +import {OrderAllOrderOrderArchiveState} from "@order/features/all-order/stores/order-archive/order-all-order-order-archive.state"; +import {OrderAllOrderStatusHistoryState} from "@order/features/all-order/stores/status-history/order-all-order-status-history.state"; +import {SharedModule} from "@shared/shared.module"; +import {OrderAllOrderDetailEditRoutable} from "./components/routables/all-order-detail-edit/order-all-order-detail-edit.routable"; + +const routables = [ + OrderAllOrderListRoutable, + OrderAllOrderDetailEditRoutable, + OrderAllOrderCreateRoutable, +]; +const containers = []; +const dialogs = [ + OrderAllOrderDeleteDialog, +]; +const presentationals = [ + OrderAllOrderFormPresentational, +]; + +@NgModule({ + declarations: [ + ...routables, + ...containers, + ...dialogs, + ...presentationals, + ], + imports: [ + SharedModule, + OrderAllOrderRoutingModule, + TranslateModule.forChild({}), + NgxsModule.forFeature([ + OrderAllOrderState, + OrderAllOrderStatusHistoryState, + OrderAllOrderAipState, + OrderAllOrderDipState, + OrderAllOrderOrderArchiveState, + ]), + ], + entryComponents: [ + ...dialogs, + ], + exports: [ + ...routables, + ], + providers: [], +}) +export class OrderAllOrderModule { +} diff --git a/src/app/features/preservation/order/stores/aip/preservation-order-aip.action.ts b/src/app/features/order/features/all-order/stores/aip/order-all-order-aip.action.ts similarity index 91% rename from src/app/features/preservation/order/stores/aip/preservation-order-aip.action.ts rename to src/app/features/order/features/all-order/stores/aip/order-all-order-aip.action.ts index 6a69822db57c4bd61af07b45eef629196e994c3e..39dbdd470ff43568938d5a9633bb3338cb6b6172 100644 --- a/src/app/features/preservation/order/stores/aip/preservation-order-aip.action.ts +++ b/src/app/features/order/features/all-order/stores/aip/order-all-order-aip.action.ts @@ -6,9 +6,9 @@ import { TypeDefaultAction, } from "solidify-frontend"; -const state = LocalStateEnum.preservation_order_aip; +const state = LocalStateEnum.order_allOrder_aip; -export namespace PreservationOrderAipAction { +export namespace OrderAllOrderAipAction { @TypeDefaultAction(state) export class GetAll extends AssociationAction.GetAll { @@ -83,4 +83,4 @@ export namespace PreservationOrderAipAction { } } -export const preservationOrderAipNamespace: AssociationNameSpace = PreservationOrderAipAction; +export const orderAllOrderAipNamespace: AssociationNameSpace = OrderAllOrderAipAction; diff --git a/src/app/features/preservation/order/stores/aip/preservation-order-aip.state.ts b/src/app/features/order/features/all-order/stores/aip/order-all-order-aip.state.ts similarity index 68% rename from src/app/features/preservation/order/stores/aip/preservation-order-aip.state.ts rename to src/app/features/order/features/all-order/stores/aip/order-all-order-aip.state.ts index fdb71544da2060e0b6713bc972f55b38d39132d9..8755f06c09f42208b9ab35cc40df1c8cf79b0be3 100644 --- a/src/app/features/preservation/order/stores/aip/preservation-order-aip.state.ts +++ b/src/app/features/order/features/all-order/stores/aip/order-all-order-aip.state.ts @@ -4,7 +4,7 @@ import { State, Store, } from "@ngxs/store"; -import {preservationOrderAipNamespace} from "@preservation/order/stores/aip/preservation-order-aip.action"; +import {orderAllOrderAipNamespace} from "@order/features/all-order/stores/aip/order-all-order-aip.action"; import {ApiResourceNameEnum} from "@shared/enums/api-resource-name.enum"; import {AccessResourceApiEnum} from "@shared/enums/api.enum"; import {LocalStateEnum} from "@shared/enums/local-state.enum"; @@ -16,22 +16,22 @@ import { NotificationService, } from "solidify-frontend"; -export interface PreservationOrderAipStateModel extends AssociationStateModel<Aip> { +export interface OrderAllOrderAipStateModel extends AssociationStateModel<Aip> { } -@State<PreservationOrderAipStateModel>({ - name: LocalStateEnum.preservation_order_aip, +@State<OrderAllOrderAipStateModel>({ + name: LocalStateEnum.order_allOrder_aip, defaults: { ...defaultAssociationStateInitValue(), }, }) -export class PreservationOrderAipState extends AssociationState<PreservationOrderAipStateModel, Aip> { +export class OrderAllOrderAipState extends AssociationState<OrderAllOrderAipStateModel, Aip> { constructor(protected apiService: ApiService, protected store: Store, protected notificationService: NotificationService, protected actions$: Actions) { super(apiService, store, notificationService, actions$, { - nameSpace: preservationOrderAipNamespace, + nameSpace: orderAllOrderAipNamespace, resourceName: ApiResourceNameEnum.AIP, }); } diff --git a/src/app/features/preservation/order/stores/dip/preservation-order-dip.action.ts b/src/app/features/order/features/all-order/stores/dip/order-all-order-dip.action.ts similarity index 91% rename from src/app/features/preservation/order/stores/dip/preservation-order-dip.action.ts rename to src/app/features/order/features/all-order/stores/dip/order-all-order-dip.action.ts index 06f02c0c75ae2853ebfed1ef17407096b5a4e878..f9d3de85c71766ae2fdd1a849aef128f73522a79 100644 --- a/src/app/features/preservation/order/stores/dip/preservation-order-dip.action.ts +++ b/src/app/features/order/features/all-order/stores/dip/order-all-order-dip.action.ts @@ -6,9 +6,9 @@ import { TypeDefaultAction, } from "solidify-frontend"; -const state = LocalStateEnum.preservation_order_dip; +const state = LocalStateEnum.order_allOrder_dip; -export namespace PreservationOrderDipAction { +export namespace OrderAllOrderDipAction { @TypeDefaultAction(state) export class GetAll extends AssociationAction.GetAll { @@ -83,4 +83,4 @@ export namespace PreservationOrderDipAction { } } -export const preservationOrderDipNamespace: AssociationNameSpace = PreservationOrderDipAction; +export const orderAllOrderDipNamespace: AssociationNameSpace = OrderAllOrderDipAction; diff --git a/src/app/features/preservation/order/stores/dip/preservation-order-dip.state.ts b/src/app/features/order/features/all-order/stores/dip/order-all-order-dip.state.ts similarity index 68% rename from src/app/features/preservation/order/stores/dip/preservation-order-dip.state.ts rename to src/app/features/order/features/all-order/stores/dip/order-all-order-dip.state.ts index 1a15c91743c66281a6df1863eded89db445032a5..eefdebbe1a76bdb5180a586889b505804252b2a7 100644 --- a/src/app/features/preservation/order/stores/dip/preservation-order-dip.state.ts +++ b/src/app/features/order/features/all-order/stores/dip/order-all-order-dip.state.ts @@ -4,7 +4,7 @@ import { State, Store, } from "@ngxs/store"; -import {preservationOrderDipNamespace} from "@preservation/order/stores/dip/preservation-order-dip.action"; +import {orderAllOrderDipNamespace} from "@order/features/all-order/stores/dip/order-all-order-dip.action"; import {ApiResourceNameEnum} from "@shared/enums/api-resource-name.enum"; import {AccessResourceApiEnum} from "@shared/enums/api.enum"; import {LocalStateEnum} from "@shared/enums/local-state.enum"; @@ -16,22 +16,22 @@ import { NotificationService, } from "solidify-frontend"; -export interface PreservationOrderDipStateModel extends AssociationStateModel<Dip> { +export interface OrderAllOrderDipStateModel extends AssociationStateModel<Dip> { } -@State<PreservationOrderDipStateModel>({ - name: LocalStateEnum.preservation_order_dip, +@State<OrderAllOrderDipStateModel>({ + name: LocalStateEnum.order_allOrder_dip, defaults: { ...defaultAssociationStateInitValue(), }, }) -export class PreservationOrderDipState extends AssociationState<PreservationOrderDipStateModel, Dip> { +export class OrderAllOrderDipState extends AssociationState<OrderAllOrderDipStateModel, Dip> { constructor(protected apiService: ApiService, protected store: Store, protected notificationService: NotificationService, protected actions$: Actions) { super(apiService, store, notificationService, actions$, { - nameSpace: preservationOrderDipNamespace, + nameSpace: orderAllOrderDipNamespace, resourceName: ApiResourceNameEnum.DIP, }); } diff --git a/src/app/features/preservation/order/stores/preservation-order.action.ts b/src/app/features/order/features/all-order/stores/order-all-order.action.ts similarity index 95% rename from src/app/features/preservation/order/stores/preservation-order.action.ts rename to src/app/features/order/features/all-order/stores/order-all-order.action.ts index 6704428b96120115605daca442f3c03b5269e007..675a5b9dadcbd3c3fdd0a42a75bd770d7c639d56 100644 --- a/src/app/features/preservation/order/stores/preservation-order.action.ts +++ b/src/app/features/order/features/all-order/stores/order-all-order.action.ts @@ -1,5 +1,5 @@ import {Order} from "@app/generated-api"; -import {LocalStateEnum} from "@app/shared/enums/local-state.enum"; +import {LocalStateEnum} from "@shared/enums/local-state.enum"; import { BaseAction, BaseSubAction, @@ -8,9 +8,9 @@ import { TypeDefaultAction, } from "solidify-frontend"; -const state = LocalStateEnum.preservation_order; +const state = LocalStateEnum.order_allOrder; -export namespace PreservationOrderAction { +export namespace OrderAllOrderAction { @TypeDefaultAction(state) export class LoadResource extends ResourceAction.LoadResource { } @@ -196,4 +196,4 @@ export namespace PreservationOrderAction { } } -export const preservationOrderActionNameSpace: ResourceNameSpace = PreservationOrderAction; +export const orderAllOrderActionNameSpace: ResourceNameSpace = OrderAllOrderAction; diff --git a/src/app/features/order/features/all-order/stores/order-all-order.state.ts b/src/app/features/order/features/all-order/stores/order-all-order.state.ts new file mode 100644 index 0000000000000000000000000000000000000000..71092ba0b1ed8181b78b8f8372f0f38a0a4884de --- /dev/null +++ b/src/app/features/order/features/all-order/stores/order-all-order.state.ts @@ -0,0 +1,255 @@ +import {Order} from "@app/generated-api"; +import { + Action, + Actions, + Selector, + State, + StateContext, + Store, +} from "@ngxs/store"; +import { + OrderAllOrderAipState, + OrderAllOrderAipStateModel, +} from "@order/features/all-order/stores/aip/order-all-order-aip.state"; +import { + OrderAllOrderDipState, + OrderAllOrderDipStateModel, +} from "@order/features/all-order/stores/dip/order-all-order-dip.state"; +import { + OrderAllOrderAction, + orderAllOrderActionNameSpace, +} from "@order/features/all-order/stores/order-all-order.action"; +import { + OrderAllOrderOrderArchiveState, + OrderAllOrderOrderArchiveStateModel, +} from "@order/features/all-order/stores/order-archive/order-all-order-order-archive.state"; +import { + OrderAllOrderStatusHistoryState, + OrderAllOrderStatusHistoryStateModel, +} from "@order/features/all-order/stores/status-history/order-all-order-status-history.state"; +import {ApiActionEnum} from "@shared/enums/api-action.enum"; +import {AccessResourceApiEnum} from "@shared/enums/api.enum"; +import {LocalStateEnum} from "@shared/enums/local-state.enum"; +import {RoutesEnum} from "@shared/enums/routes.enum"; +import {OrderArchive} from "@shared/models/business/order-archive.model"; +import {defaultStatusHistoryInitValue} from "@shared/stores/status-history/status-history.state"; +import {Observable} from "rxjs"; +import {tap} from "rxjs/internal/operators/tap"; +import {catchError} from "rxjs/operators"; +import { + ApiService, + defaultAssociationStateInitValue, + defaultResourceStateInitValue, + isNullOrUndefined, + NotificationService, + ResourceState, + ResourceStateModel, + SolidifyStateError, + StoreUtil, + TRANSLATE, + urlSeparator, +} from "solidify-frontend"; + +export interface OrderAllOrderStateModel extends ResourceStateModel<Order> { + order_allOrder_statusHistory: OrderAllOrderStatusHistoryStateModel; + order_allOrder_aip: OrderAllOrderAipStateModel | undefined; + order_allOrder_dip: OrderAllOrderDipStateModel | undefined; + order_allOrder_orderArchive: OrderAllOrderOrderArchiveStateModel | undefined; +} + +@State<OrderAllOrderStateModel>({ + name: LocalStateEnum.order_allOrder, + defaults: { + ...defaultResourceStateInitValue(), + order_allOrder_statusHistory: {...defaultStatusHistoryInitValue()}, + order_allOrder_aip: {...defaultAssociationStateInitValue()}, + order_allOrder_dip: {...defaultAssociationStateInitValue()}, + order_allOrder_orderArchive: {...defaultResourceStateInitValue()}, + }, + children: [ + OrderAllOrderStatusHistoryState, + OrderAllOrderOrderArchiveState, + OrderAllOrderAipState, + OrderAllOrderDipState, + ], +}) +export class OrderAllOrderState extends ResourceState<OrderAllOrderStateModel, Order> { + constructor(protected apiService: ApiService, + protected store: Store, + protected notificationService: NotificationService, + protected actions$: Actions) { + super(apiService, store, notificationService, actions$, { + nameSpace: orderAllOrderActionNameSpace, + routeRedirectUrlAfterSuccessCreateAction: (resId: string) => RoutesEnum.orderAllOrderDetail + urlSeparator + resId, + routeRedirectUrlAfterSuccessUpdateAction: (resId: string) => RoutesEnum.orderAllOrderDetail + urlSeparator + resId, + routeRedirectUrlAfterSuccessDeleteAction: RoutesEnum.orderAllOrder, + notificationResourceCreateSuccessTextToTranslate: TRANSLATE("order.allOrder.notification.resource.create"), + notificationResourceDeleteSuccessTextToTranslate: TRANSLATE("order.allOrder.notification.resource.delete"), + notificationResourceUpdateSuccessTextToTranslate: TRANSLATE("order.allOrder.notification.resource.update"), + }); + } + + protected get _urlResource(): string { + return AccessResourceApiEnum.orders; + } + + @Selector() + static isLoading(state: OrderAllOrderStateModel): boolean { + return StoreUtil.isLoadingState(state); + } + + @Selector() + static currentTitle(state: OrderAllOrderStateModel): string | undefined { + if (isNullOrUndefined(state.current)) { + return undefined; + } + return state.current.name; + } + + @Selector() + static isLoadingWithDependency(state: OrderAllOrderStateModel): boolean { + return this.isLoading(state); + } + + @Selector() + static isReadyToBeDisplayed(state: OrderAllOrderStateModel): boolean { + return this.isReadyToBeDisplayedInCreateMode + && !isNullOrUndefined(state.current); + } + + @Selector() + static isReadyToBeDisplayedInCreateMode(state: OrderAllOrderStateModel): boolean { + return true; + } + + @Action(OrderAllOrderAction.Submit) + submit(ctx: StateContext<OrderAllOrderStateModel>, action: OrderAllOrderAction.Submit): Observable<string[]> { + ctx.patchState({ + isLoadingCounter: ctx.getState().isLoadingCounter + 1, + }); + + return this.apiService.patchByIdWithCustomUrl(`${this._urlResource}/${action.resId}/${ApiActionEnum.SUBMIT}`, null) + .pipe( + tap(() => { + ctx.dispatch(new OrderAllOrderAction.SubmitSuccess(action)); + }), + catchError(error => { + ctx.dispatch(new OrderAllOrderAction.SubmitFail(action)); + throw new SolidifyStateError(this, error); + }), + ); + } + + @Action(OrderAllOrderAction.SubmitSuccess) + submitSuccess(ctx: StateContext<OrderAllOrderStateModel>, action: OrderAllOrderAction.SubmitSuccess): void { + ctx.patchState({ + isLoadingCounter: ctx.getState().isLoadingCounter - 1, + }); + ctx.dispatch(new OrderAllOrderAction.GetById((action.parentAction as OrderAllOrderAction.Submit).resId)); + } + + @Action(OrderAllOrderAction.SubmitFail) + submitFail(ctx: StateContext<OrderAllOrderStateModel>, action: OrderAllOrderAction.SubmitFail): void { + ctx.patchState({ + isLoadingCounter: ctx.getState().isLoadingCounter - 1, + }); + } + + @Action(OrderAllOrderAction.Resume) + resume(ctx: StateContext<OrderAllOrderStateModel>, action: OrderAllOrderAction.Resume): Observable<string[]> { + ctx.patchState({ + isLoadingCounter: ctx.getState().isLoadingCounter + 1, + }); + + return this.apiService.patchByIdWithCustomUrl(`${this._urlResource}/${action.resId}/${ApiActionEnum.RESUME}`, null) + .pipe( + tap(() => { + ctx.dispatch(new OrderAllOrderAction.ResumeSuccess(action)); + }), + catchError(error => { + ctx.dispatch(new OrderAllOrderAction.ResumeFail(action)); + throw new SolidifyStateError(this, error); + }), + ); + } + + @Action(OrderAllOrderAction.ResumeSuccess) + resumeSuccess(ctx: StateContext<OrderAllOrderStateModel>, action: OrderAllOrderAction.ResumeSuccess): void { + ctx.patchState({ + isLoadingCounter: ctx.getState().isLoadingCounter - 1, + }); + ctx.dispatch(new OrderAllOrderAction.GetById((action.parentAction as OrderAllOrderAction.Resume).resId)); + } + + @Action(OrderAllOrderAction.ResumeFail) + resumeFail(ctx: StateContext<OrderAllOrderStateModel>, action: OrderAllOrderAction.ResumeFail): void { + ctx.patchState({ + isLoadingCounter: ctx.getState().isLoadingCounter - 1, + }); + } + + // @Action(OrderAllOrderAction.View) + // view(ctx: StateContext<OrderAllOrderStateModel>, action: OrderAllOrderAction.View): Observable<OrderArchive[]> { + // ctx.patchState({ + // isLoadingCounter: ctx.getState().isLoadingCounter + 1, + // }); + // + // return this.apiService.getByIdInPath<OrderArchive[]>(`${this._urlResource}/${action.resId}/${ApiActionEnum.VIEW}`) + // .pipe( + // tap((result) => { + // ctx.dispatch(new OrderAllOrderAction.ViewSuccess(action, result)); + // }), + // catchError(error => { + // ctx.dispatch(new OrderAllOrderAction.ViewFail(action)); + // throw new SolidifyStateError(this, error); + // }), + // ); + // } + // + // @Action(OrderAllOrderAction.ViewSuccess) + // viewSuccess(ctx: StateContext<OrderAllOrderStateModel>, action: OrderAllOrderAction.ViewSuccess): void { + // ctx.patchState({ + // isLoadingCounter: ctx.getState().isLoadingCounter - 1, + // orderArchives: action.orderArchives, + // }); + // } + // + // @Action(OrderAllOrderAction.ViewFail) + // viewFail(ctx: StateContext<OrderAllOrderStateModel>, action: OrderAllOrderAction.ViewFail): void { + // ctx.patchState({ + // isLoadingCounter: ctx.getState().isLoadingCounter - 1, + // }); + // } + + @Action(OrderAllOrderAction.Save) + save(ctx: StateContext<OrderAllOrderStateModel>, action: OrderAllOrderAction.Save): Observable<OrderArchive> { + ctx.patchState({ + isLoadingCounter: ctx.getState().isLoadingCounter + 1, + }); + + return this.apiService.post<OrderArchive>(`${this._urlResource}/${action.resId}/${ApiActionEnum.SAVE}`) + .pipe( + tap(() => { + ctx.dispatch(new OrderAllOrderAction.SaveSuccess(action)); + }), + catchError(error => { + ctx.dispatch(new OrderAllOrderAction.SaveFail(action)); + throw new SolidifyStateError(this, error); + }), + ); + } + + @Action(OrderAllOrderAction.SaveSuccess) + saveSuccess(ctx: StateContext<OrderAllOrderStateModel>, action: OrderAllOrderAction.SaveSuccess): void { + ctx.patchState({ + isLoadingCounter: ctx.getState().isLoadingCounter - 1, + }); + } + + @Action(OrderAllOrderAction.SaveFail) + saveFail(ctx: StateContext<OrderAllOrderStateModel>, action: OrderAllOrderAction.SaveFail): void { + ctx.patchState({ + isLoadingCounter: ctx.getState().isLoadingCounter - 1, + }); + } +} diff --git a/src/app/features/preservation/order/stores/order-archive/preservation-order-order-archive.action.ts b/src/app/features/order/features/all-order/stores/order-archive/order-all-order-order-archive.action.ts similarity index 92% rename from src/app/features/preservation/order/stores/order-archive/preservation-order-order-archive.action.ts rename to src/app/features/order/features/all-order/stores/order-archive/order-all-order-order-archive.action.ts index 71f96ce4ae1a92dfffd9fb7fcdb38a02f471d61f..58abd80d4e135c5e2a1f5603eacece4132b4453c 100644 --- a/src/app/features/preservation/order/stores/order-archive/preservation-order-order-archive.action.ts +++ b/src/app/features/order/features/all-order/stores/order-archive/order-all-order-order-archive.action.ts @@ -1,4 +1,4 @@ -import {LocalStateEnum} from "@app/shared/enums/local-state.enum"; +import {LocalStateEnum} from "@shared/enums/local-state.enum"; import {OrderArchive} from "@shared/models/business/order-archive.model"; import { QueryParameters, @@ -7,9 +7,9 @@ import { TypeDefaultAction, } from "solidify-frontend"; -const state = LocalStateEnum.preservation_order_orderArchive; +const state = LocalStateEnum.order_allOrder_orderArchive; -export namespace PreservationOrderOrderArchiveAction { +export namespace OrderAllOrderOrderArchiveAction { @TypeDefaultAction(state) export class LoadResource extends ResourceAction.LoadResource { } @@ -130,4 +130,4 @@ export namespace PreservationOrderOrderArchiveAction { } } -export const preservationOrderOrderArchiveActionNameSpace: ResourceNameSpace = PreservationOrderOrderArchiveAction; +export const orderAllOrderOrderArchiveActionNameSpace: ResourceNameSpace = OrderAllOrderOrderArchiveAction; diff --git a/src/app/features/preservation/order/stores/order-archive/preservation-order-order-archive.state.ts b/src/app/features/order/features/all-order/stores/order-archive/order-all-order-order-archive.state.ts similarity index 69% rename from src/app/features/preservation/order/stores/order-archive/preservation-order-order-archive.state.ts rename to src/app/features/order/features/all-order/stores/order-archive/order-all-order-order-archive.state.ts index 74098051dc9e0b875611efba622107bfd2ad3b15..8b91525743bba3ac597fe145df61d1697f33b65d 100644 --- a/src/app/features/preservation/order/stores/order-archive/preservation-order-order-archive.state.ts +++ b/src/app/features/order/features/all-order/stores/order-archive/order-all-order-order-archive.state.ts @@ -1,5 +1,3 @@ -import {AccessResourceApiEnum} from "@app/shared/enums/api.enum"; -import {LocalStateEnum} from "@app/shared/enums/local-state.enum"; import {Navigate} from "@ngxs/router-plugin"; import { Action, @@ -9,10 +7,12 @@ import { Store, } from "@ngxs/store"; import { - PreservationOrderOrderArchiveAction, - preservationOrderOrderArchiveActionNameSpace, -} from "@preservation/order/stores/order-archive/preservation-order-order-archive.action"; + OrderAllOrderOrderArchiveAction, + orderAllOrderOrderArchiveActionNameSpace, +} from "@order/features/all-order/stores/order-archive/order-all-order-order-archive.action"; import {ApiActionEnum} from "@shared/enums/api-action.enum"; +import {AccessResourceApiEnum} from "@shared/enums/api.enum"; +import {LocalStateEnum} from "@shared/enums/local-state.enum"; import {OrderArchive} from "@shared/models/business/order-archive.model"; import {Observable} from "rxjs"; import { @@ -33,23 +33,23 @@ import { urlSeparator, } from "solidify-frontend"; -export interface PreservationOrderOrderArchiveStateModel extends ResourceStateModel<OrderArchive> { +export interface OrderAllOrderOrderArchiveStateModel extends ResourceStateModel<OrderArchive> { } -@State<PreservationOrderOrderArchiveStateModel>({ - name: LocalStateEnum.preservation_order_orderArchive, +@State<OrderAllOrderOrderArchiveStateModel>({ + name: LocalStateEnum.order_allOrder_orderArchive, defaults: { ...defaultResourceStateInitValue(), }, children: [], }) -export class PreservationOrderOrderArchiveState extends ResourceState<PreservationOrderOrderArchiveStateModel, OrderArchive> { +export class OrderAllOrderOrderArchiveState extends ResourceState<OrderAllOrderOrderArchiveStateModel, OrderArchive> { constructor(protected apiService: ApiService, protected store: Store, protected notificationService: NotificationService, protected actions$: Actions) { super(apiService, store, notificationService, actions$, { - nameSpace: preservationOrderOrderArchiveActionNameSpace, + nameSpace: orderAllOrderOrderArchiveActionNameSpace, }); } @@ -58,8 +58,8 @@ export class PreservationOrderOrderArchiveState extends ResourceState<Preservati } @OverrideDefaultAction() - @Action(PreservationOrderOrderArchiveAction.GetAll) - getAll(ctx: StateContext<PreservationOrderOrderArchiveStateModel>, action: PreservationOrderOrderArchiveAction.GetAll): Observable<CollectionTyped<OrderArchive>> { + @Action(OrderAllOrderOrderArchiveAction.GetAll) + getAll(ctx: StateContext<OrderAllOrderOrderArchiveStateModel>, action: OrderAllOrderOrderArchiveAction.GetAll): Observable<CollectionTyped<OrderArchive>> { let reset = {}; if (!action.keepCurrentContext) { reset = { diff --git a/src/app/features/preservation/order/stores/status-history/preservation-order-status-history.action.ts b/src/app/features/order/features/all-order/stores/status-history/order-all-order-status-history.action.ts similarity index 68% rename from src/app/features/preservation/order/stores/status-history/preservation-order-status-history.action.ts rename to src/app/features/order/features/all-order/stores/status-history/order-all-order-status-history.action.ts index 318a19b7ddecfe115f5541d835d7e7b98f97ccff..72a098815d41d82447bb4aff9c9627783467ed17 100644 --- a/src/app/features/preservation/order/stores/status-history/preservation-order-status-history.action.ts +++ b/src/app/features/order/features/all-order/stores/status-history/order-all-order-status-history.action.ts @@ -1,11 +1,11 @@ -import {LocalStateEnum} from "@app/shared/enums/local-state.enum"; +import {LocalStateEnum} from "@shared/enums/local-state.enum"; import {StatusHistoryNamespace} from "@shared/stores/status-history/status-history-namespace.model"; import {StatusHistoryAction} from "@shared/stores/status-history/status-history.action"; import {TypeDefaultAction} from "solidify-frontend"; -const state = LocalStateEnum.preservation_order_statusHistory; +const state = LocalStateEnum.order_allOrder_statusHistory; -export namespace PreservationOrderStatusHistoryAction { +export namespace OrderAllOrderStatusHistoryAction { @TypeDefaultAction(state) export class History extends StatusHistoryAction.History { @@ -24,4 +24,4 @@ export namespace PreservationOrderStatusHistoryAction { } } -export const preservationOrderStatusHistoryNamespace: StatusHistoryNamespace = PreservationOrderStatusHistoryAction; +export const orderAllOrderStatusHistoryNamespace: StatusHistoryNamespace = OrderAllOrderStatusHistoryAction; diff --git a/src/app/features/preservation/order/stores/status-history/preservation-order-status-history.state.ts b/src/app/features/order/features/all-order/stores/status-history/order-all-order-status-history.state.ts similarity index 53% rename from src/app/features/preservation/order/stores/status-history/preservation-order-status-history.state.ts rename to src/app/features/order/features/all-order/stores/status-history/order-all-order-status-history.state.ts index 16a2d7f01d0f2856174377333e3550b59029cc26..326fc57d5b9d60b20888739a287980ea1e3ef518 100644 --- a/src/app/features/preservation/order/stores/status-history/preservation-order-status-history.state.ts +++ b/src/app/features/order/features/all-order/stores/status-history/order-all-order-status-history.state.ts @@ -1,13 +1,13 @@ import {Order} from "@app/generated-api"; -import {AccessResourceApiEnum} from "@app/shared/enums/api.enum"; -import {LocalStateEnum} from "@app/shared/enums/local-state.enum"; import { Actions, State, Store, } from "@ngxs/store"; -import {preservationOrderStatusHistoryNamespace} from "@preservation/order/stores/status-history/preservation-order-status-history.action"; +import {orderAllOrderStatusHistoryNamespace} from "@order/features/all-order/stores/status-history/order-all-order-status-history.action"; +import {AccessResourceApiEnum} from "@shared/enums/api.enum"; +import {LocalStateEnum} from "@shared/enums/local-state.enum"; import { defaultStatusHistoryInitValue, StatusHistoryState, @@ -18,23 +18,23 @@ import { NotificationService, } from "solidify-frontend"; -export interface PreservationOrderStatusHistoryStateModel extends StatusHistoryStateModel<Order> { +export interface OrderAllOrderStatusHistoryStateModel extends StatusHistoryStateModel<Order> { } -@State<PreservationOrderStatusHistoryStateModel>({ - name: LocalStateEnum.preservation_order_statusHistory, +@State<OrderAllOrderStatusHistoryStateModel>({ + name: LocalStateEnum.order_allOrder_statusHistory, defaults: { ...defaultStatusHistoryInitValue(), }, }) -export class PreservationOrderStatusHistoryState extends StatusHistoryState<PreservationOrderStatusHistoryStateModel, Order> { +export class OrderAllOrderStatusHistoryState extends StatusHistoryState<OrderAllOrderStatusHistoryStateModel, Order> { constructor(protected apiService: ApiService, protected store: Store, protected notificationService: NotificationService, protected actions$: Actions) { super(apiService, store, notificationService, actions$, { - nameSpace: preservationOrderStatusHistoryNamespace, + nameSpace: orderAllOrderStatusHistoryNamespace, }); } diff --git a/src/app/features/preservation/order/helpers/order-query-type-enum.helper.ts b/src/app/features/order/helpers/order-query-type-enum.helper.ts similarity index 100% rename from src/app/features/preservation/order/helpers/order-query-type-enum.helper.ts rename to src/app/features/order/helpers/order-query-type-enum.helper.ts diff --git a/src/app/features/order/order-routing.module.ts b/src/app/features/order/order-routing.module.ts new file mode 100644 index 0000000000000000000000000000000000000000..0d0e4832b68b08ae7c2c17d380c43bdfafbd5d53 --- /dev/null +++ b/src/app/features/order/order-routing.module.ts @@ -0,0 +1,37 @@ +import {NgModule} from "@angular/core"; +import { + RouterModule, + Routes, +} from "@angular/router"; +import {OrderHomeRoutable} from "@app/features/order/components/routables/order-home/order-home.routable"; +import { + AppRoutesEnum, + OrderRoutesEnum, +} from "@app/shared/enums/routes.enum"; +import {ApplicationRoleGuardService} from "@shared/guards/application-role-guard.service"; +import {TRANSLATE} from "solidify-frontend"; + +const routes: Routes = [ + { + path: AppRoutesEnum.root, + component: OrderHomeRoutable, + data: {}, + }, + { + path: OrderRoutesEnum.allOrder, + // @ts-ignore Dynamic import + loadChildren: () => import("./features/all-order/order-all-order.module").then(m => m.OrderAllOrderModule), + data: { + breadcrumb: TRANSLATE("breadcrumb.allOrder.root"), + }, + canActivate: [ApplicationRoleGuardService], + }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class OrderRoutingModule { + +} diff --git a/src/app/features/order/order.module.ts b/src/app/features/order/order.module.ts new file mode 100644 index 0000000000000000000000000000000000000000..96c50baf9bc6f28adfe3c0cd63301c11143bf930 --- /dev/null +++ b/src/app/features/order/order.module.ts @@ -0,0 +1,50 @@ +import {NgModule} from "@angular/core"; +import {OrderHomeRoutable} from "@app/features/order/components/routables/order-home/order-home.routable"; +import {OrderAllOrderAipState} from "@app/features/order/features/all-order/stores/aip/order-all-order-aip.state"; +import {OrderAllOrderDipState} from "@app/features/order/features/all-order/stores/dip/order-all-order-dip.state"; +import {OrderAllOrderState} from "@app/features/order/features/all-order/stores/order-all-order.state"; +import {OrderAllOrderOrderArchiveState} from "@app/features/order/features/all-order/stores/order-archive/order-all-order-order-archive.state"; +import {OrderAllOrderStatusHistoryState} from "@app/features/order/features/all-order/stores/status-history/order-all-order-status-history.state"; +import {OrderRoutingModule} from "@app/features/order/order-routing.module"; +import {OrderState} from "@app/features/order/stores/order.state"; +import {SharedModule} from "@app/shared/shared.module"; +import {TranslateModule} from "@ngx-translate/core"; +import {NgxsModule} from "@ngxs/store"; + +const routables = [ + OrderHomeRoutable, +]; +const containers = []; +const dialogs = []; +const presentationals = []; + +@NgModule({ + declarations: [ + ...routables, + ...containers, + ...dialogs, + ...presentationals, + ], + imports: [ + SharedModule, + OrderRoutingModule, + TranslateModule.forChild({}), + NgxsModule.forFeature([ + OrderState, + OrderAllOrderState, + OrderAllOrderStatusHistoryState, + OrderAllOrderAipState, + OrderAllOrderDipState, + OrderAllOrderOrderArchiveState, + ]), + ], + entryComponents: [ + ...dialogs, + ], + exports: [ + ...routables, + ], + providers: [], +}) +export class OrderModule { +} diff --git a/src/app/features/order/stores/order.action.ts b/src/app/features/order/stores/order.action.ts new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/app/features/order/stores/order.state.ts b/src/app/features/order/stores/order.state.ts new file mode 100644 index 0000000000000000000000000000000000000000..76ed4f501d26de93bc492fc9007cf4495cce75e5 --- /dev/null +++ b/src/app/features/order/stores/order.state.ts @@ -0,0 +1,29 @@ +import { + OrderAllOrderState, + OrderAllOrderStateModel, +} from "@app/features/order/features/all-order/stores/order-all-order.state"; +import {LocalStateEnum} from "@app/shared/enums/local-state.enum"; +import { + State, + Store, +} from "@ngxs/store"; +import {BaseStateModel} from "solidify-frontend"; + +export interface OrderStateModel extends BaseStateModel { + order_allOrder: OrderAllOrderStateModel | undefined; +} + +@State<OrderStateModel>({ + name: LocalStateEnum.order, + defaults: { + isLoadingCounter: 0, + order_allOrder: undefined, + }, + children: [ + OrderAllOrderState, + ], +}) +export class OrderState { + constructor(protected store: Store) { + } +} diff --git a/src/app/features/preservation/components/routables/preservation-home/preservation-home.routable.ts b/src/app/features/preservation/components/routables/preservation-home/preservation-home.routable.ts index 5b18b090a95d8dbf6d320231921dd3f3ca7e791f..917f45876e8d773ac16b3bde521c815b780e8b84 100644 --- a/src/app/features/preservation/components/routables/preservation-home/preservation-home.routable.ts +++ b/src/app/features/preservation/components/routables/preservation-home/preservation-home.routable.ts @@ -65,13 +65,6 @@ export class PreservationHomeRoutable extends SharedAbstractPresentational { path: RoutesEnum.preservationAipStatuses, isVisible: () => PermissionUtil.isUserHavePermission(true, ApplicationRolePermissionEnum.rootPermission, this.userRolesObs), }, - { - avatarIcon: "cart-arrow-down", - titleToTranslate: TRANSLATE("preservation.order.home.title"), - subtitleToTranslate: TRANSLATE("preservation.order.home.subtitle"), - path: RoutesEnum.preservationOrder, - isVisible: () => PermissionUtil.isUserHavePermission(true, ApplicationRolePermissionEnum.rootPermission, this.userRolesObs), - }, ]; constructor(private store: Store) { diff --git a/src/app/features/preservation/order/components/dialogs/order-delete/preservation-order-delete.dialog.ts b/src/app/features/preservation/order/components/dialogs/order-delete/preservation-order-delete.dialog.ts deleted file mode 100644 index 2314e94ee1db20f811ba7a463fd28dd7f495e4ef..0000000000000000000000000000000000000000 --- a/src/app/features/preservation/order/components/dialogs/order-delete/preservation-order-delete.dialog.ts +++ /dev/null @@ -1,38 +0,0 @@ -import {adminLicenseActionNameSpace} from "@admin/license/stores/admin-license.action"; -import {AdminLicenseStateModel} from "@admin/license/stores/admin-license.state"; -import { - ChangeDetectionStrategy, - Component, - Inject, -} from "@angular/core"; -import { - MAT_DIALOG_DATA, - MatDialogRef, -} from "@angular/material"; -import {License} from "@app/generated-api"; -import {Store} from "@ngxs/store"; -import {preservationOrderActionNameSpace} from "@preservation/order/stores/preservation-order.action"; -import {SharedAbstractDeleteDialog} from "@shared/components/dialogs/shared-abstract-delete/shared-abstract-delete.dialog"; -import {LocalStateEnum} from "@shared/enums/local-state.enum"; -import {DeleteDialog} from "@shared/models/delete-dialog.model"; -import {TRANSLATE} from "solidify-frontend"; - -@Component({ - selector: "dlcm-preservation-order-delete-dialog", - templateUrl: "../../../../../../shared/components/dialogs/shared-abstract-delete/shared-abstract-delete.dialog.html", - styleUrls: ["../../../../../../shared/components/dialogs/shared-abstract-delete/shared-abstract-delete.dialog.scss"], - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class PreservationOrderDeleteDialog extends SharedAbstractDeleteDialog<License, AdminLicenseStateModel> { - public readonly KEY_TITLE: string = TRANSLATE("preservation.order.dialog.delete.title"); - public readonly KEY_MESSAGE: string = TRANSLATE("preservation.order.dialog.delete.message"); - public readonly KEY_CONFIRM_BUTTON: string = TRANSLATE("preservation.order.dialog.delete.confirm"); - public readonly KEY_CANCEL_BUTTON: string = TRANSLATE("preservation.order.dialog.delete.cancel"); - - constructor(protected store: Store, - protected dialogRef: MatDialogRef<PreservationOrderDeleteDialog>, - @Inject(MAT_DIALOG_DATA) public data: DeleteDialog) { - super(store, dialogRef, data, LocalStateEnum.preservation_order, preservationOrderActionNameSpace); - } - -} diff --git a/src/app/features/preservation/order/components/presentationals/order-form/preservation-order-form.presentational.scss b/src/app/features/preservation/order/components/presentationals/order-form/preservation-order-form.presentational.scss deleted file mode 100644 index 601c24000fb45f17c848aeb33c35bea86a116609..0000000000000000000000000000000000000000 --- a/src/app/features/preservation/order/components/presentationals/order-form/preservation-order-form.presentational.scss +++ /dev/null @@ -1,3 +0,0 @@ -@import "../../../../../../../sass/abstracts/mixins"; -@import "../../../../../../../sass/abstracts/variables"; -@import "../../../../../../shared/components/presentationals/shared-abstract-form/shared-abstract-form.presentational.scss"; diff --git a/src/app/features/preservation/order/components/routables/order-create/preservation-order-create.routable.html b/src/app/features/preservation/order/components/routables/order-create/preservation-order-create.routable.html deleted file mode 100644 index eb0b8cff991c9b162ea1ef7cbbde84df622a725d..0000000000000000000000000000000000000000 --- a/src/app/features/preservation/order/components/routables/order-create/preservation-order-create.routable.html +++ /dev/null @@ -1,15 +0,0 @@ -<dlcm-button-toolbar-detail [mode]="'create'" - (backToListChange)="backToList()" -> -</dlcm-button-toolbar-detail> - -<div class="wrapper" - [dlcmSpinner]="isLoadingWithDependencyObs | async" -> - <dlcm-preservation-order-form #formPresentational - *ngIf="isReadyToBeDisplayedInCreateModeObs | async" - (submitChange)="create($event)" - (checkAvailableChange)="checkAvailable($event)" - (dirtyChange)="updateCanDeactivate($event)" - ></dlcm-preservation-order-form> -</div> diff --git a/src/app/features/preservation/order/order-routing.module.ts b/src/app/features/preservation/order/order-routing.module.ts deleted file mode 100644 index 1def4891bd85edfe8060a283a2bc65f37bc3f3ed..0000000000000000000000000000000000000000 --- a/src/app/features/preservation/order/order-routing.module.ts +++ /dev/null @@ -1,52 +0,0 @@ -import {NgModule} from "@angular/core"; -import {RouterModule} from "@angular/router"; -import { - AppRoutesEnum, - PreservationPlanningRoutesEnum, -} from "@app/shared/enums/routes.enum"; -import {DlcmRoutes} from "@app/shared/models/dlcm-route.model"; -import {PreservationOrderCreateRoutable} from "@preservation/order/components/routables/order-create/preservation-order-create.routable"; -import {PreservationOrderDetailEditRoutable} from "@preservation/order/components/routables/order-detail-edit/preservation-order-detail-edit.routable"; -import {PreservationOrderListRoutable} from "@preservation/order/components/routables/order-list/preservation-order-list.routable"; -import {PreservationOrderState} from "@preservation/order/stores/preservation-order.state"; -import {CanDeactivateGuard} from "@shared/services/can-deactivate-guard.service"; -import {TRANSLATE} from "solidify-frontend"; - -const routes: DlcmRoutes = [ - { - path: AppRoutesEnum.root, - component: PreservationOrderListRoutable, - data: {}, - }, - { - path: PreservationPlanningRoutesEnum.orderDetail + AppRoutesEnum.separator + AppRoutesEnum.paramId, - component: PreservationOrderDetailEditRoutable, - data: { - breadcrumbMemoizedSelector: PreservationOrderState.currentTitle, - }, - children: [ - { - path: PreservationPlanningRoutesEnum.orderEdit, - data: { - breadcrumb: TRANSLATE("breadcrumb.preservation.order.edit"), - }, - canDeactivate: [CanDeactivateGuard], - }, - ], - }, - { - path: PreservationPlanningRoutesEnum.orderCreate, - component: PreservationOrderCreateRoutable, - data: { - breadcrumb: TRANSLATE("breadcrumb.preservation.order.create"), - }, - canDeactivate: [CanDeactivateGuard], - }, -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class OrderRoutingModule { -} diff --git a/src/app/features/preservation/order/order.module.ts b/src/app/features/preservation/order/order.module.ts deleted file mode 100644 index 1ee2a56f86510389addc974d9e3bad5d63e4cfb6..0000000000000000000000000000000000000000 --- a/src/app/features/preservation/order/order.module.ts +++ /dev/null @@ -1,58 +0,0 @@ -import {NgModule} from "@angular/core"; -import {SharedModule} from "@app/shared/shared.module"; -import {TranslateModule} from "@ngx-translate/core"; -import {NgxsModule} from "@ngxs/store"; -import {PreservationOrderDeleteDialog} from "@preservation/order/components/dialogs/order-delete/preservation-order-delete.dialog"; -import {PreservationOrderFormPresentational} from "@preservation/order/components/presentationals/order-form/preservation-order-form.presentational"; -import {PreservationOrderCreateRoutable} from "@preservation/order/components/routables/order-create/preservation-order-create.routable"; -import {PreservationOrderListRoutable} from "@preservation/order/components/routables/order-list/preservation-order-list.routable"; -import {OrderRoutingModule} from "@preservation/order/order-routing.module"; -import {PreservationOrderAipState} from "@preservation/order/stores/aip/preservation-order-aip.state"; -import {PreservationOrderDipState} from "@preservation/order/stores/dip/preservation-order-dip.state"; -import {PreservationOrderOrderArchiveState} from "@preservation/order/stores/order-archive/preservation-order-order-archive.state"; -import {PreservationOrderState} from "@preservation/order/stores/preservation-order.state"; -import {PreservationOrderStatusHistoryState} from "@preservation/order/stores/status-history/preservation-order-status-history.state"; -import {PreservationOrderDetailEditRoutable} from "./components/routables/order-detail-edit/preservation-order-detail-edit.routable"; - -const routables = [ - PreservationOrderListRoutable, - PreservationOrderDetailEditRoutable, - PreservationOrderCreateRoutable, -]; -const containers = []; -const dialogs = [ - PreservationOrderDeleteDialog, -]; -const presentationals = [ - PreservationOrderFormPresentational, -]; - -@NgModule({ - declarations: [ - ...routables, - ...containers, - ...dialogs, - ...presentationals, - ], - imports: [ - SharedModule, - OrderRoutingModule, - TranslateModule.forChild({}), - NgxsModule.forFeature([ - PreservationOrderState, - PreservationOrderStatusHistoryState, - PreservationOrderAipState, - PreservationOrderDipState, - PreservationOrderOrderArchiveState, - ]), - ], - entryComponents: [ - ...dialogs, - ], - exports: [ - ...routables, - ], - providers: [], -}) -export class OrderModule { -} diff --git a/src/app/features/preservation/order/stores/preservation-order.state.ts b/src/app/features/preservation/order/stores/preservation-order.state.ts deleted file mode 100644 index a79d6e06e56dd4efc3e8e3b9d272c51f362d4a03..0000000000000000000000000000000000000000 --- a/src/app/features/preservation/order/stores/preservation-order.state.ts +++ /dev/null @@ -1,255 +0,0 @@ -import {Order} from "@app/generated-api"; -import {AccessResourceApiEnum} from "@app/shared/enums/api.enum"; -import {LocalStateEnum} from "@app/shared/enums/local-state.enum"; -import { - Action, - Actions, - Selector, - State, - StateContext, - Store, -} from "@ngxs/store"; -import { - PreservationOrderAipState, - PreservationOrderAipStateModel, -} from "@preservation/order/stores/aip/preservation-order-aip.state"; -import { - PreservationOrderDipState, - PreservationOrderDipStateModel, -} from "@preservation/order/stores/dip/preservation-order-dip.state"; -import { - PreservationOrderOrderArchiveState, - PreservationOrderOrderArchiveStateModel, -} from "@preservation/order/stores/order-archive/preservation-order-order-archive.state"; -import { - PreservationOrderAction, - preservationOrderActionNameSpace, -} from "@preservation/order/stores/preservation-order.action"; -import { - PreservationOrderStatusHistoryState, - PreservationOrderStatusHistoryStateModel, -} from "@preservation/order/stores/status-history/preservation-order-status-history.state"; -import {ApiActionEnum} from "@shared/enums/api-action.enum"; -import {RoutesEnum} from "@shared/enums/routes.enum"; -import {OrderArchive} from "@shared/models/business/order-archive.model"; -import {defaultStatusHistoryInitValue} from "@shared/stores/status-history/status-history.state"; -import {Observable} from "rxjs"; -import {tap} from "rxjs/internal/operators/tap"; -import {catchError} from "rxjs/operators"; -import { - ApiService, - defaultAssociationStateInitValue, - defaultResourceStateInitValue, - isNullOrUndefined, - NotificationService, - ResourceState, - ResourceStateModel, - SolidifyStateError, - StoreUtil, - TRANSLATE, - urlSeparator, -} from "solidify-frontend"; - -export interface PreservationOrderStateModel extends ResourceStateModel<Order> { - preservation_order_statusHistory: PreservationOrderStatusHistoryStateModel; - preservation_order_aip: PreservationOrderAipStateModel | undefined; - preservation_order_dip: PreservationOrderDipStateModel | undefined; - preservation_order_orderArchive: PreservationOrderOrderArchiveStateModel | undefined; -} - -@State<PreservationOrderStateModel>({ - name: LocalStateEnum.preservation_order, - defaults: { - ...defaultResourceStateInitValue(), - preservation_order_statusHistory: {...defaultStatusHistoryInitValue()}, - preservation_order_aip: {...defaultAssociationStateInitValue()}, - preservation_order_dip: {...defaultAssociationStateInitValue()}, - preservation_order_orderArchive: {...defaultResourceStateInitValue()}, - }, - children: [ - PreservationOrderStatusHistoryState, - PreservationOrderOrderArchiveState, - PreservationOrderAipState, - PreservationOrderDipState, - ], -}) -export class PreservationOrderState extends ResourceState<PreservationOrderStateModel, Order> { - constructor(protected apiService: ApiService, - protected store: Store, - protected notificationService: NotificationService, - protected actions$: Actions) { - super(apiService, store, notificationService, actions$, { - nameSpace: preservationOrderActionNameSpace, - routeRedirectUrlAfterSuccessCreateAction: (resId: string) => RoutesEnum.preservationOrderDetail + urlSeparator + resId, - routeRedirectUrlAfterSuccessUpdateAction: (resId: string) => RoutesEnum.preservationOrderDetail + urlSeparator + resId, - routeRedirectUrlAfterSuccessDeleteAction: RoutesEnum.preservationOrder, - notificationResourceCreateSuccessTextToTranslate: TRANSLATE("preservation.order.notification.resource.create"), - notificationResourceDeleteSuccessTextToTranslate: TRANSLATE("preservation.order.notification.resource.delete"), - notificationResourceUpdateSuccessTextToTranslate: TRANSLATE("preservation.order.notification.resource.update"), - }); - } - - protected get _urlResource(): string { - return AccessResourceApiEnum.orders; - } - - @Selector() - static isLoading(state: PreservationOrderStateModel): boolean { - return StoreUtil.isLoadingState(state); - } - - @Selector() - static currentTitle(state: PreservationOrderStateModel): string | undefined { - if (isNullOrUndefined(state.current)) { - return undefined; - } - return state.current.name; - } - - @Selector() - static isLoadingWithDependency(state: PreservationOrderStateModel): boolean { - return this.isLoading(state); - } - - @Selector() - static isReadyToBeDisplayed(state: PreservationOrderStateModel): boolean { - return this.isReadyToBeDisplayedInCreateMode - && !isNullOrUndefined(state.current); - } - - @Selector() - static isReadyToBeDisplayedInCreateMode(state: PreservationOrderStateModel): boolean { - return true; - } - - @Action(PreservationOrderAction.Submit) - submit(ctx: StateContext<PreservationOrderStateModel>, action: PreservationOrderAction.Submit): Observable<string[]> { - ctx.patchState({ - isLoadingCounter: ctx.getState().isLoadingCounter + 1, - }); - - return this.apiService.patchByIdWithCustomUrl(`${this._urlResource}/${action.resId}/${ApiActionEnum.SUBMIT}`, null) - .pipe( - tap(() => { - ctx.dispatch(new PreservationOrderAction.SubmitSuccess(action)); - }), - catchError(error => { - ctx.dispatch(new PreservationOrderAction.SubmitFail(action)); - throw new SolidifyStateError(this, error); - }), - ); - } - - @Action(PreservationOrderAction.SubmitSuccess) - submitSuccess(ctx: StateContext<PreservationOrderStateModel>, action: PreservationOrderAction.SubmitSuccess): void { - ctx.patchState({ - isLoadingCounter: ctx.getState().isLoadingCounter - 1, - }); - ctx.dispatch(new PreservationOrderAction.GetById((action.parentAction as PreservationOrderAction.Submit).resId)); - } - - @Action(PreservationOrderAction.SubmitFail) - submitFail(ctx: StateContext<PreservationOrderStateModel>, action: PreservationOrderAction.SubmitFail): void { - ctx.patchState({ - isLoadingCounter: ctx.getState().isLoadingCounter - 1, - }); - } - - @Action(PreservationOrderAction.Resume) - resume(ctx: StateContext<PreservationOrderStateModel>, action: PreservationOrderAction.Resume): Observable<string[]> { - ctx.patchState({ - isLoadingCounter: ctx.getState().isLoadingCounter + 1, - }); - - return this.apiService.patchByIdWithCustomUrl(`${this._urlResource}/${action.resId}/${ApiActionEnum.RESUME}`, null) - .pipe( - tap(() => { - ctx.dispatch(new PreservationOrderAction.ResumeSuccess(action)); - }), - catchError(error => { - ctx.dispatch(new PreservationOrderAction.ResumeFail(action)); - throw new SolidifyStateError(this, error); - }), - ); - } - - @Action(PreservationOrderAction.ResumeSuccess) - resumeSuccess(ctx: StateContext<PreservationOrderStateModel>, action: PreservationOrderAction.ResumeSuccess): void { - ctx.patchState({ - isLoadingCounter: ctx.getState().isLoadingCounter - 1, - }); - ctx.dispatch(new PreservationOrderAction.GetById((action.parentAction as PreservationOrderAction.Resume).resId)); - } - - @Action(PreservationOrderAction.ResumeFail) - resumeFail(ctx: StateContext<PreservationOrderStateModel>, action: PreservationOrderAction.ResumeFail): void { - ctx.patchState({ - isLoadingCounter: ctx.getState().isLoadingCounter - 1, - }); - } - - // @Action(PreservationOrderAction.View) - // view(ctx: StateContext<PreservationOrderStateModel>, action: PreservationOrderAction.View): Observable<OrderArchive[]> { - // ctx.patchState({ - // isLoadingCounter: ctx.getState().isLoadingCounter + 1, - // }); - // - // return this.apiService.getByIdInPath<OrderArchive[]>(`${this._urlResource}/${action.resId}/${ApiActionEnum.VIEW}`) - // .pipe( - // tap((result) => { - // ctx.dispatch(new PreservationOrderAction.ViewSuccess(action, result)); - // }), - // catchError(error => { - // ctx.dispatch(new PreservationOrderAction.ViewFail(action)); - // throw new SolidifyStateError(this, error); - // }), - // ); - // } - // - // @Action(PreservationOrderAction.ViewSuccess) - // viewSuccess(ctx: StateContext<PreservationOrderStateModel>, action: PreservationOrderAction.ViewSuccess): void { - // ctx.patchState({ - // isLoadingCounter: ctx.getState().isLoadingCounter - 1, - // orderArchives: action.orderArchives, - // }); - // } - // - // @Action(PreservationOrderAction.ViewFail) - // viewFail(ctx: StateContext<PreservationOrderStateModel>, action: PreservationOrderAction.ViewFail): void { - // ctx.patchState({ - // isLoadingCounter: ctx.getState().isLoadingCounter - 1, - // }); - // } - - @Action(PreservationOrderAction.Save) - save(ctx: StateContext<PreservationOrderStateModel>, action: PreservationOrderAction.Save): Observable<OrderArchive> { - ctx.patchState({ - isLoadingCounter: ctx.getState().isLoadingCounter + 1, - }); - - return this.apiService.post<OrderArchive>(`${this._urlResource}/${action.resId}/${ApiActionEnum.SAVE}`) - .pipe( - tap(() => { - ctx.dispatch(new PreservationOrderAction.SaveSuccess(action)); - }), - catchError(error => { - ctx.dispatch(new PreservationOrderAction.SaveFail(action)); - throw new SolidifyStateError(this, error); - }), - ); - } - - @Action(PreservationOrderAction.SaveSuccess) - saveSuccess(ctx: StateContext<PreservationOrderStateModel>, action: PreservationOrderAction.SaveSuccess): void { - ctx.patchState({ - isLoadingCounter: ctx.getState().isLoadingCounter - 1, - }); - } - - @Action(PreservationOrderAction.SaveFail) - saveFail(ctx: StateContext<PreservationOrderStateModel>, action: PreservationOrderAction.SaveFail): void { - ctx.patchState({ - isLoadingCounter: ctx.getState().isLoadingCounter - 1, - }); - } -} diff --git a/src/app/features/preservation/preservation-routing.module.ts b/src/app/features/preservation/preservation-routing.module.ts index 99efc0d7803be12d056c1359f3f3a27c83d2481d..7015a56c4e5bc1f9b9dfac12528e6c4d7b311ea4 100644 --- a/src/app/features/preservation/preservation-routing.module.ts +++ b/src/app/features/preservation/preservation-routing.module.ts @@ -80,15 +80,6 @@ const routes: Routes = [ }, canActivate: [ApplicationRoleGuardService], }, - { - path: PreservationPlanningRoutesEnum.order, - // @ts-ignore Dynamic import - loadChildren: () => import("./order/order.module").then(m => m.OrderModule), - data: { - breadcrumb: TRANSLATE("breadcrumb.preservation.order.root"), - }, - canActivate: [ApplicationRoleGuardService], - }, { path: PreservationPlanningRoutesEnum.dip, // @ts-ignore Dynamic import diff --git a/src/app/features/preservation/preservation.module.ts b/src/app/features/preservation/preservation.module.ts index e71e4bcdeefa410a8f66e26277732a0b1f14c57e..09ec7c83185010c85cd87c79441e15459e57321a 100644 --- a/src/app/features/preservation/preservation.module.ts +++ b/src/app/features/preservation/preservation.module.ts @@ -18,11 +18,6 @@ import {DipDataFileState} from "@preservation/dip/stores/data-file/dip-data-file import {DipDataFileStatusHistoryState} from "@preservation/dip/stores/data-file/status-history/dip-data-file-status-history.state"; import {DipState} from "@preservation/dip/stores/dip.state"; import {DipStatusHistoryState} from "@preservation/dip/stores/status-history/dip-status-history.state"; -import {PreservationOrderAipState} from "@preservation/order/stores/aip/preservation-order-aip.state"; -import {PreservationOrderDipState} from "@preservation/order/stores/dip/preservation-order-dip.state"; -import {PreservationOrderOrderArchiveState} from "@preservation/order/stores/order-archive/preservation-order-order-archive.state"; -import {PreservationOrderState} from "@preservation/order/stores/preservation-order.state"; -import {PreservationOrderStatusHistoryState} from "@preservation/order/stores/status-history/preservation-order-status-history.state"; import {SipDataFileState} from "@preservation/sip/stores/data-file/sip-data-file.state"; import {SipDataFileStatusHistoryState} from "@preservation/sip/stores/data-file/status-history/sip-data-file-status-history.state"; import {SipState} from "@preservation/sip/stores/sip.state"; @@ -60,11 +55,6 @@ const presentationals = []; DipDataFileState, DipStatusHistoryState, DipDataFileStatusHistoryState, - PreservationOrderState, - PreservationOrderStatusHistoryState, - PreservationOrderAipState, - PreservationOrderDipState, - PreservationOrderOrderArchiveState, PreservationAipState, PreservationAipOrganizationalUnitState, PreservationAipAipState, diff --git a/src/app/features/preservation/stores/preservation.state.ts b/src/app/features/preservation/stores/preservation.state.ts index 01fe8aa9b37056c4282fcdaf79473ed9d4cfdf02..c1fba9111324151ab92c2b98e401111d34acdedd 100644 --- a/src/app/features/preservation/stores/preservation.state.ts +++ b/src/app/features/preservation/stores/preservation.state.ts @@ -16,10 +16,6 @@ import { State, Store, } from "@ngxs/store"; -import { - PreservationOrderState, - PreservationOrderStateModel, -} from "@preservation/order/stores/preservation-order.state"; import { DipState, DipStateModel, @@ -36,7 +32,6 @@ export interface PreservationStateModel extends BaseStateModel { preservation_aipStatus: PreservationAipStatusStateModel | undefined; preservation_sip: SipStateModel | undefined; preservation_dip: DipStateModel | undefined; - preservation_order: PreservationOrderStateModel | undefined; } @State<PreservationStateModel>({ @@ -48,7 +43,6 @@ export interface PreservationStateModel extends BaseStateModel { preservation_aipStatus: undefined, preservation_sip: undefined, preservation_dip: undefined, - preservation_order: undefined, }, children: [ PreservationMonitoringState, @@ -57,7 +51,6 @@ export interface PreservationStateModel extends BaseStateModel { SipState, DipState, PreservationAipState, - PreservationOrderState ], }) export class PreservationState { diff --git a/src/app/shared/enums/local-state.enum.ts b/src/app/shared/enums/local-state.enum.ts index eb5061cf253fdb511ea35eab212613e5d14f8c5c..8353cec8ce63679a7f47edb6fbd7a51fe5b0a3e2 100644 --- a/src/app/shared/enums/local-state.enum.ts +++ b/src/app/shared/enums/local-state.enum.ts @@ -29,6 +29,14 @@ export enum LocalStateEnum { oauth2Client = "oauth2Client", + order = "order", + + order_allOrder = "order_allOrder", + order_allOrder_statusHistory = "order_allOrder_statusHistory", + order_allOrder_aip = "order_allOrder_aip", + order_allOrder_dip = "order_allOrder_dip", + order_allOrder_orderArchive = "order_allOrder_orderArchive", + shared = "shared", shared_language = "shared_language", shared_license = "shared_license", @@ -82,12 +90,6 @@ export enum LocalStateEnum { preservation_job_execution = "preservation_job_execution", - preservation_order = "preservation_order", - preservation_order_statusHistory = "preservation_order_statusHistory", - preservation_order_aip = "preservation_order_aip", - preservation_order_dip = "preservation_order_dip", - preservation_order_orderArchive = "preservation_order_orderArchive", - preservation_sip = "preservation_sip", preservation_sip_statusHistory = "preservation_sip_statusHistory", preservation_sip_dataFile = "preservation_sip_dataFile", diff --git a/src/app/shared/enums/routes.enum.ts b/src/app/shared/enums/routes.enum.ts index d4d85f86dc83fa9d655eaedbd1511375e81c21c7..4a37bc463d2c2bf184f214ecaf946582d0492361 100644 --- a/src/app/shared/enums/routes.enum.ts +++ b/src/app/shared/enums/routes.enum.ts @@ -10,6 +10,7 @@ export enum AppRoutesEnum { organizationalUnit = "organizational-unit", admin = "admin", preservation = "preservation", + order = "order", separator = "/", paramId = ":id", paramIdOrgUnit = ":idOrgUnit", @@ -103,6 +104,15 @@ export enum AdminRoutesEnum { fundingAgenciesEdit = "edit", } +export enum OrderRoutesEnum { + order = "order", + allOrder = "all-order", + allOrderCreate = "create", + allOrderDetail = "detail", + allOrderEdit = "edit", + myOrder = "my-order", +} + export enum PreservationPlanningRoutesEnum { preservationPlanning = "preservation-planning", preservationPlanningCreate = "create", @@ -142,11 +152,6 @@ export enum PreservationPlanningRoutesEnum { sipDetail = "detail", sipMetadata = "metadata", sipFiles = "files", - - order = "order", - orderCreate = "create", - orderDetail = "detail", - orderEdit = "edit", } export class RoutesEnum implements RoutesEnum { @@ -164,6 +169,12 @@ export class RoutesEnum implements RoutesEnum { static organizationalUnit: string = AppRoutesEnum.organizationalUnit; static organizationalUnitDetail: string = AppRoutesEnum.organizationalUnit + urlSeparator + OrganizationalUnitRoutesEnum.detail; + static orderAllOrder: string = AppRoutesEnum.order + urlSeparator + OrderRoutesEnum.allOrder; + static orderAllOrderDetail: string = AppRoutesEnum.order + urlSeparator + OrderRoutesEnum.allOrder + urlSeparator + OrderRoutesEnum.allOrderDetail; + static orderAllOrderCreate: string = AppRoutesEnum.order + urlSeparator + OrderRoutesEnum.allOrder + urlSeparator + OrderRoutesEnum.allOrderCreate; + + static orderMyOrder: string = AppRoutesEnum.order + urlSeparator + OrderRoutesEnum.myOrder; + static admin: string = AppRoutesEnum.admin; static adminSubmissionPolicy: string = AppRoutesEnum.admin + urlSeparator + AdminRoutesEnum.submissionPolicy; @@ -236,9 +247,5 @@ export class RoutesEnum implements RoutesEnum { static preservationJobCreate: string = AppRoutesEnum.preservation + urlSeparator + PreservationPlanningRoutesEnum.job + urlSeparator + PreservationPlanningRoutesEnum.jobCreate; static preservationJobDetail: string = AppRoutesEnum.preservation + urlSeparator + PreservationPlanningRoutesEnum.job + urlSeparator + PreservationPlanningRoutesEnum.jobDetail; - static preservationOrder: string = AppRoutesEnum.preservation + urlSeparator + PreservationPlanningRoutesEnum.order; - static preservationOrderDetail: string = AppRoutesEnum.preservation + urlSeparator + PreservationPlanningRoutesEnum.order + urlSeparator + PreservationPlanningRoutesEnum.orderDetail; - static preservationOrderCreate: string = AppRoutesEnum.preservation + urlSeparator + PreservationPlanningRoutesEnum.order + urlSeparator + PreservationPlanningRoutesEnum.orderCreate; - static preservationAipStatuses: string = AppRoutesEnum.preservation + urlSeparator + PreservationPlanningRoutesEnum.aipStatuses; } diff --git a/src/app/shared/utils/store-dialog.util.ts b/src/app/shared/utils/store-dialog.util.ts index 6041d1d1ddc7aee8050a27306930fc8eae82678f..1b2601a11ee97bb689d827a8143c47860beeedab 100644 --- a/src/app/shared/utils/store-dialog.util.ts +++ b/src/app/shared/utils/store-dialog.util.ts @@ -10,10 +10,10 @@ import {AdminPreservationPolicyDeleteDialog} from "@admin/preservation-policy/co import {AdminSubmissionPolicyDeleteDialog} from "@admin/submission-policy/components/dialogs/admin-submission-policy-delete/admin-submission-policy-delete.dialog"; import {AdminUserDeleteDialog} from "@admin/user/components/dialogs/admin-user-delete/admin-user-delete.dialog"; import {Component} from "@angular/core"; +import {OrderAllOrderDeleteDialog} from "@app/features/order/features/all-order/components/dialogs/all-order-delete/order-all-order-delete.dialog"; import {JobDeleteDialog} from "@app/features/preservation/job/components/dialogs/job-delete/job-delete.dialog"; import {LocalStateEnum} from "@app/shared/enums/local-state.enum"; import {DepositDeleteDialog} from "@deposit/components/dialogs/deposit-delete/deposit-delete.dialog"; -import {PreservationOrderDeleteDialog} from "@preservation/order/components/dialogs/order-delete/preservation-order-delete.dialog"; import {StringUtil} from "solidify-frontend"; export class StoreDialogUtil { @@ -59,8 +59,8 @@ export class StoreDialogUtil { if (state === LocalStateEnum.preservation_job) { return JobDeleteDialog as Component; } - if (state === LocalStateEnum.preservation_order) { - return PreservationOrderDeleteDialog as Component; + if (state === LocalStateEnum.order_allOrder) { + return OrderAllOrderDeleteDialog as Component; } throw Error(StringUtil.format(StoreDialogUtil.messageNotFound, "Delete", state)); } diff --git a/src/app/shared/utils/store-route-local.util.ts b/src/app/shared/utils/store-route-local.util.ts index 98f163124a732d4f76a03b88ad029cf159c6d279..3a326395508988e6019955d02e4f5bb4e5f42fa5 100644 --- a/src/app/shared/utils/store-route-local.util.ts +++ b/src/app/shared/utils/store-route-local.util.ts @@ -63,8 +63,8 @@ export class StoreRouteLocalUtil { if (state === LocalStateEnum.preservation_dip) { return RoutesEnum.preservationDipDetail; } - if (state === LocalStateEnum.preservation_order) { - return RoutesEnum.preservationOrderDetail; + if (state === LocalStateEnum.order_allOrder) { + return RoutesEnum.orderAllOrderDetail; } throw Error(StringUtil.format(StoreRouteLocalUtil.messageNotFound, "Detail", state)); } @@ -112,8 +112,8 @@ export class StoreRouteLocalUtil { if (state === LocalStateEnum.preservation_job) { return RoutesEnum.preservationJobCreate; } - if (state === LocalStateEnum.preservation_order) { - return RoutesEnum.preservationOrderCreate; + if (state === LocalStateEnum.order_allOrder) { + return RoutesEnum.orderAllOrderCreate; } throw Error(StringUtil.format(StoreRouteLocalUtil.messageNotFound, "Create", state)); } @@ -167,8 +167,8 @@ export class StoreRouteLocalUtil { if (state === LocalStateEnum.preservation_sip) { return RoutesEnum.preservationSip; } - if (state === LocalStateEnum.preservation_order) { - return RoutesEnum.preservationOrder; + if (state === LocalStateEnum.order_allOrder) { + return RoutesEnum.orderAllOrder; } if (state === LocalStateEnum.preservation_dip) { return RoutesEnum.preservationDip; diff --git a/src/app/stores/cart/app-cart.state.ts b/src/app/stores/cart/app-cart.state.ts index e350e33c1566aa6f728d0198f8121be141a8918d..cac27dd13bf040901abe813210dbf16eb1a7620c 100644 --- a/src/app/stores/cart/app-cart.state.ts +++ b/src/app/stores/cart/app-cart.state.ts @@ -137,7 +137,7 @@ export class AppCartState { // TODO Polling until Order is in status READY then prompt user that the order is ready to download this.notificationService.showSuccess(TRANSLATE("app.order.notification.cartSubmit.success")); ctx.dispatch([ - new Navigate([RoutesEnum.preservationOrderDetail + urlSeparator + action.orderId]), + new Navigate([RoutesEnum.orderAllOrderDetail + urlSeparator + action.orderId]), new AppCartAction.Clean(), ]); } @@ -152,7 +152,7 @@ export class AppCartState { if (isNullOrUndefined(action.orderId)) { return; } - ctx.dispatch(new Navigate([RoutesEnum.preservationOrderDetail + urlSeparator + action.orderId])); + ctx.dispatch(new Navigate([RoutesEnum.orderAllOrderDetail + urlSeparator + action.orderId])); } @Action(AppCartAction.Clean) diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index 392df16ff4a6883c513b1ec47812a716fa014f5d..05ac8d62baf460020f79b35c93f2e1e9b9359ad5 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -684,9 +684,9 @@ "button": { "close": "Close", "placeholder": { - "remove": "app.cart.button.placeholder.remove" + "remove": "Remove from cart" }, - "submit": "app.cart.button.submit" + "submit": "Submit" }, "title": "Cart" }, @@ -751,6 +751,7 @@ "home": "Home", "login": "Log in", "logout": "Log out", + "orderHistory": "Order history", "organizationalUnit": "Organizational Units", "preservation": "Preservation", "profileInfo": "Profile", diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index f1fbf18184d8ab2731a6ca1bac303f691aed4f1d..5cb19894928e2bc9a64ad711428498198a265bfd 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -751,6 +751,7 @@ "home": "Home", "login": "Log in", "logout": "Log out", + "orderHistory": "Order history", "organizationalUnit": "Organizational Units", "preservation": "Preservation", "profileInfo": "Profile", diff --git a/src/assets/i18n/fr.json b/src/assets/i18n/fr.json index fe47cb15288256dd73dc091cdf3f826318814d33..2225dda108b715e6d0faa5bf7eb33f6626653849 100644 --- a/src/assets/i18n/fr.json +++ b/src/assets/i18n/fr.json @@ -751,6 +751,7 @@ "home": "Accueil", "login": "Connexion", "logout": "Déconnexion", + "orderHistory": "Historique des demandes", "organizationalUnit": "Unités Organisationnelles", "preservation": "Préservation", "profileInfo": "Profil", diff --git a/tsconfig.json b/tsconfig.json index 468e1b3edf1d611f216cf25719e71b29768b17fd..a621731b889969204833ac06956d32e2d18a248f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,6 +26,9 @@ ], "@preservation/*": [ "app/features/preservation/*" + ], + "@order/*": [ + "app/features/order/*" ] }, "outDir": "./dist/out-tsc",