PageSourceSearch

https://services1.otf.ca/scripts/react/components/page/AssignmentRole.js

js otf.ca collected 2026-10-02 03:21:50 UTC 11,100 bytes, 196 lines download raw bytes

1import { j as t } from "../../jsx-runtime.js";
2import { r as y } from "../../vendor.js";
3import k from "../form/AdvanceLookUp.js";
4import { Button as f } from "../form/Button.js";
5import v, { Types as h } from "../form/DateTime.js";
6import T, { MenuItem as _ } from "../form/DropDown.js";
7import x from "./Icon.js";
8import D from "../form/LookUp.js";
9import { s as I } from "../../ssComponent.js";
10var A = /* @__PURE__ */ ((e) => (e.COMPANYCONTACT = "companycontact", e.CONTACT = "contact", e.COMPANY = "company", e.L1UTAPROVCON = "utaprovcon", e.L2UTAPROVCON = "utaprovcon2", e))(A || {});
11const a = globalThis, p = (e, n = {}) => {
12  switch (e) {
13    case "contact":
14      return n.extuserterm;
15    case "companycontact":
16      return n.extunitterm;
17    case "company":
18      return a.getSysText("Organization");
19    default:
20      return n.extunitterm;
21  }
22};
23a.getSysTextTranslations([
24  "Add @value@",
25  "Add Groups",
26  "Add Row",
27  "Advance Lookup",
28  "End Date",
29  "Lookup...",
30  "Organization",
31  "Remove Row",
32  "Required",
33  "Select @value@",
34  "Select Roles",
35  "Start Date",
36  "Use Group Roles"
37]);
38const J = function({ ref: e, objProps: n }) {
39  const R = () => {
40    switch (parseInt(n.json.properties.ctlid)) {
41      case 140:
42      case 1095:
43        return "fal fa-users";
44      case 1080:
45      case 1099:
46        return "fal fa-sitemap";
47      case 155:
48      case 652:
49        return "fal fa-building";
50      default:
51        return "fal fa-list-alt";
52    }
53  }, g = (r) => {
54    d(), w(r);
55  }, N = () => {
56    d(), c([...o, {
57      endDate: "",
58      entry: {
59        text: "",
60        value: ""
61      },
62      group: "",
63      isGroupRoles: !1,
64      roles: "",
65      startDate: ""
66    }]);
67  }, d = (r = null) => {
68    c(r ? (l) => {
69      const s = l.filter((u) => u.endDate || u.entry.value || u.roles || u.startDate);
70      return s.push(...r), s;
71    } : (l) => {
72      let s = [...l];
73      return a.document.querySelectorAll("#associationentry .associationentryfields").forEach((u) => {
74        const i = parseInt(u.getAttribute("data-index"));
75        s[i - 1].group = a.document.getElementById(`groupid_entryfield_${i}`) ? a.document.getElementById(`groupid_entryfield_${i}`).value : null, s[i - 1].isGroupRoles = a.document.getElementById(`roletype_entryfield_${i}`) ? a.document.getElementById(`roletype_entryfield_${i}`).checked : !1, s[i - 1].entry.text = a.document.getElementById(`${n.type}txt_entryfield_${i}`).value, s[i - 1].entry.value = a.document.getElementById(`${n.type}_entryfield_${i}`).value, s[i - 1].roles = a.document.getElementById(`roleid_entryfield_${i}`) ? a.document.getElementById(`roleid_entryfield_${i}`).value : null, s[i - 1].startDate = a.document.getElementById(`startdate_entryfield_${i}`) ? a.document.getElementById(`startdate_entryfield_${i}`).value : "", s[i - 1].endDate = a.document.getElementById(`enddate_entryfield_${i}`) ? a.document.getElementById(`enddate_entryfield_${i}`).value : "";
76      }), s;
77    });
78  }, $ = () => {
79    c([{
80      endDate: "",
81      entry: {
82        text: "",
83        value: ""
84      },
85      group: "",
86      isGroupRoles: !1,
87      roles: "",
88      startDate: ""
89    }]);
90  }, S = {
91    ...n.eventHandlers,
92    onGroupRoles: (r, l) => {
93      const s = [...o];
94      s[r - 1].isGroupRoles = l, c(s);
95    },
96    onRemove: (r) => {
97      d(), c(o.toSpliced(r - 1, 1));
98    }
99  }, [m, w] = y.useState(!1), [o, c] = y.useState([{
100    endDate: "",
101    entry: {
102      text: "",
103      value: ""
104    },
105    group: "",
106    isGroupRoles: !1,
107    roles: "",
108    startDate: ""
109  }]);
110  return y.useImperativeHandle(e, () => ({
111    updateEntries: d
112  }), []), y.useEffect(() => {
113    a.inittooltips();
114  }, [o]), /* @__PURE__ */ t.jsxs("div", { id: "associationentry", className: "associationentrycontainer", "data-term": p(n.type, n.json), style: { marginBottom: "5px" }, children: [
115    /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsxs("div", { className: "caret_container", tabIndex: 0, children: [
116      /* @__PURE__ */ t.jsx(x, { className: n.json.properties.icon || R() }),
117      /* @__PURE__ */ t.jsxs("span", { children: [
118        n.json.term,
119        " (",
120        /* @__PURE__ */ t.jsx("span", { className: "associationentrycount", children: n.json.listview.pagination.recordcount }),
121        ")"
122      ] })
123    ] }) }),
124    !n.isViewMode && /* @__PURE__ */ t.jsxs("div", { id: "associationentrydiv", className: "associationentrydiv", children: [
125      /* @__PURE__ */ t.jsxs("div", { id: "associationentries", children: [
126        /* @__PURE__ */ t.jsx("input", { type: "hidden", id: "associationentryterm", name: "associationentryterm", value: p(n.type, n.json) }),
127        /* @__PURE__ */ t.jsx("input", { type: "hidden", id: "associationentry_wfrolelist", name: "associationentry_wfrolelist", value: "" }),
128        /* @__PURE__ */ t.jsx("input", { type: "hidden", id: "groupid", name: "groupid", value: "0" }),
129        n.type === "contact" && /* @__PURE__ */ t.jsx("div", { id: "contactstabs", className: "tabscrollcontainer", children: /* @__PURE__ */ t.jsxs("ul", { id: "contactstabbar", className: "tabbar", role: "tablist", children: [
130          /* @__PURE__ */ t.jsx("li", { className: `listsubtabitem ${!m && "subtabitem_active"}`, id: "associationentry-single", role: "tab", "aria-selected": "true", children: /* @__PURE__ */ t.jsx("a", { href: "#", onClick: () => {
131            g(!1);
132          }, children: a.getSysText("Add @value@").replace("@value@", n.json.term) }) }),
133          /* @__PURE__ */ t.jsx("li", { className: `listsubtabitem ${m && "subtabitem_active"}`, id: "associationentry-group", role: "tab", "aria-selected": "false", children: /* @__PURE__ */ t.jsx("a", { href: "#", onClick: () => {
134            g(!0);
135          }, children: a.getSysText("Add Groups") }) })
136        ] }) }),
137        o.map((r, l) => /* @__PURE__ */ t.jsx(E, { objProps: { index: l + 1, type: n.type, isGroups: m, isShowRemove: o.length > 1, eventHandlers: S, rowJSON: r, json: n.json } }, l))
138      ] }),
139      /* @__PURE__ */ t.jsxs("div", { id: "associationentrybuttons", children: [
140        /* @__PURE__ */ t.jsx("input", { type: "button", id: "associationentry_submit", value: `Add ${p(n.type, n.json)}`, onClick: () => {
141          d(), requestAnimationFrame(() => {
142            n.eventHandlers.onAddRoleClick(o, m, $);
143          });
144        } }),
145        /* @__PURE__ */ t.jsxs(f, { className: "btn-secondary", objProps: { id: "associationentry_add" }, onClick: N, children: [
146          /* @__PURE__ */ t.jsx(x, { className: "quarterrightmargin fas fa-plus" }),
147          a.getSysText("Add Row")
148        ] }),
149        !m && /* @__PURE__ */ t.jsxs(f, { className: "btn-secondary", objProps: { id: "associationentry_adv" }, onClick: () => {
150          d(), n.eventHandlers.onAdvanceLookUpClick(d);
151        }, children: [
152          /* @__PURE__ */ t.jsx(x, { className: "quarterrightmargin far fa-search-plus" }),
153          a.getSysText("Advance Lookup")
154        ] })
155      ] })
156    ] })
157  ] });
158}, E = function({ objProps: e }) {
159  return /* @__PURE__ */ t.jsxs("div", { id: `association_entryfield_${e.index}`, className: "associationentryfields", "data-index": e.index, children: [
160    e.json.groups && /* @__PURE__ */ t.jsxs("div", { id: `dgroup_entryfield_${e.index}`, className: `CheckBoxContainer ${!e.isGroups && "hidden" || ""}`, style: { display: "inline-block" }, children: [
161      /* @__PURE__ */ t.jsx(T, { objProps: { id: `groupid_entryfield_${e.index}`, className: "Medium", value: e.rowJSON.group }, children: e.json.groups.map((n) => /* @__PURE__ */ t.jsx(_, { objProps: { value: n.id }, children: n.text }, n.id)) }),
162      /* @__PURE__ */ t.jsx("input", { type: "checkbox", value: "1", name: `roletype_entryfield_${e.index}`, id: `roletype_entryfield_${e.index}`, onChange: (n) => {
163        e.eventHandlers.onGroupRoles(e.index, n.target.checked);
164      }, checked: e.rowJSON.isGroupRoles }),
165      /* @__PURE__ */ t.jsx("label", { htmlFor: `roletype_entryfield_${e.index}`, style: { marginRight: "15px" }, children: a.getSysText("Use Group Roles") })
166    ] }),
167    /* @__PURE__ */ t.jsx("div", { className: `lookupdiv ${e.isGroups && "hidden" || ""}`, style: { display: "inline-block" }, children: /* @__PURE__ */ t.jsx(D, { objProps: { inputID: `${e.type}txt_entryfield_${e.index}`, resultPanelID: `resultdiv_entryfield_${e.index}`, placeholder: a.getSysText("Select @value@").replace("@value@", p(e.type, e.json)), buttonText: a.getSysText("Lookup..."), onInputKeyUp: e.eventHandlers.onLookUpKeyUp, onButtonClick: e.eventHandlers.onLookUpClick, hiddenInputID: `${e.type}_entryfield_${e.index}`, inputValue: e.rowJSON.entry.text, hiddenInputValue: e.rowJSON.entry.value } }) }),
168    /* @__PURE__ */ t.jsx("div", { className: e.isGroups && e.rowJSON.isGroupRoles && "hidden" || "", style: { display: "inline-block" }
168, children: /* @__PURE__ */ t.jsx(k, { objProps: { id: `roleid_entryfield_${e.index}`, fieldID: `roleid_entryfield_${e.index}`, valueIDs: e.rowJSON.roles, placeholder: a.getSysText("Select Roles"), delimiter: "," }, children: e.json.assignroles.map((n) => /* @__PURE__ */ t.jsx(_, { objProps: { value: n.id }, children: n.text }, n.id)) }) }),
169    e.json.properties.dateformat && (e.json.properties.hasstartdate || e.json.properties.hasenddate) && /* @__PURE__ */ t.jsxs("div", { id: "daterange_entryfield_", className: "daterange_entryfield", style: { display: "inline-block" }, children: [
170      e.json.properties.hasstartdate && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
171        /* @__PURE__ */ t.jsxs("label", { className: "labelmargin", htmlFor: `startdate_entryfield_${e.index}`, children: [
172          e.json.properties.isstartdaterequired && /* @__PURE__ */ t.jsx("span", { className: "Required quarterrightmargin", title: a.getSysText("Required"), children: "*" }),
173          a.getSysText("Start Date"),
174          ":"
175        ] }),
176        /* @__PURE__ */ t.jsx(v, { objProps: { id: `startdate_entryfield_${e.index}`, type: h.DATE, dateFormat: e.json.properties.dateformat, value: e.rowJSON.startDate } })
177      ] }),
178      e.json.properties.hasenddate && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
179        /* @__PURE__ */ t.jsxs("label", { className: "labelmargin", htmlFor: `enddate_entryfield_${e.index}`, children: [
180          e.json.properties.isenddaterequired && /* @__PURE__ */ t.jsx("span", { className: "Required quarterrightmargin", title: a.getSysText("Required"), children: "*" }),
181          a.getSysText("End Date"),
182          ":"
183        ] }),
184        /* @__PURE__ */ t.jsx(v, { objProps: { id: `enddate_entryfield_${e.index}`, type: h.DATE, dateFormat: e.json.properties.dateformat, value: e.rowJSON.endDate } })
185      ] })
186    ] }),
187    e.isShowRemove && /* @__PURE__ */ t.jsx(f, { className: "btn-secondary", objProps: { id: `associationremove_entryfield_${e.index}`, text: a.getSysText("Remove Row") }, onClick: () => {
188      e.eventHandlers.onRemove(e.index);
189    }, children: /* @__PURE__ */ t.jsx(x, { className: "fas fa-times" }) })
190  ] });
191};
192I.initialize();
193export {
194  A as Types,
195  J as default
196};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.