{% extends "views/components/widgets/base.htm" %}
{% load i18n %}

{% block form %}
<div class="row widget-wrapper" data-bind="class: nodeCssClasses">
    <div class="form-group">
        <span class="control-label widget-input-label" data-bind="text:label, class: nodeCssClasses"></span>
        <!-- ko if: node -->
        <i data-bind="css: {'ion-asterisk widget-label-required': node.isrequired}"></i>
        <!-- /ko -->
        <div class="col-xs-12 resource-instance-wrapper" data-bind="class: nodeCssClasses">
            <select style="display:inline-block;"
                data-bind="
                    disable: disabled,
                    select2Query: {
                        select2Config: select2Config
                    },
                    attr: {'data-label': label}
                ">
        </div>
    </div>
</div>
{% endblock form %}

{% block config_form %}
<div>
    <div class="control-label">
        <span data-bind="text: $root.translations.placeholder"></span>
    </div>
    <div class="col-xs-12 pad-no crud-widget-container">
        <input
            class="form-control input-md widget-input"
            data-bind="
                attr: {placeholder: $root.translations.placeholder, 'aria-label': $root.translations.placeholder},
                value: placeholder,
                valueUpdate: 'keyup'
            "
        >
    </div>
</div>
<div class="control-label">
    <span data-bind="text: $root.translations.defaultValue"></span>
</div>
<div>
    <div class="form-group">
        <div class="col-xs-12 resource-instance-wrapper">
            <select style="display:inline-block;"
                data-bind="
                    select2Query: {
                        select2Config: select2Config
                    },
                    attr: {'data-label': $root.translations.defaultValue}
                ">
        </div>
    </div>
</div>
{% endblock config_form %}

{% block report %}
<dt data-bind="text: label, class: nodeCssClasses"></dt>
<!-- ko foreach: valueObjects -->
    <dd data-bind="text: name, class: $parent.nodeCssClasses">
    </dd>
<!-- /ko -->
<!-- ko if: valueObjects().length === 0 -->
<dd data-bind="class: nodeCssClasses">
    <span data-bind="text: $root.translations.none"></span>
</dd>
<!-- /ko -->
{% endblock report %}
