Skip to content

Commit

Permalink
feat: Create close event pcode in frontend AB#6295
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenGeo committed Feb 22, 2021
1 parent 31c6af0 commit 3df1628
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@
></ion-button>
</ion-row>
</form>
<ion-button (click)="closePcodeEvent(area.id)">
Close event
</ion-button>
</dialogue-turn>
</ng-container>
</ion-content>
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ApiService } from 'src/app/services/api.service';
import { ChangeDetectorRef, Component, OnDestroy } from '@angular/core';
import { AlertController } from '@ionic/angular';
import { TranslateService } from '@ngx-translate/core';
Expand Down Expand Up @@ -42,6 +43,7 @@ export class ChatComponent implements OnDestroy {
private alertController: AlertController,
private changeDetectorRef: ChangeDetectorRef,
private translateService: TranslateService,
private apiService: ApiService
) {
this.translateService
.get('chat-component.active-event')
Expand Down Expand Up @@ -110,7 +112,7 @@ export class ChatComponent implements OnDestroy {
action.action,
activeCountry.countryCodeISO3,
action.checked,
action.pcode,
action.pcode
);
} else {
return Promise.resolve();
Expand Down Expand Up @@ -149,4 +151,8 @@ export class ChatComponent implements OnDestroy {

await alert.present();
}

public closePcodeEvent(eventPcodeId: any) {
this.apiService.closeEventPcode(eventPcodeId)
}
}
22 changes: 16 additions & 6 deletions interfaces/IBF-dashboard/src/app/services/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ export class ApiService {
return this.get('uga-data-level-2/all', false).toPromise();
}

getTriggeredAreas(event: number) {
return this.get(`triggered-areas/${event}`, false).toPromise();
getTriggeredAreas(countryCodeISO3: string) {
return this.get(`triggered-areas/${countryCodeISO3}`, false).toPromise();
}

getMetadata(countryCodeISO3: string) {
Expand All @@ -188,17 +188,27 @@ export class ApiService {
action: string,
countryCodeISO3: string,
status: boolean,
pcode: string,
event: number,
pcode: string
) {
return this.post(
'eap-actions',
{
action,
countryCode: countryCodeISO3,
status,
pcode,
event,
pcode
},
false,
).toPromise();
}

closeEventPcode(
eventPcodeId: number,
) {
return this.post(
'event/close-pcode',
{
eventPcodeId
},
false,
).toPromise();
Expand Down

0 comments on commit 3df1628

Please sign in to comment.