{% extends 'base.html' %}
{% from "macros.html" import render_field %}

{% block title %}Specialist Magic Link URLs{% endblock %}

{% block content_title %}Specialist Magic Link URLs{% endblock %}
{% block content_description %}View URL and QR Code for a Magic Link{% endblock %}

{% block content %}
    <form method="post">
        {{ form.hidden_tag() }}
        {%  set disabled_fields = [] %}
        {%  set exclude_fields = [] %}
        {% for field in form %}
            {% if field.name == 'qr_code_url' and field.data %}
                <div class="form-group">
                    <label for="{{ field.id }}">{{ field.label.text }}</label>
                    <div style="max-width: 200px;">
                        <img src="{{ field.data }}" alt="QR Code" class="img-fluid">
                    </div>
                    <input type="hidden" name="{{ field.name }}" value="{{ field.data|e }}">
                </div>
            {% elif field.name == 'chat_client_url' %}
                <div class="form-group">
                    <label for="{{ field.id }}" class="form-label">{{ field.label.text }}</label>
                    <div class="input-group">
                        <input type="text" class="form-control" value="{{ field.data }}" id="{{ field.id }}" readonly>
                        <a href="{{ field.data }}" class="btn btn-primary" target="_blank">Open link</a>
                    </div>
                    <input type="hidden" name="{{ field.name }}" value="{{ field.data|e }}">
                </div>
            {% else %}
                {{ render_field(field, disabled_fields, exclude_fields) }}
            {% endif %}
        {% endfor %}
    </form>
{% endblock %}

{% block content_footer %}

{% endblock %}
