import { Component, OnInit } from '@angular/core';
import { CommonModule, DatePipe } from '@angular/common';
import { ionicStandaloneModules } from '../../../ionic-standalone.modules';
import { NavComponent } from '../../../../app/components/nav/nav.component';
import * as Parse from 'parse';
import { ActivatedRoute } from '@angular/router';
@Component({
  selector: 'app-detail',
  templateUrl: './detail.component.html',
  styleUrls: ['./detail.component.scss'],
  standalone: true,
  imports: [...ionicStandaloneModules, NavComponent, CommonModule],
  providers: [DatePipe],
})
export class DetailComponent implements OnInit {
  order?: Parse.Object;
  constructor(private activateRoute: ActivatedRoute) {}

  ngOnInit() {
    this.activateRoute.paramMap.subscribe(async (params) => {
      let id: any = params.get('id');
      let query = new Parse.Query('Order');
      query.select('price','isPay', 'orderNum','status', 'targetObject.name','targetObject.validity');
      query.get(id).then((res) => {
        this.order = res;
      });
    });
  }
}
