Application from website
ViewController
For a consultant to work, you need to register a ViewController with the name consultant.
Important: ViewController is registered once for all the online consultant forms.
CreateWidget
To create the application widget, you need to call the method CallGear.UI.createWidget() with the following parameters:
widgetName= 'consultant_offline_message'
Example
CallGear.UI.registerViewController('consultant', function (settings, tpls) {
...
var consultantOfflineMessage = CallGear.UI.createWidget('consultant_offline_message', {
settings: settings,
template: tpls['consultant_offline_message'],
...
});
...
consultantOfflineMessage.render();
});
Methods
sendRequest(data)
The method allows you to send requests with the specified fields.
The data object may contain the following fields:
name- visitor name.email- visitor e-mail.phone- visitor phone number.message- application text.group_id- ID of an employee group to which this application should be distributed. The field must be filled in if the option "Distribution of applications by employee groups" is activated in the application settings.
Events
sendofflinerequest
The event occurs after the application is sent. It allows you to find out whether the sending was successful.
sendofflinerequest event properties: Object containing the following fields:
- success -
trueif the application was sent,falseif an error occurred. - info - an object containing text fields
titleandmessageto display the message to a website visitor.