add event object
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<!-- dvbooking-cli/src/templates/angular/details.component.html.tpl -->
|
||||
|
||||
<!-- Generated by the CLI -->
|
||||
<div class="p-4 md:p-8">
|
||||
<ng-container *ngIf="event$ | async as event; else loading">
|
||||
<div class="card bg-base-100 shadow-xl max-w-2xl mx-auto">
|
||||
<div class="card-body">
|
||||
<h2 class="card-title text-3xl">Event Details</h2>
|
||||
|
||||
<div class="overflow-x-auto mt-4">
|
||||
<table class="table w-full">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>id</th>
|
||||
<td>{{ event.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>event_type_id</th>
|
||||
<td>{{ event.event_type_id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>title</th>
|
||||
<td>{{ event.title }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>description</th>
|
||||
<td>{{ event.description }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>start_time</th>
|
||||
<td>{{ event.start_time }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>end_time</th>
|
||||
<td>{{ event.end_time }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>timezone</th>
|
||||
<td>{{ event.timezone }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>is_recurring</th>
|
||||
<td>{{ event.is_recurring }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>created_at</th>
|
||||
<td>{{ event.created_at }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>updated_at</th>
|
||||
<td>{{ event.updated_at }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="card-actions justify-end mt-6">
|
||||
<a routerLink="/events" class="btn btn-secondary">Back to List</a>
|
||||
<a routerLink="/events/{{ event.id }}/edit" class="btn btn-primary">Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<ng-template #loading>
|
||||
<div class="text-center p-8">
|
||||
<span class="loading loading-spinner loading-lg"></span>
|
||||
</div>
|
||||
</ng-template>
|
||||
</div>
|
||||
@@ -0,0 +1,34 @@
|
||||
// dvbooking-cli/src/templates/angular/details.component.ts.tpl
|
||||
|
||||
// Generated by the CLI
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ActivatedRoute, RouterModule } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
import { Event } from '../../models/event.model';
|
||||
import { EventService } from '../../services/event.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-event-details',
|
||||
templateUrl: './event-details.component.html',
|
||||
standalone: true,
|
||||
imports: [CommonModule, RouterModule],
|
||||
})
|
||||
export class EventDetailsComponent implements OnInit {
|
||||
event$!: Observable<Event>;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private eventService: EventService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.event$ = this.route.params.pipe(
|
||||
switchMap(params => {
|
||||
const id = params['id'];
|
||||
return this.eventService.findOne(id);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user