new C'hnages

This commit is contained in:
saeid
2019-08-21 14:49:33 +04:30
parent 2db3d32960
commit 6c8966e777
128 changed files with 261 additions and 162 deletions
@@ -0,0 +1,513 @@
<template>
<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-flex xs12 sm4 md4>
<v-autocomplete
:search-input.sync="searchInput"
:items="testTypeNames"
v-model="filter.name"
label="Choose Test Type"
color="black"
class="pa-2"
></v-autocomplete>
</v-flex>
<v-flex xs12 sm3 md3>
<v-text-field
name="testcode"
v-model="filter.unique_code"
label="Or Enter Test Unique Code"
color="black"
class="pa-2"
></v-text-field>
</v-flex>
<v-flex xs12 md2 sm2 class="text-xs-center text-sm-center text-md-center">
<v-btn
class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black"
@click="selectTestType"
style="padding:10px 60px;"
>
<v-icon class="black--text mr-2 caption">fas fa-chevron-right</v-icon>
<span class="black--text">Select Test Result</span>
</v-btn>
</v-flex>
</v-layout>
<v-layout row wrap class="px-5 my-3" v-if="!$route.params.testResult && form.length">
<v-divider></v-divider>
</v-layout>
<v-layout align-center justify-center wrap class="px-5 my-3" v-if="form.length">
<v-flex xs12 sm12 md12>
<h3>{{testTypeNameSelected}}</h3>
</v-flex>
<v-flex xs12 sm4 md4>
<v-text-field
name="autoclave"
v-model="formData.device_id"
:label="formData.device_label"
color="black"
class="pa-2"
></v-text-field>
</v-flex>
<v-flex xs12 sm4 md4>
<v-menu
lazy
:close-on-content-click="true"
transition="v-scale-transition"
offset-y
v-model="menu"
>
<v-text-field
prepend-icon="far fa-clock"
required
slot="activator"
label="Date"
v-model="formData.date"
></v-text-field>
<v-date-picker
color="pink"
no-title
v-model="formData.date"
:date-format="date => new Date(date).toDateString()"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs12 sm4 md4>
<v-switch color="green" v-model="result" :label="'Result: ' + formData.result"></v-switch>
</v-flex>
<v-flex xs12 sm12 md12>
<div>
<input type="file" class="inputfile" @change="onFileChange" multiple />
<label for="file">
<v-icon class="v-icon greylighten-3--text mr-2 caption IconHover">fas fa-chevron-right</v-icon>Choose a file
</label>
</div>
<v-layout>
<v-flex v-for="(img, key) in images" :key="key" xs12 sm6 md3>
<img :src="img" style="width:100%;" />
<v-btn class="black" @click.native.stop="removeImage(key)">Remove image</v-btn>
</v-flex>
</v-layout>
</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'"
v-model="formData[item.name+'_'+item.id]"
:label="item.name"
color="black"
></v-text-field>
<v-container fluid v-if="item.type == 'Temperature'">
<p>{{ item.name }}</p>
<v-flex xs12>
<v-slider
step="0.1"
prepend-icon="fas fa-temperature-high"
v-model="formData[item.name+'_'+item.id]"
min="0"
max="200"
thumb-label="always"
></v-slider>
</v-flex>
</v-container>
<v-container fluid v-if="item.type == 'Pressure'">
<p>{{ item.name }}</p>
<v-flex xs12>
<v-slider
prepend-icon="fa fa-tachometer"
step="0.001"
v-model="formData[item.name+'_'+item.id]"
min="-1"
max="3"
thumb-label="always"
></v-slider>
</v-flex>
</v-container>
<v-select
multiple
v-if="item.type == 'Select'"
:items="item.options"
v-model="formData[item.name+'_'+item.id]"
:label="item.name"
color="black"
item-text="title"
item-value="id"
></v-select>
<v-container fluid v-if="item.type == 'Checkbox'">
<p>{{ item.name }}</p>
<v-checkbox
v-for="(optionValue, keyOption) in item.options"
:key="keyOption"
:label="optionValue.title"
v-model="formData[item.name+'_'+item.id]"
:value="optionValue.id"
></v-checkbox>
</v-container>
<v-container fluid v-if="item.type == 'Radiobutton'">
<p>{{ item.name }}</p>
<v-radio-group v-model="formData[item.name+'_'+item.id]">
<v-radio
v-for="(optionValue, keyOption) in item.options"
:key="keyOption"
:label="optionValue.title"
:value="optionValue.id"
></v-radio>
</v-radio-group>
</v-container>
<v-container fluid v-if="item.type == 'Switch'">
<v-switch
color="green"
v-model="formData[item.name+'_'+item.id]"
:label="item.name + ': ' + formData[item.name+'_'+item.id].toString()"
></v-switch>
</v-container>
<v-container fluid v-if="item.type == 'Range'">
<p>{{ item.name }}</p>
<v-flex xs12>
<v-slider
v-model="formData[item.name+'_'+item.id]"
:min="item.options[0].title"
:max="item.options[1].title"
thumb-label="always"
></v-slider>
</v-flex>
</v-container>
<v-container fluid v-if="item.type == 'Time'">
<v-flex xs12>
<v-text-field
v-model="formData[item.name+'_'+item.id]"
:label="item.name"
class="WM-Font-30"
mask="##:##"
></v-text-field>
</v-flex>
</v-container>
<template v-if="item.type == 'Form'">
<v-container row md-12 sm-12 xs-12>
<v-layout row wrap>
<h3>{{ item.name }}</h3>
</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+'_'+children.id]"
:label="children.name"
color="black"
></v-text-field>
<v-container fluid v-if="children.type == 'Temperature'">
<p>{{ children.name }}</p>
<v-flex xs12>
<v-slider
prepend-icon="fas fa-temperature-high"
step="0.1"
v-model="formData[children.name+'_'+children.id]"
min="0"
max="200"
thumb-label="always"
></v-slider>
</v-flex>
</v-container>
<v-container step="0.001" fluid v-if="children.type == 'Pressure'">
<p>{{ children.name }}</p>
<v-flex xs12>
<v-slider
v-model="formData[children.name+'_'+children.id]"
min="-1"
max="3"
prepend-icon="fa fa-tachometer"
thumb-label="always"
></v-slider>
</v-flex>
</v-container>
<v-select
multiple
v-if="children.type == 'Select'"
:items="children.options"
v-model="formData[children.name+'_'+children.id]"
:label="children.name"
color="black"
item-text="title"
item-value="id"
></v-select>
<v-container fluid v-if="children.type == 'Checkbox'">
<p>{{ children.name }}</p>
<v-checkbox
v-for="(optionValue, keyOption) in children.options"
:key="keyOption"
:label="optionValue.title"
v-model="formData[children.name+'_'+children.id]"
:value="optionValue.id"
></v-checkbox>
</v-container>
<v-container fluid v-if="children.type == 'Radiobutton'">
<p>{{ children.name }}</p>
<v-radio-group v-model="formData[children.name+'_'+children.id]">
<v-radio
v-for="(optionValue, keyOption) in children.options"
:key="keyOption"
:label="optionValue.title"
:value="optionValue.id"
></v-radio>
</v-radio-group>
</v-container>
<v-container fluid v-if="children.type == 'Switch'">
<v-switch
color="green"
v-model="formData[children.name+'_'+children.id]"
:label="children.name + ': ' + formData[children.name+'_'+children.id].toString()"
></v-switch>
</v-container>
<v-container fluid v-if="children.type == 'Range'">
<p>{{ item.name }}</p>
<v-flex xs12>
<v-slider
v-model="formData[children.name+'_'+children.id]"
:min="children.options[0].title"
:max="children.options[1].title"
thumb-label="always"
></v-slider>
</v-flex>
</v-container>
<v-container fluid v-if="children.type == 'Time'">
<v-flex xs12>
<v-text-field
v-model="formData[children.name+'_'+children.id]"
:label="children.name"
class="WM-Font-30"
mask="##:##"
></v-text-field>
</v-flex>
</v-container>
</v-flex>
</v-layout>
</v-container>
</template>
</v-flex>
</v-layout>
<v-layout row wrap class="px-5 my-3">
<v-divider></v-divider>
</v-layout>
<v-layout align-center justify-center wrap class="px-5 mt-2">
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px" @click="submitForm">
<v-icon class="white--text mr-2 caption">fas fa-check</v-icon>
<span class="white--text">SAVE</span>
</v-btn>
<router-link :to="{name: 'Dashboard'}">
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black ml-5">
<v-icon class="black--text mr-2 caption">fas fa-chevron-left</v-icon>
<span class="black--text">Back</span>
</v-btn>
</router-link>
</v-layout>
</material-card>
</v-container>
</v-form>
</template>
<script>
import { ApiService } from "@/services";
import { urls } from "@/config/urls";
export default {
data: () => ({
testTypeNames: [],
testTypeNameSelected: "",
searchInput: "",
form: [],
filter: {
test_result_id: "",
name: "",
unique_code: ""
},
result: false,
formData: {
device_id: "",
device_label: "ID",
result: "Reject",
img: null,
test_type_id: ""
},
images: [],
menu: ""
}),
created() {
if (this.$route.params.testResult) {
this.filter.test_result_id = this.$route.params.testResult;
this.selectTestType();
}
this.load();
},
methods: {
async load() {
const result = await ApiService.get(urls.listTestTypeName);
this.testTypeNames = result.data.data;
},
async selectTestType() {
const result = await ApiService.post(urls.getInputs, this.filter);
if (result && result.status == 200) {
this.testTypeNameSelected = result.data.data.testType.name;
this.form = result.data.data.inputs;
this.formData.test_type_id = result.data.data.testType.id;
this.formData.device_label =
result.data.data.testType.device_label;
for (const key in result.data.data.inputs) {
if (result.data.data.inputs.hasOwnProperty(key)) {
if (result.data.data.inputs[key].type == "Form") {
for (const keyForm in result.data.data.inputs[key]
.children) {
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 +
"_" +
result.data.data.inputs[key]
.children[keyForm].id
] = [];
} else {
this.formData[
result.data.data.inputs[key]
.children[keyForm].name +
"_" +
result.data.data.inputs[key]
.children[keyForm].id
] = "";
}
}
}
} else if (
result.data.data.inputs[key].type == "Checkbox" ||
result.data.data.inputs[key].type == "Select"
) {
this.formData[
result.data.data.inputs[key].name +
"_" +
result.data.data.inputs[key].id
] = [];
} else {
this.formData[
result.data.data.inputs[key].name +
"_" +
result.data.data.inputs[key].id
] = "";
}
}
}
if (this.$route.params.testResult) {
const result = await ApiService.get(
urls.editTestResult(this.$route.params.testResult)
);
if (result && result.status == 200) {
this.formData = result.data.data;
for (const key in result.data.data.imagesPath) {
if (
result.data.data.imagesPath.hasOwnProperty(key)
) {
result.data.data.imagesPath[key] =
"/" + result.data.data.imagesPath[key];
}
}
this.images = result.data.data.imagesPath;
}
}
}
},
async submitForm() {
let result;
if (this.$route.params.testResult) {
result = await ApiService.put(
urls.updateTestResult(this.$route.params.testResult),
this.formData
);
} else {
result = await ApiService.post(
urls.storeTestResult,
this.formData
);
}
if (result && result.status == 200) {
this.$router.push({ name: "AllResultTest" });
}
},
onFileChange(e) {
var files = e.target.files || e.dataTransfer.files;
if (!files.length) return;
for (const key in files) {
if (files.hasOwnProperty(key)) {
this.createImage(files[key], key);
}
}
},
createImage(file, index) {
var image = new Image();
var reader = new FileReader();
var vm = this;
reader.onload = e => {
vm.images.push(e.target.result);
};
reader.readAsDataURL(file);
},
removeImage(index) {
this.images.splice(index, 1);
}
},
watch: {
images(img) {
this.formData.imgs = img;
},
result(value) {
if (value) {
this.formData.result = "Accept";
} else {
this.formData.result = "Reject";
}
},
formData(value) {
if (value.result == "Accept") {
this.result = true;
} else {
this.result = false;
}
}
}
};
</script>
<style >
.WM-Font-30 input {
font-size: 30px !important;
}
.v-input--switch__track:not(.green--text) {
color: red !important;
}
.v-input--switch__thumb:not(.green--text) {
background-color: red !important;
}
.v-btn--floating {
padding: 0 !important;
}
.theme--light.v-btn.v-btn--flat {
color: rgba(0, 0, 0, 0.87) !important;
}
.v-btn--floating,
.v-btn--icon:before {
border-radius: 50% !important;
}
</style>
+343
View File
@@ -0,0 +1,343 @@
<template>
<div class>
<v-container fluid>
<material-card class color="black" title="All Test Resualt" text>
<v-layout align-center wrap class="my-3">
<v-flex xs12 md3 sm3>
<v-text-field
class="pa-2"
v-model="filter.device_id"
label="AutoclaveID or WaherID"
color="black"
></v-text-field>
</v-flex>
<v-flex xs12 md3 sm3>
<v-autocomplete
class="pa-2"
v-model="filter.testType_id"
label="TestType Name"
color="black"
:items="testTypes"
item-text="name"
item-value="id"
></v-autocomplete>
</v-flex>
<v-flex xs12 md3 sm3>
<v-autocomplete
class="pa-2"
v-model="filter.medicalCenter_id"
label="Hospital"
color="black"
:items="medicalCenters"
item-text="name"
item-value="id"
></v-autocomplete>
</v-flex>
<v-flex xs12 md3 sm3>
<v-text-field
class="pa-2"
v-model="filter.user_name"
label="User Name"
color="black"
></v-text-field>
</v-flex>
<v-flex xs12 sm6 md3>
<v-menu
lazy
:close-on-content-click="true"
transition="v-scale-transition"
offset-y
v-model="fromMenu"
>
<v-text-field
required
slot="activator"
label="FromDate"
v-model="filter.fromPicker"
></v-text-field>
<v-date-picker
color="pink"
no-title
v-model="filter.fromPicker"
:date-format="date => new Date(date).toDateString()"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs12 sm6 md3>
<v-menu
lazy
:close-on-content-click="true"
transition="v-scale-transition"
offset-y
v-model="upToMenu"
>
<v-text-field
required
slot="activator"
label="UpToDate"
v-model="filter.upToPicker"
></v-text-field>
<v-date-picker
color="pink"
no-title
v-model="filter.upToPicker"
:date-format="date => new Date(date).toDateString()"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex class xs12 md2 sm3>
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px" @click="load(null, null)">
<v-icon class="white--text mr-2 caption">fas fa-search</v-icon>
<span class="white--text">Filter</span>
</v-btn>
</v-flex>
<v-spacer></v-spacer>
<v-flex xs12 md2 sm2 class="text-xs-right">
<router-link :to="{name: 'SubmitTestResult'}">
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black">
<v-icon class="black--text mr-2 caption">fas fa-plus</v-icon>
<span class="black--text">Add</span>
</v-btn>
</router-link>
</v-flex>
</v-layout>
<v-divider></v-divider>
<v-layout align-center wrap class="my-3">
<v-flex md12>
<v-data-table :headers="headers" :items="items" hide-actions>
<template slot="headerCell" slot-scope="{ header }">
<span
class="subheading font-weight-light text-white text--darken-3"
v-text="header.text"
/>
</template>
<template slot="items" slot-scope="{ item }">
<td class="headline font-weight-light">{{ item.device_id }}</td>
<td
class="title font-weight-light"
>{{ item.test_type ? item.test_type.name : 'Archived Test' }}</td>
<td
class="title font-weight-light"
>{{ item.user.medical_center.name }}</td>
<td class="title font-weight-light">{{ item.user.name }}</td>
<td class="title font-weight-light">{{ item.result }}</td>
<td class="title font-weight-light">{{ item.created_at }}</td>
<td class="title font-weight-light">{{ item.verified }}</td>
<td class="text-xs-right">
<v-btn color="cyan" class="mr-2" @click="show(item.id)">
<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-icon class="white--text mr-1 caption">fas fa-eye</v-icon>
<span>generate Barcode</span>
</v-btn>
<router-link
v-if="$hasRole('Admin') || item.user_id == $store.state.user.id"
:to="{name: 'EditTestResult', params: {testResult: item.id}}"
>
<v-btn color="orange" class="mr-2">
<v-icon class="white--text mr-1 caption">fas fa-pen</v-icon>
<span>Edit</span>
</v-btn>
</router-link>
<v-btn
color="pink"
class="WM-ActionButton"
@click="remove(item.id)"
v-if="$hasRole('Admin') || item.user_id == $store.state.user.id"
>
<v-icon class="white--text mr-2 caption">fas fa-times</v-icon>
<span>Remove</span>
</v-btn>
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
<v-divider></v-divider>
<div class="text-xs-center" v-if="lastPage > 1">
<v-pagination v-model="currentPage" :length="lastPage" :total-visible="6"></v-pagination>
</div>
<v-layout row wrap align-center justify-center class="mt-3">
<router-link to="/dashboard">
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black ml-5">
<v-icon class="black--text mr-2 caption">fas fa-chevron-left</v-icon>
<span class="black--text">Back</span>
</v-btn>
</router-link>
</v-layout>
</material-card>
</v-container>
</div>
</template>
<script>
import { ApiService } from "@/services";
import { urls } from "@/config/urls";
import { mapMutations, mapGetters } from "vuex";
export default {
data: () => ({
headers: [
{
sortable: false,
text: "AutoClave Or Washer Id",
value: "name"
},
{
sortable: false,
text: "Test Type",
value: "TestType"
},
{
sortable: false,
text: "Hospital",
value: "Hospital"
},
{
sortable: false,
text: "User",
value: "Users"
},
{
sortable: false,
text: "Result",
value: "result"
},
{
sortable: false,
text: "Date",
value: "date"
},
{
sortable: false,
text: "Verify",
value: "verify"
},
{
sortable: false,
text: "Action",
value: "action",
align: "right"
}
],
filter: {
device_id:'',
testType_id: '',
medicalCenter_id: '',
user_name: '',
fromPicker: '',
upToPicker: '',
},
fromMenu: '',
upToMenu: '',
items: [],
currentPage: 1,
lastPage: 1,
testTypes: [],
medicalCenters: [],
}),
created() {
this.fillSelectFilter();
if (this.$route.name == "NotVerifyTestResult") {
this.load(1, "NotVerified");
} else {
this.load();
}
},
methods: {
...mapMutations("modal", ["changeCurrentModal"]),
async load(page = 1, verified = null) {
let filter = '?';
for (const key in this.filter) {
if (this.filter.hasOwnProperty(key)) {
filter += `${key}=${this.filter[key]}&`;
}
}
if (verified) {
filter += `verified=${verified}&`;
}
filter += (page) ? `page=${page}` : `page=1`;
const result = await ApiService.get(
urls.listTestResult(filter)
);
if (result && result.status == 200) {
this.items = result.data.data.data;
this.currentPage = result.data.data.current_page;
this.lastPage = result.data.data.last_page;
}
},
async show(testResultId) {
const result = await ApiService.get(
urls.showTestResult(testResultId)
);
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-testresult-show",
properties: { result }
});
}
},
async remove(testResultId) {
const result = await ApiService.delete(
urls.removeTestResult(testResultId)
);
if (result && result.status == 200) {
for (const key in this.items) {
if (
this.items.hasOwnProperty(key) &&
this.items[key].id == testResultId
) {
this.items.splice(key, 1);
}
}
}
},
async fillSelectFilter() {
const result = await ApiService.get(urls.listFilterItemsTestResult);
if (result && result.status == 200) {
this.medicalCenters = result.data.data.MedicalCenters;
this.testTypes = result.data.data.TestTypes;
}
},
async generateBarcode(id) {
const result = await ApiService.post(urls.TestResultQRcode(id));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-barcode-barcode",
properties: { result }
});
}
}
},
computed: {
...mapGetters("modal", ["getModalResult"])
},
watch: {
currentPage(page) {
this.load(page);
},
getModalResult(testResult) {
for (const key in this.items) {
if (
this.items.hasOwnProperty(key) &&
this.items[key].id == testResult.id
) {
this.items[key] = testResult;
}
}
}
}
};
</script>
<style>
.v-btn--floating {
padding: 0!important;
}
.theme--light.v-btn.v-btn--flat {
color: rgba(0,0,0,.87)!important;
}
.v-btn--floating, .v-btn--icon:before {
border-radius: 50%!important;
}
</style>
+248
View File
@@ -0,0 +1,248 @@
<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">Common Info</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"
>{{ 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>
</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
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>
</material-card>
<material-card>
<v-layout row wrap align-center justify-center v-if="$hasRole('Admin|Supervisor')">
<v-flex
class
xs12
md2
sm2
v-if="data.verified == 'NotVerified'"
@click="verify(data.id)"
>
<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 xs12 md2 sm2 v-else>
<v-btn
class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Gray"
@click="verify(data.id)"
>
<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 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>
export default {
data: () => ({
data: {}
})
};
</script>
<script>
import { mapGetters, mapMutations } from "vuex";
import { ApiService } from "@/services";
import { urls } from "@/config/urls";
export default {
data: () => ({}),
methods: {
...mapMutations("modal", ["closeModal", "setResultModal"]),
async verify(id) {
const result = await ApiService.post(urls.verifyTestResult(id));
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>