
ISC = Class.create( Module, {
tlog: TMDebug.gen_tlog( 'isc' ),
initialize: function( $super, config ) {
false;
this.edp = config.edp;
this.notification = config.notification;
edp.isc = this;
this.data = config.data;
this.qualifiers = config.qualifiers;
$super( 'edp_isc_display', { sub_modules: [ this.edp.venue_info ] } );
this.initialize_popups();
Event.observe( $('edp_switch_mode_link'), 'click', this.switch_to_ada.bind( this ) );
$('take_a_tour_link').observe('click', function(e) {
click_track.log_datapoint( {take_tour:''} );
}.bindAsEventListener(this));
},
initialize_popups: function ( $super ) {
this.ada_popup = new Popup( 'accessibility_popup', {
close_id: 'accessibility_close',
zIndex: 105,
links: [{
group: 'edp',
toggle: true,
link_id:      'accessibility_link',
popup_align:  { x:  1, y: -1 },
anchor_align: { x: -1, y: -1 },
offset:       { x: -5, y:  0 }
}]
});
this.map_disclaimer_popup = new Popup( 'map_disclaimer_popup', {
close_id: 'map_disclaimer_close',
zIndex: 105,
links: [{
group: 'edp',
toggle: true,
link_id:      'map_disclaimer_link',
popup_align:  { x: 1, y: -1 },
anchor_align: { x: 1, y:  1 },
offset:       { x: 0, y:  5 }
}]
});
this.ticket_limit_popup = new Popup( 'ticket_limits_popup', {
close_id: 'ticket_limits_close',
zIndex: 105,
links: [{
group: 'edp',
toggle: true,
link_id:      'ticket_limits_link',
anchor_id:    'isc_map_cart_area',
popup_align:  { x: 1, y:   1 },
anchor_align: { x: 1, y:  -1 },
offset:       { x: 0, y:  -5 }
}]
});
},
on_refresh: function() {
false;
this.cart.send_cart_to_seatmap();
},
on_reset: function() {
false;
this.cart.send_cart_to_seatmap();
},
setup: function() {
false;
this.search_constraints.password_rollup.setup();
this.cart.setup();
},
on_unlock_ticket_type: function( pw_tt ) {
var ext_tt = pw_tt.extended_ticket_type;
var tt = this.edp.event.ticket_type_map[ext_tt];
if ( pw_tt.ticket_limit ) {
tt.quantity_limits.max = pw_tt.ticket_limit;
tt.repname_quantity_limits.max = pw_tt.ticket_limit;
this.edp.event.set_limit_description( tt );
}
if ( tt.is_enabled && ( tt.password || tt.parent ) ) {
tt.is_locked = false;
if ( tt.parent ) {
if ( tt.parent.password.scheme_type == 'level_two_mask_rollup' ) {
var info;
if ( pw_tt.learn_more_link_text || pw_tt.learn_more_link_label ) {
info = {
text: pw_tt.learn_more_link_text,
link: pw_tt.learn_more_link_url,
link_text: pw_tt.learn_more_link_label
};
tt.ticket_type_info = true;
}
var desc = tt.orig_description + ': ' + pw_tt.primary_password.substr( 0, 6 ).toUpperCase();
if ( pw_tt.primary_password.length > 6 )
desc += "&#8230;";
tt.description = desc;
this.edp.event.set_limit_description( tt );
this.search_constraints.ticket_types.set_ticket_type_text( ext_tt, tt.description, info );
this.cart.update_ticket_type_description( tt );
this.search_constraints.ticket_types.show_ticket_type( ext_tt );
this.search_constraints.ticket_types.unlock_ticket_type( ext_tt );
this.search_constraints.password_rollup.add_pw_to_tt( pw_tt.primary_password, ext_tt );
}
else if ( tt.parent.password.scheme_type == 'password_server::ticket_type::cascade' ) {
this.search_constraints.ticket_types.unlock_ticket_type( tt.parent.ext_ticket_type );
this.search_constraints.ticket_types.unlock_ticket_type( ext_tt );
this.search_constraints.ticket_types.unlock_ticket_type( tt.parent.ext_ticket_type );
this.search_constraints.password_rollup.add_pw_to_tt( pw_tt.primary_password, tt.parent.ext_ticket_type );
this.search_constraints.password_rollup.add_pw_to_tt( pw_tt.primary_password, ext_tt );
tt.parent.is_locked = false;
for ( var i = 0 ; i < this.edp.event.blu_ticket_types.length ; i ++ ) {
this.search_constraints.ticket_types.check_ticket_type( this.edp.event.blu_ticket_types[i].ext_ticket_type );
this.search_constraints.password_rollup.add_pw_to_tt( pw_tt.primary_password, this.edp.event.blu_ticket_types[i].ext_ticket_type );
}
}
}
else {
this.search_constraints.ticket_types.unlock_ticket_type( ext_tt );
this.search_constraints.password_rollup.add_pw_to_tt( pw_tt.primary_password, ext_tt );
}
tt.primary_password = pw_tt.primary_password;
this.search_constraints.price_display.on_ticket_type_unlock( tt );
}
else if ( tt.is_enabled && !tt.is_locked ) {
this.search_constraints.password_rollup.add_pw_to_tt( pw_tt.primary_password, ext_tt );
}
},
switch_to_ada: function () {
this.ada_popup.hide();
var ada = edp.get_module('classic').ada;
ada.from_isc = true;
ada.show();
edp.select_mode('classic');
},
show: function ( $super ) {
var keys = $H(this.edp.merchandise).keys().sort();
for ( var i = 0 ; i < keys.length ; i ++ ) {
var m = this.edp.merchandise[keys[i]];
m.attach( 'isc_right_section' );
m.show();
}
this.edp.venue_info.attach( 'isc_left_section' );
this.edp.venue_info.$('address_break').update( new Element( 'br' ) );
$super();
$('edp_switch_classic').show();
this.seat_map.show();
this.search_constraints.setup_price_display();
this.search_constraints.ticket_types.adjust_height();
},
hide: function ( $super ) {
$super();
$('edp_switch_classic').hide();
this.seat_map.hide();
Popup.hide_group( 'edp' );
Popup.hide_group( 'pollingbox' );
Popup.hide_group( 'isc-notification' );
Popup.hide_group( 'isc-seatmap' );
}
} );

