The list rendered item.category.name. The Category entity has no getName()
(only getTitle()), so Twig fell back to CommonEntity::__call('name'), which
throws "Method name not exists" - a 500 as soon as a script had a category.
Use the same null-guarded item.category.title pattern as the program list.
134 lines
7.7 KiB
Twig
134 lines
7.7 KiB
Twig
{% set isIndex = 'index' == tmpl|default('index') ? true : false %}
|
|
{% set tmpl = 'list' %}
|
|
{% extends isIndex ? '@MauticCore/Default/content.html.twig' : '@MauticCore/Default/raw_output.html.twig' %}
|
|
|
|
{% block mauticContent %}mt3sMpCallScript{% endblock %}
|
|
|
|
{% block headerTitle %}{{ 'mt3s.call_script.header.index'|trans }}{% endblock %}
|
|
|
|
{% block content %}
|
|
<div id="page-list-wrapper" class="{% if items|length > 0 or searchValue is not empty %}panel {% endif %}panel-default">
|
|
{# The toolbar belongs to the full page only: ajax reloads (sort, filter, pagination)
|
|
replace the contents of .page-list, so including it here again would duplicate it. #}
|
|
{% if isIndex %}
|
|
{{- include('@MauticCore/Helper/list_toolbar.html.twig', {
|
|
'searchValue': searchValue,
|
|
'action': currentRoute,
|
|
'page_actions': {
|
|
'templateButtons': {
|
|
'new': permissions[permissionBase ~ ':create'],
|
|
},
|
|
'langVar': 'mt3smarketingprogram.call_scripts',
|
|
'routeBase': 'call_scripts',
|
|
},
|
|
'bulk_actions': {
|
|
'langVar': 'mt3smarketingprogram.call_scripts',
|
|
'templateButtons': {
|
|
'delete': permissions[permissionBase ~ ':deleteown'] or permissions[permissionBase ~ ':deleteother'],
|
|
},
|
|
},
|
|
}) -}}
|
|
{% endif %}
|
|
<div class="page-list">
|
|
{% if items is defined and items is not empty %}
|
|
<div class="table-responsive">
|
|
<table class="table table-hover" id="callScriptTable">
|
|
<thead>
|
|
<tr>
|
|
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
|
'checkall': 'true',
|
|
'target': '#callScriptTable',
|
|
}) }}
|
|
{# Columns: Name, Category, Status, Owner, Modified. #}
|
|
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
|
'sessionVar': sessionVar,
|
|
'orderBy': tablePrefix ~ '.name',
|
|
'text': 'mt3s.call_script.field.name',
|
|
'class': 'col-call-script-name',
|
|
'default': true,
|
|
}) }}
|
|
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
|
'sessionVar': sessionVar,
|
|
'text': 'mt3s.call_script.list.category',
|
|
'class': 'visible-md visible-lg col-call-script-category',
|
|
}) }}
|
|
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
|
'sessionVar': sessionVar,
|
|
'orderBy': tablePrefix ~ '.isPublished',
|
|
'text': 'mt3s.call_script.list.status',
|
|
'class': 'col-call-script-status',
|
|
}) }}
|
|
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
|
'sessionVar': sessionVar,
|
|
'text': 'mt3s.call_script.list.owner',
|
|
'class': 'visible-md visible-lg col-call-script-owner',
|
|
}) }}
|
|
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
|
'sessionVar': sessionVar,
|
|
'orderBy': tablePrefix ~ '.dateModified',
|
|
'text': 'mt3s.call_script.list.modified',
|
|
'class': 'visible-md visible-lg col-call-script-date',
|
|
}) }}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for item in items %}
|
|
{% set canEdit = securityHasEntityAccess(permissions[permissionBase ~ ':editown'], permissions[permissionBase ~ ':editother'], item.createdBy) %}
|
|
<tr>
|
|
<td>
|
|
{{- include('@MauticCore/Helper/list_actions.html.twig', {
|
|
'item': item,
|
|
'templateButtons': {
|
|
'edit': canEdit,
|
|
'delete': securityHasEntityAccess(permissions[permissionBase ~ ':deleteown'], permissions[permissionBase ~ ':deleteother'], item.createdBy),
|
|
},
|
|
'langVar': 'mt3smarketingprogram.call_scripts',
|
|
'routeBase': 'call_scripts',
|
|
}) -}}
|
|
</td>
|
|
<td>
|
|
{% if canEdit %}
|
|
<a href="{{ path(actionRoute, {'objectAction': 'edit', 'objectId': item.id}) }}" data-toggle="ajax">{{ item.name }}</a>
|
|
{% else %}
|
|
{{ item.name }}
|
|
{% endif %}
|
|
</td>
|
|
<td class="visible-md visible-lg">{{ item.category ? item.category.title : '—' }}</td>
|
|
<td>
|
|
{% if item.isPublished %}
|
|
<span class="label label-success"{% if item.publishUp or item.publishDown %} title="{{ item.publishUp ? item.publishUp|date('Y-m-d H:i') : '' }} → {{ item.publishDown ? item.publishDown|date('Y-m-d H:i') : '' }}"{% endif %}>{{ 'mt3s.call_script.list.published'|trans }}</span>
|
|
{% else %}
|
|
<span class="label label-default">{{ 'mt3s.call_script.list.unpublished'|trans }}</span>
|
|
{% endif %}
|
|
</td>
|
|
<td class="visible-md visible-lg">{{ item.owner.name|default('—') }}</td>
|
|
<td class="visible-md visible-lg">{{ item.dateModified ? dateToFull(item.dateModified) : '—' }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
<div class="panel-footer">
|
|
{{- include('@MauticCore/Helper/pagination.html.twig', {
|
|
'totalItems': totalItems,
|
|
'page': page,
|
|
'limit': limit,
|
|
'baseUrl': path(indexRoute),
|
|
'sessionVar': sessionVar,
|
|
}) -}}
|
|
</div>
|
|
</div>
|
|
{% elseif searchValue is not empty %}
|
|
{{ include('@MauticCore/Helper/noresults.html.twig') }}
|
|
{% else %}
|
|
<div class="mt-80 col-md-offset-2 col-lg-offset-3 col-md-8 col-lg-5 height-auto">
|
|
{{ include('@MauticCore/Components/content-block.html.twig', {
|
|
'heading': 'mt3s.call_script.onboarding.heading',
|
|
'subheading': 'mt3s.call_script.onboarding.subheading',
|
|
'copy': 'mt3s.call_script.onboarding.copy',
|
|
}) }}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|