{% extends "layout_1_column.html" %}

{% block title %}
<title>{{ topic.identifier|topic_name(topic_map.identifier) }} | {{ topic_map.name }}</title>
{% endblock %}

{% block javascript %}{% endblock %}

{% block content %}
<h1>
    {{ topic.first_base_name.name }}
    <small class="text-muted">Edit topic identifier</small>
</h1>
<hr />
<form
    action="{{ url_for('topic.edit_identifier', map_identifier=topic_map.identifier, topic_identifier=topic.identifier) }}"
    autocomplete="off" method="post" role="form">
    <input name="_csrf_token" type="hidden" value="{{ csrf_token() }}">
    <div class="form-group">
        <label for="current-identifier"><strong>Current identifier</strong></label>
        <input aria-readonly="true" class="form-control" id="current-identifier" name="current-identifier" readonly
            type="text" value="{{ topic_identifier or '' }}">
    </div>
    <div class="form-group">
        <label for="topic-name"><strong>New identifier</strong></label>
        <input class="form-control" id="topic-identifier" name="topic-identifier" placeholder="Enter identifier"
            required autofocus type="text" value="{{ topic_identifier or '' }}">
        {% if error|bitwise_and(2) == 2 %}
        <small class="text-danger">
            A topic with this identifier already exists. Please provide a different topic identifier.
        </small>
        {% endif %}
    </div>
    <a class="btn btn-secondary"
        href="{{ url_for('topic.view', map_identifier=topic_map.identifier, topic_identifier=topic.identifier) }}"
        role="button">Cancel</a>
    <button class="btn btn-success" type="submit">Update identifier</button>
</form>
<br />
{% endblock %}