diff --git a/public_html/wp-content/plugins/wordcamp-payments/css/wordcamp-budgets.css b/public_html/wp-content/plugins/wordcamp-payments/css/wordcamp-budgets.css index 2f2e6c0c7..fb0926b4c 100644 --- a/public_html/wp-content/plugins/wordcamp-payments/css/wordcamp-budgets.css +++ b/public_html/wp-content/plugins/wordcamp-payments/css/wordcamp-budgets.css @@ -187,14 +187,8 @@ tr#row-payment-method label { } /* Budget Tool */ -.wcb-budget-tool .left { - width: 50%; - float: left; -} - -.wcb-budget-tool .right { - width: 50%; - float: left; +.wcb-budget-tool .first-section { + display: flex; } .wcb-budget-tool .nav-tab-wrapper svg { @@ -419,3 +413,9 @@ tr#row-payment-method label { color: #aaa; font-weight: normal; } + +.wcb-budget-attendees, +.wcb-budget-attendees td, +.wcb-budget-attendees th { + border-left: none; +} diff --git a/public_html/wp-content/plugins/wordcamp-payments/includes/budget-tool.php b/public_html/wp-content/plugins/wordcamp-payments/includes/budget-tool.php index caa3cb603..48f6782c1 100644 --- a/public_html/wp-content/plugins/wordcamp-payments/includes/budget-tool.php +++ b/public_html/wp-content/plugins/wordcamp-payments/includes/budget-tool.php @@ -218,6 +218,7 @@ private static function _get_real_value( float $value, $link, $meta ) { $count_speakers = (int) current( wp_list_pluck( wp_list_filter( $meta, array( 'name' => 'speakers' ) ), 'value' ) ); $count_volunteers = (int) current( wp_list_pluck( wp_list_filter( $meta, array( 'name' => 'volunteers' ) ), 'value' ) ); $count_organizers = (int) current( wp_list_pluck( wp_list_filter( $meta, array( 'name' => 'organizers' ) ), 'value' ) ); + $count_sponsors = (int) current( wp_list_pluck( wp_list_filter( $meta, array( 'name' => 'sponsor-tickets' ) ), 'value' ) ); $count_attendees = (int) current( wp_list_pluck( wp_list_filter( $meta, array( 'name' => 'attendees' ) ), 'value' ) ); $count_days = (int) current( wp_list_pluck( wp_list_filter( $meta, array( 'name' => 'days' ) ), 'value' ) ); $count_tracks = (int) current( wp_list_pluck( wp_list_filter( $meta, array( 'name' => 'tracks' ) ), 'value' ) ); @@ -230,12 +231,16 @@ private static function _get_real_value( float $value, $link, $meta ) { return $value * $count_volunteers; case 'per-organizer': return $value * $count_organizers; + case 'per-sponsor': + return $value * $count_sponsors; case 'per-speaker-volunteer': return $value * $count_speakers + $value * $count_volunteers; case 'per-speaker-volunteer-organizer': return $value * $count_speakers + $value * $count_volunteers + $value * $count_organizers; case 'per-attendee': return $value * $count_attendees; + case 'per-attendee-sponsor': + return $value * $count_attendees + $value * $count_sponsors; case 'per-day': return $value * $count_days; case 'per-track': @@ -274,6 +279,7 @@ private static function _get_default_budget() { array( 'type' => 'meta', 'name' => 'speakers', 'value' => 0 ), array( 'type' => 'meta', 'name' => 'volunteers', 'value' => 0 ), array( 'type' => 'meta', 'name' => 'organizers', 'value' => 0 ), + array( 'type' => 'meta', 'name' => 'sponsor-tickets', 'value' => 0 ), array( 'type' => 'meta', 'name' => 'currency', 'value' => 'USD' ), array( 'type' => 'meta', 'name' => 'ticket-price', 'value' => 0 ), @@ -284,7 +290,6 @@ private static function _get_default_budget() { array( 'type' => 'expense', 'category' => 'venue', 'note' => 'Venue', 'amount' => 0 ), array( 'type' => 'expense', 'category' => 'venue', 'note' => 'Wifi Costs', 'amount' => 0, 'link' => 'per-day' ), - array( 'type' => 'expense', 'category' => 'other', 'note' => 'Comped Tickets', 'amount' => 0 ), array( 'type' => 'expense', 'category' => 'audio-visual', 'note' => 'Video recording', 'amount' => 0 ), array( 'type' => 'expense', 'category' => 'audio-visual', 'note' => 'Projector rental', 'amount' => 0 ), array( 'type' => 'expense', 'category' => 'audio-visual', 'note' => 'Livestream', 'amount' => 0 ), @@ -295,6 +300,7 @@ private static function _get_default_budget() { array( 'type' => 'expense', 'category' => 'food-beverage', 'note' => 'Coffee', 'amount' => 0 ), array( 'type' => 'expense', 'category' => 'swag', 'note' => 'T-shirts', 'amount' => 0 ), array( 'type' => 'expense', 'category' => 'speaker-event', 'note' => 'Speakers Dinner', 'amount' => 0, 'link' => 'per-speaker' ), + array( 'type' => 'expense', 'category' => 'comped-tickets', 'note' => 'For speakers, special guests, members of the press, volunteers, etc.', 'amount' => 0 ), ); $extra_budget_for_next_gen = array( diff --git a/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php b/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php index 82674705b..7bfb569c3 100644 --- a/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php +++ b/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php @@ -580,10 +580,11 @@ public static function get_currencies() { */ public static function get_payment_categories() { $categories = array( - // Changes here may need to be synchronized with `_get_default_budget_og_wordcamp()` or `_get_default_budget_next_gen_wordcamp`. + // Changes here may need to be synchronized with `_get_default_budget()`. 'after-party' => esc_html__( 'After Party', 'wordcamporg' ), 'audio-visual' => esc_html__( 'Audio Visual', 'wordcamporg' ), 'camera-shipping' => esc_html__( 'Camera Shipping', 'wordcamporg' ), + 'comped-tickets' => esc_html__( 'Complimentary Tickets', 'wordcamporg' ), 'food-beverages' => esc_html__( 'Food & Beverage', 'wordcamporg' ), 'office-supplies' => esc_html__( 'Office Supplies', 'wordcamporg' ), 'signage-badges' => esc_html__( 'Signage & Badges', 'wordcamporg' ), diff --git a/public_html/wp-content/plugins/wordcamp-payments/javascript/budget-tool.js b/public_html/wp-content/plugins/wordcamp-payments/javascript/budget-tool.js index a142af40a..6d8b94af7 100644 --- a/public_html/wp-content/plugins/wordcamp-payments/javascript/budget-tool.js +++ b/public_html/wp-content/plugins/wordcamp-payments/javascript/budget-tool.js @@ -9,6 +9,7 @@ window.wcb = window.wcb || { models: {}, input: [] }; $income = $container.find( '.wcb-income-placeholder' ), $expense = $container.find( '.wcb-expense-placeholder' ), $meta = $container.find( '.wcb-meta-placeholder' ), + $attendees = $container.find( '.wcb-attendees-placeholder' ), $summary = $( '.wcb-summary-placeholder' ), $form = $( '.wcb-submit-form' ); @@ -277,7 +278,7 @@ window.wcb = window.wcb || { models: {}, input: [] }; if ( networkStatus.isNextGenWordCamp && ( name === 'days' || name === 'hours' ) ) { this.model.set( 'name', this.$el.find( '.name' ).val() ); } - if ( _.contains( [ 'attendees', 'days', 'tracks', 'speakers', 'volunteers', 'organizers' ], name ) ) { + if ( _.contains( [ 'attendees', 'days', 'tracks', 'speakers', 'volunteers', 'organizers', 'sponsor-tickets' ], name ) ) { value = parseInt( value.replace( /[^\d.-]/g, '' ) ) || 0; } else if ( _.contains( [ 'ticket-price', 'hours' ], name ) ) { value = parseFloat( value.replace( /[^\d.-]/g, '' ) ) || 0; @@ -368,18 +369,28 @@ window.wcb = window.wcb || { models: {}, input: [] }; }, addOne: function( item ) { - var view = new EntryView( { model: item } ); - - switch ( view.model.get( 'type' ) ) { - case 'expense': - var $c = $expense; - break; - case 'income': - var $c = $income; - break; - case 'meta': - default: - var $c = $meta; + const view = new EntryView( { model: item } ); + const type = view.model.get('type'); + const name = view.model.get('name'); + + const typeMappings = { + 'expense': $expense, + 'income': $income, + 'meta': $meta + }; + + const metaNameMappings = { + 'attendees': $attendees, + 'speakers': $attendees, + 'volunteers': $attendees, + 'organizers': $attendees, + 'sponsor-tickets': $attendees + }; + + let $c = typeMappings[type] || $meta; // default to $meta if type is not found + + if (type === 'meta' && metaNameMappings[name]) { + $c = metaNameMappings[name]; } $c.before( view.render().el ); @@ -404,6 +415,7 @@ window.wcb = window.wcb || { models: {}, input: [] }; 'speakers' : networkStatus.isNextGenWordCamp ? 'Facilitators' : 'Speakers', 'volunteers' : 'Volunteers', 'organizers' : 'Organizers', + 'sponsor-tickets' : 'Sponsor Tickets', 'currency' : 'Currency', 'ticket-price' : 'Ticket Price', // Only exists in the Central Network. @@ -455,6 +467,17 @@ window.wcb = window.wcb || { models: {}, input: [] }; }, }, + 'per-sponsor' : { + 'label' : 'per sponsor', + 'hasValue' : true, + 'callback' : function( value ) { + return parseFloat( value ) * parseInt( wcb.table.collection.findWhere( { + type : 'meta', + name : 'sponsor-tickets', + } )?.get( 'value' ) ); + }, + }, + 'per-speaker-volunteer' : { 'label' : ( networkStatus.isNextGenWordCamp ? 'per facilitator' : 'per speaker' ) + ' + volunteer', 'hasValue' : true, @@ -504,6 +527,21 @@ window.wcb = window.wcb || { models: {}, input: [] }; }, }, + 'per-attendee-sponsor' : { + 'label' : 'per attendee + sponsor', + 'hasValue' : true, + 'callback' : function( value ) { + return parseFloat( value ) * parseInt( wcb.table.collection.findWhere( { + type : 'meta', + name : 'attendees', + } ).get( 'value' ) ) + + parseInt( wcb.table.collection.findWhere( { + type : 'meta', + name : 'sponsor-tickets', + } ).get( 'value' ) ); + }, + }, + 'per-day' : { 'label' : 'per day', 'hasValue' : true, diff --git a/public_html/wp-content/plugins/wordcamp-payments/views/budget-tool/main.php b/public_html/wp-content/plugins/wordcamp-payments/views/budget-tool/main.php index fa10ff576..8d98c68e5 100644 --- a/public_html/wp-content/plugins/wordcamp-payments/views/budget-tool/main.php +++ b/public_html/wp-content/plugins/wordcamp-payments/views/budget-tool/main.php @@ -50,23 +50,43 @@ class="nav-tab nav-tab-active">

-
-

- - - - - - - - - - -
-
-
-

-
+
+
+

+ + + + + + + + + + + + + + +
+
+
+

+ + + + + + + + + + +
+
+
+

+
+
@@ -167,18 +187,6 @@ class="nav-tab nav-tab-active"> {{data.per_person}} - - - - - - - - - - - -