@quandis/qbo4.ui 4.0.1-CI-20240430-215338 → 4.0.1-CI-20240507-200005

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.
@@ -9,24 +9,67 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  };
10
10
  import { html, LitElement } from 'lit';
11
11
  import { customElement, property } from 'lit/decorators.js';
12
+ import { elementDateTime } from './Program.js';
13
+ const formEditMap = new Map();
14
+ formEditMap.set('defaultLayout', (component) => {
15
+ return html `<div slot="content">
16
+ <span>Created:</span>
17
+ <br/>
18
+ <span>${elementDateTime(component.CreatedDate)}</span>
19
+ <br/>
20
+ <span>${component.CreatedPerson}</span>
21
+ <br/>
22
+ <br/>
23
+ <span>Updated:</span>
24
+ <br/>
25
+ <span>${elementDateTime(component.UpdatedDate)}</span>
26
+ <br/>
27
+ <span>${component.UpdatedPerson}</span>
28
+ </div>`;
29
+ });
30
+ formEditMap.set('createdLayout', (component) => {
31
+ return html `<div slot="content">
32
+ <span>Created:</span>
33
+ <br/>
34
+ <span>${elementDateTime(component.CreatedDate)}</span>
35
+ <br/>
36
+ <span>${component.CreatedPerson}</span>
37
+ </div>`;
38
+ });
39
+ formEditMap.set('updatedLayout', (component) => {
40
+ return html `<div slot="content">
41
+ <span>Updated:</span>
42
+ <br/>
43
+ <span>${elementDateTime(component.UpdatedDate)}</span>
44
+ <br/>
45
+ <span>${component.UpdatedPerson}</span>
46
+ </div>`;
47
+ });
12
48
  let QboFormEdit = class QboFormEdit extends LitElement {
13
49
  constructor() {
14
50
  super(...arguments);
15
51
  this.buttonPrimaryClass = 'qbo-primary';
16
- this.createdDate = null;
17
- this.createdPerson = null;
52
+ this.data = {};
18
53
  this.divButtonGroupClass = 'qbo-btn-group';
19
54
  this.divFormActionClass = 'qbo-form-actions';
20
55
  this.divSectionHeaderClass = 'qbo-header';
21
56
  this.editLabel = 'Edit';
22
- this.updatedDate = null;
23
- this.updatedPerson = null;
57
+ this.infoButtonClass = 'qbo-btn-light';
58
+ this.infoIconClass = 'qbo-icon-info';
59
+ this.infoTitle = 'Last Updated';
60
+ this.popoverClass = 'qbo-float-end';
61
+ this.spanEditClass = 'qbo-icon-edit';
62
+ this.type = 'defaultLayout';
24
63
  this.renderInHost = true;
25
64
  }
26
65
  createRenderRoot() {
27
66
  return this.renderInHost ? this : super.createRenderRoot();
28
67
  }
29
68
  render() {
69
+ const data = this.closest('*[apiendpoint]');
70
+ if (this.type == null)
71
+ this.type = 'createdLayout';
72
+ const popover = formEditMap.has(this.type) ? formEditMap.get(this.type)(this.data) : null;
30
73
  return html `<slot>
31
74
  <div class="${this.divSectionHeaderClass}">
32
75
  <hr />
@@ -34,7 +77,7 @@ let QboFormEdit = class QboFormEdit extends LitElement {
34
77
  <div class="${this.divFormActionClass}">
35
78
  <div class="${this.divButtonGroupClass}">
36
79
  <button type="button" class="${this.buttonPrimaryClass}">
37
- <span class="bi-pencil-square"> ${this.editLabel}</span>
80
+ <span class="${this.spanEditClass}"> ${this.editLabel}</span>
38
81
  </button>
39
82
  <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown"></button>
40
83
  <ul class="dropdown-menu">
@@ -52,10 +95,11 @@ let QboFormEdit = class QboFormEdit extends LitElement {
52
95
  </li>
53
96
  </ul>
54
97
  </div>
55
- <qbo-popover>
56
- <button type="button" class="btn btn-light float-end" data-bs-toggle="popover" data-bs-placement="left" data-bs-container="body" title="Last Updated" data-bs-html="true" data-bs-content="Created:<br/>${this.createdDate}<br/>${this.createdPerson}<br/><br/>Updated:<br/>${this.updatedDate}<br/>${this.updatedPerson}">
57
- <i class="bi-info"></i>
98
+ <qbo-popover class="${this.popoverClass}">
99
+ <button type="button" class="${this.infoButtonClass}" title="${this.infoTitle}">
100
+ <i class="${this.infoIconClass}"></i>
58
101
  </button>
102
+ ${popover}
59
103
  </qbo-popover>
60
104
  </div>
61
105
  </slot>`;
@@ -66,13 +110,9 @@ __decorate([
66
110
  __metadata("design:type", Object)
67
111
  ], QboFormEdit.prototype, "buttonPrimaryClass", void 0);
68
112
  __decorate([
69
- property({ type: Date }),
113
+ property({ type: Object, attribute: false }),
70
114
  __metadata("design:type", Object)
71
- ], QboFormEdit.prototype, "createdDate", void 0);
72
- __decorate([
73
- property({ type: String }),
74
- __metadata("design:type", Object)
75
- ], QboFormEdit.prototype, "createdPerson", void 0);
115
+ ], QboFormEdit.prototype, "data", void 0);
76
116
  __decorate([
77
117
  property({ type: String }),
78
118
  __metadata("design:type", Object)
@@ -90,13 +130,29 @@ __decorate([
90
130
  __metadata("design:type", Object)
91
131
  ], QboFormEdit.prototype, "editLabel", void 0);
92
132
  __decorate([
93
- property({ type: Date }),
133
+ property({ type: String }),
134
+ __metadata("design:type", Object)
135
+ ], QboFormEdit.prototype, "infoButtonClass", void 0);
136
+ __decorate([
137
+ property({ type: String }),
94
138
  __metadata("design:type", Object)
95
- ], QboFormEdit.prototype, "updatedDate", void 0);
139
+ ], QboFormEdit.prototype, "infoIconClass", void 0);
96
140
  __decorate([
97
141
  property({ type: String }),
98
142
  __metadata("design:type", Object)
99
- ], QboFormEdit.prototype, "updatedPerson", void 0);
143
+ ], QboFormEdit.prototype, "infoTitle", void 0);
144
+ __decorate([
145
+ property({ type: String }),
146
+ __metadata("design:type", Object)
147
+ ], QboFormEdit.prototype, "popoverClass", void 0);
148
+ __decorate([
149
+ property({ type: String }),
150
+ __metadata("design:type", Object)
151
+ ], QboFormEdit.prototype, "spanEditClass", void 0);
152
+ __decorate([
153
+ property(),
154
+ __metadata("design:type", Object)
155
+ ], QboFormEdit.prototype, "type", void 0);
100
156
  __decorate([
101
157
  property({ type: Boolean }),
102
158
  __metadata("design:type", Object)
@@ -1,5 +1,43 @@
1
- import { html, LitElement } from 'lit';
1
+ import { html, LitElement, TemplateResult } from 'lit';
2
2
  import { customElement, property } from 'lit/decorators.js';
3
+ import { elementDateTime } from './Program.js';
4
+
5
+ type TemplateFunction = (component: any) => TemplateResult;
6
+ const formEditMap: Map<string, TemplateFunction> = new Map();
7
+ formEditMap.set('defaultLayout', (component: any) => {
8
+ return html`<div slot="content">
9
+ <span>Created:</span>
10
+ <br/>
11
+ <span>${elementDateTime(component.CreatedDate)}</span>
12
+ <br/>
13
+ <span>${component.CreatedPerson}</span>
14
+ <br/>
15
+ <br/>
16
+ <span>Updated:</span>
17
+ <br/>
18
+ <span>${elementDateTime(component.UpdatedDate)}</span>
19
+ <br/>
20
+ <span>${component.UpdatedPerson}</span>
21
+ </div>`;
22
+ });
23
+ formEditMap.set('createdLayout', (component: any) => {
24
+ return html`<div slot="content">
25
+ <span>Created:</span>
26
+ <br/>
27
+ <span>${elementDateTime(component.CreatedDate)}</span>
28
+ <br/>
29
+ <span>${component.CreatedPerson}</span>
30
+ </div>`;
31
+ });
32
+ formEditMap.set('updatedLayout', (component: any) => {
33
+ return html`<div slot="content">
34
+ <span>Updated:</span>
35
+ <br/>
36
+ <span>${elementDateTime(component.UpdatedDate)}</span>
37
+ <br/>
38
+ <span>${component.UpdatedPerson}</span>
39
+ </div>`;
40
+ });
3
41
 
4
42
  @customElement('qbo-form-edit')
5
43
  export class QboFormEdit extends LitElement {
@@ -7,11 +45,8 @@ export class QboFormEdit extends LitElement {
7
45
  @property({ type: String })
8
46
  buttonPrimaryClass: String | null = 'qbo-primary';
9
47
 
10
- @property({ type: Date })
11
- createdDate = null;
12
-
13
- @property({ type: String })
14
- createdPerson = null;
48
+ @property({ type: Object, attribute: false })
49
+ data: Object = { };
15
50
 
16
51
  @property({ type: String })
17
52
  divButtonGroupClass: String | null = 'qbo-btn-group';
@@ -25,11 +60,23 @@ export class QboFormEdit extends LitElement {
25
60
  @property({ type: String })
26
61
  editLabel: String | null = 'Edit';
27
62
 
28
- @property({ type: Date })
29
- updatedDate = null;
63
+ @property({ type: String })
64
+ infoButtonClass: String | null = 'qbo-btn-light';
65
+
66
+ @property({ type: String })
67
+ infoIconClass: String | null = 'qbo-icon-info';
68
+
69
+ @property({ type: String })
70
+ infoTitle: String | null = 'Last Updated';
71
+
72
+ @property({ type: String })
73
+ popoverClass: String | null = 'qbo-float-end';
30
74
 
31
75
  @property({ type: String })
32
- updatedPerson = null;
76
+ spanEditClass: String | null = 'qbo-icon-edit';
77
+
78
+ @property()
79
+ type: string | null = 'defaultLayout';
33
80
 
34
81
  @property({ type: Boolean })
35
82
  renderInHost = true;
@@ -39,6 +86,10 @@ export class QboFormEdit extends LitElement {
39
86
  }
40
87
 
41
88
  render() {
89
+ const data : any = this.closest('*[apiendpoint]');
90
+ if (this.type == null) this.type = 'createdLayout'
91
+ const popover = formEditMap.has(this.type) ? formEditMap.get(this.type)!(this.data) : null;
92
+
42
93
  return html`<slot>
43
94
  <div class="${this.divSectionHeaderClass}">
44
95
  <hr />
@@ -46,7 +97,7 @@ export class QboFormEdit extends LitElement {
46
97
  <div class="${this.divFormActionClass}">
47
98
  <div class="${this.divButtonGroupClass}">
48
99
  <button type="button" class="${this.buttonPrimaryClass}">
49
- <span class="bi-pencil-square"> ${this.editLabel}</span>
100
+ <span class="${this.spanEditClass}"> ${this.editLabel}</span>
50
101
  </button>
51
102
  <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown"></button>
52
103
  <ul class="dropdown-menu">
@@ -64,10 +115,11 @@ export class QboFormEdit extends LitElement {
64
115
  </li>
65
116
  </ul>
66
117
  </div>
67
- <qbo-popover>
68
- <button type="button" class="btn btn-light float-end" data-bs-toggle="popover" data-bs-placement="left" data-bs-container="body" title="Last Updated" data-bs-html="true" data-bs-content="Created:<br/>${this.createdDate}<br/>${this.createdPerson}<br/><br/>Updated:<br/>${this.updatedDate}<br/>${this.updatedPerson}">
69
- <i class="bi-info"></i>
118
+ <qbo-popover class="${this.popoverClass}">
119
+ <button type="button" class="${this.infoButtonClass}" title="${this.infoTitle}">
120
+ <i class="${this.infoIconClass}"></i>
70
121
  </button>
122
+ ${popover}
71
123
  </qbo-popover>
72
124
  </div>
73
125
  </slot>`;
@@ -182,20 +182,20 @@ let QboMainMenu = class QboMainMenu extends QboFetch {
182
182
  </li>`;
183
183
  }
184
184
  render() {
185
- if (this.jsonData.MainMenu) {
185
+ if (this.jsonData && this.jsonData.Root && this.jsonData.Root.MainMenu) {
186
186
  return html `
187
187
  <nav class="${this.navClass}">
188
188
  <div>
189
189
  <a href="#">
190
- ${this.renderImage(this.jsonData.MainMenu.Image)}
191
- ${this.jsonData.MainMenu.Label}
190
+ ${this.renderImage(this.jsonData.Root.MainMenu.Image)}
191
+ ${this.jsonData.Root.MainMenu.Label}
192
192
  </a>
193
193
  <button type="${this.buttonType}" data-bs-toggle="${this.collapseToggle}" data-bs-target="#${this.dropdownId}" aria-expanded="${this.ariaExpanded}" aria-label="${this.ariaLabel}">
194
194
  <span/>
195
195
  </button>
196
196
  <div id="${this.dropdownId}">
197
197
  <ul>
198
- ${this.renderMenu(this.jsonData.MainMenu, false, false)}
198
+ ${this.renderMenu(this.jsonData.Root.MainMenu, false, false)}
199
199
  </ul>
200
200
  </div>
201
201
  </div>
@@ -238,20 +238,20 @@ export class QboMainMenu extends QboFetch {
238
238
  }
239
239
 
240
240
  render() {
241
- if (this.jsonData.MainMenu) {
241
+ if (this.jsonData && this.jsonData.Root && this.jsonData.Root.MainMenu) {
242
242
  return html`
243
243
  <nav class="${this.navClass}">
244
244
  <div>
245
245
  <a href="#">
246
- ${this.renderImage(this.jsonData.MainMenu.Image)}
247
- ${this.jsonData.MainMenu.Label}
246
+ ${this.renderImage(this.jsonData.Root.MainMenu.Image)}
247
+ ${this.jsonData.Root.MainMenu.Label}
248
248
  </a>
249
249
  <button type="${this.buttonType}" data-bs-toggle="${this.collapseToggle}" data-bs-target="#${this.dropdownId}" aria-expanded="${this.ariaExpanded}" aria-label="${this.ariaLabel}">
250
250
  <span/>
251
251
  </button>
252
252
  <div id="${this.dropdownId}">
253
253
  <ul>
254
- ${this.renderMenu(this.jsonData.MainMenu, false, false)}
254
+ ${this.renderMenu(this.jsonData.Root.MainMenu, false, false)}
255
255
  </ul>
256
256
  </div>
257
257
  </div>
@@ -3,6 +3,7 @@ export declare class QboPopover extends LitElement {
3
3
  selector: string;
4
4
  renderInHost: boolean;
5
5
  createRenderRoot(): HTMLElement | DocumentFragment;
6
- updated(changedProperties: PropertyValues): void;
6
+ connectedCallback(): void;
7
+ firstUpdated(changedProperties: PropertyValues): void;
7
8
  render(): import("lit-html").TemplateResult<1>;
8
9
  }
@@ -19,13 +19,24 @@ let QboPopover = class QboPopover extends LitElement {
19
19
  createRenderRoot() {
20
20
  return this.renderInHost ? this : super.createRenderRoot();
21
21
  }
22
- updated(changedProperties) {
23
- /* Enable Popover */
24
- this.renderRoot.querySelectorAll(`${this.selector}`).forEach(function (t) {
25
- new Popover(t);
26
- });
22
+ connectedCallback() {
23
+ super.connectedCallback();
24
+ this.setAttribute('data-bs-toggle', 'popover');
25
+ this.setAttribute('data-bs-placement', 'left');
26
+ this.setAttribute('data-bs-container', 'body');
27
+ this.setAttribute('data-bs-html', 'true');
28
+ }
29
+ firstUpdated(changedProperties) {
30
+ super.firstUpdated(changedProperties);
31
+ const content = this.querySelector('*[slot=content]');
32
+ if (content instanceof HTMLElement)
33
+ content.style.display = 'none';
34
+ this.setAttribute('data-bs-content', content?.innerHTML ?? 'no content provided');
35
+ new Popover(this);
36
+ }
37
+ render() {
38
+ return html `<slot></slot>`;
27
39
  }
28
- render() { return html `<slot></slot>`; }
29
40
  };
30
41
  __decorate([
31
42
  property({ type: String }),
@@ -15,12 +15,26 @@ export class QboPopover extends LitElement {
15
15
  return this.renderInHost ? this : super.createRenderRoot();
16
16
  }
17
17
 
18
- updated(changedProperties: PropertyValues) {
19
- /* Enable Popover */
20
- this.renderRoot.querySelectorAll(`${this.selector}`).forEach(function (t) {
21
- new Popover(t);
22
- });
18
+ connectedCallback() {
19
+ super.connectedCallback();
20
+
21
+ this.setAttribute('data-bs-toggle', 'popover');
22
+ this.setAttribute('data-bs-placement', 'left');
23
+ this.setAttribute('data-bs-container', 'body');
24
+ this.setAttribute('data-bs-html', 'true');
25
+ }
26
+
27
+ firstUpdated(changedProperties: PropertyValues) {
28
+ super.firstUpdated(changedProperties);
29
+
30
+ const content = this.querySelector('*[slot=content]');
31
+ if (content instanceof HTMLElement) content.style.display = 'none';
32
+ this.setAttribute('data-bs-content', content?.innerHTML ?? 'no content provided');
33
+
34
+ new Popover(this);
23
35
  }
24
36
 
25
- render() { return html`<slot></slot>`; }
37
+ render() {
38
+ return html`<slot></slot>`;
39
+ }
26
40
  }
@@ -0,0 +1,15 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class QboSSN extends LitElement {
3
+ apiEndpoint: string;
4
+ contactId: String | null;
5
+ disabled: boolean;
6
+ formControlSmallClass: String | null;
7
+ name: String | null;
8
+ show: boolean;
9
+ ssn: String | null;
10
+ url: String | null;
11
+ renderInHost: boolean;
12
+ createRenderRoot(): HTMLElement | DocumentFragment;
13
+ toggleSSN(): Promise<void>;
14
+ render(): import("lit-html").TemplateResult<1>;
15
+ }
@@ -0,0 +1,106 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { html, LitElement } from 'lit';
11
+ import { customElement, property } from 'lit/decorators.js';
12
+ import { services } from '@quandis/qbo4.configuration';
13
+ import { RestApiService } from './RestApiService.js';
14
+ let QboSSN = class QboSSN extends LitElement {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.apiEndpoint = 'qbo';
18
+ this.contactId = null;
19
+ this.disabled = true;
20
+ this.formControlSmallClass = 'qbo-sm';
21
+ this.name = 'USSSN';
22
+ this.show = false;
23
+ this.ssn = null;
24
+ this.url = 'contact/UnmaskSSN';
25
+ this.renderInHost = true;
26
+ }
27
+ createRenderRoot() {
28
+ return this.renderInHost ? this : super.createRenderRoot();
29
+ }
30
+ async toggleSSN() {
31
+ this.show = !this.show;
32
+ if (this.show) {
33
+ const service = services.container.isRegistered(this.apiEndpoint)
34
+ ? services.container.resolve(this.apiEndpoint) : new RestApiService(this.apiEndpoint);
35
+ const json = await service.fetch(`${this.url}`, { ID: `${this.contactId}` });
36
+ this.renderRoot.querySelectorAll('input').forEach(input => {
37
+ if (input instanceof HTMLInputElement) {
38
+ if (json?.ContactCollection?.length > 0 && json.ContactCollection[0].USSSN != null && json.ContactCollection[0].USSSN.length == 9) {
39
+ const ssn = json.ContactCollection[0].USSSN;
40
+ input.value = `${ssn.substring(0, 3)}-${ssn.substring(3, 5)}-${ssn.substring(5, 9)}`;
41
+ this.renderRoot.querySelectorAll('i').forEach(i => {
42
+ i.className = 'bi bi-eye-slash';
43
+ });
44
+ }
45
+ }
46
+ });
47
+ }
48
+ else {
49
+ this.renderRoot.querySelectorAll('input').forEach(input => {
50
+ if (input instanceof HTMLInputElement)
51
+ input.value = `${this.ssn}`;
52
+ this.renderRoot.querySelectorAll('i').forEach(i => {
53
+ i.className = 'bi bi-eye';
54
+ });
55
+ });
56
+ }
57
+ }
58
+ render() {
59
+ return html `<slot>
60
+ <div class="input-group">
61
+ <input type="text" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="${this.name}" value="${this.ssn}"/>
62
+ <span @click="${this.toggleSSN}" class="input-group-text" style="cursor:pointer;"><i class="bi bi-eye"></i></span>
63
+ </div>
64
+ </slot>`;
65
+ }
66
+ };
67
+ __decorate([
68
+ property({ type: String }),
69
+ __metadata("design:type", Object)
70
+ ], QboSSN.prototype, "apiEndpoint", void 0);
71
+ __decorate([
72
+ property({ type: String }),
73
+ __metadata("design:type", Object)
74
+ ], QboSSN.prototype, "contactId", void 0);
75
+ __decorate([
76
+ property({ type: Boolean }),
77
+ __metadata("design:type", Object)
78
+ ], QboSSN.prototype, "disabled", void 0);
79
+ __decorate([
80
+ property({ type: String }),
81
+ __metadata("design:type", Object)
82
+ ], QboSSN.prototype, "formControlSmallClass", void 0);
83
+ __decorate([
84
+ property({ type: String }),
85
+ __metadata("design:type", Object)
86
+ ], QboSSN.prototype, "name", void 0);
87
+ __decorate([
88
+ property({ type: Boolean }),
89
+ __metadata("design:type", Object)
90
+ ], QboSSN.prototype, "show", void 0);
91
+ __decorate([
92
+ property({ type: String }),
93
+ __metadata("design:type", Object)
94
+ ], QboSSN.prototype, "ssn", void 0);
95
+ __decorate([
96
+ property({ type: String }),
97
+ __metadata("design:type", Object)
98
+ ], QboSSN.prototype, "url", void 0);
99
+ __decorate([
100
+ property({ type: Boolean }),
101
+ __metadata("design:type", Object)
102
+ ], QboSSN.prototype, "renderInHost", void 0);
103
+ QboSSN = __decorate([
104
+ customElement('qbo-ssn')
105
+ ], QboSSN);
106
+ export { QboSSN };
@@ -0,0 +1,80 @@
1
+ import { html, LitElement } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import { IApiService } from './IApiService.js';
4
+ import { services } from '@quandis/qbo4.configuration';
5
+ import { RestApiService } from './RestApiService.js';
6
+
7
+ @customElement('qbo-ssn')
8
+ export class QboSSN extends LitElement {
9
+
10
+ @property({ type: String })
11
+ apiEndpoint = 'qbo';
12
+
13
+ @property({ type: String })
14
+ contactId: String | null = null;
15
+
16
+ @property({ type: Boolean })
17
+ disabled = true;
18
+
19
+ @property({ type: String })
20
+ formControlSmallClass: String | null = 'qbo-sm';
21
+
22
+ @property({ type: String })
23
+ name: String | null = 'USSSN';
24
+
25
+ @property({ type: Boolean })
26
+ show = false;
27
+
28
+ @property({ type: String })
29
+ ssn: String | null = null;
30
+
31
+ @property({ type: String })
32
+ url: String | null = 'contact/UnmaskSSN';
33
+
34
+ @property({ type: Boolean })
35
+ renderInHost = true;
36
+
37
+ createRenderRoot() {
38
+ return this.renderInHost ? this : super.createRenderRoot();
39
+ }
40
+
41
+ async toggleSSN() {
42
+ this.show = !this.show;
43
+
44
+ if (this.show) {
45
+ const service: IApiService = services.container.isRegistered(this.apiEndpoint)
46
+ ? services.container.resolve<IApiService>(this.apiEndpoint) : new RestApiService(this.apiEndpoint);
47
+ const json = await service.fetch(`${this.url}`, { ID: `${this.contactId}` });
48
+
49
+ this.renderRoot.querySelectorAll('input').forEach(input => {
50
+ if (input instanceof HTMLInputElement) {
51
+ if (json?.ContactCollection?.length > 0 && json.ContactCollection[0].USSSN != null && json.ContactCollection[0].USSSN.length == 9) {
52
+ const ssn = json.ContactCollection[0].USSSN;
53
+ input.value = `${ssn.substring(0, 3)}-${ssn.substring(3, 5)}-${ssn.substring(5, 9)}`;
54
+
55
+ this.renderRoot.querySelectorAll('i').forEach(i => {
56
+ i.className = 'bi bi-eye-slash';
57
+ });
58
+ }
59
+ }
60
+ });
61
+ } else {
62
+ this.renderRoot.querySelectorAll('input').forEach(input => {
63
+ if (input instanceof HTMLInputElement) input.value = `${this.ssn}`;
64
+
65
+ this.renderRoot.querySelectorAll('i').forEach(i => {
66
+ i.className = 'bi bi-eye';
67
+ });
68
+ });
69
+ }
70
+ }
71
+
72
+ render() {
73
+ return html`<slot>
74
+ <div class="input-group">
75
+ <input type="text" ?disabled=${this.disabled} class="${this.formControlSmallClass}" name="${this.name}" value="${this.ssn}"/>
76
+ <span @click="${this.toggleSSN}" class="input-group-text" style="cursor:pointer;"><i class="bi bi-eye"></i></span>
77
+ </div>
78
+ </slot>`;
79
+ }
80
+ }