/**
 * @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 { 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/input";
import * as i6 from "@angular/material/tooltip";
export class AswGpsDialog {
    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.aswEditGpsForm = this.formBuilder.group({
            latitude: ['', []],
            longitude: ['', []],
            value: ['', []]
        });
    }
    editProperty(control) {
        this.aswEditGpsForm.setValue({
            latitude: control.latitude,
            longitude: control.longitude,
            value: control.value
        });
    }
    onNoClick() {
        this.dialogRef.close();
    }
    onSubmit() {
        if (this.aswEditGpsForm.invalid) {
            return;
        }
        this.aswEditGpsForm.value.displayName = this.control.displayName;
        this.aswEditGpsForm.value.controlType = this.control.controlType;
        this.dialogRef.close(this.aswEditGpsForm.value);
    }
    onChange(event) {
        if (event.checked) {
            this.status = true;
        }
        else {
            this.status = false;
        }
    }
}
AswGpsDialog.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: AswGpsDialog, deps: [{ token: i1.FormBuilder }, { token: i2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
AswGpsDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", type: AswGpsDialog, selector: "asw-gps-dialog", ngImport: i0, template: "<h4 mat-dialog-title>Edit Property</h4>\r\n<mat-divider></mat-divider>\r\n<form [formGroup]=\"aswEditGpsForm\" (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\">\r\n                        <mat-label>Latitude</mat-label>\r\n                        <input matInput type=\"text\"\r\n                                        name=\"latitude\"\r\n                                        placeholder=\"Enter latitude\"\r\n                                        matTooltip=\"Enter latitude\"\r\n                                        formControlName=\"latitude\">\r\n                    </mat-form-field>\r\n                </div>\r\n                <div class=\"col-md-6\">\r\n                    <mat-form-field appearance=\"outline\">\r\n                        <mat-label>Longitude</mat-label>\r\n                        <input matInput type=\"text\"\r\n                                        name=\"longitude\"\r\n                                        placeholder=\"Enter longitude\"\r\n                                        matTooltip=\"Enter longitude\"\r\n                                        formControlName=\"longitude\">\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\">\r\n                        <mat-label>Location</mat-label>\r\n                        <input matInput type=\"text\"\r\n                                        name=\"name\"\r\n                                        placeholder=\"Enter location\"\r\n                                        matTooltip=\"Enter location\"\r\n                                        formControlName=\"value\">\r\n                    </mat-form-field>\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\r\n                type=\"button\"\r\n                class=\"btn btn-danger mr-2 mb-1\"\r\n                (click)=\"onNoClick()\">\r\n            No\r\n        </button>\r\n        <button mat-raised-button type=\"submit\"\r\n                class=\"btn btn-primary mb-1\"\r\n                cdkFocusInitial>\r\n            Yes\r\n        </button>\r\n    </mat-dialog-actions>\r\n</form>\r\n\r\n", 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"] }], 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: i5.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: i6.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: AswGpsDialog, decorators: [{
            type: Component,
            args: [{ selector: 'asw-gps-dialog', template: "<h4 mat-dialog-title>Edit Property</h4>\r\n<mat-divider></mat-divider>\r\n<form [formGroup]=\"aswEditGpsForm\" (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\">\r\n                        <mat-label>Latitude</mat-label>\r\n                        <input matInput type=\"text\"\r\n                                        name=\"latitude\"\r\n                                        placeholder=\"Enter latitude\"\r\n                                        matTooltip=\"Enter latitude\"\r\n                                        formControlName=\"latitude\">\r\n                    </mat-form-field>\r\n                </div>\r\n                <div class=\"col-md-6\">\r\n                    <mat-form-field appearance=\"outline\">\r\n                        <mat-label>Longitude</mat-label>\r\n                        <input matInput type=\"text\"\r\n                                        name=\"longitude\"\r\n                                        placeholder=\"Enter longitude\"\r\n                                        matTooltip=\"Enter longitude\"\r\n                                        formControlName=\"longitude\">\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\">\r\n                        <mat-label>Location</mat-label>\r\n                        <input matInput type=\"text\"\r\n                                        name=\"name\"\r\n                                        placeholder=\"Enter location\"\r\n                                        matTooltip=\"Enter location\"\r\n                                        formControlName=\"value\">\r\n                    </mat-form-field>\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\r\n                type=\"button\"\r\n                class=\"btn btn-danger mr-2 mb-1\"\r\n                (click)=\"onNoClick()\">\r\n            No\r\n        </button>\r\n        <button mat-raised-button type=\"submit\"\r\n                class=\"btn btn-primary mb-1\"\r\n                cdkFocusInitial>\r\n            Yes\r\n        </button>\r\n    </mat-dialog-actions>\r\n</form>\r\n\r\n" }]
        }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }]; } });
//# sourceMappingURL=data:application/json;base64, 