Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
Dims optional, tooltip Kommission, fix search with Ressort/Bereich (#21)
Browse files Browse the repository at this point in the history
* Fix search with Bereich, Ressort
Added Tooltip to Kommissionieren
Dims are now optional
  • Loading branch information
zzTriplezz authored Jan 12, 2022
1 parent 2b0949d commit 9743d76
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 26 deletions.
49 changes: 40 additions & 9 deletions src/components/SearchShipment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1274,8 +1274,13 @@ export default class SearchShipment extends Vue {
for (let y = 0; this.searchCategoryChildAdd.length > y; y++) {
if (this.searchCategoryChildAdd[y] && this.searchChildAdd[y]) {
filteredDataKey.push(this.searchCategoryChildAdd[y]);
filteredDataValue.push(this.searchChildAdd[y]);
if (this.searchCategoryChildAdd[y] === "Auftraggeber ID") {
filteredDataKey.unshift(this.searchCategoryChildAdd[y]);
filteredDataValue.unshift(this.searchChildAdd[y]);
} else {
filteredDataKey.push(this.searchCategoryChildAdd[y]);
filteredDataValue.push(this.searchChildAdd[y]);
}
}
}
Expand Down Expand Up @@ -1413,10 +1418,21 @@ export default class SearchShipment extends Vue {
}
}
if (filteredDataKey[i] === "Auftraggeber ID") {
principals.push(filteredDataValue[i].trim());
filter.principal = {
in: principals,
};
let valueToPush: number;
try {
valueToPush = Number(filteredDataValue[i].trim());
} catch {
return order;
}
if (valueToPush) {
principals.push(valueToPush);
filter.principal = {
in: principals,
};
} else {
return order;
}
}
if (filteredDataKey[i] === "Auftraggeber Email") {
// eslint-disable-next-line no-await-in-loop
Expand Down Expand Up @@ -1621,7 +1637,15 @@ export default class SearchShipment extends Vue {
}
if (arrayBereichPrinci.length > 0) {
principals = principals.concat(arrayBereichPrinci);
if (principals.length > 0) {
if ((principals.filter((value) => arrayBereichPrinci.includes(value)))?.length) {
principals = principals.filter((value) => arrayBereichPrinci.includes(value));
} else {
return order;
}
} else {
principals = principals.concat(arrayBereichPrinci);
}
filter.principal = {
in: principals,
};
Expand Down Expand Up @@ -1665,14 +1689,21 @@ export default class SearchShipment extends Vue {
}
if (arrayRessortPrinci.length > 0) {
principals = principals.concat(arrayRessortPrinci);
if (principals.length > 0) {
if ((principals.filter((value) => arrayRessortPrinci.includes(value)))?.length) {
principals = principals.filter((value) => arrayRessortPrinci.includes(value));
} else {
return order;
}
} else {
principals = principals.concat(arrayRessortPrinci);
}
filter.principal = {
in: principals,
};
}
}
}
// Check if filter is empty
if (Object.keys(filter).length === 0 && filter.constructor === Object) {
return order;
Expand Down
47 changes: 30 additions & 17 deletions src/components/subComponents/NewShipmentGoods.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@
<v-text-field
v-model="length"
:rules="dimRules"
required
label="Länge (cm)*"
label="Länge (cm)"
/>
</v-col>
<v-col
Expand All @@ -73,8 +72,7 @@
<v-text-field
v-model="width"
:rules="dimRules"
required
label="Breite (cm)*"
label="Breite (cm)"
/>
</v-col>
<v-col
Expand All @@ -84,8 +82,7 @@
<v-text-field
v-model="height"
:rules="dimRules"
required
label="Höhe (cm)*"
label="Höhe (cm)"
/>
</v-col>
<v-col
Expand Down Expand Up @@ -116,7 +113,7 @@
v-model="valueCHF"
:rules="valueCHFRules"
label="Warenwert in CHF*"
hint="Falls nicht bekannt 0 CHF eintragen"
hint="Falls nicht bekannt 1 CHF eintragen"
required
/>
</v-col>
Expand All @@ -135,12 +132,26 @@
cols="2"
class="mt-n7"
>
<v-checkbox
v-model="kommission"
label="Kommission nötig"
color="red"
hide-details
/>
<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }">
<div
v-bind="attrs"
v-on="on"
>
<v-checkbox
v-model="kommission"
label="Kommission nötig"
color="red"
hide-details
v-bind="attrs"
v-on="on"
/>
</div>
</template>
<span>
Kommission nötig - Lieferung muss umgepackt werden. Weiterverteilung der Lieferung gemäss Angaben Auftraggeber.
</span>
</v-tooltip>
</v-col>
</v-row>
</v-form>
Expand Down Expand Up @@ -210,10 +221,12 @@ export default class NewShipmentGoods extends Vue {
private dimRules = [
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(v: any) => v !== null || v !== undefined || "Wert ist erforderlich",
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(v: any) => /^[0-9]{1,11}(?:\.[0-9]{1})?$/.test(v)
|| "Nur Zahlen mit max. 1 Kommastelle",
(v: any) => {
if (v) {
return /^[0-9]{1,11}(?:\.[0-9]{1})?$/.test(v) || "Nur Zahlen mit max. 1 Kommastelle";
}
return true;
},
];
private valueCHFRules = [
Expand Down

0 comments on commit 9743d76

Please sign in to comment.