src/Trinity/FormsBundle/Resources/views/elements/row.html.twig line 1

Open in your IDE?
  1. {% trans_default_domain 'forms' %}
  2. {% set editableFields = (Question.getType in ['upload', 'email', 'email_check', 'date', 'text', 'textarea', 'dropzone']) %}
  3. {% if loadForm is not defined %}
  4.     <div class="fields-parent">
  5.         <div class="field-child">
  6.         {% endif %}
  7.         <div id="q-{{Question.id ? Question.id : random}}" data-id="{{Question.id ? Question.id : random}}" class="{% if loop is defined and loop.index0 % 2 %}two-last {% endif %} {% if Question.hidden %}qhidden{% endif %} {% if Question.required and Question.hidden == false %}required{% endif %} form-block child-sortable form-group card type-{{Question.getType}}">
  8.             {% if edit is defined %}
  9.                 <input type="hidden" name="pos[{{Question.id ? Question.id : random}}]" class="row-pos" value="{{Question.position ?? 0}}" />
  10.                 <input type="hidden" name="width[{{Question.id ? Question.id : random}}]" class="row-width" value="{{Question.width ?? 100}}" />
  11.             {% endif %}
  12.             {% if Question.getType in ['checkbox', 'radio', 'select', 'upload', 'email', 'email_check', 'date', 'text', 'textarea', 'canvas'] %}
  13.                 {% if Question.getTitle is not empty %}
  14.                      {% if edit is not defined and not Question.hiddenLabel %}
  15.                         <div class="field-label"{% if edit is defined %} contenteditable="true" {% endif %}data-type="title" style="outline:none;margin-left: 20px;line-height: 28px;min-width: 100px;display: inline-block;">
  16.                           {{Question.getTitle|raw}}
  17.                           {% if edit is not defined and Question.required and Question.hidden == false %}<span class="req">*</span>{% endif %}
  18.                         </div>
  19.                     {% endif %}
  20.                      {% if edit is defined %}
  21.                         <div class="field-control"{% if edit is defined %} contenteditable="true"{% endif %}>
  22.                             <input {% if edit is defined %}title="{{'Titel is verplicht'|trans}}"{% endif %} placeholder="{{'Titel'|trans}}" type="text" class="validate" data-type="title" value="{{Question.title|raw}}" {% if edit is defined %}required="required"{% endif %} />
  23.                             {% if edit is not defined and Question.required and Question.hidden == false %}<span class="req">*</span>{% endif %}
  24.                         </div>
  25.                     {% endif %}
  26.                 {% else %}
  27.                     <div class="field-label" {% if edit is defined %}contenteditable="true"{% endif %} data-type="title" style="outline:none;margin-left: 20px;line-height: 28px;min-width: 100px;display: inline-block;"></div>
  28.                 {% endif %}
  29.                 {% if edit is defined %}
  30.                     <div class="info">
  31.                         <span class="qid">({{Question.getTypeLabel}}, ID: {{Question.id}}<span class="req">, {{ 'VERPLICHT' |trans }}</span>)</span>
  32.                     </div>
  33.                 {% endif %}
  34.                 {# {% if edit is defined %}
  35.                         <span class="hid"><i class="material-icons">add</i></span>
  36.                 {% endif %} #}
  37.             {% elseif Question.getType in ['dropzone'] %}
  38.                 {% if Question.getTitle is not empty %}
  39.                     <div class="field-label" data-type="title" style="outline:none;margin-left: 20px;line-height: 28px;min-width: 100px;display: inline-block;"><span style="color:gray;">Dropzone</span>{% if edit is not defined and Question.required and Question.hidden == false %}<span class="req">*</span>{% endif %}</div>
  40.                 {% endif %}
  41.                 {% if edit is defined %}
  42.                     <div class="info">
  43.                         <span class="qid">({{Question.getTypeLabel}}, ID: {{Question.id}}<span class="req">, {{ 'VERPLICHT' |trans }}</span>)</span>
  44.                     </div>
  45.                 {% endif %}
  46.             {% elseif Question.getType in ['newsletter'] %}
  47.                 {% if edit is defined %}
  48.                     <div class="info">
  49.                         <span class="qid">({{Question.getTypeLabel}}, ID: {{Question.id}}<span class="req">, {{ 'VERPLICHT' |trans }}</span>)</span>
  50.                     </div>
  51.                 {% endif %}
  52.             {% endif %}
  53.             {# <div class="field"> #}
  54.                 {% if edit is defined %}
  55.                     <div class="edit" style="right:auto;left: 16px;top: 24px;">
  56.                         <span class="drag"><i class="material-icons" style="font-size: 20px;">drag_handle</i></span>
  57.                     </div>
  58.                 {% endif %}
  59.                 {% block field %}{% endblock %}
  60.                 {% if Question.getType in ['select', 'upload', 'email', 'email_check', 'email_check', 'text', 'date', 'textarea'] %}
  61.                     {% if Question.getSubTitle|trim|striptags != ('Toelichting' | trans) and edit is not defined %}<div class="sublabel form-text text-muted" data-type="subtitle" style="outline:none;">{{Question.getSubTitle|raw}}</div>{% endif %}
  62.                     {# {% if Question.getType in ['upload', 'email', 'email_check', 'date', 'text', 'textarea'] %}
  63.                             {% if edit is defined %}<div class="placeholder form-text text-muted" contenteditable="true" data-type="placeholder" style="outline:none;">{{Question.placeholder}}</div>{% endif %}
  64.                     {% endif %} #}
  65.                 {% endif %}
  66.                 {# Editor #}
  67.                 {% if edit is defined %}
  68.                     {# <div class="properties" style="display:none;">
  69.                             {% if Question.getType in ['select', 'checkbox', 'radio'] %}
  70.                                     {% include '@TrinityForms/elements/valueEditor.html.twig' %}
  71.                             {% endif %}
  72.                     </div> #}
  73.                     {# Technical #}
  74.                     <input type="hidden" class="id" name="id[]" value="{{Question.id ? Question.id : random}}" />
  75.                     <input type="hidden" class="type" name="type[]" value="{{Question.type}}" />
  76.                     <input type="hidden" class="title" name="title[]" value="{{Question.title}}" />
  77.                     {# <input type="hidden" class="subtitle" name="subtitle[{{Question.id ? Question.id : random}}]" value="{{Question.subtitle}}" /> #}
  78.                     <input type="hidden" class="classes" name="classes[{{Question.id ? Question.id : random}}]" value="{{Question.classes}}" />
  79.                     {# <div class="row"> #}
  80.                     {# {% if Question.getType in ['upload', 'email', 'email_check', 'date', 'text', 'textarea'] %} #}
  81.                     <div id="additional{{Question.id ? Question.id : random}}" class="modal">
  82.                         <div class="modal-dialog">
  83.                             <div class="modal-content">
  84.                                 <div class="modal-body">
  85.                                     <div style="display:{{editableFields ? 'block' : 'none'}};">
  86.                                         <p>
  87.                                             <label class="form-label" for="placeholder_{{Question.id ? Question.id : random}}">{{ 'Placeholder' | trans }}</label>
  88.                                             <input class="form-control" onkeyup="$('#frm-lbl-{{Question.id ? Question.id : random}}').prop('placeholder', this.value);" style="margin:0;" id="placeholder_{{Question.id ? Question.id : random}}" type="text" name="placeholder[]" value="{{Question.placeholder ? (Question.placeholder|raw) : ''}}">
  89.                                         </p>
  90.                                     </div>
  91.                                     <div>
  92.                                         <p>
  93.                                             <label class="form-label" for="subtitle_{{Question.id ? Question.id : random}}">{{ 'Toelichting' | trans }}</label>
  94.                                             <input class="form-control" style="margin:0;" id="subtitle_{{Question.id ? Question.id : random}}" type="text" name="subtitle[]" value="{{Question.subtitle|trim|striptags != ('Toelichting' | trans) ? (Question.subtitle|raw) : ''}}">
  95.                                         </p>
  96.                                     </div>
  97.                                 </div>
  98.                                 <div class="modal-footer">
  99.                                     <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ 'Sluiten' | trans }}</button>
  100.                                 </div>
  101.                             </div>
  102.                         </div>
  103.                     </div>
  104.                     {# {% endif %} #}
  105.                     <input style="display:none;" type="checkbox" {{Question.required and Question.hidden == false ? 'checked="checked"' : ''}} name="required[]" id="require_{{Question.id ? Question.id : random}}" value="{{Question.id ? Question.id : random}}" />
  106.                     <input style="display:none;" type="checkbox" {{Question.hidden ? 'checked="checked"' : ''}} name="hidden[]" id="hidden_{{Question.id ? Question.id : random}}" value="{{Question.id ? Question.id : random}}" />
  107.                     <input style="display:none;" type="checkbox" {{Question.hiddenLabel ? 'checked="checked"' : ''}} name="hidden_label[]" id="hidden_label_{{Question.id ? Question.id : random}}" value="{{Question.id ? Question.id : random}}" />
  108.                     {# </div> #}
  109.                     <div class="edit" style="top: 20px;right: 17px;">
  110.                         <a class="more" style="font-size: 20px;" data-horizontal-offset="-380" data-vertical-offset="-200" data-jq-dropdown="#jq-dropdown-{{Question.id ? Question.id : random}}" href="#"><i style="color:black;" class="material-icons">more_horiz</i></a>
  111.                     </div>
  112.                     {% if Question.getType in ['select', 'checkbox', 'radio'] %}
  113.                         <div id="options{{Question.id ? Question.id : random}}" class="modal modal-fixed-footer">
  114.                             <div class="modal-dialog">
  115.                                 <div class="modal-content">
  116.                                     <div class="modal-body">
  117.                                         <h4>{{ 'Keuze opties' | trans({}) }}</h4>
  118.                                         {% include '@TrinityForms/elements/valueEditor.html.twig' with {Question: Question} %}
  119.                                     </div>
  120.                                     <div class="modal-footer">
  121.                                         <a href="#!" class="add-child-value btn btn-flat"><i class="fa fa-plus"></i> {{ 'Optie toevoegen' |trans }}</a>
  122.                                         <button type="button" class="btn btn-green" data-bs-dismiss="modal"><i class="fa fa-check"></i> {{ 'Opslaan' | trans }}</button>
  123.                                     </div>
  124.                                 </div>
  125.                             </div>
  126.                         </div>
  127.                     {% endif %}
  128.                 {% endif %}
  129.             {# </div> #}
  130.             {# <div class="options">
  131.             <a href="#" class="pull center-align"><i class="material-icons">arrow_drop_down</i></a>
  132.             </div> #}
  133.         </div>
  134.         {% if edit is defined %}
  135.             <div id="jq-dropdown-{{Question.id ? Question.id : random}}" class="jq-dropdown jq-dropdown-tip jq-dropdown-anchor-right">
  136.                 <ul class="jq-dropdown-menu">
  137.                     {% if Question.getType in ['select', 'checkbox', 'radio'] %}
  138.                         <li><a href="#" onclick="$('#options{{Question.id ? Question.id : random}}').modal('show');return false;"><i style="font-size:15px;line-height: 17px;" class="material-icons left">edit</i>{{ 'Keuze opties bewerken' |trans }}</a></li>
  139.                     {% endif %}
  140.                     {% if Question.getType in ['select', 'upload', 'email', 'email_check', 'text', 'date', 'textarea', 'checkbox', 'radio', 'canvas', 'dropzone'] %}
  141.                         <li>
  142.                             <a href="#" data-toggle="true" onclick="if ($(this).find('i').html() == 'check_box') {
  143.                                 $(this).find('i').html('check_box_outline_blank');
  144.                                 $('#q-{{Question.id ? Question.id : random}}').removeClass('required');
  145.                                 $('#require_{{Question.id ? Question.id : random}}').prop('checked', false);
  146.                             } else {
  147.                                 $(this).find('i').html('check_box');
  148.                                 $('#q-{{Question.id ? Question.id : random}}').addClass('required');
  149.                                 $('#require_{{Question.id ? Question.id : random}}').prop('checked', true);
  150.                             }
  151.                             ;
  152.                             return false;"><i style="font-size:15px;line-height: 17px;" class="material-icons left">{{Question.required and Question.hidden == false ? 'check_box' : 'check_box_outline_blank'}}</i>{{ 'Verplichte invoer' | trans }}</a></li>
  153.                         <li><a href="#" data-toggle="true" onclick="if ($(this).find('i').html() == 'check_box') {
  154.                                     $(this).find('i').html('check_box_outline_blank');
  155.                                     $('#q-{{Question.id ? Question.id : random}}').removeClass('qhidden');$('#hidden_{{Question.id ? Question.id : random}}').prop('checked', false);} else {
  156.                                     $(this).find('i').html('check_box');
  157.                                     $('#q-{{Question.id ? Question.id : random}}').addClass('qhidden');
  158.                                     $('#hidden_{{Question.id ? Question.id : random}}').prop('checked', true);
  159.                                 }
  160.                                 ;
  161.                                 return false;"><i style="font-size:15px;line-height: 17px;" class="material-icons left">{{Question.hiddenLabel ? 'check_box' : 'check_box_outline_blank'}}</i>{{ 'Verborgen' | trans }}</a></li>
  162.                         <li><a href="#" data-toggle="true" onclick="if ($(this).find('i').html() == 'check_box') {
  163.                                 $(this).find('i').html('check_box_outline_blank');
  164.                                 $('#q-{{Question.id ? Question.id : random}} .field-control').removeClass('qhidden');
  165.                                 $('#hidden_label_{{Question.id ? Question.id : random}}').prop('checked', false);
  166.                                 } else {
  167.                                 $(this).find('i').html('check_box');
  168.                                 $('#q-{{Question.id ? Question.id : random}} .field-control').addClass('qhidden');
  169.                                 $('#hidden_label_{{Question.id ? Question.id : random}}').prop('checked', true);
  170.                             };
  171.                             return false;"><i style="font-size:15px;line-height: 17px;" class="material-icons left">{{Question.hiddenLabel ? 'check_box' : 'check_box_outline_blank'}}</i>{{ 'Verberg label' | trans }}</a></li>
  172.                         <li class="jq-dropdown-divider"></li>
  173.                         {# {% if loop is defined and loop.index == 1 %}
  174.                         <li><a data-disabled="true" class="grey-text"><i style="font-size:15px;line-height: 17px;" class="material-icons left">attachment</i>{{ 'Inhoud koppelen' | trans }}</a></li>
  175.         {% else %}
  176.                 <li><a><i style="font-size:15px;line-height: 17px;" class="material-icons left">attachment</i>{{ 'Inhoud koppelen' | trans }}</a></li>
  177.                         {% endif %} #}
  178.                         {# {% else %}
  179.                                 <li><a href="#" class="grey-text" data-disabled="true"><i style="font-size:15px;line-height: 17px;" class="material-icons left">check_box_outline_blank</i>{{ 'Verplichte invoer' | trans }}</a></li> #}
  180.                     {% endif %}
  181.                     {# {% if Question.getType in ['upload', 'email', 'email_check', 'date', 'text', 'textarea'] %} #}
  182.                     <li><a href="#" onclick="$('#additional{{Question.id ? Question.id : random}}').modal('show'); return false;"><i style="font-size:15px;line-height: 17px;" class="material-icons left">settings</i>{{ 'Opties' |trans }}</a></li>
  183.                     {# {% endif %} #}
  184.                     <li class="jq-dropdown-divider"></li>
  185.                     <li><a href="#5" onclick="deleteQuestion({{Question.id ? Question.id : random}});" class="red-text delete"><i style="font-size:15px;line-height: 17px;" class="material-icons left">clear</i>{{ 'Vraag verwijderen' | trans }}</a></li>
  186.                     <li><a data-disabled="true" class="grey-text"><i style="font-size:15px;line-height: 17px;" class="material-icons left">info_outline</i>{{ 'Vraag ID:' | trans ~ ' ' ~ Question.id}}</a></li>
  187.                 </ul>
  188.             </div>
  189.         {% endif %}
  190.         {% if loadForm is not defined %}
  191.         </div>
  192.     </div>
  193. {% endif %}
  194. {% if edit is defined %}
  195.     <script>
  196.         $('#jq-dropdown-{{Question.id ? Question.id : random}}').on('show', function (event, dropdownData) {
  197.             $('body').addClass('jq-dd');
  198.         }).on('hide', function (event, dropdownData) {
  199.             $('body').removeClass('jq-dd');
  200.         });
  201.         CKEDITOR.disableAutoInline = true;
  202.     </script>
  203. {% endif %}