@@ -10,6 +10,12 @@ function make_site(report_id, type){
1010 $ ( '#flip_' + report_id ) . data ( 'type' , 'site' ) ;
1111 $ ( '#ia' + report_id ) . empty ( ) ;
1212 $ ( '#ia_label_' + report_id ) . html ( 'IA Value N/A' ) ;
13+ if ( type == 'other' ) {
14+ $ ( '#label_' + report_id ) . html ( 'Breeding site - other' ) ;
15+ } else {
16+ $ ( '#label_' + report_id ) . html ( 'Breeding site - storm drain' ) ;
17+ }
18+ $ ( '#quick_upload_' + report_id ) . removeClass ( 'hide_button' ) ;
1319}
1420
1521function make_adult ( report_id ) {
@@ -24,7 +30,7 @@ function make_adult(report_id){
2430 const ia_value = $ ( '#ia' + report_id ) . data ( 'ia-value' ) ;
2531 const ia_f_value = Math . round ( parseFloat ( ia_value ) * 100 ) / 100
2632 $ ( '#ia_label_' + report_id ) . html ( 'IA Value ' + ia_f_value ) ;
27-
33+ $ ( '#label_' + report_id ) . html ( 'Adult' ) ;
2834}
2935
3036function set_report_visible_to ( report_id , hide_value ) {
@@ -50,6 +56,7 @@ function show_adult_buttons(report_id){
5056 $ ( `#palbo_${ report_id } ` ) . removeClass ( 'hide_button' ) ;
5157 $ ( `#dalbo_${ report_id } ` ) . removeClass ( 'hide_button' ) ;
5258 $ ( `#ns_${ report_id } ` ) . removeClass ( 'hide_button' ) ;
59+ $ ( `#quick_upload_${ report_id } ` ) . addClass ( 'hide_button' ) ;
5360}
5461
5562function hide_adult_buttons ( report_id ) {
@@ -58,6 +65,7 @@ function hide_adult_buttons(report_id){
5865 $ ( `#palbo_${ report_id } ` ) . addClass ( 'hide_button' ) ;
5966 $ ( `#dalbo_${ report_id } ` ) . addClass ( 'hide_button' ) ;
6067 $ ( `#ns_${ report_id } ` ) . addClass ( 'hide_button' ) ;
68+ $ ( `#quick_upload_${ report_id } ` ) . removeClass ( 'hide_button' ) ;
6169}
6270
6371$ ( document ) . ready ( function ( ) {
@@ -339,8 +347,11 @@ function flip_report(report_id, flip_to_type, flip_to_subtype){
339347 } ,
340348 error : function ( jqXHR , textStatus , errorThrown ) {
341349 if ( jqXHR . responseJSON . opcode == - 1 ) {
342- alert ( "This report has been claimed by at least one expert, so it will be removed from the coarse filter." )
350+ alert ( "This report has been claimed by at least one expert, so it will be removed from the coarse filter." ) ;
343351 remove_report ( report_id ) ;
352+ } else {
353+ alert ( jqXHR . responseJSON . message ) ;
354+ $ ( '#modal_flip_to_site' ) . modal ( 'hide' ) ;
344355 }
345356 $ ( '#' + report_id ) . unblock ( ) ;
346357 } ,
@@ -430,7 +441,7 @@ function single_report_template(report){
430441 <a href="/single_simple/${ report . version_UUID } " target="_blank"><span class="label label-default"><span class="glyphicon glyphicon-link"> </span> ${ report_country_name } </span></a>
431442 </div>
432443 <div class="header_report_label_wrapper">
433- <div class="header_report_label"><span class="label label-default">${ report_type_label } </span></div>
444+ <div class="header_report_label"><span id="label_ ${ report . version_UUID } " class="label label-default">${ report_type_label } </span></div>
434445 </div>
435446 <div id="header_ia_${ report . version_UUID } " class="header_ia">
436447 <div id="ia_label_${ report . version_UUID } ">IA Value ${ ia_value } </div>
@@ -495,20 +506,34 @@ function single_report_template(report){
495506$ ( '#next_page_button' ) . click ( function ( e ) {
496507 const offset = $ ( this ) . data ( 'offset' ) ;
497508 const page_size = get_page_size ( ) ;
498- load_data ( page_size , offset ) ;
509+ const filter = ui_to_filter ( ) ;
510+ $ ( '#filter_options' ) . val ( filter ) ;
511+ load_data ( page_size , offset , filter ) ;
499512} ) ;
500513
501514$ ( '#previous_page_button' ) . click ( function ( e ) {
502515 const offset = $ ( this ) . data ( 'offset' ) ;
503516 const page_size = get_page_size ( ) ;
504- load_data ( page_size , offset ) ;
517+ const filter = ui_to_filter ( ) ;
518+ $ ( '#filter_options' ) . val ( filter ) ;
519+ load_data ( page_size , offset , filter ) ;
505520} ) ;
506521
522+ $ ( '#reload_button' ) . click ( function ( e ) {
523+ const offset = 1 ;
524+ const page_size = get_page_size ( ) ;
525+ const filter = ui_to_filter ( ) ;
526+ $ ( '#filter_options' ) . val ( filter ) ;
527+ load_data ( page_size , offset , filter ) ;
528+ } ) ;
529+
507530$ ( '#page_button' ) . click ( function ( e ) {
508531 const page = $ ( '#page_input' ) . val ( ) ;
509532 const page_size = get_page_size ( ) ;
533+ const filter = ui_to_filter ( ) ;
534+ $ ( '#filter_options' ) . val ( filter ) ;
510535 if ( page != '' ) {
511- load_data ( page_size , parseInt ( page ) ) ;
536+ load_data ( page_size , parseInt ( page ) , filter ) ;
512537 }
513538} ) ;
514539
@@ -624,10 +649,45 @@ $('div#photo_grid').on('click', 'div.buttons_internal_grid button.btn.btn-warnin
624649 }
625650} ) ;
626651
652+ $ ( "input[name='radio_report_type']" ) . on ( 'click' , function ( ) {
653+ const selected_value = $ ( this ) . val ( ) ;
654+ $ ( '#flip_to_type' ) . val ( selected_value ) ;
655+ if ( selected_value == 'adult' ) {
656+ $ ( 'input[name=radio_site_type]' ) . attr ( "disabled" , true ) ;
657+ $ ( 'input[name=radio_water]' ) . attr ( "disabled" , true ) ;
658+ } else {
659+ $ ( 'input[name=radio_site_type]' ) . attr ( "disabled" , false ) ;
660+ $ ( 'input[name=radio_water]' ) . attr ( "disabled" , false ) ;
661+ }
662+ } ) ;
663+
664+ $ ( "input[name='radio_site_type']" ) . on ( 'click' , function ( ) {
665+ $ ( '#flip_to_subtype' ) . val ( $ ( this ) . val ( ) ) ;
666+ } ) ;
667+
668+ $ ( "input[name='radio_water']" ) . on ( 'click' , function ( ) {
669+ $ ( '#flip_water' ) . val ( $ ( this ) . val ( ) ) ;
670+ } ) ;
671+
672+ function set_modal_defaults ( ) {
673+ $ ( "input[name=radio_report_type][value=adult]" ) . prop ( 'checked' , true ) ;
674+ $ ( "input[name=radio_site_type][value=storm_drain]" ) . prop ( 'checked' , true ) ;
675+ $ ( "input[name=radio_water][value=water]" ) . prop ( 'checked' , true ) ;
676+ $ ( '#flip_to_type' ) . val ( 'adult' ) ;
677+ $ ( '#flip_to_subtype' ) . val ( 'storm_drain' ) ;
678+ $ ( '#flip_water' ) . val ( 'water' ) ;
679+ $ ( 'input[name=radio_site_type]' ) . attr ( "disabled" , true ) ;
680+ $ ( 'input[name=radio_water]' ) . attr ( "disabled" , true ) ;
681+ }
682+
627683$ ( 'div#photo_grid' ) . on ( 'click' , 'div.buttons_internal_grid button.btn.btn-danger.foot_btn.btn_flip' , function ( ) {
628684 const type = $ ( this ) . data ( "type" ) ;
629685 const site_cat = $ ( this ) . data ( "site-cat" ) ;
686+ const report_id = $ ( this ) . data ( "report-id" ) ;
630687 $ ( '#flip_report_id' ) . val ( $ ( this ) . data ( "report-id" ) ) ;
688+ set_modal_defaults ( ) ;
689+ $ ( '#modal_flip_to_site' ) . modal ( 'show' ) ;
690+ /*
631691 if( type=='adult' ){
632692 $('#flip_to_type').val( "site" );
633693 $('#modal_flip_to_site').modal('show');
@@ -638,6 +698,7 @@ $('div#photo_grid').on('click', 'div.buttons_internal_grid button.btn.btn-danger
638698 flip_report(report_id, 'adult', null);
639699 }
640700 }
701+ */
641702} ) ;
642703
643704function map_init_basic ( map , lat , lon ) {
0 commit comments