:: consumable_menu[menu]

<<set _menu = $larg(0)>>
<<if typeof _menu == 'string'>><<set _menu = setup.getConsumableMenu(_menu)>><</if>>

<<set _selectedCategory = Object.keys(_menu.categories)[0] >>

<div id="categorySelection" class="linksAsDefaultButtons">
    <<for _categoryId, _categoryData range _menu.categories>>
        <<capture _categoryId>>
            <<link _categoryData.label>>
                <<replace "#menuBody">>
                    <<gs 'consumable_menu_body' _menu.categories[_categoryId] _menu.payment>>
                <</replace>>
            <</link>>
        <</capture>>
    <</for>>
</div>

<div id="menuBody">
    <<gs 'consumable_menu_body' _menu.categories[_selectedCategory] _menu.payment>>
</div>

<<ret 'Leave'>>

:: consumable_menu_body[include]
<<set _category = $larg(0)>>
<<set _paymentMethod = $larg(1)>>

<<for _consumableId, _consumableData  range _category.items>>
    <<capture _consumableId>>
        <div class="consumable linksAsDefaultButtons">
            <<image _consumableData.image>>
            <div class="label">_consumableData.label</div>
            <div class="desc">_consumableData.desc</div>

            <<set _arguments = {}>>

            <<if _consumableData.price>>
                <<set _arguments.cost = {both: _consumableData.price}>>
            <</if>>
            <div class="buttons">
            <<act "Order" 1 _arguments>>
                <<gt 'beverage' _consumableId>>	
            <</act>>
            </div>
        </div>
    <</capture>>
<</for>>