import { CommonModule } from "@angular/common";
import { Component, OnInit } from "@angular/core";
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import {
  NgbCalendar,
  NgbDate,
  NgbDateStruct,
  NgbDatepickerModule,
  NgbDropdownModule,
  NgbModal,
} from "@ng-bootstrap/ng-bootstrap";
import { RingkasanService } from "src/app/cores/api-services/home/ringkasan.service";
import { BaseCrudComponent } from "src/app/cores/class-templates/base-crud.component";
import { HelpersService } from "src/app/cores/services/helpers.service";
import { LoadingService } from "src/app/cores/services/loading.service";

@Component({
  selector: "app-ringkasan",
  standalone: true,
  imports: [
    CommonModule,
    ReactiveFormsModule,
    NgbDropdownModule,
    NgbDatepickerModule,
    FormsModule,
  ],
  templateUrl: "./ringkasan.component.html",
  styleUrls: ["./ringkasan.component.scss"],
})
export class RingkasanComponent
  extends BaseCrudComponent<any>
  implements OnInit
{
  count!: any;
  model!: NgbDateStruct;

  constructor(
    calendar: NgbCalendar,
    public override modal: NgbModal,
    public override helpers: HelpersService,
    public override api: RingkasanService,
    public override loading: LoadingService
  ) {
    super(helpers, loading, api, modal);
  }

  override ngOnInit(): void {
    this.api.getAll().subscribe({
      next: ({ data }) => {
        this.count = data;
      },
    });
  }
}
