From 822019401322b41c47cbe663e5a5e37c8c3c74f0 Mon Sep 17 00:00:00 2001 From: Abhay Gautam Date: Wed, 8 Oct 2025 18:30:09 +0530 Subject: [PATCH] Added the Confirm and Cancel Button in Center-Type saving --- .../mater-data-common-body.component.ts | 26 ++++- .../app/shared/dialog/dialog.component.html | 17 +++ .../app/shared/dialog/dialog.component.scss | 101 ++++++++++++++++-- .../src/app/shared/dialog/dialog.component.ts | 16 +++ admin-ui/src/assets/config.json | 25 +++-- 5 files changed, 166 insertions(+), 19 deletions(-) diff --git a/admin-ui/src/app/features/masterdata/shared/mater-data-common-body/mater-data-common-body.component.ts b/admin-ui/src/app/features/masterdata/shared/mater-data-common-body/mater-data-common-body.component.ts index 9331fefa..0a1841a7 100644 --- a/admin-ui/src/app/features/masterdata/shared/mater-data-common-body/mater-data-common-body.component.ts +++ b/admin-ui/src/app/features/masterdata/shared/mater-data-common-body/mater-data-common-body.component.ts @@ -781,7 +781,31 @@ export class MaterDataCommonBodyComponent implements OnInit { } } - executeAPI(){ + +executeAPI() { + const typesNeedingConfirmation = ['center-type']; + + let url = this.router.url.split('/')[3]; + if (this.isCreateForm && typesNeedingConfirmation.includes(url)) { + const dialogRef = this.dialog.open(DialogComponent, { + width: '650px', + data: { + case: 'CONFIRM_CREATE', + title: 'Confirm Creation', + message: 'You are about to create a Center Type. Please ensure that all the information is correct.' + } + }); + dialogRef.afterClosed().subscribe(result => { + if (result === true) { + this.performExecuteAPI(); + } + }); + } else { + this.performExecuteAPI(); + } +} + + performExecuteAPI(){ let url = this.router.url.split('/')[3]; this.dataStorageService .getSpecFileForMasterDataEntity(this.mapping.specFileName) diff --git a/admin-ui/src/app/shared/dialog/dialog.component.html b/admin-ui/src/app/shared/dialog/dialog.component.html index 4468206d..b024cddf 100644 --- a/admin-ui/src/app/shared/dialog/dialog.component.html +++ b/admin-ui/src/app/shared/dialog/dialog.component.html @@ -302,4 +302,21 @@

{{ "filters.titleTxt" | translate }}

+ +
+

{{ title }}

+ +

{{ message }}

+
+ + + + + +
+ \ No newline at end of file diff --git a/admin-ui/src/app/shared/dialog/dialog.component.scss b/admin-ui/src/app/shared/dialog/dialog.component.scss index 87259154..16ffef15 100644 --- a/admin-ui/src/app/shared/dialog/dialog.component.scss +++ b/admin-ui/src/app/shared/dialog/dialog.component.scss @@ -1,4 +1,4 @@ -.table-spacer > tr > td { +.table-spacer>tr>td { padding: 5px; } @@ -11,14 +11,17 @@ font-family: "Roboto", sans-serif; font-size: 12px; } -.flex-container > .mat-form-field { + +.flex-container>.mat-form-field { width: 50%; padding: 4px 20px !important; } -.flex-container > .mat-option-text { + +.flex-container>.mat-option-text { font-family: "Roboto", sans-serif; font-size: 12px !important; } + .filter-heading { line-height: 14px; font-family: "Roboto", sans-serif; @@ -30,9 +33,11 @@ .date-header { margin-left: 15px; } + h5 { margin: 5px; } + .footer { display: flex; justify-content: flex-end; @@ -41,6 +46,7 @@ h5 { background-color: rgb(233, 233, 233); padding: 4px 15px; } + .footer-button { border: 0.8px solid #FF4081; border-radius: 2px; @@ -57,6 +63,7 @@ h5 { display: flex; margin: 120px; } + .mat-dialog-container { border-radius: 0; padding: 0; @@ -64,36 +71,41 @@ h5 { .mat-dialog-actions { justify-content: flex-end; - height:61px; + height: 61px; } // Confirmation popup .mat-dialog-title { font-weight: 600; - font-family:"Roboto", sans-serif; + font-family: "Roboto", sans-serif; font-size: 16px; } + .pop-up { .pop-up-header { padding: 16px !important; } + .mat-dialog-content { margin: 0 !important; padding: 0 !important; - font-family:"Roboto", sans-serif; + font-family: "Roboto", sans-serif; font-size: small; } - .pop-up-footer { + + .pop-up-footer { background: #e6e7e7; margin-bottom: 0px; padding: 0 16px; + .mat-button { - outline: 1px solid #FF4081 !important; + outline: 1px solid #ff4081 !important; margin: 0 10px; border-radius: 0; color: #FF4081; } } + .pop-up-footer { .mat-button:focus { background: #FF4081 !important; @@ -102,6 +114,7 @@ h5 { } } } + .table-container { overflow: auto; width: 100%; @@ -133,6 +146,7 @@ th.mat-header-cell { text-align: center; white-space: nowrap; } + tr:nth-child(odd) { background-color: #e8e9e9; } @@ -143,9 +157,11 @@ td.mat-footer-cell { border-bottom-width: 1px; border-bottom-style: solid; } + th.mat-header-cell { padding: 2px; } + td.mat-cell { text-align: center; font-family: "Roboto", sans-serif; @@ -155,6 +171,7 @@ td.mat-cell { font-weight: 200; color: #0f2126; } + th.mat-header-cell:first-child, td.mat-cell:first-child, td.mat-footer-cell:first-child { @@ -166,6 +183,7 @@ td.mat-cell:last-child, td.mat-footer-cell:last-child { padding-right: 16px; } + .table-header { background-color: #e6e7e7; color: #54595a; @@ -177,6 +195,7 @@ td.mat-footer-cell:last-child { height: 28px; font-weight: 600; } + .container { overflow: auto; width: 100%; @@ -194,39 +213,47 @@ td.mat-footer-cell:last-child { top: 0; z-index: 10; } + .mat-menu { border-radius: 0 !important; } + :host::ng-deep .mat-menu-content { padding-top: 0 !important; padding-bottom: 0 !important; } -.mat-menu-item{ - line-height:20px; - height:30px; +.mat-menu-item { + line-height: 20px; + height: 30px; font-size: x-small; font-family: "Roboto", sans-serif; } + .sort-icon { padding-top: 3px; margin-left: 3px; cursor: pointer !important; } + .ellipsis-button { transform: scale(0.8); } + .flex-display { display: inline-flex; align-items: center; } + .text-alignment { text-align: left !important; } + .columnName-sort-span { display: inline-flex; align-items: center; } + .image-fade { opacity: 0.2; } @@ -235,3 +262,55 @@ caption { font-size: 1.2em; font-weight: bold; } + +.confirmation-container { + padding: 0; + font-family: "Roboto", sans-serif; +} + +.confirmation-container .mat-dialog-title { + font-weight: 600; + font-size: 16px; + color: #0f2126; + padding: 20px 24px 0 24px; + margin-bottom: 12px; +} + +.confirmation-container .mat-dialog-content { + margin: 0; + padding: 0 24px; + padding-bottom: 20px; + font-size: 14px; + line-height: 1.6; + color: #54595a; +} + +.confirmation-container .mat-dialog-actions { + background-color: #e6e7e7; + justify-content: flex-end; + height: auto; + gap: 12px; + margin: 0; + padding: 16px 24px; +} + +.confirmation-container .mat-dialog-actions button { + border-radius: 2px; + font-weight: 500; + min-width: 90px; +} + +.confirmation-container .mat-dialog-actions .mat-flat-button { + background-color: #FF4081; + color: #ffffff; +} + +.confirmation-container .mat-dialog-actions .mat-stroked-button { + border: 1px solid #FF4081; + color: #FF4081; +} + +.confirmation-container .mat-dialog-actions .mat-stroked-button:hover, +.confirmation-container .mat-dialog-actions .mat-stroked-button.cdk-focused { + background-color: rgba(255, 64, 129, 0.08); +} \ No newline at end of file diff --git a/admin-ui/src/app/shared/dialog/dialog.component.ts b/admin-ui/src/app/shared/dialog/dialog.component.ts index 84d4f196..153ccca8 100644 --- a/admin-ui/src/app/shared/dialog/dialog.component.ts +++ b/admin-ui/src/app/shared/dialog/dialog.component.ts @@ -52,6 +52,10 @@ export class DialogComponent implements OnInit { rangeError = false; fieldName = ''; + showConfirmCancelButtons = false; + title = ''; + message = ''; + cancelApplied = false; filterOptions: any = {}; @@ -95,6 +99,14 @@ export class DialogComponent implements OnInit { if (this.input.case === 'STEPS-MESSAGE') { await this.getStepsForCreateUpate(); } + if (this.input.case === 'CONFIRM_CREATE') { + this.title = this.input.title || 'Confirm Creation'; + this.message = + this.input.message || + 'You are about to create a Center Type. Please ensure that all the information is correct.'; + this.showConfirmCancelButtons = true; +} + } get f() { @@ -508,4 +520,8 @@ export class DialogComponent implements OnInit { }); }); } + closeDialog(result?: boolean): void { + this.dialogRef.close(result); + } + } diff --git a/admin-ui/src/assets/config.json b/admin-ui/src/assets/config.json index 69da51a4..ab25da12 100644 --- a/admin-ui/src/assets/config.json +++ b/admin-ui/src/assets/config.json @@ -1,10 +1,21 @@ { + "baseUrl": "https://api-internal.niraqa.idencode.link/v1/", + "proxyUrl" : "https://cors-anywhere.herokuapp.com/", + "adminUrl": "/", "primaryLangCode": "eng", - "secondaryLangCode": "ara", - "baseUrl": "https://dev.mosip.net/v1/", - "adminUrl":"/admin-ui/", - "templateRepoUrl":"/admin-ui/templates/", - "validateToken": "admin/authorize/admin/validateToken", + "secondaryLangCode": "fra", + "validateToken": "authmanager/authorize/admin/validateToken", "login": "admin/login/", - "logout": "admin/logout/user" -} + "logout": "admin/logout/user", + "templateRepoUrl": "/templates/", + "supportedLanguages": " eng,", + "leftToRightOrientation": "eng", + "filterValueMaxCount": "{\"default\":20,\"registrationcenters\":500,\"locations\":300}", + "countryCode": "UGA", + "locationHierarchyLevel": "5", + "rightToLeftOrientation": "ara", + "version": "LTS", + "optionalLanguages": "", + "filterValueMaxRecords": "20", + "mandatoryLanguages": "eng" +} \ No newline at end of file