mirror of
https://git.meshkee.com/cssd/cssd-front.git
synced 2026-10-10 19:03:19 +03:30
fix : verify test result
This commit is contained in:
@@ -211,7 +211,7 @@ export default {
|
||||
text: 'packages that you posses',
|
||||
// image: '/img/Static/Dashboard/alltest.png',
|
||||
color: 'WM-LightGray-BG',
|
||||
route: {name: 'MyItem'},
|
||||
route: {name: 'MyPackage'},
|
||||
aligntext: 'text-md-left',
|
||||
alignimg: 'text-md-right',
|
||||
column: 'xs12 md4 sm4',
|
||||
|
||||
+313
-312
@@ -1,179 +1,180 @@
|
||||
<template>
|
||||
<div class>
|
||||
<v-container fluid>
|
||||
<material-card class color="black" title="All Items" text>
|
||||
<v-layout align-center wrap class="px-3">
|
||||
<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-text-field class="pt-3 pr-3" v-model="filter.item_id" label="Item ID"
|
||||
color="black"/>
|
||||
</v-flex>
|
||||
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter">
|
||||
<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-flex>
|
||||
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter">
|
||||
<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-flex>
|
||||
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter" v-if="$hasRole('Admin')">
|
||||
<v-icon class="fa fa-hospital-o mr-2 WM-Margin-B-8"/>
|
||||
<v-autocomplete class="pt-3 pr-3" v-model="filter.medical_center_id" item-text="name"
|
||||
item-value="id" label="Hospital" color="black" :items="medicalCenters"
|
||||
:clearable="true"/>
|
||||
</v-flex>
|
||||
<v-flex xs12 sm3 md3 lg2 xl1 class="WM-FlexCenter">
|
||||
<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.size" label="Size" color="black"/>
|
||||
</v-flex>
|
||||
<v-flex xs12 sm3 md3 lg2 xl1 class="WM-FlexCenter">
|
||||
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/>
|
||||
<v-text-field class="pt-3 pr-3" v-model="filter.udi" label="UDI" color="black"/>
|
||||
</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>
|
||||
<div class>
|
||||
<v-container fluid>
|
||||
<material-card class color="black" text title="All Items">
|
||||
<v-layout align-center class="px-3" wrap>
|
||||
<!-- <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-text-field class="pt-3 pr-3" v-model="filter.item_id" label="Item ID"
|
||||
color="black"/>
|
||||
</v-flex>-->
|
||||
<v-flex class="WM-FlexCenter" lg2 md3 sm3 xl1 xs12>
|
||||
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/>
|
||||
<v-text-field v-model="filter.udi" class="pt-3 pr-3" color="black" label="UDI"/>
|
||||
</v-flex>
|
||||
<v-flex class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
|
||||
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/>
|
||||
<v-text-field v-model="filter.name" class="pt-3 pr-3" color="black" label="Name"/>
|
||||
</v-flex>
|
||||
<v-flex class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
|
||||
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/>
|
||||
<v-text-field v-model="filter.user_name" class="pt-3 pr-3" color="black" label="Owner"/>
|
||||
</v-flex>
|
||||
<v-flex v-if="$hasRole('Admin')" class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
|
||||
<v-icon class="fa fa-hospital-o mr-2 WM-Margin-B-8"/>
|
||||
<v-autocomplete v-model="filter.medical_center_id" :clearable="true" :items="medicalCenters"
|
||||
class="pt-3 pr-3" color="black" item-text="name" item-value="id"
|
||||
label="Hospital"/>
|
||||
</v-flex>
|
||||
<v-flex class="WM-FlexCenter" lg2 md3 sm3 xl1 xs12>
|
||||
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/>
|
||||
<v-text-field v-model="filter.size" class="pt-3 pr-3" color="black" label="Size"/>
|
||||
</v-flex>
|
||||
|
||||
<v-btn class="WM-Outline-Btn WM-Border mr-2 WM-Margin-BT-0 WM-Border-Black" @click="download()"
|
||||
style="padding: 10px 30px;">
|
||||
<v-icon class="black--text mr-2 caption">fas fa-share-square</v-icon>
|
||||
<span class="black--text">EXPORT</span>
|
||||
</v-btn>
|
||||
<!--btn-->
|
||||
<v-spacer/>
|
||||
<v-flex class="WM-Align-R" lg12 md6 sm6 xl3 xs12>
|
||||
<v-tooltip bottom open-on-hover>
|
||||
<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-CyanBlueGradient-BG WM-Margin-BT-0" style="padding:10px 30px">
|
||||
<v-icon class="white--text mr-2 caption">fas fa-plus</v-icon>
|
||||
<span class="white--text">Add</span>
|
||||
</v-btn>
|
||||
</router-link>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout class="px-3 my-3">
|
||||
<v-divider/>
|
||||
</v-layout>
|
||||
<v-layout align-center wrap class="my-3 px-3">
|
||||
<v-flex md12>
|
||||
<v-data-table :headers="headers" :items="items" hide-actions>
|
||||
<template slot="headerCell" slot-scope="{ header }">
|
||||
<v-btn class="WM-Outline-Btn WM-Border mr-2 WM-Margin-BT-0 WM-Border-Black" style="padding: 10px 30px;"
|
||||
@click="download()">
|
||||
<v-icon class="black--text mr-2 caption">fas fa-share-square</v-icon>
|
||||
<span class="black--text">EXPORT</span>
|
||||
</v-btn>
|
||||
|
||||
<router-link :to="{ name: 'AddItem' }">
|
||||
<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>
|
||||
<span class="white--text">Add</span>
|
||||
</v-btn>
|
||||
</router-link>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<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"
|
||||
v-text="header.text"/>
|
||||
</template>
|
||||
<template slot="items" slot-scope="{ item }">
|
||||
<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.name }}</td>
|
||||
<td class="title font-weight-light">
|
||||
{{ item.user ? item.user.name : '' | text_20_letter }}
|
||||
</td>
|
||||
<td class="title font-weight-light">
|
||||
{{ (item.user && item.user.medical_center) ? item.user.medical_center.name : '' }}
|
||||
</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.status }}</td>
|
||||
<td class="text-xs-right FlexBtn Height-MD-60 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>
|
||||
<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>
|
||||
</template>
|
||||
<template slot="items" slot-scope="{ item }">
|
||||
<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.name }}</td>
|
||||
<td class="title font-weight-light">
|
||||
{{ item.user ? item.user.name : '' | text_20_letter }}
|
||||
</td>
|
||||
<td class="title font-weight-light">
|
||||
{{ (item.user && item.user.medical_center) ? item.user.medical_center.name : '' }}
|
||||
</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.status }}</td>
|
||||
<td class="text-xs-right FlexBtn Height-MD-60 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"
|
||||
v-bind="attrs" @click="changeStatus(item, status.status)"
|
||||
v-on="on">
|
||||
<v-icon :class="`${status.font_color}--text mr-1 caption`">
|
||||
fas {{ status.icon }}
|
||||
</v-icon>
|
||||
<span>{{ status.label }}</span>
|
||||
</v-btn>
|
||||
</router-link>
|
||||
</v-layout>
|
||||
</material-card>
|
||||
</v-container>
|
||||
</div>
|
||||
</template>
|
||||
<span>{{ status.label }}</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<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>
|
||||
|
||||
<script>
|
||||
@@ -183,148 +184,148 @@ import {mapMutations, mapGetters} from "vuex";
|
||||
import toast from "@/services/global/toast.service";
|
||||
|
||||
export default {
|
||||
metaInfo() {
|
||||
return {
|
||||
title: this.$route.meta.title,
|
||||
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);
|
||||
},
|
||||
metaInfo() {
|
||||
return {
|
||||
title: this.$route.meta.title,
|
||||
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);
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
+162
-161
@@ -1,79 +1,79 @@
|
||||
<template>
|
||||
<v-form ref="form">
|
||||
<v-container grid-list-xs fluid>
|
||||
<material-card color="black" title="Add Label on Set ">
|
||||
<v-layout wrap class="px-3 my-3">
|
||||
<v-flex xs12 sm6 md4 lg3 class="WM-FlexCenter pl-3">
|
||||
<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-model="formData.sterilizer_id" class="py-3 pr-3"/>
|
||||
</v-flex>
|
||||
<v-flex xs12 sm6 md4 lg3 class="WM-FlexCenter pl-3">
|
||||
<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-model="formData.cycle_number"
|
||||
class="py-3 pr-3"/>
|
||||
</v-flex>
|
||||
<v-flex xs12 sm6 md4 lg3 class="WM-FlexCenter pl-3">
|
||||
<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"
|
||||
class="py-3 pr-3"/>
|
||||
</v-flex>
|
||||
<v-spacer/>
|
||||
<v-flex xs12 sm6 md4 lg3 class="WM-FlexCenter">
|
||||
<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"
|
||||
item-value="id" label="Package ID" class="py-3 pr-3" :filter="customFilter">
|
||||
<template v-slot:chip="{ item }">
|
||||
{{ item.name }} - {{ item.id }}
|
||||
</template>
|
||||
<v-form ref="form">
|
||||
<v-container fluid grid-list-xs>
|
||||
<material-card color="black" title="Add Label on Set ">
|
||||
<v-layout class="px-3 my-3" wrap>
|
||||
<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-text-field v-model="formData.sterilizer_id" class="py-3 pr-3" color="black"
|
||||
label="Sterilizer ID" name="sterilizerId"/>
|
||||
</v-flex>
|
||||
<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-text-field v-model="formData.cycle_number" class="py-3 pr-3" color="black"
|
||||
label="Preferred Cycle Number"
|
||||
name="cycle_number"/>
|
||||
</v-flex>
|
||||
<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-text-field v-model="lotNumber" class="py-3 pr-3" color="black" label="Lot Number" name="lot_number"
|
||||
readonly/>
|
||||
</v-flex>
|
||||
<v-spacer/>
|
||||
<v-flex class="WM-FlexCenter" lg3 md4 sm6 xs12>
|
||||
<v-icon class="fas fa-check mr-2 WM-Margin-B-8"/>
|
||||
<v-autocomplete v-model="formData.package_id" :filter="customFilter" :items="items" class="py-3 pr-3"
|
||||
color="black" item-text="name" item-value="id" label="Package ID">
|
||||
<template v-slot:chip="{ item }">
|
||||
{{ item.name }} - {{ item.id }}
|
||||
</template>
|
||||
|
||||
<template v-slot:item="{ item }">
|
||||
{{ item.name }} - {{ item.id }}
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs12 sm6 md4 lg3 class="WM-FlexCenter pl-3">
|
||||
<v-icon class="far fa-calendar-alt mr-2"/>
|
||||
<v-menu lazy :close-on-content-click="true" transition="v-scale-transition" offset-y
|
||||
v-model="fromMenuSterile" style="width: 100%">
|
||||
<v-text-field required slot="activator" label="Sterile Date" color="black" class="pr-3"
|
||||
v-model="formData.sterile_date"/>
|
||||
<v-date-picker color="pink" :min="today" no-title v-model="formData.sterile_date"
|
||||
:date-format="date => new Date(date).toDateString()"/>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs12 sm6 md4 lg3 class="WM-FlexCenter pl-3">
|
||||
<v-icon class="far fa-calendar-alt mr-2"/>
|
||||
<v-menu lazy :close-on-content-click="true" transition="v-scale-transition" offset-y
|
||||
v-model="fromMenuExpire" style="width: 100%">
|
||||
<v-text-field required slot="activator" label="Expire Date" color="black" class="pr-3"
|
||||
v-model="formData.expire_date"/>
|
||||
<v-date-picker :show-current="showCurrent" :min="formData.sterile_date" color="pink"
|
||||
no-title
|
||||
v-model="formData.expire_date"
|
||||
:date-format="date => new Date(date).toDateString()"/>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<template v-slot:item="{ item }">
|
||||
{{ item.name }} - {{ item.id }}
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex class="WM-FlexCenter pl-3" lg3 md4 sm6 xs12>
|
||||
<v-icon class="far fa-calendar-alt mr-2"/>
|
||||
<v-menu v-model="fromMenuSterile" :close-on-content-click="true" lazy offset-y
|
||||
style="width: 100%" transition="v-scale-transition">
|
||||
<v-text-field slot="activator" v-model="formData.sterile_date" class="pr-3" color="black" label="Sterile Date"
|
||||
required/>
|
||||
<v-date-picker v-model="formData.sterile_date" :date-format="date => new Date(date).toDateString()" :min="today" color="pink"
|
||||
no-title/>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex class="WM-FlexCenter pl-3" lg3 md4 sm6 xs12>
|
||||
<v-icon class="far fa-calendar-alt mr-2"/>
|
||||
<v-menu v-model="fromMenuExpire" :close-on-content-click="true" lazy offset-y
|
||||
style="width: 100%" transition="v-scale-transition">
|
||||
<v-text-field slot="activator" v-model="formData.expire_date" class="pr-3" color="black" label="Expire Date"
|
||||
required/>
|
||||
<v-date-picker v-model="formData.expire_date" :date-format="date => new Date(date).toDateString()" :min="formData.sterile_date"
|
||||
:show-current="showCurrent"
|
||||
color="pink"
|
||||
no-title/>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
</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' }">
|
||||
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black">
|
||||
<v-icon class="black--text">keyboard_arrow_left</v-icon>
|
||||
<span class="black--text">Back</span>
|
||||
</v-btn>
|
||||
</router-link>
|
||||
<v-spacer/>
|
||||
<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>
|
||||
</v-layout>
|
||||
</material-card>
|
||||
</v-container>
|
||||
</v-form>
|
||||
<router-link :to="{ name: 'AllLabels' }">
|
||||
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black">
|
||||
<v-icon class="black--text">keyboard_arrow_left</v-icon>
|
||||
<span class="black--text">Back</span>
|
||||
</v-btn>
|
||||
</router-link>
|
||||
<v-spacer/>
|
||||
<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>
|
||||
</v-layout>
|
||||
</material-card>
|
||||
</v-container>
|
||||
</v-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -82,106 +82,107 @@ import {urls} from "@/config/urls";
|
||||
import toast from "@/services/global/toast.service";
|
||||
|
||||
export default {
|
||||
metaInfo() {
|
||||
return {
|
||||
title: this.$route.meta.title,
|
||||
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'});
|
||||
}
|
||||
}
|
||||
metaInfo() {
|
||||
return {
|
||||
title: this.$route.meta.title,
|
||||
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;
|
||||
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>
|
||||
<style>
|
||||
.v-btn--floating {
|
||||
padding: 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.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--icon:before {
|
||||
border-radius: 50% !important;
|
||||
border-radius: 50% !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -42,11 +42,11 @@
|
||||
</template>
|
||||
<span>Filter</span>
|
||||
</v-tooltip>
|
||||
|
||||
<!--
|
||||
<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>
|
||||
<span class="black--text">EXPORT</span>
|
||||
</v-btn>
|
||||
<v-icon class="black--text mr-2 caption">fas fa-share-square</v-icon>
|
||||
<span class="black--text">EXPORT</span>
|
||||
</v-btn>-->
|
||||
|
||||
<router-link :to="{ name: 'AddLabel' }">
|
||||
<v-btn class="WM-CyanBlueGradient-BG WM-Margin-BT-0" style="padding:10px 30px">
|
||||
|
||||
+312
-311
@@ -1,172 +1,172 @@
|
||||
<template>
|
||||
<div class>
|
||||
<v-container fluid>
|
||||
<material-card class color="black" title="My Items" text>
|
||||
<v-layout align-center wrap class="px-3">
|
||||
<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-text-field class="pt-3 pr-3" v-model="filter.item_id" label="Item ID"
|
||||
color="black"/>
|
||||
</v-flex>
|
||||
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter">
|
||||
<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-flex>
|
||||
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter" v-if="$hasRole('Admin')">
|
||||
<v-icon class="fa fa-hospital-o mr-2 WM-Margin-B-8"/>
|
||||
<v-autocomplete class="pt-3 pr-3" v-model="filter.medical_center_id" item-text="name"
|
||||
item-value="id" label="Hospital" color="black" :items="medicalCenters"
|
||||
:clearable="true"/>
|
||||
</v-flex>
|
||||
<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-text-field class="pt-3 pr-3" v-model="filter.size" label="Size" color="black"/>
|
||||
</v-flex>
|
||||
<v-flex xs12 sm4 md3 lg2 xl1 class="WM-FlexCenter">
|
||||
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/>
|
||||
<v-text-field class="pt-3 pr-3" v-model="filter.udi" label="UDI" color="black"/>
|
||||
</v-flex>
|
||||
<!--btn-->
|
||||
<v-spacer/>
|
||||
<v-flex xs12 sm6 md6 lg2 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>
|
||||
<div class>
|
||||
<v-container fluid>
|
||||
<material-card class color="black" text title="My Items">
|
||||
<v-layout align-center class="px-3" wrap>
|
||||
<!-- <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-text-field class="pt-3 pr-3" v-model="filter.item_id" label="Item ID"
|
||||
color="black"/>
|
||||
</v-flex>-->
|
||||
<v-flex class="WM-FlexCenter" lg2 md3 sm4 xl1 xs12>
|
||||
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/>
|
||||
<v-text-field v-model="filter.udi" class="pt-3 pr-3" color="black" label="UDI"/>
|
||||
</v-flex>
|
||||
<v-flex class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
|
||||
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/>
|
||||
<v-text-field v-model="filter.name" class="pt-3 pr-3" color="black" label="Name"/>
|
||||
</v-flex>
|
||||
<v-flex v-if="$hasRole('Admin')" class="WM-FlexCenter" lg3 md4 sm4 xl2 xs12>
|
||||
<v-icon class="fa fa-hospital-o mr-2 WM-Margin-B-8"/>
|
||||
<v-autocomplete v-model="filter.medical_center_id" :clearable="true" :items="medicalCenters"
|
||||
class="pt-3 pr-3" color="black" item-text="name" item-value="id"
|
||||
label="Hospital"/>
|
||||
</v-flex>
|
||||
<v-flex class="WM-FlexCenter" lg2 md4 sm4 xl1 xs12>
|
||||
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/>
|
||||
<v-text-field v-model="filter.size" class="pt-3 pr-3" color="black" label="Size"/>
|
||||
</v-flex>
|
||||
<!--btn-->
|
||||
<v-spacer/>
|
||||
<v-flex class="WM-Align-R" lg2 md6 sm6 xl3 xs12>
|
||||
<v-tooltip bottom open-on-hover>
|
||||
<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>
|
||||
|
||||
<!-- <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>
|
||||
<span class="black--text">EXPORT</span>
|
||||
</v-btn>-->
|
||||
<!-- <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>
|
||||
<span class="black--text">EXPORT</span>
|
||||
</v-btn>-->
|
||||
|
||||
<router-link :to="{ name: 'AddItem' }">
|
||||
<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>
|
||||
<span class="white--text">Add</span>
|
||||
</v-btn>
|
||||
</router-link>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout class="px-3 my-3">
|
||||
<v-divider/>
|
||||
</v-layout>
|
||||
<v-layout align-center wrap class="my-3 px-3" v-if="getMyItems">
|
||||
<v-flex md12>
|
||||
<v-data-table :headers="headers" :items="getMyItems" 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="title font-weight-light">{{ item.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.user ? item.user.name : '' | text_20_letter }}
|
||||
</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.status }}</td>
|
||||
<td class="title font-weight-light">{{ item.package_id }}</td>
|
||||
<td class="text-xs-right FlexBtn Height-MD-60 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>
|
||||
<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>
|
||||
<router-link :to="{ name: 'AddItem' }">
|
||||
<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>
|
||||
<span class="white--text">Add</span>
|
||||
</v-btn>
|
||||
</router-link>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout class="px-3 my-3">
|
||||
<v-divider/>
|
||||
</v-layout>
|
||||
<v-layout v-if="getMyItems" align-center class="my-3 px-3" wrap>
|
||||
<v-flex md12>
|
||||
<v-data-table :headers="headers" :items="getMyItems" 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="title font-weight-light">{{ item.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.user ? item.user.name : '' | text_20_letter }}
|
||||
</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.status }}</td>
|
||||
<td class="title font-weight-light">{{ item.package_id }}</td>
|
||||
<td class="text-xs-right FlexBtn Height-MD-60 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"
|
||||
v-bind="attrs" @click="changeStatus(item, status.status)"
|
||||
v-on="on">
|
||||
<v-icon :class="`${status.font_color}--text mr-1 caption`">
|
||||
fas {{ status.icon }}
|
||||
</v-icon>
|
||||
<span>{{ status.label }}</span>
|
||||
</v-btn>
|
||||
</router-link>
|
||||
<v-spacer/>
|
||||
</v-layout>
|
||||
</material-card>
|
||||
</v-container>
|
||||
</div>
|
||||
</template>
|
||||
<span>{{ status.label }}</span>
|
||||
</v-tooltip>
|
||||
</template>
|
||||
<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-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>
|
||||
<script>
|
||||
import {ApiService} from "@/services";
|
||||
@@ -175,153 +175,154 @@ import {mapMutations, mapGetters, mapActions} from "vuex";
|
||||
import toast from "@/services/global/toast.service";
|
||||
|
||||
export default {
|
||||
metaInfo() {
|
||||
return {
|
||||
title: this.$route.meta.title,
|
||||
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);
|
||||
}
|
||||
metaInfo() {
|
||||
return {
|
||||
title: this.$route.meta.title,
|
||||
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: "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>
|
||||
+107
-63
@@ -1,63 +1,63 @@
|
||||
<template>
|
||||
<v-container fluid>
|
||||
<material-card class color="black" title="All Test Result" text>
|
||||
<v-layout align-center wrap class="px-3">
|
||||
<v-flex xs12 sm4 md4 lg3 xl2 class="WM-FlexCenter">
|
||||
<material-card class color="black" text title="All Test Result">
|
||||
<v-layout align-center class="px-3" wrap>
|
||||
<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-text-field class="pt-3 pr-3" v-model="filter.device_id" label="ID"
|
||||
color="black"/>
|
||||
<v-text-field v-model="filter.device_id" class="pt-3 pr-3" color="black"
|
||||
label="ID"/>
|
||||
</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-autocomplete :items="deviceLabels" item-text="name" item-value="id"
|
||||
v-model="filter.device_label" label="ID Label" color="black" class="pt-3 pr-3"
|
||||
:clearable="true"/>
|
||||
<v-autocomplete v-model="filter.device_label" :clearable="true" :items="deviceLabels"
|
||||
class="pt-3 pr-3" color="black" item-text="name" item-value="id"
|
||||
label="ID Label"/>
|
||||
</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-autocomplete class="pt-3 pr-3" v-model="filter.testType_id" label="TestType Name"
|
||||
color="black" :items="testTypes" item-text="name" item-value="id"/>
|
||||
<v-autocomplete v-model="filter.testType_id" :items="testTypes" class="pt-3 pr-3"
|
||||
color="black" item-text="name" item-value="id" label="TestType Name"/>
|
||||
</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-autocomplete class="pt-3 pr-3" v-model="filter.medicalCenter_id" label="Hospital"
|
||||
color="black" :items="medicalCenters" item-text="name" item-value="id"
|
||||
:clearable="true"/>
|
||||
<v-autocomplete v-model="filter.medicalCenter_id" :clearable="true" :items="medicalCenters"
|
||||
class="pt-3 pr-3" color="black" item-text="name" item-value="id"
|
||||
label="Hospital"/>
|
||||
</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-text-field class="pt-3 pr-3" v-model="filter.user_name" label="User Name"
|
||||
color="black"/>
|
||||
<v-text-field v-model="filter.user_name" class="pt-3 pr-3" color="black"
|
||||
label="User Name"/>
|
||||
</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-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
|
||||
v-model="fromMenu" style="width: 100%">
|
||||
<v-text-field class="pt-3 pr-3" required slot="activator" label="FromDate"
|
||||
v-model="filter.fromPicker" color="black"/>
|
||||
<v-date-picker color="pink" no-title v-model="filter.fromPicker"
|
||||
:date-format="date => new Date(date).toDateString()"/>
|
||||
style="width: 100%" transition="v-scale-transition">
|
||||
<v-text-field slot="activator" v-model="filter.fromPicker" class="pt-3 pr-3" color="black"
|
||||
label="FromDate" required/>
|
||||
<v-date-picker v-model="filter.fromPicker" :date-format="date => new Date(date).toDateString()" color="pink"
|
||||
no-title/>
|
||||
</v-menu>
|
||||
</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-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
|
||||
v-model="upToMenu" style="width: 100%">
|
||||
<v-text-field class="pt-3 pr-3" required slot="activator" label="UpToDate" color="black"
|
||||
v-model="filter.upToPicker"/>
|
||||
<v-date-picker color="pink" no-title v-model="filter.upToPicker"
|
||||
:date-format="date => new Date(date).toDateString()"/>
|
||||
style="width: 100%" transition="v-scale-transition">
|
||||
<v-text-field slot="activator" v-model="filter.upToPicker" class="pt-3 pr-3" color="black" label="UpToDate"
|
||||
required/>
|
||||
<v-date-picker v-model="filter.upToPicker" :date-format="date => new Date(date).toDateString()" color="pink"
|
||||
no-title/>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<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>
|
||||
<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(null, null)">
|
||||
<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(null, null)"
|
||||
v-on="on">
|
||||
<v-icon class="black--text caption">fas fa-search</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
@@ -75,7 +75,7 @@
|
||||
<v-layout class="px-3 my-3">
|
||||
<v-divider/>
|
||||
</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-data-table :headers="headers" :items="items" hide-actions>
|
||||
<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.name }}</td>
|
||||
<td class="title font-weight-light">
|
||||
<span v-if="item.result == 'Reject'" class="ResultMsg Reject">
|
||||
{{ item.result }}
|
||||
</span>
|
||||
<span v-if="item.result == 'Reject'" class="ResultMsg Reject">
|
||||
{{ item.result }}
|
||||
</span>
|
||||
<span v-else-if="item.result == 'Accept'" class="ResultMsg Accept">
|
||||
{{ item.result }}
|
||||
</span>
|
||||
{{ item.result }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="headline font-weight-light">{{ $d(new Date(item.created_at), 'long') }}</td>
|
||||
<td class="title font-weight-light text-center">
|
||||
<span v-if="item.verified == 'NotVerified'" class="NotVerified">
|
||||
<v-icon class="caption fa fa-times NotVerified"/>
|
||||
</span>
|
||||
<span v-if="item.verified == 'NotVerified'" class="NotVerified">
|
||||
<v-icon class="caption fa fa-times NotVerified"/>
|
||||
</span>
|
||||
<span v-if="item.verified == 'Verified'" class="">
|
||||
<v-icon class="caption fa fa-check Verified"/>
|
||||
</span>
|
||||
<v-icon class="caption fa fa-check Verified"/>
|
||||
</span>
|
||||
<!-- {{ item.verified }} -->
|
||||
</td>
|
||||
<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>
|
||||
<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-icon class="black--text mr-1 caption">fas fa-eye</v-icon>
|
||||
<span>Show</span>
|
||||
@@ -121,8 +137,8 @@
|
||||
</v-tooltip>
|
||||
<v-tooltip bottom open-on-hover>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<v-btn color="light-gray" class="mr-2"
|
||||
@click="generateBarcode(item.id, 'TestResult')" v-bind="attrs"
|
||||
<v-btn class="mr-2" color="light-gray"
|
||||
v-bind="attrs" @click="generateBarcode(item.id, 'TestResult')"
|
||||
v-on="on">
|
||||
<v-icon class="black--text mr-1 caption">fa fa-bars</v-icon>
|
||||
<span>generate Barcode</span>
|
||||
@@ -133,10 +149,10 @@
|
||||
<v-tooltip bottom open-on-hover>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<!-- v-if="$hasRole('Admin') || item.user_id == $store.state.user.id" -->
|
||||
<router-link class="LinkBtn"
|
||||
v-if="$hasRole('Admin') || (item.user_id == $store.state.user.id && item.verified == 'None')"
|
||||
:to="{ name: 'EditTestResult', params: { testResult: item.id } }">
|
||||
<v-btn color="black" class="mr-2" v-bind="attrs" v-on="on">
|
||||
<router-link v-if="$hasRole('Admin') || (item.user_id == $store.state.user.id && item.verified == 'None')"
|
||||
:to="{ name: 'EditTestResult', params: { testResult: 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>
|
||||
@@ -147,9 +163,9 @@
|
||||
<v-tooltip bottom open-on-hover>
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
<!-- v-if="$hasRole('Admin') || item.user_id == $store.state.user.id" -->
|
||||
<v-btn color="red" class="WM-ActionButton" @click="removeModal(item.id)"
|
||||
v-if="$hasRole('Admin') || (item.user_id == $store.state.user.id && item.verified == 'None')"
|
||||
v-bind="attrs" v-on="on">
|
||||
<v-btn v-if="$hasRole('Admin') || (item.user_id == $store.state.user.id && item.verified == 'None')" class="WM-ActionButton" 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>
|
||||
@@ -162,11 +178,11 @@
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider/>
|
||||
<div class="text-xs-center mt-2" v-if="lastPage > 1">
|
||||
<v-pagination color="black" v-model="currentPage" :length="lastPage"
|
||||
:total-visible="6"/>
|
||||
<div v-if="lastPage > 1" class="text-xs-center mt-2">
|
||||
<v-pagination v-model="currentPage" :length="lastPage" :total-visible="6"
|
||||
color="black"/>
|
||||
</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">
|
||||
<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>
|
||||
@@ -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: {
|
||||
...mapGetters("modal", ["getModalResult"])
|
||||
|
||||
Reference in New Issue
Block a user