fix : verify test result

This commit is contained in:
zeinab.ashrafi
2025-05-19 14:03:09 +03:30
parent 3610d97cec
commit 12623018d6
6 changed files with 899 additions and 852 deletions
+1 -1
View File
@@ -211,7 +211,7 @@ export default {
text: 'packages that you posses', text: 'packages that you posses',
// image: '/img/Static/Dashboard/alltest.png', // image: '/img/Static/Dashboard/alltest.png',
color: 'WM-LightGray-BG', color: 'WM-LightGray-BG',
route: {name: 'MyItem'}, route: {name: 'MyPackage'},
aligntext: 'text-md-left', aligntext: 'text-md-left',
alignimg: 'text-md-right', alignimg: 'text-md-right',
column: 'xs12 md4 sm4', column: 'xs12 md4 sm4',
+313 -312
View File
@@ -1,179 +1,180 @@
<template> <template>
<div class> <div class>
<v-container fluid> <v-container fluid>
<material-card class color="black" title="All Items" text> <material-card class color="black" text title="All Items">
<v-layout align-center wrap class="px-3"> <v-layout align-center class="px-3" wrap>
<v-flex xs12 sm4 md4 lg2 xl1 class="WM-FlexCenter"> <!-- <v-flex xs12 sm4 md4 lg2 xl1 class="WM-FlexCenter">
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/> <v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/>
<v-text-field class="pt-3 pr-3" v-model="filter.item_id" label="Item ID" <v-text-field class="pt-3 pr-3" v-model="filter.item_id" label="Item ID"
color="black"/> color="black"/>
</v-flex> </v-flex>-->
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter"> <v-flex class="WM-FlexCenter" lg2 md3 sm3 xl1 xs12>
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/> <v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/>
<v-text-field class="pt-3 pr-3" v-model="filter.name" label="Name" color="black"/> <v-text-field v-model="filter.udi" class="pt-3 pr-3" color="black" label="UDI"/>
</v-flex> </v-flex>
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter"> <v-flex class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/> <v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/>
<v-text-field class="pt-3 pr-3" v-model="filter.user_name" label="Owner" color="black"/> <v-text-field v-model="filter.name" class="pt-3 pr-3" color="black" label="Name"/>
</v-flex> </v-flex>
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter" v-if="$hasRole('Admin')"> <v-flex class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
<v-icon class="fa fa-hospital-o mr-2 WM-Margin-B-8"/> <v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/>
<v-autocomplete class="pt-3 pr-3" v-model="filter.medical_center_id" item-text="name" <v-text-field v-model="filter.user_name" class="pt-3 pr-3" color="black" label="Owner"/>
item-value="id" label="Hospital" color="black" :items="medicalCenters" </v-flex>
:clearable="true"/> <v-flex v-if="$hasRole('Admin')" class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
</v-flex> <v-icon class="fa fa-hospital-o mr-2 WM-Margin-B-8"/>
<v-flex xs12 sm3 md3 lg2 xl1 class="WM-FlexCenter"> <v-autocomplete v-model="filter.medical_center_id" :clearable="true" :items="medicalCenters"
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/> class="pt-3 pr-3" color="black" item-text="name" item-value="id"
<v-text-field class="pt-3 pr-3" v-model="filter.size" label="Size" color="black"/> label="Hospital"/>
</v-flex> </v-flex>
<v-flex xs12 sm3 md3 lg2 xl1 class="WM-FlexCenter"> <v-flex class="WM-FlexCenter" lg2 md3 sm3 xl1 xs12>
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/> <v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/>
<v-text-field class="pt-3 pr-3" v-model="filter.udi" label="UDI" color="black"/> <v-text-field v-model="filter.size" class="pt-3 pr-3" color="black" label="Size"/>
</v-flex> </v-flex>
<!--btn-->
<v-spacer/>
<v-flex xs12 sm6 md6 lg12 xl3 class="WM-Align-R">
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn v-bind="attrs" v-on="on"
color="WM-Tooltip-Btn WM-Outline-Btn WM-Border WM-Margin-BT-0 WM-Border-Black mr-2"
@click="load()">
<v-icon class="black--text caption">fas fa-search</v-icon>
</v-btn>
</template>
<span>Filter</span>
</v-tooltip>
<v-btn class="WM-Outline-Btn WM-Border mr-2 WM-Margin-BT-0 WM-Border-Black" @click="download()" <!--btn-->
style="padding: 10px 30px;"> <v-spacer/>
<v-icon class="black--text mr-2 caption">fas fa-share-square</v-icon> <v-flex class="WM-Align-R" lg12 md6 sm6 xl3 xs12>
<span class="black--text">EXPORT</span> <v-tooltip bottom open-on-hover>
</v-btn> <template v-slot:activator="{ on, attrs }">
<v-btn color="WM-Tooltip-Btn WM-Outline-Btn WM-Border WM-Margin-BT-0 WM-Border-Black mr-2" v-bind="attrs"
@click="load()"
v-on="on">
<v-icon class="black--text caption">fas fa-search</v-icon>
</v-btn>
</template>
<span>Filter</span>
</v-tooltip>
<router-link :to="{ name: 'AddItem' }"> <v-btn class="WM-Outline-Btn WM-Border mr-2 WM-Margin-BT-0 WM-Border-Black" style="padding: 10px 30px;"
<v-btn class="WM-CyanBlueGradient-BG WM-Margin-BT-0" style="padding:10px 30px"> @click="download()">
<v-icon class="white--text mr-2 caption">fas fa-plus</v-icon> <v-icon class="black--text mr-2 caption">fas fa-share-square</v-icon>
<span class="white--text">Add</span> <span class="black--text">EXPORT</span>
</v-btn> </v-btn>
</router-link>
</v-flex> <router-link :to="{ name: 'AddItem' }">
</v-layout> <v-btn class="WM-CyanBlueGradient-BG WM-Margin-BT-0" style="padding:10px 30px">
<v-layout class="px-3 my-3"> <v-icon class="white--text mr-2 caption">fas fa-plus</v-icon>
<v-divider/> <span class="white--text">Add</span>
</v-layout> </v-btn>
<v-layout align-center wrap class="my-3 px-3"> </router-link>
<v-flex md12> </v-flex>
<v-data-table :headers="headers" :items="items" hide-actions> </v-layout>
<template slot="headerCell" slot-scope="{ header }"> <v-layout class="px-3 my-3">
<v-divider/>
</v-layout>
<v-layout align-center class="my-3 px-3" wrap>
<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" <span class="subheading font-weight-light text-white text--darken-3"
v-text="header.text"/> v-text="header.text"/>
</template> </template>
<template slot="items" slot-scope="{ item }"> <template slot="items" slot-scope="{ item }">
<td class="title font-weight-light">{{ item.id }}</td> <td class="title font-weight-light">{{ item.id }}</td>
<!-- <td class="title font-weight-light">{{ item.unique_id }}</td> --> <!-- <td class="title font-weight-light">{{ item.unique_id }}</td> -->
<td class="title font-weight-light">{{ item.name }}</td> <td class="title font-weight-light">{{ item.name }}</td>
<td class="title font-weight-light"> <td class="title font-weight-light">
{{ item.user ? item.user.name : '' | text_20_letter }} {{ item.user ? item.user.name : '' | text_20_letter }}
</td> </td>
<td class="title font-weight-light"> <td class="title font-weight-light">
{{ (item.user && item.user.medical_center) ? item.user.medical_center.name : '' }} {{ (item.user && item.user.medical_center) ? item.user.medical_center.name : '' }}
</td> </td>
<td class="title font-weight-light">{{ item.udi | text_20_letter }}</td> <td class="title font-weight-light">{{ item.udi | text_20_letter }}</td>
<td class="title font-weight-light">{{ item.size }}</td> <td class="title font-weight-light">{{ item.size }}</td>
<td class="title font-weight-light">{{ item.status }}</td> <td class="title font-weight-light">{{ item.status }}</td>
<td class="text-xs-right FlexBtn Height-MD-60 justify-self-end"> <td class="text-xs-right FlexBtn Height-MD-60 justify-self-end">
<template v-if="$hasRole('Admin|Supervisor')"> <template v-if="$hasRole('Admin|Supervisor')">
<v-tooltip v-for="status in getStatus(item)" :key="status.label" bottom <v-tooltip v-for="status in getStatus(item)" :key="status.label" bottom
open-on-hover> open-on-hover>
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<v-btn :color="status.color" class="mr-2" <v-btn :color="status.color" class="mr-2"
@click="changeStatus(item, status.status)" v-bind="attrs" v-bind="attrs" @click="changeStatus(item, status.status)"
v-on="on"> v-on="on">
<v-icon :class="`${status.font_color}--text mr-1 caption`"> <v-icon :class="`${status.font_color}--text mr-1 caption`">
fas {{ status.icon }} fas {{ status.icon }}
</v-icon> </v-icon>
<span>{{ status.label }}</span> <span>{{ status.label }}</span>
</v-btn>
</template>
<span>{{ status.label }}</span>
</v-tooltip>
</template>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn v-bind="attrs" v-on="on" color="light-gray" class="mr-2"
@click="show(item.id)">
<v-icon class="black--text mr-1 caption">fas fa-eye</v-icon>
<span>Show</span>
</v-btn>
</template>
<span>Show</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn class="mr-2" v-bind="attrs" v-on="on" color="light-gray"
@click="generateBarcode(item, 'Item')">
<v-icon class="black--text mr-2 caption">fas fa-barcode</v-icon>
<span class="CSSD-font">Generate Barcode</span>
</v-btn>
</template>
<span>Generate Barcode</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn class="mr-2" v-bind="attrs" v-on="on" color="light-gray"
v-if="($hasRole('Admin|Supervisor') || item.user_id == $store.state.user.id) && !(item.package_id) && item.status ==='approved'"
@click="transfer(item)">
<v-icon class="black--text mr-2 caption">fas fa-exchange-alt</v-icon>
<span class="CSSD-font">Transfer</span>
</v-btn>
</template>
<span>Transfer</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<router-link class="LinkBtn"
v-if="$hasRole('Admin|Supervisor') ||( item.user_id == $store.state.user.id && !['approved', 'rejected'].includes(item.status))"
:to="{ name: 'EditItem', params: { Item: item.id } }">
<v-btn v-bind="attrs" v-on="on" color="black" class="mr-2">
<v-icon class="white--text mr-1 caption">fas fa-pen</v-icon>
<span>Edit</span>
</v-btn>
</router-link>
</template>
<span>Edit</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn v-bind="attrs" v-on="on" color="red" class="WM-ActionButton mr-2"
@click="removeModal(item.id)"
v-if="$hasRole('Admin|Supervisor') ||( item.user_id == $store.state.user.id && !['approved', 'rejected'].includes(item.status))">
<v-icon class="white--text mr-2 caption">fas fa-trash</v-icon>
<span>Remove</span>
</v-btn>
</template>
<span>Remove</span>
</v-tooltip>
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
<v-divider/>
<div class="text-xs-center" v-if="lastPage > 1">
<v-pagination color="black" v-model="currentPage" :length="lastPage"
:total-visible="6"/>
</div>
<v-layout row wrap align-center justify-center class="mt-3 px-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 CSSD-font">Back</span>
</v-btn> </v-btn>
</router-link> </template>
</v-layout> <span>{{ status.label }}</span>
</material-card> </v-tooltip>
</v-container> </template>
</div> <v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn class="mr-2" color="light-gray" v-bind="attrs" @click="show(item.id)"
v-on="on">
<v-icon class="black--text mr-1 caption">fas fa-eye</v-icon>
<span>Show</span>
</v-btn>
</template>
<span>Show</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn class="mr-2" color="light-gray" v-bind="attrs" @click="generateBarcode(item, 'Item')"
v-on="on">
<v-icon class="black--text mr-2 caption">fas fa-barcode</v-icon>
<span class="CSSD-font">Generate Barcode</span>
</v-btn>
</template>
<span>Generate Barcode</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn v-if="($hasRole('Admin|Supervisor') || item.user_id == $store.state.user.id) && !(item.package_id) && item.status ==='approved'" class="mr-2" color="light-gray" v-bind="attrs"
@click="transfer(item)"
v-on="on">
<v-icon class="black--text mr-2 caption">fas fa-exchange-alt</v-icon>
<span class="CSSD-font">Transfer</span>
</v-btn>
</template>
<span>Transfer</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<router-link v-if="$hasRole('Admin|Supervisor') ||( item.user_id == $store.state.user.id && !['approved', 'rejected'].includes(item.status))"
:to="{ name: 'EditItem', params: { Item: item.id } }"
class="LinkBtn">
<v-btn class="mr-2" color="black" v-bind="attrs" v-on="on">
<v-icon class="white--text mr-1 caption">fas fa-pen</v-icon>
<span>Edit</span>
</v-btn>
</router-link>
</template>
<span>Edit</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn v-if="$hasRole('Admin|Supervisor') ||( item.user_id == $store.state.user.id && !['approved', 'rejected'].includes(item.status))" class="WM-ActionButton mr-2" color="red" v-bind="attrs"
@click="removeModal(item.id)"
v-on="on">
<v-icon class="white--text mr-2 caption">fas fa-trash</v-icon>
<span>Remove</span>
</v-btn>
</template>
<span>Remove</span>
</v-tooltip>
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
<v-divider/>
<div v-if="lastPage > 1" class="text-xs-center">
<v-pagination v-model="currentPage" :length="lastPage" :total-visible="6"
color="black"/>
</div>
<v-layout align-center class="mt-3 px-3" justify-center row wrap>
<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 CSSD-font">Back</span>
</v-btn>
</router-link>
</v-layout>
</material-card>
</v-container>
</div>
</template> </template>
<script> <script>
@@ -183,148 +184,148 @@ import {mapMutations, mapGetters} from "vuex";
import toast from "@/services/global/toast.service"; import toast from "@/services/global/toast.service";
export default { export default {
metaInfo() { metaInfo() {
return { return {
title: this.$route.meta.title, title: this.$route.meta.title,
meta: this.$route.meta.metaTags || [] meta: this.$route.meta.metaTags || []
}
},
data: () => ({
headers: [
// {sortable: true,text: "ID",value: "id"},
{sortable: false, text: "ID", value: "id", width: '5%'},
{sortable: false, text: "Name", value: "name"},
{sortable: false, text: "Owner", value: "User"},
{sortable: false, text: "Hospital", value: "Hospital"},
{sortable: false, text: "UDI", value: "udi"},
{sortable: false, text: "Size", value: "size"},
{sortable: false, text: "Status", value: "status", width: '10%'},
{sortable: false, text: "Action", value: "action", align: "center", width: '20%'}
],
filter: {
name: '',
size: '',
item_id: '',
medical_center_id: ''
},
items: [],
currentPage: 1,
lastPage: 1,
medicalCenters: []
}),
created() {
this.load();
},
methods: {
...mapMutations("modal", ["changeCurrentModal", "closeModal"]),
async load(page = 1) {
let filter = '?';
for (const key in this.filter) {
if (this.filter.hasOwnProperty(key)) {
filter += `${key}=${this.filter[key]}&`;
}
}
filter += (page) ? `page=${page}` : `page=1`;
const result = await ApiService.get(urls.listItem(filter));
if (result && result.status == 200) {
this.items = result.data.data;
this.currentPage = result.data.meta.current_page;
this.lastPage = result.data.meta.last_page;
}
this.loadMedicalCenters();
},
async generateBarcode(item, type = null) {
let code = item.udi;
if (code) {
const result = await ApiService.post(urls.Barcode(item.id, type));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-barcode-barcode",
properties: {result, item},
});
}
} else {
toast.error('An error occurred while generating the barcode . please first set UDI');
}
},
async show(id) {
const result = await ApiService.get(urls.showItem(id));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-item-show",
properties: {result},
});
}
},
async download() {
const result = await ApiService.get(urls.exportItems());
if (result && result.status === 200) {
window.open(result.data.data.url, '_blank');
}
},
removeModal(id) {
this.changeCurrentModal({
modal: "modal-user-confirmation",
properties: {width: '30'},
success: async () => {
const result = await ApiService.delete(urls.removeItem(id));
if (result && result.status === 200) {
for (const key in this.items) {
if (this.items.hasOwnProperty(key) && this.items[key].id === id) {
this.items.splice(key, 1);
}
}
}
this.closeModal();
},
});
},
async loadMedicalCenters() {
const result = await ApiService.get(urls.listFilterItemsTestResult);
if (result && result.status === 200) {
this.medicalCenters = result.data.data.MedicalCenters;
}
},
getStatus(item) {
if (item.status === 'pending') {
return [
{status: 'approved', label: 'approve', color: 'cyan', font_color: 'white', icon: 'fa-check'},
{status: 'rejected', label: 'reject', color: 'light-gray', font_color: 'black', icon: 'fa-close'},
]
} else {
const nextStatus = item.status === 'rejected' ? 'approved' : 'rejected'
return [
{
status: nextStatus,
label: nextStatus === 'approved' ? 'approve' : 'reject',
color: nextStatus === 'approved' ? 'cyan' : 'light-gray',
font_color: nextStatus === 'approved' ? 'white' : 'black',
icon: nextStatus === 'approved' ? 'fa-check' : 'fa-close'
}
]
}
},
async changeStatus(item, status) {
const result = await ApiService.post(urls.changeItemStatus(item.id), {status})
if (result?.data?.data?.status) {
const newStatus = result.data.data.status
const target = this.items.find(i => i.id === item.id)
if (target) target.status = newStatus
}
},
async transfer(data) {
this.changeCurrentModal({
modal: "modal-user-list",
properties: {data, type: 'item'},
});
},
},
watch: {
currentPage(page) {
this.load(page);
},
} }
},
data: () => ({
headers: [
// {sortable: true,text: "ID",value: "id"},
{sortable: false, text: "ID", value: "id", width: '5%'},
{sortable: false, text: "Name", value: "name"},
{sortable: false, text: "Owner", value: "User"},
{sortable: false, text: "Hospital", value: "Hospital"},
{sortable: false, text: "UDI", value: "udi"},
{sortable: false, text: "Size", value: "size"},
{sortable: false, text: "Status", value: "status", width: '10%'},
{sortable: false, text: "Action", value: "action", align: "center", width: '20%'}
],
filter: {
name: '',
size: '',
item_id: '',
medical_center_id: ''
},
items: [],
currentPage: 1,
lastPage: 1,
medicalCenters: []
}),
created() {
this.load();
},
methods: {
...mapMutations("modal", ["changeCurrentModal", "closeModal"]),
async load(page = 1) {
let filter = '?';
for (const key in this.filter) {
if (this.filter.hasOwnProperty(key)) {
filter += `${key}=${this.filter[key]}&`;
}
}
filter += (page) ? `page=${page}` : `page=1`;
const result = await ApiService.get(urls.listItem(filter));
if (result && result.status == 200) {
this.items = result.data.data;
this.currentPage = result.data.meta.current_page;
this.lastPage = result.data.meta.last_page;
}
this.loadMedicalCenters();
},
async generateBarcode(item, type = null) {
let code = item.udi;
if (code) {
const result = await ApiService.post(urls.Barcode(item.id, type));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-barcode-barcode",
properties: {result, item},
});
}
} else {
toast.error('An error occurred while generating the barcode . please first set UDI');
}
},
async show(id) {
const result = await ApiService.get(urls.showItem(id));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-item-show",
properties: {result},
});
}
},
async download() {
const result = await ApiService.get(urls.exportItems());
if (result && result.status === 200) {
window.open(result.data.data.url, '_blank');
}
},
removeModal(id) {
this.changeCurrentModal({
modal: "modal-user-confirmation",
properties: {width: '30'},
success: async () => {
const result = await ApiService.delete(urls.removeItem(id));
if (result && result.status === 200) {
for (const key in this.items) {
if (this.items.hasOwnProperty(key) && this.items[key].id === id) {
this.items.splice(key, 1);
}
}
}
this.closeModal();
},
});
},
async loadMedicalCenters() {
const result = await ApiService.get(urls.listFilterItemsTestResult);
if (result && result.status === 200) {
this.medicalCenters = result.data.data.MedicalCenters;
}
},
getStatus(item) {
if (item.status === 'pending') {
return [
{status: 'approved', label: 'approve', color: 'cyan', font_color: 'white', icon: 'fa-check'},
{status: 'rejected', label: 'reject', color: 'light-gray', font_color: 'black', icon: 'fa-close'},
]
} else {
const nextStatus = item.status === 'rejected' ? 'approved' : 'rejected'
return [
{
status: nextStatus,
label: nextStatus === 'approved' ? 'approve' : 'reject',
color: nextStatus === 'approved' ? 'cyan' : 'light-gray',
font_color: nextStatus === 'approved' ? 'white' : 'black',
icon: nextStatus === 'approved' ? 'fa-check' : 'fa-close'
}
]
}
},
async changeStatus(item, status) {
const result = await ApiService.post(urls.changeItemStatus(item.id), {status})
if (result?.data?.data?.status) {
const newStatus = result.data.data.status
const target = this.items.find(i => i.id === item.id)
if (target) target.status = newStatus
}
},
async transfer(data) {
this.changeCurrentModal({
modal: "modal-user-list",
properties: {data, type: 'item'},
});
},
},
watch: {
currentPage(page) {
this.load(page);
},
}
}; };
</script> </script>
+162 -161
View File
@@ -1,79 +1,79 @@
<template> <template>
<v-form ref="form"> <v-form ref="form">
<v-container grid-list-xs fluid> <v-container fluid grid-list-xs>
<material-card color="black" title="Add Label on Set "> <material-card color="black" title="Add Label on Set ">
<v-layout wrap class="px-3 my-3"> <v-layout class="px-3 my-3" wrap>
<v-flex xs12 sm6 md4 lg3 class="WM-FlexCenter pl-3"> <v-flex class="WM-FlexCenter pl-3" lg3 md4 sm6 xs12>
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/> <v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/>
<v-text-field name="sterilizerId" label="Sterilizer ID" color="black" <v-text-field v-model="formData.sterilizer_id" class="py-3 pr-3" color="black"
v-model="formData.sterilizer_id" class="py-3 pr-3"/> label="Sterilizer ID" name="sterilizerId"/>
</v-flex> </v-flex>
<v-flex xs12 sm6 md4 lg3 class="WM-FlexCenter pl-3"> <v-flex class="WM-FlexCenter pl-3" lg3 md4 sm6 xs12>
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/> <v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/>
<v-text-field name="cycle_number" label="Preferred Cycle Number" color="black" <v-text-field v-model="formData.cycle_number" class="py-3 pr-3" color="black"
v-model="formData.cycle_number" label="Preferred Cycle Number"
class="py-3 pr-3"/> name="cycle_number"/>
</v-flex> </v-flex>
<v-flex xs12 sm6 md4 lg3 class="WM-FlexCenter pl-3"> <v-flex class="WM-FlexCenter pl-3" lg3 md4 sm6 xs12>
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/> <v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/>
<v-text-field name="lot_number" label="Lot Number" color="black" readonly v-model="lotNumber" <v-text-field v-model="lotNumber" class="py-3 pr-3" color="black" label="Lot Number" name="lot_number"
class="py-3 pr-3"/> readonly/>
</v-flex> </v-flex>
<v-spacer/> <v-spacer/>
<v-flex xs12 sm6 md4 lg3 class="WM-FlexCenter"> <v-flex class="WM-FlexCenter" lg3 md4 sm6 xs12>
<v-icon class="fas fa-check mr-2 WM-Margin-B-8"/> <v-icon class="fas fa-check mr-2 WM-Margin-B-8"/>
<v-autocomplete color="black" :items="items" item-text="name" v-model="formData.package_id" <v-autocomplete v-model="formData.package_id" :filter="customFilter" :items="items" class="py-3 pr-3"
item-value="id" label="Package ID" class="py-3 pr-3" :filter="customFilter"> color="black" item-text="name" item-value="id" label="Package ID">
<template v-slot:chip="{ item }"> <template v-slot:chip="{ item }">
{{ item.name }} - {{ item.id }} {{ item.name }} - {{ item.id }}
</template> </template>
<template v-slot:item="{ item }"> <template v-slot:item="{ item }">
{{ item.name }} - {{ item.id }} {{ item.name }} - {{ item.id }}
</template> </template>
</v-autocomplete> </v-autocomplete>
</v-flex> </v-flex>
<v-flex xs12 sm6 md4 lg3 class="WM-FlexCenter pl-3"> <v-flex class="WM-FlexCenter pl-3" lg3 md4 sm6 xs12>
<v-icon class="far fa-calendar-alt mr-2"/> <v-icon class="far fa-calendar-alt mr-2"/>
<v-menu lazy :close-on-content-click="true" transition="v-scale-transition" offset-y <v-menu v-model="fromMenuSterile" :close-on-content-click="true" lazy offset-y
v-model="fromMenuSterile" style="width: 100%"> style="width: 100%" transition="v-scale-transition">
<v-text-field required slot="activator" label="Sterile Date" color="black" class="pr-3" <v-text-field slot="activator" v-model="formData.sterile_date" class="pr-3" color="black" label="Sterile Date"
v-model="formData.sterile_date"/> required/>
<v-date-picker color="pink" :min="today" no-title v-model="formData.sterile_date" <v-date-picker v-model="formData.sterile_date" :date-format="date => new Date(date).toDateString()" :min="today" color="pink"
:date-format="date => new Date(date).toDateString()"/> no-title/>
</v-menu> </v-menu>
</v-flex> </v-flex>
<v-flex xs12 sm6 md4 lg3 class="WM-FlexCenter pl-3"> <v-flex class="WM-FlexCenter pl-3" lg3 md4 sm6 xs12>
<v-icon class="far fa-calendar-alt mr-2"/> <v-icon class="far fa-calendar-alt mr-2"/>
<v-menu lazy :close-on-content-click="true" transition="v-scale-transition" offset-y <v-menu v-model="fromMenuExpire" :close-on-content-click="true" lazy offset-y
v-model="fromMenuExpire" style="width: 100%"> style="width: 100%" transition="v-scale-transition">
<v-text-field required slot="activator" label="Expire Date" color="black" class="pr-3" <v-text-field slot="activator" v-model="formData.expire_date" class="pr-3" color="black" label="Expire Date"
v-model="formData.expire_date"/> required/>
<v-date-picker :show-current="showCurrent" :min="formData.sterile_date" color="pink" <v-date-picker v-model="formData.expire_date" :date-format="date => new Date(date).toDateString()" :min="formData.sterile_date"
no-title :show-current="showCurrent"
v-model="formData.expire_date" color="pink"
:date-format="date => new Date(date).toDateString()"/> no-title/>
</v-menu> </v-menu>
</v-flex> </v-flex>
</v-layout> </v-layout>
<v-layout row wrap justify-center align-center class="px-3"> <v-layout align-center class="px-3" justify-center row wrap>
<router-link :to="{ name: 'AllLabels' }"> <router-link :to="{ name: 'AllLabels' }">
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black"> <v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black">
<v-icon class="black--text">keyboard_arrow_left</v-icon> <v-icon class="black--text">keyboard_arrow_left</v-icon>
<span class="black--text">Back</span> <span class="black--text">Back</span>
</v-btn> </v-btn>
</router-link> </router-link>
<v-spacer/> <v-spacer/>
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px" @click="submitForm()"> <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> <v-icon class="white--text mr-2 caption">fas fa-check</v-icon>
<span class="white--text">SAVE</span> <span class="white--text">SAVE</span>
</v-btn> </v-btn>
</v-layout> </v-layout>
</material-card> </material-card>
</v-container> </v-container>
</v-form> </v-form>
</template> </template>
<script> <script>
@@ -82,106 +82,107 @@ import {urls} from "@/config/urls";
import toast from "@/services/global/toast.service"; import toast from "@/services/global/toast.service";
export default { export default {
metaInfo() { metaInfo() {
return { return {
title: this.$route.meta.title, title: this.$route.meta.title,
meta: this.$route.meta.metaTags || [] meta: this.$route.meta.metaTags || []
}
},
data() {
return {
showCurrent: false,
fromMenuSterile: false,
fromMenuExpire: false,
today: new Date().toISOString().split("T")[0],
formData: {
result: "",
package_id: "",
expire_date: null,
sterilizer_id: '',
cycle_number: '',
sterile_date: new Date().toISOString().substr(0, 10)
},
items: [],
rules: {
required: value => !!value || "Required.",
counter: value => !value || value.length == 0 || value.length >= 5 || "Min 5 characters"
}
};
},
created() {
this.loadItems();
if (this.$route.params.label) {
this.load(this.$route.params.label);
}
},
computed: {
lotNumber() {
return this.formData.sterilizer_id + ' - ' + this.formData.cycle_number;
}
},
methods: {
customFilter(item, queryText) {
const name = item.name.toLowerCase();
const udi = item.udi ? item.udi.toLowerCase() : null;
const searchText = queryText.toLowerCase();
if (udi) {
return name.indexOf(searchText) > -1 ||
udi.indexOf(searchText) > -1
}
return name.indexOf(searchText) > -1
},
async load(id) {
const result = await ApiService.get(urls.editLabel(id));
if (result && result.status == 200) {
this.formData = result.data.data;
const existingIds = this.items.map(i => i.id);
if (!existingIds.includes(this.formData.package_id)) {
this.items.push(this.formData.package);
}
console.log()
}
},
async loadItems() {
const result = await ApiService.get(urls.listAllPackage());
if (result && result.status == 200) {
this.items = result.data.data;
}
if (this.$route.query.packageId) {
this.formData.package_id = this.items.find((i) => i.id == this.$route.query.packageId);
if (!this.formData.package_id) {
toast.error('package is not in the list');
}
}
},
async submitForm() {
let result;
this.formData['lot_number'] = this.lotNumber;
if (this.$route.params.label) {
result = await ApiService.put(urls.updateLabel(this.$route.params.label), this.formData);
} else {
result = await ApiService.post(urls.storeLabel, this.formData);
}
if (result && result.status == 200) {
this.$router.push({name: 'AllLabels'});
}
}
} }
},
data() {
return {
showCurrent: false,
fromMenuSterile: false,
fromMenuExpire: false,
today: new Date().toISOString().split("T")[0],
formData: {
result: "",
package_id: "",
expire_date: null,
sterilizer_id: '',
cycle_number: '',
sterile_date: new Date().toISOString().substr(0, 10)
},
items: [],
rules: {
required: value => !!value || "Required.",
counter: value => !value || value.length == 0 || value.length >= 5 || "Min 5 characters"
}
};
},
created() {
this.loadItems();
if (this.$route.params.label) {
this.load(this.$route.params.label);
}
},
computed: {
lotNumber() {
return this.formData.sterilizer_id + ' - ' + this.formData.cycle_number;
}
},
methods: {
customFilter(item, queryText) {
const name = item.name.toLowerCase();
const udi = item.udi ? item.udi.toLowerCase() : null;
const searchText = queryText.toLowerCase();
if (udi) {
return name.indexOf(searchText) > -1 ||
udi.indexOf(searchText) > -1
}
return name.indexOf(searchText) > -1
},
async load(id) {
const result = await ApiService.get(urls.editLabel(id));
if (result && result.status === 200) {
this.formData = result.data.data;
console.log()
const existingIds = this.items.map(i => i.id);
if (!existingIds.includes(this.formData.package_id)) {
this.items.push(this.formData.package);
}
console.log()
}
},
async loadItems() {
const result = await ApiService.get(urls.listAllPackage());
if (result && result.status === 200) {
this.items = result.data.data;
}
if (this.$route.query.packageId) {
const p = this.items.find((i) => i.id == this.$route.query.packageId);
this.formData.package_id = p?.id;
if (!this.formData.package_id) {
toast.error('package is not in the list');
}
}
},
async submitForm() {
let result;
this.formData['lot_number'] = this.lotNumber;
if (this.$route.params.label) {
result = await ApiService.put(urls.updateLabel(this.$route.params.label), this.formData);
} else {
result = await ApiService.post(urls.storeLabel, this.formData);
}
if (result && result.status == 200) {
this.$router.push({name: 'AllLabels'});
}
}
}
}; };
</script> </script>
<style> <style>
.v-btn--floating { .v-btn--floating {
padding: 0 !important; padding: 0 !important;
} }
.theme--light.v-btn.v-btn--flat { .theme--light.v-btn.v-btn--flat {
color: rgba(0, 0, 0, .87) !important; color: rgba(0, 0, 0, .87) !important;
} }
.v-btn--floating, .v-btn--floating,
.v-btn--icon:before { .v-btn--icon:before {
border-radius: 50% !important; border-radius: 50% !important;
} }
</style> </style>
+4 -4
View File
@@ -42,11 +42,11 @@
</template> </template>
<span>Filter</span> <span>Filter</span>
</v-tooltip> </v-tooltip>
<!--
<v-btn class="WM-Outline-Btn WM-Border mr-2 WM-Margin-BT-0 WM-Border-Black" style="padding: 10px 30px;"> <v-btn class="WM-Outline-Btn WM-Border mr-2 WM-Margin-BT-0 WM-Border-Black" style="padding: 10px 30px;">
<v-icon class="black--text mr-2 caption">fas fa-share-square</v-icon> <v-icon class="black&#45;&#45;text mr-2 caption">fas fa-share-square</v-icon>
<span class="black--text">EXPORT</span> <span class="black&#45;&#45;text">EXPORT</span>
</v-btn> </v-btn>-->
<router-link :to="{ name: 'AddLabel' }"> <router-link :to="{ name: 'AddLabel' }">
<v-btn class="WM-CyanBlueGradient-BG WM-Margin-BT-0" style="padding:10px 30px"> <v-btn class="WM-CyanBlueGradient-BG WM-Margin-BT-0" style="padding:10px 30px">
+312 -311
View File
@@ -1,172 +1,172 @@
<template> <template>
<div class> <div class>
<v-container fluid> <v-container fluid>
<material-card class color="black" title="My Items" text> <material-card class color="black" text title="My Items">
<v-layout align-center wrap class="px-3"> <v-layout align-center class="px-3" wrap>
<v-flex xs12 sm4 md4 lg2 xl1 class="WM-FlexCenter"> <!-- <v-flex xs12 sm4 md4 lg2 xl1 class="WM-FlexCenter">
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/> <v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/>
<v-text-field class="pt-3 pr-3" v-model="filter.item_id" label="Item ID" <v-text-field class="pt-3 pr-3" v-model="filter.item_id" label="Item ID"
color="black"/> color="black"/>
</v-flex> </v-flex>-->
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter"> <v-flex class="WM-FlexCenter" lg2 md3 sm4 xl1 xs12>
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/> <v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/>
<v-text-field class="pt-3 pr-3" v-model="filter.name" label="Name" color="black"/> <v-text-field v-model="filter.udi" class="pt-3 pr-3" color="black" label="UDI"/>
</v-flex> </v-flex>
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter" v-if="$hasRole('Admin')"> <v-flex class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
<v-icon class="fa fa-hospital-o mr-2 WM-Margin-B-8"/> <v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/>
<v-autocomplete class="pt-3 pr-3" v-model="filter.medical_center_id" item-text="name" <v-text-field v-model="filter.name" class="pt-3 pr-3" color="black" label="Name"/>
item-value="id" label="Hospital" color="black" :items="medicalCenters" </v-flex>
:clearable="true"/> <v-flex v-if="$hasRole('Admin')" class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
</v-flex> <v-icon class="fa fa-hospital-o mr-2 WM-Margin-B-8"/>
<v-flex xs12 sm4 md4 lg2 xl1 class="WM-FlexCenter"> <v-autocomplete v-model="filter.medical_center_id" :clearable="true" :items="medicalCenters"
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/> class="pt-3 pr-3" color="black" item-text="name" item-value="id"
<v-text-field class="pt-3 pr-3" v-model="filter.size" label="Size" color="black"/> label="Hospital"/>
</v-flex> </v-flex>
<v-flex xs12 sm4 md3 lg2 xl1 class="WM-FlexCenter"> <v-flex class="WM-FlexCenter" lg2 md4 sm4 xl1 xs12>
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/> <v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/>
<v-text-field class="pt-3 pr-3" v-model="filter.udi" label="UDI" color="black"/> <v-text-field v-model="filter.size" class="pt-3 pr-3" color="black" label="Size"/>
</v-flex> </v-flex>
<!--btn--> <!--btn-->
<v-spacer/> <v-spacer/>
<v-flex xs12 sm6 md6 lg2 xl3 class="WM-Align-R"> <v-flex class="WM-Align-R" lg2 md6 sm6 xl3 xs12>
<v-tooltip bottom open-on-hover> <v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<v-btn v-bind="attrs" v-on="on" <v-btn color="WM-Tooltip-Btn WM-Outline-Btn WM-Border WM-Margin-BT-0 WM-Border-Black mr-2" v-bind="attrs"
color="WM-Tooltip-Btn WM-Outline-Btn WM-Border WM-Margin-BT-0 WM-Border-Black mr-2" @click="load()"
@click="load()"> v-on="on">
<v-icon class="black--text caption">fas fa-search</v-icon> <v-icon class="black--text caption">fas fa-search</v-icon>
</v-btn> </v-btn>
</template> </template>
<span>Filter</span> <span>Filter</span>
</v-tooltip> </v-tooltip>
<!-- <v-btn class="WM-Outline-Btn WM-Border mr-2 WM-Margin-BT-0 WM-Border-Black" style="padding: 10px 30px;"> <!-- <v-btn class="WM-Outline-Btn WM-Border mr-2 WM-Margin-BT-0 WM-Border-Black" style="padding: 10px 30px;">
<v-icon class="black&#45;&#45;text mr-2 caption">fas fa-share-square</v-icon> <v-icon class="black&#45;&#45;text mr-2 caption">fas fa-share-square</v-icon>
<span class="black&#45;&#45;text">EXPORT</span> <span class="black&#45;&#45;text">EXPORT</span>
</v-btn>--> </v-btn>-->
<router-link :to="{ name: 'AddItem' }"> <router-link :to="{ name: 'AddItem' }">
<v-btn class="WM-CyanBlueGradient-BG WM-Margin-BT-0" style="padding:10px 30px"> <v-btn class="WM-CyanBlueGradient-BG WM-Margin-BT-0" style="padding:10px 30px">
<v-icon class="white--text mr-2 caption">fas fa-plus</v-icon> <v-icon class="white--text mr-2 caption">fas fa-plus</v-icon>
<span class="white--text">Add</span> <span class="white--text">Add</span>
</v-btn> </v-btn>
</router-link> </router-link>
</v-flex> </v-flex>
</v-layout> </v-layout>
<v-layout class="px-3 my-3"> <v-layout class="px-3 my-3">
<v-divider/> <v-divider/>
</v-layout> </v-layout>
<v-layout align-center wrap class="my-3 px-3" v-if="getMyItems"> <v-layout v-if="getMyItems" align-center class="my-3 px-3" wrap>
<v-flex md12> <v-flex md12>
<v-data-table :headers="headers" :items="getMyItems" hide-actions> <v-data-table :headers="headers" :items="getMyItems" hide-actions>
<template slot="headerCell" slot-scope="{ header }"> <template slot="headerCell" slot-scope="{ header }">
<span class="subheading font-weight-light text-white text--darken-3" <span class="subheading font-weight-light text-white text--darken-3"
v-text="header.text"/> v-text="header.text"/>
</template> </template>
<template slot="items" slot-scope="{ item }"> <template slot="items" slot-scope="{ item }">
<td class="title font-weight-light">{{ item.id }}</td> <td class="title font-weight-light">{{ item.id }}</td>
<!-- <td class="title font-weight-light">{{ item.unique_id }}</td> --> <!-- <td class="title font-weight-light">{{ item.unique_id }}</td> -->
<td class="title font-weight-light">{{ item.name }}</td> <td class="title font-weight-light">{{ item.name }}</td>
<td class="title font-weight-light"> <td class="title font-weight-light">
{{ item.user ? item.user.name : '' | text_20_letter }} {{ item.user ? item.user.name : '' | text_20_letter }}
</td> </td>
<td class="title font-weight-light">{{ item.udi }}</td> <td class="title font-weight-light">{{ item.udi }}</td>
<td class="title font-weight-light">{{ item.size }}</td> <td class="title font-weight-light">{{ item.size }}</td>
<td class="title font-weight-light">{{ item.status }}</td> <td class="title font-weight-light">{{ item.status }}</td>
<td class="title font-weight-light">{{ item.package_id }}</td> <td class="title font-weight-light">{{ item.package_id }}</td>
<td class="text-xs-right FlexBtn Height-MD-60 justify-self-end"> <td class="text-xs-right FlexBtn Height-MD-60 justify-self-end">
<template v-if="$hasRole('Admin|Supervisor')"> <template v-if="$hasRole('Admin|Supervisor')">
<v-tooltip v-for="status in getStatus(item)" :key="status.label" bottom <v-tooltip v-for="status in getStatus(item)" :key="status.label" bottom
open-on-hover> open-on-hover>
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<v-btn :color="status.color" class="mr-2" <v-btn :color="status.color" class="mr-2"
@click="changeStatus(item, status.status)" v-bind="attrs" v-bind="attrs" @click="changeStatus(item, status.status)"
v-on="on"> v-on="on">
<v-icon :class="`${status.font_color}--text mr-1 caption`"> <v-icon :class="`${status.font_color}--text mr-1 caption`">
fas {{ status.icon }} fas {{ status.icon }}
</v-icon> </v-icon>
<span>{{ status.label }}</span> <span>{{ status.label }}</span>
</v-btn>
</template>
<span>{{ status.label }}</span>
</v-tooltip>
</template>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn v-bind="attrs" v-on="on" color="light-gray" class="mr-2"
@click="show(item.id)">
<v-icon class="black--text mr-1 caption">fas fa-eye</v-icon>
<span>Show</span>
</v-btn>
</template>
<span>Show</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn class="mr-2" v-bind="attrs" v-on="on" color="light-gray"
@click="generateBarcode(item, 'Item')">
<v-icon class="black--text mr-2 caption">fas fa-barcode</v-icon>
<span class="CSSD-font">Generate Barcode</span>
</v-btn>
</template>
<span>Generate Barcode</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }" v-if="!(item.package_id) && item.status ==='approved'">
<v-btn class="mr-2" v-bind="attrs" v-on="on" color="light-gray"
@click="transfer(item)">
<v-icon class="black--text mr-2 caption">fas fa-exchange-alt</v-icon>
<span class="CSSD-font">Transfer</span>
</v-btn>
</template>
<span>Transfer</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<router-link class="LinkBtn"
v-if="$hasRole('Admin|Supervisor') ||( item.user_id == $store.state.user.id && !['approved', 'rejected'].includes(item.status))"
:to="{ name: 'EditItem', params: { Item: item.id } }">
<v-btn v-bind="attrs" v-on="on" color="black" class="mr-2">
<v-icon class="white--text mr-1 caption">fas fa-pen</v-icon>
<span>Edit</span>
</v-btn>
</router-link>
</template>
<span>Edit</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn v-bind="attrs" v-on="on" color="red" class="WM-ActionButton mr-2"
@click="removeModal(item.id)"
v-if="$hasRole('Admin|Supervisor') ||( item.user_id == $store.state.user.id && !['approved', 'rejected'].includes(item.status))">
<v-icon class="white--text mr-2 caption">fas fa-trash</v-icon>
<span>Remove</span>
</v-btn>
</template>
<span>Remove</span>
</v-tooltip>
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
<v-divider/>
<div class="text-xs-center" v-if="lastPage > 1">
<v-pagination color="black" v-model="currentPage" :length="lastPage" :total-visible="6"/>
</div>
<v-layout row wrap align-center class="px-3 mt-3">
<router-link to="/dashboard">
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black">
<v-icon class="black--text mr-2 caption">fas fa-chevron-left</v-icon>
<span class="black--text CSSD-font">Back</span>
</v-btn> </v-btn>
</router-link> </template>
<v-spacer/> <span>{{ status.label }}</span>
</v-layout> </v-tooltip>
</material-card> </template>
</v-container> <v-tooltip bottom open-on-hover>
</div> <template v-slot:activator="{ on, attrs }">
<v-btn class="mr-2" color="light-gray" v-bind="attrs" @click="show(item.id)"
v-on="on">
<v-icon class="black--text mr-1 caption">fas fa-eye</v-icon>
<span>Show</span>
</v-btn>
</template>
<span>Show</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn class="mr-2" color="light-gray" v-bind="attrs" @click="generateBarcode(item, 'Item')"
v-on="on">
<v-icon class="black--text mr-2 caption">fas fa-barcode</v-icon>
<span class="CSSD-font">Generate Barcode</span>
</v-btn>
</template>
<span>Generate Barcode</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-if="!(item.package_id) && item.status ==='approved'" v-slot:activator="{ on, attrs }">
<v-btn class="mr-2" color="light-gray" v-bind="attrs" @click="transfer(item)"
v-on="on">
<v-icon class="black--text mr-2 caption">fas fa-exchange-alt</v-icon>
<span class="CSSD-font">Transfer</span>
</v-btn>
</template>
<span>Transfer</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<router-link v-if="$hasRole('Admin|Supervisor') ||( item.user_id == $store.state.user.id && !['approved', 'rejected'].includes(item.status))"
:to="{ name: 'EditItem', params: { Item: item.id } }"
class="LinkBtn">
<v-btn class="mr-2" color="black" v-bind="attrs" v-on="on">
<v-icon class="white--text mr-1 caption">fas fa-pen</v-icon>
<span>Edit</span>
</v-btn>
</router-link>
</template>
<span>Edit</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn v-if="$hasRole('Admin|Supervisor') ||( item.user_id == $store.state.user.id && !['approved', 'rejected'].includes(item.status))" class="WM-ActionButton mr-2" color="red" v-bind="attrs"
@click="removeModal(item.id)"
v-on="on">
<v-icon class="white--text mr-2 caption">fas fa-trash</v-icon>
<span>Remove</span>
</v-btn>
</template>
<span>Remove</span>
</v-tooltip>
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
<v-divider/>
<div v-if="lastPage > 1" class="text-xs-center">
<v-pagination v-model="currentPage" :length="lastPage" :total-visible="6" color="black"/>
</div>
<v-layout align-center class="px-3 mt-3" row wrap>
<router-link to="/dashboard">
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black">
<v-icon class="black--text mr-2 caption">fas fa-chevron-left</v-icon>
<span class="black--text CSSD-font">Back</span>
</v-btn>
</router-link>
<v-spacer/>
</v-layout>
</material-card>
</v-container>
</div>
</template> </template>
<script> <script>
import {ApiService} from "@/services"; import {ApiService} from "@/services";
@@ -175,153 +175,154 @@ import {mapMutations, mapGetters, mapActions} from "vuex";
import toast from "@/services/global/toast.service"; import toast from "@/services/global/toast.service";
export default { export default {
metaInfo() { metaInfo() {
return { return {
title: this.$route.meta.title, title: this.$route.meta.title,
meta: this.$route.meta.metaTags || [] meta: this.$route.meta.metaTags || []
}
},
data: () => ({
headers: [
// {sortable: true,text: "ID",value: "id"},
{sortable: false, text: "ID", value: "id"},
{sortable: false, text: "Name", value: "name"},
{sortable: false, text: "Owner", value: "User"},
{sortable: false, text: "UDI", value: "udi"},
{sortable: false, text: "Size", value: "size"},
{sortable: false, text: "Status", value: "status", width: '10%'},
{sortable: false, text: "Action", value: "action", align: "center", width: '20%'}
],
filter: {
name: '',
size: '',
item_id: '',
medical_center_id: ''
},
medicalCenters: []
}),
async created() {
this.loadMyItem();
this.loadMedicalCenters();
},
computed: {
...mapGetters('myItems', ["getFilters", 'getMyItems', 'getCurrentPage', 'getLastPage']),
items() {
return this.getMyItems;
},
currentPage: {
get() {
return this.getCurrentPage;
},
set(val) {
this.$store.commit('myItems/SET_MY_ITEMS_CURRENT_PAGE', val);
this.$store.dispatch('myItems/loadMyItem', val);
}
},
lastPage() {
return this.getLastPage;
}
},
methods: {
...mapMutations('myItems', ["SET_FILTER"]),
...mapMutations("modal", ["changeCurrentModal", 'closeModal']),
...mapActions('myItems', ['loadMyItem', 'removeItem', 'showItem', 'generateBarcode']),
onFilterClick() {
this.loadMyItem();
},
updateFilter(key, value) {
this.SET_FILTER({key, value});
},
async transfer(data) {
this.changeCurrentModal({
modal: "modal-user-list",
properties: {data, type: 'item'},
});
},
async generateBarcode(item, type = null) {
let code = item.udi;
if (code) {
const result = await ApiService.post(urls.Barcode(item.id, type));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-barcode-barcode",
properties: {result, item},
});
}
} else {
toast.error('An error occurred while generating the barcode . please first set UDI');
}
},
async show(testResultId) {
const result = await ApiService.get(
urls.showItem(testResultId)
);
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-item-show",
properties: {result},
});
}
},
removeModal(id) {
this.changeCurrentModal({
modal: "modal-user-confirmation",
properties: {width: '30'},
success: async () => {
const result = await ApiService.delete(urls.removeItem(id));
if (result && result.status == 200) {
for (const key in this.items) {
if (this.items.hasOwnProperty(key) && this.items[key].id == id) {
this.items.splice(key, 1);
}
}
}
this.closeModal();
},
});
},
async loadMedicalCenters() {
const result = await ApiService.get(urls.listFilterItemsTestResult);
if (result && result.status == 200) {
this.medicalCenters = result.data.data.MedicalCenters;
}
},
getStatus(item) {
if (item.status === 'pending') {
return [
{status: 'approved', label: 'approve', color: 'cyan', font_color: 'white', icon: 'fa-check'},
{status: 'rejected', label: 'reject', color: 'light-gray', font_color: 'black', icon: 'fa-close'},
]
} else {
const nextStatus = item.status === 'rejected' ? 'approved' : 'rejected'
return [
{
status: nextStatus,
label: nextStatus === 'approved' ? 'approve' : 'reject',
color: nextStatus === 'approved' ? 'cyan' : 'light-gray',
font_color: nextStatus === 'approved' ? 'white' : 'black',
icon: nextStatus === 'approved' ? 'fa-check' : 'fa-close'
}
]
}
},
async changeStatus(item, status) {
const result = await ApiService.post(urls.changeItemStatus(item.id), {status})
if (result?.data?.data?.status) {
const newStatus = result.data.data.status
const target = this.items.find(i => i.id === item.id)
if (target) target.status = newStatus
}
}
},
watch: {
currentPage(page) {
this.$store.dispatch('myItems/loadMyItem', page);
}
} }
},
data: () => ({
headers: [
// {sortable: true,text: "ID",value: "id"},
{sortable: false, text: "ID", value: "id"},
{sortable: false, text: "Name", value: "name"},
{sortable: false, text: "Owner", value: "User"},
{sortable: false, text: "UDI", value: "udi"},
{sortable: false, text: "Size", value: "size"},
{sortable: false, text: "Status", value: "status", width: '10%'},
{sortable: false, text: "Package ID", value: "package_id", width: '10%'},
{sortable: false, text: "Action", value: "action", align: "center", width: '20%'}
],
filter: {
name: '',
size: '',
item_id: '',
medical_center_id: ''
},
medicalCenters: []
}),
async created() {
this.loadMyItem();
this.loadMedicalCenters();
},
computed: {
...mapGetters('myItems', ["getFilters", 'getMyItems', 'getCurrentPage', 'getLastPage']),
items() {
return this.getMyItems;
},
currentPage: {
get() {
return this.getCurrentPage;
},
set(val) {
this.$store.commit('myItems/SET_MY_ITEMS_CURRENT_PAGE', val);
this.$store.dispatch('myItems/loadMyItem', val);
}
},
lastPage() {
return this.getLastPage;
}
},
methods: {
...mapMutations('myItems', ["SET_FILTER"]),
...mapMutations("modal", ["changeCurrentModal", 'closeModal']),
...mapActions('myItems', ['loadMyItem', 'removeItem', 'showItem', 'generateBarcode']),
onFilterClick() {
this.loadMyItem();
},
updateFilter(key, value) {
this.SET_FILTER({key, value});
},
async transfer(data) {
this.changeCurrentModal({
modal: "modal-user-list",
properties: {data, type: 'item'},
});
},
async generateBarcode(item, type = null) {
let code = item.udi;
if (code) {
const result = await ApiService.post(urls.Barcode(item.id, type));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-barcode-barcode",
properties: {result, item},
});
}
} else {
toast.error('An error occurred while generating the barcode . please first set UDI');
}
},
async show(testResultId) {
const result = await ApiService.get(
urls.showItem(testResultId)
);
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-item-show",
properties: {result},
});
}
},
removeModal(id) {
this.changeCurrentModal({
modal: "modal-user-confirmation",
properties: {width: '30'},
success: async () => {
const result = await ApiService.delete(urls.removeItem(id));
if (result && result.status == 200) {
for (const key in this.items) {
if (this.items.hasOwnProperty(key) && this.items[key].id == id) {
this.items.splice(key, 1);
}
}
}
this.closeModal();
},
});
},
async loadMedicalCenters() {
const result = await ApiService.get(urls.listFilterItemsTestResult);
if (result && result.status == 200) {
this.medicalCenters = result.data.data.MedicalCenters;
}
},
getStatus(item) {
if (item.status === 'pending') {
return [
{status: 'approved', label: 'approve', color: 'cyan', font_color: 'white', icon: 'fa-check'},
{status: 'rejected', label: 'reject', color: 'light-gray', font_color: 'black', icon: 'fa-close'},
]
} else {
const nextStatus = item.status === 'rejected' ? 'approved' : 'rejected'
return [
{
status: nextStatus,
label: nextStatus === 'approved' ? 'approve' : 'reject',
color: nextStatus === 'approved' ? 'cyan' : 'light-gray',
font_color: nextStatus === 'approved' ? 'white' : 'black',
icon: nextStatus === 'approved' ? 'fa-check' : 'fa-close'
}
]
}
},
async changeStatus(item, status) {
const result = await ApiService.post(urls.changeItemStatus(item.id), {status})
if (result?.data?.data?.status) {
const newStatus = result.data.data.status
const target = this.items.find(i => i.id === item.id)
if (target) target.status = newStatus
}
}
},
watch: {
currentPage(page) {
this.$store.dispatch('myItems/loadMyItem', page);
}
}
}; };
</script> </script>
+107 -63
View File
@@ -1,63 +1,63 @@
<template> <template>
<v-container fluid> <v-container fluid>
<material-card class color="black" title="All Test Result" text> <material-card class color="black" text title="All Test Result">
<v-layout align-center wrap class="px-3"> <v-layout align-center class="px-3" wrap>
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter"> <v-flex class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/> <v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/>
<v-text-field class="pt-3 pr-3" v-model="filter.device_id" label="ID" <v-text-field v-model="filter.device_id" class="pt-3 pr-3" color="black"
color="black"/> label="ID"/>
</v-flex> </v-flex>
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter"> <v-flex class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/> <v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/>
<v-autocomplete :items="deviceLabels" item-text="name" item-value="id" <v-autocomplete v-model="filter.device_label" :clearable="true" :items="deviceLabels"
v-model="filter.device_label" label="ID Label" color="black" class="pt-3 pr-3" class="pt-3 pr-3" color="black" item-text="name" item-value="id"
:clearable="true"/> label="ID Label"/>
</v-flex> </v-flex>
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter"> <v-flex class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/> <v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/>
<v-autocomplete class="pt-3 pr-3" v-model="filter.testType_id" label="TestType Name" <v-autocomplete v-model="filter.testType_id" :items="testTypes" class="pt-3 pr-3"
color="black" :items="testTypes" item-text="name" item-value="id"/> color="black" item-text="name" item-value="id" label="TestType Name"/>
</v-flex> </v-flex>
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter"> <v-flex class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
<v-icon class="fa fa-hospital-o mr-2 WM-Margin-B-8"/> <v-icon class="fa fa-hospital-o mr-2 WM-Margin-B-8"/>
<v-autocomplete class="pt-3 pr-3" v-model="filter.medicalCenter_id" label="Hospital" <v-autocomplete v-model="filter.medicalCenter_id" :clearable="true" :items="medicalCenters"
color="black" :items="medicalCenters" item-text="name" item-value="id" class="pt-3 pr-3" color="black" item-text="name" item-value="id"
:clearable="true"/> label="Hospital"/>
</v-flex> </v-flex>
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter"> <v-flex class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/> <v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/>
<v-text-field class="pt-3 pr-3" v-model="filter.user_name" label="User Name" <v-text-field v-model="filter.user_name" class="pt-3 pr-3" color="black"
color="black"/> label="User Name"/>
</v-flex> </v-flex>
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter"> <v-flex class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
<v-icon class="far fa-calendar-alt mr-2"/> <v-icon class="far fa-calendar-alt mr-2"/>
<v-menu class="pr-3" lazy :close-on-content-click="true" transition="v-scale-transition" <v-menu v-model="fromMenu" :close-on-content-click="true" class="pr-3" lazy
offset-y offset-y
v-model="fromMenu" style="width: 100%"> style="width: 100%" transition="v-scale-transition">
<v-text-field class="pt-3 pr-3" required slot="activator" label="FromDate" <v-text-field slot="activator" v-model="filter.fromPicker" class="pt-3 pr-3" color="black"
v-model="filter.fromPicker" color="black"/> label="FromDate" required/>
<v-date-picker color="pink" no-title v-model="filter.fromPicker" <v-date-picker v-model="filter.fromPicker" :date-format="date => new Date(date).toDateString()" color="pink"
:date-format="date => new Date(date).toDateString()"/> no-title/>
</v-menu> </v-menu>
</v-flex> </v-flex>
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter" style="display: flex;align-items: center;"> <v-flex class="WM-FlexCenter" lg3 md4 sm4 style="display: flex;align-items: center;" xl2 xs12>
<v-icon class="far fa-calendar-alt mr-2"/> <v-icon class="far fa-calendar-alt mr-2"/>
<v-menu class="pr-3" lazy :close-on-content-click="true" transition="v-scale-transition" <v-menu v-model="upToMenu" :close-on-content-click="true" class="pr-3" lazy
offset-y offset-y
v-model="upToMenu" style="width: 100%"> style="width: 100%" transition="v-scale-transition">
<v-text-field class="pt-3 pr-3" required slot="activator" label="UpToDate" color="black" <v-text-field slot="activator" v-model="filter.upToPicker" class="pt-3 pr-3" color="black" label="UpToDate"
v-model="filter.upToPicker"/> required/>
<v-date-picker color="pink" no-title v-model="filter.upToPicker" <v-date-picker v-model="filter.upToPicker" :date-format="date => new Date(date).toDateString()" color="pink"
:date-format="date => new Date(date).toDateString()"/> no-title/>
</v-menu> </v-menu>
</v-flex> </v-flex>
<v-spacer/> <v-spacer/>
<v-flex xs12 sm6 md6 lg12 xl3 class="WM-Align-R"> <v-flex class="WM-Align-R" lg12 md6 sm6 xl3 xs12>
<v-tooltip bottom open-on-hover> <v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<v-btn v-bind="attrs" v-on="on" <v-btn color="WM-Tooltip-Btn WM-Outline-Btn WM-Border WM-Margin-BT-0 WM-Border-Black mr-2" v-bind="attrs"
color="WM-Tooltip-Btn WM-Outline-Btn WM-Border WM-Margin-BT-0 WM-Border-Black mr-2" @click="load(null, null)"
@click="load(null, null)"> v-on="on">
<v-icon class="black--text caption">fas fa-search</v-icon> <v-icon class="black--text caption">fas fa-search</v-icon>
</v-btn> </v-btn>
</template> </template>
@@ -75,7 +75,7 @@
<v-layout class="px-3 my-3"> <v-layout class="px-3 my-3">
<v-divider/> <v-divider/>
</v-layout> </v-layout>
<v-layout align-center wrap class="px-3 my-2"> <v-layout align-center class="px-3 my-2" wrap>
<v-flex md12> <v-flex md12>
<v-data-table :headers="headers" :items="items" hide-actions> <v-data-table :headers="headers" :items="items" hide-actions>
<template slot="headerCell" slot-scope="{ header }"> <template slot="headerCell" slot-scope="{ header }">
@@ -91,27 +91,43 @@
<td class="title font-weight-light">{{ item.user.medical_center.name }}</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.user.name }}</td>
<td class="title font-weight-light"> <td class="title font-weight-light">
<span v-if="item.result == 'Reject'" class="ResultMsg Reject"> <span v-if="item.result == 'Reject'" class="ResultMsg Reject">
{{ item.result }} {{ item.result }}
</span> </span>
<span v-else-if="item.result == 'Accept'" class="ResultMsg Accept"> <span v-else-if="item.result == 'Accept'" class="ResultMsg Accept">
{{ item.result }} {{ item.result }}
</span> </span>
</td> </td>
<td class="headline font-weight-light">{{ $d(new Date(item.created_at), 'long') }}</td> <td class="headline font-weight-light">{{ $d(new Date(item.created_at), 'long') }}</td>
<td class="title font-weight-light text-center"> <td class="title font-weight-light text-center">
<span v-if="item.verified == 'NotVerified'" class="NotVerified"> <span v-if="item.verified == 'NotVerified'" class="NotVerified">
<v-icon class="caption fa fa-times NotVerified"/> <v-icon class="caption fa fa-times NotVerified"/>
</span> </span>
<span v-if="item.verified == 'Verified'" class=""> <span v-if="item.verified == 'Verified'" class="">
<v-icon class="caption fa fa-check Verified"/> <v-icon class="caption fa fa-check Verified"/>
</span> </span>
<!-- {{ item.verified }} --> <!-- {{ item.verified }} -->
</td> </td>
<td class="text-xs-right FlexBtn justify-self-end"> <td class="text-xs-right FlexBtn justify-self-end">
<template v-if="$hasRole('Admin|Supervisor')">
<v-tooltip v-for="status in getStatus(item)" :key="status.label" bottom
open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn :color="status.color" class="mr-2"
@click="changeStatus(item, status.status)" v-bind="attrs"
v-on="on">
<v-icon :class="`${status.font_color}--text mr-1 caption`">
fas {{ status.icon }}
</v-icon>
<span>{{ status.label }}</span>
</v-btn>
</template>
<span>{{ status.label }}</span>
</v-tooltip>
</template>
<v-tooltip bottom open-on-hover> <v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<v-btn color="light-gray" class="mr-2" @click="show(item.id)" v-bind="attrs" <v-btn class="mr-2" color="light-gray" v-bind="attrs" @click="show(item.id)"
v-on="on"> v-on="on">
<v-icon class="black--text mr-1 caption">fas fa-eye</v-icon> <v-icon class="black--text mr-1 caption">fas fa-eye</v-icon>
<span>Show</span> <span>Show</span>
@@ -121,8 +137,8 @@
</v-tooltip> </v-tooltip>
<v-tooltip bottom open-on-hover> <v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<v-btn color="light-gray" class="mr-2" <v-btn class="mr-2" color="light-gray"
@click="generateBarcode(item.id, 'TestResult')" v-bind="attrs" v-bind="attrs" @click="generateBarcode(item.id, 'TestResult')"
v-on="on"> v-on="on">
<v-icon class="black--text mr-1 caption">fa fa-bars</v-icon> <v-icon class="black--text mr-1 caption">fa fa-bars</v-icon>
<span>generate Barcode</span> <span>generate Barcode</span>
@@ -133,10 +149,10 @@
<v-tooltip bottom open-on-hover> <v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<!-- v-if="$hasRole('Admin') || item.user_id == $store.state.user.id" --> <!-- v-if="$hasRole('Admin') || item.user_id == $store.state.user.id" -->
<router-link class="LinkBtn" <router-link v-if="$hasRole('Admin') || (item.user_id == $store.state.user.id && item.verified == 'None')"
v-if="$hasRole('Admin') || (item.user_id == $store.state.user.id && item.verified == 'None')" :to="{ name: 'EditTestResult', params: { testResult: item.id } }"
:to="{ name: 'EditTestResult', params: { testResult: item.id } }"> class="LinkBtn">
<v-btn color="black" class="mr-2" v-bind="attrs" v-on="on"> <v-btn class="mr-2" color="black" v-bind="attrs" v-on="on">
<v-icon class="white--text mr-1 caption">fas fa-pen</v-icon> <v-icon class="white--text mr-1 caption">fas fa-pen</v-icon>
<span>Edit</span> <span>Edit</span>
</v-btn> </v-btn>
@@ -147,9 +163,9 @@
<v-tooltip bottom open-on-hover> <v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }"> <template v-slot:activator="{ on, attrs }">
<!-- v-if="$hasRole('Admin') || item.user_id == $store.state.user.id" --> <!-- v-if="$hasRole('Admin') || item.user_id == $store.state.user.id" -->
<v-btn color="red" class="WM-ActionButton" @click="removeModal(item.id)" <v-btn v-if="$hasRole('Admin') || (item.user_id == $store.state.user.id && item.verified == 'None')" class="WM-ActionButton" color="red"
v-if="$hasRole('Admin') || (item.user_id == $store.state.user.id && item.verified == 'None')" v-bind="attrs"
v-bind="attrs" v-on="on"> @click="removeModal(item.id)" v-on="on">
<v-icon class="white--text mr-2 caption">fas fa-trash</v-icon> <v-icon class="white--text mr-2 caption">fas fa-trash</v-icon>
<span>Remove</span> <span>Remove</span>
</v-btn> </v-btn>
@@ -162,11 +178,11 @@
</v-flex> </v-flex>
</v-layout> </v-layout>
<v-divider/> <v-divider/>
<div class="text-xs-center mt-2" v-if="lastPage > 1"> <div v-if="lastPage > 1" class="text-xs-center mt-2">
<v-pagination color="black" v-model="currentPage" :length="lastPage" <v-pagination v-model="currentPage" :length="lastPage" :total-visible="6"
:total-visible="6"/> color="black"/>
</div> </div>
<v-layout row wrap align-center justify-center class="px-3"> <v-layout align-center class="px-3" justify-center row wrap>
<router-link to="/dashboard"> <router-link to="/dashboard">
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black"> <v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black">
<v-icon class="black--text mr-2 caption">fas fa-chevron-left</v-icon> <v-icon class="black--text mr-2 caption">fas fa-chevron-left</v-icon>
@@ -314,7 +330,35 @@ export default {
} }
}); });
} }
} },
getStatus(item) {
if (item.verified === 'None') {
return [
{status: 'Verified', label: 'Verified', color: 'cyan', font_color: 'white', icon: 'fa-check'},
{status: 'NotVerified', label: 'NotVerified', color: 'light-gray', font_color: 'black', icon: 'fa-close'},
]
} else {
const nextStatus = item.verified === 'NotVerified' ? 'Verified' : 'NotVerified'
return [
{
status: nextStatus,
label: nextStatus === 'Verified' ? 'approve' : 'NotVerified',
color: nextStatus === 'Verified' ? 'cyan' : 'light-gray',
font_color: nextStatus === 'Verified' ? 'white' : 'black',
icon: nextStatus === 'Verified' ? 'fa-check' : 'fa-close'
}
]
}
},
async changeStatus(item, status) {
const result = await ApiService.post(urls.verifyTestResult(item.id,status))
if (result?.data?.data?.verified) {
const newStatus = result.data.data.verified
const target = this.items.find(i => i.id === item.id)
if (target) target.verified = newStatus
}
},
}, },
computed: { computed: {
...mapGetters("modal", ["getModalResult"]) ...mapGetters("modal", ["getModalResult"])