Skip to main content

Orders & quotes

Order history, order detail, PDF export and re-ordering are all handled by a single composable: useOrders. Favourites — adjacent account data — are covered by useFavorites.

Signatures: useOrders, useFavorites.

useOrders

import { useOrders } from 'propeller-v2-vue-ui';

const orders = useOrders({
graphqlClient,
user,
companyId,
itemsPerPage: 10,
language: ref('NL'),
});

It returns the order list, the loading/error state, pagination, and a set of actions — all as Vue refs. Calls go through services.order and — for re-ordering — the shared initCart helper.

ActionSDK callsPurpose
search(form)order.searchFilter/sort the order list
getOrder(orderId)order.getOrderFull detail for one order
downloadOrderPdf(orderId)order.downloadOrderPdfInvoice/order PDF
downloadQuotePdf(quoteId)order.downloadQuotePdfQuote PDF
reorder(order)initCartcart.addItemToCart (per line)Build a new cart from a past order

All actions resolve to result objects; the list/detail actions update the composable's reactive state, the PDF actions report success/failure.

Search and pagination

search accepts an OrderSearchForm — date ranges, amount ranges, status filters and a sort key. Pagination is driven by the shared usePagination composable; order.search receives offset/limit from it and the composable updates totals from the response. itemsPerPage sets the page size (default 10).

Re-ordering

reorder is a small orchestration: resolve a fresh cart with initCart, then replay each order line through cart.addItemToCart. It resolves to { success, cart?, error? }. After it resolves, route the user to the cart (Cart & checkout).

PDF downloads

downloadOrderPdf / downloadQuotePdf call the SDK's PDF endpoints. They require an authenticated session (the access token from useAuth().login()) — order documents are account-scoped.

useFavorites

const favorites = useFavorites({ graphqlClient, user });

CRUD over the user's favourite lists, via services.favoriteList:

ActionSDK calls
create / update / delete a listfavoriteList.createFavoriteList / updateFavoriteList / deleteFavoriteList
add / remove a productfavoriteList.addProductToList / removeProductFromList

Mutations apply optimistic updates — the local list state changes immediately and is reconciled (or rolled back) when the API call resolves — so the UI feels instant. All actions return { success, error? } and never throw. Favourite lists are account-scoped, so the user must be authenticated.