@@ -254,12 +258,13 @@
placeholder="{{field.label[primaryLang] | translate}}"
[value]="primaryData[field.name]"
required={{field.ismandatory}}
+ [readonly]="!isEditable && id"
/>
-
+
@@ -268,7 +273,8 @@
id="{{field.name}}"
[value]="primaryData[field.name]"
placeholder="{{ field.label[primaryLang] }}"
- required={{field.ismandatory}}>
+ required={{field.ismandatory}}
+ [disabled]="!isEditable && id">
@@ -485,6 +495,7 @@
}}"
[value]="secondaryData[field.name]"
*ngIf="field.name !== 'fieldVal'"
+ [readonly]="!isEditable && id"
/>
@@ -500,6 +511,7 @@
}}"
[value]="secondaryData[field.name]"
*ngIf="field.name !== 'fieldVal'"
+ [readonly]="!isEditable && id"
/>
@@ -515,6 +527,7 @@
field.label[secondaryLang]
}}"
[value]="secondaryData[field.name]"
+ [readonly]="!isEditable && id"
/>
@@ -592,6 +605,7 @@
}}"
[value]="secondaryData[field.name]"
rows="3" cols="40"
+ [readonly]="!isEditable && id"
>
@@ -605,10 +619,12 @@
placeholder="{{field.label[secondaryLang] | translate}}"
[value]="secondaryData[field.name]"
field.required
+ [readonly]="!isEditable && id"
/>
@@ -618,7 +634,8 @@
+ placeholder="{{ field.label[secondaryLang] }}"
+ [disabled]="!isEditable && id">
@@ -668,6 +685,7 @@
id="{{field.name}}{{secondaryLang}}"
[value]="secondaryData[field.name]"
placeholder="{{ field.label[secondaryLang] }}"
+ [disabled]="!isEditable && id"
>
>>"+this.primaryLangCode);
- console.log("config>>>"+defaultJson.languages["ara"].name);
- /*if(url === "blocklisted-words"){
- this.primaryLang = this.primaryData.langCode;
- if(this.primaryData.langCode === "ara"){
- this.isPrimaryLangRTL = true;
- }
- }*/
if(this.primaryLang === "ara"){
this.isPrimaryLangRTL = true;
}
@@ -132,6 +125,7 @@ export class MaterDataCommonBodyComponent implements OnInit {
}
});
this.queryParamLangCode = this.activatedRoute.snapshot.queryParamMap.get('langCode');
+ this.isEditable = this.activatedRoute.snapshot.queryParamMap.get('editable')
this.activatedRoute.params.subscribe(response => {
this.id = response.id;
this.masterdataType = response.type;
@@ -239,7 +233,12 @@ export class MaterDataCommonBodyComponent implements OnInit {
if(this.router.url.split('/')[4] !== "new"){
name = this.router.url.split('/')[4];
this.dataStorageService.getDynamicfieldDescriptionValue(name, this.primaryLang).subscribe(response => {
- this.primaryData = {"name":name,"description":response.response.description,"dataType":"string","value":"", "code":"","langCode":this.primaryLang};
+ if(response.response){
+ this.primaryData = {"name":name,"description":response.response.description,"dataType":"string","value":"", "code":"","langCode":this.primaryLang};
+ }else{
+ this.primaryData = {"name":name,"description":"","dataType":"string","value":"", "code":"","langCode":this.primaryLang};
+ }
+
});
}else{
this.primaryData = {"name":name,"description":"","dataType":"string","value":"", "code":"","langCode":this.primaryLang};
@@ -368,11 +367,11 @@ export class MaterDataCommonBodyComponent implements OnInit {
this.secondaryData = response.response.data[0];
this.setSecondaryFrom("");
if(this.queryParamLangCode){
- document.getElementById("code").setAttribute("disabled", "true");
- document.getElementById("code"+this.queryParamLangCode).setAttribute("disabled", "true");
- if(!this.primaryData.code){
- this.primaryData.code = this.secondaryData.code;
- }
+ Object.keys(this.primaryData).forEach(item =>{
+ if(!this.primaryData[item]){
+ this.primaryData[item] = this.secondaryData[item]
+ }
+ })
}
}else{
this.secondaryData = null;
diff --git a/admin-ui/src/app/features/resources/center/edit/edit.component.html b/admin-ui/src/app/features/resources/center/edit/edit.component.html
index e3351ac4..51aa97a0 100644
--- a/admin-ui/src/app/features/resources/center/edit/edit.component.html
+++ b/admin-ui/src/app/features/resources/center/edit/edit.component.html
@@ -107,7 +107,7 @@ {{ "center.location-details" | translate }}
-
-
{{ "center.update" | translate }}
@@ -392,7 +392,7 @@ {{ "center.location-details" | translate }}
{{ fieldName }}
-
{{ data.name }}
@@ -520,7 +520,7 @@ {{ "center.operational-details" | translate }}
-
+
{{ "center.operational-details" | translate }}
{{ "center.holidays" | translate }}
-
-
+
{{ "center.add-button" | translate }}
diff --git a/admin-ui/src/app/features/resources/center/edit/edit.component.ts b/admin-ui/src/app/features/resources/center/edit/edit.component.ts
index da00c9f0..cc8ab749 100644
--- a/admin-ui/src/app/features/resources/center/edit/edit.component.ts
+++ b/admin-ui/src/app/features/resources/center/edit/edit.component.ts
@@ -122,6 +122,9 @@ export class EditComponent {
this.initializeComponent();
}
});
+ this.activatedRoute.queryParams.subscribe(params => {
+ this.isEditable = params
+ });
this.initialLocationCode = this.appConfigService.getConfig()['countryCode'];
this.locCode = this.appConfigService.getConfig()['locationHierarchyLevel'];
@@ -140,7 +143,6 @@ export class EditComponent {
}
loadLanguages(primaryLangCode: string) {
- console.log(`loadLanguages: primary: ${primaryLangCode}`);
// Set the primary language
this.primaryLang = this.headerService.getUserPreferredLanguage();
this.translateService.use(this.primaryLang);
@@ -148,7 +150,6 @@ export class EditComponent {
this.selectLanguagesArr = [];
let self = this;
let otherLangsArr = this.supportedLanguages.filter(function(lang){if(lang.trim() && lang.trim() !== self.primaryLang.trim()){return lang.trim()}});
- console.log("otherLangsArr>>>"+otherLangsArr);
if(otherLangsArr.length > 0){
otherLangsArr.forEach((language) => {
if (defaultJson.languages && defaultJson.languages[language]) {
@@ -159,7 +160,8 @@ export class EditComponent {
}
});
//Set the secondary language
- this.secondaryLang = this.selectLanguagesArr[0]["code"];
+ this.secondaryLang = this.isEditable.langCode ? this.isEditable['langCode'] : this.selectLanguagesArr[0]["code"];
+
this.primaryLang === this.secondaryLang ? this.showSecondaryForm = false : this.showSecondaryForm = true;
}else{
this.showSecondaryForm = false;
@@ -216,7 +218,6 @@ export class EditComponent {
}
initializeComponent() {
- console.log(`initializeComponent -- primaryLang: ${this.primaryLang}`);
//this.translateService.use(this.primaryLang);
this.activatedRoute.params.subscribe(params => {
this.centerId = params.id;
@@ -227,10 +228,6 @@ export class EditComponent {
this.filteredLanguages = this.supportedLanguages;
this.getPrimaryPanelData(this.primaryLang);
});
-
- this.activatedRoute.queryParams.subscribe(params => {
- this.isEditable = params
- });
}
setLocaleForDatePicker = (localeId) => {
@@ -334,6 +331,36 @@ export class EditComponent {
});
}
+ isNotEditible(){
+ if(this.isEditable.langCode){
+ this.primaryForm.controls.contactPerson.disable()
+ this.primaryForm.controls.addressLine1.disable()
+ this.primaryForm.controls.addressLine2.disable()
+ this.primaryForm.controls.addressLine3.disable()
+
+ this.secondaryForm.controls.name.disable()
+ this.secondaryForm.controls.contactPerson.disable()
+ this.secondaryForm.controls.addressLine1.disable()
+ this.secondaryForm.controls.addressLine2.disable()
+ this.secondaryForm.controls.addressLine3.disable()
+
+ this.commonForm.controls.centerTypeCode.disable()
+ this.commonForm.controls.contactPhone.disable()
+ this.commonForm.controls.longitude.disable()
+ this.commonForm.controls.latitude.disable()
+ this.commonForm.controls.workingDays.disable()
+ this.commonForm.controls.zone.disable()
+ this.commonForm.controls.holidayZone.disable()
+ this.commonForm.controls.processingTime.disable()
+ this.commonForm.controls.startTime.disable()
+ this.commonForm.controls.endTime.disable()
+ this.commonForm.controls.lunchStartTime.disable()
+ this.commonForm.controls.lunchEndTime.disable()
+ this.commonForm.controls.startTime.disable()
+ }
+ }
+
+
get primary() {
return this.primaryForm.controls;
}
@@ -449,7 +476,8 @@ export class EditComponent {
}
},
//error => this.showErrorPopup()
- );
+ );
+ this.isNotEditible()
}
showErrorPopup() {