mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-10 19:21:27 +03:30
255 lines
12 KiB
Vue
255 lines
12 KiB
Vue
<template>
|
|
<v-container grid-list-xs>
|
|
<material-card color="black" title="Show Test Result" id="printMe">
|
|
<v-layout align-left justify-left wrap class="my-3">
|
|
<h3 class="ml-3 CSSD-font">Test Type : {{ TestType }}</h3>
|
|
<v-flex xs12>
|
|
<hr class="v-divider theme--light"/>
|
|
</v-flex>
|
|
<v-layout row wrap class="ml-4">
|
|
<v-flex xs12 md12 sm12>
|
|
<div class>
|
|
<span class="title CSSD-font">{{ data.device_label || 'AutoclaveID' }} :</span>
|
|
<span class="headline ml-2 CSSD-font" style="letter-spacing:0 !important">
|
|
{{ data.device_id }}
|
|
</span>
|
|
</div>
|
|
</v-flex>
|
|
|
|
<v-flex xs12 sm12 class="py-1">
|
|
<span class="subtitle-1">Result :</span>
|
|
<v-icon size="20"
|
|
:class="['caption fa ml-2', data.result == 'Reject'?'NotVerified':( data.result == 'Accept'?'Verified':'')]">
|
|
{{ data.result == 'Reject' ? 'fa-times' : (data.result == 'Accept' ? 'fa-check' : '') }}
|
|
</v-icon>
|
|
<span class="headline ml-1 CSSD-font" style="letter-spacing:0 !important">
|
|
{{ data.result }}
|
|
</span>
|
|
</v-flex>
|
|
<v-flex xs12 md12 sm12>
|
|
<div class>
|
|
<span class="title CSSD-font">verify :</span>
|
|
<v-icon size="20"
|
|
:class="['caption fa ml-2', data.verified == 'NotVerified'?'NotVerified':(data.verified == 'Verified'? 'Verified' : '')]">
|
|
{{ data.verified == 'NotVerified' ? 'fa-times' :(data.verified == 'Verified' ? 'fa-check':'') }}
|
|
</v-icon>
|
|
<span class="headline ml-1" style="letter-spacing:0 !important">
|
|
{{ data.verified }}
|
|
</span>
|
|
</div>
|
|
</v-flex>
|
|
<v-flex xs12 md12 sm12>
|
|
<div class>
|
|
<span class="title CSSD-font">Register User :</span>
|
|
<span class="headline ml-2 CSSD-font" style="letter-spacing:0 !important">
|
|
{{ User }}
|
|
</span>
|
|
</div>
|
|
</v-flex>
|
|
<v-flex xs12 md12 sm12>
|
|
<div class>
|
|
<span class="title CSSD-font">Date :</span>
|
|
<span class="headline ml-2" style="letter-spacing:0 !important">
|
|
{{ data.created_at }}
|
|
</span>
|
|
</div>
|
|
</v-flex>
|
|
<v-flex xs12 md6 sm12>
|
|
<div class>
|
|
<span class="title CSSD-font">Medical Center :</span>
|
|
<span class="headline ml-2 CSSD-font" style="letter-spacing:0 !important">
|
|
{{ MedicalCenter }}
|
|
</span>
|
|
</div>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-layout>
|
|
<v-layout align-left justify-left wrap class="my-3">
|
|
<h3 class="ml-3 CSSD-font">Special Info</h3>
|
|
<v-flex xs12>
|
|
<hr class="v-divider theme--light"/>
|
|
</v-flex>
|
|
<v-layout row wrap class="ml-4">
|
|
<template v-if="data.inputs">
|
|
<v-flex xs12 md12 sm12 v-for="(inputData, keyInputs) in data.inputs" :key="keyInputs">
|
|
<span class="title">{{ keyInputs }} :</span>
|
|
<span class="headline ml-2 CSSD-font" style="letter-spacing:0 !important">
|
|
{{ inputData }}
|
|
</span>
|
|
</v-flex>
|
|
</template>
|
|
<template v-if="data.options">
|
|
<v-flex xs12 md12 sm12 v-for="(optionData, keyOptions) in data.options" :key="keyOptions">
|
|
<span class="title CSSD-font">{{ keyOptions }} :</span>
|
|
<span style="letter-spacing:0 !important" class="headline ml-2 CSSD-font"
|
|
v-for="(data, dataKey) in optionData" :key="dataKey">
|
|
{{ data }},
|
|
</span>
|
|
</v-flex>
|
|
</template>
|
|
<template v-if="data.children">
|
|
<v-flex class="mt-4 pb-4" style="border-left:3px solid #32c5d2;border-bottom:1px solid #ddd"
|
|
xs12 md12 sm12 v-for="(formData, keyForm) in data.children" :key="keyForm">
|
|
<h3 class="ml-3 CSSD-font">{{ keyForm }}</h3>
|
|
<div v-for="(childData, keyChild) in formData" :key="keyChild">
|
|
<div class="ml-4">
|
|
<span class="title CSSD-font">{{ keyChild }} :</span>
|
|
<template v-if="Array.isArray(childData)">
|
|
<span style="letter-spacing:0 !important" class="headline ml-2 CSSD-font"
|
|
v-for="(data, dataKey) in childData" :key="dataKey">
|
|
{{ data }},
|
|
</span>
|
|
</template>
|
|
<template v-else>
|
|
<span class="headline ml-2 CSSD-font">{{ childData }}</span>
|
|
</template>
|
|
</div>
|
|
</div>
|
|
</v-flex>
|
|
</template>
|
|
</v-layout>
|
|
</v-layout>
|
|
|
|
<v-layout align-left justify-left wrap class="my-3">
|
|
<v-layout align-left justify-left wrap class="my-3" v-if="data.files && data.files.length">
|
|
<h3 class="CSSD-font">Image</h3>
|
|
<v-flex xs12>
|
|
<hr class="v-divider theme--light"/>
|
|
</v-flex>
|
|
<v-layout row wrap class="align-center">
|
|
<v-flex xs6 md2 sm2 v-for="(file, key) in data.files" :key="key">
|
|
<template v-if="file.file_type == 'document'">
|
|
<a target="_blank" :href="'/'+file.thumbnail">
|
|
<v-icon class="mr-2 caption">fas fa-check</v-icon>
|
|
{{ file.file_name }}</a>
|
|
</template>
|
|
|
|
<template v-else>
|
|
<img :src="file.thumbnail" style="width: 100%" @click="openLightbox(key)"/>
|
|
</template>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-layout>
|
|
<v-layout align-left justify-left wrap class="my-3">
|
|
<h3 class="ml-3 CSSD-font">Barcode And QRCode Image</h3>
|
|
<v-flex xs12>
|
|
<hr class="v-divider theme--light">
|
|
</v-flex>
|
|
<v-layout row wrap class="ml-4 align-center mt-2">
|
|
<v-flex xs12 md6 sm6 v-if="barcodeimg">
|
|
<img :src="barcodeimg" class="barcode-container" style="width: 100%;max-width: 300px;"><br/>
|
|
<span class="CSSD-font">Item ID : {{ data.id }}</span>
|
|
</v-flex>
|
|
<v-flex xs12 md6 sm6 v-if="QRCodeimg" class="WM-Align-C">
|
|
<img :src="QRCodeimg" class="WM-Width-150">
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-layout>
|
|
</v-layout>
|
|
<v-layout row wrap style="text-align:center">
|
|
<v-flex class xs12 md2 sm12>
|
|
<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>
|
|
<vue-image-lightbox
|
|
v-if="showLightbox"
|
|
:media="lightboxImages"
|
|
:index="lightboxIndex"
|
|
@close="showLightbox = false"
|
|
/>
|
|
</v-container>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from "axios";
|
|
import {urls} from "@show/config/urls";
|
|
import VueImageLightbox from 'vue-image-lightbox'
|
|
import 'vue-image-lightbox/dist/vue-image-lightbox.min.css'
|
|
|
|
export default {
|
|
data: () => ({
|
|
data: {},
|
|
TestType: '',
|
|
MedicalCenter: '',
|
|
User: '',
|
|
QRCodeimg: '',
|
|
barcodeimg: '',
|
|
showLightbox: false,
|
|
lightboxIndex: 0,
|
|
lightboxImages: [],
|
|
}),
|
|
components: {
|
|
VueImageLightbox,
|
|
},
|
|
computed: {
|
|
imagesOnly() {
|
|
return this.data.files && this.data.files.length ? this.data.files.filter(file => file.file_type !== 'document') : [];
|
|
},
|
|
},
|
|
methods: {
|
|
async load(id) {
|
|
const result = await axios.get(urls.showTestResult(id));
|
|
|
|
if (result.status == 200) {
|
|
this.data = result.data.data;
|
|
this.TestType = result.data.data.test_type.name;
|
|
this.MedicalCenter = result.data.data.user.medical_center.name;
|
|
this.User = this.data.user.name;
|
|
if (this.data) {
|
|
this.generateBarcode(this.data);
|
|
}
|
|
}
|
|
},
|
|
async generateBarcode(item) {
|
|
const result = await axios.post(urls.Barcode(item.id, 'TestResult'));
|
|
if (result && result.status == 200) {
|
|
this.QRCodeimg = result.data.data.QRCode ? result.data.data.QRCode : null;
|
|
this.barcodeimg = result.data.data.Barcode ? result.data.data.Barcode : null;
|
|
}
|
|
},
|
|
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();
|
|
},
|
|
openLightbox(index) {
|
|
this.lightboxIndex = index;
|
|
this.showLightbox = false;
|
|
this.$nextTick(() => {
|
|
this.showLightbox = true;
|
|
});
|
|
}
|
|
},
|
|
created() {
|
|
if (this.$route.params.id) {
|
|
this.load(this.$route.params.id);
|
|
}
|
|
this.lightboxImages = this.imagesOnly && this.imagesOnly.length ? this.imagesOnly.map(file => ({
|
|
src: file.thumbnail,
|
|
thumb: file.thumbnail,
|
|
})) : [];
|
|
},
|
|
|
|
};
|
|
</script>
|