TariffFormTrait
Add/edit form of a tariff.
The skeleton comes from BasePresenter::createForm(). Covers
translations (name/title/description), duration/credits/active, the supply kind and the
price list: a TariffPrice matrix per payment region x gateway (the currency is the
front end axis), like TariffFormTrait
but without express (SMS) prices.
Table of Contents
Methods
- createComponentEditForm() : Form
- addTariffPriceMatrix() : void
- Price matrix: region VAT rate (select) plus a price and an active flag for every region x gateway pair.
- buildTariffPrices() : ArrayCollection<int, TariffPrice>
- Converts the price matrix into the owned `TariffPrice` collection. Contract of {@see \App\Core\Traits\Admin\Presenters\TariffPriceMatrixTrait}: the cell currency is the front end axis, a row exists only for a filled price, rows outside the axis are carried over unchanged.
- saveTariffForm() : bool
- setTariffFormDefaults() : void
- tariffOffAxisPrices() : array<int, TariffPrice>
- tariffOffAxisRowData() : array<int, array{regionId: int, gateId: int, currencyId: int, price: string, active: bool}>
Methods
createComponentEditForm()
protected
createComponentEditForm() : Form
Return values
FormaddTariffPriceMatrix()
Price matrix: region VAT rate (select) plus a price and an active flag for every region x gateway pair.
private
addTariffPriceMatrix(Form $form) : void
Parameters
- $form : Form
buildTariffPrices()
Converts the price matrix into the owned `TariffPrice` collection. Contract of {@see \App\Core\Traits\Admin\Presenters\TariffPriceMatrixTrait}: the cell currency is the front end axis, a row exists only for a filled price, rows outside the axis are carried over unchanged.
private
buildTariffPrices(ArrayHash<string|int, mixed> $values) : ArrayCollection<int, TariffPrice>
Parameters
- $values : ArrayHash<string|int, mixed>
Return values
ArrayCollection<int, TariffPrice>saveTariffForm()
private
saveTariffForm(ArrayHash<string|int, mixed> $values) : bool
Parameters
- $values : ArrayHash<string|int, mixed>
Return values
boolsetTariffFormDefaults()
private
setTariffFormDefaults(Form $form) : void
Parameters
- $form : Form
tariffOffAxisPrices()
private
tariffOffAxisPrices() : array<int, TariffPrice>
Return values
array<int, TariffPrice> —price-list rows of the edited tariff outside the matrix axis
tariffOffAxisRowData()
private
tariffOffAxisRowData() : array<int, array{regionId: int, gateId: int, currencyId: int, price: string, active: bool}>