From aa5be953d814bd28ff74a6e6d98f8de9acbb391b Mon Sep 17 00:00:00 2001 From: Koen Reefman Date: Mon, 29 Sep 2025 15:02:12 +0000 Subject: [PATCH] BRCF#90569 Samenvattings-knopje tonen bij (de notities van) meldingen svn path=/Website/trunk/; revision=70449 --- APPL/MLD/get_mld_info_ajax.asp | 3 ++ APPL/MLD/mld_melding.asp | 10 +++++ APPL/MLD/mld_show_note2.asp | 67 +++++++++++++++++++++++++++++++++- APPL/Shared/default.css | 35 ++++++++++++------ 4 files changed, 102 insertions(+), 13 deletions(-) diff --git a/APPL/MLD/get_mld_info_ajax.asp b/APPL/MLD/get_mld_info_ajax.asp index 61cbd383ed..55f919d670 100644 --- a/APPL/MLD/get_mld_info_ajax.asp +++ b/APPL/MLD/get_mld_info_ajax.asp @@ -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; } diff --git a/APPL/MLD/mld_melding.asp b/APPL/MLD/mld_melding.asp index f91e44af11..d8a3865368 100644 --- a/APPL/MLD/mld_melding.asp +++ b/APPL/MLD/mld_melding.asp @@ -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) { %> + +<% } } // 2. Het optionele workflowframe of andere vervolgmeldingen diff --git a/APPL/MLD/mld_show_note2.asp b/APPL/MLD/mld_show_note2.asp index 86a58e98f5..7c6a92eaa4 100644 --- a/APPL/MLD/mld_show_note2.asp +++ b/APPL/MLD/mld_show_note2.asp @@ -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(` +
${L("lcl_ai_generated")}
+
${I("fa-spinner-third fa-spin fa-lg")}
+ `); + $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 += " " + I("fa-sparkles") + ""; + } + 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; diff --git a/APPL/Shared/default.css b/APPL/Shared/default.css index b4bde7ef29..aa3685febb 100644 --- a/APPL/Shared/default.css +++ b/APPL/Shared/default.css @@ -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,