@section('page_title')
{{ $info['school']->short_name }}
@stop
@section('page_sub_title')
{{ $info['school']->name }} School Staff Listing
@stop
@section('scripts')
@parent
@stop
@section('jquery_init')
// Make this script play well with IE8
if (typeof String.prototype.trim !== 'function')
{
String.prototype.trim = function()
{
return this.replace(/^\s+|\s+$/g, '');
}
}
// Clean up any console issues
if(!window.console)
{
window.console = { log: $.noop, group: $.noop, groupEnd: $.noop };
}
// 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);
})
});
// Help Button
$('.help_button')
.button({ icons : { primary : 'ui-icon-help'}})
.css({'margin-right' : '10px', 'font-size' : '9pt'});
// Back Button
$('.back_button')
.button({ icons : { primary : 'ui-icon-arrowthick-1-w'}})
.css({'font-size' : '9pt'});
// Staff table
$('.staff_table').DataTable({
'paging' : false,
'order' : [1, 'asc'],
'columnDefs' : [
{'searchable' : false, 'targets' : [4, 5]}
]
});
function transitionToAction(action, staff_id, other_id)
{
var html = '';
$('body').css({'cursor' : 'wait'});
$('.help_dialog').addClass('loading');
// Disable buttons
if (action == 'delete' || action == 'merge')
{
$('[data-action="delete"]').button('disable');
$('[data-action="merge"]').button('disable');
}
else
{
$('[data-action="cancel"]').button('disable');
}
var url = '{{ url('/schools/' . $info['school']->id . '/edit-staff/listing') }}/' + staff_id + '?action=' + action;
if (action == 'merge-staff')
{
url += '&other-id=' + other_id;
}
var jqxhr = $.ajax(
{
type : 'GET',
url : url,
dataType : 'html'
})
.done(function (data)
{
html = data;
})
.fail(function (jqXHR, status, error)
{
var response = jqXHR.responseText;
var errorData = $.parseJSON(response);
console.log(errorData);
html = '
' + errorData.error.type + '
' + errorData.error.message + '
Line ' + errorData.error.line + ' in ' + errorData.error.file;
if (html == '')
{
html('There was an unknown error.');
}
})
.always(function()
{
// Transition to the next stage
$('[name="action-content"]').effect("drop", { direction : "right"}, "slow", function ()
{
// Show the cancel button
if (action != 'cancel')
{
$('[data-action="cancel"]').button('enable').fadeIn();
}
else
{
$('[data-action="cancel"]').fadeOut();
$('[data-action="delete"]').button('enable');
$('[data-action="merge"]').button('enable');
}
// Replace content
$('[name="action-content"]').html(html);
// Modify content
if (action == 'delete')
{
$('[data-action="delete-school-staff"]').button();
}
if (action == "merge")
{
$('a[data-action="merge-staff"]').on('click', function(event)
{
event.preventDefault();
transitionToAction('merge-staff', staff_id, $(this).attr('data-other-staff-id'));
});
}
if (action == "merge-staff")
{
$('[data-action="merge-school-staff"]').button();
}
// Show new content
$('[name="action-content"]').fadeIn(400, function() {
// Done loading
$('.help_dialog').removeClass('loading');
$('body').css({'cursor' : ''});
});
});
});
}
// Edit/Merge link
$('a[data-action="edit"]').on('click', function(event)
{
event.preventDefault();
var link = $(this);
var staff_id = link.attr('data-staff-id');
$('')
.appendTo('body')
.dialog(
{
resizable: false,
height : 500,
width : 700,
modal : false,
dialogClass : 'edit_school_staff_dialog',
title: 'Edit / Merge School Staff Record',
open : function ()
{
var dialog_object = $(this);
dialog_object.html("");
var jqxhr = $.ajax(
{
type : 'GET',
url : '{{ url('/schools/' . $info['school']->id . '/edit-staff/listing') }}/' + staff_id,
dataType : 'html'
})
.done(function (data)
{
dialog_object.html(data);
$('a[data-action="cancel"]', dialog_object)
.button()
.on('click', function(event)
{
event.preventDefault();
transitionToAction('cancel', staff_id);
});
$('a[data-action="merge"]', dialog_object)
.button()
.on('click', function(event)
{
event.preventDefault();
transitionToAction('merge', staff_id);
});
$('a[data-action="delete"]', dialog_object)
.button()
.on('click', function(event)
{
event.preventDefault();
transitionToAction('delete', staff_id);
});
}).fail(function (jqXHR, status, error)
{
var response = jqXHR.responseText;
var errorData = $.parseJSON(response);
console.log(errorData);
dialog_object.html('' + errorData.error.type + '
' + errorData.error.message + '
Line ' + errorData.error.line + ' in ' + errorData.error.file);
if (dialog_object.html() == '')
{
dialog_object.html('There was an error.');
}
});
}
});
});
@stop
@section('page_functions')
Help
Back
@stop
@section('main_content')
{{-- Success Bar --}}
@if (Session::has('success'))
{{ Session::get('success') }}
@endif
{{-- School staff list --}}
| ID # |
Name |
Email |
School Contacts |
Updated |
|
@foreach ($info['school_staff'] as $staff)
| {{ $staff->id }} |
{{ $staff->getDisplayName()}} |
{{ $staff->email }} |
@if ($staff->is_on_school_contacts)
{{ $staff->getDisplayRole() }}
@endif
|
{{ date('n/j/Y g:ia', strtotime($staff->updated_at)) }}, {{ $staff->updated_by }} |
Edit / Merge |
@endforeach
@stop