processmaker-builder
Version:
The gulp task runner for ProcessMaker building
1,185 lines (1,170 loc) • 87.7 kB
JavaScript
if (typeof(consolidated) == 'undefined') {
consolidated = '0';
}
PMDesigner.activityProperties = function (activity) {
switch (activity.getActivityType()) {
case "SUB_PROCESS":
PMDesigner.propertiesSubProcess(activity);
break;
case "TASK":
if (activity.getTaskType() === "SCRIPTTASK") {
PMDesigner.scriptTaskProperties(activity);
} else {
PMDesigner.taskProperties(activity);
}
break;
}
};
PMDesigner.taskProperties = function (activity) {
var formDefinitions,
featuresForms = [],
propertiesTabs,
formCaseLabels,
dataProperties,
formTimingControl,
configurationForms,
customGrid,
formNotifications,
buttonFieldCancel,
buttonFieldAdd,
abeForm,
MobilePanel,
enableTaskMobile,
routeCaseMobile,
abeMainPanel,
abeAddOption,
abeTemplates,
abeDynaforms,
abeEmailAcount,
abeFields,
warningChanges,
windowProperties,
processDataProperties,
i,
editRow = null,
arrayTrue = '["TRUE"]',
arrayFalse = '["FALSE"]',
stringTrue = "TRUE",
stringFalse = "FALSE";
configurationForms = [
{
id: 'windowPropertiesTabPanelDefinitions',
icon: '',
title: 'Definitions'.translate(),
panel: formDefinitions = new PMUI.form.Form({
id: 'formDefinitions',
visibleHeader: false,
width: DEFAULT_WINDOW_WIDTH - 250,
items: [{
id: 'formDefinitionsUID',
pmType: 'text',
name: 'UID',
valueType: 'string',
label: 'UID'.translate(),
controlsWidth: 300
}, {
id: 'formDefinitionsTitle',
pmType: 'text',
name: 'tas_title',
valueType: 'string',
label: 'Title'.translate(),
placeholder: 'Insert a title'.translate(),
required: true,
controlsWidth: 300
}, {
id: 'formDefinitionsDescription',
pmType: 'textarea',
name: 'tas_description',
valueType: 'string',
label: 'Description'.translate(),
placeholder: 'Insert a description'.translate(),
rows: 100,
controlsWidth: 300,
style: {cssClasses: ['mafe-textarea-resize']}
}, new CriteriaField({
id: 'formDefinitionsVariable',
pmType: 'text',
name: 'tas_priority_variable',
valueType: 'string',
label: 'Variable for Case priority'.translate(),
controlsWidth: 300
}), {
id: 'formDefinitionsRouting',
pmType: 'dropdown',
name: 'tas_derivation_screen_tpl',
valueType: 'string',
label: 'Routing Screen Template'.translate(),
controlsWidth: 150,
style: {
cssProperties: {
float: "left"
}
}
}
]
})
},
{
id: 'windowPropertiesTabPanelCaseLabels',
icon: '',
title: 'Case Labels'.translate(),
panel: formCaseLabels = new PMUI.form.Form({
id: 'formCaseLabels',
visibleHeader: false,
width: DEFAULT_WINDOW_WIDTH - 250,
items: [new CriteriaField({
id: 'formCaseLabelsTitle',
pmType: 'text',
name: 'tas_def_title',
valueType: 'string',
label: 'Title'.translate(),
placeholder: 'Insert a title'.translate(),
controlsWidth: DEFAULT_WINDOW_WIDTH - 527
}), new CriteriaField({
id: 'formCaseLabelsDescription',
pmType: 'textarea',
name: 'tas_def_description',
valueType: 'string',
label: 'Description'.translate(),
placeholder: 'Insert a description'.translate(),
rows: 100,
controlsWidth: DEFAULT_WINDOW_WIDTH - 527,
renderType: 'textarea'
})
]
})
},
{
id: 'windowPropertiesTabPanelTimingControl',
icon: '',
title: 'Timing Control'.translate(),
panel: formTimingControl = new PMUI.form.Form({
id: 'formTimingControl',
visibleHeader: false,
width: DEFAULT_WINDOW_WIDTH - 250,
items: [{
id: 'formTimingControlFly',
pmType: 'checkbox',
name: 'tas_transfer_fly',
labelVisible: false,
options: [
{
id: 'formTimingControlOption',
label: 'Allow users to change the task duration in runtime'.translate(),
value: '1'
}
],
onChange: function (val) {
changeTimingControl(this.controls[0].selected);
}
}, {
id: 'formTimingMainPanel',
pmType: 'panel',
items: [
{
id: 'formTimingControlTask',
pmType: 'text',
name: 'tas_duration',
valueType: 'string',
label: 'Task duration'.translate(),
required: true,
maxLength: 3,
controlsWidth: 200,
validators: [
{
pmType: "regexp",
criteria: /^\d*$/,
errorMessage: "Please enter a positive integer value".translate()
}
]
},
{
id: 'formTimingControlAverage',
pmType: 'text',
name: 'tas_average',
valueType: 'string',
label: 'Average'.translate(),
maxLength: 3,
readOnly: true,
controlsWidth: 200
},
{
id: 'formTimingControlSdv',
pmType: 'text',
name: 'tas_sdv',
valueType: 'string',
label: 'SDV'.translate(),
maxLength: 3,
readOnly: true,
controlsWidth: 200
},
{
id: 'formTimingControlTime',
pmType: 'dropdown',
name: 'tas_timeunit',
label: 'Time unit'.translate(),
controlsWidth: 100,
options: [{
id: 'formTimingControlTime1',
label: 'Hours'.translate(),
value: 'HOURS'
}, {
id: 'formTimingControlTime2',
label: 'Days'.translate(),
value: 'DAYS'
}, {
id: 'formTimingControlTime3',
label: 'Minutes'.translate(),
value: 'MINUTES'
}
]
}, {
id: 'formTimingControlCount',
pmType: 'dropdown',
name: 'tas_type_day',
label: 'Count days by'.translate(),
controlsWidth: 150,
options: [{
id: 'formTimingControlCount1',
label: 'Work Days'.translate(),
value: 1
}, {
id: 'formTimingControlCount2',
label: 'Calendar Days'.translate(),
value: 2
}
]
}, {
id: 'formTimingControlCalendar',
pmType: 'dropdown',
name: 'tas_calendar',
label: 'Calendar'.translate(),
options: [],
controlsWidth: 150
}
]
}
]
})
},
{
id: 'windowPropertiesTabPanelNotifications',
icon: '',
title: 'Notifications'.translate(),
panel: formNotifications = new PMUI.form.Form({
id: 'formNotifications',
visibleHeader: false,
width: DEFAULT_WINDOW_WIDTH - 250,
items: [
{
id: 'formNotificationsTasSend',
pmType: 'checkbox',
name: 'tas_send_last_email',
labelVisible: false,
options: [{
id: 'formNotificationsTasSend1',
label: 'After routing notify the next assigned user(s)'.translate(),
value: '1'
}
],
onChange: function (val) {
changeFormNotifications(this.controls[0].selected, 'text');
}
}, {
id: 'formNotificationsMainPanel',
pmType: 'panel',
items: [
{
id: 'tas_email_server_uid',
name: 'tas_email_server_uid',
pmType: 'dropdown',
label: 'Email account'.translate(),
controlsWidth: 300,
labelWidth: "27%",
options: [
{
label: 'Default email account'.translate(),
value: ''
}
]
},
{
id: 'tas_not_email_from_format',
name: 'tas_not_email_from_format',
pmType: 'dropdown',
label: 'Email From Format'.translate(),
controlsWidth: 300,
labelWidth: "27%",
options: [
{
id: 'assignedUser',
label: 'Assigned User'.translate(),
value: 0
}, {
id: 'emailAccountSettings',
label: 'Email Account Settings'.translate(),
value: 1
}
]
},
new CriteriaField({
id: 'formNotificationsSubject',
pmType: 'text',
name: 'tas_def_subject_message',
valueType: 'string',
label: 'Subject'.translate(),
placeholder: 'Insert a title'.translate(),
required: true,
controlsWidth: 300,
labelWidth: "27%"
}), {
id: 'formNotificationsContent',
pmType: 'dropdown',
name: 'tas_def_message_type',
label: 'Content Type'.translate(),
controlsWidth: 150,
labelWidth: "27%",
options: [{
id: 'formNotificationsContent1',
value: 'text',
label: 'Plain Text'.translate()
}, {
id: 'formNotificationsContent2',
value: 'template',
label: 'Html Template'.translate()
}
],
onChange: function (value) {
visibleContentType(value);
}
}, new CriteriaField({
id: 'formNotificationsMessage',
pmType: 'textarea',
name: 'tas_def_message',
valueType: 'string',
label: 'Message'.translate(),
placeholder: 'Insert a message'.translate(),
rows: 100,
width: 10,
required: true,
controlsWidth: 300,
renderType: 'textarea',
labelWidth: "27%"
}), {
id: 'formNotificationsTemplate',
pmType: 'dropdown',
name: 'tas_def_message_template',
label: 'Template'.translate(),
options: [{
value: '',
label: ''
}],
labelWidth: "27%"
}
]
},
{
id: 'formNotificationsTasReceive',
pmType: 'checkbox',
name: 'tas_receive_last_email',
labelVisible: false,
options: [{
id: 'formNotificationsTasReceive',
label: 'Notify the assigned user to this task'.translate(),
value: '1'
}
],
onChange: function (val) {
changeFormNotificationsReceive(this.controls[0].selected, 'text');
}
},
{
id: 'formNotificationsReceivePanel',
pmType: 'panel',
items: [
{
id: 'tas_receive_server_uid',
name: 'tas_receive_server_uid',
pmType: 'dropdown',
label: 'Email account'.translate(),
controlsWidth: 300,
labelWidth: "27%",
options: [
{
label: 'Default email account'.translate(),
value: ''
}
]
},
{
id: 'tas_receive_email_from_format',
name: 'tas_receive_email_from_format',
pmType: 'dropdown',
label: 'Email From Format'.translate(),
controlsWidth: 300,
labelWidth: "27%",
options: [
{
id: 'assignedUser',
label: 'Assigned User'.translate(),
value: 0
}, {
id: 'emailAccountSettings',
label: 'Email Account Settings'.translate(),
value: 1
}
]
},
new CriteriaField({
id: 'tas_receive_subject_message',
pmType: 'text',
name: 'tas_receive_subject_message',
valueType: 'string',
label: 'Subject'.translate(),
placeholder: 'Insert a title'.translate(),
required: true,
controlsWidth: 300,
labelWidth: "27%"
}),
{
id: 'tas_receive_message_type',
pmType: 'dropdown',
name: 'tas_receive_message_type',
label: 'Content Type'.translate(),
controlsWidth: 150,
labelWidth: "27%",
options: [{
id: 'formNotificationsReceive1',
value: 'text',
label: 'Plain Text'.translate()
}, {
id: 'formNotificationsReceive2',
value: 'template',
label: 'Html Template'.translate()
}
],
onChange: function (value) {
visibleContentTypeReceive(value);
}
},
new CriteriaField({
id: 'tas_receive_message',
pmType: 'textarea',
name: 'tas_receive_message',
valueType: 'string',
label: 'Message'.translate(),
placeholder: 'Insert a message'.translate(),
rows: 100,
width: 10,
required: true,
controlsWidth: 300,
renderType: 'textarea',
labelWidth: "27%"
}),
{
id: 'tas_receive_message_template',
pmType: 'dropdown',
name: 'tas_receive_message_template',
label: 'Template'.translate(),
options: [{
value: '',
label: ''
}],
labelWidth: "27%"
}
]
}
]
})
}
];
if (consolidated == '1') {
configurationForms.push({
id: 'windowPropertiesTabPanelConsolidated',
icon: '',
title: 'Consolidated Case '.translate(),
panel: formConsolidated = new PMUI.form.Form({
id: 'formConsolidated',
visibleHeader: false,
width: DEFAULT_WINDOW_WIDTH - 250,
items: [
{
id: 'formConsolidatedEnable',
pmType: 'checkbox',
name: 'consolidated_enable',
labelVisible: false,
options: [{
label: 'Enable consolidate for this task.'.translate(),
value: '1'
}
],
onChange: function (val) {
changeConsolidated(this.controls[0].selected);
}
}, {
id: 'formConsolidatedMainPanel',
pmType: 'panel',
items: [
{
id: 'formConsolidatedReportTable',
pmType: 'text',
name: 'consolidated_report_table',
visible: false,
valueType: 'string',
controlsWidth: 300
}, {
id: 'formConsolidatedDynaform',
pmType: 'dropdown',
name: 'consolidated_dynaform',
label: 'Dynaform Template'.translate(),
options: [],
required: true,
controlsWidth: 300
}, {
id: 'formConsolidatedTable',
pmType: 'text',
name: 'consolidated_table',
valueType: 'string',
label: 'Table Name'.translate(),
placeholder: 'Insert a table name'.translate(),
required: true,
controlsWidth: 300,
style: {
cssProperties: {
float: "left"
}
},
validators: [{
pmType: "regexp",
criteria: /^[a-zA-Z0-9_]+$/,
errorMessage: "The table name can not contain spaces".translate()
}]
}, {
id: 'formConsolidatedTitle',
pmType: 'text',
name: 'consolidated_title',
valueType: 'string',
label: 'Title'.translate(),
placeholder: 'Insert a title'.translate(),
required: true,
controlsWidth: 300,
style: {
cssProperties: {
float: "left"
}
}
}
]
}
]
})
});
}
/*----------------------------------********---------------------------------*/
/**features-begins**/
customGrid = new PMUI.grid.GridPanel({
id: 'customGrid',
pageSize: 10,
width: DEFAULT_WINDOW_WIDTH - 400,
style: {
cssClasses: ['mafe-gridPanel'],
cssProperties: {
'margin-left': '0px',
'padding-top': '5px'
}
},
emptyMessage: 'No records found'.translate(),
nextLabel: 'Next'.translate(),
previousLabel: 'Previous'.translate(),
behavior: 'dragdropsort',
filterable: false,
customStatusBar: function (currentPage, pageSize, numberItems, criteria, filter) {
return '';
},
columns: [{
id: 'abe_custom_value',
title: 'Value'.translate(),
dataType: 'string',
columnData: 'abe_custom_value',
alignmentCell: 'left',
width: 95,
sortable: true
}, {
id: 'abe_custom_label',
title: 'Label'.translate(),
dataType: 'string',
alignmentCell: 'left',
columnData: 'abe_custom_label',
width: 135,
sortable: true
}, {
id: 'abe_custom_format',
title: 'Format (CSS)'.translate(),
dataType: 'string',
alignmentCell: 'left',
columnData: 'abe_custom_format',
width: 320,
sortable: true
}, {
id: 'varEdit',
dataType: 'button',
title: '',
buttonLabel: 'Edit'.translate(),
width: '68px',
buttonStyle: {
cssClasses: [
'mafe-button-edit'
]
},
onButtonClick: function (row, grid) {
customGridRowEdit(row);
}
}, {
id: 'varDelete',
dataType: 'button',
title: '',
buttonLabel: function (row, data) {
return 'Delete'.translate();
},
width: '68px',
buttonStyle: {
cssClasses: [
'mafe-button-delete'
]
},
onButtonClick: function (row, grid) {
customGrid.removeItem(row);
}
}
],
dataItems: null
});
abeFields = {
'type': {
name: "ABE_TYPE",
id: "ABE_TYPE",
label: "Type",
pmType: "dropdown",
options: [
{
"label": "- None -".translate(),
"value": "",
"type": "default"
},
{
"label": "Link to fill a form".translate(),
"value": "LINK"
},
{
"label": "Use a field to generate actions links".translate(),
"value": "FIELD"
},
{
"label": "Custom actions".translate(),
"value": "CUSTOM"
}
],
onChange: function (val) {
var addOptionForm, buttonAdd, buttonAddControl, buttonCancel, buttonCancelControl;
abeFields.type.value = val;
$(abeFields.email.getHTML()).find('.pmui-field-message span').css('display', 'none');
$(abeFields.action.getHTML()).find('.pmui-field-message span').css('display', 'none');
$customGrid = $("#customGrid");
if (abeAddOption && abeAddOption.getHTML()) {
addOptionForm = $(abeAddOption.getHTML());
addOptionForm.hide();
}
switch (val) {
case '' :
abeForm.setItems([abeFields.type]);
break;
case 'LINK' :
$customGrid.hide().appendTo($("#windowProperties").find(".pmui-window-body:eq(0)"));
abeForm.setItems([abeFields.type, abeFields.template, abeFields.dynaform, abeFields.subject, abeFields.email, abeFields.emailAccount, abeFields.emailFrom, abeFields.note, abeFields.forceLogin]);
abeForm.getField('ABE_CASE_NOTE_IN_RESPONSE').setValue(abeFields.note.value);
abeForm.getField("ABE_FORCE_LOGIN").setValue(abeFields.forceLogin.value);
break;
case 'FIELD' :
$customGrid.hide().appendTo($("#windowProperties").find(".pmui-window-body:eq(0)"));
abeForm.setItems([abeFields.type, abeFields.template, abeFields.dynaform, abeFields.subject, abeFields.email, abeFields.action, abeFields.emailAccount, abeFields.emailFrom, abeFields.note, abeFields.forceLogin]);
abeForm.getField('ABE_CASE_NOTE_IN_RESPONSE').setValue(abeFields.note.value);
abeForm.getField("ABE_FORCE_LOGIN").setValue(abeFields.forceLogin.value);
abeFields.action.setLabel('Variable sent in email'.translate());
abeFields.action.setPlaceholder('Insert a variable with options'.translate());
break;
case 'CUSTOM' :
abeForm.setItems([abeFields.type, abeFields.emailAccount, abeFields.emailFrom, abeFields.email, abeFields.subject, abeFields.template, abeFields.action, abeFields.note, abeFields.forceLogin]);
abeForm.getField("ABE_CASE_NOTE_IN_RESPONSE").setValue(abeFields.note.value);
abeForm.getField("ABE_FORCE_LOGIN").setValue(abeFields.forceLogin.value);
if (!abeAddOption) {
abeMainPanel.addItem(abeAddOption = new PMUI.form.Form(abeFields.customGrid));
} else {
addOptionForm.show();
}
buttonAdd = abeAddOption.getField("buttonFieldAdd");
buttonAddControl = buttonAdd.getControl();
buttonAddControl.button.setButtonType("success");
buttonCancel = abeAddOption.getField("buttonFieldCancel");
buttonCancelControl = buttonCancel.getControl();
buttonCancelControl.button.setButtonType("error");
abeFields.action.setLabel('Store Result In'.translate());
abeFields.action.setPlaceholder('Store result in variable @@myResult'.translate());
customDOM();
break;
}
}
},
'template': abeTemplates = {
name: "ABE_TEMPLATE",
label: 'Email template'.translate(),
pmType: "dropdown",
controlsWidth: 300,
required: true,
options: [
{
"value": "",
"label": "- Select a Template -".translate(),
"type": "default"
}
],
onChange: function (val) {
}
},
'dynaform': abeDynaforms = {
name: "DYN_UID",
label: 'Dynaform'.translate(),
pmType: "dropdown",
controlsWidth: 300,
options: [
{
"value": "",
"label": "- Select a Dynaform -".translate(),
"type": "default"
}
],
onChange: function (val) {
}
},
'subject': new CriteriaField({
id: 'ABE_SUBJECT_FIELD',
pmType: 'text',
name: 'ABE_SUBJECT_FIELD',
valueType: 'string',
label: 'Subject by email'.translate(),
placeholder: 'Insert a subject variable'.translate(),
required: false,
controlsWidth: 250
}),
'email': new CriteriaField({
id: 'ABE_EMAIL_FIELD',
pmType: 'text',
name: 'ABE_EMAIL_FIELD',
valueType: 'string',
label: 'Email variable'.translate(),
placeholder: 'Insert an email variable'.translate(),
helper: "It leaving this field in blank, the next user's email will be used.".translate(),
controlsWidth: 250
}),
'action': new CriteriaField({
id: 'ABE_ACTION_FIELD',
pmType: 'text',
name: 'ABE_ACTION_FIELD',
valueType: 'string',
label: 'Variable sent in email'.translate(),
placeholder: 'Insert a variable with options'.translate(),
required: true,
controlsWidth: 250
}),
'emailAccount': abeEmailAcount = {
id: 'ABE_EMAIL_SERVER_UID',
pmType: 'dropdown',
name: 'ABE_EMAIL_SERVER_UID',
label: 'Email account'.translate(),
controlsWidth: 300,
options: [
{
id: 'defEmailAccount',
label: 'Default email account'.translate(),
value: ''
}
]
},
'emailFrom': {
id: 'ABE_MAILSERVER_OR_MAILCURRENT',
pmType: 'dropdown',
name: 'ABE_MAILSERVER_OR_MAILCURRENT',
label: 'Email From Format'.translate(),
controlsWidth: 300,
options: [
{
id: 'emailServerConfiguration',
label: 'Assigned user'.translate(),
value: 0
}, {
id: 'femailCurrentUser',
label: 'Email Account Settings'.translate(),
value: 1
}
]
},
'note': {
name: "ABE_CASE_NOTE_IN_RESPONSE",
pmType: "checkbox",
labelVisible: false,
options: [
{
"id": "formTimingControlOption",
"label": "Register a Case Note when the recipient submits the Response".translate(),
"value": "1"
}
]
},
forceLogin: {
name: "ABE_FORCE_LOGIN",
pmType: "checkbox",
labelVisible: false,
options: [
{
id: "ABE_FORCE_LOGIN",
label: "Force user login".translate(),
value: 1
}
]
},
'customGrid': {
id: "customGridPanel",
pmType: "panel",
visibleHeader: false,
layout: 'vbox',
fieldset: false,
width: 735,
legend: "Options".translate(),
items: [
{
pmType: 'panel',
legend: "Options".translate(),
fieldset: true,
layout: 'hbox',
items: [
{
pmType: "panel",
id: "customGridPanelControls",
layout: "hbox",
proportion: 1.7,
items: [
{
pmType: "panel",
layout: "vbox",
id: "firstPanel",
proportion: 0.8,
items: [
{
pmType: "text",
name: "abe_custom_value_add",
id: "abe_custom_value_add",
label: "Value".translate(),
valueType: "string",
labelWidth: "37%",
controlsWidth: 120,
maxLength: 255,
required: true
},
{
pmType: "text",
name: "abe_custom_label_add",
id: "abe_custom_label_add",
label: "Label".translate(),
valueType: "string",
labelWidth: "37%",
controlsWidth: 120,
maxLength: 255,
required: true
}
]
},
{
pmType: "panel",
layout: "vbox",
id: "secondPanel",
proportion: 1.2,
items: [
{
pmType: "textarea",
name: "abe_custom_format_add",
id: "abe_custom_format_add",
label: "Format (CSS)".translate(),
valueType: "string",
required: false,
controlsWidth: 235,
placeholder: "padding:12px;\ntext-decoration:none;\nborder-radius:2px;\nbackground:#1fbc99;\nborder:1px solid #1ba385;",
style: {
cssClasses: [
'mafe-textarea-resize'
]
},
rows: 90,
validators: [
{
pmType: "regexp",
criteria: /^[a-zA-Z0-9\s\[\]\.\-_#%;,=:()']*$/,
errorMessage: "Please enter only CSS code".translate()
}
]
}
]
}
]
},
{
pmType: "panel",
id: "thirdPanel",
layout: "vbox",
proportion: 0.3,
items: [
{
id: 'buttonFieldAdd',
pmType: 'buttonField',
value: 'Add'.translate(),
labelVisible: false,
buttonAlign: 'center',
handler: function (field) {
addAcceptedValue();
},
buttonType: "success",
controlsWidth: 120,
style: {
cssProperties: {
'width': 'auto'
}
}
},
{
id: 'buttonFieldCancel',
pmType: 'buttonField',
value: 'Cancel'.translate(),
labelVisible: false,
visible: false,
buttonAlign: 'center',
handler: function (field) {
clearAddOptionForm();
},
buttonType: "error",
controlsWidth: 120,
style: {
cssProperties: {
'width': 'auto'
}
},
buttonStyle: {
cssClasses: [
'mafe-button-delete'
]
}
}
]
}
]
}
]
}
};
for (i in ENABLED_FEATURES) {
if (ENABLED_FEATURES[i] === 'zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=') {
featuresForms.push({
id: "ActionsByEmailConfiguration",
title: "Actions by Email".translate(),
icon: "",
panel: abeMainPanel = new PMUI.core.Panel({
id: "ActionsByEmailPanel",
items: [
abeForm = new PMUI.form.Form({
id: "ActionsByEmail",
name: "ActionsByEmail",
visibleHeader: false,
width: DEFAULT_WINDOW_WIDTH - 250,
items: [abeFields.type]
})
]
})
});
}
}
featuresForms.push({
id: 'OfflineMobileConfiguration',
icon: '',
title: 'Mobile'.translate(),
panel: MobilePanel = new PMUI.core.Panel({
id: "MobilePanel",
items: [
enableTaskMobile = new PMUI.field.CheckBoxGroupField({
id: 'enableTaskMobile',
name: 'tas_offline',
pmType: 'checkbox',
labelVisible: false,
options: [{
id: 'enableTaskOffLineUse',
label: 'Enable this task for offline use:'.translate(),
value: 'TRUE'
}],
onChange: function (value) {
var valueField = this.getControl(0).isSelected();
onChangeMobileOffline(valueField);
}
}),
routeCaseMobile = new PMUI.field.CheckBoxGroupField({
id: 'routeCaseMobile',
name: 'tas_auto_root',
pmType: 'checkbox',
labelVisible: false,
options: [{
id: 'routeCaseBackOnline',
label: 'Route case when back online'.translate(),
value: 'TRUE'
}]
}),
new PMUI.field.TextAnnotationField({
text: 'Triggers after and before a step are not supported when working offline'.translate(),
text_Align: 'center',
proportion: 1.4,
style: {
cssProperties: {
color: 'red'
}
}
})
]
})
});
/**features-ends**/
/*----------------------------------********---------------------------------*/
warningChanges = new PMUI.ui.MessageWindow({
id: 'warningChanges',
windowMessageType: 'warning',
width: 490,
bodyHeight: 'auto',
title: 'Activity Properties'.translate(),
message: 'Are you sure you want to discard your changes?'.translate(),
footerItems: [
{
id: 'warningChangesButtonNo',
text: "No".translate(),
handler: function () {
warningChanges.close();
},
buttonType: "error"
},
{
id: 'warningChangesButtonYes',
text: "Yes".translate(),
handler: function () {
windowProperties.close();
warningChanges.close();
},
buttonType: "success"
}
]
});
windowProperties = new PMUI.ui.Window({
id: 'windowProperties',
title: 'Activity Properties'.translate(),
height: DEFAULT_WINDOW_HEIGHT,
width: DEFAULT_WINDOW_WIDTH,
onOpen: function () {
loadServerData();
},
items: [
propertiesTabs = new PMUI.panel.TabPanel({
id: 'windowPropertiesTabPanel',
height: 435,
width: DEFAULT_WINDOW_WIDTH - 50,
style: {
cssProperties: {
'margin-left': '10px'
}
},
items: configurationForms.concat(featuresForms),
itemsPosition: {
position: 'left'
},
onTabClick: function (tab) {
setFocusTab(tab);
}
}),
customGrid
],
onBeforeClose: function () {
if (isDirty()) {
warningChanges.open();
warningChanges.showFooter();
} else {
windowProperties.close();
}
},
buttonPanelPosition: 'bottom',
buttonsPosition: 'right',
buttons: [
{
id: 'windowPropertiesButtonCancel',
text: 'Cancel'.translate(),
handler: function () {
if (isDirty()) {
warningChanges.open();
warningChanges.showFooter();
} else {
windowProperties.close();
}
},
buttonType: "error"
},
{
id: 'windowPropertiesButtonSave',
text: 'Save'.translate(),
handler: function () {
saveData();
},
buttonType: 'success'
}
]
});
function changeConsolidated(value) {
var panel = formConsolidated.getItem('formConsolidatedMainPanel');
formConsolidated.getField('consolidated_enable').setValue(value ? '["1"]' : '[]');
if (panel) {
panel.setVisible(value);
if (value) {
panel.enable();
} else {
panel.disable();
}
}
formConsolidated.getField('consolidated_report_table').setVisible(false);
}
function changeTimingControl(value) {
var mainPanel = formTimingControl.getItem('formTimingMainPanel');
formTimingControl.getField('tas_transfer_fly').setValue(value ? '["1"]' : '[]');
if (mainPanel) {
if (value) {
mainPanel.disable();
} else {
mainPanel.enable();
}
mainPanel.setVisible(!value);
}
if (window.enterprise !== "1") {
formTimingControl.getField('tas_average').setVisible(false);
formTimingControl.getField('tas_sdv').setVisible(false);
}
}
function changeFormNotifications(value, valueTwo) {
var panel = formNotifications.getItem('formNotificationsMainPanel');
if (panel) {
panel.setVisible(value);
if (value) {
panel.enable();
} else {
panel.disable();
}
}
if (value) {
formNotifications.getField('tas_def_message_type').setValue(valueTwo);
visibleContentType(val