commit 7fcd5b8f84816ad6e424264db8889caec5e81c55 parent 01557a5c0abfa81dae69f2de9aba2382fd4ae39d Author: Sebastian <sebasjm@gmail.com> Date: Sat, 15 Nov 2025 18:44:29 -0300 fix #10602 Diffstat:
3 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/packages/merchant-backoffice-ui/src/components/form/InputStock.tsx b/packages/merchant-backoffice-ui/src/components/form/InputStock.tsx @@ -94,7 +94,7 @@ export function InputStock<T>({ <div class="field-body is-flex-grow-3"> <div class="field has-addons"> {!alreadyExist ? ( - <button type="button" class="button" + <button type="button" class="button" data-tooltip={i18n.str`Click here to configure the product's stock. If left as is, the backend will not control stock.`} onClick={(): void => { valueHandler({ @@ -109,7 +109,7 @@ export function InputStock<T>({ </span> </button> ) : ( - <button type="button" class="button" + <button type="button" class="button" data-tooltip={i18n.str`This product has been configured without stock control`} disabled > @@ -182,7 +182,7 @@ export function InputStock<T>({ name="current" label={i18n.str`Current`} side={ - <button type="button" class="button is-danger" + <button type="button" class="button is-danger" data-tooltip={i18n.str`Remove stock control for this product`} onClick={(): void => { valueHandler(undefined as any); diff --git a/packages/merchant-backoffice-ui/src/components/product/ProductForm.tsx b/packages/merchant-backoffice-ui/src/components/product/ProductForm.tsx @@ -142,7 +142,16 @@ export function ProductForm({ onSubscribe, initial, alreadyExist }: Props) { const stock = value.stock; if (!stock) { - value.total_stock = -1; + // the the input was untouched, then set the same + // initial value + value.total_stock = initial?.total_stock; + value.total_lost = initial?.total_lost; + value.next_restock = initial?.next_restock; + value.address = initial?.address; + + if (!value.total_stock) { + value.total_stock = -1; + } } else { value.total_stock = stock.current; value.total_lost = stock.lost; diff --git a/packages/merchant-backoffice-ui/src/paths/instance/products/update/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/products/update/index.tsx @@ -20,18 +20,10 @@ */ import { HttpStatusCode, TalerError, TalerMerchantApi, assertUnreachable } from "@gnu-taler/taler-util"; -import { - LocalNotificationBannerBulma, - useTranslationContext -} from "@gnu-taler/web-util/browser"; import { Fragment, VNode, h } from "preact"; -import { useState } from "preact/hooks"; import { ErrorLoadingMerchant } from "../../../../components/ErrorLoadingMerchant.js"; import { Loading } from "../../../../components/exception/loading.js"; -import { NotificationCard } from "../../../../components/menu/index.js"; -import { useSessionContext } from "../../../../context/session.js"; import { useProductDetails } from "../../../../hooks/product.js"; -import { Notification } from "../../../../utils/types.js"; import { LoginPage } from "../../../login/index.js"; import { NotFoundPageOrAdminCreate } from "../../../notfound/index.js"; import { UpdatePage } from "./UpdatePage.js"; @@ -49,7 +41,6 @@ export default function UpdateProduct({ }: Props): VNode { const result = useProductDetails(pid); - if (!result) return <Loading />; if (result instanceof TalerError) { return <ErrorLoadingMerchant error={result} />; @@ -68,7 +59,6 @@ export default function UpdateProduct({ } } - return ( <Fragment> <UpdatePage