This commit is contained in:
f.shokouhi
2019-12-21 14:38:31 +03:30
9 changed files with 319 additions and 7 deletions
+5 -1
View File
@@ -18,8 +18,12 @@ class BarCodeController extends Controller
$Barcode = DNS1D::getBarcodePNG($Number, "C128");
$QRCode = DNS2D::getBarcodePNG($URL, "QRCODE");
$ShowLink = 'Show/'.$Type.'/'.$Number;
if ($Type == 'TestType') {
$QRCode = DNS2D::getBarcodePNG($Number, "QRCODE");
}
return \MessageResponse::data(['Barcode' => 'data:image/png;base64,' .$Barcode, 'QRCode' => 'data:image/png;base64,' .$QRCode, 'ShowLink' => 'Show/'.$Type.'/'.$Number]);
return \MessageResponse::data(['Barcode' => 'data:image/png;base64,' .$Barcode, 'QRCode' => 'data:image/png;base64,' .$QRCode, 'ShowLink' => $ShowLink]);
}
}
public function generateQRcode(TestResult $TestResult)
+55 -1
View File
@@ -485,6 +485,60 @@ class TestResultController extends Controller
//--------------------------------------------------------------------------Show
public function showTestResult($id)
{
return view('ShowTestResult', compact('id'));
$TestResult = TestResult::with('input_values', 'user.medical_center', 'test_type')->select('result', 'verified', 'device_id','user_id','id', 'test_type_id', 'created_at')->findOrFail($id);
$options = [];
foreach ($TestResult->input_values as $value) {
$input = $value->input;
if ($input->parent_id != null && $input->parent['type'] == 'Form') {
//----------------------------------------------------------------------FormType
if ($input->type == 'Checkbox' || $input->type == 'Select' || $input['type'] == 'Radiobutton') {
$input_options = InputValue::with('option')->where('test_result_id', $TestResult->id)->where('input_id', $input->id)->get();
$options = [];
foreach ($input_options as $input_option) {
$options[] = $input_option->option->title;
$input_values[$input->name] = $options;
}
$children[$input->parent->name] = $input_values;
$TestResult['children'] = $children;
}
else {
$children[$input->parent->name][$input->name] = $value->value;
$TestResult['children'] = $children;
}
//-----------------------------------------------------------------------FormType
}
else {
//-----------------------------------------------------------------------Anothertype
if ($input->type == 'Checkbox' || $input->type == 'Select' || $input['type'] == 'Radiobutton') {
$input_options = InputValue::with('option')->where('test_result_id', $TestResult->id)->where('input_id', $input->id)->get();
$options = [];
foreach ($input_options as $input_option) {
$options[] = $input_option->option->title;
}
$values[$input->name] = $options;
$TestResult['options'] = $values;
}
else {
$inputs[$input->name] = $value->value;
$TestResult['inputs'] = $inputs;
}
//-----------------------------------------------------------------------Anothertype
}
}
$ImagesPath = [];
if (count($TestResult->TitleImage)) {
foreach ($TestResult->TitleImage as $Key => $TitleImage) {
$ImagesPath[] = $TitleImage->path;
}
$TestResult['imagesPath'] = $ImagesPath;
}
// dd($TestResult->test_type()->device_label);
$TestResult['device_label'] = $TestResult->test_type->device_label;
return \MessageResponse::data($TestResult);
}
}
+3 -1
View File
@@ -1,5 +1,7 @@
const urls = {
showTestResult: function(id) {
return `/ShowTestResult/${id}`;
},
showItem: function(id) {
return `/ShowItem/${id}`;
},
+5
View File
@@ -30,4 +30,9 @@ export default [
name: 'ShowCycle',
view: 'Cycle/ShowCycle'
},
{
path: '/Show/TestResult/:id',
name: 'ShowTestResult',
view: 'TestResult/ShowTestResult'
},
]
@@ -0,0 +1,228 @@
<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">
<h3 class="ml-3">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 md6 sm6>
<div class>
<span class="title">{{ data.device_label || 'AutoclaveID' }} :</span>
<span
class="headline ml-2"
style="letter-spacing:0 !important"
>{{ data.device_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>
</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>
</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"
>{{ User }}</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"
>{{ MedicalCenter }}</span>
</div>
</v-flex>
</v-layout>
</v-layout>
<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" />
</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"
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">{{keyOptions}} :</span>
<span
style="letter-spacing:0 !important"
class="headline ml-2"
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">{{keyForm}}</h3>
<div v-for="(childData, keyChild) in formData" :key="keyChild">
<div class="ml-4">
<span class="title">{{keyChild}} :</span>
<template v-if="Array.isArray(childData)">
<span
style="letter-spacing:0 !important"
class="headline ml-2"
v-for="(data, dataKey) in childData"
:key="dataKey"
>{{data}},</span>
</template>
<template v-else>
<span class="headline ml-2">{{childData}}</span>
</template>
</div>
</div>
</v-flex>
</template>
</v-layout>
</v-layout>
<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" />
</v-flex>
<v-layout row wrap class="ml-4">
<v-flex xs12 md6 sm6 v-for="(img, key) in data.title_image" :key="key">
<img :src="'/'+img.path" style="width: 100%" />
</v-flex>
</v-layout>
</v-layout>
<v-layout row wrap align-center justify-center>
<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>
</template>
<script>
import { mapGetters, mapMutations } from "vuex";
import axios from "axios";
import { urls } from "@show/config/urls";
export default {
data: () => ({
data : {},
TestType : '',
MedicalCenter : '',
User : ''
}),
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;
}
},
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() {
if (this.$route.params.id) {
this.load(this.$route.params.id);
}
},
};
</script>
@@ -14,7 +14,8 @@
</v-layout>
<v-layout row wrap class="ml-4">
<v-flex xs12 md6 sm6 v-if="QRCodeimg">
<a :href="ShowLink" target="_blank"><img :src="QRCodeimg"></a>
<a v-if = "Type != 'TestType'":href="ShowLink" target="_blank"><img :src="QRCodeimg"></a>
<img v-else :src="QRCodeimg">
</v-flex>
</v-layout>
</v-layout>
@@ -45,6 +46,7 @@ export default {
this.ShowLink = this.getModalProperties.result.data.data.ShowLink ? this.getModalProperties.result.data.data.ShowLink : '#';
this.Type = this.ShowLink.split('/')[1];
this.ID = this.ShowLink.split('/')[2];
},
computed: {
...mapGetters("modal", ["getModalProperties", "getModalLink"])
+3 -3
View File
@@ -141,7 +141,7 @@
<v-icon class="white--text mr-1 caption">fas fa-eye</v-icon>
<span>Show</span>
</v-btn>
<v-btn color="orange" class="mr-2" @click="generateBarcode(item.id)">
<v-btn color="orange" class="mr-2" @click="generateBarcode(item.id, 'TestResult')">
<v-icon class="white--text mr-1 caption">fas fa-eye</v-icon>
<span>generate Barcode</span>
</v-btn>
@@ -313,8 +313,8 @@ export default {
this.testTypes = result.data.data.TestTypes;
}
},
async generateBarcode(id) {
const result = await ApiService.post(urls.TestResultQRcode(id));
async generateBarcode(id, type) {
const result = await ApiService.post(urls.Barcode(id, type));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-barcode-barcode",
+16
View File
@@ -116,6 +116,10 @@
<v-icon class="white--text mr-1 caption">fas fa-folder</v-icon>
<span>Archive</span>
</v-btn>
<v-btn color="orange darken-1" @click="generateBarcode(item.id, 'TestType')">
<v-icon class="white--text mr-1 caption">fas fa-barcode</v-icon>
<span>Generate Barcode</span>
</v-btn>
</td>
</template>
</v-data-table>
@@ -140,6 +144,8 @@
<script>
import { ApiService } from "@/services";
import { urls } from "@/config/urls";
import { mapMutations, mapGetters } from "vuex";
export default {
data: () => ({
headers: [
@@ -187,6 +193,7 @@ export default {
this.load();
},
methods: {
...mapMutations("modal", ["changeCurrentModal"]),
async load(page = 1) {
let filter = "?";
for (const key in this.filter) {
@@ -215,6 +222,15 @@ export default {
}
}
},
async generateBarcode(code, type) {
const result = await ApiService.post(urls.Barcode(code, type));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-barcode-barcode",
properties: { result }
});
}
}
},
watch: {
currentPage(page) {
+1
View File
@@ -60,6 +60,7 @@ Route::get('/test',function(){
Route::get('/Show/{any?}/{any2?}',function(){
return view('showMaster');
});
Route::get('ShowTestResult/{id}', 'TestResultController@showTestResult');
Route::get('ShowItem/{Item}', 'ItemController@showItem');
Route::get('ShowPackage/{Package}', 'PackageController@showPackage');
Route::get('ShowLabel/{Label}', 'LabelController@showLabel');