Documentation
¶
Overview ¶
templ: version: v0.3.1020
templ: version: v0.3.1020
templ: version: v0.3.1020
Index ¶
- Constants
- Variables
- func Form(data layout.AppLayoutData, p *model.Product, recipe *dto.RecipeDTO, cogs int64, ...) templ.Component
- func Index(props IndexProps) templ.Component
- func Recipe(data layout.AppLayoutData, product model.Product, recipe dto.RecipeDTO, ...) templ.Component
- type IndexProps
- type LPPInfo
Constants ¶
View Source
const DefaultPageSize = 20
DefaultPageSize is used when no valid per_page query param is supplied.
Variables ¶
View Source
var PageSizes = []int{20, 50, 100}
PageSizes are the selectable "items per page" options for the products list.
Functions ¶
func Form ¶
func Form( data layout.AppLayoutData, p *model.Product, recipe *dto.RecipeDTO, cogs int64, cogsAvailable bool, errMsg string, categorySuggestions []string, productCategories []model.Category, branchOptions []model.Branch, productBranches []model.Branch, enableRecipes bool, lockedType *model.ProductType, ) templ.Component
func Index ¶
func Index(props IndexProps) templ.Component
Types ¶
type IndexProps ¶
type IndexProps struct {
Data layout.AppLayoutData
Products []model.Product
ActiveType string
ActiveCategory string
ActiveBranch uuid.UUID
// EnableRecipes gates the Recipe tab — off means this company doesn't
// use recipes, so it never appears. Ingredients never appear here
// regardless (they have their own dedicated page).
EnableRecipes bool
// TypeLocked, when true, renders this page as the dedicated Ingredients
// list: hides the type tab row entirely, points all links
// (new/edit/delete/pagination) at /ingredients instead of /products, and
// swaps the Price column for Cost (LPPByProduct) since ingredients have
// no selling price.
TypeLocked bool
// LPPByProduct holds each listed product's current and previous
// procurement cost, used by the Cost column and its trend indicator on
// the Ingredients list. A product with no key present has no
// procurement recorded yet. Only populated when TypeLocked.
LPPByProduct map[uuid.UUID]LPPInfo
// Categories lists the company's categories, used as the filter
// dropdown's options.
Categories []model.Category
// Branches lists the company's branches, used as the branch filter
// dropdown's options. Rendered only when there's more than one — a
// single-branch company has nothing meaningful to filter.
Branches []model.Branch
Search string
Page int
PerPage int
TotalItems int
// Created, when non-empty, is the name of a product just created —
// triggers a success toast confirming the save.
Created string
}
IndexProps holds the data needed to render the products list page.
Click to show internal directories.
Click to hide internal directories.