mirror of
https://git.meshkee.com/cssd/cssd-front.git
synced 2026-10-14 00:53:17 +03:30
fix
This commit is contained in:
+20
-10
@@ -52,7 +52,8 @@
|
|||||||
<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 }">
|
||||||
<span class="subheading font-weight-light text-white text--darken-3" v-text="header.text" />
|
<span class="subheading font-weight-light text-white text--darken-3"
|
||||||
|
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>
|
||||||
@@ -66,14 +67,18 @@
|
|||||||
<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('Supervisor|Admin')">
|
<v-tooltip bottom open-on-hover v-if="$hasRole('Supervisor|Admin')">
|
||||||
<template v-slot:activator="{ on, attrs }">
|
<template v-slot:activator="{ on, attrs }">
|
||||||
<v-btn :color="item.status ? 'red' : 'green'" class="mr-2"
|
<v-btn
|
||||||
@click="changeStatus(item.id)" v-bind="attrs" v-on="on">
|
:color="!['suspended', 'rejected'].includes(item.status) ? 'red' : 'green'"
|
||||||
<v-icon class="white--text mr-1 caption">fas {{ item.status ? 'fa-close' :
|
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>
|
'fa-check' }}</v-icon>
|
||||||
<span>{{ item.status ? 'reject' : 'approve' }}</span>
|
<span>{{ !['suspended', 'rejected'].includes(item.status) ? 'reject' :
|
||||||
|
'approve' }}</span>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</template>
|
</template>
|
||||||
<span>{{ item.status ? 'reject' : 'approve' }}</span>
|
<span>{{ !['suspended', 'rejected'].includes(item.status) ? 'reject' : 'approve'
|
||||||
|
}}</span>
|
||||||
</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 }">
|
||||||
@@ -126,7 +131,8 @@
|
|||||||
</v-layout>
|
</v-layout>
|
||||||
<v-divider></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>
|
||||||
<v-layout row wrap align-center justify-center class="mt-3">
|
<v-layout row wrap align-center justify-center class="mt-3">
|
||||||
<router-link to="/dashboard">
|
<router-link to="/dashboard">
|
||||||
@@ -267,15 +273,19 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async changeStatus(id) {
|
async changeStatus(item) {
|
||||||
|
const payload = {
|
||||||
|
status: ['suspended', 'rejected'].includes(item.status) ? 'approved' : 'rejected',
|
||||||
|
}
|
||||||
const result = await ApiService.post(
|
const result = await ApiService.post(
|
||||||
urls.changeItemStatus(id)
|
urls.changeItemStatus(item.id),
|
||||||
|
payload
|
||||||
);
|
);
|
||||||
if (result) {
|
if (result) {
|
||||||
for (const key in this.items) {
|
for (const key in this.items) {
|
||||||
if (
|
if (
|
||||||
this.items.hasOwnProperty(key) &&
|
this.items.hasOwnProperty(key) &&
|
||||||
this.items[key].id == id
|
this.items[key].id == item.id
|
||||||
) {
|
) {
|
||||||
this.items[key].status = result.data.data.status;
|
this.items[key].status = result.data.data.status;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user