import { CommonModule } from '@angular/common';
import { Component, OnInit, ViewChild, inject } from '@angular/core';
import { STColumn, STComponent } from '@delon/abc/st';
import { SFSchema } from '@delon/form';
import { ModalHelper, _HttpClient } from '@delon/theme';
import { SHARED_IMPORTS } from '@shared';

@Component({
  selector: 'data-v-date',
  standalone: true,
  imports: [CommonModule, ...SHARED_IMPORTS],
  template: ` <div class="data-container">
    {{ currentTime | date: 'yyyy-MM-dd HH:mm:ss' }}
  </div>`,
  styleUrls: ['./date.component.less']
})
export class DataVDateComponent implements OnInit {
  private readonly http = inject(_HttpClient);
  private readonly modal = inject(ModalHelper);

  currentTime: any;

  ngOnInit(): void {
    this.updateCurrentTime();
    setInterval(() => {
      this.updateCurrentTime();
    }, 1000);
  }

  add(): void {
    // this.modal
    //   .createStatic(FormEditComponent, { i: { id: 0 } })
    //   .subscribe(() => this.st.reload());
  }

  updateCurrentTime() {
    this.currentTime = new Date();
  }
}
