@@ -75,9 +75,7 @@ <h5 class="mb-0">Your Decision</h5>
7575 < label for ="comments " class ="form-label "> Comments (Optional)</ label >
7676 < textarea class ="form-control " id ="comments " name ="comments " rows ="3 " placeholder ="Add any comments about your decision... "> </ textarea >
7777 </ div >
78-
79- <!-- Action buttons (shown initially) -->
80- < div class ="d-grid gap-2 d-md-block " id ="actionButtons ">
78+ < div class ="d-grid gap-2 d-md-block ">
8179 < button type ="submit " name ="decision " value ="approve " class ="btn btn-success btn-lg ">
8280 < i class ="bi bi-check-circle "> </ i > Approve
8381 </ button >
@@ -88,57 +86,12 @@ <h5 class="mb-0">Your Decision</h5>
8886 < i class ="bi bi-arrow-left "> </ i > Back
8987 </ a >
9088 </ div >
91-
92- <!-- Loading spinner (hidden initially) -->
93- < div class ="d-none " id ="loadingSpinner ">
94- < div class ="d-flex align-items-center ">
95- < div class ="spinner-border text-primary me-3 " role ="status ">
96- < span class ="visually-hidden "> Processing...</ span >
97- </ div >
98- < div >
99- < strong id ="loadingText "> Processing your decision...</ strong >
100- < p class ="text-muted mb-0 small "> This may take a few moments.</ p >
101- </ div >
102- </ div >
103- </ div >
10489 </ form >
10590 </ div >
10691 </ div >
10792 </ div >
10893</ div >
10994{% endblock %}
11095
111- {% block extra_js %}
112- < script >
113- document . addEventListener ( 'DOMContentLoaded' , function ( ) {
114- const form = document . getElementById ( 'approvalForm' ) ;
115- const actionButtons = document . getElementById ( 'actionButtons' ) ;
116- const loadingSpinner = document . getElementById ( 'loadingSpinner' ) ;
117- const loadingText = document . getElementById ( 'loadingText' ) ;
118-
119- form . addEventListener ( 'submit' , function ( e ) {
120- // Get the clicked button's value
121- const clickedButton = e . submitter ;
122- const decision = clickedButton ? clickedButton . value : 'processing' ;
12396
124- // Update loading text based on decision
125- if ( decision === 'approve' ) {
126- loadingText . textContent = 'Approving submission...' ;
127- } else if ( decision === 'reject' ) {
128- loadingText . textContent = 'Rejecting submission...' ;
129- }
130-
131- // Hide buttons, show spinner
132- actionButtons . classList . add ( 'd-none' ) ;
133- loadingSpinner . classList . remove ( 'd-none' ) ;
134-
135- // Disable only buttons to prevent double-click (not inputs - that breaks CSRF)
136- const buttons = form . querySelectorAll ( 'button' ) ;
137- buttons . forEach ( function ( btn ) {
138- btn . disabled = true ;
139- } ) ;
140- } ) ;
141- } ) ;
142- </ script >
143- {% endblock %}
14497
0 commit comments