From 9498911e7a22cd245b27974ff01302f13ea03232 Mon Sep 17 00:00:00 2001 From: webfussel Date: Sat, 10 May 2025 14:32:40 +0200 Subject: [PATCH] add: reactive store Add useLocalStorage from VueUse --- app/components/Pp/PriceCard.vue | 16 ++- app/components/Pp/PriceCardDialog.vue | 1 - app/pages/index.vue | 147 +++++++++++--------------- shared/Card.ts | 15 ++- 4 files changed, 81 insertions(+), 98 deletions(-) diff --git a/app/components/Pp/PriceCard.vue b/app/components/Pp/PriceCard.vue index 51626a3..f9fc9e8 100755 --- a/app/components/Pp/PriceCard.vue +++ b/app/components/Pp/PriceCard.vue @@ -33,21 +33,21 @@
- {{ intl.format(card.ppr) }} + {{ intl.format(ppr) }}
Pro 1 {{ card.roles ? `(${card.roles})` : '' }}
- {{ intl.format(card.pps) }} + {{ intl.format(pps) }}
Pro 100 {{ card.sheets ? `(${card.sheets})` : '' }}
- {{ intl.format(card.ppl) }} + {{ intl.format(ppl) }}
Pro 100 {{ card.layers ? `(${card.layers})` : '' }}
@@ -92,7 +92,17 @@ const { lengthX, direction, isSwiping } = useSwipe(top, { }, }) +const priceClean = computed(() => +replaceComma(card.price)) +const ppr = computed(() => priceClean.value / +card.roles) +const pps = computed(() => (ppr.value / +card.sheets) * 100) +const ppl = computed(() => (pps.value / +card.layers)) + const update = () => emit('update') const deleteCard = () => emit('remove') + +defineExpose({ + ppr, pps, ppl, uuid : card.uuid, +}) + diff --git a/app/components/Pp/PriceCardDialog.vue b/app/components/Pp/PriceCardDialog.vue index ffd34b3..b16a262 100644 --- a/app/components/Pp/PriceCardDialog.vue +++ b/app/components/Pp/PriceCardDialog.vue @@ -83,7 +83,6 @@ const { currentCardIndex, currentCard } = defineProps() const emit = defineEmits(['update']) const dialog = useTemplateRef('dialog') -const cardLabel = computed(() => currentCardIndex > -1 ? 'Bearbeiten' : 'Hinzufügen') const checkPrice = () => { if (!currentCard) { return false } diff --git a/app/pages/index.vue b/app/pages/index.vue index 7572b4d..4e386fc 100755 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -1,61 +1,66 @@ diff --git a/shared/Card.ts b/shared/Card.ts index 59ed2c9..9937a0d 100644 --- a/shared/Card.ts +++ b/shared/Card.ts @@ -1,11 +1,8 @@ export type Card = { - ppr: number - pps: number - ppl: number - uuid: string - name: string - price: string - roles: string - sheets: string - layers: string + uuid : string + name : string + price : string + roles : string + sheets : string + layers : string }