1 | import { CommonModule } from '@angular/common';
|
2 | import { FlexLayoutModule } from '@angular/flex-layout';
|
3 | import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
4 | import { NgsFormModule } from '@soushians/form';
|
5 | import { HttpClient, HttpClientModule } from '@angular/common/http';
|
6 | import { __decorate, __metadata } from 'tslib';
|
7 | import { Actions, Effect, EffectsModule } from '@ngrx/effects';
|
8 | import { getUser, SignInActionTypes } from '@soushians/authentication';
|
9 | import { Observable } from 'rxjs/Observable';
|
10 | import { MatSnackBar, MatExpansionModule, MatSnackBarModule, MatIconModule, MatButtonModule, MatCardModule, MatSelectModule, MatInputModule, MatFormFieldModule, MatTabsModule, MatRadioModule } from '@angular/material';
|
11 | import { FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
12 | import { stringTemplate, MatchValidator } from '@soushians/shared';
|
13 | import { of, BehaviorSubject as BehaviorSubject$1 } from 'rxjs';
|
14 | import { getUserModuleConfig, getAppConfig } from '@soushians/config';
|
15 | import { map, filter, take, switchMap, combineLatest, catchError, takeWhile } from 'rxjs/operators';
|
16 | import { BehaviorSubject } from 'rxjs/BehaviorSubject';
|
17 | import { Router, ActivatedRoute, RouterModule } from '@angular/router';
|
18 | import { InjectionToken, Injectable, Inject, Component, Input, Output, EventEmitter, NgModule, defineInjectable, inject } from '@angular/core';
|
19 | import { Store, createSelector, createFeatureSelector, StoreModule } from '@ngrx/store';
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | class UserModel {
|
26 | constructor() {
|
27 | this.Roles = [];
|
28 | this.Groups = [];
|
29 | }
|
30 | }
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | const MODULE_DEFAULT_CONFIG = {
|
38 | server: "frontend_server",
|
39 | env: {
|
40 | production: false,
|
41 | frontend_server: "user/module/frontend/server/did/not/set",
|
42 | server: "user/module/server/did/not/set"
|
43 | },
|
44 | endpoints: {
|
45 |
|
46 | changePassword: "",
|
47 | editProfile: "",
|
48 | getAccountInfo: "",
|
49 | profileInformation: ""
|
50 | },
|
51 | forms: {
|
52 | profile_edit: ""
|
53 | },
|
54 | dashboardLinks: [],
|
55 | responseToUserInfo: user$ => user$,
|
56 | mapUserDisplayName: user$ => user$.pipe(map(user => user.Username))
|
57 | };
|
58 |
|
59 | const MODULE_CONFIG_TOKEN = new InjectionToken("UserModuleConfig");
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | class UserConfigurationService {
|
66 | |
67 |
|
68 |
|
69 |
|
70 | constructor(configFile, store) {
|
71 | this.store = store;
|
72 | this.config$ = new BehaviorSubject(this._config);
|
73 | this._config = Object.assign({}, MODULE_DEFAULT_CONFIG, configFile);
|
74 | this.config$.next(this._config);
|
75 | this.store.select(getUserModuleConfig).subscribe(userConfig => {
|
76 | if (!userConfig)
|
77 | return;
|
78 | this._config = Object.assign({}, this._config, userConfig.Config);
|
79 | this.config$.next(this._config);
|
80 | });
|
81 | }
|
82 | |
83 |
|
84 |
|
85 | get config() {
|
86 | return this._config;
|
87 | }
|
88 | }
|
89 | UserConfigurationService.decorators = [
|
90 | { type: Injectable, args: [{
|
91 | providedIn: "root"
|
92 | },] }
|
93 | ];
|
94 |
|
95 | UserConfigurationService.ctorParameters = () => [
|
96 | { type: undefined, decorators: [{ type: Inject, args: [MODULE_CONFIG_TOKEN,] }] },
|
97 | { type: Store }
|
98 | ];
|
99 | UserConfigurationService.ngInjectableDef = defineInjectable({ factory: function UserConfigurationService_Factory() { return new UserConfigurationService(inject(MODULE_CONFIG_TOKEN), inject(Store)); }, token: UserConfigurationService, providedIn: "root" });
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 | var ProfileViewActionTypes = {
|
107 | GET_PROFILE: "[USER][PROFILE] GET_PROFILE",
|
108 | GET_PROFILE_START: "[USER][PROFILE] GET_PROFILE_START",
|
109 | GET_PROFILE_SUCCEED: "[USER][PROFILE] GET_PROFILE_SUCCEED",
|
110 | GET_PROFILE_FAILED: "[USER][PROFILE] GET_PROFILE_FAILED",
|
111 | };
|
112 | class GetProfile {
|
113 | constructor() {
|
114 | this.type = ProfileViewActionTypes.GET_PROFILE;
|
115 | }
|
116 | }
|
117 | class GetProfileStart {
|
118 | constructor() {
|
119 | this.type = ProfileViewActionTypes.GET_PROFILE_START;
|
120 | }
|
121 | }
|
122 | class GetProfileSucceed {
|
123 | |
124 |
|
125 |
|
126 | constructor(payload) {
|
127 | this.payload = payload;
|
128 | this.type = ProfileViewActionTypes.GET_PROFILE_SUCCEED;
|
129 | }
|
130 | }
|
131 | class GetProfileFailed {
|
132 | constructor() {
|
133 | this.type = ProfileViewActionTypes.GET_PROFILE_FAILED;
|
134 | }
|
135 | }
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 | var UserActionTypes = {
|
143 | USER_SELECTED: "[USER] USER_SELECTED",
|
144 | REFRESH_USER_INFO: "[USER] REFRESH_USER_INFO",
|
145 | };
|
146 | class RefreshUserInfoAction {
|
147 | |
148 |
|
149 |
|
150 | constructor(payload) {
|
151 | this.payload = payload;
|
152 | this.type = UserActionTypes.REFRESH_USER_INFO;
|
153 | }
|
154 | }
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 | const initialState = {
|
162 | loaded: false,
|
163 | data: new UserModel()
|
164 | };
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 | function userReducer(state = initialState, action) {
|
171 | switch (action.type) {
|
172 | case UserActionTypes.USER_SELECTED: {
|
173 | return Object.assign({}, state, { loaded: true, data: action.payload });
|
174 | }
|
175 | case UserActionTypes.REFRESH_USER_INFO: {
|
176 | return Object.assign({}, state, { loaded: true, data: action.payload });
|
177 | }
|
178 | default: {
|
179 | return state;
|
180 | }
|
181 | }
|
182 | }
|
183 |
|
184 | const getAccountInfo = (state) => state.data;
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 | var ProfileViewModel;
|
191 | (function (ProfileViewModel) {
|
192 | class Request {
|
193 | |
194 |
|
195 |
|
196 | constructor(initValue) {
|
197 | Object.keys(initValue).forEach(key => (this[key] = initValue[key]));
|
198 | }
|
199 | |
200 |
|
201 |
|
202 | getRequestBody() {
|
203 | return {};
|
204 | }
|
205 | |
206 |
|
207 |
|
208 | static get formGroup() {
|
209 | return new FormGroup({
|
210 | Username: new FormControl("", [Validators.minLength(8), Validators.required])
|
211 | });
|
212 | }
|
213 | }
|
214 | ProfileViewModel.Request = Request;
|
215 | class Response extends UserModel {
|
216 | constructor() {
|
217 | super();
|
218 | }
|
219 | }
|
220 | ProfileViewModel.Response = Response;
|
221 | })(ProfileViewModel || (ProfileViewModel = {}));
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 | var EditProfile_ApiModel;
|
228 | (function (EditProfile_ApiModel) {
|
229 | class Request {
|
230 | |
231 |
|
232 |
|
233 | constructor(initValue = /** @type {?} */ ({})) {
|
234 | Object.keys(initValue).forEach(key => (this[key] = initValue[key]));
|
235 | }
|
236 | |
237 |
|
238 |
|
239 | getRequestBody() {
|
240 | return this;
|
241 | }
|
242 | |
243 |
|
244 |
|
245 | static get formGroup() {
|
246 | return new FormGroup({
|
247 | Email: new FormControl(null, [Validators.required]),
|
248 | Roles: new FormControl(null, [Validators.required]),
|
249 | Groups: new FormControl(null, [Validators.required])
|
250 | });
|
251 | }
|
252 | }
|
253 | EditProfile_ApiModel.Request = Request;
|
254 | class Response {
|
255 | |
256 |
|
257 |
|
258 | constructor(initValue = /** @type {?} */ ({})) {
|
259 | Object.keys(initValue).forEach(key => (this[key] = initValue[key]));
|
260 | }
|
261 | |
262 |
|
263 |
|
264 | extractData() {
|
265 | return this.Result.User;
|
266 | }
|
267 | }
|
268 | EditProfile_ApiModel.Response = Response;
|
269 | })(EditProfile_ApiModel || (EditProfile_ApiModel = {}));
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 | class UserService {
|
276 | |
277 |
|
278 |
|
279 |
|
280 |
|
281 | constructor(http, store, configurationService) {
|
282 | this.http = http;
|
283 | this.store = store;
|
284 | this.configurationService = configurationService;
|
285 | this.configurationService.config$.subscribe(config => (this.config = config));
|
286 | setTimeout(() => {
|
287 | this.store.dispatch(new GetProfile());
|
288 | }, 999);
|
289 | }
|
290 | |
291 |
|
292 |
|
293 | getAccountInfo() {
|
294 | return this.configurationService.config$.pipe(filter(config => config.endpoints.profileInformation != ""), take(1), combineLatest(this.store.select(getUser)), filter(([config, user]) => user != undefined), switchMap(([config, user]) => {
|
295 | return this.http
|
296 | .get(stringTemplate(config.env[config.server] + config.endpoints.profileInformation, {
|
297 | user: user || {}
|
298 | }))
|
299 | .let(config.responseToUserInfo)
|
300 | .pipe(map((response) => {
|
301 |
|
302 | const _user = Object.assign({}, response);
|
303 | if (_user.Role) {
|
304 | _user.Roles = [_user.Role];
|
305 | }
|
306 | return _user;
|
307 | }), catchError(err => of(false)));
|
308 | }));
|
309 | }
|
310 | |
311 |
|
312 |
|
313 |
|
314 | editProfile(data) {
|
315 |
|
316 | const model = new EditProfile_ApiModel.Request(data);
|
317 | return this.http
|
318 | .put(stringTemplate(this.config.env[this.config.server] + this.config.endpoints.editProfile, model), model.getRequestBody())
|
319 | .pipe(map(response => new EditProfile_ApiModel.Response(response).extractData()));
|
320 | }
|
321 | |
322 |
|
323 |
|
324 |
|
325 | getInfo(data) {
|
326 |
|
327 | const model = new ProfileViewModel.Request(data);
|
328 | return this.http
|
329 | .get(stringTemplate(this.config.env[this.config.server] + this.config.endpoints.getAccountInfo, model))
|
330 | .pipe(map(response => response));
|
331 | }
|
332 | |
333 |
|
334 |
|
335 |
|
336 | is_role(role) {
|
337 | return this.store
|
338 | .select(getAccountInfo)
|
339 | .pipe(filter(user => user && user.Roles != undefined), take(1), map(user => user.Roles.indexOf(role) > -1));
|
340 | }
|
341 | }
|
342 | UserService.decorators = [
|
343 | { type: Injectable, args: [{
|
344 | providedIn: "root"
|
345 | },] }
|
346 | ];
|
347 |
|
348 | UserService.ctorParameters = () => [
|
349 | { type: HttpClient },
|
350 | { type: Store },
|
351 | { type: UserConfigurationService }
|
352 | ];
|
353 | UserService.ngInjectableDef = defineInjectable({ factory: function UserService_Factory() { return new UserService(inject(HttpClient), inject(Store), inject(UserConfigurationService)); }, token: UserService, providedIn: "root" });
|
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 | var EditProfileActionTypes = {
|
361 | EDIT_PROFILE: "[USER][PASSWORD] EDIT_PROFILE",
|
362 | EDIT_PROFILE_START: "[USER][PASSWORD] EDIT_PROFILE_START",
|
363 | EDIT_PROFILE_SUCCEED: "[USER][PASSWORD] EDIT_PROFILE_SUCCEED",
|
364 | EDIT_PROFILE_FAILED: "[USER][PASSWORD] EDIT_PROFILE_FAILED",
|
365 | };
|
366 | class EditProfile {
|
367 | |
368 |
|
369 |
|
370 | constructor(payload) {
|
371 | this.payload = payload;
|
372 | this.type = EditProfileActionTypes.EDIT_PROFILE;
|
373 | }
|
374 | }
|
375 | class EditProfileStart {
|
376 | |
377 |
|
378 |
|
379 | constructor(payload) {
|
380 | this.payload = payload;
|
381 | this.type = EditProfileActionTypes.EDIT_PROFILE_START;
|
382 | }
|
383 | }
|
384 | class EditProfileSucceed {
|
385 | |
386 |
|
387 |
|
388 | constructor(payload) {
|
389 | this.payload = payload;
|
390 | this.type = EditProfileActionTypes.EDIT_PROFILE_SUCCEED;
|
391 | }
|
392 | }
|
393 | class EditProfileFailed {
|
394 | constructor() {
|
395 | this.type = EditProfileActionTypes.EDIT_PROFILE_FAILED;
|
396 | }
|
397 | }
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 | class EditProfileEffects {
|
404 | |
405 |
|
406 |
|
407 |
|
408 |
|
409 | constructor(actions$, router, service) {
|
410 | this.actions$ = actions$;
|
411 | this.router = router;
|
412 | this.service = service;
|
413 | this.EditProfileRequest$ = this.actions$
|
414 | .ofType(EditProfileActionTypes.EDIT_PROFILE)
|
415 | .pipe(map(action => action.payload), map(data => new EditProfileStart(data)));
|
416 | this.RequestEditProfileLink$ = this.actions$
|
417 | .ofType(EditProfileActionTypes.EDIT_PROFILE_START)
|
418 | .pipe(map(action => action.payload), switchMap((data) => this.service.editProfile(data)), map(res => new EditProfileSucceed(res)), catchError(() => of(new EditProfileFailed())));
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 | this.goToView$ = this.actions$.ofType(EditProfileActionTypes.EDIT_PROFILE_SUCCEED).pipe(map(() => {
|
426 | this.router.navigate(["/user/profile"]);
|
427 | return new GetProfile();
|
428 | }));
|
429 | }
|
430 | }
|
431 | EditProfileEffects.decorators = [
|
432 | { type: Injectable }
|
433 | ];
|
434 |
|
435 | EditProfileEffects.ctorParameters = () => [
|
436 | { type: Actions },
|
437 | { type: Router },
|
438 | { type: UserService }
|
439 | ];
|
440 | __decorate([
|
441 | Effect(),
|
442 | __metadata("design:type", Object)
|
443 | ], EditProfileEffects.prototype, "EditProfileRequest$", void 0);
|
444 | __decorate([
|
445 | Effect(),
|
446 | __metadata("design:type", Object)
|
447 | ], EditProfileEffects.prototype, "RequestEditProfileLink$", void 0);
|
448 | __decorate([
|
449 | Effect(),
|
450 | __metadata("design:type", Object)
|
451 | ], EditProfileEffects.prototype, "goToView$", void 0);
|
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 | class ProfileViewEffects {
|
458 | |
459 |
|
460 |
|
461 |
|
462 | constructor(actions$, userService) {
|
463 | this.actions$ = actions$;
|
464 | this.userService = userService;
|
465 | this.ProfileRequest$ = this.actions$
|
466 | .ofType(ProfileViewActionTypes.GET_PROFILE)
|
467 | .pipe(map(action => action.payload), map(data => new GetProfileStart()));
|
468 | this.getProfile$ = this.actions$
|
469 | .ofType(ProfileViewActionTypes.GET_PROFILE_START)
|
470 | .pipe(map(action => action.payload), switchMap((data) => this.userService
|
471 | .getAccountInfo()
|
472 | .pipe(map(res => new GetProfileSucceed(res)), catchError(() => of(new GetProfileFailed())))));
|
473 | this.refreshUserInfo$ = this.actions$
|
474 | .ofType(ProfileViewActionTypes.GET_PROFILE_SUCCEED)
|
475 | .pipe(map(action => action.payload), map(data => new RefreshUserInfoAction(data)));
|
476 | }
|
477 | }
|
478 | ProfileViewEffects.decorators = [
|
479 | { type: Injectable }
|
480 | ];
|
481 |
|
482 | ProfileViewEffects.ctorParameters = () => [
|
483 | { type: Actions },
|
484 | { type: UserService }
|
485 | ];
|
486 | __decorate([
|
487 | Effect(),
|
488 | __metadata("design:type", Object)
|
489 | ], ProfileViewEffects.prototype, "ProfileRequest$", void 0);
|
490 | __decorate([
|
491 | Effect(),
|
492 | __metadata("design:type", Object)
|
493 | ], ProfileViewEffects.prototype, "getProfile$", void 0);
|
494 | __decorate([
|
495 | Effect(),
|
496 | __metadata("design:type", Object)
|
497 | ], ProfileViewEffects.prototype, "refreshUserInfo$", void 0);
|
498 |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 | class UserEffects {
|
504 | |
505 |
|
506 |
|
507 |
|
508 |
|
509 | constructor(actions$, router, service) {
|
510 | this.actions$ = actions$;
|
511 | this.router = router;
|
512 | this.service = service;
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 | this.getAccountInfo$ = this.actions$.ofType(SignInActionTypes.SIGNIN_SUCCEED).pipe(map(() => {
|
521 | return new GetProfile();
|
522 | }));
|
523 | this.signout$ = this.actions$
|
524 | .ofType(SignInActionTypes.SIGNOUT)
|
525 | .pipe(map(() => new RefreshUserInfoAction( ({}))));
|
526 | }
|
527 | }
|
528 | UserEffects.decorators = [
|
529 | { type: Injectable }
|
530 | ];
|
531 |
|
532 | UserEffects.ctorParameters = () => [
|
533 | { type: Actions },
|
534 | { type: Router },
|
535 | { type: UserService }
|
536 | ];
|
537 | __decorate([
|
538 | Effect(),
|
539 | __metadata("design:type", Object)
|
540 | ], UserEffects.prototype, "getAccountInfo$", void 0);
|
541 | __decorate([
|
542 | Effect(),
|
543 | __metadata("design:type", Object)
|
544 | ], UserEffects.prototype, "signout$", void 0);
|
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 |
|
551 | var ResetPasswordRequestActionTypes = {
|
552 | GET_RESET_PASSWORD_LINK: "[USER][PASSWORD] GET_RESET_PASSWORD_LINK",
|
553 | RESET_PASSWORD_LINK_REQUEST_START: "[USER][PASSWORD] RESET_PASSWORD_LINK_REQUEST_START",
|
554 | RESET_PASSWORD_LINK_REQUEST_SUCCEED: "[USER][PASSWORD] RESET_PASSWORD_LINK_REQUEST_SUCCEED",
|
555 | RESET_PASSWORD_LINK_REQUEST_FAILED: "[USER][PASSWORD] RESET_PASSWORD_LINK_REQUEST_FAILED",
|
556 | DISABLE_GET_LINK: "[USER][PASSWORD] DISABLE_GET_LINK",
|
557 | ENABLE_GET_LINK: "[USER][PASSWORD] ENABLE_GET_LINK",
|
558 | MAXIMUM_TRY_HAPPEND: "[USER][PASSWORD] MAXIMUM_TRY_HAPPEND",
|
559 | PASSWORD_CHANGED_SUCCEED: "[USER][PASSWORD] PASSWORD_CHANGED_SUCCEED",
|
560 | PASSWORD_CHANGED_FAILED: "[USER][PASSWORD] PASSWORD_CHANGED_FAILED",
|
561 | };
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 | const initialState$1 = {
|
569 | numberOfRequested: 0,
|
570 | lastRequestedTime: null,
|
571 | disable: false
|
572 | };
|
573 |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 | function reducer(state = initialState$1, action) {
|
579 | switch (action.type) {
|
580 | case ResetPasswordRequestActionTypes.GET_RESET_PASSWORD_LINK: {
|
581 | return Object.assign({}, state);
|
582 | }
|
583 | case ResetPasswordRequestActionTypes.RESET_PASSWORD_LINK_REQUEST_START: {
|
584 | return Object.assign({}, state, { numberOfRequested: state.numberOfRequested + 1, lastRequestedTime: Date.now().toString() });
|
585 | }
|
586 | case ResetPasswordRequestActionTypes.RESET_PASSWORD_LINK_REQUEST_SUCCEED: {
|
587 | return Object.assign({}, state);
|
588 | }
|
589 | case ResetPasswordRequestActionTypes.DISABLE_GET_LINK: {
|
590 | return Object.assign({}, state, { disable: true });
|
591 | }
|
592 | case ResetPasswordRequestActionTypes.ENABLE_GET_LINK: {
|
593 | return Object.assign({}, state, { disable: false });
|
594 | }
|
595 | default: {
|
596 | return state;
|
597 | }
|
598 | }
|
599 | }
|
600 |
|
601 | var getNumberOfRequeseted = (state) => state.numberOfRequested;
|
602 |
|
603 | var getStatus = (state) => state.disable;
|
604 |
|
605 |
|
606 |
|
607 |
|
608 |
|
609 |
|
610 | var ChangePasswordActionTypes = {
|
611 | CHANGE_PASSWORD: "[USER][PASSWORD] CHANGE_PASSWORD",
|
612 | PASSWORD_CHANGED_START: "[USER][PASSWORD] PASSWORD_CHANGED_START",
|
613 | PASSWORD_CHANGED_SUCCEED: "[USER][PASSWORD] PASSWORD_CHANGED_SUCCEED",
|
614 | PASSWORD_CHANGED_FAILED: "[USER][PASSWORD] PASSWORD_CHANGED_FAILED",
|
615 | };
|
616 | class ChangePassword {
|
617 | |
618 |
|
619 |
|
620 | constructor(payload) {
|
621 | this.payload = payload;
|
622 | this.type = ChangePasswordActionTypes.CHANGE_PASSWORD;
|
623 | }
|
624 | }
|
625 |
|
626 |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 | const initialState$2 = {
|
632 | status: "pristine"
|
633 | };
|
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 | function reducer$1(state = initialState$2, action) {
|
640 | switch (action.type) {
|
641 | case ChangePasswordActionTypes.CHANGE_PASSWORD: {
|
642 | return {
|
643 | status: "dirty"
|
644 | };
|
645 | }
|
646 | case ChangePasswordActionTypes.PASSWORD_CHANGED_START: {
|
647 | return {
|
648 | status: "pending"
|
649 | };
|
650 | }
|
651 | case ChangePasswordActionTypes.PASSWORD_CHANGED_SUCCEED: {
|
652 | return {
|
653 | status: "succeed"
|
654 | };
|
655 | }
|
656 | case ChangePasswordActionTypes.PASSWORD_CHANGED_FAILED: {
|
657 | return {
|
658 | status: "failed"
|
659 | };
|
660 | }
|
661 | default: {
|
662 | return initialState$2;
|
663 | }
|
664 | }
|
665 | }
|
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 | const initialState$3 = {
|
673 | status: "pristine"
|
674 | };
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 | function reducer$2(state = initialState$3, action) {
|
681 | switch (action.type) {
|
682 | case EditProfileActionTypes.EDIT_PROFILE: {
|
683 | return {
|
684 | status: "dirty"
|
685 | };
|
686 | }
|
687 | case EditProfileActionTypes.EDIT_PROFILE_START: {
|
688 | return {
|
689 | status: "pending"
|
690 | };
|
691 | }
|
692 | case EditProfileActionTypes.EDIT_PROFILE_SUCCEED: {
|
693 | return {
|
694 | status: "succeed"
|
695 | };
|
696 | }
|
697 | case EditProfileActionTypes.EDIT_PROFILE_FAILED: {
|
698 | return {
|
699 | status: "failed"
|
700 | };
|
701 | }
|
702 | default: {
|
703 | return state;
|
704 | }
|
705 | }
|
706 | }
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 | var SearchActionTypes = {
|
714 | SEARCH: "[USER][SEARCH] SEARCH",
|
715 | SEARCH_START: "[USER][SEARCH] SEARCH_START",
|
716 | SEARCH_SUCCEED: "[USER][SEARCH] SEARCH_SUCCEED",
|
717 | SEARCH_FAILED: "[USER][SEARCH] SEARCH_FAILED",
|
718 | CLEAR_SEARCHED_USER: "[USER][SEARCH] CLEAR_SEARCHED_USER",
|
719 | };
|
720 | class Search {
|
721 | |
722 |
|
723 |
|
724 | constructor(payload) {
|
725 | this.payload = payload;
|
726 | this.type = SearchActionTypes.SEARCH;
|
727 | }
|
728 | }
|
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 | const initialState$4 = {
|
736 | status: "pristine",
|
737 | data: ({})
|
738 | };
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 | function reducer$3(state = initialState$4, action) {
|
745 | switch (action.type) {
|
746 | case SearchActionTypes.SEARCH: {
|
747 | return Object.assign({}, state, { status: "dirty", data: new ProfileViewModel.Response() });
|
748 | }
|
749 | case SearchActionTypes.SEARCH_START: {
|
750 | return Object.assign({}, state, { status: "pending" });
|
751 | }
|
752 | case SearchActionTypes.SEARCH_SUCCEED: {
|
753 | return Object.assign({}, state, { status: "succeed", data: action.payload });
|
754 | }
|
755 | case SearchActionTypes.SEARCH_FAILED: {
|
756 | return Object.assign({}, state, { status: "failed" });
|
757 | }
|
758 | case SearchActionTypes.CLEAR_SEARCHED_USER: {
|
759 | return initialState$4;
|
760 | }
|
761 | default: {
|
762 | return state;
|
763 | }
|
764 | }
|
765 | }
|
766 |
|
767 | var getStatus$3 = (state) => state.status;
|
768 |
|
769 |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 | const UserReducers = {
|
775 | user: userReducer,
|
776 | resetPasswordRequest: reducer,
|
777 | changePassword: reducer$1,
|
778 | searchView: reducer$3,
|
779 | editProfile: reducer$2
|
780 | };
|
781 |
|
782 | const selectFeatureState = createFeatureSelector("user");
|
783 |
|
784 | const getUserInforamtionStatus = createSelector(selectFeatureState, (state) => state.user.loaded);
|
785 |
|
786 | const isSignedIn = createSelector(selectFeatureState, (state) => state.user.loaded);
|
787 |
|
788 | const selectResetPasswordRequestState = createSelector(selectFeatureState, (state) => state.resetPasswordRequest);
|
789 |
|
790 | const getNumberOfRequeseted$1 = createSelector(selectResetPasswordRequestState, getNumberOfRequeseted);
|
791 |
|
792 | const getResetPasswordRequestStatus = createSelector(selectResetPasswordRequestState, getStatus);
|
793 |
|
794 | const selectUserInformaionState = createSelector(selectFeatureState, (state) => state.user);
|
795 |
|
796 | const getAccountInfo$2 = createSelector(selectUserInformaionState, getAccountInfo);
|
797 |
|
798 | const selectSearchState = createSelector(selectFeatureState, (state) => state.searchView);
|
799 |
|
800 | const getSearchStatus = createSelector(selectSearchState, getStatus$3);
|
801 |
|
802 |
|
803 |
|
804 |
|
805 |
|
806 |
|
807 | class SearchComponent {
|
808 | |
809 |
|
810 |
|
811 | constructor(store) {
|
812 | this.store = store;
|
813 | this.formGroup = ProfileViewModel.Request.formGroup;
|
814 | this.userDataLoaded$ = new BehaviorSubject$1(false);
|
815 | this.userNotFound$ = new BehaviorSubject$1(false);
|
816 | this.user = this.store.select(getAccountInfo$2);
|
817 | this.userStatus$ = this.store.select(getSearchStatus);
|
818 | }
|
819 | |
820 |
|
821 |
|
822 | ngOnInit() {
|
823 | this.userStatus$.subscribe(value => this.userDataLoaded$.next(!"pristine|dirty|pending".includes(value)));
|
824 | }
|
825 | |
826 |
|
827 |
|
828 | search() {
|
829 | if (!this.formGroup.valid)
|
830 | return;
|
831 | this.store.dispatch(new Search(this.formGroup.value));
|
832 | }
|
833 | }
|
834 | SearchComponent.decorators = [
|
835 | { type: Component, args: [{
|
836 | selector: "search",
|
837 | template: "<mat-card fxFlex=\"450px\" *ngIf=\"(userStatus$ | async) == 'succeed'\">\r\n <mat-card-header>\r\n <mat-card-title>\r\n <div fxLayout=\"row\" fxLayoutAlign=\"space-between\">\r\n <div fxFlex=\"nogrow\">\r\n <!-- {{(user | async).LastName }}\u060C {{(user | async).FirstName }} -->\r\n </div>\r\n <div fxFlex=\"nogrow\">\r\n <!-- {{(user | async).Email}} -->\r\n </div>\r\n </div>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <div>\r\n <div class='list-item' fxFlexLayout='row' fxLayoutAlign='center center'>\r\n <mat-icon fxFlex='nogrow'>local_grocery_store</mat-icon>\r\n <div fxFlex='15px'></div>\r\n <p fxFlex='40'>\u0634\u0646\u0627\u0633\u0647</p>\r\n <!-- <p fxFlex='60' fxLayoutAlign=\"end\">{{(user | async)._id }}</p> -->\r\n </div>\r\n <div class='list-item' fxFlexLayout='row' fxLayoutAlign='center center'>\r\n <mat-icon fxFlex='nogrow'>email</mat-icon>\r\n <div fxFlex='15px'></div>\r\n <p fxFlex='40'>\u067E\u0633\u062A \u0627\u0644\u06A9\u062A\u0631\u0648\u0646\u06CC\u06A9\u06CC</p>\r\n <!-- <p fxFlex='60' fxLayoutAlign=\"end\">{{(user | async).Email }}</p> -->\r\n </div>\r\n </div>\r\n\r\n </mat-card-content>\r\n</mat-card>",
|
838 | styles: [""]
|
839 | }] }
|
840 | ];
|
841 |
|
842 | SearchComponent.ctorParameters = () => [
|
843 | { type: Store }
|
844 | ];
|
845 |
|
846 |
|
847 |
|
848 |
|
849 |
|
850 | class ChangePasswordComponent {
|
851 | constructor() {
|
852 | this.submited = new EventEmitter();
|
853 | }
|
854 | |
855 |
|
856 |
|
857 | ngOnInit() { }
|
858 | |
859 |
|
860 |
|
861 | submit() { }
|
862 | |
863 |
|
864 |
|
865 | changePassword() {
|
866 | if (!this.formGroup.valid)
|
867 | return;
|
868 | this.submited.emit(this.formGroup.value);
|
869 | }
|
870 | }
|
871 | ChangePasswordComponent.decorators = [
|
872 | { type: Component, args: [{
|
873 | selector: "user-change-password",
|
874 | template: "<div fxFlex=\"450px\">\r\n <form [formGroup]=\"formGroup\" (ngSubmit)=\"changePassword()\" fxLayout=\"column\">\r\n <mat-card>\r\n <mat-card-content>\r\n <mat-form-field fxFlexFill>\r\n <input type=\"password\" matInput placeholder=\"\u06A9\u0644\u0645\u0647 \u0639\u0628\u0648\u0631\" formControlName=\"Password\">\r\n </mat-form-field>\r\n <mat-form-field fxFlexFill>\r\n <input type=\"password\" matInput placeholder=\"\u062A\u06A9\u0631\u0627\u0631 \u06A9\u0644\u0645\u0647 \u0639\u0628\u0648\u0631\" formControlName=\"Confirm\">\r\n </mat-form-field>\r\n </mat-card-content>\r\n <mat-card-actions fxLayoutAlign=\"center center\">\r\n <button fxFlex=\"nogrow\" type=\"submit\" mat-raised-button color=\"primary\">\u062A\u063A\u06CC\u06CC\u0631 \u0631\u0645\u0632 \u0639\u0628\u0648\u0631</button>\r\n <button fxFlex=\"nogrow\" type=\"button\" routerLink=\"/user/panel\" mat-raised-button>\u0628\u0627\u0632\u06AF\u0634\u062A</button>\r\n </mat-card-actions>\r\n </mat-card>\r\n </form>\r\n</div>",
|
875 | styles: [""]
|
876 | }] }
|
877 | ];
|
878 |
|
879 | ChangePasswordComponent.ctorParameters = () => [];
|
880 | ChangePasswordComponent.propDecorators = {
|
881 | formGroup: [{ type: Input }],
|
882 | submited: [{ type: Output }]
|
883 | };
|
884 |
|
885 |
|
886 |
|
887 |
|
888 |
|
889 | class ProfileEditComponent {
|
890 | |
891 |
|
892 |
|
893 | constructor(router) {
|
894 | this.router = router;
|
895 | this.submited = new EventEmitter();
|
896 | }
|
897 | |
898 |
|
899 |
|
900 | ngOnInit() { }
|
901 | |
902 |
|
903 |
|
904 |
|
905 | editProfile(form) {
|
906 | if (!form.valid)
|
907 | return;
|
908 | this.submited.emit(form.value);
|
909 | }
|
910 | |
911 |
|
912 |
|
913 | goback() {
|
914 | this.router.navigate([".."]);
|
915 | }
|
916 | }
|
917 | ProfileEditComponent.decorators = [
|
918 | { type: Component, args: [{
|
919 | selector: "profile-edit",
|
920 | template: "<div fxFlex=\"450px\">\r\n\r\n \r\n <ngs-form-view #form [id]=\"formId\" [card]=\"true\" (accept)=\"editProfile(form.formGroup)\" (cancel)=\"goback()\" ></ngs-form-view>\r\n <!-- <form [formGroup]=\"formGroup\" (ngSubmit)=\"editProfile()\" fxLayout=\"column\">\r\n <mat-card>\r\n <mat-card-content>\r\n </mat-card-content>\r\n <mat-card-actions align=\"end\">\r\n <button type=\"button\" routerLink=\"..\" mat-button color=\"primary\">\u0628\u0627\u0632\u06AF\u0634\u062A</button>\r\n <button type=\"submit\" mat-raised-button color=\"primary\">\u0648\u06CC\u0631\u0627\u06CC\u0634</button>\r\n </mat-card-actions>\r\n </mat-card>\r\n </form> -->\r\n</div>"
|
921 | }] }
|
922 | ];
|
923 |
|
924 | ProfileEditComponent.ctorParameters = () => [
|
925 | { type: Router }
|
926 | ];
|
927 | ProfileEditComponent.propDecorators = {
|
928 | submited: [{ type: Output }],
|
929 | userInfo: [{ type: Input }],
|
930 | formId: [{ type: Input }],
|
931 | roles$: [{ type: Input, args: ["roles",] }],
|
932 | groups: [{ type: Input }]
|
933 | };
|
934 |
|
935 |
|
936 |
|
937 |
|
938 |
|
939 | class DashboardLinksComponent {
|
940 | |
941 |
|
942 |
|
943 |
|
944 | constructor(userConfigurationService, store) {
|
945 | this.userConfigurationService = userConfigurationService;
|
946 | this.store = store;
|
947 | this.links$ = this.userConfigurationService.config$.pipe(map(data => data.dashboardLinks));
|
948 | this.links = [
|
949 | {
|
950 | title: "مشاهده حساب کاربری",
|
951 | route: "/user/panel/profile",
|
952 |
|
953 | icon: "person"
|
954 | }
|
955 | ];
|
956 | }
|
957 | |
958 |
|
959 |
|
960 | ngAfterViewInit() { }
|
961 | }
|
962 | DashboardLinksComponent.decorators = [
|
963 | { type: Component, args: [{
|
964 | selector: "user-dashboard-links",
|
965 | template: "<div fxLayout='row' fxLayoutWrap id=\"con\">\r\n <button fxFlex=\"31\" class='link' mat-raised-button [routerLink]='link.route' *ngFor='let link of links'>\r\n <div fxLayout='column' fxLayoutAlign='center center'>\r\n <mat-icon color='primary'>{{link.icon}}</mat-icon>\r\n <h3 class='title'>{{link.title}}</h3>\r\n <div class='description'>{{link.description}}</div>\r\n </div>\r\n </button>\r\n <button fxFlex=\"31\" class='link' mat-raised-button [routerLink]='link.route' *ngFor='let link of links$ | async'>\r\n <div fxLayout='column' fxLayoutAlign='center center'>\r\n <mat-icon color='primary'>{{link.icon}}</mat-icon>\r\n <h3 class='title'>{{link.title}}</h3>\r\n <div class='description'>{{link.description}}</div>\r\n </div>\r\n </button>\r\n</div>",
|
966 | styles: ["#con [fxflex]{margin-right:25px}:host{width:100%;padding:25px 25px 0}button mat-icon{font-size:48px;width:48px;height:48px}button.link{padding:25px 15px;margin-bottom:25px}.title{margin-top:0;margin-bottom:5px}.description{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:90%}"]
|
967 | }] }
|
968 | ];
|
969 |
|
970 | DashboardLinksComponent.ctorParameters = () => [
|
971 | { type: UserConfigurationService },
|
972 | { type: Store }
|
973 | ];
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 | class ResetPasswordRequestComponent {
|
980 | |
981 |
|
982 |
|
983 | constructor(snackBar) {
|
984 | this.snackBar = snackBar;
|
985 | this.submitted = new EventEmitter();
|
986 | this.maximumResendingHappend$ = new BehaviorSubject(false);
|
987 | this.timer$ = Observable.timer(0, 100).pipe(map(i => i + 1), takeWhile(i => i * 100 <= 3000), map(i => 3000 - i * 100));
|
988 | }
|
989 | |
990 |
|
991 |
|
992 |
|
993 | set pending(isPending) {
|
994 | if (isPending) {
|
995 | this.formGroup.disable();
|
996 | }
|
997 | this.formGroup.enable();
|
998 | }
|
999 | |
1000 |
|
1001 |
|
1002 | ngOnInit() {
|
1003 | this.numberOfRequested.subscribe(data => {
|
1004 | if (data > 2) {
|
1005 | this.maximumResendingHappend$.next(true);
|
1006 | }
|
1007 | });
|
1008 | }
|
1009 | |
1010 |
|
1011 |
|
1012 | submit() {
|
1013 | if (this.formGroup.valid) {
|
1014 | this.submitted.emit(this.formGroup.value);
|
1015 |
|
1016 | let message = this.maximumResendingHappend$.getValue()
|
1017 | ? "عدم امکان ..."
|
1018 | : "پیامک جدید برای شما ارسال گردید.";
|
1019 | this.snackBar.open(message, "", {
|
1020 | duration: 3000
|
1021 | });
|
1022 | }
|
1023 | }
|
1024 | }
|
1025 | ResetPasswordRequestComponent.decorators = [
|
1026 | { type: Component, args: [{
|
1027 | selector: "user-reset-password-request",
|
1028 | template: "<form [formGroup]=\"formGroup\" (ngSubmit)=\"submit()\" fxLayout=\"column\">\r\n <mat-card>\r\n <mat-card-header>\r\n <mat-card-title>\r\n <h3>\u062F\u0631\u062E\u0648\u0627\u0633\u062A \u0628\u0627\u0632\u06CC\u0627\u0628\u06CC \u0631\u0645\u0632 \u0639\u0628\u0648\u0631</h3>\r\n </mat-card-title>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <p>\u0628\u0631\u0627\u06CC \u0628\u0627\u0632\u06CC\u0627\u0628\u06CC \u0631\u0645\u0632 \u0639\u0628\u0648\u0631 \u0634\u0645\u0627\u0631\u0647 \u062A\u0644\u0641\u0646 \u062E\u0648\u062F \u0631\u0627 \u0648\u0627\u0631\u062F \u0646\u0645\u0627\u06CC\u06CC\u062F</p>\r\n <mat-radio-group fxFlexFill formControlName=\"Type\">\r\n <mat-radio-button value=\"sms\">\u067E\u06CC\u0627\u0645\u06A9</mat-radio-button>\r\n <mat-radio-button value=\"email\">\u067E\u0633\u062A \u0627\u0644\u06A9\u062A\u0631\u0648\u0646\u06CC\u06A9\u06CC</mat-radio-button>\r\n </mat-radio-group>\r\n <mat-form-field fxFlexFill>\r\n <input matInput placeholder=\"\u0634\u0645\u0627\u0631\u0647 \u062A\u0644\u0641\u0646 \u0647\u0645\u0631\u0627\u0647\" formControlName=\"Username\">\r\n </mat-form-field>\r\n </mat-card-content>\r\n <mat-card-actions>\r\n <!--<button type=\"submit\" [disabled]='(canRequestPin | async) || (maximumResendingHappend$ | async)' (click)=\"submit()\" mat-raised-button color=\"primary\">-->\r\n <button type=\"submit\" [disabled]='(canRequestPin | async)' (click)=\"submit()\" mat-raised-button color=\"primary\">\r\n <span *ngIf='!(canRequestPin | async)'>\r\n \u0628\u0627\u0632\u06CC\u0627\u0628\u06CC \u0631\u0645\u0632 \u0639\u0628\u0648\u0631\r\n </span>\r\n <!--<div *ngIf='(canRequestPin | async) && !(maximumResendingHappend$ | async)'>\r\n {{timer$ | async}} \u062B\u0627\u0646\u06CC\u0647 \u062A\u0627 \u0627\u0645\u06A9\u0627\u0646 \u062F\u0631 \u062E\u0648\u0627\u0633\u062A \u062F\u0648\u0628\u0627\u0631\u0647 \u062F\u0631\u06CC\u0627\u0641\u062A \u067E\u06CC\u0627\u0645\u06A9.\r\n </div>\r\n <div *ngIf='(maximumResendingHappend$ | async)'>\r\n \u0639\u062F\u0645 \u0627\u0645\u06A9\u0627\u0646 \u062F\u0631\u062E\u0648\u0627\u0633\u062A\r\n </div>-->\r\n </button>\r\n <a mat-button routerLink='/auth/signin'>\u0627\u0646\u0635\u0631\u0627\u0641</a>\r\n </mat-card-actions>\r\n </mat-card>\r\n</form>\r\n",
|
1029 | styles: [""]
|
1030 | }] }
|
1031 | ];
|
1032 |
|
1033 | ResetPasswordRequestComponent.ctorParameters = () => [
|
1034 | { type: MatSnackBar }
|
1035 | ];
|
1036 | ResetPasswordRequestComponent.propDecorators = {
|
1037 | submitted: [{ type: Output }],
|
1038 | formGroup: [{ type: Input }],
|
1039 | numberOfRequested: [{ type: Input }],
|
1040 | canRequestPin: [{ type: Input }],
|
1041 | pending: [{ type: Input }]
|
1042 | };
|
1043 |
|
1044 |
|
1045 |
|
1046 |
|
1047 |
|
1048 | class FeatureContainerComponent {
|
1049 | |
1050 |
|
1051 |
|
1052 |
|
1053 | constructor(route, store) {
|
1054 | this.route = route;
|
1055 | this.store = store;
|
1056 | this.route.params.subscribe(params => {
|
1057 |
|
1058 | let model = new ProfileViewModel.Request( ({ Email: params["Email"] }));
|
1059 | this.store.dispatch(new Search(model));
|
1060 | });
|
1061 | }
|
1062 | }
|
1063 | FeatureContainerComponent.decorators = [
|
1064 | { type: Component, args: [{
|
1065 | template: "<router-outlet></router-outlet>"
|
1066 | }] }
|
1067 | ];
|
1068 |
|
1069 | FeatureContainerComponent.ctorParameters = () => [
|
1070 | { type: ActivatedRoute },
|
1071 | { type: Store }
|
1072 | ];
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 | var ChangePasswordModel;
|
1079 | (function (ChangePasswordModel) {
|
1080 | class Request {
|
1081 | |
1082 |
|
1083 |
|
1084 | constructor(initValue = /** @type {?} */ ({})) {
|
1085 | Object.keys(initValue).forEach(key => (this[key] = initValue[key]));
|
1086 | }
|
1087 | |
1088 |
|
1089 |
|
1090 | getRequestBody() {
|
1091 | return {
|
1092 | Password: this.Password
|
1093 | };
|
1094 | }
|
1095 | |
1096 |
|
1097 |
|
1098 | static get formGroup() {
|
1099 | return new FormGroup({
|
1100 | Password: new FormControl(null, [Validators.required, Validators.minLength(7)]),
|
1101 | Confirm: new FormControl(null, [Validators.required, MatchValidator("Password")])
|
1102 | });
|
1103 | }
|
1104 | }
|
1105 | ChangePasswordModel.Request = Request;
|
1106 | class Response {
|
1107 | constructor() { }
|
1108 | }
|
1109 | ChangePasswordModel.Response = Response;
|
1110 | })(ChangePasswordModel || (ChangePasswordModel = {}));
|
1111 |
|
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 | class ChangePasswordContainerComponent {
|
1117 | |
1118 |
|
1119 |
|
1120 |
|
1121 | constructor(route, store) {
|
1122 | this.route = route;
|
1123 | this.store = store;
|
1124 | this.formGroup = ChangePasswordModel.Request.formGroup;
|
1125 | this.ChangePasswordModel = new ChangePasswordModel.Request();
|
1126 | }
|
1127 | |
1128 |
|
1129 |
|
1130 | ngOnInit() {
|
1131 | this.store.select(getAccountInfo$2).subscribe(userInfo => {
|
1132 | if (!userInfo)
|
1133 | return;
|
1134 |
|
1135 |
|
1136 | });
|
1137 | }
|
1138 | |
1139 |
|
1140 |
|
1141 |
|
1142 | changePassword(event) {
|
1143 | this.ChangePasswordModel.Password = this.formGroup.get("Password").value;
|
1144 | this.store.dispatch(new ChangePassword(this.ChangePasswordModel));
|
1145 | }
|
1146 | }
|
1147 | ChangePasswordContainerComponent.decorators = [
|
1148 | { type: Component, args: [{
|
1149 | template: `<user-change-password
|
1150 | (submited)='changePassword($event)'
|
1151 | [formGroup]="formGroup"
|
1152 | ></user-change-password>`
|
1153 | }] }
|
1154 | ];
|
1155 |
|
1156 | ChangePasswordContainerComponent.ctorParameters = () => [
|
1157 | { type: ActivatedRoute },
|
1158 | { type: Store }
|
1159 | ];
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 | class ProfileEditContainerComponent {
|
1166 | |
1167 |
|
1168 |
|
1169 |
|
1170 | constructor(store, configService) {
|
1171 | this.store = store;
|
1172 | this.configService = configService;
|
1173 | this.userInforamation$ = this.store.select(getAccountInfo$2);
|
1174 | this.roles$ = this.store
|
1175 | .select(getAppConfig)
|
1176 | .pipe(filter(config => config != undefined), map(config => config.Config.Roles));
|
1177 |
|
1178 |
|
1179 | this.groups = of(["test1", "test2"]);
|
1180 | this.config$ = this.configService.config$;
|
1181 | }
|
1182 | |
1183 |
|
1184 |
|
1185 | ngOnInit() { }
|
1186 | |
1187 |
|
1188 |
|
1189 |
|
1190 | updateProfile(data) {
|
1191 | this.store.dispatch(new EditProfile(data));
|
1192 | }
|
1193 | }
|
1194 | ProfileEditContainerComponent.decorators = [
|
1195 | { type: Component, args: [{
|
1196 | selector: "profile-edit-contianer",
|
1197 | template: `<profile-edit
|
1198 | (submited)='updateProfile($event)'
|
1199 | [userInfo]="userInforamation$ | async"
|
1200 | [roles]="roles$"
|
1201 | [groups]="groups | async"
|
1202 | [formId]="(config$|async)?.forms.profile_edit"
|
1203 | ></profile-edit>`
|
1204 | }] }
|
1205 | ];
|
1206 |
|
1207 | ProfileEditContainerComponent.ctorParameters = () => [
|
1208 | { type: Store },
|
1209 | { type: UserConfigurationService }
|
1210 | ];
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 |
|
1216 | class DashboardContainerComponent {
|
1217 | |
1218 |
|
1219 |
|
1220 | constructor(store) {
|
1221 | this.store = store;
|
1222 | this.user$ = this.store.select(getAccountInfo);
|
1223 |
|
1224 | }
|
1225 | |
1226 |
|
1227 |
|
1228 | ngOnInit() { }
|
1229 | }
|
1230 | DashboardContainerComponent.decorators = [
|
1231 | { type: Component, args: [{
|
1232 | selector: "user-dashboard-container",
|
1233 | template: "<!-- <router-outlet name=\"links\"></router-outlet> -->\r\n<div fxLayoutAlign=\"center\">\r\n <router-outlet></router-outlet>\r\n</div>",
|
1234 | styles: ["#box-left{background:#fff}#box-bottom{background:#2b0033}#box-right{background:#000833;padding-top:10px!important;padding-bottom:10px!important}#box-right div{background:#fff;opacity:.5}#banner:not(.active){height:100%;-webkit-filter:grayscale(100%) brightness(1.5) opacity(.2) blur(2px);filter:grayscale(100%) brightness(1.5) opacity(.2) blur(2px)}#s1{background:#aaa}#s2{background:#bbb}#s3{background:#ccc}.personal-info{background-color:rgba(255,255,255,.5);position:relative;right:10%;width:90%;height:469px}.personal-info h2{color:#00bcd4;font-weight:400;font-size:24px;font-family:iran-sans-light!important}.personal-info h6{font-weight:400;font-size:12px;float:right;width:50%;margin:0;color:#555;border-bottom:2px solid #ececec}.personal-info p{float:right;width:30%;margin:0;font-size:13px;padding-right:30px;border-bottom:2px solid #ececec}.personal-info div{width:100%;height:50px;position:relative;line-height:52px;right:17px}.quick-box{width:100%;height:50px;position:relative;line-height:52px;padding-top:79px}.quick-btn{background-color:#00bcd4;margin:12px 10px;height:100px;text-align:center;line-height:100px;font-size:17px;color:#fff}.banner-section{text-align:center}.info-section{padding:60px 25px 10px;background-color:#f7f7f7;background-image:url(https://www.toptal.com/designers/subtlepatterns/patterns/grey.png)!important;height:1040px;padding-bottom:120px!important}"]
|
1235 | }] }
|
1236 | ];
|
1237 |
|
1238 | DashboardContainerComponent.ctorParameters = () => [
|
1239 | { type: Store }
|
1240 | ];
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 | class ProfileComponent {
|
1247 | constructor() {
|
1248 | this.info = [];
|
1249 | }
|
1250 | |
1251 |
|
1252 |
|
1253 |
|
1254 | set information(information) {
|
1255 | if (!information)
|
1256 | return;
|
1257 | Object.keys(information).forEach(k => this.info.push([k, information[k]]));
|
1258 | }
|
1259 | |
1260 |
|
1261 |
|
1262 | ngOnInit() { }
|
1263 | }
|
1264 | ProfileComponent.decorators = [
|
1265 | { type: Component, args: [{
|
1266 | selector: "user-profile",
|
1267 | template: "<div fxFlex=\"450px\">\r\n <router-outlet name=\"ngs-user-profile-view\"></router-outlet>\r\n <router-outlet></router-outlet>\r\n <!-- <mat-card>\r\n <mat-card-header>\r\n <mat-card-title>\u0627\u0637\u0644\u0627\u0639\u0627\u062A \u067E\u0631\u0648\u0641\u0627\u06CC\u0644</mat-card-title>\r\n </mat-card-header>\r\n <mat-card-content *ngIf='dataStatus$ | async'>\r\n <div class='list-item' fxFlexLayout='row' *ngFor=\"let item of info\">\r\n <p fxFlex='40'>{{item[0]}}</p>\r\n <p fxFlex='60'>{{item[1]}}</p>\r\n </div>\r\n \r\n </mat-card-content>\r\n\r\n <mat-card-actions align=\"end\">\r\n <button mat-button color=\"primary\" routerLink='..'>\u0628\u0627\u0632\u06AF\u0634\u062A</button>\r\n <button mat-raised-button color=\"primary\" routerLink='edit'>\u0648\u06CC\u0631\u0627\u06CC\u0634</button>\r\n </mat-card-actions>\r\n </mat-card> -->\r\n</div>\r\n\r\n\r\n\r\n<!-- <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u0627\u06CC\u0645\u06CC\u0644</p>\r\n <p fxFlex='60'>{{(information | async).Email}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>roles</p>\r\n <p fxFlex='60'>{{(information | async).Roles | json}}</p>\r\n </div> -->\r\n<!-- <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u0646\u0627\u0645</p>\r\n <p fxFlex='60'>{{(userInformation | async).FirstName}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u0646\u0627\u0645 \u062E\u0627\u0646\u0648\u0627\u062F\u06AF\u06CC</p>\r\n <p fxFlex='60'>{{(userInformation | async).LastName}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u0646\u0627\u0645 \u06A9\u0627\u0631\u0628\u0631\u06CC</p>\r\n <p fxFlex='60'>{{(userInformation | async).Username}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u062A\u0644\u0641\u0646 \u0647\u0645\u0631\u0627\u0647</p>\r\n <p fxFlex='60'>{{(userInformation | async).MobileNumber | persianNumber}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u062C\u0646\u0633\u06CC\u062A</p>\r\n <p fxFlex='60'>{{sex$ | async}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u062A\u0627\u0631\u06CC\u062E \u062A\u0648\u0644\u062F</p>\r\n <p fxFlex='60'>{{(userInformation | async).Birthdate | persianDate : false}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u0627\u06CC\u0645\u06CC\u0644</p>\r\n <p fxFlex='60'>{{(userInformation | async).Email}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>{{(identifierType$ | async)}}</p>\r\n <p fxFlex='60'>{{(userInformation | async).IdentificationNo | persianNumber}}</p>\r\n </div>\r\n <div class='list-item' fxFlexLayout='row'>\r\n <p fxFlex='40'>\u062A\u0627\u0631\u06CC\u062E \u0639\u0636\u0648\u06CC\u062A</p>\r\n <p fxFlex='60'>{{(userInformation | async).RegisterDate | persianDate}}</p>\r\n </div> -->",
|
1268 | styles: [""]
|
1269 | }] }
|
1270 | ];
|
1271 |
|
1272 | ProfileComponent.ctorParameters = () => [];
|
1273 | ProfileComponent.propDecorators = {
|
1274 | information: [{ type: Input }],
|
1275 | dataStatus$: [{ type: Input }]
|
1276 | };
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 | class ProfileContainerComponent {
|
1283 | |
1284 |
|
1285 |
|
1286 | constructor(store) {
|
1287 | this.store = store;
|
1288 | this.data$ = this.store.select(getAccountInfo$2);
|
1289 | this.dataStatus$ = this.store.select(getUserInforamtionStatus);
|
1290 | }
|
1291 | |
1292 |
|
1293 |
|
1294 | ngOnInit() { }
|
1295 | }
|
1296 | ProfileContainerComponent.decorators = [
|
1297 | { type: Component, args: [{
|
1298 | template: `<user-profile
|
1299 | [information]="data$ | async"
|
1300 | [dataStatus$]='dataStatus$'
|
1301 | ></user-profile>`
|
1302 | }] }
|
1303 | ];
|
1304 |
|
1305 | ProfileContainerComponent.ctorParameters = () => [
|
1306 | { type: Store }
|
1307 | ];
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 | class NgsUserModule {
|
1314 | |
1315 |
|
1316 |
|
1317 |
|
1318 | static forRoot(config) {
|
1319 | return {
|
1320 | ngModule: RootNgsUserModule,
|
1321 | providers: [{ provide: MODULE_CONFIG_TOKEN, useValue: config }]
|
1322 | };
|
1323 | }
|
1324 | }
|
1325 | NgsUserModule.decorators = [
|
1326 | { type: NgModule, args: [{
|
1327 | imports: [
|
1328 | HttpClientModule,
|
1329 | FormsModule,
|
1330 | RouterModule,
|
1331 | CommonModule,
|
1332 | MatExpansionModule,
|
1333 | MatSnackBarModule,
|
1334 | MatIconModule,
|
1335 | MatButtonModule,
|
1336 | MatCardModule,
|
1337 | MatSelectModule,
|
1338 | MatInputModule,
|
1339 | MatFormFieldModule,
|
1340 | MatTabsModule,
|
1341 | FlexLayoutModule,
|
1342 | MatRadioModule,
|
1343 | ReactiveFormsModule,
|
1344 | BrowserAnimationsModule,
|
1345 | NgsFormModule
|
1346 | ],
|
1347 | declarations: [
|
1348 | SearchComponent,
|
1349 | ProfileComponent,
|
1350 | ChangePasswordComponent,
|
1351 | ProfileEditComponent,
|
1352 | ProfileContainerComponent,
|
1353 | DashboardLinksComponent,
|
1354 | ResetPasswordRequestComponent,
|
1355 | FeatureContainerComponent,
|
1356 | DashboardContainerComponent,
|
1357 | ChangePasswordContainerComponent,
|
1358 | ProfileEditContainerComponent
|
1359 | ],
|
1360 | exports: []
|
1361 | },] }
|
1362 | ];
|
1363 | class RootNgsUserModule {
|
1364 | }
|
1365 | RootNgsUserModule.decorators = [
|
1366 | { type: NgModule, args: [{
|
1367 | imports: [
|
1368 | NgsUserModule,
|
1369 | StoreModule.forFeature("user", UserReducers),
|
1370 | EffectsModule.forFeature([
|
1371 | EditProfileEffects,
|
1372 | ProfileViewEffects,
|
1373 | UserEffects
|
1374 | ])
|
1375 | ]
|
1376 | },] }
|
1377 | ];
|
1378 |
|
1379 |
|
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 | const routes = [
|
1385 | {
|
1386 | path: "user/panel",
|
1387 | component: DashboardContainerComponent,
|
1388 | children: [
|
1389 | {
|
1390 | path: "",
|
1391 | component: DashboardLinksComponent
|
1392 | },
|
1393 | {
|
1394 | path: "profile",
|
1395 | component: ProfileContainerComponent
|
1396 | },
|
1397 | {
|
1398 | path: "profile/edit",
|
1399 | component: ProfileEditContainerComponent
|
1400 | }
|
1401 | ]
|
1402 | },
|
1403 | {
|
1404 | path: "admin/user",
|
1405 | children: [
|
1406 |
|
1407 | {
|
1408 | path: ":Email",
|
1409 | component: FeatureContainerComponent,
|
1410 | children: [
|
1411 | {
|
1412 | path: "profile-edit",
|
1413 | component: ProfileEditContainerComponent
|
1414 | }
|
1415 | ]
|
1416 | }
|
1417 | ]
|
1418 | }
|
1419 | ];
|
1420 |
|
1421 | const NgsUserRoutingModule = RouterModule.forChild(routes);
|
1422 |
|
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 |
|
1428 | var NgsUserModuleOutlets = {
|
1429 | ngs_user_profile_view: "ngs-user-profile-view",
|
1430 | };
|
1431 |
|
1432 |
|
1433 |
|
1434 |
|
1435 |
|
1436 | class UserFacadeService {
|
1437 | |
1438 |
|
1439 |
|
1440 |
|
1441 | constructor(store, configService) {
|
1442 | this.store = store;
|
1443 | this.configService = configService;
|
1444 | }
|
1445 | |
1446 |
|
1447 |
|
1448 | getDisplayName() {
|
1449 | return this.store.select(getAccountInfo$2).let(this.configService.config$.getValue().mapUserDisplayName);
|
1450 |
|
1451 | }
|
1452 | |
1453 |
|
1454 |
|
1455 | getInfo() {
|
1456 | return this.store.select(getAccountInfo$2);
|
1457 | }
|
1458 | }
|
1459 | UserFacadeService.decorators = [
|
1460 | { type: Injectable, args: [{
|
1461 | providedIn: "root"
|
1462 | },] }
|
1463 | ];
|
1464 |
|
1465 | UserFacadeService.ctorParameters = () => [
|
1466 | { type: Store },
|
1467 | { type: UserConfigurationService }
|
1468 | ];
|
1469 | UserFacadeService.ngInjectableDef = defineInjectable({ factory: function UserFacadeService_Factory() { return new UserFacadeService(inject(Store), inject(UserConfigurationService)); }, token: UserFacadeService, providedIn: "root" });
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 | export { UserModel, NgsUserModule, NgsUserRoutingModule, NgsUserModuleOutlets, UserService, UserFacadeService, getAccountInfo$2 as getAccountInfo, UserActionTypes, ChangePasswordContainerComponent as ɵr, reducer$1 as ɵw, ChangePasswordComponent as ɵj, getAccountInfo as ɵu, userReducer as ɵt, DashboardContainerComponent as ɵq, DashboardLinksComponent as ɵm, FeatureContainerComponent as ɵp, UserEffects as ɵbb, EditProfileEffects as ɵz, reducer$2 as ɵy, ProfileEditContainerComponent as ɵs, ProfileEditComponent as ɵk, ProfileContainerComponent as ɵl, ProfileViewEffects as ɵba, ProfileComponent as ɵi, reducer as ɵv, ResetPasswordRequestComponent as ɵo, reducer$3 as ɵx, SearchComponent as ɵh, UserConfigurationService as ɵn, MODULE_CONFIG_TOKEN as ɵa, RootNgsUserModule as ɵb, UserReducers as ɵd, selectFeatureState as ɵf, selectUserInformaionState as ɵg, routes as ɵc };
|
1482 |
|
1483 |
|
\ | No newline at end of file |