import * as i3 from '@acorex/components/button';
import { AXButtonModule } from '@acorex/components/button';
import * as i2 from '@acorex/components/decorators';
import { AXDecoratorModule } from '@acorex/components/decorators';
import { AXDialogModule } from '@acorex/components/dialog';
import { AXDropdownModule } from '@acorex/components/dropdown';
import * as i6 from '@acorex/components/dropdown-button';
import { AXDropdownButtonModule } from '@acorex/components/dropdown-button';
import * as i1 from '@acorex/components/form';
import { AXFormModule } from '@acorex/components/form';
import * as i5 from '@acorex/components/label';
import { AXLabelModule } from '@acorex/components/label';
import * as i4 from '@acorex/components/loading';
import { AXLoadingModule } from '@acorex/components/loading';
import { AXBasePageComponent } from '@acorex/components/page';
import { AXTabsModule } from '@acorex/components/tabs';
import { AXTooltipModule } from '@acorex/components/tooltip';
import * as i10 from '@acorex/core/translation';
import { AXTranslationModule } from '@acorex/core/translation';
import { AXValidationModule } from '@acorex/core/validation';
import { AXPGridLayoutDirective } from '@acorex/platform/core';
import * as i1$1 from '@acorex/platform/layout/components';
import { AXPComponentSlotModule } from '@acorex/platform/layout/components';
import * as i7 from '@acorex/platform/layout/widget-core';
import { AXPWidgetContainerComponent, AXPPageStatus, AXPWidgetCoreModule } from '@acorex/platform/layout/widget-core';
import { AXPWidgetsModule } from '@acorex/platform/layout/widgets';
import { AXPWorkflowService } from '@acorex/platform/workflow';
import * as i1$2 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { inject, viewChild, ChangeDetectionStrategy, Component } from '@angular/core';
import { FormsModule } from '@angular/forms';

class AXPEntityMasterModifyViewComponent extends AXBasePageComponent {
    constructor() {
        super(...arguments);
        this.workflow = inject(AXPWorkflowService);
        this.container = viewChild(AXPWidgetContainerComponent, ...(ngDevMode ? [{ debugName: "container" }] : []));
    }
    ngAfterViewInit() {
        this.vm.builder = this.container().builderService;
    }
    handleCloseClick() {
        this.close();
    }
    async handleSaveClick(form) {
        const formResult = await form.validate();
        if (formResult.result) {
            try {
                await this.vm.save();
                this.close({ result: true, context: this.vm.context() });
            }
            catch (error) {
                this.vm.builder.setStatus(AXPPageStatus.Error);
            }
        }
    }
    async handleSectionDiscard(form) {
        this.close({ result: false });
    }
    async handleSectionReset(form) {
        this.vm.reset();
    }
    async handleContextChange(e) {
        this.vm.context.set(e.data);
    }
    ngOnDestroy() { }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXPEntityMasterModifyViewComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: AXPEntityMasterModifyViewComponent, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "container", first: true, predicate: AXPWidgetContainerComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<axp-component-slot name=\"entity-modify-header\" [context]=\"vm.context()\"></axp-component-slot>\n<axp-widgets-container [context]=\"vm.context()\" (onContextChanged)=\"handleContextChange($event)\">\n  <ax-form id=\"axp-entity-form-edit\" class=\"ax-flex ax-flex-col ax-gap-6 ax-p-4 ax-pb-8\" #form [messageStyle]=\"'bottom'\"\n    [updateOn]=\"'blur'\">\n    <!-- Begin Sections -->\n    <div class=\"ax-grid ax-grid-cols-12 ax-gap-4\">\n      @for (section of vm.sections(); track section.name()) {\n      <div class=\"ax-col-span-12\">\n        <ax-form>\n          @if (vm.sections().length > 1 && !section.description()) {\n          <div class=\"ax-pb-4\">\n            <span class=\"ax-font-bold ax-text-xl\">{{ section.title() | translate | async }}</span>\n            @if (section.description()) {\n            <p class=\"ax-text-sm ax-text-gray-500\">{{ section.description() }}</p>\n            }\n          </div>\n          }\n          <div class=\"ax-card-body !ax-grid !ax-grid-cols-12 !ax-gap-4\">\n            @for (attr of section.elements(); track $index) {\n            <ax-form-field [attr.id]=\"'axp-field-' + attr.name()\" class=\"ax-flex ax-flex-col ax-gap-1\"\n              [axp-grid-layout]=\"attr.layout()\" [class.ax-hidden]=\"widget.options()['visibility'] == false\">\n              @if (attr.layout().label?.visible != false) {\n              <ax-label class=\"ax-font-semibold ax-text-sm\" [required]=\"attr.isRequired()\">\n                @if (attr.title()) {\n                {{ attr.title() | translate | async }}\n                } @else {\n                &nbsp;\n                }\n              </ax-label>\n              }\n              <ng-container axp-widget-renderer [node]=\"attr.node()\" [mode]=\"'edit'\"\n                #widget=\"widgetRenderer\"></ng-container>\n            </ax-form-field>\n            }\n          </div>\n        </ax-form>\n      </div>\n      }\n    </div>\n    <!-- Finish Sections  -->\n  </ax-form>\n</axp-widgets-container>\n@if (slot.isEmpty()) {\n<ax-footer id=\"axp-entity-footer-edit\">\n  <ax-prefix>\n    <axp-component-slot name=\"entity-modify-footer-prefix\" [context]=\"vm.context()\"></axp-component-slot>\n  </ax-prefix>\n  <ax-suffix>\n    <ax-dropdown-button [mode]=\"'split'\" id=\"axp-btn-discard\"\n      [text]=\"'@general:actions.discard.title' | translate | async\" (onClick)=\"handleSectionDiscard(form)\">\n      <ax-button-item-list>\n        <ax-button-item id=\"axp-btn-reset\" [text]=\"('@general:actions.reset.title' | translate | async) ?? ' '\"\n          (onClick)=\"handleSectionReset(form)\">\n          <ax-prefix>\n            <ax-icon icon=\"fa-solid fa-rotate-left fa-flip-horizontal\"></ax-icon>\n          </ax-prefix>\n        </ax-button-item>\n\n      </ax-button-item-list>\n    </ax-dropdown-button>\n\n    <ax-button id=\"axp-btn-apply\" [disabled]=\"vm.isInProgress()\" color=\"primary\"\n      [text]=\"'@general:actions.apply.title' | translate | async\" (onClick)=\"handleSaveClick(form)\">\n      @if (vm.isInProgress()) {\n      <ax-loading></ax-loading>\n      }\n    </ax-button>\n    <axp-component-slot name=\"entity-modify-footer-suffix\" [context]=\"vm.context()\"></axp-component-slot>\n  </ax-suffix>\n</ax-footer>\n}\n<axp-component-slot name=\"entity-modify-footer\" #slot=\"slot\" [context]=\"vm.context()\"></axp-component-slot>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: AXFormModule }, { kind: "component", type: i1.AXFormFieldComponent, selector: "ax-form-field", inputs: ["labelMode"] }, { kind: "component", type: i1.AXFormComponent, selector: "ax-form", inputs: ["disabled", "readonly", "labelMode", "look", "messageStyle", "updateOn", "inUserInteractionActive"], outputs: ["onValidate", "updateOnChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i2.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i2.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-subtitle, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i3.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "iconOnly", "type", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "loadingTextChange"] }, { kind: "component", type: i3.AXButtonItemComponent, selector: "ax-button-item", inputs: ["color", "disabled", "text", "selected", "divided", "data", "name"], outputs: ["onClick", "onFocus", "onBlur", "disabledChange"] }, { kind: "component", type: i3.AXButtonItemListComponent, selector: "ax-button-item-list", inputs: ["items", "closeParentOnClick", "lockOnLoading"], outputs: ["onItemClick"] }, { kind: "ngmodule", type: AXDialogModule }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "component", type: i4.AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "context"], outputs: ["visibleChange"] }, { kind: "ngmodule", type: AXTabsModule }, { kind: "ngmodule", type: AXTooltipModule }, { kind: "ngmodule", type: AXValidationModule }, { kind: "ngmodule", type: AXLabelModule }, { kind: "component", type: i5.AXLabelComponent, selector: "ax-label", inputs: ["required", "for"], outputs: ["requiredChange"] }, { kind: "ngmodule", type: AXDropdownModule }, { kind: "ngmodule", type: AXDropdownButtonModule }, { kind: "component", type: i6.AXDropdownButtonComponent, selector: "ax-dropdown-button", inputs: ["disabled", "size", "color", "look", "text", "type", "mode"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "lookChange", "colorChange", "disabledChange"] }, { kind: "ngmodule", type: 
                //
                AXPWidgetCoreModule }, { kind: "component", type: i7.AXPWidgetContainerComponent, selector: "axp-widgets-container", inputs: ["context", "functions"], outputs: ["onContextChanged"] }, { kind: "directive", type: i7.AXPWidgetRendererDirective, selector: "[axp-widget-renderer]", inputs: ["parentNode", "index", "mode", "node"], outputs: ["onOptionsChanged", "onValueChanged", "onLoad"], exportAs: ["widgetRenderer"] }, { kind: "ngmodule", type: AXPWidgetsModule }, { kind: "directive", type: AXPGridLayoutDirective, selector: "[axp-grid-layout]", inputs: ["axp-grid-layout"] }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "ngmodule", type: AXPComponentSlotModule }, { kind: "directive", type: i1$1.AXPComponentSlotDirective, selector: "axp-component-slot", inputs: ["name", "host", "context"], exportAs: ["slot"] }, { kind: "pipe", type: i1$2.AsyncPipe, name: "async" }, { kind: "pipe", type: i10.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AXPEntityMasterModifyViewComponent, decorators: [{
            type: Component,
            args: [{ imports: [
                        CommonModule,
                        FormsModule,
                        AXFormModule,
                        AXDecoratorModule,
                        CommonModule,
                        AXButtonModule,
                        AXDialogModule,
                        AXLoadingModule,
                        AXTabsModule,
                        AXTooltipModule,
                        AXValidationModule,
                        AXLabelModule,
                        AXDropdownModule,
                        AXDropdownButtonModule,
                        //
                        AXPWidgetCoreModule,
                        AXPWidgetsModule,
                        AXPGridLayoutDirective,
                        AXTranslationModule,
                        AXPComponentSlotModule,
                    ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<axp-component-slot name=\"entity-modify-header\" [context]=\"vm.context()\"></axp-component-slot>\n<axp-widgets-container [context]=\"vm.context()\" (onContextChanged)=\"handleContextChange($event)\">\n  <ax-form id=\"axp-entity-form-edit\" class=\"ax-flex ax-flex-col ax-gap-6 ax-p-4 ax-pb-8\" #form [messageStyle]=\"'bottom'\"\n    [updateOn]=\"'blur'\">\n    <!-- Begin Sections -->\n    <div class=\"ax-grid ax-grid-cols-12 ax-gap-4\">\n      @for (section of vm.sections(); track section.name()) {\n      <div class=\"ax-col-span-12\">\n        <ax-form>\n          @if (vm.sections().length > 1 && !section.description()) {\n          <div class=\"ax-pb-4\">\n            <span class=\"ax-font-bold ax-text-xl\">{{ section.title() | translate | async }}</span>\n            @if (section.description()) {\n            <p class=\"ax-text-sm ax-text-gray-500\">{{ section.description() }}</p>\n            }\n          </div>\n          }\n          <div class=\"ax-card-body !ax-grid !ax-grid-cols-12 !ax-gap-4\">\n            @for (attr of section.elements(); track $index) {\n            <ax-form-field [attr.id]=\"'axp-field-' + attr.name()\" class=\"ax-flex ax-flex-col ax-gap-1\"\n              [axp-grid-layout]=\"attr.layout()\" [class.ax-hidden]=\"widget.options()['visibility'] == false\">\n              @if (attr.layout().label?.visible != false) {\n              <ax-label class=\"ax-font-semibold ax-text-sm\" [required]=\"attr.isRequired()\">\n                @if (attr.title()) {\n                {{ attr.title() | translate | async }}\n                } @else {\n                &nbsp;\n                }\n              </ax-label>\n              }\n              <ng-container axp-widget-renderer [node]=\"attr.node()\" [mode]=\"'edit'\"\n                #widget=\"widgetRenderer\"></ng-container>\n            </ax-form-field>\n            }\n          </div>\n        </ax-form>\n      </div>\n      }\n    </div>\n    <!-- Finish Sections  -->\n  </ax-form>\n</axp-widgets-container>\n@if (slot.isEmpty()) {\n<ax-footer id=\"axp-entity-footer-edit\">\n  <ax-prefix>\n    <axp-component-slot name=\"entity-modify-footer-prefix\" [context]=\"vm.context()\"></axp-component-slot>\n  </ax-prefix>\n  <ax-suffix>\n    <ax-dropdown-button [mode]=\"'split'\" id=\"axp-btn-discard\"\n      [text]=\"'@general:actions.discard.title' | translate | async\" (onClick)=\"handleSectionDiscard(form)\">\n      <ax-button-item-list>\n        <ax-button-item id=\"axp-btn-reset\" [text]=\"('@general:actions.reset.title' | translate | async) ?? ' '\"\n          (onClick)=\"handleSectionReset(form)\">\n          <ax-prefix>\n            <ax-icon icon=\"fa-solid fa-rotate-left fa-flip-horizontal\"></ax-icon>\n          </ax-prefix>\n        </ax-button-item>\n\n      </ax-button-item-list>\n    </ax-dropdown-button>\n\n    <ax-button id=\"axp-btn-apply\" [disabled]=\"vm.isInProgress()\" color=\"primary\"\n      [text]=\"'@general:actions.apply.title' | translate | async\" (onClick)=\"handleSaveClick(form)\">\n      @if (vm.isInProgress()) {\n      <ax-loading></ax-loading>\n      }\n    </ax-button>\n    <axp-component-slot name=\"entity-modify-footer-suffix\" [context]=\"vm.context()\"></axp-component-slot>\n  </ax-suffix>\n</ax-footer>\n}\n<axp-component-slot name=\"entity-modify-footer\" #slot=\"slot\" [context]=\"vm.context()\"></axp-component-slot>" }]
        }], propDecorators: { container: [{ type: i0.ViewChild, args: [i0.forwardRef(() => AXPWidgetContainerComponent), { isSignal: true }] }] } });

export { AXPEntityMasterModifyViewComponent };
//# sourceMappingURL=acorex-platform-themes-default-entity-master-modify-view.component-DAFQ4UI9.mjs.map
