Files
OnDoc/API_NetFramework/CLM.aspx
Stefan Hutter 4460f36891 Update 20260319
2026-03-19 21:38:36 +01:00

382 lines
10 KiB
Plaintext

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CLM.aspx.cs" Inherits="WebApp.CLM" %>
<!DOCTYPE html>
<html>
<head runat="server">
<%--<title>Daten & JSON Editor</title>--%>
<script src="/Scripts/ace/ace.js"></script>
<script src="/Scripts/ace/mode-json.min.js"></script>
<script src="/Scripts/ace/theme-tomorrow.min.js"></script>
<script src="/Scripts/ace/worker-json.js"></script>
<script src="/Scripts/jquery.min.js"></script>
<script src="/Scripts/ace/ext-searchbox.js"></script>
<link href="/Content/bootstrap.css" rel="stylesheet" />
<%--<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.23.4/ace.js"></script>--%>
<style>
html, body {
margin: 0;
padding: 0;
height: 100%;
font-family: Arial;
background: #d9d8d4;
}
.page-header {
background-color: #2563eb;
color: #fff;
padding: 15px 30px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.page-header h1 {
margin: 0;
font-size: 1.8rem;
}
.page-header p {
margin: 4px 0 0 0;
font-size: 0.95rem;
color: #dbeafe;
}
.layout {
display: flex;
height: calc(100% - 70px);
}
/* 70px für header */
.left {
width: 45%;
padding: 20px;
background: #fff;
border-right: 1px solid #ddd;
overflow: auto;
}
.leftfull {
width: 100%;
padding: 20px;
background: #fff;
border-right: 1px solid #ddd;
overflow: auto;
}
.right {
width: 55%;
padding: 0;
height: 100%;
display: flex;
flex-direction: column;
}
#editor {
flex: 1;
width: 100%;
}
select {
width: 100%;
padding: 8px;
margin-bottom: 12px;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
}
th, td {
padding: 8px;
border-bottom: 1px solid #e5e7eb;
}
tr:hover {
background: #f9fafb;
}
.pager a, .pager span {
padding: 5px 9px;
border: 1px solid #ddd;
border-radius: 5px;
margin-left: 4px;
text-decoration: none;
font-size: 13px;
}
.pager span {
background: #2563eb;
color: #fff;
border-color: #2563eb;
}
a.open {
color: #2563eb;
cursor: pointer;
text-decoration: none;
}
a.open:hover {
text-decoration: underline;
}
#pdfFrame {
width: 100%;
height: 500px;
}
.leftpanel {
border-right: 1px solid #ccc;
height: 100%;
}
.navbar-custom {
background-color: #c4c4bc;
padding-top: 10px;
padding-bottom: 10px;
}
.navbar-custom .navbar-brand {
color: black;
font-weight: 600;
}
.navbar-custom .btn {
border-color: white;
color: white;
}
.navbar-custom .btn:hover {
background: white;
color: #0d6efd;
}
.content {
padding: 30px;
}
/* Cards */
.cards {
display: grid;
grid-template-columns: repeat(auto-fit,minmax(250px,1fr));
gap: 10px;
margin-bottom: 10px;
}
.card {
background: white;
padding: 10px;
border-radius: 12px;
box-shadow: 0 10px 20px rgba(0,0,0,0.08);
animation: fadeInUp 0.6s ease;
}
.card h3 {
margin-top: 0;
}
.card:hover {
transform: translateY(-4px);
transition: 0.2s;
}
</style>
</head>
<nav class="navbar navbar-expand-lg navbar-custom">
<div class="container-fluid">
<!-- TITEL LINKS -->
<span class="navbar-brand">
<h2>OnDoc-API - CLM-Dokumente</h2>
</span>
<div class="ms-auto d-flex gap-2">
<!-- BUTTON -->
<button class="btn btn-primary" onclick="generateFromJson()">
Generieren
</button>
</div>
</div>
</nav>
<!-- LAYOUT -->
<div class="layout">
<form runat="server" class="left" id="masterform">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" />
<div class="content">
<!-- Dashboard Cards -->
<div class="cards">
<div class="card">
<h3>Selektion</h3>
<p>
Tabelle
<asp:DropDownList
Width="200"
ID="ddlTables"
runat="server"
AutoPostBack="true"
OnSelectedIndexChanged="ddlTables_SelectedIndexChanged" />
<asp:Label ID="lblFilter" runat="server" Text="Filter:"></asp:Label>
<asp:TextBox ID="txtfilter" runat="server" Width="207px"></asp:TextBox>
<asp:Button ID="btnRefresh" runat="server" Text="Aktualisieren" OnClick="ddlTables_SelectedIndexChanged" />
<asp:Button ID="Button1" runat="server" Text="Filter löschen" OnClick="ddlTables_clearfilter" />
</div>
</div>
<!-- Schnellzugriff Buttons -->
</div>
<%-- <asp:DropDownList
Width="300"
ID="ddlTables"
runat="server"
AutoPostBack="true"
OnSelectedIndexChanged="ddlTables_SelectedIndexChanged" />
&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblFilter" runat="server" Text="Filter:"></asp:Label>
<asp:TextBox ID="txtfilter" runat="server" Width="207px"></asp:TextBox>
<asp:Button ID="btnRefresh" runat="server" Text="Aktualisieren" OnClick="ddlTables_SelectedIndexChanged" />
<asp:Button ID="Button1" runat="server" Text="Filter löschen" OnClick="ddlTables_clearfilter" />--%>
<asp:GridView
ID="gvData"
runat="server"
AutoGenerateColumns="true"
AllowPaging="true"
PageSize="15"
PagerStyle-CssClass="pager"
OnPageIndexChanging="gvData_PageIndexChanging"
OnRowCreated="gvData_RowCreated"
OnRowDataBound="gvData_RowDataBound" />
</form>
<div id="editor"></div>
</div>
<script>
const editor = ace.edit("editor");
editor.setTheme("ace/theme/tomorrow");
editor.session.setMode("ace/mode/json");
editor.setShowPrintMargin(false);
editor.session.setTabSize(2);
editor.session.setUseSoftTabs(true);
editor.session.doc
//let editor;
//$(function () {
// editor = ace.edit("editor");
// editor.setTheme("ace/theme/tomorrow");
// editor.session.setMode("ace/mode/json");
// editor.setShowPrintMargin(false);
// editor.session.setTabSize(2);
// editor.session.setUseSoftTabs(true);
// editor.commands.addCommand({
// name: "find",
// bindKey: { win: "Ctrl-F", mac: "Command-F" },
// exec: function (ed) {
// ace.require("ace/ext/searchbox").Search(ed);
// }
// });
//});
function generateFromJson() {
var jsonText = editor.getValue();
alert("Hallo");
$.ajax({
type: "POST",
url: "/API/DokumentGenerator",
data: jsonText,
contentType: "application/json; charset=utf-8",
dataType: "json",
headers: {
"Authorization": "Bearer " + "pZkuG6l6ORCEckqQimPK58PO1A9EnkMtL5oCgRX9WiWnD4xeH7ikGzhWnTBy/vk8J4Iiz8gCSx9uFHA4+DvITG0roO97sk82d/0BCjVlwLWINpXlJfGYEF3X96AdoCQvb3ruwv/tVqEHsSU5aNfyxBAe+EhLTHQ8t7ysgJZWh98="
},
success: function (response) {
var pdfWindow = window.open("");
pdfWindow.document.write("<iframe width='100%' height='100%' src='data:application/pdf;base64," + response.file + "'></iframe>");
//alert("Server Response: " + response.file);
},
error: function (err) {
alert("Error: " + err.responseText);
}
});
}
function showDoc(tableKey, id) {
PageMethods.GetDoc(
tableKey,
id,
function (result) {
var pdfWindow = window.open("");
pdfWindow.document.write("<iframe width='100%' height='100%' src='data:application/pdf;base64," + result + "'></iframe>");
},
function (err) {
alert(err.get_message())
}
);
}
function loadJson(tableKey, id) {
editor.setValue("// lade JSON ...", -1);
PageMethods.GetJson(
tableKey,
id,
function (result) {
editor.setValue(result, -1);
},
function (err) {
editor.setValue(JSON.stringify({ error: err.get_message() }, null, 2), -1);
}
);
}
</script>
<script type="text/javascript">
window.onload = function () {
var isLoggedIn = <%= (Session["LoggedIn"] != null && (bool)Session["LoggedIn"])
? "true"
: "false" %>;
if (!isLoggedIn) {
window.location.href = "/OnDocAPIHome.aspx";
}
};
</script>
</body>
</html>