@section('page_title') OSAA - Manage Hotels @stop @section('page_sub_title') Manage Headquarter Hotels @stop @section('scripts') @parent @stop @section('jquery_init') 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); }) }); /* * Custom tooltip items */ $('[data-tooltip]').each(function () { var item = $(this); var help = item.attr('data-tooltip'); item.tooltip({'content' : help, 'items' : item}); }); /* Positioned elements * * Elements that contain the attribute data-position="true" will be positioned * using JQuery's UI positioning utility. Other expected attributes define the * element's position: * data-position-my * data-position-at * data-position-of */ $('[data-position="true"]').each(function() { var element = $(this); var my = element.attr('data-position-my'); var at = element.attr('data-position-at'); var of = element.attr('data-position-of'); var options = $.parseJSON('{ "my" : "' + my + '", "at": "' + at + '", "of": "' + of + '"}'); element.position(options); }); // Table row highlighter function colorRows () { $('table').each(function () { var i = 0; $('tbody tr:visible', $(this)).each(function () { if (i % 2 == 1) { $(this).addClass('odd'); } else { $(this).removeClass('odd'); } i = i + 1; }); }); } colorRows(); /* * Close button */ $('.close_button') .button({'icons':{'primary':'ui-icon-circle-close'}}) .css({'font-size':'9pt', 'margin-left':'10px'}); /* * Delete hotel button */ $('[data-action="delete-hotel"]') .click(function(event) { event.preventDefault(); }); // Show the add/edit hotel dialog function showAddEdit(dialog_data) { var hotel_id = dialog_data.id; if (hotel_id == 0) { var dialog_title = 'Add a New Hotel'; } else { var dialog_title = 'Edit Hotel ID# ' + hotel_id; } var content_url = '{{ url('/admin/hotels/') }}/' + hotel_id + '/edit'; $('
') .appendTo('body') .dialog( { draggable : true, resizable : false, modal : true, height : 700, width : 750, title : dialog_title, buttons: [ { text : "Save", 'class' : "float_left", icons : { primary : 'ui-icon-disk'}, click : function() { // Get the form var form = $('form[name="add-edit-hotel"]', $(this))[0]; // Create an empty object to hold activity data var activity_data = {}; // Process each activity and save its data $('.activity_list .item').each(function(index) { var item = $(this); var name = item.attr('data-act-slug'); var value = { is_shown : $('input[type="checkbox"][name="is_shown"]', item).is(':checked'), is_hq : $('input[type="checkbox"][name="is_hq"]', item).is(':checked'), group : $('input[type="text"][name="group"]', item).val(), }; activity_data[name] = value; }); // Add the activity data to the form $('') .attr('name', 'activity_data') .attr('value', JSON.stringify(activity_data)) .appendTo('form'); // Exclude activity list inputs from being submitted $('.activity_list input', $(form)).attr('name', ''); //console.log($(form).serializeArray()); $('
') .addClass('ui-widget-overlay ui-front') .appendTo('body'); $('
').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') .html('
Saving...

Please wait while your form is saved...
'); form.submit(); } }, { text : "Cancel", 'class' : "float_right", icons : { primary : 'ui-icon-cancel'}, click : function() { // Close the dialog box $(this).dialog("close"); } }, { text : "Reset Form", 'class' : "float_right", icons : { primary : 'ui-icon-arrowrefresh-1-e'}, 'style' : 'margin-right: 40px;', click : function() { $('form[name="add-edit-hotel"]')[0].reset(); $('[data-autofocus="true"]', $(this)).focus(); } } ], open : function () { var dialog_object = $(this); dialog_object.html("
"); var jqxhr = $.ajax( { type : 'GET', url : content_url, dataType : 'html' }) .done(function (returned_data) { dialog_object.html(returned_data); }) .fail(function (jqXHR, status, error) { var response = jqXHR.responseText; var errorData = $.parseJSON(response); console.log(errorData); dialog_object.html("There was an error loading the information.

" + errorData.error.message); $(".ui-dialog-buttonpane button:contains('Save')").button("disable"); {{-- $(".ui-dialog-buttonpane button:contains('Delete')").button("disable"); --}} }) .complete(function () { $('[data-required]', dialog_object).after('*'); $('[data-autofocus="true"]', dialog_object).focus(); $('[data-action="clear-activity"]', dialog_object).click(function(event) { event.preventDefault(); var item = $(this).parents('.item'); $('input[type="checkbox"]', item).removeAttr('checked'); $('input[type="text"]', item).val(''); }); }); $('.ui-dialog-buttonpane', dialog_object.parents('.ui-dialog')).css({'padding' : '0 0.5em', 'font-size' : '9pt', 'position' : 'relative'}); $('.ui-dialog-buttonpane .ui-dialog-buttonset', dialog_object.parents('.ui-dialog')).css({'width' : '100%'}); }, close : function () { if (hotel_id != 0) { dialog_data.row.removeClass('highlight'); } var dialog_object = $(this); $(dialog_object).remove(); } }); } /* * New hotel button */ $('[data-action="new-hotel"]') .button({'icons':{'primary':'ui-icon-circle-plus'}}) .css({'font-size':'9pt'}) .click(function(event) { event.preventDefault(); var button = $(this); var dialog_data = { id : 0 }; showAddEdit(dialog_data); }); /* * Edit hotel button */ $('[data-action="edit-hotel"]') .click(function(event) { event.preventDefault(); var button = $(this); button.blur(); var hotel_id = parseInt(button.attr('data-id')); var row = button.parents('tr'); row.addClass('highlight'); var button = $(this); var dialog_data = { id : hotel_id, row : row }; showAddEdit(dialog_data); }); @stop @section('page_functions') Close @stop @section('main_content') {{-- Success Bar --}} @if (Session::has('success'))
{{ Session::get('success') }}
@endif {{-- Errors --}} @if (Session::has('errors'))
@foreach ($errors->all() as $error) {{ $error }} @endforeach
@endif
New Hotel

List of Hotels

@if (count($info['hotels']) > 0) {{-- --}} {{-- --}} @foreach ($info['hotels'] as $hotel) {{-- --}} {{-- --}} @endforeach
Name Instructions PhoneEmailTouringActivities
@if (Helpers::strIsEmpty($hotel->website)) {{ $hotel->name }} @else {{ $hotel->name }} @endif {{ $hotel->instructions }} {{ $hotel->phone }} {{ $hotel->email }} @if (Helpers::strIsEmpty($hotel->local_website)) {{ $hotel->local_text }} @else {{ $hotel->local_text }} @endif
Warning: Invalid argument supplied for foreach() in /home/osaa/web_app/dev/app/views/admin/manage_hotels.blade.php on line 595
{{ implode(', ', $display_activities) }}
@else There are no hotels in the database to display. @endif

@stop