From aff53e072502d63d8002d9c83213ce7f9d12c352 Mon Sep 17 00:00:00 2001 From: Justin Choquette Date: Wed, 27 Sep 2023 17:03:38 -0400 Subject: user subsystem clean up Change-Id: Ia59bb7c1e4412693f55cdcaf9607bcb4158850ae Signed-off-by: Justin Choquette --- src/templates/base/account/booking_list.html | 27 ++-- src/templates/base/account/resource_list.html | 24 +++- src/templates/base/account/settings.html | 181 ++++++++++++++++--------- src/templates/base/booking/booking_detail.html | 28 ++-- src/templates/base/dashboard/landing.html | 89 ++++++++++-- src/templates/base/workflow/book_a_pod.html | 67 +++++++-- 6 files changed, 301 insertions(+), 115 deletions(-) (limited to 'src/templates') diff --git a/src/templates/base/account/booking_list.html b/src/templates/base/account/booking_list.html index 2af3915..c6702c9 100644 --- a/src/templates/base/account/booking_list.html +++ b/src/templates/base/account/booking_list.html @@ -97,16 +97,23 @@ } async function submit_cancel_form() { - var ajaxForm = $("#booking_cancel_form"); - var formData = ajaxForm.serialize(); - req = new XMLHttpRequest(); - var url = "cancel/" + current_booking_id; - req.open("POST", url, true); - req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - req.onerror = function() { alert("problem submitting form"); } - req.send(formData); - await new Promise(r => setTimeout(r, 500)); // Quickest solution I could come up with to give liblaas time to mark it as deleted until we do an api rework - location.reload(); + let data = {"booking_id": current_booking_id} + $.ajax({ + url: '', + type: 'post', + data: JSON.stringify(data), + headers: { + 'X-CSRFToken': document.getElementsByName('csrfmiddlewaretoken')[0].value, + 'Content-Type': 'application/json' + }, + dataType: 'text', + }) + .done(function() { + location.reload() + }) + .fail(function() { + alert("Unable to cancel booking.") + }) } diff --git a/src/templates/base/account/resource_list.html b/src/templates/base/account/resource_list.html index c16fd07..c44e974 100644 --- a/src/templates/base/account/resource_list.html +++ b/src/templates/base/account/resource_list.html @@ -1,6 +1,5 @@ {% extends "base.html" %} {% block extrahead %} - {% endblock %} {% block content %}
@@ -42,12 +41,25 @@ } async function submit_delete_form() { - if(LibLaaSAPI.deleteTemplate(current_resource_id)) { - location.reload(); - } else { - alert('Unable to delete template.'); - } + let data = {"template_id": current_resource_id} + $.ajax({ + url: '', + type: 'post', + data: JSON.stringify(data), + headers: { + 'X-CSRFToken': document.getElementsByName('csrfmiddlewaretoken')[0].value, + 'Content-Type': 'application/json' + }, + dataType: 'text', + }) + .done(function() { + location.reload() + }) + .fail(function() { + alert("Unable to delete resource.") + }) } + {% endblock content %} diff --git a/src/templates/base/workflow/book_a_pod.html b/src/templates/base/workflow/book_a_pod.html index 5c1a253..6c79bfe 100644 --- a/src/templates/base/workflow/book_a_pod.html +++ b/src/templates/base/workflow/book_a_pod.html @@ -114,14 +114,21 @@
+ + @@ -145,10 +152,52 @@ {% endblock %} -- cgit 1.2.3-korg