Back

AI Formula Generation & Testing for Salary Component

This side panel allows you to review the prompt text, the generated function, and test its results on real employee data before applying and saving the salary component.

Conditions to Open the Side Panel

The side panel opens only when all the following conditions are met:

  • salary component type is selected (Earnings or Deductions).
  • An employee is selected, or the default employee is used.
  • A time period is selected, or default values are used.
  • A prompt text is written or selected.
  • The user clicks Generate & Test.

Important:
An AIC balance must be available. If the balance is zero, the following message appears:

.Insufficient AIC balance to complete the operation. The process will be blocked.

Side Panel Sections

1. Prompt Section

Displays the entered prompt in read-only mode.

Available actions:

  • Edit AI Prompt
    When clicked:
    • The prompt becomes editable
    • A warning appears: Editing the prompt will consume AIC credits
    • Two buttons appear: Save Changes / Cancel

On Save Changes:

  • The system regenerates the function based on the updated prompt
  • A loading indicator is shown
  • AIC credits are deducted

On Cancel:

  • The prompt returns to read-only mode
  • No AIC is consumed
  • Predefined Examples
    A dropdown list of sample prompts that can be inserted directly into the input field.

2. Generated Function (Result Section)

After processing is complete, the panel displays:

  • Input data in JSON format
  • Generated function code in a scrollable field
  • Function status:
    • Valid: Result is calculated and variables are shown, and Apply Salary Component button is enabled
    • Invalid: No result is calculated, and Apply Salary Component button is disabled

Note:
AIC credits are deducted once results are displayed. The balance may become negative and will still be recorded in the activity log.

3. Simulation Section (Salary Preview)

The left side of the panel shows a simulated Salary sheet based on:

  • Selected employee
  • Selected time period
  • AI-generated result (if valid)

It always includes:

  • Mandatory contract items (e.g., basic salary)
  • The current Salary Component

Available actions:

  • Change employee or time period → automatically reloads the simulation
  • Refresh → recalculates simulation only (no AIC consumption, no regeneration)

If the function is invalid, the Salary Component will not appear in the preview.

4. Apply Salary Component

A Apply Salary Component button is located at the bottom of the panel.

  • Enabled only when the function is valid
  • On click:
    • The Salary Component is saved
    • The side panel is closed

Side Panel Close Behavior

When clicking the X button, one of two states may appear:

1. AI is still processing

The AI is still processing your request. Creating the Salary Component is in progress. Closing now may interrupt the process and consume AIC credits unnecessarily. It is recommended to wait until completion.

2. Generation completed but not saved

Salary Component not saved. The Salary Component has been generated using AI but has not been saved yet. The result will be temporarily retained as long as the prompt is not changed. Modifying the prompt will consume additional AIC credits.