Skip to content

Tracker

A tracker that would create a dispatch using the provided tracker. This widget will not render anything, it just wrapper for dispatch creation. Its children should be tracker-metric. This widget will tracks changes made by its children tracker metric and will create a dispatch when user pressed submit button.

Name Description
component tracker
options see options below
child required, a widget to be rendered that would collect the tracker metrics
styles any styles
styles.text apply the specified text styles to children (if children doesn't have a styles defined)

Options

Parameters in the options are evaluated so feel free to use expression

Name Description
tracker required, tracker that contains metrics definitions
dispatchId optional, if passed and dispatch exists, it will be used as context dispatch and the dispatch will be opened in edit mode
date optional, date of the dispatch, this will be used as when date of dispatch, if not provided, default to today
showActionButton optional boolean, true will show end drawer (dispatch actions, top right vertical ellipsess), default to true
showDate optional boolean, if false will hide date (default to true)
showBottomNavigator optional boolean, show attachment button (default to true)
accountId optional string, account id as the author of this dispatch
pageStore boolean; merge page data into the data map
form inline, dialog; display the dialog or display the form inline

Example

{
  "ux": {
    "component": "tracker",
    "options": {
      "tracker": "meal-entry",
      "dispatchId": "{data.dispatchId}",
      "date": "{data.date}"
    },
    "styles": {
      "root": {
        "padding": "10px 20px"
      }
    },
    "child": {
      "component": "grid",
      "children": [
          {
              "component": "tracker-metric",
              "options": {
                  "tracker": "meal-entry",
                  "metric": "breakfast"
              }
          },
          {
            "component": "accordion",
            "condition": {
              "rule": "values.breakfast exists"
            }
            "children": [
              {
                "component": "grid",
                "direction": "row",
                "children": [
                  {
                    "component": "tracker-metric",
                    "options": {
                      "tracker": "meal-entry",
                      "metric": "stapleRice"
                    }
                  },
                  {
                    "component": "text",
                    "text": "stuff"
                  },
                  {
                    "component": "tracker-metric",
                    "options": {
                      "tracker": "meal-entry",
                      "metric": "stapleRiceAmount"
                    }
                  }
                ]
              }
            ]
          }
      ]
    }
  }
}