-
-
![]()
+
+
+
+
+
+
+
+
![]()
+
+
+
+
Share Your Experience
+
Take a quick survey about your recent experience with MediaCo.
+
+
+
-
-
-
Share Your Experience
-
Take a quick survey about your recent experience with MediaCo.
-
-
-
-
+
diff --git a/src/app/_samples/mediaco/components/todo/todo.component.scss b/src/app/_samples/mediaco/components/todo/todo.component.scss
index 0579927a..8cb7d714 100644
--- a/src/app/_samples/mediaco/components/todo/todo.component.scss
+++ b/src/app/_samples/mediaco/components/todo/todo.component.scss
@@ -4,6 +4,7 @@ $text-white: #ffffff;
$btn-text-color: #5c4498;
.banner-container {
+ width: 670px;
font-family: $font-family;
background: linear-gradient(135deg, rgb(103, 80, 164) 0%, rgb(248, 20, 227) 50%, rgb(0, 201, 255) 100%) 0% 0% / 200% 200%;
@@ -20,11 +21,6 @@ $btn-text-color: #5c4498;
text-align: center;
padding: 32px 24px;
}
-
- position: absolute;
- z-index: 10;
- left: 30%;
- top: 15rem;
}
.icon-wrapper {
@@ -46,7 +42,7 @@ $btn-text-color: #5c4498;
flex-grow: 1;
display: flex;
flex-direction: column;
- justify-content: center;
+ align-items: flex-start;
h2 {
margin: 0 0 6px 0;
diff --git a/src/app/_samples/mediaco/components/todo/todo.component.ts b/src/app/_samples/mediaco/components/todo/todo.component.ts
index eabd28c5..a3f691b2 100644
--- a/src/app/_samples/mediaco/components/todo/todo.component.ts
+++ b/src/app/_samples/mediaco/components/todo/todo.component.ts
@@ -1,11 +1,13 @@
-import { Component, OnInit, OnDestroy, Input } from '@angular/core';
+import { Component, OnInit, OnDestroy, Input, ViewContainerRef, ViewChild, TemplateRef } from '@angular/core';
import { CommonModule } from '@angular/common';
+import { TemplatePortal } from '@angular/cdk/portal';
import { MatIcon } from '@angular/material/icon';
import { publicConstants } from '@pega/pcore-pconnect-typedefs/constants';
-import { ProgressSpinnerService } from '@pega/angular-sdk-components';
+import { ProgressSpinnerService, TodoComponent as OOTBTodoComponent } from '@pega/angular-sdk-components';
import { ErrorMessagesService } from '@pega/angular-sdk-components';
import { Utils } from '@pega/angular-sdk-components';
import { updateWorkList } from '@pega/angular-sdk-components';
+import { PortalService } from '../../services/portal.service';
const fetchMyWorkList = (datapage, fields, numberOfRecords, includeTotalCount, context) => {
return PCore.getDataPageUtils()
@@ -57,13 +59,14 @@ interface ToDoProps {
myWorkList?: any;
label?: string;
readOnly?: boolean;
+ isMyWorklistChecked?: boolean;
}
@Component({
- selector: 'app-todo',
+ selector: 'app-mediaco-todo',
templateUrl: './todo.component.html',
styleUrls: ['./todo.component.scss'],
- imports: [CommonModule, MatIcon]
+ imports: [CommonModule, MatIcon, OOTBTodoComponent]
})
export class TodoComponent implements OnInit, OnDestroy {
img = this.utils.getImageSrc('message-circle', this.utils.getSDKStaticContentUrl());
@@ -84,7 +87,12 @@ export class TodoComponent implements OnInit, OnDestroy {
CONSTS: typeof publicConstants;
bLogging = true;
surveyCase: any[];
+ isMyWorklistChecked: boolean | undefined;
+ @ViewChild('mediacoTodo', { read: TemplateRef }) private mediacoTodoTemplate: TemplateRef
;
+
constructor(
+ private portalService: PortalService,
+ private viewContainerRef: ViewContainerRef,
private psService: ProgressSpinnerService,
private erService: ErrorMessagesService,
private utils: Utils
@@ -101,12 +109,22 @@ export class TodoComponent implements OnInit, OnDestroy {
this.updateToDo();
}
+ ngAfterViewInit() {
+ // Create a TemplatePortal from the template and its view context
+ const portal = new TemplatePortal(this.mediacoTodoTemplate, this.viewContainerRef);
+
+ // Set the portal in the shared service
+ this.portalService.setPortal(portal);
+ }
+
ngOnDestroy() {
const { CREATE_STAGE_SAVED, CREATE_STAGE_DELETED } = PCore.getEvents().getCaseEvent();
PCore.getPubSubUtils().unsubscribe(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL, 'updateToDo');
PCore.getPubSubUtils().unsubscribe(CREATE_STAGE_SAVED, CREATE_STAGE_SAVED);
PCore.getPubSubUtils().unsubscribe(CREATE_STAGE_DELETED, CREATE_STAGE_DELETED);
+
+ this.portalService.clearPortal();
}
updateList() {
@@ -120,7 +138,7 @@ export class TodoComponent implements OnInit, OnDestroy {
updateToDo() {
this.configProps$ = this.pConn$.resolveConfigProps(this.pConn$.getConfigProps()) as ToDoProps;
-
+ this.isMyWorklistChecked = this.configProps$?.isMyWorklistChecked;
this.headerText$ = this.headerText$ || this.configProps$.headerText;
this.datasource$ = this.datasource$ || this.configProps$.datasource;
this.myWorkList$ = this.myWorkList$ || this.configProps$.myWorkList;
diff --git a/src/app/_samples/mediaco/services/portal.service.ts b/src/app/_samples/mediaco/services/portal.service.ts
new file mode 100644
index 00000000..f1b0d300
--- /dev/null
+++ b/src/app/_samples/mediaco/services/portal.service.ts
@@ -0,0 +1,32 @@
+import { Injectable } from '@angular/core';
+import { TemplatePortal } from '@angular/cdk/portal';
+import { BehaviorSubject } from 'rxjs';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class PortalService {
+ private portal$ = new BehaviorSubject | null>(null);
+
+ /**
+ * Sets the portal that should be rendered elsewhere.
+ * @param portal The TemplatePortal to be shared.
+ */
+ setPortal(portal: TemplatePortal) {
+ this.portal$.next(portal);
+ }
+
+ /**
+ * Clears the currently set portal.
+ */
+ clearPortal() {
+ this.portal$.next(null);
+ }
+
+ /**
+ * Returns the current portal as an observable.
+ */
+ getPortal() {
+ return this.portal$.asObservable();
+ }
+}