diff --git a/print_designer/patches/convert_formats_for_recursive_container.py b/print_designer/patches/convert_formats_for_recursive_container.py index 997574f..f7dc17c 100644 --- a/print_designer/patches/convert_formats_for_recursive_container.py +++ b/print_designer/patches/convert_formats_for_recursive_container.py @@ -18,33 +18,52 @@ def patch_format(): if not is_older_schema(settings=settings, current_version="1.1.0") and is_older_schema( settings=settings, current_version="1.3.0" ): - pf_print_format = frappe.json.loads(pf.print_designer_print_format) + pf_print_format = frappe.json.loads(pf.print_designer_print_format or "{}") - for headerType in ["firstPage", "oddPage", "evenPage", "lastPage"]: - for row in pf_print_format["header"][headerType]: - row["layoutType"] = "row" - for column in row["childrens"]: - column["layoutType"] = "column" + if pf_print_format.get("header", False): + if type(pf_print_format["header"]) == list: + # issue #285 + pf_print_format["header"] = { + "firstPage": pf_print_format["header"], + "oddPage": pf_print_format["header"], + "evenPage": pf_print_format["header"], + "lastPage": pf_print_format["header"], + } + for headerType in ["firstPage", "oddPage", "evenPage", "lastPage"]: + for row in pf_print_format["header"][headerType]: + row["layoutType"] = "row" + for column in row["childrens"]: + column["layoutType"] = "column" - for footerType in ["firstPage", "oddPage", "evenPage", "lastPage"]: - for row in pf_print_format["footer"][footerType]: + if pf_print_format.get("footer", False): + if type(pf_print_format["footer"]) == list: + # issue #285 + pf_print_format["footer"] = { + "firstPage": pf_print_format["footer"], + "oddPage": pf_print_format["footer"], + "evenPage": pf_print_format["footer"], + "lastPage": pf_print_format["footer"], + } + for footerType in ["firstPage", "oddPage", "evenPage", "lastPage"]: + for row in pf_print_format["footer"][footerType]: + row["layoutType"] = "row" + for column in row["childrens"]: + column["layoutType"] = "column" + + if pf_print_format.get("body", False): + for row in pf_print_format["body"]: row["layoutType"] = "row" for column in row["childrens"]: column["layoutType"] = "column" - - for row in pf_print_format["body"]: - row["layoutType"] = "row" - for column in row["childrens"]: - column["layoutType"] = "column" - # body elements should be inside page object forgot to add it in patch move_header_footers_to_new_schema - pf_print_format["body"] = [ - { - "index": 0, - "type": "page", - "childrens": pf_print_format["body"], - "isDropZone": True, - } - ] + # body elements should be inside page object forgot to add it in patch move_header_footers_to_new_schema + pf_print_format["body"] = [ + { + "index": 0, + "type": "page", + "childrens": pf_print_format["body"], + "isDropZone": True, + } + ] frappe.set_value( "Print Format", diff --git a/print_designer/print_designer/page/print_designer/jinja/macros/spantag.html b/print_designer/print_designer/page/print_designer/jinja/macros/spantag.html index 587c202..a96ffe9 100644 --- a/print_designer/print_designer/page/print_designer/jinja/macros/spantag.html +++ b/print_designer/print_designer/page/print_designer/jinja/macros/spantag.html @@ -15,7 +15,11 @@ {%- set value = _(frappe.db.get_value(field.doctype, doc[field.parentField], field.fieldname)) -%} {{ frappe.format(value, {'fieldtype': field.fieldtype, 'options': field.options}) }} {%- elif row -%} + {%- if field.fieldtype == "Image" and row.get(field['options']) -%} + + {%- else -%} {{row.get_formatted(field.fieldname)}} + {%- endif -%} {%- else -%} {{doc.get_formatted(field.fieldname)}} {%- endif -%} diff --git a/print_designer/public/images/print-designer-logo.svg b/print_designer/public/images/print-designer-logo.svg index 9517a34..ee3f5ce 100644 --- a/print_designer/public/images/print-designer-logo.svg +++ b/print_designer/public/images/print-designer-logo.svg @@ -1,26 +1,18 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - diff --git a/print_designer/public/js/print_designer/App.vue b/print_designer/public/js/print_designer/App.vue index 248d929..8694a5e 100644 --- a/print_designer/public/js/print_designer/App.vue +++ b/print_designer/public/js/print_designer/App.vue @@ -111,8 +111,8 @@ watchEffect(() => { justify-content: space-between; margin: 0; cursor: default; - --primary: #6f5f35; - --primary-color: #6f5f35; + --primary: #7b4b57; + --primary-color: #7b4b57; .app-sections { flex: 1; height: calc(100vh - var(--navbar-height)); diff --git a/print_designer/public/js/print_designer/PropertiesPanelState.js b/print_designer/public/js/print_designer/PropertiesPanelState.js index f631fd7..c9e9b3d 100644 --- a/print_designer/public/js/print_designer/PropertiesPanelState.js +++ b/print_designer/public/js/print_designer/PropertiesPanelState.js @@ -704,6 +704,7 @@ export const createPropertiesPanel = () => { fieldtype: "Int", label: "No", options: undefined, + tableName: currentEL["table"], }; if (value && currentEL) { currentEL["table"] = MainStore.metaFields.find( @@ -755,6 +756,9 @@ export const createPropertiesPanel = () => { dlKeys[index] ], ]; + col.dynamicContent.forEach((dc) => { + dc.tableName = currentEL["table"].fieldname; + }); col.label = col.dynamicContent[0].label || col.dynamicContent[0].fieldname; diff --git a/print_designer/public/js/print_designer/components/base/BaseDynamicTextSpanTag.vue b/print_designer/public/js/print_designer/components/base/BaseDynamicTextSpanTag.vue index 1ce3d5a..5edd3b5 100644 --- a/print_designer/public/js/print_designer/components/base/BaseDynamicTextSpanTag.vue +++ b/print_designer/public/js/print_designer/components/base/BaseDynamicTextSpanTag.vue @@ -62,6 +62,7 @@