aril 1.0.39 → 1.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/http/src/serviceStateMethods.mjs +6 -2
- package/esm2022/theme/layout/app/favorite-pages/favorite-pages-sidebar.component.mjs +211 -0
- package/esm2022/theme/layout/app/favorite-pages/favorite-pages.service.mjs +55 -0
- package/esm2022/theme/layout/app/favorite-pages/modals/add-edit-favorite-modal/add-edit-favorite-modal.component.mjs +129 -0
- package/esm2022/theme/layout/app/history/history-sidebar.component.mjs +128 -0
- package/esm2022/theme/layout/app/history/history.service.mjs +146 -0
- package/esm2022/theme/layout/app/layout/app.layout.component.mjs +9 -3
- package/esm2022/theme/layout/app/profileSidebar/app.profilesidebar.component.mjs +100 -8
- package/esm2022/theme/layout/app/profileSidebar/modals/change-password-modal/change-password-modal.component.mjs +142 -0
- package/esm2022/theme/layout/app/profileSidebar/modals/edit-profile-modal/edit-profile-modal.component.mjs +123 -0
- package/esm2022/theme/layout/app/profileSidebar/profile.service.mjs +42 -0
- package/esm2022/theme/layout/app/site-map/site-map-sidebar.component.mjs +161 -0
- package/esm2022/theme/layout/app/topbar/app.topbar.component.mjs +23 -5
- package/esm2022/theme/layout/service/app.layout.service.mjs +13 -1
- package/fesm2022/aril-http.mjs +5 -1
- package/fesm2022/aril-http.mjs.map +1 -1
- package/fesm2022/aril-theme-layout.mjs +1197 -75
- package/fesm2022/aril-theme-layout.mjs.map +1 -1
- package/package.json +84 -83
- package/theme/layout/app/favorite-pages/favorite-pages-sidebar.component.d.ts +42 -0
- package/theme/layout/app/favorite-pages/favorite-pages-sidebar.component.html +106 -0
- package/theme/layout/app/favorite-pages/favorite-pages-sidebar.component.scss +181 -0
- package/theme/layout/app/favorite-pages/favorite-pages-sidebar.component.ts +253 -0
- package/theme/layout/app/favorite-pages/favorite-pages.service.d.ts +54 -0
- package/theme/layout/app/favorite-pages/favorite-pages.service.ts +87 -0
- package/theme/layout/app/favorite-pages/modals/add-edit-favorite-modal/add-edit-favorite-modal.component.d.ts +36 -0
- package/theme/layout/app/favorite-pages/modals/add-edit-favorite-modal/add-edit-favorite-modal.component.html +27 -0
- package/theme/layout/app/favorite-pages/modals/add-edit-favorite-modal/add-edit-favorite-modal.component.ts +165 -0
- package/theme/layout/app/history/history-sidebar.component.d.ts +30 -0
- package/theme/layout/app/history/history-sidebar.component.html +88 -0
- package/theme/layout/app/history/history-sidebar.component.scss +191 -0
- package/theme/layout/app/history/history-sidebar.component.ts +139 -0
- package/theme/layout/app/history/history.service.d.ts +36 -0
- package/theme/layout/app/history/history.service.ts +182 -0
- package/theme/layout/app/layout/app.layout.component.html +3 -0
- package/theme/layout/app/layout/app.layout.component.ts +7 -1
- package/theme/layout/app/profileSidebar/app.profilesidebar.component.d.ts +17 -2
- package/theme/layout/app/profileSidebar/app.profilesidebar.component.html +107 -135
- package/theme/layout/app/profileSidebar/app.profilesidebar.component.scss +152 -0
- package/theme/layout/app/profileSidebar/app.profilesidebar.component.ts +114 -7
- package/theme/layout/app/profileSidebar/modals/change-password-modal/change-password-modal.component.d.ts +30 -0
- package/theme/layout/app/profileSidebar/modals/change-password-modal/change-password-modal.component.html +46 -0
- package/theme/layout/app/profileSidebar/modals/change-password-modal/change-password-modal.component.scss +28 -0
- package/theme/layout/app/profileSidebar/modals/change-password-modal/change-password-modal.component.ts +178 -0
- package/theme/layout/app/profileSidebar/modals/edit-profile-modal/edit-profile-modal.component.d.ts +27 -0
- package/theme/layout/app/profileSidebar/modals/edit-profile-modal/edit-profile-modal.component.html +76 -0
- package/theme/layout/app/profileSidebar/modals/edit-profile-modal/edit-profile-modal.component.ts +141 -0
- package/theme/layout/app/profileSidebar/profile.service.d.ts +67 -0
- package/theme/layout/app/profileSidebar/profile.service.ts +89 -0
- package/theme/layout/app/site-map/site-map-sidebar.component.d.ts +37 -0
- package/theme/layout/app/site-map/site-map-sidebar.component.html +118 -0
- package/theme/layout/app/site-map/site-map-sidebar.component.scss +189 -0
- package/theme/layout/app/site-map/site-map-sidebar.component.ts +189 -0
- package/theme/layout/app/topbar/app.topbar.component.d.ts +7 -1
- package/theme/layout/app/topbar/app.topbar.component.html +37 -17
- package/theme/layout/app/topbar/app.topbar.component.scss +188 -12
- package/theme/layout/app/topbar/app.topbar.component.ts +29 -7
- package/theme/layout/service/app.layout.service.d.ts +6 -0
- package/theme/layout/service/app.layout.service.ts +19 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Component, effect } from '@angular/core';
|
|
3
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
4
|
+
import {
|
|
5
|
+
AbstractControl,
|
|
6
|
+
FormBuilder,
|
|
7
|
+
FormControl,
|
|
8
|
+
FormGroup,
|
|
9
|
+
FormsModule,
|
|
10
|
+
ReactiveFormsModule,
|
|
11
|
+
ValidationErrors
|
|
12
|
+
} from '@angular/forms';
|
|
13
|
+
|
|
14
|
+
import { MessageService } from 'primeng/api';
|
|
15
|
+
import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog';
|
|
16
|
+
import { PasswordModule } from 'primeng/password';
|
|
17
|
+
import { TooltipModule } from 'primeng/tooltip';
|
|
18
|
+
|
|
19
|
+
import { TranslocoModule, TranslocoService } from '@ngneat/transloco';
|
|
20
|
+
import { Subject, switchMap } from 'rxjs';
|
|
21
|
+
|
|
22
|
+
import { ButtonComponent } from 'aril/ui/button';
|
|
23
|
+
import { FieldComponent } from 'aril/ui/field';
|
|
24
|
+
import { ARiLFormModule } from 'aril/ui/form';
|
|
25
|
+
|
|
26
|
+
import { ProfileService, ResetPasswordRequestDTO } from '../../profile.service';
|
|
27
|
+
|
|
28
|
+
export class PasswordValidators {
|
|
29
|
+
static passwordMatchValidator = (passwordFormGroup: FormGroup) => {
|
|
30
|
+
return (control: AbstractControl): ValidationErrors | null => {
|
|
31
|
+
if (!control.value || !passwordFormGroup) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const passwordControl = passwordFormGroup.get('newPassword');
|
|
36
|
+
const confirmPasswordValue = control.value;
|
|
37
|
+
|
|
38
|
+
if (!passwordControl || !confirmPasswordValue) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const passwordsMatch = passwordControl.value === confirmPasswordValue;
|
|
43
|
+
return passwordsMatch ? null : (
|
|
44
|
+
{
|
|
45
|
+
passwordMismatch: 'Şifreler eşleşmiyor. Lütfen aynı şifreyi giriniz.'
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
static minLength(length: number) {
|
|
52
|
+
return (control: AbstractControl): ValidationErrors | null => {
|
|
53
|
+
if (!control.value || control.value.length >= length) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return { minlength: `Şifre en az ${length} karakter olmalıdır.` };
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static required(control: AbstractControl): ValidationErrors | null {
|
|
61
|
+
if (!control.value || control.value.trim() === '') {
|
|
62
|
+
return { required: 'Bu alan zorunludur.' };
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@Component({
|
|
69
|
+
standalone: true,
|
|
70
|
+
imports: [
|
|
71
|
+
CommonModule,
|
|
72
|
+
ReactiveFormsModule,
|
|
73
|
+
FormsModule,
|
|
74
|
+
ARiLFormModule,
|
|
75
|
+
FieldComponent,
|
|
76
|
+
ButtonComponent,
|
|
77
|
+
PasswordModule,
|
|
78
|
+
TooltipModule,
|
|
79
|
+
TranslocoModule
|
|
80
|
+
],
|
|
81
|
+
templateUrl: './change-password-modal.component.html',
|
|
82
|
+
styleUrls: ['./change-password-modal.component.scss']
|
|
83
|
+
})
|
|
84
|
+
export class ChangePasswordModalComponent {
|
|
85
|
+
passwordForm!: FormGroup;
|
|
86
|
+
userId: string;
|
|
87
|
+
|
|
88
|
+
private subjects = {
|
|
89
|
+
resetPassword: new Subject<ResetPasswordRequestDTO>()
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
resetPasswordService = toSignal(
|
|
93
|
+
this.subjects.resetPassword.pipe(switchMap((data) => this.profileService.resetPassword(data)))
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
constructor(
|
|
97
|
+
private readonly formBuilder: FormBuilder,
|
|
98
|
+
private readonly dialogRef: DynamicDialogRef,
|
|
99
|
+
private readonly dialogConfig: DynamicDialogConfig,
|
|
100
|
+
private readonly profileService: ProfileService,
|
|
101
|
+
private readonly translocoService: TranslocoService,
|
|
102
|
+
private readonly messageService: MessageService
|
|
103
|
+
) {
|
|
104
|
+
this.userId = this.dialogConfig.data?.userId;
|
|
105
|
+
|
|
106
|
+
effect(
|
|
107
|
+
() => {
|
|
108
|
+
const service = this.resetPasswordService();
|
|
109
|
+
if (service?.response) {
|
|
110
|
+
this.messageService.add({
|
|
111
|
+
severity: 'success',
|
|
112
|
+
summary: this.translocoService.translate('profileSidebar.changePasswordSuccess'),
|
|
113
|
+
detail: this.translocoService.translate('profileSidebar.changePasswordSuccessDetail'),
|
|
114
|
+
key: 'toast-root'
|
|
115
|
+
});
|
|
116
|
+
this.dialogRef.close({ status: 'success' });
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{ allowSignalWrites: true }
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
this.initializeForm();
|
|
123
|
+
|
|
124
|
+
if (!this.userId) {
|
|
125
|
+
this.dialogRef.close('error');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
initializeForm(): void {
|
|
130
|
+
this.passwordForm = this.formBuilder.group({
|
|
131
|
+
newPassword: new FormControl('', [PasswordValidators.required, PasswordValidators.minLength(6)]),
|
|
132
|
+
confirmPassword: new FormControl('', [PasswordValidators.required])
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const confirmPasswordControl = this.passwordForm.get('confirmPassword');
|
|
136
|
+
if (confirmPasswordControl) {
|
|
137
|
+
confirmPasswordControl.setValidators([
|
|
138
|
+
PasswordValidators.required,
|
|
139
|
+
PasswordValidators.passwordMatchValidator(this.passwordForm)
|
|
140
|
+
]);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
this.passwordForm.get('newPassword')?.valueChanges.subscribe(() => {
|
|
144
|
+
confirmPasswordControl?.updateValueAndValidity({ emitEvent: false });
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
getErrorMessage(controlName: string): string {
|
|
149
|
+
const control = this.passwordForm.get(controlName);
|
|
150
|
+
if (control?.errors) {
|
|
151
|
+
const errors = control.errors;
|
|
152
|
+
const errorKeys = Object.keys(errors);
|
|
153
|
+
if (errorKeys.length > 0) {
|
|
154
|
+
return errors[errorKeys[0]];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return '';
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
submit(): void {
|
|
161
|
+
if (this.passwordForm.invalid) {
|
|
162
|
+
this.passwordForm.markAllAsTouched();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const formValue = this.passwordForm.value;
|
|
167
|
+
const resetRequest: ResetPasswordRequestDTO = {
|
|
168
|
+
userId: this.userId,
|
|
169
|
+
password: formValue.newPassword
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
this.subjects.resetPassword.next(resetRequest);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
cancel(): void {
|
|
176
|
+
this.dialogRef.close('cancel');
|
|
177
|
+
}
|
|
178
|
+
}
|
package/theme/layout/app/profileSidebar/modals/edit-profile-modal/edit-profile-modal.component.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import { FormBuilder, FormGroup } from '@angular/forms';
|
|
3
|
+
import { MessageService } from 'primeng/api';
|
|
4
|
+
import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog';
|
|
5
|
+
import { TranslocoService } from '@ngneat/transloco';
|
|
6
|
+
import { ProfileService, UserResponseDTO } from '../../profile.service';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare class EditProfileModalComponent implements OnInit {
|
|
9
|
+
private readonly formBuilder;
|
|
10
|
+
private readonly dialogRef;
|
|
11
|
+
private readonly dialogConfig;
|
|
12
|
+
private readonly profileService;
|
|
13
|
+
private readonly translocoService;
|
|
14
|
+
private readonly messageService;
|
|
15
|
+
profileForm: FormGroup;
|
|
16
|
+
userProfile: UserResponseDTO;
|
|
17
|
+
private subjects;
|
|
18
|
+
updateUserService: import("@angular/core").Signal<import("../../../../../../../../dist/http").ServiceResponse<UserResponseDTO> | undefined>;
|
|
19
|
+
constructor(formBuilder: FormBuilder, dialogRef: DynamicDialogRef, dialogConfig: DynamicDialogConfig, profileService: ProfileService, translocoService: TranslocoService, messageService: MessageService);
|
|
20
|
+
ngOnInit(): void;
|
|
21
|
+
private initializeEffects;
|
|
22
|
+
private initializeForm;
|
|
23
|
+
submit(): void;
|
|
24
|
+
cancel(): void;
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EditProfileModalComponent, never>;
|
|
26
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EditProfileModalComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
27
|
+
}
|
package/theme/layout/app/profileSidebar/modals/edit-profile-modal/edit-profile-modal.component.html
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<div *transloco="let t; read: 'profileSidebar'">
|
|
2
|
+
<aril-form [formGroup]="profileForm">
|
|
3
|
+
<aril-field [label]="t('systemUser')" [cols]="{ xl: 6, lg: 6, md: 12, sm: 12 }">
|
|
4
|
+
<aril-checkbox [label]="' '" formControlName="systemUser" [disabled]="true"></aril-checkbox>
|
|
5
|
+
</aril-field>
|
|
6
|
+
|
|
7
|
+
<aril-field [label]="t('systemUserApp')" [cols]="{ xl: 6, lg: 6, md: 12, sm: 12 }">
|
|
8
|
+
<aril-text formControlName="clientOfSystemUser" [disabled]="true"></aril-text>
|
|
9
|
+
</aril-field>
|
|
10
|
+
|
|
11
|
+
<!-- <aril-field [label]="t('userType')" [cols]="{ xl: 6, lg: 6, md: 6, sm: 12 }">
|
|
12
|
+
<aril-text formControlName="userTypeId" [disabled]="true"></aril-text>
|
|
13
|
+
</aril-field>
|
|
14
|
+
|
|
15
|
+
<aril-field [label]="t('responsibleRegions')" [cols]="{ xl: 6, lg: 6, md: 6, sm: 12 }">
|
|
16
|
+
<aril-text formControlName="regions" [disabled]="true"></aril-text>
|
|
17
|
+
</aril-field> -->
|
|
18
|
+
|
|
19
|
+
<aril-field [label]="t('username')" [cols]="{ xl: 6, lg: 6, md: 6, sm: 12 }" [markAsRequired]="true">
|
|
20
|
+
<aril-text formControlName="userName" [disabled]="true"></aril-text>
|
|
21
|
+
</aril-field>
|
|
22
|
+
|
|
23
|
+
<aril-field [label]="t('firstName')" [cols]="{ xl: 6, lg: 6, md: 6, sm: 12 }" [markAsRequired]="true">
|
|
24
|
+
<aril-text formControlName="firstName"></aril-text>
|
|
25
|
+
</aril-field>
|
|
26
|
+
|
|
27
|
+
<aril-field [label]="t('lastName')" [cols]="{ xl: 6, lg: 6, md: 6, sm: 12 }">
|
|
28
|
+
<aril-text formControlName="lastName"></aril-text>
|
|
29
|
+
</aril-field>
|
|
30
|
+
|
|
31
|
+
<aril-field [label]="t('email')" [cols]="{ xl: 6, lg: 6, md: 6, sm: 12 }" [markAsRequired]="true">
|
|
32
|
+
<aril-text formControlName="email"></aril-text>
|
|
33
|
+
</aril-field>
|
|
34
|
+
|
|
35
|
+
<aril-field [label]="t('phone')" [cols]="{ xl: 6, lg: 6, md: 6, sm: 12 }">
|
|
36
|
+
<aril-mask mask="(999) 999 99 99" [placeholder]="t('phoneExample')" formControlName="phone"></aril-mask>
|
|
37
|
+
</aril-field>
|
|
38
|
+
|
|
39
|
+
<aril-field [label]="t('tcNumber')" [cols]="{ xl: 6, lg: 6, md: 6, sm: 12 }" [markAsRequired]="true">
|
|
40
|
+
<aril-mask mask="99999999999" formControlName="tckn"></aril-mask>
|
|
41
|
+
</aril-field>
|
|
42
|
+
|
|
43
|
+
<aril-field [label]="t('photoUrl')" [cols]="{ xl: 6, lg: 6, md: 6, sm: 12 }">
|
|
44
|
+
<aril-text formControlName="photoUrl"></aril-text>
|
|
45
|
+
</aril-field>
|
|
46
|
+
|
|
47
|
+
<aril-field [label]="t('active')" [cols]="{ xl: 6, lg: 6, md: 6, sm: 12 }">
|
|
48
|
+
<aril-checkbox [label]="' '" formControlName="enabled" [disabled]="true"></aril-checkbox>
|
|
49
|
+
</aril-field>
|
|
50
|
+
|
|
51
|
+
<aril-field [label]="t('emailVerified')" [cols]="{ xl: 6, lg: 6, md: 6, sm: 12 }">
|
|
52
|
+
<aril-checkbox [label]="' '" formControlName="emailVerified" [disabled]="true"></aril-checkbox>
|
|
53
|
+
</aril-field>
|
|
54
|
+
|
|
55
|
+
<aril-field [label]="t('notes')" [cols]="{ xl: 12, lg: 12, md: 12, sm: 12 }">
|
|
56
|
+
<aril-text-area [rows]="3" [cols]="40" formControlName="notes"></aril-text-area>
|
|
57
|
+
</aril-field>
|
|
58
|
+
|
|
59
|
+
<div class="col-12 flex justify-content-end mt-4 gap-2">
|
|
60
|
+
<aril-button
|
|
61
|
+
color="danger"
|
|
62
|
+
[label]="t('cancel')"
|
|
63
|
+
[outlined]="true"
|
|
64
|
+
icon="TIMES"
|
|
65
|
+
(clickEvent)="cancel()">
|
|
66
|
+
</aril-button>
|
|
67
|
+
<aril-button
|
|
68
|
+
color="success"
|
|
69
|
+
[label]="t('save')"
|
|
70
|
+
[raised]="false"
|
|
71
|
+
icon="CHECK"
|
|
72
|
+
(clickEvent)="submit()">
|
|
73
|
+
</aril-button>
|
|
74
|
+
</div>
|
|
75
|
+
</aril-form>
|
|
76
|
+
</div>
|
package/theme/layout/app/profileSidebar/modals/edit-profile-modal/edit-profile-modal.component.ts
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { Component, OnInit, effect } from '@angular/core';
|
|
3
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { FormBuilder, FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
5
|
+
|
|
6
|
+
import { MessageService } from 'primeng/api';
|
|
7
|
+
import { DynamicDialogConfig, DynamicDialogRef } from 'primeng/dynamicdialog';
|
|
8
|
+
|
|
9
|
+
import { TranslocoModule, TranslocoService } from '@ngneat/transloco';
|
|
10
|
+
import { Subject, switchMap } from 'rxjs';
|
|
11
|
+
|
|
12
|
+
import { ButtonComponent } from 'aril/ui/button';
|
|
13
|
+
import { CheckboxComponent } from 'aril/ui/checkbox';
|
|
14
|
+
import { FieldComponent } from 'aril/ui/field';
|
|
15
|
+
import { ARiLFormModule } from 'aril/ui/form';
|
|
16
|
+
import { MaskComponent } from 'aril/ui/mask';
|
|
17
|
+
import { TextComponent } from 'aril/ui/text';
|
|
18
|
+
import { TextAreaComponent } from 'aril/ui/textArea';
|
|
19
|
+
|
|
20
|
+
import { ProfileService, UpdateUserRequestDTO, UserResponseDTO } from '../../profile.service';
|
|
21
|
+
|
|
22
|
+
@Component({
|
|
23
|
+
standalone: true,
|
|
24
|
+
imports: [
|
|
25
|
+
CommonModule,
|
|
26
|
+
ReactiveFormsModule,
|
|
27
|
+
FormsModule,
|
|
28
|
+
ARiLFormModule,
|
|
29
|
+
FieldComponent,
|
|
30
|
+
TextComponent,
|
|
31
|
+
TextAreaComponent,
|
|
32
|
+
ButtonComponent,
|
|
33
|
+
MaskComponent,
|
|
34
|
+
CheckboxComponent,
|
|
35
|
+
TranslocoModule
|
|
36
|
+
],
|
|
37
|
+
templateUrl: './edit-profile-modal.component.html'
|
|
38
|
+
})
|
|
39
|
+
export class EditProfileModalComponent implements OnInit {
|
|
40
|
+
profileForm!: FormGroup;
|
|
41
|
+
userProfile: UserResponseDTO;
|
|
42
|
+
|
|
43
|
+
private subjects = {
|
|
44
|
+
updateUser: new Subject<UpdateUserRequestDTO>()
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
updateUserService = toSignal(
|
|
48
|
+
this.subjects.updateUser.pipe(switchMap((data) => this.profileService.updateUser(data)))
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
constructor(
|
|
52
|
+
private readonly formBuilder: FormBuilder,
|
|
53
|
+
private readonly dialogRef: DynamicDialogRef,
|
|
54
|
+
private readonly dialogConfig: DynamicDialogConfig,
|
|
55
|
+
private readonly profileService: ProfileService,
|
|
56
|
+
private readonly translocoService: TranslocoService,
|
|
57
|
+
private readonly messageService: MessageService
|
|
58
|
+
) {
|
|
59
|
+
this.userProfile = this.dialogConfig.data?.userProfile;
|
|
60
|
+
this.initializeEffects();
|
|
61
|
+
this.initializeForm();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
ngOnInit(): void {
|
|
65
|
+
if (!this.userProfile) {
|
|
66
|
+
this.dialogRef.close('error');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private initializeEffects(): void {
|
|
71
|
+
effect(
|
|
72
|
+
() => {
|
|
73
|
+
const service = this.updateUserService();
|
|
74
|
+
if (service?.response) {
|
|
75
|
+
this.messageService.add({
|
|
76
|
+
severity: 'success',
|
|
77
|
+
summary: this.translocoService.translate('profileSidebar.updateSuccess'),
|
|
78
|
+
detail: this.translocoService.translate('profileSidebar.updateSuccessDetail'),
|
|
79
|
+
key: 'toast-root'
|
|
80
|
+
});
|
|
81
|
+
this.dialogRef.close({ status: 'success', data: service.response });
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{ allowSignalWrites: true }
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private initializeForm(): void {
|
|
89
|
+
this.profileForm = this.formBuilder.group({
|
|
90
|
+
id: new FormControl(this.userProfile?.id || null),
|
|
91
|
+
systemUser: new FormControl({ value: this.userProfile?.systemUser ?? true, disabled: true }),
|
|
92
|
+
clientOfSystemUser: new FormControl({ value: this.userProfile?.clientOfSystemUser || '', disabled: true }),
|
|
93
|
+
userTypeId: new FormControl({ value: this.userProfile?.userTypeId || null, disabled: true }),
|
|
94
|
+
regions: new FormControl({ value: this.userProfile?.regions || '', disabled: true }),
|
|
95
|
+
userName: new FormControl({ value: this.userProfile?.userName || '', disabled: true }, [Validators.required]),
|
|
96
|
+
firstName: new FormControl(this.userProfile?.firstName || '', [Validators.required]),
|
|
97
|
+
lastName: new FormControl(this.userProfile?.lastName || ''),
|
|
98
|
+
email: new FormControl(this.userProfile?.email || '', [Validators.email, Validators.required]),
|
|
99
|
+
phone: new FormControl(
|
|
100
|
+
Array.isArray(this.userProfile?.phone) ? this.userProfile.phone[0] || '' : this.userProfile?.phone || ''
|
|
101
|
+
),
|
|
102
|
+
tckn: new FormControl(Array.isArray(this.userProfile?.tckn) ? this.userProfile.tckn[0] || '' : '', [
|
|
103
|
+
Validators.required
|
|
104
|
+
]),
|
|
105
|
+
photoUrl: new FormControl(this.userProfile?.photoUrl || ''),
|
|
106
|
+
enabled: new FormControl({ value: this.userProfile?.enabled ?? true, disabled: true }),
|
|
107
|
+
emailVerified: new FormControl({ value: this.userProfile?.emailVerified ?? true, disabled: true }),
|
|
108
|
+
notes: new FormControl(this.userProfile?.notes || '')
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
submit(): void {
|
|
113
|
+
if (this.profileForm.invalid) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const rawValue = this.profileForm.getRawValue();
|
|
117
|
+
const updateRequest: UpdateUserRequestDTO = {
|
|
118
|
+
id: this.userProfile.id,
|
|
119
|
+
firstName: rawValue.firstName,
|
|
120
|
+
lastName: rawValue.lastName,
|
|
121
|
+
email: rawValue.email,
|
|
122
|
+
phone: Array.isArray(rawValue.phone) ? rawValue.phone : [rawValue.phone],
|
|
123
|
+
tckn: Array.isArray(rawValue.tckn) ? rawValue.tckn : [rawValue.tckn],
|
|
124
|
+
photoUrl: Array.isArray(rawValue.photoUrl) ? rawValue.photoUrl : [rawValue.photoUrl],
|
|
125
|
+
notes: Array.isArray(rawValue.notes) ? rawValue.notes : [rawValue.notes],
|
|
126
|
+
password: null,
|
|
127
|
+
enabled: rawValue.enabled,
|
|
128
|
+
emailVerified: rawValue.emailVerified,
|
|
129
|
+
systemUser: rawValue.systemUser,
|
|
130
|
+
clientOfSystemUser: rawValue.clientOfSystemUser,
|
|
131
|
+
userTypeId: rawValue.userTypeId || null,
|
|
132
|
+
regions: rawValue.regions
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
this.subjects.updateUser.next(updateRequest);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
cancel(): void {
|
|
139
|
+
this.dialogRef.close('cancel');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { RestClient, ServiceCallStateMap, ServiceResponse } from 'aril/http';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export interface GetUserRequestDTO {
|
|
5
|
+
id: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UpdateUserRequestDTO {
|
|
8
|
+
id: string;
|
|
9
|
+
firstName?: string;
|
|
10
|
+
lastName?: string;
|
|
11
|
+
email?: string;
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
emailVerified?: boolean;
|
|
14
|
+
phone?: string[];
|
|
15
|
+
tckn?: string[];
|
|
16
|
+
regions?: Array<{
|
|
17
|
+
startLevel: string;
|
|
18
|
+
endLevel: string;
|
|
19
|
+
}>;
|
|
20
|
+
photoUrl?: string[];
|
|
21
|
+
notes?: string[];
|
|
22
|
+
userTypeId?: string;
|
|
23
|
+
clientOfSystemUser?: string;
|
|
24
|
+
systemUser?: boolean;
|
|
25
|
+
password?: string | null;
|
|
26
|
+
}
|
|
27
|
+
export interface ResetPasswordRequestDTO {
|
|
28
|
+
userId: string;
|
|
29
|
+
password: string;
|
|
30
|
+
}
|
|
31
|
+
export interface UserResponseDTO {
|
|
32
|
+
id: string;
|
|
33
|
+
userName: string;
|
|
34
|
+
email: string;
|
|
35
|
+
firstName: string;
|
|
36
|
+
lastName: string;
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
phone?: string | string[];
|
|
39
|
+
roles?: string[];
|
|
40
|
+
userTypes?: string[];
|
|
41
|
+
photoUrl?: string | string[];
|
|
42
|
+
createdTimestamp?: number;
|
|
43
|
+
emailVerified?: boolean;
|
|
44
|
+
lastSession?: number;
|
|
45
|
+
tckn?: string | string[];
|
|
46
|
+
notes?: string | string[];
|
|
47
|
+
systemUser?: boolean;
|
|
48
|
+
clientOfSystemUser?: string;
|
|
49
|
+
userTypeId?: string;
|
|
50
|
+
regions?: string[] | Array<{
|
|
51
|
+
startLevel: string;
|
|
52
|
+
endLevel: string;
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
export declare const profileEndpoints: {
|
|
56
|
+
getUser: string;
|
|
57
|
+
updateUser: string;
|
|
58
|
+
resetPassword: string;
|
|
59
|
+
};
|
|
60
|
+
export declare class ProfileService extends RestClient {
|
|
61
|
+
states: ServiceCallStateMap<ProfileService>;
|
|
62
|
+
getUser(post: GetUserRequestDTO): Observable<ServiceResponse<UserResponseDTO>>;
|
|
63
|
+
updateUser(post: UpdateUserRequestDTO): Observable<ServiceResponse<UserResponseDTO>>;
|
|
64
|
+
resetPassword(post: ResetPasswordRequestDTO): Observable<ServiceResponse<any>>;
|
|
65
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ProfileService, never>;
|
|
66
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ProfileService>;
|
|
67
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
|
|
5
|
+
import { Apps } from 'aril/boot/config/apps';
|
|
6
|
+
import { HTTPMethods, ProxyTypes, RestClient, ServiceCall, ServiceCallStateMap, ServiceResponse } from 'aril/http';
|
|
7
|
+
|
|
8
|
+
export interface GetUserRequestDTO {
|
|
9
|
+
id: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface UpdateUserRequestDTO {
|
|
13
|
+
id: string;
|
|
14
|
+
firstName?: string;
|
|
15
|
+
lastName?: string;
|
|
16
|
+
email?: string;
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
emailVerified?: boolean;
|
|
19
|
+
phone?: string[];
|
|
20
|
+
tckn?: string[];
|
|
21
|
+
regions?: Array<{
|
|
22
|
+
startLevel: string;
|
|
23
|
+
endLevel: string;
|
|
24
|
+
}>;
|
|
25
|
+
photoUrl?: string[];
|
|
26
|
+
notes?: string[];
|
|
27
|
+
userTypeId?: string;
|
|
28
|
+
clientOfSystemUser?: string;
|
|
29
|
+
systemUser?: boolean;
|
|
30
|
+
password?: string | null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ResetPasswordRequestDTO {
|
|
34
|
+
userId: string;
|
|
35
|
+
password: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface UserResponseDTO {
|
|
39
|
+
id: string;
|
|
40
|
+
userName: string;
|
|
41
|
+
email: string;
|
|
42
|
+
firstName: string;
|
|
43
|
+
lastName: string;
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
phone?: string | string[];
|
|
46
|
+
roles?: string[];
|
|
47
|
+
userTypes?: string[];
|
|
48
|
+
photoUrl?: string | string[];
|
|
49
|
+
createdTimestamp?: number;
|
|
50
|
+
emailVerified?: boolean;
|
|
51
|
+
lastSession?: number;
|
|
52
|
+
tckn?: string | string[];
|
|
53
|
+
notes?: string | string[];
|
|
54
|
+
systemUser?: boolean;
|
|
55
|
+
clientOfSystemUser?: string;
|
|
56
|
+
userTypeId?: string;
|
|
57
|
+
regions?:
|
|
58
|
+
| string[]
|
|
59
|
+
| Array<{
|
|
60
|
+
startLevel: string;
|
|
61
|
+
endLevel: string;
|
|
62
|
+
}>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const profileEndpoints = {
|
|
66
|
+
getUser: 'user-management/users/get',
|
|
67
|
+
updateUser: 'user-management/users/update',
|
|
68
|
+
resetPassword: 'user-management/users/reset-password'
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
@Injectable({ providedIn: 'root' })
|
|
72
|
+
export class ProfileService extends RestClient {
|
|
73
|
+
override states: ServiceCallStateMap<ProfileService> = {};
|
|
74
|
+
|
|
75
|
+
@ServiceCall(HTTPMethods.POST, ProxyTypes.ClientSide, profileEndpoints.getUser, {}, Apps.MW)
|
|
76
|
+
getUser(post: GetUserRequestDTO) {
|
|
77
|
+
return new Observable<ServiceResponse<UserResponseDTO>>();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@ServiceCall(HTTPMethods.POST, ProxyTypes.ClientSide, profileEndpoints.updateUser, {}, Apps.MW)
|
|
81
|
+
updateUser(post: UpdateUserRequestDTO) {
|
|
82
|
+
return new Observable<ServiceResponse<UserResponseDTO>>();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@ServiceCall(HTTPMethods.POST, ProxyTypes.ClientSide, profileEndpoints.resetPassword, {}, Apps.MW)
|
|
86
|
+
resetPassword(post: ResetPasswordRequestDTO) {
|
|
87
|
+
return new Observable<ServiceResponse<any>>();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import { TranslocoService } from '@ngneat/transloco';
|
|
3
|
+
import { LayoutService } from '../../service/app.layout.service';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
interface MenuNode {
|
|
6
|
+
key: string;
|
|
7
|
+
label: string | object;
|
|
8
|
+
icon?: string;
|
|
9
|
+
routerLink?: string;
|
|
10
|
+
children?: MenuNode[];
|
|
11
|
+
expanded?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare class SiteMapSidebarComponent implements OnInit {
|
|
14
|
+
layoutService: LayoutService;
|
|
15
|
+
private translocoService;
|
|
16
|
+
siteMapNodes: import("@angular/core").WritableSignal<MenuNode[]>;
|
|
17
|
+
filteredNodes: import("@angular/core").WritableSignal<MenuNode[]>;
|
|
18
|
+
searchTerm: import("@angular/core").WritableSignal<string>;
|
|
19
|
+
totalPages: import("@angular/core").WritableSignal<number>;
|
|
20
|
+
constructor(layoutService: LayoutService, translocoService: TranslocoService);
|
|
21
|
+
ngOnInit(): void;
|
|
22
|
+
get visible(): boolean;
|
|
23
|
+
set visible(value: boolean);
|
|
24
|
+
private loadSiteMap;
|
|
25
|
+
private buildSiteMapNodes;
|
|
26
|
+
private countTotalPages;
|
|
27
|
+
onSearchChange(): void;
|
|
28
|
+
private filterNodes;
|
|
29
|
+
expandAll(): void;
|
|
30
|
+
collapseAll(): void;
|
|
31
|
+
private expandNodes;
|
|
32
|
+
toggleNode(node: MenuNode): void;
|
|
33
|
+
trackByKey(index: number, node: MenuNode): string;
|
|
34
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SiteMapSidebarComponent, never>;
|
|
35
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SiteMapSidebarComponent, "app-site-map-sidebar", never, {}, {}, never, never, true, never>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|