/**
 * @license
 * Copyright ASW (A Software World) All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file
 */
import { Component, Inject } from '@angular/core';
import { Validators } from '@angular/forms';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { Constants } from '@asoftwareworld/form-builder/form-control/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/forms";
import * as i2 from "@angular/material/dialog";
import * as i3 from "@angular/material/divider";
import * as i4 from "@angular/material/form-field";
import * as i5 from "@angular/material/datepicker";
import * as i6 from "@angular/material/select";
import * as i7 from "@angular/material/core";
import * as i8 from "@angular/material/slide-toggle";
import * as i9 from "@angular/material/input";
import * as i10 from "@angular/material/tooltip";
import * as i11 from "@angular/common";
export class AswDatepickerDialog {
    constructor(formBuilder, dialogRef, control) {
        this.formBuilder = formBuilder;
        this.dialogRef = dialogRef;
        this.control = control;
        this.constants = Constants;
    }
    ngOnInit() {
        this.validateFormBuilder();
        this.editProperty(this.control);
    }
    validateFormBuilder() {
        this.aswDatepickerForm = this.formBuilder.group({
            tooltip: ['', []],
            label: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(25)]],
            name: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(25)]],
            value: ['', []],
            column: [],
            style: ['', [Validators.required]],
            isRequired: [false]
        });
    }
    editProperty(control) {
        this.aswDatepickerForm.setValue({
            tooltip: control.tooltip,
            label: control.label,
            name: control.name,
            value: control.value,
            style: control.style,
            column: control.column,
            isRequired: control.isRequired
        });
    }
    onNoClick() {
        this.dialogRef.close();
    }
    onSubmit() {
        this.aswDatepickerForm.value.controlType = this.control.controlType;
        this.dialogRef.close(this.aswDatepickerForm.value);
    }
    onChange(event) {
        if (event.checked) {
            this.status = true;
        }
        else {
            this.status = false;
        }
    }
}
AswDatepickerDialog.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: AswDatepickerDialog, deps: [{ token: i1.FormBuilder }, { token: i2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
AswDatepickerDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.4", type: AswDatepickerDialog, selector: "asw-datepicker-dialog", ngImport: i0, template: "<h4 mat-dialog-title>Edit Property</h4>\r\n<mat-divider></mat-divider>\r\n<form [formGroup]=\"aswDatepickerForm\" (ngSubmit)=\"onSubmit()\">\r\n    <mat-dialog-content class=\"mat-typography\">\r\n        <div class=\"asw-full-width\"><br>\r\n            <div class=\"row\">\r\n                <div class=\"col-md-6\">\r\n                    <mat-form-field appearance=\"outline\" class=\"asw-mat-form-field\">\r\n                        <mat-label>Label</mat-label>\r\n                        <input matInput type=\"text\" name=\"label\" placeholder=\"Enter label\" matTooltip=\"Enter label\"\r\n                            formControlName=\"label\" required>\r\n                        <mat-error class=\"asw-mat-error\" *ngFor=\"let validation of constants.accountValidationMessages.label\">\r\n                            <mat-error class=\"asw-mat-error\"\r\n                                *ngIf=\"aswDatepickerForm.get('label')?.hasError(validation.type) && (aswDatepickerForm.get('label')?.dirty || aswDatepickerForm.get('label')?.touched)\">\r\n                                {{validation.message}}\r\n                            </mat-error>\r\n                        </mat-error>\r\n                    </mat-form-field>\r\n                </div>\r\n                <div class=\"col-md-6\">\r\n                    <mat-form-field appearance=\"outline\" class=\"asw-mat-form-field\">\r\n                        <mat-label>Tooltip</mat-label>\r\n                        <input matInput type=\"text\" name=\"tooltip\" placeholder=\"Enter tooltip\"\r\n                            matTooltip=\"Enter tooltip\" formControlName=\"tooltip\">\r\n                    </mat-form-field>\r\n                </div>\r\n            </div>\r\n            <div class=\"row\">\r\n                <div class=\"col-md-12\">\r\n                    <mat-form-field appearance=\"outline\" class=\"asw-mat-form-field\">\r\n                        <mat-label>Name</mat-label>\r\n                        <input matInput type=\"text\" name=\"name\" placeholder=\"Enter name\" matTooltip=\"Enter name\"\r\n                            formControlName=\"name\" required>\r\n                        <mat-error class=\"asw-mat-error\" *ngFor=\"let validation of constants.accountValidationMessages.name\">\r\n                            <mat-error class=\"asw-mat-error\"\r\n                                *ngIf=\"aswDatepickerForm.get('name')?.hasError(validation.type) && (aswDatepickerForm.get('name')?.dirty || aswDatepickerForm.get('name')?.touched)\">\r\n                                {{validation.message}}\r\n                            </mat-error>\r\n                        </mat-error>\r\n                    </mat-form-field>\r\n                </div>\r\n            </div>\r\n            <div class=\"row\">\r\n                <div class=\"col-md-12\">\r\n                    <mat-form-field appearance=\"outline\" class=\"asw-mat-form-field\">\r\n                        <mat-label>Value</mat-label>\r\n                        <input matInput name=\"value\" placeholder=\"Enter value\" matTooltip=\"Enter value\"\r\n                            formControlName=\"value\" [matDatepicker]=\"picker\">\r\n                        <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n                        <mat-datepicker #picker></mat-datepicker>\r\n                    </mat-form-field>\r\n                </div>\r\n            </div>\r\n            <div class=\"row\">\r\n                <div class=\"col-md-6\">\r\n                    <mat-form-field appearance=\"outline\" class=\"asw-mat-form-field\">\r\n                        <mat-label>Column Size</mat-label>\r\n                        <mat-select formControlName=\"column\" matTooltip=\"Select column size\">\r\n                            <mat-option *ngFor=\"let column of constants.columns\" [value]=\"column.value\">\r\n                                {{column.label}}\r\n                            </mat-option>\r\n                        </mat-select>\r\n                    </mat-form-field>\r\n                </div>\r\n                <div class=\"col-md-6\">\r\n                    <mat-form-field appearance=\"outline\" class=\"asw-mat-form-field\">\r\n                        <mat-label>Textbox Style</mat-label>\r\n                        <mat-select formControlName=\"style\" matTooltip=\"Select textbox style\">\r\n                            <mat-option value=\"legacy\">Legacy</mat-option>\r\n                            <mat-option value=\"standard\">Standard</mat-option>\r\n                            <mat-option value=\"fill\">Fill</mat-option>\r\n                            <mat-option value=\"outline\">Outline</mat-option>\r\n                        </mat-select>\r\n                    </mat-form-field>\r\n                </div>\r\n            </div>\r\n            <div class=\"row\">\r\n                <div class=\"col-md-12\">\r\n                    <mat-slide-toggle color=\"primary\" #isActive formControlName=\"isRequired\"\r\n                        (change)=\"onChange($event)\">{{status? 'Required':'Not Required'}}\r\n                    </mat-slide-toggle>\r\n                </div>\r\n            </div>\r\n        </div>\r\n    </mat-dialog-content>\r\n    <mat-dialog-actions align=\"end\">\r\n        <button mat-raised-button type=\"button\" class=\"btn btn-danger mr-2 mb-1 me-2\" (click)=\"onNoClick()\">\r\n            No\r\n        </button>\r\n        <button mat-raised-button type=\"submit\" class=\"btn btn-primary mb-1\" cdkFocusInitial>\r\n            Yes\r\n        </button>\r\n    </mat-dialog-actions>\r\n</form>", components: [{ type: i3.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i5.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { type: i5.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { type: i6.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i7.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: i8.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex", "name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "checked"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }], directives: [{ type: i2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i4.MatLabel, selector: "mat-label" }, { type: i9.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i10.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i11.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.MatError, selector: "mat-error", inputs: ["id"] }, { type: i11.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { type: i4.MatSuffix, selector: "[matSuffix]" }, { type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.4", ngImport: i0, type: AswDatepickerDialog, decorators: [{
            type: Component,
            args: [{ selector: 'asw-datepicker-dialog', template: "<h4 mat-dialog-title>Edit Property</h4>\r\n<mat-divider></mat-divider>\r\n<form [formGroup]=\"aswDatepickerForm\" (ngSubmit)=\"onSubmit()\">\r\n    <mat-dialog-content class=\"mat-typography\">\r\n        <div class=\"asw-full-width\"><br>\r\n            <div class=\"row\">\r\n                <div class=\"col-md-6\">\r\n                    <mat-form-field appearance=\"outline\" class=\"asw-mat-form-field\">\r\n                        <mat-label>Label</mat-label>\r\n                        <input matInput type=\"text\" name=\"label\" placeholder=\"Enter label\" matTooltip=\"Enter label\"\r\n                            formControlName=\"label\" required>\r\n                        <mat-error class=\"asw-mat-error\" *ngFor=\"let validation of constants.accountValidationMessages.label\">\r\n                            <mat-error class=\"asw-mat-error\"\r\n                                *ngIf=\"aswDatepickerForm.get('label')?.hasError(validation.type) && (aswDatepickerForm.get('label')?.dirty || aswDatepickerForm.get('label')?.touched)\">\r\n                                {{validation.message}}\r\n                            </mat-error>\r\n                        </mat-error>\r\n                    </mat-form-field>\r\n                </div>\r\n                <div class=\"col-md-6\">\r\n                    <mat-form-field appearance=\"outline\" class=\"asw-mat-form-field\">\r\n                        <mat-label>Tooltip</mat-label>\r\n                        <input matInput type=\"text\" name=\"tooltip\" placeholder=\"Enter tooltip\"\r\n                            matTooltip=\"Enter tooltip\" formControlName=\"tooltip\">\r\n                    </mat-form-field>\r\n                </div>\r\n            </div>\r\n            <div class=\"row\">\r\n                <div class=\"col-md-12\">\r\n                    <mat-form-field appearance=\"outline\" class=\"asw-mat-form-field\">\r\n                        <mat-label>Name</mat-label>\r\n                        <input matInput type=\"text\" name=\"name\" placeholder=\"Enter name\" matTooltip=\"Enter name\"\r\n                            formControlName=\"name\" required>\r\n                        <mat-error class=\"asw-mat-error\" *ngFor=\"let validation of constants.accountValidationMessages.name\">\r\n                            <mat-error class=\"asw-mat-error\"\r\n                                *ngIf=\"aswDatepickerForm.get('name')?.hasError(validation.type) && (aswDatepickerForm.get('name')?.dirty || aswDatepickerForm.get('name')?.touched)\">\r\n                                {{validation.message}}\r\n                            </mat-error>\r\n                        </mat-error>\r\n                    </mat-form-field>\r\n                </div>\r\n            </div>\r\n            <div class=\"row\">\r\n                <div class=\"col-md-12\">\r\n                    <mat-form-field appearance=\"outline\" class=\"asw-mat-form-field\">\r\n                        <mat-label>Value</mat-label>\r\n                        <input matInput name=\"value\" placeholder=\"Enter value\" matTooltip=\"Enter value\"\r\n                            formControlName=\"value\" [matDatepicker]=\"picker\">\r\n                        <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n                        <mat-datepicker #picker></mat-datepicker>\r\n                    </mat-form-field>\r\n                </div>\r\n            </div>\r\n            <div class=\"row\">\r\n                <div class=\"col-md-6\">\r\n                    <mat-form-field appearance=\"outline\" class=\"asw-mat-form-field\">\r\n                        <mat-label>Column Size</mat-label>\r\n                        <mat-select formControlName=\"column\" matTooltip=\"Select column size\">\r\n                            <mat-option *ngFor=\"let column of constants.columns\" [value]=\"column.value\">\r\n                                {{column.label}}\r\n                            </mat-option>\r\n                        </mat-select>\r\n                    </mat-form-field>\r\n                </div>\r\n                <div class=\"col-md-6\">\r\n                    <mat-form-field appearance=\"outline\" class=\"asw-mat-form-field\">\r\n                        <mat-label>Textbox Style</mat-label>\r\n                        <mat-select formControlName=\"style\" matTooltip=\"Select textbox style\">\r\n                            <mat-option value=\"legacy\">Legacy</mat-option>\r\n                            <mat-option value=\"standard\">Standard</mat-option>\r\n                            <mat-option value=\"fill\">Fill</mat-option>\r\n                            <mat-option value=\"outline\">Outline</mat-option>\r\n                        </mat-select>\r\n                    </mat-form-field>\r\n                </div>\r\n            </div>\r\n            <div class=\"row\">\r\n                <div class=\"col-md-12\">\r\n                    <mat-slide-toggle color=\"primary\" #isActive formControlName=\"isRequired\"\r\n                        (change)=\"onChange($event)\">{{status? 'Required':'Not Required'}}\r\n                    </mat-slide-toggle>\r\n                </div>\r\n            </div>\r\n        </div>\r\n    </mat-dialog-content>\r\n    <mat-dialog-actions align=\"end\">\r\n        <button mat-raised-button type=\"button\" class=\"btn btn-danger mr-2 mb-1 me-2\" (click)=\"onNoClick()\">\r\n            No\r\n        </button>\r\n        <button mat-raised-button type=\"submit\" class=\"btn btn-primary mb-1\" cdkFocusInitial>\r\n            Yes\r\n        </button>\r\n    </mat-dialog-actions>\r\n</form>" }]
        }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }]; } });
//# sourceMappingURL=data:application/json;base64, 