mirror of
https://git.meshkee.com/cssd/cssd-front.git
synced 2026-10-10 19:23:38 +03:30
fix : package transfer
This commit is contained in:
@@ -114,13 +114,23 @@ export default {
|
||||
},
|
||||
async transfer() {
|
||||
try {
|
||||
const result = await this.transferItem({
|
||||
let result = {}
|
||||
if (this.getModalProperties.type && this.getModalProperties.type === 'item') {
|
||||
result = await this.transferItem({
|
||||
itemId: this.getModalProperties.data.id,
|
||||
userId: this.selected.id,
|
||||
isUser: this.$hasRole('User')
|
||||
});
|
||||
} else if (this.getModalProperties.type && this.getModalProperties.type === 'package') {
|
||||
result = await ApiService.post(urls.transferPackage(this.getModalProperties.data.id), {
|
||||
user_id: this.selected.id,
|
||||
});
|
||||
}
|
||||
if (result && result.status === 200) {
|
||||
this.setResultModal(result);
|
||||
this.closeModal();
|
||||
return result;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Transfer failed:", e);
|
||||
}
|
||||
|
||||
@@ -183,6 +183,9 @@ const urls = {
|
||||
transferItem: function (id) {
|
||||
return `/transfer-items/${id}`;
|
||||
},
|
||||
transferPackage: function (id) {
|
||||
return `/transfer-packages/${id}`;
|
||||
},
|
||||
removeItem: function (id) {
|
||||
return `Items/${id}`;
|
||||
},
|
||||
|
||||
@@ -44,7 +44,8 @@
|
||||
<span>Filter</span>
|
||||
</v-tooltip>
|
||||
|
||||
<v-btn class="WM-Outline-Btn WM-Border mr-2 WM-Margin-BT-0 WM-Border-Black" @click="download()" style="padding: 10px 30px;">
|
||||
<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>
|
||||
@@ -288,8 +289,8 @@ export default {
|
||||
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'},
|
||||
{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'
|
||||
@@ -316,7 +317,7 @@ export default {
|
||||
async transfer(data) {
|
||||
this.changeCurrentModal({
|
||||
modal: "modal-user-list",
|
||||
properties: {data},
|
||||
properties: {data, type: 'item'},
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
@@ -235,7 +235,7 @@ export default {
|
||||
async transfer(data) {
|
||||
this.changeCurrentModal({
|
||||
modal: "modal-user-list",
|
||||
properties: {data},
|
||||
properties: {data, type: 'item'},
|
||||
});
|
||||
},
|
||||
async generateBarcode(item, type = null) {
|
||||
|
||||
@@ -22,14 +22,16 @@
|
||||
<v-flex xs12 sm6 md6 lg4 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-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" 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>
|
||||
<span class="black--text">EXPORT</span>
|
||||
</v-btn>-->
|
||||
@@ -261,8 +263,8 @@ export default {
|
||||
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'},
|
||||
{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'
|
||||
@@ -293,11 +295,18 @@ export default {
|
||||
}
|
||||
},
|
||||
async transfer(data) {
|
||||
this.changeCurrentModal({
|
||||
const result = this.changeCurrentModal({
|
||||
modal: "modal-user-list",
|
||||
properties: {data},
|
||||
properties: {data, type:'package'},
|
||||
});
|
||||
if (result && result.status === 200) {
|
||||
for (const key in this.items) {
|
||||
if (this.items.hasOwnProperty(key) && this.items[key].id === data.id) {
|
||||
this.items.splice(key, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters("modal", ["getModalResult"])
|
||||
|
||||
@@ -292,10 +292,17 @@ export default {
|
||||
}
|
||||
},
|
||||
async transfer(data) {
|
||||
this.changeCurrentModal({
|
||||
const result = this.changeCurrentModal({
|
||||
modal: "modal-user-list",
|
||||
properties: {data},
|
||||
properties: {data, type:'package'},
|
||||
});
|
||||
if (result && result.status === 200) {
|
||||
for (const key in this.items) {
|
||||
if (this.items.hasOwnProperty(key) && this.items[key].id === data.id) {
|
||||
this.items.splice(key, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
async changeStatus(item, status) {
|
||||
const result = await ApiService.post(urls.changePackageStatus(item.id), {status})
|
||||
|
||||
Reference in New Issue
Block a user