import { AbstractDialog } from '@/shared/abstractClasses/abstract-dialog';
import { UikitFlatpickrJalaliComponent } from '@/uikit';
import { Component, inject } from '@angular/core';
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
import { PosLandingStore } from '../store/main.store';
import { SharedDialogComponent } from '@/shared/components/dialog/dialog.component';

@Component({
  selector: 'pos-pre-invoice-dialog',
  templateUrl: './pre-invoice-dialog.component.html',
  imports: [SharedDialogComponent, UikitFlatpickrJalaliComponent, ReactiveFormsModule],
})
export class PosPreInvoiceDialogComponent extends AbstractDialog {
  private readonly store = inject(PosLandingStore);
  private readonly fb = inject(FormBuilder);

  private initForm() {
    const form = this.fb.group({
      invoiceDate: [this.store.invoiceDate(), [Validators.required]],
    });
    return form;
  }

  form = this.initForm();
}
