1import { j as s } from "../../../jsx-runtime.js"; 2import { r as c } from "../../../vendor.js"; 3import { s as U } from "../../../ssComponent.js"; 4import J, { Types as d } from "../../../components/page/AssignmentRole.js"; 5import { ButtonList as N, IconButton as h } from "../../../components/form/Button.js"; 6import { ObjectDropDown as S } from "../../../components/form/DropDown.js"; 7import M, { ListViewBar as _ } from "../../../components/page/ListView.js"; 8import W from "../../../components/page/ListViewPagination.js"; 9const e = globalThis; 10e.setDependencies(["/scripts/components/arcadia/sstoast.js", "/styles/components/arcadia/sstoast.css", "/styles/react/controllers/shared/nonconfig/contactscontroller.css"]); 11e.getSysTextTranslations([ 12 "@value@ added", 13 "@value@ removed", 14 "Add @value@", 15 "Export Contacts", 16 "Group Email", 17 "List View Options", 18 "Please enter a @value@", 19 "Please enter a valid end date", 20 "Please enter a valid start date", 21 "Please select a contact to email", 22 "Please select a role", 23 "Please select the records to export", 24 "Remove", 25 "Select @value@" 26]); 27const se = function({ id: g = "", appid: p = -1, objectid: m = -1, level: u = -1, isViewMode: b = !1, isAffiliate: j = !1, viewUserID: $ = -1, isShowCompanies: y = !1 }) { 28 const w = () => { 29 const i = e.document.querySelector(`#${g} div.listsubtabs`), t = e.document.querySelector(`#${g} section.listview-bar`); 30 let o = i ? i.offsetHeight : 0; 31 e.document.body.classList.contains("redesign") && (o += e.document.body.classList.contains("compactMode") ? 32 : 43), t.style.top = `${o - 1}px`, e.document.querySelector(`#listview-${d.CONTACT} thead`).style.top = `${o + t.offsetHeight - 2}px`; 32 }, D = () => { 33 (async () => { 34 const i = await fetch("/system/api/contacts?" + new URLSearchParams({ appid: p, objectid: m, level: u, roletabid: l.tabID, viewid: l.viewID, page: l.page, pagesize: l.pageSize }), { 35 credentials: "include", 36 headers: { "Content-Type": "application/json", "X-Platform-Internal": "true" } 37 }), t = await i.json(); 38 i.status === 200 ? (F(t), P(t.listview), requestAnimationFrame(() => { 39 requestAnimationFrame(() => { 40 e.document.querySelectorAll(`#listview-${d.CONTACT} input[name='objid']:checked, #${d.CONTACT}-select-all-checkbox`).forEach((o) => { 41 o.checked = !1; 42 }), e.document.getElementById("footeroptbtnlist").classList.add("hidden"), w(), e.inittooltips(); 43 }); 44 }), l.tabID < 0 && t && t.roletabs && t.roletabs.length > 0 && f((o) => ({ 45 ...o, 46 tabID: t.roletabs[0].id 47 }))) : alert(t.message || "An unknown error has occurred"); 48 })(); 49 }, L = (i) => { 50 T.current.updateEntries(), f((t) => ({ 51 ...t, 52 tabID: parseInt(i.target.closest("li").getAttribute("data-id")), 53 page: 1, 54 sortBy: "", 55 sortDirection: "" 56 })); 57 }, O = () => { 58 const i = [...e.document.querySelectorAll(`#listview-${d.CONTACT} input[name='objid']:checked`)].map((o) => parseInt(o.value)); 59 if (i.length < 1) { 60 alert(e.getSysText("Please select the records to export")); 61 return; 62 } 63 const t = e.document.frmexport; 64 t.exportidstr.value = i.join(","), e.confirmExportLV(t, e.getSysText("Export Contacts")); 65 }, q = () => { 66 const i = [...e.document.querySelectorAll(`#listview-${d.CONTACT} input[name='objid']:checked`)].map((o) => parseInt(o.value)); 67 if (i.length < 1) 68 return alert(e.getSysText("Please select a contact to email")), !1; 69 const t = e.document.frmgroupemail; 70 if (u < 4) { 71 let o = 0; 72 switch (u) { 73 case 1: { 74 o = 23; 75 break; 76 } 77 case 2: { 78 o = 26; 79 break; 80 } 81 case 3: { 82 o = 8; 83 break; 84 } 85 } 86 t.objecttype.value = o; 87 } 88 t.idlist.value = i.join(","), e.ssWindow.open({ title: e.getSysText("Group Email"), formobject: t, resizetocontenttype: 1 }), t.submit(); 89 }, R = () => { 90 (async () => { 91 const i = await fetch("/system/api/contacts/", { 92 method: "DELETE", 93 credentials: "include", 94 headers: { "Content-Type": "application/json", "X-Platform-Internal": "true" }, 95 body: JSON.stringify({ 96 appid: p, 97 objectid: m, 98 level: u, 99 idlist: [...e.document.querySelectorAll(`#listview-${d.CONTACT} input[name='objid']:checked`)].map((o) => parseInt(o.value)) 100 }) 101 }), t = await i.json(); 102 i.status === 200 ? (v(!0), e.updateObjectCounts(), e.ssToast.show({ message: e.getSysText("@value@ removed").replace("@value@", parseInt(r.properties.ctlid) === 1080 ? r.extunitterm : r.extuserterm), type: "success" })) : alert(t.message || "An unknown error has occurred"); 103 })(); 104 }, V = (i) => { 105 f((t) => ({ 106 ...t, 107 viewID: parseInt(i.target.closest("li").getAttribute("data-value")) 108 })); 109 }, B = (i) => { 110 e.editview(1, i.target.closest("li").getAttribute("data-value"), p, a.properties.entityid); 111 }, k = (i = 1, t = -1) => { 112 f((o) => ({ 113 ...o, 114 page: i, 115 pageSize: t 116 })); 117 }, z = { 118 sort: (i, t) => { 119 f((o) => ({ 120 ...o, 121 sortType: i, 122 sortDirection: t 123 })); 124 }, 125 rowCheckboxHandler: (i) => { 126 i ? e.document.getElementById("footeroptbtnlist").classList.remove("hidden") : e.document.querySelector("[name='objid']:checked") || e.document.getElementById("footeroptbtnlist").classList.add("hidden"); 127 }, 128 open: (i, t) => { 129 e.openlistobject(y ? `/s_viewcompany.jsp?companyid=${a.records.filter((o) =>
129 parseInt(o.id) === parseInt(i))[0].companyid}` : `/s_edituser.jsp?userid=${i}`, "", t); 130 }, 131 reload: () => { 132 k(l.page, l.pageSize === -1 ? -2 : -1); 133 } 134 }, H = { 135 onLookUpKeyUp: (i) => { 136 const t = parseInt(i.target.closest(".associationentryfields").getAttribute("data-index")); 137 e.dynamicKeyPress(i), y ? e.dyn_companysearch(i, i.target.value, e.document.getElementById(`resultdiv_entryfield_${t}`), e.document.getElementById(`resultdiv_entryfield_${t}`).closest(".lookupdiv"), document.getElementById(`companycontact_entryfield_${t}`), document.getElementById(`companycontacttxt_entryfield_${t}`), j ? "" : 1, 0, "", !0, !1, "", 0, r.properties.ctlid, 1) : e.dyn_peoplesearch(i, i.target.value, e.document.getElementById(`resultdiv_entryfield_${t}`), e.document.getElementById(`resultdiv_entryfield_${t}`).closest(".lookupdiv"), document.getElementById(`contact_entryfield_${t}`), document.getElementById(`contacttxt_entryfield_${t}`), 1, p, "", !0, !1, r.properties.limitobjectid, null, null, r.properties.typeid, r.properties.limitcompanyid, null, r.properties.ctlid, 1, null, null, r.properties.isShowNew ? 1 : 0, e.isMobile ? 1 : 0, null, r.properties.allowcontactassoc ? 1 : 0, 0); 138 }, 139 onLookUpClick: (i) => { 140 const t = parseInt(i.target.closest(".associationentryfields").getAttribute("data-index")), o = (y ? d.COMPANYCONTACT : d.CONTACT) + "_entryfield_" + t, x = (y ? d.COMPANYCONTACT : d.CONTACT) + "txt_entryfield_" + t; 141 let n = null; 142 j && $ > 0 ? n = "/s_selectobject.jsp?type=30b&scope=2&frm=frmcontact&txt=" + x + "&id=" + o + "&appid=" + p + "&ctltype=0&ctlid=" + r.properties.ctlid : (n = "/s_userpicker2.jsp?all=1&type=1&userlist=&c1=" + x + "&c2=" + o + "&appid=" + p, r.properties.limitcompanyid && (n += "&l1companyid=" + r.properties.limitcompanyid), n += "&isassociation=1&allowcontactassoc=" + (r.properties.allowcontactassoc ? 1 : 0), r.properties.limitobjectid && (n += "&limitoppid=" + r.properties.limitobjectid), r.properties.typeid && (n += "&sc=" + r.properties.typeid), n += "&ctlid=" + r.properties.ctlid), e.ssWindow.open({ title: e.getSysText("Select @value@").replace("@value@", parseInt(r.properties.ctlid) === 1080 ? r.extunitterm : r.extuserterm), url: n, resizetocontenttype: 0 }); 143 }, 144 onAddRoleClick: (i, t, o) => { 145 const x = []; 146 for (let n of i) { 147 if (!t && !n.entry.value) 148 return alert(e.getSysText("Please enter a @value@").replace("@value@", parseInt(r.properties.ctlid) === 1080 ? r.extunitterm : r.extuserterm)), !1; 149 if ((!t || t && !n.isGroupRoles) && !n.roles) 150 return alert(e.getSysText("Please select a role")), !1; 151 if (r.properties.isstartdaterequired && (!n.startDate || !e.isDateStr(n.startDate, !1, r.properties.dateformat))) 152 return alert(e.getSysText("Please enter a valid start date")), !1; 153 if (r.properties.isenddaterequired && (!n.endDate || !e.isDateStr(n.endDate, !1, r.properties.dateformat))) 154 return alert(e.getSysText("Please enter a valid end date")), !1; 155 if (t) 156 x.push({ 157 id: n.group, 158 usegrouproles: n.isGroupRoles, 159 roleids: n.roles.split(","), 160 startdate: e.ConvertDateStr(n.startDate, r.properties.dateformat, !0), 161 enddate: e.ConvertDateStr(n.endDate, r.properties.dateformat, !0) 162 }); 163 else 164 for (let C of n.roles.split(",")) 165 x.push({ 166 id: n.entry.value, 167 roleid: parseInt(C), 168 startdate: e.ConvertDateStr(n.startDate, r.properties.dateformat, !0), 169 enddate: e.ConvertDateStr(n.endDate, r.properties.dateformat, !0) 170 }); 171 } 172 (async () => { 173 const n = await fetch(t ? "/system/api/contacts/group" : "/system/api/contacts/", { 174 method: "POST", 175 credentials: "include", 176 headers: { "Content-Type": "application/json", "X-Platform-Internal": "true" }, 177 body: JSON.stringify({ 178 appid: p, 179 objectid: m, 180 level: u, 181 [t ? "groups" : "contacts"]: x 182 }) 183 }), C = await n.json(); 184 n.status === 200 ? (v(!0), e.updateObjectCounts(), o(), e.setDependencies(["/scripts/components/
184arcadia/sstoast.js", "/styles/components/arcadia/sstoast.css"], !1, function() { 185 e.ssToast.show({ message: e.getSysText("@value@ added").replace("@value@", parseInt(r.properties.ctlid) === 1080 ? r.extunitterm : r.extuserterm), type: "success" }); 186 })) : alert(C.message || "An unknown error has occurred"); 187 })(); 188 }, 189 onAdvanceLookUpClick: (i) => { 190 e.ssWindow.open({ title: e.getSysText("Add @value@").replace("@value@", parseInt(r.properties.ctlid) === 1080 ? r.extunitterm : r.extuserterm), url: "/s_assignment.jsp?appid=" + p + "&level=" + u + "&objectid=" + m + "&ctlid=" + r.properties.ctlid + "&typeid=" + r.properties.typeid + "&openinlang=0", resizetocontenttype: 0, reactfunctions: { updateEntries: (t) => { 191 i(t); 192 } } }); 193 } 194 }, [l, f] = c.useState({ tabID: -1, viewID: 0, page: 1, pageSize: -1, sortType: "", sortDirection: "" }), [r, F] = c.useState(null), [a, P] = c.useState(null), [E, v] = c.useState(!1), T = c.useRef(null); 195 c.useEffect(() => (e.addEventListener("resize", w), () => { 196 e.removeEventListener("resize", w); 197 }), []), c.useEffect(() => { 198 D(); 199 }, [p, u, m, l.tabID]), c.useEffect(() => { 200 E && (v(!1), D()); 201 }, [E]), c.useEffect(() => { 202 r?.roletabs && (r.roletabs.length > 0 && l.tabID > -1 || r.roletabs.length === 0) && (async () => { 203 const i = await fetch("/system/api/contacts/listview?" + new URLSearchParams({ appid: p, objectid: m, level: u, viewid: l.viewID, page: l.page, pagesize: l.pageSize, orderby: l.sortType, sortdirection: l.sortDirection, roletabid: l.tabID }), { 204 credentials: "include", 205 headers: { "Content-Type": "application/json", "X-Platform-Internal": "true" } 206 }), t = await i.json(); 207 i.status === 200 ? (P(t), e.inittooltips()) : alert(t.message || "An unknown error has occurred"); 208 })(); 209 }, [l.viewID, l.page, l.pageSize, l.sortType, l.sortDirection]); 210 let A = ""; 211 const I = []; 212 if (a) { 213 for (let i of a.types) 214 if (i.records.length > 0) { 215 I.push(/* @__PURE__ */ s.jsx(S.Header, { objProps: { id: `header${i.id}`, value: i.id, text: i.text, action: { icon: "fas fa-cog", onClick: () => { 216 e.ssWindow.open({ url: "/userreport/ur_views.jsp?appid=" + p + "&entityid=" + a.properties.entityid, title: "", resizetocontenttype: 4 }); 217 } } } }, `header${i.id}`)); 218 for (let t of i.records) 219 parseInt(t.id) === a.properties.viewid && (A = t.text), I.push(/* @__PURE__ */ s.jsx(S.Item, { objProps: { id: `dropopt_${t.id}`, value: t.id, text: t.text, action: { icon: "fas fa-wrench", onClick: B }, onSelect: V, isSelected: parseInt(t.id) === a.properties.viewid } }, `dropopt_${t.id}`)); 220 } 221 } 222 return r && /* @__PURE__ */ s.jsxs("section", { id: g, children: [ 223 /* @__PURE__ */ s.jsxs("form", { method: "post", id: "frmcontact", name: "frmcontact", children: [
224 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "ss_formtoken", id: "ss_formtoken", value: r.properties.formtoken }), 225 r.instructions && /* @__PURE__ */ s.jsx("div", { className: "FormInstructions", children: r.instructions }), 226 r.roletabs && r.roletabs.length && /* @__PURE__ */ s.jsx("div", { id: "listsubtabs", className: `listsubtabs ${b && "quarterbottommargin"}`, children: /* @__PURE__ */ s.jsxs("div", { id: "listsubtabcontainer", className: "tabcontainer", children: [ 227 /* @__PURE__ */ s.jsx("div", { id: "nav_left_listsubtab", className: "tabnav_left", style: { display: "none" } }), 228 /* @__PURE__ */ s.jsx("div", { id: "nav_right_listsubtab", className: "tabnav_right", style: { display: "none" } }), 229 /* @__PURE__ */ s.jsx("div", { id: "listsubtabscrollcontainer", className: "tabscrollcontainer", children: /* @__PURE__ */ s.jsx("ul", { id: "listsubtabbar", className: "listsubtabbar", role: "tablist", children: r.roletabs.map((i) => /* @__PURE__ */ s.jsx("li", { "data-id": i.id, className: `listsubtabitem ${parseInt(i.id) === parseInt(l.tabID) && "listsubtabitem_active" || ""}`, id: `roletabid${p}-${i.id}`, role: "tab", "aria-selected": i.id == l.tabID, children: /* @__PURE__ */ s.jsx("a", { onClick: L, dangerouslySetInnerHTML: { __html: i.text } }) }, i.id)) }) }) 230 ] }) }) || "",
231 /* @__PURE__ */ s.jsx(J, { ref: T, objProps: { id: "contacts", type: y ? d.COMPANYCONTACT : d.CONTACT, isViewMode: b, eventHandlers: H, json: r } }), 232 /* @__PURE__ */ s.jsxs("div", { className: "list_container", onClick: () => { 233 T.current.updateEntries(); 234 }, children: [ 235 /* @__PURE__ */ s.jsxs(_, { children: [ 236 /* @__PURE__ */ s.jsxs(_.LeftPanel, { children: [ 237 /* @__PURE__ */ s.jsx(N, { id: "optbtnlist", className: "quarterrightmargin", children: /* @__PURE__ */ s.jsx(h, { objProps: { id: "viewoptionsbtn", text: e.getSysText("List View Options"), icon: "fas fa-sliders-h-square" }, onClick: () => { 238 e.toggleviewopts(1, a.properties.viewid, 1, e.getSysText("List View Options"), () => { 239 v(!0); 240 }); 241 } }) }), 242 /* @__PURE__ */ s.jsxs(N, { id: "footeroptbtnlist", className: "quarterrightmargin hidden", children: [ 243 r.properties.isexportable && /* @__PURE__ */ s.jsx(h, { objProps: { id: "nav_export", text: e.getSysText("Export Contacts"), icon: "far fa-file-export" }, onClick: O }), 244 r.properties.showgroupemail && /* @__PURE__ */ s.jsx(h, { objProps: { id: "btn_groupemail", text: e.getSysText("Group Email"), icon: "far fa-envelope" }, onClick: q }), 245 !b && /* @__PURE__ */ s.jsx(h, { objProps: { id: "btn_remove", text: e.getSysText("Remove"), icon: "fas fa-minus-square" }, onClick: R }) 246 ] }),
247 /* @__PURE__ */ s.jsx(S, { objProps: { id: "listview", text: A, icon: "fas fa-list", panelID: "dropdown-panel-listview", className: "quarterrightmargin" }, children: I }) 248 ] }), 249 /* @__PURE__ */ s.jsx(_.RightPanel, { children: /* @__PURE__ */ s.jsx("div", { className: "navdiv", children: /* @__PURE__ */ s.jsx(W, { id: "pagination", objListView: a, objFunctions: { onChangePage: k } }) }) }) 250 ] }), 251 /* @__PURE__ */ s.jsx(M, { id: d.CONTACT, objListView: a, objFunctions: z }) 252 ] }) 253 ] }), 254 r.properties.showgroupemail && a && /* @__PURE__ */ s.jsxs("form", { action: "/Apps/app_groupemail.jsp", method: "post", target: "_blank", name: "frmgroupemail", id: "frmgroupemail", children: [ 255 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "ss_formtoken", value: r.properties.formtoken }), 256 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "opportunityid", value: p > 0 && m || "" }), 257 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "objecttype", value: a.properties.entityid }),
258 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "idlist", value: "" }), 259 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "appid", value: p || "" }), 260 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "aff", value: j ? 1 : 0 }) 261 ] }), 262 a && a.properties.exportparameters && /* @__PURE__ */ s.jsxs("form", { action: "/userreport/ur_queryexport.jsp", method: "Post", target: "_blank", name: "frmexport", id: "frmexport", children: [ 263 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "ss_formtoken", value: r.properties.formtoken }), 264 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "qtoken", value: r.properties.ensql }), 265 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "objecttype", value: "40" }), 266 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "prikey", value: r.properties.prikey }), 267 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "excelheader", value: a.properties.exportparameters.excelheader }), 268 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "columns", value: a.properties.exportparameters.columns }),
269 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "folderid", value: a.properties.exportparameters.folderid }), 270 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "foldertype", value: a.properties.exportparameters.foldertype }), 271 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "datastart", value: a.properties.exportparameters.datastart }), 272 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "metastart", value: a.properties.exportparameters.metastart }), 273 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "header", value: a.properties.exportparameters.header }), 274 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "tablebm", value: a.properties.exportparameters.tablebm }), 275 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "criteria", value: a.properties.exportparameters.criteria }), 276 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "exportidstr", value: a.properties.exportparameters.exportidstr }), 277 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "exheader", value: a.properties.exportparameters.exheader }),
278 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "exline", value: a.properties.exportparameters.exline }), 279 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "exfooter", value: a.properties.exportparameters.exfooter }), 280 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "exfilename", value: a.properties.exportparameters.exfilename }), 281 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "exstatus", value: a.properties.exportparameters.exstatus }), 282 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "exencoding", value: a.properties.exportparameters.exencoding }), 283 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "exwfid", value: a.properties.exportparameters.exwfid }), 284 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "exappid", value: a.properties.exportparameters.exappid }), 285 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "exvalueonly", value: a.properties.exportparameters.exvalueonly }), 286 /* @__PURE__ */ s.jsx("input", { type: "hidden", name: "exviewid", value: a.properties.exportparameters.exviewid }) 287 ] }) 288 ] }); 289}; 290U.initialize(); 291export { 292 se as default 293};
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.