BRCF#90569 Samenvattings-knopje tonen bij (de notities van) meldingen

svn path=/Website/trunk/; revision=70449
This commit is contained in:
2025-09-29 15:02:12 +00:00
parent 898aaa1883
commit aa5be953d8
4 changed files with 102 additions and 13 deletions

View File

@@ -393,6 +393,9 @@ switch (req_info)
if (useCase == "afmelden") {
var json = mld.getmldjson(mld_key);
result = shared.promptAI(JSON.stringify(json), { "instructions": L("lcl_mld_ai_afmeldtekst_instructions") });
} else if (useCase == "summary") {
var json = mld.getmldjson(mld_key);
result = shared.promptAI(JSON.stringify(json), { "instructions": L("lcl_mld_ai_summarize_instructions") });
}
break;
}

View File

@@ -432,6 +432,16 @@ if (srtdisc_key > 0) {
page = "mld_show_note2.asp?urole=" + urole + "&mld_key=" + mld_key + transitParam;
IFRAMER("mldnoteframe", page, { refreshOnClose: true, sidebar: true } ); // sidebar heeft geen icon/title nodig
if (S("ai_enabled") & 4) { %>
<div id="dmodal" class="ai_mld_summary" style="display:none">
<div class='mld-summary'>
<div class="card">
<div class="header"><%=L("lcl_ai_generated")%></div>
<div class="body"><%=I("fa-spinner-third fa-spin fa-lg")%></div>
</div>
</div>
</div>
<% }
}
// 2. Het optionele workflowframe of andere vervolgmeldingen

View File

@@ -143,9 +143,68 @@ if (mld_key > 0)
FcltMgr.resized();
}
<% if (S("ai_enabled") & 4)
{ %>
var ai_params = {};
function aiSummarize() {
let $popup = parent?.$(".ai_mld_summary");
if (!$popup.length) {
return;
}
$popup.find(".card").html(`
<div class="header">${L("lcl_ai_generated")}</div>
<div class="body">${I("fa-spinner-third fa-spin fa-lg")}</div>
`);
$popup.dialog(ai_params).dialog("open");
<% var url_get_mld_info_ajax = "../mld/get_mld_info_ajax.asp?req_info=promptAI&mld_key=" + mld_key; %>
var protected_mld_info_ajax = "<%=safe.jsstring(protectQS.create(url_get_mld_info_ajax))%>";
var data = {
for: "summary"
};
protectRequest.dataToken(data);
var request = $.ajax(protected_mld_info_ajax, {
method: "POST",
noSpinner: true,
data: data
});
request.then(json => {
if (json.success) {
var $ai_body = $popup.find(".mld-summary > .card > .body > i").parent(".body");
if ($ai_body.length) {
$ai_body.data("summary", json.content);
$.when($ai_body.text(json.content)).then(FcltMgr.resized);
}
}
});
}
<% } %>
$(function ()
{
<% if (getQParamInt("startacceptdialog", 0 )== 1)
<% if (S("ai_enabled") & 4)
{ %>
ai_params = {
modal: true,
width: 600,
position: { my: "center", at: "center", of: <%=1 == 1 ? "parent." : ""%>window },
create: parent.FcltMgr.fnCreateCloseButton(".ai_mld_summary"),
closeOnEscape: true
};
let $popup = parent?.$(".ai_mld_summary");
$popup.find(".mld-summary .card").on("click", function () {
var summary = $popup.find(".body").data("summary");
if (summary) {
if ($("#note").val() == "") {
$("#note").val(summary)
.trigger("blur") // Autogrow
.get(0).scrollIntoView({ block: "nearest", behavior: "smooth" });
}
$popup.dialog("close");
}
});
<% }
if (getQParamInt("startacceptdialog", 0 )== 1)
{ %>
window.parent.mldframe.mld_accept("<%=stdm_info.doublecheck%>", 1);
<% }
@@ -179,7 +238,11 @@ if (mld_key > 0)
buttons.push({ id: "appendixes", icon: "fa-chevron-down", title: L("lcl_appendixes"), action: "toggleDropdown()", showAlways: true });
IFRAMER_HEADER(L("lcl_mld_behandeling"), buttons, { inhamburger: true });
BLOCK_START("mldHistorie", L("lcl_mld_frame_notes"), { detailToggle: true, wide: true, nopadding: true, icon: "fa-clipboard-list-check"});
var safe_notes_title = safe.html(L("lcl_mld_frame_notes"));
if (S("ai_enabled") & 4) {
safe_notes_title += "&nbsp;<span class='default-clickable-icon' onclick='aiSummarize()'>" + I("fa-sparkles") + "</span>";
}
BLOCK_START("mldHistorie", safe_notes_title, { detailToggle: true, wide: true, nopadding: true, icon: "fa-clipboard-list-check", ishtmlsafe: true });
var note_zichtbaarFE = mld_info.fenotes == 1 || mld_info.fenotes == 3;
var mld_note_flag = 0;

View File

@@ -6898,8 +6898,9 @@ div.werkweekend {
}
}
/* .afmeld-teksten */
.afmeld-teksten {
/* melding afmeld-/samenvattings teksten */
.afmeld-teksten,
.mld-summary {
display: flex;
flex-direction: column;
flex: 1;
@@ -6910,25 +6911,18 @@ div.werkweekend {
}
.header,
.body {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
line-clamp: 1;
font-size: var(--fclt-font-size-s);
overflow: hidden;
padding-right: 3.5em;
}
.body {
-webkit-line-clamp: 3;
line-clamp: 3;
}
.card {
display: flex;
cursor: pointer;
gap: .25em;
padding: .5em;
}
.card::after {
content: "\2b"; /* fa-plus */
font-family: "Font Awesome 6 Pro";
font-size: 2.5em;
font-weight: 300;
@@ -6951,6 +6945,25 @@ div.werkweekend {
}
}
}
.afmeld-teksten {
.header,
.body {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
line-clamp: 1;
}
.body {
-webkit-line-clamp: 3;
line-clamp: 3;
}
.card::after {
content: "\2b"; /* fa-plus */
}
}
.mld-summary .card::after {
content: "\f737"; /* fa-clipboard-list-check */
}
/* chatter */
#chat .card-header,