Skip to content
Snippets Groups Projects
Commit 564c9a7a authored by Seb Barnard's avatar Seb Barnard :speech_balloon:
Browse files

Fixed key information updating, added loading + success messages

parent e3f95a6a
Branches
No related tags found
2 merge requests!114LoggingService service class, new method to add a log to the "Logs" table when...,!112Issue thirty seven
src/main/resources/static/imgs/uploaded/0998cd76_0b99_40de_8ed0_3c8a6f0fa097.png

35.3 KiB

src/main/resources/static/imgs/uploaded/0cc539d8_4a87_4756_8d75_0e33c2bdf40e.jpg

10.1 KiB

src/main/resources/static/imgs/uploaded/6d59ca26_4438_4db0_948f_aaf8c81ec188.png

114 KiB

src/main/resources/static/imgs/uploaded/c19d7850_e484_4649_92bd_acf558d68811.png

114 KiB

src/main/resources/static/imgs/uploaded/ca7344f3_9ce2_47b0_9c9d_c079cf3185bd.png

114 KiB

......@@ -15,15 +15,33 @@ async function submitFile(inputName) {
}
};
xhttp.send(formData);
}else{
reject("")
}
})
}
async function submitInfo(shopId) {
let bannerName = await submitFile("bannerInput");
let logoName = await submitFile("logoInput")
document.getElementById("saveInfoButton").classList.add("is-loading")
let bannerName, logoName
try{
bannerName = await submitFile("bannerInput");
}catch(e){
console.log(e)
bannerName = ""
}
try{
logoName = await submitFile("logoInput");
}catch(e){
console.log(e)
logoName = ""
}
var xhttp = new XMLHttpRequest();
let params = "shopId=" + shopId
params += "&shopName=" + encodeURIComponent(document.getElementById("nameInput").value)
params += "&shopDescription=" + encodeURIComponent(document.getElementById("descriptionInput").value)
......@@ -34,7 +52,9 @@ async function submitInfo(shopId) {
xhttp.onload = function () {
if (xhttp.readyState === 4 && xhttp.status === 200) {
var response = xhttp.responseText
if (response == "success") {
if (response == "OK") {
document.getElementById("saveInfoButton").classList.remove("is-loading")
document.getElementById("infoSuccess").innerHTML = "Changes Saved!"
} else {
}
} else {
......
......@@ -47,7 +47,8 @@
</label>
</div>
<button th:onclick="'submitInfo('+ ${shop.shopId} +');'" class="button is-link" style="margin-top:15px; margin-bottom:10px;">Save changes</button>
<button id="saveInfoButton" th:onclick="'submitInfo('+ ${shop.shopId} +');'" class="button is-link" style="margin-top:15px; margin-bottom:10px;">Save changes</button>
<p class="help is-success" id="infoSuccess"></p>
</div>
<p style="border-bottom: #000000 1px solid;"></p>
</body>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment