feat(call-script): add the Call Script component (0.19.0)
A new Mautic component, listed under Components > Call Scripts (/s/call-scripts),
built like the other domains on AbstractStandardFormController/FormModel.
- CallScript (mt3s_call_scripts): name, description, category, owner, status,
the publish window shown as start/end date and time, the HTML script with
dynamic tokens kept as typed (html cleaning mask), the calling window
(weekdays, hours, sentinel in the contact's or a fixed timezone) and the retry
policy (max attempts, delay, backoff: none/linear/exponential)
- CallScriptOutcome (mt3s_call_script_outcomes, ON DELETE CASCADE): label,
data type (checkbox/radio/free text/dropdown), options JSON ({value,label})
and position; nested collections reuse the program-collection JS
- validators: ValidCallingWindow, ValidCallScriptOutcomeOptions, and an atPath
option on EndDateAfterStartDate so its violation lands on publishDown
- config: routes, the Components menu item (parent mautic.core.components),
call_script category type, model alias, call_scripts permissions, version 0.19.0
- migration Version_0_19_0 creates both tables and their FKs immediately
(users/categories SET NULL, outcomes CASCADE), idempotent
- translations en_US/fr_FR, unit tests, readme/AGENTS documentation
This commit is contained in:
1 parent
88256ca345
commit
4fb36eebfc
33 files changed
+2537
-6
No files matched your search
@@ -400,6 +400,14 @@ Mautic.mt3sMpProgramInitCollection = function ($editor) {
|
||||
var $row = mQuery($editor.attr('data-prototype').replace(prototypeName, nextIndex++));
|
||||
$list.append($row);
|
||||
refresh();
|
||||
// A new row may contain nested collections (a call script outcome's options): give them
|
||||
// their own add/remove/drag handler.
|
||||
$row.find('.program-collection').each(function () {
|
||||
Mautic.mt3sMpProgramInitCollection(mQuery(this));
|
||||
});
|
||||
if (typeof Mautic.mt3sMpCallScriptInitOutcomeTypes === 'function') {
|
||||
Mautic.mt3sMpCallScriptInitOutcomeTypes($row);
|
||||
}
|
||||
$row.find('select, input[type="text"], textarea').first().trigger('focus');
|
||||
});
|
||||
|
||||
@@ -430,6 +438,40 @@ Mautic.mt3sMpProgramInitCollection = function ($editor) {
|
||||
refresh();
|
||||
};
|
||||
|
||||
/**
|
||||
* Call Script form: show the options of an outcome only for the choice types (checkbox, radio,
|
||||
* dropdown); a free text outcome has none.
|
||||
*/
|
||||
Mautic.mt3sMpCallScriptInitOutcomeTypes = function ($container) {
|
||||
mQuery($container).find('select.program-outcome-type').each(function () {
|
||||
var $select = mQuery(this);
|
||||
|
||||
if ($select.data('mt3sMpCallScriptTypeInitialized')) {
|
||||
return;
|
||||
}
|
||||
$select.data('mt3sMpCallScriptTypeInitialized', true);
|
||||
|
||||
var toggle = function () {
|
||||
var $row = $select.closest('.program-collection-row');
|
||||
$row.find('.program-outcome-options').first().toggleClass('hide', 'free_text' === $select.val());
|
||||
};
|
||||
|
||||
$select.on('change', toggle);
|
||||
toggle();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* The Call Script form (Components > Call Scripts): its outcomes and their nested options use the
|
||||
* program collections, and the options block follows the chosen data type.
|
||||
*/
|
||||
Mautic.mt3sMpCallScriptOnLoad = function (container) {
|
||||
mQuery(container).find('.program-collection').each(function () {
|
||||
Mautic.mt3sMpProgramInitCollection(mQuery(this));
|
||||
});
|
||||
Mautic.mt3sMpCallScriptInitOutcomeTypes(mQuery(container));
|
||||
};
|
||||
|
||||
/**
|
||||
* Settings > Configuration > Plan: add and remove item types (description and allocation).
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user