CoolCMS API

SellerPickerTrait

Seller picker for the invoice, pattern of {@see \App\UI\Admin\System\Presenters\Traits\Pickers\UserPickerTrait}.

fieldMap fills the denormalized seller snapshot in the form from the first contact and the first bank account of the picked seller (address, registration number, VAT id, bank). The snapshot stays editable. The modal targets :Admin:Invoicer:Seller.

TODO: let the user pick a specific (non-primary) contact or account via dependent selects.

Table of Contents

Properties

$sellerManager  : SellerManager

Methods

sellerPicker()  : PickerConfig
loadSeller()  : Seller|null
Loads the seller with contacts, accounts and tax status history for the server-side prefill of the invoice snapshot.
resolveSellerLabel()  : string|null
sellerLabel()  : string
sellerPrefillData()  : array<string, string>
suggestSellers()  : array<int, array{id: int, label: string, data: array}>

Properties

Methods

sellerPicker()

protected sellerPicker(string $formName, string $targetField[, string|null $submitButton = null ]) : PickerConfig
Parameters
$formName : string

name of the form with the hidden field

$targetField : string

name of the hidden control (sellerId)

$submitButton : string|null = null
Return values
PickerConfig

loadSeller()

Loads the seller with contacts, accounts and tax status history for the server-side prefill of the invoice snapshot.

private loadSeller(int $id) : Seller|null
Parameters
$id : int
Return values
Seller|null

resolveSellerLabel()

private resolveSellerLabel(int $id) : string|null
Parameters
$id : int
Return values
string|null

sellerPrefillData()

private sellerPrefillData(Seller $seller) : array<string, string>
Parameters
$seller : Seller
Return values
array<string, string>

suggestSellers()

private suggestSellers(string $query) : array<int, array{id: int, label: string, data: array}>
Parameters
$query : string
Return values
array<int, array{id: int, label: string, data: array}>
On this page

Search results