51 lines
1.3 KiB
HTML
51 lines
1.3 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block content %}
|
|
<script>
|
|
function sendquote(id) {
|
|
select = document.getElementById("space_option");
|
|
space_id = select[select.selectedIndex].value;
|
|
space_name = select[select.selectedIndex].text;
|
|
if (space_id === "NaN") {
|
|
alert("Please select a space");
|
|
return
|
|
}
|
|
|
|
let confirmation = confirm(`Send quote to ${space_name}`)
|
|
if (confirmation === true) {
|
|
let send_url = "{{ url_for('chatbot.send_quote', space='AAAAAA', _external=True) }}"
|
|
send_url = send_url.replace("AAAAAA",space_id)
|
|
fetch(send_url, {method: "POST",headers: {"Content-Type": "application/json"},body: JSON.stringify({"quote_id": id})})
|
|
.then((response) => console.log(response))
|
|
}
|
|
|
|
}
|
|
</script>
|
|
<div >
|
|
<h3 class="title">Quotes</h3>
|
|
<div >
|
|
{% with messages = get_flashed_messages() %}
|
|
{% if messages %}
|
|
<div class="notification is-danger">
|
|
{{ messages[0] }}
|
|
</div>
|
|
{% endif %}
|
|
{% endwith %}
|
|
<table class="table">
|
|
{% for quote in quotes %}
|
|
<tr>
|
|
<td class=" is-primary" style="text-align: left">
|
|
{{ quote[0] }}
|
|
</td>
|
|
{% if current_user.administrator %}
|
|
<td class="is-primary"><button class="is-primary button" onclick='sendquote({{ quote[1] }})' type="submit">Send</button></td>
|
|
{% endif %}
|
|
</tr>
|
|
{% endfor %}
|
|
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
{% endblock %}
|