CoolCMS API

WorkListInvoiceFormTrait

"Issue invoice" modal of a job, in two steps.

invoicePreview! (AJAX; JS collects the ticked sheets[<id>][bill] and sends them as sheetIds[]) fills the shared ModalWindow with a read-only preview. The preview has no fail-soft: on failure no table is rendered, only the error message. The confirm button is a real Form (invoiceConfirmForm, mirrored by WorkListArchiveFormTrait::createComponentUnarchiveForm()) whose submit is a full navigation, because issuing an invoice changes most of the page (aside groups, billing box, job summary, read-only banner of the grids).

The selected sheetIds travel as plain <input type="hidden" name="sheetIds[]"> in the modal template (a variable number of scalars, not typed Nette controls) and are read back from the POST, like sheets[] in WorkListSheetsFormTrait.

Terminology: WorkList is a job, WorkSheet is a work sheet inside a job.

Table of Contents

Properties

$invoicePreviewError  : string
$invoicePreviewFailed  : bool
True when the preview failed to load; the modal then shows only the error, never a table.
$invoicePreviewSheetIds  : array<int, int>
$invoicePreviewSheets  : array<int, array<string, mixed>>
$invoicePreviewTotals  : array{items: int, billableItems: int, skippedItems: int, hours: string, total: string}

Methods

handleInvoicePreview()  : void
Opens the modal with a read-only invoice preview (AJAX).
createComponentInvoiceConfirmForm()  : Form
buildInvoiceModalContent()  : string
processInvoiceConfirm()  : void

Properties

$invoicePreviewFailed

True when the preview failed to load; the modal then shows only the error, never a table.

private bool $invoicePreviewFailed = false

$invoicePreviewSheetIds

private array<int, int> $invoicePreviewSheetIds = []

selected work sheets, kept to re-render the form's hidden fields

$invoicePreviewSheets

private array<int, array<string, mixed>> $invoicePreviewSheets = []

work sheets from the preview response

$invoicePreviewTotals

private array{items: int, billableItems: int, skippedItems: int, hours: string, total: string} $invoicePreviewTotals = ['items' => 0, 'billableItems' => 0, 'skippedItems' => 0, 'hours' => '0.00', 'total' => '0.00']

Methods

handleInvoicePreview()

Opens the modal with a read-only invoice preview (AJAX).

public handleInvoicePreview([array<int, int|string> $sheetIds = [] ]) : void

An empty selection is treated as an error (no work sheets to invoice) without calling the bridge.

Parameters
$sheetIds : array<int, int|string> = []

processInvoiceConfirm()

private processInvoiceConfirm(ArrayHash<string|int, mixed> $values) : void
Parameters
$values : ArrayHash<string|int, mixed>
On this page

Search results