lean-api/view/lean-api/form_descriptor.phtml
Dave M 9b360c4010 - Added a new ArrayCollection
- Changed Action attribute and transformed it into an abstract class
2026-07-14 14:44:30 +00:00

64 lines
3.6 KiB
PHTML

{% language.set "lean.api.descriptor.form" %}
{% function yesOrNo(bool $toggle) : void %}
<span style="color: {{ $toggle ? 'green' : '#ac1b1b' }}">{{ $toggle ? 'oui' : 'non' }}</span>
{% endfunction %}
<div class="forms">
{% foreach $forms as $name => $form %}
<div class="single-form" style="padding-left:15px;border-left: 3px solid #9ccce6;" data-form="{% json.html $form %}">
<h4 class='form-name'>
<span title="{{ $name }}">{{ $form['className'] }}</span>
</h4>
<div class='description'>{{ $form['description'] }}</div>
<hr style="margin-top:15px">
{% if $form['fields'] %}
<div class="fields-wrapper">
<div class="header-fields">Champs</div>
<ol class='fields'>
{% foreach $form['fields'] as $field %}
<li class="odd-even">
<div class="title">
<div>
<strong style="font-family:monospace">{{ $field['name'] }} {% if $field['mandatory'] %}<span style="color:red">*</span>{% endif %}</strong>
<span style='margin-left:15px'>{{ $field['description'] }}</span>
</div>
</div>
<div class="field-desc" style="margin-top:10px;;background:#fff;padding:5px;font-size:0.9em">
<div><u>Variable POST / champ JSON</u> : {{ $field['name'] }}</div>
<div><u>Type(s)</u> : {{ implode(' | ', array_map(fn($e) => $e->type, $field['type'])) }}</div>
<div><u>Nullable</u> : {{ yesOrNo($field['allowNulls']) }}</div>
{% if $field['regexPattern'] !== null %}
<div><u>Pattern regex</u> : {{ $field['regexPattern'] }}</div>
{% endif %}
{% if $field['minLength'] !== null %}
<div><u>Taille min.</u> : {{ $field['minLength'] }}</div>
{% endif %}
{% if $field['maxLength'] !== null %}
<div><u>Taille max.</u> : {{ $field['maxLength'] }}</div>
{% endif %}
{% if $field['example'] !== null || $field['values'] %}
<div><u>Exemple</u> : {{ $field['example'] }}</div>
{% endif %}
{% if $field['default'] !== null %}
<div><u>Valeur par défaut</u> : {{ $field['default'] }}</div>
{% endif %}
{% if $field['values'] %}
<div><u>Valeurs possibles</u> : [ <u class="enum-value">{{= implode('</u><u class="enum-value">', $field['values']) }}</u> ]</div>
{% endif %}
</div>
</li>
{% endforeach %}
</ol>
</div>
{% else %}
<div class="empty">Aucun champ adressable pour ce context</div>
{% endif %}
</div>
{% or %}
<i style="color:#585858; padding:0 12px">{% _ "none" %}</i>
{% endforeach %}
</div>