print and new types and multi image

This commit is contained in:
saeid
2019-07-15 11:30:02 +04:30
parent a8bc46151e
commit d3735c6d30
11 changed files with 67836 additions and 434 deletions
@@ -1,37 +1,67 @@
<template>
<v-container grid-list-xs>
<material-card color="black" title="Submit Test Result">
<material-card color="black" title="Submit Test Result" id="printMe">
<v-layout align-left justify-left wrap class="px-5 my-3">
<h3 class="ml-3">Common Info</h3>
<v-flex xs12>
<hr class="v-divider theme--light">
<hr class="v-divider theme--light" />
</v-flex>
<v-layout row wrap class="ml-4">
<v-flex xs12 md6 sm6>
<div class>
<span class="title">Auto Clave Id :</span>
<span class="headline ml-2" style="letter-spacing:0 !important">{{ data.autoclave_id }}</span>
<span
class="headline ml-2"
style="letter-spacing:0 !important"
>{{ data.autoclave_id }}</span>
</div>
</v-flex>
<v-flex xs12 md6 sm6>
<div class>
<span class="title">Result :</span>
<v-icon class="green--text ml-2 caption">fas fa-check</v-icon>
<span class="headline ml-1" style="letter-spacing:0 !important">{{ data.result }}</span>
<span
class="headline ml-1"
style="letter-spacing:0 !important"
>{{ data.result }}</span>
</div>
</v-flex>
<v-flex xs12 md6 sm6>
<div class>
<span class="title">verify :</span>
<v-icon class="pink--text ml-2 caption">fas fa-times</v-icon>
<span class="headline ml-1" style="letter-spacing:0 !important">{{ data.verified }}</span>
<span
class="headline ml-1"
style="letter-spacing:0 !important"
>{{ data.verified }}</span>
</div>
</v-flex>
<v-flex xs12 md6 sm6>
<div class>
<span class="title">Register User :</span>
<span class="headline ml-2" style="letter-spacing:0 !important">{{ data.user.name }}</span>
<span
class="headline ml-2"
style="letter-spacing:0 !important"
>{{ data.user.name }}</span>
</div>
</v-flex>
<v-flex xs12 md6 sm6>
<div class>
<span class="title">Date :</span>
<span
class="headline ml-2"
style="letter-spacing:0 !important"
>{{ data.created_at }}</span>
</div>
</v-flex>
<v-flex xs12 md6 sm6>
<div class>
<span class="title">Medical Center :</span>
<span
class="headline ml-2"
style="letter-spacing:0 !important"
>{{ data.user.medical_center.name }}</span>
</div>
</v-flex>
</v-layout>
@@ -39,7 +69,7 @@
<v-layout align-left justify-left wrap class="px-5 my-3">
<h3 class="ml-3">Special Info</h3>
<v-flex xs12>
<hr class="v-divider theme--light">
<hr class="v-divider theme--light" />
</v-flex>
<v-layout row wrap>
<template v-if="data.inputs">
@@ -51,7 +81,10 @@
:key="keyInputs"
>
<span class="title">{{keyInputs}} :</span>
<span class="headline ml-2" style="letter-spacing:0 !important">{{inputData}}</span>
<span
class="headline ml-2"
style="letter-spacing:0 !important"
>{{inputData}}</span>
</v-flex>
</template>
<template v-if="data.options">
@@ -103,14 +136,16 @@
<v-layout align-left justify-left wrap class="px-5 my-3">
<h3 class="ml-3">Image</h3>
<v-flex xs12>
<hr class="v-divider theme--light">
<hr class="v-divider theme--light" />
</v-flex>
<v-layout row wrap class="ml-4">
<v-flex xs12 md6 sm6>
<img :src="'/'+data.imagePath" style="width: 100%">
<img :src="'/'+data.imagePath" style="width: 100%" />
</v-flex>
</v-layout>
</v-layout>
</material-card>
<material-card>
<v-layout row wrap align-center justify-center v-if="$hasRole('Admin|Supervisor')">
<v-flex
class
@@ -134,6 +169,15 @@
<span class="black--text">UnVerify</span>
</v-btn>
</v-flex>
<v-flex class xs12 md2 sm2>
<v-btn
class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Gray"
@click="print"
>
<v-icon class="black--text mr-2 caption">fas fa-print</v-icon>
<span class="black--text">Print</span>
</v-btn>
</v-flex>
</v-layout>
</material-card>
</v-container>
@@ -159,6 +203,39 @@ export default {
this.setResultModal(result.data.data);
this.closeModal();
}
},
print() {
const prtHtml = document.getElementById("printMe").innerHTML;
// Get all stylesheets HTML
let stylesHtml = "";
for (const node of [
...document.querySelectorAll('link[rel="stylesheet"], style')
]) {
stylesHtml += node.outerHTML;
}
// Open the print window
const WinPrint = window.open(
"",
"",
"left=0,top=0,width=800,height=900,toolbar=0,scrollbars=0,status=0"
);
WinPrint.document.write(`<!DOCTYPE html>
<html>
<head>
${stylesHtml}
</head>
<body>
${prtHtml}
</body>
</html>`);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}
},
created() {