summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOsCoder <oscoder@lczimmermann.eu>2026-04-06 23:48:33 +0000
committerOsCoder <oscoder@lczimmermann.eu>2026-04-06 23:48:33 +0000
commita88104859b55fbaecf8bad67b09ce1f311f973d4 (patch)
tree174dbb2b0bf045b9a00b8cebf5f9c0e133845818
parent8e7de9146d6134eb2f313c77ab3484e5063a7003 (diff)
downloadsupportive_help-a88104859b55fbaecf8bad67b09ce1f311f973d4.tar.xz
supportive_help-a88104859b55fbaecf8bad67b09ce1f311f973d4.zip
Added family notes
-rw-r--r--supportive_help/supportive_help/doctype/sh_family/sh_family.js21
-rw-r--r--supportive_help/supportive_help/doctype/sh_family/sh_family.json22
-rw-r--r--supportive_help/supportive_help/doctype/sh_family_note/__init__.py0
-rw-r--r--supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.json53
-rw-r--r--supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.py14
-rw-r--r--supportive_help/translations/de.csv5
-rw-r--r--supportive_help/translations/en.csv3
7 files changed, 110 insertions, 8 deletions
diff --git a/supportive_help/supportive_help/doctype/sh_family/sh_family.js b/supportive_help/supportive_help/doctype/sh_family/sh_family.js
index 06e05bb..a990b5a 100644
--- a/supportive_help/supportive_help/doctype/sh_family/sh_family.js
+++ b/supportive_help/supportive_help/doctype/sh_family/sh_family.js
@@ -1,8 +1,21 @@
// Copyright (c) 2026, Leon Zimmermann and contributors
// For license information, please see license.txt
-// frappe.ui.form.on("sh_family", {
-// refresh(frm) {
+frappe.ui.form.on("sh_family_note", {
+ note: function (frm, cdt, cdn) {
+ // Aktuelles Child-Dokument holen
+ const child_row = frappe.get_doc(cdt, cdn);
-// },
-// });
+ // Wortzählung durchfüren
+ if (child_row.note) {
+ const words = child_row.note
+ .trim()
+ .split(/\s+/)
+ .filter((word) => word.length > 0);
+ frappe.model.set_value(cdt, cdn, "word_count", words.length);
+ console.log("Wortanzahl aktualisiert:", words.length);
+ } else {
+ frappe.model.set_value(cdt, cdn, "word_count", 0);
+ }
+ },
+});
diff --git a/supportive_help/supportive_help/doctype/sh_family/sh_family.json b/supportive_help/supportive_help/doctype/sh_family/sh_family.json
index 0228440..5e2b5af 100644
--- a/supportive_help/supportive_help/doctype/sh_family/sh_family.json
+++ b/supportive_help/supportive_help/doctype/sh_family/sh_family.json
@@ -9,7 +9,10 @@
"affected_person",
"family_member_tab",
"family_member",
- "family_member_count"
+ "family_member_count",
+ "note_tab",
+ "section_break_ybmq",
+ "notes"
],
"fields": [
{
@@ -39,12 +42,27 @@
"in_list_view": 1,
"label": "Family Member Count",
"non_negative": 1
+ },
+ {
+ "fieldname": "note_tab",
+ "fieldtype": "Tab Break",
+ "label": "Notes"
+ },
+ {
+ "fieldname": "notes",
+ "fieldtype": "Table",
+ "label": "Notes",
+ "options": "sh_family_note"
+ },
+ {
+ "fieldname": "section_break_ybmq",
+ "fieldtype": "Section Break"
}
],
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"links": [],
- "modified": "2026-03-17 23:55:11.085474",
+ "modified": "2026-04-07 00:48:19.304376",
"modified_by": "Administrator",
"module": "Supportive Help",
"name": "sh_family",
diff --git a/supportive_help/supportive_help/doctype/sh_family_note/__init__.py b/supportive_help/supportive_help/doctype/sh_family_note/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/supportive_help/supportive_help/doctype/sh_family_note/__init__.py
diff --git a/supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.json b/supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.json
new file mode 100644
index 0000000..9da797b
--- /dev/null
+++ b/supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.json
@@ -0,0 +1,53 @@
+{
+ "actions": [],
+ "allow_rename": 1,
+ "creation": "2026-04-07 00:30:23.520579",
+ "doctype": "DocType",
+ "engine": "InnoDB",
+ "field_order": [
+ "overview_section",
+ "note",
+ "word_count"
+ ],
+ "fields": [
+ {
+ "allow_in_quick_entry": 1,
+ "fieldname": "note",
+ "fieldtype": "Text",
+ "in_list_view": 1,
+ "label": "Note"
+ },
+ {
+ "default": "0",
+ "fieldname": "word_count",
+ "fieldtype": "Int",
+ "in_list_view": 1,
+ "label": "Word Count",
+ "length": 6,
+ "non_negative": 1,
+ "print_hide": 1,
+ "read_only": 1
+ },
+ {
+ "fieldname": "overview_section",
+ "fieldtype": "Section Break",
+ "label": "Overview"
+ }
+ ],
+ "grid_page_length": 50,
+ "index_web_pages_for_search": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2026-04-07 01:07:30.830406",
+ "modified_by": "Administrator",
+ "module": "Supportive Help",
+ "name": "sh_family_note",
+ "naming_rule": "By script",
+ "owner": "Administrator",
+ "permissions": [],
+ "row_format": "Dynamic",
+ "rows_threshold_for_grid_search": 20,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": []
+} \ No newline at end of file
diff --git a/supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.py b/supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.py
new file mode 100644
index 0000000..694baa0
--- /dev/null
+++ b/supportive_help/supportive_help/doctype/sh_family_note/sh_family_note.py
@@ -0,0 +1,14 @@
+# Copyright (c) 2026, Leon Zimmermann and contributors
+# For license information, please see license.txt
+
+import frappe
+from frappe.model.document import Document
+from frappe.utils import now_datetime
+
+
+class sh_family_note(Document):
+ def autoname(self):
+ parent_name = self.get("parent") or "unknown_parent"
+ timestamp = now_datetime().strftime("%Y%m%d-%H%M%S")
+ user = frappe.session.user
+ self.name = f"{parent_name}-{timestamp}-{user}"
diff --git a/supportive_help/translations/de.csv b/supportive_help/translations/de.csv
index cc3828a..38d8aa9 100644
--- a/supportive_help/translations/de.csv
+++ b/supportive_help/translations/de.csv
@@ -88,4 +88,7 @@
"custody","Vollmacht"
"guardian","Vormund*in"
"joint authority","Geteiltes Sorgerecht"
-"joint custody","Geteilte Vollmacht" \ No newline at end of file
+"joint custody","Geteilte Vollmacht"
+"Notes","Notizen"
+"Word Count","Wortanzahl"
+"sh_family_note","Notiz" \ No newline at end of file
diff --git a/supportive_help/translations/en.csv b/supportive_help/translations/en.csv
index eb581fd..0842f84 100644
--- a/supportive_help/translations/en.csv
+++ b/supportive_help/translations/en.csv
@@ -4,4 +4,5 @@
"sh_person_counterpart","Counterpart"
"sh_family","Family"
"sh_family_member","Family Member"
-"sh_person_law","Person Law" \ No newline at end of file
+"sh_person_law","Person Law"
+"sh_family_note","Family Note" \ No newline at end of file