### Action Component Structure for API Calls Source: https://context7_llms Defines the structure for an action component, outlining a sequence of steps. The example shows a 'SUBMIT' step targeting an API endpoint with specified method, URL, and path variable mappings. ```json { "type": "ACTION", "steps": [ { "type": "SUBMIT", "target": { "url": "{ENV.BASE_API_URI}/endpoint/{id}", "method": "GET|POST|PUT|DELETE", "pathVariablesMapping": [ { "source": "$context.item.id", "target": "id" } ] } } ] } ``` -------------------------------- ### Value Checking with HasValue and IsBlank Functions Source: https://context7_llms Provides examples of using `HasValue` to check if a field contains data and `IsBlank` to check if a field is empty or null. These are crucial for input validation and conditional logic. ```javascript HasValue(field) // Returns true if field has a value IsBlank(field) // Returns true if field is empty/null // Examples: HasValue($context.item.numerUmowy) IsBlank($context.item.dane.kontrahent) not HasValue($queryParams.id) ``` -------------------------------- ### API Endpoints: Custom Actions Source: https://context7_llms Provides examples of custom API endpoints for specific business actions beyond standard CRUD operations. These include operations like copying documents, reserving agreements, and retrieving agreement points. ```http POST /documents/{id}/copy - Copy document PUT /agreements/{id}/reserve - Reserve agreement PUT /agreements/{id}/revoke-reservation - Cancel reservation GET /agreements/{id}/points - Get agreement points ``` -------------------------------- ### API Endpoints: Standard CRUD Operations Source: https://context7_llms Lists standard RESTful API endpoints for CRUD (Create, Read, Update, Delete) operations on entities using OData. Includes example URLs for listing, retrieving by ID, creating, updating, and deleting resources. ```http GET /odata/EntityName - List all GET /odata/EntityName({id}) - Get by ID POST /odata/EntityName - Create PUT /odata/EntityName({id}) - Update DELETE /odata/EntityName({id}) - Delete ``` -------------------------------- ### Common Pattern: Conditional Visibility Source: https://context7_llms Shows a pattern for controlling the visibility of UI elements based on conditions. This example uses a 'condition' object with a 'visibility' property that checks if global data exists and the current item ID is not blank. ```json "condition": { "visibility": "HasValue($global.daneUmowy) and not IsBlank($context.item.id)" } ``` -------------------------------- ### Common Pattern: Date Range Display Source: https://context7_llms A pattern for displaying a date range, combining start and end dates. It uses `Concat` and `FormatDate` to present the dates in a human-readable 'YYYY-MM-DD' format. ```javascript Concat('Od: ', FormatDate($context.item.dataOd, 'YYYY-MM-DD'), ' Do: ', FormatDate($context.item.dataDo, 'YYYY-MM-DD')) ``` -------------------------------- ### JavaScript Date Range Validation Source: https://context7_llms Checks if the start date precedes the end date. Returns an error message if the start date is after the end date. Assumes date comparison is supported. ```javascript If($context.item.startDate > $context.item.endDate, 'Start date must be before end date', '') ``` -------------------------------- ### Conditional Logic with If Function Source: https://context7_llms Demonstrates conditional logic using the `If` function, which evaluates a condition and returns a value based on whether the condition is true or false. Supports nested conditions for complex logic. ```javascript If(condition, trueValue, falseValue) // Examples: If($context.item.typUmowy='D','Dochodowa','Inna') If(IsBlank($context.item.pole), 'Pole wymagane', '') // Nested conditions If($context.item.typUmowy='D','Dochodowa', If($context.item.typUmowy='W','Wydatkowa', If($context.item.typUmowy='G','Grantowa','Inny typ'))) ``` -------------------------------- ### String Concatenation with Concat Function Source: https://context7_llms Explains how to concatenate multiple strings using the `Concat` function. This is useful for building dynamic strings from various data sources. ```javascript Concat(string1, string2, ...) // Examples: Concat($context.item.imie1,' ',$context.item.nazwisko1) Concat('Status: ',$context.item.workflowStatus) ``` -------------------------------- ### CSS Responsive Grid Layout Source: https://context7_llms Defines a responsive grid layout using CSS. Columns automatically adjust based on available space, with a minimum width of 380px and a gap of 10px between items. ```css "styles": [ "display: grid", "grid-template-columns: repeat(auto-fit, minmax(380px, 1fr))", "grid-gap: 10px" ] ``` -------------------------------- ### Type Conversion with ToString Function Source: https://context7_llms Demonstrates converting various data types to strings using the `ToString` function. This is useful when data needs to be manipulated as strings, such as in concatenations. ```javascript ToString(value) // Example: ToString($context.item.kwotaBrutto) ``` -------------------------------- ### Custom Actions Source: https://context7_llms Details custom API endpoints for specific business actions like copying documents or managing agreement reservations. ```APIDOC ## Custom Actions ### Description Enables specific business logic execution through custom API endpoints. ### Method POST, PUT, GET ### Endpoint - `/documents/{id}/copy` - `/agreements/{id}/reserve` - `/agreements/{id}/revoke-reservation` - `/agreements/{id}/points` ### Parameters #### Path Parameters - **id** (string) - Required - The identifier for the document or agreement. #### Query Parameters None #### Request Body Depends on the specific action; may be empty or contain relevant data. ### Request Example `POST /documents/doc123/copy` `PUT /agreements/agr456/reserve` `GET /agreements/agr456/points` ### Response #### Success Response (200) - **body** (object) - Varies based on the action performed. #### Response Example `{ "message": "Document copied successfully" }` or `{ "points": [...] }` ``` -------------------------------- ### JavaScript Iterable List Data Binding Source: https://context7_llms Sets up an iterable component to display a list of items. It binds to an array field within the current context item and includes a placeholder for defining the template for each item. ```javascript { "type": "ITERABLE", "datasource": "$context.item.arrayField", "itemTemplate": [ // Template for each item ] } ``` -------------------------------- ### Common Pattern: Display Full Name Source: https://context7_llms A common pattern for displaying a full name by concatenating first name and last name fields with a space in between. It assumes fields like `imie1` and `nazwisko1` exist within the current context item. ```javascript Concat($context.item.kontrahent.imie1,' ',$context.item.kontrahent.nazwisko1) ``` -------------------------------- ### Formatting Currency with ToCurrency Function Source: https://context7_llms Illustrates currency formatting using the `ToCurrency` function, which converts a numeric amount into a string representation with default formatting (e.g., "1,234.56"). It can be combined with `Concat` for adding currency symbols. ```javascript ToCurrency(amount) // Examples: ToCurrency($context.item.kwotaBrutto) // Returns: "1,234.56" Concat(ToCurrency($context.item.kwota),' zł') // Returns: "1,234.56 zł" ``` -------------------------------- ### Common Pattern: Display Formatted Currency Source: https://context7_llms A common pattern to display currency values with a currency symbol appended. It uses `ToCurrency` for formatting and `Concat` to add ' zł'. ```javascript Concat(ToCurrency($context.item.kwotaCalkowita),' zł') ``` -------------------------------- ### JavaScript Nested Conditional Logic Source: https://context7_llms Illustrates how to implement nested conditional logic using the `If()` function. This allows for multiple conditions to be evaluated sequentially, providing a default value if none of the conditions are met. ```javascript If(condition1, value1, If(condition2, value2, 'Default value')) // Always provide default ``` -------------------------------- ### Formatting Dates with FormatDate Function Source: https://context7_llms Shows how to format date values using the `FormatDate` function, which accepts a date value and a format string. Supported formats include 'YYYY-MM-DD', 'DD.MM.YYYY', and 'YYYY'. ```javascript FormatDate(dateValue, format) // Examples: FormatDate($context.item.dataZawarciaUmowy, 'YYYY-MM-DD') FormatDate($context.item.createdDate, 'DD.MM.YYYY') FormatDate($context.item.timestamp, 'YYYY') ``` -------------------------------- ### JavaScript Select/Dropdown Data Binding Source: https://context7_llms Configures a select component to use a data source. It maps the 'name' property of each option for display and uses 'id' as the unique value key. Data is sourced from a global context. ```javascript { "type": "SELECT", "datasource": { "type": "context", "dataPath": "availableOptions", "isGlobal": true }, "labelMapper": "$option.name", "valueUniqueKey": "id" } ``` -------------------------------- ### Common Pattern: Status Mapping Source: https://context7_llms Illustrates a common pattern for mapping internal status codes to user-friendly display strings using nested `If` conditions. This pattern translates workflow statuses into readable labels. ```javascript If($context.item.workflowStatus='Robocza','Draft', If($context.item.workflowStatus='Zaakceptowano','Approved','Other')) ``` -------------------------------- ### Form Definition Structure Source: https://context7_llms Defines the structure for a form component, specifying its type, fields, context for data binding, and validation rules. It includes properties like `key`, `context`, `required`, and `validators`. ```json { "type": "FORM", "fields": [ { "key": "fieldName", "context": { "isGlobal": true, "contextVariableName": "variableName" }, "required": false, "validators": [] } ] } ``` -------------------------------- ### Standard CRUD Operations Source: https://context7_llms Defines the standard OData endpoints for performing Create, Read, Update, and Delete operations on entities. ```APIDOC ## Standard CRUD Operations ### Description Provides endpoints for common data manipulation tasks using OData conventions. ### Method GET, POST, PUT, DELETE ### Endpoint `/odata/EntityName` or `/odata/EntityName({id})` ### Parameters #### Path Parameters - **id** (string) - Optional - The unique identifier of the entity. #### Query Parameters None #### Request Body None for GET, object representing the entity for POST/PUT. ### Request Example `GET /odata/EntityName` `GET /odata/EntityName(123)` `POST /odata/EntityName { "fieldName": "value" }` `PUT /odata/EntityName(123) { "fieldName": "newValue" }` `DELETE /odata/EntityName(123)` ### Response #### Success Response (200) - **body** (object) - A list of entities for GET, or the created/updated entity for POST/PUT. Returns empty for DELETE. #### Response Example `[ { "id": 1, "fieldName": "value" } ]` ``` -------------------------------- ### Accessing Context Variables in JavaScript Source: https://context7_llms Demonstrates how to access context variables in JavaScript, including current item properties, nested properties, global data, and query parameters. This is fundamental for data retrieval within the application. ```javascript // Access current item property $context.item.propertyName // Access nested properties $context.item.dane.kontrahent.nazwisko1 // Access global data $global.daneUmowy.numer // Access query parameters $queryParams.id ``` -------------------------------- ### OData Data View Component Structure Source: https://context7_llms Defines the structure for an OData data view component, specifying its type, the OData model to use, the API endpoint URL, display modes (table, list), and a context variable to hold the data. ```json { "type": "ODATA_VIEW", "model": "EntityName", "url": "{ENV.BASE_API_URI}/odata", "modes": ["table", "list"], "context": { "contextVariableName": "dataView" } } ``` -------------------------------- ### JavaScript Safe Field Access with HasValue Source: https://context7_llms Demonstrates the best practice of checking for the existence of a field before accessing its nested properties. Uses `HasValue()` to prevent errors when a field might be undefined. ```javascript If(HasValue($context.item.dane), $context.item.dane.pole, '') ``` -------------------------------- ### JavaScript Conditional Styling Source: https://context7_llms Applies background colors based on the status of an item. Sets a light green background for 'Active' status and a light gray for others. This is useful for visual indicators. ```javascript "styles": [ If($context.item.status='Active', 'background-color: #DBF1CE', 'background-color: #F0F0F0') ] ``` -------------------------------- ### Array Filtering with ArrayFilter Function Source: https://context7_llms Shows how to filter arrays using the `ArrayFilter` function, which takes an array and a condition to return a new array containing only elements that satisfy the condition. The `$item` variable refers to the current element during iteration. ```javascript ArrayFilter(array, condition) // Example: ArrayFilter($context.item.kontrahenci,$item.kontrahentCzyGlowny) ``` -------------------------------- ### Validation Pattern: Required Field Source: https://context7_llms A validation pattern to check if a field is required. It uses the `IsBlank` function to determine if the field has a value, returning an error message if it's empty. ```javascript If(IsBlank($context.item.requiredField), 'This field is required', '') ``` -------------------------------- ### JavaScript Email Format Validation Source: https://context7_llms Validates if an email address contains the '@' symbol. Returns an error message if the format is invalid. This is a basic client-side check. ```javascript If(not Contains($context.item.email, '@'), 'Invalid email format', '') ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.