Просмотр исходного кода

Viele kleine Änderungen vor Abstimmung mit Matthias

gc-server3 3 дней назад
Родитель
Сommit
ec40881626

+ 13 - 4
app/routes.py

@@ -147,9 +147,15 @@ def forderungen_liste(request: Request, db: Session = Depends(get_session), limi
 
 
 @router.get("/app/forderungen/details/{primary_key}", response_class=HTMLResponse)
-def forderungen_details(request: Request, primary_key: str, db: Session = Depends(get_session), limit: int = 100):
+def forderungen_details(request: Request, primary_key: str, db: Session = Depends(get_session)):
 
     pkey = convert_primary_key("forderungen", primary_key)
+
+    template_context = get_template_context(request, pkey, db)
+    return templates.TemplateResponse(request, "forderungen/details/details.html", template_context)
+
+
+def get_template_context(request: Request, pkey: dict[str, str], db: Session) -> dict:
     context = {
         "appsmith": {
             "URL": {
@@ -167,7 +173,7 @@ def forderungen_details(request: Request, primary_key: str, db: Session = Depend
     for filename in [
         "auftraege_positionen",
         "forderungen_buchungen",
-        "forderungen_kommentar",
+        "forderungen_kommentare",
         "forderungen_details",
         "forderungen_mahnungen",
         "versicherungen",
@@ -185,8 +191,7 @@ def forderungen_details(request: Request, primary_key: str, db: Session = Depend
     }
     template_context["files"] = get_files(pkey)
     template_context["add7days"] = (datetime.now() + timedelta(days=7)).strftime("%Y-%m-%d")
-
-    return templates.TemplateResponse(request, "forderungen/details/details.html", template_context)
+    return template_context
 
 
 @router.post("/app/forderungen/details/{primary_key}", response_class=HTMLResponse)
@@ -247,6 +252,10 @@ async def post_forderungen_details(
         q = db.execute(text(subquery))
         print(q.rowcount)
     db.commit()
+    template_context = get_template_context(request, pkey, db)
+    if source == "comments":
+        return templates.TemplateResponse(request, "base/chat_container.html", template_context)
+    return templates.TemplateResponse(request, "forderungen/details/details_formular.html", template_context)
 
 
 def convert_primary_key(area: str, primary_key: str) -> dict[str, str]:

+ 1 - 1
pyproject.toml

@@ -1,7 +1,7 @@
 [project]
 name = "gcepic"
 version = "0.2.0"
-description = "GlobalCube Enterprise Planning, Information & Controlling"
+description = "GlobalCube Enterprise Processing, Information & Controlling"
 readme = "README.md"
 requires-python = ">=3.13"
 dependencies = [

+ 117 - 83
static/assets/css/main.css

@@ -1,9 +1,8 @@
-
 .inter-gc {
-  font-family: "Inter", sans-serif;
-  font-optical-sizing: auto;
-  font-weight: 400;
-  font-style: normal;
+    font-family: "Inter", sans-serif;
+    font-optical-sizing: auto;
+    font-weight: 400;
+    font-style: normal;
 }
 
 
@@ -473,6 +472,10 @@ body {
     margin-bottom: 12px;
 }
 
+.toolbar form {
+    width: 100%;
+}
+
 .tool-button {
     background: none;
     border: none;
@@ -513,6 +516,7 @@ body {
     resize: none;
     transition: var(--transition);
     height: 50px;
+    width: 80%;
     outline: none;
 }
 
@@ -796,7 +800,13 @@ body {
 
 
 @media (min-width: 1400px) {
-    .container, .container-lg, .container-md, .container-sm, .container-xl, .container-xxl {
+
+    .container,
+    .container-lg,
+    .container-md,
+    .container-sm,
+    .container-xl,
+    .container-xxl {
         max-width: 1750px;
     }
 }
@@ -819,86 +829,110 @@ a {
 }
 
 .footer {
-        --cui-footer-bg: #B1BCC7;
-}
-
-.table thead {
-  position: sticky;
-  top: 40px;
-  background: white;
-}
-
-
-      .chat-input {
-            padding: 15px 20px;
-            border-top: 1px solid var(--border);
-            display: flex;
-            align-items: center;
-            background-color: white;
-            position: relative;
-            z-index: 10;
-        }
-
-        .input-container {
-            flex: 1;
-            display: flex;
-            align-items: center;
-            background-color: var(--secondary);
-            border-radius: 20px;
-            padding: 0 15px;
-            position: relative;
-        }
-
-        .input-container input {
-            flex: 1;
-            border: none;
-            outline: none;
-            height: 40px;
-            background-color: transparent;
-            padding: 0 10px;
-            font-size: 15px;
-        }
-
-        .input-actions {
-            display: flex;
-            gap: 10px;
-        }
-
-        .input-btn {
-            background: none;
-            border: none;
-            color: #888;
-            cursor: pointer;
-            transition: var(--transition);
-            font-size: 18px;
-        }
-
-        .input-btn:hover {
-            color: var(--primary);
-        }
-
-        .send-btn {
-            background-color: var(--primary);
-            color: white;
-            width: 40px;
-            height: 40px;
-            border-radius: 50%;
-            border: none;
-            cursor: pointer;
-            margin-left: 10px;
-            transition: var(--transition);
-            display: flex;
-            align-items: center;
-            justify-content: center;
-        }
-
-        .send-btn:hover {
-            background-color: var(--primary-light);
-            transform: scale(1.05);
-        }
+    --cui-footer-bg: #B1BCC7;
+}
+
+.table thead
+{
+    position: sticky;
+    top: 40px;
+    background: white;
+}
+
+
+.chat-input {
+    padding: 15px 20px;
+    border-top: 1px solid var(--border);
+    display: flex;
+    align-items: center;
+    background-color: white;
+    position: relative;
+    z-index: 10;
+}
+
+.input-container {
+    flex: 1;
+    display: flex;
+    align-items: center;
+    background-color: var(--secondary);
+    border-radius: 20px;
+    padding: 0 15px;
+    position: relative;
+}
+
+.input-container input {
+    flex: 1;
+    border: none;
+    outline: none;
+    height: 40px;
+    background-color: transparent;
+    padding: 0 10px;
+    font-size: 15px;
+}
+
+.input-actions {
+    display: flex;
+    gap: 10px;
+}
+
+.input-btn {
+    background: none;
+    border: none;
+    color: #888;
+    cursor: pointer;
+    transition: var(--transition);
+    font-size: 18px;
+}
+
+.input-btn:hover {
+    color: var(--primary);
+}
+
+.send-btn {
+    background-color: var(--primary);
+    color: white;
+    width: 40px;
+    height: 40px;
+    border-radius: 50%;
+    border: none;
+    cursor: pointer;
+    margin-left: 10px;
+    transition: var(--transition);
+    display: flex;
+    align-items: center;
+    justify-content: center;
+}
+
+.send-btn:hover {
+    background-color: var(--primary-light);
+    transform: scale(1.05);
+}
 
 .modal {
     --cui-modal-width: 80%;
 }
 
+.beleg-M1 td {
+    color: #cc8800
+}
+
+.beleg-M2 td {
+    color: #cc2200
+}
+
+.beleg-M3 td {
+    color: #882200
+}
+
+::-webkit-datetime-edit-year-field:not([aria-valuenow]),
+::-webkit-datetime-edit-month-field:not([aria-valuenow]),
+::-webkit-datetime-edit-day-field:not([aria-valuenow]) {
+    color: #eee;
+}
 
+input[type="date"]:in-range::-webkit-datetime-edit-year-field,
+input[type="date"]:in-range::-webkit-datetime-edit-month-field,
+input[type="date"]:in-range::-webkit-datetime-edit-day-field,
+input[type="date"]:in-range::-webkit-datetime-edit-text {
+    color: #eee;
+}

+ 1 - 1
templates/base/base.html

@@ -29,7 +29,7 @@
   <link rel="icon" href="/static/assets/images/favicon.ico" type="image/x-icon">
 </head>
 
-<body class="container py-3" hx-boost="true">
+<body class="container" hx-boost="true">
   <!--<nav class="navbar navbar-expand-lg bg-primary">
     <div class="container-fluid">
         <a class="navbar-brand" href="#">Navbar</a>

+ 16 - 4
templates/base/chat_container.html

@@ -1,4 +1,4 @@
-<div class="chat-container">
+<div class="chat-container" id="chat">
     <div class="header">
         <div class="header-left">
             <div class="avatar" style="background-color: #5468FF;">
@@ -10,7 +10,7 @@
                 </svg>
             </div>
             <div class="course-info">
-                <div class="course-title">{{ forderungen_details[0].Kunde }} / {{ forderungen_details[0].Beleg_Nr }}</div>
+                <div class="course-title">{{ forderungen_details[0].Kunde_Text }} / {{ forderungen_details[0].Beleg_Nr }}</div>
                 <div class="course-participants">4 Mitarbeiter involviert</div>
             </div>
         </div>
@@ -108,6 +108,11 @@
             </div>
         </div>
         {% endfor %}
+
+        <div id="chat-end">
+            &nbsp;
+        </div>
+
         <!--
         <div class="message student">
             <div class="message-header">
@@ -422,7 +427,7 @@
                 <input type="hidden" name="source" value="comments" />
                 <input type="text" class="message-input" id="comment" name="Kommentar" placeholder="Kommentieren ..."
                     autofocus="autofocus" />
-                <button class="btn btn-primary" hx-post="" hx-trigger="click" hx-swap="none" hx-push-url="false">
+                <button class="btn btn-primary" hx-post="" hx-trigger="click" hx-swap="outerHTML" hx-target="#chat" hx-push-url="false">
                     <i class="icon icon-lg cil-chevron-right"></i>
                 </button>
             </form>
@@ -463,4 +468,11 @@
             </div>
         </div>
     </div>
-</div>
+</div>
+
+<script>
+    window.setTimeout(function() {
+        let element = document.getElementById("chat-end");
+        element.scrollIntoView({ behavior: "smooth", block: "end" });
+    }, 1000);
+</script>

+ 5 - 18
templates/forderungen/details/details.html

@@ -2,7 +2,7 @@
 {% block content %}
 
 <br>
-<h2>{{forderungen_details[0].Beleg_Text }}</h2>
+<h2>{{ forderungen_details[0].Beleg_Text }}</h2>
 <br>
 
 <div class="row g-3">
@@ -40,27 +40,14 @@
 
 </div>
 </div>
-<br>
-<br>
 
-{%include 'forderungen/details/details_kommentare.html' %}
-
-<br>
 <br>
 
-
-<h3>Mahnungen</h3>
-
-{%include 'forderungen/details/details_mahnungen.html' %}
-
-<br>
-<br>
-
-
 <h3>Buchungsbelege</h3>
+<p class="lead">
+  Debitorenkonto {{ forderungen_details[0].Kunde_Nr }} - {{ forderungen_details[0].Kunde_Name }}
+</p>
 
-        {%include 'forderungen/details/details_buchungen.html' %}
-
-
+{%include 'forderungen/details/details_buchungen.html' %}
 
 {% endblock %}

+ 6 - 4
templates/forderungen/details/details_buchungen.html

@@ -1,6 +1,6 @@
 <div class="tabs">
     <div class="tab">Diese Rechnung</div>
-    <div class="tab">Alle offenen Rechnungen</div>
+    <div class="tab">Alle offenen Belege</div>
     <div class="tab">Dieses Fahrzeug</div>
     <div class="tab active">Debitor Historie</div>
 </div>
@@ -9,24 +9,26 @@
     <thead>
         <tr>
             <th>Fahrzeug</th>
+            <th>Belegart</th>
             <th>Belegnr.</th>
             <th>Belegdatum</th>
             <th>Beschreibung</th>
             <th>Benutzer</th>
             <th>Betrag</th>
-            <th>Offen</th>
+            <th>Bezahlt</th>
         </tr>
     </thead>
     <tbody>
         {% for row in forderungen_buchungen %}
-        <tr>
+        <tr class="beleg-{{ row.Beleg_Art }}">
             <td>{{ row.Fahrzeug_Nr }}</td>
+            <td>{{ row.Beleg_Art }}</td>
             <td>{{ row.Beleg_Nr }}</td>
             <td>{{ row.Beleg_Datum|date_format }}</td>
             <td>{{ row.Beleg_Beschreibung }}</td>
             <td>{{ row.Benutzer }}</td>
             <td class="text-end">{{ row.Betrag|number_format }}</td>
-            <td>{{ row.Status }}</td>
+            <td>{{ row.Bezahlt }}</td>
         </tr>
         {% endfor %}
     </tbody>

+ 3 - 3
templates/forderungen/details/details_formular.html

@@ -1,6 +1,6 @@
 {% set row = forderungen_details[0] %}
 
-<form class="row g-3">
+<form class="row g-3" id="formular">
   <input type="hidden" name="source" value="details" />
   <div class="col-12">
     <div class="form-check" data-coreui-toggle="collapse" data-coreui-target="#VersicherungCollapse"
@@ -198,7 +198,7 @@
       <label for="Wiedervorlage" class="col-sm-3 col-form-label">Wiedervorlage</label>
       <div class="col-sm-5">
         <input type="date" class="form-control" id="Wiedervorlage" name="Wiedervorlage"
-          value="{{ row.Wiedervorlage.strftime(" %Y-%m-%d") }}">
+          value="{{ row.Wiedervorlage.strftime("%Y-%m-%d") }}">
       </div>
       <div class="col-3">
         <a class="btn btn-primary" onclick="document.getElementById('Wiedervorlage').value='{{ add7days }}';" hx-disable="true">
@@ -209,7 +209,7 @@
   </div>
 
   <div class="col-12">
-    <button class="btn btn-primary" hx-post="" hx-trigger="click" hx-swap="none" hx-push-url="false">Speichern</button>
+    <button class="btn btn-primary" hx-post="" hx-trigger="click" hx-swap="outerHTML" hx-target="#formular" hx-push-url="false">Speichern</button>
   </div>
 
 

+ 2 - 2
templates/forderungen/details/details_mahnungen.html

@@ -1,6 +1,6 @@
 <div class="tabs">
     <div class="tab">Diese Rechnung</div>
-    <div class="tab">Alle offenen Rechnungen</div>
+    <div class="tab">Alle offenen Belege</div>
     <div class="tab">Dieses Fahrzeug</div>
     <div class="tab active">Debitor Historie</div>
 </div>
@@ -15,7 +15,7 @@
             <th>Belegnr.</th>
             <th>Belegdatum</th>
             <th>Betrag</th>
-            <th>Offen</th>
+            <th>Bezahlt</th>
         </tr>
     </thead>
     <tbody>

+ 4 - 9
templates/forderungen/details/queries/forderungen_buchungen.sql

@@ -6,14 +6,9 @@ SELECT TOP 1000 [Client_DB]
      , [Beleg_Datum]
      , [Beleg_Beschreibung]
      , [Betrag]
-     , [Benutzer]
-     , iif([Open] = '0', 'N', 'J') as [Status]
-     , CASE
-           WHEN [Document Type] = '2' THEN 'R'
-           WHEN [Document Type] = '3' THEN 'R'
-           WHEN [Document Type] = '1' THEN 'Z'
-           WHEN [Document Type] = '0' THEN 'K'
-           ELSE 'X' END AS [Beleg_Art]
+     , [Benutzer_ID]
+     , [Bezahlt]
+     , [Beleg_Art]
 FROM [dbo].[Forderungen_Buchungen]
 WHERE (
 	[Client_DB] = {{ appsmith.URL.queryParams.Client_DB }}
@@ -27,4 +22,4 @@ AND (
 	
 ) OR 1 != 1
 
-ORDER BY [Beleg_Datum], [Beleg_Nr]
+ORDER BY [Beleg_Datum], [Beleg_Art], [Beleg_Nr]

+ 0 - 0
templates/forderungen/details/queries/forderungen_kommentar.sql → templates/forderungen/details/queries/forderungen_kommentare.sql


+ 1 - 1
templates/forderungen/details/queries/forderungen_mahnungen.sql

@@ -6,7 +6,7 @@ SELECT TOP 100 [Client_DB]
      , [Beleg_Nr]
      , [Beleg_Datum]
      , [Betrag]
-     , [Offen]
+     , 'N' as [Bezahlt]
 FROM [dbo].[Forderungen_Mahnungen]
 WHERE (
 	[Client_DB] = {{ appsmith.URL.queryParams.Client_DB }}

+ 1 - 1
templates/forderungen/liste/config/liste_filter.csv

@@ -1,7 +1,7 @@
 Name;Filter_Typ;Breite;Beschriftung;Tabellenfeld;Anzeigewert;Sortierung;Standardwert
 Mandant;select;2;;Client_DB;Hauptbetrieb_Name;;
 Filiale;select;2;;Standort_ID;Standort_Name;;
-Bereich;select;2;;;;;
+Abteilung;select;2;;;;;
 Verursacher;select;4;;Verursacher_Text;;;
 RechnungGutschrift;select;2;R/G;Rechnung_Gutschrift;;;
 

+ 1 - 1
templates/forderungen/liste/liste_kopfzeile.html

@@ -1,5 +1,5 @@
     <tr>
-        <th>Filiale / Bereich</th>
+        <th>Filiale / Abteilung</th>
         <th>Verursacher</th>
         <th>RG-Betrag<br>/ RG-Nr.</th>
         <th>RG-Datum<br>/ Fällig</th>

+ 1 - 1
templates/forderungen/liste/liste_zeile.html

@@ -1,7 +1,7 @@
 <tr>
   <td>
     <div class="gc-title">{{ row.Standort_Name }}</div>
-    <div class="gc-subtitle">{{ row.Bereich }}</div>
+    <div class="gc-subtitle">{{ row.Abteilung }}</div>
   </td>
 
   <td>

+ 2 - 2
templates/forderungen/liste/queries/forderungen_liste.sql

@@ -16,7 +16,7 @@ SELECT [F].[Client_DB]
      , [F].[Verursacher_Text]
      , [F].[Kunde_Text]
      , [F].[Beleg_Text]
-     , [F].[Bereich]
+     , [F].[Abteilung]
      , [F].[Beleg_Tage_offen]
      , CASE
            WHEN [F].[Beleg_Tage_offen] > 90 THEN 3
@@ -24,7 +24,7 @@ SELECT [F].[Client_DB]
            WHEN [F].[Beleg_Tage_offen] > 30 THEN 1
            ELSE 0
        END AS [Stufe]
-     , replace([F].[Staffel_Text], 'Wochen', 'W.') AS [Staffel]
+     , replace([F].[Staffel_Text], 'Wochen', 'W.') AS [Staffel_Text]
      , [F].[Mahnstufe]
      , [F].[Forderungsart]
      --, [F].[Abwarten]