Home
Wiki
Home
Wiki
  1. 3. Reusables
  • Back to home
  • 1. Themes
  • Vs Code
    • Getting Started
  • Kitchenware
    • Layout
      • New Layout
      • Legacy Layout
    • Components
      • Announcement
      • Banner Carousel
      • Banner With Products Carousel
      • Blog Category List
      • Blog List
      • Brand List
      • Brands Carousel
      • Breadcrumb
      • Call To Action
      • Cart
      • Categories List
      • Change Password
      • Checkout
      • Cookie Manager
      • Filter list
      • Footer
      • Forgot Password
      • Form
      • Hero Carousel
      • Icon Block
      • Invitation
      • Last Visited Products
      • Layout
      • Login
      • Map
      • Nav Bar
      • Offer
      • Product Attachments
      • Product Attributes
      • Product Documentation
      • Product Expected
      • Product Modal
      • Products Block
      • Products Carousel
      • Product Single
      • Profile
      • Quote
      • Register
      • Related Products
      • Search
      • Stores
      • Subscribe Newsletter
      • Text with Image
      • Top Bar
      • Video
    • Reusables
      • Getting Started
    • Assets
      • Getting Started
    • SDK
      • Products
        • _findProductsByCategory
        • _findProductsByIds
        • _findProductsByTitle
        • _findProductsByFilter
        • _findProductsByCriteria
        • _findProductsAndCalculate
        • _findProductsThenCalculate
        • _getProductAttributeSet
        • _setLastVisited
      • Categories
        • _findCategoryTreeById
        • _findCategoriesByIds
        • _findCategoryByAlias
        • _findCategoryTreeByAlias
        • _getCategoryContent
      • Collections
        • _getCollectionContent
        • _findCollectionsByIds
        • _findCollectionsByIdsThenCalculate
      • Brands
        • _getBrandContent
        • _findBrandsByIds
      • Cart
        • _addToCartMulti
        • _addToCart
        • _setCart
        • _clearCart
        • _setCartListener
        • _removeFromCart
        • _calculateCart
      • Checkout
        • _startCheckout
        • _updateCheckout
        • _completeCheckout
      • Shopping Lists
        • _getShoppingLists
        • _updateShoppingList
        • _createShoppingList
        • _deleteShoppingList
        • _getShoppingListByAlias
      • Navigation
        • _getFooterMenu
        • _getHeaderMenu
      • Users
        • _getUserById
      • Utils
        • _calculateCurrency
        • _getCurrencySymbol
        • _getCulture
        • _subscribeToNewsletter
        • _findUnitsByIds
  • Noir
    • 0. Introduction
    • 6. FAQ
    • 1. Structure
      • _Overview
      • LayoutA.liquid
      • ComponentsList.liquid
      • Metas.liquid
      • CssVariables.liquid
      • Json.liquid
      • GoogleTagManager.liquid
      • StagingButton.liquid
    • 2. Components
      • _Overview
      • Announcement
      • BannerCarousel
      • BlogCategoryList
      • BlogHighlights
      • BlogList
      • BrandList
      • Breadcrumb
      • Cart
      • CategoriesList
      • ChangePassword
      • Checkout
      • CookieManager
      • CustomTable
      • Faq
      • FilterList
      • Footer
      • ForgotPassword
      • Form
      • IconBlock
      • Invitation
      • LastVisitedProducts
      • Login
      • Map
      • NavBar
      • Offer
      • ProductAttachments
      • ProductAttributes
      • ProductComparison
      • ProductDocumentation
      • ProductMixList
      • ProductsBlock
      • ProductsCarousel
      • ProductSingle
      • Profile
      • Quote
      • Register
      • RelatedProducts
      • SingleBlog
      • Stores
      • TextWithImage
      • ThankYouPage
      • TopBar
      • Wishlist
      • OrderReviews
      • ProductReviews
      • Newsletter
    • 3. Reusables
      • _Overview
      • Addresses
      • AddressForm
      • AnnouncementModal
      • BackToTop
      • BillingRetail
      • BlogPostingStructuredData
      • BrandListStructuredData
      • CollectionStructuredData
      • Company
      • General
      • GroupChildrenTable
      • Login
      • LoginModal
      • MonthlyTransactions
      • Offers
      • Orders
      • Payment
      • ProductAttachments
      • ProductAttributes
      • ProductAvailabilityAction
      • ProductComparisonButton
      • ProductComparisonFloatingButton
      • ProductGridItem
      • ProductGridItemClassic
      • ProductListItem
      • ProductModal
      • ProductStructuredData
      • ProfileInfo
      • PromptModal
      • Quotes
      • Register
      • Services
      • Shipping
      • ShoppingLists
      • ShoppingListsButton
      • ShoppingListsNavbar
      • StoresStructuredData
      • Toast
      • Transactions
      • Users
      • VariantContent
      • VariantContentClassic
      • WishlistButton
      • ProductRating
      • ClientHelpers
      • FaqStructuredData
    • 4. Assets
      • Fonts
      • Images
      • Templates
      • Javascript
        • _Overview
        • theme.js
      • Css - Scss
        • _Overview
        • ThemeClasses
    • 5. SDK
      • _Overview
      • LiquidGlobals
      • ServicesSDK
  1. 3. Reusables

Transactions

Purpose#

Transactions is the Profile-tab reusable that displays customer transaction history with date-range filtering and pagination.
It combines Flatpickr-driven date selection with query-string navigation for server-rendered transaction lists.

Where it's rendered#

In Components/Profile/Default.liquid:
{% render 'Reusables\\Transactions\\Default', transactionData: transactionData %}

Inputs (Liquid render parameters)#

Model shape (storefront example)#

Below is a sanitized excerpt from a Profile component model containing the transactionData object passed to this reusable.
{
  "transactionData": {
    "pagination": {
      "pageNumber": 1,
      "numberOfPages": 28
    },
    "dateFrom": "2025-01-01",
    "dateTo": "2025-01-31",
    "lines": [
      {
        "id": "Transaction Id",
        "code": "CRN-2025-000007",
        "credit": 80.0,
        "creditText": "80.00 €",
        "debit": 0.0,
        "debitText": "0.00 €",
        "turnover": -80.0,
        "turnoverText": "-80.00 €",
        "progressiveBalance": 980.5,
        "progressiveBalanceText": "980.50 €",
        "description": "Sample description",
        "notes": "Sample notes",
        "transactionDate": "2025-01-25T16:05:00Z",
        "invoiceUrl": "https://example.com/sample"
      }
    ],
    "forward": {
      "credit": 1500.0,
      "creditText": "1,500.00 €",
      "debit": 2200.0,
      "debitText": "2,200.00 €",
      "turnover": 700.0,
      "turnoverText": "700.00 €",
      "balance": 700.0,
      "balanceText": "700.00 €"
    },
    "total": {
      "credit": 2080.0,
      "debit": 3760.5,
      "turnover": 1680.5,
      "balance": 1680.5
    }
  }
}

transactionData#

dateFrom (string, optional)
Expected format: YYYY-MM-DD
dateTo (string, optional)
Expected format: YYYY-MM-DD
pagination (object, required)
pageNumber (number)
numberOfPages (number)
lines (array, optional)
The current Liquid template uses:
line.transactionDate
line.code
line.debitText
line.creditText
line.progressiveBalanceText
forward (object, optional): the balance carried forward from before dateFrom, as reported by the ERP connector. null when the ERP does not report one.
The current Liquid template uses forward.balanceText. creditText, debitText and turnoverText are also available.

Template behavior (Liquid + Alpine)#

When transactionData.forward is present and the current page is 1, the first row of the table is the balance carried forward, labelled Reusables.Transactions.Translations.ForwardBalance, with forward.balanceText in the progressive-balance column (- when the ERP reports no balance). It is not repeated on later pages, and zebra striping continues from it.
If transactionData is null or transactionData.lines is empty, shows Reusables.Transactions.Translations.NoTransactions, below the carried-forward row when there is one.
The date range input is disabled when there is no data.
Pagination pages are generated in Liquid using a sliding window:
If total pages , show all pages.
Else, show 1, a window around the current page, and totalPages with ... placeholders.

Data contract (JS runtime)#

Document runtime state shape, factories, and main state fields.

JavaScript#

Global object: transactionsreusabledefault in Reusables/Transactions/Default.js.

initComponent(currentPage, totalPages, dateFrom, dateTo)#

Initializes Flatpickr on the x-ref="dateRangePicker" input.
Reads optional overrides from data-datepicker-options.
On date change:
Updates dateFrom/dateTo to YYYY-MM-DD
Redirects to page 1.
Initialization is performed in init().

init#

Alpine lifecycle method that initializes the Flatpickr range picker and wires date-change redirects.

redirectToState(newPage)#

Builds the query string and navigates with window.location.href.
Params:
page (when provided)
dateFrom (if set)
dateTo (if set)

resetDateRange()#

Clears the picker and resets dateFrom/dateTo.

resetDateRange#

Note: current implementation includes a TODO comment for backend reset filtering.

parseYmdToDate#

Parses a YYYY-MM-DD string into a Date object for picker/range calculations.

parseDmyToYmd#

Converts DD/MM/YYYY input into YYYY-MM-DD format.

formatDateToYmd#

Formats a Date object into YYYY-MM-DD for query-string state.

parseRange#

Parses a picker range string and resolves normalized dateFrom/dateTo values.

Global Alpine stores#

No direct Alpine store dependencies are used by this reusable.

Services / API calls#

No direct API/service calls are made by this reusable.

Dependencies#

Liquid: Reusables/Transactions/Default.liquid
JS: Reusables/Transactions/Default.js
Translations: Reusables/Transactions/Default.json
Vendor library: Flatpickr (loaded by Structure/LayoutA.liquid)

Notes#

Runtime dependency: Flatpickr assets are loaded by Structure/LayoutA.liquid.
This reusable reads translations from Reusables/Transactions/Default.json (e.g. Reusables.Transactions.Translations.*).
Modified at 2026-11-16 09:18:34
Previous
Toast
Next
Users
Built with