Show And Barcode

This commit is contained in:
saeid
2019-05-09 19:54:25 +04:30
parent 56b108401a
commit aa61c9e54f
16 changed files with 750 additions and 276 deletions
+27 -6
View File
@@ -46,6 +46,7 @@
<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>
@@ -59,7 +60,11 @@
<span>Edit</span>
</v-btn>
</router-link>
<v-btn color="pink" class="WM-ActionButton" @click="remove(item.id)" >
<v-btn
color="pink"
class="WM-ActionButton"
@click="remove(item.id)"
>
<v-icon class="white--text mr-2 caption">fas fa-times</v-icon>
<span>Remove</span>
</v-btn>
@@ -88,7 +93,7 @@
<script>
import { ApiService } from "@/services";
import { urls } from "@/config/urls";
import { mapMutations } from "vuex";
import { mapMutations, mapGetters } from "vuex";
export default {
data: () => ({
headers: [
@@ -117,6 +122,11 @@ export default {
text: "Date",
value: "date"
},
{
sortable: false,
text: "Verify",
value: "verify"
},
{
sortable: false,
text: "Action",
@@ -129,17 +139,18 @@ export default {
lastPage: 1
}),
created() {
if(this.$route.name == 'NotVerifyTestResult') {
this.load(1, 'NotVerified');
if (this.$route.name == "NotVerifyTestResult") {
this.load(1, "NotVerified");
} else {
this.load();
}
},
methods: {
...mapMutations("modal", ["changeCurrentModal"]),
async load(page = 1, verified = null) {
const result = await ApiService.get(urls.listTestResult(page, verified));
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;
@@ -173,9 +184,19 @@ export default {
}
}
},
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;
}
}
}
}
};
+12 -1
View File
@@ -47,7 +47,7 @@
<span>Edit</span>
</v-btn>
</router-link>
<v-btn color="orange darken-1">
<v-btn color="orange darken-1" @click="generateBarcode(item.id)">
<v-icon class="white--text mr-1 caption">fas fa-barcode</v-icon>
<span>Generate Barcode</span>
</v-btn>
@@ -79,6 +79,7 @@
<script>
import { ApiService } from "@/services";
import { urls } from "@/config/urls";
import { mapMutations } from "vuex";
export default {
data: () => ({
headers: [
@@ -117,6 +118,7 @@ export default {
this.getData();
},
methods: {
...mapMutations("modal", ["changeCurrentModal"]),
async getData(page = 1) {
const result = await ApiService.get(urls.listTestType(page));
if (result && result.status == 200) {
@@ -137,6 +139,15 @@ export default {
}
}
}
},
async generateBarcode(id) {
const result = await ApiService.post(urls.TestTypeBarcode(id));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-testtype-barcode",
properties: { result }
});
}
}
},
watch: {