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 * as i5 from '@acorex/components/form';
import { AXFormModule } from '@acorex/components/form';
import * as i4 from '@acorex/components/label';
import { AXLabelModule } from '@acorex/components/label';
import { AXBasePageComponent } from '@acorex/components/page';
import * as i1 from '@acorex/platform/layout/widget-core';
import { AXPWidgetCoreModule } from '@acorex/platform/layout/widget-core';
import { CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { signal, Component } from '@angular/core';

class AXMMeetingPublishPopupComponent extends AXBasePageComponent {
    constructor() {
        super(...arguments);
        this.context = signal({}, ...(ngDevMode ? [{ debugName: "context" }] : []));
        this.userLookupNode = {
            name: 'assignedTo',
            path: 'assignedTo',
            type: 'lookup-editor',
            options: {
                entity: 'SecurityManagement.User',
                multiple: false,
                look: 'lookup',
            },
        };
        this.dateNode = {
            name: 'publishDate',
            path: 'publishDate',
            type: 'date-time-editor',
            options: {
                format: 'date',
            },
        };
    }
    handleContextChanged($event) {
        this.context.set($event.data);
    }
    isValid() {
        const c = this.context();
        return !!c?.assignedTo && !!c?.publishDate;
    }
    async handlePublish(form) {
        const validation = await form.validate();
        if (validation.result && this.isValid()) {
            this.close({
                assignedTo: this.context()?.assignedTo,
                publishDate: this.context()?.publishDate,
                confirmed: true,
            });
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMMeetingPublishPopupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.4", type: AXMMeetingPublishPopupComponent, isStandalone: true, selector: "ng-component", usesInheritance: true, ngImport: i0, template: `
    <div>
      <ax-content class="ax-p-4">
        <ax-form #form>
          <axp-widgets-container [context]="context()" (onContextChanged)="handleContextChanged($event)">
            <ax-form-field class="ax-px-3">
              <ax-label>User</ax-label>
              <ng-container axp-widget-renderer [node]="userLookupNode" [mode]="'edit'"></ng-container>
            </ax-form-field>
            <ax-form-field class="ax-px-3">
              <ax-label>Date</ax-label>
              <ng-container axp-widget-renderer [node]="dateNode" [mode]="'edit'"></ng-container>
            </ax-form-field>
          </axp-widgets-container>
        </ax-form>
      </ax-content>
      <ax-footer>
        <ax-suffix>
          <ax-button text="Cancel" (onClick)="close()"></ax-button>
          <ax-button color="primary" text="Publish" [disabled]="!isValid()" (onClick)="handlePublish(form)"></ax-button>
        </ax-suffix>
      </ax-footer>
    </div>
  `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXPWidgetCoreModule }, { kind: "component", type: i1.AXPWidgetContainerComponent, selector: "axp-widgets-container", inputs: ["context", "functions"], outputs: ["onContextChanged"] }, { kind: "directive", type: i1.AXPWidgetRendererDirective, selector: "[axp-widget-renderer]", inputs: ["parentNode", "index", "mode", "node"], outputs: ["onOptionsChanged", "onValueChanged"], exportAs: ["widgetRenderer"] }, { kind: "ngmodule", type: AXDecoratorModule }, { 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: "ngmodule", type: AXLabelModule }, { kind: "component", type: i4.AXLabelComponent, selector: "ax-label", inputs: ["required", "for"], outputs: ["requiredChange"] }, { kind: "ngmodule", type: AXFormModule }, { kind: "component", type: i5.AXFormFieldComponent, selector: "ax-form-field", inputs: ["labelMode"] }, { kind: "component", type: i5.AXFormComponent, selector: "ax-form", inputs: ["labelMode", "look", "messageStyle", "updateOn"], outputs: ["onValidate", "updateOnChange"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMMeetingPublishPopupComponent, decorators: [{
            type: Component,
            args: [{
                    template: `
    <div>
      <ax-content class="ax-p-4">
        <ax-form #form>
          <axp-widgets-container [context]="context()" (onContextChanged)="handleContextChanged($event)">
            <ax-form-field class="ax-px-3">
              <ax-label>User</ax-label>
              <ng-container axp-widget-renderer [node]="userLookupNode" [mode]="'edit'"></ng-container>
            </ax-form-field>
            <ax-form-field class="ax-px-3">
              <ax-label>Date</ax-label>
              <ng-container axp-widget-renderer [node]="dateNode" [mode]="'edit'"></ng-container>
            </ax-form-field>
          </axp-widgets-container>
        </ax-form>
      </ax-content>
      <ax-footer>
        <ax-suffix>
          <ax-button text="Cancel" (onClick)="close()"></ax-button>
          <ax-button color="primary" text="Publish" [disabled]="!isValid()" (onClick)="handlePublish(form)"></ax-button>
        </ax-suffix>
      </ax-footer>
    </div>
  `,
                    imports: [
                        CommonModule,
                        AXPWidgetCoreModule,
                        AXDecoratorModule,
                        AXButtonModule,
                        AXLabelModule,
                        AXFormModule,
                    ],
                }]
        }] });

export { AXMMeetingPublishPopupComponent };
//# sourceMappingURL=acorex-modules-meeting-management-meeting-publish-popup.component-qfvoSBvE.mjs.map
