Files
cssd-back/resources/js/vue/components/modal/testresult/Show.vue
T

309 lines
14 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="px-5 my-3 ShowTestResult">
<h4 class="ml-4 headline font-weight-bold">Test Type : {{ data.test_type.name }}</h4>
<v-flex xs12>
<hr class="v-divider theme--light" />
</v-flex>
<v-layout row wrap class="ml-4">
<!-- <v-flex xs6 md6 sm6>
<div class>
<span class="subtitle-1">{{ data.device_label || 'AutoclaveID' }} :</span>
<span
class="title font-weight-bold ml-2"
style="letter-spacing:0 !important"
>{{ data.device_id }}</span>
</div>
</v-flex> -->
<v-flex xs3 md3 sm3>
<div class>
<span class="subtitle-1">Result :</span>
<span v-if="data.result == 'Reject'" class="NotVerified">
<v-icon class="caption fa fa-times NotVerified"></v-icon>
</span>
<span v-if="data.result == 'Accept'" class="">
<v-icon class="caption fa fa-check Verified"></v-icon>
</span>
<span
class="title font-weight-bold ml-1"
style="letter-spacing:0 !important"
>{{ data.result }}</span>
</div>
</v-flex>
<v-flex xs3 md3 sm3>
<div class>
<span class="subtitle-1">verify :</span>
<!-- <v-icon class="pink--text ml-2 caption">fas fa-times</v-icon> -->
<!-- <span
class="title font-weight-bold ml-1"
style="letter-spacing:0 !important"
>{{ data.verified }}</span> -->
<span v-if="data.verified == 'NotVerified'" class="NotVerified">
<v-icon class="caption fa fa-times NotVerified"></v-icon>
</span>
<span v-if="data.verified == 'Verified'" class="">
<v-icon class="caption fa fa-check Verified"></v-icon>
</span>
<span
class="title font-weight-bold ml-1"
style="letter-spacing:0 !important"
>{{ data.verified }}</span>
</div>
</v-flex>
<v-flex xs3 md3 sm3>
<div class>
<span class="subtitle-1">Register User :</span>
<span
class="title font-weight-bold ml-2"
style="letter-spacing:0 !important"
>{{ data.user.name }}</span>
</div>
</v-flex>
<v-flex xs3 md3 sm3>
<div class>
<span class="subtitle-1">Date :</span>
<span
class="title font-weight-bold ml-2"
style="letter-spacing:0 !important"
>{{ data.created_at }}</span>
</div>
</v-flex>
<v-flex xs3 md3 sm3>
<div class>
<span class="subtitle-1">Medical Center :</span>
<span
class="title font-weight-bold ml-2"
style="letter-spacing:0 !important"
>{{ data.user.medical_center.name }}</span>
</div>
</v-flex>
</v-layout>
</v-layout>
<v-layout align-left justify-left wrap class="px-5 my-3">
<h4 class="ml-4 headline CSSD-font font-weight-bold">Special Info</h4>
<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
xs3
md3
sm3
v-for="(inputData, keyInputs) in data.inputs"
:key="keyInputs"
>
<span class="subtitle-1">{{keyInputs}} :</span>
<span
class="title font-weight-bold ml-2"
style="letter-spacing:0 !important"
>{{inputData}}</span>
</v-flex>
</template>
<template v-if="data.options">
<v-flex
xs3
md3
sm3
v-for="(optionData, keyOptions) in data.options"
:key="keyOptions"
>
<span class="subtitle-1">{{keyOptions}} :</span>
<span
style="letter-spacing:0 !important"
class="title font-weight-bold ml-2"
v-for="(data, dataKey) in optionData"
:key="dataKey"
>{{data}},</span>
</v-flex>
</template>
<template v-if="data.children">
<v-layout row wrap class="WM-Width-Full">
<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"
>
<h4 class="ml-4 headline CSSD-font font-weight-bold">{{keyForm}}</h4>
<v-layout row wrap>
<v-layout row wrap v-for="(childData, keyChild) in formData" :key="keyChild">
<v-flex
xs12
md12
sm12
class="ml-4">
<span class="subtitle-1">{{keyChild}} :</span>
<template v-if="Array.isArray(childData)">
<span
style="letter-spacing:0 !important"
class="title font-weight-bold ml-2"
v-for="(data, dataKey) in childData"
:key="dataKey"
>{{data}},</span>
</template>
<template v-else>
<span class="headline ml-2">{{childData}}</span>
</template>
</v-flex>
</v-layout>
</v-layout>
</v-flex>
</v-layout>
</template>
</v-layout>
</v-layout>
<v-layout align-left justify-left wrap class="px-5 my-3">
<h4 class="ml-4 headline CSSD-font font-weight-bold">Image</h4>
<v-flex xs12>
<hr class="v-divider theme--light" />
</v-flex>
<v-layout row wrap class="ml-4">
<!-- <LightBox :media="data.images.map(img => ({thumb: img.path, src: img.path}))" style="width: 20%"></LightBox> -->
<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.path"><v-icon class="mr-2 caption">fas fa-check</v-icon>{{ file.file_name }}</a>
</template>
<template v-else>
<img :src="'/'+file.path" style="width: 100%" />
</template>
</v-flex>
</v-layout>
</v-layout>
<!-- </material-card>
<material-card> -->
<v-layout row wrap align-center justify-center class="px-5 my-3" v-if="$hasRole('Admin|Supervisor')">
<v-flex
class="WM-Align-R mr-1"
xs12
md3
sm3
v-if="data.verified == 'None' || (data.verified == 'NotVerified' && $hasRole('Admin'))"
@click="verify(data.id, 'Verified')"
>
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px">
<v-icon class="white--text mr-2 caption">fas fa-check</v-icon>
<span class="white--text">Verify</span>
</v-btn>
</v-flex>
<v-flex class="WM-Align-R" xs6 md3 sm3 v-if="data.verified == 'None' || (data.verified == 'Verified' && $hasRole('Admin'))">
<v-btn
class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Gray"
@click="verify(data.id, 'NotVerified')"
>
<v-icon class="black--text mr-2 caption">fas fa-check</v-icon>
<span class="black--text">UnVerify</span>
</v-btn>
</v-flex>
<v-flex xs6 md2 sm2>
<a :href="'/Show/TestResult/'+data.id">
<v-btn
class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Gray"
>
<v-icon class="black--text mr-2 caption">fas fa-print</v-icon>
<span class="black--text">Go to Print Page</span>
</v-btn>
</a>
</v-flex>
</v-layout>
<v-layout row wrap align-center justify-center class="px-5 my-3" >
<!-- <v-flex class xs6 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>
</template>
<script>
export default {
data: () => ({
data: {}
})
};
</script>
<script>
import { mapGetters, mapMutations } from "vuex";
import { ApiService } from "@/services";
import { urls } from "@/config/urls";
// import LightBox from 'vue-image-lightbox';
// import 'vue-image-lightbox/dist/vue-image-lightbox.min.css'
export default {
data: () => ({}),
methods: {
...mapMutations("modal", ["closeModal", "setResultModal"]),
async verify(id, value) {
const result = await ApiService.post(urls.verifyTestResult(id, value));
if (result && result.status == 200) {
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() {
this.data = this.getModalProperties.result.data.data;
},
computed: {
...mapGetters("modal", ["getModalProperties"])
}
};
</script>
<style media="screen">
@media screen and (max-width: 1536px) {
.headline {
font-size: 1rem !important;
}
}
@media screen and (max-width : 500px) {
.ShowTestResult .WM-Outline-Btn {
text-align: center;
}
}
</style>