Skip to content

Commit 38a97ab

Browse files
reolve the issue in service request button.
1 parent 427c02e commit 38a97ab

File tree

2 files changed

+34
-41
lines changed

2 files changed

+34
-41
lines changed

app/static/js/service_requests.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -131,26 +131,23 @@ fields.innerHTML = "";
131131
switch(queryType){
132132

133133
case "CHANGE_PIN":
134-
135-
fields.innerHTML = `
136-
<input type="password" id="new_pin" placeholder=" " class="peer w-full bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-white border border-gray-300 dark:border-gray-600 rounded-2xl px-5 pt-7 pb-3 focus:ring-2 focus:ring-cyan-500 focus:border-transparent outline-none transition-all font-medium">
137-
<label class="absolute left-5 top-2.5 text-gray-500 dark:text-gray-400 text-xs font-semibold uppercase tracking-wider transition-all peer-placeholder-shown:top-4 peer-placeholder-shown:text-sm peer-placeholder-shown:normal-case peer-placeholder-shown:tracking-normal peer-focus:top-2.5 peer-focus:text-xs peer-focus:uppercase peer-focus:tracking-wider peer-focus:text-cyan-500">New PIN</label>
138-
<button type="button" id="toggleIcon" onclick="togglePin()" class="absolute right-5 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 text-xl">👁️</button>
139-
`;
140-
141-
button.onclick("submitRequest('CHANGE_PIN')");
142-
143-
break;
134+
fields.innerHTML = `
135+
<input type="password" id="new_pin" placeholder=" " class="peer w-full bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-white border border-gray-300 dark:border-gray-600 rounded-2xl px-5 pt-7 pb-3 focus:ring-2 focus:ring-cyan-500 focus:border-transparent outline-none transition-all font-medium">
136+
<label class="absolute left-5 top-2.5 text-gray-500 dark:text-gray-400 text-xs font-semibold uppercase tracking-wider transition-all peer-placeholder-shown:top-4 peer-placeholder-shown:text-sm peer-placeholder-shown:normal-case peer-placeholder-shown:tracking-normal peer-focus:top-2.5 peer-focus:text-xs peer-focus:uppercase peer-focus:tracking-wider peer-focus:text-cyan-500">New PIN</label>
137+
<button type="button" id="toggleIcon" onclick="togglePin()" class="absolute right-5 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 text-xl">👁️</button>
138+
`;
139+
button.addEventListener(onclick,submitRequest('CHANGE_PIN'));
140+
141+
break;
144142

145143
case "CHANGE_ACCOUNT_NAME":
146-
147-
fields.innerHTML = `
148-
<input type="text" id="new_name" class="peer w-full bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-white border border-gray-300 dark:border-gray-600 rounded-2xl px-5 pt-7 pb-3 focus:ring-2 focus:ring-cyan-500 focus:border-transparent outline-none transition-all font-medium">
149-
<label class="absolute left-5 top-2.5 text-gray-500 dark:text-gray-400 text-xs font-semibold uppercase tracking-wider transition-all peer-placeholder-shown:top-4 peer-placeholder-shown:text-sm peer-placeholder-shown:normal-case peer-placeholder-shown:tracking-normal peer-focus:top-2.5 peer-focus:text-xs peer-focus:uppercase peer-focus:tracking-wider peer-focus:text-cyan-500">New Account Name</label>
150-
`;
151-
button.onclick("submitRequest('CHANGE_ACCOUNT_NAME')");
152-
153-
break;
144+
fields.innerHTML = `
145+
<input type="text" id="new_name" class="peer w-full bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-white border border-gray-300 dark:border-gray-600 rounded-2xl px-5 pt-7 pb-3 focus:ring-2 focus:ring-cyan-500 focus:border-transparent outline-none transition-all font-medium">
146+
<label class="absolute left-5 top-2.5 text-gray-500 dark:text-gray-400 text-xs font-semibold uppercase tracking-wider transition-all peer-placeholder-shown:top-4 peer-placeholder-shown:text-sm peer-placeholder-shown:normal-case peer-placeholder-shown:tracking-normal peer-focus:top-2.5 peer-focus:text-xs peer-focus:uppercase peer-focus:tracking-wider peer-focus:text-cyan-500">New Account Name</label>
147+
`;
148+
button.addEventListener(onclick,submitRequest('CHANGE_ACCOUNT_NAME'));
149+
150+
break;
154151

155152
//NOTE : //h future request query implementation :
156153
// case "UPDATE_CONTACT":
@@ -214,7 +211,9 @@ break;
214211
}
215212

216213
async function submitRequest(query_type){
217-
214+
document.getElementById("dynamic_submit_button").disabled = true;
215+
document.getElementById("btnText").textContent = "Logging in...";
216+
document.getElementById("spinner").classList.remove("hidden");
218217
const fields = document.querySelectorAll("#dynamic_form_fields input, #dynamic_form_fields textarea");
219218

220219
const payload = {};

app/templates/service_requests.html

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -277,19 +277,21 @@ <h2 class="text-xl font-bold text-gray-900 dark:text-white">My Requests</h2>
277277
</table>
278278
</div>
279279
</div>
280-
<!-- Dynamic Request Form -->
281-
<div id="request_form_container" class="hidden fixed inset-0 bg-gray-900/60 dark:bg-gray-950/80 backdrop-blur-xl items-center justify-center z-50 transition-opacity p-4">
282-
<div class="bg-white dark:bg-gray-900 p-8 rounded-[2rem] shadow-2xl w-full max-w-md relative border border-gray-200 dark:border-gray-700 animate-[fadeIn_0.3s_ease-out] dark:shadow-black/50">
283-
<button onclick="closeLoginModal()" class="close-modal absolute top-5 right-5 w-8 h-8 flex items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-white transition-colors">
284-
285-
</button>
286-
<div class="mb-8">
287-
<h2 class="text-3xl font-extrabold text-gray-900 dark:text-white mb-2">Complete Request</h2>
288-
<p class="text-gray-500 dark:text-gray-400 text-sm">Sign in to your dashboard</p>
289-
</div>
290-
<form class="flex flex-col gap-5">
291-
<div id="dynamic_form_fields" class="relative group"></div>
292-
<button id="dynamic_submit_button" class="btn-glow w-full bg-gradient-to-r from-blue-600 to-cyan-500 text-white py-4 rounded-2xl font-bold text-lg hover:from-blue-700 hover:to-cyan-600 active:scale-[0.98] transition-all duration-200 shadow-md flex items-center justify-center gap-2 mt-2">
280+
</div>
281+
</div>
282+
<!-- Dynamic Request Form -->
283+
<div id="request_form_container" class="hidden fixed inset-0 bg-gray-900/60 dark:bg-gray-950/80 backdrop-blur-xl items-center justify-center z-50 transition-opacity p-4">
284+
<div class="bg-white dark:bg-gray-900 p-8 rounded-[2rem] shadow-2xl w-full max-w-md relative border border-gray-200 dark:border-gray-700 animate-[fadeIn_0.3s_ease-out] dark:shadow-black/50">
285+
<button onclick="closeLoginModal()" class="close-modal absolute top-5 right-5 w-8 h-8 flex items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-white transition-colors">
286+
287+
</button>
288+
<div class="mb-8">
289+
<h2 class="text-3xl font-extrabold text-gray-900 dark:text-white mb-2">Complete Request</h2>
290+
<p class="text-gray-500 dark:text-gray-400 text-sm">Sign in to your dashboard</p>
291+
</div>
292+
<form class="flex flex-col gap-5">
293+
<div id="dynamic_form_fields" class="relative group"></div>
294+
<button id="dynamic_submit_button" class="btn-glow w-full bg-gradient-to-r from-blue-600 to-cyan-500 text-white py-4 rounded-2xl font-bold text-lg hover:from-blue-700 hover:to-cyan-600 active:scale-[0.98] transition-all duration-200 shadow-md flex items-center justify-center gap-2 mt-2">
293295
<span id="btnText">Submit →</span>
294296
<svg id="spinner" class="hidden w-5 h-5 animate-spin" viewBox="0 0 24 24">
295297
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4">
@@ -298,19 +300,11 @@ <h2 class="text-3xl font-extrabold text-gray-900 dark:text-white mb-2">Complete
298300
</svg>
299301
</button>
300302
<button onclick="location.reload()" class="btn-glow w-full bg-gradient-to-r from-blue-600 to-cyan-500 text-white py-4 rounded-2xl font-bold text-lg hover:from-blue-700 hover:to-cyan-600 active:scale-[0.98] transition-all duration-200 shadow-md flex items-center justify-center gap-2 mt-2">
301-
<span id="btnText">Cancel →</span>
302-
<svg id="spinner" class="hidden w-5 h-5 animate-spin" viewBox="0 0 24 24">
303-
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4">
304-
305-
</circle>
306-
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v4a4 4 00-4 4H4z"></path>
307-
</svg>
303+
Cancel →
308304
</button>
309305
</form>
310306
</div>
311307
</div>
312-
</div>
313-
</div>
314308
</div>
315309
</main>
316310

0 commit comments

Comments
 (0)