diff --git a/admin-ui/src/app/features/masterdata/document-category-mapping/document-category-mapping.component.html b/admin-ui/src/app/features/masterdata/document-category-mapping/document-category-mapping.component.html index 5f3373fad95..0c11ea84919 100644 --- a/admin-ui/src/app/features/masterdata/document-category-mapping/document-category-mapping.component.html +++ b/admin-ui/src/app/features/masterdata/document-category-mapping/document-category-mapping.component.html @@ -71,7 +71,7 @@

{{'masterData.doc-category-mapping'|translate}}

- + 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 9ab93b5b93d..fb7083a4860 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 @@ -910,7 +910,7 @@ export class MaterDataCommonBodyComponent implements OnInit { this.dataStorageService.updateData(request).subscribe(updateResponse => { if (!updateResponse.errors) { if(textToValidate){ - this.secondaryData["code"] = updateResponse.response.code; + // this.secondaryData["code"] = updateResponse.response.code; if(updateResponse.response.id && url !== "dynamicfields"){ this.secondaryData["id"] = updateResponse.response.id; } diff --git a/admin-ui/src/app/features/resources/center/center-header/center-header.component.html b/admin-ui/src/app/features/resources/center/center-header/center-header.component.html index aa2e96e84d7..29aa72767cb 100644 --- a/admin-ui/src/app/features/resources/center/center-header/center-header.component.html +++ b/admin-ui/src/app/features/resources/center/center-header/center-header.component.html @@ -7,9 +7,11 @@
+

{{'center.center-name'|translate}}: {{headerData.name}}

{{'center.center-id'|translate}}:  {{headerData.id}}

{{'center.status'|translate}}:  {{headerData.isActive | status}}

+
diff --git a/admin-ui/src/app/features/resources/center/center-header/center-header.component.ts b/admin-ui/src/app/features/resources/center/center-header/center-header.component.ts index cb39ab623b6..e805809a98f 100644 --- a/admin-ui/src/app/features/resources/center/center-header/center-header.component.ts +++ b/admin-ui/src/app/features/resources/center/center-header/center-header.component.ts @@ -14,6 +14,7 @@ import { CenterModel } from 'src/app/core/models/center.model'; import { HeaderService } from 'src/app/core/services/header.service'; import * as appConstants from '../../../../app.constants'; +import { Router } from '@angular/router'; @Component({ selector: 'app-center-header', @@ -22,7 +23,7 @@ import * as appConstants from '../../../../app.constants'; }) export class CenterHeaderComponent implements OnInit, OnChanges { actionButtonElipses = new Array(); - + router; lang: string; @Input() headerData: HeaderModel; @@ -32,9 +33,12 @@ export class CenterHeaderComponent implements OnInit, OnChanges { private dataSerice: DataStorageService, private appService: AppConfigService, private headerService: HeaderService, - private commonService: CommonService + private commonService: CommonService, + private _router: Router + ) { this.lang = headerService.getUserPreferredLanguage(); + this.router = _router.url; } ngOnInit() {} diff --git a/admin-ui/src/app/features/resources/center/create/create.component.html b/admin-ui/src/app/features/resources/center/create/create.component.html index 073910fc7f8..9ba5053c669 100644 --- a/admin-ui/src/app/features/resources/center/create/create.component.html +++ b/admin-ui/src/app/features/resources/center/create/create.component.html @@ -499,7 +499,7 @@

{{ "center.operational-details" | translate }}

- {{ data.exceptionHolidayDate }} + {{ data.exceptionHolidayDate }}
+ +
@@ -13,8 +14,7 @@
{{ "center.language" | translate }} keyboard
@@ -109,7 +109,7 @@

{{ "center.location-details" | translate }}

- @@ -129,8 +129,7 @@

{{ "center.location-details" | translate }}

{{ secondaryLanguageLabels["language"] }} keyboard
@@ -256,12 +255,10 @@

{{ secondaryLanguageLabels["location-details"] }}

- -
- + {{ fieldName }} @@ -641,7 +639,7 @@

{{ "center.operational-details" | translate }}


{{ "center.workingDays" | translate }} - +
@@ -673,7 +671,7 @@

{{ "center.operational-details" | translate }}

- {{ data.exceptionHolidayDate }} + {{ data.exceptionHolidayDate }}
; @ViewChildren('keyboardRef', { read: ElementRef }) @@ -91,7 +91,7 @@ export class EditComponent { secondaryKeyboard: string; keyboardType: string; subscribed: any; - days = []; + days = []; holidayDate: any; minDate = new Date(); locCode = 0; @@ -99,6 +99,8 @@ export class EditComponent { localeDtFormat = ""; locationFieldNameList: string[] = []; dynamicFieldValue = {}; + showSpinner = false; + showUpdateButton = null; constructor( private location: Location, private translateService: TranslateService, @@ -115,16 +117,16 @@ export class EditComponent { private dateAdapter: DateAdapter ) { this.subscribed = router.events.subscribe(event => { - if (event instanceof NavigationEnd) { + if (event instanceof NavigationEnd) { this.initializeComponent(); } }); this.initialLocationCode = this.appConfigService.getConfig()['countryCode']; this.locCode = this.appConfigService.getConfig()['locationHierarchyLevel']; - + this.disablePrimaryForm = true; this.disableSecondaryForm = true; - + //load all supported languages this.supportedLanguages = []; let supportedLanguagesArr = this.appConfigService.getConfig()['supportedLanguages'].split(','); @@ -139,11 +141,11 @@ export class EditComponent { console.log(`loadLanguages: primary: ${primaryLangCode}`); // Set the primary language this.primaryLang = this.headerService.getUserPreferredLanguage(); - this.translateService.use(this.primaryLang); + this.translateService.use(this.primaryLang); //Set the "Select Language" dropdown options this.selectLanguagesArr = []; let otherLangsArr = this.supportedLanguages.filter(lang => lang !== this.primaryLang); - if(otherLangsArr.length > 0){ + if (otherLangsArr.length > 0) { otherLangsArr.forEach((language) => { if (defaultJson.languages && defaultJson.languages[language]) { this.selectLanguagesArr.push({ @@ -155,8 +157,9 @@ export class EditComponent { //Set the secondary language this.secondaryLang = this.selectLanguagesArr[0]["code"]; this.primaryLang === this.secondaryLang ? this.showSecondaryForm = false : this.showSecondaryForm = true; - }else{ + } else { this.showSecondaryForm = false; + this.showSpinner = false; } //Set the keyboard mapping this.primaryKeyboard = defaultJson.keyboardMapping[this.primaryLang]; @@ -164,7 +167,7 @@ export class EditComponent { // Set the language orientation LTR or RTL this.isPrimaryLangRTL = false; this.isSecondaryLangRTL = false; - if(this.appConfigService.getConfig()['rightToLeftOrientation']){ + if (this.appConfigService.getConfig()['rightToLeftOrientation']) { let allRTLLangs = this.appConfigService.getConfig()['rightToLeftOrientation'].split(','); let filteredList = allRTLLangs.filter(langCode => langCode == this.primaryLang); if (filteredList.length > 0) { @@ -193,7 +196,7 @@ export class EditComponent { }); //load all the dropdowns //this.loadLocationData(this.initialLocationCode, 'region'); - this.getRegistrationCenterTypes(); + this.getRegistrationCenterTypes(); this.getHolidayZoneData(); this.getProcessingTime(); this.getTimeSlots(); @@ -204,7 +207,7 @@ export class EditComponent { this.setLocaleForDatePicker(localeId); } - lessThanEqual(locCode, index){ + lessThanEqual(locCode, index) { return index <= locCode; } @@ -219,10 +222,10 @@ export class EditComponent { this.auditService.audit(8, centerSpecFile.auditEventIds[1], 'centers'); this.filteredLanguages = this.supportedLanguages; this.getPrimaryPanelData(this.primaryLang); - }); + }); } - setLocaleForDatePicker = (localeId) => { + setLocaleForDatePicker = (localeId) => { this.dateAdapter.setLocale(localeId); let localeDtFormat = moment.localeData(localeId).longDateFormat('L'); this.translateService.get('demographic.date_yyyy').subscribe((year: string) => { @@ -250,8 +253,8 @@ export class EditComponent { localeDtFormat = localeDtFormat.replace(/D/g, dayLabel); } this.localeDtFormat = localeDtFormat; - }); - }); + }); + }); }); } @@ -280,13 +283,13 @@ export class EditComponent { let regionReq = [], provinceReq = [], cityReq = [], laaReq = [], postalCodeReq = []; if (1 <= this.locCode) { regionReq = [Validators.required]; - } if(2 <= this.locCode) { + } if (2 <= this.locCode) { provinceReq = [Validators.required]; - } if(3 <= this.locCode) { + } if (3 <= this.locCode) { cityReq = [Validators.required]; - } if(4 <= this.locCode) { + } if (4 <= this.locCode) { laaReq = [Validators.required]; - } if(5 <= this.locCode) { + } if (5 <= this.locCode) { postalCodeReq = [Validators.required]; } this.commonForm = this.formBuilder.group({ @@ -309,7 +312,7 @@ export class EditComponent { holidayZone: ['', [Validators.required]], workingHours: [{ value: '', disabled: true }], noKiosk: [ - { value: 0}, + { value: 0 }, [Validators.required, Validators.min(0), ValidateKiosk] ], processingTime: ['', [Validators.required]], @@ -337,24 +340,24 @@ export class EditComponent { getLeafZoneData() { this.dataStorageService - .getLeafZoneData(this.primaryLang) - .subscribe(response => { - //console.log(response); - this.dropDownValues.zone.primary = response.response; - if (this.dropDownValues.zone.primary.length === 1) { - this.commonForm.controls.zone.setValue( - this.dropDownValues.zone.primary[0].code - ); - this.commonForm.controls.zone.disable(); - } - }); + .getLeafZoneData(this.primaryLang) + .subscribe(response => { + //console.log(response); + this.dropDownValues.zone.primary = response.response; + if (this.dropDownValues.zone.primary.length === 1) { + this.commonForm.controls.zone.setValue( + this.dropDownValues.zone.primary[0].code + ); + this.commonForm.controls.zone.disable(); + } + }); } - getWorkingDays(){ + getWorkingDays() { this.dataStorageService .getWorkingDays(this.primaryLang) - .subscribe(response => { - this.days = response["response"]["workingdays"] + .subscribe(response => { + this.days = response["response"]["workingdays"] }); } @@ -372,7 +375,7 @@ export class EditComponent { this.centerRequest ); this.data[0] = null; - + this.showSpinner = true; this.centerService.getRegistrationCentersDetails(request).subscribe( response => { if (response.response.data) { @@ -399,7 +402,8 @@ export class EditComponent { let newLanguageCode = filter[0]; if (this.data[0] == null) { this.getPrimaryPanelData(newLanguageCode); - } + + } } } }, @@ -407,7 +411,7 @@ export class EditComponent { ); } - async getSecondaryPanelData (language: string) { + async getSecondaryPanelData(language: string) { const filter = new FilterModel('id', 'equals', this.centerId); this.centerRequest.filters = [filter]; this.centerRequest.languageCode = language; @@ -423,20 +427,24 @@ export class EditComponent { .getRegistrationCentersDetails(request) .subscribe(secondaryResponse => { if (secondaryResponse.response.data) { + this.showUpdateButton = true; this.data[1] = secondaryResponse.response.data ? secondaryResponse.response.data[0] : null; this.setSecondaryFormValues(); this.disableSecondaryForm = false; + this.showSpinner = false; } else { - this.disableSecondaryForm = false; + this.showUpdateButton = false; + this.disableSecondaryForm = false; + this.showSpinner = false; //this.showErrorPopup(); } }, - //error => this.showErrorPopup() - ); + //error => this.showErrorPopup() + ); } - + showErrorPopup() { this.dialog .open(DialogComponent, { @@ -464,7 +472,7 @@ export class EditComponent { this.secondaryForm.controls["selectLanguage"].setValue(this.secondaryLang); //this.submitSecondaryPanel(selectedNewLangCode); this.submitSecondaryPanel(); - } + } if (!this.secondaryForm.valid) { this.secondaryForm.controls["selectLanguage"].setValue(this.secondaryLang); for (const i in this.secondaryForm.controls) { @@ -473,10 +481,10 @@ export class EditComponent { } } } - } + } else { this.reloadSecondaryFormWithNewLang(selectedNewLangCode); - } + } } reloadSecondaryFormWithNewLang = (selectedNewLangCode: string) => { @@ -492,10 +500,10 @@ export class EditComponent { this.data[1] = null; } this.translateService - .getTranslation(this.secondaryLang) - .subscribe(response => { - this.secondaryLanguageLabels = response.center; - }); + .getTranslation(this.secondaryLang) + .subscribe(response => { + this.secondaryLanguageLabels = response.center; + }); this.initializeSecondaryForm(); this.auditService.audit(8, centerSpecFile.auditEventIds[1], 'centers') this.secondaryForm.controls.selectLanguage.setValue( @@ -546,7 +554,7 @@ export class EditComponent { let commonData = this.data[0]; this.commonForm.controls.centerTypeCode.setValue( commonData.centerTypeCode - ); + ); this.commonForm.controls.contactPhone.setValue(commonData.contactPhone); this.commonForm.controls.longitude.setValue(commonData.longitude); this.commonForm.controls.latitude.setValue(commonData.latitude); @@ -579,7 +587,7 @@ export class EditComponent { Utils.convertTimeTo12Hours(commonData.lunchEndTime) ); this.commonForm.controls.workingDays.setValue(commonData.workingNonWorkingDays ? - this.reverseFormatWorkingDays(commonData.workingNonWorkingDays) : []); + this.reverseFormatWorkingDays(commonData.workingNonWorkingDays) : []); //console.log("commonData.workingNonWorkingDays>>>"+JSON.stringify(commonData.workingNonWorkingDays)+"<<>>"+this.commonForm.controls.workingDays.value); this.commonForm.controls.exceptionalHolidays.setValue( commonData.exceptionalHolidayPutPostDto ? [...commonData.exceptionalHolidayPutPostDto] : []); @@ -588,7 +596,7 @@ export class EditComponent { this.validateAndLoadLunchStartTime(); this.validateAndLoadLunchEndTime(); } - + formatWorkingDays(selectedDays: string[]) { const obj = {}; this.days.forEach(day => { @@ -629,18 +637,18 @@ export class EditComponent { primaryObject ); this.dataStorageService - .updateCenterLangData(primaryRequest) - .subscribe(updateResponse => { + .updateCenterLangData(primaryRequest) + .subscribe(updateResponse => { if (!updateResponse.errors) { this.showMessage('update-success', primaryObject) - .afterClosed() - .subscribe(() => { - this.router.navigateByUrl(`/admin/resources/centers/single-view/${this.centerId}`); - }); - } else { - this.showMessage('update-error', updateResponse); - } - }); + .afterClosed() + .subscribe(() => { + this.router.navigateByUrl(`/admin/resources/centers/single-view/${this.centerId}`); + }); + } else { + this.showMessage('update-error', updateResponse); + } + }); } updateSecondaryPanelData() { @@ -660,22 +668,22 @@ export class EditComponent { secondaryObject ); this.dataStorageService - .updateCenterLangData(secondaryRequest) - .subscribe(updateResponse => { + .updateCenterLangData(secondaryRequest) + .subscribe(updateResponse => { if (!updateResponse.errors) { this.showMessage('update-success', secondaryObject) - .afterClosed() - .subscribe(() => { - this.router.navigateByUrl(`/admin/resources/centers/single-view/${this.centerId}`); - }); - } else { - this.showMessage('update-error', updateResponse); - } - }); + .afterClosed() + .subscribe(() => { + this.router.navigateByUrl(`/admin/resources/centers/single-view/${this.centerId}`); + }); + } else { + this.showMessage('update-error', updateResponse); + } + }); } updateCommonData() { - console.log("this.commonForm.controls.workingDays.value>>>"+this.dynamicFieldValue[this.locationFieldNameList[this.locCode-1]]); - console.log("this.commonForm.controls.workingDays.value>>>"+JSON.stringify(this.dynamicFieldValue)); + console.log("this.commonForm.controls.workingDays.value>>>" + this.dynamicFieldValue[this.locationFieldNameList[this.locCode - 1]]); + console.log("this.commonForm.controls.workingDays.value>>>" + JSON.stringify(this.dynamicFieldValue)); this.createUpdate = true; /*let locationCode = ""; if (1 == this.locCode) { @@ -696,7 +704,7 @@ export class EditComponent { this.commonForm.controls.contactPhone.value, this.commonForm.controls.holidayZone.value, this.commonForm.controls.latitude.value, - this.dynamicFieldValue[this.locationFieldNameList[this.locCode-1]], + this.dynamicFieldValue[this.locationFieldNameList[this.locCode - 1]], this.commonForm.controls.longitude.value, Utils.convertTime(this.commonForm.controls.lunchEndTime.value), Utils.convertTime(this.commonForm.controls.lunchStartTime.value), @@ -721,10 +729,10 @@ export class EditComponent { nonLangFieldsObject["name"] = this.data[0].name; } this.showMessage('update-success', nonLangFieldsObject) - .afterClosed() - .subscribe(() => { - this.router.navigateByUrl(`/admin/resources/centers/single-view/${this.centerId}`); - }); + .afterClosed() + .subscribe(() => { + this.router.navigateByUrl(`/admin/resources/centers/single-view/${this.centerId}`); + }); } else { this.showMessage('update-error', updateResponse); } @@ -733,15 +741,15 @@ export class EditComponent { showMessage(type: string, data?: any) { let message = ""; - if(type === 'create-success' || type === 'update-success'){ + if (type === 'create-success' || type === 'update-success') { message = this.popupMessages[type].message[0] + data.id + this.popupMessages[type].message[1] + data.name; - }else{ - if(data.errors[0].errorCode === "KER-MSD-999"){ + } else { + if (data.errors[0].errorCode === "KER-MSD-999") { data.errors.forEach((element) => { - message = message + element.message.toString() +"\n\n"; + message = message + element.message.toString() + "\n\n"; }); - message = this.serverError[data.errors[0].errorCode] +"\n\n"+ message; - }else{ + message = this.serverError[data.errors[0].errorCode] + "\n\n" + message; + } else { message = this.serverError[data.errors[0].errorCode]; } } @@ -750,7 +758,7 @@ export class EditComponent { data: { case: 'MESSAGE', title: this.popupMessages[type].title, - message:message, + message: message, btnTxt: this.popupMessages[type].btnTxt } }); @@ -799,33 +807,33 @@ export class EditComponent { }); }*/ - loadLocationDropDownsDynamicallyForUpdate() { - if(this.locationFieldNameList && this.data[0]) + loadLocationDropDownsDynamicallyForUpdate() { + if (this.locationFieldNameList && this.data[0]) for (let i = 0; i < this.locationFieldNameList.length; i++) { - this.loadLocationDataDynamically({"value":this.data[0].location[i+1]}, i); - if(this.data[0]) - this.dynamicFieldValue[this.locationFieldNameList[i]] = this.data[0].location[i+1]; + this.loadLocationDataDynamically({ "value": this.data[0].location[i + 1] }, i); + if (this.data[0]) + this.dynamicFieldValue[this.locationFieldNameList[i]] = this.data[0].location[i + 1]; } } - loadLocationDataDynamically(event:any, index: any){ - let locationCode = ""; - let fieldName = ""; - let self = this; - if(event === ""){ + loadLocationDataDynamically(event: any, index: any) { + let locationCode = ""; + let fieldName = ""; + let self = this; + if (event === "") { fieldName = this.locationFieldNameList[parseInt(index)]; locationCode = this.initialLocationCode; - }else{ - fieldName = this.locationFieldNameList[parseInt(index)+1]; - locationCode = event.value; + } else { + fieldName = this.locationFieldNameList[parseInt(index) + 1]; + locationCode = event.value; this.dynamicFieldValue[this.locationFieldNameList[parseInt(index)]] = event.value; - } + } this.dataStorageService - .getImmediateChildren(locationCode, this.primaryLang) - .subscribe(response => { - if(response['response']) - self.dynamicDropDown[fieldName] = response['response']['locations']; - }); + .getImmediateChildren(locationCode, this.primaryLang) + .subscribe(response => { + if (response['response']) + self.dynamicDropDown[fieldName] = response['response']['locations']; + }); } submitPrimaryPanel() { @@ -963,7 +971,7 @@ export class EditComponent { this.dataStorageService.getStubbedDataForDropdowns(this.primaryLang).subscribe(response => { if (response.response.locations) { this.dropDownValues.holidayZone.primary = - response.response.locations; + response.response.locations; } }); } @@ -974,18 +982,18 @@ export class EditComponent { self.locationFieldNameList = []; self.dataStorageService.getLocationHierarchyLevels(self.primaryLang).subscribe(response => { response.response.locationHierarchyLevels.forEach(function (value) { - if(value.hierarchyLevel != 0) - if(value.hierarchyLevel <= self.locCode) - self.locationFieldNameList.push(value.hierarchyLevelName); - }); - for(let value of self.locationFieldNameList) { - self.dynamicDropDown[value] = []; + if (value.hierarchyLevel != 0) + if (value.hierarchyLevel <= self.locCode) + self.locationFieldNameList.push(value.hierarchyLevelName); + }); + for (let value of self.locationFieldNameList) { + self.dynamicDropDown[value] = []; self.dynamicFieldValue[value] = ""; } self.loadLocationDataDynamically("", 0); self.loadLocationDropDownsDynamicallyForUpdate(); //self.loadLocationData(self.initialLocationCode, 'region'); - }); + }); } getRegistrationCenterTypes() { @@ -1049,7 +1057,7 @@ export class EditComponent { if (this.commonForm.controls.startTime.value !== "" && this.commonForm.controls.startTime.valid) { const x = [...this.allSlots]; let startIndex = x.indexOf(this.commonForm.controls.startTime.value) + 1; - if (this.commonForm.controls.lunchStartTime.value != this.commonForm.controls.lunchEndTime.value + if (this.commonForm.controls.lunchStartTime.value != this.commonForm.controls.lunchEndTime.value && this.commonForm.controls.lunchEndTime.value !== '' && this.commonForm.controls.lunchEndTime.valid) { const endIndex = x.indexOf(this.commonForm.controls.lunchEndTime.value); this.dropDownValues.lunchStartTime = x.slice(startIndex, endIndex); @@ -1074,14 +1082,14 @@ export class EditComponent { if (this.commonForm.controls.endTime.value !== "" && this.commonForm.controls.endTime.valid) { const x = [...this.allSlots]; const endIndex = x.indexOf(this.commonForm.controls.endTime.value); - if (this.commonForm.controls.lunchStartTime.value != this.commonForm.controls.lunchEndTime.value + if (this.commonForm.controls.lunchStartTime.value != this.commonForm.controls.lunchEndTime.value && this.commonForm.controls.lunchStartTime.value !== '' && this.commonForm.controls.lunchStartTime.valid) { const startIndex = x.indexOf(this.commonForm.controls.lunchStartTime.value) + 1; - this.dropDownValues.lunchEndTime = x.slice(startIndex, endIndex); + this.dropDownValues.lunchEndTime = x.slice(startIndex, endIndex); } else { const startIndex = x.indexOf(this.commonForm.controls.startTime.value) + 1; this.dropDownValues.lunchEndTime = x.slice(startIndex, endIndex); - } + } } // else { // this.dialog.open(DialogComponent, { diff --git a/admin-ui/src/app/features/resources/users/users-header/users-header.component.html b/admin-ui/src/app/features/resources/users/users-header/users-header.component.html index da56e21905a..cf2186defac 100644 --- a/admin-ui/src/app/features/resources/users/users-header/users-header.component.html +++ b/admin-ui/src/app/features/resources/users/users-header/users-header.component.html @@ -20,20 +20,15 @@

{{'center.updated-by'|translate}}: {{headerData.updatedBy}}

- - - - + + +
\ No newline at end of file diff --git a/admin-ui/src/app/features/resources/users/users-header/users-header.component.ts b/admin-ui/src/app/features/resources/users/users-header/users-header.component.ts index 23edcfa1a1c..0720e9ea4ec 100644 --- a/admin-ui/src/app/features/resources/users/users-header/users-header.component.ts +++ b/admin-ui/src/app/features/resources/users/users-header/users-header.component.ts @@ -10,6 +10,7 @@ import { AppConfigService } from 'src/app/app-config.service'; import { CommonService } from 'src/app/core/services/common.service'; import { MachineModel } from 'src/app/core/models/machine.model'; import * as appConstants from '../../../../app.constants'; +import { HeaderService } from 'src/app/core/services/header.service'; @Component({ selector: 'app-users-header', @@ -25,9 +26,11 @@ export class UsersHeaderComponent implements OnInit { constructor( private dataSerice: DataStorageService, private appService: AppConfigService, - private commonService: CommonService + private commonService: CommonService, + private headerService: HeaderService, + ) { - this.lang = appService.getConfig()['primaryLangCode']; + this.lang = this.headerService.getUserPreferredLanguage();; } ngOnInit() { diff --git a/admin-ui/src/app/features/resources/users/view/view.component.html b/admin-ui/src/app/features/resources/users/view/view.component.html index 18f63a277a0..c5b8adc8903 100644 --- a/admin-ui/src/app/features/resources/users/view/view.component.html +++ b/admin-ui/src/app/features/resources/users/view/view.component.html @@ -17,6 +17,7 @@ > { console.log(response); @@ -74,7 +75,8 @@ export class ViewComponent implements OnInit { getUserConfigs() { let url = this.router.url.split('/')[3]; - if(url === "zoneuser"){ + if (url === "zoneuser") { + this.isUserMatMenu = true; this.displayedColumns = ZoneUserConfig.columnsToDisplay; this.actionButtons = ZoneUserConfig.actionButtons.filter( value => value.showIn.toLowerCase() === 'ellipsis' @@ -83,16 +85,17 @@ export class ViewComponent implements OnInit { value => value.showIn.toLowerCase() === 'button' ); this.paginatorOptions = ZoneUserConfig.paginator; - }else{ + } else { + this.isUserMatMenu = false; this.displayedColumns = userConfig.columnsToDisplay; - this.actionButtons = userConfig.actionButtons.filter( - value => value.showIn.toLowerCase() === 'ellipsis' - ); - this.actionEllipsis = userConfig.actionButtons.filter( - value => value.showIn.toLowerCase() === 'button' - ); - this.paginatorOptions = userConfig.paginator; - } + // this.actionButtons = userConfig.actionButtons.filter( + // value => value.showIn.toLowerCase() === 'ellipsis' + // ); + this.actionEllipsis = userConfig.actionButtons.filter( + value => value.showIn.toLowerCase() === 'button' + ); + this.paginatorOptions = userConfig.paginator; + } } pageEvent(event: any) { @@ -101,12 +104,12 @@ export class ViewComponent implements OnInit { filters.pagination.pageStart = event.pageIndex; const url = Utils.convertFilterToUrl(filters); let currenturl = this.router.url.split('/')[3]; - if(currenturl === "zoneuser"){ + if (currenturl === "zoneuser") { this.router.navigateByUrl(`admin/resources/zoneuser/view?${url}`); - }else{ + } else { this.router.navigateByUrl(`admin/resources/users/view?${url}`); } - + } getSortColumn(event: SortModel) { @@ -118,15 +121,15 @@ export class ViewComponent implements OnInit { } }); if (event.sortType != null) { - this.sortFilter.push(event); - } + this.sortFilter.push(event); + } const filters = Utils.convertFilter(this.activatedRoute.snapshot.queryParams, this.primaryLang); filters.sort = this.sortFilter; const url = Utils.convertFilterToUrl(filters); let currenturl = this.router.url.split('/')[3]; - if(currenturl === "zoneuser"){ + if (currenturl === "zoneuser") { this.router.navigateByUrl(`admin/resources/zoneuser/view?${url}`); - }else{ + } else { this.router.navigateByUrl(`admin/resources/users/view?${url}`); } } @@ -140,8 +143,8 @@ export class ViewComponent implements OnInit { this.filtersApplied = true; } this.sortFilter = filters.sort; - if(this.sortFilter.length == 0){ - this.sortFilter.push({"sortType":"desc","sortField":"createdDateTime"}); + if (this.sortFilter.length == 0) { + this.sortFilter.push({ "sortType": "desc", "sortField": "createdDateTime" }); } let currenturl = this.router.url.split('/')[3]; this.requestModel = new RequestModel(null, null, filters); @@ -150,6 +153,7 @@ export class ViewComponent implements OnInit { .getUsersData(this.requestModel, currenturl) .subscribe(({ response, errors }) => { console.log(response); + if (response != null) { this.paginatorOptions.totalEntries = response.totalRecord; this.paginatorOptions.pageIndex = filters.pagination.pageStart; @@ -157,25 +161,42 @@ export class ViewComponent implements OnInit { console.log(this.paginatorOptions); if (response.data != null) { this.users = [...response.data]; + let url = this.router.url.split('/')[3]; + if (url !== "zoneuser") { + this.users.forEach((item) => { + if (item.regCenterId === null) { + //map to center + this.actionButtons.push(userConfig.actionButtons1.filter( + value => value.showIn.toLowerCase() === 'ellipsis' + )); + } + else { + //remap + this.actionButtons.push(userConfig.actionButtons.filter( + value => value.showIn.toLowerCase() === 'ellipsis' + )); + } + }) + } } else { this.noData = true; - } - } else { - this.dialog - .open(DialogComponent, { - data: { - case: 'MESSAGE', - title: this.errorMessages.technicalError.title, - message: this.errorMessages.technicalError.message, - btnTxt: this.errorMessages.technicalError.btnTxt - } , - width: '700px' - }) - .afterClosed() - .subscribe(result => { - console.log('dialog is closed from view component'); - }); - } + } + } else { + this.dialog + .open(DialogComponent, { + data: { + case: 'MESSAGE', + title: this.errorMessages.technicalError.title, + message: this.errorMessages.technicalError.message, + btnTxt: this.errorMessages.technicalError.btnTxt + }, + width: '700px' + }) + .afterClosed() + .subscribe(result => { + console.log('dialog is closed from view component'); + }); + } }); } diff --git a/admin-ui/src/app/shared/table/table.component.html b/admin-ui/src/app/shared/table/table.component.html index b4a9864ce7d..62e5bba542b 100644 --- a/admin-ui/src/app/shared/table/table.component.html +++ b/admin-ui/src/app/shared/table/table.component.html @@ -2,66 +2,57 @@ - - - + - - +
+ +
+ +
+ +
+
- Code : {{data[item].code}} | Value : {{data[item].value}}{{ data[item] | mapStatus }}{{ data[item] | createFormatDate}}{{'isActive.Active'|translate}}{{'isActive.InActive'|translate}} + + Code : {{data[item].code}} | Value : + {{data[item].value}}{{ data[item] | mapStatus }}{{ data[item] | createFormatDate}}{{'isActive.Active'|translate}}{{'isActive.InActive'|translate}} +

{{'center.popupMessages.noData.message' | translate}}

-
- -
- +
+ +
+ \ No newline at end of file diff --git a/admin-ui/src/app/shared/table/table.component.ts b/admin-ui/src/app/shared/table/table.component.ts index 9b4ea09715b..2b6dff78fa6 100644 --- a/admin-ui/src/app/shared/table/table.component.ts +++ b/admin-ui/src/app/shared/table/table.component.ts @@ -29,7 +29,8 @@ export class TableComponent implements OnInit, OnChanges { @Input() showRadioButton: boolean = false; @Output() sort = new EventEmitter(); @Output() selectedCenterDetail = new EventEmitter(); - + @Input() isUser = true; + tableData = []; columnsOfTableData = []; sortStatusArray: string[] = []; @@ -49,7 +50,8 @@ export class TableComponent implements OnInit, OnChanges { private auditService: AuditService ) { let lang = headerService.getUserPreferredLanguage(); - translate.use(lang); + translate.use(lang); + } ngOnInit(): void { this.tableData = [...this.data]; @@ -87,17 +89,17 @@ export class TableComponent implements OnInit, OnChanges { selectedRow(data: any, specData: any) { let currentRouteType = this.router.url.split('/')[3]; let id = null; - if(!currentRouteType.includes("view")){ + if (!currentRouteType.includes("view")) { id = appConstants.ListViewIdKeyMapping[`${currentRouteType}`]; - }else{ + } else { currentRouteType = this.router.url.split('/')[2]; id = appConstants.ListViewIdKeyMapping[`${currentRouteType}`]; } if (specData.callBackFunction && specData.callBackFunction !== '') { if (currentRouteType.toLowerCase() === 'blocklisted-words') { - this.commonService[specData.callBackFunction]({...data}, specData.redirectURL +"$"+data.langCode, id.idKey); - }else{ - this.commonService[specData.callBackFunction]({...data}, specData.redirectURL, id.idKey); + this.commonService[specData.callBackFunction]({ ...data }, specData.redirectURL + "$" + data.langCode, id.idKey); + } else { + this.commonService[specData.callBackFunction]({ ...data }, specData.redirectURL, id.idKey); } } } @@ -118,7 +120,7 @@ export class TableComponent implements OnInit, OnChanges { `${this.currentRoute}/single-view`, data[id.idKey] + '$' + data.langCode ]); - }else if (currentRouteType.toLowerCase() === 'dynamicfields') { + } else if (currentRouteType.toLowerCase() === 'dynamicfields') { this.router.navigate([ `${this.currentRoute}/single-view`, data.fieldVal.code @@ -162,22 +164,48 @@ export class TableComponent implements OnInit, OnChanges { ellipsisAction(data) { if (data.isActive === true) { - this.ellipsisList = [...this.buttonList]; - this.ellipsisList.filter(values => { - if (values.buttonName.eng === 'Activate') { - const index = this.ellipsisList.indexOf(values); - this.ellipsisList.splice(index, 1); - } - }); + // this.ellipsisList = [...this.buttonList]; + this.ellipsisList = JSON.parse(JSON.stringify(this.buttonList)); + if (!this.isUser) { + // user mapping center menu options + this.ellipsisList.filter((values, i) => { + values.filter(value => { + if (value.buttonName.eng === 'Activate') { + const index = this.ellipsisList[i].indexOf(value); + this.ellipsisList[i].splice(index, 1); + } + }) + }); + } else { + this.ellipsisList.filter(values => { + if (values.buttonName.eng === 'Activate') { + const index = this.ellipsisList.indexOf(values); + this.ellipsisList.splice(index, 1); + } + }); + } } else if (data.isActive === false) { - this.ellipsisList = [...this.buttonList]; - this.ellipsisList.filter(values => { - if (values.buttonName.eng === 'Deactivate') { - const index = this.ellipsisList.indexOf(values); - this.ellipsisList.splice(index, 1); - } - }); - }else{ + // this.ellipsisList = [...this.buttonList]; + this.ellipsisList = JSON.parse(JSON.stringify(this.buttonList)); + if (!this.isUser) { + // user mapping center menu options + this.ellipsisList.filter((values, i) => { + values.filter(value => { + if (value.buttonName.eng === 'Deactivate') { + const index = this.ellipsisList[i].indexOf(value); + this.ellipsisList[i].splice(index, 1); + } + }) + }); + } else { + this.ellipsisList.filter(values => { + if (values.buttonName.eng === 'Deactivate') { + const index = this.ellipsisList.indexOf(values); + this.ellipsisList.splice(index, 1); + } + }); + } + } else { this.ellipsisList = [...this.buttonList]; } } diff --git a/admin-ui/src/app/shared/toolbar/toolbar.component.scss b/admin-ui/src/app/shared/toolbar/toolbar.component.scss index 48eab27386c..e29082a8cb6 100644 --- a/admin-ui/src/app/shared/toolbar/toolbar.component.scss +++ b/admin-ui/src/app/shared/toolbar/toolbar.component.scss @@ -44,7 +44,7 @@ :host::ng-deep.mat-form-field-appearance-legacy .mat-form-field-infix { padding: 0.4375em 0; border: 0.9px solid #b5b7b7; - height: 20px; + height: 25px; } :host::ng-deep .mat-form-field-appearance-legacy .mat-form-field-underline { background-color: transparent; @@ -53,6 +53,9 @@ width: 50px !important; padding: 10px; } +:host::ng-deep .mat-form-field{ + text-align: left !important; +} ::ng-deep .mat-select-arrow { height: 3px !important; width: 3px !important; @@ -61,8 +64,7 @@ :host::ng-deep .mat-select-value { font-size: 9.5px !important; color: #3b4141;; - padding-top: 2px; - padding-left: 8px; + padding-left: 10px; } :host::ng-deep.mat-paginator-range-label { diff --git a/admin-ui/src/assets/entity-spec/center-type.json b/admin-ui/src/assets/entity-spec/center-type.json index 643a623392a..6cc74ab0af5 100644 --- a/admin-ui/src/assets/entity-spec/center-type.json +++ b/admin-ui/src/assets/entity-spec/center-type.json @@ -268,7 +268,45 @@ "pageSize": "10", "pageSizeList": [10, 20, 30, 40, 50] }, - "filterColumns": [{ + "filterColumns": [ + { + "filtername": "code", + "filterlabel": { + "eng": "Code", + "ara": "الشفرة", + "fra": "Code", + "tam": "குறியீடு", + "hin": "कोड", + "kan": "ಕೋಡ್" + }, + "filterType": "equals", + "autocomplete": "false", + "dropdown": "true", + "datePicker": "false", + "apiName": "registrationcentertypes", + "fieldName": "code", + "methodCallName": "" + }, + { + "filtername": "name", + "filterlabel": { + "eng": "Name", + "ara": "اسم", + "fra": "prénom", + "tam": "பெயர்", + "hin": "नाम", + "kan": "ಹೆಸರು" + }, + "filterType": "equals", + "fieldType": "input", + "autocomplete": "false", + "dropdown": "false", + "datePicker": "false", + "apiName": "registrationcentertypes", + "fieldName": "name", + "methodCallName": "" + }, + { "filtername": "isActive", "filterlabel": { "eng": "Status", diff --git a/admin-ui/src/assets/entity-spec/devices.json b/admin-ui/src/assets/entity-spec/devices.json index a8893c9ea7a..9960f1a3a7a 100644 --- a/admin-ui/src/assets/entity-spec/devices.json +++ b/admin-ui/src/assets/entity-spec/devices.json @@ -163,12 +163,12 @@ "name": "mapStatus", "showInListView": "", "label": { - "eng": "Map Status", - "ara": "تعيين الحالة", - "fra": "Attribuer un statut", - "tam": "வரைபட நிலை", - "hin": "मानचित्र स्थिति", - "kan": "ನಕ್ಷೆಯ ಸ್ಥಿತಿ" + "eng": "Center Name", + "ara": "اسم المركز", + "fra": "Nom du centre", + "hin": "केंद्र का नाम", + "kan": "ಕೇಂದ್ರದ ಹೆಸರು", + "tam": "மையப் பெயர்" }, "sortOrder": "", "showAsLink": "", diff --git a/admin-ui/src/assets/entity-spec/machines.json b/admin-ui/src/assets/entity-spec/machines.json index bd3957c910a..8c4a3996ceb 100644 --- a/admin-ui/src/assets/entity-spec/machines.json +++ b/admin-ui/src/assets/entity-spec/machines.json @@ -149,12 +149,12 @@ "name": "mapStatus", "showInListView": "", "label": { - "eng": "Map Status", - "ara": "تعيين الحالة", - "fra": "Attribuer un statut", - "hin": "मानचित्र स्थिति", - "kan": "ನಕ್ಷೆಯ ಸ್ಥಿತಿ", - "tam": "வரைபட நிலை" + "eng": "Center Name", + "ara": "اسم المركز", + "fra": "Nom du centre", + "hin": "केंद्र का नाम", + "kan": "ಕೇಂದ್ರದ ಹೆಸರು", + "tam": "மையப் பெயர்" }, "sortOrder": "", "showAsLink": "", diff --git a/admin-ui/src/assets/entity-spec/templates.json b/admin-ui/src/assets/entity-spec/templates.json index 3f1e0d3a4ad..f4b58c86b36 100644 --- a/admin-ui/src/assets/entity-spec/templates.json +++ b/admin-ui/src/assets/entity-spec/templates.json @@ -63,7 +63,7 @@ "validations": "" }, { - "buttonName": { "eng": "Filter", "ara": "تصفيه", "fra": "filtre" }, + "buttonName": { "eng": "Filter", "ara": "تصفيه", "fra": "filtre","hin": "फ़िल्टर", "kan":"ಫಿಲ್ಟರ್ ಮಾಡಿ","tam":"வடிகட்டி" }, "imagePath": "assets/images/filter.png", "actionListType": "action", "actionURL": { "case": "filter" }, @@ -356,7 +356,7 @@ "name": "isActive", "showInListView": "true", "showInSingleView": "false", - "label": { "eng": "Status", "ara": "نشط", "fra": "c'est actif" }, + "label": { "eng": "Status", "ara": "نشط", "fra": "c'est actif","hin": "स्थिति","kan":"ಸ್ಥಿತಿ","tam":"நிலை" }, "sortOrder": "", "showAsLink": "false", "linkType": "", diff --git a/admin-ui/src/assets/entity-spec/user.json b/admin-ui/src/assets/entity-spec/user.json index 8d0b62f9a7a..93306f516e3 100644 --- a/admin-ui/src/assets/entity-spec/user.json +++ b/admin-ui/src/assets/entity-spec/user.json @@ -3,12 +3,12 @@ "actionButtons": [ { "buttonName": { - "eng": "Edit", - "ara": "تصحيح", - "fra": "modifier", - "hin": "संपादित करें ", - "kan": "ತಿದ್ದು", - "tam": "தொகு " + "eng": "Remap", + "ara": "إعادة رسم خريطة", + "fra": "remapper", + "hin": "सरीमैप", + "kan": "ರೀಮ್ಯಾಪ್", + "tam": "மறுவடிவமைப்பு " }, "actionURL": "", "redirectURL": "/admin/resources/users/single-view/$id", @@ -78,6 +78,86 @@ "validations": "" } ], + + "actionButtons1": [ + { + "buttonName": { + "eng": "Map to Center", + "ara":"تعيين إلى المركز", + "fra": "Carte vers le centre", + "hin": "नक्शा से केंद्र", + "kan": "ನಕ್ಷೆಯಿಂದ ಕೇಂದ್ರಕ್ಕೆ", + "tam": "வரைபடத்திலிருந்து மையத்திற்கு" + }, + "actionURL": "", + "redirectURL": "/admin/resources/users/single-view/$id", + "showIn": "Ellipsis", + "validations": "", + "callBackFunction": "centerEdit" + }, + { + "buttonName": { + "eng": "Delete", + "ara": "حذف", + "fra": "Supprimer", + "hin": "हटाएं", + "kan": "ಅಳಿಸು", + "tam": "அழி " + }, + "actionURL": "", + "redirectURL": "", + "showIn": "Ellipsis", + "validations": "", + "callBackFunction": "deleteUser" + }, + { + "buttonName": { + "eng": "Activate", + "ara": "تنشيط", + "fra": "déclencher", + "hin": "सक्रिय", + "kan": "ಸಕ್ರಿಯಗೊಳಿಸಿ", + "tam": "செயல்படுத்த" + }, + "actionURL": "", + "redirectURL": "", + "showIn": "Ellipsis", + "validations": "", + "callBackFunction": "activateCenter" + }, + { + "buttonName": { + "eng": "Deactivate", + "ara": "الغاء تنشيط", + "fra": "désactiver", + "hin": "निष्क्रिय करें", + "kan": "ನಿಷ್ಕ್ರಿಯಗೊಳಿಸಿ", + "tam": "செயலிழக்க" + }, + "actionURL": "", + "redirectURL": "", + "showIn": "Ellipsis", + "validations": "", + "callBackFunction": "deactivateCenter" + }, + { + "buttonName": { + "eng": "Filter", + "fra": "filtre", + "ara": "تصفيه", + "tam": "வடிகட்டி", + "hin": "फ़िल्टर", + "kan": "ಫಿಲ್ಟರ್ ಮಾಡಿ" + }, + "imagePath": "assets/images/filter.png", + "actionListType": "action", + "actionURL": { "case": "filter" }, + "redirectURL": "", + "showIn": "Button", + "validations": "" + } + ], + "columnsToDisplay": [ { "name": "userName", diff --git a/admin-ui/src/assets/entity-spec/zoneuser.json b/admin-ui/src/assets/entity-spec/zoneuser.json index 19e2af068ec..63dfa42af61 100644 --- a/admin-ui/src/assets/entity-spec/zoneuser.json +++ b/admin-ui/src/assets/entity-spec/zoneuser.json @@ -3,12 +3,12 @@ "actionButtons": [ { "buttonName": { - "eng": "Edit", - "ara": "تصحيح", - "fra": "modifier", - "hin": "संपादित करें ", - "kan": "ತಿದ್ದು", - "tam": "தொகு " + "eng": "Remap", + "ara": "إعادة رسم خريطة", + "fra": "remapper", + "hin": "सरीमैप ", + "kan": "ರೀಮ್ಯಾಪ್", + "tam": "மறுவடிவமைப்பு " }, "actionURL": "", "redirectURL": "/admin/resources/zoneuser/single-view/$id", diff --git a/admin-ui/src/styles.scss b/admin-ui/src/styles.scss index 7a20c870d9b..4beb16b7cc7 100644 --- a/admin-ui/src/styles.scss +++ b/admin-ui/src/styles.scss @@ -190,6 +190,7 @@ h3 { } .secondary-form { padding-right: 25px; + padding-left: 25px; padding-top: 30px; flex: 1; .mat-form-field {