@@ -178,7 +179,9 @@ export default {
}
},
methods: {
-
+ toPercent(value) {
+ return value !== null ? (value * 100).toFixed(2) : '0.00';
+ },
updateSelected(value) {
this.premiseEditStore.setSelectTo([this.id], value);
},
@@ -214,10 +217,6 @@ export default {
overflow: hidden;
}
-/*.bulk-edit-row:hover {
-// background-color: rgba(107, 134, 156, 0.05);
-//} */
-
.bulk-edit-row:last-child {
border-bottom: none;
}
@@ -249,11 +248,6 @@ export default {
.edit-calculation-cell--copy-mode:hover {
cursor: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyOCIgaGVpZ2h0PSIyOCIgdmlld0JveD0iMCAwIDI1NiAyNTYiPgogIDxyZWN0IHg9Ijg0IiB5PSIzMiIgd2lkdGg9IjEzNiIgaGVpZ2h0PSIxMzYiIGZpbGw9IndoaXRlIiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iOCIgcng9IjQiLz4KICA8cmVjdCB4PSIzNiIgeT0iODQiIHdpZHRoPSIxMzYiIGhlaWdodD0iMTM2IiBmaWxsPSJ3aGl0ZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjgiIHJ4PSI0Ii8+Cjwvc3ZnPg==") 12 12, pointer;
-
- /*cursor: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0iI2ZmZmZmZiIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjQiIHZpZXdCb3g9IjAgMCAyNTYgMjU2Ij4KICA8cGF0aCBkPSJNMjAwLDMySDE2My43NGE0Ny45Miw0Ny45MiwwLDAsMC03MS40OCwwSDU2QTE2LDE2LDAsMCwwLDQwLDQ4VjIxNmExNiwxNiwwLDAsMCwxNiwxNkgyMDBhMTYsMTYsMCwwLDAsMTYtMTZWNDhBMTYsMTYsMCwwLDAsMjAwLDMyWm0tNzIsMGEzMiwzMiwwLDAsMSwzMiwzMkg5NkEzMiwzMiwwLDAsMSwxMjgsMzJaIj48L3BhdGg+Cjwvc3ZnPg==") 12 12, pointer;
-*/
-
-
background-color: rgba(107, 134, 156, 0.05);
border-radius: 0.8rem;
box-shadow: 0 0.4rem 0.6rem -0.1rem rgba(0, 0, 0, 0.1);
diff --git a/src/frontend/src/components/layout/edit/DestinationListView.vue b/src/frontend/src/components/layout/edit/DestinationListView.vue
index c432041..c599753 100644
--- a/src/frontend/src/components/layout/edit/DestinationListView.vue
+++ b/src/frontend/src/components/layout/edit/DestinationListView.vue
@@ -93,12 +93,10 @@ export default {
},
async addDestination(node) {
console.log(node)
- // todo add to massEdit copy only
const [id] = await this.premiseEditStore.addDestination(node);
this.editDestination(id);
},
deleteDestination(id) {
- // todo delete from to massEdit copy only
this.premiseEditStore.deleteDestination(id);
},
editDestination(id) {
diff --git a/src/frontend/src/components/layout/edit/MaterialEdit.vue b/src/frontend/src/components/layout/edit/MaterialEdit.vue
index 771b6da..0ae60dd 100644
--- a/src/frontend/src/components/layout/edit/MaterialEdit.vue
+++ b/src/frontend/src/components/layout/edit/MaterialEdit.vue
@@ -28,14 +28,14 @@
+ placeholder="Find hs code" no-results-text="Not found.">
Tariff rate [%]
-
@@ -59,6 +59,7 @@ import {mapStores} from "pinia";
import {parseNumberFromString} from "@/common.js";
import Modal from "@/components/UI/Modal.vue";
import SelectMaterial from "@/components/layout/material/SelectMaterial.vue";
+import {useCustomsStore} from "@/store/customs.js";
export default {
name: "MaterialEdit",
@@ -66,7 +67,7 @@ export default {
SelectMaterial,
Modal, PhArrowCounterClockwise, ModalDialog, AutosuggestSearchbar, InputField, Flag, IconButton
},
- emits: ["update:tariffRate", "updateMaterial", "update:partNumber", "update:hsCode"],
+ emits: ["update:tariffRate", "updateMaterial", "update:partNumber", "update:hsCode", "save"],
props: {
description: {
type: String,
@@ -86,7 +87,7 @@ export default {
},
},
computed: {
- ...mapStores(useMaterialStore),
+ ...mapStores(useMaterialStore, useCustomsStore),
tariffRatePercent() {
return this.tariffRate ? (this.tariffRate * 100).toFixed(2) : '';
}
@@ -119,25 +120,25 @@ export default {
}
});
},
- validateInput(type, event) {
- const decimals = 2
- const parsed = parseNumberFromString(event.target.value, decimals);
- console.log('validateInput', type, event.target.value, parsed);
+ validateTariffRate(event) {
+ const percentValue = parseNumberFromString(event.target.value, 4);
- this.$emit(`update:${type}`, parsed);
+ const validatedPercent = Math.max(0, Math.min(999.99, percentValue));
+ const validatedDecimal = validatedPercent / 100;
- // Force update the input field with the correctly formatted value
- const formattedValue = parsed.toFixed(decimals);
- const inputRef = `${type}Input`;
- this.updateInputValue(inputRef, formattedValue);
+ if (validatedDecimal !== this.tariffRate) {
+ this.$emit('update:tariffRate', validatedDecimal);
+ }
+
+ event.target.value = validatedPercent.toFixed(2);
},
activateEditMode() {
this.modalSelectMaterial = true;
},
async fetchHsCode(query) {
const hsCodeQuery = {searchTerm: query};
- await this.customs.setQuery(hsCodeQuery);
- return this.customs.hsCodes;
+ await this.customsStore.setQuery(hsCodeQuery);
+ return this.customsStore.hsCodes;
}
}
}
diff --git a/src/frontend/src/components/layout/edit/PriceEdit.vue b/src/frontend/src/components/layout/edit/PriceEdit.vue
index 47d7170..6e32000 100644
--- a/src/frontend/src/components/layout/edit/PriceEdit.vue
+++ b/src/frontend/src/components/layout/edit/PriceEdit.vue
@@ -34,7 +34,7 @@ import {parseNumberFromString} from "@/common.js";
export default {
name: "PriceEdit",
components: {Tooltip, Checkbox},
- emits: ['update:price', 'update:overSeaShare', 'update:includeFcaFee'],
+ emits: ['update:price', 'update:overSeaShare', 'update:includeFcaFee', 'save'],
props: {
price: {
required: true,
diff --git a/src/frontend/src/components/layout/edit/destination/DestinationEdit.vue b/src/frontend/src/components/layout/edit/destination/DestinationEdit.vue
index 90da764..6673779 100644
--- a/src/frontend/src/components/layout/edit/destination/DestinationEdit.vue
+++ b/src/frontend/src/components/layout/edit/destination/DestinationEdit.vue
@@ -65,7 +65,7 @@ export default {
flex-direction: column;
gap: 1.6rem;
flex: 1 0 min(60vw, 120rem);
- height: min(70vh, 50rem);
+ height: min(60vh, 120rem);
min-height: 0; /* Critical: allows flex child to shrink below content size */
}
diff --git a/src/frontend/src/components/layout/edit/destination/DestinationEditRoutes.vue b/src/frontend/src/components/layout/edit/destination/DestinationEditRoutes.vue
index 43c342c..3c1c4db 100644
--- a/src/frontend/src/components/layout/edit/destination/DestinationEditRoutes.vue
+++ b/src/frontend/src/components/layout/edit/destination/DestinationEditRoutes.vue
@@ -102,13 +102,13 @@ export default {
return `Annual quantity that "${this.destination.destination_node.name}" will source from the supplier`
},
showMassEditWarning() {
- return (this.destination.massEdit ?? false);
+ return (this.destination.routes ?? null) === null;
},
showRoutes() {
- return !this.destination.is_d2d && this.destination.routes?.length > 0 | false;
+ return !this.destination.is_d2d && (this.destination.routes?.length > 0);
},
showRouteWarning() {
- return !this.destination.is_d2d && this.destination.routes.length === 0;
+ return !this.destination.is_d2d && this.destination.routes?.length === 0;
},
calculationModel: {
get() {
diff --git a/src/frontend/src/components/layout/material/SelectMaterial.vue b/src/frontend/src/components/layout/material/SelectMaterial.vue
index fc25437..a02995f 100644
--- a/src/frontend/src/components/layout/material/SelectMaterial.vue
+++ b/src/frontend/src/components/layout/material/SelectMaterial.vue
@@ -22,7 +22,7 @@
{{ hsCode }}
+ text="Tick to reload master data from database (if present) and overwrite current values.">
update master data
diff --git a/src/frontend/src/pages/CalculationMassEdit.vue b/src/frontend/src/pages/CalculationMassEdit.vue
index 478e36e..c32d4fb 100644
--- a/src/frontend/src/pages/CalculationMassEdit.vue
+++ b/src/frontend/src/pages/CalculationMassEdit.vue
@@ -1,3 +1,5 @@
+
+