merchant-backoffice

ZZZ: Inactive/Deprecated
Log | Files | Refs | Submodules | README

commit fb5a844be86c40e0fea2985092724e69f7a39374
parent 3ee6de02c72e7164fdfe7f67ff0678b58e996f93
Author: Sebastian <sebasjm@gmail.com>
Date:   Tue, 13 Apr 2021 16:03:38 -0300

add select by order id

Diffstat:
Mpackages/frontend/src/paths/instance/orders/list/index.tsx | 34++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+), 0 deletions(-)

diff --git a/packages/frontend/src/paths/instance/orders/list/index.tsx b/packages/frontend/src/paths/instance/orders/list/index.tsx @@ -52,6 +52,9 @@ export default function ({ onUnauthorized, onLoadError, onCreate, onSelect, onNo const [notif, setNotif] = useState<Notification | undefined>(undefined) + const [orderId, setOrderId] = useState<string | undefined>(undefined) + const [errorOrderId, setErrorOrderId] = useState<string | undefined>(undefined) + if (result.clientError && result.isUnauthorized) return onUnauthorized() if (result.clientError && result.isNotfound) return onNotFound() if (result.loading) return <Loading /> @@ -62,9 +65,40 @@ export default function ({ onUnauthorized, onLoadError, onCreate, onSelect, onNo const isNotWiredActive = filter.wired === 'no' ? "is-active" : '' const isAllActive = filter.paid === undefined && filter.refunded === undefined && filter.wired === undefined ? 'is-active' : '' + async function testIfOrderExistAndSelect() { + if (!orderId) { + setErrorOrderId('place an order id here') + return; + } + try { + const r = await getPaymentURL(orderId) + onSelect(orderId) + setErrorOrderId(undefined) + } catch { + setErrorOrderId('order not found') + } + } + return <section class="section is-main-section"> <NotificationCard notification={notif} /> + <div class="level"> + <div class="level-left"> + <div class="level-item"> + <div class="field has-addons"> + <div class="control"> + <input class={errorOrderId ? "input is-danger" : "input"} type="text" value={orderId} onChange={e => setOrderId(e.currentTarget.value)} placeholder="go to order id" /> + {errorOrderId && <p class="help is-danger">{errorOrderId}</p>} + </div> + <div class="control"> + <a class="button" onClick={testIfOrderExistAndSelect}> + <span class="icon"><i class="mdi mdi-arrow-right" /></span> + </a> + </div> + </div> + </div> + </div> + </div> <div class="columns"> <div class="column"> <div class="tabs">