Show Test Result

This commit is contained in:
saeid_01
2019-05-09 04:24:27 +04:30
parent 940a1b01ab
commit 116ef9e130
21 changed files with 504 additions and 173 deletions
@@ -3,9 +3,39 @@
<v-container fluid>
<material-card class color="black" title="Show Test Resualt" text>
<v-layout align-center wrap class="my-3">
<v-flex xs12 md2 sm2>
<v-text-field class="pa-2" label="Name" color="black"></v-text-field>
<v-flex xs12 md12 sm12>
<div>Auto Clave Id : {{ data.autoclave_id }}</div>
</v-flex>
<v-flex xs12 md12 sm12>
<div>Result : {{ data.result }}</div>
</v-flex>
<v-flex xs12 md12 sm12>
<div>verify : {{ data.verified }}</div>
</v-flex>
<v-flex xs12 md12 sm12>
<div>Register User : {{ data.user.name }}</div>
</v-flex>
<template v-if="data.inputs">
<v-flex xs12 md12 sm12 v-for="(inputData, keyInputs) in data.inputs" :key="keyInputs">
<div>{{keyInputs}} : {{inputData}}</div>
</v-flex>
</template>
<template v-if="data.options">
<v-flex xs12 md12 sm12 v-for="(optionData, keyOptions) in data.options" :key="keyOptions">
<div>{{keyOptions}} : <span v-for="(data, dataKey) in optionData" :key="dataKey">{{data}}, </span></div>
</v-flex>
</template>
<template v-if="data.children">
<v-flex xs12 md12 sm12 v-for="(formData, keyForm) in data.children" :key="keyForm">
<h1>{{keyForm}}</h1>
<div v-for="(childData, keyChild) in formData" :key="keyChild">
<div>{{keyChild}} :
<template v-if="Array.isArray(childData)"><span v-for="(data, dataKey) in childData" :key="dataKey">{{data}}, </span> </template>
<template v-else > <span>{{childData}}</span> </template>
</div>
</div>
</v-flex>
</template>
</v-layout>
<v-divider></v-divider>
<v-layout align-center wrap class="my-3">
@@ -41,7 +71,7 @@ export default {
this.data = this.getModalProperties.result.data.data;
},
computed: {
...mapGetters("modal", ["getModalProperties"])
...mapGetters("modal", ["getModalProperties"]),
}
};
</script>
+4 -1
View File
@@ -23,7 +23,10 @@ const urls = {
updateTestType : function(id) {
return `/TestTypes/${id}`;
},
listTestResult : function(page) {
listTestResult : function(page, verified = null) {
if (verified) {
return `/TestResults/?verified=${verified}&page=${page}`;
}
return "/TestResults?page=" + page;
},
editTestResult : function(id) {
+5
View File
@@ -101,4 +101,9 @@ export default [
name: 'EditTestResult',
view: 'TestResult/AddEdit'
},
{
path: '/test-result/NotVerified',
name: 'NotVerifyTestResult',
view: 'TestResult/List'
},
]
+1 -1
View File
@@ -33,7 +33,7 @@ export default {
{title:'Manage Users', text:'You can edit the medical center information',icon:'/img/Static/Dashboard/ipad.png',color:'WM-YellowPinkGradient-BG',route:{name: 'ManageUsers'},aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12'},
{title:'Manage Medical Center', text:'Managing users very fast by ...',icon:'/img/Static/Dashboard/Macbook.png',color:'WM-MuskGradient-BG',route:{name: 'ManageMedicalCenter'},aligntext:'text-md-left',alignimg:'text-md-right',column:'xs12 md7 sm7'},
{title:'List Test Type', text:'You can simply add your own test type',icon:'/img/Static/Dashboard/Book-and-Pen.png',color:'WM-GreyGradient-BG',route:{name: 'ListTestType'},aligntext:'text-md-left',alignimg:'text-md-right',column:'xs12 md5 sm5'},
{title:'Test to Verify', text:'You can simply add your own test type in this section of website',icon:'/img/Static/Dashboard/notepad-colorful.png',color:'WM-PinkGradient-BG',route:{name: 'SubmitTestResult'},aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12'},
{title:'Test to Verify', text:'You can simply add your own test type in this section of website',icon:'/img/Static/Dashboard/notepad-colorful.png',color:'WM-PinkGradient-BG',route:{name: 'NotVerifyTestResult'},aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12'},
{title:'Add a Test Result', text:'You can edit the medical center information',icon:'/img/Static/Dashboard/ipad.png',color:'WM-YellowPinkGradient-BG',route:{name: 'SubmitTestResult'},aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12'},
]
}
+52 -5
View File
@@ -2,7 +2,13 @@
<v-form ref="form">
<v-container grid-list-xs>
<material-card color="black" title="Submit Test Result">
<v-layout align-center justify-center wrap class="px-5 my-3" v-if="!$route.params.testResult">
<v-layout
align-center
justify-center
wrap
class="px-5 my-3"
v-if="!$route.params.testResult"
>
<v-flex xs12 sm4 md4>
<v-autocomplete
:search-input.sync="searchInput"
@@ -55,6 +61,15 @@
class="pa-2"
></v-select>
</v-flex>
<v-flex xs12 sm4 md3>
<div v-if="!image">
<input type="file" @change="onFileChange">
</div>
<div v-else>
<img :src="image" style="width:100%;"/>
<button @click="removeImage">Remove image</button>
</div>
</v-flex>
<v-flex :class="['pa-2', item.size]" v-for="(item, key) in form" :key="key">
<v-text-field
v-if="item.type == 'Text'"
@@ -72,7 +87,7 @@
item-text="title"
item-value="id"
></v-select>
<v-container fluid v-if="item.type == 'Checkbox'" >
<v-container fluid v-if="item.type == 'Checkbox'">
<p>{{ item.name }}</p>
<v-checkbox
v-for="(optionValue, keyOption) in item.options"
@@ -85,7 +100,13 @@
<template v-if="item.type == 'Form'">
<v-layout row wrap>
<h3>{{ item.name }}</h3>
<v-flex :class="['pa-2', children.size]" v-for="(children, keyChildren) in item.children" :key="keyChildren">
</v-layout>
<v-layout row wrap>
<v-flex
:class="['pa-2', children.size]"
v-for="(children, keyChildren) in item.children"
:key="keyChildren"
>
<v-text-field
v-if="children.type == 'Text'"
v-model="formData[children.name]"
@@ -153,8 +174,10 @@ export default {
formData : {
autoclave_id: "",
result: "",
img: null,
test_type_id: "",
}
},
image: null,
}),
created() {
if (this.$route.params.testResult) {
@@ -181,7 +204,6 @@ export default {
if (result.data.data.inputs[key].children.hasOwnProperty(keyForm)) {
if (result.data.data.inputs[key].children[keyForm].type == 'Checkbox' || result.data.data.inputs[key].children[keyForm].type == 'Select' ) {
this.formData[result.data.data.inputs[key].children[keyForm].name] = [];
console.log(this.formData[result.data.data.inputs[key].children[keyForm].name]);
} else {
this.formData[result.data.data.inputs[key].children[keyForm].name] = '';
}
@@ -214,6 +236,31 @@ export default {
this.$router.push({name: 'Dashboard'})
}
},
onFileChange(e) {
var files = e.target.files || e.dataTransfer.files;
if (!files.length)
return;
this.createImage(files[0]);
},
createImage(file) {
var image = new Image();
var reader = new FileReader();
var vm = this;
reader.onload = (e) => {
vm.image = e.target.result;
};
reader.readAsDataURL(file);
},
removeImage: function (e) {
this.image = null;
},
},
watch:{
image(img) {
this.formData.img = img;
}
}
};
</script>
+8 -3
View File
@@ -129,12 +129,17 @@ export default {
lastPage: 1
}),
created() {
this.load();
if(this.$route.name == 'NotVerifyTestResult') {
this.load(1, 'NotVerified');
} else {
this.load();
}
},
methods: {
...mapMutations("modal", ["changeCurrentModal"]),
async load(page = 1) {
const result = await ApiService.get(urls.listTestResult(page));
async load(page = 1, verified = null) {
const result = await ApiService.get(urls.listTestResult(page, verified));
if (result && result.status == 200) {
this.items = result.data.data.data;
this.currentPage = result.data.data.current_page;