Files
GIA/core/templates/partials/whatsapp-account-add.html

46 lines
2.0 KiB
HTML

<div class="whatsapp-account-add-fragment">
{% if object.ok %}
<img src="data:image/png;base64, {{ object.image_b64 }}" alt="WhatsApp QR code" />
{% if object.warning %}
<p class="is-size-7" style="margin-top: 0.6rem;">{{ object.warning }}</p>
{% endif %}
{% if object.debug_lines %}
<article class="notification is-light" style="margin-top: 0.6rem; margin-bottom: 0;">
<p><strong>Runtime Debug</strong></p>
<pre class="is-size-7" style="white-space: pre-wrap; margin: 0.4rem 0 0;">{% for line in object.debug_lines %}{{ line }}
{% endfor %}</pre>
</article>
{% endif %}
{% else %}
<article class="notification is-warning is-light" style="margin-bottom: 0;">
<p><strong>WhatsApp QR Not Ready.</strong></p>
<p>{{ object.error|default:"No Neonize pairing QR is available yet." }}</p>
{% if object.warning %}
<p style="margin-top: 0.45rem;">{{ object.warning }}</p>
{% endif %}
{% if object.pending %}
<p class="is-size-7" style="margin-top: 0.5rem;">
Waiting for Neonize QR event. This panel will refresh automatically.
</p>
<form
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-post="{{ detail_url }}"
hx-target="closest .whatsapp-account-add-fragment"
hx-swap="outerHTML"
hx-trigger="load delay:1800ms">
{% csrf_token %}
<input type="hidden" name="device" value="{{ object.device|default:'GIA Device' }}" />
<input type="hidden" name="refresh" value="1" />
</form>
{% endif %}
{% if object.debug_lines %}
<article class="notification is-light" style="margin-top: 0.6rem; margin-bottom: 0;">
<p><strong>Runtime Debug</strong></p>
<pre class="is-size-7" style="white-space: pre-wrap; margin: 0.4rem 0 0;">{% for line in object.debug_lines %}{{ line }}
{% endfor %}</pre>
</article>
{% endif %}
</article>
{% endif %}
</div>