@@ -5,6 +5,7 @@ $(function() {
55 const product_drive_participant_id = "#donation_product_drive_participant_id" ;
66 const product_drive_id = "#donation_product_drive_id"
77 const manufacturer_id = "#donation_manufacturer_id" ;
8+ const donation_site_id = "#donation_donation_site_id"
89
910 const donation_site_container_id = "div.donation_donation_site" ;
1011 const product_drive_container_id = "div.donation_product_drive" ;
@@ -17,8 +18,8 @@ $(function() {
1718
1819 const create_new_product_drive_text = "---Create new Product Drive---" ;
1920 const create_new_product_drive_participant_text = "---Create new Participant---" ;
20-
2121 const create_new_manufacturer_text = "---Create new Manufacturer---" ;
22+ const create_new_donation_site_text = "---Add New Donation Site---" ;
2223
2324 $ ( product_drive_id ) . append (
2425
@@ -32,6 +33,10 @@ $(function() {
3233 `<option value="">${ create_new_manufacturer_text } </option>`
3334 ) ;
3435
36+ $ ( donation_site_id ) . append (
37+ `<option value="">${ create_new_donation_site_text } </option>`
38+ )
39+
3540 $ ( document ) . on ( "change" , product_drive_id , function ( evt ) {
3641 const selection = $ ( product_drive_id + " option" )
3742 . filter ( ":selected" )
@@ -61,6 +66,17 @@ $(function() {
6166 }
6267 } ) ;
6368
69+ $ ( document ) . on ( "change" , donation_site_id , function ( evt ) {
70+ const selection = $ ( donation_site_id + " option" )
71+ . filter ( ":selected" )
72+ . text ( ) ;
73+
74+ if ( selection === create_new_donation_site_text ) {
75+ document . getElementById ( "new_donation_site" ) . click ( )
76+ }
77+ } ) ;
78+
79+
6480 function handleSourceSelection ( ) {
6581 const selection = $ ( control_id + " option" )
6682 . filter ( ":selected" )
0 commit comments