@@ -136,11 +136,34 @@ <h1 class="text-3xl font-bold text-gray-800 mb-6 text-center">Mercadix</h1>
136136 < input type ="text " id ="item " name ="item " required placeholder ="Raqueta de tenis "
137137 class ="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 " />
138138 </ div >
139+
139140 < div >
140- < label for ="number_of_pages " class ="block text-gray-700 font-medium mb-1 "> Cantidad de páginas a escanear:</ label >
141- < input type ="number " id ="number_of_pages " name ="number_of_pages " required min ="1 " max ="3 " value ="1 "
142- class ="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 " />
141+ < label class ="block text-gray-700 font-medium mb-2 "> Cantidad de páginas a escanear:</ label >
142+ < div class ="flex justify-between gap-2 ">
143+ < label for ="page-option-1 " class ="flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-blue-600 text-white font-medium rounded-md cursor-pointer hover:bg-blue-700 transition duration-200 ">
144+ < input type ="radio " id ="page-option-1 " name ="number_of_pages " value ="1 " checked class ="hidden " />
145+ < span class ="flex items-center justify-center w-5 h-5 border-2 border-white rounded-full ">
146+ < span class ="w-3 h-3 bg-white rounded-full "> </ span >
147+ </ span >
148+ 1
149+ </ label >
150+ < label for ="page-option-2 " class ="flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-blue-100 text-blue-800 font-medium rounded-md cursor-pointer hover:bg-blue-200 transition duration-200 ">
151+ < input type ="radio " id ="page-option-2 " name ="number_of_pages " value ="2 " class ="hidden " />
152+ < span class ="flex items-center justify-center w-5 h-5 border-2 border-blue-800 rounded-full ">
153+ < span class ="w-0 h-0 bg-blue-800 rounded-full transition-all duration-200 "> </ span >
154+ </ span >
155+ 2
156+ </ label >
157+ < label for ="page-option-3 " class ="flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-blue-100 text-blue-800 font-medium rounded-md cursor-pointer hover:bg-blue-200 transition duration-200 ">
158+ < input type ="radio " id ="page-option-3 " name ="number_of_pages " value ="3 " class ="hidden " />
159+ < span class ="flex items-center justify-center w-5 h-5 border-2 border-blue-800 rounded-full ">
160+ < span class ="w-0 h-0 bg-blue-800 rounded-full transition-all duration-200 "> </ span >
161+ </ span >
162+ 3
163+ </ label >
164+ </ div >
143165 </ div >
166+
144167 < button type ="submit " id ="submit-button "
145168 class ="w-full bg-blue-600 text-white font-semibold py-2 rounded-md hover:bg-blue-700 transition duration-200 ">
146169 Generar Histograma
@@ -206,6 +229,33 @@ <h1 class="text-3xl font-bold text-gray-800 mb-6 text-center">Mercadix</h1>
206229 toggleAr . classList . remove ( 'active' ) ;
207230 countryInput . value = 'br' ;
208231 } ) ;
232+
233+ // Page options toggle functionality
234+ const pageOptions = document . querySelectorAll ( 'input[name="number_of_pages"]' ) ;
235+ pageOptions . forEach ( option => {
236+ option . addEventListener ( 'change' , function ( ) {
237+ // Reset all options to inactive state
238+ document . querySelectorAll ( 'label[for^="page-option-"]' ) . forEach ( label => {
239+ label . classList . remove ( 'bg-blue-600' , 'text-white' ) ;
240+ label . classList . add ( 'bg-blue-100' , 'text-blue-800' ) ;
241+
242+ // Reset the circle indicator
243+ const circle = label . querySelector ( 'span > span' ) ;
244+ circle . classList . remove ( 'w-3' , 'h-3' ) ;
245+ circle . classList . add ( 'w-0' , 'h-0' ) ;
246+ } ) ;
247+
248+ // Set active state for the selected option
249+ const selectedLabel = document . querySelector ( `label[for="page-option-${ this . value } "]` ) ;
250+ selectedLabel . classList . remove ( 'bg-blue-100' , 'text-blue-800' ) ;
251+ selectedLabel . classList . add ( 'bg-blue-600' , 'text-white' ) ;
252+
253+ // Update the circle indicator
254+ const circle = selectedLabel . querySelector ( 'span > span' ) ;
255+ circle . classList . remove ( 'w-0' , 'h-0' ) ;
256+ circle . classList . add ( 'w-3' , 'h-3' ) ;
257+ } ) ;
258+ } ) ;
209259 } ) ;
210260</ script >
211261
0 commit comments