From 3b49c39350a9f23f1dba744f25e978faefc7371d Mon Sep 17 00:00:00 2001 From: suvarnakale Date: Tue, 3 Oct 2023 18:56:35 +0530 Subject: [PATCH] #814 - Ownership UI Modifications - Done --- .../admin/ownership/ownership.component.html | 272 +++++++++--------- .../admin/ownership/ownership.component.ts | 80 +++--- src/assets/i18n/global/en-global.json | 6 +- src/assets/i18n/global/hi-global.json | 6 +- 4 files changed, 200 insertions(+), 164 deletions(-) diff --git a/src/app/admin/ownership/ownership.component.html b/src/app/admin/ownership/ownership.component.html index afc91a5..805ebef 100644 --- a/src/app/admin/ownership/ownership.component.html +++ b/src/app/admin/ownership/ownership.component.html @@ -1,159 +1,173 @@
-
-
- {{'HOW_CAN_ENTITIES_LOGIN' | translate}} -
-
-
-
- {{'UNIQUE_FIELD' | translate}}
- -
-
-
-
-
- {{'AUTHENTICATION_TYPE' | translate}}
- -
- -
-
-
-
- - -
-
- -
-
-
-
-
-
-
- - -
-
- -
-
-
- -
-
- -
-
- - +
+
+ {{'HOW_CAN_ENTITIES_LOGIN' | translate}} +
+
+
+
+ {{'FIELD_MAPPING' | translate}}
- -
-
- {{'AUTHENTICATION_TYPE' | translate}}
- -
- -
-
-
-
- - -
- - +
+
+
+
+
+
+
+ + +
+
+ +
+
+
+
+
+
+
+ + +
+
+ +
+
+
-
-
-
-
-
- - -
- - +
+
+
+
+
+ + +
+
+ +
+
+
+
+
+
+
+ + +
+
+ +
+
+
-
-
-
-
- {{'WHO_IS_AUTHORISED_FOR_ISSUANCE' | translate}} -
+
+
+ {{'WHO_IS_AUTHORISED_FOR_ISSUANCE' | translate}} +
- - + +
- +
-
- {{'SELECT_ROLE' | translate}}
+
+ {{'SELECT_ROLE' | translate}}
+
+ + +
+
+
+
-
+
+
+ {{'WHO_IS_AUTHORISED_TO_INVITE_ROLES' | translate}} +
+
+
+
+
+ + +
+
+ + +
+
+ {{'SELECT_ROLE' | translate}}
+ +
+
+
+ + +
+
-
+
\ No newline at end of file diff --git a/src/app/admin/ownership/ownership.component.ts b/src/app/admin/ownership/ownership.component.ts index 31d8429..b0c66b2 100644 --- a/src/app/admin/ownership/ownership.component.ts +++ b/src/app/admin/ownership/ownership.component.ts @@ -19,32 +19,29 @@ export class OwnershipComponent implements OnInit, OnChanges { propertyList = []; propertyNames = []; selectedProperty: any; + entityList: any[]; constructor( private activeRoute: ActivatedRoute, public translate: TranslateService, private fb: FormBuilder, public generalService: GeneralService - ) { + ) { this.ownershipForm = this.fb.group({ - uniqueField: '', primaryLogin: this.fb.group({ - authenticationType: '', - emailCheckbox: false, - emailField: false, - mobilenumberCheckbox: false, - mobilenumberField: '' - }), - alternateLoginCheckbox: false, - alternateLogin: this.fb.group({ - authenticationType: '', + userIDCheckbox : false, + userIDField : '', emailCheckbox: false, emailField: '', mobilenumberCheckbox: false, - mobilenumberField: '' + mobilenumberField: '', + passwordCheckbox:false, + passwordField: '' }), issuer: 'anonymous', - issuerRole: '' + issuerRole: '', + invitee:'anonymous', + inviteRole:'' }) } @@ -52,8 +49,8 @@ export class OwnershipComponent implements OnInit, OnChanges { this.activeRoute.params.subscribe(params => { this.params = params; - if(params.hasOwnProperty('page') && params.page) - this.isSettingMenu = true; + if (params.hasOwnProperty('page') && params.page) + this.isSettingMenu = true; this.entityName = params.entity; }); @@ -76,7 +73,6 @@ export class OwnershipComponent implements OnInit, OnChanges { for (let i = 0; i < res.length; i++) { if (typeof (res[i].schema) == 'string') { res[i].schema = JSON.parse(res[i].schema); - if (!res[i].schema.hasOwnProperty('isRefSchema') && !res[i].schema.isRefSchema) { this.items.push(res[i]); } @@ -87,72 +83,90 @@ export class OwnershipComponent implements OnInit, OnChanges { populateFields() { this.propertyList = []; this.propertyNames = []; - for(let i = 0; i < this.items.length; i++) { - // console.log(this.items[i]); - if(this.items[i]["name"] == this.entityName) { + this.entityList = []; + for (let i = 0; i < this.items.length; i++) { + this.entityList.push(this.items[i].name); + if (this.items[i]["name"] == this.entityName) { let properties = this.items[i]["schema"]["definitions"][this.entityName]["properties"]; + let requiredProperties = this.items[i]["schema"]["definitions"][this.entityName]["required"]; + for(let j=0; j< requiredProperties.length; j++){ + this.propertyNames.push(requiredProperties[j]); + } const keys = Object.keys(properties); keys.forEach((key, index) => { properties[key] = { ...properties[key], "key": key } - this.propertyList.push(properties[key]); - this.propertyNames.push(properties[key].title); + this.propertyList.push(properties[key]); }); + } } } submitOwnershipForm() { - if(this.ownershipForm.value.uniqueField.length === 0) { + if (this.ownershipForm.value.uniqueField.length === 0) { return; } - for(let i = 0; i < this.propertyNames.length; i++) { - if(this.ownershipForm.value.uniqueField === this.propertyNames[i]) { + for (let i = 0; i < this.propertyNames.length; i++) { + if (this.ownershipForm.value.uniqueField === this.propertyNames[i]) { this.selectedProperty = this.propertyList[i]; } } - for(let i = 0; i < this.items.length; i++){ - if(this.entityName === this.items[i].name) { + for (let i = 0; i < this.items.length; i++) { + if (this.entityName === this.items[i].name) { let ownershipObj = {}; let alternateOwnershipObj = {}; let editSchema = this.items[i]["schema"]; editSchema["_osConfig"]["ownershipAttributes"] = []; editSchema["_osConfig"]["uniqueIndexFields"] = []; - - if(this.ownershipForm.value.primaryLogin['emailCheckbox']){ + + if (this.ownershipForm.value.primaryLogin['userIDCheckbox']) { + ownershipObj = { + ...ownershipObj, + "userID": "/" + this.selectedProperty?.key + "/userID" + } + } + if (this.ownershipForm.value.primaryLogin['emailCheckbox']) { ownershipObj = { ...ownershipObj, "email": "/" + this.selectedProperty?.key + "/email" } } - if(this.ownershipForm.value.primaryLogin['mobilenumberCheckbox']){ + if (this.ownershipForm.value.primaryLogin['mobilenumberCheckbox']) { ownershipObj = { ...ownershipObj, "mobile": "/" + this.selectedProperty?.key + "/contact" } } - if(Object.keys(ownershipObj).length !== 0){ + if (this.ownershipForm.value.primaryLogin['passwordCheckbox']) { + ownershipObj = { + ...ownershipObj, + "password": "/" + this.selectedProperty?.key + "/password" + } + } + + if (Object.keys(ownershipObj).length !== 0) { editSchema["_osConfig"]["ownershipAttributes"].push(ownershipObj); editSchema["_osConfig"]["uniqueIndexFields"].push(this.selectedProperty.key); } - if(this.ownershipForm.value.alternateLoginCheckbox && this.ownershipForm.value.alternateLogin['emailCheckbox']){ + if (this.ownershipForm.value.alternateLoginCheckbox && this.ownershipForm.value.alternateLogin['emailCheckbox']) { alternateOwnershipObj = { ...alternateOwnershipObj, "email": "/" + this.selectedProperty?.key + "/email" } } - if(this.ownershipForm.value.alternateLoginCheckbox && this.ownershipForm.value.alternateLogin['mobilenumberCheckbox']){ + if (this.ownershipForm.value.alternateLoginCheckbox && this.ownershipForm.value.alternateLogin['mobilenumberCheckbox']) { alternateOwnershipObj = { ...alternateOwnershipObj, "mobile": "/" + this.selectedProperty?.key + "/contact" } } - if(Object.keys(alternateOwnershipObj).length !== 0){ + if (Object.keys(alternateOwnershipObj).length !== 0) { editSchema["_osConfig"]["ownershipAttributes"].push(alternateOwnershipObj); editSchema["_osConfig"]["uniqueIndexFields"].push(this.selectedProperty.key); } diff --git a/src/assets/i18n/global/en-global.json b/src/assets/i18n/global/en-global.json index 39d04d8..0ba01a6 100644 --- a/src/assets/i18n/global/en-global.json +++ b/src/assets/i18n/global/en-global.json @@ -144,17 +144,21 @@ "COMING_SOON": "Coming Soon", "WHO_IS_AUTHORISED_FOR_ISSUANCE": "Who is authorised for issuance?", + "WHO_IS_AUTHORISED_TO_INVITE_ROLES": "Who Is Authorized to Invite Roles?", "ANONYMOUS": "Anonymous", "ROLE": "Role", + "INVITE_ROLES": "Invite Roles", "ADD_ROLE": "Add Role", "HOW_CAN_ENTITIES_LOGIN": "How can entities login?", "ENTITY_NAME": "Entity Name:", "EDUCATION_BOARD": "Education Board", - "UNIQUE_FIELD": "Unique Field", + "FIELD_MAPPING": "Field Mapping", "PUBLIC": "Public", "AUTHENTICATION_TYPE": "Authentication Type", "OTP": "OTP", "EMAIL": "Email", + "USERID":"UserID", + "PASSWORD":"Password", "SELECT_FIELD": "Select Field", "MOBILE_NUMBER": "Mobile Number", "EDUCATIONBOARD_EMAIL": "educationboard.email", diff --git a/src/assets/i18n/global/hi-global.json b/src/assets/i18n/global/hi-global.json index 62bd14e..37e158d 100644 --- a/src/assets/i18n/global/hi-global.json +++ b/src/assets/i18n/global/hi-global.json @@ -144,18 +144,22 @@ "EDUCATION_RC" : "शिक्षा आरसी", "WHO_IS_AUTHORISED_FOR_ISSUANCE" : "जारी करने के लिए कौन अधिकृत है?", + "WHO_IS_AUTHORISED_TO_INVITE_ROLES":"भूमिकाएँ आमंत्रित करने के लिए कौन अधिकृत है?", "COMING_SOON" : "जल्द आ रहा है", "ANONYMOUS" : "बेनामी", "ROLE" : "भूमिका", + "INVITE_ROLES": "भूमिकाएँ आमंत्रित करें", "ADD_ROLE" : "भूमिका जोड़ें", "HOW_CAN_ENTITIES_LOGIN" : "इकाइयां कैसे लॉगिन कर सकती हैं?", "ENTITY_NAME" : "इकाई का नाम:", "EDUCATION_BOARD" : "शिक्षा बोर्ड", - "UNIQUE_FIELD" : "अद्वितीय क्षेत्र", + "FIELD_MAPPING" : "फ़ील्ड मानचित्रण", "PUBLIC" : "सार्वजनिक", "AUTHENTICATION_TYPE" : "प्रमाणीकरण प्रकार", "OTP" : "ओटीपी", "EMAIL" : "ईमेल", + "USERID":"उपयोगकर्ता पहचान", + "PASSWORD":"पासवर्ड", "SELECT_FIELD" : "फ़ील्ड चुनें", "MOBILE_NUMBER" : "मोबाइल नंबर", "EDUCATIONBOARD_EMAIL" : "शिक्षा.ईमेल",