diff --git a/customer/app/src/app/pages/registration/registration.component.html b/customer/app/src/app/pages/registration/registration.component.html
index 8f0a4fc..d9bea35 100644
--- a/customer/app/src/app/pages/registration/registration.component.html
+++ b/customer/app/src/app/pages/registration/registration.component.html
@@ -28,8 +28,9 @@
Státusz
- {{ "Lemondva" }}
- {{ "Aktív" }}
+ {{ "Lemondva" }}
+ {{ "Törölve" }}
+ {{ "Aktív" }}
diff --git a/customer/app/src/app/pages/registration/registration.component.ts b/customer/app/src/app/pages/registration/registration.component.ts
index a8f386d..15f9b54 100644
--- a/customer/app/src/app/pages/registration/registration.component.ts
+++ b/customer/app/src/app/pages/registration/registration.component.ts
@@ -3,6 +3,7 @@ import { EventService, Registration} from "../../services/event.service";
import {ActivatedRoute, Router} from "@angular/router";
import {tap} from "rxjs/operators";
import {NavigationService} from "../../services/navigation.service";
+import {RegistrationService} from "../../services/reservation.service";
@Component({
selector: 'app-registration',
@@ -16,7 +17,8 @@ export class RegistrationComponent implements OnInit {
constructor(private eventService: EventService,
private route: Router,
private activeRoute: ActivatedRoute ,
- private navigationService: NavigationService) { }
+ private navigationService: NavigationService,
+ public registrationService: RegistrationService) { }
ngOnInit() {
this.activeRoute.params.subscribe( value => {
@@ -44,7 +46,7 @@ export class RegistrationComponent implements OnInit {
}
mayCancel(registration: Registration) {
- return registration.deleted_at == null;
+ return this.registrationService.mayCancel(registration);
}
goBack() {
diff --git a/customer/app/src/app/services/event.service.ts b/customer/app/src/app/services/event.service.ts
index cf5a1a2..2876ff3 100644
--- a/customer/app/src/app/services/event.service.ts
+++ b/customer/app/src/app/services/event.service.ts
@@ -105,6 +105,7 @@ export interface Registration {
id: number;
created_at: number;
deleted_at: number;
+ canceled_at: number;
event?: Event
}
diff --git a/customer/app/src/app/services/reservation.service.ts b/customer/app/src/app/services/reservation.service.ts
index 60ba9c2..5ca3cab 100644
--- a/customer/app/src/app/services/reservation.service.ts
+++ b/customer/app/src/app/services/reservation.service.ts
@@ -1,12 +1,27 @@
import { Injectable } from '@angular/core';
-import {HttpClient} from "@angular/common/http";
+import {Registration} from "./event.service";
@Injectable({
providedIn: 'root'
})
-export class ReservationService {
+export class RegistrationService {
- constructor(private http: HttpClient) { }
+ constructor() { }
+ public isCanceled(registration: Registration){
+ return registration.canceled_at != null;
+ }
+
+ public isDeleted(registration: Registration){
+ return registration.deleted_at != null;
+ }
+
+ public isActive(registration: Registration){
+ return !this.isDeleted(registration) && !this.isCanceled(registration)
+ }
+
+ public mayCancel(registration: Registration) {
+ return this.isActive(registration);
+ }
}
diff --git a/customerapi/controllers/EventRegistrationController.php b/customerapi/controllers/EventRegistrationController.php
index 64134d1..b780d4e 100644
--- a/customerapi/controllers/EventRegistrationController.php
+++ b/customerapi/controllers/EventRegistrationController.php
@@ -77,7 +77,7 @@ class EventRegistrationController extends CustomerApiController
public function actionCancel($idRegistration) {
$manager = new \common\manager\EventRegistrationManager();
$registration = $manager->loadRegistration($idRegistration);
- $manager->deleteRegistration($registration);
+ $manager->cancelRegistration($registration);
$registration = $manager->loadRegistration($idRegistration);
return $this->asJson($registration);
}
diff --git a/customerapi/models/registrations/EventRegistrationAvailable.php b/customerapi/models/registrations/EventRegistrationAvailable.php
index 757d3f4..47a3ce9 100644
--- a/customerapi/models/registrations/EventRegistrationAvailable.php
+++ b/customerapi/models/registrations/EventRegistrationAvailable.php
@@ -18,6 +18,7 @@ class EventRegistrationAvailable extends EventRegistration
"created_at" => "created_at",
"updated_at" => "updated_at",
"deleted_at" => "deleted_at",
+ "canceled_at" => "canceled_at",
];
$fields['event'] = 'event';
return $fields;