74 lines
2.1 KiB
TypeScript
74 lines
2.1 KiB
TypeScript
import {
|
|
ChangeDetectorRef,
|
|
Component,
|
|
Inject,
|
|
OnInit,
|
|
ViewEncapsulation,
|
|
} from '@angular/core';
|
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|
import { SiteService } from 'app/modules/polyglot/site/services/site.service';
|
|
import { IdentityService } from 'app/modules/polyglot/identity/services/identity.service';
|
|
import { Site } from 'app/modules/proto/models/site_pb';
|
|
|
|
export interface AddComposeData {
|
|
price: string;
|
|
memo: string;
|
|
}
|
|
export interface AddComposeResult {
|
|
choice: boolean;
|
|
}
|
|
|
|
@Component({
|
|
selector: 'app-add-compose',
|
|
templateUrl: './add-compose.component.html',
|
|
encapsulation: ViewEncapsulation.None,
|
|
})
|
|
export class AddComposeComponent implements OnInit {
|
|
composeForm!: FormGroup;
|
|
sites: any[] = [];
|
|
// quillModules: any = {
|
|
// toolbar: [
|
|
// ['bold', 'italic', 'underline'],
|
|
// [{ align: [] }, { list: 'ordered' }, { list: 'bullet' }],
|
|
// ['clean'],
|
|
// ],
|
|
// };
|
|
|
|
/**
|
|
* Constructor
|
|
*/
|
|
constructor(
|
|
public matDialogRef: MatDialogRef<AddComposeComponent>,
|
|
@Inject(MAT_DIALOG_DATA) public data: AddComposeData,
|
|
private _formBuilder: FormBuilder,
|
|
private _identityService: IdentityService,
|
|
private _changeDetectorRef: ChangeDetectorRef
|
|
) {}
|
|
|
|
// -----------------------------------------------------------------------------------------------------
|
|
// @ Lifecycle hooks
|
|
// -----------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
* On init
|
|
*/
|
|
ngOnInit(): void {
|
|
// Create the form
|
|
this.composeForm = this._formBuilder.group({
|
|
price: ['', [Validators.required]],
|
|
memo: ['', [Validators.required]],
|
|
});
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------------------------------
|
|
// @ Public methods
|
|
// -----------------------------------------------------------------------------------------------------
|
|
|
|
selectAndClose(choice: boolean): void {
|
|
this.matDialogRef.close({
|
|
choice,
|
|
});
|
|
}
|
|
}
|