2
0
mirror of https://github.com/frappe/books.git synced 2024-11-14 01:14:03 +00:00
books/ui/components/Print/PrintView.vue

58 lines
1.0 KiB
Vue
Raw Normal View History

2018-07-13 07:29:57 +00:00
<template>
<div class="print-view">
<print-actions
v-bind:title="name"
2018-07-13 07:45:30 +00:00
@view-form="viewForm"
2018-07-14 11:59:55 +00:00
@pdf="getPDF"
2018-07-13 07:29:57 +00:00
></print-actions>
<div class="print-container">
<div class="print-template" v-html="printTemplate"></div>
</div>
</div>
</template>
<script>
import { getHTML } from '../../../common/print.js';
import PrintActions from './PrintActions';
export default {
name: 'PrintView',
props: ['doctype', 'name'],
data() {
return {
printTemplate: '',
}
},
components: {
PrintActions: PrintActions
},
async created(vm) {
this.printTemplate = await getHTML(this.doctype, this.name);
},
2018-07-13 07:45:30 +00:00
methods: {
viewForm() {
this.$router.push(`/edit/${this.doctype}/${this.name}`);
},
2018-07-14 11:59:55 +00:00
2018-07-15 23:47:14 +00:00
getPDF() {
frappe.getPDF(this.doctype, this.name);
2018-07-14 11:59:55 +00:00
}
2018-07-13 07:45:30 +00:00
}
2018-07-13 07:29:57 +00:00
}
</script>
<style lang="scss">
@import "../../styles/variables";
.print-container {
2018-07-15 23:47:14 +00:00
padding: 1rem 5rem;
2018-07-13 07:29:57 +00:00
}
.print-template {
padding: 1rem;
background-color: $white;
box-shadow: 0rem 0rem 0.5rem rgba(0,0,0,0.2);
}
</style>