Files
cssd-back/resources/js/vue/views/TestResult/List.vue
T
2019-04-29 19:24:18 +04:30

170 lines
5.1 KiB
Vue

<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 md2 sm2>
<v-text-field
class="pa-2"
label="Name"
color="black"
>
</v-text-field>
</v-flex>
<v-flex xs12 md2 sm2>
<v-text-field
class="pa-2"
label="Date"
color="black"
>
</v-text-field>
</v-flex>
<v-flex xs12 md2 sm2>
<v-text-field
class="pa-2"
label="Hospital"
color="black"
>
</v-text-field>
</v-flex>
<v-flex class="" xs12 md2 sm2>
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px">
<v-icon class="white--text mr-2 caption">fas fa-search</v-icon>
<span class="white--text">Filter</span>
</v-btn>
</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.autoclave_id }}</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="text-xs-right">
<v-btn color="black" class="mr-2">
<v-icon class="white--text mr-1 caption">fas fa-folder</v-icon>
<span>Archive</span>
</v-btn>
<router-link :to="{name: 'EditTestResult', params: {testResult: item.id}}">
<v-btn color="cyan" 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="mr-2" @click="remove(item.id)" >
<v-icon class="white--text mr-1 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";
export default {
data: () => ({
headers: [
{
sortable: false,
text: "AutoClaveId",
value: "name"
},
{
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: "Action",
value: "action",
align: "right"
}
],
items:[],
currentPage:1,
lastPage:1,
}),
created() {
this.load();
},
methods: {
async load() {
const result = await ApiService.get(urls.listTestResult);
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 load() {
const result = await ApiService.get(urls.listTestResult);
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 remove(testResultId) {
const result = await ApiService.get(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);
}
}
}
},
}
}
</script>