import { defineComponent as _, createElementBlock as P, createCommentVNode as $, openBlock as y, withModifiers as G, toDisplayString as h, watch as S, createBlock as C, unref as n, mergeProps as N, withCtx as f, createTextVNode as U, createVNode as k, ref as w } from "vue";
import { useI18n as O } from "vue-i18n";
import { o as I, M as z, s as l, ai as R, j, I as T, X as W, aD as D, z as M } from "./start-CE9SawgU.js";
import "pinia";
import "./header-Bn1EKnBE.js";
const q = /* @__PURE__ */ _({
  __name: "PluginLink",
  props: {
    link: {},
    caption: {}
  },
  emits: ["open"],
  setup(e, { emit: s }) {
    const m = s;
    function i(t) {
      const [, , a, o] = t.split("."), g = t.split("/").slice(3).join("/");
      m("open", { url: g, vendor: a, name: o });
    }
    return (t, a) => t.link ? (y(), P("a", {
      key: 0,
      class: "pointer",
      onClick: a[0] || (a[0] = G((o) => i(t.link), ["prevent", "stop"]))
    }, h(t.caption || t.$t("tasks-ui.table.link")), 1)) : $("", !0);
  }
}), Q = /* @__PURE__ */ I(q, [["__scopeId", "data-v-45a5232f"]]), X = z, K = `${X}Tasks.`, u = `${K}Tasks.`, V = {
  /** getList */
  async getList(e) {
    return l.post(`${u}getList`, e);
  },
  /** Get entity data */
  async get(e, s) {
    return l.post(`${u}get`, {
      entityId: e,
      freezeEntityIfPossible: s
    });
  },
  /** markDone */
  async markDone(e) {
    return l.post(`${u}markDone`, { ids: e });
  },
  /** reopen */
  async reopen(e) {
    return l.post(`${u}reopen`, { ids: e });
  },
  /** assignTo */
  async assignTo(e, s) {
    return l.post(`${u}assignTo`, { userId: e, ids: s });
  },
  /** listAttributesLanguagesAndScopes */
  async listAttributesLanguagesAndScopes(e) {
    return l.post(
      `${u}listAttributesLanguagesAndScopes`,
      { entityId: e }
    );
  },
  /** listAttributesLanguagesAndScopesBySetId */
  async listAttributesLanguagesAndScopesBySetId(e) {
    return l.post(
      `${u}listAttributesLanguagesAndScopesBySetId`,
      { dhAttributeSetId: e }
    );
  },
  /** Get all dependencies for a specific entity */
  async getDependencies(e) {
    return l.post(`${u}getDependencies`, e);
  },
  /** Rerun specific mappings for a source entity */
  async rerunMappings(e, s) {
    return l.post(`${u}rerunMappings`, {
      entityId: e,
      dependencies: s
    });
  }
}, F = 5, H = {
  data: V.getList,
  hideGlobalSearch: !0,
  hideRemove: !0,
  hidePagination: !1,
  hideNoDataDescription: !0,
  hideNoDataComment: !0,
  pageSize: F,
  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
    }
  ]
}, B = /* @__PURE__ */ _({
  __name: "TasksList",
  emits: ["open", "row-count"],
  setup(e, { emit: s }) {
    const m = s, { t: i } = O(), { table: t, isLoading: a, onDeleteRows: o } = R({
      deleteApi: V.markDone
    });
    S(
      () => t.value?.table.rowCount.value || 0,
      (p) => {
        m("row-count", p);
      },
      { immediate: !0 }
    );
    function g(p) {
      o([p]);
    }
    return (p, b) => (y(), C(n(j), N({
      ref_key: "table",
      ref: t,
      class: "assigned-tasks",
      "loading-rows-count": 3
    }, n(H)), {
      "cell-link": f(({ cellValue: v }) => [
        k(Q, {
          link: v,
          caption: n(i)("tasks-plugin.overview.link"),
          onOpen: b[0] || (b[0] = (r) => p.$emit("open", r))
        }, null, 8, ["link", "caption"])
      ]),
      "cell-action": f(({ row: v }) => [
        k(n(T), {
          color: "primary",
          text: n(i)("tasks-plugin.overview.markAsDone"),
          disabled: n(a),
          onClick: (r) => g(v.id)
        }, null, 8, ["text", "disabled", "onClick"])
      ]),
      "no-data-title": f(() => [
        U(h(n(i)("tasks-plugin.overview.noTasks")), 1)
      ]),
      _: 1
    }, 16));
  }
});
function A(e) {
  const s = e;
  s.__i18n = s.__i18n || [], s.__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, v: "Open tasks assigned to you directly (" }, { t: 5, i: 0 }, { t: 3, v: ")" }] } },
            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: "Liste ist leer" } },
            openTasks: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Offene Aufgaben" } },
            openTasksAssignedToMe: { t: 0, b: { t: 2, i: [{ t: 3, v: "Offene Aufgaben, die Ihnen direkt zugewiesen wurden (" }, { t: 5, i: 0 }, { t: 3, v: ")" }] } },
            openTasksAssignedViaGroup: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Offene Aufgaben, die Ihnen über Gruppen zugewiesen wurden" } },
            seeMore: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Mehr Infos im Modul Aufgaben" } },
            markAsDone: { t: 0, b: { t: 2, i: [{ t: 3 }], s: "Als erledigt markieren" } }
          }
        }
      }
    }
  });
}
typeof A == "function" && A(B);
const L = /* @__PURE__ */ I(B, [["__scopeId", "data-v-15201f98"]]), J = /* @__PURE__ */ _({
  __name: "TasksOverview",
  props: {
    module: {}
  },
  emits: ["close", "navigate-to"],
  setup(e, { emit: s }) {
    const m = e, i = s, t = w(!0), a = w(-1);
    S(t, (r) => {
      r || i("close");
    });
    const { t: o } = O();
    function g() {
      const r = D("", M(m.module), "tasks/list");
      i("navigate-to", r), t.value = !1;
    }
    function p({ view: r, name: c, namespace: d, url: x }) {
      const E = D("", M({ view: r, name: c, namespace: d }), x);
      i("navigate-to", E), t.value = !1;
    }
    const b = {
      assignedToMeDirectly: !0,
      assignedToMeViaGroups: !1,
      openOnly: !0
    }, v = {
      assignedToMeDirectly: !1,
      assignedToMeViaGroups: !0,
      openOnly: !0
    };
    return (r, c) => t.value ? (y(), C(n(W), {
      key: 0,
      modelValue: t.value,
      "onUpdate:modelValue": c[2] || (c[2] = (d) => t.value = d),
      title: n(o)("tasks-plugin.overview.openTasks"),
      "cancel-caption": ""
    }, {
      actions: f(() => [
        k(n(T), {
          color: "secondary",
          text: n(o)("tasks-plugin.overview.seeMore"),
          onClick: g
        }, null, 8, ["text"]),
        k(n(T), {
          text: n(o)("common.ok"),
          color: "primary",
          onClick: c[0] || (c[0] = (d) => t.value = !1)
        }, null, 8, ["text"])
      ]),
      default: f(() => [
        k(L, {
          "table-name": n(o)("tasks-plugin.overview.openTasksAssignedToMe", [a.value || "-"]),
          "custom-query": b,
          class: "mb-9",
          onOpen: p,
          onRowCount: c[1] || (c[1] = (d) => a.value = d)
        }, null, 8, ["table-name"]),
        k(L, {
          "table-name": n(o)("tasks-plugin.overview.openTasksAssignedViaGroup"),
          "custom-query": v,
          onOpen: p
        }, null, 8, ["table-name"])
      ]),
      _: 1
    }, 8, ["modelValue", "title"])) : $("", !0);
  }
});
typeof A == "function" && A(J);
export {
  J as default
};
