Bugfix: update url, when remove line from mass edit view

This commit is contained in:
Jan 2025-10-19 15:27:30 +02:00
parent de896cea30
commit a2e0029dfe
2 changed files with 43 additions and 8 deletions

View file

@ -222,6 +222,7 @@ export default {
},
remove() {
this.premiseEditStore.removePremise(this.id);
this.$emit('remove', this.id);
}
}
}

View file

@ -18,7 +18,7 @@
</div>
</div>
<Toast ref="toast" />
<Toast ref="toast"/>
<transition name="list-edit-container" tag="div">
<transition-group name="list-edit" mode="out-in" class="edit-calculation-list-container" tag="div">
@ -45,7 +45,8 @@
</div>
<bulk-edit-row v-else class="edit-calculation-list-item" v-for="premise of this.premiseEditStore.getPremisses"
:key="premise.id" :id="premise.id" :premise="premise" @action="onClickAction">
:key="premise.id" :id="premise.id" :premise="premise" @action="onClickAction"
@remove="updateUrl">
</bulk-edit-row>
@ -133,7 +134,17 @@ const COMPONENT_TYPES = {
export default {
name: "MassEdit",
components: {Toast, Modal, MassEditDialog, ListEdit, Spinner, CalculationListItem, Checkbox, BulkEditRow, BasicButton},
components: {
Toast,
Modal,
MassEditDialog,
ListEdit,
Spinner,
CalculationListItem,
Checkbox,
BulkEditRow,
BasicButton
},
computed: {
...mapStores(usePremiseEditStore),
hasSelection() {
@ -187,6 +198,7 @@ export default {
this.ids = new UrlSafeBase64().decodeIds(this.$route.params.ids);
this.premiseEditStore.loadPremissesForced(this.ids);
},
data() {
return {
ids: [],
@ -216,10 +228,25 @@ export default {
}
},
methods: {
updateUrl(id) {
const idx = this.ids.findIndex(curId => curId === id);
if (idx > -1) {
this.ids.splice(idx, 1);
this.$router.replace({
name: "bulk",
params: {
ids: new UrlSafeBase64().encodeIds(this.ids)
}
});
}
},
async startCalculation() {
const error = await this.premiseEditStore.startCalculation();
if(error !== null) {
if (error !== null) {
this.$refs.toast.addToast({
icon: 'warning',
@ -228,8 +255,7 @@ export default {
variant: 'exception',
duration: 8000
})
} else
{
} else {
this.closeMassEdit()
}
},
@ -271,7 +297,7 @@ export default {
} else if (action === "accept") {
const props = this.componentsData[this.modalType].props;
switch(this.modalType) {
switch (this.modalType) {
case "price":
await this.premiseEditStore.batchUpdatePrice(this.editIds, props);
break;
@ -294,7 +320,15 @@ export default {
// clear
this.componentsData = {
price: {props: {price: null, overSeaShare: null, includeFcaFee: null}},
material: {props: {partNumber: "", hsCode: null, tariffRate: null, description: null, hideDescription: hideDescription}},
material: {
props: {
partNumber: "",
hsCode: null,
tariffRate: null,
description: null,
hideDescription: hideDescription
}
},
packaging: {
props: {
length: null,