- {{ 'PAC.INDICATOR.REGISTER.BUSINESS' | translate }}:
+ {{ 'PAC.INDICATOR.REGISTER.NAME' | translate }}:
-
- {{indicator.business}}
+
+ {{indicator.name}}
-
-
-
- {{ 'PAC.INDICATOR.VIEWER.MODEL_INFORMATION' | translate: {Default: 'Model information'} }}
-
-
-
-
-
- {{ 'PAC.INDICATOR.REGISTER.MODEL' | translate }}:
-
-
-
-
- {{ 'PAC.INDICATOR.REGISTER.ENTITY' | translate }}:
-
-
- {{indicator.entity}}
-
-
-
- {{ 'PAC.INDICATOR.REGISTER.TYPE' | translate }}:
-
-
-
-
- {{ 'PAC.INDICATOR.REGISTER.MEASURE' | translate }}:
-
-
- {{indicator.options?.measure}}
-
-
-
- {{ 'PAC.INDICATOR.REGISTER.Aggregator' | translate: {Default: 'Aggregator'} }}:
-
-
- {{indicator.options?.aggregator}}
-
-
-
- {{ 'PAC.INDICATOR.REGISTER.FORMULA' | translate }}:
-
-
- {{indicator.options?.formula}}
-
-
-
- {{ 'PAC.INDICATOR.REGISTER.DIMENSIONS' | translate }}:
-
-
- {{indicator.options?.dimensions}}
-
-
+
- {{ 'PAC.INDICATOR.REGISTER.FILTERS' | translate }}:
+ {{ 'PAC.INDICATOR.REGISTER.Code' | translate: {Default: 'Code'} }}:
-
-
+
+
+
+
+ {{ 'PAC.INDICATOR.VIEWER.BASIC_INFORMATION' | translate: {Default: 'Basic information'} }}
+
+
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.BUSINESS_AREA' | translate }}:
+
+
+ {{indicator.businessArea?.name}}
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.UNIT' | translate }}:
+
+
+ {{indicator.unit}}
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.CREATED_BY' | translate }}:
+
+
+ {{indicator.createdBy | createdBy}}
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.PRINCIPAL' | translate }}:
+
+
+ {{indicator.principal}}
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.Certification' | translate: {Default: 'Certification'} }}:
+
+
+
+ {{indicator.certification.name}}
+
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.VALIDITY' | translate }}:
+
+
+ {{indicator.validity}}
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.STATUS' | translate }}:
+
+
+
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.Visible' | translate: {Default: 'Visible'} }}:
+
+
+
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.Tags' | translate: {Default: 'Tags'} }}:
+
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.BUSINESS' | translate }}:
+
+
+ {{indicator.business}}
+
+
+
+
+
+
+
+
+ {{ 'PAC.INDICATOR.VIEWER.MODEL_INFORMATION' | translate: {Default: 'Model information'} }}
+
+
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.MODEL' | translate }}:
+
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.ENTITY' | translate }}:
+
+
+ {{indicator.entity}}
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.TYPE' | translate }}:
+
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.MEASURE' | translate }}:
+
+
+ {{indicator.options?.measure}}
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.Aggregator' | translate: {Default: 'Aggregator'} }}:
+
+
+ {{indicator.options?.aggregator}}
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.FORMULA' | translate }}:
+
+
+ {{indicator.options?.formula}}
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.DIMENSIONS' | translate }}:
+
+
+ {{indicator.options?.dimensions}}
+
+
+
+ {{ 'PAC.INDICATOR.REGISTER.FILTERS' | translate }}:
+
+
+
+
+
+
+
diff --git a/apps/cloud/src/app/features/indicator/viewer/viewer.component.scss b/apps/cloud/src/app/features/indicator/viewer/viewer.component.scss
index 6e6d25280..16fd50f81 100644
--- a/apps/cloud/src/app/features/indicator/viewer/viewer.component.scss
+++ b/apps/cloud/src/app/features/indicator/viewer/viewer.component.scss
@@ -1,6 +1,3 @@
:host {
- flex: 1;
- overflow-y: auto;
- overflow-x: hidden;
- max-width: 100%;
+ @apply flex-1 max-w-full flex flex-col overflow-y-auto overflow-x-hidden;
}
diff --git a/apps/cloud/src/app/features/indicator/viewer/viewer.component.ts b/apps/cloud/src/app/features/indicator/viewer/viewer.component.ts
index 57ca2356d..e6e06a75b 100644
--- a/apps/cloud/src/app/features/indicator/viewer/viewer.component.ts
+++ b/apps/cloud/src/app/features/indicator/viewer/viewer.component.ts
@@ -1,16 +1,17 @@
-import { Component, OnInit, inject } from '@angular/core'
+import { CommonModule } from '@angular/common'
+import { Component, inject } from '@angular/core'
+import { toSignal } from '@angular/core/rxjs-interop'
+import { FormsModule } from '@angular/forms'
import { ActivatedRoute, Router, RouterModule } from '@angular/router'
import { IndicatorsService } from '@metad/cloud/state'
+import { NxSelectionModule } from '@metad/components/selection'
+import { TranslateModule, TranslateService } from '@ngx-translate/core'
+import formatRelative from 'date-fns/formatRelative'
import { isNil, negate } from 'lodash-es'
import { distinctUntilChanged, filter, map, startWith, switchMap } from 'rxjs/operators'
import { AbilityActions, getDateLocale } from '../../../@core'
-import { IndicatorTypeComponent } from '../../../@shared/indicator'
-import { CommonModule } from '@angular/common'
import { CreatedByPipe, MaterialModule, TagViewerComponent } from '../../../@shared'
-import { TranslateModule, TranslateService } from '@ngx-translate/core'
-import { FormsModule } from '@angular/forms'
-import { NxSelectionModule } from '@metad/components/selection'
-import formatRelative from 'date-fns/formatRelative'
+import { IndicatorTypeComponent } from '../../../@shared/indicator'
@Component({
standalone: true,
@@ -20,7 +21,7 @@ import formatRelative from 'date-fns/formatRelative'
FormsModule,
MaterialModule,
TranslateModule,
-
+
CreatedByPipe,
NxSelectionModule,
IndicatorTypeComponent,
@@ -30,29 +31,31 @@ import formatRelative from 'date-fns/formatRelative'
templateUrl: './viewer.component.html',
styleUrls: ['./viewer.component.scss']
})
-export class ViewerComponent implements OnInit {
+export class ViewerComponent {
AbilityActions = AbilityActions
public readonly translateService = inject(TranslateService)
-
- public readonly indicator$ = this._route.paramMap.pipe(
- startWith(this._route.snapshot.paramMap),
- map((paramMap) => paramMap.get('id')),
- filter(negate(isNil)),
- distinctUntilChanged(),
- switchMap((id) => this.indicatorsService.getById(id, ['model', 'businessArea', 'createdBy', 'certification'])),
- map((indicator) => ({
- ...indicator,
- validity: formatRelative(new Date(indicator.validity), new Date(), { locale: getDateLocale(this.translateService.currentLang) }),
- } as any))
- )
+ private indicatorsService = inject(IndicatorsService)
+ private _route = inject(ActivatedRoute)
+ private _router = inject(Router)
- constructor(
- private indicatorsService: IndicatorsService,
- private _route: ActivatedRoute,
- private _router: Router
- ) {}
-
- ngOnInit() {}
+ public readonly indicator = toSignal(
+ this._route.paramMap.pipe(
+ startWith(this._route.snapshot.paramMap),
+ map((paramMap) => paramMap.get('id')),
+ filter(negate(isNil)),
+ distinctUntilChanged(),
+ switchMap((id) => this.indicatorsService.getById(id, ['model', 'businessArea', 'createdBy', 'certification'])),
+ map(
+ (indicator) =>
+ ({
+ ...indicator,
+ validity: formatRelative(new Date(indicator.validity), new Date(), {
+ locale: getDateLocale(this.translateService.currentLang)
+ })
+ } as any)
+ )
+ )
+ )
edit(id: string) {
this._router.navigate(['../../edit/', id], { relativeTo: this._route })
diff --git a/apps/cloud/src/app/features/project/indicators/my/my.component.html b/apps/cloud/src/app/features/project/indicators/all/all.component.html
similarity index 96%
rename from apps/cloud/src/app/features/project/indicators/my/my.component.html
rename to apps/cloud/src/app/features/project/indicators/all/all.component.html
index 223ddc85e..363a1eca1 100644
--- a/apps/cloud/src/app/features/project/indicators/my/my.component.html
+++ b/apps/cloud/src/app/features/project/indicators/all/all.component.html
@@ -1,4 +1,5 @@
+ [routerLink]="['/project/indicators/', id]">
edit
diff --git a/apps/cloud/src/app/features/project/indicators/all/all.component.scss b/apps/cloud/src/app/features/project/indicators/all/all.component.scss
new file mode 100644
index 000000000..b38f13e75
--- /dev/null
+++ b/apps/cloud/src/app/features/project/indicators/all/all.component.scss
@@ -0,0 +1,3 @@
+:host {
+ @apply w-full overflow-hidden flex-1 max-w-full flex flex-col p-4;
+}
\ No newline at end of file
diff --git a/apps/cloud/src/app/features/project/indicators/my/my.component.ts b/apps/cloud/src/app/features/project/indicators/all/all.component.ts
similarity index 93%
rename from apps/cloud/src/app/features/project/indicators/my/my.component.ts
rename to apps/cloud/src/app/features/project/indicators/all/all.component.ts
index 17872e041..ffd0f9441 100644
--- a/apps/cloud/src/app/features/project/indicators/my/my.component.ts
+++ b/apps/cloud/src/app/features/project/indicators/all/all.component.ts
@@ -27,11 +27,11 @@ import { ProjectIndicatorsComponent } from '../indicators.component'
AppearanceDirective,
NxTableModule
],
- selector: 'pac-indicator-my',
- templateUrl: './my.component.html',
- styleUrls: ['./my.component.scss']
+ selector: 'pac-indicator-all',
+ templateUrl: './all.component.html',
+ styleUrls: ['./all.component.scss']
})
-export class MyIndicatorComponent implements OnDestroy {
+export class AllIndicatorComponent implements OnDestroy {
private projectComponent = inject(ProjectComponent)
private indicatorsComponent = inject(ProjectIndicatorsComponent)
diff --git a/apps/cloud/src/app/features/project/indicators/approvals/approvals.component.scss b/apps/cloud/src/app/features/project/indicators/approvals/approvals.component.scss
index 7dc610e40..809713427 100644
--- a/apps/cloud/src/app/features/project/indicators/approvals/approvals.component.scss
+++ b/apps/cloud/src/app/features/project/indicators/approvals/approvals.component.scss
@@ -1,3 +1,3 @@
:host {
- @apply flex-1 max-w-full overflow-hidden flex flex-col;
+ @apply flex-1 w-full max-w-full overflow-hidden flex flex-col p-4;
}
diff --git a/apps/cloud/src/app/features/project/indicators/indicators.component.html b/apps/cloud/src/app/features/project/indicators/indicators.component.html
index 324232101..283bd7739 100644
--- a/apps/cloud/src/app/features/project/indicators/indicators.component.html
+++ b/apps/cloud/src/app/features/project/indicators/indicators.component.html
@@ -1,6 +1,6 @@
-
-
-
+
diff --git a/apps/cloud/src/app/features/project/indicators/register/register.component.scss b/apps/cloud/src/app/features/project/indicators/register/register.component.scss
index b761d93a6..0845bc75f 100644
--- a/apps/cloud/src/app/features/project/indicators/register/register.component.scss
+++ b/apps/cloud/src/app/features/project/indicators/register/register.component.scss
@@ -1,5 +1,5 @@
:host {
- @apply overflow-auto flex-1 max-w-full flex flex-col;
+ @apply overflow-auto flex-1 w-full max-w-full flex flex-col;
}
.pac-indicator-register__form.pac-page__body {
diff --git a/apps/cloud/src/app/features/project/indicators/register/register.component.ts b/apps/cloud/src/app/features/project/indicators/register/register.component.ts
index 973f9d12d..1fce299b8 100644
--- a/apps/cloud/src/app/features/project/indicators/register/register.component.ts
+++ b/apps/cloud/src/app/features/project/indicators/register/register.component.ts
@@ -1,5 +1,5 @@
import { CommonModule } from '@angular/common'
-import { ChangeDetectorRef, Component, HostListener, inject, Optional, ViewChild } from '@angular/core'
+import { ChangeDetectorRef, Component, HostListener, inject, OnDestroy, Optional, ViewChild } from '@angular/core'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { MatDialog } from '@angular/material/dialog'
import { ActivatedRoute, Router, RouterModule } from '@angular/router'
@@ -20,6 +20,7 @@ import { MaterialModule, userLabel } from '../../../../@shared'
import { ProjectComponent } from '../../project.component'
import { exportIndicator } from '../../types'
import { IndicatorRegisterFormComponent } from '../register-form/register-form.component'
+import { ProjectIndicatorsComponent } from '../indicators.component'
// AOA : array of array
type AOA = any[][]
@@ -47,8 +48,9 @@ type AOA = any[][]
styleUrls: ['./register.component.scss'],
providers: []
})
-export class IndicatorRegisterComponent extends TranslationBaseComponent {
+export class IndicatorRegisterComponent extends TranslationBaseComponent implements OnDestroy {
private projectComponent = inject(ProjectComponent)
+ private indicatorsComponent? = inject(ProjectIndicatorsComponent, {optional: true})
@ViewChild('register_form') registerForm: IndicatorRegisterFormComponent
@@ -71,6 +73,11 @@ export class IndicatorRegisterComponent extends TranslationBaseComponent {
public readonly indicator$ = this._route.paramMap.pipe(
startWith(this._route.snapshot.paramMap),
map((paramMap) => paramMap.get('id')),
+ tap((id) => {
+ if (id === 'new') {
+ this.indicatorsComponent?.setCurrentLink({id: 'new'} as Indicator)
+ }
+ }),
filter((id) => !isNil(id) && id !== 'new'),
distinctUntilChanged(),
switchMap((id) => {
@@ -128,6 +135,7 @@ export class IndicatorRegisterComponent extends TranslationBaseComponent {
delay(300)
).subscribe((indicator) => {
this.registerForm.formGroup.markAsPristine()
+ this.indicatorsComponent?.setCurrentLink(indicator)
})
constructor(
private indicatorsService: IndicatorsService,
@@ -157,10 +165,11 @@ export class IndicatorRegisterComponent extends TranslationBaseComponent {
indicator = await firstValueFrom(this.indicatorsService.create(indicator))
this.loading = false
- if (indicator.id) {
+ if (this.indicator.id) {
this.toastrService.success('PAC.INDICATOR.REGISTER.SaveIndicator', { Default: 'Save Indicator' })
} else {
this.toastrService.success('PAC.INDICATOR.REGISTER.CreateIndicator', { Default: 'Create Indicator' })
+ this.indicatorsComponent?.replaceNewIndicator(indicator)
}
await this.projectComponent.refreshIndicators()
@@ -234,4 +243,8 @@ export class IndicatorRegisterComponent extends TranslationBaseComponent {
this.onSubmit()
}
}
+
+ ngOnDestroy(): void {
+ this.indicatorsComponent?.setCurrentLink(null)
+ }
}
diff --git a/apps/cloud/src/app/features/project/members/members.component.html b/apps/cloud/src/app/features/project/members/members.component.html
index 5ba9a02d3..1f577a479 100644
--- a/apps/cloud/src/app/features/project/members/members.component.html
+++ b/apps/cloud/src/app/features/project/members/members.component.html
@@ -7,7 +7,7 @@
[user]="project?.owner">
-
+
local_shipping
{{ 'PAC.Project.TransferOwnership' | translate: { Default: 'Transfer Ownership' } }}
diff --git a/apps/cloud/src/app/features/project/project-routing.module.ts b/apps/cloud/src/app/features/project/project-routing.module.ts
index fab81196a..729ab0c12 100644
--- a/apps/cloud/src/app/features/project/project-routing.module.ts
+++ b/apps/cloud/src/app/features/project/project-routing.module.ts
@@ -5,7 +5,7 @@ import { StoryViewerComponent } from '../story/viewer/viewer.component'
import { ProjectHomeComponent } from './home/home.component'
import { ApprovalsComponent } from './indicators/approvals/approvals.component'
import { ProjectIndicatorsComponent } from './indicators/indicators.component'
-import { MyIndicatorComponent } from './indicators/my/my.component'
+import { AllIndicatorComponent } from './indicators/all/all.component'
import { IndicatorRegisterComponent } from './indicators/register/register.component'
import { ProjectMembersComponent } from './members/members.component'
import { ProjectComponent } from './project.component'
@@ -32,12 +32,17 @@ const routes: Routes = [
children: [
{
path: '',
- component: MyIndicatorComponent
+ component: AllIndicatorComponent
},
{
path: 'approvals',
component: ApprovalsComponent
},
+ {
+ path: ':id',
+ component: IndicatorRegisterComponent,
+ canDeactivate: [DirtyCheckGuard],
+ },
]
},
{
diff --git a/apps/cloud/src/app/features/project/project.component.html b/apps/cloud/src/app/features/project/project.component.html
index aba4bbdc7..873703fb1 100644
--- a/apps/cloud/src/app/features/project/project.component.html
+++ b/apps/cloud/src/app/features/project/project.component.html
@@ -13,7 +13,7 @@
-
+
{{ 'PAC.Project.Bookmarks' | translate: {Default: 'Bookmarks'} }}
@@ -48,7 +48,7 @@
-
+
{{ 'PAC.Project.Collections' | translate: {Default: 'Collections'} }}
-
+
{{ 'PAC.Project.SemanticModels' | translate: {Default: 'Semantic Models'} }}
diff --git a/apps/cloud/src/app/features/project/release-story.component.ts b/apps/cloud/src/app/features/project/release-story.component.ts
index dcfcc834a..da841f49f 100644
--- a/apps/cloud/src/app/features/project/release-story.component.ts
+++ b/apps/cloud/src/app/features/project/release-story.component.ts
@@ -1,7 +1,7 @@
import { DIALOG_DATA } from '@angular/cdk/dialog'
import { DragDropModule } from '@angular/cdk/drag-drop'
import { CommonModule } from '@angular/common'
-import { Component, Inject } from '@angular/core'
+import { Component, Inject, computed, inject } from '@angular/core'
import { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'
import { MatDialogRef } from '@angular/material/dialog'
import { NgmCommonModule, NgmTreeSelectComponent } from '@metad/ocap-angular/common'
@@ -9,9 +9,11 @@ import { ButtonGroupDirective, DensityDirective } from '@metad/ocap-angular/core
import { pick } from '@metad/ocap-core'
import { TranslateModule } from '@ngx-translate/core'
import { BusinessAreasService, StoriesService } from '@metad/cloud/state'
-import { firstValueFrom, startWith } from 'rxjs'
+import { BehaviorSubject, filter, firstValueFrom, map, startWith, switchMap } from 'rxjs'
import { IStory, StoryStatusEnum, ToastrService, Visibility } from '../../@core'
import { MaterialModule } from '../../@shared'
+import { toSignal } from '@angular/core/rxjs-interop'
+import { nonNullable } from '@metad/core'
@Component({
standalone: true,
@@ -47,7 +49,17 @@ import { MaterialModule } from '../../@shared'
-
+
+ {{ 'PAC.Project.AllModelsMustBePublic' | translate: { Default: 'All models must be public' } }}
+
+
+
+
+
+
{{ 'PAC.Project.Release' | translate: { Default: 'Release' } }}
@@ -90,6 +102,8 @@ import { MaterialModule } from '../../@shared'
styles: [``]
})
export class ReleaseStoryDialog {
+ private readonly storiesService = inject(StoriesService)
+
form = new FormGroup({
type: new FormControl(null),
name: new FormControl(null, [Validators.required]),
@@ -97,26 +111,40 @@ export class ReleaseStoryDialog {
businessAreaId: new FormControl(null),
})
- get type() {
- return this.form.get('type').value
- }
+ public readonly type = toSignal(this.form.get('type').valueChanges)
public readonly businessArea$ = this.businessAreaService.getMyAreasTree(true).pipe(startWith([]))
+
+ story$ = new BehaviorSubject(null)
+ public readonly semanticModels = toSignal(this.story$.pipe(
+ filter(nonNullable),
+ switchMap(story => this.storiesService.getOne(story.id, ['models'])),
+ map((story) => story.models)
+ ))
+
+ public readonly noPublicModels = computed(() => {
+ return this.semanticModels()?.filter(model => model.visibility !== Visibility.Public)
+ })
+
+ public readonly notAllPublic = computed(() => {
+ return this.type() === 2 && this.noPublicModels()?.length > 0
+ })
+
constructor(
@Inject(DIALOG_DATA) public data: {
story: IStory
},
private _dialogRef: MatDialogRef,
private businessAreaService: BusinessAreasService,
- private storiesService: StoriesService,
private _toastrService: ToastrService
) {
+ this.story$.next(this.data.story)
this.form.patchValue(pick(this.data.story, 'name', 'description', 'businessAreaId'))
}
async release() {
if (this.form.valid) {
- await firstValueFrom(this.storiesService.update(this.data.story.id, this.type === 1 ? {
+ await firstValueFrom(this.storiesService.update(this.data.story.id, this.type() === 1 ? {
name: this.form.value.name,
description: this.form.value.description,
businessAreaId: this.form.value.businessAreaId,
diff --git a/apps/cloud/src/app/features/semantic-model/model/members/members.component.html b/apps/cloud/src/app/features/semantic-model/model/members/members.component.html
index a420744fa..c893ed7c6 100644
--- a/apps/cloud/src/app/features/semantic-model/model/members/members.component.html
+++ b/apps/cloud/src/app/features/semantic-model/model/members/members.component.html
@@ -8,7 +8,7 @@
[user]="semanticModel?.owner">
-
+
local_shipping
{{ 'PAC.MODEL.TransferOwnership' | translate: { Default: 'Transfer Ownership' } }}
diff --git a/apps/cloud/src/app/features/setting/_settings-theme.scss b/apps/cloud/src/app/features/setting/_settings-theme.scss
index 051707426..757e4b974 100644
--- a/apps/cloud/src/app/features/setting/_settings-theme.scss
+++ b/apps/cloud/src/app/features/setting/_settings-theme.scss
@@ -71,21 +71,21 @@
@apply bg-slate-50 border-slate-200 rounded-lg dark:bg-bluegray-600 dark:border-bluegray-500;
}
.pac-nav__tab-bar.active {
- @apply bg-slate-100 border-slate-200 rounded-lg dark:bg-bluegray-700 dark:border-bluegray-500;
+ @apply bg-slate-50 border-slate-200 rounded-lg dark:bg-bluegray-700 dark:border-bluegray-500;
}
}
/**
* 横向 nav bar
*/
- .pac-tab-nav-bar {
- @apply flex flex-wrap -mb-px text-base font-medium text-center justify-center border-b-bluegray-100 border-b-[1px] dark:border-b-bluegray-600;
- .pac-tab-link {
- &.active {
- & > button {
- @apply border-b-bluegray-500;
- }
- }
- }
- }
+ // .pac-tab-nav-bar {
+ // @apply flex flex-wrap -mb-px text-base font-medium text-center justify-center border-b-bluegray-100 border-b-[1px] dark:border-b-bluegray-600;
+ // .pac-tab-link {
+ // &.active {
+ // & > button {
+ // @apply border-b-bluegray-500;
+ // }
+ // }
+ // }
+ // }
}
diff --git a/apps/cloud/src/app/features/setting/account/account.component.html b/apps/cloud/src/app/features/setting/account/account.component.html
index 8b4ed8c8d..9b6839d93 100644
--- a/apps/cloud/src/app/features/setting/account/account.component.html
+++ b/apps/cloud/src/app/features/setting/account/account.component.html
@@ -1,28 +1,31 @@
-
+
+
+
+
+
diff --git a/apps/cloud/src/app/features/setting/account/account.component.scss b/apps/cloud/src/app/features/setting/account/account.component.scss
index ef3ec0dee..e12c20894 100644
--- a/apps/cloud/src/app/features/setting/account/account.component.scss
+++ b/apps/cloud/src/app/features/setting/account/account.component.scss
@@ -1,3 +1,3 @@
:host {
- @apply flex flex-col flex-1 max-w-full items-center gap-4;
+ @apply flex flex-col flex-1 max-w-full items-stretch;
}
diff --git a/apps/cloud/src/app/features/setting/account/account.component.ts b/apps/cloud/src/app/features/setting/account/account.component.ts
index 982f329ac..d5851d34a 100644
--- a/apps/cloud/src/app/features/setting/account/account.component.ts
+++ b/apps/cloud/src/app/features/setting/account/account.component.ts
@@ -1,27 +1,30 @@
import { CommonModule } from '@angular/common'
-import { Component } from '@angular/core'
+import { Component, inject } from '@angular/core'
+import { toSignal } from '@angular/core/rxjs-interop'
+import { MatDividerModule } from '@angular/material/divider'
import { MatTabsModule } from '@angular/material/tabs'
import { RouterModule } from '@angular/router'
-import { UntilDestroy } from '@ngneat/until-destroy'
import { TranslateModule } from '@ngx-translate/core'
-import { IUser, Store } from '../../../@core'
+import { Store } from '../../../@core'
import { UserAvatarEditorComponent, UserPipe } from '../../../@shared'
-@UntilDestroy({ checkProperties: true })
@Component({
- standalone: true,
- selector: 'pac-account',
- templateUrl: './account.component.html',
- styleUrls: ['./account.component.scss'],
- imports: [CommonModule, MatTabsModule, TranslateModule, RouterModule, UserPipe, UserAvatarEditorComponent]
+ standalone: true,
+ selector: 'pac-account',
+ templateUrl: './account.component.html',
+ styleUrls: ['./account.component.scss'],
+ imports: [
+ CommonModule,
+ MatTabsModule,
+ MatDividerModule,
+ TranslateModule,
+ RouterModule,
+ UserPipe,
+ UserAvatarEditorComponent
+ ]
})
export class PACAccountComponent {
- user: IUser
+ private readonly store = inject(Store)
- private _userSub = this.store.user$.subscribe((user) => {
- this.user = user
- })
- constructor(
- private readonly store: Store,
- ) {}
+ public readonly user = toSignal(this.store.user$)
}
diff --git a/apps/cloud/src/app/features/setting/business-area/area-info-form/area-info-form.component.html b/apps/cloud/src/app/features/setting/business-area/area-info-form/area-info-form.component.html
new file mode 100644
index 000000000..2a8dc3959
--- /dev/null
+++ b/apps/cloud/src/app/features/setting/business-area/area-info-form/area-info-form.component.html
@@ -0,0 +1,11 @@
+
+
+
+
+ {{ 'PAC.ACTIONS.SAVE' | translate: { Default: 'Save' } }}
+
+
\ No newline at end of file
diff --git a/apps/cloud/src/app/features/setting/business-area/area-info-form/area-info-form.component.ts b/apps/cloud/src/app/features/setting/business-area/area-info-form/area-info-form.component.ts
index 72590edf5..79b9261e6 100644
--- a/apps/cloud/src/app/features/setting/business-area/area-info-form/area-info-form.component.ts
+++ b/apps/cloud/src/app/features/setting/business-area/area-info-form/area-info-form.component.ts
@@ -1,67 +1,48 @@
-import { Component, inject } from '@angular/core'
-import { toSignal } from '@angular/core/rxjs-interop'
-import { FormGroup } from '@angular/forms'
-import { pick } from '@metad/ocap-core'
-import { UntilDestroy } from '@ngneat/until-destroy'
+import { Component, effect, inject } from '@angular/core'
+import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'
import { BusinessAreasService, ToastrService } from '@metad/cloud/state'
-import { FORMLY_W_1_2 } from '@metad/formly'
-import { TranslationBaseComponent } from 'apps/cloud/src/app/@shared'
-import { firstValueFrom, map } from 'rxjs'
-import { BusinessAreaComponent } from '../business-area/business-area.component'
-import { BusinessAreasComponent } from '../business-areas/areas.component'
+import { NgmCommonModule } from '@metad/ocap-angular/common'
+import { pick } from '@metad/ocap-core'
+import { TranslateModule } from '@ngx-translate/core'
+import { MaterialModule, TranslationBaseComponent } from 'apps/cloud/src/app/@shared'
+import { firstValueFrom } from 'rxjs'
+import { EditBusinessAreaComponent } from '../business-area/business-area.component'
-@UntilDestroy({ checkProperties: true })
@Component({
+ standalone: true,
selector: 'pac-area-info-form',
- template: `
-
-
- {{ 'PAC.ACTIONS.SAVE' | translate: { Default: 'Save' } }}
-
- `
+ templateUrl: './area-info-form.component.html',
+ imports: [MaterialModule, TranslateModule, ReactiveFormsModule, NgmCommonModule]
})
export class BusinessAreaInfoFormComponent extends TranslationBaseComponent {
private readonly businessAreasService = inject(BusinessAreasService)
- private readonly businessAreaComponent = inject(BusinessAreaComponent)
- private readonly businessAreasComponent = inject(BusinessAreasComponent)
+ private readonly businessAreaComponent = inject(EditBusinessAreaComponent)
private readonly _toastrService = inject(ToastrService)
//Fields for the form
- public form = new FormGroup({})
- model = {} as any
-
- fields = toSignal(
- this.translateService.stream('PAC.BUSINESS_AREA.BASIC_INFO_FORM', { Default: {} }).pipe(
- map((TRANSLATE) => {
- return [
- {
- className: FORMLY_W_1_2,
- key: 'name',
- type: 'input',
- props: {
- label: TRANSLATE?.Name ?? 'Name',
- placeholder: ''
- }
- }
- ]
- })
- )
- )
-
- private _businessAreaSub = this.businessAreaComponent.businessArea$.subscribe((value) => {
- this.form.patchValue(value)
- this.model = value
+ public form = new FormGroup({
+ id: new FormControl(null),
+ name: new FormControl(null)
})
+ get model() {
+ return this.form.value
+ }
+
+ constructor() {
+ super()
- onFormChange(model) {
- //
+ effect(() => {
+ this.form.patchValue(this.businessAreaComponent.businessArea())
+ this.form.markAsPristine()
+ }, {allowSignalWrites: true})
}
async save() {
try {
await firstValueFrom(this.businessAreasService.update(this.model.id, pick(this.model, 'name')))
- this.businessAreasComponent.refresh()
+ this.businessAreaComponent.refresh()
this._toastrService.success('PAC.BUSINESS_AREA.Update', { Default: 'Update' })
+ this.form.markAsPristine()
} catch (err) {
this._toastrService.error('PAC.BUSINESS_AREA.Update', '', { Default: 'Update' })
}
diff --git a/apps/cloud/src/app/features/setting/business-area/area-users/area-users.component.html b/apps/cloud/src/app/features/setting/business-area/area-users/area-users.component.html
index 669eaabe2..70a7169db 100644
--- a/apps/cloud/src/app/features/setting/business-area/area-users/area-users.component.html
+++ b/apps/cloud/src/app/features/setting/business-area/area-users/area-users.component.html
@@ -1,6 +1,6 @@
-
+
({ ...user, role: value.role }))
diff --git a/apps/cloud/src/app/features/setting/business-area/business-area-routing.module.ts b/apps/cloud/src/app/features/setting/business-area/business-area-routing.module.ts
index 2b8bc0854..abf5e0281 100644
--- a/apps/cloud/src/app/features/setting/business-area/business-area-routing.module.ts
+++ b/apps/cloud/src/app/features/setting/business-area/business-area-routing.module.ts
@@ -3,33 +3,39 @@ import { NgModule } from '@angular/core'
import { RouterModule, Routes } from '@angular/router'
import { BusinessAreaInfoFormComponent } from './area-info-form/area-info-form.component'
import { BusinessAreaUsersComponent } from './area-users/area-users.component'
-import { BusinessAreaComponent } from './business-area/business-area.component'
+import { BusinessAreaComponent } from './business-area.component'
+import { EditBusinessAreaComponent } from './business-area/business-area.component'
import { BusinessAreasComponent } from './business-areas/areas.component'
const routes: Routes = [
{
path: '',
- component: BusinessAreasComponent,
+ component: BusinessAreaComponent,
data: {
title: 'Settings / BusinessArea'
},
children: [
+
{
path: ':id',
- component: BusinessAreaComponent,
- children: [
- {
- path: '',
- component: BusinessAreaInfoFormComponent
- },
- {
- path: 'users',
- component: BusinessAreaUsersComponent
- }
- ]
+ component: EditBusinessAreaComponent,
+ // children: [
+ // {
+ // path: '',
+ // component: BusinessAreaInfoFormComponent
+ // },
+ // {
+ // path: 'users',
+ // component: BusinessAreaUsersComponent
+ // }
+ // ]
+ },
+ {
+ path: '',
+ component: BusinessAreasComponent
},
]
- },
+ }
]
@NgModule({
diff --git a/apps/cloud/src/app/features/setting/business-area/business-area.component.html b/apps/cloud/src/app/features/setting/business-area/business-area.component.html
new file mode 100644
index 000000000..847930070
--- /dev/null
+++ b/apps/cloud/src/app/features/setting/business-area/business-area.component.html
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+ {{ 'PAC.ACTIONS.CREATE' | translate: {Default: "Create"} }} {{ 'PAC.KEY_WORDS.BUSINESS_AREA' | translate: {Default: "Business Area"} }}
+
+
+
+
+
+
+
+
+
+
+ {{ 'COMPONENTS.COMMON.CANCEL' | translate: {Default: 'Cancel'} }}
+
+
+ {{ 'COMPONENTS.COMMON.APPLY' | translate: {Default: 'Apply'} }}
+
+
+
+
\ No newline at end of file
diff --git a/apps/cloud/src/app/features/setting/business-area/business-area.component.scss b/apps/cloud/src/app/features/setting/business-area/business-area.component.scss
new file mode 100644
index 000000000..294754f5d
--- /dev/null
+++ b/apps/cloud/src/app/features/setting/business-area/business-area.component.scss
@@ -0,0 +1,3 @@
+:host {
+ @apply flex-1 flex flex-col justify-start items-stretch overflow-hidden;
+}
diff --git a/apps/cloud/src/app/features/setting/business-area/business-area.component.ts b/apps/cloud/src/app/features/setting/business-area/business-area.component.ts
new file mode 100644
index 000000000..0d5f19a09
--- /dev/null
+++ b/apps/cloud/src/app/features/setting/business-area/business-area.component.ts
@@ -0,0 +1,96 @@
+import { CommonModule } from '@angular/common'
+import { Component, ElementRef, TemplateRef, ViewChild, effect, inject, signal } from '@angular/core'
+import { FormsModule, ReactiveFormsModule } from '@angular/forms'
+import { MatDialog } from '@angular/material/dialog'
+import { ActivatedRoute, Router } from '@angular/router'
+import { BusinessAreasService } from '@metad/cloud/state'
+import { NgmCommonModule } from '@metad/ocap-angular/common'
+import { TranslateModule } from '@ngx-translate/core'
+import { firstValueFrom } from 'rxjs'
+import { IBusinessArea, routeAnimations } from '../../../@core'
+import { MaterialModule, SharedModule } from '../../../@shared'
+
+@Component({
+ standalone: true,
+ selector: 'pac-business-area',
+ templateUrl: './business-area.component.html',
+ styleUrls: ['./business-area.component.scss'],
+ animations: [routeAnimations],
+ imports: [
+ SharedModule,
+ CommonModule,
+ FormsModule,
+ ReactiveFormsModule,
+ TranslateModule,
+ MaterialModule,
+ NgmCommonModule
+ ]
+})
+export class BusinessAreaComponent {
+ private router = inject(Router)
+ private _route = inject(ActivatedRoute)
+ private _dialog = inject(MatDialog)
+ private businessAreasStore = inject(BusinessAreasService)
+
+ @ViewChild('createTempl') private createTempl: TemplateRef
+
+ openedBusinessAreas = signal([])
+ currentBusinessArea = signal(null)
+ parentId = ''
+ name = ''
+ constructor() {
+ effect(
+ () => {
+ if (this.currentBusinessArea()) {
+ const businessAreas = this.openedBusinessAreas()
+ const index = businessAreas.findIndex((item) => item.id === this.currentBusinessArea().id)
+ if (index > -1) {
+ if (businessAreas[index] !== this.currentBusinessArea()) {
+ this.openedBusinessAreas.set([
+ ...businessAreas.slice(0, index),
+ this.currentBusinessArea(),
+ ...businessAreas.slice(index + 1)
+ ])
+ }
+ } else {
+ this.openedBusinessAreas.set([...businessAreas, this.currentBusinessArea()])
+ }
+ }
+ },
+ { allowSignalWrites: true }
+ )
+ }
+
+ trackById(index: number, item: IBusinessArea) {
+ return item?.id
+ }
+
+ async addGroup(parent?: IBusinessArea) {
+ this.parentId = parent?.id
+ this.name = null
+ const name = await firstValueFrom(
+ this._dialog.open(this.createTempl, { panelClass: 'nx-dialog-container' }).afterClosed()
+ )
+
+ if (name) {
+ return await firstValueFrom(
+ this.businessAreasStore.create({
+ name,
+ parentId: this.parentId
+ })
+ )
+ }
+
+ return null
+ }
+
+ setCurrentBusinessArea(businessArea: IBusinessArea) {
+ this.currentBusinessArea.set(businessArea)
+ }
+
+ removeOpenedArea(businessArea: IBusinessArea) {
+ this.currentBusinessArea.set(null)
+ this.openedBusinessAreas.set(this.openedBusinessAreas().filter((item) => item.id !== businessArea.id))
+ this.router.navigate(['.'], { relativeTo: this._route })
+ }
+}
diff --git a/apps/cloud/src/app/features/setting/business-area/business-area.module.ts b/apps/cloud/src/app/features/setting/business-area/business-area.module.ts
index 425283363..68cf9f9c2 100644
--- a/apps/cloud/src/app/features/setting/business-area/business-area.module.ts
+++ b/apps/cloud/src/app/features/setting/business-area/business-area.module.ts
@@ -1,46 +1,11 @@
-import { A11yModule } from '@angular/cdk/a11y'
import { CommonModule } from '@angular/common'
import { NgModule } from '@angular/core'
-import { FormsModule, ReactiveFormsModule } from '@angular/forms'
-import { TreeTableModule } from '@metad/ocap-angular/common'
-import { OcapCoreModule } from '@metad/ocap-angular/core'
-import { FormlyModule } from '@ngx-formly/core'
-import { TranslateModule } from '@ngx-translate/core'
-import { NxTableModule } from '@metad/components/table'
-import { SharedModule, UserProfileInlineComponent } from '../../../@shared'
-import { InlineSearchComponent } from '../../../@shared/form-fields'
-import { BusinessAreaInfoFormComponent } from './area-info-form/area-info-form.component'
-import { BusinessAreaUsersComponent } from './area-users/area-users.component'
import { BusinessAreasRoutingModule } from './business-area-routing.module'
-import { BusinessAreaComponent } from './business-area/business-area.component'
-import { BusinessAreasComponent } from './business-areas/areas.component'
@NgModule({
- imports: [
- A11yModule,
- SharedModule,
- CommonModule,
- FormsModule,
- ReactiveFormsModule,
- BusinessAreasRoutingModule,
- TranslateModule,
- FormlyModule,
-
- InlineSearchComponent,
- NxTableModule,
- UserProfileInlineComponent,
-
- // OCAP Modules
- OcapCoreModule,
- TreeTableModule
- ],
- exports: [BusinessAreasComponent, BusinessAreaComponent, BusinessAreaUsersComponent],
- declarations: [
- BusinessAreasComponent,
- BusinessAreaComponent,
- BusinessAreaUsersComponent,
- BusinessAreaInfoFormComponent
- ],
+ imports: [CommonModule, BusinessAreasRoutingModule],
+ exports: [],
+ declarations: [],
providers: []
})
export class BusinessAreaModule {}
diff --git a/apps/cloud/src/app/features/setting/business-area/business-area/business-area.component.html b/apps/cloud/src/app/features/setting/business-area/business-area/business-area.component.html
index c3be52588..0ac34677c 100644
--- a/apps/cloud/src/app/features/setting/business-area/business-area/business-area.component.html
+++ b/apps/cloud/src/app/features/setting/business-area/business-area/business-area.component.html
@@ -1,32 +1,32 @@
{{ 'PAC.MENU.EDIT_BUSINESS_AREA' | translate: {Default: "Edit Business Area"} }}
- {{ name$ | async }}
+ {{ name() }}
-
-
- settings
- {{ 'PAC.BUSINESS_AREA.BASIC' | translate: {Default: "Basic Info"} }}
-
+
+
+
+ settings
+ {{ 'PAC.BUSINESS_AREA.BASIC' | translate: {Default: "Basic Info"} }}
+
+
+
+
+
+
+
-
-
+
+
+
group_add
- {{ 'PAC.MENU.USERS' | translate: {Default: "Users"} }}
+ {{ 'PAC.MENU.USERS' | translate: {Default: "Users"} }}
-
-
+
-
-
-
+
+
+
+
diff --git a/apps/cloud/src/app/features/setting/business-area/business-area/business-area.component.scss b/apps/cloud/src/app/features/setting/business-area/business-area/business-area.component.scss
index c3e49e68a..53d90966f 100644
--- a/apps/cloud/src/app/features/setting/business-area/business-area/business-area.component.scss
+++ b/apps/cloud/src/app/features/setting/business-area/business-area/business-area.component.scss
@@ -1,5 +1,3 @@
:host {
- flex: 1;
- max-width: 100%;
- padding: 1rem;
+ @apply flex-1 w-full max-w-full p-4 flex flex-col gap-4;
}
diff --git a/apps/cloud/src/app/features/setting/business-area/business-area/business-area.component.ts b/apps/cloud/src/app/features/setting/business-area/business-area/business-area.component.ts
index 7484c7eb9..b5f88986e 100644
--- a/apps/cloud/src/app/features/setting/business-area/business-area/business-area.component.ts
+++ b/apps/cloud/src/app/features/setting/business-area/business-area/business-area.component.ts
@@ -1,18 +1,29 @@
-import { Component, OnInit } from '@angular/core'
+import { Component, OnDestroy, computed, effect, inject } from '@angular/core'
+import { toSignal } from '@angular/core/rxjs-interop'
import { ActivatedRoute, Router } from '@angular/router'
-import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'
import { BusinessAreasService, BusinessType } from '@metad/cloud/state'
-import { distinctUntilChanged, filter, map, shareReplay, startWith, switchMap } from 'rxjs'
+import { TranslateModule } from '@ngx-translate/core'
+import { MaterialModule } from 'apps/cloud/src/app/@shared'
+import { BehaviorSubject, distinctUntilChanged, filter, map, startWith, switchMap } from 'rxjs'
+import { BusinessAreaInfoFormComponent } from '../area-info-form/area-info-form.component'
+import { BusinessAreaUsersComponent } from '../area-users/area-users.component'
+import { BusinessAreaComponent } from '../business-area.component'
-@UntilDestroy()
@Component({
- selector: 'pac-business-area',
+ standalone: true,
+ selector: 'pac-edit-business-area',
templateUrl: './business-area.component.html',
- styleUrls: ['./business-area.component.scss']
+ styleUrls: ['./business-area.component.scss'],
+ imports: [MaterialModule, TranslateModule, BusinessAreaInfoFormComponent, BusinessAreaUsersComponent]
})
-export class BusinessAreaComponent implements OnInit {
+export class EditBusinessAreaComponent implements OnDestroy {
BUSINESS_AREA_TYPE = BusinessType
+ private route = inject(ActivatedRoute)
+ private router = inject(Router)
+ private businessAreasService = inject(BusinessAreasService)
+ private businessAreaComponent = inject(BusinessAreaComponent)
+
public readonly businessAreaId$ = this.route.params.pipe(
startWith(this.route.snapshot.params),
map((params) => params?.id),
@@ -20,18 +31,32 @@ export class BusinessAreaComponent implements OnInit {
distinctUntilChanged()
)
- public readonly businessArea$ = this.businessAreaId$.pipe(
- switchMap((id) => this.businessAreasService.getById(id)),
- untilDestroyed(this),
- shareReplay(1)
+ private readonly refresh$ = new BehaviorSubject
(null)
+
+ public readonly businessArea = toSignal(
+ this.businessAreaId$.pipe(
+ switchMap((id) => this.refresh$.pipe(switchMap(() => this.businessAreasService.getById(id))))
+ )
)
- public readonly name$ = this.businessArea$.pipe(map((businessArea) => businessArea?.name))
- constructor(
- private route: ActivatedRoute,
- private router: Router,
- private businessAreasService: BusinessAreasService
- ) {}
+ public readonly name = computed(() => this.businessArea()?.name)
+
+ constructor() {
+ effect(
+ () => {
+ if (this.businessArea()) {
+ this.businessAreaComponent.setCurrentBusinessArea(this.businessArea())
+ }
+ },
+ { allowSignalWrites: true }
+ )
+ }
+
+ refresh() {
+ this.refresh$.next()
+ }
- ngOnInit(): void {}
+ ngOnDestroy(): void {
+ this.businessAreaComponent.setCurrentBusinessArea(null)
+ }
}
diff --git a/apps/cloud/src/app/features/setting/business-area/business-areas/areas.component.html b/apps/cloud/src/app/features/setting/business-area/business-areas/areas.component.html
index b424c6ffd..e07c71556 100644
--- a/apps/cloud/src/app/features/setting/business-area/business-areas/areas.component.html
+++ b/apps/cloud/src/app/features/setting/business-area/business-areas/areas.component.html
@@ -1,16 +1,5 @@
-
-
-
-
-
- add
- {{ 'PAC.ACTIONS.NEW' | translate: {Default: "New"} }} {{ 'PAC.KEY_WORDS.BUSINESS_AREA' | translate: {Default: "Business Area"} }}
-
-
-
-
-
-
+
-
-
-
-
-
-
-
- {{ 'PAC.ACTIONS.CREATE' | translate: {Default: "Create"} }} {{ 'PAC.KEY_WORDS.BUSINESS_AREA' | translate: {Default: "Business Area"} }}
-
-
-
-
-
- {{ 'PAC.KEY_WORDS.NAME' | translate: {Default: 'Name'} }}
-
-
-
-
-
-
- {{ 'COMPONENTS.COMMON.CANCEL' | translate: {Default: 'Cancel'} }}
-
-
- {{ 'COMPONENTS.COMMON.APPLY' | translate: {Default: 'Apply'} }}
-
-
-
-
diff --git a/apps/cloud/src/app/features/setting/business-area/business-areas/areas.component.scss b/apps/cloud/src/app/features/setting/business-area/business-areas/areas.component.scss
index 5bcdd7767..8626accca 100644
--- a/apps/cloud/src/app/features/setting/business-area/business-areas/areas.component.scss
+++ b/apps/cloud/src/app/features/setting/business-area/business-areas/areas.component.scss
@@ -1,11 +1,7 @@
:host {
- @apply w-full flex flex-col sm:flex-row;
+ @apply flex-1 w-full flex flex-col sm:flex-row p-4;
}
-.pac-page__body {
- flex: 1;
- padding-top: 0;
-}
.emoji-loader {
position: absolute;
}
diff --git a/apps/cloud/src/app/features/setting/business-area/business-areas/areas.component.ts b/apps/cloud/src/app/features/setting/business-area/business-areas/areas.component.ts
index 5c5e92147..5881dc479 100644
--- a/apps/cloud/src/app/features/setting/business-area/business-areas/areas.component.ts
+++ b/apps/cloud/src/app/features/setting/business-area/business-areas/areas.component.ts
@@ -1,69 +1,76 @@
-import { Component, ElementRef, OnInit, TemplateRef, ViewChild } from '@angular/core'
+import { CommonModule } from '@angular/common'
+import { Component, inject } from '@angular/core'
+import { takeUntilDestroyed } from '@angular/core/rxjs-interop'
+import { FormsModule, ReactiveFormsModule } from '@angular/forms'
import { MatDialog } from '@angular/material/dialog'
-import { DisplayDensity } from '@metad/ocap-angular/core'
-import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'
import { BusinessAreasService } from '@metad/cloud/state'
import { ConfirmDeleteComponent } from '@metad/components/confirm'
+import { TreeTableModule } from '@metad/ocap-angular/common'
+import { DisplayDensity, OcapCoreModule } from '@metad/ocap-angular/core'
+import { TranslateModule } from '@ngx-translate/core'
+import { InlineSearchComponent, MaterialModule, SharedModule } from 'apps/cloud/src/app/@shared'
import { BehaviorSubject, firstValueFrom } from 'rxjs'
import { shareReplay, switchMap, tap } from 'rxjs/operators'
-import { IBusinessArea, ToastrService } from '../../../../@core/index'
+import { IBusinessArea, ToastrService, routeAnimations } from '../../../../@core/index'
+import { BusinessAreaComponent } from '../business-area.component'
-@UntilDestroy()
@Component({
+ standalone: true,
selector: 'pac-business-areas',
templateUrl: './areas.component.html',
- styleUrls: ['./areas.component.scss']
+ styleUrls: ['./areas.component.scss'],
+ animations: [routeAnimations],
+ imports: [
+ MaterialModule,
+ SharedModule,
+ CommonModule,
+ FormsModule,
+ ReactiveFormsModule,
+ TranslateModule,
+
+ InlineSearchComponent,
+
+ // OCAP Modules
+ OcapCoreModule,
+ TreeTableModule
+ ]
})
-export class BusinessAreasComponent implements OnInit {
+export class BusinessAreasComponent {
DisplayDensity = DisplayDensity
+ private readonly businessAreaComponent = inject(BusinessAreaComponent)
+
loading = false
private refresh$ = new BehaviorSubject(null)
public readonly groupTree$ = this.refresh$.pipe(
tap(() => (this.loading = true)),
switchMap(() => this.businessAreasStore.getGroupsTree()),
tap(() => (this.loading = false)),
- untilDestroyed(this),
+ takeUntilDestroyed(),
shareReplay(1)
)
- @ViewChild('createTempl') private createTempl: TemplateRef
-
- parentId: string
- name: string
constructor(
private businessAreasStore: BusinessAreasService,
private readonly _toastrService: ToastrService,
private _dialog: MatDialog
) {}
- ngOnInit(): void {}
-
async addGroup(parent?: IBusinessArea) {
- this.parentId = parent?.id
- this.name = null
- const name = await firstValueFrom(
- this._dialog.open(this.createTempl, { panelClass: 'nx-dialog-container' }).afterClosed()
- )
-
- if (name) {
- await firstValueFrom(
- this.businessAreasStore.create({
- name,
- parentId: this.parentId
- })
- )
-
+ const area = await this.businessAreaComponent.addGroup(parent)
+ if (area) {
this.refresh$.next()
}
}
async deleteBusinessArea(item: IBusinessArea) {
- const cofirm = await firstValueFrom(this._dialog.open(ConfirmDeleteComponent, {data: {value: item.name}}).afterClosed())
+ const cofirm = await firstValueFrom(
+ this._dialog.open(ConfirmDeleteComponent, { data: { value: item.name } }).afterClosed()
+ )
if (!cofirm) {
return
}
-
+
try {
await firstValueFrom(this.businessAreasStore.delete(item.id))
this._toastrService.success('PAC.BUSINESS_AREA.Delete', { Default: 'Delete' })
diff --git a/apps/cloud/src/app/features/setting/certification/certification.component.html b/apps/cloud/src/app/features/setting/certification/certification.component.html
index b81ec5503..12b4b685b 100644
--- a/apps/cloud/src/app/features/setting/certification/certification.component.html
+++ b/apps/cloud/src/app/features/setting/certification/certification.component.html
@@ -1,78 +1,97 @@
-
- {{ 'PAC.KEY_WORDS.Certification' | translate: {Default: 'Certification'} }}
-
-
- {{ 'PAC.KEY_WORDS.DigitalAssetCertificationTypes' | translate: {Default: 'Digital Asset Certification Types'} }}
-
-
-
-
-
- {{ 'PAC.ACTIONS.New' | translate: {Default: 'New'} }}
-
+
-
-
-
-
-
- {{ certification.name }}
-
-
- {{ certification.description }}
-
-
+
+
-
-
-
+ account_tree
+ {{ 'PAC.BUSINESS_AREA.All' | translate: {Default: "All"} }}
+
+
+
+
-
-
-
- edit
-
-
- close
-
-
-
-
-
+
+
+
+
+
+
+ {{ certification.name }}
+
+
+ {{ certification.description }}
+
+
+
+
+
+
-
-
- {{ 'PAC.ACTIONS.Edit' | translate: {Default: 'Edit'} }}
+
+
+
+ edit
+
+
+ delete_forever
+
+
+
+
-
-
+
diff --git a/apps/cloud/src/app/features/setting/certification/certification.component.ts b/apps/cloud/src/app/features/setting/certification/certification.component.ts
index 21dfcb597..f698771f8 100644
--- a/apps/cloud/src/app/features/setting/certification/certification.component.ts
+++ b/apps/cloud/src/app/features/setting/certification/certification.component.ts
@@ -10,7 +10,7 @@ import { UsersService } from '@metad/cloud/state'
import { ConfirmDeleteComponent } from '@metad/components/confirm'
import { BehaviorSubject, catchError, firstValueFrom, from, map, switchMap } from 'rxjs'
import { CertificationService, ICertification, ToastrService } from '../../../@core'
-import { MaterialModule, UserProfileInlineComponent, userLabel } from '../../../@shared'
+import { MaterialModule, SharedModule, UserProfileInlineComponent, userLabel } from '../../../@shared'
@UntilDestroy({ checkProperties: true })
@Component({
@@ -19,6 +19,7 @@ import { MaterialModule, UserProfileInlineComponent, userLabel } from '../../../
templateUrl: './certification.component.html',
styleUrls: ['./certification.component.scss'],
imports: [
+ SharedModule,
CommonModule,
TranslateModule,
MaterialModule,
diff --git a/apps/cloud/src/app/features/setting/certification/certification.module.ts b/apps/cloud/src/app/features/setting/certification/certification.module.ts
index 20ba35eb2..a5d08d1fa 100644
--- a/apps/cloud/src/app/features/setting/certification/certification.module.ts
+++ b/apps/cloud/src/app/features/setting/certification/certification.module.ts
@@ -1,11 +1,8 @@
import { NgModule } from '@angular/core'
-import { FormsModule, ReactiveFormsModule } from '@angular/forms'
-import { TranslateModule } from '@ngx-translate/core'
-import { MaterialModule } from '../../../@shared'
import { CertificationRoutingModule } from './certification-routing.module'
@NgModule({
- imports: [CertificationRoutingModule, TranslateModule, MaterialModule, FormsModule, ReactiveFormsModule],
+ imports: [CertificationRoutingModule],
declarations: [],
providers: []
})
diff --git a/apps/cloud/src/app/features/setting/copilot/copilot.component.html b/apps/cloud/src/app/features/setting/copilot/copilot.component.html
index d5aced20c..37429e367 100644
--- a/apps/cloud/src/app/features/setting/copilot/copilot.component.html
+++ b/apps/cloud/src/app/features/setting/copilot/copilot.component.html
@@ -1,5 +1,5 @@
-
- {{ 'PAC.Copilot.AICopilot' | translate: {Default: 'AI Copilot'} }}
+
- {{ 'PAC.MENU.Custom SMTP' | translate: {Default: "Custom SMTP"} }}
-
+