HireHop Framework Customisation Guide for Plugins

The HireHop frontend web interface can be customised using plugins as HireHop has been built on its own modular framework that allows you to change code on the user's device without changing back-end code. These plugins can add, change or even remove functionality, and do so by overriding existing JavaScript modules that are in fact JQuery UI Widgets.

The HireHop frontend architecture is built on top of the jQuery UI Widget Factory ($.widget). Widgets in this framework heavily utilize inheritance, for example, hh_grid_categories_page inherits all the layout and logic from hh_grid_bottom_page, which in turn inherits from hh_tabbed_page.

When writing plugins or customizing pages, you will frequently extend these widgets by overriding their prototype methods. To ensure you don't inadvertently break the core engine, pay close attention to the method tags used throughout this documentation.

Method Tag Legend

Requires _super()

Standard Inheritance. You can override this method to add your own functionality, but you must execute this._super(arguments); or this._superApply(arguments); within your override to prevent breaking core logic.

Required Override

Abstract Stub. Left intentionally empty by the framework. Designed specifically for you to override with your own custom logic. You do not need to call _super() for these but should do just in case you inherit from another plugin.

Core Method

Internal Mechanics. Handles complex internal state management. You should generally never override this directly.

💡 Pro Tips for Developers

  • The _init_custom() Hook: Every major page widget includes an empty _init_custom() function. This is the designated, safe entry point for initializing your custom plugin logic.
  • Mixins vs. Inheritance: Notice that $hh_pqGrid is a Mixin, not a Widget. It is an object of functions that is merged into other widgets. You don't extend it using $.widget; instead, the widgets that consume it expose its methods that you can then overwrite.

$hh_pqGrid

Type: JavaScript Object (Mixin)
Description: Acts as the base mixin for any widget that incorporates a grid. It seamlessly injects a remote, infinite-scroll capable pqGrid into `this.grid_container`. It automatically manages core grid behaviors including server-side paging, dynamic column hiding/showing/moving, saving user layout states to the database, Excel exporting, and data formatting.

Configuration Options

Option Default Description
grid_sequential_page_load false If true, the grid strictly loads the next sequential page instead of jumping to random pages based on scroll position. Essential for datasets where the total record count is unknown.
grid_columns_key "" The unique string key used to save and load the user's specific column order and visibility preferences. Setting this to an empty string completely disables the column configuration menu.
grid_rowsPerPage 100 The number of rows fetched per page request during infinite scrolling. Set to 0 to disable paging entirely.
grid_initial_sort_column "ID" The dataIndx name of the column that the grid should initially sort by on load.
grid_initial_sort_order "up" The initial sort direction for the column specified above. Accepts 'up' (ascending) or 'down' (descending).
grid_fullscreen_loader true If true, loading data triggers a full-screen loading overlay. If false, it uses a smaller internal spinner.
custom_fields_type "" The identifier string for the custom fields type applied to this grid.
tabs_to_menu_width 660 The responsive screen width breakpoint (in px) that determines when standard tabs collapse into a mobile dropdown menu.
grid_load_once false If true, fetches data from the server exactly once upon initialization and treats the data as local from then on.
list_filename "list.php" The backend URL endpoint that the grid calls to fetch its JSON row data. Empty forces local operation.

Local Methods & Functions

Initialization

Method Requirement Description
_init_grid() Core Method

Core initialization routine. Sets up the paging object, binds grid options, applies localization, and attaches pqGrid to the DOM.

_init_grid_columns_menu()

Initializes the column visibility popup menu. Only executes if grid_columns_key is populated.

General

Method Requirement Description
grid_update_counters() Required Override

Hook called when row numbers change. Intended to be overridden to update UI tab badges (e.g., 'Notes (3)').

grid_get_rowData()

Returns the raw rowData object of the currently selected row. Returns null if none or multiple are selected.

grid_get_selected_id()

Fetches the ID integer from the currently selected row. Used for syncing related tabs.

grid_get_filter_values()

Extracts current column filters and sorting rules into a parameter object ready for Ajax transmission.

grid_select_indx(indx)

Programmatically selects a specific row index. Safely clamps to boundaries or triggers clear views if empty.

grid_refresh()

Forces a hard refresh of the grid. Aborts pending calls, clears data cache, resets paging, and fires a new request.

grid_load_once()

Bypasses remote protocol for a manual, one-time Ajax GET to fetch the entire dataset at once.

grid_load_once_loaded(dataJSON)

Callback executed by grid_load_once(). Populates the paging object and pushes data directly into local dataModel.

grid_call_filter(ui)

Internal utility used to programmatically trigger filter rules and force an immediate re-fetch.

grid_get_ID_rowData_lookup()

Returns a dictionary mapping row IDs to their exact rowData objects for extremely fast memory lookups.

ColModel Renderers

Method Requirement Description
grid_string_render(ui)

Standard column renderer. Trims strings and generates HTML title tooltips for hovering.

grid_custom_field_render(ui, field_name)

Safely digs into nested CUSTOM_FIELDS JSON object to extract and format custom string values.

grid_UTCdate_render(ui)

Parses server UTC timestamps and formats them to the user's localized time zone settings.

grid_date_render(ui)

Standard localized date renderer utilizing the global dateFormatter().

grid_currency_render(ui)

Automatically applies the user's currency symbol, decimal rules, and multiplier logic.

Column Hide/Show

Method Requirement Description
grid_columns_btn_click(owner)

Click handler for the column gear icon. Positions and reveals the column visibility toggles.

grid_cols_popup_menu_setup()

Scans the active colModel and applies tick/blank icons to the column menu list accordingly.

grid_build_columns_menu()

Constructs the HTML DOM for the column toggle menu based on columns flagged with hh_optional: true.

grid_cols_popup_menu_selected(e, ui) Core Method

Handles menu selections. Triggers grid resets or calculates visibility arrays. Automatically saves settings.

grid_show_hide_columns(visible_cols)

Takes array of desired visible columns, computes hidden array based on hh_optional, and applies to pqGrid.

grid_column_moved(event, ui)

Callback fired when a user drags to reorder a column. Extracts new layout and saves to profile.

Options Builders

Method Requirement Description
grid_options()

Master assembler compiling all models into the final configuration object handed to pqGrid.

grid_postData(ui) Requires _super()

Generates Ajax payload (time, paging, deleted flag). Designed to be extended via _super().

grid_dataModel() Requires _super()

Constructs the pqGrid dataModel object (GET/POST, URL routing, JSON type, success handlers).

grid_setup_column_model() Core Method

Retrieves raw column model and cross-references against user's saved settings to reorder/hide columns.

grid_columnModel() Required Override

Returns raw array of column definitions. Intended to be completely overridden by descendant widgets.

grid_add_custom_fields_to_columnModel(colModel, options)

Utility to parse FIELD_DEFINITIONS and inject dynamically generated schemas for custom fields.

grid_sortModel()

Generates the pqGrid sortModel based on the initial sort options provided.

grid_filterModel()

Generates the pqGrid filterModel. Applies a 1000ms debounce timeout.

grid_focusModel()

Generates the pqGrid focusModel. Disables individual cell focus outlines by default.

Grid Callbacks

Method Requirement Description
grid_rowInit(ui)

Callback executed as each row is drawn. Override to inject custom CSS classes based on row status.

Grid Events

Method Requirement Description
grid_paging_init_event()

Event hook triggered immediately whenever the internal paging tracker object is reset to page 0.

grid_get_paging_object()

Returns the internal grid_paging tracker object (stores data chunks, total records, current page).

grid_rowSelect(event, ui) Requires _super()

Fired when a user clicks a row. Immediately delegates to this.fill_details().

grid_rowDblClick(event, ui)

Fired on double click. Left empty by default, intended for overriding.

grid_getData(dataJSON, textStatus, jqXHR) Requires _super()

Master Ajax success interceptor. Calculates pagination math, caches lookups, and splices data into scroll buffer.

grid_truncate_rows_from_data()

Memory management function to trim trailing empty placeholder rows if data exceeds totalRecords.

grid_beforeSort(evt, ui) Requires _super()

Fired before sorting. Hard-resets the pagination object to prevent page offset corruptions.

grid_beforeFilter(evt, ui) Requires _super()

Fired before filtering. Caches focused filter input to seamlessly restore cursor focus after re-rendering.

grid_scrollStop()

Infinite scroll engine. Analyzes viewport to detect empty placeholder rows and triggers Ajax fetches.

grid_complete(evt, ui) Requires _super()

Fires after DOM rendering completes. Forces row selection, executes fill_details(), restores focus.

grid_beforeTableView(evt, ui)

Used in sequential page load mode. Pre-emptively checks bottom boundary to fetch next page.

grid_scroll(evt, ui)

Fired iteratively during scrolling. Empty hook for override.

grid_context(evt, ui)

Empty hook fired upon a right mouse click event on the grid.

Excel / CSV Export

Method Requirement Description
grid_setup_excel_formats()

Parses user currency and date formats to construct native Excel string formats for exports.

grid_export(format, filename, colWrap)

Requests export, applies custom row striping/headers, and triggers browser download.

grid_export_eachCol(col, ci, column)

Export callback to adjust visibility dynamically during export processing.

grid_export_eachCellHead(cell, ci, ri, column)

Export callback hook to manipulate header cell text/styling.

grid_export_eachCell(cell, ci, ri, column, rowData)

Export callback hook to apply Excel-specific data formatting (urls, math) before encoding.

Utilities

Method Requirement Description
build_depot_filter(no_virtual_depots)

Constructs a robust pqGrid filter dropdown object dynamically populated with the global depot list.

build_job_status_filter()

Constructs a standard filter dropdown object populated by the globally localized lang.statusValues array.

build_options_filter(opts, field_name)

Constructs a generic dropdown filter object from any provided array of objects.

Editing & Data Handlers

Method Requirement Description
fill_details() Required Override

Stub hook. Fired whenever grid row selection changes to populate external forms or update UI states.

get_save_params() Requires _super()

Scans the edit dialog to gather values for saving. Applies red border warnings. Returns payload.

hh_tabbed_page

Type: Widget
Description: The foundational widget for creating responsive, tabbed interfaces within HireHop. Generates the standard UI layout featuring a main content tab alongside integrated modules for 'Tasks', 'Notes', and 'Files'.

Configuration Options

Option Default Description
doc_type doc_type The system document type ID. Defaults to the global variable. Useful to spoof or enforce document scope.
custom_fields_type "" String identifier mapping to FIELD_DEFINITIONS. Automatically renders a custom fields block.
no_tab_totals false If true, hides the numerical counters inside brackets on the Tasks, Notes, and Files tabs.
min_top_height 0 Minimum CSS height applied to the top section of the page.
tabs_to_menu_width 660 Responsive screen width breakpoint (in px) that triggers tabs to collapse into a mobile dropdown.

Local Methods & Functions

Initialization Lifecycle

Method Requirement Description
_create() Requires _super()

Standard widget constructor. Adds base classes and kicks off the _init_sections() builder pipeline.

_init_sections() Requires _super()

Master builder routine. Sequentially calls all other _init_* functions to construct DOM.

_init_dependencies() Requires _super()

Loads required APIs or establishes initial object variables before DOM construction begins.

_init_sections_extra() Required Override

Empty hook designed for descendant widgets to inject extra build steps.

_init_custom() Required Override

Empty hook intended purely for OOP customizations and third-party plugins.

_init_finally() Requires _super()

Final step in pipeline. Triggers initial resize() and attaches ResizeObserver.

UI Builders

Method Requirement Description
_init_main() Requires _super()

Creates master tabs container, mobile nav bar, and initializes jQuery UI tabs.

_init_mobile_nav_bar() Requires _super()

Constructs the mobile-only navigation bar with the hamburger icon toggle.

_init_tabs() Requires _super()

Injects standard list elements and div panes for Main, Todo, Notes, and Files tabs.

_init_tabs_menu() Requires _super()

Duplicates horizontal tabs into a vertical .ui-menu popup for mobile navigation.

_init_main_tab_content() Requires _super()

Assembles the contents of the main tab (buttons, body, custom fields).

_init_buttons() Required Override

Empty stub. Override to construct page-specific action buttons inside the main tab.

_init_main_tab_body() Required Override

Empty stub. Override to build the primary layout inside the main tab.

_init_popup_menu() Requires _super()

Sets up context/popup menu and binds right-click (contextmenu) listener.

build_popup_menu_contents() Requires _super()

Populates the context menu with standard actions (New, Edit, Print, etc).

Events & Interactions

Method Requirement Description
resize() Requires _super()

Master responsive reflow function. Adapts layout for header bars, converts adaptive buttons.

tab_active(ui, selected_id) Requires _super()

Fired when user switches tabs. Manages lazy-loading of Todo, Notes, and Files widgets.

setup_menu() Required Override

Empty stub triggered when popup menu receives focus. Dynamically disables/enables items.

print() Requires _super()

Hides active menus and triggers global openPrint() routine.

send_email() Requires _super()

Hides active menus and triggers global send_email() routine.

show_log() Requires _super()

Opens the system history log dialog for the currently selected record ID.

Data & Utilities

Method Requirement Description
get_print_email_params() Requires _super()

Returns configuration object defining the document scope required by Print and Email engines.

get_doc_type() Requires _super()

Safely returns the active document type, prioritizing options with a fallback to global.

grid_get_selected_id() Required Override

Stub returning 0. Must be overridden to return database ID of selected row.

read_custom_field(field) Required Override

Stub returning null. Must be overridden to extract custom field values for display.

hh_grid_bottom_page

Type: Widget
Inherits: hh_tabbed_page
Mixes: $hh_pqGrid
Description: A composite widget that establishes a page with standard top tabs and a unified data grid anchored at the bottom. Marries UI navigation with data capabilities, while introducing standard CRUD edit dialog infrastructure.

Configuration Options

Option Default Description
min_grid_height 160 The minimum allowable CSS height (in pixels) for the bottom grid container.
min_top_height 0 The default and minimum height of the top tabbed section before the grid starts.
grid_columns_key "_custom" The local storage key used for saving column order/visibility states.
edit_dlg_max_width 190 The maximum width limit (in pixels) for the CRUD edit dialog.
edit_help_page "" The localized HTML help file to load when the user triggers help from the edit dialog.
save_filename "save.php" The backend Ajax endpoint URL hit when saving the CRUD edit dialog.
delete_filename "delete.php" The backend Ajax endpoint URL hit when executing a row deletion.

Inherited Options

From hh_tabbed_page (Inherits)

Option Default Description
doc_type doc_type The system document type ID. Defaults to the global variable. Useful to spoof or enforce document scope.
custom_fields_type "" String identifier mapping to FIELD_DEFINITIONS. Automatically renders a custom fields block.
no_tab_totals false If true, hides the numerical counters inside brackets on the Tasks, Notes, and Files tabs.
min_top_height 0 Minimum CSS height applied to the top section of the page.
tabs_to_menu_width 660 Responsive screen width breakpoint (in px) that triggers tabs to collapse into a mobile dropdown.

From $hh_pqGrid (Mixes)

Option Default Description
grid_sequential_page_load false If true, the grid strictly loads the next sequential page instead of jumping to random pages based on scroll position. Essential for datasets where the total record count is unknown.
grid_columns_key "" The unique string key used to save and load the user's specific column order and visibility preferences. Setting this to an empty string completely disables the column configuration menu.
grid_rowsPerPage 100 The number of rows fetched per page request during infinite scrolling. Set to 0 to disable paging entirely.
grid_initial_sort_column "ID" The dataIndx name of the column that the grid should initially sort by on load.
grid_initial_sort_order "up" The initial sort direction for the column specified above. Accepts 'up' (ascending) or 'down' (descending).
grid_fullscreen_loader true If true, loading data triggers a full-screen loading overlay. If false, it uses a smaller internal spinner.
custom_fields_type "" The identifier string for the custom fields type applied to this grid.
tabs_to_menu_width 660 The responsive screen width breakpoint (in px) that determines when standard tabs collapse into a mobile dropdown menu.
grid_load_once false If true, fetches data from the server exactly once upon initialization and treats the data as local from then on.
list_filename "list.php" The backend URL endpoint that the grid calls to fetch its JSON row data. Empty forces local operation.

Local Methods & Functions

Initialization & Builders

Method Requirement Description
_create() Requires _super()

Widget constructor. Adds has_bottom_table class and initializes sections.

_init_main() Requires _super()

Overrides parent. Triggers _init_bottom_section() to construct the grid container.

_init_sections_extra() Requires _super()

Initializes the edit dialog and the column configuration gear menu.

_init_buttons() Required Override

Builds standard New, Edit, Delete, Refresh, and Columns buttons into main tab header.

_init_bottom_section() Required Override

Creates grid_container, appends it, and invokes _init_grid() to bind pqGrid.

_init_edit_dlg() Required Override

Creates the jQuery UI Dialog infrastructure for editing records.

_init_edit_dlg_contents() Required Override

Empty stub intended to be overridden to inject HTML inputs into edit dialog DOM.

_init_edit_dlg_custom_fields() Required Override

Appends a dynamic custom fields form block to edit dialog if configured.

_init_grid_columns_menu() Requires _super()

Overrides mixin. Enforces backwards compatibility by appending explicit id to menu.

Actions & Events

Method Requirement Description
resize() Requires _super()

Reflows edit dialog dimensions and forces a visual refresh of underlying pqGrid.

refresh() Required Override

Safe alias to trigger this.grid_refresh().

fill_details() Required Override

Toggles button states based on grid selection and syncs custom field views.

get_print_email_params() Required Override

Fetches active grid filters and selected row ID to build print/email payload.

refresh_btn_click() Required Override

Click handler for the Refresh button. Calls refresh().

menu_btn_click() Required Override

Click handler for the Menu button. Positions and displays context menu.

show_deleted_btn_click() Required Override

Click handler for the Show Deleted checkbox. Triggers full grid refresh.

setup_menu() Required Override

Automatically toggles popup menu items with needs_selected class based on grid state.

grid_context(evt, ui) Required Override

Overrides mixin. Force-selects a row when the user right-clicks on it.

Editing & Data Handlers

Method Requirement Description
open_edit_dlg() Required Override

Fired when edit dialog opens. Injects contextual help page paths and triggers resize.

close_edit_dlg() Required Override

Fired when edit dialog closes. Restores original help page paths.

resize_edit_dlg() Required Override

Dynamically recalculates edit dialog width against window boundary.

new_btn_click() Required Override

Click handler. Wipes data, applies 'New' title, and opens edit dialog.

fill_new_dlg() Required Override

Clears inputs, textareas, and selects inside dialog, wiping validation borders.

edit_btn_click() Required Override

Click handler. Extracts selected row payload and routes to fill_edit_dlg().

fill_edit_dlg(row) Required Override

Iterates over dialog DOM matching input name attributes to payload keys to pre-fill form.

save() Required Override

Validates inputs and dispatches payload to options.save_filename via Ajax POST.

saved(row, new_rowData) Required Override

Ajax success callback. Interprets server response to update existing row or prepend new one.

get_delete_params() Required Override

Extracts the ID of the selected row to construct the deletion HTTP payload.

delete_btn_click() Required Override

Prompts for user confirmation, then fires Ajax POST to options.delete_filename.

row_deleted(row, response) Required Override

Ajax success callback. Physically removes deleted row from pqGrid's local cache.

read_custom_field(field) Required Override

Extracts specific custom field values from active grid row for display rendering.

get_custom_field(field) Required Override

Retrieves custom field value currently staged within edit dialog's data store.

save_custom_field(field, value) Required Override

Updates edit dialog's internal data store with newly manipulated custom field value.

Inherited Methods

From hh_tabbed_page (Inherits)

Method Description
_create()

Standard widget constructor. Adds base classes and kicks off the _init_sections() builder pipeline.

_init_sections()

Master builder routine. Sequentially calls all other _init_* functions to construct DOM.

_init_dependencies()

Loads required APIs or establishes initial object variables before DOM construction begins.

_init_sections_extra()

Empty hook designed for descendant widgets to inject extra build steps.

_init_custom()

Empty hook intended purely for OOP customizations and third-party plugins.

_init_finally()

Final step in pipeline. Triggers initial resize() and attaches ResizeObserver.

_init_main()

Creates master tabs container, mobile nav bar, and initializes jQuery UI tabs.

_init_mobile_nav_bar()

Constructs the mobile-only navigation bar with the hamburger icon toggle.

_init_tabs()

Injects standard list elements and div panes for Main, Todo, Notes, and Files tabs.

_init_tabs_menu()

Duplicates horizontal tabs into a vertical .ui-menu popup for mobile navigation.

_init_main_tab_content()

Assembles the contents of the main tab (buttons, body, custom fields).

_init_buttons()

Empty stub. Override to construct page-specific action buttons inside the main tab.

_init_main_tab_body()

Empty stub. Override to build the primary layout inside the main tab.

_init_popup_menu()

Sets up context/popup menu and binds right-click (contextmenu) listener.

build_popup_menu_contents()

Populates the context menu with standard actions (New, Edit, Print, etc).

resize()

Master responsive reflow function. Adapts layout for header bars, converts adaptive buttons.

tab_active(ui, selected_id)

Fired when user switches tabs. Manages lazy-loading of Todo, Notes, and Files widgets.

setup_menu()

Empty stub triggered when popup menu receives focus. Dynamically disables/enables items.

print()

Hides active menus and triggers global openPrint() routine.

send_email()

Hides active menus and triggers global send_email() routine.

show_log()

Opens the system history log dialog for the currently selected record ID.

get_print_email_params()

Returns configuration object defining the document scope required by Print and Email engines.

get_doc_type()

Safely returns the active document type, prioritizing options with a fallback to global.

grid_get_selected_id()

Stub returning 0. Must be overridden to return database ID of selected row.

read_custom_field(field)

Stub returning null. Must be overridden to extract custom field values for display.

From $hh_pqGrid (Mixes)

Method Description
_init_grid()

Core initialization routine. Sets up the paging object, binds grid options, applies localization, and attaches pqGrid to the DOM.

_init_grid_columns_menu()

Initializes the column visibility popup menu. Only executes if grid_columns_key is populated.

grid_update_counters()

Hook called when row numbers change. Intended to be overridden to update UI tab badges (e.g., 'Notes (3)').

grid_get_rowData()

Returns the raw rowData object of the currently selected row. Returns null if none or multiple are selected.

grid_get_selected_id()

Fetches the ID integer from the currently selected row. Used for syncing related tabs.

grid_get_filter_values()

Extracts current column filters and sorting rules into a parameter object ready for Ajax transmission.

grid_select_indx(indx)

Programmatically selects a specific row index. Safely clamps to boundaries or triggers clear views if empty.

grid_refresh()

Forces a hard refresh of the grid. Aborts pending calls, clears data cache, resets paging, and fires a new request.

grid_load_once()

Bypasses remote protocol for a manual, one-time Ajax GET to fetch the entire dataset at once.

grid_load_once_loaded(dataJSON)

Callback executed by grid_load_once(). Populates the paging object and pushes data directly into local dataModel.

grid_call_filter(ui)

Internal utility used to programmatically trigger filter rules and force an immediate re-fetch.

grid_get_ID_rowData_lookup()

Returns a dictionary mapping row IDs to their exact rowData objects for extremely fast memory lookups.

grid_string_render(ui)

Standard column renderer. Trims strings and generates HTML title tooltips for hovering.

grid_custom_field_render(ui, field_name)

Safely digs into nested CUSTOM_FIELDS JSON object to extract and format custom string values.

grid_UTCdate_render(ui)

Parses server UTC timestamps and formats them to the user's localized time zone settings.

grid_date_render(ui)

Standard localized date renderer utilizing the global dateFormatter().

grid_currency_render(ui)

Automatically applies the user's currency symbol, decimal rules, and multiplier logic.

grid_columns_btn_click(owner)

Click handler for the column gear icon. Positions and reveals the column visibility toggles.

grid_cols_popup_menu_setup()

Scans the active colModel and applies tick/blank icons to the column menu list accordingly.

grid_build_columns_menu()

Constructs the HTML DOM for the column toggle menu based on columns flagged with hh_optional: true.

grid_cols_popup_menu_selected(e, ui)

Handles menu selections. Triggers grid resets or calculates visibility arrays. Automatically saves settings.

grid_show_hide_columns(visible_cols)

Takes array of desired visible columns, computes hidden array based on hh_optional, and applies to pqGrid.

grid_column_moved(event, ui)

Callback fired when a user drags to reorder a column. Extracts new layout and saves to profile.

grid_options()

Master assembler compiling all models into the final configuration object handed to pqGrid.

grid_postData(ui)

Generates Ajax payload (time, paging, deleted flag). Designed to be extended via _super().

grid_dataModel()

Constructs the pqGrid dataModel object (GET/POST, URL routing, JSON type, success handlers).

grid_setup_column_model()

Retrieves raw column model and cross-references against user's saved settings to reorder/hide columns.

grid_columnModel()

Returns raw array of column definitions. Intended to be completely overridden by descendant widgets.

grid_add_custom_fields_to_columnModel(colModel, options)

Utility to parse FIELD_DEFINITIONS and inject dynamically generated schemas for custom fields.

grid_sortModel()

Generates the pqGrid sortModel based on the initial sort options provided.

grid_filterModel()

Generates the pqGrid filterModel. Applies a 1000ms debounce timeout.

grid_focusModel()

Generates the pqGrid focusModel. Disables individual cell focus outlines by default.

grid_rowInit(ui)

Callback executed as each row is drawn. Override to inject custom CSS classes based on row status.

grid_paging_init_event()

Event hook triggered immediately whenever the internal paging tracker object is reset to page 0.

grid_get_paging_object()

Returns the internal grid_paging tracker object (stores data chunks, total records, current page).

grid_rowSelect(event, ui)

Fired when a user clicks a row. Immediately delegates to this.fill_details().

grid_rowDblClick(event, ui)

Fired on double click. Left empty by default, intended for overriding.

grid_getData(dataJSON, textStatus, jqXHR)

Master Ajax success interceptor. Calculates pagination math, caches lookups, and splices data into scroll buffer.

grid_truncate_rows_from_data()

Memory management function to trim trailing empty placeholder rows if data exceeds totalRecords.

grid_beforeSort(evt, ui)

Fired before sorting. Hard-resets the pagination object to prevent page offset corruptions.

grid_beforeFilter(evt, ui)

Fired before filtering. Caches focused filter input to seamlessly restore cursor focus after re-rendering.

grid_scrollStop()

Infinite scroll engine. Analyzes viewport to detect empty placeholder rows and triggers Ajax fetches.

grid_complete(evt, ui)

Fires after DOM rendering completes. Forces row selection, executes fill_details(), restores focus.

grid_beforeTableView(evt, ui)

Used in sequential page load mode. Pre-emptively checks bottom boundary to fetch next page.

grid_scroll(evt, ui)

Fired iteratively during scrolling. Empty hook for override.

grid_context(evt, ui)

Empty hook fired upon a right mouse click event on the grid.

grid_setup_excel_formats()

Parses user currency and date formats to construct native Excel string formats for exports.

grid_export(format, filename, colWrap)

Requests export, applies custom row striping/headers, and triggers browser download.

grid_export_eachCol(col, ci, column)

Export callback to adjust visibility dynamically during export processing.

grid_export_eachCellHead(cell, ci, ri, column)

Export callback hook to manipulate header cell text/styling.

grid_export_eachCell(cell, ci, ri, column, rowData)

Export callback hook to apply Excel-specific data formatting (urls, math) before encoding.

build_depot_filter(no_virtual_depots)

Constructs a robust pqGrid filter dropdown object dynamically populated with the global depot list.

build_job_status_filter()

Constructs a standard filter dropdown object populated by the globally localized lang.statusValues array.

build_options_filter(opts, field_name)

Constructs a generic dropdown filter object from any provided array of objects.

fill_details()

Stub hook. Fired whenever grid row selection changes to populate external forms or update UI states.

get_save_params()

Scans the edit dialog to gather values for saving. Applies red border warnings. Returns payload.

hh_grid_categories_page

Type: Widget
Inherits: hh_grid_bottom_page
Description: Extends bottom grid page to include a Category selector. Renders either horizontal Category Tabs above grid, or nested Category Tree alongside it based on user settings.

Configuration Options

Option Default Description
no_category_types false If true, excludes specific category type classifiers (IS_STOCK, IS_CONSUMABLE) when editing.
category_list "/php_functions/categories_list.php" Backend Ajax endpoint URL for fetching category tree/list data.
category_save "/php_functions/categories_save.php" Backend Ajax endpoint URL for saving category additions or edits.
category_delete "/php_functions/categories_delete.php" Backend Ajax endpoint URL for processing category deletions.
category_move "/php_functions/categories_move.php" Backend Ajax endpoint URL for processing drag-and-drop movements.

Inherited Options

From hh_grid_bottom_page (Inherits)

Option Default Description
min_grid_height 160 The minimum allowable CSS height (in pixels) for the bottom grid container.
min_top_height 0 The default and minimum height of the top tabbed section before the grid starts.
grid_columns_key "_custom" The local storage key used for saving column order/visibility states.
edit_dlg_max_width 190 The maximum width limit (in pixels) for the CRUD edit dialog.
edit_help_page "" The localized HTML help file to load when the user triggers help from the edit dialog.
save_filename "save.php" The backend Ajax endpoint URL hit when saving the CRUD edit dialog.
delete_filename "delete.php" The backend Ajax endpoint URL hit when executing a row deletion.

Local Methods & Functions

Initialization

Method Requirement Description
_create() Requires _super()

Widget constructor. Adds hh-framework_grid_categories_page class and resets timeout buffers.

_init_bottom_section() Required Override

Overrides parent builder. Checks USE_CATEGORY_TREE to execute tab or tree builder before grid.

_init_finally() Requires _super()

Calls parent finalizer to bind resize observers.

UI Builders

Method Requirement Description
_init_categories_tabs() Core Method

Constructs horizontal jQuery UI Tabs container for flat category filtering.

_init_categories_tree() Core Method

Constructs side panel and initializes specialized pqGrid formatted as selectable checkbox tree.

_init_tabs() Requires _super()

Appends 'Categories' management tab to top navigation alongside standard tabs.

Actions & Events

Method Requirement Description
tab_active(ui) Requires _super()

Intercepts tab changes. Lazy-loads categories_edit sub-widget if Categories tab selected.

resize() Requires _super()

Extends parent reflow to calculate dynamic dimensions for active category selector.

resize_cat_tabs()

Calculates total width of category list elements for horizontal scrolling.

resize_cats_tree()

Adjusts top positioning of category tree panel when viewport drops below 880px.

set_cats_tree_bar_icon()

Toggles directional arrow icon on mobile category slide-out bar based on visibility.

category_tree_item_selected()

Fired when node is checked. Applies 500ms debounce before grid data refresh.

Data & Grid Overrides

Method Requirement Description
grid_postData(ui) Requires _super()

Appends selected Tab ID or JSON array of checked Tree IDs to grid's Ajax payload.

cats_tree_colModel()

Defines specialized column model required for rendering Category Tree's pqGrid.

grid_getData(dataJSON, textStatus, jqXHR) Requires _super()

Intercepts Ajax response to dynamically rebuild Category Tabs if headings are present.

refresh_category_tree()

Rebuilds category tree data from global heading_data and restores previously checked nodes.

get_category_tree_ids()

Extracts checked nodes from Category Tree and formats into JSON string for HTTP transmission.

Inherited Methods

From hh_grid_bottom_page (Inherits)

Method Description
_create()

Widget constructor. Adds has_bottom_table class and initializes sections.

_init_main()

Overrides parent. Triggers _init_bottom_section() to construct the grid container.

_init_sections_extra()

Initializes the edit dialog and the column configuration gear menu.

_init_buttons()

Builds standard New, Edit, Delete, Refresh, and Columns buttons into main tab header.

_init_bottom_section()

Creates grid_container, appends it, and invokes _init_grid() to bind pqGrid.

_init_edit_dlg()

Creates the jQuery UI Dialog infrastructure for editing records.

_init_edit_dlg_contents()

Empty stub intended to be overridden to inject HTML inputs into edit dialog DOM.

_init_edit_dlg_custom_fields()

Appends a dynamic custom fields form block to edit dialog if configured.

_init_grid_columns_menu()

Overrides mixin. Enforces backwards compatibility by appending explicit id to menu.

resize()

Reflows edit dialog dimensions and forces a visual refresh of underlying pqGrid.

refresh()

Safe alias to trigger this.grid_refresh().

fill_details()

Toggles button states based on grid selection and syncs custom field views.

get_print_email_params()

Fetches active grid filters and selected row ID to build print/email payload.

refresh_btn_click()

Click handler for the Refresh button. Calls refresh().

menu_btn_click()

Click handler for the Menu button. Positions and displays context menu.

show_deleted_btn_click()

Click handler for the Show Deleted checkbox. Triggers full grid refresh.

setup_menu()

Automatically toggles popup menu items with needs_selected class based on grid state.

grid_context(evt, ui)

Overrides mixin. Force-selects a row when the user right-clicks on it.

open_edit_dlg()

Fired when edit dialog opens. Injects contextual help page paths and triggers resize.

close_edit_dlg()

Fired when edit dialog closes. Restores original help page paths.

resize_edit_dlg()

Dynamically recalculates edit dialog width against window boundary.

new_btn_click()

Click handler. Wipes data, applies 'New' title, and opens edit dialog.

fill_new_dlg()

Clears inputs, textareas, and selects inside dialog, wiping validation borders.

edit_btn_click()

Click handler. Extracts selected row payload and routes to fill_edit_dlg().

fill_edit_dlg(row)

Iterates over dialog DOM matching input name attributes to payload keys to pre-fill form.

save()

Validates inputs and dispatches payload to options.save_filename via Ajax POST.

saved(row, new_rowData)

Ajax success callback. Interprets server response to update existing row or prepend new one.

get_delete_params()

Extracts the ID of the selected row to construct the deletion HTTP payload.

delete_btn_click()

Prompts for user confirmation, then fires Ajax POST to options.delete_filename.

row_deleted(row, response)

Ajax success callback. Physically removes deleted row from pqGrid's local cache.

read_custom_field(field)

Extracts specific custom field values from active grid row for display rendering.

get_custom_field(field)

Retrieves custom field value currently staged within edit dialog's data store.

save_custom_field(field, value)

Updates edit dialog's internal data store with newly manipulated custom field value.

hh_top_section

Type: Widget
Mixes: $hh_pqGrid
Description: A top section or entire page layout containing a grid with NO tabs. Features standard CRUD buttons and resize handlers.

Configuration Options

Option Default Description
include_resize false Include a bottom drag-handle for vertical resizing.
min_height 120 Minimum height of element.
height 200 Initial default height.
main_id 0 Owner ID (e.g. parent stock ID). Changing this triggers auto-refresh.
sub_type 0 Sub-type ID for filtering attached documents.
edit_dlg_max_width 550 Max width constraint for edit dialog.
grid_fullscreen_loader false Overrides mixin default to utilize small internal spinner.
item_data null Data payload of selected parent item, passed down to section.
edit_help_page "" Specific HTML help file for edit dialog.
element_class "" Extra CSS classes applied to root element.
save_filename "save.php" Ajax save endpoint.
delete_filename "delete.php" Ajax delete endpoint.

Inherited Options

From $hh_pqGrid (Mixes)

Option Default Description
grid_sequential_page_load false If true, the grid strictly loads the next sequential page instead of jumping to random pages based on scroll position. Essential for datasets where the total record count is unknown.
grid_columns_key "" The unique string key used to save and load the user's specific column order and visibility preferences. Setting this to an empty string completely disables the column configuration menu.
grid_rowsPerPage 100 The number of rows fetched per page request during infinite scrolling. Set to 0 to disable paging entirely.
grid_initial_sort_column "ID" The dataIndx name of the column that the grid should initially sort by on load.
grid_initial_sort_order "up" The initial sort direction for the column specified above. Accepts 'up' (ascending) or 'down' (descending).
grid_fullscreen_loader true If true, loading data triggers a full-screen loading overlay. If false, it uses a smaller internal spinner.
custom_fields_type "" The identifier string for the custom fields type applied to this grid.
tabs_to_menu_width 660 The responsive screen width breakpoint (in px) that determines when standard tabs collapse into a mobile dropdown menu.
grid_load_once false If true, fetches data from the server exactly once upon initialization and treats the data as local from then on.
list_filename "list.php" The backend URL endpoint that the grid calls to fetch its JSON row data. Empty forces local operation.

Local Methods & Functions

Initialization

Method Requirement Description
_create() Requires _super()

Widget constructor. Adds custom classes and triggers build sequence.

_init_sections() Requires _super()

Master builder invoking all sub-initialization methods.

_init_dependencies() Requires _super()

Pre-flight hook for APIs.

_init_sections_extra() Required Override

Customizations hook for descendant extensions.

_init_custom() Required Override

OOP customizations hook for third-party plugins.

_init_finally() Requires _super()

Final requirements. Forces resize computation.

UI Builders

Method Requirement Description
_init_main() Requires _super()

Configures CSS grid template rules and calls button/content builders.

_init_buttons() Required Override

Constructs the button bar (New, Edit, Delete, Refresh).

_init_top_section() Required Override

Builds content area directly beneath buttons and above grid.

_init_main_content() Required Override

Appends grid_container and invokes pqGrid mixin initializer.

_init_resize_bar() Core Method

Attaches jQuery UI Resizable handle if include_resize option is true.

_init_popup_menu() Requires _super()

Builds right-click context menu and assigns selection handlers.

_init_edit_dlg() Required Override

Sets up jQuery UI Dialog for editing records.

_init_edit_dlg_contents() Required Override

Stub for injecting form inputs into edit dialog.

_init_edit_dlg_custom_fields() Required Override

Injects custom fields form block if type is specified.

build_popup_menu_contents() Required Override

Populates context menu items.

Grid Options

Method Requirement Description
grid_postData(ui) Requires _super()

Mixes in main_id and del flags into Ajax payload.

Grid Events

Method Requirement Description
grid_rowDblClick(event, ui) Required Override

Double click handler mapping to edit_btn_click().

Events & Interactions

Method Requirement Description
_setOption(key, value) Requires _super()

Intercepts option changes. Triggers auto-refresh if main_id changes.

Actions

Method Requirement Description
refresh() Required Override

Fires grid refresh, or clears data if main_id is 0.

resize() Requires _super()

Resizes dialogs and visually reflows pqGrid.

refresh_btn_click() Required Override

Refresh button click handler.

menu_btn_click() Required Override

Context menu button click handler.

show_deleted_btn_click() Required Override

Show/hide deleted checkbox handler.

print() Requires _super()

Routes params to global openPrint().

send_email() Requires _super()

Routes params to global send_email().

setup_menu() Required Override

Enables/disables popup menu items dynamically.

Data & Utilities

Method Requirement Description
get_doc_type() Requires _super()

Returns current active document type.

read_custom_field(field) Required Override

Extracts custom field value for display.

get_print_email_params() Required Override

Returns payload parameters for print/email routing.

Data Binding

Method Requirement Description
fill_details() Required Override

Toggles button states based on row selection and main_id presence.

Editing

Method Requirement Description
open_edit_dlg() Required Override

Edit dialog opened handler. Sets help pages.

close_edit_dlg() Required Override

Edit dialog closed handler.

resize_edit_dlg() Required Override

Resizes edit dialog bounded by edit_dlg_max_width.

new_btn_click() Required Override

New button clicked. Clears form and opens dialog.

fill_new_dlg() Required Override

Empties edit dialog inputs for fresh record.

edit_btn_click() Required Override

Edit button clicked. Loads selection to dialog.

fill_edit_dlg(row) Required Override

Fills edit dialog inputs matching rowData keys.

save(close_dlg) Required Override

Validates inputs and dispatches Ajax save.

saved(row, data) Required Override

Applies saved data to grid (update or addRow).

get_delete_params() Required Override

Gets delete parameters containing selected ID.

delete_btn_click() Required Override

Delete button clicked. Confirms and dispatches Ajax.

row_deleted(row, response) Required Override

Processes local grid deletion post-success.

save_custom_field_value(field, value) Required Override

Stages custom field edits in dialog data store.

get_custom_field_value(field) Required Override

Retrieves staged custom field value.

Inherited Methods

From $hh_pqGrid (Mixes)

Method Description
_init_grid()

Core initialization routine. Sets up the paging object, binds grid options, applies localization, and attaches pqGrid to the DOM.

_init_grid_columns_menu()

Initializes the column visibility popup menu. Only executes if grid_columns_key is populated.

grid_update_counters()

Hook called when row numbers change. Intended to be overridden to update UI tab badges (e.g., 'Notes (3)').

grid_get_rowData()

Returns the raw rowData object of the currently selected row. Returns null if none or multiple are selected.

grid_get_selected_id()

Fetches the ID integer from the currently selected row. Used for syncing related tabs.

grid_get_filter_values()

Extracts current column filters and sorting rules into a parameter object ready for Ajax transmission.

grid_select_indx(indx)

Programmatically selects a specific row index. Safely clamps to boundaries or triggers clear views if empty.

grid_refresh()

Forces a hard refresh of the grid. Aborts pending calls, clears data cache, resets paging, and fires a new request.

grid_load_once()

Bypasses remote protocol for a manual, one-time Ajax GET to fetch the entire dataset at once.

grid_load_once_loaded(dataJSON)

Callback executed by grid_load_once(). Populates the paging object and pushes data directly into local dataModel.

grid_call_filter(ui)

Internal utility used to programmatically trigger filter rules and force an immediate re-fetch.

grid_get_ID_rowData_lookup()

Returns a dictionary mapping row IDs to their exact rowData objects for extremely fast memory lookups.

grid_string_render(ui)

Standard column renderer. Trims strings and generates HTML title tooltips for hovering.

grid_custom_field_render(ui, field_name)

Safely digs into nested CUSTOM_FIELDS JSON object to extract and format custom string values.

grid_UTCdate_render(ui)

Parses server UTC timestamps and formats them to the user's localized time zone settings.

grid_date_render(ui)

Standard localized date renderer utilizing the global dateFormatter().

grid_currency_render(ui)

Automatically applies the user's currency symbol, decimal rules, and multiplier logic.

grid_columns_btn_click(owner)

Click handler for the column gear icon. Positions and reveals the column visibility toggles.

grid_cols_popup_menu_setup()

Scans the active colModel and applies tick/blank icons to the column menu list accordingly.

grid_build_columns_menu()

Constructs the HTML DOM for the column toggle menu based on columns flagged with hh_optional: true.

grid_cols_popup_menu_selected(e, ui)

Handles menu selections. Triggers grid resets or calculates visibility arrays. Automatically saves settings.

grid_show_hide_columns(visible_cols)

Takes array of desired visible columns, computes hidden array based on hh_optional, and applies to pqGrid.

grid_column_moved(event, ui)

Callback fired when a user drags to reorder a column. Extracts new layout and saves to profile.

grid_options()

Master assembler compiling all models into the final configuration object handed to pqGrid.

grid_postData(ui)

Generates Ajax payload (time, paging, deleted flag). Designed to be extended via _super().

grid_dataModel()

Constructs the pqGrid dataModel object (GET/POST, URL routing, JSON type, success handlers).

grid_setup_column_model()

Retrieves raw column model and cross-references against user's saved settings to reorder/hide columns.

grid_columnModel()

Returns raw array of column definitions. Intended to be completely overridden by descendant widgets.

grid_add_custom_fields_to_columnModel(colModel, options)

Utility to parse FIELD_DEFINITIONS and inject dynamically generated schemas for custom fields.

grid_sortModel()

Generates the pqGrid sortModel based on the initial sort options provided.

grid_filterModel()

Generates the pqGrid filterModel. Applies a 1000ms debounce timeout.

grid_focusModel()

Generates the pqGrid focusModel. Disables individual cell focus outlines by default.

grid_rowInit(ui)

Callback executed as each row is drawn. Override to inject custom CSS classes based on row status.

grid_paging_init_event()

Event hook triggered immediately whenever the internal paging tracker object is reset to page 0.

grid_get_paging_object()

Returns the internal grid_paging tracker object (stores data chunks, total records, current page).

grid_rowSelect(event, ui)

Fired when a user clicks a row. Immediately delegates to this.fill_details().

grid_rowDblClick(event, ui)

Fired on double click. Left empty by default, intended for overriding.

grid_getData(dataJSON, textStatus, jqXHR)

Master Ajax success interceptor. Calculates pagination math, caches lookups, and splices data into scroll buffer.

grid_truncate_rows_from_data()

Memory management function to trim trailing empty placeholder rows if data exceeds totalRecords.

grid_beforeSort(evt, ui)

Fired before sorting. Hard-resets the pagination object to prevent page offset corruptions.

grid_beforeFilter(evt, ui)

Fired before filtering. Caches focused filter input to seamlessly restore cursor focus after re-rendering.

grid_scrollStop()

Infinite scroll engine. Analyzes viewport to detect empty placeholder rows and triggers Ajax fetches.

grid_complete(evt, ui)

Fires after DOM rendering completes. Forces row selection, executes fill_details(), restores focus.

grid_beforeTableView(evt, ui)

Used in sequential page load mode. Pre-emptively checks bottom boundary to fetch next page.

grid_scroll(evt, ui)

Fired iteratively during scrolling. Empty hook for override.

grid_context(evt, ui)

Empty hook fired upon a right mouse click event on the grid.

grid_setup_excel_formats()

Parses user currency and date formats to construct native Excel string formats for exports.

grid_export(format, filename, colWrap)

Requests export, applies custom row striping/headers, and triggers browser download.

grid_export_eachCol(col, ci, column)

Export callback to adjust visibility dynamically during export processing.

grid_export_eachCellHead(cell, ci, ri, column)

Export callback hook to manipulate header cell text/styling.

grid_export_eachCell(cell, ci, ri, column, rowData)

Export callback hook to apply Excel-specific data formatting (urls, math) before encoding.

build_depot_filter(no_virtual_depots)

Constructs a robust pqGrid filter dropdown object dynamically populated with the global depot list.

build_job_status_filter()

Constructs a standard filter dropdown object populated by the globally localized lang.statusValues array.

build_options_filter(opts, field_name)

Constructs a generic dropdown filter object from any provided array of objects.

fill_details()

Stub hook. Fired whenever grid row selection changes to populate external forms or update UI states.

get_save_params()

Scans the edit dialog to gather values for saving. Applies red border warnings. Returns payload.

hh_grid_and_categories

Type: Widget
Mixes: $hh_pqGrid
Description: A standalone DIV container rendering a selection grid bundled with category filtering functionality. By default, its dataModel is initialized as 'local' to prevent immediate auto-loading.

Configuration Options

Option Default Description
grid_dataModel null Override object for grid dataModel.
grid_columnModel null Override array for grid colModel.
grid_rowDblClick null Callback function executed upon row double-click.
grid_options null Extra root-level grid options.
cats_tree_hide_size 600 Width breakpoint (px) triggering category tree collapse into a floating popout.
get_postData null Callback to inject extra parameters into Ajax requests.
fill_details null Callback fired whenever row selection changes.

Inherited Options

From $hh_pqGrid (Mixes)

Option Default Description
grid_sequential_page_load false If true, the grid strictly loads the next sequential page instead of jumping to random pages based on scroll position. Essential for datasets where the total record count is unknown.
grid_columns_key "" The unique string key used to save and load the user's specific column order and visibility preferences. Setting this to an empty string completely disables the column configuration menu.
grid_rowsPerPage 100 The number of rows fetched per page request during infinite scrolling. Set to 0 to disable paging entirely.
grid_initial_sort_column "ID" The dataIndx name of the column that the grid should initially sort by on load.
grid_initial_sort_order "up" The initial sort direction for the column specified above. Accepts 'up' (ascending) or 'down' (descending).
grid_fullscreen_loader true If true, loading data triggers a full-screen loading overlay. If false, it uses a smaller internal spinner.
custom_fields_type "" The identifier string for the custom fields type applied to this grid.
tabs_to_menu_width 660 The responsive screen width breakpoint (in px) that determines when standard tabs collapse into a mobile dropdown menu.
grid_load_once false If true, fetches data from the server exactly once upon initialization and treats the data as local from then on.
list_filename "list.php" The backend URL endpoint that the grid calls to fetch its JSON row data. Empty forces local operation.

Local Methods & Functions

Initialization

Method Requirement Description
_create() Requires _super()

Widget constructor. Binds classes and initializes buffers.

_init_custom() Required Override

Customizations hook.

_init_finally() Requires _super()

Final requirements. Binds resize observers.

UI Builders

Method Requirement Description
_init_main() Requires _super()

Evaluates USE_CATEGORY_TREE to spawn either tabs or tree, and appends grid container.

_init_categories_tabs() Core Method

Initializes horizontal category tabs.

_init_categories_tree() Core Method

Initializes hierarchical category tree via pqGrid.

Lifecycle

Method Requirement Description
_destroy() Requires _super()

Destroys generated elements and dialogs.

Actions

Method Requirement Description
refresh() Required Override

Forces dataModel.location to 'remote' and triggers grid_refresh().

resize() Requires _super()

Calculates dimension reflows for either tabs or trees.

resize_cat_tabs()

Reflows tab widths for scrolling.

resize_cats_tree()

Switches tree into floating popout panel below breakpoint.

Grid Configuration

Method Requirement Description
cats_tree_colModel() Core Method

Defines internal column schema specifically for the Category Tree.

grid_postData(ui) Requires _super()

Merges option callbacks and appends selected categories to Ajax payload.

grid_dataModel() Requires _super()

Overrides mixin to explicitly set location:'local' to prevent auto-load on boot.

grid_getData(dataJSON, textStatus, jqXHR) Requires _super()

Intercepts JSON response. Rebuilds Category Tabs or Tree dynamically based on response metadata.

grid_columnModel() Requires _super()

Returns grid_columnModel derived from options array.

grid_options() Requires _super()

Merges mixin defaults with options.grid_options.

Data Retrieval

Method Requirement Description
get_grid()

Returns the underlying jQuery jqGrid/pqGrid element.

get_category_tree_ids()

Extracts selected category IDs from tree as JSON string.

Grid Events

Method Requirement Description
grid_rowDblClick(event, ui) Required Override

Fires options.grid_rowDblClick callback.

Data Binding

Method Requirement Description
fill_details() Required Override

Executes options.fill_details callback.

Events & Interactions

Method Requirement Description
category_tab_selected(ui)

Handler for category tab clicks. Triggers refresh().

category_tree_item_selected(skip_timeout)

Handler for tree node checks. Applies debounce timeout before grid refresh.

set_cats_tree_bar_icon()

Toggles slide-out arrow icon direction on mobile view.

Inherited Methods

From $hh_pqGrid (Mixes)

Method Description
_init_grid()

Core initialization routine. Sets up the paging object, binds grid options, applies localization, and attaches pqGrid to the DOM.

_init_grid_columns_menu()

Initializes the column visibility popup menu. Only executes if grid_columns_key is populated.

grid_update_counters()

Hook called when row numbers change. Intended to be overridden to update UI tab badges (e.g., 'Notes (3)').

grid_get_rowData()

Returns the raw rowData object of the currently selected row. Returns null if none or multiple are selected.

grid_get_selected_id()

Fetches the ID integer from the currently selected row. Used for syncing related tabs.

grid_get_filter_values()

Extracts current column filters and sorting rules into a parameter object ready for Ajax transmission.

grid_select_indx(indx)

Programmatically selects a specific row index. Safely clamps to boundaries or triggers clear views if empty.

grid_refresh()

Forces a hard refresh of the grid. Aborts pending calls, clears data cache, resets paging, and fires a new request.

grid_load_once()

Bypasses remote protocol for a manual, one-time Ajax GET to fetch the entire dataset at once.

grid_load_once_loaded(dataJSON)

Callback executed by grid_load_once(). Populates the paging object and pushes data directly into local dataModel.

grid_call_filter(ui)

Internal utility used to programmatically trigger filter rules and force an immediate re-fetch.

grid_get_ID_rowData_lookup()

Returns a dictionary mapping row IDs to their exact rowData objects for extremely fast memory lookups.

grid_string_render(ui)

Standard column renderer. Trims strings and generates HTML title tooltips for hovering.

grid_custom_field_render(ui, field_name)

Safely digs into nested CUSTOM_FIELDS JSON object to extract and format custom string values.

grid_UTCdate_render(ui)

Parses server UTC timestamps and formats them to the user's localized time zone settings.

grid_date_render(ui)

Standard localized date renderer utilizing the global dateFormatter().

grid_currency_render(ui)

Automatically applies the user's currency symbol, decimal rules, and multiplier logic.

grid_columns_btn_click(owner)

Click handler for the column gear icon. Positions and reveals the column visibility toggles.

grid_cols_popup_menu_setup()

Scans the active colModel and applies tick/blank icons to the column menu list accordingly.

grid_build_columns_menu()

Constructs the HTML DOM for the column toggle menu based on columns flagged with hh_optional: true.

grid_cols_popup_menu_selected(e, ui)

Handles menu selections. Triggers grid resets or calculates visibility arrays. Automatically saves settings.

grid_show_hide_columns(visible_cols)

Takes array of desired visible columns, computes hidden array based on hh_optional, and applies to pqGrid.

grid_column_moved(event, ui)

Callback fired when a user drags to reorder a column. Extracts new layout and saves to profile.

grid_options()

Master assembler compiling all models into the final configuration object handed to pqGrid.

grid_postData(ui)

Generates Ajax payload (time, paging, deleted flag). Designed to be extended via _super().

grid_dataModel()

Constructs the pqGrid dataModel object (GET/POST, URL routing, JSON type, success handlers).

grid_setup_column_model()

Retrieves raw column model and cross-references against user's saved settings to reorder/hide columns.

grid_columnModel()

Returns raw array of column definitions. Intended to be completely overridden by descendant widgets.

grid_add_custom_fields_to_columnModel(colModel, options)

Utility to parse FIELD_DEFINITIONS and inject dynamically generated schemas for custom fields.

grid_sortModel()

Generates the pqGrid sortModel based on the initial sort options provided.

grid_filterModel()

Generates the pqGrid filterModel. Applies a 1000ms debounce timeout.

grid_focusModel()

Generates the pqGrid focusModel. Disables individual cell focus outlines by default.

grid_rowInit(ui)

Callback executed as each row is drawn. Override to inject custom CSS classes based on row status.

grid_paging_init_event()

Event hook triggered immediately whenever the internal paging tracker object is reset to page 0.

grid_get_paging_object()

Returns the internal grid_paging tracker object (stores data chunks, total records, current page).

grid_rowSelect(event, ui)

Fired when a user clicks a row. Immediately delegates to this.fill_details().

grid_rowDblClick(event, ui)

Fired on double click. Left empty by default, intended for overriding.

grid_getData(dataJSON, textStatus, jqXHR)

Master Ajax success interceptor. Calculates pagination math, caches lookups, and splices data into scroll buffer.

grid_truncate_rows_from_data()

Memory management function to trim trailing empty placeholder rows if data exceeds totalRecords.

grid_beforeSort(evt, ui)

Fired before sorting. Hard-resets the pagination object to prevent page offset corruptions.

grid_beforeFilter(evt, ui)

Fired before filtering. Caches focused filter input to seamlessly restore cursor focus after re-rendering.

grid_scrollStop()

Infinite scroll engine. Analyzes viewport to detect empty placeholder rows and triggers Ajax fetches.

grid_complete(evt, ui)

Fires after DOM rendering completes. Forces row selection, executes fill_details(), restores focus.

grid_beforeTableView(evt, ui)

Used in sequential page load mode. Pre-emptively checks bottom boundary to fetch next page.

grid_scroll(evt, ui)

Fired iteratively during scrolling. Empty hook for override.

grid_context(evt, ui)

Empty hook fired upon a right mouse click event on the grid.

grid_setup_excel_formats()

Parses user currency and date formats to construct native Excel string formats for exports.

grid_export(format, filename, colWrap)

Requests export, applies custom row striping/headers, and triggers browser download.

grid_export_eachCol(col, ci, column)

Export callback to adjust visibility dynamically during export processing.

grid_export_eachCellHead(cell, ci, ri, column)

Export callback hook to manipulate header cell text/styling.

grid_export_eachCell(cell, ci, ri, column, rowData)

Export callback hook to apply Excel-specific data formatting (urls, math) before encoding.

build_depot_filter(no_virtual_depots)

Constructs a robust pqGrid filter dropdown object dynamically populated with the global depot list.

build_job_status_filter()

Constructs a standard filter dropdown object populated by the globally localized lang.statusValues array.

build_options_filter(opts, field_name)

Constructs a generic dropdown filter object from any provided array of objects.

fill_details()

Stub hook. Fired whenever grid row selection changes to populate external forms or update UI states.

get_save_params()

Scans the edit dialog to gather values for saving. Applies red border warnings. Returns payload.

hh_picklist_dlg

Type: Widget
Description: Product picklist dialog managing both single and bulk multi-selection with integrated real-time availability tracking via Ajax.

Configuration Options

Option Default Description
price_group 0 Price group used to determine default price extraction.
multi_select true If true, exposes QTY spinner columns for bulk addition.
multi_select_full false If true, the shopping list payload retains the complete rowData for each selected item.
single_filter 0 If multi_select is false, restricts list (1=Sales, 2=Rental, 4=Labour).
no_rental false Hides rental items (used in maintenance modules).
grid_initial_sort_column "TITLE" Initial column index to sort by.
grid_rowsPerPage 80 Rows fetched per page.
grid_columns_key "itemsPicklist" Key for saving column visibility settings.
grid_cellClick null Callback triggered when any cell is clicked.
list_filename "/php_functions/picklist_list.php" Backend endpoint to fetch product list.
availability_filename "/php_functions/picklist_get_availability.php" Backend endpoint to resolve '?' stock values.
global_depot 0 Depot ID targeted for GLOBAL stock checks.
colModel_setup null Callback allowing arbitrary mutation of the generated colModel.
saved_callback null Callback executed when user hits Apply/Save.
job_id 0 Contextual Job ID for availability math.
client_id 0 Contextual Customer ID for specific pricing tiers.

Local Methods & Functions

Initialization

Method Requirement Description
_create() Requires _super()

Widget constructor. Initializes shopping list stores.

_init_custom() Required Override

Customizations hook.

_init_finally() Requires _super()

Binds dialog behavior, buttons, and resize handlers.

UI Builders

Method Requirement Description
_init_main() Requires _super()

Injects top filters section and instantiates hh_grid_and_categories.

_init_top_section() Required Override

Builds checkboxes for Sales/Rental/Labour and global search input.

Lifecycle

Method Requirement Description
_destroy() Requires _super()

Destroys dialog UI footprint entirely.

Actions

Method Requirement Description
refresh() Required Override

Aliases refresh to inner hh_grid_and_categories instance.

resize() Requires _super()

Calculates math to maximize dialog bounds against viewport.

Grid Rendering

Method Requirement Description
grid_string_render(ui)

Routes string rendering to inner instance.

quantity_render(ui) Core Method

Renders QTY cell. Triggers async availability fetch if value is '?'.

grid_rowInit(ui) Required Override

Row initialization callback. Disables rows if unavailable or depot restricted.

Events & Interactions

Method Requirement Description
opened() Required Override

Dialog opened handler. Resets shopping list and enforces column visibility based on multi_select.

closed() Required Override

Dialog closed handler. Halts any pending availability fetches.

grid_columns_btn_click() Required Override

Routes column configuration gear click to inner instance.

Data Binding

Method Requirement Description
fill_details(rowData) Required Override

Updates thumbnail image and HTML memo block for selected item.

Data Retrieval

Method Requirement Description
get_grid()

Returns underlying pqGrid element.

Grid Configuration

Method Requirement Description
grid_columnModel() Required Override

Constructs complex colModel including dynamic price group columns.

grid_post_data(ui) Required Override

Assembles search terms, checkboxes, and client IDs for list fetch.

Data Handlers

Method Requirement Description
get_save_params() Required Override

Compiles internal shopping_list dictionary into final save payload.

save() Required Override

Validates payload and triggers options.saved_callback.

Availability Engine

Method Requirement Description
trigger_availability() Core Method

Starts 500ms debounce timer for availability fetch.

get_availability_params() Core Method

Scans visible viewport rows and extracts items requiring stock resolution.

get_availability() Core Method

Dispatches Ajax GET to resolve batch of stock queries.

get_availability_success(rows) Core Method

Merges resolved stock numbers back into active grid rowData cache.

reset_GLOBAL_column() Required Override

Forces all GLOBAL cells back to '?' to force re-fetch upon depot change.

hh_search_results_dialog

Type: Widget
Mixes: $hh_pqGrid
Description: The standard full-screen Job and Project search dialog popup. Includes advanced filter forms above the grid and a Favorites management system.

Configuration Options

Option Default Description
include_job_custom_fields false Dynamically injects job custom fields into the search column model.
include_project_custom_fields false Dynamically injects project custom fields into the search column model.
grid_columns_key "searchCols" Key for saving search column visibility settings.
override_open null Callback to override default link-opening behavior (used in scanning/ePos).
grid_initial_sort_column "OUT_DATE" Initial column sort.
list_filename "/php_functions/search_list.php" Search endpoint URL.

Inherited Options

From $hh_pqGrid (Mixes)

Option Default Description
grid_sequential_page_load false If true, the grid strictly loads the next sequential page instead of jumping to random pages based on scroll position. Essential for datasets where the total record count is unknown.
grid_columns_key "" The unique string key used to save and load the user's specific column order and visibility preferences. Setting this to an empty string completely disables the column configuration menu.
grid_rowsPerPage 100 The number of rows fetched per page request during infinite scrolling. Set to 0 to disable paging entirely.
grid_initial_sort_column "ID" The dataIndx name of the column that the grid should initially sort by on load.
grid_initial_sort_order "up" The initial sort direction for the column specified above. Accepts 'up' (ascending) or 'down' (descending).
grid_fullscreen_loader true If true, loading data triggers a full-screen loading overlay. If false, it uses a smaller internal spinner.
custom_fields_type "" The identifier string for the custom fields type applied to this grid.
tabs_to_menu_width 660 The responsive screen width breakpoint (in px) that determines when standard tabs collapse into a mobile dropdown menu.
grid_load_once false If true, fetches data from the server exactly once upon initialization and treats the data as local from then on.
list_filename "list.php" The backend URL endpoint that the grid calls to fetch its JSON row data. Empty forces local operation.

Local Methods & Functions

Initialization

Method Requirement Description
_create() Requires _super()

Widget constructor. Binds ID and initializes buffers.

_init_dependencies() Requires _super()

Loads dependencies.

_init_custom() Required Override

Customizations hook.

_init_finally() Requires _super()

Binds dialog behavior, buttons, and resize handlers.

UI Builders

Method Requirement Description
_init_main() Requires _super()

Configures CSS grid template and appends filter box.

_init_bottom_section() Required Override

Constructs the massive HTML filter form (dates, checkboxes, statuses).

_init_favourites_dlg() Required Override

Instantiates the nested hh_favourites_dialog widget.

get_dialog_buttons()

Returns array of standard buttons (Favorite, Export, Open, Close) for dialog.

_init_grid_columns_menu() Requires _super()

Overrides mixin to rename 'COLOUR' heading text.

Actions

Method Requirement Description
resize() Requires _super()

Calculates math to maximize dialog bounds against viewport.

refresh() Required Override

Evaluates sequential load requirements and fires grid_refresh().

reset_grid_options() Required Override

Hard-resets grid paging options upon filter change.

Data Binding

Method Requirement Description
fill_details() Required Override

Dynamically disables/enables filter checkboxes based on cross-dependencies.

set_search_options(options) Required Override

Programmatically mutates UI checkbox/date fields from JSON and executes filter.

Data Retrieval

Method Requirement Description
get_selected_rowData()

Returns raw payload of selected row.

Events & Interactions

Method Requirement Description
open_clicked() Required Override

Handler for 'Open' button or double-click. Evaluates override_open callback.

open(search_options) Required Override

Public API to invoke dialog programmatically with pre-filled search JSON.

Data Handlers

Method Requirement Description
convert_params_to_json()

Serializes all active UI filters into a standardized JSON payload.

Grid Events

Method Requirement Description
grid_rowDblClick(event, ui) Requires _super()

Routes double click to open_clicked().

grid_getData(dataJSON, textStatus, jqXHR) Requires _super()

Intercepts JSON response to populate preset_search_settings cache globally.

Grid Configuration

Method Requirement Description
grid_columnModel() Required Override

Defines massive column model for all job/project metadata.

get_custom_index_column()

Returns column model for the localized custom index column.

add_custom_fields_columns(columnModel, custom_field_defs)

Injects custom field definitions dynamically into column array.

grid_dataModel() Requires _super()

DataModel configured explicitly for local loading on boot.

grid_postData(ui) Requires _super()

Assembles all form filters into final Ajax payload.

Excel / CSV Export

Method Requirement Description
grid_export_eachCol(col, ci, column) Required Override

Export callback to hide 'MONEY' column conditionally.

grid_export_eachCellHead(cell, ci, ri, column) Required Override

Export callback to rename header cells.

grid_export_eachCell(cell, ci, ri, column, rowData) Required Override

Export callback to format dates, money, and hyperlinked IDs.

Favorites Management

Method Requirement Description
open_favourites() Required Override

Invokes the hh_favourites_dialog.

apply_search(rowData) Required Override

Callback executed when a user selects a preset search.

Inherited Methods

From $hh_pqGrid (Mixes)

Method Description
_init_grid()

Core initialization routine. Sets up the paging object, binds grid options, applies localization, and attaches pqGrid to the DOM.

_init_grid_columns_menu()

Initializes the column visibility popup menu. Only executes if grid_columns_key is populated.

grid_update_counters()

Hook called when row numbers change. Intended to be overridden to update UI tab badges (e.g., 'Notes (3)').

grid_get_rowData()

Returns the raw rowData object of the currently selected row. Returns null if none or multiple are selected.

grid_get_selected_id()

Fetches the ID integer from the currently selected row. Used for syncing related tabs.

grid_get_filter_values()

Extracts current column filters and sorting rules into a parameter object ready for Ajax transmission.

grid_select_indx(indx)

Programmatically selects a specific row index. Safely clamps to boundaries or triggers clear views if empty.

grid_refresh()

Forces a hard refresh of the grid. Aborts pending calls, clears data cache, resets paging, and fires a new request.

grid_load_once()

Bypasses remote protocol for a manual, one-time Ajax GET to fetch the entire dataset at once.

grid_load_once_loaded(dataJSON)

Callback executed by grid_load_once(). Populates the paging object and pushes data directly into local dataModel.

grid_call_filter(ui)

Internal utility used to programmatically trigger filter rules and force an immediate re-fetch.

grid_get_ID_rowData_lookup()

Returns a dictionary mapping row IDs to their exact rowData objects for extremely fast memory lookups.

grid_string_render(ui)

Standard column renderer. Trims strings and generates HTML title tooltips for hovering.

grid_custom_field_render(ui, field_name)

Safely digs into nested CUSTOM_FIELDS JSON object to extract and format custom string values.

grid_UTCdate_render(ui)

Parses server UTC timestamps and formats them to the user's localized time zone settings.

grid_date_render(ui)

Standard localized date renderer utilizing the global dateFormatter().

grid_currency_render(ui)

Automatically applies the user's currency symbol, decimal rules, and multiplier logic.

grid_columns_btn_click(owner)

Click handler for the column gear icon. Positions and reveals the column visibility toggles.

grid_cols_popup_menu_setup()

Scans the active colModel and applies tick/blank icons to the column menu list accordingly.

grid_build_columns_menu()

Constructs the HTML DOM for the column toggle menu based on columns flagged with hh_optional: true.

grid_cols_popup_menu_selected(e, ui)

Handles menu selections. Triggers grid resets or calculates visibility arrays. Automatically saves settings.

grid_show_hide_columns(visible_cols)

Takes array of desired visible columns, computes hidden array based on hh_optional, and applies to pqGrid.

grid_column_moved(event, ui)

Callback fired when a user drags to reorder a column. Extracts new layout and saves to profile.

grid_options()

Master assembler compiling all models into the final configuration object handed to pqGrid.

grid_postData(ui)

Generates Ajax payload (time, paging, deleted flag). Designed to be extended via _super().

grid_dataModel()

Constructs the pqGrid dataModel object (GET/POST, URL routing, JSON type, success handlers).

grid_setup_column_model()

Retrieves raw column model and cross-references against user's saved settings to reorder/hide columns.

grid_columnModel()

Returns raw array of column definitions. Intended to be completely overridden by descendant widgets.

grid_add_custom_fields_to_columnModel(colModel, options)

Utility to parse FIELD_DEFINITIONS and inject dynamically generated schemas for custom fields.

grid_sortModel()

Generates the pqGrid sortModel based on the initial sort options provided.

grid_filterModel()

Generates the pqGrid filterModel. Applies a 1000ms debounce timeout.

grid_focusModel()

Generates the pqGrid focusModel. Disables individual cell focus outlines by default.

grid_rowInit(ui)

Callback executed as each row is drawn. Override to inject custom CSS classes based on row status.

grid_paging_init_event()

Event hook triggered immediately whenever the internal paging tracker object is reset to page 0.

grid_get_paging_object()

Returns the internal grid_paging tracker object (stores data chunks, total records, current page).

grid_rowSelect(event, ui)

Fired when a user clicks a row. Immediately delegates to this.fill_details().

grid_rowDblClick(event, ui)

Fired on double click. Left empty by default, intended for overriding.

grid_getData(dataJSON, textStatus, jqXHR)

Master Ajax success interceptor. Calculates pagination math, caches lookups, and splices data into scroll buffer.

grid_truncate_rows_from_data()

Memory management function to trim trailing empty placeholder rows if data exceeds totalRecords.

grid_beforeSort(evt, ui)

Fired before sorting. Hard-resets the pagination object to prevent page offset corruptions.

grid_beforeFilter(evt, ui)

Fired before filtering. Caches focused filter input to seamlessly restore cursor focus after re-rendering.

grid_scrollStop()

Infinite scroll engine. Analyzes viewport to detect empty placeholder rows and triggers Ajax fetches.

grid_complete(evt, ui)

Fires after DOM rendering completes. Forces row selection, executes fill_details(), restores focus.

grid_beforeTableView(evt, ui)

Used in sequential page load mode. Pre-emptively checks bottom boundary to fetch next page.

grid_scroll(evt, ui)

Fired iteratively during scrolling. Empty hook for override.

grid_context(evt, ui)

Empty hook fired upon a right mouse click event on the grid.

grid_setup_excel_formats()

Parses user currency and date formats to construct native Excel string formats for exports.

grid_export(format, filename, colWrap)

Requests export, applies custom row striping/headers, and triggers browser download.

grid_export_eachCol(col, ci, column)

Export callback to adjust visibility dynamically during export processing.

grid_export_eachCellHead(cell, ci, ri, column)

Export callback hook to manipulate header cell text/styling.

grid_export_eachCell(cell, ci, ri, column, rowData)

Export callback hook to apply Excel-specific data formatting (urls, math) before encoding.

build_depot_filter(no_virtual_depots)

Constructs a robust pqGrid filter dropdown object dynamically populated with the global depot list.

build_job_status_filter()

Constructs a standard filter dropdown object populated by the globally localized lang.statusValues array.

build_options_filter(opts, field_name)

Constructs a generic dropdown filter object from any provided array of objects.

fill_details()

Stub hook. Fired whenever grid row selection changes to populate external forms or update UI states.

get_save_params()

Scans the edit dialog to gather values for saving. Applies red border warnings. Returns payload.

hh_favourites_dialog

Type: Widget
Description: Favorites dialog for the search functionality. Can manage and apply preset or custom-saved search filters.

Configuration Options

Option Default Description
no_buttons false If true, hides the top button bar (used when opened in settings view).
callback null Callback fired when a search is selected/applied.
search_params null Current search parameters passed down from search dialog for saving.
delete_favourite_filename "/php_functions/search_delete_favourite.php" Ajax delete endpoint.
save_favourite_filename "/php_functions/search_save_favourite.php" Ajax save endpoint.

Local Methods & Functions

Initialization

Method Requirement Description
_create() Requires _super()

Widget constructor.

_init_dependencies() Requires _super()

Dependencies hook.

_init_custom() Required Override

Customizations hook.

_init_finally() Requires _super()

Final initialization and resize binding.

UI Builders

Method Requirement Description
_init_main() Requires _super()

Conditionally builds buttons and instantiates UI Dialog.

_init_grid() Required Override

Sets up local pqGrid specifically for rendering favorites tree.

_init_name_edit_dlg() Required Override

Sets up secondary dialog for editing search names.

Actions

Method Requirement Description
resize() Requires _super()

Recalculates dialog position.

Events & Interactions

Method Requirement Description
opened() Required Override

Dialog opened handler. Ensures grid is drawn correctly.

open(params) Required Override

Public API to invoke dialog with active search params.

new_button_click() Required Override

Opens name edit dialog for new favorite.

edit_button_click() Required Override

Opens name edit dialog for existing favorite.

delete_button_click() Required Override

Fires Ajax deletion routine.

Data Binding

Method Requirement Description
fill_details() Required Override

Enables/disables buttons based on selected preset vs custom search.

Data Handlers

Method Requirement Description
compile_data() Core Method

Parses global preset_search_settings to build grid payload.

deleted_success(data, row) Required Override

Removes deleted item from global preset_search_settings cache.

get_save_params() Required Override

Extracts new name and packages JSON payload.

save() Required Override

Fires Ajax POST to save favourite.

save_success(data, params) Required Override

Merges saved response back into global cache and refreshes grid.

hh_search_dialog

Type: Widget
Description: Constructs the standard field-based search form. Can run as a dialog popup or embed statically inside a panel on the home page.

Configuration Options

Option Default Description
make_dialog true Set to false to render inline as a div instead of a dialog.

Local Methods & Functions

Initialization

Method Requirement Description
_create() Requires _super()

Widget constructor.

_init_dependencies() Requires _super()

Dependencies hook.

_init_custom() Required Override

Customizations hook.

_init_finally() Requires _super()

Final initialization.

UI Builders

Method Requirement Description
_init_main() Required Override

Builds the entire HTML form (inputs, dates, depot selectors).

Actions

Method Requirement Description
resize() Requires _super()

Recalculates dialog position.

Events & Interactions

Method Requirement Description
open(params) Required Override

Resets the form and opens the dialog.

Data Handlers

Method Requirement Description
get_search_options() Required Override

Serializes all active form inputs into JSON payload.

base_select

Type: Widget
Description: Replaces standard HTML `<select>` elements with customized, advanced floating DIV dropdowns. Capable of rendering multi-select checkboxes or interactive hierarchical UI trees.

Configuration Options

Option Default Description
drop_width 0 Width of drop down. 0 matches select width.
selected null Pre-selected ID or array of IDs.
changed null Callback fired on selection change.
include_check_all true Include a master 'Select All' toggle.
include_none false Include 'None' option for strict single selects.
none_value "0" The payload value of the 'None' option.
data [] Array defining the tree node schema.
no_select_parent true If true, clicking a parent node expands it instead of selecting it.
multi_select true Add checkboxes for multi select capability.
is_tree true Render hierarchical node logic and indenting.
icons_closed "&#x25B6;&#x1F4C1;" HTML entities for closed parent icon.
icons_open "&#x25E2;&#x1F4C2;" HTML entities for open parent icon.
icons_no_children "" Icons for leaf nodes.
id_field "ID" Property name mapped from rowData as ID payload.
text_field "TEXT" Property name mapped from rowData as visible label.
class "hh_base_select" Root CSS class applied to wrapper.

Local Methods & Functions

Initialization

Method Requirement Description
_create() Requires _super()

Widget constructor. Disables native select.

_init_custom() Required Override

Customizations hook.

_init_finally() Requires _super()

Binds dialog open/close observers to hide dropdown.

UI Builders

Method Requirement Description
_init_main() Requires _super()

Builds CSS wrappers, overlays, and floating tree panels.

fill_dropdown() Core Method

Master routine that populates all rows and nodes.

add_check_all() Core Method

Injects sticky check-all header.

create_list_element() Core Method

Creates UL or DIV container for tree or list.

add_none() Core Method

Adds 'none' row for single select configurations.

add_rows(data, parent) Core Method

Recursive function that generates DOM nodes from JSON tree.

add_row_text(rowData, label) Core Method

Builds text/html span for a row.

Actions

Method Requirement Description
refresh() Required Override

Redraws and repopulates internal dropdown structures.

set_disabled(disable) Required Override

Programmatically toggles UI disabled states.

Events & Interactions

Method Requirement Description
show_dropdown() Required Override

Calculates collision fit against window boundaries and displays the floating tree panel.

setup_row_events() Core Method

Binds hover and click listeners to dynamically generated rows.

parent_open_close(div, force_open) Required Override

Expands or collapses a parent node (trees only).

scroll_into_view() Required Override

Scrolls selected node into visible boundary of dropdown.

Data Filtering

Method Requirement Description
exclude_row(rowData) Required Override

Hook evaluated during row creation to silently drop specific rows.

Data Binding

Method Requirement Description
set_values(values) Required Override

Programmatically checks UI boxes matching array of passed IDs.

set_value(val) Required Override

Alias for set_values.

value_changed(no_callback) Required Override

Synchronizes visual tree state back to hidden native `<select>` and fires callback.

multi_depots_combo

Type: Widget
Inherits: base_select
Description: A customized `base_select` dropdown configured specifically for selecting multiple depots across the HireHop system.

Configuration Options

Option Default Description
include_virtual true If true, includes virtual depots in the dropdown list hierarchy.
include_check_all true Include all check option.
no_select_parent false Allow selecting parent items.
multi_select true Enable multi select.
is_tree true Render as tree.
icons_closed "&#x25B6;" Icon for closed node.
icons_open "&#x25E2;" Icon for open node.
text_field "DEPOT" Specific property name mapped from rowData to print as label.
class "hh_depots_select" Applied wrapper class.

Inherited Options

From base_select (Inherits)

Option Default Description
drop_width 0 Width of drop down. 0 matches select width.
selected null Pre-selected ID or array of IDs.
changed null Callback fired on selection change.
include_check_all true Include a master 'Select All' toggle.
include_none false Include 'None' option for strict single selects.
none_value "0" The payload value of the 'None' option.
data [] Array defining the tree node schema.
no_select_parent true If true, clicking a parent node expands it instead of selecting it.
multi_select true Add checkboxes for multi select capability.
is_tree true Render hierarchical node logic and indenting.
icons_closed "&#x25B6;&#x1F4C1;" HTML entities for closed parent icon.
icons_open "&#x25E2;&#x1F4C2;" HTML entities for open parent icon.
icons_no_children "" Icons for leaf nodes.
id_field "ID" Property name mapped from rowData as ID payload.
text_field "TEXT" Property name mapped from rowData as visible label.
class "hh_base_select" Root CSS class applied to wrapper.

Local Methods & Functions

Initialization

Method Requirement Description
_init_main() Requires _super()

Overrides parent initializer to build data tree specifically by parsing the global `depots` JSON variable.

Inherited Methods

From base_select (Inherits)

Method Description
_create()

Widget constructor. Disables native select.

_init_main()

Builds CSS wrappers, overlays, and floating tree panels.

_init_custom()

Customizations hook.

_init_finally()

Binds dialog open/close observers to hide dropdown.

refresh()

Redraws and repopulates internal dropdown structures.

show_dropdown()

Calculates collision fit against window boundaries and displays the floating tree panel.

set_disabled(disable)

Programmatically toggles UI disabled states.

fill_dropdown()

Master routine that populates all rows and nodes.

add_check_all()

Injects sticky check-all header.

create_list_element()

Creates UL or DIV container for tree or list.

add_none()

Adds 'none' row for single select configurations.

add_rows(data, parent)

Recursive function that generates DOM nodes from JSON tree.

add_row_text(rowData, label)

Builds text/html span for a row.

exclude_row(rowData)

Hook evaluated during row creation to silently drop specific rows.

setup_row_events()

Binds hover and click listeners to dynamically generated rows.

parent_open_close(div, force_open)

Expands or collapses a parent node (trees only).

scroll_into_view()

Scrolls selected node into visible boundary of dropdown.

set_values(values)

Programmatically checks UI boxes matching array of passed IDs.

set_value(val)

Alias for set_values.

value_changed(no_callback)

Synchronizes visual tree state back to hidden native `<select>` and fires callback.

credit_period_edit

Type: Widget
Description: A dialog to configure ISO-compliant credit periods. Contains specialized translation and sanitisation functions utilized globally.

Configuration Options

Option Default Description
callback null Callback executed on save with formatted credit period structure.

Local Methods & Functions

Initialization

Method Requirement Description
_create() Requires _super()

Widget constructor.

_init_custom() Required Override

Customizations hook.

_init_finally() Requires _super()

Final initialization.

UI Builders

Method Requirement Description
_init_main() Requires _super()

Builds dialog components.

_init_dialog_contents() Required Override

Constructs complex radio and select configurations for credit periods.

Events & Interactions

Method Requirement Description
radio_clicked(value) Required Override

Toggles fieldsets disabled states based on active radio context.

open_edit_dlg() Required Override

Dialog opened handler. Sets help context.

close_edit_dlg() Required Override

Dialog closed handler.

change_handler(e) Required Override

Input change handler. Triggers translation string generation.

open(data) Required Override

Sanitises input payload, pre-fills form, and opens dialog.

save() Required Override

Validates form and triggers saved().

saved(params) Required Override

Fires callback and closes dialog.

Actions

Method Requirement Description
resize() Requires _super()

Resizes dialog elements.

Data Parsers

Method Requirement Description
sanitise_data(data) Core Method

Globally accessible method. Enforces ISO duration constraints on period data.

translate(data) Core Method

Globally accessible method. Translates credit period JSON into a localized human-readable sentence.

Data Handlers

Method Requirement Description
get_save_params() Required Override

Scrapes DOM elements and constructs ISO string payload.