File tree Expand file tree Collapse file tree
resources/views/pages/location_report Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22location_report.js is used in the report on a single location,
33pages/location_report/collapsed.blade.php.
44*/
5+ var suggestion_counter = 0 ;
56function initMap ( ) {
67 var map = new google . maps . Map ( document . getElementById ( 'map' ) , {
78 zoom : 15 ,
@@ -172,11 +173,22 @@ function suggestionButtonClicked() {
172173function highlightDiffField ( id ) {
173174 var element = document . getElementById ( id ) ;
174175 element . addEventListener ( "change" , function ( event ) {
176+ //highlight modified suggestion fields
175177 if ( element . dataset . value != element . value ) {
178+ if ( ! $ ( element ) . hasClass ( 'highlight' ) )
179+ suggestion_counter += 1 ;
176180 $ ( element ) . addClass ( 'highlight' ) ;
177181 } else {
182+ if ( $ ( element ) . hasClass ( 'highlight' ) )
183+ suggestion_counter -= 1 ;
178184 $ ( element ) . removeClass ( 'highlight' ) ;
179185 }
186+ // disable submit button when there is no difference in the fields
187+ if ( suggestion_counter > 0 )
188+ $ ( "#suggestionFormConfirm" ) . prop ( "disabled" , false ) ;
189+ else
190+ $ ( "#suggestionFormConfirm" ) . prop ( "disabled" , true ) ;
191+
180192 } )
181193}
182194
Original file line number Diff line number Diff line change 151151 <button type =" button" class =" btn btn-default"
152152 data-dismiss =" modal" >Close
153153 </button >
154- <button type =" button" class =" btn btn-primary" id =" suggestionFormConfirm" >
154+ <button type =" button" class =" btn btn-primary" id =" suggestionFormConfirm" disabled >
155155 Confirm
156156 </button >
157157 </div >
You can’t perform that action at this time.
0 commit comments