Skip to content

Commit 2365093

Browse files
enhance the desgin for the dynamic request submit form.
1 parent 250f589 commit 2365093

2 files changed

Lines changed: 32 additions & 21 deletions

File tree

app/static/js/service_requests.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,29 +132,24 @@ switch(queryType){
132132
case "CHANGE_PIN":
133133

134134
fields.innerHTML = `
135-
<div class="flex flex-col gap-3">
136-
<label class="font-semibold">New PIN</label>
137-
<input type="password" id="new_pin"
138-
class="border p-2 rounded w-full dark:bg-gray-700 dark:border-gray-600" placeholder="Enter new PIN number">
135+
<input type="password" id="new_pin" placeholder=" " class="dynamic_input">
136+
<label id="dynamic_label">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>
139138
<button
140-
onclick="submitRequest('CHANGE_PIN')"
141-
class="mt-2 bg-blue-900 text-white px-4 py-2 rounded-lg hover:bg-blue-700">
139+
onclick="submitRequest('CHANGE_PIN')" id="dynamic_button">
142140
Submit
143141
</button>
144-
</div>
145142
`;
146143

147144
break;
148145

149146
case "CHANGE_ACCOUNT_NAME":
150147

151148
fields.innerHTML = `
152-
<label class="font-semibold">New Account Name</label>
153-
<input type="text" id="new_name"
154-
class="border p-2 rounded w-full" placeholder="Enter the Account Holder Name">
149+
<input type="text" id="new_name" class="dynamic_input">
150+
<label id="dynamic_label">New Account Name</label>
155151
<button
156-
onclick="submitRequest('CHANGE_ACCOUNT_NAME')"
157-
class="mt-4 bg-blue-900 text-white px-4 py-2 rounded-lg hover:bg-blue-700 cursor-pointer transition">
152+
onclick="submitRequest('CHANGE_ACCOUNT_NAME')" id="dynamic_button">
158153
Submit
159154
</button>
160155
`;
@@ -220,6 +215,9 @@ break;
220215

221216

222217
}
218+
document.getElementsByClassName("dynamic_input").classList.add("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")
219+
document.getElementById("dynamic_label").classList.add("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")
220+
document.getElementById("dynamic_button").classList.add("mt-2 bg-blue-900 text-white px-4 py-2 rounded-lg hover:bg-blue-700")
223221

224222
}
225223

app/templates/service_requests.html

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -276,16 +276,29 @@ <h2 class="text-xl font-bold text-gray-900 dark:text-white">My Requests</h2>
276276
</tbody>
277277
</table>
278278
</div>
279-
<!-- Dynamic Request Form -->
280-
<div id="request_form_container" class="hidden p-6">
281-
<div class="bg-gray-100 dark:bg-gray-800 p-6 rounded-xl">
282-
<h3 class="text-lg font-bold mb-4">Complete Request</h3>
283-
<div id="dynamic_form_fields"></div>
284-
<button onclick="location.reload()"
285-
class="mt-4 bg-gray-500 text-white px-4 py-2 rounded">
286-
Cancel
287-
</button>
279+
</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>
288289
</div>
290+
<form class="flex flex-col gap-5">
291+
<div id="dynamic_form_fields" class="relative group"></div>
292+
<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">
293+
<span id="btnText">Cancel →</span>
294+
<svg id="spinner" class="hidden w-5 h-5 animate-spin" viewBox="0 0 24 24">
295+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4">
296+
297+
</circle>
298+
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v4a4 4 00-4 4H4z"></path>
299+
</svg>
300+
</button>
301+
</form>
289302
</div>
290303
</div>
291304
</div>

0 commit comments

Comments
 (0)