customer design improvement
This commit is contained in:
parent
166eb5b7dd
commit
34d898779c
@ -28,8 +28,9 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-sm-12 app-font-weight-bold"><span class="title">Státusz</span></div>
|
||||
<div class="col-lg-9 col-sm-12">
|
||||
<span *ngIf="registration.deleted_at">{{ "Lemondva" }}</span>
|
||||
<span *ngIf="registration.deleted_at == null">{{ "Aktív" }}</span>
|
||||
<span *ngIf="registrationService.isCanceled(registration)">{{ "Lemondva" }}</span>
|
||||
<span *ngIf="registrationService.isDeleted(registration)">{{ "Törölve" }}</span>
|
||||
<span *ngIf="registrationService.isActive(registration)">{{ "Aktív" }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@ -38,7 +39,7 @@
|
||||
<a *ngIf="mayCancel(registration)" class="btn btn-primary d-none d-lg-inline-block" (click)="cancel(registration)">Lemondás</a>
|
||||
<a class="btn btn-dark d-lg-none w-100 mt-2" (click)="goBack( )">Vissza</a>
|
||||
<a class="btn btn-dark d-none d-lg-inline-block "
|
||||
[class.ms-2]="registration.deleted_at == null"
|
||||
[class.ms-2]="registrationService.isActive(registration)"
|
||||
(click)="goBack( )">Vissza</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -105,6 +105,7 @@ export interface Registration {
|
||||
id: number;
|
||||
created_at: number;
|
||||
deleted_at: number;
|
||||
canceled_at: number;
|
||||
event?: Event
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user