fix : package transfer

This commit is contained in:
zeinab.ashrafi
2025-05-15 12:04:49 +03:30
parent ba6cc0ef83
commit be15f1352c
6 changed files with 54 additions and 24 deletions
+11 -1
View File
@@ -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);
}
+3
View File
@@ -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}`;
},
+3 -2
View File
@@ -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>
@@ -316,7 +317,7 @@ export default {
async transfer(data) {
this.changeCurrentModal({
modal: "modal-user-list",
properties: {data},
properties: {data, type: 'item'},
});
},
},
+1 -1
View File
@@ -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) {
+12 -3
View File
@@ -22,7 +22,9 @@
<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>
@@ -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"])
+9 -2
View File
@@ -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})