<div id="organization-settings" data-name="organization-settings" class="settings-section">
    <form class="form-horizontal admin-realm-form org-settings-form">

        <div id="org-msg-editing" class="org-subsection-parent">
            <div class="subsection-header">
                <h3>{{t "Message editing" }}
                    <a href="/help/configure-message-editing-and-deletion" target="_blank">
                        <i class="fa fa-question-circle-o" aria-hidden="true"></i>
                    </a>
                </h3>
                {{> settings_save_discard_widget section_name="msg-editing" }}
            </div>
            <div class="inline-block organization-settings-parent">
                <div class="input-group">
                    <label for="realm_msg_edit_limit_setting" class="dropdown-title">{{t "Allow message editing" }}</label>
                    <select name="realm_msg_edit_limit_setting" id="id_realm_msg_edit_limit_setting" class="prop-element">
                        {{#each msg_edit_limit_dropdown_values}}
                        <option value="{{0}}">{{1.text}}</option>
                        {{/each}}
                    </select>
                    <div class="dependent-inline-block">
                        <label for="id_realm_message_content_edit_limit_minutes" class="inline-block realm-time-limit-label">
                            {{t 'N' }}:
                        </label>
                        <input type="text" id="id_realm_message_content_edit_limit_minutes"
                          name="realm_message_content_edit_limit_minutes"
                          class="admin-realm-time-limit-input prop-element"
                          autocomplete="off"
                          value="{{ realm_message_content_edit_limit_minutes }}"/>
                    </div>
                </div>

                {{> settings_checkbox
                  setting_name="realm_allow_community_topic_editing"
                  prefix="id_"
                  is_checked=realm_allow_community_topic_editing
                  label=admin_settings_label.realm_allow_community_topic_editing}}

                {{> settings_checkbox
                  setting_name="realm_allow_edit_history"
                  prefix="id_"
                  is_checked=realm_allow_edit_history
                  label=admin_settings_label.realm_allow_edit_history}}

                <div class="input-group">
                    <label for="realm_msg_delete_limit_setting" class="dropdown-title">
                        {{t "Allow message deleting" }}
                        <i class="fa fa-info-circle settings-info-icon realm_allow_message_deleting_tooltip" data-toggle="tooltip"
                          aria-hidden="true" title="{{t 'Administrators can always delete any message.' }}"></i>
                    </label>
                    <select name="realm_msg_delete_limit_setting" id="id_realm_msg_delete_limit_setting" class="prop-element">
                        {{#each msg_delete_limit_dropdown_values}}
                        <option value="{{0}}">{{1.text}}</option>
                        {{/each}}
                    </select>
                    <div class="dependent-inline-block">
                        <label for="id_realm_message_content_delete_limit_minutes" class="inline-block realm-time-limit-label">
                            {{t 'N' }}:
                        </label>
                        <input type="text" id="id_realm_message_content_delete_limit_minutes"
                          name="realm_message_content_delete_limit_minutes"
                          class="admin-realm-time-limit-input prop-element"
                          autocomplete="off"
                          value="{{ realm_message_content_delete_limit_minutes }}"/>
                    </div>
                </div>
            </div>
        </div>

        <div id="org-notifications" class="org-subsection-parent">
            <div class="subsection-header">
                <h3>{{t "Notifications" }}</h3>
                {{> settings_save_discard_widget section_name="notifications" }}
            </div>
            <div class="inline-block organization-settings-parent">
                {{> settings_checkbox
                  setting_name="realm_send_welcome_emails"
                  prefix="id_"
                  is_checked=realm_send_welcome_emails
                  label=admin_settings_label.realm_send_welcome_emails}}
                {{#if settings_send_digest_emails }}
                {{> settings_checkbox
                  setting_name="realm_digest_emails_enabled"
                  prefix="id_"
                  is_checked=realm_digest_emails_enabled
                  label=admin_settings_label.realm_digest_emails_enabled}}
                {{/if}}
                <div class="input-group">
                    <label for="realm_digest_weekday" class="dropdown-title">{{t "Day of the week to send digests" }}</label>
                    <select name="realm_digest_weekday"
                      id="id_realm_digest_weekday"
                      class="setting-widget prop-element"
                      data-setting-widget-type="integer">
                        <option value="0">{{t "Monday" }}</option>
                        <option value="1">{{t "Tuesday" }}</option>
                        <option value="2">{{t "Wednesday" }}</option>
                        <option value="3">{{t "Thursday" }}</option>
                        <option value="4">{{t "Friday" }}</option>
                        <option value="5">{{t "Saturday" }}</option>
                        <option value="6">{{t "Sunday" }}</option>
                    </select>
                </div>
            </div>

            {{> dropdown_list_widget
              setting_name="realm_notifications_stream_id"
              list_placeholder=(t 'Filter streams')
              reset_button_text=(t '[Disable]')
              label=admin_settings_label.realm_notifications_stream }}

            {{> dropdown_list_widget
              setting_name="realm_signup_notifications_stream_id"
              list_placeholder=(t 'Filter streams')
              reset_button_text=(t '[Disable]')
              label=admin_settings_label.realm_notifications_stream }}

        </div>

        <div id="org-user-defaults" class="org-subsection-parent">
            <div class="subsection-header">
                <h3>{{t "Default user settings" }}</h3>
                {{> settings_save_discard_widget section_name="user-defaults" }}
            </div>
            <p>{{t "Default settings for new users joining this organization." }}</p>
            <div class="inline-block organization-settings-parent">
                <div class="input-group">
                    <label for="realm_default_language" class="dropdown-title">{{t "Default language" }}</label>
                    <select name="realm_default_language" class ="setting-widget prop-element" id="id_realm_default_language" data-setting-widget-type="text">
                        {{#each language_list}}
                        <option value='{{this.code}}'>{{this.name}}</option>
                        {{/each}}
                    </select>
                </div>
                <div class="input-group">
                    <label for="realm_default_twenty_four_hour_time" class="dropdown-title">{{ admin_settings_label.realm_default_twenty_four_hour_time }}</label>
                    <select name="realm_default_twenty_four_hour_time" class ="setting-widget prop-element" id="id_realm_default_twenty_four_hour_time" data-setting-widget-type="text">
                        {{#each realm_default_twenty_four_hour_time_values}}
                        <option value='{{ this.value }}'>{{ this.description }}</option>
                        {{/each}}
                    </select>
                </div>
            </div>
        </div>

        <div id="org-other-settings" class="org-subsection-parent">
            <div class="subsection-header">
                <h3>{{t "Other settings" }}</h3>
                {{> settings_save_discard_widget section_name="other-settings" }}
            </div>
            <div class="inline-block organization-settings-parent">
                <div class="input-group">
                    <label for="realm_video_chat_provider" class="dropdown-title">
                        {{t 'Video chat provider' }}
                    </label>
                    <select name="realm_video_chat_provider" class ="setting-widget prop-element" id="id_realm_video_chat_provider" data-setting-widget-type="integer">
                        {{#each realm_available_video_chat_providers}}
                        <option value='{{this.id}}'>{{this.name}}</option>
                        {{/each}}
                    </select>
                    <div id="google_hangouts_domain">
                        <label>{{t 'Domain for your <a href="https://gsuite.google.com" target="_blank">G Suite team</a> (required)' }}:</label>
                        <input type="text" id="id_realm_google_hangouts_domain"
                          name="realm_google_hangouts_domain"
                          autocomplete="off"
                          class="admin-realm-google-hangouts-domain setting-widget prop-element"
                          data-setting-widget-type="text"/>
                    </div>
                    <div id="zoom_help_text" class="zoom_credentials">
                        <p>
                            Note: Zoom support is experimental. In particular, Zulip currently supports having
                            only one active Zoom meeting at a time.
                        </p>
                    </div>
                    <div id="zoom_user_id" class="zoom_credentials">
                        <label>{{t 'Zoom user ID or email address (required)' }}:</label>
                        <input type="text" id="id_realm_zoom_user_id"
                          name="realm_zoom_user_id"
                          autocomplete="off"
                          class="admin-realm-zoom-field setting-widget prop-element"
                          data-setting-widget-type="text"/>
                    </div>
                    <div id="zoom_api_key" class="zoom_credentials">
                        <label>{{t 'Zoom API key (required)' }}:</label>
                        <input type="text" id="id_realm_zoom_api_key"
                          name="realm_zoom_api_key"
                          autocomplete="off"
                          class="admin-realm-zoom-field setting-widget prop-element"
                          data-setting-widget-type="text"/>
                    </div>
                    <div id="zoom_api_secret" class="zoom_credentials">
                        <label>{{t 'Zoom API secret (required if changed)' }}:</label>
                        <input type="text" id="id_realm_zoom_api_secret"
                          name="realm_zoom_api_secret"
                          autocomplete="off"
                          class="admin-realm-zoom-field setting-widget prop-element"
                          data-setting-widget-type="text"/>
                    </div>
                </div>

                {{> dropdown_list_widget
                  setting_name="realm_default_code_block_language"
                  list_placeholder=(t 'Filter languages')
                  reset_button_text=(t '[Unset]')
                  label=admin_settings_label.realm_default_code_block_language }}

                {{> settings_checkbox
                  setting_name="realm_message_content_allowed_in_email_notifications"
                  prefix="id_"
                  is_checked=realm_message_content_allowed_in_email_notifications
                  label=admin_settings_label.realm_message_content_allowed_in_email_notifications}}

                {{#if false}}
                <div class="input-group">
                    <label for="realm_message_retention_days"
                      id="id_realm_message_retention_days_label">
                        {{t 'Messages retention period in days (blank means messages are retained forever)' }}
                    </label>
                    <input type="text" id="id_realm_message_retention_days"
                      name="realm_message_retention_days"
                      class="admin-realm-message-retention-days prop-element"
                      value="{{ realm_message_retention_days }}"/>
                </div>
                {{/if}}
                {{> settings_checkbox
                  setting_name="realm_mandatory_topics"
                  prefix="id_"
                  is_checked=realm_mandatory_topics
                  label=admin_settings_label.realm_mandatory_topics}}

                {{#if server_inline_image_preview}}
                {{> settings_checkbox
                  setting_name="realm_inline_image_preview"
                  prefix="id_"
                  is_checked=realm_inline_image_preview
                  label=admin_settings_label.realm_inline_image_preview
                  help_link="/help/allow-image-link-previews"}}
                {{/if}}

                {{#if server_inline_url_embed_preview}}
                {{> settings_checkbox
                  setting_name="realm_inline_url_embed_preview"
                  prefix="id_"
                  is_checked=realm_inline_url_embed_preview
                  label=admin_settings_label.realm_inline_url_embed_preview
                  help_link="/help/allow-image-link-previews"}}
                {{/if}}
            </div>
        </div>
    </form>
</div>
