add changes for sdg-selection component
This commit is contained in:
parent
f6084fbcd4
commit
efc2d6c47b
|
@ -73,7 +73,7 @@ export class CommunityService {
|
|||
return this.http.post(url, community, options);
|
||||
}
|
||||
|
||||
public updateSubjects(subjects: string[], fos: string[], sgd: string[]) {
|
||||
public updateSubjects(subjects: string[], fos: string[], sdg: string[]) {
|
||||
let communityInfo: CommunityInfo = this.community.value;
|
||||
communityInfo.subjects = subjects;
|
||||
communityInfo.fos = fos;
|
||||
|
@ -109,7 +109,19 @@ export class CommunityService {
|
|||
}
|
||||
if (resData.subjects != null) {
|
||||
community.subjects = Array.isArray(resData.subjects)?resData.subjects:[resData.subjects];
|
||||
}
|
||||
} else {
|
||||
community.subjects = [];
|
||||
}
|
||||
if (resData.sdg != null) {
|
||||
community.sdg = Array.isArray(resData.sdg)?resData.sdg:[resData.sdg];
|
||||
} else {
|
||||
community.sdg = [];
|
||||
}
|
||||
if (resData.fos != null) {
|
||||
community.fos = Array.isArray(resData.fos)?resData.fos:[resData.fos];
|
||||
} else {
|
||||
community.fos = [];
|
||||
}
|
||||
if (resData.advancedConstraint != null) {
|
||||
community.selectionCriteria = resData.advancedConstraint;
|
||||
} else {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<label [class.uk-text-bolder]="subjects?.includes(item.id)">
|
||||
<input [(ngModel)]="item.checked"
|
||||
type="checkbox" class="uk-checkbox uk-margin-small-right">
|
||||
<span class="uk-text-uppercase uk-margin-xsmall-right">Goal</span>
|
||||
<span *ngIf="isFeedback" class="uk-text-uppercase uk-margin-xsmall-right">Goal</span>
|
||||
<span>{{item.id}}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<label [class.uk-text-bolder]="subjects?.includes(item.id)">
|
||||
<input [(ngModel)]="item.checked"
|
||||
type="checkbox" class="uk-checkbox uk-margin-small-right">
|
||||
<span *ngIf="i !== secondColumn.length - 1"
|
||||
<span *ngIf="i !== secondColumn.length - 1 && isFeedback"
|
||||
class="uk-text-uppercase uk-margin-xsmall-right">Goal</span>
|
||||
<span>{{item.id}}</span>
|
||||
</label>
|
||||
|
|
|
@ -13,6 +13,7 @@ export class SdgSelectionComponent {
|
|||
public properties: EnvProperties = properties;
|
||||
@Input() subjects: string[];
|
||||
@Input() entityType: string;
|
||||
@Input() isFeedback: boolean = true;
|
||||
|
||||
public loading: boolean;
|
||||
public sdgs: any = [];
|
||||
|
@ -27,17 +28,19 @@ export class SdgSelectionComponent {
|
|||
data['sdg'].forEach(element => {
|
||||
this.sdgs.push({code: element.code, id: element.id, label: element.label, html: element.html, checked: this.subjects?.includes(element.id)});
|
||||
});
|
||||
this.sdgs.push({code: '18', id: 'No SDGs are relevant for this ' + this.getEntityName(this.entityType), label: 'Not relevant', html: 'Not relevant', checked: false});
|
||||
this.loading = false;
|
||||
if(this.isFeedback) {
|
||||
this.sdgs.push({code: '18', id: 'No SDGs are relevant for this ' + this.getEntityName(this.entityType), label: 'Not relevant', html: 'Not relevant', checked: false});
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
public get firstColumn() {
|
||||
return this.sdgs.slice(0, this.sdgs.length/2);
|
||||
return this.sdgs.slice(0, Math.ceil(this.sdgs.length/2));
|
||||
}
|
||||
|
||||
public get secondColumn() {
|
||||
return this.sdgs.slice(this.sdgs.length/2, this.sdgs.length);
|
||||
return this.sdgs.slice(Math.ceil(this.sdgs.length/2), this.sdgs.length);
|
||||
}
|
||||
|
||||
public getSelectedSubjects() {
|
||||
|
|
Loading…
Reference in New Issue