mirror of
https://git.meshkee.com/cssd/cssd-front.git
synced 2026-10-13 16:23:28 +03:30
fix : packages
This commit is contained in:
@@ -113,6 +113,9 @@ const urls = {
|
|||||||
verifyPackage: function (id) {
|
verifyPackage: function (id) {
|
||||||
return `/Package/Verify/${id}`;
|
return `/Package/Verify/${id}`;
|
||||||
},
|
},
|
||||||
|
changePackageStatus: function (id) {
|
||||||
|
return `/Packages/ChangeStatus/${id}`;
|
||||||
|
},
|
||||||
listLabel: function (filter) {
|
listLabel: function (filter) {
|
||||||
return "/Labels" + filter;
|
return "/Labels" + filter;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -33,10 +33,6 @@ import { ApiService, TokenService } from '@/services'
|
|||||||
sync(store, router)
|
sync(store, router)
|
||||||
|
|
||||||
//vue filter for string
|
//vue filter for string
|
||||||
Vue.filter('text_8_letter', function(value) {
|
|
||||||
if (!value) return '';
|
|
||||||
return value.slice(0, 8);
|
|
||||||
});
|
|
||||||
Vue.filter('text_20_letter', function(value) {
|
Vue.filter('text_20_letter', function(value) {
|
||||||
if (!value) return '';
|
if (!value) return '';
|
||||||
return value.slice(0, 20);
|
return value.slice(0, 20);
|
||||||
|
|||||||
@@ -100,9 +100,9 @@ export default ApiService
|
|||||||
export { ApiService }
|
export { ApiService }
|
||||||
|
|
||||||
axios.interceptors.request.use(request => {
|
axios.interceptors.request.use(request => {
|
||||||
console.log("🔵 API Request:", request.method.toUpperCase(), request.url);
|
// console.log("🔵 API Request:", request.method.toUpperCase(), request.url);
|
||||||
console.log("🔹 Headers:", request.headers);
|
// console.log("🔹 Headers:", request.headers);
|
||||||
console.log("🔹 Data:", request.data);
|
// console.log("🔹 Data:", request.data);
|
||||||
return request;
|
return request;
|
||||||
}, error => {
|
}, error => {
|
||||||
console.error("🔴 Request Error:", error);
|
console.error("🔴 Request Error:", error);
|
||||||
@@ -110,9 +110,9 @@ axios.interceptors.request.use(request => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
axios.interceptors.response.use(response => {
|
axios.interceptors.response.use(response => {
|
||||||
console.log("🟢 API Response:", response.config.url);
|
// console.log("🟢 API Response:", response.config.url);
|
||||||
console.log("🟢 Status:", response.status);
|
// console.log("🟢 Status:", response.status);
|
||||||
console.log("🟢 Data:", response.data);
|
// console.log("🟢 Data:", response.data);
|
||||||
return response;
|
return response;
|
||||||
}, error => {
|
}, error => {
|
||||||
console.error("🔴 API Error:", error.response ? error.response.data : error);
|
console.error("🔴 API Error:", error.response ? error.response.data : error);
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
<td class="title font-weight-light">{{ item.name }}</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.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.user && item.user.medical_center) ? item.user.medical_center.name : '' }}</td>
|
||||||
<td class="title font-weight-light">{{ item.udi | text_8_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">
|
<td class="text-xs-right FlexBtn Height-MD-60">
|
||||||
|
|||||||
+52
-12
@@ -4,19 +4,19 @@
|
|||||||
<material-card class color="black" title="All Packages" text>
|
<material-card class color="black" title="All Packages" text>
|
||||||
<v-layout align-center wrap class="mt-3 px-5">
|
<v-layout align-center wrap class="mt-3 px-5">
|
||||||
<v-flex xs12 md3 sm3 class="WM-FlexCenter">
|
<v-flex xs12 md3 sm3 class="WM-FlexCenter">
|
||||||
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"></v-icon>
|
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"/>
|
||||||
<v-text-field class="py-3 pr-3" v-model="filter.package_id" label="Package ID"
|
<v-text-field class="py-3 pr-3" v-model="filter.package_id" label="Package ID"
|
||||||
color="black"></v-text-field>
|
color="black"/>
|
||||||
</v-flex>
|
</v-flex>
|
||||||
<v-flex xs12 md3 sm3 class="WM-FlexCenter pl-3">
|
<v-flex xs12 md3 sm3 class="WM-FlexCenter pl-3">
|
||||||
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"></v-icon>
|
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"/>
|
||||||
<v-text-field class="py-3 pr-3" v-model="filter.name" label="Name" color="black"></v-text-field>
|
<v-text-field class="py-3 pr-3" v-model="filter.name" label="Name" color="black"/>
|
||||||
</v-flex>
|
</v-flex>
|
||||||
<v-flex xs12 md3 sm3 class="WM-FlexCenter pl-3" v-if="$hasRole('Admin')">
|
<v-flex xs12 md3 sm3 class="WM-FlexCenter pl-3" v-if="$hasRole('Admin')">
|
||||||
<v-icon class="fa fa-hospital-o mr-2 WM-Margin-B-8"></v-icon>
|
<v-icon class="fa fa-hospital-o mr-2 WM-Margin-B-8"/>
|
||||||
<v-autocomplete class="py-3 pr-3" v-model="filter.medical_center_id" item-text="name"
|
<v-autocomplete class="py-3 pr-3" v-model="filter.medical_center_id" item-text="name"
|
||||||
item-value="id" label="Hospital" color="black" :items="medicalCenters"
|
item-value="id" label="Hospital" color="black" :items="medicalCenters"
|
||||||
:clearable="true"></v-autocomplete>
|
:clearable="true"/>
|
||||||
</v-flex>
|
</v-flex>
|
||||||
<!-- <v-flex class xs12 md2 sm3>
|
<!-- <v-flex class xs12 md2 sm3>
|
||||||
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px" @click="load()">
|
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px" @click="load()">
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<span class="white--text">Filter</span>
|
<span class="white--text">Filter</span>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-flex>
|
</v-flex>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer/>
|
||||||
<v-flex xs12 md2 sm2 class="text-xs-right ml-3">
|
<v-flex xs12 md2 sm2 class="text-xs-right ml-3">
|
||||||
<router-link :to="{ name: 'AddPackage' }">
|
<router-link :to="{ name: 'AddPackage' }">
|
||||||
<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">
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
</v-flex>
|
</v-flex>
|
||||||
</v-layout>
|
</v-layout>
|
||||||
<v-layout class="px-4 my-3">
|
<v-layout class="px-4 my-3">
|
||||||
<v-divider></v-divider>
|
<v-divider/>
|
||||||
</v-layout>
|
</v-layout>
|
||||||
<v-layout align-center wrap class="my-3 px-5">
|
<v-layout align-center wrap class="my-3 px-5">
|
||||||
<v-flex md12>
|
<v-flex md12>
|
||||||
@@ -60,10 +60,26 @@
|
|||||||
<td class="title font-weight-light">{{ item.name }}</td>
|
<td class="title font-weight-light">{{ item.name }}</td>
|
||||||
<td class="title font-weight-light">{{ (item.user && item.user.medical_center) ?
|
<td class="title font-weight-light">{{ (item.user && item.user.medical_center) ?
|
||||||
item.user.medical_center.name : '' }}</td>
|
item.user.medical_center.name : '' }}</td>
|
||||||
<td class="title font-weight-light">{{ item.user ? item.user.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.udi | text_20_letter }}</td>
|
||||||
<td class="title font-weight-light">{{ item.description }}</td>
|
<td class="title font-weight-light">{{ item.description }}</td>
|
||||||
|
<td class="title font-weight-light">{{ item.status }}</td>
|
||||||
<td class="text-xs-right FlexBtn Height-MD-60">
|
<td class="text-xs-right FlexBtn Height-MD-60">
|
||||||
|
<v-tooltip bottom open-on-hover v-if="$hasRole('Admin|Supervisor')">
|
||||||
|
<template v-slot:activator="{ on, attrs }">
|
||||||
|
<v-btn :color="!['suspended', 'rejected'].includes(item.status) ? 'red' : 'green'"
|
||||||
|
class="mr-2" @click="changeStatus(item)" v-bind="attrs" v-on="on">
|
||||||
|
<v-icon class="white--text mr-1 caption">
|
||||||
|
fas {{!['suspended', 'rejected'].includes(item.status) ? 'fa-close' : 'fa-check' }}
|
||||||
|
</v-icon>
|
||||||
|
<span>
|
||||||
|
{{ !['suspended', 'rejected'].includes(item.status) ? 'reject' : 'approve' }}
|
||||||
|
</span>
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
<span>{{ !['suspended', 'rejected'].includes(item.status) ? 'reject' : 'approve'
|
||||||
|
}}</span>
|
||||||
|
</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 v-bind="attrs" v-on="on" color="cyan" class="mr-2"
|
<v-btn v-bind="attrs" v-on="on" color="cyan" class="mr-2"
|
||||||
@@ -113,7 +129,7 @@
|
|||||||
</v-data-table>
|
</v-data-table>
|
||||||
</v-flex>
|
</v-flex>
|
||||||
</v-layout>
|
</v-layout>
|
||||||
<v-divider></v-divider>
|
<v-divider/>
|
||||||
<div class="text-xs-center" v-if="lastPage > 1">
|
<div class="text-xs-center" v-if="lastPage > 1">
|
||||||
<v-pagination color="black" v-model="currentPage" :length="lastPage" :total-visible="6"></v-pagination>
|
<v-pagination color="black" v-model="currentPage" :length="lastPage" :total-visible="6"></v-pagination>
|
||||||
</div>
|
</div>
|
||||||
@@ -161,7 +177,7 @@ export default {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
sortable: true,
|
sortable: true,
|
||||||
text: "User",
|
text: "Owner",
|
||||||
value: "User"
|
value: "User"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -173,6 +189,11 @@ export default {
|
|||||||
text: "Description",
|
text: "Description",
|
||||||
value: "description"
|
value: "description"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
sortable: true,
|
||||||
|
text: "Status",
|
||||||
|
value: "status"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
sortable: false,
|
sortable: false,
|
||||||
text: "Action",
|
text: "Action",
|
||||||
@@ -255,6 +276,25 @@ export default {
|
|||||||
toast.error('please first set UDI');
|
toast.error('please first set UDI');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async changeStatus(item) {
|
||||||
|
const payload = {
|
||||||
|
status: ['suspended', 'rejected'].includes(item.status) ? 'approved' : 'rejected',
|
||||||
|
}
|
||||||
|
const result = await ApiService.post(
|
||||||
|
urls.changePackageStatus(item.id),
|
||||||
|
payload
|
||||||
|
);
|
||||||
|
if (result) {
|
||||||
|
for (const key in this.items) {
|
||||||
|
if (
|
||||||
|
this.items.hasOwnProperty(key) &&
|
||||||
|
this.items[key].id == item.id
|
||||||
|
) {
|
||||||
|
this.items[key].status = result.data.data.status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
async loadMedicalCenters() {
|
async loadMedicalCenters() {
|
||||||
const result = await ApiService.get(urls.listFilterItemsTestResult);
|
const result = await ApiService.get(urls.listFilterItemsTestResult);
|
||||||
if (result && result.status == 200) {
|
if (result && result.status == 200) {
|
||||||
|
|||||||
Reference in New Issue
Block a user