mirror of
https://git.meshkee.com/cssd/cssd-front.git
synced 2026-10-10 19:13:18 +03:30
fix : package transfer
This commit is contained in:
@@ -114,13 +114,23 @@ export default {
|
|||||||
},
|
},
|
||||||
async transfer() {
|
async transfer() {
|
||||||
try {
|
try {
|
||||||
const result = await this.transferItem({
|
let result = {}
|
||||||
itemId: this.getModalProperties.data.id,
|
if (this.getModalProperties.type && this.getModalProperties.type === 'item') {
|
||||||
userId: this.selected.id,
|
result = await this.transferItem({
|
||||||
isUser: this.$hasRole('User')
|
itemId: this.getModalProperties.data.id,
|
||||||
});
|
userId: this.selected.id,
|
||||||
this.setResultModal(result);
|
isUser: this.$hasRole('User')
|
||||||
this.closeModal();
|
});
|
||||||
|
} 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) {
|
} catch (e) {
|
||||||
console.error("Transfer failed:", e);
|
console.error("Transfer failed:", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,6 +183,9 @@ const urls = {
|
|||||||
transferItem: function (id) {
|
transferItem: function (id) {
|
||||||
return `/transfer-items/${id}`;
|
return `/transfer-items/${id}`;
|
||||||
},
|
},
|
||||||
|
transferPackage: function (id) {
|
||||||
|
return `/transfer-packages/${id}`;
|
||||||
|
},
|
||||||
removeItem: function (id) {
|
removeItem: function (id) {
|
||||||
return `Items/${id}`;
|
return `Items/${id}`;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -44,7 +44,8 @@
|
|||||||
<span>Filter</span>
|
<span>Filter</span>
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
|
|
||||||
<v-btn class="WM-Outline-Btn WM-Border mr-2 WM-Margin-BT-0 WM-Border-Black" @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>
|
<v-icon class="black--text mr-2 caption">fas fa-share-square</v-icon>
|
||||||
<span class="black--text">EXPORT</span>
|
<span class="black--text">EXPORT</span>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
@@ -288,8 +289,8 @@ export default {
|
|||||||
getStatus(item) {
|
getStatus(item) {
|
||||||
if (item.status === 'pending') {
|
if (item.status === 'pending') {
|
||||||
return [
|
return [
|
||||||
{status: 'approved', label: 'approve', color: 'cyan', font_color : 'white', icon: 'fa-check'},
|
{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: 'rejected', label: 'reject', color: 'light-gray', font_color: 'black', icon: 'fa-close'},
|
||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
const nextStatus = item.status === 'rejected' ? 'approved' : 'rejected'
|
const nextStatus = item.status === 'rejected' ? 'approved' : 'rejected'
|
||||||
@@ -316,7 +317,7 @@ export default {
|
|||||||
async transfer(data) {
|
async transfer(data) {
|
||||||
this.changeCurrentModal({
|
this.changeCurrentModal({
|
||||||
modal: "modal-user-list",
|
modal: "modal-user-list",
|
||||||
properties: {data},
|
properties: {data, type: 'item'},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ export default {
|
|||||||
async transfer(data) {
|
async transfer(data) {
|
||||||
this.changeCurrentModal({
|
this.changeCurrentModal({
|
||||||
modal: "modal-user-list",
|
modal: "modal-user-list",
|
||||||
properties: {data},
|
properties: {data, type: 'item'},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async generateBarcode(item, type = null) {
|
async generateBarcode(item, type = null) {
|
||||||
|
|||||||
@@ -22,17 +22,19 @@
|
|||||||
<v-flex xs12 sm6 md6 lg4 xl3 class="WM-Align-R">
|
<v-flex xs12 sm6 md6 lg4 xl3 class="WM-Align-R">
|
||||||
<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="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-icon class="black--text caption">fas fa-search</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</template>
|
</template>
|
||||||
<span>Filter</span>
|
<span>Filter</span>
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
|
|
||||||
<!-- <v-btn class="WM-Outline-Btn WM-Border mr-2 WM-Margin-BT-0 WM-Border-Black" style="padding: 10px 30px;">
|
<!-- <v-btn class="WM-Outline-Btn WM-Border mr-2 WM-Margin-BT-0 WM-Border-Black" style="padding: 10px 30px;">
|
||||||
<v-icon class="black--text mr-2 caption">fas fa-share-square</v-icon>
|
<v-icon class="black--text mr-2 caption">fas fa-share-square</v-icon>
|
||||||
<span class="black--text">EXPORT</span>
|
<span class="black--text">EXPORT</span>
|
||||||
</v-btn>-->
|
</v-btn>-->
|
||||||
|
|
||||||
<router-link :to="{ name: 'AddPackage' }">
|
<router-link :to="{ name: 'AddPackage' }">
|
||||||
<v-btn class="WM-CyanBlueGradient-BG WM-Margin-BT-0" style="padding:10px 30px">
|
<v-btn class="WM-CyanBlueGradient-BG WM-Margin-BT-0" style="padding:10px 30px">
|
||||||
@@ -261,8 +263,8 @@ export default {
|
|||||||
getStatus(item) {
|
getStatus(item) {
|
||||||
if (item.status === 'pending') {
|
if (item.status === 'pending') {
|
||||||
return [
|
return [
|
||||||
{status: 'approved', label: 'approve', color: 'cyan' , font_color : 'white', icon: 'fa-check'},
|
{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: 'rejected', label: 'reject', color: 'light-gray', font_color: 'black', icon: 'fa-close'},
|
||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
const nextStatus = item.status === 'rejected' ? 'approved' : 'rejected'
|
const nextStatus = item.status === 'rejected' ? 'approved' : 'rejected'
|
||||||
@@ -293,11 +295,18 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async transfer(data) {
|
async transfer(data) {
|
||||||
this.changeCurrentModal({
|
const result = this.changeCurrentModal({
|
||||||
modal: "modal-user-list",
|
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: {
|
computed: {
|
||||||
...mapGetters("modal", ["getModalResult"])
|
...mapGetters("modal", ["getModalResult"])
|
||||||
|
|||||||
@@ -292,10 +292,17 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async transfer(data) {
|
async transfer(data) {
|
||||||
this.changeCurrentModal({
|
const result = this.changeCurrentModal({
|
||||||
modal: "modal-user-list",
|
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) {
|
async changeStatus(item, status) {
|
||||||
const result = await ApiService.post(urls.changePackageStatus(item.id), {status})
|
const result = await ApiService.post(urls.changePackageStatus(item.id), {status})
|
||||||
|
|||||||
Reference in New Issue
Block a user