import { Component, Output, Input, EventEmitter, ViewChildren, ViewChild, effect } from '@angular/core';
import { MessageBox } from "../../message-box/message-box";
import ODataStore from "devextreme/data/odata/store";
import ArrayStore from "devextreme/data/array_store";
import { DxDataGridComponent } from 'devextreme-angular';
import { Project, ProjectLocation } from "mobicloud-core/api";
import * as i0 from "@angular/core";
import * as i1 from "mobicloud-core";
import * as i2 from "mobicloud-core/api";
import * as i3 from "@angular/material/dialog";
import * as i4 from "@angular/common";
import * as i5 from "devextreme-angular/core";
import * as i6 from "devextreme-angular/ui/nested";
import * as i7 from "devextreme-angular";
import * as i8 from "devextreme-angular/ui/data-grid";
import * as i9 from "devextreme-angular/ui/form";
import * as i10 from "../../group-box/group-box.component";
export class ProjectLocationComponent {
    constructor(coreService, cloudDataService, matDialog) {
        this.coreService = coreService;
        this.cloudDataService = cloudDataService;
        this.matDialog = matDialog;
        this.editAllowed = false;
        this.inEditMode = false;
        this.isLoadingData = false;
        this.loadingText = $localize `:@@Loading-Text:Loading...`;
        this.hasErrors = false;
        this.errorText = "";
        this.projectChanged = new EventEmitter();
        this._countryOpened = false;
        effect(() => {
            const userProfile = this.cloudDataService.coreService.mobiUserProfile();
            if (userProfile) {
                this.cloudDataService.coreService.requireEmployeePermission(userProfile, (valid) => {
                    this.editAllowed = valid;
                });
            }
        });
    }
    ngOnInit() {
        this.initializeDataSource();
        this.createCountryDataSource();
    }
    async initializeDataSource() {
        this.project_store = new ODataStore({
            url: this.cloudDataService.getMobiManagementODataUrl("Project"),
            beforeSend: (e) => {
                if (e.method?.toUpperCase() == "POST") {
                    e.url = this.cloudDataService.getMobiManagementODataUrl("Project(" + this.project?.Id + ")/UpdateLocation");
                    e.payload = { location: e.payload };
                }
            },
            withCredentials: true,
            key: "Id",
            keyType: "Guid",
            version: 4,
        });
        this.projectlocation_store = new ODataStore({
            url: this.cloudDataService.getMobiManagementODataUrl("ProjectLocation"),
            withCredentials: true,
            key: "Id",
            keyType: "Guid",
            version: 4,
        });
    }
    ngOnChanges(changes) {
        if (changes['project']?.currentValue && changes['project'].currentValue != this.formProject) {
            this.formProject = this.project;
            this.onProjectChanged(this.formProject);
        }
    }
    onProjectChanged(proj) {
        this._countryId = this.formProject?.Location?.Country?.toString();
        if (this.datagrids) {
            this.datagrids.forEach(function (dataGrid) {
                dataGrid.instance?.refresh();
            });
        }
    }
    getProject() {
        if (this.project?.Id && this.project_store) {
            this.isLoadingData = true;
            this.loadingText = $localize `:@@Loading-Text-Project:Loading project...`;
            this.project_store.byKey(this.project.Id, { expand: this.project_expands }).then((dataItem) => {
                this.formProject = Object.assign(new Project(), dataItem[0]);
                this.project = this.formProject;
                this.onProjectChanged(this.project);
                this.isLoadingData = false;
                this.hasErrors = false;
                this.errorText = "";
                this.loadingText = $localize `:@@Loading-Text:Loading...`;
                this.projectChanged.emit(this.project);
            }, (error) => {
                console.log(error);
                this.isLoadingData = false;
                this.hasErrors = true;
                this.errorText = error;
                this.loadingText = $localize `:@@Loading-Text:Loading...`;
            });
        }
    }
    onEditClick() {
        this.form.instance?.getEditor("ProjectId")?.focus();
        this.inEditMode = true;
    }
    onSaveClick() {
        const validateResult = this.form.instance.validate();
        if (validateResult?.isValid) {
            this.saveProjectLocation();
        }
    }
    saveProjectLocation() {
        this.isLoadingData = true;
        this.loadingText = $localize `:@@Updating-Text-Location:Updating location...`;
        if (this.project?.Location?.Id && this.projectlocation_store && this.formProject) {
            const data = {
                Street: this.formProject.Location?.Street,
                ZipCode: this.formProject.Location?.ZipCode,
                City: this.formProject.Location?.City,
                Country: this._countryId,
                Phone: this.formProject.Location?.Phone,
                Email: this.formProject.Location?.Email,
                ContactPerson: this.formProject.Location?.ContactPerson,
            };
            this.projectlocation_store.update(this.project.Location.Id, data)
                .then((dataObj) => {
                this.getProject();
                this.isLoadingData = false;
                this.inEditMode = false;
                this.loadingText = $localize `:@@Loading-Text:Loading...`;
            }, (error) => {
                console.log(error);
                this.isLoadingData = false;
                this.loadingText = $localize `:@@Loading-Text:Loading...`;
                MessageBox.showError({ title: $localize `:@@Failed-Text-Location:Location update failed`, message: error }, this.matDialog)
                    .subscribe(result => {
                });
            });
        }
        else if (this.project_store && this.formProject) {
            this.project_store.insert({
                Street: this.formProject.Location?.Street,
                ZipCode: this.formProject.Location?.ZipCode,
                City: this.formProject.Location?.City,
                Country: this._countryId
            })
                .then((dataObj) => {
                this.getProject();
                this.isLoadingData = false;
                this.inEditMode = false;
                this.loadingText = $localize `:@@Loading-Text:Loading...`;
            }, (error) => {
                console.log(error);
                this.isLoadingData = false;
                this.loadingText = $localize `:@@Loading-Text:Loading...`;
                MessageBox.showError({ title: $localize `:@@Failed-Text-Location:Location update failed`, message: error }, this.matDialog)
                    .subscribe(result => {
                });
            });
        }
    }
    onCancelEditClick() {
        this.getProject();
        this.inEditMode = false;
    }
    onRetryClick() {
        this.getProject();
        this.inEditMode = false;
    }
    createCountryDataSource() {
        this.country_ds = new ArrayStore({ key: 'Code2', data: Array.from(this.coreService.countries()?.values() ?? []) });
    }
    countryChanged(args) {
        this._selectedCountry = args.selectedRowsData?.length > 0 ? args.selectedRowsData[0] : undefined;
        this._countryId = this._selectedCountry?.Code2;
        if (this.formProject) {
            if (!this.formProject.Location) {
                this.formProject.Location = new ProjectLocation();
            }
            if (this.formProject.Location)
                this.formProject.Location.Country = this._countryId;
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ProjectLocationComponent, deps: [{ token: i1.MobicloudCoreService }, { token: i2.MobiCloudDataService }, { token: i3.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ProjectLocationComponent, selector: "mobicloud-project-location", inputs: { project: "project", project_expands: "project_expands", editAllowed: "editAllowed", inEditMode: "inEditMode", width: "width", contentheight: "contentheight", isLoadingData: "isLoadingData", loadingText: "loadingText", hasErrors: "hasErrors", errorText: "errorText" }, outputs: { projectChanged: "projectChanged" }, viewQueries: [{ propertyName: "form", first: true, predicate: ["form"], descendants: true }, { propertyName: "datagrids", predicate: DxDataGridComponent, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<mobicloud-group-box title=\"Location\" i18n-title=\"@@CaptionHeader-Location\" [width]=\"[width]\" [contentheight]=[contentheight] class=\"projectLocationForm\" [isLoadingData]=\"isLoadingData\" [loadingText]=\"loadingText\" \n   [editAllowed]=\"editAllowed\" [inEditMode]=\"inEditMode\" [hasErrors]=\"hasErrors\" errorCaption=\"Error\" i18n-errorCaption=\"@@CaptionHeader-Error\" [errorText]=\"errorText\" [enableRetryOnError]=\"true\"\n    (Edit_Click)=\"onEditClick()\" (Save_Click)=\"onSaveClick()\" (CancelEdit_Click)=\"onCancelEditClick()\" (Retry_Click)=\"onRetryClick()\">\n\n    <dx-form #form id=\"form\"\n        [formData]=\"formProject\"\n        [readOnly]=\"!inEditMode\"\n        [showColonAfterLabel]=\"true\"\n        labelLocation=\"top\"\n        [showValidationSummary]=\"false\" \n        [showRequiredMark] = \"false\"\n        validationGroup=\"formProjectData_Location\">\n\n        <dxi-item itemType=\"group\" caption=\"\" [colCount]=\"2\">\n            <dxi-item dataField=\"Location.Street\" [colSpan]=\"2\">\n                <dxo-label text=\"Address\" i18n-text=\"@@FieldCaption-Address\"></dxo-label>\n            </dxi-item>\n            <dxi-item dataField=\"Location.ZipCode\">\n                <dxo-label text=\"Zip code\" i18n-text=\"@@FieldCaption-ZipCode\"></dxo-label>\n            </dxi-item>\n            <dxi-item dataField=\"Location.City\">\n                <dxo-label text=\"City\"  i18n-text=\"@@FieldCaption-City\"></dxo-label>\n            </dxi-item>\n\n            <dxi-item dataField=\"Location.Country\" [colSpan]=\"2\">\n                <dxo-label text=\"Country\" i18n-text=\"@@FieldCaption-Country\"></dxo-label>  \n                <div *dxTemplate=\"let data of 'content'\">\n                    <dx-drop-down-box [deferRendering]=\"true\" [showClearButton]=\"true\" [readOnly]=\"!inEditMode\" fieldTemplate=\"fieldTemplate\"\n                        [dataSource]=\"country_ds\"                   \n                        [(value)]=\"_countryId\"\n                        valueExpr=\"Code2\"                \n                        displayExpr=\"LocalName\"                                    \n                        [(opened)]=\"_countryOpened\"> \n                        <dxo-drop-down-options title=\"Countries\" i18n-title=\"@@FieldCaption-Countries\" [showTitle]=\"true\" [fullScreen]=\"false\" [showCloseButton]=\"true\">\n                    </dxo-drop-down-options>                                       \n                        <dx-data-grid [filterRow]=\"{ visible: true }\" [scrolling]=\"{ mode: 'standard' }\" [selection]=\"{ mode: 'single' }\" height=\"100%\" [hoverStateEnabled]=\"true\"\n                            [dataSource]=\"country_ds\"\n                            [(selectedRowKeys)]=\"_countryId\"\n                            (onSelectionChanged)=\"countryChanged($event)\"\n                            (onRowClick)=\"_countryOpened = false\">\n                            <dxi-column dataField=\"Code2\" [allowFiltering]=\"false\" [allowSorting]=\"false\" cellTemplate=\"imgCellTemplate\" all [width]=\"50\" caption=\"\"></dxi-column>\n                            <dxi-column dataField=\"LocalName\" i18n-caption=\"@@GridColumn-Name\" caption=\"Name\"></dxi-column>\n                            <dxo-paging [enabled]=\"false\"></dxo-paging>\n                            <div *dxTemplate=\"let data of 'imgCellTemplate'\">\n                                <img alt=\"\"src=\"{{cloudDataService.FlagUrl}}/{{data.value}}-32.png\"/>\n                            </div>\n                        </dx-data-grid>\n                        <div *dxTemplate=\"let data of 'fieldTemplate'\">\n                            <div class=\"country-edit-item\">\n                                <div class=\"country-edit-image\"><img alt=\"\" src=\"{{cloudDataService.FlagUrl}}/{{_selectedCountry?.Code2}}-32.png\" *ngIf=\"_selectedCountry?.Code2\"></div>\n                                <div class=\"country-edit-text\">\n                                    <dx-text-box stylingMode=\"filled\" [value]=\"_selectedCountry?.LocalName\" [readOnly]=\"true\"></dx-text-box>\n                                </div>\n                            </div>\n                        </div>\n                    </dx-drop-down-box>\n                </div>   \n                <!-- <dxi-validation-rule type=\"required\" message=\"Country is required\"></dxi-validation-rule>    -->\n            </dxi-item>\n            <dxi-item dataField=\"Location.ContactPerson\">\n                <dxo-label text=\"Contact person\" i18n-text=\"@@FieldCaption-ContactPerson\"></dxo-label>\n            </dxi-item>  \n            <dxi-item dataField=\"Location.Phone\">\n                <dxo-label text=\"Phone\" i18n-text=\"@@FieldCaption-Phone\"></dxo-label>\n            </dxi-item>\n            <dxi-item dataField=\"Location.Email\" [colSpan]=\"2\" [editorOptions]=\"{ inputAttr: {'autocomplete': 'email'} }\">\n                <dxo-label text=\"Email\" i18n-text=\"@@FieldCaption-Email\"></dxo-label>     \n                <dxi-validation-rule type=\"email\" message=\"Email is invalid\" i18n-message=\"@@ValidationText-Email-Invalid\"></dxi-validation-rule>                           \n            </dxi-item>             \n \n        </dxi-item>\n        \n    </dx-form>\n\n</mobicloud-group-box>", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.DxTemplateDirective, selector: "[dxTemplate]", inputs: ["dxTemplateOf"] }, { kind: "component", type: i6.DxoDropDownOptionsComponent, selector: "dxo-drop-down-options", inputs: ["accessKey", "animation", "container", "contentTemplate", "deferRendering", "disabled", "dragAndResizeArea", "dragEnabled", "dragOutsideBoundary", "enableBodyScroll", "focusStateEnabled", "fullScreen", "height", "hideOnOutsideClick", "hideOnParentScroll", "hint", "hoverStateEnabled", "maxHeight", "maxWidth", "minHeight", "minWidth", "onContentReady", "onDisposing", "onHidden", "onHiding", "onInitialized", "onOptionChanged", "onResize", "onResizeEnd", "onResizeStart", "onShowing", "onShown", "onTitleRendered", "position", "resizeEnabled", "restorePosition", "rtlEnabled", "shading", "shadingColor", "showCloseButton", "showTitle", "tabIndex", "title", "titleTemplate", "toolbarItems", "visible", "width", "wrapperAttr", "hideEvent", "showEvent", "target"], outputs: ["heightChange", "positionChange", "visibleChange", "widthChange"] }, { kind: "component", type: i6.DxiItemComponent, selector: "dxi-item", inputs: ["disabled", "html", "icon", "template", "text", "title", "titleTemplate", "visible", "onClick", "stylingMode", "type", "baseSize", "box", "ratio", "shrink", "elementAttr", "hint", "alt", "author", "id", "isDeleted", "isEdited", "src", "timestamp", "beginGroup", "closeMenuOnClick", "items", "selectable", "selected", "colSpan", "cssClass", "dataField", "editorOptions", "editorType", "helpText", "isRequired", "itemType", "label", "name", "validationRules", "visibleIndex", "alignItemLabels", "caption", "captionTemplate", "colCount", "colCountByScreen", "tabPanelOptions", "tabs", "badge", "tabTemplate", "buttonOptions", "horizontalAlignment", "verticalAlignment", "locateInMenu", "location", "menuItemTemplate", "options", "showText", "widget", "height", "width", "imageAlt", "imageSrc", "acceptedValues", "commands", "key", "showChevron", "linkAttr", "url", "collapsed", "collapsedSize", "collapsible", "maxSize", "minSize", "resizable", "size", "splitter", "heightRatio", "widthRatio", "expanded", "hasItems", "parentId"] }, { kind: "component", type: i7.DxTextBoxComponent, selector: "dx-text-box", inputs: ["accessKey", "activeStateEnabled", "buttons", "disabled", "elementAttr", "focusStateEnabled", "height", "hint", "hoverStateEnabled", "inputAttr", "isDirty", "isValid", "label", "labelMode", "mask", "maskChar", "maskInvalidMessage", "maskRules", "maxLength", "mode", "name", "placeholder", "readOnly", "rtlEnabled", "showClearButton", "showMaskMode", "spellcheck", "stylingMode", "tabIndex", "text", "useMaskedValue", "validationError", "validationErrors", "validationMessageMode", "validationMessagePosition", "validationStatus", "value", "valueChangeEvent", "visible", "width"], outputs: ["onChange", "onContentReady", "onCopy", "onCut", "onDisposing", "onEnterKey", "onFocusIn", "onFocusOut", "onInitialized", "onInput", "onKeyDown", "onKeyUp", "onOptionChanged", "onPaste", "onValueChanged", "accessKeyChange", "activeStateEnabledChange", "buttonsChange", "disabledChange", "elementAttrChange", "focusStateEnabledChange", "heightChange", "hintChange", "hoverStateEnabledChange", "inputAttrChange", "isDirtyChange", "isValidChange", "labelChange", "labelModeChange", "maskChange", "maskCharChange", "maskInvalidMessageChange", "maskRulesChange", "maxLengthChange", "modeChange", "nameChange", "placeholderChange", "readOnlyChange", "rtlEnabledChange", "showClearButtonChange", "showMaskModeChange", "spellcheckChange", "stylingModeChange", "tabIndexChange", "textChange", "useMaskedValueChange", "validationErrorChange", "validationErrorsChange", "validationMessageModeChange", "validationMessagePositionChange", "validationStatusChange", "valueChange", "valueChangeEventChange", "visibleChange", "widthChange", "onBlur"] }, { kind: "component", type: i7.DxDropDownBoxComponent, selector: "dx-drop-down-box", inputs: ["acceptCustomValue", "accessKey", "activeStateEnabled", "buttons", "contentTemplate", "dataSource", "deferRendering", "disabled", "displayExpr", "displayValueFormatter", "dropDownButtonTemplate", "dropDownOptions", "elementAttr", "fieldTemplate", "focusStateEnabled", "height", "hint", "hoverStateEnabled", "inputAttr", "isDirty", "isValid", "items", "label", "labelMode", "maxLength", "name", "opened", "openOnFieldClick", "placeholder", "readOnly", "rtlEnabled", "showClearButton", "showDropDownButton", "stylingMode", "tabIndex", "text", "validationError", "validationErrors", "validationMessageMode", "validationMessagePosition", "validationStatus", "value", "valueChangeEvent", "valueExpr", "visible", "width"], outputs: ["onChange", "onClosed", "onCopy", "onCut", "onDisposing", "onEnterKey", "onFocusIn", "onFocusOut", "onInitialized", "onInput", "onKeyDown", "onKeyUp", "onOpened", "onOptionChanged", "onPaste", "onValueChanged", "acceptCustomValueChange", "accessKeyChange", "activeStateEnabledChange", "buttonsChange", "contentTemplateChange", "dataSourceChange", "deferRenderingChange", "disabledChange", "displayExprChange", "displayValueFormatterChange", "dropDownButtonTemplateChange", "dropDownOptionsChange", "elementAttrChange", "fieldTemplateChange", "focusStateEnabledChange", "heightChange", "hintChange", "hoverStateEnabledChange", "inputAttrChange", "isDirtyChange", "isValidChange", "itemsChange", "labelChange", "labelModeChange", "maxLengthChange", "nameChange", "openedChange", "openOnFieldClickChange", "placeholderChange", "readOnlyChange", "rtlEnabledChange", "showClearButtonChange", "showDropDownButtonChange", "stylingModeChange", "tabIndexChange", "textChange", "validationErrorChange", "validationErrorsChange", "validationMessageModeChange", "validationMessagePositionChange", "validationStatusChange", "valueChange", "valueChangeEventChange", "valueExprChange", "visibleChange", "widthChange", "onBlur"] }, { kind: "component", type: i6.DxiColumnComponent, selector: "dxi-column", inputs: ["alignment", "allowEditing", "allowExporting", "allowFiltering", "allowFixing", "allowGrouping", "allowHeaderFiltering", "allowHiding", "allowReordering", "allowResizing", "allowSearch", "allowSorting", "autoExpandGroup", "buttons", "calculateCellValue", "calculateDisplayValue", "calculateFilterExpression", "calculateGroupValue", "calculateSortValue", "caption", "cellTemplate", "columns", "cssClass", "customizeText", "dataField", "dataType", "editCellTemplate", "editorOptions", "encodeHtml", "falseText", "filterOperations", "filterType", "filterValue", "filterValues", "fixed", "fixedPosition", "format", "formItem", "groupCellTemplate", "groupIndex", "headerCellTemplate", "headerFilter", "hidingPriority", "isBand", "lookup", "minWidth", "name", "ownerBand", "renderAsync", "selectedFilterOperation", "setCellValue", "showEditorAlways", "showInColumnChooser", "showWhenGrouped", "sortIndex", "sortingMethod", "sortOrder", "trueText", "type", "validationRules", "visible", "visibleIndex", "width"], outputs: ["filterValueChange", "filterValuesChange", "groupIndexChange", "selectedFilterOperationChange", "sortIndexChange", "sortOrderChange", "visibleChange", "visibleIndexChange"] }, { kind: "component", type: i6.DxoLabelComponent, selector: "dxo-label", inputs: ["connectorColor", "connectorWidth", "customizeText", "font", "format", "indent", "visible", "horizontalAlignment", "position", "text", "verticalAlignment", "alignment", "customizeHint", "displayMode", "indentFromAxis", "overlappingBehavior", "rotationAngle", "staggeringSpacing", "template", "textOverflow", "wordWrap", "argumentFormat", "backgroundColor", "border", "connector", "displayFormat", "horizontalOffset", "showForZeroValues", "verticalOffset", "hideFirstOrLast", "indentFromTick", "useRangeColors", "location", "showColon", "radialOffset", "topIndent", "shadow", "useNodeColors", "dataField", "enabled"] }, { kind: "component", type: i8.DxDataGridComponent, selector: "dx-data-grid", inputs: ["accessKey", "activeStateEnabled", "allowColumnReordering", "allowColumnResizing", "autoNavigateToFocusedRow", "cacheEnabled", "cellHintEnabled", "columnAutoWidth", "columnChooser", "columnFixing", "columnHidingEnabled", "columnMinWidth", "columnResizingMode", "columns", "columnWidth", "customizeColumns", "dataRowTemplate", "dataSource", "dateSerializationFormat", "disabled", "editing", "elementAttr", "errorRowEnabled", "export", "filterBuilder", "filterBuilderPopup", "filterPanel", "filterRow", "filterSyncEnabled", "filterValue", "focusedColumnIndex", "focusedRowEnabled", "focusedRowIndex", "focusedRowKey", "grouping", "groupPanel", "headerFilter", "height", "highlightChanges", "hint", "hoverStateEnabled", "keyboardNavigation", "keyExpr", "loadPanel", "masterDetail", "noDataText", "pager", "paging", "remoteOperations", "renderAsync", "repaintChangesOnly", "rowAlternationEnabled", "rowDragging", "rowTemplate", "rtlEnabled", "scrolling", "searchPanel", "selectedRowKeys", "selection", "selectionFilter", "showBorders", "showColumnHeaders", "showColumnLines", "showRowLines", "sortByGroupSummaryInfo", "sorting", "stateStoring", "summary", "syncLookupFilterValues", "tabIndex", "toolbar", "twoWayBindingEnabled", "visible", "width", "wordWrapEnabled"], outputs: ["onAdaptiveDetailRowPreparing", "onCellClick", "onCellDblClick", "onCellHoverChanged", "onCellPrepared", "onContentReady", "onContextMenuPreparing", "onDataErrorOccurred", "onDisposing", "onEditCanceled", "onEditCanceling", "onEditingStart", "onEditorPrepared", "onEditorPreparing", "onExporting", "onFocusedCellChanged", "onFocusedCellChanging", "onFocusedRowChanged", "onFocusedRowChanging", "onInitialized", "onInitNewRow", "onKeyDown", "onOptionChanged", "onRowClick", "onRowCollapsed", "onRowCollapsing", "onRowDblClick", "onRowExpanded", "onRowExpanding", "onRowInserted", "onRowInserting", "onRowPrepared", "onRowRemoved", "onRowRemoving", "onRowUpdated", "onRowUpdating", "onRowValidating", "onSaved", "onSaving", "onSelectionChanged", "onToolbarPreparing", "accessKeyChange", "activeStateEnabledChange", "allowColumnReorderingChange", "allowColumnResizingChange", "autoNavigateToFocusedRowChange", "cacheEnabledChange", "cellHintEnabledChange", "columnAutoWidthChange", "columnChooserChange", "columnFixingChange", "columnHidingEnabledChange", "columnMinWidthChange", "columnResizingModeChange", "columnsChange", "columnWidthChange", "customizeColumnsChange", "dataRowTemplateChange", "dataSourceChange", "dateSerializationFormatChange", "disabledChange", "editingChange", "elementAttrChange", "errorRowEnabledChange", "exportChange", "filterBuilderChange", "filterBuilderPopupChange", "filterPanelChange", "filterRowChange", "filterSyncEnabledChange", "filterValueChange", "focusedColumnIndexChange", "focusedRowEnabledChange", "focusedRowIndexChange", "focusedRowKeyChange", "groupingChange", "groupPanelChange", "headerFilterChange", "heightChange", "highlightChangesChange", "hintChange", "hoverStateEnabledChange", "keyboardNavigationChange", "keyExprChange", "loadPanelChange", "masterDetailChange", "noDataTextChange", "pagerChange", "pagingChange", "remoteOperationsChange", "renderAsyncChange", "repaintChangesOnlyChange", "rowAlternationEnabledChange", "rowDraggingChange", "rowTemplateChange", "rtlEnabledChange", "scrollingChange", "searchPanelChange", "selectedRowKeysChange", "selectionChange", "selectionFilterChange", "showBordersChange", "showColumnHeadersChange", "showColumnLinesChange", "showRowLinesChange", "sortByGroupSummaryInfoChange", "sortingChange", "stateStoringChange", "summaryChange", "syncLookupFilterValuesChange", "tabIndexChange", "toolbarChange", "twoWayBindingEnabledChange", "visibleChange", "widthChange", "wordWrapEnabledChange"] }, { kind: "component", type: i6.DxiValidationRuleComponent, selector: "dxi-validation-rule", inputs: ["message", "trim", "type", "ignoreEmptyValue", "max", "min", "reevaluate", "validationCallback", "comparisonTarget", "comparisonType", "pattern"] }, { kind: "component", type: i6.DxoPagingComponent, selector: "dxo-paging", inputs: ["enabled", "pageIndex", "pageSize"], outputs: ["pageIndexChange", "pageSizeChange"] }, { kind: "component", type: i9.DxFormComponent, selector: "dx-form", inputs: ["accessKey", "activeStateEnabled", "alignItemLabels", "alignItemLabelsInAllGroups", "colCount", "colCountByScreen", "customizeItem", "disabled", "elementAttr", "focusStateEnabled", "formData", "height", "hint", "hoverStateEnabled", "isDirty", "items", "labelLocation", "labelMode", "minColWidth", "optionalMark", "readOnly", "requiredMark", "requiredMessage", "rtlEnabled", "screenByWidth", "scrollingEnabled", "showColonAfterLabel", "showOptionalMark", "showRequiredMark", "showValidationSummary", "tabIndex", "validationGroup", "visible", "width"], outputs: ["onContentReady", "onDisposing", "onEditorEnterKey", "onFieldDataChanged", "onInitialized", "onOptionChanged", "accessKeyChange", "activeStateEnabledChange", "alignItemLabelsChange", "alignItemLabelsInAllGroupsChange", "colCountChange", "colCountByScreenChange", "customizeItemChange", "disabledChange", "elementAttrChange", "focusStateEnabledChange", "formDataChange", "heightChange", "hintChange", "hoverStateEnabledChange", "isDirtyChange", "itemsChange", "labelLocationChange", "labelModeChange", "minColWidthChange", "optionalMarkChange", "readOnlyChange", "requiredMarkChange", "requiredMessageChange", "rtlEnabledChange", "screenByWidthChange", "scrollingEnabledChange", "showColonAfterLabelChange", "showOptionalMarkChange", "showRequiredMarkChange", "showValidationSummaryChange", "tabIndexChange", "validationGroupChange", "visibleChange", "widthChange"] }, { kind: "component", type: i10.GroupBoxComponent, selector: "mobicloud-group-box", inputs: ["width", "contentheight", "noBackgroundHeader", "title", "isLoadingData", "loadingText", "hasErrors", "errorCaption", "errorText", "enableRetryOnError", "editAllowed", "inEditMode"], outputs: ["Edit_Click", "Save_Click", "CancelEdit_Click", "Retry_Click"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ProjectLocationComponent, decorators: [{
            type: Component,
            args: [{ selector: 'mobicloud-project-location', template: "<mobicloud-group-box title=\"Location\" i18n-title=\"@@CaptionHeader-Location\" [width]=\"[width]\" [contentheight]=[contentheight] class=\"projectLocationForm\" [isLoadingData]=\"isLoadingData\" [loadingText]=\"loadingText\" \n   [editAllowed]=\"editAllowed\" [inEditMode]=\"inEditMode\" [hasErrors]=\"hasErrors\" errorCaption=\"Error\" i18n-errorCaption=\"@@CaptionHeader-Error\" [errorText]=\"errorText\" [enableRetryOnError]=\"true\"\n    (Edit_Click)=\"onEditClick()\" (Save_Click)=\"onSaveClick()\" (CancelEdit_Click)=\"onCancelEditClick()\" (Retry_Click)=\"onRetryClick()\">\n\n    <dx-form #form id=\"form\"\n        [formData]=\"formProject\"\n        [readOnly]=\"!inEditMode\"\n        [showColonAfterLabel]=\"true\"\n        labelLocation=\"top\"\n        [showValidationSummary]=\"false\" \n        [showRequiredMark] = \"false\"\n        validationGroup=\"formProjectData_Location\">\n\n        <dxi-item itemType=\"group\" caption=\"\" [colCount]=\"2\">\n            <dxi-item dataField=\"Location.Street\" [colSpan]=\"2\">\n                <dxo-label text=\"Address\" i18n-text=\"@@FieldCaption-Address\"></dxo-label>\n            </dxi-item>\n            <dxi-item dataField=\"Location.ZipCode\">\n                <dxo-label text=\"Zip code\" i18n-text=\"@@FieldCaption-ZipCode\"></dxo-label>\n            </dxi-item>\n            <dxi-item dataField=\"Location.City\">\n                <dxo-label text=\"City\"  i18n-text=\"@@FieldCaption-City\"></dxo-label>\n            </dxi-item>\n\n            <dxi-item dataField=\"Location.Country\" [colSpan]=\"2\">\n                <dxo-label text=\"Country\" i18n-text=\"@@FieldCaption-Country\"></dxo-label>  \n                <div *dxTemplate=\"let data of 'content'\">\n                    <dx-drop-down-box [deferRendering]=\"true\" [showClearButton]=\"true\" [readOnly]=\"!inEditMode\" fieldTemplate=\"fieldTemplate\"\n                        [dataSource]=\"country_ds\"                   \n                        [(value)]=\"_countryId\"\n                        valueExpr=\"Code2\"                \n                        displayExpr=\"LocalName\"                                    \n                        [(opened)]=\"_countryOpened\"> \n                        <dxo-drop-down-options title=\"Countries\" i18n-title=\"@@FieldCaption-Countries\" [showTitle]=\"true\" [fullScreen]=\"false\" [showCloseButton]=\"true\">\n                    </dxo-drop-down-options>                                       \n                        <dx-data-grid [filterRow]=\"{ visible: true }\" [scrolling]=\"{ mode: 'standard' }\" [selection]=\"{ mode: 'single' }\" height=\"100%\" [hoverStateEnabled]=\"true\"\n                            [dataSource]=\"country_ds\"\n                            [(selectedRowKeys)]=\"_countryId\"\n                            (onSelectionChanged)=\"countryChanged($event)\"\n                            (onRowClick)=\"_countryOpened = false\">\n                            <dxi-column dataField=\"Code2\" [allowFiltering]=\"false\" [allowSorting]=\"false\" cellTemplate=\"imgCellTemplate\" all [width]=\"50\" caption=\"\"></dxi-column>\n                            <dxi-column dataField=\"LocalName\" i18n-caption=\"@@GridColumn-Name\" caption=\"Name\"></dxi-column>\n                            <dxo-paging [enabled]=\"false\"></dxo-paging>\n                            <div *dxTemplate=\"let data of 'imgCellTemplate'\">\n                                <img alt=\"\"src=\"{{cloudDataService.FlagUrl}}/{{data.value}}-32.png\"/>\n                            </div>\n                        </dx-data-grid>\n                        <div *dxTemplate=\"let data of 'fieldTemplate'\">\n                            <div class=\"country-edit-item\">\n                                <div class=\"country-edit-image\"><img alt=\"\" src=\"{{cloudDataService.FlagUrl}}/{{_selectedCountry?.Code2}}-32.png\" *ngIf=\"_selectedCountry?.Code2\"></div>\n                                <div class=\"country-edit-text\">\n                                    <dx-text-box stylingMode=\"filled\" [value]=\"_selectedCountry?.LocalName\" [readOnly]=\"true\"></dx-text-box>\n                                </div>\n                            </div>\n                        </div>\n                    </dx-drop-down-box>\n                </div>   \n                <!-- <dxi-validation-rule type=\"required\" message=\"Country is required\"></dxi-validation-rule>    -->\n            </dxi-item>\n            <dxi-item dataField=\"Location.ContactPerson\">\n                <dxo-label text=\"Contact person\" i18n-text=\"@@FieldCaption-ContactPerson\"></dxo-label>\n            </dxi-item>  \n            <dxi-item dataField=\"Location.Phone\">\n                <dxo-label text=\"Phone\" i18n-text=\"@@FieldCaption-Phone\"></dxo-label>\n            </dxi-item>\n            <dxi-item dataField=\"Location.Email\" [colSpan]=\"2\" [editorOptions]=\"{ inputAttr: {'autocomplete': 'email'} }\">\n                <dxo-label text=\"Email\" i18n-text=\"@@FieldCaption-Email\"></dxo-label>     \n                <dxi-validation-rule type=\"email\" message=\"Email is invalid\" i18n-message=\"@@ValidationText-Email-Invalid\"></dxi-validation-rule>                           \n            </dxi-item>             \n \n        </dxi-item>\n        \n    </dx-form>\n\n</mobicloud-group-box>" }]
        }], ctorParameters: () => [{ type: i1.MobicloudCoreService }, { type: i2.MobiCloudDataService }, { type: i3.MatDialog }], propDecorators: { project: [{
                type: Input
            }], project_expands: [{
                type: Input
            }], editAllowed: [{
                type: Input
            }], inEditMode: [{
                type: Input
            }], width: [{
                type: Input
            }], contentheight: [{
                type: Input
            }], isLoadingData: [{
                type: Input
            }], loadingText: [{
                type: Input
            }], hasErrors: [{
                type: Input
            }], errorText: [{
                type: Input
            }], projectChanged: [{
                type: Output
            }], form: [{
                type: ViewChild,
                args: ['form']
            }], datagrids: [{
                type: ViewChildren,
                args: [DxDataGridComponent]
            }] } });
//# sourceMappingURL=data:application/json;base64, 