').appendTo('body')
.css('width', '225px')
.css('height', '170px')
.css('text-align', 'center')
.css('padding', '0.5em')
.position({my : "center center", at : "center center", of : window})
.addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-di buttons')
.html('
Deleting...
Please wait, this may take a while to process...
');
// Submit the change
var jqxhr = $.ajax(
{
type : 'POST',
url : '{{ url('/teams') }}/' + data.team_id + '/delete',
data : data,
dataType : 'html'
})
.done(function (return_data)
{
// Reload
window.location.href= data.redirect;
})
.fail(function (jqXHR, status, error)
{
var response = jqXHR.responseText;
var errorData = $.parseJSON(response);
console.log(errorData);
console.log(response);
alert ("There was an error saving changes.\n\nThis page will be reloaded.");
location.reload();
});
}
}
],
open : function ()
{
var dialog_object = $(this);
var html = '
';
html += '
';
html += '
Are you sure you want to drop the ' + data.team_level + ' level ' + data.activity + ' team for ' + data.ap_name + '? ';
html += '
';
html += 'The following actions will be taken:
';
html += 'All contests involving this team will be deleted and removed from the database. ';
html += 'This team will be removed from the database. ';
html += ' ';
html += '
This cannot be undone. If you drop this team, it cannot be reinstated. All scheduling data for this team will be lost.
';
html += '
';
dialog_object.html(html);
$('.drop_team_confirm .ui-widget-header').css('background', '#f6a828 url(http://download.jqueryui.com/themeroller/images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x').css('border-color', '#f6a828');
$('.drop_team_confirm .ui-widget-content').css('border-color', '#dddddd');
$('.drop_team_confirm .ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt');
$('.drop_team_confirm .ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');
},
close : function ()
{
var dialog_object = $(this);
$(dialog_object).remove();
}
});
});
@endif
$('.button_set').buttonset();
$('.button_set label').addClass('ui-corner-all');
$('#related_teams').buttonset();
$('#related_teams input').click(function() {
var link_location = $(this).attr('data-href');
if (!$(this).attr('checked'))
{
window.location = link_location;
}
});
$('#add_team').button({icons : {primary : 'ui-icon-plusthick'}, text : false});
$('.tabs').tabs({
beforeActivate : function (event, ui)
{
if (ui.newTab.is('[data-escape]'))
{
event.preventDefault();
window.location = ui.newTab.attr('data-escape');
}
}
});
$('.submit_button').button();
$('#event_date, #event_date2').datepicker({'dateFormat' : 'mm/dd/yy', 'minDate' : '{{ $information['first_event_at'] }}', 'maxDate' : '{{ $information['last_event_at'] }}'});
$('#event_time, #event_time2').timepicker({ 'timeFormat': 'h:i A' , 'step' : 15, 'maxTime' : '10:00pm'});
$('[data-format="height"]').mask("9-9?9");
/*
$('.add_contest .close').click(event, function () {
var panel = $(event.target).parent();
var state = panel.attr('data-state');
if (state == 'expand')
{
panel.css('height', panel.attr('data-min'));
panel.attr('data-state', 'collapse');
panel.children('*').css({'visibility' : 'hidden', 'display' : 'none'});
panel.children('.close').css({'visibility' : 'visible', 'display' : 'block'});
panel.children('.close').removeClass ('ui-icon-triangle-1-n');
panel.children('.close').addClass ('ui-icon-triangle-1-s');
}
if (state == 'collapse')
{
panel.css('height', panel.attr('data-max'));
panel.attr('data-state', 'expand');
panel.children('*').css({'visibility' : 'visible', 'display' : 'block'});
panel.children('.close').removeClass ('ui-icon-triangle-1-s');
panel.children('.close').addClass ('ui-icon-triangle-1-n');
}
});
*/
$('#contest_type').buttonset();
function updateOOSState ()
{
if ($('#is_oos_opponent:checked').length > 0)
{
$('#state').removeAttr('disabled');
}
else
{
$('#state').attr('disabled', 'disabled');
}
}
function updateOOSState2 ()
{
if ($('input[name="host_is_oos"]:checked').length > 0)
{
$('#state').removeAttr('disabled');
}
else
{
$('#state').attr('disabled', 'disabled');
}
}
function updateOOSState3 ()
{
if ($('input[name="other_team_is_oos"]:checked').length > 0)
{
$('#state2').removeAttr('disabled');
}
else
{
$('#state2').attr('disabled', 'disabled');
}
}
updateOOSState ();
updateOOSState2 ();
updateOOSState3 ();
$('#is_oos_opponent').change(function ()
{
updateOOSState ();
});
$('input[name="host_is_oos"]').change(function ()
{
updateOOSState2 ();
});
$('input[name="other_team_is_oos"]').change(function ()
{
updateOOSState3 ();
});
$('#is_endowment').change (function ()
{
if ($('#is_endowment:checked').length > 0)
{
$("input[name='event_status']").attr('value', 'PND');
$('.event_status_text').html('
Pending / Needs Approval ');
$('.event_status_note').html('Once you create this contest, it must be approved by the OSAA office; it will appear on your schedule as pending
');
}
else
{
$("input[name='event_status']").attr('value', 'SCHD');
/*
$('.event_status_text').html('
Ready to be scheduled ');
$('.event_status_note').html('Once you create this contest, it will be added to your schedule');
*/
$('.event_status_text').html('');
$('.event_status_note').html('');
}
});
$('#swap_home_away').button({text : false, icons : { primary : 'ui-icon-shuffle'}});
var availableOpponents = [
{{ $information['available_opponents'] }}
];
var availableLocations = [
{{ $information['available_locations'] }}
];
var availableTournaments = [
{{ $information['available_tournaments'] }}
];
$('.school_autocomplete').autocomplete(
{
source : availableOpponents
});
$("#opponent" ).autocomplete({
source : availableOpponents,
change : function (event, ui)
{
if ($('#swapped').val() > 0)
{
$("input[name='home_team_name']").attr('value', $(this).val());
}
else
{
$("input[name='away_team_name']").attr('value', $(this).val());
}
updateTeamDesignations ();
return true;
}});
$('#location').autocomplete({source : availableLocations});
$('#location2').autocomplete({source : availableLocations});
$('#tournament').autocomplete({source : availableTournaments});
function updateTeamDesignations ()
{
var home_team = $("input[name='home_team_name']").attr('value');
var away_team = $("input[name='away_team_name']").attr('value');
if (home_team != null)
{
$('#home_team_name').html(home_team.replace(/(<([^>]+)>)/ig,""));
}
if (away_team != null)
{
$('#away_team_name').html(away_team.replace(/(<([^>]+)>)/ig,""));
}
}
updateTeamDesignations ();
$('#swap_home_away').click(function ()
{
var home_team = $("input[name='home_team_name']").attr('value');
var away_team = $("input[name='away_team_name']").attr('value');
$("input[name='home_team_name']").attr('value', away_team);
$("input[name='away_team_name']").attr('value', home_team);
updateTeamDesignations ();
$('#swapped').val($('#swapped').val() * -1);
});
$('#is_neutral_location, #is_endowment, #is_tournament, #is_oos_opponent').button();
$('#is_tournament').change(function ()
{
if ($('#is_tournament:checked').length > 0 && $('#is_neutral_location:checked').length < 1)
{
$('#is_neutral_location').click();
}
});
$('#tournament').change(function ()
{
if ($(this).val() != "" && $('#is_tournament:checked').length < 1)
{
$('#is_tournament').click();
}
});
// Success bar
$('.success_bar').animate({ 'top' : 32, 'background-color' : 'rgba(176, 255, 190, 1.0)'}, 1600, 'easeOutQuad', function ()
{
$(this).delay(6000).fadeOut(4000);
$(this).hover(function ()
{
$(this).stop(true).css('opacity', '1.0');
},
function ()
{
$(this).fadeOut(4000);
})
});
$('.success_bar_alert').animate({ 'top' : 32, 'background-color' : 'rgba(255, 238, 178, 1.0)'}, 1600, 'easeOutQuad', function ()
{
$(this).delay(8000).fadeOut(4000);
$(this).hover(function ()
{
$(this).stop(true).css('opacity', '1.0');
},
function ()
{
$(this).fadeOut(4000);
})
});
$('.edit_contest_button')
.button({ icons : {primary : 'ui-icon-pencil'},
text : false})
.css({'width' : '16px',
'height' : '16px',
'position' : 'relative',
'top' : '-1px',
'margin-left' : '4px'})
.tooltip()
.attr('title', 'Click to edit this contest.');
// New schedule formatting
function colorRows ()
{
$('table.schedule').each(function ()
{
var i = 0;
$('tbody tr[data-status]', $(this)).each(function ()
{
if (i % 2 == 1)
{
$(this).addClass('odd');
if ($(this).next().is('tr'))
{
$(this).next().addClass('odd');
}
}
else
{
$(this).removeClass('odd');
if ($(this).next().is('tr'))
{
$(this).next().removeClass('odd');
}
}
i = i + 1;
});
});
}
colorRows();
$('[data-status="CXL"]').css({'background-color' : '#cacaca', 'color' : '#ffffff !important;'});
$('[data-status="CXL"] a').css({'background-color' : '#cacaca', 'color' : '#ffffff !important;'});
$('[data-status="CXL"] .gray').css({'background-color' : '#cacaca', 'color' : '#ffffff !important;'});
$('[data-status="PPD"]').css({'background-color' : '#b5a5fb', 'color' : '#ffffff !important;'});
$('[data-status="PPD"] a').css({'background-color' : '#b5a5fb', 'color' : '#ffffff !important;'});
$('[data-status="PPD"] .gray').css({'background-color' : '#b5a5fb', 'color' : '#ffffff !important;'});
$('[data-status="LIVE"]').css({'background-color' : '#effff1', 'color' : '#222222 !important;'});
$('[data-status="LIVE"] a').css({'background-color' : '#effff1', 'color' : '#222222 !important;'});
$('[data-status="LIVE"] .gray').css({'background-color' : '#effff1', 'color' : '#222222 !important;'});
$('[data-status="PND"]').css({'background-color' : '#fff7da', 'color' : '#222222 !important;'});
$('[data-status="PND"] a').css({'background-color' : '#fff7da', 'color' : '#222222 !important;'});
$('[data-status="PND"] .gray').css({'background-color' : '#fff7da', 'color' : '#222222 !important;'});
$('[data-status="DEL"]').css({'background-color' : '#ad2c2c', 'color' : '#ffffff !important;'});
$('[data-status="DEL"] a').css({'background-color' : '#ad2c2c', 'color' : '#ffffff !important;'});
$('[data-status="DEL"] .gray').css({'background-color' : '#ad2c2c', 'color' : '#ffffff !important;'});
$('.event_notes').css({'font-size' : '9pt'});
$('.contest_viewer').dialog({ autoOpen : false,
buttons : [ { text : 'Done', 'class' : 'float_right', click : function () { $(this).dialog('close'); }}
@if (Auth::check())
, { text : 'Edit Contest', 'class' : 'float_left', 'style' : 'margin-left:5px;', icons : { primary : 'ui-icon-pencil' }, click : function () { window.location = ('/contests/' + $(this).attr('data-contest') + '/edit?ap={{ $information['activity_program']->id}}'); }},
{ text : 'Submit Scores', 'class' : 'float_left', 'style' : 'margin-left:10px;', icons : { primary : 'ui-icon-circle-arrow-e' }, click : function () { window.location = ('/contests/' + $(this).attr('data-contest') + '/submit-scores'); }}
@endif ],
draggable : false,
height: 'auto',
modal : true,
open : function ()
{
var contest = $(this).attr('data-contest');
$('.contest_viewer').html("
");
var jqxhr = $.ajax({ type : 'GET', url : '/contests/' + contest + '?mode=ajax', dataType : 'html' })
.done(function (data)
{
$('.contest_viewer').html(data);
$('.button').button();
})
.fail(function () { $('.contest_viewer').html('There was an error.'); });
$('.ui-dialog-buttonpane').css('padding', '0').css('font-size', '8pt');
$('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');
},
resizable : false,
show : { effect : 'highlight', delay : 0, duration : 400, easing : 'easeInOutSine' },
title : 'OSAA {{ Helpers::getActivityName($information['activity_program']->activity) }}',
width : 900
});
$('.contest_details').click(function ()
{
$('.contest_viewer').attr('data-contest', $(this).attr('data-contest')).dialog('open');
})
.hover(function()
{
$(this).css({'cursor':'pointer'});
}, function()
{
$(this).css({'cursor':'auto'});
});
$("#add_a_school").button(
{
icons : {
primary : 'ui-icon-circle-plus'
}
}
).click(function ()
{
var n = $('input.other_school').size();
var label = $('
').attr('for', 'other_school_' + (n +1)).attr('class', 'input_label').html('School: ');
var input = $(' ').attr('style', 'width:325px').attr('class', 'school_autocomplete other_school').attr('name', 'other_school_' + (n +1)).attr('type', 'text');
input.autocomplete(
{
source : availableOpponents
});
$('#other_schools').append(label);
$('#other_schools').append(input);
$('#other_schools').append(' ');
});
function colorRows2()
{
var rows = 0;
$('table.roster tbody tr').each(function (row)
{
if (row % 2 == 0)
{
$(this).css('background-color', '#ffffff');
}
else
{
$(this).css('background-color', '#f2f2f2');
}
row = row + 1;
});
}
colorRows2();
$('.button.delete').click(function ()
{
var row_id = $(this).attr('data-player');
$('#player_' + row_id).remove();
colorRows2();
});
$('.button.add.player').click(function ()
{
var next_id = $('tbody tr').size() - 2;
var row = $('#new_player_row').clone();
row.attr('id', 'player_' + next_id)
.removeAttr('style');
$('input', row).each(function ()
{
$(this).attr('name', $(this).attr('name').replace('_X', '_' + (next_id)));
if ($(this).val() == "X")
{
$(this).val(next_id);
}
});
$('select', row).each(function ()
{
$(this).attr('name', $(this).attr('name').replace('_X', '_' + (next_id)));
});
$('.tooltip', row).tooltip();
$('.tooltip.right', row).tooltip({ position : {my: "left+15 middle", at: "right middle", collision: "flipfit"}});
$('.button.delete', row).button({ icons : { primary : 'ui-icon-closethick'}, text : false})
.attr('data-player', next_id)
.tooltip()
.click(function ()
{
var row_id = $(this).attr('data-player');
$('#player_' + row_id).remove();
colorRows2();
});
row.appendTo($('#new_player_row').parent());
$('[data-format="height"]', row).mask("9-9?9");
colorRows2();
});
function readURL(input)
{
if (input.files && input.files[0])
{
var reader = new FileReader();
reader.onload = function (e)
{
$('#preview').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$('#photo').change(function()
{
readURL(this);
});
$('#image_uploading').hide();
$('#upload_photo').click(function ()
{
$('#image_uploading').show();
});
$('#confirm_delete_dialog').dialog(
{
autoOpen: false,
resizable: false,
height:275,
width: 400,
modal: true,
buttons: {
"Yes": function() {
var team = $(this).attr('data-team');
$.ajax(
{
type : "POST",
url : '{{ url('/teams/remove-photo') }}',
data : { 'team' : team },
success : function()
{
/*location.reload();*/
/* Get the team photo container */
var p = $('#existing_team_photo').parent();
/* Remove the team photo and the delete button */
$('#existing_team_photo').remove();
$('#delete_photo_button').remove();
/* Add in the no image found template HTML */
$(p).html("No Team Photo Found Use the photo upload form to the left to upload a team photo.
");
}
});
$(this).dialog("close");
return true;
},
"No": function() {
$(this).dialog( "close" );
return false;
}
}
});
$('#delete_photo_button').click(function ()
{
$('#confirm_delete_dialog').dialog('open');
});
$('#confirm_delete_dialog_meet').dialog(
{
autoOpen: false,
resizable: false,
height:260,
width: 400,
modal: true,
buttons: {
"Yes": function() {
var team = $(this).attr('data-team');
var meet = $(this).attr('data-meet');
$.ajax(
{
type : "POST",
url : '{{ url('/meets/delete') }}',
data : { 'team' : team,
'meet' : meet },
success : function()
{
location.reload();
}
});
$(this).dialog("close");
return true;
},
"No": function() {
$(this).dialog( "close" );
return false;
}
}
});
$('.button.delete[data-action="delete"]').click(function ()
{
$('#confirm_delete_dialog_meet').attr('data-meet', $(this).attr('data-meet'))
.dialog('open');
});
$('#confirm_drop_dialog_meet').dialog(
{
autoOpen: false,
resizable: false,
height:225,
width: 400,
modal: true,
buttons: {
"Yes": function() {
var team = $(this).attr('data-team');
var meet = $(this).attr('data-meet');
$.ajax(
{
type : "POST",
url : '{{ url('/meets/drop') }}',
data : { 'team' : team,
'meet' : meet },
success : function()
{
location.reload();
}
});
$(this).dialog("close");
return true;
},
"No": function() {
$(this).dialog( "close" );
return false;
}
}
});
$('.button.cancel[data-action="drop"]').click(function ()
{
$('#confirm_drop_dialog_meet').attr('data-meet', $(this).attr('data-meet'))
.dialog('open');
});
// Click next button during stage 1
$('.button.next[data-stage="1"]').click(function ()
{
// Ensure meet type is selected
if ($('input[name="meet_type"]:checked').size() != 1)
{
alert ('You must select the type of the meet to continue.');
return false;
}
// Ensure host team is selected
if ($('input[name="host_team"]').val() == "")
{
alert ('You must enter in the hosting team\'s name.');
return false;
}
$('.error').effect("drop", { direction : "right"}, "slow");
// Transition to the next stage
$('[name="directions"]').effect("drop", { direction : "right"}, "slow", function ()
{
// Meet type is DUAL
if ($('input[name="meet_type"]:checked').val() == 'DUAL')
{
// Show the host name (safeified)
$('[name="hosting_team_name"]').html($('input[name="host_team"]').val().replace(/<\/?[^>]+(>|$)/g, ""));
// Do not allow the other team to be OOS if the host is OOS
if ($('input[name="host_is_oos"]:checked').length > 0 || $('input[name="host_team"]').val() != '{{ str_replace('\'', '\\\'', $information['activity_program']->name) }}')
{
$('input[name="other_team_is_oos"]').attr('disabled' , 'disabled');
$('input[name="other_team"]').val('{{ str_replace('\'', '\\\'', $information['activity_program']->name) }}').attr('disabled', 'disabled');
}
// Show the dual meet creator
$('[name="dual_creator"]').fadeIn();
}
else
{
// Show the host name (safeified)
$('[name="hosting_team_name"]').html($('input[name="host_team"]').val().replace(/<\/?[^>]+(>|$)/g, ""));
if ($('input[name="host_team"]').val() == '{{ str_replace('\'', '\\\'', $information['activity_program']->name) }}' || $('input[name="host_is_oos"]:checked').length > 0)
{
// Show the invitational meet creator (since this is the host team or the host is OOS)
$('[name="inv_creator"]').fadeIn();
}
else
{
// Show the invitational meet finder
$('.button.next_add').button('disable');
$('.button.join').button('disable');
$('select[name="available_meets"]').parent().append("
");
$('[name="inv_finder"]').fadeIn();
// Get a list of meets for this host team
var name = $('input[name="host_team"]').val().replace('/<\/?[^>]+(>|$)/g', "");
$('#returned_result_count').html('(Searching...)');
var jqxhr = $.ajax(
{
type : 'GET',
url : '/teams/get-meets?name=' + name + '&activity={{ $information['activity_program']->activity }}',
dataType : 'html'
});
jqxhr.done(function (data)
{
var list = $.parseJSON(data);
for (var i = 0; i < list.length; i++)
{
var id = list[i].id;
var value = list[i].value;
$('select[name="available_meets"]').append('' + value + ' ');
}
var c = list.length;
$('#returned_result_count').html('(Found ' + c + ' to choose from)');
});
jqxhr.fail(function ()
{
$('#returned_result_count').html('(Unable to find any)');
});
jqxhr.always(function ()
{
$('.button.next_add').button('enable');
$('.ajax_loader').hide();
});
}
}
});
// Disable the first form options
$('[name="meet_type"]').button("disable");
$('[name="host_team"]').attr('disabled', 'disabled');
$('[name="host_is_oos"]').attr('disabled', 'disabled');
$('[name="state"]').attr('disabled', 'disabled');
});
// Create button is clicked from the invitational meet finder
$('.button.next_add[data-from="INV_F"]').click(function ()
{
$('select[name="available_meets"]').children().remove();
$('#returned_result_count').html('');
// Show the host name (safeified)
$('[name="hosting_team_name"]').html($('input[name="host_team"]').val().replace(/<\/?[^>]+(>|$)/g, ""));
// Do not allow the other team to be OOS if the host is OOS
if ($('input[name="host_is_oos"]:checked').length > 0 || $('input[name="host_team"]').val() != '{{ str_replace('\'', '\\\'', $information['activity_program']->name) }}')
{
$('input[name="other_team_is_oos"]').attr('disabled' , 'disabled');
$('input[name="other_team"]').val('{{ str_replace('\'', '\\\'', $information['activity_program']->name) }}').attr('disabled', 'disabled');
}
// Transition to the next stage
$('[name="inv_finder"]').effect("drop", { direction : "right"}, "slow", function ()
{
$('.button.join').button('disable');
$('.button.next_add').button('disable');
// Show the inv meet creator
$('[name="inv_creator"]').fadeIn();
});
});
// Add teams button is clicked from the invitational meet creator
$('.button.add_teams[data-from="INV"]').click(function ()
{
// Make sure we have the required information
var d = $('#event_date2').val().replace(/<\/?[^>]+(>|$)/g, "");
if (d.match(/^\d{2}\/\d{2}\/\d{4}$/) == null)
{
alert ('You must enter the meet date in MM/DD/YYYY format.');
return false;
}
var n = $('#meet_name').val().replace(/<\/?[^>]+(>|$)/g, "");
if (n == '')
{
alert ('You must enter the meet name.');
return false;
}
// Show the meet name (safeified)
$('[name="new_inv_meet_name"]').html(n);
$('[name="new_inv_meet_date"]').html(d);
// Add the host to the list of participating schools
var h = $('input[name="host_team"]').val().replace(/<\/?[^>]+(>|$)/g, "");
if ($('input[name="host_is_oos"]:checked').length > 0)
{
h = h + ' (' + $('input[name="state"]:selected').val() + ')';
}
var e = '{{ str_replace('\'', '\\\'', $information['activity_program']->name) }}';
$('input[name="add_team[0]"]').val(h);
if (h != e)
{
$('input[name="add_team[1]"]').val(e);
}
// Transition to the next stage
$('[name="inv_creator"]').effect("drop", { direction : "right"}, "slow", function ()
{
// Show the add team view
$('[name="inv_creator2"]').fadeIn();
});
});
// Reset button is clicked from the dual meet creator
$('.button.reset[data-from="DUAL"]').click(function ()
{
$('#meet_adder').trigger('reset');
$('input[name="other_team_is_oos"]').removeAttr('disabled');
$('input[name="other_team"]').removeAttr('disabled');
// Transition to the previous stage
$('[name="dual_creator"]').effect("drop", { direction : "right"}, "slow", function ()
{
// Enable the first form options
$('[name="meet_type"]').button("enable");
$('[name="host_team"]').removeAttr('disabled');
$('[name="host_is_oos"]').removeAttr('disabled');
$('[name="state"]').attr('disabled', 'disabled');
// Show the dual meet creator
$('[name="directions"]').fadeIn();
});
});
// Reset button is clicked from the individual meet creator
$('.button.reset[data-from="INV"]').click(function ()
{
$('#meet_adder').trigger('reset');
$('input[name="other_team_is_oos"]').removeAttr('disabled');
$('input[name="other_team"]').removeAttr('disabled');
// Transition to the previous stage
$('[name="inv_creator"]').effect("drop", { direction : "right"}, "slow", function ()
{
// Enable the first form options
$('[name="meet_type"]').button("enable");
$('[name="host_team"]').removeAttr('disabled');
$('[name="host_is_oos"]').removeAttr('disabled');
$('[name="state"]').attr('disabled', 'disabled');
// Show the dual meet creator
$('[name="directions"]').fadeIn();
});
});
// Reset button is clicked from the individual meet creator
$('.button.reset[data-from="INV2"]').click(function ()
{
$('#meet_adder').trigger('reset');
$('input[name="other_team_is_oos"]').removeAttr('disabled');
$('input[name="other_team"]').removeAttr('disabled');
// Transition to the previous stage
$('[name="inv_creator2"]').effect("drop", { direction : "right"}, "slow", function ()
{
// Enable the first form options
$('[name="meet_type"]').button("enable");
$('[name="host_team"]').removeAttr('disabled');
$('[name="host_is_oos"]').removeAttr('disabled');
$('[name="state"]').attr('disabled', 'disabled');
// Show the dual meet creator
$('[name="directions"]').fadeIn();
});
});
// Reset button is clicked from the invitational meet finder
$('.button.reset[data-from="INV_F"]').click(function ()
{
$('#meet_adder').trigger('reset');
$('input[name="other_team_is_oos"]').removeAttr('disabled');
$('select[name="available_meets"]').children().remove();
$('#returned_result_count').html('');
// Transition to the previous stage
$('[name="inv_finder"]').effect("drop", { direction : "right"}, "slow", function ()
{
// Enable the first form options
$('[name="meet_type"]').button('enable');
$('[name="host_team"]').removeAttr('disabled');
$('[name="host_is_oos"]').removeAttr('disabled');
$('[name="state"]').attr('disabled', 'disabled');
$('.button.join').button('disable');
$('.button.next_add').button('disable');
// Show the dual meet creator
$('[name="directions"]').fadeIn();
});
});
$('select[name="available_meets"]').change(function ()
{
$('.button.join').button('enable');
});
$('.button.add_more_team_spots').click(function ()
{
$('[data-holder="teams"]').append(' ');
var i = $('input[type="text"]', '[data-holder="teams"]').size();
var row = $(' ').attr('style', 'width:215px')
.attr('class', 'school_autocomplete')
.attr('name', 'add_team[' + i + ']')
.attr('type', 'text');
row.autocomplete(
{
source : availableOpponents
});
$('[data-holder="teams"]').append(row);
$('[name="add_team[' + i + ']"').focus();
});
// Join an invitational
$('.button.join[data-from="INV_F"]').click(function ()
{
$('#meet_adder').append(' ');
$('#meet_adder').trigger('submit');
});
// Create a dual
$('.button.create[data-from="DUAL"]').click(function ()
{
// Make sure we have the required information
var d = $('#event_date').val().replace(/<\/?[^>]+(>|$)/g, "");
if (d.match(/^\d{2}\/\d{2}\/\d{4}$/) == null)
{
alert ('You must enter the meet date in MM/DD/YYYY format.');
return false;
}
var n = $('#other_team').val().replace(/<\/?[^>]+(>|$)/g, "");
if (n == '')
{
alert ('You must enter the name of the other team participating in this meet.');
return false;
}
$('[name="meet_type"]').button('enable');
$('[name="host_team"]').removeAttr('disabled');
$('[name="other_team"]').removeAttr('disabled');
$('[name="host_is_oos"]').removeAttr('disabled');
$('#state').removeAttr('disabled');
$('#meet_adder').append(' ');
$('#meet_adder').trigger('submit');
});
// Create an invitational
$('.button.create[data-from="INV"]').click(function ()
{
$('[name="meet_type"]').button('enable');
$('[name="host_team"]').removeAttr('disabled');
$('[name="host_is_oos"]').removeAttr('disabled');
$('#state').removeAttr('disabled');
$('#meet_adder').append(' ');
$('#meet_adder').trigger('submit');
});
@if (!Auth::user()->isOsaaUser())
@foreach (array('A', 'EX', 'PO') as $type)
@if (Input::old('contest_type') != $type)
var item = $('input[type="radio"][name="contest_type"][value="{{ $type }}"]');
item.attr('disabled', 'disabled');
item.button('disable');
@endif
@endforeach
@endif
/*
* Create contest expander
*/
var expand_create = $('h4[data-action="expand_create"]');
var expand_help = $('.help[data-action="expand_create"]');
var expand_image = $('img', expand_create);
var create_section = $('.add_contest');
expand_create
.css({'cursor' : 'pointer'})
.on('click', function(event)
{
event.preventDefault();
if (create_section.is(':visible'))
{
create_section.slideUp(400);
expand_help.slideDown(400);
expand_image.attr('src', '{{ asset('/images/icons/bullet_arrow_right.png') }}');
}
else
{
create_section.slideDown(400);
expand_help.slideUp(400);
expand_image.attr('src', '{{ asset('/images/icons/bullet_arrow_down.png') }}');
}
});
/*
* Copy team schedule feature
*/
$('#copy_schedule_list')
.menu()
.css({'display' : 'none',
'z-index' : '200',
'position' : 'absolute',
'font-size' : '9pt',
'right' : '0',
'top' : '23px',
'margin' : '0',
'padding' : '0',
'width' : '175px'});
$('#copy_schedule_list li ul')
.css({'margin' : '0',
'padding' : '0',
'width' : '160px'});
$('#copy_schedule_list img')
.css({'position' : 'relative',
'top' : '2px',
'margin-right' : '6px'});
$('.copy_schedule')
.button({ icons : { secondary : 'ui-icon-triangle-1-e'}})
.css({'float':'right',
'font-size':'8pt'})
.click(function (event)
{
if ($('#copy_schedule_list').is(':visible'))
{
$('#copy_schedule_list').slideUp(400);
$(this).button({icons : { secondary : 'ui-icon-triangle-1-e'}});
}
else
{
$('#copy_schedule_list').slideDown(400);
$(this).button({icons : { secondary : 'ui-icon-triangle-1-s'}});
}
event.stopPropagation();
});
$(document).on('click', function(event)
{
var list = $("#copy_schedule_list");
if (list.is(':visible'))
{
list.slideUp(400);
$('.copy_schedule').button({icons : { secondary : 'ui-icon-triangle-1-e'}});
event.stopPropagation();
}
});
$('[data-copy-to-level]').on('click', function(event)
{
// Do not follow link
event.preventDefault();
// Get the clicked link
var link = $(this);
// Get the target level information
var target_level = {
'slug' : link.attr('data-copy-to-level'),
'name' : link.attr('data-level-name')
};
// Show copy schedule dialog
$('
')
.appendTo('body')
.dialog(
{
draggable : false,
resizable : false,
height : 600,
width : 750,
modal : true,
title : 'Copy Varsity Schedule to ' + target_level.name + ' Team',
dialogClass : 'copy_schedule_dialog',
buttons: [
{
text : "Cancel",
'class' : "float_right",
icons : { primary : 'ui-icon-cancel'},
click : function()
{
// Cancel button is clicked
// Close the dialog box
$(this).dialog("close");
}
},
{
text : "Copy",
'class' : "float_left start_copy_button",
icons : { primary : 'ui-icon-copy'},
click : function()
{
var dialog_object = $(this);
// Copy button is clicked
// Show a confirmation box
$('
')
.appendTo('body')
.dialog(
{
modal : true,
draggable : true,
resizable : false,
title : 'Confirmation',
dialogClass : 'confirm_dialog',
height : 250,
width : 400,
buttons: [
{
text : "No",
'class' : "float_right",
icons : { primary : 'ui-icon-cancel'},
click : function()
{
// Confirmation not received
// Close the confirmation dialog box
$(this).dialog("close");
}
},
{
text : "Yes",
'class' : "float_left",
icons : { primary : 'ui-icon-check'},
click : function()
{
// Confirmation received
// Close the confirmation dialog box
$(this).dialog('close');
// Disable the buttons
var buttons = [
{
text : "Finish",
'class' : "float_right copy_schedule_buttons",
'data-autofocus' : "true",
icons : { primary : 'ui-icon-check'},
click : function()
{
// Show the loading window
$('')
.attr('data-loading', 1)
.addClass('ui-widget-overlay ui-front')
.appendTo('body');
$('
').appendTo('body')
.attr('data-loading', 1)
.css('width', '225px')
.css('height', '170px')
.css('text-align', 'center')
.css('padding', '0.5em')
.position({my : "center center", at : "center center", of : window})
.addClass('ui-dialog ui-widget ui-widget-content ui-corner-all ui-front')
.html('
Reloading...
Please wait while your page is reloaded ...
');
location.reload();
}
}
];
// Update the button options
dialog_object.dialog('option', 'buttons', buttons);
// Disable the buttons
$('.copy_schedule_buttons').button('disable');
// Hide the close button
$('.ui-dialog-titlebar-close', '.copy_schedule_dialog').css({'display' : 'none'});
// Change the title
dialog_object.dialog('option', 'title', 'Copying Varsity Schedule to ' + target_level.name + ' Team');
// Remove excluded contest rows
$('tr[data-include="0"]', '.copy_schedule_dialog').fadeOut(400, function() { $(this).remove() });
// Get the rows to process
var rows = $('tr[data-include="1"]', '.copy_schedule_dialog');
var total = rows.length;
// Ensure there are contests selected to copy
if (total < 1)
{
alert('You have not selected any contests to copy.');
location.reload();
}
// Lock in the rows of contests to be copied and update their icons
$('img.toggle_copy_inclusion', rows).attr('src', '{{ asset('/images/icons/ajax_loader2.gif') }}');
$('img.toggle_copy_inclusion', rows).unbind('click').css({'cursor' : 'auto'});
$('input[type="text"]', rows).attr('readonly', 'readonly').attr('disabled', 'disabled');
// Setup count variables
var error_count = 0;
var index = 0;
var stage = 0;
// Get the current height of the instructions text element
var previous_height = $('.instructions', dialog_object).height();
// Update the instruction text
var html = '
Copying Schedule... Please wait while your Varsity schedule is copied to your ' + target_level.name + ' schedule. This may take a while to process. Do not close this dialog or use your browser\'s back button. Progress:
';
$('.instructions', dialog_object).html(html);
// Setup the progress bar
var progress_bar = $('.sync_progressbar', dialog_object);
progress_bar.progressbar({ value : stage, max : total});
// Return the instructions to the correct height
$('.instructions', dialog_object).height(previous_height);
// Define a function to copy a contest from a row of data
function copyContest(index)
{
// Get the row
var row = $(rows[index]);
// Get the data object
var data = {
contest_id : row.attr('data-contest-id'),
time : $('input[name="time"]', row).val(),
dismiss_time : $('input[name="dismiss_time"]', row).val(),
depart_time : $('input[name="depart_time"]', row).val(),
return_time : $('input[name="return_time"]', row).val(),
designation : row.attr('data-designation'),
target_team : row.attr('data-target-team-id'),
target_level : target_level.slug
};
// Submit data to be copied to target team's schedule
var jqxhr = $.ajax(
{
type : 'POST',
url : '{{ url('teams') }}/' + {{ $information['team']->id }} + '/contests/' + row.attr('data-contest-id') + '/copy',
dataType : 'html',
data : data
})
.done(function (returned_data)
{
var error_returned = false;
try
{
var returned_status = $.parseJSON(returned_data);
if (returned_status.status != 'OK')
{
error_returned = true;
}
}
catch (err)
{
error_returned = true;
}
if (!error_returned)
{
// Turn this row green and update its icon
$('img.toggle_copy_inclusion', row).attr('src', '{{ asset('/images/icons/check_mark_16px.png') }}').attr('title', 'This contest was successfully copied.');
row.css({'background' : '#c9ffc9'});
}
else
{
// Turn this row red and update its icon
$('img.toggle_copy_inclusion', row).attr('src', '{{ asset('/images/icons/alert_16px.png') }}').attr('title', 'There was an error while attempting to copy this contest.');
row.css({'background' : '#f3cdc6'});
error_count += 1;
}
})
.fail(function (jqXHR, status, error)
{
// Turn this row red and update its icon
$('img.toggle_copy_inclusion', row).attr('src', '{{ asset('/images/icons/alert_16px.png') }}').attr('title', 'There was an error while attempting to copy this contest.');
row.css({'background' : '#f3cdc6'});
error_count += 1;
})
.always(function ()
{
index += 1;
stage += 1;
progress_bar.progressbar('value', stage);
// Done?
if (index == rows.length)
{
if (error_count == 0)
{
// No errors
$('.ui-progressbar-value', progress_bar).css({'background' : '#2ae44d'});
dialog_object.dialog('option', 'title', 'Copied Varsity Schedule to ' + target_level.name + ' Team');
$('.copy_status_icon', dialog_object).attr('src', '{{ asset('/images/icons/success_64px.png') }}');
$('.copy_status_title', dialog_object).html('Schedule Successfully Copied');
$('.copy_status_text', dialog_object).html('The Varsity schedule was successfully copied to your ' + target_level.name + ' schedule. The contests highlighted in green were copied successfully. Click
Finish to reload this page.');
}
else
{
// There were errors
$('.ui-progressbar-value', progress_bar).css({'background' : '#ff0000'});
dialog_object.dialog('option', 'title', 'Copy Varsity Schedule to ' + target_level.name + ' Team');
$('.copy_status_icon', dialog_object).attr('src', '{{ asset('/images/icons/yield_icon_72px.png') }}');
$('.copy_status_title', dialog_object).html('Finished with Errors');
$('.copy_status_text', dialog_object).html('There were errors while the Varsity schedule was copied to your ' + target_level.name + ' schedule. The contests highlighted in red were not copied successfully. Click
Finish to reload this page.');
}
// Enable the finish button
$('.copy_schedule_buttons').button('enable');
// Focus on the autofocus element
dialog_object.parent().find('[data-autofocus]').focus();
}
else
{
copyContest(index);
}
});
}
copyContest(index);
}
}
],
open : function ()
{
var html = '
Are you sure you wan to copy the selected Varsity contests to your ' + target_level.name + ' schedule?';
$(this).html(html);
$('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt');
$('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');
$('.confirm_dialog .ui-widget-header').css('background', '#f6a828 url(http://download.jqueryui.com/themeroller/images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x').css('border-color', '#f6a828');
$('.confirm_dialog.ui-widget-content').css('border-color', '#f6a828');
},
close : function ()
{
$(this).remove();
}
});
}
}],
open : function ()
{
var dialog_object = $(this);
dialog_object.html("
");
$('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt');
$('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%');
var jqxhr = $.ajax(
{
type : 'GET',
url : '{{ url('teams') }}/' + {{ $information['team']->id }} + '/copy-schedule?target-level=' + target_level.slug,
dataType : 'html'
})
.done(function (returned_data)
{
dialog_object.html(returned_data);
})
.fail(function (jqXHR, status, error)
{
try
{
var response = jqXHR.responseText;
var errorData = $.parseJSON(response);
dialog_object.html('
' + errorData.error.type + ' ' + errorData.error.message + '
Line ' + errorData.error.line + ' in ' + errorData.error.file);
}
catch(err)
{
dialog_object.html('There was an error.');
}
// Disable the submit button if there was an error
$('.start_copy_button').button('disable');
})
.complete(function ()
{
// Form logic and bindings
$('[data-format="contest_time"]', dialog_object).timepicker({ 'timeFormat': 'h:i A' , 'step' : 15, 'maxTime' : '10:00pm'});
$('img.toggle_copy_inclusion', dialog_object)
.css({'cursor' : 'pointer'})
.on('click', function(event)
{
var img = $(this);
var row = img.parents('tr');
var include = row.attr('data-include');
if (include == 1)
{
// Exclude
img.attr('src', '{{ asset('/images/icons/not_selected_16px.png') }}');
row.attr('data-include', 0);
row.addClass('odd');
}
else
{
// Include
img.attr('src', '{{ asset('/images/icons/check_16px.png') }}');
row.attr('data-include', 1);
row.removeClass('odd');
}
});
});
},
close : function ()
{
var dialog_object = $(this);
$(dialog_object).remove();
}
});
});
@stop
@section('page_functions')
Warning : Invalid argument supplied for foreach() in /home/osaa/web_app/dev/app/views/teams/edit.blade.php on line 1757
@if (Auth::user()->canAccessTeamTask($information['activity_program']->id, 'ADMIN', true) and $information['activity_program']->countTeams() < 5 and $information['activity_program']->getActivityType() == 'TS')
@endif
@stop
@section('main_content')
{{-- Success Bar --}}
@if (Session::has('success') or Session::has('success_alert'))
@if (Session::has('success'))
{{ Session::get('success') }}
@else
{{ Session::get('success_alert') }}
@endif
@endif
@if (Helpers::strEqual (Helpers::getActivityType($information['activity_program']->activity), array('TS', 'IS')))
Schedule
@endif
Roster
Team Photo
@if (Helpers::strEqual($information['activity_program']->activity, 'BBL'))
Pitch Counts
@endif
@if (Auth::user()->isOsaaUser() and Helpers::strEqual(Auth::user()->email, array('gibbyr@osaa.org', 'kellyf@osaa.org')))
Drop Team
@endif
@if ($information['team']->level == 'V')
Out-of-State Management
@endif
Public View
@if (Helpers::strEqual (Helpers::getActivityType($information['activity_program']->activity), array('TS', 'IS')))
Fatal error : Class 'Helpers' not found in /home/osaa/web_app/dev/app/views/teams/edit.blade.php on line 1826