{#
/*
 * Spring Signage Ltd - http://www.springsignage.com
 * Copyright (C) 2015 Spring Signage Ltd
 * (${FILE_NAME})
 */
#}

{% extends "form-base.twig" %}
{% import "forms.twig" as forms %}

{% block formTitle %}
    {% trans "Add HLS Video Stream" %}
{% endblock %}

{% block formButtons %}
    {% trans "Help" %}, XiboHelpRender("{{ help }}")
    {% trans "Cancel" %}, XiboDialogClose()
    {% trans "Save" %}, $("#hlsAddForm").submit()
{% endblock %}

{% block formFieldActions %}
    [{
    "field": "useDuration",
    "trigger": "init",
    "value": false,
    "operation": "is:checked",
    "actions": {
    ".duration-fields": { "display": "none" }
    }
    },{
    "field": "useDuration",
    "trigger": "change",
    "value": false,
    "operation": "is:checked",
    "actions": {
    ".duration-fields": { "display": "none" }
    }
    },{
    "field": "useDuration",
    "trigger": "init",
    "value": true,
    "operation": "is:checked",
    "actions": {
    ".duration-fields": { "display": "block" }
    }
    },{
    "field": "useDuration",
    "trigger": "change",
    "value": true,
    "operation": "is:checked",
    "actions": {
    ".duration-fields": { "display": "block" }
    }
    }]
{% endblock %}

{% block formHtml %}
    <div class="row">
        <div class="col-md-12">
            <form id="hlsAddForm" class="XiboForm form-horizontal" method="post" action="{{ urlFor("module.widget.add", {type: module.widget.type, id: playlist.playlistId}) }}">
                {% set title %}{% trans "Video Path" %}{% endset %}
                {% set helpText %}{% trans "A URL to the HLS video stream. Requires Player running Windows 8.1 or later, or Android 6 or later. Earlier Android devices may play HLS via the LocalVideo widget." %}{% endset %}
                {{ forms.input("uri", title, "", helpText, "", "required") }}

                {% set title %}{% trans "Set a duration?" %}{% endset %}
                {% set helpText %}{% trans "Select to provide a specific duration for this Widget" %}{% endset %}
                {{ forms.checkbox("useDuration", title, 0, helpText) }}

                {% set title %}{% trans "Duration" %}{% endset %}
                {% set helpText %}{% trans "The duration in seconds this should be displayed" %}{% endset %}
                {{ forms.number("duration", title, module.getModule().defaultDuration, helpText, "duration-fields", "required") }}

                {% set title %}{% trans "Mute?" %}{% endset %}
                {% set helpText %}{% trans "Should the video be muted?" %}{% endset %}
                {{ forms.checkbox("mute", title, 0, helpText, "mute-fields") }}
            </form>
        </div>
    </div>
{% endblock %}