{% load i18n %}

    <div class="modal" id="schemas-form-modal" tabindex="-1">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" tabindex="-1">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title">
                        {% trans 'Update schema' %}
                    </h4>
                </div>

                <div class="modal-body">
                    <div class="row">
                        <formgroup
                            class="col-md-8"
                            data-id="name"
                            data-type="text"
                            data-label="{{ meta.Schema.name.verbose_name }}"
                            data-help="{{ meta.Schema.name.help_text }}"
                            data-model="service.values.name"
                            data-errors="service.errors.name">
                        </formgroup>
                        <formgroup
                            class="col-md-4"
                            data-id="order"
                            data-type="number"
                            data-label="{{ meta.Schema.order.verbose_name }}"
                            data-help="{{ meta.Schema.order.help_text }}"
                            data-model="service.values.order"
                            data-errors="service.errors.order">
                        </formgroup>
                    </div>
                    <formgroup
                        data-id="title"
                        data-type="text"
                        data-label="{{ meta.Schema.title.verbose_name }}"
                        data-help="{{ meta.Schema.title.help_text }}"
                        data-model="service.values.title"
                        data-errors="service.errors.title">
                    </formgroup>
                    <formgroup
                        data-id="description"
                        data-type="textarea"
                        data-label="{{ meta.Schema.description.verbose_name }}"
                        data-help="{{ meta.Schema.description.help_text }}"
                        data-model="service.values.description"
                        data-errors="service.errors.description">
                    </formgroup>
                    <div class="row">
                        <formgroup
                            class="col-md-4"
                            data-id="license"
                            data-type="select"
                            data-label="{{ meta.Schema.license.verbose_name }}"
                            data-help="{{ meta.Schema.license.help_text }}"
                            data-model="service.values.license"
                            data-errors="service.errors.license"
                            data-options="service.licenses"
                            data-options-label="text">
                        </formgroup>
                        <formgroup
                            class="col-md-4"
                            data-id="doi"
                            data-type="text"
                            data-label="{{ meta.Schema.doi.verbose_name }}"
                            data-help="{{ meta.Schema.doi.help_text }}"
                            data-model="service.values.doi"
                            data-errors="service.errors.doi">
                        </formgroup>
                        <formgroup
                            class="col-md-4"
                            data-id="utype"
                            data-type="text"
                            data-label="{{ meta.Schema.utype.verbose_name }}"
                            data-help="{{ meta.Schema.utype.help_text }}"
                            data-model="service.values.utype"
                            data-errors="service.errors.utype">
                        </formgroup>
                    </div>
                    <div class="row">
                        <formgroup
                            class="col-md-6"
                            data-id="published"
                            data-type="date"
                            data-label="{{ meta.Schema.published.verbose_name }}"
                            data-help="{{ meta.Schema.published.help_text }}"
                            data-model="service.values.published"
                            data-errors="service.errors.published">
                        </formgroup>
                        <formgroup
                            class="col-md-6"
                            data-id="updated"
                            data-type="date"
                            data-label="{{ meta.Schema.updated.verbose_name }}"
                            data-help="{{ meta.Schema.updated.help_text }}"
                            data-model="service.values.updated"
                            data-errors="service.errors.updated">
                        </formgroup>
                    </div>
                    <div class="row">
                        <formgroup
                            class="col-md-6"
                            data-id="access_level"
                            data-type="select"
                            data-label="{{ meta.Schema.access_level.verbose_name }}"
                            data-help="{{ meta.Schema.access_level.help_text }}"
                            data-model="service.values.access_level"
                            data-errors="service.errors.access_level"
                            data-options="service.accesslevels"
                            data-options-label="text">
                        </formgroup>
                        <formgroup
                            class="col-md-6"
                            data-id="metadata_access_level"
                            data-type="select"
                            data-label="{{ meta.Schema.metadata_access_level.verbose_name }}"
                            data-help="{{ meta.Schema.metadata_access_level.help_text }}"
                            data-model="service.values.metadata_access_level"
                            data-errors="service.errors.metadata_access_level"
                            data-options="service.accesslevels"
                            data-options-label="text">
                        </formgroup>
                    </div>
                    <formgroup
                        data-id="groups"
                        data-type="multicheckbox"
                        data-label="{% trans 'Groups with access' %}"
                        data-model="service.values.groups"
                        data-errors="service.errors.groups"
                        data-options="service.groups"
                        data-options-label="name"
                        data-options-empty="{% trans 'no groups available' %}">
                    </formgroup>
                    <div ng-hide="service.values.id">
                        <formgroup
                            data-id="discover"
                            data-type="checkbox"
                            data-label="{% trans 'Automatically discover tables and columns' %}"
                            data-model="service.values.discover"
                            data-errors="service.errors.discover">
                        </formgroup>
                    </div>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        {% trans 'Close' %}
                    </button>
                    <button type="button" class="btn btn-primary"
                            ng-click="service.submitFormModal('schemas')">
                        {% trans 'Save' %}
                    </button>
                </div>
            </div>
        </div>
    </div>
