import { defineComponent as y, createElementBlock as B, createCommentVNode as L, openBlock as T, withModifiers as E, toDisplayString as S, createBlock as $, unref as n, mergeProps as x, withCtx as g, createTextVNode as P, createVNode as d, ref as G, watch as N } from "vue";
import { useI18n as h } from "vue-i18n";
import { l as w, M as U, o as i, aa as R, i as W, E as b, I as j, ap as A, v as D } from "./start-BYfL32Oe.mjs";
import "pinia";
import "vue-router";
import "./header-Droxy2Kd.mjs";
import "./moment-h96o7c8I.mjs";
const q = /* @__PURE__ */ y({
  __name: "PluginLink",
  props: {
    link: {},
    caption: {}
  },
  emits: ["open"],
  setup(e, { emit: t }) {
    const k = t;
    function l(s) {
      const [, , o, r] = s.split("."), p = s.split("/").slice(3).join("/");
      k("open", { url: p, vendor: o, name: r });
    }
    return (s, o) => s.link ? (T(), B("a", {
      key: 0,
      class: "pointer",
      onClick: o[0] || (o[0] = E((r) => l(s.link), ["prevent", "stop"]))
    }, S(s.caption || s.$t("tasks-ui.table.link")), 1)) : L("", !0);
  }
}), Q = /* @__PURE__ */ w(q, [["__scopeId", "data-v-45a5232f"]]), z = U, K = `${z}Tasks.`, a = `${K}Tasks.`, O = {
  /** getList */
  async getList(e) {
    return i.post(`${a}getList`, e);
  },
  /** Get entity data */
  async get(e, t) {
    return i.post(`${a}get`, {
      entityId: e,
      freezeEntityIfPossible: t
    });
  },
  /** markDone */
  async markDone(e) {
    return i.post(`${a}markDone`, { ids: e });
  },
  /** reopen */
  async reopen(e) {
    return i.post(`${a}reopen`, { ids: e });
  },
  /** assignTo */
  async assignTo(e, t) {
    return i.post(`${a}assignTo`, { userId: e, ids: t });
  },
  /** listAttributesLanguagesAndScopes */
  async listAttributesLanguagesAndScopes(e) {
    return i.post(
      `${a}listAttributesLanguagesAndScopes`,
      { entityId: e }
    );
  },
  /** listAttributesLanguagesAndScopesBySetId */
  async listAttributesLanguagesAndScopesBySetId(e) {
    return i.post(
      `${a}listAttributesLanguagesAndScopesBySetId`,
      { dhAttributeSetId: e }
    );
  },
  /** Get all dependencies for a specific entity */
  async getDependencies(e) {
    return i.post(`${a}getDependencies`, e);
  },
  /** Rerun specific mappings for a source entity */
  async rerunMappings(e, t) {
    return i.post(`${a}rerunMappings`, {
      entityId: e,
      dependencies: t
    });
  }
}, X = 5, F = {
  data: O.getList,
  hideGlobalSearch: !0,
  hideRemove: !0,
  hidePagination: !1,
  hideNoDataDescription: !0,
  hideNoDataComment: !0,
  pageSize: X,
  columns: [
    {
      id: "created",
      header: "common.created",
      width: 200
    },
    {
      id: "title",
      header: "common.title",
      minWidth: 200
    },
    {
      id: "description",
      header: "common.description",
      minWidth: 200
    },
    {
      id: "link",
      header: "tasks-plugin.overview.link",
      width: 100
    },
    {
      id: "action",
      header: "",
      width: 200
    }
  ]
}, C = /* @__PURE__ */ y({
  __name: "TasksList",
  emits: ["open"],
  setup(e) {
    const { t } = h(), { table: k, isLoading: l, onDeleteRows: s } = R({
      deleteApi: O.markDone
    });
    function o(r) {
      s([r]);
    }
    return (r, p) => (T(), $(n(W), x({
      ref_key: "table",
      ref: k,
      class: "assigned-tasks"
    }, n(F)), {
      "cell-link": g(({ cellValue: m }) => [
        d(Q, {
          link: m,
          caption: n(t)("tasks-plugin.overview.link"),
          onOpen: p[0] || (p[0] = (v) => r.$emit("open", v))
        }, null, 8, ["link", "caption"])
      ]),
      "cell-action": g(({ row: m }) => [
        d(n(b), {
          variant: "elevated",
          color: "primary",
          text: n(t)("tasks-plugin.overview.markAsDone"),
          disabled: n(l),
          onClick: (v) => o(m.id)
        }, null, 8, ["text", "disabled", "onClick"])
      ]),
      "no-data-title": g(() => [
        P(S(n(t)("tasks-plugin.overview.noTasks")), 1)
      ]),
      _: 1
    }, 16));
  }
});
function f(e) {
  const t = e;
  t.__i18n = t.__i18n || [], t.__i18n.push({
    locale: "",
    resource: {
      "en-US": {
        "tasks-plugin": {
          overview: {
            link: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "link" } },
            noTasks: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "List is empty" } },
            openTasks: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Open tasks" } },
            openTasksAssignedToMe: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Open tasks assigned to you directly" } },
            openTasksAssignedViaGroup: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Open tasks assigned to you via groups" } },
            seeMore: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "See more in task module" } },
            markAsDone: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Mark as done" } }
          }
        }
      },
      "de-DE": {
        "tasks-plugin": {
          overview: {
            link: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "link" } },
            noTasks: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "List is empty" } },
            openTasks: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Open tasks" } },
            openTasksAssignedToMe: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Open tasks assigned to you directly" } },
            openTasksAssignedViaGroup: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Open tasks assigned to you via groups" } },
            seeMore: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "See more in task module" } },
            markAsDone: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Mark as done" } }
          }
        }
      }
    }
  });
}
typeof f == "function" && f(C);
const M = /* @__PURE__ */ w(C, [["__scopeId", "data-v-3c815135"]]), H = /* @__PURE__ */ y({
  __name: "TasksOverview",
  props: {
    module: {}
  },
  emits: ["close", "navigate-to"],
  setup(e, { emit: t }) {
    const k = e, l = t, s = G(!0);
    N(s, (u) => {
      u || l("close");
    });
    const { t: o } = h();
    function r() {
      const u = A("", D(k.module), "tasks/list");
      l("navigate-to", u), s.value = !1;
    }
    function p({ view: u, name: c, namespace: _, url: V }) {
      const I = A("", D({ view: u, name: c, namespace: _ }), V);
      l("navigate-to", I), s.value = !1;
    }
    const m = {
      assignedToMeDirectly: !0,
      assignedToMeViaGroups: !1,
      openOnly: !0
    }, v = {
      assignedToMeDirectly: !1,
      assignedToMeViaGroups: !0,
      openOnly: !0
    };
    return (u, c) => s.value ? (T(), $(n(j), {
      key: 0,
      modelValue: s.value,
      "onUpdate:modelValue": c[1] || (c[1] = (_) => s.value = _),
      title: n(o)("tasks-plugin.overview.openTasks"),
      "cancel-caption": ""
    }, {
      actions: g(() => [
        d(n(b), {
          color: "on_dark",
          text: n(o)("tasks-plugin.overview.seeMore"),
          onClick: r
        }, null, 8, ["text"]),
        d(n(b), {
          variant: "elevated",
          text: n(o)("common.ok"),
          onClick: c[0] || (c[0] = (_) => s.value = !1)
        }, null, 8, ["text"])
      ]),
      default: g(() => [
        d(M, {
          "table-name": n(o)("tasks-plugin.overview.openTasksAssignedToMe"),
          "custom-query": m,
          class: "mb-9",
          onOpen: p
        }, null, 8, ["table-name"]),
        d(M, {
          "table-name": n(o)("tasks-plugin.overview.openTasksAssignedViaGroup"),
          "custom-query": v,
          onOpen: p
        }, null, 8, ["table-name"])
      ]),
      _: 1
    }, 8, ["modelValue", "title"])) : L("", !0);
  }
});
typeof f == "function" && f(H);
export {
  H as default
};
