import { Component, Input } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@progress/kendo-angular-dialog";
import * as i2 from "@angular/forms";
import * as i3 from "@progress/kendo-angular-inputs";
import * as i4 from "@progress/kendo-angular-buttons";
function ActionResultCodeDialogComponent_Conditional_23_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 14);
    i0.ɵɵtext(1, " This result indicates successful execution ");
} }
function ActionResultCodeDialogComponent_Conditional_24_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 15);
    i0.ɵɵtext(1, " This result indicates failed or partial execution ");
} }
function ActionResultCodeDialogComponent_Conditional_30_Template(rf, ctx) { if (rf & 1) {
    const _r1 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "button", 16);
    i0.ɵɵlistener("click", function ActionResultCodeDialogComponent_Conditional_30_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.save()); });
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵproperty("primary", true)("disabled", !ctx_r1.code);
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", ctx_r1.isNew ? "Add" : "Save", " ");
} }
export class ActionResultCodeDialogComponent {
    constructor(dialogRef) {
        this.dialogRef = dialogRef;
        this.isNew = false;
        this.editMode = false;
        // Form fields
        this.code = '';
        this.description = '';
        this.isSuccess = false;
    }
    ngOnInit() {
        if (this.resultCode) {
            // Load existing values
            this.code = this.resultCode.ResultCode || '';
            this.description = this.resultCode.Description || '';
            this.isSuccess = this.resultCode.IsSuccess || false;
        }
    }
    save() {
        // Update the result code entity with form values
        this.resultCode.ResultCode = this.code;
        this.resultCode.Description = this.description;
        this.resultCode.IsSuccess = this.isSuccess;
        // Close dialog and pass back the updated result code
        this.dialogRef.close({ resultCode: this.resultCode, save: true });
    }
    cancel() {
        this.dialogRef.close({ save: false });
    }
    static { this.ɵfac = function ActionResultCodeDialogComponent_Factory(t) { return new (t || ActionResultCodeDialogComponent)(i0.ɵɵdirectiveInject(i1.DialogRef)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ActionResultCodeDialogComponent, selectors: [["mj-action-result-code-dialog"]], inputs: { resultCode: "resultCode", isNew: "isNew", editMode: "editMode" }, decls: 31, vars: 10, consts: [[1, "dialog-title"], [1, "fa-solid", "fa-clipboard-check"], [1, "dialog-content"], [1, "form-group"], [1, "form-label", "required"], ["placeholder", "Enter result code (e.g., SUCCESS, ERROR_TIMEOUT)", 1, "form-control", 3, "ngModelChange", "ngModel", "disabled"], [1, "form-hint"], [1, "form-label"], ["placeholder", "Describe what this result code means", 1, "form-control", 3, "ngModelChange", "ngModel", "disabled", "rows"], [1, "checkbox-wrapper"], [3, "ngModelChange", "ngModel", "disabled"], [1, "checkbox-label"], ["kendoButton", "", 3, "click"], ["kendoButton", "", 3, "primary", "disabled"], [1, "fa-solid", "fa-check-circle", "success-icon"], [1, "fa-solid", "fa-times-circle", "error-icon"], ["kendoButton", "", 3, "click", "primary", "disabled"]], template: function ActionResultCodeDialogComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "kendo-dialog-titlebar")(1, "span", 0);
            i0.ɵɵelement(2, "i", 1);
            i0.ɵɵtext(3);
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(4, "div", 2)(5, "div", 3)(6, "label", 4);
            i0.ɵɵtext(7, "Result Code");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(8, "kendo-textbox", 5);
            i0.ɵɵtwoWayListener("ngModelChange", function ActionResultCodeDialogComponent_Template_kendo_textbox_ngModelChange_8_listener($event) { i0.ɵɵtwoWayBindingSet(ctx.code, $event) || (ctx.code = $event); return $event; });
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(9, "div", 6);
            i0.ɵɵtext(10, "A unique code that identifies this result type");
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(11, "div", 3)(12, "label", 7);
            i0.ɵɵtext(13, "Description");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(14, "kendo-textarea", 8);
            i0.ɵɵtwoWayListener("ngModelChange", function ActionResultCodeDialogComponent_Template_kendo_textarea_ngModelChange_14_listener($event) { i0.ɵɵtwoWayBindingSet(ctx.description, $event) || (ctx.description = $event); return $event; });
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(15, "div", 6);
            i0.ɵɵtext(16, "Explain when this result code is returned");
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(17, "div", 3)(18, "label", 7);
            i0.ɵɵtext(19, "Success Status");
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(20, "div", 9)(21, "kendo-checkbox", 10);
            i0.ɵɵtwoWayListener("ngModelChange", function ActionResultCodeDialogComponent_Template_kendo_checkbox_ngModelChange_21_listener($event) { i0.ɵɵtwoWayBindingSet(ctx.isSuccess, $event) || (ctx.isSuccess = $event); return $event; });
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(22, "span", 11);
            i0.ɵɵtemplate(23, ActionResultCodeDialogComponent_Conditional_23_Template, 2, 0)(24, ActionResultCodeDialogComponent_Conditional_24_Template, 2, 0);
            i0.ɵɵelementEnd()();
            i0.ɵɵelementStart(25, "div", 6);
            i0.ɵɵtext(26, "Determines if this code represents a successful outcome");
            i0.ɵɵelementEnd()()();
            i0.ɵɵelementStart(27, "kendo-dialog-actions")(28, "button", 12);
            i0.ɵɵlistener("click", function ActionResultCodeDialogComponent_Template_button_click_28_listener() { return ctx.cancel(); });
            i0.ɵɵtext(29, " Cancel ");
            i0.ɵɵelementEnd();
            i0.ɵɵtemplate(30, ActionResultCodeDialogComponent_Conditional_30_Template, 2, 3, "button", 13);
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵadvance(3);
            i0.ɵɵtextInterpolate1(" ", ctx.isNew ? "Add" : "Edit", " Result Code ");
            i0.ɵɵadvance(5);
            i0.ɵɵtwoWayProperty("ngModel", ctx.code);
            i0.ɵɵproperty("disabled", !ctx.editMode);
            i0.ɵɵadvance(6);
            i0.ɵɵtwoWayProperty("ngModel", ctx.description);
            i0.ɵɵproperty("disabled", !ctx.editMode)("rows", 3);
            i0.ɵɵadvance(7);
            i0.ɵɵtwoWayProperty("ngModel", ctx.isSuccess);
            i0.ɵɵproperty("disabled", !ctx.editMode);
            i0.ɵɵadvance(2);
            i0.ɵɵconditional(ctx.isSuccess ? 23 : 24);
            i0.ɵɵadvance(7);
            i0.ɵɵconditional(ctx.editMode ? 30 : -1);
        } }, dependencies: [i2.NgControlStatus, i2.NgModel, i1.DialogTitleBarComponent, i1.DialogActionsComponent, i3.TextAreaComponent, i3.TextBoxComponent, i3.CheckBoxComponent, i4.ButtonComponent], styles: [".dialog-title[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    font-size: 1.1rem;\n    font-weight: 600;\n}\n\n.dialog-title[_ngcontent-%COMP%]   i[_ngcontent-%COMP%] {\n    color: #6f42c1;\n}\n\n.dialog-content[_ngcontent-%COMP%] {\n    padding: 20px;\n    max-height: 60vh;\n    overflow-y: auto;\n}\n\n.form-group[_ngcontent-%COMP%] {\n    margin-bottom: 20px;\n}\n\n.form-label[_ngcontent-%COMP%] {\n    display: block;\n    margin-bottom: 6px;\n    font-weight: 500;\n    color: #333;\n    font-size: 0.9rem;\n}\n\n.form-label.required[_ngcontent-%COMP%]::after {\n    content: ' *';\n    color: #dc3545;\n}\n\n.form-control[_ngcontent-%COMP%] {\n    width: 100%;\n}\n\n.form-hint[_ngcontent-%COMP%] {\n    margin-top: 4px;\n    font-size: 0.85rem;\n    color: #6c757d;\n}\n\n.checkbox-wrapper[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    margin-top: 8px;\n}\n\n.checkbox-label[_ngcontent-%COMP%] {\n    display: flex;\n    align-items: center;\n    gap: 6px;\n    font-size: 0.95rem;\n}\n\n.success-icon[_ngcontent-%COMP%] {\n    color: #28a745;\n}\n\n.error-icon[_ngcontent-%COMP%] {\n    color: #dc3545;\n}\n\nkendo-dialog-actions[_ngcontent-%COMP%] {\n    padding: 15px 20px;\n    background: #f8f9fa;\n    border-top: 1px solid #dee2e6;\n}"] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ActionResultCodeDialogComponent, [{
        type: Component,
        args: [{ selector: 'mj-action-result-code-dialog', template: "<kendo-dialog-titlebar>\n    <span class=\"dialog-title\">\n        <i class=\"fa-solid fa-clipboard-check\"></i>\n        {{ isNew ? 'Add' : 'Edit' }} Result Code\n    </span>\n</kendo-dialog-titlebar>\n\n<div class=\"dialog-content\">\n    <div class=\"form-group\">\n        <label class=\"form-label required\">Result Code</label>\n        <kendo-textbox \n            [(ngModel)]=\"code\"\n            [disabled]=\"!editMode\"\n            placeholder=\"Enter result code (e.g., SUCCESS, ERROR_TIMEOUT)\"\n            class=\"form-control\">\n        </kendo-textbox>\n        <div class=\"form-hint\">A unique code that identifies this result type</div>\n    </div>\n    \n    <div class=\"form-group\">\n        <label class=\"form-label\">Description</label>\n        <kendo-textarea \n            [(ngModel)]=\"description\"\n            [disabled]=\"!editMode\"\n            [rows]=\"3\"\n            placeholder=\"Describe what this result code means\"\n            class=\"form-control\">\n        </kendo-textarea>\n        <div class=\"form-hint\">Explain when this result code is returned</div>\n    </div>\n    \n    <div class=\"form-group\">\n        <label class=\"form-label\">Success Status</label>\n        <div class=\"checkbox-wrapper\">\n            <kendo-checkbox \n                [(ngModel)]=\"isSuccess\"\n                [disabled]=\"!editMode\">\n            </kendo-checkbox>\n            <span class=\"checkbox-label\">\n                @if (isSuccess) {\n                    <i class=\"fa-solid fa-check-circle success-icon\"></i>\n                    This result indicates successful execution\n                } @else {\n                    <i class=\"fa-solid fa-times-circle error-icon\"></i>\n                    This result indicates failed or partial execution\n                }\n            </span>\n        </div>\n        <div class=\"form-hint\">Determines if this code represents a successful outcome</div>\n    </div>\n</div>\n\n<kendo-dialog-actions>\n    <button kendoButton (click)=\"cancel()\">\n        Cancel\n    </button>\n    @if (editMode) {\n        <button kendoButton [primary]=\"true\" (click)=\"save()\" [disabled]=\"!code\">\n            {{ isNew ? 'Add' : 'Save' }}\n        </button>\n    }\n</kendo-dialog-actions>", styles: [".dialog-title {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    font-size: 1.1rem;\n    font-weight: 600;\n}\n\n.dialog-title i {\n    color: #6f42c1;\n}\n\n.dialog-content {\n    padding: 20px;\n    max-height: 60vh;\n    overflow-y: auto;\n}\n\n.form-group {\n    margin-bottom: 20px;\n}\n\n.form-label {\n    display: block;\n    margin-bottom: 6px;\n    font-weight: 500;\n    color: #333;\n    font-size: 0.9rem;\n}\n\n.form-label.required::after {\n    content: ' *';\n    color: #dc3545;\n}\n\n.form-control {\n    width: 100%;\n}\n\n.form-hint {\n    margin-top: 4px;\n    font-size: 0.85rem;\n    color: #6c757d;\n}\n\n.checkbox-wrapper {\n    display: flex;\n    align-items: center;\n    gap: 10px;\n    margin-top: 8px;\n}\n\n.checkbox-label {\n    display: flex;\n    align-items: center;\n    gap: 6px;\n    font-size: 0.95rem;\n}\n\n.success-icon {\n    color: #28a745;\n}\n\n.error-icon {\n    color: #dc3545;\n}\n\nkendo-dialog-actions {\n    padding: 15px 20px;\n    background: #f8f9fa;\n    border-top: 1px solid #dee2e6;\n}"] }]
    }], () => [{ type: i1.DialogRef }], { resultCode: [{
            type: Input
        }], isNew: [{
            type: Input
        }], editMode: [{
            type: Input
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ActionResultCodeDialogComponent, { className: "ActionResultCodeDialogComponent", filePath: "src/lib/custom/Actions/action-result-code-dialog.component.ts", lineNumber: 10 }); })();
//# sourceMappingURL=action-result-code-dialog.component.js.map