<div class="modal fade" id="add-widget-modal" tabindex="-1" role="dialog" aria-labelledby="add-widget-modal-title"
    aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="add-widget-modal-title">Add New Widget</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <form>
                <div class="modal-body">
                    <div class="form-group row">
                        <label class="col-form-label col-sm-3" for="widget-name-input">
                            <b>Widget Name</b>:
                        </label>
                        <div class="col-sm-5">
                            <input maxlength="32" minlength="4" required name="name" type="text" class="form-control" id="widget-name-input">
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-form-label col-sm-3" for="widget-type-select">
                            <b>Widget Type</b>:
                        </label>
                        <div class="col-sm-5">
                            <select required name="type" class="form-control" id="widget-type-select">
                                {% for key, type in pairs(widgets_type) do %}
                                    <option value="{* key *}">{* type.i18n *}</option>
                                {% end %}
                            </select>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-form-label col-sm-3" for="widget-ds-source-select">
                            <b>Datasource</b>:
                        </label>
                        <div class="col-sm-5">
                            <select required name="ds_hash" class="form-control" id="widget-ds-source-select">
                                {% for _, ds in ipairs(datasources) do %}
                                    <option value="{* ds.hash *}">{* ds.alias *}</option>
                                {% end %}
                            </select>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="col-form-label col-sm-3" for="widget-interface-select">
                            <b>Interface</b>:
                        </label>
                        <div class="col-sm-5">
                            <select required name="interface" class="form-control" id="widget-interface-select">
                                {% for key, iface in pairsByKeys(interfaces, asc) do %}
                                    <option value="{* key *}">{* iface *}</option>
                                {% end %}
                            </select>
                        </div>
                        <label class="col-form-label col-sm-2">
                            ($ifid)
                        </label>
                    </div>
                    <div class="form-group row">
                        <label class="col-form-label col-sm-3" for="widget-key-input">
                            Key:
                        </label>
                        <div class="col-sm-5">
                            <input max="32" min="1" name="key" type="text" class="form-control" id="widget-key-input">
                        </div>
                        <label class="col-form-label col-sm-2">
                            ($key)
                        </label>
                    </div>
                    <div class="form-group row">
                        <label class="col-form-label col-sm-3" for="widget-begin-time-input">
                            Begin Time:
                        </label>
                        <div class="col-sm-5">
                            <input minlength="1" name="begin_time" type="text" class="form-control" id="widget-begin-time-input">
                        </div>
                        <label class="col-form-label col-sm-2">
                            ($begin_time)
                        </label>
                    </div>
                    <div class="form-group row">
                        <label class="col-form-label col-sm-3" for="widget-end-time-input">
                            End Time:
                        </label>
                        <div class="col-sm-5">
                            <input minlength="1" name="end_time" type="text" class="form-control" id="widget-end-time-input">
                        </div>
                        <label class="col-form-label col-sm-2">
                            ($end_time)
                        </label>
                    </div>

                    <span class="invalid-feedback"></span>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
                    <button type="submit" class="btn btn-primary">Add</button>
                </div>
            </form>
        </div>
    </div>
</div>