@section('page_title') OSAA - Officials Associations @stop @section('page_sub_title') Local Officials Associations & Commissioners @stop @section('scripts') @parent @stop @section('jquery_init') $('.associations_list .association_row:odd').css('background-color', '#f2f2f2'); @if (Auth::check() and Auth::user()->isOsaaUser()) $('.assign_commissioner') .click(function(event) { event.preventDefault(); var link = $(this); var parent = link.parents('.association_row'); var association_id = parent.attr('data-id'); var association_name = $('.association_name', parent).text(); $('
') .appendTo('body') .dialog( { title : 'Assign Commissioner', height : 300, width : 600, draggable : false, resizable : false, modal : true, buttons: [ { text : "Go", 'class' : "float_left", icons : { secondary : 'ui-icon-triangle-1-e'}, click : function() { var dialog_object = $(this); // Get the data from the form fields if ($('input[name="first_name"]', dialog_object).size() > 0) { var data = { email : $('input[name="email"]', dialog_object).val(), first_name : $('input[name="first_name"]', dialog_object).val(), last_name : $('input[name="last_name"]', dialog_object).val(), work_phone : $('input[name="work_phone"]', dialog_object).val(), mobile_phone : $('input[name="mobile_phone"]', dialog_object).val(), create_new_user : "true" }; } else { var data = { email : $('input[name="email"]', dialog_object).val() }; } // Debug console.log(data); // Show the loading animation while the e-mail address is looked up dialog_object.html("
"); // Submit the change var jqxhr = $.ajax( { type : 'POST', url : 'http://www.osaa.org/officials/associations/' + association_id + '/assign-commissioner', data : data, dataType : 'html' }) .done(function (return_data) { // User was not found if (return_data == 'No Such User') { var html = '
' + association_name + '
'; html += '
That e-mail address was not found. Please provide additional information to create a new user. Phone numbers are optional.
'; html += '
E-Mail: '; html += ''; html += '
'; html += '

'; html += '
First Name: '; html += ''; html += '
'; html += '
Last Name: '; html += ''; html += '
'; html += '

'; html += '
Work Phone: '; html += ''; html += '
'; html += '
Mobile Phone: '; html += ''; html += '
'; html += '

'; html += '
This will create a new user and assign him/her as the commissioner. The user\'s default password will be "Cmsh2014" and must be changed at first login.

Click Go when ready.
'; // Expand the dialog box, change the text, and focus where it should dialog_object .animate({'height' : 325}, 400, 'swing', function() { dialog_object.hide() .html(html) .fadeIn('slow', function() { $('[data-autofocus="true"]', dialog_object).focus(); }); }); } // User was found else { // Reload the page location.reload(); } }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); console.log(errorData); alert ("There was an error.\n\n" + errorData.error.message + "\n\nPlease try again."); location.reload(); }); } }, { text : "Cancel", 'class' : "float_right", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); } } ], open : function () { var dialog_object = $(this); var html = '
' + association_name + '
'; html += '
Assign a commissioner to this association by e-mail address. If the e-mail address is not found, you will be prompted to create a new user for the commissioner. Click Go when ready.
'; html += '
E-Mail: '; html += ''; html += '
'; html += '

'; dialog_object.html(html); $('.ui-dialog-buttonpane').css('padding', '0 0.5em').css('font-size', '9pt'); $('.ui-dialog-buttonpane .ui-dialog-buttonset').css('width', '100%'); $('[data-autofocus="true"]').focus(); }, close : function () { var dialog_object = $(this); $(dialog_object).remove(); } }); }); @endif @stop @section('page_functions') @stop @section('main_content')
@foreach ($info['list'] as $sport => $loas)

{{ $sport }}

@foreach ($loas as $loa)
{{ $loa->name }}
@if (!is_null($loa->commissioner)) {{ $loa->commissioner->user->getDisplayFullName() }} @else @if (Auth::check() and Auth::user()->isOsaaUser()) Add Commissioner @else - - @endif @endif
@if (!is_null($loa->commissioner)) {{ Helpers::obfuscateEmailLink($loa->commissioner->user->email) }} @else - - @endif
{{ ucfirst(strtolower($loa->oregon_region)) }}
@endforeach
@endforeach @stop