Added quote changes and a launch.json

This commit is contained in:
Benjamyn Love 2023-03-16 15:04:15 +11:00
parent 23c3aa97dd
commit dbcdb61680
3 changed files with 66 additions and 13 deletions

24
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,24 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "priceybot2",
"FLASK_DEBUG": "1"
},
"args": [
"run",
"--host=0.0.0.0"
],
"jinja": true,
"justMyCode": true
}
]
}

View File

@ -5,6 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pricey Bot</title>
<script src="https://kit.fontawesome.com/4b444ef337.js" crossorigin="anonymous"></script>
<script type="application/javascript" src="{{ url_for('static', filename='scripts/dark-mode.js', version='0.1') }}"></script>
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css', version='0.1') }}">
</head>
@ -15,7 +16,27 @@
<nav class="navbar">
<div class="container">
<div id="navbarMenuHeroA" class="navbar-menu">
<div class="navbar-start">
{% if current_user.is_authenticated %}
<span class="navbar-item">{{ current_user.name }} is logged in{% if current_user.administrator %}<br/><span class="navbar-item icon p-4">
<i class="fas fa-screwdriver-wrench"></i>
</span></span>
{% endif %}
{% endif %}
</div>
<div class="navbar-end">
{% if space_list is defined %}
<div class="select is-primary navbar-item m-4 p-4" >
<select name="space" id="space_option">
<option selected="selected" value="NaN">Please selelct a space!</option>
{% for i in space_list %}
<option value="{{ i[0] }}">{{ i[1] }}</option>
{% endfor %}
</select>
</div>
{% endif %}
<a href="{{ url_for('main.index') }}" class="navbar-item">
Home
</a>
@ -36,16 +57,7 @@
<a href="{{ url_for('auth.logout') }}" class="navbar-item">
Logout
</a>
{% if space_list is defined %}
<div class="select is-primary" >
<select name="space" id="space">
{% for i in space_list %}
<option value="{{ i[0] }}">{{ i[1] }}</option>
{% endfor %}
</select>
</div>
{% endif %}
{% endif %}
</div>
</div>
@ -66,5 +78,6 @@
</label>
</div>
</section>
</body>
</html>

View File

@ -3,8 +3,22 @@
{% block content %}
<script>
function sendquote(id) {
let space="AAAAi8Ave9c";
alert("{{ url_for('chatbot.send_quote', space='AAAAi8Ave9c', _external=True) }}");
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 >
@ -23,7 +37,9 @@
<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 %}