diff --git a/src/App.vue b/src/App.vue
index 53749eb..304dd89 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -23,6 +23,20 @@ export default defineComponent({
this.store.setupAPIData();
},
+ computed: {
+ currentStockString() {
+ return this.store.stockString;
+ },
+ },
+
+ watch: {
+ currentStockString(val: string) {
+ if (val != this.store.chosenStorageStockString) {
+ this.store.chosenStorageStockName = '';
+ }
+ },
+ },
+
methods: {
loadStockDataFromStorage() {
const savedData = localStorage.getItem('savedStockData');
diff --git a/src/components/tabs/StockListTab.vue b/src/components/tabs/StockListTab.vue
index e7da9dd..0a05915 100644
--- a/src/components/tabs/StockListTab.vue
+++ b/src/components/tabs/StockListTab.vue
@@ -22,12 +22,6 @@
diff --git a/src/components/tabs/StorageTab.vue b/src/components/tabs/StorageTab.vue
index aa42553..e546ecf 100644
--- a/src/components/tabs/StorageTab.vue
+++ b/src/components/tabs/StorageTab.vue
@@ -110,6 +110,7 @@ export default defineComponent({
delete this.store.storageStockData[stockName];
this.store.chosenStorageStockName = '';
+ this.store.chosenStorageStockString = '';
try {
localStorage.setItem('savedStockData', JSON.stringify(this.store.storageStockData));
@@ -122,6 +123,8 @@ export default defineComponent({
try {
this.loadStockFromString(this.store.storageStockData[stockName].stockString);
this.store.chosenStorageStockName = stockName;
+ this.store.chosenStorageStockString = this.store.storageStockData[stockName].stockString;
+
this.$router.push('/');
} catch (error) {
console.log(error);
diff --git a/src/components/tabs/stock-list/StockActions.vue b/src/components/tabs/stock-list/StockActions.vue
index 40f6d05..6b3ed40 100644
--- a/src/components/tabs/stock-list/StockActions.vue
+++ b/src/components/tabs/stock-list/StockActions.vue
@@ -247,8 +247,6 @@ export default defineComponent({
if (!entryName) return;
- let updatedAt: number | undefined = undefined;
-
if (entryName in this.store.storageStockData) {
const overwriteDataConfirm = confirm(this.$t('stocklist.prompt-bookmark-overwrite'));
@@ -267,6 +265,7 @@ export default defineComponent({
try {
localStorage.setItem('savedStockData', JSON.stringify(this.store.storageStockData));
this.store.chosenStorageStockName = entryName;
+ this.store.chosenStorageStockString = this.store.stockString;
} catch (error) {
console.error('Wystąpił błąd podczas zapisywania składu do localStorage!', error);
}
diff --git a/src/components/tabs/stock-list/StockSpecs.vue b/src/components/tabs/stock-list/StockSpecs.vue
index e1388a9..afdac71 100644
--- a/src/components/tabs/stock-list/StockSpecs.vue
+++ b/src/components/tabs/stock-list/StockSpecs.vue
@@ -1,20 +1,25 @@
-
-
-
- {{ store.chosenStorageStockName }}
-
- |
-
+
+
+
+
+ {{ store.chosenStorageStockName.slice(0, 40) }}
+ {{ store.chosenStorageStockName.length > 41 ? '...' : '' }}
+
+ |
+
-
+
+
+
+ {{ chosenRealComposition.number }} {{ chosenRealComposition.name }}
+
+
+
{{ $t('stocklist.mass') }}
@@ -36,18 +41,31 @@
import { defineComponent } from 'vue';
import { useStore } from '../../../store';
import imageMixin from '../../../mixins/imageMixin';
+import { BookmarkIcon } from '@heroicons/vue/20/solid';
export default defineComponent({
+ components: { BookmarkIcon },
+
mixins: [imageMixin],
data: () => ({
store: useStore(),
}),
+
+ computed: {
+ chosenRealComposition() {
+ const currentStockString = this.store.stockList.map((s) => s.vehicleRef.type).join(';');
+
+ return this.store.realCompositionList.find((rc) => rc.stockString == currentStockString);
+ },
+ },
});