Skip to content

Commit 6bf3f4d

Browse files
fix: Fixed styling issues and cancel alert (#362)
Co-authored-by: tumms2021389 <[email protected]>
1 parent 5f0ddea commit 6bf3f4d

File tree

6 files changed

+14
-40
lines changed

6 files changed

+14
-40
lines changed

packages/angular-sdk-components/src/lib/_components/field/cancel-alert/cancel-alert.component.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
<div *ngIf="bShowAlert$" class="psdk-cancel-alert-background">
22
<div class="psdk-cancel-alert-top">
3-
<h3 *ngIf="heading$ != ''">{{ heading$ }}</h3>
3+
<h3>{{ localizedVal('Discard unsaved changes?', localeCategory) }}</h3>
44
<div>
5-
<p>{{ body1$ }}</p>
6-
<p>{{ body2$ }}</p>
5+
<p>{{ localizedVal('You have unsaved changes. You can discard them or go back to keep working.', localeCategory) }}</p>
76
</div>
87
<mat-grid-list cols="2" rowHeight="6.25rem">
98
<mat-grid-tile>
10-
<button mat-raised-button color="secondary" (click)="buttonClick('save')">{{ localizedVal('Save for later', localeCategory) }}</button>
9+
<button mat-raised-button color="secondary" (click)="buttonClick('continue')">{{ localizedVal('Go back', localeCategory) }}</button>
1110
</mat-grid-tile>
1211
<mat-grid-tile>
13-
<button mat-raised-button color="secondary" (click)="buttonClick('continue')">{{ localizedVal('Continue Working', localeCategory) }}</button>
14-
<button mat-raised-button color="primary" (click)="buttonClick('delete')">{{ localizedVal('Delete', localeCategory) }}</button>
12+
<button mat-raised-button color="primary" (click)="buttonClick('discard')">{{ localizedVal('Discard', localeCategory) }}</button>
1513
</mat-grid-tile>
1614
</mat-grid-list>
1715
</div>

packages/angular-sdk-components/src/lib/_components/field/cancel-alert/cancel-alert.component.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
z-index: 9999;
1010
top: 0px;
1111
left: 0px;
12+
background: rgba(0, 0, 0, 0.5);
1213
}
1314

1415
.psdk-cancel-alert-top {
@@ -19,4 +20,5 @@
1920
border-radius: 10px;
2021
padding: 20px;
2122
box-shadow: 0 0 10px 3px var(--app-box-shadow-color);
23+
background-color: var(--mat-sys-surface-container);
2224
}

packages/angular-sdk-components/src/lib/_components/field/cancel-alert/cancel-alert.component.ts

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ export class CancelAlertComponent implements OnChanges {
1515
@Input() bShowAlert$: boolean;
1616
@Output() onAlertState$: EventEmitter<boolean> = new EventEmitter<boolean>();
1717

18-
heading$: string;
19-
body1$: string;
20-
body2$: string;
2118
itemKey: string;
2219
localizedVal: Function;
2320
localeCategory = 'ModalContainer';
@@ -26,28 +23,18 @@ export class CancelAlertComponent implements OnChanges {
2623
ngOnChanges() {
2724
if (this.bShowAlert$) {
2825
this.psService.sendMessage(false);
29-
3026
const contextName = this.pConn$.getContextName();
31-
const caseInfo = this.pConn$.getCaseInfo();
32-
const caseName = caseInfo.getName();
33-
const ID = caseInfo.getID();
3427
this.localizedVal = PCore.getLocaleUtils().getLocaleValue;
35-
3628
this.itemKey = contextName;
37-
this.heading$ = `Delete ${caseName} (${ID})`;
38-
this.body1$ = `${this.localizedVal('Are you sure you want to delete ', this.localeCategory) + caseName} (${ID})?`;
39-
this.body2$ = this.localizedVal('Alternatively, you can continue working or save your work for later.', this.localeCategory);
40-
41-
// this.onAlertState$.emit(true);
4229
}
4330
}
4431

45-
dismissAlert() {
32+
dismissAlertOnly() {
4633
this.bShowAlert$ = false;
4734
this.onAlertState$.emit(false);
4835
}
4936

50-
dismissAlertOnly() {
37+
dismissAlert() {
5138
this.bShowAlert$ = false;
5239
this.onAlertState$.emit(true);
5340
}
@@ -61,26 +48,10 @@ export class CancelAlertComponent implements OnChanges {
6148
this.localizedVal = PCore.getLocaleUtils().getLocaleValue;
6249

6350
switch (sAction) {
64-
case 'save':
65-
this.psService.sendMessage(true);
66-
// eslint-disable-next-line no-case-declarations
67-
const savePromise = actionsAPI.saveAndClose(this.itemKey);
68-
savePromise
69-
.then(() => {
70-
this.psService.sendMessage(false);
71-
this.dismissAlert();
72-
73-
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CASE_CREATED);
74-
})
75-
.catch(() => {
76-
this.psService.sendMessage(false);
77-
this.sendMessage(this.localizedVal('Save failed', this.localeCategory));
78-
});
79-
break;
8051
case 'continue':
8152
this.dismissAlertOnly();
8253
break;
83-
case 'delete':
54+
case 'discard':
8455
this.psService.sendMessage(true);
8556

8657
// eslint-disable-next-line no-case-declarations

packages/angular-sdk-components/src/lib/_components/template/simple-table-manual/simple-table-manual.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ <h3 *ngIf="label" className="label" style="font-weight: bold">
4444
<td mat-cell *matCellDef="let element; index as j">
4545
<div class="header-icon">
4646
<button mat-icon-button [matMenuTriggerFor]="utilityMenu">
47-
<img class="psdk-utility-card-actions-svg-icon" src="{{ settingsSvgIcon$ }}" />
47+
<mat-icon>more_vert</mat-icon>
4848
</button>
4949
<mat-menu #utilityMenu="matMenu" overlapTrigger="false">
5050
<button mat-menu-item (click)="editRecord(element, j)">Edit</button>
@@ -82,7 +82,7 @@ <h3 *ngIf="label" className="label" style="font-weight: bold">
8282
<th mat-header-cell *matHeaderCellDef></th>
8383
<td mat-cell *matCellDef="let element; index as j">
8484
<button id="delete-button" mat-icon-button (click)="deleteRecord(j)">
85-
<img class="psdk-utility-card-action-svg-icon" src="{{ menuIconOverride$ }}" />
85+
<mat-icon>delete</mat-icon>
8686
</button>
8787
</td>
8888
</ng-container>

packages/angular-sdk-components/src/lib/_components/template/simple-table-manual/simple-table-manual.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { MatMenuModule } from '@angular/material/menu';
99
import { MatOptionModule } from '@angular/material/core';
1010
import { MatSelectModule } from '@angular/material/select';
1111
import { MatSort, MatSortModule } from '@angular/material/sort';
12+
import { MatIcon } from '@angular/material/icon';
1213
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
1314
import isEqual from 'fast-deep-equal';
1415

@@ -73,6 +74,7 @@ class Group {
7374
MatOptionModule,
7475
MatSelectModule,
7576
MatInputModule,
77+
MatIcon,
7678
forwardRef(() => ComponentMapperComponent)
7779
],
7880
providers: [DatapageService]

projects/angular-test-app/src/containerStyles.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ app-modal-view-container {
5555
padding: 20px;
5656
box-shadow: 0 0 10px 3px var(--mat-sys-level3);
5757
overflow-y: auto;
58+
max-width: 700px;
5859
}
5960

6061
.psdk-dialog-float {

0 commit comments

Comments
 (0)