'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-1141a245.js');
const i18n = require('./i18n-e186d480.js');
const actions = require('./actions-d7eabd95.js');
const actionUtil = require('./action-util-72085aee.js');
require('./i18n-476901fd.js');
require('./i18n-a8cc9ef1.js');
require('./i18n-0bdc9383.js');

const DvnAppViewTakvimDailyCalendarView = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.invalidation = index.createEvent(this, "invalidation", 7);
    this.notification = index.createEvent(this, "notification", 7);
    this.action = index.createEvent(this, "action", 7);
  }
  async componentWillLoad() {
    this.strings = await this.apiSozluk.getContent(this.view.i18nEntryId, i18n.takvimDailyCalendarI18nDefault);
  }
  // TODO this event should be defined in config or the meeting detail should be shown in this view
  // @Listen('viewMeeting')
  // onViewMeeting(event: CustomEvent) {
  //   console.log('onViewMeeting');
  //   console.log(event.detail);
  // }
  onAction(event) {
    var _a, _b;
    const { view } = this;
    if (view.availableTimePickerConfig.successNavigationAction) {
      // show go to meeting page action confirmation dialog
      this.createdMeeting = event.detail;
    }
    (_b = (_a = view.availableTimePickerConfig.events) === null || _a === void 0 ? void 0 : _a.success) === null || _b === void 0 ? void 0 : _b.forEach(eventToEmit => {
      if (eventToEmit instanceof actions.InvalidationAction) {
        this.invalidation.emit(eventToEmit);
      }
      if (eventToEmit instanceof actions.NotificationAction) {
        this.notification.emit(eventToEmit);
      }
    });
  }
  render() {
    const { strings } = this;
    return (index.h(index.Host, { class: "d-flex flex-grow-1", style: { overflow: 'hidden' } }, index.h("takvim-daily-calendar", { apiData: this.apiData, apiTakvim: this.apiTakvim, strings: this.strings, user: this.user, userSettings: this.userSettings, membershipConfigId: this.membership.config._id, calendarConfigId: this.view.table._id, membershipConfigIdToGroupMeetings: this.view.membershipConfigIdToGroupMeetings, membershipConfigIdToViewOnMeetings: this.view.membershipConfigIdToViewOnMeetings }), index.h("dvn-dialog", { title: strings.meetingIsScheduled, shown: !!this.createdMeeting, onDismiss: () => this.createdMeeting = undefined }, index.h("div", { slot: "actions" }, index.h("dvn-button", { view: "flat", onClick: () => this.createdMeeting = undefined }, strings.stayOnPage), index.h("dvn-button", { tint: "primary", view: "flat", onClick: () => {
        this.action.emit(actionUtil.generateActionEmitData({}, this.createdMeeting, this.view.availableTimePickerConfig.successNavigationAction));
        this.createdMeeting = undefined;
      } }, strings.goToMeetingPage)))));
  }
};

exports.dvn_app_view_takvim_daily_calendar_view = DvnAppViewTakvimDailyCalendarView;
