import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA } from "@angular/material/dialog";
import ODataStore from "devextreme/data/odata/store";
import "devextreme/ui/validation_engine";
import { MessageResult } from "../message-box/message-box";
import * as i0 from "@angular/core";
import * as i1 from "@angular/material/dialog";
import * as i2 from "mobicloud-core/api";
import * as i3 from "angular-svg-icon";
import * as i4 from "@angular/material/button";
import * as i5 from "@angular/material/tooltip";
import * as i6 from "@angular/material/toolbar";
import * as i7 from "@angular/material/card";
import * as i8 from "devextreme-angular/core";
import * as i9 from "devextreme-angular";
import * as i10 from "../directives/material-elevation.directive";
export class PrintDialog {
    constructor(dialogRef, data, cloudDataService, matDialog) {
        this.dialogRef = dialogRef;
        this.data = data;
        this.cloudDataService = cloudDataService;
        this.matDialog = matDialog;
        this.showLoadIndicator = false;
        if (data?.printerId) {
            this.selectedPrinterId = data.printerId;
        }
    }
    ngOnInit() {
        this.createPrinterStore();
    }
    async createPrinterStore() {
        this.printer_store = new ODataStore({
            url: this.cloudDataService.getMobiManagementODataUrl("GatewayPrinter"),
            withCredentials: true,
            key: "Id",
            keyType: "Guid",
            version: 4,
        });
    }
    ngAfterViewInit() {
    }
    onClose() {
        this.dialogRef.close({ result: { id: this.selectedPrinterId, dialogResult: MessageResult.Ok } });
    }
    onCancelClick() {
        this.onCancel();
    }
    onCancel() {
        this.dialogRef.close({ result: { id: "", dialogResult: MessageResult.Cancel } });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PrintDialog, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i2.MobiCloudDataService }, { token: i1.MatDialog }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: PrintDialog, selector: "mobicloud-print-dialog", ngImport: i0, template: "<div mat-dialog-container class=\"dialog-container\">\n    <mat-toolbar color=\"primary\" class=\"mat-elevation-z2 dialog-caption\" cdkDrag cdkDragRootElement=\".cdk-overlay-pane\" cdkDragHandle>\n        <mat-card-header>\n            <div class=\"toolbar-header-text-container\">\n                <svg-icon name=\"mobicloud_printer\" svgClass=\"dialog-caption-icon\"></svg-icon><div i18n=\"@@FieldCaption-SelectPrinter\" class=\"toolbar-header-text\">Select printer</div>\n            </div>            \n        </mat-card-header>\n        <span class=\"dialog-caption-spacer\"></span>\n        <button mat-raised-button appMaterialElevation matTooltip=\"Close\" i18n-matTooltip=\"@@Action-Close\" aria-label=\"Close\" i18n-aria-label=\"@@Action-Close\" class=\"dialog-toolbar-button\" (click)=\"onCancel()\">\n          <svg-icon name=\"mobicloud_close\" svgClass=\"dialog-toolbar-button-icon\"></svg-icon>\n        </button>        \n    </mat-toolbar>    \n    <div class=\"dialog-content\">\n        <div class=\"printer\">\n            <dx-select-box id=\"printerSelectbox\" [dataSource]=\"printer_store\" label=\"Printer\" i18n-label=\"@@FieldCaption-Printer\" labelMode=\"static\" displayExpr=\"PrinterName\" valueExpr=\"Id\" [(value)]=\"selectedPrinterId\">\n                <div *dxTemplate=\"let data of 'item'\">\n                    <div class=\"printer-item\">\n                        <div class=\"printer-name\">\n                            {{data?.PrinterName}} {{ data?.GatewayInstallationName ? ('(' + data.GatewayInstallationName + ')') : ('') }}\n                        </div>\n                    </div>\n                </div>                                        \n            </dx-select-box> \n        </div>\n\n        <div>\n            <div class=\"dialog-button-row flex flex-row basis-[100%] justify-end items-center\">                            \n                <button mat-flat-button color=\"accent\" class=\"button1\" [disabled]=\"showLoadIndicator\" (click)=\"onCancelClick()\" i18n=\"@@Button-Cancel\">Cancel</button>                \n                <button mat-flat-button color=\"primary\" class=\"button2\" [disabled]=\"showLoadIndicator || !selectedPrinterId\" (click)=\"onClose()\" i18n=\"@@Button-OK\">OK</button>                            \n            </div>                                   \n        </div>          \n    </div>\n    <!-- <div #dialog-content id=\"dialog-content\" class=\"dialog-content\">\n     here we go\n    </div>     -->\n</div>\n\n  <dx-load-panel\n    #loadPanelMainContent\n    container=\"#dialog-content\"\n    [position]=\"{ of: '#dialog-content' }\"\n    [(visible)]=\"showLoadIndicator\"\n    [showIndicator]=\"true\"\n    [showPane]=\"true\"\n    [shading]=\"true\"    \n    [hideOnOutsideClick]=\"false\"></dx-load-panel>", styles: [".toolbar-header-text-container{display:flex}.toolbar-header-text{margin-top:5px;margin-left:8px}.dialog-caption-icon{pointer-events:none;fill:var(--default-toolbar-iconcolor);width:22px;height:22px;margin-top:10px}.dialog-content{margin-top:40px;padding-left:40px;padding-right:40px}.printer{margin-bottom:40px}\n"], dependencies: [{ kind: "component", type: i3.SvgIconComponent, selector: "svg-icon", inputs: ["src", "name", "stretch", "applyClass", "applyCss", "svgClass", "class", "viewBox", "svgAriaLabel", "svgStyle"] }, { kind: "component", type: i4.MatButton, selector: "    button[mat-button], button[mat-raised-button], button[mat-flat-button],    button[mat-stroked-button]  ", exportAs: ["matButton"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: i6.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: i7.MatCardHeader, selector: "mat-card-header" }, { kind: "directive", type: i8.DxTemplateDirective, selector: "[dxTemplate]", inputs: ["dxTemplateOf"] }, { kind: "component", type: i9.DxSelectBoxComponent, selector: "dx-select-box", inputs: ["acceptCustomValue", "accessKey", "activeStateEnabled", "buttons", "customItemCreateEvent", "dataSource", "deferRendering", "disabled", "displayExpr", "displayValue", "dropDownButtonTemplate", "dropDownOptions", "elementAttr", "fieldTemplate", "focusStateEnabled", "grouped", "groupTemplate", "height", "hint", "hoverStateEnabled", "inputAttr", "isDirty", "isValid", "items", "itemTemplate", "label", "labelMode", "maxLength", "minSearchLength", "name", "noDataText", "opened", "openOnFieldClick", "placeholder", "readOnly", "rtlEnabled", "searchEnabled", "searchExpr", "searchMode", "searchTimeout", "selectedItem", "showClearButton", "showDataBeforeSearch", "showDropDownButton", "showSelectionControls", "spellcheck", "stylingMode", "tabIndex", "text", "useItemTextAsTitle", "validationError", "validationErrors", "validationMessageMode", "validationMessagePosition", "validationStatus", "value", "valueChangeEvent", "valueExpr", "visible", "width", "wrapItemText"], outputs: ["onChange", "onClosed", "onContentReady", "onCopy", "onCustomItemCreating", "onCut", "onDisposing", "onEnterKey", "onFocusIn", "onFocusOut", "onInitialized", "onInput", "onItemClick", "onKeyDown", "onKeyUp", "onOpened", "onOptionChanged", "onPaste", "onSelectionChanged", "onValueChanged", "acceptCustomValueChange", "accessKeyChange", "activeStateEnabledChange", "buttonsChange", "customItemCreateEventChange", "dataSourceChange", "deferRenderingChange", "disabledChange", "displayExprChange", "displayValueChange", "dropDownButtonTemplateChange", "dropDownOptionsChange", "elementAttrChange", "fieldTemplateChange", "focusStateEnabledChange", "groupedChange", "groupTemplateChange", "heightChange", "hintChange", "hoverStateEnabledChange", "inputAttrChange", "isDirtyChange", "isValidChange", "itemsChange", "itemTemplateChange", "labelChange", "labelModeChange", "maxLengthChange", "minSearchLengthChange", "nameChange", "noDataTextChange", "openedChange", "openOnFieldClickChange", "placeholderChange", "readOnlyChange", "rtlEnabledChange", "searchEnabledChange", "searchExprChange", "searchModeChange", "searchTimeoutChange", "selectedItemChange", "showClearButtonChange", "showDataBeforeSearchChange", "showDropDownButtonChange", "showSelectionControlsChange", "spellcheckChange", "stylingModeChange", "tabIndexChange", "textChange", "useItemTextAsTitleChange", "validationErrorChange", "validationErrorsChange", "validationMessageModeChange", "validationMessagePositionChange", "validationStatusChange", "valueChange", "valueChangeEventChange", "valueExprChange", "visibleChange", "widthChange", "wrapItemTextChange", "onBlur"] }, { kind: "component", type: i9.DxLoadPanelComponent, selector: "dx-load-panel", inputs: ["animation", "container", "deferRendering", "delay", "focusStateEnabled", "height", "hideOnOutsideClick", "hideOnParentScroll", "hint", "hoverStateEnabled", "indicatorSrc", "maxHeight", "maxWidth", "message", "minHeight", "minWidth", "position", "rtlEnabled", "shading", "shadingColor", "showIndicator", "showPane", "visible", "width", "wrapperAttr"], outputs: ["onContentReady", "onDisposing", "onHidden", "onHiding", "onInitialized", "onOptionChanged", "onShowing", "onShown", "animationChange", "containerChange", "deferRenderingChange", "delayChange", "focusStateEnabledChange", "heightChange", "hideOnOutsideClickChange", "hideOnParentScrollChange", "hintChange", "hoverStateEnabledChange", "indicatorSrcChange", "maxHeightChange", "maxWidthChange", "messageChange", "minHeightChange", "minWidthChange", "positionChange", "rtlEnabledChange", "shadingChange", "shadingColorChange", "showIndicatorChange", "showPaneChange", "visibleChange", "widthChange", "wrapperAttrChange"] }, { kind: "directive", type: i10.MaterialElevationDirective, selector: "[appMaterialElevation]", inputs: ["defaultElevation", "raisedElevation"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PrintDialog, decorators: [{
            type: Component,
            args: [{ selector: 'mobicloud-print-dialog', template: "<div mat-dialog-container class=\"dialog-container\">\n    <mat-toolbar color=\"primary\" class=\"mat-elevation-z2 dialog-caption\" cdkDrag cdkDragRootElement=\".cdk-overlay-pane\" cdkDragHandle>\n        <mat-card-header>\n            <div class=\"toolbar-header-text-container\">\n                <svg-icon name=\"mobicloud_printer\" svgClass=\"dialog-caption-icon\"></svg-icon><div i18n=\"@@FieldCaption-SelectPrinter\" class=\"toolbar-header-text\">Select printer</div>\n            </div>            \n        </mat-card-header>\n        <span class=\"dialog-caption-spacer\"></span>\n        <button mat-raised-button appMaterialElevation matTooltip=\"Close\" i18n-matTooltip=\"@@Action-Close\" aria-label=\"Close\" i18n-aria-label=\"@@Action-Close\" class=\"dialog-toolbar-button\" (click)=\"onCancel()\">\n          <svg-icon name=\"mobicloud_close\" svgClass=\"dialog-toolbar-button-icon\"></svg-icon>\n        </button>        \n    </mat-toolbar>    \n    <div class=\"dialog-content\">\n        <div class=\"printer\">\n            <dx-select-box id=\"printerSelectbox\" [dataSource]=\"printer_store\" label=\"Printer\" i18n-label=\"@@FieldCaption-Printer\" labelMode=\"static\" displayExpr=\"PrinterName\" valueExpr=\"Id\" [(value)]=\"selectedPrinterId\">\n                <div *dxTemplate=\"let data of 'item'\">\n                    <div class=\"printer-item\">\n                        <div class=\"printer-name\">\n                            {{data?.PrinterName}} {{ data?.GatewayInstallationName ? ('(' + data.GatewayInstallationName + ')') : ('') }}\n                        </div>\n                    </div>\n                </div>                                        \n            </dx-select-box> \n        </div>\n\n        <div>\n            <div class=\"dialog-button-row flex flex-row basis-[100%] justify-end items-center\">                            \n                <button mat-flat-button color=\"accent\" class=\"button1\" [disabled]=\"showLoadIndicator\" (click)=\"onCancelClick()\" i18n=\"@@Button-Cancel\">Cancel</button>                \n                <button mat-flat-button color=\"primary\" class=\"button2\" [disabled]=\"showLoadIndicator || !selectedPrinterId\" (click)=\"onClose()\" i18n=\"@@Button-OK\">OK</button>                            \n            </div>                                   \n        </div>          \n    </div>\n    <!-- <div #dialog-content id=\"dialog-content\" class=\"dialog-content\">\n     here we go\n    </div>     -->\n</div>\n\n  <dx-load-panel\n    #loadPanelMainContent\n    container=\"#dialog-content\"\n    [position]=\"{ of: '#dialog-content' }\"\n    [(visible)]=\"showLoadIndicator\"\n    [showIndicator]=\"true\"\n    [showPane]=\"true\"\n    [shading]=\"true\"    \n    [hideOnOutsideClick]=\"false\"></dx-load-panel>", styles: [".toolbar-header-text-container{display:flex}.toolbar-header-text{margin-top:5px;margin-left:8px}.dialog-caption-icon{pointer-events:none;fill:var(--default-toolbar-iconcolor);width:22px;height:22px;margin-top:10px}.dialog-content{margin-top:40px;padding-left:40px;padding-right:40px}.printer{margin-bottom:40px}\n"] }]
        }], ctorParameters: () => [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }, { type: i2.MobiCloudDataService }, { type: i1.MatDialog }] });
//# sourceMappingURL=data:application/json;base64, 