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
130 lines
6.1 KiB
Twig
130 lines
6.1 KiB
Twig
{% extends '@MauticCore/Default/content.html.twig' %}
|
|
|
|
{% block mauticContent %}mt3sMpCallScript{% endblock %}
|
|
|
|
{% block headerTitle %}
|
|
{% if form.vars.data.id %}
|
|
{{ 'mt3s.call_script.header.edit'|trans({'%name%': form.vars.data.name}) }}
|
|
{% else %}
|
|
{{ 'mt3s.call_script.header.new'|trans }}
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{# One {value, label} option of an outcome's choices. #}
|
|
{% macro option_row(option) %}
|
|
<li class="program-collection-row list-group-item">
|
|
<div class="row">
|
|
<div class="col-md-5">{{ form_row(option.value) }}</div>
|
|
<div class="col-md-5">{{ form_row(option.label) }}</div>
|
|
<div class="col-md-2 text-right">
|
|
<button type="button" class="btn btn-ghost btn-sm btn-nospin program-collection-remove" title="{{ 'mt3s.call_script.outcome.options.remove'|trans }}">
|
|
<i class="ri-delete-bin-line"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
{% endmacro %}
|
|
|
|
{# One outcome: its label, the data type the agent records it with, and the options of the choice types.
|
|
Adding, removing and reordering is handled by Assets/js/mt3s-mp-program.js through the
|
|
program-collection-* classes (the options are a nested collection of the same kind). #}
|
|
{% macro outcome_row(outcome) %}
|
|
<li class="program-collection-row list-group-item">
|
|
<div class="row">
|
|
<div class="col-xs-1 text-center">
|
|
<span class="program-collection-handle text-muted" title="{{ 'mt3s.call_script.outcome.drag'|trans }}" style="cursor: move;">
|
|
<i class="ri-draggable ri-lg"></i>
|
|
</span>
|
|
</div>
|
|
<div class="col-xs-10">
|
|
<div class="row">
|
|
<div class="col-md-6">{{ form_row(outcome.label) }}</div>
|
|
<div class="col-md-6">{{ form_row(outcome.inputType) }}</div>
|
|
</div>
|
|
<div class="program-outcome-options">
|
|
<h5>{{ 'mt3s.call_script.outcome.options'|trans }}</h5>
|
|
<div class="program-collection program-outcome-option-collection"
|
|
data-prototype="{{ _self.option_row(outcome.options.vars.prototype)|e('html_attr') }}"
|
|
data-prototype-name="__option__">
|
|
<p class="text-muted program-collection-empty{% if outcome.options|length > 0 %} hide{% endif %}">
|
|
{{ 'mt3s.call_script.outcome.options.empty'|trans }}
|
|
</p>
|
|
<ul class="list-group program-collection-list">
|
|
{% for option in outcome.options %}
|
|
{{ _self.option_row(option) }}
|
|
{% endfor %}
|
|
</ul>
|
|
<button type="button" class="btn btn-ghost btn-sm btn-nospin program-collection-add">
|
|
<i class="ri-add-line"></i> {{ 'mt3s.call_script.outcome.options.add'|trans }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
{{ form_widget(outcome.position) }}
|
|
</div>
|
|
<div class="col-xs-1 text-right">
|
|
<button type="button" class="btn btn-ghost btn-sm btn-nospin program-collection-remove" title="{{ 'mt3s.call_script.outcome.remove'|trans }}">
|
|
<i class="ri-delete-bin-line"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
{% endmacro %}
|
|
|
|
{% block content %}
|
|
{{ form_start(form) }}
|
|
<div class="box-layout">
|
|
<div class="col-md-9 height-auto bdr-r">
|
|
<div class="pa-md">
|
|
{{ form_row(form.name) }}
|
|
{{ form_row(form.description) }}
|
|
{{ form_row(form.script) }}
|
|
</div>
|
|
<div class="pa-md">
|
|
<h4 class="mt-lg mb-sm">{{ 'mt3s.call_script.outcome.list'|trans }}</h4>
|
|
<div class="program-collection program-call-script-outcomes"
|
|
data-prototype="{{ _self.outcome_row(form.outcomes.vars.prototype)|e('html_attr') }}"
|
|
data-prototype-name="__outcome__">
|
|
{{ form_errors(form.outcomes) }}
|
|
<p class="text-muted program-collection-empty{% if form.outcomes|length > 0 %} hide{% endif %}">
|
|
{{ 'mt3s.call_script.outcome.empty'|trans }}
|
|
</p>
|
|
<ul class="list-group program-collection-list">
|
|
{% for outcome in form.outcomes %}
|
|
{{ _self.outcome_row(outcome) }}
|
|
{% endfor %}
|
|
</ul>
|
|
<button type="button" class="btn btn-ghost btn-nospin program-collection-add">
|
|
<i class="ri-add-line"></i> {{ 'mt3s.call_script.outcome.add'|trans }}
|
|
</button>
|
|
</div>
|
|
{% do form.outcomes.setRendered %}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3 height-auto">
|
|
<div class="pr-lg pl-lg pt-md pb-md">
|
|
{{ form_row(form.owner) }}
|
|
{{ form_row(form.category) }}
|
|
{{ form_row(form.isPublished) }}
|
|
{{ form_row(form.publishUp) }}
|
|
{{ form_row(form.publishDown) }}
|
|
|
|
<h4>{{ 'mt3s.call_script.section.calling_window'|trans }}</h4>
|
|
{{ form_row(form.callingDays) }}
|
|
{{ form_row(form.callingFrom) }}
|
|
{{ form_row(form.callingTo) }}
|
|
{{ form_row(form.callingTimezoneMode) }}
|
|
{{ form_row(form.callingTimezone) }}
|
|
|
|
<h4>{{ 'mt3s.call_script.section.retry_policy'|trans }}</h4>
|
|
{{ form_row(form.retryMaxAttempts) }}
|
|
{{ form_row(form.retryDelayMinutes) }}
|
|
{{ form_row(form.retryBackoff) }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{ form_row(form.buttons) }}
|
|
{# render_rest is false, so the hidden CSRF token must be rendered explicitly. #}
|
|
{{ form_widget(form._token) }}
|
|
{{ form_end(form, {'render_rest': false}) }}
|
|
{% endblock %}
|