@posiwise/user-module 0.0.1

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.
Files changed (149) hide show
  1. package/README.md +7 -0
  2. package/assets/scss/_bootstrap_modules.scss +40 -0
  3. package/assets/scss/_custom-bootstrap.scss +13 -0
  4. package/assets/scss/_dashboard.scss +31 -0
  5. package/assets/scss/_dynamic-styles.scss +534 -0
  6. package/assets/scss/_plugins.scss +3 -0
  7. package/assets/scss/_public-pages.scss +7 -0
  8. package/assets/scss/_shared.scss +3 -0
  9. package/assets/scss/_variables.scss +5 -0
  10. package/assets/scss/common/landing-page-a/landing-page-style-1.scss +670 -0
  11. package/assets/scss/common/landing-page-b/banner.scss +141 -0
  12. package/assets/scss/common/landing-page-b/contact-us.scss +167 -0
  13. package/assets/scss/common/landing-page-b/explainer.scss +75 -0
  14. package/assets/scss/common/landing-page-b/explainer2.scss +35 -0
  15. package/assets/scss/common/landing-page-b/header.scss +56 -0
  16. package/assets/scss/common/landing-page-b/landing-page-style-2.scss +20 -0
  17. package/assets/scss/custom-bootstrap/_badge.scss +468 -0
  18. package/assets/scss/custom-bootstrap/_bootstrap_variables.scss +30 -0
  19. package/assets/scss/custom-bootstrap/_buttons.scss +84 -0
  20. package/assets/scss/custom-bootstrap/_card.scss +319 -0
  21. package/assets/scss/custom-bootstrap/_carousel.scss +6 -0
  22. package/assets/scss/custom-bootstrap/_form_select.scss +7 -0
  23. package/assets/scss/custom-bootstrap/_forms.scss +337 -0
  24. package/assets/scss/custom-bootstrap/_links.scss +7 -0
  25. package/assets/scss/custom-bootstrap/_modal.scss +16 -0
  26. package/assets/scss/custom-bootstrap/_navbar.scss +42 -0
  27. package/assets/scss/custom-bootstrap/_popover.scss +10 -0
  28. package/assets/scss/custom-bootstrap/_progress.scss +12 -0
  29. package/assets/scss/custom-bootstrap/_reboot.scss +93 -0
  30. package/assets/scss/custom-bootstrap/_type.scss +202 -0
  31. package/assets/scss/dashboard/_admin.scss +15 -0
  32. package/assets/scss/dashboard/_animations.scss +20 -0
  33. package/assets/scss/dashboard/_bootstrap-social.scss +641 -0
  34. package/assets/scss/dashboard/_chat.scss +250 -0
  35. package/assets/scss/dashboard/_coming-soon.scss +34 -0
  36. package/assets/scss/dashboard/_components.scss +229 -0
  37. package/assets/scss/dashboard/_email.scss +184 -0
  38. package/assets/scss/dashboard/_fixed-navbar.scss +18 -0
  39. package/assets/scss/dashboard/_gallery.scss +1201 -0
  40. package/assets/scss/dashboard/_helper.scss +736 -0
  41. package/assets/scss/dashboard/_horizontal-timeline.scss +314 -0
  42. package/assets/scss/dashboard/_icons.scss +107 -0
  43. package/assets/scss/dashboard/_layout.scss +23 -0
  44. package/assets/scss/dashboard/_misc.scss +220 -0
  45. package/assets/scss/dashboard/_notifications.scss +27 -0
  46. package/assets/scss/dashboard/_palette.scss +308 -0
  47. package/assets/scss/dashboard/_profile.scss +36 -0
  48. package/assets/scss/dashboard/_responsive.scss +209 -0
  49. package/assets/scss/dashboard/_search.scss +33 -0
  50. package/assets/scss/dashboard/_select.scss +16 -0
  51. package/assets/scss/dashboard/_sidebar-content.scss +632 -0
  52. package/assets/scss/dashboard/_tables.scss +17 -0
  53. package/assets/scss/dashboard/_tabs.scss +151 -0
  54. package/assets/scss/dashboard/_ui-switch.scss +6 -0
  55. package/assets/scss/dashboard/_upload.scss +249 -0
  56. package/assets/scss/dashboard/_utilities.scss +105 -0
  57. package/assets/scss/dashboard/_vertical-timeline.scss +1261 -0
  58. package/assets/scss/dashboard/mixins/_buttons.scss +78 -0
  59. package/assets/scss/dashboard/mixins/_colors.scss +29 -0
  60. package/assets/scss/dashboard/mixins/_custom.scss +34 -0
  61. package/assets/scss/dashboard/mixins/_shadows.scss +62 -0
  62. package/assets/scss/dashboard/mixins/_type.scss +16 -0
  63. package/assets/scss/dashboard/mixins/_typography.scss +29 -0
  64. package/assets/scss/dashboard/mixins/_utilities.scss +129 -0
  65. package/assets/scss/dashboard/mixins/_vendor-prefixes.scss +71 -0
  66. package/assets/scss/plugins/_plugin-nouislider.scss +199 -0
  67. package/assets/scss/plugins/_toastr.scss +71 -0
  68. package/assets/scss/plugins/perfect-scrollbar/_main.scss +3 -0
  69. package/assets/scss/plugins/perfect-scrollbar/_mixins.scss +135 -0
  70. package/assets/scss/plugins/perfect-scrollbar/_ps-custom.scss +134 -0
  71. package/assets/scss/plugins/perfect-scrollbar/_themes.scss +23 -0
  72. package/assets/scss/plugins/perfect-scrollbar/_variables.scss +19 -0
  73. package/assets/scss/public-pages/_buttons.scss +136 -0
  74. package/assets/scss/public-pages/_input-fields.scss +29 -0
  75. package/assets/scss/public-pages/_layout.scss +108 -0
  76. package/assets/scss/public-pages/mixins/_buttons.scss +28 -0
  77. package/assets/scss/shared/_modal.scss +28 -0
  78. package/assets/scss/shared/_prime-ng-tables.scss +107 -0
  79. package/assets/scss/shared/_prime-ng.scss +5100 -0
  80. package/assets/scss/variables/_app-colors-variables.scss +760 -0
  81. package/assets/scss/variables/_branding-variables.scss +93 -0
  82. package/assets/scss/variables/_dashboard-variables.scss +96 -0
  83. package/assets/scss/variables/_generic-variables.scss +33 -0
  84. package/assets/scss/variables/_landing-page-new-variables.scss +11 -0
  85. package/assets/scss/variables/_primeng-variables.scss +190 -0
  86. package/esm2020/index.mjs +33 -0
  87. package/esm2020/lib/account/account-details/account-details.component.mjs +272 -0
  88. package/esm2020/lib/account/account.component.mjs +45 -0
  89. package/esm2020/lib/account/subscriptions/add-subscription/add-subscription.component.mjs +87 -0
  90. package/esm2020/lib/account/subscriptions/saved-card-details/saved-card-details.component.mjs +36 -0
  91. package/esm2020/lib/account/subscriptions/subscription-credential/subscription-credential.component.mjs +207 -0
  92. package/esm2020/lib/account/subscriptions/update-payment-details/update-payment-details.component.mjs +117 -0
  93. package/esm2020/lib/account/subscriptions/upgrade-subscription/upgrade-subscription.component.mjs +292 -0
  94. package/esm2020/lib/account/subscriptions/user-subscription-details/user-subscription-details.component.mjs +191 -0
  95. package/esm2020/lib/account/subscriptions/user-subscriptions-list/user-subscriptions-list.component.mjs +219 -0
  96. package/esm2020/lib/account/user-invoice/user-invoice.component.mjs +51 -0
  97. package/esm2020/lib/settings-tabs/communication-tab/communication-tab.component.mjs +84 -0
  98. package/esm2020/lib/settings-tabs/others-tab/others-tab.component.mjs +71 -0
  99. package/esm2020/lib/settings-tabs/security-tab/security-tab.component.mjs +101 -0
  100. package/esm2020/lib/settings-tabs/settings-tabs.component.mjs +48 -0
  101. package/esm2020/lib/support/support-details/support-details.component.mjs +80 -0
  102. package/esm2020/lib/support/support.component.mjs +42 -0
  103. package/esm2020/lib/user-module.module.mjs +192 -0
  104. package/esm2020/lib/user-profile/edit-portfolios/edit-portfolios.component.mjs +104 -0
  105. package/esm2020/lib/user-profile/edit-project-modal/edit-project-modal.component.mjs +147 -0
  106. package/esm2020/lib/user-profile/edit-qualifications-modal/edit-qualifications-modal.component.mjs +111 -0
  107. package/esm2020/lib/user-profile/edit-recommendation-modal/edit-recommendation-modal.component.mjs +70 -0
  108. package/esm2020/lib/user-profile/edit-skills-modal/edit-skills-modal.component.mjs +111 -0
  109. package/esm2020/lib/user-profile/edit-social-links/edit-social-links.component.mjs +87 -0
  110. package/esm2020/lib/user-profile/edit-user-profile-modal/edit-user-profile-modal.component.mjs +131 -0
  111. package/esm2020/lib/user-profile/user-about/user-about.component.mjs +144 -0
  112. package/esm2020/lib/user-profile/user-portfolios/user-portfolios.component.mjs +63 -0
  113. package/esm2020/lib/user-profile/user-profile-page.component.mjs +155 -0
  114. package/esm2020/lib/user-profile/user-projects/user-projects.component.mjs +103 -0
  115. package/esm2020/user-module.mjs +5 -0
  116. package/fesm2015/user-module.mjs +3019 -0
  117. package/fesm2015/user-module.mjs.map +1 -0
  118. package/fesm2020/user-module.mjs +3007 -0
  119. package/fesm2020/user-module.mjs.map +1 -0
  120. package/index.d.ts +28 -0
  121. package/lib/account/account-details/account-details.component.d.ts +62 -0
  122. package/lib/account/account.component.d.ts +14 -0
  123. package/lib/account/subscriptions/add-subscription/add-subscription.component.d.ts +39 -0
  124. package/lib/account/subscriptions/saved-card-details/saved-card-details.component.d.ts +27 -0
  125. package/lib/account/subscriptions/subscription-credential/subscription-credential.component.d.ts +58 -0
  126. package/lib/account/subscriptions/update-payment-details/update-payment-details.component.d.ts +32 -0
  127. package/lib/account/subscriptions/upgrade-subscription/upgrade-subscription.component.d.ts +57 -0
  128. package/lib/account/subscriptions/user-subscription-details/user-subscription-details.component.d.ts +58 -0
  129. package/lib/account/subscriptions/user-subscriptions-list/user-subscriptions-list.component.d.ts +69 -0
  130. package/lib/account/user-invoice/user-invoice.component.d.ts +17 -0
  131. package/lib/settings-tabs/communication-tab/communication-tab.component.d.ts +23 -0
  132. package/lib/settings-tabs/others-tab/others-tab.component.d.ts +19 -0
  133. package/lib/settings-tabs/security-tab/security-tab.component.d.ts +23 -0
  134. package/lib/settings-tabs/settings-tabs.component.d.ts +15 -0
  135. package/lib/support/support-details/support-details.component.d.ts +22 -0
  136. package/lib/support/support.component.d.ts +16 -0
  137. package/lib/user-module.module.d.ts +43 -0
  138. package/lib/user-profile/edit-portfolios/edit-portfolios.component.d.ts +32 -0
  139. package/lib/user-profile/edit-project-modal/edit-project-modal.component.d.ts +36 -0
  140. package/lib/user-profile/edit-qualifications-modal/edit-qualifications-modal.component.d.ts +29 -0
  141. package/lib/user-profile/edit-recommendation-modal/edit-recommendation-modal.component.d.ts +22 -0
  142. package/lib/user-profile/edit-skills-modal/edit-skills-modal.component.d.ts +35 -0
  143. package/lib/user-profile/edit-social-links/edit-social-links.component.d.ts +23 -0
  144. package/lib/user-profile/edit-user-profile-modal/edit-user-profile-modal.component.d.ts +33 -0
  145. package/lib/user-profile/user-about/user-about.component.d.ts +52 -0
  146. package/lib/user-profile/user-portfolios/user-portfolios.component.d.ts +22 -0
  147. package/lib/user-profile/user-profile-page.component.d.ts +40 -0
  148. package/lib/user-profile/user-projects/user-projects.component.d.ts +36 -0
  149. package/package.json +52 -0
@@ -0,0 +1,3019 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component, ViewChild, EventEmitter, Input, Output, NgModule } from '@angular/core';
3
+ import * as i4 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as i1 from '@angular/router';
6
+ import * as i7 from '@posiwise/shared-components';
7
+ import { SharedComponentsModule } from '@posiwise/shared-components';
8
+ import { __decorate, __metadata } from 'tslib';
9
+ import * as i2 from '@angular/forms';
10
+ import { Validators, ReactiveFormsModule } from '@angular/forms';
11
+ import { StatusCodes } from 'http-status-codes';
12
+ import swal from 'sweetalert2';
13
+ import { AppBaseComponent } from '@posiwise/app-base-component';
14
+ import { AppUser, PRODUCT_CATEGORY, POLL_TIMEOUT, Project, TAG_TYPE, TAG_ENTITY } from '@posiwise/common-utilities';
15
+ import { HelperService } from '@posiwise/helper-service';
16
+ import { ValidateForm, clearQueryParams, appendQueryParam } from '@posiwise/utils';
17
+ import * as i1$1 from '@ng-bootstrap/ng-bootstrap';
18
+ import * as i1$2 from '@posiwise/common-services';
19
+ import { FormHelperService, PermissionService, ValidationService } from '@posiwise/common-services';
20
+ import * as i3 from '@posiwise/directives';
21
+ import { DirectivesModule } from '@posiwise/directives';
22
+ import * as i6 from 'ngx-google-places-autocomplete';
23
+ import { GooglePlaceModule } from 'ngx-google-places-autocomplete';
24
+ import * as i5 from 'primeng/progressspinner';
25
+ import { ProgressSpinnerModule } from 'primeng/progressspinner';
26
+ import * as i9 from '@node_modules/@ng-bootstrap/ng-bootstrap';
27
+ import { NgbModalModule, NgbDatepickerModule } from '@node_modules/@ng-bootstrap/ng-bootstrap';
28
+ import * as i10 from '@ngneat/transloco';
29
+ import cloneDeep from 'lodash/cloneDeep';
30
+ import sortBy from 'lodash/sortBy';
31
+ import { from, forkJoin, interval } from 'rxjs';
32
+ import { distinct, mergeMap } from 'rxjs/operators';
33
+ import { GetUser, getUser } from '@posiwise/app-store';
34
+ import * as i4$1 from '@ngrx/store';
35
+ import * as i10$1 from 'primeng/tooltip';
36
+ import { HttpParams } from '@angular/common/http';
37
+ import * as i2$1 from '@posiwise/admin-module-utils';
38
+ import { AppAdmin } from '@posiwise/admin-module-utils';
39
+ import * as i5$1 from '@angular/cdk/clipboard';
40
+ import * as i3$1 from 'primeng/accordion';
41
+ import { AccordionModule } from 'primeng/accordion';
42
+ import * as i5$2 from 'primeng/fileupload';
43
+ import { FileUploadModule } from 'primeng/fileupload';
44
+ import moment from 'moment';
45
+ import * as i6$1 from 'primeng/tabmenu';
46
+ import { CoreTranslocoModule } from '@posiwise/core-transloco';
47
+
48
+ class AccountComponent {
49
+ constructor(router) {
50
+ this.router = router;
51
+ this.items = [
52
+ {
53
+ id: 'account',
54
+ label: 'Account',
55
+ icon: 'fa fa-fw fa-list',
56
+ routerLink: ['/account/details']
57
+ },
58
+ {
59
+ id: 'subscription',
60
+ label: 'Subscription',
61
+ icon: 'fa fa-fw fa-file-invoice',
62
+ routerLink: ['/account/subscriptions']
63
+ },
64
+ {
65
+ id: 'invoice',
66
+ label: 'Invoices',
67
+ icon: 'fa fa-fw fa-tag',
68
+ routerLink: ['/account/invoice']
69
+ }
70
+ ];
71
+ this.activeItem =
72
+ this.items[this.items.findIndex(record => record.routerLink[0] === this.router.url.split('?')[0])];
73
+ }
74
+ activateMenu() {
75
+ this.activeItem = this.menu['activeItem'];
76
+ }
77
+ }
78
+ AccountComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AccountComponent, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Component });
79
+ AccountComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: AccountComponent, selector: "pw-user-account", viewQueries: [{ propertyName: "menu", first: true, predicate: ["menuItems"], descendants: true, static: true }], ngImport: i0, template: "<pw-tabs [items]=\"items\"></pw-tabs>\n", dependencies: [{ kind: "component", type: i7.PwTabsComponent, selector: "pw-tabs", inputs: ["items", "withSubscription"] }] });
80
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AccountComponent, decorators: [{
81
+ type: Component,
82
+ args: [{ selector: 'pw-user-account', template: "<pw-tabs [items]=\"items\"></pw-tabs>\n" }]
83
+ }], ctorParameters: function () { return [{ type: i1.Router }]; }, propDecorators: { menu: [{
84
+ type: ViewChild,
85
+ args: ['menuItems', { static: true }]
86
+ }] } });
87
+
88
+ class AccountDetailsComponent extends AppBaseComponent {
89
+ constructor(fb, modalService, authService, geoService, profileService, injector) {
90
+ super(injector);
91
+ this.fb = fb;
92
+ this.modalService = modalService;
93
+ this.authService = authService;
94
+ this.geoService = geoService;
95
+ this.profileService = profileService;
96
+ this.image = 'assets/img/icons/male.png';
97
+ this.states = [];
98
+ this.passwordVerified = false;
99
+ this.isCurrentPasswordValid = true;
100
+ this.isLoaded = false;
101
+ this.getForms();
102
+ }
103
+ ngOnInit() {
104
+ this.getUserProfile();
105
+ this.countries$ = this.geoService.getCountries();
106
+ }
107
+ handleAddressChange(_event) {
108
+ this.profileForm.patchValue({
109
+ latitude: _event.geometry.location.lat(),
110
+ longitude: _event.geometry.location.lng(),
111
+ location: _event.formatted_address
112
+ });
113
+ }
114
+ getUserProfile() {
115
+ this.userService
116
+ .getUserInfo()
117
+ .subscribe(user => {
118
+ var _a, _b;
119
+ if (user) {
120
+ this.user = user;
121
+ this.slug = user.slug;
122
+ if ((user === null || user === void 0 ? void 0 : user.user_avatar) && ((_a = user === null || user === void 0 ? void 0 : user.user_avatar) === null || _a === void 0 ? void 0 : _a.length)) {
123
+ this.image = (_b = user === null || user === void 0 ? void 0 : user.user_avatar[2]) === null || _b === void 0 ? void 0 : _b.url;
124
+ }
125
+ let dobObject;
126
+ if (user.dob) {
127
+ dobObject = {
128
+ year: Number(user.dob.substring(0, 4)),
129
+ month: Number(user.dob.substring(5, 7)),
130
+ day: Number(user.dob.substring(8, 10))
131
+ };
132
+ }
133
+ this.getRegion(user.country);
134
+ this.profileForm.patchValue(this.user);
135
+ this.profileForm.patchValue({ dob: dobObject });
136
+ this.validatedEmail = this.user.email;
137
+ }
138
+ })
139
+ .add(() => {
140
+ this.isLoaded = true;
141
+ });
142
+ }
143
+ /**
144
+ * Updates Email Address
145
+ * this needs to be separate and requires the email to be validated from email before it's actually changed
146
+ */
147
+ onEmailFormSubmit() {
148
+ const data = this.emailForm.value;
149
+ data.confirmation_path = 'confirm-email';
150
+ if (data && this.passwordVerified) {
151
+ this.userService.updateEmail(data).subscribe(() => {
152
+ this.emailForm.reset();
153
+ this.passwordVerified = false;
154
+ this.toast.success(`A verification email has been sent to ${data.email}`, '', {
155
+ positionClass: 'toast-top-center',
156
+ timeOut: 100000
157
+ });
158
+ });
159
+ }
160
+ }
161
+ validatePassword() {
162
+ const password = this.passwordRef.nativeElement.value;
163
+ if (password) {
164
+ this.userService.checkPassword({ password }).subscribe(data => {
165
+ if ((data === null || data === void 0 ? void 0 : data.status) === StatusCodes.OK) {
166
+ this.passwordVerified = true;
167
+ }
168
+ else {
169
+ this.toast.error(data.error.message);
170
+ this.passwordRef.nativeElement.value = '';
171
+ }
172
+ });
173
+ }
174
+ }
175
+ checkValidity() {
176
+ const password = this.passwordRef.nativeElement.value;
177
+ if (password.length > 5) {
178
+ this.isCurrentPasswordValid = false;
179
+ }
180
+ else {
181
+ this.isCurrentPasswordValid = true;
182
+ }
183
+ }
184
+ onPasswordFormSubmit() {
185
+ if (this.passwordForm.valid) {
186
+ const data = {
187
+ password: this.passwordForm.value['newPassword'],
188
+ password_confirmation: this.passwordForm.value['confirmPassword'],
189
+ old_password: this.passwordForm.value['currentPassword']
190
+ };
191
+ this.userService.updatePassword(data).subscribe(response => {
192
+ if (response.status_code === 200) {
193
+ this.toast.success(response.message, '', {
194
+ positionClass: 'toast-top-center'
195
+ });
196
+ this.onTogglePassword();
197
+ }
198
+ else {
199
+ this.toast.error(response.error.message);
200
+ }
201
+ this.passwordForm.reset();
202
+ });
203
+ }
204
+ }
205
+ onProfileFormSubmit() {
206
+ var _a;
207
+ const data = Object.assign({}, this.profileForm.value);
208
+ data.dob = HelperService.dateFormat((_a = this.profileForm.get('dob')) === null || _a === void 0 ? void 0 : _a.value);
209
+ if (data.location === '') {
210
+ data.location = null;
211
+ }
212
+ Object.entries(data).forEach(([key, val]) => {
213
+ if (val === '' || val === null) {
214
+ delete data[key];
215
+ }
216
+ });
217
+ this.profileService.updateUserProfile(data).subscribe(() => {
218
+ this.toast.success(this.translation.translate('User.Profile.ProfileUpdated'));
219
+ });
220
+ }
221
+ onAvatarSave() {
222
+ var _a;
223
+ const data = {
224
+ avatar: (_a = this.profileForm.get('avatar')) === null || _a === void 0 ? void 0 : _a.value
225
+ };
226
+ this.profileService.updateUserProfile(data).subscribe(() => {
227
+ this.toast.success(this.translation.translate('User.Profile.ProfileUpdated'));
228
+ });
229
+ }
230
+ openModal(content) {
231
+ this.modalService.open(content, { centered: true, windowClass: 'modal-holder' });
232
+ }
233
+ onUpdateSlug() {
234
+ this.userService.updateSlug(this.slug).subscribe(response => {
235
+ this.toggleNickName = false;
236
+ if (response && response.status === StatusCodes.OK) {
237
+ this.getUserProfile();
238
+ }
239
+ else {
240
+ this.toast.error('User.Account.UserNameError');
241
+ }
242
+ });
243
+ }
244
+ onImageSelection(event) {
245
+ const blob = this.dataURLtoBlob(event);
246
+ const filename = `${`${this.slug.toLocaleLowerCase()}_${Date.parse(new Date().toString())}`}.png`;
247
+ const file = new File([blob], filename);
248
+ this.userService.addAvatar(file).subscribe(res => {
249
+ var _a;
250
+ this.image = (_a = res === null || res === void 0 ? void 0 : res.user_avatar[2]) === null || _a === void 0 ? void 0 : _a.url;
251
+ this.modalService.dismissAll();
252
+ });
253
+ }
254
+ sendMailToResetPassword() {
255
+ this.authService.forgotPassword(this.user.email, 'reset-password').subscribe(() => {
256
+ this.toast.success(this.translation.translate('User.Account.Message.CheckEmail'));
257
+ });
258
+ }
259
+ getRegion(countryId) {
260
+ if (countryId) {
261
+ this.geoService.getRegions(countryId).subscribe(response => {
262
+ this.states = response;
263
+ });
264
+ }
265
+ }
266
+ getForms() {
267
+ this.emailForm = this.fb.group({
268
+ email: ['', [Validators.required, Validators.email]]
269
+ });
270
+ this.passwordForm = this.fb.group({
271
+ currentPassword: ['', [Validators.required]],
272
+ newPassword: ['', [Validators.required, Validators.minLength(8)]],
273
+ confirmPassword: ['', [Validators.required, Validators.minLength(8)]]
274
+ }, {
275
+ validators: this.passwordMatcher
276
+ });
277
+ this.profileForm = AppUser.getForm(new AppUser({}));
278
+ }
279
+ passwordMatcher(ac) {
280
+ const password = ac.get('newPassword').value;
281
+ const confirmPassword = ac.get('confirmPassword').value;
282
+ if (password !== confirmPassword) {
283
+ ac.get('confirmPassword').setErrors({ MatchPassword: true });
284
+ }
285
+ return null;
286
+ }
287
+ dataURLtoBlob(dataurl) {
288
+ const arr = dataurl.split(',');
289
+ const mime = arr[0].match(/^[A-Z]*[a-z]*:(.*?);[A-Z]*/)[1];
290
+ const bstr = atob(arr[1]);
291
+ let n = bstr.length;
292
+ const u8arr = new Uint8Array(n);
293
+ while (n--) {
294
+ u8arr[n] = bstr.charCodeAt(n);
295
+ }
296
+ return new Blob([u8arr], { type: mime });
297
+ }
298
+ onToggleEmail() {
299
+ this.emailForm.reset();
300
+ this.passwordVerified = false;
301
+ this.toggleEmail = false;
302
+ }
303
+ onTogglePassword() {
304
+ this.passwordForm.reset();
305
+ this.togglePassword = false;
306
+ }
307
+ onClose() {
308
+ this.modalService.dismissAll();
309
+ }
310
+ shouldUserChangeEmail() {
311
+ if (this.user.has_password) {
312
+ this.toggleEmail = !this.toggleEmail;
313
+ }
314
+ else {
315
+ swal.fire({
316
+ text: `You don't have password, please reset your password first and then try changing email`,
317
+ icon: 'warning'
318
+ });
319
+ }
320
+ }
321
+ }
322
+ AccountDetailsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AccountDetailsComponent, deps: [{ token: i2.UntypedFormBuilder }, { token: i1$1.NgbModal }, { token: i1$2.AuthService }, { token: i1$2.GeoService }, { token: i1$2.ProfileService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
323
+ AccountDetailsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: AccountDetailsComponent, selector: "pw-account-details", viewQueries: [{ propertyName: "passwordRef", first: true, predicate: ["password"], descendants: true }, { propertyName: "places", first: true, predicate: ["places"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"w-100 text-center mt-3\">\n <ng-template [ngIf]=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </ng-template>\n</div>\n<div class=\"row d-flex flex-row\">\n <div class=\"col-md-8 order-md-first order-sm-last\">\n <section id=\"email-section\">\n <div class=\"row\">\n <div class=\"col-sm-12 col-md-8 col-lg-8\">\n <h2>{{ 'User.Account.RegisteredEmail' | transloco }}</h2>\n <!-- Email Form -->\n <section id=\"email-form\">\n <form [formGroup]=\"emailForm\"\n (ngSubmit)=\"onEmailFormSubmit()\">\n <!-- Email Address -->\n <div class=\"mt-0\">\n <label class=\"me-3\">{{ 'User.Account.PrimaryEmail' | transloco }}:\n </label>\n <strong>{{ validatedEmail }}</strong>\n <div class=\"mt-1\">\n <ng-container *ngIf=\"!toggleEmail\">\n <a class=\"btn btn-raised btn-outline-primary\"\n href=\"javascript:void(0)\"\n (click)=\"shouldUserChangeEmail()\">\n {{ 'User.Account.ChangeEmail' | transloco }}</a>\n </ng-container>\n <ng-container *ngIf=\"toggleEmail\">\n <div class=\"row\">\n <div class=\"clearfix\"></div>\n <div class=\"col-12 mb-3\">\n <input type=\"password\"\n class=\"form-control\"\n id=\"pwd\"\n #password\n *ngIf=\"!passwordVerified\"\n placeholder=\"Current Password\"\n (keyup)=\"checkValidity()\" />\n <input type=\"text\"\n class=\"form-control\"\n id=\"email\"\n *ngIf=\"passwordVerified\"\n placeholder=\"New Email\"\n formControlName=\"email\" />\n </div>\n <div class=\"col-12\">\n <a *ngIf=\"toggleEmail\"\n class=\"btn btn-raised btn-outline-default my-2 me-2\"\n href=\"javascript:void(0)\"\n (click)=\"onToggleEmail()\">{{ 'Button.Cancel' | transloco }}</a>\n <button class=\"btn btn-raised btn-primary\"\n type=\"submit\"\n (click)=\"validatePassword()\"\n *ngIf=\"!passwordVerified\"\n [disabled]=\"isCurrentPasswordValid\">\n {{ 'User.Account.Validate' | transloco }}\n </button>\n <button type=\"submit\"\n class=\"btn btn-raised btn-primary\"\n *ngIf=\"passwordVerified\">\n {{\n 'User.Account.SendVerification' | transloco\n }}\n </button>\n </div>\n </div>\n </ng-container>\n </div>\n </div>\n <section id=\"slug\"\n class=\"mb-2 mt-3\">\n <div>\n <label class=\"me-3\">{{ 'User.Account.NickName' | transloco }}:\n </label>\n <strong>{{ slug }}</strong>\n <div>\n <ng-container *ngIf=\"!toggleNickName\">\n <a class=\"btn btn-raised btn-outline-primary me-2\"\n href=\"javascript:void(0)\"\n (click)=\"toggleNickName = true\">\n {{ 'User.Account.ChangeNickname' | transloco }}</a>\n </ng-container>\n <ng-container *ngIf=\"toggleNickName\">\n <div class=\"mb-3\">\n <input type=\"text\"\n class=\"form-control slug-input\"\n [(ngModel)]=\"slug\"\n [ngModelOptions]=\"{ standalone: true }\" />\n </div>\n <div>\n <button type=\"button\"\n class=\"btn btn-raised btn-outline-default\"\n (click)=\"toggleNickName = false\">\n {{ 'Button.Cancel' | transloco }}\n </button>\n <button type=\"button\"\n class=\"btn btn-raised btn-primary ms-2\"\n [disabled]=\"slug?.length < 2\"\n (click)=\"onUpdateSlug()\">\n {{ 'User.Account.UpdateNickname' | transloco }}\n </button>\n </div>\n </ng-container>\n </div>\n </div>\n </section>\n </form>\n </section>\n </div>\n </div>\n <section id=\"password-change\"\n class=\"mt-1\">\n <form [formGroup]=\"passwordForm\"\n (ngSubmit)=\"onPasswordFormSubmit()\">\n <div class=\"row\">\n <div class=\"col-sm-12 col-md-8 col-lg-8 mt-4\">\n <h2>{{ 'User.Account.ChangePassword' | transloco }}</h2>\n </div>\n <ng-container *ngIf=\"!user?.has_password\">\n <div class=\"text-danger mx-3 my-2\">\n <div>\n You don't have a password set, click on\n <em>{{ 'User.Account.ChangePassword' | transloco }}</em>.\n </div>\n <div>{{ 'User.Profile.PictureMessage' | transloco }}</div>\n </div>\n </ng-container>\n <div class=\"col-sm-12 col-md-8 col-lg-8\"\n *ngIf=\"user?.has_password\">\n <ng-container *ngIf=\"togglePassword\">\n <div class=\"mb-3\">\n <label>{{ 'User.Account.CurrentPassword' | transloco }}</label>\n <input type=\"password\"\n class=\"form-control\"\n formControlName=\"currentPassword\" />\n <small class=\"form-text text-muted danger\"\n *ngIf=\"\n !passwordForm.get('currentPassword').valid &&\n (passwordForm.get('currentPassword').dirty ||\n passwordForm.get('currentPassword').touched)\n \">\n {{ 'User.Account.Required' | transloco }}\n </small>\n </div>\n <div class=\"mb-3\">\n <label>{{ 'User.Account.NewPassword' | transloco }}</label>\n <input type=\"password\"\n class=\"form-control\"\n formControlName=\"newPassword\" />\n <small class=\"form-text text-muted danger\"\n *ngIf=\"\n !passwordForm.get('newPassword').valid &&\n (passwordForm.get('newPassword').dirty ||\n passwordForm.get('newPassword').touched)\n \">{{ 'User.Account.Validation.StrongPassword' | transloco }}\n </small>\n </div>\n <div class=\"mb-3\">\n <label for=\"password\">{{\n 'User.Account.ConfirmPassword' | transloco\n }}</label>\n <input type=\"password\"\n class=\"form-control\"\n formControlName=\"confirmPassword\" />\n <div class=\"text-danger\"\n *ngIf=\"\n passwordForm.get('confirmPassword').touched &&\n passwordForm.get('confirmPassword').errors\n ?.MatchPassword\n \">\n {{ 'User.Account.Validation.PasswordsMatch' | transloco }}\n </div>\n </div>\n <div class=\"mb-3\">\n <a class=\"btn btn-raised btn-outline-default\"\n href=\"javascript:void(0)\"\n data-bs-target=\"\"\n *ngIf=\"togglePassword\"\n (click)=\"onTogglePassword()\">\n {{ 'Button.Cancel' | transloco }}</a>\n <button class=\"btn btn-raised btn-primary ms-2\"\n [disabled]=\"!passwordForm.valid\">\n {{ 'User.Account.UpdatePassword' | transloco }}\n </button>\n </div>\n </ng-container>\n <div>\n <a class=\"btn btn-raised btn-outline-primary\"\n href=\"javascript:void(0)\"\n data-bs-target=\"\"\n *ngIf=\"!togglePassword\"\n (click)=\"togglePassword = !togglePassword\">\n {{ 'User.Account.ChangePassword' | transloco }}</a>\n </div>\n </div>\n <div class=\"col-sm-12 col-md-8 col-lg-8\"\n *ngIf=\"!user?.has_password\">\n <a class=\"btn btn-raised btn-primary me-2\"\n href=\"javascript:void(0)\"\n data-bs-target=\"\"\n (click)=\"sendMailToResetPassword()\">\n {{ 'User.Account.ChangePassword' | transloco }}</a>\n </div>\n </div>\n </form>\n </section>\n </section>\n </div>\n <!-- Avatar -->\n <div class=\"mt-4 mt-sm-0 col-md-4 text-center order-md-last order-sm-first\">\n <h2>{{ 'User.Profile.Avatar' | transloco }}</h2>\n <div class=\"text-center mt-1\">\n <div class=\"image-container\">\n <img [src]=\"image\"\n width=\"150\"\n height=\"150\"\n class=\"image rounded-circle\"\n alt=\"User's Avatar\"\n onerror=\"this.onerror=null;this.src='assets/img/icons/male.png';\" />\n <div class=\"overlay\"\n (click)=\"openModal(content)\">\n <div class=\"overlay-text\">{{ 'User.Profile.Change' | transloco }}</div>\n </div>\n </div>\n <h4 class=\"mt-2\">{{ user?.first_name }} {{ user?.last_name }}</h4>\n <a href=\"javascript:void(0)\"\n class=\"d-inline-block mb-2\"\n (click)=\"openModal(content)\">\n {{ 'User.Profile.EditAvatar' | transloco }}</a>\n <br />\n </div>\n </div>\n</div>\n<br />\n<section id=\"user-profile\"\n class=\"mt-2\">\n <div class=\"row\">\n <div class=\"col-12\">\n <form [formGroup]=\"profileForm\"\n (ngSubmit)=\"onProfileFormSubmit()\">\n <h2>{{ 'User.Profile.UserProfile' | transloco }}</h2>\n <div class=\"row mt-3\">\n <div class=\"col-sm-12 col-md-6 col-lg-6\">\n <pw-input-container label=\"First Name\"\n name=\"first_name\"\n errorMsg=\"Please enter first Name\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"first_name\"\n id=\"first_name\" />\n </pw-input-container>\n <pw-input-container label=\"Preferred name\"\n name=\"preferred_name\"\n errorMsg=\"Please enter preferred Name\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"preferred_name\"\n id=\"preferred_name\" />\n </pw-input-container>\n <ng-container *ngIf=\"countries$ | async as countries\">\n <pw-input-container label=\"Country\"\n name=\"country\"\n errorMsg=\"Please select a country\">\n <select id=\"country\"\n class=\"form-select form-control\"\n formControlName=\"country\"\n (change)=\"getRegion($event.target.value)\">\n <option value=\"0\">\n {{ 'User.Profile.SelectCountry' | transloco }}\n </option>\n <option *ngFor=\"let country of countries\"\n [value]=\"country.code\">\n {{ country.name }}\n </option>\n </select>\n </pw-input-container>\n </ng-container>\n <pw-input-container label=\"Province\"\n name=\"province\"\n errorMsg=\"Please enter province\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"province\" />\n </pw-input-container>\n <pw-input-container label=\"Website Url\"\n name=\"website_url\"\n errorMsg=\"Please enter Website\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"website_url\" />\n </pw-input-container>\n </div>\n <div class=\"col-sm-12 col-md-6 col-lg-6\">\n <pw-input-container label=\"Last Name\"\n name=\"last_name\"\n errorMsg=\"Please enter last Name\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"last_name\"\n id=\"last_name\" />\n </pw-input-container>\n <pw-input-container label=\"Date of Birth\"\n name=\"dob\"\n errorMsg=\"Please enter date of birth\">\n <div class=\"input-group\">\n <input class=\"form-control\"\n placeholder=\"dd-mm-yyyy\"\n formControlName=\"dob\"\n ngbDatepicker\n #d=\"ngbDatepicker\"\n [minDate]=\"{ day: 1, month: 1, year: 1950 }\"\n [maxDate]=\"{ day: 31, month: 12, year: 2018 }\" />\n <div class=\"input-group-append\">\n <button class=\"btn btn-primary\"\n (click)=\"d.toggle()\"\n type=\"button\">\n <i class=\"fa fa-calendar\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </div>\n </pw-input-container>\n <pw-input-container label=\"State\"\n name=\"state\"\n errorMsg=\"Please select a state\">\n <select id=\"state\"\n class=\"form-select form-control\"\n [(value)]=\"selectedState\"\n formControlName=\"state\">\n <option value=\"0\">\n {{ 'User.Profile.SelectState' | transloco }}\n </option>\n <option *ngFor=\"let state of states\"\n [value]=\"state.code\">\n {{ state.name }}\n </option>\n </select>\n </pw-input-container>\n <!-- Location -->\n <pw-input-container label=\"Location\"\n name=\"location\">\n <input ngx-google-places-autocomplete\n class=\"form-control\"\n #places=\"ngx-places\"\n formControlName=\"location\"\n (onAddressChange)=\"handleAddressChange($event)\" />\n </pw-input-container>\n <pw-input-container label=\"Phone Number\"\n name=\"phone_number\"\n errorMsg=\"Please enter phone number\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"phone_number\"\n id=\"phone_number\" />\n </pw-input-container>\n </div>\n <div class=\"col-12 text-end\">\n <div class=\"mb-3\">\n <button class=\"btn btn-raised btn-primary\">\n {{ 'Button.Save' | transloco }}\n </button>\n </div>\n </div>\n </div>\n </form>\n </div>\n </div>\n</section>\n<ng-template #content\n let-modal>\n <div class=\"card m-0\">\n <div class=\"card-content\">\n <div class=\"card-title\">\n <h3 class=\"modal-title\">{{ 'User.Profile.ProfilePicture' | transloco }}</h3>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"card-header\">\n <small> {{ 'User.Profile.PictureMessage' | transloco }}</small>\n <pw-image-cropper #profile\n aspectRatio=\"auto\"\n (imageSelectionEvent)=\"onImageSelection($event)\"\n (closeEvent)=\"onClose()\">\n </pw-image-cropper>\n </div>\n </div>\n </div>\n</ng-template>\n", styles: [".overlay{left:50%;opacity:0;position:absolute;text-align:center;top:50%;transform:translate(-50%,-50%);transition:.5s ease}.image-container{position:relative}.image-container:hover .image{opacity:.3}.image-container:hover .overlay{opacity:0}.overlay-text{background:rgba(240,239,239,.5);border-radius:50%;color:#000;font-size:16px;height:150px;line-height:150px;text-align:center;vertical-align:middle;width:150px}@media screen and (max-width: 767px){.card-body{padding:20px!important}}\n"], dependencies: [{ kind: "directive", type: i3.LazyImgDirective, selector: "img" }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i6.GooglePlaceDirective, selector: "[ngx-google-places-autocomplete]", inputs: ["options"], outputs: ["onAddressChange"], exportAs: ["ngx-places"] }, { kind: "component", type: i7.ProfileImageCropperComponent, selector: "pw-image-cropper", inputs: ["aspectRatio"], outputs: ["imageSelectionEvent", "closeEvent", "fileChangeEvent"] }, { kind: "component", type: i7.InputContainerComponent, selector: "pw-input-container", inputs: ["name", "label", "labelClass", "tooltipPosition", "required", "errorMsg", "isReadOnly", "showTooltip", "tooltipText"] }, { kind: "component", type: i5.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { kind: "directive", type: i9.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "popperOptions", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: i10.TranslocoPipe, name: "transloco" }] });
324
+ __decorate([
325
+ ValidateForm('profileForm'),
326
+ __metadata("design:type", Function),
327
+ __metadata("design:paramtypes", []),
328
+ __metadata("design:returntype", void 0)
329
+ ], AccountDetailsComponent.prototype, "onProfileFormSubmit", null);
330
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AccountDetailsComponent, decorators: [{
331
+ type: Component,
332
+ args: [{ selector: 'pw-account-details', template: "<div class=\"w-100 text-center mt-3\">\n <ng-template [ngIf]=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </ng-template>\n</div>\n<div class=\"row d-flex flex-row\">\n <div class=\"col-md-8 order-md-first order-sm-last\">\n <section id=\"email-section\">\n <div class=\"row\">\n <div class=\"col-sm-12 col-md-8 col-lg-8\">\n <h2>{{ 'User.Account.RegisteredEmail' | transloco }}</h2>\n <!-- Email Form -->\n <section id=\"email-form\">\n <form [formGroup]=\"emailForm\"\n (ngSubmit)=\"onEmailFormSubmit()\">\n <!-- Email Address -->\n <div class=\"mt-0\">\n <label class=\"me-3\">{{ 'User.Account.PrimaryEmail' | transloco }}:\n </label>\n <strong>{{ validatedEmail }}</strong>\n <div class=\"mt-1\">\n <ng-container *ngIf=\"!toggleEmail\">\n <a class=\"btn btn-raised btn-outline-primary\"\n href=\"javascript:void(0)\"\n (click)=\"shouldUserChangeEmail()\">\n {{ 'User.Account.ChangeEmail' | transloco }}</a>\n </ng-container>\n <ng-container *ngIf=\"toggleEmail\">\n <div class=\"row\">\n <div class=\"clearfix\"></div>\n <div class=\"col-12 mb-3\">\n <input type=\"password\"\n class=\"form-control\"\n id=\"pwd\"\n #password\n *ngIf=\"!passwordVerified\"\n placeholder=\"Current Password\"\n (keyup)=\"checkValidity()\" />\n <input type=\"text\"\n class=\"form-control\"\n id=\"email\"\n *ngIf=\"passwordVerified\"\n placeholder=\"New Email\"\n formControlName=\"email\" />\n </div>\n <div class=\"col-12\">\n <a *ngIf=\"toggleEmail\"\n class=\"btn btn-raised btn-outline-default my-2 me-2\"\n href=\"javascript:void(0)\"\n (click)=\"onToggleEmail()\">{{ 'Button.Cancel' | transloco }}</a>\n <button class=\"btn btn-raised btn-primary\"\n type=\"submit\"\n (click)=\"validatePassword()\"\n *ngIf=\"!passwordVerified\"\n [disabled]=\"isCurrentPasswordValid\">\n {{ 'User.Account.Validate' | transloco }}\n </button>\n <button type=\"submit\"\n class=\"btn btn-raised btn-primary\"\n *ngIf=\"passwordVerified\">\n {{\n 'User.Account.SendVerification' | transloco\n }}\n </button>\n </div>\n </div>\n </ng-container>\n </div>\n </div>\n <section id=\"slug\"\n class=\"mb-2 mt-3\">\n <div>\n <label class=\"me-3\">{{ 'User.Account.NickName' | transloco }}:\n </label>\n <strong>{{ slug }}</strong>\n <div>\n <ng-container *ngIf=\"!toggleNickName\">\n <a class=\"btn btn-raised btn-outline-primary me-2\"\n href=\"javascript:void(0)\"\n (click)=\"toggleNickName = true\">\n {{ 'User.Account.ChangeNickname' | transloco }}</a>\n </ng-container>\n <ng-container *ngIf=\"toggleNickName\">\n <div class=\"mb-3\">\n <input type=\"text\"\n class=\"form-control slug-input\"\n [(ngModel)]=\"slug\"\n [ngModelOptions]=\"{ standalone: true }\" />\n </div>\n <div>\n <button type=\"button\"\n class=\"btn btn-raised btn-outline-default\"\n (click)=\"toggleNickName = false\">\n {{ 'Button.Cancel' | transloco }}\n </button>\n <button type=\"button\"\n class=\"btn btn-raised btn-primary ms-2\"\n [disabled]=\"slug?.length < 2\"\n (click)=\"onUpdateSlug()\">\n {{ 'User.Account.UpdateNickname' | transloco }}\n </button>\n </div>\n </ng-container>\n </div>\n </div>\n </section>\n </form>\n </section>\n </div>\n </div>\n <section id=\"password-change\"\n class=\"mt-1\">\n <form [formGroup]=\"passwordForm\"\n (ngSubmit)=\"onPasswordFormSubmit()\">\n <div class=\"row\">\n <div class=\"col-sm-12 col-md-8 col-lg-8 mt-4\">\n <h2>{{ 'User.Account.ChangePassword' | transloco }}</h2>\n </div>\n <ng-container *ngIf=\"!user?.has_password\">\n <div class=\"text-danger mx-3 my-2\">\n <div>\n You don't have a password set, click on\n <em>{{ 'User.Account.ChangePassword' | transloco }}</em>.\n </div>\n <div>{{ 'User.Profile.PictureMessage' | transloco }}</div>\n </div>\n </ng-container>\n <div class=\"col-sm-12 col-md-8 col-lg-8\"\n *ngIf=\"user?.has_password\">\n <ng-container *ngIf=\"togglePassword\">\n <div class=\"mb-3\">\n <label>{{ 'User.Account.CurrentPassword' | transloco }}</label>\n <input type=\"password\"\n class=\"form-control\"\n formControlName=\"currentPassword\" />\n <small class=\"form-text text-muted danger\"\n *ngIf=\"\n !passwordForm.get('currentPassword').valid &&\n (passwordForm.get('currentPassword').dirty ||\n passwordForm.get('currentPassword').touched)\n \">\n {{ 'User.Account.Required' | transloco }}\n </small>\n </div>\n <div class=\"mb-3\">\n <label>{{ 'User.Account.NewPassword' | transloco }}</label>\n <input type=\"password\"\n class=\"form-control\"\n formControlName=\"newPassword\" />\n <small class=\"form-text text-muted danger\"\n *ngIf=\"\n !passwordForm.get('newPassword').valid &&\n (passwordForm.get('newPassword').dirty ||\n passwordForm.get('newPassword').touched)\n \">{{ 'User.Account.Validation.StrongPassword' | transloco }}\n </small>\n </div>\n <div class=\"mb-3\">\n <label for=\"password\">{{\n 'User.Account.ConfirmPassword' | transloco\n }}</label>\n <input type=\"password\"\n class=\"form-control\"\n formControlName=\"confirmPassword\" />\n <div class=\"text-danger\"\n *ngIf=\"\n passwordForm.get('confirmPassword').touched &&\n passwordForm.get('confirmPassword').errors\n ?.MatchPassword\n \">\n {{ 'User.Account.Validation.PasswordsMatch' | transloco }}\n </div>\n </div>\n <div class=\"mb-3\">\n <a class=\"btn btn-raised btn-outline-default\"\n href=\"javascript:void(0)\"\n data-bs-target=\"\"\n *ngIf=\"togglePassword\"\n (click)=\"onTogglePassword()\">\n {{ 'Button.Cancel' | transloco }}</a>\n <button class=\"btn btn-raised btn-primary ms-2\"\n [disabled]=\"!passwordForm.valid\">\n {{ 'User.Account.UpdatePassword' | transloco }}\n </button>\n </div>\n </ng-container>\n <div>\n <a class=\"btn btn-raised btn-outline-primary\"\n href=\"javascript:void(0)\"\n data-bs-target=\"\"\n *ngIf=\"!togglePassword\"\n (click)=\"togglePassword = !togglePassword\">\n {{ 'User.Account.ChangePassword' | transloco }}</a>\n </div>\n </div>\n <div class=\"col-sm-12 col-md-8 col-lg-8\"\n *ngIf=\"!user?.has_password\">\n <a class=\"btn btn-raised btn-primary me-2\"\n href=\"javascript:void(0)\"\n data-bs-target=\"\"\n (click)=\"sendMailToResetPassword()\">\n {{ 'User.Account.ChangePassword' | transloco }}</a>\n </div>\n </div>\n </form>\n </section>\n </section>\n </div>\n <!-- Avatar -->\n <div class=\"mt-4 mt-sm-0 col-md-4 text-center order-md-last order-sm-first\">\n <h2>{{ 'User.Profile.Avatar' | transloco }}</h2>\n <div class=\"text-center mt-1\">\n <div class=\"image-container\">\n <img [src]=\"image\"\n width=\"150\"\n height=\"150\"\n class=\"image rounded-circle\"\n alt=\"User's Avatar\"\n onerror=\"this.onerror=null;this.src='assets/img/icons/male.png';\" />\n <div class=\"overlay\"\n (click)=\"openModal(content)\">\n <div class=\"overlay-text\">{{ 'User.Profile.Change' | transloco }}</div>\n </div>\n </div>\n <h4 class=\"mt-2\">{{ user?.first_name }} {{ user?.last_name }}</h4>\n <a href=\"javascript:void(0)\"\n class=\"d-inline-block mb-2\"\n (click)=\"openModal(content)\">\n {{ 'User.Profile.EditAvatar' | transloco }}</a>\n <br />\n </div>\n </div>\n</div>\n<br />\n<section id=\"user-profile\"\n class=\"mt-2\">\n <div class=\"row\">\n <div class=\"col-12\">\n <form [formGroup]=\"profileForm\"\n (ngSubmit)=\"onProfileFormSubmit()\">\n <h2>{{ 'User.Profile.UserProfile' | transloco }}</h2>\n <div class=\"row mt-3\">\n <div class=\"col-sm-12 col-md-6 col-lg-6\">\n <pw-input-container label=\"First Name\"\n name=\"first_name\"\n errorMsg=\"Please enter first Name\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"first_name\"\n id=\"first_name\" />\n </pw-input-container>\n <pw-input-container label=\"Preferred name\"\n name=\"preferred_name\"\n errorMsg=\"Please enter preferred Name\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"preferred_name\"\n id=\"preferred_name\" />\n </pw-input-container>\n <ng-container *ngIf=\"countries$ | async as countries\">\n <pw-input-container label=\"Country\"\n name=\"country\"\n errorMsg=\"Please select a country\">\n <select id=\"country\"\n class=\"form-select form-control\"\n formControlName=\"country\"\n (change)=\"getRegion($event.target.value)\">\n <option value=\"0\">\n {{ 'User.Profile.SelectCountry' | transloco }}\n </option>\n <option *ngFor=\"let country of countries\"\n [value]=\"country.code\">\n {{ country.name }}\n </option>\n </select>\n </pw-input-container>\n </ng-container>\n <pw-input-container label=\"Province\"\n name=\"province\"\n errorMsg=\"Please enter province\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"province\" />\n </pw-input-container>\n <pw-input-container label=\"Website Url\"\n name=\"website_url\"\n errorMsg=\"Please enter Website\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"website_url\" />\n </pw-input-container>\n </div>\n <div class=\"col-sm-12 col-md-6 col-lg-6\">\n <pw-input-container label=\"Last Name\"\n name=\"last_name\"\n errorMsg=\"Please enter last Name\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"last_name\"\n id=\"last_name\" />\n </pw-input-container>\n <pw-input-container label=\"Date of Birth\"\n name=\"dob\"\n errorMsg=\"Please enter date of birth\">\n <div class=\"input-group\">\n <input class=\"form-control\"\n placeholder=\"dd-mm-yyyy\"\n formControlName=\"dob\"\n ngbDatepicker\n #d=\"ngbDatepicker\"\n [minDate]=\"{ day: 1, month: 1, year: 1950 }\"\n [maxDate]=\"{ day: 31, month: 12, year: 2018 }\" />\n <div class=\"input-group-append\">\n <button class=\"btn btn-primary\"\n (click)=\"d.toggle()\"\n type=\"button\">\n <i class=\"fa fa-calendar\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </div>\n </pw-input-container>\n <pw-input-container label=\"State\"\n name=\"state\"\n errorMsg=\"Please select a state\">\n <select id=\"state\"\n class=\"form-select form-control\"\n [(value)]=\"selectedState\"\n formControlName=\"state\">\n <option value=\"0\">\n {{ 'User.Profile.SelectState' | transloco }}\n </option>\n <option *ngFor=\"let state of states\"\n [value]=\"state.code\">\n {{ state.name }}\n </option>\n </select>\n </pw-input-container>\n <!-- Location -->\n <pw-input-container label=\"Location\"\n name=\"location\">\n <input ngx-google-places-autocomplete\n class=\"form-control\"\n #places=\"ngx-places\"\n formControlName=\"location\"\n (onAddressChange)=\"handleAddressChange($event)\" />\n </pw-input-container>\n <pw-input-container label=\"Phone Number\"\n name=\"phone_number\"\n errorMsg=\"Please enter phone number\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"phone_number\"\n id=\"phone_number\" />\n </pw-input-container>\n </div>\n <div class=\"col-12 text-end\">\n <div class=\"mb-3\">\n <button class=\"btn btn-raised btn-primary\">\n {{ 'Button.Save' | transloco }}\n </button>\n </div>\n </div>\n </div>\n </form>\n </div>\n </div>\n</section>\n<ng-template #content\n let-modal>\n <div class=\"card m-0\">\n <div class=\"card-content\">\n <div class=\"card-title\">\n <h3 class=\"modal-title\">{{ 'User.Profile.ProfilePicture' | transloco }}</h3>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"card-header\">\n <small> {{ 'User.Profile.PictureMessage' | transloco }}</small>\n <pw-image-cropper #profile\n aspectRatio=\"auto\"\n (imageSelectionEvent)=\"onImageSelection($event)\"\n (closeEvent)=\"onClose()\">\n </pw-image-cropper>\n </div>\n </div>\n </div>\n</ng-template>\n", styles: [".overlay{left:50%;opacity:0;position:absolute;text-align:center;top:50%;transform:translate(-50%,-50%);transition:.5s ease}.image-container{position:relative}.image-container:hover .image{opacity:.3}.image-container:hover .overlay{opacity:0}.overlay-text{background:rgba(240,239,239,.5);border-radius:50%;color:#000;font-size:16px;height:150px;line-height:150px;text-align:center;vertical-align:middle;width:150px}@media screen and (max-width: 767px){.card-body{padding:20px!important}}\n"] }]
333
+ }], ctorParameters: function () { return [{ type: i2.UntypedFormBuilder }, { type: i1$1.NgbModal }, { type: i1$2.AuthService }, { type: i1$2.GeoService }, { type: i1$2.ProfileService }, { type: i0.Injector }]; }, propDecorators: { passwordRef: [{
334
+ type: ViewChild,
335
+ args: ['password', { static: false }]
336
+ }], places: [{
337
+ type: ViewChild,
338
+ args: ['places', { static: true }]
339
+ }], onProfileFormSubmit: [] } });
340
+
341
+ class AddSubscriptionComponent extends AppBaseComponent {
342
+ constructor(productService, injector) {
343
+ super(injector);
344
+ this.productService = productService;
345
+ this.availableProducts = [];
346
+ this.category = PRODUCT_CATEGORY;
347
+ this.singleProducts = [];
348
+ this.enterpriseProducts = [];
349
+ this.units = 1;
350
+ this.subscribedPermissionKeys = [];
351
+ }
352
+ ngOnInit() {
353
+ this.subscriptionId = Number(this.route.snapshot.queryParamMap.get('subscription_id'));
354
+ this.getProducts();
355
+ }
356
+ getProducts() {
357
+ // Gets All the products
358
+ this.productService
359
+ .getProductList({}, this.subscriptionId, { only_relevant: true })
360
+ .subscribe((response) => {
361
+ var _a;
362
+ this.products = response.products || [];
363
+ if ((_a = this.products) === null || _a === void 0 ? void 0 : _a.length) {
364
+ this.products = this.products.filter(x => x.active);
365
+ }
366
+ this.isLoaded = true;
367
+ this.userStore().subscribe(user => {
368
+ this.user = user;
369
+ if (this.user) {
370
+ const subs = cloneDeep(this.user.subscriptions);
371
+ subs.forEach(subscription => {
372
+ subscription.products.forEach(product => {
373
+ const prod = this.products.find(x => x.id === product.id);
374
+ if (prod) {
375
+ prod['is_subscribed'] = true;
376
+ prod['purchased_units'] = product === null || product === void 0 ? void 0 : product.purchased_units;
377
+ }
378
+ });
379
+ });
380
+ this.subscribedPermissionKeys = Array.from(new Set(this.user.subscriptions
381
+ .flatMap(x => x.products)
382
+ .map(product => product.permission_key)));
383
+ // show category only if we have products
384
+ const prodPermissionKeys = this.products.map(p => p.permission_key);
385
+ this.subscribedPermissionKeys = this.subscribedPermissionKeys.filter(x => prodPermissionKeys.includes(x));
386
+ // Filtering the product with the existing permission_key
387
+ this.availableProducts = sortBy(this.getSingleCategoryProducts(), 'is_subscribed');
388
+ }
389
+ });
390
+ });
391
+ }
392
+ getSingleCategoryProducts(category = this.subscribedPermissionKeys[0]) {
393
+ return this.products.filter(x => category === x.permission_key);
394
+ }
395
+ onChangeCategory(category) {
396
+ this.availableProducts = this.getSingleCategoryProducts(category);
397
+ this.availableProducts = sortBy(this.availableProducts, 'is_subscribed');
398
+ }
399
+ onSelection(product) {
400
+ this.router.navigate([
401
+ `account/subscriptions/upgrade/${this.subscriptionId}/${product.id}`
402
+ ]);
403
+ }
404
+ trackByProduct(_index, item) {
405
+ return item.id;
406
+ }
407
+ ngOnDestroy() {
408
+ super.ngOnDestroy();
409
+ }
410
+ }
411
+ AddSubscriptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AddSubscriptionComponent, deps: [{ token: i1$2.ProductService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
412
+ AddSubscriptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: AddSubscriptionComponent, selector: "pw-add-subscription", usesInheritance: true, ngImport: i0, template: "<div *ngIf=\"isLoaded && !selectedProduct\"\n class=\"mt-4\">\n <a href=\"javascript:void(0)\"\n [routerLink]=\"['/account/subscriptions']\"\n class=\"previous float-start\"><i class=\"fa fa-arrow-alt-circle-left\" aria-hidden=\"true\"></i>\n </a>\n\n <div class=\"d-flex flex-wrap justify-content-center\">\n <div class=\"toggle\"\n *ngFor=\"let item of subscribedPermissionKeys; let i = index\">\n <input type=\"radio\"\n name=\"sizeBy\"\n value=\"option{{ i + 1 }}\"\n id=\"option{{ i + 1 }}\"\n (change)=\"onChangeCategory(item)\"\n [checked]=\"i === 0\" />\n <label for=\"option{{ i + 1 }}\">{{ item }}</label>\n </div>\n </div>\n\n <ul class=\"row animated fadeIn d-flex\">\n <li *ngFor=\"let product of availableProducts; trackBy: trackByProduct\"\n class=\"col-sm-12 col-md-6 col-xl-4 my-3 mt-sm-2\">\n <div class=\"card\">\n <div class=\"card-content\">\n <div class=\"card-header\">\n <h4 class=\"text-bold-500 primary mb-3\">{{ product.name }}</h4>\n <ng-template [ngIf]=\"product.price_per_unit\"\n [ngIfElse]=\"freeProductRef\">\n <h5 *ngIf=\"product?.purchased_units\"\n class=\"my-3 branding-color-1\">\n Currently {{ product.currency | currencySymbol\n }}{{\n (\n (product.purchased_units * product.price_per_unit) /\n 100\n ).toFixed(2)\n }}&nbsp;/&nbsp;{{ product.billing_frequency }}\n </h5>\n <h5 class=\"my-3\">\n Min\n {{product.min_units &gt; 1 ? (product.min_units + ' Seats'): (product.min_units + ' Seat')}}\n - {{ product.currency | currencySymbol\n }}{{\n ((product.min_units * product.price_per_unit) / 100).toFixed(2)\n }}&nbsp;/&nbsp;{{ product.billing_frequency }}\n </h5>\n <h5 class=\"d-inline-block text-bold-600 mb-2\">\n {{ product.currency | currencySymbol\n }}{{ (product.price_per_unit / 100).toFixed(2) }}&nbsp;/&nbsp;{{\n product.billing_frequency\n }}&nbsp;/&nbsp;seat\n </h5>\n </ng-template>\n <ng-template #freeProductRef>\n <div class=\"d-inline-block text-bold-600 mb-2\">Free</div>\n </ng-template>\n <p class=\"mb-2\"\n [innerHTML]=\"product?.description\"></p>\n </div>\n <div class=\"card-footer px-3\">\n <a href=\"javascript:void(0)\"\n (click)=\"onSelection(product)\"\n *ngIf=\"\n !product.is_subscribed &&\n !product.trial_subscription &&\n product.stripe_plan_id\n \"\n class=\"card-btn btn btn-raised me-1 btn-primary btn-sm\">\n {{ 'User.Subscriptions.Subscribe' | transloco }}\n </a>\n\n <div class=\"mt-3\"\n *ngIf=\"\n !product.is_subscribed &&\n product.trial_subscription &&\n product.stripe_plan_id\n \">\n <a href=\"javascript:void(0)\"\n (click)=\"onSelection(product)\"\n class=\"card-btn btn btn-raised me-1 btn-primary btn-sm\">\n {{ 'Button.Upgrade' | transloco }}\n </a>\n <span class=\"badge bg-secondary position-absolute trial-badge\">{{ 'User.Subscriptions.Trial' | transloco }}\n </span>\n </div>\n\n <span *ngIf=\"\n product.is_subscribed &&\n !product.trial_subscription &&\n !product.is_deleted\n \"\n class=\"card-btn badge bg-default text-white\">\n {{ 'User.Subscriptions.Subscribed' | transloco }}\n </span>\n\n <span *ngIf=\"\n product.is_subscribed &&\n product.trial_subscription &&\n product.price_per_unit === 0 &&\n !product.is_deleted &&\n !product.stripe_plan_id\n \"\n class=\"card-btn badge bg-default text-white\">\n Free\n </span>\n\n <span *ngIf=\"product.is_deleted\"\n class=\"card-btn badge bg-default text-white\">\n {{ 'User.Subscriptions.UnsubscribedButActive' | transloco }}\n </span>\n </div>\n </div>\n </div>\n </li>\n </ul>\n <div class=\"row\">\n <div class=\"col-12\">\n <pw-no-data message=\"No products available under this category.\"\n *ngIf=\"availableProducts && availableProducts.length === 0\">\n </pw-no-data>\n </div>\n </div>\n</div>\n", styles: [":root{--first: rgb(23 105 225);--second: rgb(54 194 131);--third: rgb(255 171 0);--text: rgb(34 34 34);--tabs_bg: rgb(23 105 225);--tabs_text: rgb(255 255 255);--titles: rgb(34 34 34);--sidebar_bg: rgb(0, 48, 63);--sidebar_text: rgb(255 255 255)}.card .card-body{position:relative}.card .card-body .bottom-text{bottom:15px;left:20px;position:absolute}.card .card-body .card-btn{bottom:15px;position:absolute}.card.shadow-md{height:100%}.card .primary{text-transform:uppercase}.trial-badge{bottom:15px;left:20px}.toggle{align-items:stretch;box-sizing:border-box;display:flex;flex-flow:row nowrap;font-size:0;justify-content:flex-start;margin:0}.toggle input{height:0;left:-9999px;position:absolute;width:0}.toggle input+label{background-color:#fff;border:solid 1px rgb(221,221,221);box-shadow:0 0 #fff0;box-sizing:border-box;display:inline-block;font-size:1rem;font-weight:600;line-height:140%;margin:0;padding:.75rem 2rem;position:relative;text-align:center;transition:border-color .15s ease-out,color .25s ease-out,background-color .15s ease-out,box-shadow .15s ease-out}.toggle input:hover+label{border-color:#213140}.toggle input:checked+label{background-color:var(--tabs_bg);border-color:var(--tabs_bg);box-shadow:0 0 10px #66b3fb80;color:var(--tabs_text);z-index:1}.shadow-md{height:100%;padding-bottom:50px!important}.fadeIn{animation-name:fadeIn}.animated{animation-duration:2s;animation-fill-mode:both}.card-btn{bottom:15px;position:absolute;right:20px}.card-footer{height:60px}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@media (max-width: 800px){.toggle{justify-content:center}.toggle input+label{align-items:center;display:flex;flex:0 0 70%;justify-content:center;padding:.75rem .25rem}}.branding-color-1{color:var(--first)!important}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: i10.TranslocoPipe, name: "transloco" }] });
413
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: AddSubscriptionComponent, decorators: [{
414
+ type: Component,
415
+ args: [{ selector: 'pw-add-subscription', template: "<div *ngIf=\"isLoaded && !selectedProduct\"\n class=\"mt-4\">\n <a href=\"javascript:void(0)\"\n [routerLink]=\"['/account/subscriptions']\"\n class=\"previous float-start\"><i class=\"fa fa-arrow-alt-circle-left\" aria-hidden=\"true\"></i>\n </a>\n\n <div class=\"d-flex flex-wrap justify-content-center\">\n <div class=\"toggle\"\n *ngFor=\"let item of subscribedPermissionKeys; let i = index\">\n <input type=\"radio\"\n name=\"sizeBy\"\n value=\"option{{ i + 1 }}\"\n id=\"option{{ i + 1 }}\"\n (change)=\"onChangeCategory(item)\"\n [checked]=\"i === 0\" />\n <label for=\"option{{ i + 1 }}\">{{ item }}</label>\n </div>\n </div>\n\n <ul class=\"row animated fadeIn d-flex\">\n <li *ngFor=\"let product of availableProducts; trackBy: trackByProduct\"\n class=\"col-sm-12 col-md-6 col-xl-4 my-3 mt-sm-2\">\n <div class=\"card\">\n <div class=\"card-content\">\n <div class=\"card-header\">\n <h4 class=\"text-bold-500 primary mb-3\">{{ product.name }}</h4>\n <ng-template [ngIf]=\"product.price_per_unit\"\n [ngIfElse]=\"freeProductRef\">\n <h5 *ngIf=\"product?.purchased_units\"\n class=\"my-3 branding-color-1\">\n Currently {{ product.currency | currencySymbol\n }}{{\n (\n (product.purchased_units * product.price_per_unit) /\n 100\n ).toFixed(2)\n }}&nbsp;/&nbsp;{{ product.billing_frequency }}\n </h5>\n <h5 class=\"my-3\">\n Min\n {{product.min_units &gt; 1 ? (product.min_units + ' Seats'): (product.min_units + ' Seat')}}\n - {{ product.currency | currencySymbol\n }}{{\n ((product.min_units * product.price_per_unit) / 100).toFixed(2)\n }}&nbsp;/&nbsp;{{ product.billing_frequency }}\n </h5>\n <h5 class=\"d-inline-block text-bold-600 mb-2\">\n {{ product.currency | currencySymbol\n }}{{ (product.price_per_unit / 100).toFixed(2) }}&nbsp;/&nbsp;{{\n product.billing_frequency\n }}&nbsp;/&nbsp;seat\n </h5>\n </ng-template>\n <ng-template #freeProductRef>\n <div class=\"d-inline-block text-bold-600 mb-2\">Free</div>\n </ng-template>\n <p class=\"mb-2\"\n [innerHTML]=\"product?.description\"></p>\n </div>\n <div class=\"card-footer px-3\">\n <a href=\"javascript:void(0)\"\n (click)=\"onSelection(product)\"\n *ngIf=\"\n !product.is_subscribed &&\n !product.trial_subscription &&\n product.stripe_plan_id\n \"\n class=\"card-btn btn btn-raised me-1 btn-primary btn-sm\">\n {{ 'User.Subscriptions.Subscribe' | transloco }}\n </a>\n\n <div class=\"mt-3\"\n *ngIf=\"\n !product.is_subscribed &&\n product.trial_subscription &&\n product.stripe_plan_id\n \">\n <a href=\"javascript:void(0)\"\n (click)=\"onSelection(product)\"\n class=\"card-btn btn btn-raised me-1 btn-primary btn-sm\">\n {{ 'Button.Upgrade' | transloco }}\n </a>\n <span class=\"badge bg-secondary position-absolute trial-badge\">{{ 'User.Subscriptions.Trial' | transloco }}\n </span>\n </div>\n\n <span *ngIf=\"\n product.is_subscribed &&\n !product.trial_subscription &&\n !product.is_deleted\n \"\n class=\"card-btn badge bg-default text-white\">\n {{ 'User.Subscriptions.Subscribed' | transloco }}\n </span>\n\n <span *ngIf=\"\n product.is_subscribed &&\n product.trial_subscription &&\n product.price_per_unit === 0 &&\n !product.is_deleted &&\n !product.stripe_plan_id\n \"\n class=\"card-btn badge bg-default text-white\">\n Free\n </span>\n\n <span *ngIf=\"product.is_deleted\"\n class=\"card-btn badge bg-default text-white\">\n {{ 'User.Subscriptions.UnsubscribedButActive' | transloco }}\n </span>\n </div>\n </div>\n </div>\n </li>\n </ul>\n <div class=\"row\">\n <div class=\"col-12\">\n <pw-no-data message=\"No products available under this category.\"\n *ngIf=\"availableProducts && availableProducts.length === 0\">\n </pw-no-data>\n </div>\n </div>\n</div>\n", styles: [":root{--first: rgb(23 105 225);--second: rgb(54 194 131);--third: rgb(255 171 0);--text: rgb(34 34 34);--tabs_bg: rgb(23 105 225);--tabs_text: rgb(255 255 255);--titles: rgb(34 34 34);--sidebar_bg: rgb(0, 48, 63);--sidebar_text: rgb(255 255 255)}.card .card-body{position:relative}.card .card-body .bottom-text{bottom:15px;left:20px;position:absolute}.card .card-body .card-btn{bottom:15px;position:absolute}.card.shadow-md{height:100%}.card .primary{text-transform:uppercase}.trial-badge{bottom:15px;left:20px}.toggle{align-items:stretch;box-sizing:border-box;display:flex;flex-flow:row nowrap;font-size:0;justify-content:flex-start;margin:0}.toggle input{height:0;left:-9999px;position:absolute;width:0}.toggle input+label{background-color:#fff;border:solid 1px rgb(221,221,221);box-shadow:0 0 #fff0;box-sizing:border-box;display:inline-block;font-size:1rem;font-weight:600;line-height:140%;margin:0;padding:.75rem 2rem;position:relative;text-align:center;transition:border-color .15s ease-out,color .25s ease-out,background-color .15s ease-out,box-shadow .15s ease-out}.toggle input:hover+label{border-color:#213140}.toggle input:checked+label{background-color:var(--tabs_bg);border-color:var(--tabs_bg);box-shadow:0 0 10px #66b3fb80;color:var(--tabs_text);z-index:1}.shadow-md{height:100%;padding-bottom:50px!important}.fadeIn{animation-name:fadeIn}.animated{animation-duration:2s;animation-fill-mode:both}.card-btn{bottom:15px;position:absolute;right:20px}.card-footer{height:60px}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@media (max-width: 800px){.toggle{justify-content:center}.toggle input+label{align-items:center;display:flex;flex:0 0 70%;justify-content:center;padding:.75rem .25rem}}.branding-color-1{color:var(--first)!important}\n"] }]
416
+ }], ctorParameters: function () { return [{ type: i1$2.ProductService }, { type: i0.Injector }]; } });
417
+
418
+ /**
419
+ * @summary Shows the saved credit card details of the user
420
+ * @author anikets43
421
+ *
422
+ * Created at : 2020-02-08 16:56:18
423
+ * Last modified : 2020-02-08 17:06:29
424
+ */
425
+ class SavedCardDetailsComponent {
426
+ constructor() {
427
+ /**
428
+ * Emitter: on payment change request
429
+ */
430
+ this.changeEvent = new EventEmitter();
431
+ }
432
+ OnPaymentChange(value) {
433
+ this.changeEvent.emit(value);
434
+ }
435
+ }
436
+ SavedCardDetailsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SavedCardDetailsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
437
+ SavedCardDetailsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: SavedCardDetailsComponent, selector: "pw-saved-card-details", inputs: { data: "data", isChangePayment: "isChangePayment", showNewCard: "showNewCard" }, outputs: { changeEvent: "changeEvent" }, ngImport: i0, template: "<div class=\"row\">\n <div class=\"col-12\"\n *ngIf=\"!showNewCard\">\n <h4 class=\"title\">Saved Card</h4>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">Type:</div>\n <div class=\"summary-right\">{{ data?.brand }}</div>\n </div>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">Expiry:</div>\n <div class=\"summary-right\">{{ data.exp_month }} / {{ data.exp_year }}</div>\n </div>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">Card Number:</div>\n <div class=\"summary-right\">{{ data?.card_number }}</div>\n </div>\n </div>\n\n <div class=\"col-12 mt-3\"\n *ngIf=\"!showNewCard\">\n <a href=\"javascript:void(0)\"\n (click)=\"OnPaymentChange(true)\">Change Payment Option</a>\n </div>\n</div>\n", styles: [".summary-row{padding-left:10px;padding-right:10px}.summary-row.total{border-top:1px solid rgb(204,204,204);font-weight:500}.summary-left{-webkit-box-flex:1;color:#555;flex-grow:1;-ms-flex-positive:1;font-weight:600;text-align:left}.summary-left.plan{color:#c93f00;font-size:14px;margin:5px 0}.summary-right{-webkit-box-flex:1;-webkit-box-pack:end;color:#000;flex-grow:1;-ms-flex-pack:end;-ms-flex-positive:1;justify-content:flex-end;text-align:right}h4{border-bottom:1px solid rgb(0,0,0);font-size:1rem;font-weight:600;margin:0 0 20px;padding:0 0 5px;text-transform:uppercase}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
438
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SavedCardDetailsComponent, decorators: [{
439
+ type: Component,
440
+ args: [{ selector: 'pw-saved-card-details', template: "<div class=\"row\">\n <div class=\"col-12\"\n *ngIf=\"!showNewCard\">\n <h4 class=\"title\">Saved Card</h4>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">Type:</div>\n <div class=\"summary-right\">{{ data?.brand }}</div>\n </div>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">Expiry:</div>\n <div class=\"summary-right\">{{ data.exp_month }} / {{ data.exp_year }}</div>\n </div>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">Card Number:</div>\n <div class=\"summary-right\">{{ data?.card_number }}</div>\n </div>\n </div>\n\n <div class=\"col-12 mt-3\"\n *ngIf=\"!showNewCard\">\n <a href=\"javascript:void(0)\"\n (click)=\"OnPaymentChange(true)\">Change Payment Option</a>\n </div>\n</div>\n", styles: [".summary-row{padding-left:10px;padding-right:10px}.summary-row.total{border-top:1px solid rgb(204,204,204);font-weight:500}.summary-left{-webkit-box-flex:1;color:#555;flex-grow:1;-ms-flex-positive:1;font-weight:600;text-align:left}.summary-left.plan{color:#c93f00;font-size:14px;margin:5px 0}.summary-right{-webkit-box-flex:1;-webkit-box-pack:end;color:#000;flex-grow:1;-ms-flex-pack:end;-ms-flex-positive:1;justify-content:flex-end;text-align:right}h4{border-bottom:1px solid rgb(0,0,0);font-size:1rem;font-weight:600;margin:0 0 20px;padding:0 0 5px;text-transform:uppercase}\n"] }]
441
+ }], propDecorators: { data: [{
442
+ type: Input
443
+ }], isChangePayment: [{
444
+ type: Input
445
+ }], showNewCard: [{
446
+ type: Input
447
+ }], changeEvent: [{
448
+ type: Output
449
+ }] } });
450
+
451
+ class SubscriptionCredentialComponent extends AppBaseComponent {
452
+ constructor(fb, subscriptionService, injector) {
453
+ super(injector);
454
+ this.fb = fb;
455
+ this.subscriptionService = subscriptionService;
456
+ this.data = [];
457
+ this.isEdit = false;
458
+ this.submitted = false;
459
+ this.buttonBusy = false;
460
+ this.availableCredentials = [];
461
+ this.isLoaded = false;
462
+ this.credentials = [];
463
+ this.uniqueCredential = [];
464
+ this.showForm = false;
465
+ this.form = this.fb.group({
466
+ credentials: this.fb.array([])
467
+ });
468
+ }
469
+ ngOnInit() {
470
+ this.route.params.subscribe(params => {
471
+ this.subscriptionId = params['subscriptionId'];
472
+ if (this.subscriptionId) {
473
+ this.getAllCredentials();
474
+ }
475
+ });
476
+ }
477
+ get credentialsGroup() {
478
+ return this.form.get('credentials');
479
+ }
480
+ /** Function to get all credentials */
481
+ getAllCredentials() {
482
+ this.allSubscriptionCredentials = [];
483
+ this.subscriptionService
484
+ .getAllSubscriptionCredentials(this.subscriptionId)
485
+ .subscribe(response => {
486
+ this.allSubscriptionCredentials = response.subscription_credentials;
487
+ this.totalRecords = response.object_count;
488
+ this.getAllAvailableCredentials();
489
+ })
490
+ .add(() => {
491
+ this.isLoaded = true;
492
+ });
493
+ }
494
+ /** Function to get available Credentials */
495
+ getAllAvailableCredentials() {
496
+ this.credentials = [];
497
+ this.uniqueCredential = [];
498
+ this.subscriptionService.getAllCredentials().subscribe(response => {
499
+ this.availableCredentials = response.credentials;
500
+ from(this.availableCredentials)
501
+ .pipe(distinct(c => c.name))
502
+ .subscribe(res => {
503
+ this.uniqueCredential.push(res);
504
+ });
505
+ this.uniqueCredential.forEach(credential => {
506
+ const subscriptionCredentialGroup = { credential_name: '', credentials: [] };
507
+ this.allSubscriptionCredentials.forEach(subscriptionCredential => {
508
+ if (credential.name === subscriptionCredential.name) {
509
+ subscriptionCredentialGroup['credentials'].push(subscriptionCredential);
510
+ }
511
+ });
512
+ if (subscriptionCredentialGroup['credentials'].length > 0) {
513
+ subscriptionCredentialGroup['credential_name'] = credential.name;
514
+ this.credentials.push(subscriptionCredentialGroup);
515
+ }
516
+ });
517
+ });
518
+ }
519
+ /** Function to get credential on select */
520
+ selectedOption(event) {
521
+ this.credentialsGroup.clear();
522
+ const credentialName = this.isEdit ? event : event.target.value;
523
+ this.credentialsSelect = this.availableCredentials.filter(x => x.name === credentialName);
524
+ this.credentialsSelect.forEach(adminCredential => {
525
+ const subscriptionCredential = this.allSubscriptionCredentials.find(credential => (credential === null || credential === void 0 ? void 0 : credential.credential_id) === (adminCredential === null || adminCredential === void 0 ? void 0 : adminCredential.id));
526
+ adminCredential.value = subscriptionCredential === null || subscriptionCredential === void 0 ? void 0 : subscriptionCredential.value;
527
+ adminCredential.subscription_credential_id = subscriptionCredential === null || subscriptionCredential === void 0 ? void 0 : subscriptionCredential.id;
528
+ adminCredential.credential_id = subscriptionCredential === null || subscriptionCredential === void 0 ? void 0 : subscriptionCredential.credential_id;
529
+ this.credentialsGroup.push(this.fb.group({
530
+ subscription_id: [0, [Validators.required]],
531
+ credential_id: [adminCredential === null || adminCredential === void 0 ? void 0 : adminCredential.id],
532
+ field: [adminCredential === null || adminCredential === void 0 ? void 0 : adminCredential.field],
533
+ description: [adminCredential === null || adminCredential === void 0 ? void 0 : adminCredential.description],
534
+ value: [
535
+ adminCredential === null || adminCredential === void 0 ? void 0 : adminCredential.value,
536
+ (adminCredential === null || adminCredential === void 0 ? void 0 : adminCredential.is_required) ? [Validators.required] : []
537
+ ],
538
+ id: [subscriptionCredential === null || subscriptionCredential === void 0 ? void 0 : subscriptionCredential.id]
539
+ }));
540
+ });
541
+ }
542
+ /** Function to post credentials */
543
+ saveCredentials() {
544
+ this.submitted = true;
545
+ this.buttonBusy = true;
546
+ const subscription$ = [];
547
+ const isValid = this.form.value.credentials.every((_x, i) => this.credentialsGroup.controls[i].valid === true);
548
+ if (isValid) {
549
+ this.form.value.credentials.forEach(credential => {
550
+ if (credential === null || credential === void 0 ? void 0 : credential.value) {
551
+ const data = {
552
+ subscription_id: this.subscriptionId,
553
+ credential_id: credential.credential_id,
554
+ value: credential.value
555
+ };
556
+ const sub$ = (credential === null || credential === void 0 ? void 0 : credential.id)
557
+ ? this.subscriptionService.editSubscriptionCredential(credential.id, data)
558
+ : this.subscriptionService.postSubscriptionCredential(data);
559
+ subscription$.push(sub$);
560
+ }
561
+ });
562
+ forkJoin(subscription$)
563
+ .subscribe(response => {
564
+ if (response === null || response === void 0 ? void 0 : response.length) {
565
+ this.toast.success(this.translation.translate('User.Subscriptions.SubscriptionCredentials.UpdateMessage'));
566
+ }
567
+ else {
568
+ this.toast.error(`Something went wrong while saving credentials`);
569
+ }
570
+ })
571
+ .add(() => {
572
+ this.submitted = false;
573
+ this.buttonBusy = false;
574
+ });
575
+ }
576
+ else {
577
+ this.buttonBusy = false;
578
+ }
579
+ }
580
+ revealCredentials(credential) {
581
+ this.credentialToReveal = credential.credential_name;
582
+ this.passwordValidationModalForRevealCredential.open();
583
+ }
584
+ hideCredentials() {
585
+ this.credentialName = '';
586
+ }
587
+ showCredentials() {
588
+ this.credentialName = this.credentialToReveal;
589
+ }
590
+ /** Function to get form controls */
591
+ get f() {
592
+ return this.form.controls;
593
+ }
594
+ onCancel() {
595
+ this.getAllCredentials();
596
+ this.submitted = false;
597
+ this.form.reset();
598
+ this.showForm = false;
599
+ this.isEdit = false;
600
+ this.credentialsSelect = [];
601
+ this.data = [];
602
+ this.credentialSaved = '';
603
+ }
604
+ // password popup for add credential
605
+ openCredentialsForAdd() {
606
+ this.passwordValidationModalForAddCredential.open();
607
+ }
608
+ // password popup for edit credential
609
+ openCredentialsForEdit(credential) {
610
+ this.credentialToEdit = credential;
611
+ this.passwordValidationModalForEditCredential.open();
612
+ }
613
+ editCredentials() {
614
+ this.showForm = true;
615
+ this.isEdit = true;
616
+ this.selectedOption(this.credentialToEdit);
617
+ }
618
+ showEditForm() {
619
+ this.data = [];
620
+ this.isEdit = false;
621
+ this.showForm = true;
622
+ }
623
+ ngOnDestroy() {
624
+ super.ngOnDestroy();
625
+ }
626
+ }
627
+ SubscriptionCredentialComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SubscriptionCredentialComponent, deps: [{ token: i2.UntypedFormBuilder }, { token: i1$2.SubscriptionService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
628
+ SubscriptionCredentialComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: SubscriptionCredentialComponent, selector: "pw-subscription-credential", viewQueries: [{ propertyName: "passwordValidationModalForRevealCredential", first: true, predicate: ["passwordValidationModalForRevealCredential"], descendants: true }, { propertyName: "passwordValidationModalForEditCredential", first: true, predicate: ["passwordValidationModalForEditCredential"], descendants: true }, { propertyName: "passwordValidationModalForAddCredential", first: true, predicate: ["passwordValidationModalForAddCredential"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"row\"\n *ngIf=\"showForm\">\n <div class=\"col-12 d-flex\">\n <a href=\"javascript:void(0)\"\n (click)=\"onCancel()\"\n class=\"previous\"><i class=\"fa fa-arrow-alt-circle-left\" aria-hidden=\"true\"></i></a>\n <h3 class=\"m-subheader__title m-subheader__title--separator\">\n <span>{{ data.length ? 'Edit' : 'Create new' }} Credential</span>\n </h3>\n </div>\n</div>\n<ng-container *ngIf=\"showForm\">\n <div class=\"container-fluid pw-tab\">\n <div class=\"p-2 mt-3\">\n <form>\n <div class=\"row mb-3\">\n <div class=\"col-12 col-md-4\"\n *ngIf=\"!isEdit && showForm\">\n <div class=\"mb-3\">\n <label>Credential <span class=\"text-danger\">*</span> </label>\n <select class=\"form-select\"\n (change)=\"selectedOption($event)\">\n <option>Select credential</option>\n <option *ngFor=\"let data of uniqueCredential\"\n value=\"{{ data.name }}\">\n {{ data.name }}\n </option>\n </select>\n </div>\n </div>\n\n <div class=\"col-12 col-md-4\"\n *ngIf=\"credentialsSelect?.length\">\n <div class=\"card pb-2 pt-2 overflow-visible\">\n <div class=\"card-content\">\n <div class=\"card-header\">\n <form [formGroup]=\"form\"\n novalidate\n (ngSubmit)=\"saveCredentials()\">\n <div formArrayName=\"credentials\">\n <div *ngFor=\"\n let credential of credentialsGroup.controls;\n let i = index\n \">\n <div [formGroupName]=\"i\">\n <div class=\"mb-3\">\n <pw-input-container label=\"{{\n credential.get('field').value\n }}\"\n [class.info-circle]=\"\n credential.get('description').value\n \"\n name=\"value\"\n errorMsg=\"Please enter value\">\n <span *ngIf=\"\n credential.get('description')\n .value\n \"\n class=\"tooltiptext gradient-custom-branding\">{{\n credential.get('description')\n .value\n }}</span>\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"value\"\n [ngClass]=\"{\n 'is-invalid':\n submitted &&\n credential.get('value')\n .invalid\n }\" />\n </pw-input-container>\n </div>\n </div>\n </div>\n </div>\n <div class=\"text-end mt-3\">\n <button type=\"submit\"\n [buttonBusy]=\"buttonBusy\"\n class=\"btn btn-primary\">\n {{ 'Button.Submit' | transloco }}\n </button>\n </div>\n </form>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12 text-end mt-3\">\n <button type=\"button\"\n class=\"btn btn-outline-default me-2\"\n (click)=\"onCancel()\">\n {{ 'Button.Back' | transloco }}\n </button>\n </div>\n </div>\n </form>\n </div>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"!showForm\">\n <div class=\"row\">\n <div class=\"col-12 d-flex\">\n <a href=\"javascript:void(0)\"\n (click)=\"back()\"\n class=\"previous\"><i class=\"fa fa-arrow-alt-circle-left\" aria-hidden=\"true\"></i></a>\n <h2 class=\"mt-3\">Credentials</h2>\n </div>\n <div class=\"col-12 col-md-12 text-end\">\n <button class=\"btn btn-sm btn-outline-primary\"\n (click)=\"openCredentialsForAdd()\">\n <i class=\"fa fa-plus-circle\" aria-hidden=\"true\"></i> {{ 'Add Credential' }}\n </button>\n </div>\n </div>\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n <div class=\"row my-4\">\n <div class=\"col-12 col-md-6 col-xl-4 mt-3 credential-cards\"\n *ngFor=\"let credential of credentials\">\n <div class=\"card\">\n <h2 class=\"credential-field mt-3\">{{ credential.credential_name }}</h2>\n <div class=\"card-content\"\n *ngFor=\"let subscriptionCredential of credential.credentials\">\n <div class=\"card-header\">\n <div>\n <strong class=\"d-block\">{{ subscriptionCredential.field }}:</strong>\n <input class=\"credential-value\"\n [type]=\"\n credentialName === credential.credential_name\n ? 'text'\n : 'password'\n \"\n readonly\n #input\n [value]=\"subscriptionCredential?.value\" />\n </div>\n </div>\n <div class=\"card-footer\">\n <div class=\"float-end px-2\">\n <button class=\"btn btn-outline-primary me-2\"\n *ngIf=\"credentialName !== credential.credential_name\"\n (click)=\"revealCredentials(credential)\">\n {{\n 'User.Subscriptions.SubscriptionCredentials.RevealCredential'\n | transloco\n }}\n </button>\n <button class=\"btn btn-outline-primary me-2\"\n *ngIf=\"credentialName === credential.credential_name\"\n (click)=\"hideCredentials()\">\n {{\n 'User.Subscriptions.SubscriptionCredentials.HideCredential'\n | transloco\n }}\n </button>\n <a class=\"me-2 my-1\"\n (click)=\"openCredentialsForEdit(credential.credential_name)\"><i class=\"fa fa-edit edit-icon\" aria-hidden=\"true\"></i></a>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div *ngIf=\"allSubscriptionCredentials?.length === 0 && isLoaded\"\n class=\"clearboth\">\n <pw-no-data [message]=\"'User.Subscriptions.SubscriptionCredentials.NoDataMessage' | transloco\">\n </pw-no-data>\n </div>\n</ng-container>\n<!-- password validation modal for reveal Credential -->\n<pw-password-validation #passwordValidationModalForRevealCredential\n (successEvent)=\"showCredentials()\">\n</pw-password-validation>\n<!-- password validation modal for Edit Credential -->\n<pw-password-validation #passwordValidationModalForEditCredential\n (successEvent)=\"editCredentials()\">\n</pw-password-validation>\n<!-- password validation modal for Add Credential -->\n<pw-password-validation #passwordValidationModalForAddCredential\n (successEvent)=\"showEditForm()\">\n</pw-password-validation>\n", styles: [".credential-field{text-align:center}.card .card-header{padding:0 24px}.credentials-field{border:0}.credential-value{border:0;width:100%}.overflow-visible{overflow:visible}\n"], dependencies: [{ kind: "directive", type: i3.ButtonBusyDirective, selector: "[buttonBusy]", inputs: ["buttonBusy", "busyText"] }, { kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i2.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i2.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "component", type: i7.PasswordValidationComponent, selector: "pw-password-validation", outputs: ["successEvent"] }, { kind: "component", type: i7.InputContainerComponent, selector: "pw-input-container", inputs: ["name", "label", "labelClass", "tooltipPosition", "required", "errorMsg", "isReadOnly", "showTooltip", "tooltipText"] }, { kind: "component", type: i5.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { kind: "pipe", type: i10.TranslocoPipe, name: "transloco" }] });
629
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SubscriptionCredentialComponent, decorators: [{
630
+ type: Component,
631
+ args: [{ selector: 'pw-subscription-credential', template: "<div class=\"row\"\n *ngIf=\"showForm\">\n <div class=\"col-12 d-flex\">\n <a href=\"javascript:void(0)\"\n (click)=\"onCancel()\"\n class=\"previous\"><i class=\"fa fa-arrow-alt-circle-left\" aria-hidden=\"true\"></i></a>\n <h3 class=\"m-subheader__title m-subheader__title--separator\">\n <span>{{ data.length ? 'Edit' : 'Create new' }} Credential</span>\n </h3>\n </div>\n</div>\n<ng-container *ngIf=\"showForm\">\n <div class=\"container-fluid pw-tab\">\n <div class=\"p-2 mt-3\">\n <form>\n <div class=\"row mb-3\">\n <div class=\"col-12 col-md-4\"\n *ngIf=\"!isEdit && showForm\">\n <div class=\"mb-3\">\n <label>Credential <span class=\"text-danger\">*</span> </label>\n <select class=\"form-select\"\n (change)=\"selectedOption($event)\">\n <option>Select credential</option>\n <option *ngFor=\"let data of uniqueCredential\"\n value=\"{{ data.name }}\">\n {{ data.name }}\n </option>\n </select>\n </div>\n </div>\n\n <div class=\"col-12 col-md-4\"\n *ngIf=\"credentialsSelect?.length\">\n <div class=\"card pb-2 pt-2 overflow-visible\">\n <div class=\"card-content\">\n <div class=\"card-header\">\n <form [formGroup]=\"form\"\n novalidate\n (ngSubmit)=\"saveCredentials()\">\n <div formArrayName=\"credentials\">\n <div *ngFor=\"\n let credential of credentialsGroup.controls;\n let i = index\n \">\n <div [formGroupName]=\"i\">\n <div class=\"mb-3\">\n <pw-input-container label=\"{{\n credential.get('field').value\n }}\"\n [class.info-circle]=\"\n credential.get('description').value\n \"\n name=\"value\"\n errorMsg=\"Please enter value\">\n <span *ngIf=\"\n credential.get('description')\n .value\n \"\n class=\"tooltiptext gradient-custom-branding\">{{\n credential.get('description')\n .value\n }}</span>\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"value\"\n [ngClass]=\"{\n 'is-invalid':\n submitted &&\n credential.get('value')\n .invalid\n }\" />\n </pw-input-container>\n </div>\n </div>\n </div>\n </div>\n <div class=\"text-end mt-3\">\n <button type=\"submit\"\n [buttonBusy]=\"buttonBusy\"\n class=\"btn btn-primary\">\n {{ 'Button.Submit' | transloco }}\n </button>\n </div>\n </form>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12 text-end mt-3\">\n <button type=\"button\"\n class=\"btn btn-outline-default me-2\"\n (click)=\"onCancel()\">\n {{ 'Button.Back' | transloco }}\n </button>\n </div>\n </div>\n </form>\n </div>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"!showForm\">\n <div class=\"row\">\n <div class=\"col-12 d-flex\">\n <a href=\"javascript:void(0)\"\n (click)=\"back()\"\n class=\"previous\"><i class=\"fa fa-arrow-alt-circle-left\" aria-hidden=\"true\"></i></a>\n <h2 class=\"mt-3\">Credentials</h2>\n </div>\n <div class=\"col-12 col-md-12 text-end\">\n <button class=\"btn btn-sm btn-outline-primary\"\n (click)=\"openCredentialsForAdd()\">\n <i class=\"fa fa-plus-circle\" aria-hidden=\"true\"></i> {{ 'Add Credential' }}\n </button>\n </div>\n </div>\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n <div class=\"row my-4\">\n <div class=\"col-12 col-md-6 col-xl-4 mt-3 credential-cards\"\n *ngFor=\"let credential of credentials\">\n <div class=\"card\">\n <h2 class=\"credential-field mt-3\">{{ credential.credential_name }}</h2>\n <div class=\"card-content\"\n *ngFor=\"let subscriptionCredential of credential.credentials\">\n <div class=\"card-header\">\n <div>\n <strong class=\"d-block\">{{ subscriptionCredential.field }}:</strong>\n <input class=\"credential-value\"\n [type]=\"\n credentialName === credential.credential_name\n ? 'text'\n : 'password'\n \"\n readonly\n #input\n [value]=\"subscriptionCredential?.value\" />\n </div>\n </div>\n <div class=\"card-footer\">\n <div class=\"float-end px-2\">\n <button class=\"btn btn-outline-primary me-2\"\n *ngIf=\"credentialName !== credential.credential_name\"\n (click)=\"revealCredentials(credential)\">\n {{\n 'User.Subscriptions.SubscriptionCredentials.RevealCredential'\n | transloco\n }}\n </button>\n <button class=\"btn btn-outline-primary me-2\"\n *ngIf=\"credentialName === credential.credential_name\"\n (click)=\"hideCredentials()\">\n {{\n 'User.Subscriptions.SubscriptionCredentials.HideCredential'\n | transloco\n }}\n </button>\n <a class=\"me-2 my-1\"\n (click)=\"openCredentialsForEdit(credential.credential_name)\"><i class=\"fa fa-edit edit-icon\" aria-hidden=\"true\"></i></a>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div *ngIf=\"allSubscriptionCredentials?.length === 0 && isLoaded\"\n class=\"clearboth\">\n <pw-no-data [message]=\"'User.Subscriptions.SubscriptionCredentials.NoDataMessage' | transloco\">\n </pw-no-data>\n </div>\n</ng-container>\n<!-- password validation modal for reveal Credential -->\n<pw-password-validation #passwordValidationModalForRevealCredential\n (successEvent)=\"showCredentials()\">\n</pw-password-validation>\n<!-- password validation modal for Edit Credential -->\n<pw-password-validation #passwordValidationModalForEditCredential\n (successEvent)=\"editCredentials()\">\n</pw-password-validation>\n<!-- password validation modal for Add Credential -->\n<pw-password-validation #passwordValidationModalForAddCredential\n (successEvent)=\"showEditForm()\">\n</pw-password-validation>\n", styles: [".credential-field{text-align:center}.card .card-header{padding:0 24px}.credentials-field{border:0}.credential-value{border:0;width:100%}.overflow-visible{overflow:visible}\n"] }]
632
+ }], ctorParameters: function () { return [{ type: i2.UntypedFormBuilder }, { type: i1$2.SubscriptionService }, { type: i0.Injector }]; }, propDecorators: { passwordValidationModalForRevealCredential: [{
633
+ type: ViewChild,
634
+ args: ['passwordValidationModalForRevealCredential', { static: false }]
635
+ }], passwordValidationModalForEditCredential: [{
636
+ type: ViewChild,
637
+ args: ['passwordValidationModalForEditCredential', { static: false }]
638
+ }], passwordValidationModalForAddCredential: [{
639
+ type: ViewChild,
640
+ args: ['passwordValidationModalForAddCredential', { static: false }]
641
+ }] } });
642
+
643
+ class UpdatePaymentDetailsComponent extends AppBaseComponent {
644
+ constructor(fb, scriptLoader, productService, subscriptionService, injector) {
645
+ super(injector);
646
+ this.fb = fb;
647
+ this.scriptLoader = scriptLoader;
648
+ this.productService = productService;
649
+ this.subscriptionService = subscriptionService;
650
+ this.years = [];
651
+ this.loading = true;
652
+ this.months = [];
653
+ this.route.params.subscribe(response => {
654
+ this.subscriptionId = Number(response['subscriptionId']);
655
+ this.productId = Number(response['productId']);
656
+ this.getCardDetails();
657
+ });
658
+ this.form = this.fb.group({
659
+ card_number: ['', Validators.required],
660
+ cvc: ['', Validators.required],
661
+ exp_month: ['', Validators.required],
662
+ exp_year: ['', Validators.required]
663
+ });
664
+ }
665
+ ngOnInit() {
666
+ this.scriptLoader.loadScript('head', 'https://js.stripe.com/v2/', true);
667
+ this.years = HelperService.getYears();
668
+ this.months = HelperService.getMonths();
669
+ }
670
+ getCardDetails() {
671
+ forkJoin({
672
+ cardDetails: this.subscriptionService.getCardDetails(this.subscriptionId),
673
+ product: this.productService.getProductById(this.productId)
674
+ })
675
+ .subscribe(response => {
676
+ this.stripePublishKey = response.product.stripe_publishable_key;
677
+ if (response.cardDetails.status === StatusCodes.OK) {
678
+ this.cardDetails = response.cardDetails.data || null;
679
+ }
680
+ })
681
+ .add(() => {
682
+ this.loading = false;
683
+ });
684
+ }
685
+ onUpdatePaymentDetailsCancel() {
686
+ this.router.navigate(['/account/subscriptions']);
687
+ }
688
+ onSave() {
689
+ this.busy = true;
690
+ this.errorMsg = '';
691
+ const cardDetails = {
692
+ number: this.form.value.card_number,
693
+ cvc: this.form.value.cvc,
694
+ exp_month: this.form.value.exp_month,
695
+ exp_year: this.form.value.exp_year
696
+ };
697
+ Stripe.setPublishableKey(this.stripePublishKey);
698
+ Stripe.card.createToken(cardDetails, (status, res) => {
699
+ var _a;
700
+ if (status !== 200) {
701
+ this.toast.error((_a = res === null || res === void 0 ? void 0 : res.error) === null || _a === void 0 ? void 0 : _a.message);
702
+ this.busy = false;
703
+ }
704
+ else {
705
+ this.subscriptionService
706
+ .updateCardDetails(this.form.value, this.subscriptionId)
707
+ .subscribe({
708
+ next: response => {
709
+ if (response.error) {
710
+ const err = response.error.errors[0].message;
711
+ this.toast.error(err);
712
+ }
713
+ else if (response.status === StatusCodes.CREATED) {
714
+ this.toast.success(response.message);
715
+ }
716
+ this.cancel();
717
+ }
718
+ })
719
+ .add(() => {
720
+ this.busy = false;
721
+ });
722
+ }
723
+ });
724
+ }
725
+ cancel() {
726
+ this.router.navigate(['/account/subscriptions']);
727
+ }
728
+ onChange(value) {
729
+ this.isChangePayment = value;
730
+ }
731
+ }
732
+ UpdatePaymentDetailsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UpdatePaymentDetailsComponent, deps: [{ token: i2.UntypedFormBuilder }, { token: i1$2.ScriptLoaderService }, { token: i1$2.ProductService }, { token: i1$2.SubscriptionService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
733
+ UpdatePaymentDetailsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: UpdatePaymentDetailsComponent, selector: "pw-update-payment-details", usesInheritance: true, ngImport: i0, template: "<div class=\"container-fluid\">\n <div class=\"card-block\">\n <div class=\"row\">\n <div class=\"col-lg-12 ps-0\">\n <a href=\"javascript:void(0)\"\n (click)=\"back()\"\n class=\"previous float-start\"><i class=\"fa fa-arrow-alt-circle-left\" aria-hidden=\"true\"></i></a>\n <h4 class=\"form-section my-3\">\n <i class=\"ft-edit\" aria-hidden=\"true\"></i>\n Update Card Details\n </h4>\n </div>\n <div class=\"col-12 col-lg-6 mt-3 payment-left p-3 card\">\n <div class=\"card-body\">\n <div class=\"alert alert-danger\"\n *ngIf=\"errorMsg\">{{ errorMsg }}</div>\n <ng-template [ngIf]=\"!isChangePayment && cardDetails\">\n <pw-saved-card-details [data]=\"cardDetails\"\n (changeEvent)=\"onChange($event)\">\n </pw-saved-card-details>\n </ng-template>\n\n <ng-template [ngIf]=\"loading\">\n <div class=\"text-center\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n </ng-template>\n\n <ng-container *ngIf=\"(!cardDetails && !loading) || isChangePayment\">\n <form [formGroup]=\"form\"\n (ngSubmit)=\"onSave()\">\n <h4 class=\"title\">New card?</h4>\n <div class=\"row\">\n <div class=\"col-md-9\">\n <div class=\"mb-3\">\n <label>Card Number</label>\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"card_number\"\n placeholder=\"Card Number\"\n name=\"card_number\" />\n <div class=\"danger\"\n *ngIf=\"\n form.get('card_number').touched &&\n form.get('card_number').errors?.required\n \">\n <span> Please enter card number. </span>\n </div>\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"mb-3\">\n <label>CVC</label>\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"cvc\"\n placeholder=\"CVC\"\n name=\"cvc\" />\n <div class=\"danger\"\n *ngIf=\"\n form.get('cvc').touched &&\n form.get('cvc').errors?.required\n \">\n <span> Please enter cvc number. </span>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"row\">\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <label class=\"sr-only\">Exp. Month</label>\n <select class=\"form-select\"\n formControlName=\"exp_month\">\n <option value=\"\"\n selected>Exp. Month</option>\n <option *ngFor=\"let month of months\"\n [value]=\"month?.value\">\n {{ month?.value }}\n </option>\n </select>\n <div class=\"danger\"\n *ngIf=\"\n form.get('exp_month').touched &&\n form.get('exp_month').errors?.required\n \">\n <span> Please enter expiry month. </span>\n </div>\n </div>\n </div>\n\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <label class=\"sr-only\">Exp. Year</label>\n <select class=\"form-select\"\n formControlName=\"exp_year\">\n <option value=\"\"\n selected>Exp. Year</option>\n <option *ngFor=\"let year of years\"\n [value]=\"year.value\">\n {{ year.value }}\n </option>\n </select>\n <div class=\"danger\"\n *ngIf=\"\n form.get('exp_year').touched &&\n form.get('exp_year').errors['required']\n \">\n <span> Please enter expiry year. </span>\n </div>\n </div>\n </div>\n\n <div class=\"col-12 text-center mt-4\">\n <img src=\"/assets/img/icons/powered_by_stripe_v2.png\"\n class=\"payment-provider\"\n alt=\"\" />\n </div>\n\n <div class=\"col-12 mt-4 text-end\">\n <button type=\"button\"\n (click)=\"cancel()\"\n class=\"btn btn-outline-default me-2\">\n Cancel\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\"\n [buttonBusy]=\"busy\">\n Submit\n </button>\n </div>\n </div>\n </form>\n </ng-container>\n </div>\n </div>\n </div>\n </div>\n</div>\n", styles: [".card-block .payment-left{border:1px solid rgb(204,204,204);height:100%}.card-block .payment-left h4{border-bottom:1px solid rgb(0,0,0);font-size:1rem;font-weight:600;margin:0 0 20px;padding:0 0 5px;text-transform:uppercase}.payment-provider{width:30%}@media (max-width: 800px){.payment-provider{width:60%}}.card{width:50%}\n"], dependencies: [{ kind: "directive", type: i3.ButtonBusyDirective, selector: "[buttonBusy]", inputs: ["buttonBusy", "busyText"] }, { kind: "directive", type: i3.LazyImgDirective, selector: "img" }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i5.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { kind: "component", type: SavedCardDetailsComponent, selector: "pw-saved-card-details", inputs: ["data", "isChangePayment", "showNewCard"], outputs: ["changeEvent"] }] });
734
+ __decorate([
735
+ ValidateForm('form'),
736
+ __metadata("design:type", Function),
737
+ __metadata("design:paramtypes", []),
738
+ __metadata("design:returntype", void 0)
739
+ ], UpdatePaymentDetailsComponent.prototype, "onSave", null);
740
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UpdatePaymentDetailsComponent, decorators: [{
741
+ type: Component,
742
+ args: [{ selector: 'pw-update-payment-details', template: "<div class=\"container-fluid\">\n <div class=\"card-block\">\n <div class=\"row\">\n <div class=\"col-lg-12 ps-0\">\n <a href=\"javascript:void(0)\"\n (click)=\"back()\"\n class=\"previous float-start\"><i class=\"fa fa-arrow-alt-circle-left\" aria-hidden=\"true\"></i></a>\n <h4 class=\"form-section my-3\">\n <i class=\"ft-edit\" aria-hidden=\"true\"></i>\n Update Card Details\n </h4>\n </div>\n <div class=\"col-12 col-lg-6 mt-3 payment-left p-3 card\">\n <div class=\"card-body\">\n <div class=\"alert alert-danger\"\n *ngIf=\"errorMsg\">{{ errorMsg }}</div>\n <ng-template [ngIf]=\"!isChangePayment && cardDetails\">\n <pw-saved-card-details [data]=\"cardDetails\"\n (changeEvent)=\"onChange($event)\">\n </pw-saved-card-details>\n </ng-template>\n\n <ng-template [ngIf]=\"loading\">\n <div class=\"text-center\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n </ng-template>\n\n <ng-container *ngIf=\"(!cardDetails && !loading) || isChangePayment\">\n <form [formGroup]=\"form\"\n (ngSubmit)=\"onSave()\">\n <h4 class=\"title\">New card?</h4>\n <div class=\"row\">\n <div class=\"col-md-9\">\n <div class=\"mb-3\">\n <label>Card Number</label>\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"card_number\"\n placeholder=\"Card Number\"\n name=\"card_number\" />\n <div class=\"danger\"\n *ngIf=\"\n form.get('card_number').touched &&\n form.get('card_number').errors?.required\n \">\n <span> Please enter card number. </span>\n </div>\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"mb-3\">\n <label>CVC</label>\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"cvc\"\n placeholder=\"CVC\"\n name=\"cvc\" />\n <div class=\"danger\"\n *ngIf=\"\n form.get('cvc').touched &&\n form.get('cvc').errors?.required\n \">\n <span> Please enter cvc number. </span>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"row\">\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <label class=\"sr-only\">Exp. Month</label>\n <select class=\"form-select\"\n formControlName=\"exp_month\">\n <option value=\"\"\n selected>Exp. Month</option>\n <option *ngFor=\"let month of months\"\n [value]=\"month?.value\">\n {{ month?.value }}\n </option>\n </select>\n <div class=\"danger\"\n *ngIf=\"\n form.get('exp_month').touched &&\n form.get('exp_month').errors?.required\n \">\n <span> Please enter expiry month. </span>\n </div>\n </div>\n </div>\n\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <label class=\"sr-only\">Exp. Year</label>\n <select class=\"form-select\"\n formControlName=\"exp_year\">\n <option value=\"\"\n selected>Exp. Year</option>\n <option *ngFor=\"let year of years\"\n [value]=\"year.value\">\n {{ year.value }}\n </option>\n </select>\n <div class=\"danger\"\n *ngIf=\"\n form.get('exp_year').touched &&\n form.get('exp_year').errors['required']\n \">\n <span> Please enter expiry year. </span>\n </div>\n </div>\n </div>\n\n <div class=\"col-12 text-center mt-4\">\n <img src=\"/assets/img/icons/powered_by_stripe_v2.png\"\n class=\"payment-provider\"\n alt=\"\" />\n </div>\n\n <div class=\"col-12 mt-4 text-end\">\n <button type=\"button\"\n (click)=\"cancel()\"\n class=\"btn btn-outline-default me-2\">\n Cancel\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\"\n [buttonBusy]=\"busy\">\n Submit\n </button>\n </div>\n </div>\n </form>\n </ng-container>\n </div>\n </div>\n </div>\n </div>\n</div>\n", styles: [".card-block .payment-left{border:1px solid rgb(204,204,204);height:100%}.card-block .payment-left h4{border-bottom:1px solid rgb(0,0,0);font-size:1rem;font-weight:600;margin:0 0 20px;padding:0 0 5px;text-transform:uppercase}.payment-provider{width:30%}@media (max-width: 800px){.payment-provider{width:60%}}.card{width:50%}\n"] }]
743
+ }], ctorParameters: function () { return [{ type: i2.UntypedFormBuilder }, { type: i1$2.ScriptLoaderService }, { type: i1$2.ProductService }, { type: i1$2.SubscriptionService }, { type: i0.Injector }]; }, propDecorators: { onSave: [] } });
744
+
745
+ class UpgradeSubscriptionComponent extends AppBaseComponent {
746
+ get totalAmount() {
747
+ if (this.product) {
748
+ const units = Number(this.form.get('units').value);
749
+ // eslint-disable-next-line no-restricted-globals
750
+ if (!Number.isNaN(units)) {
751
+ return (units * this.product.price_per_unit) / 100;
752
+ }
753
+ }
754
+ return 0;
755
+ }
756
+ constructor(injector, productService, fb, modalService, subscriptionService, store, scriptLoader) {
757
+ super(injector);
758
+ this.productService = productService;
759
+ this.fb = fb;
760
+ this.modalService = modalService;
761
+ this.subscriptionService = subscriptionService;
762
+ this.store = store;
763
+ this.scriptLoader = scriptLoader;
764
+ this.months = [];
765
+ this.years = [];
766
+ this.form = this.fb.group({
767
+ card_number: ['', Validators.required],
768
+ units: [],
769
+ cvc: ['', Validators.required],
770
+ exp_month: ['', Validators.required],
771
+ exp_year: ['', Validators.required]
772
+ });
773
+ }
774
+ ngOnInit() {
775
+ this.scriptLoader.loadScript('head', 'https://js.stripe.com/v2/', true);
776
+ this.years = HelperService.getYears();
777
+ this.months = HelperService.getMonths();
778
+ this.userStore().subscribe(user => {
779
+ this.user = user;
780
+ });
781
+ this.route.params.subscribe(response => {
782
+ this.subscriptionId = +response['subscriptionId'];
783
+ this.productId = +response['productId'];
784
+ this.getSubscriptionDetails();
785
+ this.getCardDetails(this.subscriptionId);
786
+ });
787
+ }
788
+ getSubscriptionDetails() {
789
+ this.subscriptionService
790
+ .getById(this.subscriptionId)
791
+ .subscribe(response => {
792
+ this.subscription = response;
793
+ const product = this.subscription.products.find(x => x.id === this.productId);
794
+ this.form.patchValue({
795
+ units: product === null || product === void 0 ? void 0 : product.purchased_units
796
+ });
797
+ this.units = this.form.get('units').value;
798
+ })
799
+ .add(() => {
800
+ this.getProductDetails();
801
+ });
802
+ }
803
+ getProductDetails() {
804
+ this.productService.getProductById(this.productId).subscribe(response => {
805
+ this.product = response;
806
+ this.stripePublishKey = response === null || response === void 0 ? void 0 : response.stripe_publishable_key;
807
+ if (response === null || response === void 0 ? void 0 : response.stripe_publishable_key) {
808
+ Stripe.setPublishableKey(response.stripe_publishable_key);
809
+ }
810
+ const prodUnits = this.units > this.product.min_units ? this.units : this.product.min_units || 1;
811
+ this.form.patchValue({
812
+ units: prodUnits
813
+ });
814
+ this.units = this.form.get('units').value;
815
+ });
816
+ }
817
+ onMaxReached(event) {
818
+ if (event) {
819
+ this.unitError = `Maximum is ${this.units}`;
820
+ }
821
+ }
822
+ onMinReached(event) {
823
+ if (event) {
824
+ this.unitError = `Minimum is ${this.subscription.min_units || this.product.min_units}`;
825
+ }
826
+ }
827
+ onUnitChange(event) {
828
+ this.units = event;
829
+ this.form.patchValue({
830
+ units: event
831
+ });
832
+ this.unitError = '';
833
+ }
834
+ onValidatePassword(isSuccess) {
835
+ if (isSuccess) {
836
+ this.onPurchaseSubmit();
837
+ this.password = null;
838
+ this.modalService.dismissAll();
839
+ }
840
+ }
841
+ postCreateToken(cardToken) {
842
+ const data = {
843
+ stripe_token: cardToken,
844
+ product_id: this.product.id,
845
+ units: this.form.get('units').value || 1,
846
+ subscription_id: this.subscriptionId
847
+ };
848
+ this.userService
849
+ .addNewSubscriptionUsingStripe(data)
850
+ .subscribe({
851
+ next: () => {
852
+ this.toast.success(this.translation.translate('User.Subscriptions.SubscriptionPurchased'));
853
+ this.router.navigate(['/account/subscriptions']);
854
+ this.modalService.dismissAll();
855
+ },
856
+ error: () => {
857
+ this.busy = false;
858
+ }
859
+ })
860
+ .add(() => {
861
+ this.busy = false;
862
+ });
863
+ }
864
+ attemptPurchase() {
865
+ if (this.user.has_password) {
866
+ this.passwordValidationModal.open();
867
+ }
868
+ else {
869
+ this.noPasswordModal();
870
+ }
871
+ }
872
+ onPurchaseSubmit() {
873
+ this.busy = true;
874
+ this.passwordModalVisible = true;
875
+ if (this.subscription.stripe_customer_id) {
876
+ if (this.showNewCard) {
877
+ this.updateCardDetails();
878
+ }
879
+ else {
880
+ this.enrollUserToSubscription();
881
+ }
882
+ }
883
+ else if (this.form.valid) {
884
+ const cardDetails = {
885
+ number: this.form.value.card_number,
886
+ cvc: this.form.value.cvc,
887
+ exp_month: this.form.value.exp_month,
888
+ exp_year: this.form.value.exp_year
889
+ };
890
+ // Get publishable key from product get id
891
+ Stripe.card.createToken(cardDetails, (status, response) => {
892
+ var _a;
893
+ if (status === StatusCodes.OK) {
894
+ const cardToken = response.id;
895
+ this.postCreateToken(cardToken);
896
+ }
897
+ else {
898
+ this.toast.error((_a = response === null || response === void 0 ? void 0 : response.error) === null || _a === void 0 ? void 0 : _a.message, '', { disableTimeOut: true });
899
+ this.busy = false;
900
+ this.isPurchaseAttempted = false;
901
+ }
902
+ }, () => {
903
+ this.busy = false;
904
+ this.isPurchaseAttempted = false;
905
+ this.modalService.dismissAll();
906
+ });
907
+ }
908
+ }
909
+ enrollUserToSubscription() {
910
+ const data = {
911
+ product_id: this.product.id,
912
+ units: this.form.get('units').value,
913
+ subscription_id: this.subscriptionId
914
+ };
915
+ this.subscriptionService.postSubscription(data).subscribe({
916
+ next: response => {
917
+ this.store.dispatch(new GetUser());
918
+ if (response.id) {
919
+ this.router.navigate(['/account/subscriptions']);
920
+ this.toast.success(this.translation.translate('User.Subscriptions.SubscriptionPurchased'));
921
+ this.isPurchaseAttempted = false;
922
+ this.modalService.dismissAll();
923
+ this.back();
924
+ }
925
+ },
926
+ error: () => {
927
+ this.busy = false;
928
+ this.isPurchaseAttempted = false;
929
+ },
930
+ complete: () => {
931
+ this.busy = !this.busy;
932
+ }
933
+ });
934
+ }
935
+ noPasswordModal() {
936
+ swal.fire({
937
+ title: 'Set Password',
938
+ html: `<div>Please set a password before changing the subscription in the account section.</div>
939
+ <br />
940
+ <strong><a href="/account/details">Click here to reset</a></strong>`,
941
+ confirmButtonText: 'OK'
942
+ });
943
+ }
944
+ getCardDetails(subscriptionId) {
945
+ this.subscriptionService.getCardDetails(subscriptionId).subscribe(data => {
946
+ var _a, _b, _c, _d;
947
+ this.cardDetails = data.data || null;
948
+ this.form.patchValue({
949
+ units: this.units,
950
+ card_number: (_a = this.cardDetails) === null || _a === void 0 ? void 0 : _a.card_number,
951
+ cvc: (_b = this.cardDetails) === null || _b === void 0 ? void 0 : _b.cvc,
952
+ exp_month: ((_c = this.cardDetails) === null || _c === void 0 ? void 0 : _c.exp_month) || '',
953
+ exp_year: ((_d = this.cardDetails) === null || _d === void 0 ? void 0 : _d.exp_year) || ''
954
+ });
955
+ });
956
+ }
957
+ onDiscardToggle() {
958
+ this.form.markAllAsTouched();
959
+ FormHelperService.markFormAsPristine(this.form);
960
+ }
961
+ updateCardDetails() {
962
+ const cardDetails = {
963
+ number: this.form.value.card_number,
964
+ cvc: this.form.value.cvc,
965
+ exp_month: this.form.value.exp_month,
966
+ exp_year: this.form.value.exp_year
967
+ };
968
+ Stripe.setPublishableKey(this.stripePublishKey);
969
+ Stripe.card.createToken(cardDetails, (status, res) => {
970
+ if (status !== 200) {
971
+ this.toast.error(res.error.message);
972
+ }
973
+ else {
974
+ this.subscriptionService
975
+ .updateCardDetails(this.form.value, this.subscriptionId)
976
+ .subscribe({
977
+ next: response => {
978
+ if (response.error) {
979
+ const err = response.error.errors[0].message;
980
+ this.toast.error(err);
981
+ }
982
+ else if (response.status === StatusCodes.CREATED) {
983
+ this.enrollUserToSubscription();
984
+ this.toast.success(response.message);
985
+ }
986
+ },
987
+ error: error => {
988
+ this.errorMsg = HelperService.getErrorMessage(error);
989
+ this.toast.error(this.errorMsg);
990
+ }
991
+ });
992
+ }
993
+ });
994
+ }
995
+ ngOnDestroy() {
996
+ super.ngOnDestroy();
997
+ }
998
+ }
999
+ UpgradeSubscriptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UpgradeSubscriptionComponent, deps: [{ token: i0.Injector }, { token: i1$2.ProductService }, { token: i2.UntypedFormBuilder }, { token: i1$1.NgbModal }, { token: i1$2.SubscriptionService }, { token: i4$1.Store }, { token: i1$2.ScriptLoaderService }], target: i0.ɵɵFactoryTarget.Component });
1000
+ UpgradeSubscriptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: UpgradeSubscriptionComponent, selector: "pw-upgrade-subscription", viewQueries: [{ propertyName: "passwordValidationModal", first: true, predicate: ["passwordValidationModal"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<h4 class=\"form-section m-3\">\n <i class=\"ft-check-circle\" aria-hidden=\"true\"></i> {{ 'Button.Payment' | transloco }}\n</h4>\n<div class=\"card-block\">\n <!-- Show Payment Page when there is user.has_stripe_account===false -->\n <ng-container>\n <form class=\"form\"\n (ngSubmit)=\"attemptPurchase()\"\n [formGroup]=\"form\">\n <div class=\"row\">\n <div class=\"col-md-6\">\n <div class=\"form-body p-3 payment-left card pb-0\">\n <div class=\"card-body\">\n <div class=\"row\"\n *ngIf=\"product?.max_units > 1\">\n <div class=\"col-12\">\n <div class=\"mb-3\">\n <h4 class=\"title\">\n {{ 'User.Subscriptions.LicensesRequired' | transloco }}\n </h4>\n <div class=\"row btns-row\">\n <div class=\"col-md-4 col-8\">\n <pw-number-picker name=\"number-picker\"\n [(value)]=\"units\"\n [min]=\"subscription.min_units || product.min_units\"\n [max]=\"product.max_units\"\n step=\"1\"\n postfix=\"Units\"\n placeholder=\"Total Licencees\"\n [inputReadOnly]=\"false\"\n size=\"small\"\n pickStartAfter=\"500\"\n pickTimer=\"100\"\n [arrowKeys]=\"true\"\n (minReached)=\"onMinReached($event)\"\n (maxReached)=\"onMaxReached($event)\"\n (valueChange)=\"onUnitChange($event)\">\n </pw-number-picker>\n </div>\n </div>\n <div class=\"text-center\">\n <small class=\"form-text text-muted danger\">\n {{ unitError }}\n </small>\n </div>\n </div>\n <p>\n If you proceed, your credit card will be charged\n <strong>{{ product.currency }}\n {{ totalAmount.toFixed(2) }}</strong>\n </p>\n </div>\n </div>\n <!-- Shows Saved Card: Shows when user has card details and not trying to update the card details -->\n <ng-template [ngIf]=\"cardDetails\">\n <pw-saved-card-details [data]=\"cardDetails\"\n (changeEvent)=\"showNewCard = $event\"\n [showNewCard]=\"showNewCard\">\n </pw-saved-card-details>\n </ng-template>\n <!-- Add New Payment Starts, opens up when user doesn't have stripe account or tries to change the\n card details -->\n <ng-template [ngIf]=\"(user && !cardDetails) || (cardDetails && showNewCard)\">\n <h4 class=\"title\">\n {{ 'User.Subscriptions.NewCard' | transloco }}?\n </h4>\n <div class=\"row\">\n <div class=\"col-md-9\">\n <div class=\"mb-3\">\n <label>{{\n 'User.Subscriptions.CardNumber' | transloco\n }}</label>\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"card_number\"\n placeholder=\"Card Number\"\n name=\"card_number\" />\n <div class=\"danger\"\n *ngIf=\"\n form.get('card_number').touched &&\n form.get('card_number').errors?.required\n \">\n <span> Please enter card number. </span>\n </div>\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"mb-3\">\n <label>{{\n 'User.Subscriptions.CVC' | transloco\n }}</label>\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"cvc\"\n placeholder=\"CVC\"\n name=\"cvc\" />\n <div class=\"danger\"\n *ngIf=\"\n form.get('cvc').touched &&\n form.get('cvc').errors?.required\n \">\n <span> Please enter cvc. </span>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <label class=\"sr-only\">Exp. Month</label>\n <select class=\"form-select\"\n formControlName=\"exp_month\">\n <option value=\"\"\n selected>Exp. Month</option>\n <option *ngFor=\"let month of months\"\n [value]=\"month.value\">\n {{ month?.value }}\n </option>\n </select>\n <div class=\"danger\"\n *ngIf=\"\n form.get('exp_month').touched &&\n form.get('exp_month').errors?.required\n \">\n <span> Please enter expiry month. </span>\n </div>\n </div>\n </div>\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <label class=\"sr-only\">Exp. Year</label>\n <select class=\"form-select\"\n formControlName=\"exp_year\">\n <option value=\"\"\n selected>Exp. Year</option>\n <option *ngFor=\"let year of years\"\n [value]=\"year.value\">\n {{ year?.value }}\n </option>\n </select>\n <div class=\"danger\"\n *ngIf=\"\n form.get('exp_year').touched &&\n form.get('exp_year').errors?.required\n \">\n <span> Please enter expiry year. </span>\n </div>\n </div>\n </div>\n <div class=\"col-12 mt-2\"\n *ngIf=\"cardDetails\">\n <a href=\"javascript:void(0)\"\n (click)=\"showNewCard = false; onDiscardToggle()\">Disregard and pay with current registered card</a>\n </div>\n </div>\n </ng-template>\n </div>\n </div>\n </div>\n <!-- Purchase Summary -->\n <div class=\"col-md-6\"\n *ngIf=\"product\">\n <div class=\"purchase-summary card p-3 payment-right\">\n <div class=\"card-body\">\n <h4 class=\"title\">{{ 'Label.PurchaseSummary' | transloco }}</h4>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">{{ 'Label.Plan' | transloco }}:</div>\n <div class=\"summary-right\">{{ product.name }}</div>\n </div>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">{{ 'Label.Price' | transloco }}:</div>\n <div class=\"summary-right\">\n {{ product.currency }}\n {{ (product.price_per_unit / 100).toFixed(2) }}\n </div>\n </div>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">{{ 'Label.Seats' | transloco }}:</div>\n <div class=\"summary-right\">{{ form.get('units').value }}</div>\n </div>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">{{ 'Label.Total' | transloco }}:</div>\n <div class=\"summary-right\">\n {{ product.currency }} {{ totalAmount.toFixed(2) }}\n </div>\n </div>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">\n {{ 'Label.Recurrency' | transloco }}:\n </div>\n <div class=\"summary-right\">{{ product.billing_frequency }}</div>\n </div>\n </div>\n <div class=\"text-center\">\n <hr />\n <p>\n By subscribing you acknowledge and accept our terms of service and\n privacy policy\n </p>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12 text-center mt-3\">\n <img src=\"/assets/img/icons/powered_by_stripe_v2.png\"\n class=\"payment-provider\"\n alt=\"\" />\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"form-actions text-end\">\n <button type=\"button\"\n class=\"btn btn-raised btn-outline-default me-1\"\n [disabled]=\"isPurchaseAttempted\"\n routerLink=\"/account/subscriptions\">\n <i class=\"ft-x\" aria-hidden=\"true\"></i>{{ 'Button.Back' | transloco }}\n </button>\n <button type=\"submit\"\n class=\"btn btn-raised btn-primary\"\n [disabled]=\"isPurchaseAttempted\"\n [buttonBusy]=\"busy\">\n <i class=\"ft-check\" aria-hidden=\"true\"></i>\n {{ 'Button.Purchase' | transloco }}\n </button>\n </div>\n </div>\n </div>\n </form>\n </ng-container>\n</div>\n\n<pw-password-validation #passwordValidationModal\n (successEvent)=\"onValidatePassword($event)\">\n <div class=\"row\">\n <div class=\"col-12\">\n <p>\n If you proceed, your credit card will be charged\n <strong *ngIf=\"totalAmount\">{{ product.currency }} {{ totalAmount.toFixed(2) }}</strong>\n </p>\n </div>\n </div>\n</pw-password-validation>\n", styles: [".payment-left,.payment-right{border:1px solid rgb(204,204,204);height:100%}.payment-left h4,.payment-right h4{border-bottom:1px solid rgb(0,0,0);font-size:1rem;font-weight:600;margin:0 0 20px;padding:0 0 5px;text-transform:uppercase}.payment-left .summary-row.total,.payment-right .summary-row.total{padding:10px 0 0 10px}.payment-left .summary-row .summary-left,.payment-right .summary-row .summary-left{font-weight:600}.payment-provider{width:20%}@media (max-width: 800px){.payment-provider{width:60%}}.summary-left{-webkit-box-flex:1;color:#555;flex-grow:1;-ms-flex-positive:1;font-weight:200;text-align:left}.summary-left.plan{color:#c93f00;font-size:14px;margin:5px 0}.summary-right{-webkit-box-flex:1;-webkit-box-pack:end;color:#000;flex-grow:1;-ms-flex-pack:end;-ms-flex-positive:1;justify-content:flex-end;text-align:right}\n"], dependencies: [{ kind: "directive", type: i3.ButtonBusyDirective, selector: "[buttonBusy]", inputs: ["buttonBusy", "busyText"] }, { kind: "directive", type: i3.LazyImgDirective, selector: "img" }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i7.PasswordValidationComponent, selector: "pw-password-validation", outputs: ["successEvent"] }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: SavedCardDetailsComponent, selector: "pw-saved-card-details", inputs: ["data", "isChangePayment", "showNewCard"], outputs: ["changeEvent"] }, { kind: "pipe", type: i10.TranslocoPipe, name: "transloco" }] });
1001
+ __decorate([
1002
+ ValidateForm('form'),
1003
+ __metadata("design:type", Function),
1004
+ __metadata("design:paramtypes", []),
1005
+ __metadata("design:returntype", void 0)
1006
+ ], UpgradeSubscriptionComponent.prototype, "updateCardDetails", null);
1007
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UpgradeSubscriptionComponent, decorators: [{
1008
+ type: Component,
1009
+ args: [{ selector: 'pw-upgrade-subscription', template: "<h4 class=\"form-section m-3\">\n <i class=\"ft-check-circle\" aria-hidden=\"true\"></i> {{ 'Button.Payment' | transloco }}\n</h4>\n<div class=\"card-block\">\n <!-- Show Payment Page when there is user.has_stripe_account===false -->\n <ng-container>\n <form class=\"form\"\n (ngSubmit)=\"attemptPurchase()\"\n [formGroup]=\"form\">\n <div class=\"row\">\n <div class=\"col-md-6\">\n <div class=\"form-body p-3 payment-left card pb-0\">\n <div class=\"card-body\">\n <div class=\"row\"\n *ngIf=\"product?.max_units > 1\">\n <div class=\"col-12\">\n <div class=\"mb-3\">\n <h4 class=\"title\">\n {{ 'User.Subscriptions.LicensesRequired' | transloco }}\n </h4>\n <div class=\"row btns-row\">\n <div class=\"col-md-4 col-8\">\n <pw-number-picker name=\"number-picker\"\n [(value)]=\"units\"\n [min]=\"subscription.min_units || product.min_units\"\n [max]=\"product.max_units\"\n step=\"1\"\n postfix=\"Units\"\n placeholder=\"Total Licencees\"\n [inputReadOnly]=\"false\"\n size=\"small\"\n pickStartAfter=\"500\"\n pickTimer=\"100\"\n [arrowKeys]=\"true\"\n (minReached)=\"onMinReached($event)\"\n (maxReached)=\"onMaxReached($event)\"\n (valueChange)=\"onUnitChange($event)\">\n </pw-number-picker>\n </div>\n </div>\n <div class=\"text-center\">\n <small class=\"form-text text-muted danger\">\n {{ unitError }}\n </small>\n </div>\n </div>\n <p>\n If you proceed, your credit card will be charged\n <strong>{{ product.currency }}\n {{ totalAmount.toFixed(2) }}</strong>\n </p>\n </div>\n </div>\n <!-- Shows Saved Card: Shows when user has card details and not trying to update the card details -->\n <ng-template [ngIf]=\"cardDetails\">\n <pw-saved-card-details [data]=\"cardDetails\"\n (changeEvent)=\"showNewCard = $event\"\n [showNewCard]=\"showNewCard\">\n </pw-saved-card-details>\n </ng-template>\n <!-- Add New Payment Starts, opens up when user doesn't have stripe account or tries to change the\n card details -->\n <ng-template [ngIf]=\"(user && !cardDetails) || (cardDetails && showNewCard)\">\n <h4 class=\"title\">\n {{ 'User.Subscriptions.NewCard' | transloco }}?\n </h4>\n <div class=\"row\">\n <div class=\"col-md-9\">\n <div class=\"mb-3\">\n <label>{{\n 'User.Subscriptions.CardNumber' | transloco\n }}</label>\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"card_number\"\n placeholder=\"Card Number\"\n name=\"card_number\" />\n <div class=\"danger\"\n *ngIf=\"\n form.get('card_number').touched &&\n form.get('card_number').errors?.required\n \">\n <span> Please enter card number. </span>\n </div>\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"mb-3\">\n <label>{{\n 'User.Subscriptions.CVC' | transloco\n }}</label>\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"cvc\"\n placeholder=\"CVC\"\n name=\"cvc\" />\n <div class=\"danger\"\n *ngIf=\"\n form.get('cvc').touched &&\n form.get('cvc').errors?.required\n \">\n <span> Please enter cvc. </span>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <label class=\"sr-only\">Exp. Month</label>\n <select class=\"form-select\"\n formControlName=\"exp_month\">\n <option value=\"\"\n selected>Exp. Month</option>\n <option *ngFor=\"let month of months\"\n [value]=\"month.value\">\n {{ month?.value }}\n </option>\n </select>\n <div class=\"danger\"\n *ngIf=\"\n form.get('exp_month').touched &&\n form.get('exp_month').errors?.required\n \">\n <span> Please enter expiry month. </span>\n </div>\n </div>\n </div>\n <div class=\"col-md-6\">\n <div class=\"mb-3\">\n <label class=\"sr-only\">Exp. Year</label>\n <select class=\"form-select\"\n formControlName=\"exp_year\">\n <option value=\"\"\n selected>Exp. Year</option>\n <option *ngFor=\"let year of years\"\n [value]=\"year.value\">\n {{ year?.value }}\n </option>\n </select>\n <div class=\"danger\"\n *ngIf=\"\n form.get('exp_year').touched &&\n form.get('exp_year').errors?.required\n \">\n <span> Please enter expiry year. </span>\n </div>\n </div>\n </div>\n <div class=\"col-12 mt-2\"\n *ngIf=\"cardDetails\">\n <a href=\"javascript:void(0)\"\n (click)=\"showNewCard = false; onDiscardToggle()\">Disregard and pay with current registered card</a>\n </div>\n </div>\n </ng-template>\n </div>\n </div>\n </div>\n <!-- Purchase Summary -->\n <div class=\"col-md-6\"\n *ngIf=\"product\">\n <div class=\"purchase-summary card p-3 payment-right\">\n <div class=\"card-body\">\n <h4 class=\"title\">{{ 'Label.PurchaseSummary' | transloco }}</h4>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">{{ 'Label.Plan' | transloco }}:</div>\n <div class=\"summary-right\">{{ product.name }}</div>\n </div>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">{{ 'Label.Price' | transloco }}:</div>\n <div class=\"summary-right\">\n {{ product.currency }}\n {{ (product.price_per_unit / 100).toFixed(2) }}\n </div>\n </div>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">{{ 'Label.Seats' | transloco }}:</div>\n <div class=\"summary-right\">{{ form.get('units').value }}</div>\n </div>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">{{ 'Label.Total' | transloco }}:</div>\n <div class=\"summary-right\">\n {{ product.currency }} {{ totalAmount.toFixed(2) }}\n </div>\n </div>\n <div class=\"summary-row d-flex mb-2\">\n <div class=\"summary-left\">\n {{ 'Label.Recurrency' | transloco }}:\n </div>\n <div class=\"summary-right\">{{ product.billing_frequency }}</div>\n </div>\n </div>\n <div class=\"text-center\">\n <hr />\n <p>\n By subscribing you acknowledge and accept our terms of service and\n privacy policy\n </p>\n </div>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12 text-center mt-3\">\n <img src=\"/assets/img/icons/powered_by_stripe_v2.png\"\n class=\"payment-provider\"\n alt=\"\" />\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"form-actions text-end\">\n <button type=\"button\"\n class=\"btn btn-raised btn-outline-default me-1\"\n [disabled]=\"isPurchaseAttempted\"\n routerLink=\"/account/subscriptions\">\n <i class=\"ft-x\" aria-hidden=\"true\"></i>{{ 'Button.Back' | transloco }}\n </button>\n <button type=\"submit\"\n class=\"btn btn-raised btn-primary\"\n [disabled]=\"isPurchaseAttempted\"\n [buttonBusy]=\"busy\">\n <i class=\"ft-check\" aria-hidden=\"true\"></i>\n {{ 'Button.Purchase' | transloco }}\n </button>\n </div>\n </div>\n </div>\n </form>\n </ng-container>\n</div>\n\n<pw-password-validation #passwordValidationModal\n (successEvent)=\"onValidatePassword($event)\">\n <div class=\"row\">\n <div class=\"col-12\">\n <p>\n If you proceed, your credit card will be charged\n <strong *ngIf=\"totalAmount\">{{ product.currency }} {{ totalAmount.toFixed(2) }}</strong>\n </p>\n </div>\n </div>\n</pw-password-validation>\n", styles: [".payment-left,.payment-right{border:1px solid rgb(204,204,204);height:100%}.payment-left h4,.payment-right h4{border-bottom:1px solid rgb(0,0,0);font-size:1rem;font-weight:600;margin:0 0 20px;padding:0 0 5px;text-transform:uppercase}.payment-left .summary-row.total,.payment-right .summary-row.total{padding:10px 0 0 10px}.payment-left .summary-row .summary-left,.payment-right .summary-row .summary-left{font-weight:600}.payment-provider{width:20%}@media (max-width: 800px){.payment-provider{width:60%}}.summary-left{-webkit-box-flex:1;color:#555;flex-grow:1;-ms-flex-positive:1;font-weight:200;text-align:left}.summary-left.plan{color:#c93f00;font-size:14px;margin:5px 0}.summary-right{-webkit-box-flex:1;-webkit-box-pack:end;color:#000;flex-grow:1;-ms-flex-pack:end;-ms-flex-positive:1;justify-content:flex-end;text-align:right}\n"] }]
1010
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1$2.ProductService }, { type: i2.UntypedFormBuilder }, { type: i1$1.NgbModal }, { type: i1$2.SubscriptionService }, { type: i4$1.Store }, { type: i1$2.ScriptLoaderService }]; }, propDecorators: { passwordValidationModal: [{
1011
+ type: ViewChild,
1012
+ args: ['passwordValidationModal', { static: true }]
1013
+ }], updateCardDetails: [] } });
1014
+
1015
+ class UserSubscriptionDetailsComponent extends AppBaseComponent {
1016
+ totalAmount() {
1017
+ const allProductsPrice = this.subscription.products.map(x => x.price_per_unit * this.units);
1018
+ return allProductsPrice.reduce((a, b) => a + b, 0) / 100;
1019
+ }
1020
+ constructor(fb, geoService, modalService, subscriptionService, store, injector) {
1021
+ super(injector);
1022
+ this.fb = fb;
1023
+ this.geoService = geoService;
1024
+ this.modalService = modalService;
1025
+ this.subscriptionService = subscriptionService;
1026
+ this.store = store;
1027
+ this.units = 1;
1028
+ this.form = this.getForm();
1029
+ this.route.params.subscribe(params => {
1030
+ this.subscriptionId = +params['subscriptionId'];
1031
+ this.fetchData();
1032
+ });
1033
+ }
1034
+ ngOnInit() {
1035
+ this.countries$ = this.geoService.getCountries();
1036
+ this.userStore().subscribe(user => {
1037
+ if (user) {
1038
+ this.slug = user.slug;
1039
+ this.user = user;
1040
+ this.userId = user.id;
1041
+ }
1042
+ });
1043
+ }
1044
+ fetchData() {
1045
+ this.subscriptionService.getById(this.subscriptionId).subscribe(response => {
1046
+ var _a, _b, _c, _d, _e;
1047
+ this.subscription = response;
1048
+ this.fullLogo = (_a = this.subscription) === null || _a === void 0 ? void 0 : _a.full_logo.url;
1049
+ this.squaredLogo = (_c = (_b = this.subscription) === null || _b === void 0 ? void 0 : _b.squared_logo) === null || _c === void 0 ? void 0 : _c.url;
1050
+ this.form.patchValue(this.subscription);
1051
+ this.units = (_e = (_d = this.subscription) === null || _d === void 0 ? void 0 : _d.products[0]) === null || _e === void 0 ? void 0 : _e.purchased_units;
1052
+ this.form.patchValue({
1053
+ units: this.units
1054
+ });
1055
+ });
1056
+ }
1057
+ getForm() {
1058
+ return this.fb.group({
1059
+ organisation: ['', [Validators.required]],
1060
+ contact_name: ['', [Validators.required]],
1061
+ contact_email: ['', [Validators.required, Validators.email]],
1062
+ contact_tel: [''],
1063
+ tax_id: [''],
1064
+ address: ['', [Validators.required]],
1065
+ country_code: ['', [Validators.required]],
1066
+ facebook_handle: [''],
1067
+ twitter_handle: [''],
1068
+ linkedin_handle: [''],
1069
+ reddit_handle: [''],
1070
+ company_url: [''],
1071
+ enforce_2fa: [false]
1072
+ });
1073
+ }
1074
+ /** *
1075
+ * Update seats for all the products of subscription
1076
+ */
1077
+ updateUnits() {
1078
+ if (this.subscription.products[0].trial_subscription) {
1079
+ return;
1080
+ }
1081
+ this.modal.open();
1082
+ }
1083
+ openModal(content) {
1084
+ this.modalService.open(content, { centered: true, windowClass: 'modal-holder' });
1085
+ }
1086
+ onImageSelection(event) {
1087
+ const blob = this.dataURLtoBlob(event);
1088
+ const filename = `${`${this.slug.toLocaleLowerCase()}_${Date.parse(new Date().toString())}`}.png`;
1089
+ const file = new File([blob], filename);
1090
+ this.subscriptionService.addFullLogo(this.subscriptionId, file).subscribe(res => {
1091
+ var _a;
1092
+ this.modalService.dismissAll();
1093
+ this.fullLogo = (_a = res === null || res === void 0 ? void 0 : res.full_logo) === null || _a === void 0 ? void 0 : _a.url;
1094
+ });
1095
+ }
1096
+ uploadSquaredLogo(event) {
1097
+ const blob = this.dataURLtoBlob(event);
1098
+ const filename = `${`${this.slug.toLocaleLowerCase()}_${Date.parse(new Date().toString())}`}.png`;
1099
+ const file = new File([blob], filename);
1100
+ this.subscriptionService.addSquaredLogo(this.subscriptionId, file).subscribe(res => {
1101
+ var _a;
1102
+ this.modalService.dismissAll();
1103
+ this.squaredLogo = (_a = res === null || res === void 0 ? void 0 : res.squared_logo) === null || _a === void 0 ? void 0 : _a.url;
1104
+ });
1105
+ }
1106
+ onClose() {
1107
+ this.modalService.dismissAll();
1108
+ }
1109
+ dataURLtoBlob(dataurl) {
1110
+ const arr = dataurl.split(',');
1111
+ const mime = arr[0].match(/^[A-Z]*[a-z]*:(.*?);[A-Z]*/)[1];
1112
+ const bstr = atob(arr[1]);
1113
+ let n = bstr.length;
1114
+ const u8arr = new Uint8Array(n);
1115
+ while (n--) {
1116
+ u8arr[n] = bstr.charCodeAt(n);
1117
+ }
1118
+ return new Blob([u8arr], { type: mime });
1119
+ }
1120
+ onSaveDetails() {
1121
+ this.subscriptionService
1122
+ .updateSubscription(Number(this.subscriptionId), this.form.value)
1123
+ .subscribe(() => {
1124
+ this.toast.success('Subscription details updated.');
1125
+ this.store.dispatch(new GetUser());
1126
+ this.back();
1127
+ });
1128
+ }
1129
+ onPasswordValidation(_event) {
1130
+ this.subscriptionService
1131
+ .updateSubscriptionUnit(this.subscription.id, this.units)
1132
+ .subscribe(response => {
1133
+ if (response.status === StatusCodes.OK) {
1134
+ this.toast.success('Unit quantity updated.');
1135
+ }
1136
+ else {
1137
+ this.toast.error('Something went wrong!');
1138
+ }
1139
+ });
1140
+ }
1141
+ onMaxReached(event) {
1142
+ if (event) {
1143
+ this.unitError = `Maximum is ${this.units}`;
1144
+ }
1145
+ }
1146
+ onMinReached(event) {
1147
+ if (event) {
1148
+ this.unitError = `Minimum is ${this.units}`;
1149
+ }
1150
+ }
1151
+ onUnitChange(event) {
1152
+ this.allowUpdate = true;
1153
+ this.hasUnitChanged = true;
1154
+ this.units = event;
1155
+ this.unitError = '';
1156
+ }
1157
+ /** Function to execute on location select */
1158
+ handleAddressChange(event) {
1159
+ this.form.get('address').setValue(event.formatted_address);
1160
+ }
1161
+ trackByProduct(_index, item) {
1162
+ return item.id;
1163
+ }
1164
+ ngOnDestroy() {
1165
+ super.ngOnDestroy();
1166
+ this.allowUpdate = false;
1167
+ }
1168
+ }
1169
+ UserSubscriptionDetailsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UserSubscriptionDetailsComponent, deps: [{ token: i2.UntypedFormBuilder }, { token: i1$2.GeoService }, { token: i1$1.NgbModal }, { token: i1$2.SubscriptionService }, { token: i4$1.Store }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
1170
+ UserSubscriptionDetailsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: UserSubscriptionDetailsComponent, selector: "ng-component", viewQueries: [{ propertyName: "modal", first: true, predicate: ["modal"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<!-- edit Subscription details page -->\n<div class=\"row\">\n <div class=\"col-12\">\n <h3 class=\"my-3\">{{ subscription?.organisation || subscription?.contact_name }}</h3>\n </div>\n</div>\n\n<div class=\"row\"\n *ngIf=\"subscription\">\n <div class=\"col-md-6\">\n <div class=\"text-center mt-5\">\n <div class=\"image-container\">\n <h4 class=\"mb-2\">Full Logo\n <span class=\"tooltip-wrap ms-1\"\n [pTooltip]=\"'User.Subscriptions.Tooltip.FullLogo'|transloco\"\n [appendTo]=\"'body'\"\n [tooltipPosition]=\"'top'\">\n <i class=\"fas fa-info-circle\"></i>\n </span>\n </h4>\n <img [src]=\"fullLogo\"\n alt=\"full logo image\"\n width=\"100%\"\n class=\"image full-logo\"\n height=\"100%\"\n onerror=\"this.onerror=null;this.src='assets/img/icons/dummy-logo.jpg';\" />\n <div class=\"overlay mt-2\"\n (click)=\"openModal(content)\">\n <div class=\"overlay-text\">\n <a href=\"javascript:void(0)\">{{ 'User.Profile.Change' | transloco }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"col-md-6\">\n <div class=\"text-center mt-5\">\n <div class=\"image-container\">\n <h4 class=\"mb-2\">Squared Logo\n <span class=\"tooltip-wrap ms-1\"\n [pTooltip]=\"'User.Subscriptions.Tooltip.SquaredLogo'|transloco\"\n [appendTo]=\"'body'\"\n [tooltipPosition]=\"'top'\">\n <i class=\"fas fa-info-circle\"></i>\n </span>\n </h4>\n <img [src]=\"squaredLogo\"\n alt=\"squared logo image\"\n width=\"150\"\n class=\"squared_logo\"\n [height]=\"'150'\"\n onerror=\"this.onerror=null;this.src='assets/img/icons/dummy-icon.jpg';\" />\n <div class=\"overlay mt-2\"\n (click)=\"openModal(squaredLogoContent)\">\n <div class=\"overlay-text\">\n <a href=\"javascript:void(0)\">{{ 'User.Profile.Change' | transloco }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n<div class=\"row\">\n <div class=\"col-12\">\n <small *ngIf=\"subscription?.trial_subscription && subscription?.calculated_price\"\n class=\"text-danger\">Upgrade to be able to update your purchased seats</small>\n </div>\n</div>\n<div class=\"row btns-row align-items-center\">\n <div class=\"col-md-3 col-8\"\n *ngIf=\"subscription\">\n <pw-number-picker [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.Seats'|transloco\"\n name=\"number-picker\"\n [(value)]=\"units\"\n [min]=\"subscription?.min_units||subscription?.products[0].min_units\"\n [max]=\"subscription?.products[0].max_units\"\n step=\"1\"\n postfix=\"seats\"\n placeholder=\"Total Licencees\"\n [inputReadOnly]=\"subscription?.products[0].trial_subscription\"\n [showUpButton]=\"!subscription?.products[0].trial_subscription\"\n [showDownButton]=\"!subscription?.products[0].trial_subscription\"\n size=\"small\"\n pickStartAfter=\"500\"\n pickTimer=\"100\"\n [arrowKeys]=\"true\"\n (minReached)=\"onMinReached($event)\"\n (maxReached)=\"onMaxReached($event)\"\n (valueChange)=\"onUnitChange($event)\">\n </pw-number-picker>\n </div>\n\n <div class=\"col-md-3 col-4 p-1\"\n *ngIf=\"subscription\">\n\n <ng-template [ngIf]=\"!subscription?.products[0].trial_subscription && allowUpdate\"\n [ngIfElse]=\"nonPaidRef\">\n <button class=\"btn btn-primary\"\n (click)=\"updateUnits()\">\n {{ 'User.Subscriptions.UpdateUnits' | transloco }}\n </button>\n </ng-template>\n <ng-template #nonPaidRef>\n <div>\n <small class=\"danger\"\n *ngIf=\"subscription?.products[0].trial_subscription\">Update seats is available only to paid subscriptions</small>\n </div>\n </ng-template>\n </div>\n\n <div class=\"col-12 col-md-6\"\n *ngIf=\"hasUnitChanged\">\n <table class=\"table table-borderless table-sm\"\n aria-describedby=\"Product details\">\n <thead>\n <tr>\n <th scope=\"true\">Product</th>\n <th scope=\"true\">Price per seat <span>({{subscription?.products[0]?.currency|currencySymbol}})</span></th>\n <th scope=\"true\">Seats</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let product of subscription.products; trackBy: trackByProduct\">\n <td>{{ product.name }}</td>\n <td>{{ product.price_per_unit / 100 }}</td>\n <td>{{ units }}</td>\n </tr>\n </tbody>\n </table>\n <p>\n If you proceed, the new cost for your subscription will be\n <strong>{{ totalAmount()| currency: subscription?.products[0]?.currency:'symbol-narrow'}}</strong>\n </p>\n </div>\n</div>\n<form [formGroup]=\"form\"\n (ngSubmit)=\"onSaveDetails()\"\n class=\"row mt-4\"\n *ngIf=\"subscription\">\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.ContactName' | transloco\"\n class=\"col-md-6\"\n label=\"Contact Name\"\n name=\"contact_name\"\n errorMsg=\"Please enter Contact Name\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"contact_name\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.ContactEmail' | transloco\"\n class=\"col-md-6\"\n label=\"Contact Email\"\n name=\"contact_email\"\n errorMsg=\"Please enter Contact Email\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"contact_email\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.Organisation' | transloco\"\n class=\"col-md-6\"\n label=\"Organisation\"\n name=\"organisation\"\n errorMsg=\"Please enter organisation\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"organisation\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.Phone' | transloco\"\n class=\"col-md-6\"\n label=\"Contact Tel\"\n name=\"contact_tel\"\n errorMsg=\"Please enter Contact Telephone Number\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"contact_tel\" />\n </pw-input-container>\n <ng-container *ngIf=\"countries$ | async as countries\">\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.Country' | transloco\"\n class=\"col-md-6\"\n label=\"Country\"\n name=\"country_code\"\n errorMsg=\"Please select a country\">\n <select id=\"country\"\n class=\"form-select form-control\"\n formControlName=\"country_code\">\n <option value=\"0\">Select Country</option>\n <option *ngFor=\"let country of countries\"\n [value]=\"country.code\">\n {{ country.name }}\n </option>\n </select>\n </pw-input-container>\n </ng-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.Address' | transloco\"\n class=\"col-md-6\"\n label=\"Address\"\n name=\"address\"\n errorMsg=\"Please enter address\">\n <input ngx-google-places-autocomplete\n class=\"form-control\"\n #places=\"ngx-places\"\n formControlName=\"address\"\n (onAddressChange)=\"handleAddressChange($event)\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.VatNumber' | transloco\"\n class=\"col-md-6\"\n label=\"GST/VAT Number\"\n name=\"tax_id\"\n errorMsg=\"Please enter GST/VAT Number\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"tax_id\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.CompanyUrl' | transloco\"\n class=\"col-md-6\"\n label=\"Company URL\"\n name=\"company_url\"\n errorMsg=\"Please enter company url\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"company_url\" />\n </pw-input-container>\n\n <ng-container *rbacAllow=\"'SubscriptionSuperAdmin'\">\n <div class=\"col-12\">\n <h3>Social Media</h3>\n <p>\n Any of the social media handles that you set here will appear in the footer of emails going out to your child subscriptions.\n </p>\n </div>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.FacebookHandle' | transloco\"\n class=\"col-md-6\"\n label=\"Facebook handle\"\n name=\"facebook_handle\"\n errorMsg=\"Please enter facebook id\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"facebook_handle\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.TwitterHandle' | transloco\"\n class=\"col-md-6\"\n label=\"Twitter handle\"\n name=\"twitter_handle\"\n errorMsg=\"Please enter twitter id\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"twitter_handle\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.LinkedinHandle' | transloco\"\n class=\"col-md-6\"\n label=\"Linkedin handle\"\n name=\"linkedin_handle\"\n errorMsg=\"Please enter linkedin id\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"linkedin_handle\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.RedditHandle' | transloco\"\n class=\"col-md-6\"\n label=\"Reddit handle\"\n name=\"reddit_handle\"\n errorMsg=\"Please enter reddit id\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"reddit_handle\" />\n </pw-input-container>\n </ng-container>\n\n <div class=\"col-12\">\n <h3>Security</h3>\n <p>\n While we'll add more security options in the future, please start by enforcing 2FA for all your subscription members.\n </p>\n </div>\n <div class=\"col-12 col-sm-3\">\n <pw-input-container label=\"Enforce 2FA\"\n [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.Enforce2fa' | transloco\"\n name=\"enforce_2fa\">\n <ui-switch formControlName=\"enforce_2fa\"\n name=\"enforce_2fa\"> </ui-switch>\n </pw-input-container>\n </div>\n <div class=\"mb-3 col-12 text-end mt-3\">\n <button type=\"button\"\n class=\"btn btn-outline-default me-2\"\n routerLink=\"/account/subscriptions\">\n {{ 'Button.Cancel' | transloco }}\n </button>\n <button name=\"submit\"\n type=\"submit\"\n class=\"btn btn-primary\">\n {{ 'Button.Submit' | transloco }}\n </button>\n </div>\n</form>\n\n<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h3 class=\"modal-title mb-0 p-0\">{{ 'User.Subscriptions.FullLogo' | transloco }}</h3>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <small> {{ 'User.Profile.PictureMessage' | transloco }}</small>\n <pw-image-cropper #profile\n (imageSelectionEvent)=\"onImageSelection($event)\"\n aspectRatio=\"fullLogo\"\n (closeEvent)=\"onClose()\">\n </pw-image-cropper>\n </div>\n</ng-template>\n<ng-template #squaredLogoContent\n let-modal>\n <div class=\"modal-header\">\n <h3 class=\"modal-title mb-0 p-0\">{{ 'User.Subscriptions.SquaredLogo' | transloco }}</h3>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <small> {{ 'User.Profile.PictureMessage' | transloco }}</small>\n <pw-image-cropper #profile\n (imageSelectionEvent)=\"uploadSquaredLogo($event)\"\n aspectRatio=\"auto\"\n (closeEvent)=\"onClose()\">\n </pw-image-cropper>\n </div>\n</ng-template>\n<pw-password-validation #modal\n (successEvent)=\"onPasswordValidation($event)\"> </pw-password-validation>\n", styles: [".sub-header{color:gray;font-size:20px;font-weight:600}.full-logo{object-fit:cover;width:280px}@media only screen and (max-width: 767px){.btns-row .btn-primary{font-size:.8rem;margin-top:5px;padding:.375rem .5rem}}\n"], dependencies: [{ kind: "directive", type: i3.LazyImgDirective, selector: "img" }, { kind: "directive", type: i3.RbacAllowDirective, selector: "[rbacAllow]", inputs: ["rbacAllow"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i6.GooglePlaceDirective, selector: "[ngx-google-places-autocomplete]", inputs: ["options"], outputs: ["onAddressChange"], exportAs: ["ngx-places"] }, { kind: "component", type: i7.PasswordValidationComponent, selector: "pw-password-validation", outputs: ["successEvent"] }, { kind: "component", type: i7.ProfileImageCropperComponent, selector: "pw-image-cropper", inputs: ["aspectRatio"], outputs: ["imageSelectionEvent", "closeEvent", "fileChangeEvent"] }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i10$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "component", type: i7.InputContainerComponent, selector: "pw-input-container", inputs: ["name", "label", "labelClass", "tooltipPosition", "required", "errorMsg", "isReadOnly", "showTooltip", "tooltipText"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i10.TranslocoPipe, name: "transloco" }] });
1171
+ __decorate([
1172
+ ValidateForm('form'),
1173
+ __metadata("design:type", Function),
1174
+ __metadata("design:paramtypes", []),
1175
+ __metadata("design:returntype", void 0)
1176
+ ], UserSubscriptionDetailsComponent.prototype, "onSaveDetails", null);
1177
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UserSubscriptionDetailsComponent, decorators: [{
1178
+ type: Component,
1179
+ args: [{ template: "<!-- edit Subscription details page -->\n<div class=\"row\">\n <div class=\"col-12\">\n <h3 class=\"my-3\">{{ subscription?.organisation || subscription?.contact_name }}</h3>\n </div>\n</div>\n\n<div class=\"row\"\n *ngIf=\"subscription\">\n <div class=\"col-md-6\">\n <div class=\"text-center mt-5\">\n <div class=\"image-container\">\n <h4 class=\"mb-2\">Full Logo\n <span class=\"tooltip-wrap ms-1\"\n [pTooltip]=\"'User.Subscriptions.Tooltip.FullLogo'|transloco\"\n [appendTo]=\"'body'\"\n [tooltipPosition]=\"'top'\">\n <i class=\"fas fa-info-circle\"></i>\n </span>\n </h4>\n <img [src]=\"fullLogo\"\n alt=\"full logo image\"\n width=\"100%\"\n class=\"image full-logo\"\n height=\"100%\"\n onerror=\"this.onerror=null;this.src='assets/img/icons/dummy-logo.jpg';\" />\n <div class=\"overlay mt-2\"\n (click)=\"openModal(content)\">\n <div class=\"overlay-text\">\n <a href=\"javascript:void(0)\">{{ 'User.Profile.Change' | transloco }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"col-md-6\">\n <div class=\"text-center mt-5\">\n <div class=\"image-container\">\n <h4 class=\"mb-2\">Squared Logo\n <span class=\"tooltip-wrap ms-1\"\n [pTooltip]=\"'User.Subscriptions.Tooltip.SquaredLogo'|transloco\"\n [appendTo]=\"'body'\"\n [tooltipPosition]=\"'top'\">\n <i class=\"fas fa-info-circle\"></i>\n </span>\n </h4>\n <img [src]=\"squaredLogo\"\n alt=\"squared logo image\"\n width=\"150\"\n class=\"squared_logo\"\n [height]=\"'150'\"\n onerror=\"this.onerror=null;this.src='assets/img/icons/dummy-icon.jpg';\" />\n <div class=\"overlay mt-2\"\n (click)=\"openModal(squaredLogoContent)\">\n <div class=\"overlay-text\">\n <a href=\"javascript:void(0)\">{{ 'User.Profile.Change' | transloco }}</a>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n<div class=\"row\">\n <div class=\"col-12\">\n <small *ngIf=\"subscription?.trial_subscription && subscription?.calculated_price\"\n class=\"text-danger\">Upgrade to be able to update your purchased seats</small>\n </div>\n</div>\n<div class=\"row btns-row align-items-center\">\n <div class=\"col-md-3 col-8\"\n *ngIf=\"subscription\">\n <pw-number-picker [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.Seats'|transloco\"\n name=\"number-picker\"\n [(value)]=\"units\"\n [min]=\"subscription?.min_units||subscription?.products[0].min_units\"\n [max]=\"subscription?.products[0].max_units\"\n step=\"1\"\n postfix=\"seats\"\n placeholder=\"Total Licencees\"\n [inputReadOnly]=\"subscription?.products[0].trial_subscription\"\n [showUpButton]=\"!subscription?.products[0].trial_subscription\"\n [showDownButton]=\"!subscription?.products[0].trial_subscription\"\n size=\"small\"\n pickStartAfter=\"500\"\n pickTimer=\"100\"\n [arrowKeys]=\"true\"\n (minReached)=\"onMinReached($event)\"\n (maxReached)=\"onMaxReached($event)\"\n (valueChange)=\"onUnitChange($event)\">\n </pw-number-picker>\n </div>\n\n <div class=\"col-md-3 col-4 p-1\"\n *ngIf=\"subscription\">\n\n <ng-template [ngIf]=\"!subscription?.products[0].trial_subscription && allowUpdate\"\n [ngIfElse]=\"nonPaidRef\">\n <button class=\"btn btn-primary\"\n (click)=\"updateUnits()\">\n {{ 'User.Subscriptions.UpdateUnits' | transloco }}\n </button>\n </ng-template>\n <ng-template #nonPaidRef>\n <div>\n <small class=\"danger\"\n *ngIf=\"subscription?.products[0].trial_subscription\">Update seats is available only to paid subscriptions</small>\n </div>\n </ng-template>\n </div>\n\n <div class=\"col-12 col-md-6\"\n *ngIf=\"hasUnitChanged\">\n <table class=\"table table-borderless table-sm\"\n aria-describedby=\"Product details\">\n <thead>\n <tr>\n <th scope=\"true\">Product</th>\n <th scope=\"true\">Price per seat <span>({{subscription?.products[0]?.currency|currencySymbol}})</span></th>\n <th scope=\"true\">Seats</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let product of subscription.products; trackBy: trackByProduct\">\n <td>{{ product.name }}</td>\n <td>{{ product.price_per_unit / 100 }}</td>\n <td>{{ units }}</td>\n </tr>\n </tbody>\n </table>\n <p>\n If you proceed, the new cost for your subscription will be\n <strong>{{ totalAmount()| currency: subscription?.products[0]?.currency:'symbol-narrow'}}</strong>\n </p>\n </div>\n</div>\n<form [formGroup]=\"form\"\n (ngSubmit)=\"onSaveDetails()\"\n class=\"row mt-4\"\n *ngIf=\"subscription\">\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.ContactName' | transloco\"\n class=\"col-md-6\"\n label=\"Contact Name\"\n name=\"contact_name\"\n errorMsg=\"Please enter Contact Name\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"contact_name\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.ContactEmail' | transloco\"\n class=\"col-md-6\"\n label=\"Contact Email\"\n name=\"contact_email\"\n errorMsg=\"Please enter Contact Email\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"contact_email\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.Organisation' | transloco\"\n class=\"col-md-6\"\n label=\"Organisation\"\n name=\"organisation\"\n errorMsg=\"Please enter organisation\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"organisation\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.Phone' | transloco\"\n class=\"col-md-6\"\n label=\"Contact Tel\"\n name=\"contact_tel\"\n errorMsg=\"Please enter Contact Telephone Number\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"contact_tel\" />\n </pw-input-container>\n <ng-container *ngIf=\"countries$ | async as countries\">\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.Country' | transloco\"\n class=\"col-md-6\"\n label=\"Country\"\n name=\"country_code\"\n errorMsg=\"Please select a country\">\n <select id=\"country\"\n class=\"form-select form-control\"\n formControlName=\"country_code\">\n <option value=\"0\">Select Country</option>\n <option *ngFor=\"let country of countries\"\n [value]=\"country.code\">\n {{ country.name }}\n </option>\n </select>\n </pw-input-container>\n </ng-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.Address' | transloco\"\n class=\"col-md-6\"\n label=\"Address\"\n name=\"address\"\n errorMsg=\"Please enter address\">\n <input ngx-google-places-autocomplete\n class=\"form-control\"\n #places=\"ngx-places\"\n formControlName=\"address\"\n (onAddressChange)=\"handleAddressChange($event)\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.VatNumber' | transloco\"\n class=\"col-md-6\"\n label=\"GST/VAT Number\"\n name=\"tax_id\"\n errorMsg=\"Please enter GST/VAT Number\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"tax_id\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.CompanyUrl' | transloco\"\n class=\"col-md-6\"\n label=\"Company URL\"\n name=\"company_url\"\n errorMsg=\"Please enter company url\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"company_url\" />\n </pw-input-container>\n\n <ng-container *rbacAllow=\"'SubscriptionSuperAdmin'\">\n <div class=\"col-12\">\n <h3>Social Media</h3>\n <p>\n Any of the social media handles that you set here will appear in the footer of emails going out to your child subscriptions.\n </p>\n </div>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.FacebookHandle' | transloco\"\n class=\"col-md-6\"\n label=\"Facebook handle\"\n name=\"facebook_handle\"\n errorMsg=\"Please enter facebook id\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"facebook_handle\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.TwitterHandle' | transloco\"\n class=\"col-md-6\"\n label=\"Twitter handle\"\n name=\"twitter_handle\"\n errorMsg=\"Please enter twitter id\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"twitter_handle\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.LinkedinHandle' | transloco\"\n class=\"col-md-6\"\n label=\"Linkedin handle\"\n name=\"linkedin_handle\"\n errorMsg=\"Please enter linkedin id\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"linkedin_handle\" />\n </pw-input-container>\n <pw-input-container [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.RedditHandle' | transloco\"\n class=\"col-md-6\"\n label=\"Reddit handle\"\n name=\"reddit_handle\"\n errorMsg=\"Please enter reddit id\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"reddit_handle\" />\n </pw-input-container>\n </ng-container>\n\n <div class=\"col-12\">\n <h3>Security</h3>\n <p>\n While we'll add more security options in the future, please start by enforcing 2FA for all your subscription members.\n </p>\n </div>\n <div class=\"col-12 col-sm-3\">\n <pw-input-container label=\"Enforce 2FA\"\n [showTooltip]=\"true\"\n [tooltipText]=\"'User.Subscriptions.Tooltip.Enforce2fa' | transloco\"\n name=\"enforce_2fa\">\n <ui-switch formControlName=\"enforce_2fa\"\n name=\"enforce_2fa\"> </ui-switch>\n </pw-input-container>\n </div>\n <div class=\"mb-3 col-12 text-end mt-3\">\n <button type=\"button\"\n class=\"btn btn-outline-default me-2\"\n routerLink=\"/account/subscriptions\">\n {{ 'Button.Cancel' | transloco }}\n </button>\n <button name=\"submit\"\n type=\"submit\"\n class=\"btn btn-primary\">\n {{ 'Button.Submit' | transloco }}\n </button>\n </div>\n</form>\n\n<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h3 class=\"modal-title mb-0 p-0\">{{ 'User.Subscriptions.FullLogo' | transloco }}</h3>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <small> {{ 'User.Profile.PictureMessage' | transloco }}</small>\n <pw-image-cropper #profile\n (imageSelectionEvent)=\"onImageSelection($event)\"\n aspectRatio=\"fullLogo\"\n (closeEvent)=\"onClose()\">\n </pw-image-cropper>\n </div>\n</ng-template>\n<ng-template #squaredLogoContent\n let-modal>\n <div class=\"modal-header\">\n <h3 class=\"modal-title mb-0 p-0\">{{ 'User.Subscriptions.SquaredLogo' | transloco }}</h3>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <small> {{ 'User.Profile.PictureMessage' | transloco }}</small>\n <pw-image-cropper #profile\n (imageSelectionEvent)=\"uploadSquaredLogo($event)\"\n aspectRatio=\"auto\"\n (closeEvent)=\"onClose()\">\n </pw-image-cropper>\n </div>\n</ng-template>\n<pw-password-validation #modal\n (successEvent)=\"onPasswordValidation($event)\"> </pw-password-validation>\n", styles: [".sub-header{color:gray;font-size:20px;font-weight:600}.full-logo{object-fit:cover;width:280px}@media only screen and (max-width: 767px){.btns-row .btn-primary{font-size:.8rem;margin-top:5px;padding:.375rem .5rem}}\n"] }]
1180
+ }], ctorParameters: function () { return [{ type: i2.UntypedFormBuilder }, { type: i1$2.GeoService }, { type: i1$1.NgbModal }, { type: i1$2.SubscriptionService }, { type: i4$1.Store }, { type: i0.Injector }]; }, propDecorators: { modal: [{
1181
+ type: ViewChild,
1182
+ args: ['modal', { static: true }]
1183
+ }], onSaveDetails: [] } });
1184
+
1185
+ class UserSubscriptionListComponent extends AppBaseComponent {
1186
+ constructor(subscriptionService, adminService, modalService, store, clipboard, injector) {
1187
+ super(injector);
1188
+ this.subscriptionService = subscriptionService;
1189
+ this.adminService = adminService;
1190
+ this.modalService = modalService;
1191
+ this.store = store;
1192
+ this.clipboard = clipboard;
1193
+ this.showApiKey = true;
1194
+ this.subscribedSubscriptions = [];
1195
+ this.isLoaded = false;
1196
+ this.showTos = false;
1197
+ this.objectKeys = Object.keys;
1198
+ this.items = [
1199
+ { id: 'profile', label: 'Profile', icon: 'fa fa-fw fa-user-cog' },
1200
+ { id: 'subscription', label: 'Subscription', icon: 'fa fa-fw fa-book' },
1201
+ { id: 'invoice', label: 'Invoice', icon: 'fa fa-file-invoice-dollar' }
1202
+ ];
1203
+ this.getSubscribedProduct = this.getSubscribedProduct.bind(this);
1204
+ }
1205
+ ngOnInit() {
1206
+ this.route.queryParams.subscribe(params => {
1207
+ this.isAddNew = params['isNew'];
1208
+ this.getSubscribedProduct();
1209
+ this.selectedSubscription = null;
1210
+ });
1211
+ [this.activeItem] = this.items;
1212
+ }
1213
+ onClipboardCopy(accessCode) {
1214
+ this.clipboard.copy(accessCode);
1215
+ this.toast.success('Access Key copied to the clipboard');
1216
+ }
1217
+ attemptUnsubscribe(item, productId) {
1218
+ this.selectedSubscription = item;
1219
+ this.selectedSubscription.productId = productId;
1220
+ if (this.user.has_password) {
1221
+ this.passwordValidationForUnsubscribe.open();
1222
+ }
1223
+ else {
1224
+ this.noPasswordModal();
1225
+ }
1226
+ }
1227
+ getSubscribedProduct() {
1228
+ this.userStore().subscribe(user => {
1229
+ this.user = user;
1230
+ if (user) {
1231
+ this.userService.getUserSubscriptions(user.id).subscribe(response => {
1232
+ this.subscribedSubscriptions = sortBy(response.subscriptions, 'deleted');
1233
+ response === null || response === void 0 ? void 0 : response.expired_subscriptions.forEach(subscription => {
1234
+ this.subscribedSubscriptions.push(subscription);
1235
+ });
1236
+ this.subscribedSubscriptions.forEach(subscription => {
1237
+ subscription.products.forEach((product) => {
1238
+ product.masked = product.api_access_token
1239
+ ? '*************************'
1240
+ : null;
1241
+ });
1242
+ });
1243
+ this.isLoaded = true;
1244
+ });
1245
+ }
1246
+ });
1247
+ }
1248
+ updateAPIKEY(item) {
1249
+ this.subscriptionService.updateSubscriptionAPIKey(item.id).subscribe(response => {
1250
+ item.api_access_token = response;
1251
+ this.toast.success(this.translation.translate('User.Subscriptions.UpdatedKey'));
1252
+ this.getSubscribedProduct();
1253
+ });
1254
+ }
1255
+ showKey(item) {
1256
+ this.currentItem = item;
1257
+ this.passwordValidationModalForKey.open();
1258
+ this.showApiKey = false;
1259
+ }
1260
+ displayApiKey() {
1261
+ var _a;
1262
+ this.showApiKey = true;
1263
+ this.currentItem.masked = (_a = this.currentItem) === null || _a === void 0 ? void 0 : _a.api_access_token;
1264
+ }
1265
+ activateMenu() {
1266
+ this.activeItem = this.menu['activeItem'];
1267
+ if (this.activeItem.id === 'subscription') {
1268
+ this.getSubscribedProduct();
1269
+ }
1270
+ }
1271
+ onUnsubscribe(item) {
1272
+ const httpParams = new HttpParams().set('product_id', item.productId);
1273
+ this.subscriptionService
1274
+ .deleteSubscription(item.id, { params: httpParams })
1275
+ .subscribe(() => {
1276
+ this.store.dispatch(new GetUser());
1277
+ this.toast.success(this.translation.translate('User.Subscriptions.UnsubscribedProduct'));
1278
+ this.modalService.dismissAll();
1279
+ this.getSubscribedProduct();
1280
+ this.selectedSubscription = null;
1281
+ });
1282
+ }
1283
+ onValidatePassword(isSuccess) {
1284
+ if (isSuccess) {
1285
+ this.onUnsubscribe(this.selectedSubscription);
1286
+ }
1287
+ }
1288
+ discardEdit() {
1289
+ this.editing = false;
1290
+ this.selectedSubscription = null;
1291
+ }
1292
+ onSaveDetails() {
1293
+ this.toast.success(this.translation.translate('User.Subscriptions.UpdatedMessage'));
1294
+ this.editing = false;
1295
+ }
1296
+ onUpdatePaymentDetailsCancel() {
1297
+ this.router.navigate(['.'], { relativeTo: this.route, queryParams: {} });
1298
+ }
1299
+ attemptUpgrade(subscription, product) {
1300
+ if (this.user.has_password) {
1301
+ this.router.navigate([
1302
+ `account/subscriptions/upgrade/${subscription.id}/${product.id}`
1303
+ ]);
1304
+ }
1305
+ else {
1306
+ this.noPasswordModal();
1307
+ }
1308
+ }
1309
+ noPasswordModal() {
1310
+ swal.fire({
1311
+ title: 'Set Password',
1312
+ text: `Please set a password before changing the subscription in the account section.`,
1313
+ confirmButtonText: 'OK'
1314
+ });
1315
+ }
1316
+ showModalForAccountDeletion() {
1317
+ swal.fire({
1318
+ title: 'Delete',
1319
+ html: `Are you sure you want to delete?`,
1320
+ showCancelButton: true,
1321
+ reverseButtons: true,
1322
+ icon: 'warning'
1323
+ }).then(rep => {
1324
+ if (rep.value) {
1325
+ this.passwordValidationModalForAccountDelete.open();
1326
+ }
1327
+ });
1328
+ }
1329
+ deleteUser(_evnt) {
1330
+ const subscriptionId = PermissionService.selectedSubscription.id;
1331
+ this.adminService.deleteUser(this.user.id, subscriptionId).subscribe(() => {
1332
+ this.router.navigate(['logout']);
1333
+ });
1334
+ }
1335
+ showPrivacyAndTos(product) {
1336
+ this.productId = product.id;
1337
+ this.productName = product.name;
1338
+ this.showTos = true;
1339
+ }
1340
+ onCancel() {
1341
+ this.showTos = false;
1342
+ }
1343
+ trackBySubscription(_index, item) {
1344
+ return item.id;
1345
+ }
1346
+ trackByProduct(_index, item) {
1347
+ return item.id;
1348
+ }
1349
+ ngOnDestroy() {
1350
+ super.ngOnDestroy();
1351
+ }
1352
+ }
1353
+ UserSubscriptionListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UserSubscriptionListComponent, deps: [{ token: i1$2.SubscriptionService }, { token: i2$1.AdminService }, { token: i1$1.NgbModal }, { token: i4$1.Store }, { token: i5$1.Clipboard }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
1354
+ UserSubscriptionListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: UserSubscriptionListComponent, selector: "pw-user-subscriptions-list", viewQueries: [{ propertyName: "menu", first: true, predicate: ["menuItems"], descendants: true }, { propertyName: "changeSubscriptionRef", first: true, predicate: AddSubscriptionComponent, descendants: true }, { propertyName: "passwordValidationModalForAccountDelete", first: true, predicate: ["passwordValidationModalForAccountDelete"], descendants: true }, { propertyName: "passwordValidationModalForKey", first: true, predicate: ["passwordValidationModalForKey"], descendants: true }, { propertyName: "passwordValidationForUnsubscribe", first: true, predicate: ["passwordValidationForUnsubscribe"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<ng-container *ngIf=\"!showTos\">\n <!-- Subscriptions Tab Content -->\n <div class=\"row\"\n *ngIf=\"!editing && !isAddNew\">\n <div class=\"col-12\">\n <h2>Your Subscriptions</h2>\n <p class=\"float-start\">You'll find in this section the summary of your subscriptions.</p>\n <div class=\"text-end\">\n <!-- Delete Account -->\n <button type=\"button\"\n class=\"btn btn-sm btn-outline-danger px-3 mt-2 me-2 me-sm-2\"\n (click)=\"showModalForAccountDeletion()\"\n [pTooltip]=\"'User.Account.Tooltip.DeleteAccount' | transloco\"\n tooltipPosition=\"bottom\">\n {{ 'User.Account.DeleteAccount' | transloco }}\n </button>\n </div>\n </div>\n </div>\n <!-- Subscribed Product Cards -->\n\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n\n <div class=\"row\"\n *ngIf=\"\n !editing && !isAddNew && !isUpdatePayment && isLoaded && subscribedSubscriptions.length\n \">\n <div class=\"col-12 col-md-6 my-4\"\n *ngFor=\"let subscription of subscribedSubscriptions; trackBy: trackBySubscription\">\n <div class=\"subscription-details mb-4\">\n <div class=\"float-start\">\n <div>\n <strong>Organisation:</strong>\n {{\n subscription.organisation\n ? subscription.organisation\n : subscription.contact_name\n }}\n </div>\n <div>\n <strong>{{ 'User.Subscriptions.TotalPriceExclTax' | transloco }}:</strong>\n <ng-template [ngIf]=\"subscription.calculated_price\"\n [ngIfElse]=\"freeProductRef\">\n {{\n subscription.calculated_price / 100\n | currency: subscription.products[0]?.currency:'symbol-narrow'\n }}\n {{ subscription.products[0].trial_subscription ? '(After Trial)' : '' }}\n </ng-template>\n <ng-template #freeProductRef> Free </ng-template>\n </div>\n <div>\n <strong>{{ 'User.Subscriptions.TotalPurchasedSeats' | transloco }}:</strong>\n {{ subscription.purchased_units }}\n </div>\n <div>\n <div>\n <strong>{{ 'User.Subscriptions.SeatsInUse' | transloco }}:</strong>\n {{ subscription.units_in_use || 1 }}\n </div>\n </div>\n </div>\n\n <!-- Products list -->\n <div *ngFor=\"\n let product of subscription.products;\n let first = first;\n trackBy: trackByProduct\n \">\n <ng-container *ngIf=\"first\">\n <!-- Edit -->\n <div *ngIf=\"\n !product.deleted &&\n (subscription.is_subscription_owner ||\n subscription.is_subscription_admin) &&\n !product.dependency_products?.length\n \"\n class=\"float-end m-2 m-sm-2\">\n <a class=\"btn btn-outline-primary btn-sm mx-1\"\n href=\"javascript:void(0)\"\n [routerLink]=\"['../subscriptions/details', subscription.id]\">\n {{ 'Button.Edit' | transloco }}\n </a>\n <button [routerLink]=\"['../subscriptions', subscription.id, 'credential']\"\n *ngIf=\"\n !product.expired &&\n !product.deleted &&\n !product.trial_subscription\n \"\n class=\"btn btn-dark btn-sm float-end mx-1\">\n {{ 'User.Subscriptions.Credentials' | transloco }}\n </button>\n <!-- Update Card Details -->\n <a class=\"btn btn-sm btn-outline-primary mx-1 me-sm-2\"\n *ngIf=\"!isUpdatePayment && subscription.stripe_customer_id\"\n [routerLink]=\"[\n '../subscriptions',\n subscription.id,\n 'product',\n product.id,\n 'update-payment'\n ]\">\n <i class=\"fa fa-edit\" aria-hidden=\"true\"></i>\n {{ 'User.Subscriptions.UpdateCardDetails' | transloco }}</a>\n </div>\n <!-- Add New Subscription -->\n <div class=\"float-end m-2 m-sm-2\"\n *ngIf=\"\n !product.deleted &&\n (subscription.is_subscription_owner ||\n subscription.is_subscription_admin) &&\n !product.dependency_products?.length\n \">\n <button class=\"btn btn-sm btn-primary\"\n [routerLink]=\"'/account/subscriptions/add-new'\"\n [queryParams]=\"{ subscription_id: subscription.id }\"\n [pTooltip]=\"\n 'User.Subscriptions.Tooltip.ManageAllProducts' | transloco\n \"\n tooltipPosition=\"bottom\">\n <i class=\"fa fa-plus-circle\"></i>\n {{ 'User.Subscriptions.SeeAllProducts' | transloco }}\n </button>\n </div>\n </ng-container>\n <div class=\"card subscription-products-cards\">\n <div class=\"card-content\">\n <div class=\"card-header\">\n <div>\n <h4 class=\"mb-3 text-bold-500 primary\">{{ product?.name }}</h4>\n <!-- Frequency -->\n <div>\n <div>\n <strong class=\"d-inline-block w-50\">{{\n 'User.Subscriptions.Frequency' | transloco\n }}:</strong>\n {{ product?.billing_frequency | uppercase }}\n </div>\n </div>\n <!-- Expiration -->\n <div [ngClass]=\"{ 'text-danger': product.expired }\">\n <strong class=\"d-inline-block w-50\">{{\n product.expired ? 'Expired' : 'Expiry Date'\n }}:</strong>\n {{ product.expires_at | dateFormat }}\n </div>\n <!-- Estimated Price -->\n <div [ngClass]=\"{ 'text-danger': product.expired }\">\n <strong class=\"d-inline-block w-50\">{{\n 'User.Subscriptions.PriceExclTax' | transloco\n }}:</strong>\n {{ product.currency }}\n {{ (product.calculated_price / 100).toFixed(2) }}\n </div>\n <!-- API Key -->\n <ng-template [ngIf]=\"\n (product.stripe_plan_id && product.max_hits > 0) ||\n product.max_hits_trial > 0\n \">\n <div class=\"d-inline\">\n <strong class=\"d-inline-block w-50\">{{\n 'User.Subscriptions.ApiKey' | transloco\n }}:</strong>\n <code class=\"d-inline me-2\">{{ product.masked }}</code>\n </div>\n <div class=\"float-end\">\n <!-- Show Access Key -->\n <button class=\"btn\"\n ngbTooltip=\"Show Access Key\"\n (click)=\"showKey(product)\">\n <i class=\"fas fa-eye\" aria-hidden=\"true\"></i>\n </button>\n <!-- Copy To Clipboard -->\n <button class=\"btn\"\n ngbTooltip=\"Copy Key\">\n <i\n class=\"fal fa-copy\"\n aria-hidden=\"true\"\n (click)=\"\n onClipboardCopy(product.api_access_token)\n \"\n ></i>\n </button>\n <!-- Update API Key -->\n <button class=\"btn\"\n ngbTooltip=\"Change Key\"\n *ngIf=\"!product.expired && !product.deleted\"\n (click)=\"updateAPIKEY(product)\">\n <i class=\"fal fa-sync-alt\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </ng-template>\n <div class=\"clearfix\"></div>\n </div>\n </div>\n <div class=\"card-footer px-3\">\n <div class=\"float-start\">\n <div *ngIf=\"product.deleted && !product.expired\">\n <i class=\"fa fa-info-circle me-2\" aria-hidden=\"true\"></i>{{ 'User.Subscriptions.OutdatedMessage' | transloco }}\n </div>\n <div>\n <span *ngIf=\"product.deleted\"\n class=\"badge bg-danger me-2\">Deleted</span>\n <span class=\"badge bg-warning me-2\"\n *ngIf=\"\n product.trial_subscription &&\n product.calculated_price\n \">\n Trial</span>\n <span class=\"badge badge-grey me-2\"\n *ngIf=\"product?.pause_collection && objectKeys(product?.pause_collection)?.length\"\n [pTooltip]=\"'User.Subscriptions.Tooltip.PausedCollection'|transloco\"\n tooltipPosition=\"top\">\n Paused collection\n </span>\n <span class=\"badge bg-success me-2\"\n *ngIf=\"!product.calculated_price\">\n Free\n </span>\n </div>\n </div>\n <ng-template [ngIf]=\"\n subscription.is_subscription_owner ||\n subscription.is_subscription_admin\n \">\n <!-- Unsubscribe -->\n <button class=\"btn btn-outline-danger btn-sm float-end me-2\"\n *ngIf=\"\n subscription?.stripe_customer_id&&\n !product?.deleted &&\n !product?.trial_subscription\n \"\n (click)=\"attemptUnsubscribe(subscription, product.id)\">\n {{ 'User.Subscriptions.Unsubscribe' | transloco }}\n </button>\n <button class=\"badge bg-dark me-2 float-end\"\n *ngIf=\"product?.product_privacy_service_id\"\n (click)=\"showPrivacyAndTos(product)\">\n {{\n 'User.Subscriptions.PrivacyAndTermsOfService'\n | transloco\n }}\n </button>\n\n <ng-template [ngIf]=\"product.stripe_plan_id && product.active\">\n <!-- Upgrade -->\n <button class=\"btn btn-primary btn-sm me-2 float-end\"\n *ngIf=\"product.trial_subscription && !product.deleted\"\n (click)=\"attemptUpgrade(subscription, product)\">\n {{ 'Button.Upgrade' | transloco }}\n </button>\n <!-- Subscribe -->\n <button class=\"btn btn-primary btn-sm float-start\"\n *ngIf=\"subscription.expired && product.stripe_plan_id\"\n [routerLink]=\"'/account/subscriptions/add-new'\">\n {{ 'User.Subscriptions.Subscribe' | transloco }}\n </button>\n </ng-template>\n </ng-template>\n <div *ngIf=\"!product?.deleted && !subscription.is_subscription_owner\">\n <i class=\"fa fa-info-circle\" aria-hidden=\"true\"></i> Invited to\n use this product\n <span *ngIf=\"subscription.is_subscription_admin\"\n class=\"fw-bold\">as an admin</span>\n </div>\n </div>\n </div>\n </div>\n\n <div *ngIf=\"subscription.products.length === 0\">\n <div class=\"card\">\n <div class=\"card-content\">\n <div class=\"card-header\">\n <p class=\"text-center\">\n No product available for this subscription\n </p>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"col-12\"\n *ngIf=\"!editing && !isAddNew && !isUpdatePayment\">\n <pw-no-data message=\"You don't have any subscription.\"\n *ngIf=\"subscribedSubscriptions.length === 0\">\n </pw-no-data>\n </div>\n </div>\n </div>\n </div>\n\n <!--\n Add New Subscription\n -->\n <!-- <ng-template [ngIf]=\"isAddNew && !isUpdatePayment\">\n <pw-subscription-details></pw-subscription-details>\n </ng-template> -->\n <!--\n Validate Password For Account Delete\n -->\n <pw-password-validation #passwordValidationModalForAccountDelete\n (successEvent)=\"deleteUser($event)\">\n <div class=\"row\">\n <div class=\"col-12\">\n <p>{{ 'User.Account.Message.ActionCanNotUndone' | transloco }}</p>\n <p>{{ 'User.Account.Message.ConfirmPassword' | transloco }}</p>\n </div>\n </div>\n </pw-password-validation>\n <!--\n Validate Password For Display Key\n -->\n <pw-password-validation #passwordValidationModalForKey\n (successEvent)=\"displayApiKey()\">\n </pw-password-validation>\n <!--\n Validate Password For Unsubscribe\n -->\n <pw-password-validation #passwordValidationForUnsubscribe\n (successEvent)=\"onValidatePassword($event)\">\n <div class=\"row\">\n <div class=\"col-12\">\n <p>{{ 'User.Account.Message.ActionCanNotUndone' | transloco }}</p>\n <p>{{ 'User.Account.Message.ConfirmPassword' | transloco }}</p>\n </div>\n </div>\n </pw-password-validation>\n</ng-container>\n\n<ng-container *ngIf=\"showTos\">\n <pw-privacy-and-tos [productId]=\"productId\"></pw-privacy-and-tos>\n</ng-container>\n\n<router-outlet></router-outlet>\n", styles: [".btn-list{bottom:24px;left:0;padding:0 38px;right:0}.shadow-md{padding-bottom:70px!important}.bg-dark{border:0}.subscription-products-cards{padding-bottom:0!important}.subscription-products-cards .card-footer{position:static!important}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i7.PasswordValidationComponent, selector: "pw-password-validation", outputs: ["successEvent"] }, { kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i10$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "component", type: i5.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { kind: "pipe", type: i4.UpperCasePipe, name: "uppercase" }, { kind: "pipe", type: i4.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i10.TranslocoPipe, name: "transloco" }] });
1355
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UserSubscriptionListComponent, decorators: [{
1356
+ type: Component,
1357
+ args: [{ selector: 'pw-user-subscriptions-list', template: "<ng-container *ngIf=\"!showTos\">\n <!-- Subscriptions Tab Content -->\n <div class=\"row\"\n *ngIf=\"!editing && !isAddNew\">\n <div class=\"col-12\">\n <h2>Your Subscriptions</h2>\n <p class=\"float-start\">You'll find in this section the summary of your subscriptions.</p>\n <div class=\"text-end\">\n <!-- Delete Account -->\n <button type=\"button\"\n class=\"btn btn-sm btn-outline-danger px-3 mt-2 me-2 me-sm-2\"\n (click)=\"showModalForAccountDeletion()\"\n [pTooltip]=\"'User.Account.Tooltip.DeleteAccount' | transloco\"\n tooltipPosition=\"bottom\">\n {{ 'User.Account.DeleteAccount' | transloco }}\n </button>\n </div>\n </div>\n </div>\n <!-- Subscribed Product Cards -->\n\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n\n <div class=\"row\"\n *ngIf=\"\n !editing && !isAddNew && !isUpdatePayment && isLoaded && subscribedSubscriptions.length\n \">\n <div class=\"col-12 col-md-6 my-4\"\n *ngFor=\"let subscription of subscribedSubscriptions; trackBy: trackBySubscription\">\n <div class=\"subscription-details mb-4\">\n <div class=\"float-start\">\n <div>\n <strong>Organisation:</strong>\n {{\n subscription.organisation\n ? subscription.organisation\n : subscription.contact_name\n }}\n </div>\n <div>\n <strong>{{ 'User.Subscriptions.TotalPriceExclTax' | transloco }}:</strong>\n <ng-template [ngIf]=\"subscription.calculated_price\"\n [ngIfElse]=\"freeProductRef\">\n {{\n subscription.calculated_price / 100\n | currency: subscription.products[0]?.currency:'symbol-narrow'\n }}\n {{ subscription.products[0].trial_subscription ? '(After Trial)' : '' }}\n </ng-template>\n <ng-template #freeProductRef> Free </ng-template>\n </div>\n <div>\n <strong>{{ 'User.Subscriptions.TotalPurchasedSeats' | transloco }}:</strong>\n {{ subscription.purchased_units }}\n </div>\n <div>\n <div>\n <strong>{{ 'User.Subscriptions.SeatsInUse' | transloco }}:</strong>\n {{ subscription.units_in_use || 1 }}\n </div>\n </div>\n </div>\n\n <!-- Products list -->\n <div *ngFor=\"\n let product of subscription.products;\n let first = first;\n trackBy: trackByProduct\n \">\n <ng-container *ngIf=\"first\">\n <!-- Edit -->\n <div *ngIf=\"\n !product.deleted &&\n (subscription.is_subscription_owner ||\n subscription.is_subscription_admin) &&\n !product.dependency_products?.length\n \"\n class=\"float-end m-2 m-sm-2\">\n <a class=\"btn btn-outline-primary btn-sm mx-1\"\n href=\"javascript:void(0)\"\n [routerLink]=\"['../subscriptions/details', subscription.id]\">\n {{ 'Button.Edit' | transloco }}\n </a>\n <button [routerLink]=\"['../subscriptions', subscription.id, 'credential']\"\n *ngIf=\"\n !product.expired &&\n !product.deleted &&\n !product.trial_subscription\n \"\n class=\"btn btn-dark btn-sm float-end mx-1\">\n {{ 'User.Subscriptions.Credentials' | transloco }}\n </button>\n <!-- Update Card Details -->\n <a class=\"btn btn-sm btn-outline-primary mx-1 me-sm-2\"\n *ngIf=\"!isUpdatePayment && subscription.stripe_customer_id\"\n [routerLink]=\"[\n '../subscriptions',\n subscription.id,\n 'product',\n product.id,\n 'update-payment'\n ]\">\n <i class=\"fa fa-edit\" aria-hidden=\"true\"></i>\n {{ 'User.Subscriptions.UpdateCardDetails' | transloco }}</a>\n </div>\n <!-- Add New Subscription -->\n <div class=\"float-end m-2 m-sm-2\"\n *ngIf=\"\n !product.deleted &&\n (subscription.is_subscription_owner ||\n subscription.is_subscription_admin) &&\n !product.dependency_products?.length\n \">\n <button class=\"btn btn-sm btn-primary\"\n [routerLink]=\"'/account/subscriptions/add-new'\"\n [queryParams]=\"{ subscription_id: subscription.id }\"\n [pTooltip]=\"\n 'User.Subscriptions.Tooltip.ManageAllProducts' | transloco\n \"\n tooltipPosition=\"bottom\">\n <i class=\"fa fa-plus-circle\"></i>\n {{ 'User.Subscriptions.SeeAllProducts' | transloco }}\n </button>\n </div>\n </ng-container>\n <div class=\"card subscription-products-cards\">\n <div class=\"card-content\">\n <div class=\"card-header\">\n <div>\n <h4 class=\"mb-3 text-bold-500 primary\">{{ product?.name }}</h4>\n <!-- Frequency -->\n <div>\n <div>\n <strong class=\"d-inline-block w-50\">{{\n 'User.Subscriptions.Frequency' | transloco\n }}:</strong>\n {{ product?.billing_frequency | uppercase }}\n </div>\n </div>\n <!-- Expiration -->\n <div [ngClass]=\"{ 'text-danger': product.expired }\">\n <strong class=\"d-inline-block w-50\">{{\n product.expired ? 'Expired' : 'Expiry Date'\n }}:</strong>\n {{ product.expires_at | dateFormat }}\n </div>\n <!-- Estimated Price -->\n <div [ngClass]=\"{ 'text-danger': product.expired }\">\n <strong class=\"d-inline-block w-50\">{{\n 'User.Subscriptions.PriceExclTax' | transloco\n }}:</strong>\n {{ product.currency }}\n {{ (product.calculated_price / 100).toFixed(2) }}\n </div>\n <!-- API Key -->\n <ng-template [ngIf]=\"\n (product.stripe_plan_id && product.max_hits > 0) ||\n product.max_hits_trial > 0\n \">\n <div class=\"d-inline\">\n <strong class=\"d-inline-block w-50\">{{\n 'User.Subscriptions.ApiKey' | transloco\n }}:</strong>\n <code class=\"d-inline me-2\">{{ product.masked }}</code>\n </div>\n <div class=\"float-end\">\n <!-- Show Access Key -->\n <button class=\"btn\"\n ngbTooltip=\"Show Access Key\"\n (click)=\"showKey(product)\">\n <i class=\"fas fa-eye\" aria-hidden=\"true\"></i>\n </button>\n <!-- Copy To Clipboard -->\n <button class=\"btn\"\n ngbTooltip=\"Copy Key\">\n <i\n class=\"fal fa-copy\"\n aria-hidden=\"true\"\n (click)=\"\n onClipboardCopy(product.api_access_token)\n \"\n ></i>\n </button>\n <!-- Update API Key -->\n <button class=\"btn\"\n ngbTooltip=\"Change Key\"\n *ngIf=\"!product.expired && !product.deleted\"\n (click)=\"updateAPIKEY(product)\">\n <i class=\"fal fa-sync-alt\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </ng-template>\n <div class=\"clearfix\"></div>\n </div>\n </div>\n <div class=\"card-footer px-3\">\n <div class=\"float-start\">\n <div *ngIf=\"product.deleted && !product.expired\">\n <i class=\"fa fa-info-circle me-2\" aria-hidden=\"true\"></i>{{ 'User.Subscriptions.OutdatedMessage' | transloco }}\n </div>\n <div>\n <span *ngIf=\"product.deleted\"\n class=\"badge bg-danger me-2\">Deleted</span>\n <span class=\"badge bg-warning me-2\"\n *ngIf=\"\n product.trial_subscription &&\n product.calculated_price\n \">\n Trial</span>\n <span class=\"badge badge-grey me-2\"\n *ngIf=\"product?.pause_collection && objectKeys(product?.pause_collection)?.length\"\n [pTooltip]=\"'User.Subscriptions.Tooltip.PausedCollection'|transloco\"\n tooltipPosition=\"top\">\n Paused collection\n </span>\n <span class=\"badge bg-success me-2\"\n *ngIf=\"!product.calculated_price\">\n Free\n </span>\n </div>\n </div>\n <ng-template [ngIf]=\"\n subscription.is_subscription_owner ||\n subscription.is_subscription_admin\n \">\n <!-- Unsubscribe -->\n <button class=\"btn btn-outline-danger btn-sm float-end me-2\"\n *ngIf=\"\n subscription?.stripe_customer_id&&\n !product?.deleted &&\n !product?.trial_subscription\n \"\n (click)=\"attemptUnsubscribe(subscription, product.id)\">\n {{ 'User.Subscriptions.Unsubscribe' | transloco }}\n </button>\n <button class=\"badge bg-dark me-2 float-end\"\n *ngIf=\"product?.product_privacy_service_id\"\n (click)=\"showPrivacyAndTos(product)\">\n {{\n 'User.Subscriptions.PrivacyAndTermsOfService'\n | transloco\n }}\n </button>\n\n <ng-template [ngIf]=\"product.stripe_plan_id && product.active\">\n <!-- Upgrade -->\n <button class=\"btn btn-primary btn-sm me-2 float-end\"\n *ngIf=\"product.trial_subscription && !product.deleted\"\n (click)=\"attemptUpgrade(subscription, product)\">\n {{ 'Button.Upgrade' | transloco }}\n </button>\n <!-- Subscribe -->\n <button class=\"btn btn-primary btn-sm float-start\"\n *ngIf=\"subscription.expired && product.stripe_plan_id\"\n [routerLink]=\"'/account/subscriptions/add-new'\">\n {{ 'User.Subscriptions.Subscribe' | transloco }}\n </button>\n </ng-template>\n </ng-template>\n <div *ngIf=\"!product?.deleted && !subscription.is_subscription_owner\">\n <i class=\"fa fa-info-circle\" aria-hidden=\"true\"></i> Invited to\n use this product\n <span *ngIf=\"subscription.is_subscription_admin\"\n class=\"fw-bold\">as an admin</span>\n </div>\n </div>\n </div>\n </div>\n\n <div *ngIf=\"subscription.products.length === 0\">\n <div class=\"card\">\n <div class=\"card-content\">\n <div class=\"card-header\">\n <p class=\"text-center\">\n No product available for this subscription\n </p>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"col-12\"\n *ngIf=\"!editing && !isAddNew && !isUpdatePayment\">\n <pw-no-data message=\"You don't have any subscription.\"\n *ngIf=\"subscribedSubscriptions.length === 0\">\n </pw-no-data>\n </div>\n </div>\n </div>\n </div>\n\n <!--\n Add New Subscription\n -->\n <!-- <ng-template [ngIf]=\"isAddNew && !isUpdatePayment\">\n <pw-subscription-details></pw-subscription-details>\n </ng-template> -->\n <!--\n Validate Password For Account Delete\n -->\n <pw-password-validation #passwordValidationModalForAccountDelete\n (successEvent)=\"deleteUser($event)\">\n <div class=\"row\">\n <div class=\"col-12\">\n <p>{{ 'User.Account.Message.ActionCanNotUndone' | transloco }}</p>\n <p>{{ 'User.Account.Message.ConfirmPassword' | transloco }}</p>\n </div>\n </div>\n </pw-password-validation>\n <!--\n Validate Password For Display Key\n -->\n <pw-password-validation #passwordValidationModalForKey\n (successEvent)=\"displayApiKey()\">\n </pw-password-validation>\n <!--\n Validate Password For Unsubscribe\n -->\n <pw-password-validation #passwordValidationForUnsubscribe\n (successEvent)=\"onValidatePassword($event)\">\n <div class=\"row\">\n <div class=\"col-12\">\n <p>{{ 'User.Account.Message.ActionCanNotUndone' | transloco }}</p>\n <p>{{ 'User.Account.Message.ConfirmPassword' | transloco }}</p>\n </div>\n </div>\n </pw-password-validation>\n</ng-container>\n\n<ng-container *ngIf=\"showTos\">\n <pw-privacy-and-tos [productId]=\"productId\"></pw-privacy-and-tos>\n</ng-container>\n\n<router-outlet></router-outlet>\n", styles: [".btn-list{bottom:24px;left:0;padding:0 38px;right:0}.shadow-md{padding-bottom:70px!important}.bg-dark{border:0}.subscription-products-cards{padding-bottom:0!important}.subscription-products-cards .card-footer{position:static!important}\n"] }]
1358
+ }], ctorParameters: function () { return [{ type: i1$2.SubscriptionService }, { type: i2$1.AdminService }, { type: i1$1.NgbModal }, { type: i4$1.Store }, { type: i5$1.Clipboard }, { type: i0.Injector }]; }, propDecorators: { menu: [{
1359
+ type: ViewChild,
1360
+ args: ['menuItems', { static: false }]
1361
+ }], changeSubscriptionRef: [{
1362
+ type: ViewChild,
1363
+ args: [AddSubscriptionComponent, { static: false }]
1364
+ }], passwordValidationModalForAccountDelete: [{
1365
+ type: ViewChild,
1366
+ args: ['passwordValidationModalForAccountDelete', { static: false }]
1367
+ }], passwordValidationModalForKey: [{
1368
+ type: ViewChild,
1369
+ args: ['passwordValidationModalForKey', { static: false }]
1370
+ }], passwordValidationForUnsubscribe: [{
1371
+ type: ViewChild,
1372
+ args: ['passwordValidationForUnsubscribe', { static: false }]
1373
+ }] } });
1374
+
1375
+ class UserInvoiceComponent extends AppBaseComponent {
1376
+ constructor() {
1377
+ super(...arguments);
1378
+ this.invoices = [];
1379
+ this.intervalTimer = interval(POLL_TIMEOUT * 60 * 1000);
1380
+ this.isLoaded = false;
1381
+ }
1382
+ ngOnInit() {
1383
+ this.fetchInvoices();
1384
+ }
1385
+ fetchInvoices() {
1386
+ this.userStore().subscribe(user => {
1387
+ if (user) {
1388
+ this.userId = user.id;
1389
+ this.userService.getUserInvoices(user.id).subscribe(invoices => {
1390
+ this.isLoaded = true;
1391
+ this.invoices = invoices;
1392
+ this.pollForInvoices();
1393
+ });
1394
+ }
1395
+ });
1396
+ }
1397
+ pollForInvoices() {
1398
+ this.subscription = this.intervalTimer
1399
+ .pipe(mergeMap(() => this.userService.getUserInvoices(this.userId)))
1400
+ .subscribe(data => {
1401
+ this.invoices = data;
1402
+ });
1403
+ }
1404
+ ngOnDestroy() {
1405
+ super.ngOnDestroy();
1406
+ if (this.subscription) {
1407
+ this.subscription.unsubscribe();
1408
+ }
1409
+ }
1410
+ }
1411
+ UserInvoiceComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UserInvoiceComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1412
+ UserInvoiceComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: UserInvoiceComponent, selector: "pw-user-invoice", usesInheritance: true, ngImport: i0, template: "<section class=\"invoice-template\">\n <div class=\"row\"\n *ngIf=\"isLoaded\">\n <div class=\"col-12 mb-3\">\n <h2>Your Invoices</h2>\n\n <p>Please find below your invoices.</p>\n </div>\n <div class=\"col-md-3 my-3\"\n *ngFor=\"let invoice of invoices\">\n <div class=\"shadow-md\">\n <div class=\"page-heading\">\n <div class=\"page-heading__container\">\n <h2 class=\"title\">{{ invoice?.product.name }}</h2>\n </div>\n </div>\n <div class=\"p-3\">\n <div class=\"card-inner-container\">\n <div class=\"text-muted margin-bottom-20 invoice-text\">\n <div>Invoice Date:</div>\n <div>{{ invoice.date | dateFormat }}</div>\n </div>\n <div class=\"text-muted margin-bottom-20 invoice-text\">\n <div>Frequency:</div>\n <div>{{ invoice.product.billing_frequency | uppercase }}</div>\n </div>\n <div class=\"text-muted margin-bottom-20 invoice-text\">\n <div>Seats Purchased:</div>\n <div>{{ invoice?.subscription_product?.purchased_units }}</div>\n </div>\n <div class=\"mt-4 text-muted invoice-text\">\n <div>Subtotal</div>\n <h5 class=\"fw-bold\"\n *ngIf=\"invoice?.subtotal_in_cents\">\n {{ (invoice.subtotal_in_cents / 100) | currency:invoice?.product?.currency }}\n </h5>\n </div>\n <div class=\"mt-4 text-muted invoice-text\">\n <div>Total (incl. tax)</div>\n <h5 class=\"fw-bold\"\n *ngIf=\"invoice?.total_in_cents\">\n {{ (invoice.total_in_cents / 100) | currency:invoice?.product?.currency }}\n </h5>\n </div>\n </div>\n <div class=\"d-block\">\n <a *ngIf=\"invoice?.file?.url;else noFileUrl\"\n class=\"btn btn-sm btn-primary\"\n [attr.href]=\"invoice.file.url\"\n target=\"_blank\"\n title=\"Download\">\n <i class=\"fa fa-download\">&nbsp;Download</i>\n </a>\n <ng-template #noFileUrl>\n <a class=\"btn btn-sm btn-primary\"\n [attr.href]=\"invoice?.stripe_invoice_pdf\"\n target=\"_blank\"\n title=\"Download\">\n <i class=\"fa fa-download\">&nbsp;Download</i>\n </a>\n </ng-template>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"\">\n <pw-no-data message=\"You don't have any invoice yet.\"\n *ngIf=\"invoices.length === 0\">\n </pw-no-data>\n </div>\n\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n</section>\n", styles: [".page-heading{background:rgb(252,252,252);border-bottom:1px solid rgba(0,0,0,.1);position:relative;width:100%}.page-heading:after{clear:both;content:\"\";display:table}.page-heading .page-heading__container{padding:15px 20px;position:relative}.page-heading .page-heading__container .title{color:#242437;font-size:15px;font-weight:500;line-height:20px;margin:3px 0 0;overflow:hidden;padding:0;text-overflow:ellipsis;width:95%}.card .card-container{position:absolute;right:20px;top:25px;z-index:1}.card-inner-container{background:rgba(0,0,0,.05);border:1px dashed rgba(0,0,0,.1);border-radius:3px;margin-bottom:20px;padding:20px}.invoice-text{display:flex;font-size:13px;justify-content:space-between;margin:10px 0}.invoice-template{min-height:calc(100vh - 190px)}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { kind: "pipe", type: i4.UpperCasePipe, name: "uppercase" }, { kind: "pipe", type: i4.CurrencyPipe, name: "currency" }] });
1413
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UserInvoiceComponent, decorators: [{
1414
+ type: Component,
1415
+ args: [{ selector: 'pw-user-invoice', template: "<section class=\"invoice-template\">\n <div class=\"row\"\n *ngIf=\"isLoaded\">\n <div class=\"col-12 mb-3\">\n <h2>Your Invoices</h2>\n\n <p>Please find below your invoices.</p>\n </div>\n <div class=\"col-md-3 my-3\"\n *ngFor=\"let invoice of invoices\">\n <div class=\"shadow-md\">\n <div class=\"page-heading\">\n <div class=\"page-heading__container\">\n <h2 class=\"title\">{{ invoice?.product.name }}</h2>\n </div>\n </div>\n <div class=\"p-3\">\n <div class=\"card-inner-container\">\n <div class=\"text-muted margin-bottom-20 invoice-text\">\n <div>Invoice Date:</div>\n <div>{{ invoice.date | dateFormat }}</div>\n </div>\n <div class=\"text-muted margin-bottom-20 invoice-text\">\n <div>Frequency:</div>\n <div>{{ invoice.product.billing_frequency | uppercase }}</div>\n </div>\n <div class=\"text-muted margin-bottom-20 invoice-text\">\n <div>Seats Purchased:</div>\n <div>{{ invoice?.subscription_product?.purchased_units }}</div>\n </div>\n <div class=\"mt-4 text-muted invoice-text\">\n <div>Subtotal</div>\n <h5 class=\"fw-bold\"\n *ngIf=\"invoice?.subtotal_in_cents\">\n {{ (invoice.subtotal_in_cents / 100) | currency:invoice?.product?.currency }}\n </h5>\n </div>\n <div class=\"mt-4 text-muted invoice-text\">\n <div>Total (incl. tax)</div>\n <h5 class=\"fw-bold\"\n *ngIf=\"invoice?.total_in_cents\">\n {{ (invoice.total_in_cents / 100) | currency:invoice?.product?.currency }}\n </h5>\n </div>\n </div>\n <div class=\"d-block\">\n <a *ngIf=\"invoice?.file?.url;else noFileUrl\"\n class=\"btn btn-sm btn-primary\"\n [attr.href]=\"invoice.file.url\"\n target=\"_blank\"\n title=\"Download\">\n <i class=\"fa fa-download\">&nbsp;Download</i>\n </a>\n <ng-template #noFileUrl>\n <a class=\"btn btn-sm btn-primary\"\n [attr.href]=\"invoice?.stripe_invoice_pdf\"\n target=\"_blank\"\n title=\"Download\">\n <i class=\"fa fa-download\">&nbsp;Download</i>\n </a>\n </ng-template>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"\">\n <pw-no-data message=\"You don't have any invoice yet.\"\n *ngIf=\"invoices.length === 0\">\n </pw-no-data>\n </div>\n\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n</section>\n", styles: [".page-heading{background:rgb(252,252,252);border-bottom:1px solid rgba(0,0,0,.1);position:relative;width:100%}.page-heading:after{clear:both;content:\"\";display:table}.page-heading .page-heading__container{padding:15px 20px;position:relative}.page-heading .page-heading__container .title{color:#242437;font-size:15px;font-weight:500;line-height:20px;margin:3px 0 0;overflow:hidden;padding:0;text-overflow:ellipsis;width:95%}.card .card-container{position:absolute;right:20px;top:25px;z-index:1}.card-inner-container{background:rgba(0,0,0,.05);border:1px dashed rgba(0,0,0,.1);border-radius:3px;margin-bottom:20px;padding:20px}.invoice-text{display:flex;font-size:13px;justify-content:space-between;margin:10px 0}.invoice-template{min-height:calc(100vh - 190px)}\n"] }]
1416
+ }] });
1417
+
1418
+ class CommunicationTabComponent extends AppBaseComponent {
1419
+ constructor(commonService, profileService, store, injector) {
1420
+ super(injector);
1421
+ this.commonService = commonService;
1422
+ this.profileService = profileService;
1423
+ this.store = store;
1424
+ this.subscriptions = [];
1425
+ this.isLoaded = false;
1426
+ this.userSubscription = [];
1427
+ }
1428
+ ngOnInit() {
1429
+ this.getAllSubscription();
1430
+ }
1431
+ getAllSubscription() {
1432
+ this.commonService.getAllNewsletter().subscribe(response => {
1433
+ this.store.select(getUser).subscribe(user => {
1434
+ if (user && user.currentUser) {
1435
+ this.user = user.currentUser;
1436
+ this.profileService
1437
+ .getUserObject('user_newsletters', this.user.slug)
1438
+ .subscribe(neswsletter => {
1439
+ this.isLoaded = true;
1440
+ this.userSubscription = neswsletter;
1441
+ this.subscriptions = response.newsletters;
1442
+ if (this.userSubscription.length > 0 && this.subscriptions.length > 0) {
1443
+ this.subscriptions.forEach(element => {
1444
+ const item = this.userSubscription.find(x => x.newsletter_id === element.id);
1445
+ element.enabled = item ? item.send_newsletters : false;
1446
+ });
1447
+ }
1448
+ else {
1449
+ this.subscriptions.forEach(element => {
1450
+ element.enabled = false;
1451
+ });
1452
+ }
1453
+ });
1454
+ }
1455
+ });
1456
+ });
1457
+ }
1458
+ onValueChange(item, value) {
1459
+ const data = {
1460
+ send_newsletter: value
1461
+ };
1462
+ if (item.id === 9999) {
1463
+ const marketingSubs = {
1464
+ id: this.user.id,
1465
+ send_marketing_emails: value
1466
+ };
1467
+ this.profileService.updateUserProfile(marketingSubs).subscribe(() => {
1468
+ this.updateUser();
1469
+ this.toast.success(this.translation.translate('User.Settings.UpdatedMessage'));
1470
+ });
1471
+ }
1472
+ else {
1473
+ this.commonService.toggleNewsletter(item.id, data).subscribe(() => {
1474
+ this.updateUser();
1475
+ this.toast.success(this.translation.translate('User.Settings.Communications.UpdatedMessage'));
1476
+ });
1477
+ }
1478
+ }
1479
+ updateUser() {
1480
+ // this.userService.getUserInfo().subscribe(resp => {
1481
+ // this.localStorage.setItem('user', JSON.stringify(resp)).subscribe();
1482
+ // });
1483
+ }
1484
+ }
1485
+ CommunicationTabComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: CommunicationTabComponent, deps: [{ token: i1$2.CommonService }, { token: i1$2.ProfileService }, { token: i4$1.Store }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
1486
+ CommunicationTabComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: CommunicationTabComponent, selector: "pw-communication-tab", usesInheritance: true, ngImport: i0, template: "<div class=\"row\">\n <div class=\"col-12\">\n <h2>Communication preferences</h2>\n\n <p>\n Although sometimes we do need to communicate with you - for example if you contact\n Support, or if we need to send you a receipt or invoice - we make a clear distinction\n between transactional and non-transactional communications.\n </p>\n\n <p>\n You will always receive the transactional communications but you can decide to opt out\n from all the not transactional ones. To do so, you\u2019ll just need to turn the switch off\n in the list of available communication provided below.\n </p>\n </div>\n\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n</div>\n\n<div class=\"row mt-4 pt-1\"\n *ngIf=\"isLoaded\">\n <div class=\"col-md-6 col-sm-6\">\n <ng-container *ngFor=\"let item of subscriptions; let idx = index\">\n <div class=\"mb-3\"\n *ngIf=\"item.visible || item.enabled\">\n <div class=\"row\">\n <div class=\"col-md-10 col-sm-6\">\n <label>{{ item.name }}</label>\n </div>\n <div class=\"col-md-2 col-sm-6\">\n <ui-switch [checked]=\"item.enabled\"\n checkedLabel=\"on\"\n uncheckedLabel=\"off\"\n (valueChange)=\"onValueChange(item, $event)\">\n </ui-switch>\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }] });
1487
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: CommunicationTabComponent, decorators: [{
1488
+ type: Component,
1489
+ args: [{ selector: 'pw-communication-tab', template: "<div class=\"row\">\n <div class=\"col-12\">\n <h2>Communication preferences</h2>\n\n <p>\n Although sometimes we do need to communicate with you - for example if you contact\n Support, or if we need to send you a receipt or invoice - we make a clear distinction\n between transactional and non-transactional communications.\n </p>\n\n <p>\n You will always receive the transactional communications but you can decide to opt out\n from all the not transactional ones. To do so, you\u2019ll just need to turn the switch off\n in the list of available communication provided below.\n </p>\n </div>\n\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n</div>\n\n<div class=\"row mt-4 pt-1\"\n *ngIf=\"isLoaded\">\n <div class=\"col-md-6 col-sm-6\">\n <ng-container *ngFor=\"let item of subscriptions; let idx = index\">\n <div class=\"mb-3\"\n *ngIf=\"item.visible || item.enabled\">\n <div class=\"row\">\n <div class=\"col-md-10 col-sm-6\">\n <label>{{ item.name }}</label>\n </div>\n <div class=\"col-md-2 col-sm-6\">\n <ui-switch [checked]=\"item.enabled\"\n checkedLabel=\"on\"\n uncheckedLabel=\"off\"\n (valueChange)=\"onValueChange(item, $event)\">\n </ui-switch>\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n</div>\n" }]
1490
+ }], ctorParameters: function () { return [{ type: i1$2.CommonService }, { type: i1$2.ProfileService }, { type: i4$1.Store }, { type: i0.Injector }]; } });
1491
+
1492
+ class OthersTabComponent extends AppBaseComponent {
1493
+ constructor(commonService, injector) {
1494
+ super(injector);
1495
+ this.commonService = commonService;
1496
+ this.subscriptionConfigs = [];
1497
+ this.globalConfigs = [];
1498
+ this.isLoaded = false;
1499
+ }
1500
+ ngOnInit() {
1501
+ this.getGlobalConfigs();
1502
+ this.userStore().subscribe(res => {
1503
+ if (res) {
1504
+ this.userId = res.id;
1505
+ }
1506
+ });
1507
+ }
1508
+ getGlobalSubscriptionConfig() {
1509
+ this.commonService
1510
+ .getAllGlobalSubscriptionConfigs()
1511
+ .subscribe(response => {
1512
+ this.subscriptionConfigs = response.global_subscriptin_configs;
1513
+ this.globalConfigs.forEach(globalConfig => {
1514
+ const config = this.subscriptionConfigs.find(subscriptionConfig => subscriptionConfig.global_config_id === (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.id));
1515
+ globalConfig.value = config === null || config === void 0 ? void 0 : config.value;
1516
+ globalConfig.global_subscriptin_config_id = config === null || config === void 0 ? void 0 : config.id;
1517
+ });
1518
+ })
1519
+ .add(() => {
1520
+ this.isLoaded = true;
1521
+ });
1522
+ }
1523
+ getGlobalConfigs() {
1524
+ this.commonService.getAllGlobalConfigs().subscribe(response => {
1525
+ this.globalConfigs = response.global_configs;
1526
+ this.getGlobalSubscriptionConfig();
1527
+ });
1528
+ }
1529
+ onValueChange(item, value) {
1530
+ const data = {
1531
+ user_id: this.userId,
1532
+ value,
1533
+ global_config_id: item === null || item === void 0 ? void 0 : item.id
1534
+ };
1535
+ const sub$ = (item === null || item === void 0 ? void 0 : item.global_subscriptin_config_id)
1536
+ ? this.commonService.editGlobalSubscriptionConfig(item === null || item === void 0 ? void 0 : item.global_subscriptin_config_id, data)
1537
+ : this.commonService.postGlobalSubscriptionConfig(data);
1538
+ sub$.subscribe(() => {
1539
+ this.toast.success(this.translation.translate('User.OtherSettings.UpdatedMessage'));
1540
+ }).add(() => {
1541
+ this.getGlobalConfigs();
1542
+ });
1543
+ }
1544
+ ngOnDestroy() {
1545
+ super.ngOnDestroy();
1546
+ }
1547
+ }
1548
+ OthersTabComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: OthersTabComponent, deps: [{ token: i1$2.CommonService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
1549
+ OthersTabComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: OthersTabComponent, selector: "pw-others-tab", usesInheritance: true, ngImport: i0, template: "<div class=\"row\">\n <div class=\"col-12\">\n <h2>Other</h2>\n </div>\n</div>\n<div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n</div>\n<div class=\"row mt-4 pt-1\"\n *ngIf=\"isLoaded && globalConfigs?.length\">\n <div class=\"col-md-6 col-sm-6\">\n <ng-container *ngFor=\"let item of globalConfigs; let idx = index\">\n <div class=\"mb-3\">\n <div class=\"row\">\n <div class=\"col-md-10 col-sm-6\">\n <label> {{ item?.name }} </label>\n </div>\n <div class=\"col-md-2 col-sm-6\">\n <ui-switch [checked]=\"item.value === 'true'\"\n checkedLabel=\"on\"\n uncheckedLabel=\"off\"\n (valueChange)=\"onValueChange(item, $event)\">\n </ui-switch>\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n</div>\n\n<div *ngIf=\"isLoaded && !globalConfigs?.length\">\n <pw-no-data [message]=\"'User.OtherSettings.NoDataMessage' | transloco\"> </pw-no-data>\n</div>\n", dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { kind: "pipe", type: i10.TranslocoPipe, name: "transloco" }] });
1550
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: OthersTabComponent, decorators: [{
1551
+ type: Component,
1552
+ args: [{ selector: 'pw-others-tab', template: "<div class=\"row\">\n <div class=\"col-12\">\n <h2>Other</h2>\n </div>\n</div>\n<div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n</div>\n<div class=\"row mt-4 pt-1\"\n *ngIf=\"isLoaded && globalConfigs?.length\">\n <div class=\"col-md-6 col-sm-6\">\n <ng-container *ngFor=\"let item of globalConfigs; let idx = index\">\n <div class=\"mb-3\">\n <div class=\"row\">\n <div class=\"col-md-10 col-sm-6\">\n <label> {{ item?.name }} </label>\n </div>\n <div class=\"col-md-2 col-sm-6\">\n <ui-switch [checked]=\"item.value === 'true'\"\n checkedLabel=\"on\"\n uncheckedLabel=\"off\"\n (valueChange)=\"onValueChange(item, $event)\">\n </ui-switch>\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n</div>\n\n<div *ngIf=\"isLoaded && !globalConfigs?.length\">\n <pw-no-data [message]=\"'User.OtherSettings.NoDataMessage' | transloco\"> </pw-no-data>\n</div>\n" }]
1553
+ }], ctorParameters: function () { return [{ type: i1$2.CommonService }, { type: i0.Injector }]; } });
1554
+
1555
+ class SecurityTabComponent extends AppBaseComponent {
1556
+ constructor() {
1557
+ super(...arguments);
1558
+ this.isCurrentPasswordValid = true;
1559
+ this.passwordVerified = false;
1560
+ this.show2FA = false;
1561
+ }
1562
+ ngOnInit() {
1563
+ this.getUser();
1564
+ }
1565
+ getUser() {
1566
+ this.userService.getUserInfo().subscribe(res => {
1567
+ this.user = res;
1568
+ });
1569
+ }
1570
+ validatePassword() {
1571
+ const password = this.passwordRef.nativeElement.value;
1572
+ if (password) {
1573
+ this.userService.checkPassword({ password }).subscribe({
1574
+ next: data => {
1575
+ var _a;
1576
+ if ((data === null || data === void 0 ? void 0 : data.status) === StatusCodes.OK) {
1577
+ if (((_a = this.user) === null || _a === void 0 ? void 0 : _a.enable_two_factor_authenticator) === false) {
1578
+ this.passwordVerified = true;
1579
+ this.create2FA();
1580
+ }
1581
+ else {
1582
+ this.disable2FA();
1583
+ }
1584
+ }
1585
+ },
1586
+ error: err => {
1587
+ if (err) {
1588
+ this.toast.error(err.error.message);
1589
+ this.passwordRef.nativeElement.value = '';
1590
+ }
1591
+ }
1592
+ });
1593
+ }
1594
+ }
1595
+ checkValidity() {
1596
+ const password = this.passwordRef.nativeElement.value;
1597
+ if (password.length > 5) {
1598
+ this.isCurrentPasswordValid = false;
1599
+ }
1600
+ else {
1601
+ this.isCurrentPasswordValid = true;
1602
+ }
1603
+ }
1604
+ create2FA() {
1605
+ this.userService.createTwoFactorAuthenticator().subscribe(res => {
1606
+ this.created2faDetails = res;
1607
+ });
1608
+ }
1609
+ verfiy2FA() {
1610
+ this.userService
1611
+ .verifyTwoFactorAuthenticator(this.verificationCode.nativeElement.value)
1612
+ .subscribe(() => {
1613
+ this.enable2FA();
1614
+ });
1615
+ }
1616
+ enable2FA() {
1617
+ this.userService
1618
+ .enableTwoFactorAuthenticator(this.verificationCode.nativeElement.value)
1619
+ .subscribe(_ => {
1620
+ this.getUser();
1621
+ this.reset();
1622
+ });
1623
+ }
1624
+ disable2FA() {
1625
+ this.userService.disableTwoFactorAuthenticator().subscribe(_ => {
1626
+ this.getUser();
1627
+ this.reset();
1628
+ });
1629
+ }
1630
+ reset() {
1631
+ this.show2FA = false;
1632
+ this.isCurrentPasswordValid = true;
1633
+ this.passwordVerified = false;
1634
+ this.created2faDetails = {};
1635
+ }
1636
+ }
1637
+ SecurityTabComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SecurityTabComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1638
+ SecurityTabComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: SecurityTabComponent, selector: "pw-security-tab", viewQueries: [{ propertyName: "passwordRef", first: true, predicate: ["password"], descendants: true }, { propertyName: "verificationCode", first: true, predicate: ["verificationcode"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"row\">\n <div class=\"col-12\">\n <h2>Security settings</h2>\n </div>\n</div>\n<p-accordion>\n <p-accordionTab header=\"Two Factor Authentication\">\n <div class=\"row mt-2\">\n <div class=\"col-12\">\n <div class=\"d-flex\">\n <p class=\"small text-muted\">\n Add an extra layer of security to your user account by asking to verify\n their identity when they enter a username and password\n </p>\n </div>\n </div>\n </div>\n\n <div class=\"row\">\n <div class=\"col-12\">\n <!-- Disable 2FA -->\n <button class=\"btn btn-danger\"\n *ngIf=\"user?.enable_two_factor_authenticator\"\n (click)=\"show2FA = true\">\n Disable\n </button>\n\n <!-- Enable 2FA -->\n <button class=\"btn btn-primary\"\n *ngIf=\"!user?.enable_two_factor_authenticator\"\n [disabled]=\"created2faDetails?.code\"\n (click)=\"show2FA = true\">\n Enable\n </button>\n </div>\n </div>\n\n <div class=\"row\"\n *ngIf=\"show2FA\">\n <div class=\"col-12 col-md-6 col-lg-4 mt-2\">\n <div class=\"mb-3\">\n <input type=\"password\"\n class=\"form-control\"\n #password\n *ngIf=\"!passwordVerified\"\n placeholder=\"Current Password\"\n (keyup)=\"checkValidity()\" />\n </div>\n </div>\n\n <div *ngIf=\"created2faDetails?.code\"\n class=\"col-12\">\n <p class=\"small\">\n Scan the QR code below or use secret manually with the Google authenticator app\n on your mobile device, after that fill in the field below with the code\n generated in the app\n </p>\n <img [src]=\"created2faDetails?.qr_uri\"\n alt=\"loading QR code...\"\n class=\"qr-code img-thumbnail img-responsive\" />\n <strong> Secret Key: {{ created2faDetails?.code }}</strong>\n <p class=\"small\">Auth Type: Time Based OTP</p>\n </div>\n </div>\n\n <div class=\"row\"\n *ngIf=\"show2FA\">\n <div class=\"col-4\">\n <div class=\"mb-3 mt-2\">\n <input type=\"text\"\n #verificationcode\n class=\"form-control\"\n *ngIf=\"passwordVerified\"\n placeholder=\"Provide passcode from authenticator app\" />\n </div>\n </div>\n\n <div class=\"col-12\"\n *ngIf=\"show2FA\">\n <div class=\"d-flex mt-2\">\n <button class=\"btn btn-raised btn-outline-default me-2\"\n (click)=\"reset()\">\n Cancel\n </button>\n <button class=\"btn btn-raised btn-primary\"\n *ngIf=\"!passwordVerified\"\n (click)=\"validatePassword()\"\n [disabled]=\"isCurrentPasswordValid\">\n Validate\n </button>\n <button class=\"btn btn-raised btn-primary\"\n *ngIf=\"passwordVerified\"\n (click)=\"verfiy2FA()\">\n Confirm\n </button>\n </div>\n </div>\n </div>\n </p-accordionTab>\n</p-accordion>\n", styles: [".qr-code{margin:10px;max-width:200px}\n"], dependencies: [{ kind: "directive", type: i3.LazyImgDirective, selector: "img" }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.Accordion, selector: "p-accordion", inputs: ["multiple", "style", "styleClass", "expandIcon", "collapseIcon", "activeIndex"], outputs: ["onClose", "onOpen", "activeIndexChange"] }, { kind: "component", type: i3$1.AccordionTab, selector: "p-accordionTab", inputs: ["header", "headerStyle", "tabStyle", "contentStyle", "tabStyleClass", "headerStyleClass", "contentStyleClass", "disabled", "cache", "transitionOptions", "iconPos", "selected"], outputs: ["selectedChange"] }] });
1639
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SecurityTabComponent, decorators: [{
1640
+ type: Component,
1641
+ args: [{ selector: 'pw-security-tab', template: "<div class=\"row\">\n <div class=\"col-12\">\n <h2>Security settings</h2>\n </div>\n</div>\n<p-accordion>\n <p-accordionTab header=\"Two Factor Authentication\">\n <div class=\"row mt-2\">\n <div class=\"col-12\">\n <div class=\"d-flex\">\n <p class=\"small text-muted\">\n Add an extra layer of security to your user account by asking to verify\n their identity when they enter a username and password\n </p>\n </div>\n </div>\n </div>\n\n <div class=\"row\">\n <div class=\"col-12\">\n <!-- Disable 2FA -->\n <button class=\"btn btn-danger\"\n *ngIf=\"user?.enable_two_factor_authenticator\"\n (click)=\"show2FA = true\">\n Disable\n </button>\n\n <!-- Enable 2FA -->\n <button class=\"btn btn-primary\"\n *ngIf=\"!user?.enable_two_factor_authenticator\"\n [disabled]=\"created2faDetails?.code\"\n (click)=\"show2FA = true\">\n Enable\n </button>\n </div>\n </div>\n\n <div class=\"row\"\n *ngIf=\"show2FA\">\n <div class=\"col-12 col-md-6 col-lg-4 mt-2\">\n <div class=\"mb-3\">\n <input type=\"password\"\n class=\"form-control\"\n #password\n *ngIf=\"!passwordVerified\"\n placeholder=\"Current Password\"\n (keyup)=\"checkValidity()\" />\n </div>\n </div>\n\n <div *ngIf=\"created2faDetails?.code\"\n class=\"col-12\">\n <p class=\"small\">\n Scan the QR code below or use secret manually with the Google authenticator app\n on your mobile device, after that fill in the field below with the code\n generated in the app\n </p>\n <img [src]=\"created2faDetails?.qr_uri\"\n alt=\"loading QR code...\"\n class=\"qr-code img-thumbnail img-responsive\" />\n <strong> Secret Key: {{ created2faDetails?.code }}</strong>\n <p class=\"small\">Auth Type: Time Based OTP</p>\n </div>\n </div>\n\n <div class=\"row\"\n *ngIf=\"show2FA\">\n <div class=\"col-4\">\n <div class=\"mb-3 mt-2\">\n <input type=\"text\"\n #verificationcode\n class=\"form-control\"\n *ngIf=\"passwordVerified\"\n placeholder=\"Provide passcode from authenticator app\" />\n </div>\n </div>\n\n <div class=\"col-12\"\n *ngIf=\"show2FA\">\n <div class=\"d-flex mt-2\">\n <button class=\"btn btn-raised btn-outline-default me-2\"\n (click)=\"reset()\">\n Cancel\n </button>\n <button class=\"btn btn-raised btn-primary\"\n *ngIf=\"!passwordVerified\"\n (click)=\"validatePassword()\"\n [disabled]=\"isCurrentPasswordValid\">\n Validate\n </button>\n <button class=\"btn btn-raised btn-primary\"\n *ngIf=\"passwordVerified\"\n (click)=\"verfiy2FA()\">\n Confirm\n </button>\n </div>\n </div>\n </div>\n </p-accordionTab>\n</p-accordion>\n", styles: [".qr-code{margin:10px;max-width:200px}\n"] }]
1642
+ }], propDecorators: { passwordRef: [{
1643
+ type: ViewChild,
1644
+ args: ['password', { static: false }]
1645
+ }], verificationCode: [{
1646
+ type: ViewChild,
1647
+ args: ['verificationcode', { static: false }]
1648
+ }] } });
1649
+
1650
+ class SettingsComponent {
1651
+ constructor(router, permissionService) {
1652
+ this.router = router;
1653
+ this.permissionService = permissionService;
1654
+ this.items = [
1655
+ {
1656
+ id: 'communications',
1657
+ label: 'Communications',
1658
+ icon: 'fa fa-fw fa-cogs',
1659
+ routerLink: ['/settings/communication']
1660
+ },
1661
+ {
1662
+ id: 'security',
1663
+ label: 'Security',
1664
+ icon: 'fa fa-fw fa-lock',
1665
+ routerLink: ['/settings/security']
1666
+ },
1667
+ {
1668
+ id: 'other',
1669
+ label: 'Other',
1670
+ icon: 'fa fa-fw fa-list',
1671
+ routerLink: ['/settings/other']
1672
+ }
1673
+ ];
1674
+ this.activeItem =
1675
+ this.items[this.items.findIndex(record => record.routerLink[0] === this.router.url.split('?')[0])];
1676
+ }
1677
+ activateMenu() {
1678
+ this.activeItem = this.menu['activeItem'];
1679
+ }
1680
+ }
1681
+ SettingsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SettingsComponent, deps: [{ token: i1.Router }, { token: i1$2.PermissionService }], target: i0.ɵɵFactoryTarget.Component });
1682
+ SettingsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: SettingsComponent, selector: "pw-settings", viewQueries: [{ propertyName: "menu", first: true, predicate: ["menuItems"], descendants: true, static: true }], ngImport: i0, template: "<pw-tabs [items]=\"items\"></pw-tabs>\n", dependencies: [{ kind: "component", type: i7.PwTabsComponent, selector: "pw-tabs", inputs: ["items", "withSubscription"] }] });
1683
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SettingsComponent, decorators: [{
1684
+ type: Component,
1685
+ args: [{ selector: 'pw-settings', template: "<pw-tabs [items]=\"items\"></pw-tabs>\n" }]
1686
+ }], ctorParameters: function () { return [{ type: i1.Router }, { type: i1$2.PermissionService }]; }, propDecorators: { menu: [{
1687
+ type: ViewChild,
1688
+ args: ['menuItems', { static: true }]
1689
+ }] } });
1690
+
1691
+ class SupportComponent extends AppBaseComponent {
1692
+ constructor(injector, commonService) {
1693
+ super(injector);
1694
+ this.commonService = commonService;
1695
+ this.supports = [];
1696
+ this.isLoaded = false;
1697
+ }
1698
+ ngOnInit() {
1699
+ var _a;
1700
+ this.subscriptionId = (_a = PermissionService.selectedSubscription) === null || _a === void 0 ? void 0 : _a.id;
1701
+ this.getAllSupport();
1702
+ }
1703
+ getAllSupport() {
1704
+ this.isLoading = true;
1705
+ this.commonService
1706
+ .getAllCustomerSupport(this.subscriptionId)
1707
+ .subscribe(response => {
1708
+ this.supports = response;
1709
+ })
1710
+ .add(() => {
1711
+ this.isLoading = false;
1712
+ this.isLoaded = true;
1713
+ });
1714
+ }
1715
+ }
1716
+ SupportComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SupportComponent, deps: [{ token: i0.Injector }, { token: i1$2.CommonService }], target: i0.ɵɵFactoryTarget.Component });
1717
+ SupportComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: SupportComponent, selector: "pw-support", usesInheritance: true, ngImport: i0, template: "<div class=\"row m-1\">\n <div class=\"col-12 mb-3\">\n <h2>Support Center</h2>\n <a class=\"btn btn-sm btn-outline-primary float-end ms-2\"\n routerLink=\"/support-details/add\">\n <i class=\"fa fa-plus-circle\" aria-hidden=\"true\"></i> Create new support request\n </a>\n </div>\n <div class=\"col-12 my-3\">\n <h3>Previous support requests</h3>\n <p>Please find below previously submitted support requests.</p>\n </div>\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"isLoading\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n <div class=\"col-12 mb-3\">\n <p-accordion>\n <p-accordionTab *ngFor=\"let item of supports\"\n header=\"{{ item?.created_at | dateFormat }} {{ item?.title }}\">\n <p>{{ item?.description }}</p>\n <a [href]=\"item?.attachment?.version_200x200?.url\"\n target=\"_blank\">\n <img alt=\"version_200x200\"\n *ngIf=\"item?.attachment?.version_200x200?.url\"\n [src]=\"item?.attachment?.version_200x200?.url\"\n class=\"img-fluid\" /></a>\n </p-accordionTab>\n </p-accordion>\n </div>\n <div class=\"col-12\"\n *ngIf=\"!supports?.length && isLoaded\">\n <pw-no-data message=\"No support requests found\"> </pw-no-data>\n </div>\n</div>\n", styles: [".contact-support{font-size:24px;font-weight:600}\n"], dependencies: [{ kind: "directive", type: i3.LazyImgDirective, selector: "img" }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i5.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { kind: "component", type: i3$1.Accordion, selector: "p-accordion", inputs: ["multiple", "style", "styleClass", "expandIcon", "collapseIcon", "activeIndex"], outputs: ["onClose", "onOpen", "activeIndexChange"] }, { kind: "component", type: i3$1.AccordionTab, selector: "p-accordionTab", inputs: ["header", "headerStyle", "tabStyle", "contentStyle", "tabStyleClass", "headerStyleClass", "contentStyleClass", "disabled", "cache", "transitionOptions", "iconPos", "selected"], outputs: ["selectedChange"] }] });
1718
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SupportComponent, decorators: [{
1719
+ type: Component,
1720
+ args: [{ selector: 'pw-support', template: "<div class=\"row m-1\">\n <div class=\"col-12 mb-3\">\n <h2>Support Center</h2>\n <a class=\"btn btn-sm btn-outline-primary float-end ms-2\"\n routerLink=\"/support-details/add\">\n <i class=\"fa fa-plus-circle\" aria-hidden=\"true\"></i> Create new support request\n </a>\n </div>\n <div class=\"col-12 my-3\">\n <h3>Previous support requests</h3>\n <p>Please find below previously submitted support requests.</p>\n </div>\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"isLoading\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n <div class=\"col-12 mb-3\">\n <p-accordion>\n <p-accordionTab *ngFor=\"let item of supports\"\n header=\"{{ item?.created_at | dateFormat }} {{ item?.title }}\">\n <p>{{ item?.description }}</p>\n <a [href]=\"item?.attachment?.version_200x200?.url\"\n target=\"_blank\">\n <img alt=\"version_200x200\"\n *ngIf=\"item?.attachment?.version_200x200?.url\"\n [src]=\"item?.attachment?.version_200x200?.url\"\n class=\"img-fluid\" /></a>\n </p-accordionTab>\n </p-accordion>\n </div>\n <div class=\"col-12\"\n *ngIf=\"!supports?.length && isLoaded\">\n <pw-no-data message=\"No support requests found\"> </pw-no-data>\n </div>\n</div>\n", styles: [".contact-support{font-size:24px;font-weight:600}\n"] }]
1721
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1$2.CommonService }]; } });
1722
+
1723
+ class EditPortfoliosComponent {
1724
+ constructor(modalService, profileService) {
1725
+ this.modalService = modalService;
1726
+ this.profileService = profileService;
1727
+ this.uploadedFiles = [];
1728
+ this.project = [];
1729
+ this.projectPictures = [];
1730
+ this.successEvent = new EventEmitter();
1731
+ }
1732
+ openModal(id) {
1733
+ this.id = 0;
1734
+ this.id = id;
1735
+ this.modalService.open(this.content, {
1736
+ centered: true,
1737
+ size: 'lg',
1738
+ windowClass: 'modal-holder'
1739
+ });
1740
+ }
1741
+ onSelect(event = null) {
1742
+ // eslint-disable-next-line no-restricted-syntax
1743
+ for (const file of event.files) {
1744
+ this.uploadedFiles.push(file);
1745
+ }
1746
+ }
1747
+ getProjectPictures() {
1748
+ this.profileService.getProjectPictures(this.slug).subscribe(response => {
1749
+ if (response.length > 0) {
1750
+ this.projectPictures = response.flatMap(x => x.project_pictures);
1751
+ }
1752
+ });
1753
+ }
1754
+ /**
1755
+ * Uploads multiple images for the project
1756
+ * @param form
1757
+ */
1758
+ onSave(form) {
1759
+ if (this.uploadedFiles.length > 0) {
1760
+ this.busy = true;
1761
+ const subscriptions$ = [];
1762
+ this.uploadedFiles.forEach(file => {
1763
+ subscriptions$.push(this.profileService.addProjectPictures({
1764
+ project_id: Number(this.id),
1765
+ image: file
1766
+ }));
1767
+ });
1768
+ forkJoin(subscriptions$)
1769
+ .subscribe({
1770
+ next: () => {
1771
+ form.clear();
1772
+ this.successEvent.emit();
1773
+ this.modalService.dismissAll();
1774
+ },
1775
+ error: () => {
1776
+ form.clear();
1777
+ this.modalService.dismissAll();
1778
+ }
1779
+ })
1780
+ .add(() => {
1781
+ this.busy = false;
1782
+ });
1783
+ }
1784
+ }
1785
+ deleteProjectPicture(id) {
1786
+ this.profileService.deletePicture(id).subscribe(_ => {
1787
+ this.getProjectPictures();
1788
+ });
1789
+ }
1790
+ trackByImage(_index, item) {
1791
+ return item === null || item === void 0 ? void 0 : item.id;
1792
+ }
1793
+ onRemove(event) {
1794
+ this.uploadedFiles = this.uploadedFiles.filter(x => event.file.name !== x.name);
1795
+ }
1796
+ }
1797
+ EditPortfoliosComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: EditPortfoliosComponent, deps: [{ token: i1$1.NgbModal }, { token: i1$2.ProfileService }], target: i0.ɵɵFactoryTarget.Component });
1798
+ EditPortfoliosComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: EditPortfoliosComponent, selector: "pw-edit-portfolios", inputs: { id: "id", slug: "slug" }, outputs: { successEvent: "successEvent" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, static: true }, { propertyName: "uploader", first: true, predicate: ["form"], descendants: true }], ngImport: i0, template: "<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title\"\n id=\"modal-basic-title\">Add/Edit Portfolio Item</h4>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n Add a cover image or a downloadable file for your portfolio item\n <p-fileUpload #form\n name=\"myfile[]\"\n [customUpload]=\"true\"\n [showUploadButton]=\"false\"\n accept=\"image/*\"\n multiple=\"multiple\"\n (onSelect)=\"onSelect($event)\"\n (onRemove)=\"onRemove($event)\">\n </p-fileUpload>\n\n <div class=\"ui-fileupload-content ui-widget-content ui-corner-bottom\">\n <div class=\"ui-fileupload-files\">\n <div class=\"\">\n <h5>Uploaded Pictures</h5>\n <div *ngFor=\"let image of projectPictures; trackBy: trackByImage\"\n class=\"ui-fileupload-row d-inline-block\">\n <div>\n <img [src]=\"image?.picture?.version_50x50?.url\"\n alt=\"\"\n width=\"50\" />\n </div>\n <div class=\"pt-1 ps-1\">\n <button icon=\"pi pi-times\"\n type=\"button\"\n (click)=\"deleteProjectPicture(image.id)\"\n class=\"ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only\">\n <span class=\"ui-button-icon-left ui-clickable pi pi-times\"></span>\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\"\n class=\"btn btn-outline-default\"\n (click)=\"modal.close()\">\n Cancel\n </button>\n <button type=\"button\"\n class=\"btn btn-primary\"\n [buttonBusy]=\"busy\"\n (click)=\"onSave(form)\">\n Save\n </button>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i3.ButtonBusyDirective, selector: "[buttonBusy]", inputs: ["buttonBusy", "busyText"] }, { kind: "directive", type: i3.LazyImgDirective, selector: "img" }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i5$2.FileUpload, selector: "p-fileUpload", inputs: ["name", "url", "method", "multiple", "accept", "disabled", "auto", "withCredentials", "maxFileSize", "invalidFileSizeMessageSummary", "invalidFileSizeMessageDetail", "invalidFileTypeMessageSummary", "invalidFileTypeMessageDetail", "invalidFileLimitMessageDetail", "invalidFileLimitMessageSummary", "style", "styleClass", "previewWidth", "chooseLabel", "uploadLabel", "cancelLabel", "chooseIcon", "uploadIcon", "cancelIcon", "showUploadButton", "showCancelButton", "mode", "headers", "customUpload", "fileLimit", "uploadStyleClass", "cancelStyleClass", "removeStyleClass", "chooseStyleClass", "files"], outputs: ["onBeforeUpload", "onSend", "onUpload", "onError", "onClear", "onRemove", "onSelect", "onProgress", "uploadHandler", "onImageError"] }] });
1799
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: EditPortfoliosComponent, decorators: [{
1800
+ type: Component,
1801
+ args: [{ selector: 'pw-edit-portfolios', template: "<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title\"\n id=\"modal-basic-title\">Add/Edit Portfolio Item</h4>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n Add a cover image or a downloadable file for your portfolio item\n <p-fileUpload #form\n name=\"myfile[]\"\n [customUpload]=\"true\"\n [showUploadButton]=\"false\"\n accept=\"image/*\"\n multiple=\"multiple\"\n (onSelect)=\"onSelect($event)\"\n (onRemove)=\"onRemove($event)\">\n </p-fileUpload>\n\n <div class=\"ui-fileupload-content ui-widget-content ui-corner-bottom\">\n <div class=\"ui-fileupload-files\">\n <div class=\"\">\n <h5>Uploaded Pictures</h5>\n <div *ngFor=\"let image of projectPictures; trackBy: trackByImage\"\n class=\"ui-fileupload-row d-inline-block\">\n <div>\n <img [src]=\"image?.picture?.version_50x50?.url\"\n alt=\"\"\n width=\"50\" />\n </div>\n <div class=\"pt-1 ps-1\">\n <button icon=\"pi pi-times\"\n type=\"button\"\n (click)=\"deleteProjectPicture(image.id)\"\n class=\"ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only\">\n <span class=\"ui-button-icon-left ui-clickable pi pi-times\"></span>\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\"\n class=\"btn btn-outline-default\"\n (click)=\"modal.close()\">\n Cancel\n </button>\n <button type=\"button\"\n class=\"btn btn-primary\"\n [buttonBusy]=\"busy\"\n (click)=\"onSave(form)\">\n Save\n </button>\n </div>\n</ng-template>\n" }]
1802
+ }], ctorParameters: function () { return [{ type: i1$1.NgbModal }, { type: i1$2.ProfileService }]; }, propDecorators: { content: [{
1803
+ type: ViewChild,
1804
+ args: ['content', { static: true }]
1805
+ }], uploader: [{
1806
+ type: ViewChild,
1807
+ args: ['form', { static: false }]
1808
+ }], successEvent: [{
1809
+ type: Output
1810
+ }], id: [{
1811
+ type: Input
1812
+ }], slug: [{
1813
+ type: Input
1814
+ }] } });
1815
+
1816
+ class EditProjectModalComponent extends AppBaseComponent {
1817
+ constructor(modalService, fb, profileService, injector) {
1818
+ super(injector);
1819
+ this.modalService = modalService;
1820
+ this.fb = fb;
1821
+ this.profileService = profileService;
1822
+ this.cancelEvent = new EventEmitter();
1823
+ this.saveEvent = new EventEmitter();
1824
+ this.title = 'Add Project';
1825
+ this.submitted = false;
1826
+ this.getForm();
1827
+ }
1828
+ get f() {
1829
+ return this.form.controls;
1830
+ }
1831
+ ngOnInit() {
1832
+ clearQueryParams(this.router, this.route);
1833
+ this.userStore().subscribe(user => {
1834
+ this.userId = user.id;
1835
+ });
1836
+ }
1837
+ ngOnDestroy() {
1838
+ super.ngOnDestroy();
1839
+ }
1840
+ getStartYear() {
1841
+ const d = new Date(`01 July 1980`);
1842
+ const range = [];
1843
+ for (let i = new Date().getFullYear(); i >= d.getFullYear(); i--) {
1844
+ range.push(i);
1845
+ }
1846
+ this.startYears = range;
1847
+ }
1848
+ getEndYears(start_year) {
1849
+ const range = [];
1850
+ for (let i = new Date().getFullYear(); i >= start_year; i--) {
1851
+ range.push(i);
1852
+ }
1853
+ this.endYears = range;
1854
+ }
1855
+ getWeeks() {
1856
+ const endYear = moment([this.form.value['end_year']]);
1857
+ const startYear = moment([this.form.value['start_year']]);
1858
+ if (endYear) {
1859
+ const weeks = endYear.diff(startYear, 'weeks');
1860
+ this.weeks = Array.from(Array(weeks).keys());
1861
+ }
1862
+ }
1863
+ onOpen(item = null) {
1864
+ this.currentProject = item;
1865
+ appendQueryParam(this.router, this.route, {
1866
+ modal: 'editProjects'
1867
+ });
1868
+ if (item) {
1869
+ this.form.patchValue(item);
1870
+ this.title = `Edit Project - ${item.title}`;
1871
+ this.getStartYear();
1872
+ this.getEndYears(item.end_year);
1873
+ this.getWeeks();
1874
+ }
1875
+ else {
1876
+ this.form.reset();
1877
+ this.title = 'Add Project';
1878
+ }
1879
+ this.modalService.open(this.content, {
1880
+ centered: true,
1881
+ size: 'lg',
1882
+ windowClass: 'modal-holder'
1883
+ });
1884
+ }
1885
+ onSaveDetail() {
1886
+ this.submitted = true;
1887
+ const { value } = this.form;
1888
+ value.user_id = this.userId;
1889
+ const subscription$ = this.currentProject && this.currentProject.id
1890
+ ? this.profileService.updateProjects(this.currentProject.id, value)
1891
+ : this.profileService.addProjects(value);
1892
+ subscription$
1893
+ .subscribe(() => {
1894
+ this.modalService.dismissAll();
1895
+ this.toast.success(this.translation.translate('User.Profile.Projects.ProjectUpdated'));
1896
+ this.saveEvent.emit(true);
1897
+ })
1898
+ .add(() => {
1899
+ this.submitted = false;
1900
+ });
1901
+ }
1902
+ getForm() {
1903
+ this.form = this.fb.group({
1904
+ start_year: [
1905
+ null,
1906
+ [
1907
+ Validators.required,
1908
+ Validators.pattern(ValidationService.CustomValidatorPatterns.Year)
1909
+ ]
1910
+ ],
1911
+ end_year: [
1912
+ null,
1913
+ [
1914
+ Validators.required,
1915
+ Validators.pattern(ValidationService.CustomValidatorPatterns.Year)
1916
+ ]
1917
+ ],
1918
+ client_name: [null, Validators.required],
1919
+ title: [null, Validators.required],
1920
+ description: [null, Validators.required],
1921
+ length: ['', [Validators.required, Validators.max(5000)]],
1922
+ advertisable: [false],
1923
+ syndicated: [false]
1924
+ });
1925
+ }
1926
+ }
1927
+ EditProjectModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: EditProjectModalComponent, deps: [{ token: i1$1.NgbModal }, { token: i2.UntypedFormBuilder }, { token: i1$2.ProfileService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
1928
+ EditProjectModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: EditProjectModalComponent, selector: "pw-edit-project-modal", outputs: { cancelEvent: "cancelEvent", saveEvent: "saveEvent" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title\"\n id=\"modal-basic-title\">{{ title }}</h4>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"form\">\n <div class=\"row p-2\">\n <!-- Title -->\n <pw-input-container class=\"col-12\"\n label=\"Title\"\n name=\"title\"\n errorMsg=\"This field is required.\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"title\"\n [ngClass]=\"{ 'is-invalid': submitted && f.title.errors }\" />\n </pw-input-container>\n <!-- Client Name -->\n <pw-input-container class=\"col-12\"\n label=\"Client Name\"\n name=\"client_name\"\n errorMsg=\"This field is required.\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"client_name\"\n [ngClass]=\"{ 'is-invalid': submitted && f.client_name.errors }\" />\n </pw-input-container>\n <!-- Project Start Year -->\n <pw-input-container class=\"col-4\"\n label=\"Start\"\n name=\"start_year\"\n errorMsg=\"YYYY format date is required\">\n <select (focusin)=\"getStartYear()\"\n formControlName=\"start_year\"\n class=\"form-control form-select\"\n (change)=\"getEndYears($event.target.value)\"\n [ngClass]=\"{ 'is-invalid': submitted && f.start_year.errors }\">\n <option *ngFor=\"let year of startYears\"\n [value]=\"year\">{{ year }}</option>\n </select>\n </pw-input-container>\n <!-- Project End Year -->\n <pw-input-container class=\"col-4\"\n label=\"End\"\n name=\"end_year\"\n errorMsg=\"YYYY format date is required\">\n <select class=\"form-select\"\n formControlName=\"end_year\"\n id=\"endYear\"\n (change)=\"getEndYears($event.target.value)\"\n [ngClass]=\"{ 'is-invalid': submitted && f.end_year.errors }\">\n <option *ngFor=\"let year of endYears\"\n [value]=\"year\">{{ year }}</option>\n </select>\n </pw-input-container>\n <!-- Total Weeks Worked -->\n <pw-input-container class=\"col-4\"\n label=\"Weeks worked\"\n name=\"length\"\n errorMsg=\"This field is required. (0-5000)\">\n <input type=\"number\"\n formControlName=\"length\"\n class=\"form-control\"\n placeholder=\"weeks\"\n [ngClass]=\"{ 'is-invalid': submitted && f.length.errors }\" />\n </pw-input-container>\n <!-- Description -->\n <pw-input-container class=\"col-12\"\n label=\"Description\"\n name=\"description\"\n errorMsg=\"This field is required.\">\n <textarea type=\"text\"\n class=\"form-control\"\n formControlName=\"description\"\n required\n [ngClass]=\"{ 'is-invalid': submitted && f.description.errors }\"></textarea>\n </pw-input-container>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\"\n class=\"btn btn-outline-default\"\n (click)=\"modal.close()\">\n Cancel\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\"\n (click)=\"onSaveDetail()\">Save</button>\n </div>\n</ng-template>\n", styles: [".ng-valid.is-invalid{background-image:none;border-color:inherit}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i7.InputContainerComponent, selector: "pw-input-container", inputs: ["name", "label", "labelClass", "tooltipPosition", "required", "errorMsg", "isReadOnly", "showTooltip", "tooltipText"] }] });
1929
+ __decorate([
1930
+ ValidateForm('form'),
1931
+ __metadata("design:type", Function),
1932
+ __metadata("design:paramtypes", []),
1933
+ __metadata("design:returntype", void 0)
1934
+ ], EditProjectModalComponent.prototype, "onSaveDetail", null);
1935
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: EditProjectModalComponent, decorators: [{
1936
+ type: Component,
1937
+ args: [{ selector: 'pw-edit-project-modal', template: "<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title\"\n id=\"modal-basic-title\">{{ title }}</h4>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"form\">\n <div class=\"row p-2\">\n <!-- Title -->\n <pw-input-container class=\"col-12\"\n label=\"Title\"\n name=\"title\"\n errorMsg=\"This field is required.\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"title\"\n [ngClass]=\"{ 'is-invalid': submitted && f.title.errors }\" />\n </pw-input-container>\n <!-- Client Name -->\n <pw-input-container class=\"col-12\"\n label=\"Client Name\"\n name=\"client_name\"\n errorMsg=\"This field is required.\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"client_name\"\n [ngClass]=\"{ 'is-invalid': submitted && f.client_name.errors }\" />\n </pw-input-container>\n <!-- Project Start Year -->\n <pw-input-container class=\"col-4\"\n label=\"Start\"\n name=\"start_year\"\n errorMsg=\"YYYY format date is required\">\n <select (focusin)=\"getStartYear()\"\n formControlName=\"start_year\"\n class=\"form-control form-select\"\n (change)=\"getEndYears($event.target.value)\"\n [ngClass]=\"{ 'is-invalid': submitted && f.start_year.errors }\">\n <option *ngFor=\"let year of startYears\"\n [value]=\"year\">{{ year }}</option>\n </select>\n </pw-input-container>\n <!-- Project End Year -->\n <pw-input-container class=\"col-4\"\n label=\"End\"\n name=\"end_year\"\n errorMsg=\"YYYY format date is required\">\n <select class=\"form-select\"\n formControlName=\"end_year\"\n id=\"endYear\"\n (change)=\"getEndYears($event.target.value)\"\n [ngClass]=\"{ 'is-invalid': submitted && f.end_year.errors }\">\n <option *ngFor=\"let year of endYears\"\n [value]=\"year\">{{ year }}</option>\n </select>\n </pw-input-container>\n <!-- Total Weeks Worked -->\n <pw-input-container class=\"col-4\"\n label=\"Weeks worked\"\n name=\"length\"\n errorMsg=\"This field is required. (0-5000)\">\n <input type=\"number\"\n formControlName=\"length\"\n class=\"form-control\"\n placeholder=\"weeks\"\n [ngClass]=\"{ 'is-invalid': submitted && f.length.errors }\" />\n </pw-input-container>\n <!-- Description -->\n <pw-input-container class=\"col-12\"\n label=\"Description\"\n name=\"description\"\n errorMsg=\"This field is required.\">\n <textarea type=\"text\"\n class=\"form-control\"\n formControlName=\"description\"\n required\n [ngClass]=\"{ 'is-invalid': submitted && f.description.errors }\"></textarea>\n </pw-input-container>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\"\n class=\"btn btn-outline-default\"\n (click)=\"modal.close()\">\n Cancel\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\"\n (click)=\"onSaveDetail()\">Save</button>\n </div>\n</ng-template>\n", styles: [".ng-valid.is-invalid{background-image:none;border-color:inherit}\n"] }]
1938
+ }], ctorParameters: function () { return [{ type: i1$1.NgbModal }, { type: i2.UntypedFormBuilder }, { type: i1$2.ProfileService }, { type: i0.Injector }]; }, propDecorators: { content: [{
1939
+ type: ViewChild,
1940
+ args: ['content', { static: true }]
1941
+ }], cancelEvent: [{
1942
+ type: Output
1943
+ }], saveEvent: [{
1944
+ type: Output
1945
+ }], onSaveDetail: [] } });
1946
+
1947
+ class EditQualificationsModalComponent extends AppBaseComponent {
1948
+ constructor(modalService, fb, qualificationService, injector) {
1949
+ super(injector);
1950
+ this.modalService = modalService;
1951
+ this.fb = fb;
1952
+ this.qualificationService = qualificationService;
1953
+ this.saveEvent = new EventEmitter();
1954
+ this.title = 'Add Education';
1955
+ this.now = new Date(); // Used for datepiker
1956
+ this.minToDate = this.now;
1957
+ this.qualifications = [
1958
+ { value: 0, label: 'No formal education' },
1959
+ { value: 1, label: 'Primary education' },
1960
+ { value: 2, label: 'Secondary educ, ation or high school' },
1961
+ { value: 3, label: 'GED' },
1962
+ { value: 4, label: 'Vocational qualification' },
1963
+ { value: 5, label: "Bachelor's degree" },
1964
+ { value: 7, label: "Master's degree" },
1965
+ { value: 9, label: 'Doctorate or higher' }
1966
+ ];
1967
+ this.form = this.fb.group({
1968
+ id: [null],
1969
+ school: [null, Validators.required],
1970
+ course: [null, Validators.required],
1971
+ degree: [null],
1972
+ started_on: [null, Validators.required],
1973
+ ended_on: [null, Validators.required],
1974
+ description: [null],
1975
+ points: [null]
1976
+ });
1977
+ }
1978
+ ngOnInit() {
1979
+ clearQueryParams(this.router, this.route);
1980
+ this.userStore().subscribe(response => {
1981
+ this.userId = response.id;
1982
+ });
1983
+ }
1984
+ onOpen(value = null) {
1985
+ appendQueryParam(this.router, this.route, {
1986
+ modal: 'editQualifications'
1987
+ });
1988
+ if (value) {
1989
+ this.form.patchValue(value);
1990
+ this.title = 'Edit Education';
1991
+ }
1992
+ else {
1993
+ this.form.reset();
1994
+ this.title = 'Add Education';
1995
+ }
1996
+ this.modalService.open(this.content, {
1997
+ centered: true,
1998
+ size: 'lg',
1999
+ windowClass: 'modal-holder'
2000
+ });
2001
+ }
2002
+ onDateChange() {
2003
+ const fromDate = this.form.controls['started_on'].value;
2004
+ if (fromDate) {
2005
+ this.minToDate = new Date(fromDate);
2006
+ this.minToDate.setDate(this.minToDate.getDate() + 1);
2007
+ }
2008
+ }
2009
+ onSaveDetail() {
2010
+ var _a;
2011
+ const data = Object.assign({}, this.form.value);
2012
+ data.user_id = this.userId;
2013
+ data.degree = (_a = this.qualifications.find(x => x.value === data.points)) === null || _a === void 0 ? void 0 : _a.label;
2014
+ const sub$ = (data === null || data === void 0 ? void 0 : data.id)
2015
+ ? this.qualificationService.updateQualifications(data.id, data)
2016
+ : this.qualificationService.addQualifications(data);
2017
+ sub$.subscribe(() => {
2018
+ const msg = data.id
2019
+ ? this.translation.translate('User.Profile.Qualifications.UpdatedMessage')
2020
+ : this.translation.translate('User.Profile.Qualifications.AddedMessage');
2021
+ this.toast.success(msg);
2022
+ this.saveEvent.emit();
2023
+ clearQueryParams(this.router, this.route);
2024
+ this.modalService.dismissAll();
2025
+ });
2026
+ }
2027
+ }
2028
+ EditQualificationsModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: EditQualificationsModalComponent, deps: [{ token: i1$1.NgbModal }, { token: i2.UntypedFormBuilder }, { token: i1$2.QualificationService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
2029
+ EditQualificationsModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: EditQualificationsModalComponent, selector: "pw-edit-qualifications-modal", outputs: { saveEvent: "saveEvent" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title\"\n id=\"modal-basic-title\">{{ title }}</h4>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"form\">\n <div class=\"row p-2\">\n <pw-input-container class=\"col-12\"\n label=\"School\"\n name=\"school\"\n errorMsg=\"This field is required.\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"school\" />\n </pw-input-container>\n\n <pw-input-container class=\"col-6\"\n label=\"Dates Attended\"\n name=\"started_on\"\n errorMsg=\"This field is required.\">\n <div class=\"ui-fluid\">\n <p-calendar formControlName=\"started_on\"\n [monthNavigator]=\"true\"\n [yearNavigator]=\"true\"\n yearRange=\"1950:2020\"\n (onSelect)=\"onDateChange()\"\n [showIcon]=\"true\"\n dateFormat=\"yy-mm-dd\">\n </p-calendar>\n </div>\n </pw-input-container>\n\n <pw-input-container class=\"col-6\"\n label=\"Dates Completed\"\n name=\"ended_on\"\n errorMsg=\"This field is required.\">\n <div class=\"ui-fluid\">\n <p-calendar formControlName=\"ended_on\"\n [monthNavigator]=\"true\"\n [yearNavigator]=\"true\"\n [showIcon]=\"true\"\n (onSelect)=\"onDateChange()\"\n [minDate]=\"minToDate\"\n dateFormat=\"yy-mm-dd\"\n yearRange=\"1950:2025\"></p-calendar>\n </div>\n </pw-input-container>\n\n <pw-input-container class=\"col-12\"\n label=\"Degree\"\n name=\"points\"\n errorMsg=\"This field is required.\">\n <p-dropdown [options]=\"qualifications\"\n placeholder=\"Select\"\n formControlName=\"points\"\n [style]=\"{ width: '100%' }\"></p-dropdown>\n </pw-input-container>\n\n <pw-input-container class=\"col-12\"\n label=\"Course\"\n name=\"course\"\n errorMsg=\"This field is required.\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"course\" />\n </pw-input-container>\n\n <pw-input-container class=\"col-12\"\n label=\"Description\"\n name=\"description\">\n <textarea type=\"text\"\n class=\"form-control\"\n formControlName=\"description\"></textarea>\n </pw-input-container>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\"\n class=\"btn btn-outline-default\"\n (click)=\"modal.close()\">\n Cancel\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\"\n (click)=\"onSaveDetail()\">Save</button>\n </div>\n</ng-template>\n\n<i\n class=\"fa fa-lg fa-edit float-end mt-3 pt-1 pt-md-0 primary\"\n data-cy=\"add-qualification\"\n (click)=\"onOpen()\"\n aria-hidden=\"true\"\n></i>\n", styles: [".btn-add{cursor:pointer;font-size:24px}\n"], dependencies: [{ kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i7.InputContainerComponent, selector: "pw-input-container", inputs: ["name", "label", "labelClass", "tooltipPosition", "required", "errorMsg", "isReadOnly", "showTooltip", "tooltipText"] }] });
2030
+ __decorate([
2031
+ ValidateForm('form'),
2032
+ __metadata("design:type", Function),
2033
+ __metadata("design:paramtypes", []),
2034
+ __metadata("design:returntype", void 0)
2035
+ ], EditQualificationsModalComponent.prototype, "onSaveDetail", null);
2036
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: EditQualificationsModalComponent, decorators: [{
2037
+ type: Component,
2038
+ args: [{ selector: 'pw-edit-qualifications-modal', template: "<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title\"\n id=\"modal-basic-title\">{{ title }}</h4>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"form\">\n <div class=\"row p-2\">\n <pw-input-container class=\"col-12\"\n label=\"School\"\n name=\"school\"\n errorMsg=\"This field is required.\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"school\" />\n </pw-input-container>\n\n <pw-input-container class=\"col-6\"\n label=\"Dates Attended\"\n name=\"started_on\"\n errorMsg=\"This field is required.\">\n <div class=\"ui-fluid\">\n <p-calendar formControlName=\"started_on\"\n [monthNavigator]=\"true\"\n [yearNavigator]=\"true\"\n yearRange=\"1950:2020\"\n (onSelect)=\"onDateChange()\"\n [showIcon]=\"true\"\n dateFormat=\"yy-mm-dd\">\n </p-calendar>\n </div>\n </pw-input-container>\n\n <pw-input-container class=\"col-6\"\n label=\"Dates Completed\"\n name=\"ended_on\"\n errorMsg=\"This field is required.\">\n <div class=\"ui-fluid\">\n <p-calendar formControlName=\"ended_on\"\n [monthNavigator]=\"true\"\n [yearNavigator]=\"true\"\n [showIcon]=\"true\"\n (onSelect)=\"onDateChange()\"\n [minDate]=\"minToDate\"\n dateFormat=\"yy-mm-dd\"\n yearRange=\"1950:2025\"></p-calendar>\n </div>\n </pw-input-container>\n\n <pw-input-container class=\"col-12\"\n label=\"Degree\"\n name=\"points\"\n errorMsg=\"This field is required.\">\n <p-dropdown [options]=\"qualifications\"\n placeholder=\"Select\"\n formControlName=\"points\"\n [style]=\"{ width: '100%' }\"></p-dropdown>\n </pw-input-container>\n\n <pw-input-container class=\"col-12\"\n label=\"Course\"\n name=\"course\"\n errorMsg=\"This field is required.\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"course\" />\n </pw-input-container>\n\n <pw-input-container class=\"col-12\"\n label=\"Description\"\n name=\"description\">\n <textarea type=\"text\"\n class=\"form-control\"\n formControlName=\"description\"></textarea>\n </pw-input-container>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\"\n class=\"btn btn-outline-default\"\n (click)=\"modal.close()\">\n Cancel\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\"\n (click)=\"onSaveDetail()\">Save</button>\n </div>\n</ng-template>\n\n<i\n class=\"fa fa-lg fa-edit float-end mt-3 pt-1 pt-md-0 primary\"\n data-cy=\"add-qualification\"\n (click)=\"onOpen()\"\n aria-hidden=\"true\"\n></i>\n", styles: [".btn-add{cursor:pointer;font-size:24px}\n"] }]
2039
+ }], ctorParameters: function () { return [{ type: i1$1.NgbModal }, { type: i2.UntypedFormBuilder }, { type: i1$2.QualificationService }, { type: i0.Injector }]; }, propDecorators: { saveEvent: [{
2040
+ type: Output
2041
+ }], content: [{
2042
+ type: ViewChild,
2043
+ args: ['content', { static: true }]
2044
+ }], onSaveDetail: [] } });
2045
+
2046
+ class EditRecommendationModalComponent {
2047
+ constructor(modalService, fb, profileService) {
2048
+ this.modalService = modalService;
2049
+ this.fb = fb;
2050
+ this.profileService = profileService;
2051
+ this.title = 'Endorse';
2052
+ this.project = new Project();
2053
+ this.form = this.fb.group({
2054
+ project_id: [null],
2055
+ user_id: [null],
2056
+ description: [null, Validators.required],
2057
+ quality: [null],
2058
+ time: [null],
2059
+ communication: [null]
2060
+ });
2061
+ }
2062
+ onOpen(value = null) {
2063
+ if (value) {
2064
+ this.project = value;
2065
+ }
2066
+ this.modalService.open(this.content, {
2067
+ centered: true,
2068
+ size: 'lg',
2069
+ windowClass: 'modal-holder'
2070
+ });
2071
+ }
2072
+ onSaveDetail() {
2073
+ const data = {
2074
+ user_id: this.user.id,
2075
+ project_id: this.project.id,
2076
+ description: this.form.get('description').value,
2077
+ quality: this.form.get('quality').value,
2078
+ time: this.form.get('time').value,
2079
+ communication: this.form.get('communication').value
2080
+ };
2081
+ this.profileService.postProjectRecommmndation(data).subscribe(_ => {
2082
+ this.modalService.dismissAll();
2083
+ });
2084
+ }
2085
+ }
2086
+ EditRecommendationModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: EditRecommendationModalComponent, deps: [{ token: i1$1.NgbModal }, { token: i2.UntypedFormBuilder }, { token: i1$2.ProfileService }], target: i0.ɵɵFactoryTarget.Component });
2087
+ EditRecommendationModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: EditRecommendationModalComponent, selector: "pw-edit-recommendation-modal", inputs: { user: "user" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, static: true }], ngImport: i0, template: "<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title\"\n id=\"modal-basic-title\">{{ title }}</h4>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"form\">\n <div class=\"row p-2\">\n <pw-input-container class=\"col-12 col-md-4\"\n label=\"Quality\"\n name=\"quality\"\n errorMsg=\"This field is required.\">\n <p-rating formControlName=\"quality\"\n [cancel]=\"false\"></p-rating>\n </pw-input-container>\n\n <pw-input-container class=\"col-12 col-md-4\"\n label=\"Communication\"\n name=\"communication\"\n errorMsg=\"This field is required.\">\n <p-rating formControlName=\"communication\"\n [cancel]=\"false\"></p-rating>\n </pw-input-container>\n\n <pw-input-container class=\"col-12 col-md-4\"\n label=\"Time\"\n name=\"time\"\n errorMsg=\"This field is required.\">\n <p-rating formControlName=\"time\"\n [cancel]=\"false\"></p-rating>\n </pw-input-container>\n\n <pw-input-container class=\"col-12\"\n label=\"Description\"\n name=\"description\"\n errorMsg=\"This field is required.\">\n <textarea type=\"text\"\n class=\"form-control\"\n formControlName=\"description\"></textarea>\n </pw-input-container>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\"\n class=\"btn btn-outline-default\"\n (click)=\"modal.close()\">\n Cancel\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\"\n (click)=\"onSaveDetail()\">Save</button>\n </div>\n</ng-template>\n\n<!-- <i class=\"fal fa-plus-circle fa-2x btn-link float-end btn-add\" (click)=\"onOpen()\" aria-hidden=\"true\"></i> -->\n", dependencies: [{ kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i7.InputContainerComponent, selector: "pw-input-container", inputs: ["name", "label", "labelClass", "tooltipPosition", "required", "errorMsg", "isReadOnly", "showTooltip", "tooltipText"] }] });
2088
+ __decorate([
2089
+ ValidateForm('form'),
2090
+ __metadata("design:type", Function),
2091
+ __metadata("design:paramtypes", []),
2092
+ __metadata("design:returntype", void 0)
2093
+ ], EditRecommendationModalComponent.prototype, "onSaveDetail", null);
2094
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: EditRecommendationModalComponent, decorators: [{
2095
+ type: Component,
2096
+ args: [{ selector: 'pw-edit-recommendation-modal', template: "<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title\"\n id=\"modal-basic-title\">{{ title }}</h4>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"form\">\n <div class=\"row p-2\">\n <pw-input-container class=\"col-12 col-md-4\"\n label=\"Quality\"\n name=\"quality\"\n errorMsg=\"This field is required.\">\n <p-rating formControlName=\"quality\"\n [cancel]=\"false\"></p-rating>\n </pw-input-container>\n\n <pw-input-container class=\"col-12 col-md-4\"\n label=\"Communication\"\n name=\"communication\"\n errorMsg=\"This field is required.\">\n <p-rating formControlName=\"communication\"\n [cancel]=\"false\"></p-rating>\n </pw-input-container>\n\n <pw-input-container class=\"col-12 col-md-4\"\n label=\"Time\"\n name=\"time\"\n errorMsg=\"This field is required.\">\n <p-rating formControlName=\"time\"\n [cancel]=\"false\"></p-rating>\n </pw-input-container>\n\n <pw-input-container class=\"col-12\"\n label=\"Description\"\n name=\"description\"\n errorMsg=\"This field is required.\">\n <textarea type=\"text\"\n class=\"form-control\"\n formControlName=\"description\"></textarea>\n </pw-input-container>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\"\n class=\"btn btn-outline-default\"\n (click)=\"modal.close()\">\n Cancel\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\"\n (click)=\"onSaveDetail()\">Save</button>\n </div>\n</ng-template>\n\n<!-- <i class=\"fal fa-plus-circle fa-2x btn-link float-end btn-add\" (click)=\"onOpen()\" aria-hidden=\"true\"></i> -->\n" }]
2097
+ }], ctorParameters: function () { return [{ type: i1$1.NgbModal }, { type: i2.UntypedFormBuilder }, { type: i1$2.ProfileService }]; }, propDecorators: { content: [{
2098
+ type: ViewChild,
2099
+ args: ['content', { static: true }]
2100
+ }], user: [{
2101
+ type: Input
2102
+ }], onSaveDetail: [] } });
2103
+
2104
+ class EditSkillsModalComponent extends AppBaseComponent {
2105
+ constructor(modalService, tagService, injector) {
2106
+ super(injector);
2107
+ this.modalService = modalService;
2108
+ this.tagService = tagService;
2109
+ this.entityType = TAG_TYPE.SKILLS;
2110
+ this.entityEntity = TAG_ENTITY.USER;
2111
+ this.saveEvent = new EventEmitter();
2112
+ this.allSkills = [];
2113
+ this.searchSkills = [];
2114
+ this.selectedSkills = [];
2115
+ }
2116
+ open() {
2117
+ this.getSkills();
2118
+ this.modalService.open(this.content, { centered: true, windowClass: 'modal-holder' });
2119
+ appendQueryParam(this.router, this.route, {
2120
+ modal: 'editskills'
2121
+ });
2122
+ }
2123
+ /**
2124
+ * Populate all the skills for the dropdown
2125
+ */
2126
+ getSkills() {
2127
+ this.tagService.getTagsByType('skills', {}).subscribe(response => {
2128
+ this.allSkills = response.tags;
2129
+ this.getEntitySkills();
2130
+ });
2131
+ }
2132
+ /**
2133
+ * Skills Search
2134
+ * @param event: keyword to search
2135
+ */
2136
+ search(event) {
2137
+ let data = [];
2138
+ if (event.query) {
2139
+ data = this.allSkills.filter(x => x.name.toLowerCase().includes(event.query.toLowerCase()));
2140
+ }
2141
+ else {
2142
+ this.allSkills.forEach(item => {
2143
+ data.push(item);
2144
+ });
2145
+ }
2146
+ this.searchSkills = data;
2147
+ }
2148
+ close(modal) {
2149
+ modal.close();
2150
+ this.selectedSkills = [];
2151
+ }
2152
+ getEntitySkills() {
2153
+ this.tagService
2154
+ .getTagsByEntity(this.slug, this.entityEntity, this.entityType)
2155
+ .subscribe(response => {
2156
+ this.selectedSkills = this.allSkills.filter(item => {
2157
+ return response.tags.find(x => x.id === item.id);
2158
+ });
2159
+ });
2160
+ }
2161
+ saveUserSkills() {
2162
+ const skills = [];
2163
+ this.selectedSkills.forEach(element => {
2164
+ skills.push({
2165
+ tag_id: element.id,
2166
+ rank: element.id,
2167
+ years: 0,
2168
+ preferred: true
2169
+ });
2170
+ });
2171
+ const postData = {
2172
+ entity_tags: skills,
2173
+ user_id: Number(this.userId),
2174
+ slug: this.slug,
2175
+ tag_entity: this.entityEntity
2176
+ };
2177
+ this.tagService.addTags(postData).subscribe(() => {
2178
+ this.saveEvent.emit(true);
2179
+ this.toast.success(this.translation.translate('User.Profile.Skills.UpdatedMessage'));
2180
+ clearQueryParams(this.router, this.route);
2181
+ this.modalService.dismissAll();
2182
+ });
2183
+ }
2184
+ }
2185
+ EditSkillsModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: EditSkillsModalComponent, deps: [{ token: i1$1.NgbModal }, { token: i1$2.TagService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
2186
+ EditSkillsModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: EditSkillsModalComponent, selector: "pw-edit-skills-modal", inputs: { userId: "userId", slug: "slug", entityType: "entityType", entityEntity: "entityEntity" }, outputs: { saveEvent: "saveEvent" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title\"\n id=\"modal-basic-title\">My Skills</h4>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <div class=\"ui-fluid skills-modal skills-dropdown\">\n <p-autoComplete [(ngModel)]=\"selectedSkills\"\n [suggestions]=\"searchSkills\"\n dataKey=\"id\"\n field=\"name\"\n (completeMethod)=\"search($event)\"\n styleClass=\"w-100\"\n [minLength]=\"1\"\n [maxlength]=\"10\"\n placeholder=\"Skills\"\n [dropdown]=\"true\"\n [multiple]=\"true\"></p-autoComplete>\n\n <small class=\"p-2\">Select up to 10 skills.</small>\n </div>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\"\n class=\"btn btn-outline-default\"\n (click)=\"close(modal)\">Cancel</button>\n <button type=\"button\"\n class=\"btn btn-primary\"\n (click)=\"saveUserSkills()\">Save</button>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }] });
2187
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: EditSkillsModalComponent, decorators: [{
2188
+ type: Component,
2189
+ args: [{ selector: 'pw-edit-skills-modal', template: "<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title\"\n id=\"modal-basic-title\">My Skills</h4>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <div class=\"ui-fluid skills-modal skills-dropdown\">\n <p-autoComplete [(ngModel)]=\"selectedSkills\"\n [suggestions]=\"searchSkills\"\n dataKey=\"id\"\n field=\"name\"\n (completeMethod)=\"search($event)\"\n styleClass=\"w-100\"\n [minLength]=\"1\"\n [maxlength]=\"10\"\n placeholder=\"Skills\"\n [dropdown]=\"true\"\n [multiple]=\"true\"></p-autoComplete>\n\n <small class=\"p-2\">Select up to 10 skills.</small>\n </div>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\"\n class=\"btn btn-outline-default\"\n (click)=\"close(modal)\">Cancel</button>\n <button type=\"button\"\n class=\"btn btn-primary\"\n (click)=\"saveUserSkills()\">Save</button>\n </div>\n</ng-template>\n" }]
2190
+ }], ctorParameters: function () { return [{ type: i1$1.NgbModal }, { type: i1$2.TagService }, { type: i0.Injector }]; }, propDecorators: { content: [{
2191
+ type: ViewChild,
2192
+ args: ['content', { static: true }]
2193
+ }], userId: [{
2194
+ type: Input
2195
+ }], slug: [{
2196
+ type: Input
2197
+ }], entityType: [{
2198
+ type: Input
2199
+ }], entityEntity: [{
2200
+ type: Input
2201
+ }], saveEvent: [{
2202
+ type: Output
2203
+ }] } });
2204
+
2205
+ class EditSocialLinksComponent extends AppBaseComponent {
2206
+ constructor(injector, modalService, fb, profileService) {
2207
+ super(injector);
2208
+ this.modalService = modalService;
2209
+ this.fb = fb;
2210
+ this.profileService = profileService;
2211
+ this.saveEvent = new EventEmitter();
2212
+ this.form = this.fb.group({
2213
+ user_id: 0,
2214
+ youtube: ['', this.urlValidator('youtube')],
2215
+ skype: ['', this.urlValidator('skype')],
2216
+ linkedin: ['', this.urlValidator('linkedin')],
2217
+ twitter: ['', this.urlValidator('twitter')],
2218
+ instagram: ['', this.urlValidator('instagram')],
2219
+ facebook: ['', this.urlValidator('facebook')],
2220
+ stackoverflow: ['', this.urlValidator('stackoverflow')],
2221
+ github: ['', this.urlValidator('github')],
2222
+ bitbucket: ['', this.urlValidator('bitbucket')],
2223
+ gitlab: ['', this.urlValidator('gitlab')]
2224
+ });
2225
+ }
2226
+ urlValidator(social) {
2227
+ return (control) => {
2228
+ const url = `https://www.${social}`;
2229
+ const url2 = `https://${social}`;
2230
+ if (control.value) {
2231
+ const valid = control.value.includes(url) || control.value.includes(url2);
2232
+ return valid ? null : { urlMalformed: { value: control.value } };
2233
+ }
2234
+ return null;
2235
+ };
2236
+ }
2237
+ ngOnInit() {
2238
+ this.form.patchValue(this.links);
2239
+ }
2240
+ onOpen() {
2241
+ this.modalService.open(this.content, {
2242
+ centered: true,
2243
+ size: 'lg',
2244
+ windowClass: 'modal-holder'
2245
+ });
2246
+ }
2247
+ onSaveDetail() {
2248
+ this.form.patchValue({
2249
+ user_id: this.userId
2250
+ });
2251
+ this.profileService.postLinks(this.form.value).subscribe(_ => {
2252
+ this.toast.success(this.translation.translate('User.Profile.SocialLinks.AddedMessage'));
2253
+ this.modalService.dismissAll();
2254
+ this.saveEvent.emit();
2255
+ });
2256
+ }
2257
+ }
2258
+ EditSocialLinksComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: EditSocialLinksComponent, deps: [{ token: i0.Injector }, { token: i1$1.NgbModal }, { token: i2.UntypedFormBuilder }, { token: i1$2.ProfileService }], target: i0.ɵɵFactoryTarget.Component });
2259
+ EditSocialLinksComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: EditSocialLinksComponent, selector: "pw-edit-social-links", inputs: { links: "links", userId: "userId" }, outputs: { saveEvent: "saveEvent" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title\"\n id=\"modal-basic-title\">Tell us your external portfolio</h4>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"form\"\n class=\"p-sm-3\"\n (ngSubmit)=\"onSaveDetail()\">\n <div>\n <p>\n Please tell us where we can find more information about you or about your\n work/projects. This will impact your ranking on the site.\n </p>\n </div>\n\n <div class=\"row mt-0\">\n <div class=\"col-sm-6 col-12\">\n <div class=\"mb-3\">\n <label><img src=\"/assets/img/icons/social/linkedin.svg\"\n width=\"20\"\n alt=\"\" />\n LinkedIn</label>\n <input type=\"url\"\n formControlName=\"linkedin\"\n class=\"form-control\"\n placeholder=\"https://linkedin.com/in/nickname\" />\n </div>\n </div>\n\n <div class=\"col-sm-6 col-12\">\n <div class=\"mb-3\">\n <label><img src=\"/assets/img/icons/social/twitter.svg\"\n width=\"20\"\n alt=\"\" />\n Twitter</label>\n <input type=\"url\"\n formControlName=\"twitter\"\n class=\"form-control\"\n placeholder=\"https://twitter.com/nickname\" />\n </div>\n </div>\n\n <div class=\"col-sm-6 col-12\">\n <div class=\"mb-3\">\n <label><img src=\"/assets/img/icons/social/facebook.svg\"\n width=\"20\"\n alt=\"\" />\n Facebook</label>\n <input type=\"url\"\n formControlName=\"facebook\"\n class=\"form-control\"\n placeholder=\"https://www.facebook.com/nickname\" />\n </div>\n </div>\n\n <div class=\"col-sm-6 col-12\">\n <div class=\"mb-3\">\n <label><img src=\"/assets/img/icons/social/youtube.svg\"\n width=\"20\"\n alt=\"\" />\n YouTube</label>\n <input type=\"url\"\n formControlName=\"youtube\"\n class=\"form-control\"\n placeholder=\"https://www.youtube.com/nickname\" />\n </div>\n </div>\n\n <div class=\"col-sm-6 col-12\">\n <div class=\"mb-3\">\n <label>\n <img src=\"/assets/img/icons/social/skype.svg\"\n width=\"20\"\n alt=\"\" /> Skype\n </label>\n <input type=\"url\"\n formControlName=\"skype\"\n class=\"form-control\"\n placeholder=\"https://www.skype.com/nickname\" />\n </div>\n </div>\n\n <div class=\"col-sm-6 col-12\">\n <div class=\"mb-3\">\n <label><img src=\"/assets/img/icons/social/github.svg\"\n width=\"20\"\n alt=\"\" />\n Github</label>\n <input type=\"url\"\n formControlName=\"github\"\n class=\"form-control\"\n placeholder=\"https://github.com/nickname\" />\n </div>\n </div>\n\n <div class=\"col-sm-6 col-12\">\n <div class=\"mb-3\">\n <label><img src=\"/assets/img/icons/social/stackoverflow.svg\"\n width=\"20\"\n alt=\"\" />\n Stackoverflow</label>\n <input type=\"url\"\n formControlName=\"stackoverflow\"\n class=\"form-control\"\n placeholder=\"http://stackoverflow.com/users/nickname\" />\n </div>\n </div>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\"\n class=\"btn btn-outline-default\"\n (click)=\"modal.close()\">\n Cancel\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\"\n (click)=\"onSaveDetail()\">Save</button>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i3.LazyImgDirective, selector: "img" }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] });
2260
+ __decorate([
2261
+ ValidateForm('form'),
2262
+ __metadata("design:type", Function),
2263
+ __metadata("design:paramtypes", []),
2264
+ __metadata("design:returntype", void 0)
2265
+ ], EditSocialLinksComponent.prototype, "onSaveDetail", null);
2266
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: EditSocialLinksComponent, decorators: [{
2267
+ type: Component,
2268
+ args: [{ selector: 'pw-edit-social-links', template: "<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title\"\n id=\"modal-basic-title\">Tell us your external portfolio</h4>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"form\"\n class=\"p-sm-3\"\n (ngSubmit)=\"onSaveDetail()\">\n <div>\n <p>\n Please tell us where we can find more information about you or about your\n work/projects. This will impact your ranking on the site.\n </p>\n </div>\n\n <div class=\"row mt-0\">\n <div class=\"col-sm-6 col-12\">\n <div class=\"mb-3\">\n <label><img src=\"/assets/img/icons/social/linkedin.svg\"\n width=\"20\"\n alt=\"\" />\n LinkedIn</label>\n <input type=\"url\"\n formControlName=\"linkedin\"\n class=\"form-control\"\n placeholder=\"https://linkedin.com/in/nickname\" />\n </div>\n </div>\n\n <div class=\"col-sm-6 col-12\">\n <div class=\"mb-3\">\n <label><img src=\"/assets/img/icons/social/twitter.svg\"\n width=\"20\"\n alt=\"\" />\n Twitter</label>\n <input type=\"url\"\n formControlName=\"twitter\"\n class=\"form-control\"\n placeholder=\"https://twitter.com/nickname\" />\n </div>\n </div>\n\n <div class=\"col-sm-6 col-12\">\n <div class=\"mb-3\">\n <label><img src=\"/assets/img/icons/social/facebook.svg\"\n width=\"20\"\n alt=\"\" />\n Facebook</label>\n <input type=\"url\"\n formControlName=\"facebook\"\n class=\"form-control\"\n placeholder=\"https://www.facebook.com/nickname\" />\n </div>\n </div>\n\n <div class=\"col-sm-6 col-12\">\n <div class=\"mb-3\">\n <label><img src=\"/assets/img/icons/social/youtube.svg\"\n width=\"20\"\n alt=\"\" />\n YouTube</label>\n <input type=\"url\"\n formControlName=\"youtube\"\n class=\"form-control\"\n placeholder=\"https://www.youtube.com/nickname\" />\n </div>\n </div>\n\n <div class=\"col-sm-6 col-12\">\n <div class=\"mb-3\">\n <label>\n <img src=\"/assets/img/icons/social/skype.svg\"\n width=\"20\"\n alt=\"\" /> Skype\n </label>\n <input type=\"url\"\n formControlName=\"skype\"\n class=\"form-control\"\n placeholder=\"https://www.skype.com/nickname\" />\n </div>\n </div>\n\n <div class=\"col-sm-6 col-12\">\n <div class=\"mb-3\">\n <label><img src=\"/assets/img/icons/social/github.svg\"\n width=\"20\"\n alt=\"\" />\n Github</label>\n <input type=\"url\"\n formControlName=\"github\"\n class=\"form-control\"\n placeholder=\"https://github.com/nickname\" />\n </div>\n </div>\n\n <div class=\"col-sm-6 col-12\">\n <div class=\"mb-3\">\n <label><img src=\"/assets/img/icons/social/stackoverflow.svg\"\n width=\"20\"\n alt=\"\" />\n Stackoverflow</label>\n <input type=\"url\"\n formControlName=\"stackoverflow\"\n class=\"form-control\"\n placeholder=\"http://stackoverflow.com/users/nickname\" />\n </div>\n </div>\n </div>\n </form>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\"\n class=\"btn btn-outline-default\"\n (click)=\"modal.close()\">\n Cancel\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\"\n (click)=\"onSaveDetail()\">Save</button>\n </div>\n</ng-template>\n" }]
2269
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1$1.NgbModal }, { type: i2.UntypedFormBuilder }, { type: i1$2.ProfileService }]; }, propDecorators: { content: [{
2270
+ type: ViewChild,
2271
+ args: ['content', { static: true }]
2272
+ }], links: [{
2273
+ type: Input
2274
+ }], userId: [{
2275
+ type: Input
2276
+ }], saveEvent: [{
2277
+ type: Output
2278
+ }], onSaveDetail: [] } });
2279
+
2280
+ class EditUserProfileModalComponent extends AppBaseComponent {
2281
+ constructor(modalService, fb, profileService, geoService, injector) {
2282
+ super(injector);
2283
+ this.modalService = modalService;
2284
+ this.fb = fb;
2285
+ this.profileService = profileService;
2286
+ this.geoService = geoService;
2287
+ this.saveEvent = new EventEmitter();
2288
+ this.states = [];
2289
+ this.form = this.fb.group({
2290
+ first_name: [null, Validators.required],
2291
+ last_name: [null, Validators.required],
2292
+ headline: [null, Validators.required],
2293
+ description: [null, Validators.required],
2294
+ gender: [null],
2295
+ phone_number: [null],
2296
+ dob: [null, Validators.required],
2297
+ website_url: [null],
2298
+ country: [null, Validators.required],
2299
+ postcode: [null],
2300
+ location: [null],
2301
+ state: [null, Validators.required],
2302
+ province: [null, Validators.required]
2303
+ });
2304
+ }
2305
+ ngOnInit() {
2306
+ this.countries$ = this.geoService.getCountries();
2307
+ this.getValues();
2308
+ }
2309
+ getValues() {
2310
+ let dobObject;
2311
+ const userProfile = this.user.profile;
2312
+ if (userProfile.country) {
2313
+ this.getRegion(userProfile.country);
2314
+ }
2315
+ if (userProfile.dob) {
2316
+ dobObject = {
2317
+ year: Number(userProfile.dob.substring(0, 4)),
2318
+ month: Number(userProfile.dob.substring(5, 7)),
2319
+ day: Number(userProfile.dob.substring(8, 10))
2320
+ };
2321
+ this.form.patchValue({});
2322
+ }
2323
+ this.form.patchValue(userProfile);
2324
+ this.form.patchValue({
2325
+ first_name: this.user.first_name,
2326
+ last_name: this.user.last_name,
2327
+ dob: dobObject || {}
2328
+ });
2329
+ }
2330
+ handleAddressChange(_event) {
2331
+ this.form.patchValue({
2332
+ latitude: _event.geometry.location.lat(),
2333
+ longitude: _event.geometry.location.lng(),
2334
+ location: _event.formatted_address
2335
+ });
2336
+ }
2337
+ onOpen() {
2338
+ this.form.reset();
2339
+ this.getValues();
2340
+ this.modalService.open(this.content, {
2341
+ centered: true,
2342
+ size: 'lg',
2343
+ windowClass: 'modal-holder'
2344
+ });
2345
+ }
2346
+ getRegion(countryId) {
2347
+ if (countryId) {
2348
+ this.geoService.getRegions(countryId).subscribe(response => {
2349
+ this.states = response;
2350
+ });
2351
+ }
2352
+ }
2353
+ onSaveDetail() {
2354
+ this.form.patchValue({ province: this.form.value.state });
2355
+ this.save();
2356
+ }
2357
+ save() {
2358
+ const data = Object.assign({}, this.form.value);
2359
+ data.dob = HelperService.dateFormat(this.form.get('dob').value);
2360
+ this.profileService.updateUserProfile(data).subscribe(response => {
2361
+ if (response.id) {
2362
+ this.toast.success(this.translation.translate('User.Profile.ProfileUpdated'));
2363
+ this.modalService.dismissAll();
2364
+ this.saveEvent.emit(response);
2365
+ }
2366
+ });
2367
+ }
2368
+ }
2369
+ EditUserProfileModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: EditUserProfileModalComponent, deps: [{ token: i1$1.NgbModal }, { token: i2.UntypedFormBuilder }, { token: i1$2.ProfileService }, { token: i1$2.GeoService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
2370
+ EditUserProfileModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: EditUserProfileModalComponent, selector: "pw-edit-user-profile-modal", inputs: { slug: "slug", user: "user" }, outputs: { saveEvent: "saveEvent" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, static: true }, { propertyName: "places", first: true, predicate: ["places"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title\"\n id=\"modal-basic-title\">Edit Intro</h4>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"form\"\n (ngSubmit)=\"onSaveDetail()\">\n <div class=\"row\">\n <pw-input-container class=\"col-6\"\n label=\"First Name\"\n name=\"first_name\"\n errorMsg=\"Please enter first Name\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"first_name\"\n id=\"first_name\" />\n </pw-input-container>\n\n <pw-input-container class=\"col-6\"\n label=\"Last Name\"\n name=\"last_name\"\n errorMsg=\"Please enter last Name\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"last_name\"\n id=\"last_name\" />\n </pw-input-container>\n\n <pw-input-container class=\"col-12\"\n label=\"Headline\"\n name=\"headline\"\n errorMsg=\"Please enter headline\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"headline\"\n id=\"headline\" />\n </pw-input-container>\n\n <pw-input-container class=\"col-12\"\n label=\"About me\"\n name=\"description\"\n errorMsg=\"Please enter description\">\n <textarea class=\"form-control\"\n formControlName=\"description\"\n id=\"description\"></textarea>\n </pw-input-container>\n\n <pw-input-container class=\"col-6\"\n label=\"Gender\"\n name=\"gender\"\n errorMsg=\"Please enter Gender\">\n <p-selectButton [options]=\"[\n { label: 'Male', value: 'M' },\n { label: 'Female', value: 'F' }\n ]\"\n formControlName=\"gender\"></p-selectButton>\n </pw-input-container>\n\n <pw-input-container class=\"col-6\"\n label=\"Date of Birth\"\n name=\"dob\"\n errorMsg=\"Please enter date of birth\">\n <div class=\"input-group\">\n <input class=\"form-control\"\n placeholder=\"dd-mm-yyyy\"\n formControlName=\"dob\"\n ngbDatepicker\n #d=\"ngbDatepicker\"\n [minDate]=\"{ year: 1950, month: 1, day: 1 }\"\n [maxDate]=\"{ year: 2018, month: 12, day: 31 }\" />\n <div class=\"input-group-append\">\n <button class=\"btn btn-primary\"\n (click)=\"d.toggle()\"\n type=\"button\">\n <i class=\"fa fa-calendar\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </div>\n </pw-input-container>\n\n <pw-input-container class=\"col-6\"\n label=\"Phone\"\n name=\"phone_number\"\n errorMsg=\"Please enter phone\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"phone_number\" />\n </pw-input-container>\n\n <pw-input-container class=\"col-6\"\n label=\"Postcode\"\n name=\"postcode\"\n errorMsg=\"Please enter postcode\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"postcode\" />\n </pw-input-container>\n\n <ng-container *ngIf=\"countries$ | async as countries\">\n <pw-input-container class=\"col-12 col-sm-6\"\n label=\"Country\"\n name=\"country\"\n errorMsg=\"Please select a country\">\n <select id=\"country\"\n class=\"form-select\"\n formControlName=\"country\"\n (change)=\"getRegion($event.target.value)\">\n <option value=\"0\">Select Country</option>\n <option *ngFor=\"let country of countries\"\n [value]=\"country.code\">\n {{ country.name }}\n </option>\n </select>\n </pw-input-container>\n </ng-container>\n\n <pw-input-container class=\"col-12 col-sm-6\"\n label=\"State\"\n name=\"state\"\n errorMsg=\"Please select a state\">\n <select id=\"state\"\n class=\"form-control form-select\"\n formControlName=\"state\">\n <option value=\"0\">Select State</option>\n <option *ngFor=\"let state of states\"\n [value]=\"state.code\">\n {{ state.name }}\n </option>\n </select>\n </pw-input-container>\n\n <!-- Location -->\n <pw-input-container label=\"Location\"\n class=\"col-12 col-md-6\"\n name=\"location\">\n <input ngx-google-places-autocomplete\n class=\"form-control\"\n #places=\"ngx-places\"\n formControlName=\"location\"\n (onAddressChange)=\"handleAddressChange($event)\" />\n </pw-input-container>\n\n <pw-input-container class=\"col-12 col-sm-6\"\n label=\"Website\"\n name=\"website_url\"\n errorMsg=\"Please enter Website\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"website_url\" />\n </pw-input-container>\n </div>\n <div class=\"modal-footer\">\n <input type=\"button\"\n class=\"btn btn-outline-default me-2\"\n (click)=\"modal.close()\"\n value=\"Cancel\" />\n <input type=\"submit\"\n class=\"btn btn-primary\"\n value=\"Save Changes\" />\n </div>\n </form>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i6.GooglePlaceDirective, selector: "[ngx-google-places-autocomplete]", inputs: ["options"], outputs: ["onAddressChange"], exportAs: ["ngx-places"] }, { kind: "component", type: i7.InputContainerComponent, selector: "pw-input-container", inputs: ["name", "label", "labelClass", "tooltipPosition", "required", "errorMsg", "isReadOnly", "showTooltip", "tooltipText"] }, { kind: "directive", type: i9.NgbInputDatepicker, selector: "input[ngbDatepicker]", inputs: ["autoClose", "datepickerClass", "dayTemplate", "dayTemplateData", "displayMonths", "firstDayOfWeek", "footerTemplate", "markDisabled", "minDate", "maxDate", "navigation", "outsideDays", "placement", "popperOptions", "restoreFocus", "showWeekNumbers", "startDate", "container", "positionTarget", "weekdays", "disabled"], outputs: ["dateSelect", "navigate", "closed"], exportAs: ["ngbDatepicker"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }] });
2371
+ __decorate([
2372
+ ValidateForm('form'),
2373
+ __metadata("design:type", Function),
2374
+ __metadata("design:paramtypes", []),
2375
+ __metadata("design:returntype", void 0)
2376
+ ], EditUserProfileModalComponent.prototype, "save", null);
2377
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: EditUserProfileModalComponent, decorators: [{
2378
+ type: Component,
2379
+ args: [{ selector: 'pw-edit-user-profile-modal', template: "<ng-template #content\n let-modal>\n <div class=\"modal-header\">\n <h4 class=\"modal-title\"\n id=\"modal-basic-title\">Edit Intro</h4>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"modal-body\">\n <form [formGroup]=\"form\"\n (ngSubmit)=\"onSaveDetail()\">\n <div class=\"row\">\n <pw-input-container class=\"col-6\"\n label=\"First Name\"\n name=\"first_name\"\n errorMsg=\"Please enter first Name\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"first_name\"\n id=\"first_name\" />\n </pw-input-container>\n\n <pw-input-container class=\"col-6\"\n label=\"Last Name\"\n name=\"last_name\"\n errorMsg=\"Please enter last Name\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"last_name\"\n id=\"last_name\" />\n </pw-input-container>\n\n <pw-input-container class=\"col-12\"\n label=\"Headline\"\n name=\"headline\"\n errorMsg=\"Please enter headline\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"headline\"\n id=\"headline\" />\n </pw-input-container>\n\n <pw-input-container class=\"col-12\"\n label=\"About me\"\n name=\"description\"\n errorMsg=\"Please enter description\">\n <textarea class=\"form-control\"\n formControlName=\"description\"\n id=\"description\"></textarea>\n </pw-input-container>\n\n <pw-input-container class=\"col-6\"\n label=\"Gender\"\n name=\"gender\"\n errorMsg=\"Please enter Gender\">\n <p-selectButton [options]=\"[\n { label: 'Male', value: 'M' },\n { label: 'Female', value: 'F' }\n ]\"\n formControlName=\"gender\"></p-selectButton>\n </pw-input-container>\n\n <pw-input-container class=\"col-6\"\n label=\"Date of Birth\"\n name=\"dob\"\n errorMsg=\"Please enter date of birth\">\n <div class=\"input-group\">\n <input class=\"form-control\"\n placeholder=\"dd-mm-yyyy\"\n formControlName=\"dob\"\n ngbDatepicker\n #d=\"ngbDatepicker\"\n [minDate]=\"{ year: 1950, month: 1, day: 1 }\"\n [maxDate]=\"{ year: 2018, month: 12, day: 31 }\" />\n <div class=\"input-group-append\">\n <button class=\"btn btn-primary\"\n (click)=\"d.toggle()\"\n type=\"button\">\n <i class=\"fa fa-calendar\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </div>\n </pw-input-container>\n\n <pw-input-container class=\"col-6\"\n label=\"Phone\"\n name=\"phone_number\"\n errorMsg=\"Please enter phone\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"phone_number\" />\n </pw-input-container>\n\n <pw-input-container class=\"col-6\"\n label=\"Postcode\"\n name=\"postcode\"\n errorMsg=\"Please enter postcode\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"postcode\" />\n </pw-input-container>\n\n <ng-container *ngIf=\"countries$ | async as countries\">\n <pw-input-container class=\"col-12 col-sm-6\"\n label=\"Country\"\n name=\"country\"\n errorMsg=\"Please select a country\">\n <select id=\"country\"\n class=\"form-select\"\n formControlName=\"country\"\n (change)=\"getRegion($event.target.value)\">\n <option value=\"0\">Select Country</option>\n <option *ngFor=\"let country of countries\"\n [value]=\"country.code\">\n {{ country.name }}\n </option>\n </select>\n </pw-input-container>\n </ng-container>\n\n <pw-input-container class=\"col-12 col-sm-6\"\n label=\"State\"\n name=\"state\"\n errorMsg=\"Please select a state\">\n <select id=\"state\"\n class=\"form-control form-select\"\n formControlName=\"state\">\n <option value=\"0\">Select State</option>\n <option *ngFor=\"let state of states\"\n [value]=\"state.code\">\n {{ state.name }}\n </option>\n </select>\n </pw-input-container>\n\n <!-- Location -->\n <pw-input-container label=\"Location\"\n class=\"col-12 col-md-6\"\n name=\"location\">\n <input ngx-google-places-autocomplete\n class=\"form-control\"\n #places=\"ngx-places\"\n formControlName=\"location\"\n (onAddressChange)=\"handleAddressChange($event)\" />\n </pw-input-container>\n\n <pw-input-container class=\"col-12 col-sm-6\"\n label=\"Website\"\n name=\"website_url\"\n errorMsg=\"Please enter Website\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"website_url\" />\n </pw-input-container>\n </div>\n <div class=\"modal-footer\">\n <input type=\"button\"\n class=\"btn btn-outline-default me-2\"\n (click)=\"modal.close()\"\n value=\"Cancel\" />\n <input type=\"submit\"\n class=\"btn btn-primary\"\n value=\"Save Changes\" />\n </div>\n </form>\n </div>\n</ng-template>\n" }]
2380
+ }], ctorParameters: function () { return [{ type: i1$1.NgbModal }, { type: i2.UntypedFormBuilder }, { type: i1$2.ProfileService }, { type: i1$2.GeoService }, { type: i0.Injector }]; }, propDecorators: { content: [{
2381
+ type: ViewChild,
2382
+ args: ['content', { static: true }]
2383
+ }], slug: [{
2384
+ type: Input
2385
+ }], saveEvent: [{
2386
+ type: Output
2387
+ }], user: [{
2388
+ type: Input
2389
+ }], places: [{
2390
+ type: ViewChild,
2391
+ args: ['places', { static: true }]
2392
+ }], save: [] } });
2393
+
2394
+ class UserAboutComponent extends AppBaseComponent {
2395
+ constructor(profileService, qualificationService, tagService, injector) {
2396
+ super(injector);
2397
+ this.profileService = profileService;
2398
+ this.qualificationService = qualificationService;
2399
+ this.tagService = tagService;
2400
+ this.isEdit = false;
2401
+ this.saveEvent = new EventEmitter();
2402
+ this.allSkills = [];
2403
+ this.searchSkills = [];
2404
+ this.objectKeys = Object.keys;
2405
+ this.qualifications = [];
2406
+ this.userLinks = [];
2407
+ this.loading = false;
2408
+ }
2409
+ ngOnInit() {
2410
+ this.getUserDetails();
2411
+ this.getSkills();
2412
+ }
2413
+ getUserDetails() {
2414
+ this.loading = true;
2415
+ forkJoin({
2416
+ user_profile: this.profileService.getUserObject('user_profile', this.user.slug),
2417
+ qualifications: this.profileService.getUserObject('qualifications', this.user.slug),
2418
+ user_links: this.profileService.getUserObject('user_link', this.user.slug),
2419
+ user_skills: this.tagService.getGroupedSkills(this.user.slug, TAG_ENTITY.USER, TAG_TYPE.SKILLS)
2420
+ }).subscribe({
2421
+ next: response => {
2422
+ this.user_profile = response.user_profile;
2423
+ this.user['profile'] = response.user_profile;
2424
+ this.qualifications = response.qualifications;
2425
+ this.userLinks = response.user_links || [];
2426
+ this.noUserLinks = Object.values(this.userLinks).some(x => !!x);
2427
+ this.selectedSkills = response.user_skills;
2428
+ this.loading = false;
2429
+ },
2430
+ error: err => {
2431
+ this.loading = false;
2432
+ this.toast.showToast(err);
2433
+ },
2434
+ complete: () => {
2435
+ this.loading = false;
2436
+ }
2437
+ });
2438
+ }
2439
+ /**
2440
+ * Populate all the skills for the dropdown
2441
+ */
2442
+ getSkills() {
2443
+ this.tagService.getTagsByType('skills', {}).subscribe(response => {
2444
+ this.allSkills = response.skills;
2445
+ });
2446
+ }
2447
+ onProfileOpen() {
2448
+ this.modal.onOpen();
2449
+ }
2450
+ openSkills() {
2451
+ this.skillsModal.open();
2452
+ }
2453
+ onProfileSaved(_event) {
2454
+ this.getUserDetails();
2455
+ this.saveEvent.emit();
2456
+ }
2457
+ onOpenSocial() {
2458
+ this.socialModal.onOpen();
2459
+ }
2460
+ editQualification(item) {
2461
+ this.qualificationModal.onOpen(item);
2462
+ }
2463
+ deleteQualification(item) {
2464
+ swal.fire({
2465
+ title: 'Delete',
2466
+ html: `Are you sure you want to delete <strong>${item.degree}</strong>?`,
2467
+ showCancelButton: true,
2468
+ reverseButtons: true,
2469
+ icon: 'warning'
2470
+ }).then(rep => {
2471
+ if (rep.value) {
2472
+ this.qualificationService.deleteQualifications(item.id).subscribe(() => {
2473
+ this.toast.success(this.translation.translate('User.Profile.Qualifications.QualificationDelete'));
2474
+ this.getUserDetails();
2475
+ });
2476
+ }
2477
+ });
2478
+ }
2479
+ onSaveUserLinks() {
2480
+ this.getUserDetails();
2481
+ }
2482
+ trackByQualification(_index, item) {
2483
+ return item.id;
2484
+ }
2485
+ ngOnDestroy() {
2486
+ // avoid memory leaks here by cleaning up after ourselves. If we
2487
+ // don't then we will continue to run our initialiseInvites()
2488
+ // method on every navigationEnd event.
2489
+ if (this.navigationSubscription) {
2490
+ this.navigationSubscription.unsubscribe();
2491
+ }
2492
+ }
2493
+ }
2494
+ UserAboutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UserAboutComponent, deps: [{ token: i1$2.ProfileService }, { token: i1$2.QualificationService }, { token: i1$2.TagService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
2495
+ UserAboutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: UserAboutComponent, selector: "pw-user-about", inputs: { user: "user", isEdit: "isEdit" }, outputs: { saveEvent: "saveEvent" }, viewQueries: [{ propertyName: "modal", first: true, predicate: EditUserProfileModalComponent, descendants: true }, { propertyName: "qualificationModal", first: true, predicate: EditQualificationsModalComponent, descendants: true }, { propertyName: "skillsModal", first: true, predicate: EditSkillsModalComponent, descendants: true }, { propertyName: "socialModal", first: true, predicate: EditSocialLinksComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"row\"\n *ngIf=\"!loading\">\n <div class=\"col-sm-12 mt-2\">\n <div data-cy=\"personal-info\">\n <h2 class=\"\">Personal Information</h2>\n <ng-container *ngIf=\"user && isEdit\">\n <i\n class=\"fa fa-lg fa-user-edit primary float-end mt-3 pt-1 pt-md-0\"\n (click)=\"onProfileOpen()\"\n aria-hidden=\"true\"\n ></i>\n <pw-edit-user-profile-modal [user]=\"user\"\n (saveEvent)=\"onProfileSaved($event)\"\n [slug]=\"user?.slug\">\n </pw-edit-user-profile-modal>\n </ng-container>\n </div>\n <div>\n <div class=\"my-3\">\n <span class=\"profile-label\">About Me:</span>\n <span class=\"display-block overflow-hidden\">{{ user_profile?.description || 'No description has been added yet.' }}\n </span>\n </div>\n <hr />\n <div class=\"row mt-0 my-0\">\n <div class=\"col-6 col-sm-6 col-lg-4\">\n <ul class=\"no-list-style personal-info\">\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"icon-present font-small-3\" aria-hidden=\"true\"></i>\n Birthday:</span>\n <span class=\"display-block overflow-hidden pt-2\">{{\n user_profile?.dob | dateFormat\n }}</span>\n </li>\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-globe font-small-3\" aria-hidden=\"true\"></i> Lives\n in:</span>\n <span class=\"display-block overflow-hidden pt-2\">{{\n user_profile?.country\n }}</span>\n </li>\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-monitor font-small-3\" aria-hidden=\"true\"></i>\n Website:</span>\n <a class=\"display-block overflow-hidden pt-2\">{{\n user_profile?.website_url\n }}</a>\n </li>\n </ul>\n </div>\n <div class=\"col-6 col-sm-6 col-lg-4\">\n <ul class=\"no-list-style personal-info\">\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-user font-small-3\" aria-hidden=\"true\"></i>\n Gender:</span>\n <span class=\"display-block overflow-hidden pt-2\">\n {{\n user_profile?.gender === 'M'\n ? 'Male'\n : user_profile?.gender === 'F'\n ? 'Female'\n : ''\n }}\n </span>\n </li>\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-mail font-small-3\" aria-hidden=\"true\"></i>\n Email:</span>\n <a class=\"display-block overflow-hidden pt-2\">{{ user?.email }}</a>\n </li>\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-smartphone font-small-3\" aria-hidden=\"true\"></i> Phone\n Number:</span>\n <span class=\"display-block overflow-hidden pt-2\">{{\n user_profile?.phone_number\n }}</span>\n </li>\n </ul>\n </div>\n <div class=\"col-6 col-md-6 col-lg-4\">\n <ul class=\"no-list-style personal-info\">\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-book font-small-3\" aria-hidden=\"true\"></i>\n Joined:</span>\n <span class=\"display-block overflow-hidden pt-2\">{{\n user?.joined_at | dateFormat\n }}</span>\n </li>\n </ul>\n </div>\n </div>\n </div>\n <hr />\n <div data-cy=\"skills-info\"\n class=\"mt-4\">\n <h2 class=\"\">Skills</h2>\n <div class=\"float-end\"\n *ngIf=\"isEdit\">\n <i\n class=\"fa fa-lg fa-edit primary float-end mt-3 pt-1 pt-md-0\"\n (click)=\"openSkills()\"\n aria-hidden=\"true\"\n ></i>\n <pw-edit-skills-modal [userId]=\"user?.id\"\n [slug]=\"user?.slug\"\n (saveEvent)=\"getUserDetails()\">\n </pw-edit-skills-modal>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"mb-4\"\n *ngIf=\"selectedSkills?.length === 0\">\n {{\n isEdit\n ? \"You haven't selected any skills yet. Please add some.\"\n : 'No skills added.'\n }}\n </div>\n </div>\n </div>\n </div>\n <div class=\"ui-fluid\">\n <span class=\"\"\n *ngFor=\"let skill of selectedSkills\">\n <span class=\"my-2 me-3\">{{ skill.category_name }}</span>\n <span *ngFor=\"let item of skill.tags\"\n class=\"badge bg-success me-2 mb-2\">{{ item.name }}\n </span>\n <br />\n </span>\n </div>\n <hr />\n <div data-cy=\"educational-info\">\n <div class=\"\">\n <h2 class=\"\">Educational Information</h2>\n <div class=\"float-end\"\n *ngIf=\"isEdit\">\n <pw-edit-qualifications-modal (saveEvent)=\"getUserDetails()\">\n </pw-edit-qualifications-modal>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-lg-6 col-12 mb-4\"\n [ngClass]=\"{ editable: isEdit }\"\n *ngFor=\"let item of qualifications; trackBy: trackByQualification\">\n <div class=\"mb-2\">\n <div class=\"float-start\">\n <h4>{{ item?.school }}</h4>\n <ul class=\"no-list-style\">\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-clock font-small-3\" aria-hidden=\"true\"></i>\n Period:</span>\n <span class=\"display-block overflow-hidden pt-2\">\n {{ item?.started_on }} - {{ item?.ended_on }}\n </span>\n </li>\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-feather font-small-3\" aria-hidden=\"true\"></i>\n Degree:</span>\n <span class=\"display-block overflow-hidden pt-2\">\n {{ item?.degree }}\n </span>\n </li>\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-octagon font-small-3\" aria-hidden=\"true\"></i>\n Course:</span>\n <span class=\"display-block overflow-hidden pt-2\">\n {{ item?.course }}\n </span>\n </li>\n </ul>\n </div>\n <div class=\"float-end action\"\n *ngIf=\"isEdit\">\n <span class=\"fa-stack\">\n <i\n class=\"fa fa-lg fa-edit fa-stack-1x me-3 primary\"\n title=\"Edit\"\n (click)=\"editQualification(item)\"\n aria-hidden=\"true\"\n ></i>\n </span>\n <span class=\"fa-stack\">\n <i\n class=\"fa fa-lg fa-trash fa-stack-1x primary\"\n data-cy=\"delete-qualification\"\n title=\"Delete\"\n (click)=\"deleteQualification(item)\"\n aria-hidden=\"true\"\n ></i>\n </span>\n </div>\n </div>\n </div>\n <div class=\"col-lg-6 col-12 mb-4\"\n *ngIf=\"qualifications && qualifications.length === 0\">\n {{\n isEdit\n ? ' No qualification yet. Please add some.'\n : 'No qualifications added.'\n }}\n </div>\n </div>\n </div>\n <hr />\n <!-- External Portfolio -->\n <div data-cy=\"portfolio-info\"\n class=\"mt-4\">\n <div class=\"\">\n <h2 class=\"\">External Portfolio</h2>\n <i\n class=\"fa fa-lg fa-edit primary float-end mt-3 pt-1 pt-md-0\"\n *ngIf=\"isEdit\"\n (click)=\"onOpenSocial()\"\n aria-hidden=\"true\"\n ></i>\n </div>\n <div class=\"row\">\n <div class=\"col-md-6 col-12 mb-4\">\n <div *ngIf=\"userLinks\">\n <ng-container *ngFor=\"let link of objectKeys(userLinks)\">\n <a target=\"_blank\"\n rel=\"noopener noreferrer\"\n [href]=\"userLinks[link]\"\n *ngIf=\"userLinks[link]\">\n <img src=\"assets/img/icons/social/{{ link }}.svg\"\n class=\"me-2\"\n width=\"40\"\n alt=\"\" />\n </a>\n </ng-container>\n </div>\n <div class=\"row\">\n <ng-container *ngIf=\"user\">\n <pw-edit-social-links [userId]=\"user.id\"\n [links]=\"userLinks\"\n (saveEvent)=\"onSaveUserLinks()\">\n </pw-edit-social-links>\n </ng-container>\n <div class=\"col-12 mb-4\"\n *ngIf=\"!noUserLinks\">\n {{\n isEdit\n ? 'No external portfolio yet. Please add some.'\n : 'No portfolio added.'\n }}\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n<div class=\"w-100 text-center mt-3\"\n *ngIf=\"loading\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n</div>\n", styles: [":root{--first: rgb(23 105 225);--second: rgb(54 194 131);--third: rgb(255 171 0);--text: rgb(34 34 34);--tabs_bg: rgb(23 105 225);--tabs_text: rgb(255 255 255);--titles: rgb(34 34 34);--sidebar_bg: rgb(0, 48, 63);--sidebar_text: rgb(255 255 255)}.edu-card .action{display:none}.edu-card:hover .action{display:block}.profile-label{color:var(--first);font-weight:700;margin-right:15px}.personal-info{margin-left:6%}@media only screen and (max-width: 1024px){#about{font-size:.7rem}}\n"], dependencies: [{ kind: "directive", type: i3.LazyImgDirective, selector: "img" }, { kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { kind: "component", type: EditQualificationsModalComponent, selector: "pw-edit-qualifications-modal", outputs: ["saveEvent"] }, { kind: "component", type: EditSkillsModalComponent, selector: "pw-edit-skills-modal", inputs: ["userId", "slug", "entityType", "entityEntity"], outputs: ["saveEvent"] }, { kind: "component", type: EditSocialLinksComponent, selector: "pw-edit-social-links", inputs: ["links", "userId"], outputs: ["saveEvent"] }, { kind: "component", type: EditUserProfileModalComponent, selector: "pw-edit-user-profile-modal", inputs: ["slug", "user"], outputs: ["saveEvent"] }] });
2496
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UserAboutComponent, decorators: [{
2497
+ type: Component,
2498
+ args: [{ selector: 'pw-user-about', template: "<div class=\"row\"\n *ngIf=\"!loading\">\n <div class=\"col-sm-12 mt-2\">\n <div data-cy=\"personal-info\">\n <h2 class=\"\">Personal Information</h2>\n <ng-container *ngIf=\"user && isEdit\">\n <i\n class=\"fa fa-lg fa-user-edit primary float-end mt-3 pt-1 pt-md-0\"\n (click)=\"onProfileOpen()\"\n aria-hidden=\"true\"\n ></i>\n <pw-edit-user-profile-modal [user]=\"user\"\n (saveEvent)=\"onProfileSaved($event)\"\n [slug]=\"user?.slug\">\n </pw-edit-user-profile-modal>\n </ng-container>\n </div>\n <div>\n <div class=\"my-3\">\n <span class=\"profile-label\">About Me:</span>\n <span class=\"display-block overflow-hidden\">{{ user_profile?.description || 'No description has been added yet.' }}\n </span>\n </div>\n <hr />\n <div class=\"row mt-0 my-0\">\n <div class=\"col-6 col-sm-6 col-lg-4\">\n <ul class=\"no-list-style personal-info\">\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"icon-present font-small-3\" aria-hidden=\"true\"></i>\n Birthday:</span>\n <span class=\"display-block overflow-hidden pt-2\">{{\n user_profile?.dob | dateFormat\n }}</span>\n </li>\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-globe font-small-3\" aria-hidden=\"true\"></i> Lives\n in:</span>\n <span class=\"display-block overflow-hidden pt-2\">{{\n user_profile?.country\n }}</span>\n </li>\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-monitor font-small-3\" aria-hidden=\"true\"></i>\n Website:</span>\n <a class=\"display-block overflow-hidden pt-2\">{{\n user_profile?.website_url\n }}</a>\n </li>\n </ul>\n </div>\n <div class=\"col-6 col-sm-6 col-lg-4\">\n <ul class=\"no-list-style personal-info\">\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-user font-small-3\" aria-hidden=\"true\"></i>\n Gender:</span>\n <span class=\"display-block overflow-hidden pt-2\">\n {{\n user_profile?.gender === 'M'\n ? 'Male'\n : user_profile?.gender === 'F'\n ? 'Female'\n : ''\n }}\n </span>\n </li>\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-mail font-small-3\" aria-hidden=\"true\"></i>\n Email:</span>\n <a class=\"display-block overflow-hidden pt-2\">{{ user?.email }}</a>\n </li>\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-smartphone font-small-3\" aria-hidden=\"true\"></i> Phone\n Number:</span>\n <span class=\"display-block overflow-hidden pt-2\">{{\n user_profile?.phone_number\n }}</span>\n </li>\n </ul>\n </div>\n <div class=\"col-6 col-md-6 col-lg-4\">\n <ul class=\"no-list-style personal-info\">\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-book font-small-3\" aria-hidden=\"true\"></i>\n Joined:</span>\n <span class=\"display-block overflow-hidden pt-2\">{{\n user?.joined_at | dateFormat\n }}</span>\n </li>\n </ul>\n </div>\n </div>\n </div>\n <hr />\n <div data-cy=\"skills-info\"\n class=\"mt-4\">\n <h2 class=\"\">Skills</h2>\n <div class=\"float-end\"\n *ngIf=\"isEdit\">\n <i\n class=\"fa fa-lg fa-edit primary float-end mt-3 pt-1 pt-md-0\"\n (click)=\"openSkills()\"\n aria-hidden=\"true\"\n ></i>\n <pw-edit-skills-modal [userId]=\"user?.id\"\n [slug]=\"user?.slug\"\n (saveEvent)=\"getUserDetails()\">\n </pw-edit-skills-modal>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"mb-4\"\n *ngIf=\"selectedSkills?.length === 0\">\n {{\n isEdit\n ? \"You haven't selected any skills yet. Please add some.\"\n : 'No skills added.'\n }}\n </div>\n </div>\n </div>\n </div>\n <div class=\"ui-fluid\">\n <span class=\"\"\n *ngFor=\"let skill of selectedSkills\">\n <span class=\"my-2 me-3\">{{ skill.category_name }}</span>\n <span *ngFor=\"let item of skill.tags\"\n class=\"badge bg-success me-2 mb-2\">{{ item.name }}\n </span>\n <br />\n </span>\n </div>\n <hr />\n <div data-cy=\"educational-info\">\n <div class=\"\">\n <h2 class=\"\">Educational Information</h2>\n <div class=\"float-end\"\n *ngIf=\"isEdit\">\n <pw-edit-qualifications-modal (saveEvent)=\"getUserDetails()\">\n </pw-edit-qualifications-modal>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-lg-6 col-12 mb-4\"\n [ngClass]=\"{ editable: isEdit }\"\n *ngFor=\"let item of qualifications; trackBy: trackByQualification\">\n <div class=\"mb-2\">\n <div class=\"float-start\">\n <h4>{{ item?.school }}</h4>\n <ul class=\"no-list-style\">\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-clock font-small-3\" aria-hidden=\"true\"></i>\n Period:</span>\n <span class=\"display-block overflow-hidden pt-2\">\n {{ item?.started_on }} - {{ item?.ended_on }}\n </span>\n </li>\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-feather font-small-3\" aria-hidden=\"true\"></i>\n Degree:</span>\n <span class=\"display-block overflow-hidden pt-2\">\n {{ item?.degree }}\n </span>\n </li>\n <li class=\"mb-4\">\n <span class=\"profile-label\"><i class=\"ft-octagon font-small-3\" aria-hidden=\"true\"></i>\n Course:</span>\n <span class=\"display-block overflow-hidden pt-2\">\n {{ item?.course }}\n </span>\n </li>\n </ul>\n </div>\n <div class=\"float-end action\"\n *ngIf=\"isEdit\">\n <span class=\"fa-stack\">\n <i\n class=\"fa fa-lg fa-edit fa-stack-1x me-3 primary\"\n title=\"Edit\"\n (click)=\"editQualification(item)\"\n aria-hidden=\"true\"\n ></i>\n </span>\n <span class=\"fa-stack\">\n <i\n class=\"fa fa-lg fa-trash fa-stack-1x primary\"\n data-cy=\"delete-qualification\"\n title=\"Delete\"\n (click)=\"deleteQualification(item)\"\n aria-hidden=\"true\"\n ></i>\n </span>\n </div>\n </div>\n </div>\n <div class=\"col-lg-6 col-12 mb-4\"\n *ngIf=\"qualifications && qualifications.length === 0\">\n {{\n isEdit\n ? ' No qualification yet. Please add some.'\n : 'No qualifications added.'\n }}\n </div>\n </div>\n </div>\n <hr />\n <!-- External Portfolio -->\n <div data-cy=\"portfolio-info\"\n class=\"mt-4\">\n <div class=\"\">\n <h2 class=\"\">External Portfolio</h2>\n <i\n class=\"fa fa-lg fa-edit primary float-end mt-3 pt-1 pt-md-0\"\n *ngIf=\"isEdit\"\n (click)=\"onOpenSocial()\"\n aria-hidden=\"true\"\n ></i>\n </div>\n <div class=\"row\">\n <div class=\"col-md-6 col-12 mb-4\">\n <div *ngIf=\"userLinks\">\n <ng-container *ngFor=\"let link of objectKeys(userLinks)\">\n <a target=\"_blank\"\n rel=\"noopener noreferrer\"\n [href]=\"userLinks[link]\"\n *ngIf=\"userLinks[link]\">\n <img src=\"assets/img/icons/social/{{ link }}.svg\"\n class=\"me-2\"\n width=\"40\"\n alt=\"\" />\n </a>\n </ng-container>\n </div>\n <div class=\"row\">\n <ng-container *ngIf=\"user\">\n <pw-edit-social-links [userId]=\"user.id\"\n [links]=\"userLinks\"\n (saveEvent)=\"onSaveUserLinks()\">\n </pw-edit-social-links>\n </ng-container>\n <div class=\"col-12 mb-4\"\n *ngIf=\"!noUserLinks\">\n {{\n isEdit\n ? 'No external portfolio yet. Please add some.'\n : 'No portfolio added.'\n }}\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n<div class=\"w-100 text-center mt-3\"\n *ngIf=\"loading\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n</div>\n", styles: [":root{--first: rgb(23 105 225);--second: rgb(54 194 131);--third: rgb(255 171 0);--text: rgb(34 34 34);--tabs_bg: rgb(23 105 225);--tabs_text: rgb(255 255 255);--titles: rgb(34 34 34);--sidebar_bg: rgb(0, 48, 63);--sidebar_text: rgb(255 255 255)}.edu-card .action{display:none}.edu-card:hover .action{display:block}.profile-label{color:var(--first);font-weight:700;margin-right:15px}.personal-info{margin-left:6%}@media only screen and (max-width: 1024px){#about{font-size:.7rem}}\n"] }]
2499
+ }], ctorParameters: function () { return [{ type: i1$2.ProfileService }, { type: i1$2.QualificationService }, { type: i1$2.TagService }, { type: i0.Injector }]; }, propDecorators: { user: [{
2500
+ type: Input
2501
+ }], isEdit: [{
2502
+ type: Input
2503
+ }], saveEvent: [{
2504
+ type: Output
2505
+ }], modal: [{
2506
+ type: ViewChild,
2507
+ args: [EditUserProfileModalComponent, { static: false }]
2508
+ }], qualificationModal: [{
2509
+ type: ViewChild,
2510
+ args: [EditQualificationsModalComponent, { static: false }]
2511
+ }], skillsModal: [{
2512
+ type: ViewChild,
2513
+ args: [EditSkillsModalComponent, { static: false }]
2514
+ }], socialModal: [{
2515
+ type: ViewChild,
2516
+ args: [EditSocialLinksComponent, { static: false }]
2517
+ }] } });
2518
+
2519
+ class PortfoliosComponent {
2520
+ constructor(service, modalService) {
2521
+ this.service = service;
2522
+ this.modalService = modalService;
2523
+ this.projectPictures = [];
2524
+ this.isLoaded = false;
2525
+ this.isEdit = false;
2526
+ }
2527
+ ngOnInit() {
2528
+ this.getProjectPictures();
2529
+ }
2530
+ getProjectPictures() {
2531
+ this.service.getProjectPictures(this.user.slug).subscribe(response => {
2532
+ if (response.length > 0) {
2533
+ this.projectPictures = response.flatMap(x => x.project_pictures);
2534
+ }
2535
+ this.isLoaded = true;
2536
+ });
2537
+ }
2538
+ deletePicture(id) {
2539
+ HelperService.raiseDeletePopup().then(resp => {
2540
+ if (resp.value) {
2541
+ this.service.deletePicture(id).subscribe(_ => {
2542
+ this.getProjectPictures();
2543
+ });
2544
+ }
2545
+ });
2546
+ }
2547
+ trackByImage(_index, item) {
2548
+ return item.id;
2549
+ }
2550
+ showFullImage(picture, content, evt) {
2551
+ if ($(evt.target).attr('id') !== 'delete-icon') {
2552
+ this.selectedPicURL = picture.picture.url;
2553
+ this.modalService.open(content, {
2554
+ centered: true,
2555
+ size: 'lg',
2556
+ windowClass: 'img-popup'
2557
+ });
2558
+ }
2559
+ }
2560
+ }
2561
+ PortfoliosComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: PortfoliosComponent, deps: [{ token: i1$2.ProfileService }, { token: i1$1.NgbModal }], target: i0.ɵɵFactoryTarget.Component });
2562
+ PortfoliosComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: PortfoliosComponent, selector: "pw-portfolios", inputs: { user: "user", isEdit: "isEdit" }, ngImport: i0, template: "<div class=\"row\">\n <div class=\"col-sm-12 mt-2\">\n <h2>User's Portfolio</h2>\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n <pw-no-data message=\"No portfolio listed.\"\n *ngIf=\"projectPictures.length === 0\"></pw-no-data>\n <div class=\"card-body\">\n <div class=\"card-block\"\n *ngIf=\"projectPictures.length\">\n <div class=\"grid-hover\">\n <div class=\"row\">\n <div class=\"col-md-4 col-12 mb-2\"\n *ngFor=\"let picture of projectPictures; trackBy: trackByImage\">\n <figure class=\"effect-marley\"\n (click)=\"showFullImage(picture, content, $event)\">\n <img [src]=\"picture.picture.url\"\n alt=\"project pic\" />\n <figcaption>\n <h2>\n <span class=\"portfolio-header-text\">{{ picture.project_title }}</span>\n </h2>\n <i\n class=\"fal fa-2x fa-times white\"\n id=\"delete-icon\"\n (click)=\"deletePicture(picture.id)\"\n *ngIf=\"isEdit\"\n aria-hidden=\"true\"\n ></i>\n <p class=\"thumb-description\">\n {{ picture?.project_description }}\n </p>\n </figcaption>\n </figure>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n<ng-template #content\n let-modal>\n <div class=\"modal-img-popup\">\n <img alt=\"selected picture\"\n [src]=\"selectedPicURL\"\n class=\"img-fluid\" />\n <button type=\"button\"\n class=\"close close-img\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss('Cross click')\">\n <span class=\"btn\">&times;</span>\n </button>\n </div>\n</ng-template>\n", styles: [".grid-hover figure{height:100%}.grid-hover figure figcaption:hover{background-color:#343a4066}.grid-hover figure figcaption h2{color:#fff}.thumb-description{color:#fff!important;height:154px;overflow:hidden;text-overflow:ellipsis;top:91px}.demo .modal-dialog{max-width:800px}.close-img{position:absolute}.close-img span{background-color:#4a4a4a;border:1px solid rgb(255,255,255);border-radius:50px;color:#fff;cursor:pointer;display:inline-block;font-size:1rem;height:40px;position:absolute;right:-30px;text-align:center;top:-30px;width:40px}@media screen and (max-width: 767px){.grid-hover figure{max-width:100%;min-width:100%}}@media screen and (min-device-width: 768px) and (max-device-width: 1200px){.grid-hover figure{min-width:-moz-fit-content;min-width:fit-content}}.portfolio-header-text{color:#fff!important}\n"], dependencies: [{ kind: "directive", type: i3.LazyImgDirective, selector: "img" }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }] });
2563
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: PortfoliosComponent, decorators: [{
2564
+ type: Component,
2565
+ args: [{ selector: 'pw-portfolios', template: "<div class=\"row\">\n <div class=\"col-sm-12 mt-2\">\n <h2>User's Portfolio</h2>\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n <pw-no-data message=\"No portfolio listed.\"\n *ngIf=\"projectPictures.length === 0\"></pw-no-data>\n <div class=\"card-body\">\n <div class=\"card-block\"\n *ngIf=\"projectPictures.length\">\n <div class=\"grid-hover\">\n <div class=\"row\">\n <div class=\"col-md-4 col-12 mb-2\"\n *ngFor=\"let picture of projectPictures; trackBy: trackByImage\">\n <figure class=\"effect-marley\"\n (click)=\"showFullImage(picture, content, $event)\">\n <img [src]=\"picture.picture.url\"\n alt=\"project pic\" />\n <figcaption>\n <h2>\n <span class=\"portfolio-header-text\">{{ picture.project_title }}</span>\n </h2>\n <i\n class=\"fal fa-2x fa-times white\"\n id=\"delete-icon\"\n (click)=\"deletePicture(picture.id)\"\n *ngIf=\"isEdit\"\n aria-hidden=\"true\"\n ></i>\n <p class=\"thumb-description\">\n {{ picture?.project_description }}\n </p>\n </figcaption>\n </figure>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>\n<ng-template #content\n let-modal>\n <div class=\"modal-img-popup\">\n <img alt=\"selected picture\"\n [src]=\"selectedPicURL\"\n class=\"img-fluid\" />\n <button type=\"button\"\n class=\"close close-img\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss('Cross click')\">\n <span class=\"btn\">&times;</span>\n </button>\n </div>\n</ng-template>\n", styles: [".grid-hover figure{height:100%}.grid-hover figure figcaption:hover{background-color:#343a4066}.grid-hover figure figcaption h2{color:#fff}.thumb-description{color:#fff!important;height:154px;overflow:hidden;text-overflow:ellipsis;top:91px}.demo .modal-dialog{max-width:800px}.close-img{position:absolute}.close-img span{background-color:#4a4a4a;border:1px solid rgb(255,255,255);border-radius:50px;color:#fff;cursor:pointer;display:inline-block;font-size:1rem;height:40px;position:absolute;right:-30px;text-align:center;top:-30px;width:40px}@media screen and (max-width: 767px){.grid-hover figure{max-width:100%;min-width:100%}}@media screen and (min-device-width: 768px) and (max-device-width: 1200px){.grid-hover figure{min-width:-moz-fit-content;min-width:fit-content}}.portfolio-header-text{color:#fff!important}\n"] }]
2566
+ }], ctorParameters: function () { return [{ type: i1$2.ProfileService }, { type: i1$1.NgbModal }]; }, propDecorators: { user: [{
2567
+ type: Input
2568
+ }], isEdit: [{
2569
+ type: Input
2570
+ }] } });
2571
+
2572
+ class UserProjectsComponent extends AppBaseComponent {
2573
+ constructor(service, injector) {
2574
+ super(injector);
2575
+ this.service = service;
2576
+ this.isEdit = false;
2577
+ this.projects = [];
2578
+ this.isLoaded = false;
2579
+ }
2580
+ ngOnInit() {
2581
+ this.getProjects();
2582
+ }
2583
+ onEditProject(item) {
2584
+ this.projectModal.onOpen(item);
2585
+ }
2586
+ editRecommendation(item) {
2587
+ this.recommendationModal.onOpen(item);
2588
+ }
2589
+ openSkills(project) {
2590
+ this.skillModal.slug = project.slug;
2591
+ this.skillModal.open();
2592
+ }
2593
+ getProjects() {
2594
+ var _a;
2595
+ this.service.getProjects((_a = this.user) === null || _a === void 0 ? void 0 : _a.slug).subscribe(response => {
2596
+ this.projects = response.projects;
2597
+ this.isLoaded = true;
2598
+ });
2599
+ }
2600
+ onSkillsSave() {
2601
+ this.getProjects();
2602
+ }
2603
+ onSaveProject(_event) {
2604
+ this.getProjects();
2605
+ }
2606
+ openPortfolis(id) {
2607
+ this.porfolios.openModal(id);
2608
+ this.porfolios.getProjectPictures();
2609
+ }
2610
+ onDeleteProject(project) {
2611
+ swal.fire({
2612
+ title: 'Delete',
2613
+ text: `Are you sure you want to delete ${project.title}?`,
2614
+ showCancelButton: true,
2615
+ reverseButtons: true,
2616
+ icon: 'warning'
2617
+ }).then(rep => {
2618
+ if (rep.value) {
2619
+ this.service.deleteProject(project.id).subscribe(() => {
2620
+ this.projects = this.projects.filter((x) => x.id !== project.id);
2621
+ });
2622
+ }
2623
+ });
2624
+ }
2625
+ trackByProject(_index, item) {
2626
+ return item.id;
2627
+ }
2628
+ deletePicture(project) {
2629
+ this.service.deletePicture(project.project_pictures[0].id).subscribe(_ => {
2630
+ this.getProjects();
2631
+ });
2632
+ }
2633
+ }
2634
+ UserProjectsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UserProjectsComponent, deps: [{ token: i1$2.ProfileService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
2635
+ UserProjectsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: UserProjectsComponent, selector: "pw-user-projects", inputs: { user: "user", isEdit: "isEdit" }, viewQueries: [{ propertyName: "projectModal", first: true, predicate: EditProjectModalComponent, descendants: true, static: true }, { propertyName: "skillModal", first: true, predicate: EditSkillsModalComponent, descendants: true }, { propertyName: "recommendationModal", first: true, predicate: EditRecommendationModalComponent, descendants: true, static: true }, { propertyName: "porfolios", first: true, predicate: EditPortfoliosComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"row\">\n <div class=\"col-sm-12 mt-2\">\n <h2>User's Projects</h2>\n <div class=\"row\"\n *ngIf=\"isEdit\">\n <div class=\"col-12\">\n <div class=\"content-header\">\n <button class=\"btn btn-primary float-end\"\n (click)=\"onEditProject(null)\">\n <i class=\"fa fa-plus-circle\" aria-hidden=\"true\"></i> {{'Create Project' | transloco}}\n </button>\n </div>\n </div>\n </div>\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n <div id=\"timeline\"\n class=\"timeline-center timeline-wrapper\"\n *ngIf=\"projects?.length\">\n <ul class=\"timeline\">\n <li class=\"timeline-line\"></li>\n </ul>\n <ul class=\"timeline\">\n <li class=\"timeline-line\"></li>\n <li class=\"timeline-item\"\n [ngClass]=\"{ 'mt-5': odd }\"\n *ngFor=\"\n let project of projects;\n let i = index;\n let odd = odd;\n let even = even;\n trackBy: trackByProject\n \">\n <div class=\"timeline-badge\">\n <span class=\"bg-red bg-lighten-1\"\n data-bs-toggle=\"tooltip\"\n data-placement=\"right\"\n title=\"Portfolio project work\">\n <span class=\"timeline-year\"> {{ project.start_year }} </span>\n </span>\n </div>\n <div class=\"timeline-card card shadow rounded border-grey border-lighten-2 pb-0\">\n <div class=\"card-header\">\n <h4 class=\"mb-0 card-title\">\n <a>{{ project.title }}</a>\n </h4>\n <div class=\"card-subtitle text-muted mt-0\">\n <span class=\"font-small-3\">\n {{ project.start_year }} - {{ project.end_year }}</span>\n </div>\n </div>\n <div class=\"card-body project-card\">\n <ng-container *ngIf=\"project.project_pictures?.length\">\n <i\n class=\"fal fa-times\"\n (click)=\"deletePicture(project)\"\n aria-hidden=\"true\"\n ></i>\n <img class=\"img-fluid project-picture\"\n [src]=\"project.project_pictures[0].picture.url\"\n alt=\"Project Cover\" />\n </ng-container>\n <div class=\"card-body\">\n <div class=\"\">\n <p class=\"card-text\">{{ project.description }}</p>\n <div class=\"list-inline mb-1\">\n <!-- Skills -->\n <div *ngIf=\"project.tags?.length\">\n <div class=\"my-2\">\n <i class=\"fa fa-user-tag\" aria-hidden=\"true\"></i>\n Skills\n </div>\n <ng-container *ngFor=\"let tag of project.tags\">\n <span class=\"badge bg-success me-2\">{{\n tag.name\n }}</span>\n </ng-container>\n </div>\n <div class=\"mt-2\"\n *ngIf=\"project.project_recommendations?.length\">\n <div class=\"my-2\">\n <i\n class=\"fa fa-clipboard-check me-2\"\n aria-hidden=\"true\"\n ></i>\n Recommendations\n </div>\n <section class=\"mb-2\"\n *ngFor=\"\n let recommendation of project.project_recommendations\n \">\n <div class=\"me-2\">\n Client: {{ recommendation?.client_name }}\n </div>\n <div class=\"me-2\">\n Message: {{ recommendation?.description }}\n </div>\n <div class=\"row recommendation\">\n <div class=\"col-4\">\n <span>Communication</span>\n <p-rating [(ngModel)]=\"\n recommendation.communication\n \"\n [cancel]=\"false\"\n [readonly]=\"true\">\n </p-rating>\n </div>\n <div class=\"col-4\">\n <span>Quality</span>\n <p-rating [(ngModel)]=\"recommendation.quality\"\n [cancel]=\"false\"\n [readonly]=\"true\">\n </p-rating>\n </div>\n <div class=\"col-4\">\n <span>Time</span>\n <p-rating [(ngModel)]=\"recommendation.time\"\n [cancel]=\"false\"\n [readonly]=\"true\">\n </p-rating>\n </div>\n </div>\n </section>\n </div>\n <div class=\"text-end mt-3 d-flex justify-content-end project-actions\"\n *ngIf=\"isEdit\">\n <!-- Project Edit -->\n <span class=\"btn btn-link pb-0\"\n (click)=\"onEditProject(project)\">\n Edit\n </span>\n <button class=\"btn btn-link pb-0\"\n (click)=\"openSkills(project)\">\n Skills\n </button>\n <pw-edit-skills-modal [userId]=\"user?.id\"\n entityEntity=\"Project\"\n entityType=\"skills\"\n (saveEvent)=\"onSkillsSave()\"\n [slug]=\"project?.slug\">\n </pw-edit-skills-modal>\n <!-- Portfolios -->\n <button class=\"btn btn-link pb-0\"\n (click)=\"openPortfolis(project.id)\">\n Photos\n </button>\n <pw-edit-portfolios [slug]=\"user?.slug\"\n [id]=\"project.id\"\n (successEvent)=\"getProjects()\">\n </pw-edit-portfolios>\n <span class=\"btn btn-link pb-0 delete-project\"\n (click)=\"onDeleteProject(project)\">\n Delete\n </span>\n </div>\n <!-- Recommendation -->\n <span class=\"pe-1 mt-3\"\n (click)=\"editRecommendation(project)\"\n *ngIf=\"!isEdit\">\n <a class=\"primary\"><span class=\"fa fa-commenting-o\"></span> Endorse\n </a></span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </li>\n </ul>\n </div>\n <pw-no-data [message]=\"\n isEdit\n ? ('User.Profile.Projects.NoProjects' | transloco)\n : ('User.Profile.Projects.NoUserProjects' | transloco)\n \"\n *ngIf=\"projects?.length === 0\">\n </pw-no-data>\n </div>\n</div>\n<pw-edit-project-modal (saveEvent)=\"onSaveProject($event)\"></pw-edit-project-modal>\n<pw-edit-recommendation-modal [user]=\"user\"></pw-edit-recommendation-modal>\n", styles: [":root{--first: rgb(23 105 225);--second: rgb(54 194 131);--third: rgb(255 171 0);--text: rgb(34 34 34);--tabs_bg: rgb(23 105 225);--tabs_text: rgb(255 255 255);--titles: rgb(34 34 34);--sidebar_bg: rgb(0, 48, 63);--sidebar_text: rgb(255 255 255)}.project-card{position:relative}.project-card i.fa-times{color:#fff;display:none;font-size:20px;position:absolute;right:39px;top:14px}.project-card:hover i.fa-times{display:inline}.timeline-card.card{min-height:auto}.timeline-card.card .card-header{padding:1.5rem 1.5rem 0}.timeline-card.card .card-body.project-card{padding:0 20px 1rem}.timeline-card.card .card-body.project-card .card-body{padding:20px 0 0}@media only screen and (max-width: 767px){.timeline-center{margin-top:30px}.timeline-center .project-actions .btn{padding:.375rem .5rem}}\n"], dependencies: [{ kind: "directive", type: i3.LazyImgDirective, selector: "img" }, { kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: i5.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { kind: "component", type: EditPortfoliosComponent, selector: "pw-edit-portfolios", inputs: ["id", "slug"], outputs: ["successEvent"] }, { kind: "component", type: EditProjectModalComponent, selector: "pw-edit-project-modal", outputs: ["cancelEvent", "saveEvent"] }, { kind: "component", type: EditRecommendationModalComponent, selector: "pw-edit-recommendation-modal", inputs: ["user"] }, { kind: "component", type: EditSkillsModalComponent, selector: "pw-edit-skills-modal", inputs: ["userId", "slug", "entityType", "entityEntity"], outputs: ["saveEvent"] }, { kind: "pipe", type: i10.TranslocoPipe, name: "transloco" }] });
2636
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UserProjectsComponent, decorators: [{
2637
+ type: Component,
2638
+ args: [{ selector: 'pw-user-projects', template: "<div class=\"row\">\n <div class=\"col-sm-12 mt-2\">\n <h2>User's Projects</h2>\n <div class=\"row\"\n *ngIf=\"isEdit\">\n <div class=\"col-12\">\n <div class=\"content-header\">\n <button class=\"btn btn-primary float-end\"\n (click)=\"onEditProject(null)\">\n <i class=\"fa fa-plus-circle\" aria-hidden=\"true\"></i> {{'Create Project' | transloco}}\n </button>\n </div>\n </div>\n </div>\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n <div id=\"timeline\"\n class=\"timeline-center timeline-wrapper\"\n *ngIf=\"projects?.length\">\n <ul class=\"timeline\">\n <li class=\"timeline-line\"></li>\n </ul>\n <ul class=\"timeline\">\n <li class=\"timeline-line\"></li>\n <li class=\"timeline-item\"\n [ngClass]=\"{ 'mt-5': odd }\"\n *ngFor=\"\n let project of projects;\n let i = index;\n let odd = odd;\n let even = even;\n trackBy: trackByProject\n \">\n <div class=\"timeline-badge\">\n <span class=\"bg-red bg-lighten-1\"\n data-bs-toggle=\"tooltip\"\n data-placement=\"right\"\n title=\"Portfolio project work\">\n <span class=\"timeline-year\"> {{ project.start_year }} </span>\n </span>\n </div>\n <div class=\"timeline-card card shadow rounded border-grey border-lighten-2 pb-0\">\n <div class=\"card-header\">\n <h4 class=\"mb-0 card-title\">\n <a>{{ project.title }}</a>\n </h4>\n <div class=\"card-subtitle text-muted mt-0\">\n <span class=\"font-small-3\">\n {{ project.start_year }} - {{ project.end_year }}</span>\n </div>\n </div>\n <div class=\"card-body project-card\">\n <ng-container *ngIf=\"project.project_pictures?.length\">\n <i\n class=\"fal fa-times\"\n (click)=\"deletePicture(project)\"\n aria-hidden=\"true\"\n ></i>\n <img class=\"img-fluid project-picture\"\n [src]=\"project.project_pictures[0].picture.url\"\n alt=\"Project Cover\" />\n </ng-container>\n <div class=\"card-body\">\n <div class=\"\">\n <p class=\"card-text\">{{ project.description }}</p>\n <div class=\"list-inline mb-1\">\n <!-- Skills -->\n <div *ngIf=\"project.tags?.length\">\n <div class=\"my-2\">\n <i class=\"fa fa-user-tag\" aria-hidden=\"true\"></i>\n Skills\n </div>\n <ng-container *ngFor=\"let tag of project.tags\">\n <span class=\"badge bg-success me-2\">{{\n tag.name\n }}</span>\n </ng-container>\n </div>\n <div class=\"mt-2\"\n *ngIf=\"project.project_recommendations?.length\">\n <div class=\"my-2\">\n <i\n class=\"fa fa-clipboard-check me-2\"\n aria-hidden=\"true\"\n ></i>\n Recommendations\n </div>\n <section class=\"mb-2\"\n *ngFor=\"\n let recommendation of project.project_recommendations\n \">\n <div class=\"me-2\">\n Client: {{ recommendation?.client_name }}\n </div>\n <div class=\"me-2\">\n Message: {{ recommendation?.description }}\n </div>\n <div class=\"row recommendation\">\n <div class=\"col-4\">\n <span>Communication</span>\n <p-rating [(ngModel)]=\"\n recommendation.communication\n \"\n [cancel]=\"false\"\n [readonly]=\"true\">\n </p-rating>\n </div>\n <div class=\"col-4\">\n <span>Quality</span>\n <p-rating [(ngModel)]=\"recommendation.quality\"\n [cancel]=\"false\"\n [readonly]=\"true\">\n </p-rating>\n </div>\n <div class=\"col-4\">\n <span>Time</span>\n <p-rating [(ngModel)]=\"recommendation.time\"\n [cancel]=\"false\"\n [readonly]=\"true\">\n </p-rating>\n </div>\n </div>\n </section>\n </div>\n <div class=\"text-end mt-3 d-flex justify-content-end project-actions\"\n *ngIf=\"isEdit\">\n <!-- Project Edit -->\n <span class=\"btn btn-link pb-0\"\n (click)=\"onEditProject(project)\">\n Edit\n </span>\n <button class=\"btn btn-link pb-0\"\n (click)=\"openSkills(project)\">\n Skills\n </button>\n <pw-edit-skills-modal [userId]=\"user?.id\"\n entityEntity=\"Project\"\n entityType=\"skills\"\n (saveEvent)=\"onSkillsSave()\"\n [slug]=\"project?.slug\">\n </pw-edit-skills-modal>\n <!-- Portfolios -->\n <button class=\"btn btn-link pb-0\"\n (click)=\"openPortfolis(project.id)\">\n Photos\n </button>\n <pw-edit-portfolios [slug]=\"user?.slug\"\n [id]=\"project.id\"\n (successEvent)=\"getProjects()\">\n </pw-edit-portfolios>\n <span class=\"btn btn-link pb-0 delete-project\"\n (click)=\"onDeleteProject(project)\">\n Delete\n </span>\n </div>\n <!-- Recommendation -->\n <span class=\"pe-1 mt-3\"\n (click)=\"editRecommendation(project)\"\n *ngIf=\"!isEdit\">\n <a class=\"primary\"><span class=\"fa fa-commenting-o\"></span> Endorse\n </a></span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </li>\n </ul>\n </div>\n <pw-no-data [message]=\"\n isEdit\n ? ('User.Profile.Projects.NoProjects' | transloco)\n : ('User.Profile.Projects.NoUserProjects' | transloco)\n \"\n *ngIf=\"projects?.length === 0\">\n </pw-no-data>\n </div>\n</div>\n<pw-edit-project-modal (saveEvent)=\"onSaveProject($event)\"></pw-edit-project-modal>\n<pw-edit-recommendation-modal [user]=\"user\"></pw-edit-recommendation-modal>\n", styles: [":root{--first: rgb(23 105 225);--second: rgb(54 194 131);--third: rgb(255 171 0);--text: rgb(34 34 34);--tabs_bg: rgb(23 105 225);--tabs_text: rgb(255 255 255);--titles: rgb(34 34 34);--sidebar_bg: rgb(0, 48, 63);--sidebar_text: rgb(255 255 255)}.project-card{position:relative}.project-card i.fa-times{color:#fff;display:none;font-size:20px;position:absolute;right:39px;top:14px}.project-card:hover i.fa-times{display:inline}.timeline-card.card{min-height:auto}.timeline-card.card .card-header{padding:1.5rem 1.5rem 0}.timeline-card.card .card-body.project-card{padding:0 20px 1rem}.timeline-card.card .card-body.project-card .card-body{padding:20px 0 0}@media only screen and (max-width: 767px){.timeline-center{margin-top:30px}.timeline-center .project-actions .btn{padding:.375rem .5rem}}\n"] }]
2639
+ }], ctorParameters: function () { return [{ type: i1$2.ProfileService }, { type: i0.Injector }]; }, propDecorators: { user: [{
2640
+ type: Input
2641
+ }], isEdit: [{
2642
+ type: Input
2643
+ }], projectModal: [{
2644
+ type: ViewChild,
2645
+ args: [EditProjectModalComponent, { static: true }]
2646
+ }], skillModal: [{
2647
+ type: ViewChild,
2648
+ args: [EditSkillsModalComponent, { static: false }]
2649
+ }], recommendationModal: [{
2650
+ type: ViewChild,
2651
+ args: [EditRecommendationModalComponent, { static: true }]
2652
+ }], porfolios: [{
2653
+ type: ViewChild,
2654
+ args: [EditPortfoliosComponent, { static: false }]
2655
+ }] } });
2656
+
2657
+ class UserProfilePageComponent extends AppBaseComponent {
2658
+ activateMenu() {
2659
+ this.activeItem = this.menu['activeItem'];
2660
+ }
2661
+ constructor(injector, profileService, modalService) {
2662
+ super(injector);
2663
+ this.profileService = profileService;
2664
+ this.modalService = modalService;
2665
+ this.objectKeys = Object.keys;
2666
+ this.image = 'assets/img/icons/male.png';
2667
+ this.isLoaded = false;
2668
+ this.route.params.subscribe(data => {
2669
+ this.slug = data['user-slug'];
2670
+ });
2671
+ this.items = [
2672
+ { id: 'about', label: 'About', icon: 'fa fa-fw fa-user' },
2673
+ {
2674
+ id: 'projects',
2675
+ label: 'Projects',
2676
+ icon: 'fa fa-fw fa-briefcase',
2677
+ visible: this.permissionService.evaluatePermissions('Pages.Product.CRM')
2678
+ },
2679
+ {
2680
+ id: 'portfolio',
2681
+ label: 'Portfolio',
2682
+ icon: 'fa fa-fw fa-image',
2683
+ visible: this.permissionService.evaluatePermissions('Pages.Product.CRM')
2684
+ }
2685
+ ];
2686
+ [this.activeItem] = this.items;
2687
+ }
2688
+ get allowEdit() {
2689
+ var _a;
2690
+ return (((_a = this.loggedInUserDetails) === null || _a === void 0 ? void 0 : _a.slug) === this.slug || this.permissionService.isSuperAdmin());
2691
+ }
2692
+ ngOnInit() {
2693
+ this.getUserBySlug();
2694
+ // Horizontal Timeline js for user timeline
2695
+ $.getScript('/assets/js/vertical-timeline.js');
2696
+ }
2697
+ dataURLtoBlob(dataurl) {
2698
+ const arr = dataurl === null || dataurl === void 0 ? void 0 : dataurl.split(',');
2699
+ // eslint-disable-next-line @typescript-eslint/prefer-regexp-exec
2700
+ const mime = arr[0].match(/^[A-Z]*[a-z]*:(.*?);[A-Z]*/)[1];
2701
+ const bstr = atob(arr[1]);
2702
+ let n = bstr.length;
2703
+ const u8arr = new Uint8Array(n);
2704
+ // eslint-disable-next-line no-plusplus
2705
+ while (n--) {
2706
+ u8arr[n] = bstr.charCodeAt(n);
2707
+ }
2708
+ return new Blob([u8arr], { type: mime });
2709
+ }
2710
+ openModal(content) {
2711
+ if (this.allowEdit) {
2712
+ this.modalService.open(content, { centered: true, windowClass: 'modal-holder' });
2713
+ }
2714
+ }
2715
+ onImageSelection(event) {
2716
+ const blob = this.dataURLtoBlob(event);
2717
+ const filename = `${`${this.slug.toLocaleLowerCase()}_${Date.parse(new Date().toString())}`}.png`;
2718
+ const file = new File([blob], filename);
2719
+ this.userService.addAvatar(file).subscribe(res => {
2720
+ var _a;
2721
+ this.modalService.dismissAll();
2722
+ this.image = (_a = res === null || res === void 0 ? void 0 : res.user_avatar[2]) === null || _a === void 0 ? void 0 : _a.url;
2723
+ });
2724
+ }
2725
+ getUserBySlug() {
2726
+ forkJoin({
2727
+ user: this.profileService.getUserObject('user', this.slug),
2728
+ user_profile: this.profileService.getUserObject('user_profile', this.slug),
2729
+ avatar: this.profileService.getUserObject('avatar', this.slug)
2730
+ }).subscribe({
2731
+ next: response => {
2732
+ var _a;
2733
+ this.user = response.user;
2734
+ this.userProfile = response.user_profile;
2735
+ if (response.avatar && response.avatar.length > 0) {
2736
+ this.image = (_a = response === null || response === void 0 ? void 0 : response.avatar[2]) === null || _a === void 0 ? void 0 : _a.url;
2737
+ }
2738
+ this.getCurrentUserDetails();
2739
+ this.isLoaded = true;
2740
+ },
2741
+ error: error => {
2742
+ if (error.status === StatusCodes.NOT_FOUND) {
2743
+ this.router.navigate(['NotFound']);
2744
+ }
2745
+ }
2746
+ });
2747
+ }
2748
+ onClose() {
2749
+ this.modalService.dismissAll();
2750
+ }
2751
+ getCurrentUserDetails() {
2752
+ this.userStore().subscribe((currentUser) => {
2753
+ if (currentUser) {
2754
+ this.loggedInUserDetails = currentUser;
2755
+ this.userService
2756
+ .getCurrentUserObject('user_relationships')
2757
+ .subscribe((response) => {
2758
+ this.isFollowing =
2759
+ response.length > 0
2760
+ ? response.some(x => x.followed_id === this.user.id &&
2761
+ currentUser.id === x.follower_id)
2762
+ : false;
2763
+ });
2764
+ }
2765
+ });
2766
+ }
2767
+ sendMessageSlug() {
2768
+ this.router.navigate(['/message'], { fragment: this.slug });
2769
+ }
2770
+ followUser() {
2771
+ this.userService.followUser(this.user.id).subscribe(response => {
2772
+ const name = this.user.first_name || this.user.slug;
2773
+ if (response.id) {
2774
+ this.isFollowing = true;
2775
+ this.toast.success(`You're now following ${name}`);
2776
+ }
2777
+ else {
2778
+ this.isFollowing = false;
2779
+ this.toast.success(`You've unfollowed ${name}`);
2780
+ }
2781
+ });
2782
+ }
2783
+ ngOnDestroy() {
2784
+ super.ngOnDestroy();
2785
+ }
2786
+ }
2787
+ UserProfilePageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UserProfilePageComponent, deps: [{ token: i0.Injector }, { token: i1$2.ProfileService }, { token: i1$1.NgbModal }], target: i0.ɵɵFactoryTarget.Component });
2788
+ UserProfilePageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: UserProfilePageComponent, selector: "pw-user-profile-page", viewQueries: [{ propertyName: "menu", first: true, predicate: ["menuItems"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<!-- User Profile Starts -->\n<!-- Basic User Details Starts -->\n<section id=\"user-profile\"\n *ngIf=\"user\">\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"dashboard\">\n <div class=\"media row py-3 align-items-center\">\n <div class=\"col-3 col-sm-2\">\n <div class=\"align-self-center halfway-fab text-center\">\n <!-- User Avatar -->\n <a class=\"profile-image\">\n <img [src]=\"image\"\n width=\"100\"\n height=\"100\"\n class=\"rounded-circle img-border width-100\"\n alt=\"User's Avatar\"\n onerror=\"this.onerror=null;this.src='assets/img/icons/male.png';\"\n (click)=\"openModal(content)\" />\n <div class=\"ms-4 ps-3 ms-sm-0 ps-sm-0 overlay\"\n (click)=\"openModal(content)\"\n *ngIf=\"allowEdit\">\n <div class=\"overlay-text\">\n <!-- Change Profile Pic -->\n <a href=\"javascript:void(0)\">\n {{ 'User.Profile.Change' | transloco }}\n </a>\n </div>\n </div>\n </a>\n </div>\n </div>\n <div class=\"col-9 col-sm-5\">\n <div class=\"align-self-start halfway-fab ps-3 pt-2\">\n <div>\n <strong class=\"font-medium-2 text-uppercase\"\n *ngIf=\"user?.last_name\">\n {{\n user?.first_name\n ? user?.first_name + ' ' + user?.last_name\n : 'Update Profile'\n }}\n </strong>\n <strong class=\"font-medium-2 text-uppercase\"\n *ngIf=\"!user?.last_name\">\n {{ user?.first_name ? user?.first_name : 'Update Profile' }}\n </strong>\n <p class=\"font-small-4\">{{ userProfile?.headline }}</p>\n </div>\n </div>\n </div>\n <div class=\"col-12 col-sm-5\">\n <div class=\"profile-cover-buttons\"\n *ngIf=\"!allowEdit\">\n <div class=\"d-flex halfway-fab align-self-end\">\n <div class=\"text-end d-none d-sm-none d-md-none d-lg-block\">\n <button type=\"button\"\n (click)=\"followUser()\"\n class=\"btn btn-outline-primary btn-raised me-2\">\n <i class=\"fa fa-plus\" aria-hidden=\"true\"></i>\n {{ isFollowing ? 'Following' : 'Follow' }}\n </button>\n <button type=\"button\"\n class=\"btn btn-primary btn-raised me-3\"\n (click)=\"sendMessageSlug()\">\n <i class=\"fa fa-mail-bulk\" aria-hidden=\"true\"></i> Message\n </button>\n </div>\n <div class=\"text-end d-block d-sm-block d-md-block d-lg-none\">\n <button type=\"button\"\n class=\"btn btn-primary btn-raised me-2\">\n <i class=\"fa fa-plus\" aria-hidden=\"true\"></i>\n </button>\n <button type=\"button\"\n class=\"btn btn-primary btn-raised me-3\">\n <i class=\"fa fa-mail-bulk\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</section>\n<!-- Basic User Details Ends -->\n<section>\n <div class=\"container-fluid pw-tab overflow-hidden\">\n <p-tabMenu #menuItems\n [model]=\"items\"\n [activeItem]=\"activeItem\"\n (click)=\"activateMenu()\">\n </p-tabMenu>\n <div class=\"dashboard\">\n <div class=\"dashboard-body\">\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n <ng-template [ngIf]=\"user && activeItem.id === 'about'\">\n <pw-user-about [user]=\"user\"\n [isEdit]=\"allowEdit\"\n (saveEvent)=\"getUserBySlug()\">\n </pw-user-about>\n </ng-template>\n <ng-template [ngIf]=\"activeItem.id === 'projects'\">\n <pw-user-projects [user]=\"user\"\n [isEdit]=\"allowEdit\"></pw-user-projects>\n </ng-template>\n <ng-template [ngIf]=\"activeItem.id === 'portfolio'\">\n <pw-portfolios [user]=\"user\"\n [isEdit]=\"allowEdit\"></pw-portfolios>\n </ng-template>\n </div>\n </div>\n </div>\n</section>\n<ng-template #content\n let-modal>\n <div class=\"card m-0\">\n <div class=\"card-content\">\n <div class=\"card-title\">\n <h3 class=\"modal-title\">{{ 'User.Profile.ProfilePicture' | transloco }}</h3>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"card-header\">\n <small> {{ 'User.Profile.PictureMessage' | transloco }}</small>\n <pw-image-cropper #profile\n aspectRatio=\"auto\"\n (imageSelectionEvent)=\"onImageSelection($event)\"\n (closeEvent)=\"onClose()\">\n </pw-image-cropper>\n </div>\n </div>\n </div>\n</ng-template>\n", styles: [":root{--first: rgb(23 105 225);--second: rgb(54 194 131);--third: rgb(255 171 0);--text: rgb(34 34 34);--tabs_bg: rgb(23 105 225);--tabs_text: rgb(255 255 255);--titles: rgb(34 34 34);--sidebar_bg: rgb(0, 48, 63);--sidebar_text: rgb(255 255 255)}.card-body{padding:10px!important}.py-3{padding-top:4rem!important;padding-bottom:0rem!important}.overlay-text{margin-left:-19px;margin-top:5px;text-align:center}::ng-deep .pw-tab .p-tabmenu .p-tabmenu-nav .p-tabmenuitem.p-highlight .p-menuitem-link{background-color:#1769e1!important;box-shadow:none!important;color:#fff!important}::ng-deep .pw-tab .p-tabmenu .p-tabmenu-nav .p-tabmenuitem.p-highlight .p-menuitem-link:hover{background-color:#1769e1!important;color:#fff!important}\n"], dependencies: [{ kind: "directive", type: i3.LazyImgDirective, selector: "img" }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i7.ProfileImageCropperComponent, selector: "pw-image-cropper", inputs: ["aspectRatio"], outputs: ["imageSelectionEvent", "closeEvent", "fileChangeEvent"] }, { kind: "component", type: i6$1.TabMenu, selector: "p-tabMenu", inputs: ["model", "activeItem", "scrollable", "popup", "style", "styleClass"], outputs: ["activeItemChange"] }, { kind: "component", type: i5.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { kind: "component", type: UserAboutComponent, selector: "pw-user-about", inputs: ["user", "isEdit"], outputs: ["saveEvent"] }, { kind: "component", type: PortfoliosComponent, selector: "pw-portfolios", inputs: ["user", "isEdit"] }, { kind: "component", type: UserProjectsComponent, selector: "pw-user-projects", inputs: ["user", "isEdit"] }, { kind: "pipe", type: i10.TranslocoPipe, name: "transloco" }] });
2789
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UserProfilePageComponent, decorators: [{
2790
+ type: Component,
2791
+ args: [{ selector: 'pw-user-profile-page', template: "<!-- User Profile Starts -->\n<!-- Basic User Details Starts -->\n<section id=\"user-profile\"\n *ngIf=\"user\">\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"dashboard\">\n <div class=\"media row py-3 align-items-center\">\n <div class=\"col-3 col-sm-2\">\n <div class=\"align-self-center halfway-fab text-center\">\n <!-- User Avatar -->\n <a class=\"profile-image\">\n <img [src]=\"image\"\n width=\"100\"\n height=\"100\"\n class=\"rounded-circle img-border width-100\"\n alt=\"User's Avatar\"\n onerror=\"this.onerror=null;this.src='assets/img/icons/male.png';\"\n (click)=\"openModal(content)\" />\n <div class=\"ms-4 ps-3 ms-sm-0 ps-sm-0 overlay\"\n (click)=\"openModal(content)\"\n *ngIf=\"allowEdit\">\n <div class=\"overlay-text\">\n <!-- Change Profile Pic -->\n <a href=\"javascript:void(0)\">\n {{ 'User.Profile.Change' | transloco }}\n </a>\n </div>\n </div>\n </a>\n </div>\n </div>\n <div class=\"col-9 col-sm-5\">\n <div class=\"align-self-start halfway-fab ps-3 pt-2\">\n <div>\n <strong class=\"font-medium-2 text-uppercase\"\n *ngIf=\"user?.last_name\">\n {{\n user?.first_name\n ? user?.first_name + ' ' + user?.last_name\n : 'Update Profile'\n }}\n </strong>\n <strong class=\"font-medium-2 text-uppercase\"\n *ngIf=\"!user?.last_name\">\n {{ user?.first_name ? user?.first_name : 'Update Profile' }}\n </strong>\n <p class=\"font-small-4\">{{ userProfile?.headline }}</p>\n </div>\n </div>\n </div>\n <div class=\"col-12 col-sm-5\">\n <div class=\"profile-cover-buttons\"\n *ngIf=\"!allowEdit\">\n <div class=\"d-flex halfway-fab align-self-end\">\n <div class=\"text-end d-none d-sm-none d-md-none d-lg-block\">\n <button type=\"button\"\n (click)=\"followUser()\"\n class=\"btn btn-outline-primary btn-raised me-2\">\n <i class=\"fa fa-plus\" aria-hidden=\"true\"></i>\n {{ isFollowing ? 'Following' : 'Follow' }}\n </button>\n <button type=\"button\"\n class=\"btn btn-primary btn-raised me-3\"\n (click)=\"sendMessageSlug()\">\n <i class=\"fa fa-mail-bulk\" aria-hidden=\"true\"></i> Message\n </button>\n </div>\n <div class=\"text-end d-block d-sm-block d-md-block d-lg-none\">\n <button type=\"button\"\n class=\"btn btn-primary btn-raised me-2\">\n <i class=\"fa fa-plus\" aria-hidden=\"true\"></i>\n </button>\n <button type=\"button\"\n class=\"btn btn-primary btn-raised me-3\">\n <i class=\"fa fa-mail-bulk\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</section>\n<!-- Basic User Details Ends -->\n<section>\n <div class=\"container-fluid pw-tab overflow-hidden\">\n <p-tabMenu #menuItems\n [model]=\"items\"\n [activeItem]=\"activeItem\"\n (click)=\"activateMenu()\">\n </p-tabMenu>\n <div class=\"dashboard\">\n <div class=\"dashboard-body\">\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"!isLoaded\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n <ng-template [ngIf]=\"user && activeItem.id === 'about'\">\n <pw-user-about [user]=\"user\"\n [isEdit]=\"allowEdit\"\n (saveEvent)=\"getUserBySlug()\">\n </pw-user-about>\n </ng-template>\n <ng-template [ngIf]=\"activeItem.id === 'projects'\">\n <pw-user-projects [user]=\"user\"\n [isEdit]=\"allowEdit\"></pw-user-projects>\n </ng-template>\n <ng-template [ngIf]=\"activeItem.id === 'portfolio'\">\n <pw-portfolios [user]=\"user\"\n [isEdit]=\"allowEdit\"></pw-portfolios>\n </ng-template>\n </div>\n </div>\n </div>\n</section>\n<ng-template #content\n let-modal>\n <div class=\"card m-0\">\n <div class=\"card-content\">\n <div class=\"card-title\">\n <h3 class=\"modal-title\">{{ 'User.Profile.ProfilePicture' | transloco }}</h3>\n <button type=\"button\"\n class=\"btn-close float-end\"\n aria-label=\"Close\"\n (click)=\"modal.dismiss()\">\n\n </button>\n </div>\n <div class=\"card-header\">\n <small> {{ 'User.Profile.PictureMessage' | transloco }}</small>\n <pw-image-cropper #profile\n aspectRatio=\"auto\"\n (imageSelectionEvent)=\"onImageSelection($event)\"\n (closeEvent)=\"onClose()\">\n </pw-image-cropper>\n </div>\n </div>\n </div>\n</ng-template>\n", styles: [":root{--first: rgb(23 105 225);--second: rgb(54 194 131);--third: rgb(255 171 0);--text: rgb(34 34 34);--tabs_bg: rgb(23 105 225);--tabs_text: rgb(255 255 255);--titles: rgb(34 34 34);--sidebar_bg: rgb(0, 48, 63);--sidebar_text: rgb(255 255 255)}.card-body{padding:10px!important}.py-3{padding-top:4rem!important;padding-bottom:0rem!important}.overlay-text{margin-left:-19px;margin-top:5px;text-align:center}::ng-deep .pw-tab .p-tabmenu .p-tabmenu-nav .p-tabmenuitem.p-highlight .p-menuitem-link{background-color:#1769e1!important;box-shadow:none!important;color:#fff!important}::ng-deep .pw-tab .p-tabmenu .p-tabmenu-nav .p-tabmenuitem.p-highlight .p-menuitem-link:hover{background-color:#1769e1!important;color:#fff!important}\n"] }]
2792
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1$2.ProfileService }, { type: i1$1.NgbModal }]; }, propDecorators: { menu: [{
2793
+ type: ViewChild,
2794
+ args: ['menuItems', { static: true }]
2795
+ }] } });
2796
+
2797
+ class SupportDetailsComponent extends AppBaseComponent {
2798
+ constructor(injector, commonService, authService) {
2799
+ super(injector);
2800
+ this.commonService = commonService;
2801
+ this.authService = authService;
2802
+ this.uploadedFiles = [];
2803
+ this.isSubmitClicked = false;
2804
+ this.recaptcha = null;
2805
+ this.form = AppAdmin.customerSupportForm();
2806
+ this.form.get('product_id').setValue(PermissionService.selectedProduct.id);
2807
+ this.siteKey = this.appConfig.integrations.captcha_key_V2;
2808
+ }
2809
+ onSave() {
2810
+ this.isSubmitClicked = true;
2811
+ }
2812
+ handleSuccess(token) {
2813
+ if (token) {
2814
+ this.authService.validateReCaptcha(token).subscribe((isSuccess) => {
2815
+ if (isSuccess) {
2816
+ this.isLoading = true;
2817
+ const data = Object.assign({}, this.form.value);
2818
+ if (this.uploadedFiles.length > 0) {
2819
+ // eslint-disable-next-line prefer-destructuring
2820
+ data.attachment = this.uploadedFiles[0];
2821
+ }
2822
+ if (!data.attachment) {
2823
+ delete data.attachment;
2824
+ }
2825
+ this.commonService
2826
+ .postCustomerSupport(data)
2827
+ .subscribe(() => {
2828
+ this.back();
2829
+ })
2830
+ .add(() => {
2831
+ this.isLoading = false;
2832
+ this.isSubmitClicked = false;
2833
+ });
2834
+ }
2835
+ });
2836
+ }
2837
+ }
2838
+ onSelect(event = null) {
2839
+ // eslint-disable-next-line no-restricted-syntax
2840
+ for (const file of event.files) {
2841
+ this.uploadedFiles.push(file);
2842
+ }
2843
+ }
2844
+ onRemove(event) {
2845
+ this.uploadedFiles = this.uploadedFiles.filter(x => event.file.name !== x.name);
2846
+ }
2847
+ }
2848
+ SupportDetailsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SupportDetailsComponent, deps: [{ token: i0.Injector }, { token: i1$2.CommonService }, { token: i1$2.AuthService }], target: i0.ɵɵFactoryTarget.Component });
2849
+ SupportDetailsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: SupportDetailsComponent, selector: "pw-support-details", usesInheritance: true, ngImport: i0, template: "<div class=\"row m-1 align-items-baseline\">\n <a href=\"javascript:void(0)\"\n (click)=\"back()\"\n class=\"previous\"><i class=\"fa fa-arrow-alt-circle-left\" aria-hidden=\"true\"></i></a>\n <h3 class=\"m-subheader__title m-subheader__title--separator\">\n <span>Open new support request</span>\n </h3>\n</div>\n<div class=\"p-2 m-1 mt-3\">\n <form [formGroup]=\"form\"\n (ngSubmit)=\"onSave()\">\n <div class=\"row\">\n <div class=\"col-12\">\n <pw-input-container label=\"title\"\n name=\"title\"\n errorMsg=\"Title is required\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"title\" />\n </pw-input-container>\n </div>\n <div class=\"col-12 col-sm-12\">\n <pw-input-container label=\"Description\"\n errorMsg=\"description is required\"\n name=\"description\">\n <textarea rows=\"3\"\n type=\"text\"\n class=\"form-control\"\n formControlName=\"description\"\n id=\"description\"></textarea>\n </pw-input-container>\n </div>\n <div class=\"col-12 col-md-6\">\n <h4 class=\"mt-4\">You can add a picture here</h4>\n <div class=\"mb-3 file-upload-support-details\">\n <label>Upload Picture</label>\n <p-fileUpload #forms\n name=\"myfile\"\n [customUpload]=\"true\"\n [auto]=\"true\"\n [showUploadButton]=\"false\"\n accept=\"image/*\"\n (onSelect)=\"onSelect($event)\"\n (onRemove)=\"onRemove($event)\">\n </p-fileUpload>\n </div>\n </div>\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"isLoading\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n <div class=\"col-12 text-end mt-3\">\n <ng-container *ngIf=\"isSubmitClicked\">\n <div class=\"support-details-captcha\">\n <ngx-recaptcha2 [ngModelOptions]=\"{ standalone: true }\"\n [siteKey]=\"siteKey\"\n size=\"normal\"\n [(ngModel)]=\"recaptcha\"\n (success)=\"handleSuccess($event)\">\n </ngx-recaptcha2>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!isSubmitClicked\">\n <button type=\"button\"\n class=\"btn btn-outline-default me-2\"\n (click)=\"back()\">\n {{ 'Button.Cancel' | transloco }}\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\">\n {{ 'Button.Submit' | transloco }}\n </button>\n </ng-container>\n </div>\n </div>\n </form>\n</div>\n", styles: ["::ng-deep .file-upload-support-details .p-fileupload .p-fileupload-content{padding:4rem 1rem}::ng-deep .file-upload-support-details .p-fileupload-content .p-fileupload-files .p-fileupload-row>:first-child{display:none}.support-details-captcha{text-align:-webkit-right}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i7.InputContainerComponent, selector: "pw-input-container", inputs: ["name", "label", "labelClass", "tooltipPosition", "required", "errorMsg", "isReadOnly", "showTooltip", "tooltipText"] }, { kind: "component", type: i5.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { kind: "component", type: i5$2.FileUpload, selector: "p-fileUpload", inputs: ["name", "url", "method", "multiple", "accept", "disabled", "auto", "withCredentials", "maxFileSize", "invalidFileSizeMessageSummary", "invalidFileSizeMessageDetail", "invalidFileTypeMessageSummary", "invalidFileTypeMessageDetail", "invalidFileLimitMessageDetail", "invalidFileLimitMessageSummary", "style", "styleClass", "previewWidth", "chooseLabel", "uploadLabel", "cancelLabel", "chooseIcon", "uploadIcon", "cancelIcon", "showUploadButton", "showCancelButton", "mode", "headers", "customUpload", "fileLimit", "uploadStyleClass", "cancelStyleClass", "removeStyleClass", "chooseStyleClass", "files"], outputs: ["onBeforeUpload", "onSend", "onUpload", "onError", "onClear", "onRemove", "onSelect", "onProgress", "uploadHandler", "onImageError"] }, { kind: "pipe", type: i10.TranslocoPipe, name: "transloco" }] });
2850
+ __decorate([
2851
+ ValidateForm('form'),
2852
+ __metadata("design:type", Function),
2853
+ __metadata("design:paramtypes", []),
2854
+ __metadata("design:returntype", void 0)
2855
+ ], SupportDetailsComponent.prototype, "onSave", null);
2856
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: SupportDetailsComponent, decorators: [{
2857
+ type: Component,
2858
+ args: [{ selector: 'pw-support-details', template: "<div class=\"row m-1 align-items-baseline\">\n <a href=\"javascript:void(0)\"\n (click)=\"back()\"\n class=\"previous\"><i class=\"fa fa-arrow-alt-circle-left\" aria-hidden=\"true\"></i></a>\n <h3 class=\"m-subheader__title m-subheader__title--separator\">\n <span>Open new support request</span>\n </h3>\n</div>\n<div class=\"p-2 m-1 mt-3\">\n <form [formGroup]=\"form\"\n (ngSubmit)=\"onSave()\">\n <div class=\"row\">\n <div class=\"col-12\">\n <pw-input-container label=\"title\"\n name=\"title\"\n errorMsg=\"Title is required\">\n <input type=\"text\"\n class=\"form-control\"\n formControlName=\"title\" />\n </pw-input-container>\n </div>\n <div class=\"col-12 col-sm-12\">\n <pw-input-container label=\"Description\"\n errorMsg=\"description is required\"\n name=\"description\">\n <textarea rows=\"3\"\n type=\"text\"\n class=\"form-control\"\n formControlName=\"description\"\n id=\"description\"></textarea>\n </pw-input-container>\n </div>\n <div class=\"col-12 col-md-6\">\n <h4 class=\"mt-4\">You can add a picture here</h4>\n <div class=\"mb-3 file-upload-support-details\">\n <label>Upload Picture</label>\n <p-fileUpload #forms\n name=\"myfile\"\n [customUpload]=\"true\"\n [auto]=\"true\"\n [showUploadButton]=\"false\"\n accept=\"image/*\"\n (onSelect)=\"onSelect($event)\"\n (onRemove)=\"onRemove($event)\">\n </p-fileUpload>\n </div>\n </div>\n <div class=\"w-100 text-center mt-3\"\n *ngIf=\"isLoading\">\n <p-progressSpinner strokeWidth=\"2\"> </p-progressSpinner>\n </div>\n <div class=\"col-12 text-end mt-3\">\n <ng-container *ngIf=\"isSubmitClicked\">\n <div class=\"support-details-captcha\">\n <ngx-recaptcha2 [ngModelOptions]=\"{ standalone: true }\"\n [siteKey]=\"siteKey\"\n size=\"normal\"\n [(ngModel)]=\"recaptcha\"\n (success)=\"handleSuccess($event)\">\n </ngx-recaptcha2>\n </div>\n </ng-container>\n <ng-container *ngIf=\"!isSubmitClicked\">\n <button type=\"button\"\n class=\"btn btn-outline-default me-2\"\n (click)=\"back()\">\n {{ 'Button.Cancel' | transloco }}\n </button>\n <button type=\"submit\"\n class=\"btn btn-primary\">\n {{ 'Button.Submit' | transloco }}\n </button>\n </ng-container>\n </div>\n </div>\n </form>\n</div>\n", styles: ["::ng-deep .file-upload-support-details .p-fileupload .p-fileupload-content{padding:4rem 1rem}::ng-deep .file-upload-support-details .p-fileupload-content .p-fileupload-files .p-fileupload-row>:first-child{display:none}.support-details-captcha{text-align:-webkit-right}\n"] }]
2859
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1$2.CommonService }, { type: i1$2.AuthService }]; }, propDecorators: { onSave: [] } });
2860
+
2861
+ const primeNgModules = [
2862
+ ProgressSpinnerModule,
2863
+ AccordionModule,
2864
+ FileUploadModule
2865
+ ];
2866
+ const ngbModule = [
2867
+ NgbModalModule,
2868
+ NgbDatepickerModule,
2869
+ ];
2870
+ class UserModuleModule {
2871
+ }
2872
+ UserModuleModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UserModuleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2873
+ UserModuleModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.5", ngImport: i0, type: UserModuleModule, declarations: [AccountComponent,
2874
+ AccountDetailsComponent,
2875
+ AddSubscriptionComponent,
2876
+ SavedCardDetailsComponent,
2877
+ SubscriptionCredentialComponent,
2878
+ UpdatePaymentDetailsComponent,
2879
+ UpgradeSubscriptionComponent,
2880
+ UserSubscriptionDetailsComponent,
2881
+ UserSubscriptionListComponent,
2882
+ UserInvoiceComponent,
2883
+ CommunicationTabComponent,
2884
+ OthersTabComponent,
2885
+ SecurityTabComponent,
2886
+ SettingsComponent,
2887
+ SupportComponent,
2888
+ EditPortfoliosComponent,
2889
+ EditProjectModalComponent,
2890
+ EditQualificationsModalComponent,
2891
+ EditRecommendationModalComponent,
2892
+ EditSkillsModalComponent,
2893
+ EditSocialLinksComponent,
2894
+ EditUserProfileModalComponent,
2895
+ UserAboutComponent,
2896
+ PortfoliosComponent,
2897
+ UserProfilePageComponent,
2898
+ UserProjectsComponent,
2899
+ SupportDetailsComponent], imports: [DirectivesModule,
2900
+ CommonModule,
2901
+ ReactiveFormsModule,
2902
+ CoreTranslocoModule,
2903
+ GooglePlaceModule,
2904
+ SharedComponentsModule, ProgressSpinnerModule,
2905
+ AccordionModule,
2906
+ FileUploadModule, NgbModalModule,
2907
+ NgbDatepickerModule], exports: [AccountComponent,
2908
+ AccountDetailsComponent,
2909
+ AddSubscriptionComponent,
2910
+ SavedCardDetailsComponent,
2911
+ SubscriptionCredentialComponent,
2912
+ UpdatePaymentDetailsComponent,
2913
+ UpgradeSubscriptionComponent,
2914
+ UserSubscriptionDetailsComponent,
2915
+ UserSubscriptionListComponent,
2916
+ UserInvoiceComponent,
2917
+ CommunicationTabComponent,
2918
+ OthersTabComponent,
2919
+ SecurityTabComponent,
2920
+ SettingsComponent,
2921
+ SupportComponent,
2922
+ EditPortfoliosComponent,
2923
+ EditProjectModalComponent,
2924
+ EditQualificationsModalComponent,
2925
+ EditRecommendationModalComponent,
2926
+ EditSkillsModalComponent,
2927
+ EditSocialLinksComponent,
2928
+ EditUserProfileModalComponent,
2929
+ UserAboutComponent,
2930
+ PortfoliosComponent,
2931
+ UserProfilePageComponent,
2932
+ UserProjectsComponent,
2933
+ SupportDetailsComponent] });
2934
+ UserModuleModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UserModuleModule, imports: [DirectivesModule,
2935
+ CommonModule,
2936
+ ReactiveFormsModule,
2937
+ CoreTranslocoModule,
2938
+ GooglePlaceModule,
2939
+ SharedComponentsModule, primeNgModules, ngbModule] });
2940
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: UserModuleModule, decorators: [{
2941
+ type: NgModule,
2942
+ args: [{
2943
+ declarations: [
2944
+ AccountComponent,
2945
+ AccountDetailsComponent,
2946
+ AddSubscriptionComponent,
2947
+ SavedCardDetailsComponent,
2948
+ SubscriptionCredentialComponent,
2949
+ UpdatePaymentDetailsComponent,
2950
+ UpgradeSubscriptionComponent,
2951
+ UserSubscriptionDetailsComponent,
2952
+ UserSubscriptionListComponent,
2953
+ UserInvoiceComponent,
2954
+ CommunicationTabComponent,
2955
+ OthersTabComponent,
2956
+ SecurityTabComponent,
2957
+ SettingsComponent,
2958
+ SupportComponent,
2959
+ EditPortfoliosComponent,
2960
+ EditProjectModalComponent,
2961
+ EditQualificationsModalComponent,
2962
+ EditRecommendationModalComponent,
2963
+ EditSkillsModalComponent,
2964
+ EditSocialLinksComponent,
2965
+ EditUserProfileModalComponent,
2966
+ UserAboutComponent,
2967
+ PortfoliosComponent,
2968
+ UserProfilePageComponent,
2969
+ UserProjectsComponent,
2970
+ SupportDetailsComponent
2971
+ ],
2972
+ imports: [
2973
+ DirectivesModule,
2974
+ CommonModule,
2975
+ ReactiveFormsModule,
2976
+ CoreTranslocoModule,
2977
+ GooglePlaceModule,
2978
+ SharedComponentsModule,
2979
+ ...primeNgModules,
2980
+ ...ngbModule
2981
+ ],
2982
+ exports: [
2983
+ AccountComponent,
2984
+ AccountDetailsComponent,
2985
+ AddSubscriptionComponent,
2986
+ SavedCardDetailsComponent,
2987
+ SubscriptionCredentialComponent,
2988
+ UpdatePaymentDetailsComponent,
2989
+ UpgradeSubscriptionComponent,
2990
+ UserSubscriptionDetailsComponent,
2991
+ UserSubscriptionListComponent,
2992
+ UserInvoiceComponent,
2993
+ CommunicationTabComponent,
2994
+ OthersTabComponent,
2995
+ SecurityTabComponent,
2996
+ SettingsComponent,
2997
+ SupportComponent,
2998
+ EditPortfoliosComponent,
2999
+ EditProjectModalComponent,
3000
+ EditQualificationsModalComponent,
3001
+ EditRecommendationModalComponent,
3002
+ EditSkillsModalComponent,
3003
+ EditSocialLinksComponent,
3004
+ EditUserProfileModalComponent,
3005
+ UserAboutComponent,
3006
+ PortfoliosComponent,
3007
+ UserProfilePageComponent,
3008
+ UserProjectsComponent,
3009
+ SupportDetailsComponent
3010
+ ]
3011
+ }]
3012
+ }] });
3013
+
3014
+ /**
3015
+ * Generated bundle index. Do not edit.
3016
+ */
3017
+
3018
+ export { AccountComponent, AccountDetailsComponent, AddSubscriptionComponent, CommunicationTabComponent, EditPortfoliosComponent, EditProjectModalComponent, EditQualificationsModalComponent, EditRecommendationModalComponent, EditSkillsModalComponent, EditSocialLinksComponent, EditUserProfileModalComponent, OthersTabComponent, PortfoliosComponent, SavedCardDetailsComponent, SecurityTabComponent, SettingsComponent, SubscriptionCredentialComponent, SupportComponent, SupportDetailsComponent, UpdatePaymentDetailsComponent, UpgradeSubscriptionComponent, UserAboutComponent, UserInvoiceComponent, UserModuleModule, UserProfilePageComponent, UserProjectsComponent, UserSubscriptionDetailsComponent, UserSubscriptionListComponent };
3019
+ //# sourceMappingURL=user-module.mjs.map