forked from frappe/frappe
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Print Format Builder Beta page - Add margin fields in Print Format - Using vuedraggable for drag and drop
- Loading branch information
1 parent
c3c4057
commit b8fbed0
Showing
17 changed files
with
815 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
frappe/printing/page/print_format_builder/print_format_builder.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
3 changes: 3 additions & 0 deletions
3
frappe/printing/page/print_format_builder_beta/print_format_builder_beta.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.layout-main-section-wrapper { | ||
margin-bottom: 0; | ||
} |
31 changes: 31 additions & 0 deletions
31
frappe/printing/page/print_format_builder_beta/print_format_builder_beta.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
frappe.pages["print-format-builder-beta"].on_page_load = function(wrapper) { | ||
var page = frappe.ui.make_app_page({ | ||
parent: wrapper, | ||
title: __("Print Format Builder"), | ||
single_column: true | ||
}); | ||
|
||
function load_print_format_builder_beta() { | ||
let route = frappe.get_route(); | ||
let $parent = $(wrapper).find(".layout-main-section"); | ||
$parent.empty(); | ||
|
||
if (route.length > 1) { | ||
frappe.require("print_format_builder.bundle.js").then(() => { | ||
frappe.print_format_builder = new frappe.ui.PrintFormatBuilder({ | ||
wrapper: $parent, | ||
page, | ||
print_format: route[1] | ||
}); | ||
}); | ||
} | ||
} | ||
|
||
load_print_format_builder_beta(); | ||
|
||
// hot reload in development | ||
if (frappe.boot.developer_mode) { | ||
frappe.hot_update = frappe.hot_update || []; | ||
frappe.hot_update.push(load_print_format_builder_beta); | ||
} | ||
}; |
22 changes: 22 additions & 0 deletions
22
frappe/printing/page/print_format_builder_beta/print_format_builder_beta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"content": null, | ||
"creation": "2021-07-10 12:22:16.138485", | ||
"docstatus": 0, | ||
"doctype": "Page", | ||
"idx": 0, | ||
"modified": "2021-07-10 12:22:16.138485", | ||
"modified_by": "Administrator", | ||
"module": "Printing", | ||
"name": "print-format-builder-beta", | ||
"owner": "Administrator", | ||
"page_name": "Print Format Builder Beta", | ||
"roles": [ | ||
{ | ||
"role": "System Manager" | ||
} | ||
], | ||
"script": null, | ||
"standard": "Yes", | ||
"style": null, | ||
"system_page": 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<template> | ||
<div class="print-format-main" :style="rootStyles"> | ||
<draggable | ||
v-model="layout.sections" | ||
group="sections" | ||
filter=".section-columns, .column, .field" | ||
:animation="200" | ||
> | ||
<PrintFormatSection | ||
v-for="(section, i) in layout.sections" | ||
:key="i" | ||
:section="section" | ||
@add_section_above="add_section_above(section)" | ||
/> | ||
</draggable> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import draggable from "vuedraggable"; | ||
import PrintFormatSection from "./PrintFormatSection.vue"; | ||
export default { | ||
name: "PrintFormat", | ||
props: ["print_format", "meta", "layout"], | ||
components: { | ||
draggable, | ||
PrintFormatSection, | ||
}, | ||
computed: { | ||
rootStyles() { | ||
let { | ||
margin_top = 0, | ||
margin_bottom = 0, | ||
margin_left = 0, | ||
margin_right = 0, | ||
} = this.print_format; | ||
return { | ||
padding: `${margin_top}mm ${margin_right}mm ${margin_bottom}mm ${margin_left}mm`, | ||
width: "210mm", | ||
minHeight: "297mm", | ||
}; | ||
}, | ||
}, | ||
methods: { | ||
add_section_above(section) { | ||
let sections = []; | ||
for (let _section of this.layout.sections) { | ||
if (_section === section) { | ||
sections.push({ | ||
label: "", | ||
columns: [ | ||
{ label: "", fields: [] }, | ||
{ label: "", fields: [] }, | ||
], | ||
}); | ||
} | ||
sections.push(_section); | ||
} | ||
this.$set(this.layout, "sections", sections); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style scoped> | ||
.print-format-main { | ||
margin-left: auto; | ||
background-color: white; | ||
box-shadow: var(--shadow-lg); | ||
border-radius: var(--border-radius); | ||
} | ||
</style> |
Oops, something went wrong.