Event Tickets - Version 4.6.1.1

Version Description

Download this release

Release Info

Developer bordoni
Plugin Icon 128x128 Event Tickets
Version 4.6.1.1
Comparing to
See all releases

Code changes from version 4.6.1 to 4.6.1.1

event-tickets.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Event Tickets
4
  Description: Event Tickets allows your guests to RSVP from any post, page, or event.
5
- Version: 4.6.1
6
  Author: Modern Tribe, Inc.
7
  Author URI: http://m.tri.be/28
8
  License: GPLv2 or later
2
  /*
3
  Plugin Name: Event Tickets
4
  Description: Event Tickets allows your guests to RSVP from any post, page, or event.
5
+ Version: 4.6.1.1
6
  Author: Modern Tribe, Inc.
7
  Author URI: http://m.tri.be/28
8
  License: GPLv2 or later
lang/event-tickets-cs_CZ.po CHANGED
@@ -1151,7 +1151,7 @@ msgstr "http://m.tri.be/28"
1151
  msgid "Modern Tribe, Inc."
1152
  msgstr "Modern Tribe, Inc."
1153
 
1154
- #. #-#-#-#-# event-tickets.pot (Event Tickets 4.6.1) #-#-#-#-#
1155
  #. Plugin Name of the plugin/theme
1156
  #: src/Tribe/Main.php:470
1157
  msgid "Event Tickets"
1151
  msgid "Modern Tribe, Inc."
1152
  msgstr "Modern Tribe, Inc."
1153
 
1154
+ #. #-#-#-#-# event-tickets.pot (Event Tickets 4.6.1.1) #-#-#-#-#
1155
  #. Plugin Name of the plugin/theme
1156
  #: src/Tribe/Main.php:470
1157
  msgid "Event Tickets"
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: ModernTribe, borkweb, aguseo, barry.hughes, bordoni, brianjessee,
4
  Tags: RSVP, events, tickets, event management, calendar, ticket sales, community, registration, api, dates, date, posts, workshop, conference, meeting, seminar, concert, summit, ticket integration, event ticketing
5
  Requires at least: 4.5
6
  Tested up to: 4.9
7
- Stable tag: 4.6.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -233,6 +233,12 @@ The plugin is produced by [Modern Tribe Inc](http://m.tri.be/18uc).
233
 
234
  == Changelog ==
235
 
 
 
 
 
 
 
236
  = [4.6.1] 2017-11-21 =
237
 
238
  * Tweak - Prevents unnecessary AJAX requests when using tickets editor [88642]
4
  Tags: RSVP, events, tickets, event management, calendar, ticket sales, community, registration, api, dates, date, posts, workshop, conference, meeting, seminar, concert, summit, ticket integration, event ticketing
5
  Requires at least: 4.5
6
  Tested up to: 4.9
7
+ Stable tag: 4.6.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
233
 
234
  == Changelog ==
235
 
236
+ = [4.6.1.1] 2017-11-24 =
237
+
238
+ * Fix - Respect Start and End time for Ticket sales (props to Scott) [93439]
239
+ * Fix - Ensure attendee fields remain visible within the admin environment (compatibility fix for Event Tickets Plus) [94142]
240
+ * Language - 0 new strings added, 1 updated, 0 fuzzied, and 0 obsoleted
241
+
242
  = [4.6.1] 2017-11-21 =
243
 
244
  * Tweak - Prevents unnecessary AJAX requests when using tickets editor [88642]
src/Tribe/Main.php CHANGED
@@ -4,7 +4,7 @@ class Tribe__Tickets__Main {
4
  /**
5
  * Current version of this plugin
6
  */
7
- const VERSION = '4.6.1';
8
 
9
  /**
10
  * Min required The Events Calendar version
4
  /**
5
  * Current version of this plugin
6
  */
7
+ const VERSION = '4.6.1.1';
8
 
9
  /**
10
  * Min required The Events Calendar version
src/Tribe/Ticket_Object.php CHANGED
@@ -220,7 +220,13 @@ if ( ! class_exists( 'Tribe__Tickets__Ticket_Object' ) ) {
220
  public function start_date() {
221
  $start_date = null;
222
  if ( ! empty( $this->start_date ) ) {
223
- $start_date = strtotime( $this->start_date );
 
 
 
 
 
 
224
  }
225
 
226
  return $start_date;
@@ -235,8 +241,15 @@ if ( ! class_exists( 'Tribe__Tickets__Ticket_Object' ) ) {
235
  */
236
  public function end_date() {
237
  $end_date = null;
 
238
  if ( ! empty( $this->end_date ) ) {
239
- $end_date = strtotime( $this->end_date );
 
 
 
 
 
 
240
  }
241
 
242
  return $end_date;
220
  public function start_date() {
221
  $start_date = null;
222
  if ( ! empty( $this->start_date ) ) {
223
+ $start_date = $this->start_date;
224
+
225
+ if ( ! empty( $this->start_time ) ) {
226
+ $start_date .= ' ' . $this->start_time;
227
+ }
228
+
229
+ $start_date = strtotime( $start_date );
230
  }
231
 
232
  return $start_date;
241
  */
242
  public function end_date() {
243
  $end_date = null;
244
+
245
  if ( ! empty( $this->end_date ) ) {
246
+ $end_date = $this->end_date;
247
+
248
+ if ( ! empty( $this->end_time ) ) {
249
+ $end_date .= ' ' . $this->end_time;
250
+ }
251
+
252
+ $end_date = strtotime( $end_date );
253
  }
254
 
255
  return $end_date;
src/resources/js/tickets.js CHANGED
@@ -345,6 +345,17 @@ var ticketHeaderImage = window.ticketHeaderImage || {};
345
  }
346
  }
347
 
 
 
 
 
 
 
 
 
 
 
 
348
  // Setup Drag and Drop
349
  if (
350
  tribe.tickets.table
345
  }
346
  }
347
 
348
+ // When we have Meta fields for Attendees
349
+ if (
350
+ 'undefined' !== typeof tribe_event_tickets_plus
351
+ && $.isPlainObject( tribe_event_tickets_plus )
352
+ && $.isPlainObject( tribe_event_tickets_plus.meta )
353
+ && $.isPlainObject( tribe_event_tickets_plus.meta.admin )
354
+ && $.isFunction( tribe_event_tickets_plus.meta.admin.init_ticket_fields )
355
+ ) {
356
+ tribe_event_tickets_plus.meta.admin.init_ticket_fields();
357
+ }
358
+
359
  // Setup Drag and Drop
360
  if (
361
  tribe.tickets.table
src/resources/js/tickets.min.js CHANGED
@@ -1 +1 @@
1
- "undefined"==typeof tribe.tickets&&(tribe.tickets={}),tribe.tickets.editor={};var ticketHeaderImage=window.ticketHeaderImage||{};!function(e,t,i){"use strict";function n(e){"undefined"==typeof e&&(e=!0);var i=r.find(".tribe-ticket-editor-field-default_provider").filter(":checked"),n="Tribe__Tickets__RSVP_radio";!e&&i.length>0&&(n=i.val()+"_radio"),t(document.getElementById(n)).prop("checked",!0).trigger("change")}var a=(t("html, body"),t(document)),r=t(document.getElementById("tribetickets"));if(0!==r.length){var d=(t(document.getElementById("event_tickets")),t(document.getElementById("post_ID"))),c=t(document.getElementById("publish")),o=r.find(".tribe-tickets-editor-blocker"),l=r.find(".spinner"),s=t(document.getElementById("tribe_panel_base")),p=t(document.getElementById("tribe_panel_edit")),m=t(document.getElementById("tribe_panel_settings")),_=["yy-mm-dd","m/d/yy","mm/dd/yy","d/m/yy","dd/mm/yy","m-d-yy","mm-dd-yy","d-m-yy","dd-mm-yy","yy.mm.dd","mm.dd.yy","dd.mm.yy"],f=_[0],u=function(e,i){if("undefined"==typeof i){var n=t(this);i=n.val()}if(void 0!==i){i||(i=0),i=parseInt(i,10);var a=t(".tribe-ticket-capacity-max"),r=a.find(".tribe-ticket-capacity-value"),d=t('.tribe-ticket-field-capacity[name="tribe-ticket[capacity]"]');d.attr("placeholder",i),i?d.attr("max",i):i=0,r.text(i)}};i.beforeUnload=function(e){var t=!1;return"true"===s.attr("aria-hidden")&&(t=tribe_global_stock_admin_ui.nav_away_msg),e.returnValue=t,t},ticketHeaderImage={uploader:function(){var e=wp.media({title:HeaderImageData.title,multiple:!1,library:{type:"image"},button:{text:HeaderImageData.button}});return e.on("close",function(){var t=e.state().get("selection").toJSON();t.length&&ticketHeaderImage.render(t[0])}),e.open(),!1},render:function(e){t(document.getElementById("tribe_ticket_header_preview")).html(ticketHeaderImage.imgHTML(e)),t(document.getElementById("tribe_ticket_header_image_id")).val(e.id),t(document.getElementById("tribe_ticket_header_remove")).show(),t(document.getElementById("tribe_tickets_image_preview_filename")).show().find(".filename").text(e.filename)},imgHTML:function(e){var t='<img src="'+e.url+'" ';return t+='width="'+e.width+'" ',t+='height="'+e.height+'" ',t+="/>"}},i.panels={list:"#tribe_panel_base",ticket:"#tribe_panel_edit",settings:"#tribe_panel_settings"},i.swapPanel=function(n){var a;a=n instanceof jQuery?n:"undefined"!=typeof i.panels[n]?t(i.panels[n]):s,r.find(".ticket_panel").each(function(){t(this).attr("aria-hidden",!0)}),a.attr("aria-hidden",!1),a.is(s)?t(e).off("beforeunload.tribe"):t(e).on("beforeunload.tribe",i.beforeUnload)},i.fetchPanels=function(e,n){"undefined"==typeof e&&(e=[]);var a={action:"tribe-ticket-panels",notice:!1,post_id:d.val(),nonce:TribeTickets.add_ticket_nonce,data:e,is_admin:t("body").hasClass("wp-admin")};t.post(ajaxurl,a,function(e){e.success&&i.refreshPanels(e.data,n)},"json")},i.refreshPanels=function(e,n){s=t(e.list),p=t(e.ticket),m=t(e.settings),r.find(i.panels.list).replaceWith(s),r.find(i.panels.ticket).replaceWith(p),r.find(i.panels.settings).replaceWith(m),i.setupPanels(),i.swapPanel(n)},i.setupPanels=function(){e.MTAccordion({target:".accordion"});var i=t(document.getElementById("tribe-event-datepickers")),n=t(document.getElementById("ticket_start_date")),a=t(document.getElementById("ticket_end_date")),d=(t(document.getElementById("ticket_start_time")),t(document.getElementById("ticket_end_time")),0);if(i.length&&(d=i.data("startofweek")),"undefined"!=typeof tribe_dynamic_help_text){var c=t.isNumeric(tribe_dynamic_help_text.datepicker_format_index)?tribe_dynamic_help_text.datepicker_format_index:0;f=_[c]}var o={dateFormat:f,showAnim:"fadeIn",changeMonth:!0,changeYear:!0,numberOfMonths:3,firstDay:d,showButtonPanel:!1,onChange:function(){},beforeShow:function(e,i){i.input.data("prevDate",i.input.datepicker("getDate"));var n=t(i.dpDiv);n.addClass("tribe-ui-datepicker"),n.attrchange({trackValues:!0,callback:function(e){(e.newValue.indexOf("display: none")>=0||e.newValue.indexOf("display:none")>=0)&&n.removeClass("tribe-ui-datepicker")}})},onSelect:function(e,i){var r=t.datepicker.parseDate(f,e);"ticket_start_date"===i.id?a.datepicker("option","minDate",r):n.datepicker("option","maxDate",r)}};t.extend(o,tribe_l10n_datatables.datepicker);var l=r.find(".tribe-timepicker:not(.ui-timepicker-input)");if(tribe_timepickers.setup_timepickers(l),n.datepicker(o).datepicker("option","defaultDate",t(document.getElementById("EventStartDate")).val()).keyup(function(e){8!==e.keyCode&&46!==e.keyCode||t.datepicker._clearDate(this)}),a.datepicker(o).datepicker("option","defaultDate",t(document.getElementById("EventEndDate")).val()).keyup(function(e){8!==e.keyCode&&46!==e.keyCode||t.datepicker._clearDate(this)}),t(document.getElementById("tribe_ticket_header_preview")).find("img").length){t(document.getElementById("tribe_ticket_header_remove")).show();var p=t(document.getElementById("tribe_ticket_header_preview")).find("img");p.removeAttr("width").removeAttr("height"),r.width()<p.width()&&p.css("width","95%")}tribe.tickets.table&&0!==s.find("tribe-tickets-editor-table-tickets-body tr").length&&tribe.tickets.table.toggle_sortable(),r.find(tribe.validation.selectors.item).validation(),r.find(".tribe-dependent").dependency(),r.find(".tribe-dependency").trigger("verify.dependency")},a.ajaxSend(function(e,i,n){"string"===t.type(n.data)&&-1!==n.data.indexOf("action=tribe-ticket")&&r.trigger("spin.tribe","start")}),a.ajaxComplete(function(e,i,n){"string"===t.type(n.data)&&-1!==n.data.indexOf("action=tribe-ticket")&&r.trigger("spin.tribe","stop")}),a.on({"spin.tribe":function(e,i){("undefined"==typeof i||t.inArray(i,["start","stop"]))&&(i="stop"),"stop"===i?(o.hide(),l.removeClass("is-active")):(o.show(),l.addClass("is-active"))}}),c.on("click",function(i){t(e).off("beforeunload.tribe")}),a.on("click","#settings_form_toggle",function(e){return e.preventDefault(),i.fetchPanels(null,"settings"),!1}),a.on("click","#tribe_settings_form_cancel, #ticket_form_cancel",function(e){return e.preventDefault(),i.fetchPanels(null,"list"),!1}),a.on("click","#tribe_settings_form_save",function(e){e.preventDefault();var t=m.find("input,textarea").serialize();return i.fetchPanels(t,"list"),!1}),a.on("click",".ticket_form_toggle",function(e){e.preventDefault();var a=t(this);return n("rsvp_form_toggle"===a.attr("id")),p.find(".tribe-dependency").trigger("verify.dependency"),i.swapPanel("ticket"),!1}),a.on("click",".ticket_edit_button",function(e){e.preventDefault();var n=t(this),a={action:"tribe-ticket-edit",post_id:d.val(),ticket_id:n.data("ticketId"),nonce:TribeTickets.edit_ticket_nonce,is_admin:t("body").hasClass("wp-admin")};return t.post(ajaxurl,a,function(e){e.success&&i.refreshPanels(e.data,"ticket")},"json"),!1}),a.on("click.tribe",'[name="ticket_form_save"]',function(e){var n=t(document.getElementById("ticket_form_table"));if(n.trigger("validation.tribe"),!tribe.validation.hasErrors(n)){r.trigger("pre-save-ticket.tribe",e);var a=s.find(".tribe-ticket-field-order"),c={action:"tribe-ticket-add",data:p.find("input,textarea").serialize(),post_id:d.val(),nonce:TribeTickets.add_ticket_nonce,menu_order:a.length,is_admin:t("body").hasClass("wp-admin")};t.post(ajaxurl,c,function(e){e.success&&i.refreshPanels(e.data)},"json")}}),a.on("click",".ticket_delete",function(e){if(!confirm(tribe_ticket_notices.confirm_alert))return!1;e.preventDefault(),r.trigger("delete-ticket.tribe",e);var n=t(this).attr("attr-ticket-id"),a={action:"tribe-ticket-delete",post_id:d.val(),ticket_id:n,nonce:TribeTickets.remove_ticket_nonce,is_admin:t("body").hasClass("wp-admin")};t.post(ajaxurl,a,function(e){e.success&&i.refreshPanels(e.data)},"json")}),a.on("change",".tribe-ticket-field-capacity",function(e){var i=t(this),n=i.parents(".input_block").eq(0).find(".tribe-ticket-field-mode");i.val()&&n.val("capped")}),a.on("keyup","#ticket_price",function(e){e.preventDefault();var i=price_format.decimal,n=new RegExp("[^-0-9%\\"+i+"]+","gi"),a=t(this).val(),r=a.replace(n,"");a!==r&&t(this).val(r)}),a.on("click","#tribe_ticket_header_image, #tribe_ticket_header_preview",function(e){e.preventDefault(),ticketHeaderImage.uploader("","")}),a.on("focus","#settings_global_capacity_edit",function(){var e=t(this),i=0,n=t(".tribe-tickets-editor-capacity-table").find("[data-capacity]");n.each(function(){var e=t(this);i+=parseInt(e.data("capacity"),10)}),e.data("nonSharedCapacity",i)}),a.on("blur change","#settings_global_capacity_edit",function(){var e=t(".tribe-tickets-editor-table-row-capacity-total"),i=parseInt(e.data("totalCapacity"),10);if(-1!==i){var n=t(this),a=e.find(".tribe-tickets-editor-total-capacity"),r=parseInt(n.val(),10),d=n.data("nonSharedCapacity");(""===r||0>r)&&(n.val(0),r=0);var c=d+r;a.text(c)}}),a.on("click","#global_capacity_edit_button",function(e){e.preventDefault(),t(document.getElementById("settings_global_capacity_edit")).prop("disabled",!1).focus()}),a.on("blur",'[name="tribe-ticket[event_capacity]"]',u),a.on("change",'[name="tribe-ticket[capacity]"]',function(e){var i=t(this),n=parseInt(i.attr("max"),10),a=parseInt(i.val(),10);n&&n<a&&i.val(n)}),a.on("click","#tribe_ticket_header_remove",function(e){e.preventDefault(),t(document.getElementById("tribe_ticket_header_preview")).html(""),t(document.getElementById("tribe_ticket_header_remove")).hide(),t(document.getElementById("tribe_tickets_image_preview_filename")).hide().find(".filename").text(""),t(document.getElementById("tribe_ticket_header_image_id")).val("")}),a.ready(function(){i.setupPanels()})}}(window,jQuery,tribe.tickets.editor);
1
+ "undefined"==typeof tribe.tickets&&(tribe.tickets={}),tribe.tickets.editor={};var ticketHeaderImage=window.ticketHeaderImage||{};!function(e,t,i){"use strict";function n(e){"undefined"==typeof e&&(e=!0);var i=r.find(".tribe-ticket-editor-field-default_provider").filter(":checked"),n="Tribe__Tickets__RSVP_radio";!e&&i.length>0&&(n=i.val()+"_radio"),t(document.getElementById(n)).prop("checked",!0).trigger("change")}var a=(t("html, body"),t(document)),r=t(document.getElementById("tribetickets"));if(0!==r.length){var c=(t(document.getElementById("event_tickets")),t(document.getElementById("post_ID"))),d=t(document.getElementById("publish")),o=r.find(".tribe-tickets-editor-blocker"),l=r.find(".spinner"),s=t(document.getElementById("tribe_panel_base")),_=t(document.getElementById("tribe_panel_edit")),p=t(document.getElementById("tribe_panel_settings")),m=["yy-mm-dd","m/d/yy","mm/dd/yy","d/m/yy","dd/mm/yy","m-d-yy","mm-dd-yy","d-m-yy","dd-mm-yy","yy.mm.dd","mm.dd.yy","dd.mm.yy"],u=m[0],f=function(e,i){if("undefined"==typeof i){var n=t(this);i=n.val()}if(void 0!==i){i||(i=0),i=parseInt(i,10);var a=t(".tribe-ticket-capacity-max"),r=a.find(".tribe-ticket-capacity-value"),c=t('.tribe-ticket-field-capacity[name="tribe-ticket[capacity]"]');c.attr("placeholder",i),i?c.attr("max",i):i=0,r.text(i)}};i.beforeUnload=function(e){var t=!1;return"true"===s.attr("aria-hidden")&&(t=tribe_global_stock_admin_ui.nav_away_msg),e.returnValue=t,t},ticketHeaderImage={uploader:function(){var e=wp.media({title:HeaderImageData.title,multiple:!1,library:{type:"image"},button:{text:HeaderImageData.button}});return e.on("close",function(){var t=e.state().get("selection").toJSON();t.length&&ticketHeaderImage.render(t[0])}),e.open(),!1},render:function(e){t(document.getElementById("tribe_ticket_header_preview")).html(ticketHeaderImage.imgHTML(e)),t(document.getElementById("tribe_ticket_header_image_id")).val(e.id),t(document.getElementById("tribe_ticket_header_remove")).show(),t(document.getElementById("tribe_tickets_image_preview_filename")).show().find(".filename").text(e.filename)},imgHTML:function(e){var t='<img src="'+e.url+'" ';return t+='width="'+e.width+'" ',t+='height="'+e.height+'" ',t+="/>"}},i.panels={list:"#tribe_panel_base",ticket:"#tribe_panel_edit",settings:"#tribe_panel_settings"},i.swapPanel=function(n){var a;a=n instanceof jQuery?n:"undefined"!=typeof i.panels[n]?t(i.panels[n]):s,r.find(".ticket_panel").each(function(){t(this).attr("aria-hidden",!0)}),a.attr("aria-hidden",!1),a.is(s)?t(e).off("beforeunload.tribe"):t(e).on("beforeunload.tribe",i.beforeUnload)},i.fetchPanels=function(e,n){"undefined"==typeof e&&(e=[]);var a={action:"tribe-ticket-panels",notice:!1,post_id:c.val(),nonce:TribeTickets.add_ticket_nonce,data:e,is_admin:t("body").hasClass("wp-admin")};t.post(ajaxurl,a,function(e){e.success&&i.refreshPanels(e.data,n)},"json")},i.refreshPanels=function(e,n){s=t(e.list),_=t(e.ticket),p=t(e.settings),r.find(i.panels.list).replaceWith(s),r.find(i.panels.ticket).replaceWith(_),r.find(i.panels.settings).replaceWith(p),i.setupPanels(),i.swapPanel(n)},i.setupPanels=function(){e.MTAccordion({target:".accordion"});var i=t(document.getElementById("tribe-event-datepickers")),n=t(document.getElementById("ticket_start_date")),a=t(document.getElementById("ticket_end_date")),c=(t(document.getElementById("ticket_start_time")),t(document.getElementById("ticket_end_time")),0);if(i.length&&(c=i.data("startofweek")),"undefined"!=typeof tribe_dynamic_help_text){var d=t.isNumeric(tribe_dynamic_help_text.datepicker_format_index)?tribe_dynamic_help_text.datepicker_format_index:0;u=m[d]}var o={dateFormat:u,showAnim:"fadeIn",changeMonth:!0,changeYear:!0,numberOfMonths:3,firstDay:c,showButtonPanel:!1,onChange:function(){},beforeShow:function(e,i){i.input.data("prevDate",i.input.datepicker("getDate"));var n=t(i.dpDiv);n.addClass("tribe-ui-datepicker"),n.attrchange({trackValues:!0,callback:function(e){(e.newValue.indexOf("display: none")>=0||e.newValue.indexOf("display:none")>=0)&&n.removeClass("tribe-ui-datepicker")}})},onSelect:function(e,i){var r=t.datepicker.parseDate(u,e);"ticket_start_date"===i.id?a.datepicker("option","minDate",r):n.datepicker("option","maxDate",r)}};t.extend(o,tribe_l10n_datatables.datepicker);var l=r.find(".tribe-timepicker:not(.ui-timepicker-input)");if(tribe_timepickers.setup_timepickers(l),n.datepicker(o).datepicker("option","defaultDate",t(document.getElementById("EventStartDate")).val()).keyup(function(e){8!==e.keyCode&&46!==e.keyCode||t.datepicker._clearDate(this)}),a.datepicker(o).datepicker("option","defaultDate",t(document.getElementById("EventEndDate")).val()).keyup(function(e){8!==e.keyCode&&46!==e.keyCode||t.datepicker._clearDate(this)}),t(document.getElementById("tribe_ticket_header_preview")).find("img").length){t(document.getElementById("tribe_ticket_header_remove")).show();var _=t(document.getElementById("tribe_ticket_header_preview")).find("img");_.removeAttr("width").removeAttr("height"),r.width()<_.width()&&_.css("width","95%")}"undefined"!=typeof tribe_event_tickets_plus&&t.isPlainObject(tribe_event_tickets_plus)&&t.isPlainObject(tribe_event_tickets_plus.meta)&&t.isPlainObject(tribe_event_tickets_plus.meta.admin)&&t.isFunction(tribe_event_tickets_plus.meta.admin.init_ticket_fields)&&tribe_event_tickets_plus.meta.admin.init_ticket_fields(),tribe.tickets.table&&0!==s.find("tribe-tickets-editor-table-tickets-body tr").length&&tribe.tickets.table.toggle_sortable(),r.find(tribe.validation.selectors.item).validation(),r.find(".tribe-dependent").dependency(),r.find(".tribe-dependency").trigger("verify.dependency")},a.ajaxSend(function(e,i,n){"string"===t.type(n.data)&&-1!==n.data.indexOf("action=tribe-ticket")&&r.trigger("spin.tribe","start")}),a.ajaxComplete(function(e,i,n){"string"===t.type(n.data)&&-1!==n.data.indexOf("action=tribe-ticket")&&r.trigger("spin.tribe","stop")}),a.on({"spin.tribe":function(e,i){("undefined"==typeof i||t.inArray(i,["start","stop"]))&&(i="stop"),"stop"===i?(o.hide(),l.removeClass("is-active")):(o.show(),l.addClass("is-active"))}}),d.on("click",function(i){t(e).off("beforeunload.tribe")}),a.on("click","#settings_form_toggle",function(e){return e.preventDefault(),i.fetchPanels(null,"settings"),!1}),a.on("click","#tribe_settings_form_cancel, #ticket_form_cancel",function(e){return e.preventDefault(),i.fetchPanels(null,"list"),!1}),a.on("click","#tribe_settings_form_save",function(e){e.preventDefault();var t=p.find("input,textarea").serialize();return i.fetchPanels(t,"list"),!1}),a.on("click",".ticket_form_toggle",function(e){e.preventDefault();var a=t(this);return n("rsvp_form_toggle"===a.attr("id")),_.find(".tribe-dependency").trigger("verify.dependency"),i.swapPanel("ticket"),!1}),a.on("click",".ticket_edit_button",function(e){e.preventDefault();var n=t(this),a={action:"tribe-ticket-edit",post_id:c.val(),ticket_id:n.data("ticketId"),nonce:TribeTickets.edit_ticket_nonce,is_admin:t("body").hasClass("wp-admin")};return t.post(ajaxurl,a,function(e){e.success&&i.refreshPanels(e.data,"ticket")},"json"),!1}),a.on("click.tribe",'[name="ticket_form_save"]',function(e){var n=t(document.getElementById("ticket_form_table"));if(n.trigger("validation.tribe"),!tribe.validation.hasErrors(n)){r.trigger("pre-save-ticket.tribe",e);var a=s.find(".tribe-ticket-field-order"),d={action:"tribe-ticket-add",data:_.find("input,textarea").serialize(),post_id:c.val(),nonce:TribeTickets.add_ticket_nonce,menu_order:a.length,is_admin:t("body").hasClass("wp-admin")};t.post(ajaxurl,d,function(e){e.success&&i.refreshPanels(e.data)},"json")}}),a.on("click",".ticket_delete",function(e){if(!confirm(tribe_ticket_notices.confirm_alert))return!1;e.preventDefault(),r.trigger("delete-ticket.tribe",e);var n=t(this).attr("attr-ticket-id"),a={action:"tribe-ticket-delete",post_id:c.val(),ticket_id:n,nonce:TribeTickets.remove_ticket_nonce,is_admin:t("body").hasClass("wp-admin")};t.post(ajaxurl,a,function(e){e.success&&i.refreshPanels(e.data)},"json")}),a.on("change",".tribe-ticket-field-capacity",function(e){var i=t(this),n=i.parents(".input_block").eq(0).find(".tribe-ticket-field-mode");i.val()&&n.val("capped")}),a.on("keyup","#ticket_price",function(e){e.preventDefault();var i=price_format.decimal,n=new RegExp("[^-0-9%\\"+i+"]+","gi"),a=t(this).val(),r=a.replace(n,"");a!==r&&t(this).val(r)}),a.on("click","#tribe_ticket_header_image, #tribe_ticket_header_preview",function(e){e.preventDefault(),ticketHeaderImage.uploader("","")}),a.on("focus","#settings_global_capacity_edit",function(){var e=t(this),i=0,n=t(".tribe-tickets-editor-capacity-table").find("[data-capacity]");n.each(function(){var e=t(this);i+=parseInt(e.data("capacity"),10)}),e.data("nonSharedCapacity",i)}),a.on("blur change","#settings_global_capacity_edit",function(){var e=t(".tribe-tickets-editor-table-row-capacity-total"),i=parseInt(e.data("totalCapacity"),10);if(-1!==i){var n=t(this),a=e.find(".tribe-tickets-editor-total-capacity"),r=parseInt(n.val(),10),c=n.data("nonSharedCapacity");(""===r||0>r)&&(n.val(0),r=0);var d=c+r;a.text(d)}}),a.on("click","#global_capacity_edit_button",function(e){e.preventDefault(),t(document.getElementById("settings_global_capacity_edit")).prop("disabled",!1).focus()}),a.on("blur",'[name="tribe-ticket[event_capacity]"]',f),a.on("change",'[name="tribe-ticket[capacity]"]',function(e){var i=t(this),n=parseInt(i.attr("max"),10),a=parseInt(i.val(),10);n&&n<a&&i.val(n)}),a.on("click","#tribe_ticket_header_remove",function(e){e.preventDefault(),t(document.getElementById("tribe_ticket_header_preview")).html(""),t(document.getElementById("tribe_ticket_header_remove")).hide(),t(document.getElementById("tribe_tickets_image_preview_filename")).hide().find(".filename").text(""),t(document.getElementById("tribe_ticket_header_image_id")).val("")}),a.ready(function(){i.setupPanels()})}}(window,jQuery,tribe.tickets.editor);