import { r as registerInstance, c as createEvent, h, H as Host } from './index-ecdfb761.js';
import { C as CalendarUtils } from './calendar-470c802a.js';
import { S as SozlukApi } from './index-3bf9b308.js';
import { s as sozlukEntries, d as MentornityAnnouncementWrapperI18nKey, e as mentornityAnnouncementWrapperI18nDefault } from './sozluk-entries-1e8f5234.js';
import './index-a3ca021c.js';
import './_commonjsHelpers-27f122dd.js';
import './moment-65eca6b3.js';
import './i18n-09a07b97.js';
import './i18n-0e757ca5.js';

const MentornityAnnouncementsMailingReport = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.openSelectUsersDialog = createEvent(this, "openSelectUsersDialog", 7);
    this.openAnnouncementReport = createEvent(this, "openAnnouncementReport", 7);
    this.setDictionaryLanguage = async () => {
      const apiSozluk = new SozlukApi().setLanguage(this.item.language).setContents(sozlukEntries);
      this.strings = await apiSozluk.getContent(MentornityAnnouncementWrapperI18nKey, mentornityAnnouncementWrapperI18nDefault);
    };
  }
  componentWillLoad() {
    this.setDictionaryLanguage();
  }
  render() {
    var _a, _b, _c, _d, _e, _f, _g;
    const { strings } = this;
    if (!strings)
      return;
    const hasSentEmails = ((_b = (_a = this.item) === null || _a === void 0 ? void 0 : _a.targetList) === null || _b === void 0 ? void 0 : _b.length) > 0;
    const sentEmailsDate = ((_d = (_c = this.item) === null || _c === void 0 ? void 0 : _c.sentEmailsAt) === null || _d === void 0 ? void 0 : _d.length) > 0 && CalendarUtils.format(((_e = this.item) === null || _e === void 0 ? void 0 : _e.sentEmailsAt[((_g = (_f = this.item) === null || _f === void 0 ? void 0 : _f.sentEmailsAt) === null || _g === void 0 ? void 0 : _g.length) - 1]) * 1000, `DD-MM-YYYY - ${CalendarUtils.timeFormat === '12-hour' ? 'hh:mm A' : 'HH:mm'}`); // get latest sent date
    return (h(Host, null, hasSentEmails ?
      h("div", { class: "d-flex align-items-center" }, h("p", { class: "m-0" }, SozlukApi.build(strings.sentOn, { date: sentEmailsDate })), h("strong", { class: "m-0 ml-3", style: { cursor: 'pointer' }, onClick: () => this.openAnnouncementReport.emit(this.item) }, h("dvn-icon", { iconName: "uil uil-envelope-check" }), strings.checkReport))
      :
        h("div", { class: "d-flex align-items-center" }, h("dvn-button", { tint: "primary", leaned: true, scale: "small", onClick: () => this.openSelectUsersDialog.emit(this.item) }, strings.sendNow), h("p", { class: "m-0 ml-3" }, strings.notSent))));
  }
};

export { MentornityAnnouncementsMailingReport as mentornity_announcements_mailing_report };
