From c2bbf7ea60367fd0d312c947a2d01688477786f4 Mon Sep 17 00:00:00 2001 From: Martin Berka Date: Fri, 5 Jun 2026 10:37:58 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20opravy=20generov=C3=A1n=C3=AD=20QR=20k?= =?UTF-8?q?=C3=B3d=C5=AF,=20zobrazen=C3=AD=20tak=C3=A9=20na=20str=C3=A1nce?= =?UTF-8?q?=20objedn=C3=A1n=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/App.tsx | 66 ++++--------------- client/src/Utils.tsx | 13 ++++ client/src/components/PendingPayments.tsx | 58 ++++++++++++++++ .../components/modals/PayForGroupModal.tsx | 3 +- client/src/pages/OrderGroupsPage.tsx | 18 ++++- server/changelogs/2026-06-05.json | 5 ++ server/src/qr.ts | 24 +++++-- server/src/tests/qr.test.ts | 25 ++++++- 8 files changed, 149 insertions(+), 63 deletions(-) create mode 100644 client/src/components/PendingPayments.tsx create mode 100644 server/changelogs/2026-06-05.json diff --git a/client/src/App.tsx b/client/src/App.tsx index ec14769..7342f87 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -16,12 +16,12 @@ import Footer from './components/Footer'; import { faArrowUpRightFromSquare, faBasketShopping, faChainBroken, faChevronLeft, faChevronRight, faGear, faMoneyBillTransfer, faSatelliteDish, faSearch, faTriangleExclamation } from '@fortawesome/free-solid-svg-icons'; import { useNavigate } from 'react-router-dom'; import Loader from './components/Loader'; -import { getHumanDateTime, isInTheFuture, formatDateString } from './Utils'; +import { getHumanDateTime, isInTheFuture } from './Utils'; import NoteModal from './components/modals/NoteModal'; -import ConfirmModal from './components/modals/ConfirmModal'; import PayForAllModal from './components/modals/PayForAllModal'; +import PendingPayments from './components/PendingPayments'; import { useEasterEgg } from './context/eggs'; -import { ClientData, Food, MealSlot, PendingQr, PizzaOrder, DepartureTime, PizzaDayState, Restaurant, RestaurantDayMenu, RestaurantDayMenuMap, LunchChoice, LocationLunchChoicesMap, UserLunchChoice, PizzaVariant, getData, getEasterEggImage, addPizza, removePizza, updatePizzaDayNote, createPizzaDay, deletePizzaDay, lockPizzaDay, unlockPizzaDay, finishOrder, finishDelivery, addChoice, jdemeObed, removeChoices, removeChoice, updateNote, changeDepartureTime, setBuyer, dismissQr, generateQr } from '../../types'; +import { ClientData, Food, MealSlot, PendingQr, PizzaOrder, DepartureTime, PizzaDayState, Restaurant, RestaurantDayMenu, RestaurantDayMenuMap, LunchChoice, LocationLunchChoicesMap, UserLunchChoice, PizzaVariant, getData, getEasterEggImage, addPizza, removePizza, updatePizzaDayNote, createPizzaDay, deletePizzaDay, lockPizzaDay, unlockPizzaDay, finishOrder, finishDelivery, addChoice, jdemeObed, removeChoices, removeChoice, updateNote, changeDepartureTime, setBuyer, generateQr } from '../../types'; import { getLunchChoiceName } from './enums'; // import FallingLeaves, { LEAF_PRESETS, LEAF_COLOR_THEMES } from './FallingLeaves'; // import './FallingLeaves.scss'; @@ -78,7 +78,6 @@ function App() { const [dayIndex, setDayIndex] = useState(); const [loadingPizzaDay, setLoadingPizzaDay] = useState(false); const [noteModalOpen, setNoteModalOpen] = useState(false); - const [dismissQrId, setDismissQrId] = useState(null); const [payForAllLocationKey, setPayForAllLocationKey] = useState(null); const [eggImage, setEggImage] = useState(); const eggRef = useRef(null); @@ -888,42 +887,21 @@ function App() { } - { - data.pizzaDay.state === PizzaDayState.DELIVERED && myOrder?.hasQr && (() => { - const pizzaQr = data.pendingQrs?.find(qr => qr.creator === data.pizzaDay?.creator); - return pizzaQr ? ( -
-

QR platba

- QR kód -
- ) : null; - })() - } } } - {data.pendingQrs && data.pendingQrs.length > 0 && -
-

Nevyřízené platby

-

Máte neuhrazené platby.

- {data.pendingQrs.map(qr => ( -
-

- {formatDateString(qr.date)} — {qr.creator} ({qr.totalPrice / 100} Kč) - {qr.purpose && <>
{qr.purpose}} -

- QR kód -
- -
-
- ))} -
- } + { + const response = await getData({ query: { dayIndex } }); + if (response.data) { + setData(response.data); + } + }} + /> {/* */}