import { Component, OnInit, AfterViewInit, QueryList, ViewChildren } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import {
    TripJsonld,
    TripLocationJsonld,
    TripLocationService,
    TripService,
    LocationService,
    LocationJsonld,
    UserTripService, UserService, UserTripJsonld, UserJsonld, UserTripEventJsonld, UserTripEventService, TripLocation
} from "@app/core/api/v1";
import { AppHelperService } from "@app/_helpers/app-helper.service";
import { ActivatedRoute } from "@angular/router";
import { FormMode, FormSubmitEvent } from "@app/_components/_abstract/abstract-data-form-component";
import { ModalStatus } from "@app/_helpers/modal.states";
import {firstValueFrom, Observable} from 'rxjs';
import { ListColDefinition } from '@app/_components/list/list-col-definition';
import { SearchSelectComponent } from '@app/_components/search-select/search-select.component';
import {map} from "rxjs/operators";
import {TranslateService} from "@ngx-translate/core";

@Component({
    selector: 'app-trip-detail',
    templateUrl: './trip-detail.component.html',
    styleUrl: './trip-detail.component.scss'
})
export class TripDetailComponent implements OnInit {
    protected trip!: TripJsonld;
    protected users: UserJsonld[] = [];

    constructor(
        private tripService: TripService,
        protected appHelperService: AppHelperService,
        protected translateService: TranslateService,
        private route: ActivatedRoute,
    ) {}

    ngOnInit() {
        this.route.params.subscribe(params => {
            this.tripService.tripsIdGet(params['id']).subscribe(
                data => {
                    this.trip = data;
                }
            );
        });
    }
}