<?php
/*
*	CityHub master template file
*
*	Contains variables for content input
*	-	$title				-	string	-	Page title, for <title> and og:title (if not default)
*	-	$css_files			-	array	-	list of additional CSS files
*	-	$js_header_files	-	array	-	list of additional JS files
*	-	$js_footer_files	-	array	-	list of additional JS files
*	-	$load_map_layout	-	boolean	-	true if map layout with fixed sizes should be loaded
*											(should be used with $load_google_maps = true)
*	-	$load_map_layout_reports	-	boolean	-	true if map layout for reports should be loaded
*	-	$load_map_layout_polygon	-	boolean -	true if map layout for polygonal shape should be loaded
*											(should be used with $load_google_maps = true)
*	-	$load_google_maps	-	boolean	-	true if Google Maps should be loaded
*	-	$body_content		-	boolean -	false if body tag should be empty of HTML tags, except
*											footer JS and Google Analytics
*/
?>
<?php //$cities = City::getCity();echo '<pre>'; print_r($cities);exit;
//var_dump(bin2hex("💪")); die();
?>

<!DOCTYPE html>
<html lang="<?php echo App::getLocale(); ?>" class="no-js">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <?php
    //$test = $test ? $test : false;

    if (isset($title)) {
        $title = $title . ' :: ' . Lang::get('core.cityhub');
    } else {
        $title = Lang::get('core.cityhub_title');
    }
    ?>
    <title><?php echo $title; ?></title>

    <meta property="og:title" content="<?php echo $title; ?>">
    <meta property="og:site_name" content="<?php echo Lang::get('core.cityhub_title'); ?>">

    <?php
    if (!isset($excerpt)) {
        $excerpt = Lang::get('core.meta_description');
    }
    ?>
    <meta property="og:description" content="<?php echo $excerpt; ?>">
    <meta property="og:type" content="website">
    <meta property="og:url" content="<?php echo url(); ?>/<?php echo Request::path(); ?>">

    <?php
    if (!isset($image)) {
        $image = 'img/core/og-cityhub.jpg';
    }
    ?>
    <meta property="og:image" content="<?php echo URL::route('getHome'); ?>/uploads/cityBlog/<?php echo $image; ?>">

    <meta name="description" content="<?php echo $excerpt; ?>">
    <meta name="keywords" content="<?php echo Lang::get('core.meta_keywords'); ?>">
    <meta name="author" content="MicroHub GmbH <info@microhub.de>">
    <meta name="Publisher" content="https://plus.google.com/107075430277881701825">

    <link rel="icon" href="<?php echo URL::asset('favicon.png'); ?>">
    <!--[if IE]>
    <link rel="shortcut icon" href="<?php echo URL::asset('favicon.ico'); ?>"><![endif]-->

    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="msapplication-TileImage" content="<?php echo URL::asset('img/core/icon-72@2x.png'); ?>">

    <link rel="apple-touch-icon-precomposed" href="<?php echo URL::asset('img/core/icon.png'); ?>">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php echo URL::asset('img/core/icon-72.png'); ?>">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php echo URL::asset('img/core/icon@2x.png'); ?>">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="<?php echo URL::asset('img/core/icon-72@2x.png'); ?>">

    <link href='https://fonts.googleapis.com/css?family=Roboto:400,700,900,300&subset=latin,latin-ext' rel='stylesheet'
          type='text/css'>


    <?php /* Load the Modernizr before everything, for feature detection */ ?>
    <?php echo HTML::script('js/vendor/modernizr.js'); ?>

  <!--  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">-->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.2/css/materialize.css">


    <?php echo HTML::style('css/materialize.css'); ?>

    <?php echo HTML::style('css/vendor/animate.min.css'); ?>

    <?php echo HTML::style('css/style.css'); ?>

    <?php echo HTML::style('css/materialicons.css'); ?>

    <?php /* HTML::style('https://fonts.googleapis.com/icon?family=Material+Icons') */ ?>




    <?php /*
        <?php echo HTML::style('css/vendor/animate.min.css'); ?>

        <?php echo HTML::style('css/core/fonts.css'); ?>

        <?php echo HTML::style('css/vendor/icomoon.css'); ?>

        <?php echo HTML::style('css/core/core.css'); ?>

        <?php echo HTML::style('https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css'); ?>

        <?php echo HTML::style('css/vendor/jquery.mCustomScrollbar.css'); ?>

        <?php echo HTML::style('css/core/bootstrap-select.css'); ?>


        */ ?>


    <?php /* Load map layout? */ ?>
    <?php if(isset($load_map_layout) && $load_map_layout == true): ?>
        <?php echo HTML::style('css/core/coreMapLayout.css'); ?>

    <?php endif; ?>

    <?php if(isset($load_map_layout_polygon) && $load_map_layout_polygon == true): ?>
        <?php echo HTML::style('css/core/coreMapLayout-polygon.css'); ?>

    <?php endif; ?>

    <?php /* Loop that implements additional CSS for a module and/or view */ ?>
    <?php if(isset($css_files) && is_array($css_files)): ?>
        <?php foreach($css_files as $css_file): ?>
            <?php echo HTML::style($css_file); ?>

        <?php endforeach; ?>
    <?php endif; ?>

    <?php echo HTML::script('https://code.jquery.com/jquery-2.1.1.min.js'); ?>


    <?php echo HTML::script('js/vendor/jquery.noty.packaged.min.js'); ?>

    <?php echo HTML::script('js/vendor/jquery.numeric.js'); ?>

    <?php echo HTML::script('js/core/noty.cityhub.theme.js'); ?>

    <?php /*<?php echo HTML::script('js/core/core.js'); ?>*/ ?>
    <?php /*<?php echo HTML::script('js/vendor/jquery.mCustomScrollbar.js'); ?>*/ ?>
    <?php echo HTML::script('js/vendor/underscore-min.js'); ?>

    <?php echo HTML::script('https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js'); ?>

    <?php echo HTML::script('js/core/bootstrap-select.js'); ?>

    <?php echo HTML::script('js/tree/jquery-ui.min.js'); ?>

    <?php /* HTML::script('js/new/bin/materialize.min.js') */ ?>
    <?php /* HTML::script('js/new/bin/materialize.js') */ ?>
    <?php echo HTML::script('js/new/bin/materialize-compiled.js'); ?>

    <?php echo HTML::script('js/new/main.js'); ?>

    <?php echo HTML::script('js/vendor/he-1.1.1/he.js'); ?>



    <?php /* Loads default path to a JS variable (no trailing slash) */ ?>
    <script>
        var rootPath = "<?php echo e(url('/')); ?>";

         warningLabels =
            {
                "file_type_warning":'<?php echo Lang::get('tree.msg.warning.file_extension'); ?>'
            }
    </script>

    <?php /* Load maps? */ ?>
    <?php if(isset($load_google_maps) && $load_google_maps == true): ?>
        <?php echo HTML::script('https://maps.googleapis.com/maps/api/js?key=AIzaSyD4vM-7czsLO6IC22zWsSXwVyYUaR0eitA&libraries=places&language='. App::getLocale()); ?>

    <?php endif; ?>

    <?php /* Load map layout JS? */ ?>
    <?php if(isset($load_map_layout) && $load_map_layout == true): ?>
        <?php echo HTML::script('js/core/coreMapLayout.js'); ?>

    <?php endif; ?>

    <?php /* Load map reports layout JS? */ ?>
    <?php if(isset($load_map_layout_reports) && $load_map_layout_reports == true): ?>
        <?php echo HTML::script('js/core/coreMapLayout.js'); ?>

    <?php endif; ?>

    <?php /* Load map reports layout JS? */ ?>
    <?php if(isset($load_map_layout_polygon) && $load_map_layout_polygon == true): ?>
        <?php echo HTML::script('js/core/coreMapLayout.js'); ?>

    <?php endif; ?>


    <?php /* Loop that implements additional header JS for a module and/or view */ ?>
    <?php if(isset($js_header_files) && is_array($js_header_files)): ?>
        <?php foreach($js_header_files as $js_file): ?>
            <?php echo HTML::script($js_file); ?>

        <?php endforeach; ?>
    <?php endif; ?>

</head>
<body role="document" <?php if(Route::getCurrentRoute()->getPath() === 'sign-in' OR Route::getCurrentRoute()->getPath() === 'forgot-password'  OR strpos(Route::getCurrentRoute()->getPath(), 'reset-password')>-1): ?> class="signinpage" <?php endif; ?>>

<!-- Google Tag Manager (noscript) -->
<noscript>
    <iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MX5MQTC"
            height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<!-- End Google Tag Manager (noscript) -->


<!-- Header and side nav section start -->
<header>
    <nav class="top-nav">
        <div class="logo"></div>

        <select onChange="window.location.href=this.value">
            <?php $language_iso_name = App::getLocale(); ?>
            <?php $languages = Language::getLanguage(); ?>
            <?php if($languages['status'] == 1): ?>
                <?php foreach($languages['languages'] as $language): ?>
                    <option <?php echo ($language_iso_name==$language->iso_tag)?'selected':''; ?> value="<?php echo URL::route('switchLang', array('id' => $language->iso_tag)); ?>"><?php echo $language->tag; ?></option>
                <?php endforeach; ?>
            <?php endif; ?>
        </select>

    </nav>
    <a href="#" data-activates="nav-mobile"
       class="button-collapse top-nav waves-effect waves-light hide-on-large-only nav-collapse-btn"><i
                class="material-icons">menu</i></a>
    <ul id="nav-mobile" class="side-nav fixed">

        <?php if(Auth::user()): ?>
            <a class='dropdown-button btn truncate' href='#'
               data-activates='user-dropdown'><?php echo Auth::user()->first_name . ' ' . Auth::user()->last_name; ?> <i
                        class="material-icons">keyboard_arrow_down</i></a>

            <ul id='user-dropdown' class='dropdown-content'>
                <li><a href="<?php echo URL::route('getProfile'); ?>"><?php echo Lang::get('core.menu_profile'); ?></a></li>
                <li><a href="<?php echo URL::route('getSignOut'); ?>"><?php echo Lang::get('core.menu_sign_out'); ?></a></li>
            </ul>

            <?php if(Entrust::hasRole('admin') || Entrust::hasRole('superadmin') || Entrust::hasRole('manager')): ?>
                <?php
                if (Entrust::hasRole('superadmin')) {
                    Session::put('city_id', 0);
                }
                $city = CitiesUsers::getListByUser(Auth::user()->id);
                $currentCity = Session::get('city_id');
                $menuSet = 1; // dashboard
                //segmenti za menu
                $segments = Request::segments();

                if (isset($segments[0]) && $segments[0] == "dashboard")
                    $menuSet = 1;
                if (isset($segments[0]) && $segments[0] == "communal-service")
                    $menuSet = 2;
                if (((isset($segments[0]) && $segments[0] == "info") OR (isset($segments[0]) && $segments[0] == "homescreen")))
                    $menuSet = 3;
                if (((isset($segments[0]) && $segments[0] == "cityoptions") ))
                    $menuSet = 8;
                if (strpos(Request::path(), 'send-email')!==false)
                    $menuSet = 9;



                ?>
                <?php if(Entrust::hasRole('admin') || Entrust::hasRole('manager')): ?>
                    <div class="select-city-wrapper">
                        <select id="selected-city" onchange="selectCity()">
                            <?php foreach($city as $ki=>$cityData): ?>
                                <?php if (!Session::has('city_id')) {
                                    Session::put('city_id', $cityData->id);
                                } ?>

                                <option <?php echo (Session::get('city_id')==$cityData->id)?'selected':''; ?>

                                        value="<?php echo $cityData->id; ?>"><?php echo $cityData->name; ?></option>

                            <?php endforeach; ?>
                        </select>
                    </div>
                <?php endif; ?>
            <?php endif; ?>

            <li class="bold <?php if(isset($menuSet) && $menuSet == 1): ?>active <?php endif; ?>"><a
                        href="<?php echo URL::route('getDashboard'); ?>"
                        class="waves-effect waves-grey"><?php echo Lang::get('core.menu_dashboard'); ?></a></li>

        <?php if(Entrust::hasRole('manager')): ?>


                <li class="bold <?php if(isset($menuSet) && $menuSet == 3): ?>active <?php endif; ?>"><a
                            href="<?php echo URL::route('showTree'); ?>"
                            class="waves-effect waves-grey"><?php echo Lang::get('core.menu_cityinfo'); ?></a></li>

        <?php endif; ?>

   <?php if(Entrust::hasRole('admin') || Entrust::hasRole('superadmin')): ?>

       <?php if(Entrust::hasRole('superadmin')): ?>

       <li class="bold <?php if(isset($menuSet) && $menuSet == 2): ?>active <?php endif; ?>">
           <a href="<?php echo URL::route('CommunalServiceCityReports'); ?>"
              class="waves-effect waves-grey"><?php echo Lang::get('communalService.module_name'); ?></a>

       </li>
        <li class="bold <?php if(isset($menuSet) && $menuSet == 9): ?>active <?php endif; ?>">
        <a href="<?php echo URL::route('sendEmailToAdmins'); ?>"
        class="waves-effect waves-grey"><?php echo Lang::get('core.menu_sendmail'); ?></a>

        </li>
       <?php endif; ?>
        <?php if(Entrust::hasRole('admin')): ?>

       <li class="bold <?php if(isset($menuSet) && $menuSet == 3): ?>active <?php endif; ?>"><a
                   href="<?php echo URL::route('getCategoryTree'); ?>"
                   class="waves-effect waves-grey"><?php echo Lang::get('core.menu_cityinfo'); ?></a></li>
        <?php endif; ?>


       <?php if(Entrust::hasRole('admin')): ?>
           <?php
           $modules=CitiesModules::getModulesByCity(Session::get('city_id'));

           ?>

       <?php foreach($modules['modules'] as $module): ?>



               <li class="bold <?php if(strpos(Request::path(), $module->module_route_prefix)!==false): ?>active <?php endif; ?>">
                   <a href="<?php echo URL::route($module->module_landing_fn); ?>"
                      class="waves-effect waves-grey"><?php echo Lang::get($module->module_identifier . '.module_name'); ?></a>

               </li>
               <?php
                   if(strpos(Request::path(), $module->module_route_prefix)!==false){

                       $menuSet=5;
                       $tab= Lang::get($module->module_identifier . '.module_name') ;
                   }
                   if(strpos(Request::path(), 'communal-service')!==false){

                       $menuSet=2;
                   }
                   if(strpos(Request::path(), 'cityforms/city-form')!==false){

                       $menuSet=6;
                   }
                   if(strpos(Request::path(),'volunteer/posts/')!==false)
                   {
                      $menuSet = 7;
                   }




           ?>

       <?php endforeach; ?>

       <li class="bold <?php if(isset($menuSet) && $menuSet == 8): ?>active <?php endif; ?>"><a href="<?php echo URL::route('GetCityOptions', Session::get('city_id')); ?>"
                                                                              class="waves-effect waves-grey"><?php echo ucfirst(trim(Lang::get('communalService.title_city_options', ['name' => '']))); ?></a>
       </li>

       <?php endif; ?>
   <?php endif; ?>

<?php endif; ?>
</ul>
</header>
<!-- Header and side nav section end -->


<div class="body-content">


<?php

if (isset($body_content)) {
$displayContent = $body_content;
} else {
$displayContent = true;
}
?>
<?php if($displayContent == true): ?>

<main class="mainContent">

   <?php /* No Javascript warning */ ?>
   <noscript>
       <div class="container">
           <div class="row">
               <div class="col-xs-12">
                   <p class="text-center bordered-danger no-javascript-warning"><?php echo Lang::get('core.no_javascript'); ?></p>
               </div>
           </div>
       </div>
   </noscript>

   <div class="progress" style="visibility: hidden;">
       <div class="indeterminate"></div>
   </div>
   <div class="main-holder">
       <!--
    MAINTENANCE MESSAGE

       <div class="row" style="background-color:#E74C3C;border-radius:8px;">
           <h4 style="color:#ddd;margin:0 auto;text-align: center;">We are about to upgrade the system. During the upgrade system will not work properly.<br> Estimated duration is 2 hours. Upgrade will start at 10:30.<br> Thank you for your patience</h4>
       </div>-->
       <div class="row">
           <?php if(isset($menuSet)): ?>
               <div class="col s12">
                   <ul id="tabs-top" class="tabs tabs-fixed-width">
                       <?php if($menuSet == 1): ?>
                           <li class="tab progressbar"><a
                                       class=" <?php echo Request::url()==URL::route('getHome')?'active':''; ?>"
                                       target="_self"
                                       href="<?php echo URL::route('getHome'); ?>"><?php echo ucfirst(Lang::get('core.overview')); ?></a>
                           </li>
                           <?php if(Entrust::hasRole('superadmin')): ?>
                               <li class="tab progressbar"><a
                                           class=" <?php echo Request::url()==URL::route('getListCities')?'active':''; ?>"
                                           target="_self"
                                           href="<?php echo URL::route('getListCities'); ?>"
                                           id="city-list"><?php echo Lang::get('core.menu_cities'); ?></a></li>
                           <?php endif; ?>

                           <?php if(!Entrust::hasRole('manager')): ?>
                               <li class="tab progressbar"><a
                                           class=" <?php echo strpos(Request::url(), 'users')>-1?'active':''; ?>"
                                           target="_self"
                                           href="<?php echo URL::route('getUsersList'); ?>"><?php echo Lang::get('core.menu_users'); ?></a>
                               </li>
                           <?php endif; ?>
                           <?php if(Entrust::hasRole('superadmin')): ?>
                           <li class="tab progressbar"><a
                                       class=" <?php echo Request::url()==URL::route('getSubscriberList')?'active':''; ?>"
                                       target="_self"
                                       href="<?php echo URL::route('getSubscriberList'); ?>"><?php echo Lang::get('dashboard.subscribers'); ?></a>
                           </li>
                           <?php endif; ?>
                           <?php if(!Entrust::hasRole('manager')): ?>
                           <li class="tab progressbar"><a
                                       class=" <?php echo strpos(Request::url(), 'companies')>-1?'active':''; ?>"
                                       target="_self"
                                       href="<?php echo URL::route('getCompaniesList'); ?>"><?php echo Lang::get('core.menu_companies'); ?></a>
                           </li>
                           <li class="tab progressbar"><a
                                       class=" <?php echo Request::url()==URL::route('getCategoryStatistics')?'active':''; ?>"
                                       target="_self"
                                       href="<?php echo URL::route('getCategoryStatistics'); ?>"><?php echo Lang::get('dashboard.view_statistics'); ?></a>
                           </li>

                           <?php endif; ?>
                           <?php if(Entrust::hasRole('admin')): ?>
                               <li class="tab progressbar"><a
                                           class=" <?php echo Request::url()==URL::route('getCategoryShared')?'active':''; ?>"
                                           target="_self"
                                           href="<?php echo URL::route('getCategoryShared'); ?>"><?php echo Lang::get('dashboard.sharing'); ?></a>
                               </li>
                           <?php endif; ?>

                       <?php elseif($menuSet == 2): ?>


                           <?php if(Entrust::hasRole('admin')): ?>

                               <li class="tab progressbar">
                                   <a class=" <?php echo Request::url()==URL::route('CommunalServiceCityReports')?'active':''; ?>"
                                      target="_self"
                                      href="<?php echo URL::route('CommunalServiceCityReports'); ?>"><?php echo Lang::get('communalService.list_of_reports'); ?></a>
                               </li>
                               <li class="tab progressbar"><a
                                           class=" <?php echo Request::url()==URL::route('CommunalServiceGetTypesList')?'active':''; ?>"
                                           target="_self"
                                           href="<?php echo URL::route('CommunalServiceGetTypesList'); ?>"><?php echo Lang::get('communalService.link_types'); ?></a>
                               </li>
                               <li class="tab progressbar"><a
                                           class=" <?php echo Request::url()==URL::route('CommunalServiceListTemplates')?'active':''; ?>"
                                           target="_self"
                                           href="<?php echo URL::route('CommunalServiceListTemplates'); ?>"><?php echo Lang::get('communalService.title_template_list'); ?></a>
                               </li>


                               <?php elseif(Entrust::hasRole('superadmin')): ?>

                               <li class="tab progressbar">
                                   <a class=" <?php echo Request::url()==URL::route('CommunalServiceCityReports')?'active':''; ?>"
                                      target="_self"
                                      href="<?php echo URL::route('CommunalServiceCityReports'); ?>"><?php echo Lang::get('communalService.list_of_reports'); ?></a>
                               </li>
                               <?php endif; ?>

                       <?php elseif($menuSet == 3 && !Entrust::hasRole('manager')): ?>
                           <li class="tab progressbar"><a class="<?php echo Request::url()==URL::route('getCategoryTree')?'active':''; ?>"   target="_self"
                                              href="<?php echo URL::route('getCategoryTree'); ?>"><?php echo Lang::get('core.city_info_categories', ['city'=>'']); ?></a>
                           </li>
                           <li class="tab progressbar"><a class="<?php echo Request::url()==URL::route('showTree')?'active':''; ?>"
                                                          target="_self"
                                                          href="<?php echo URL::route('showTree'); ?>"><?php echo Lang::get('core.posts', ['city'=>'']); ?></a></li>
                           <li class="tab progressbar"><a class="<?php echo Request::url()==URL::route('getHomeGenerator')?'active':''; ?>"
                                                          target="_self" href="<?php echo URL::route('getHomeGenerator'); ?>"><?php echo Lang::get('core.city_info_home_screen', ['city'=>'']); ?></a></li>
                           <li class="tab progressbar">
                               <a  class="<?php echo Request::url()==URL::route('getTemplates')?'active':''; ?>"   target="_self" href="<?php echo URL::route('getTemplates'); ?>"><?php echo Lang::get('core.city_info_categories_templates', ['city'=>'']); ?></a>
                           </li>




                       <?php elseif($menuSet == 3 && Entrust::hasRole('manager')): ?>

                           <li class="tab progressbar"><a class="<?php echo Request::url()==URL::route('showTree')?'active':''; ?>"
                                              target="_self"
                                              href="<?php echo URL::route('showTree'); ?>"><?php echo Lang::get('core.posts', ['city'=>'']); ?></a></li>


                       <?php elseif($menuSet == 4): ?>


                       <?php elseif($menuSet == 5): ?>
                           <li class="tab"><a
                                       class="active"><?php echo $tab; ?></a>
                           </li>
                       <?php elseif($menuSet == 6): ?>

                           <li class="tab"><a href="#tab-usersubmit"><?php echo Lang::get('cityForm.usersubmit'); ?></a></li>
                           <li class="tab"><a href="#tab-active_formlist"><?php echo Lang::get('cityForm.active_formlist'); ?></a></li>
                           <li class="tab"><a href="#tab-inactive_formlist"><?php echo Lang::get('cityForm.inactive_formlist'); ?></a></li>
                           <li class="tab"><a href="#tab-archive"><?php echo Lang::get('cityForm.archive'); ?></a></li>
                       <?php elseif($menuSet == 7): ?>
                           <li class="tab"><a href="#tab_a" ><?php echo Lang::get('volontiranje.registrations_list'); ?></a></li>
                           <li class="tab"><a  href="#tab_b" ><?php echo Lang::get('volontiranje.registration_posts'); ?></a></li>
                           <li class="tab"><a  href="#tab_c" ><?php echo Lang::get('volontiranje.volunteer_applications'); ?></a></li>
                           <li class="tab" ><a href="#tab_d" ><?php echo Lang::get('volontiranje.volunteer_mailing_list'); ?></a></li>
                       <?php elseif($menuSet == 8): ?>
                           <li class="tab"><a
                                       class="active"><?php echo ucfirst(trim(Lang::get('communalService.title_city_options', ['name' => '']))); ?></a>
                           </li>

                           <?php elseif($menuSet == 9): ?>
                               <li class="tab"><a
                                           class="active"><?php echo ucfirst(trim(Lang::get('sendMail.send_mail_heading'))); ?></a>
                               </li>
                           <?php endif; ?>
                   </ul>

               </div>
           <?php endif; ?>


           <?php if(Session::has('message')): ?>
               <script>
                   var n = noty({
                       text: '<?php echo e(Session::get('message')); ?>',
                       type: 'alert', // Alert, Success, Error, Warning, Information, Confirm
                       theme: 'cityhub', // or 'defaultTheme'
                       layout: 'bottomRight', // top - topLeft - topCenter - topRight - center - centerLeft - centerRight - bottom - bottomLeft - bottomCenter - bottomRight
                       animation: {
                           open: 'animated bounceInUp',
                           close: 'animated bounceOutDown',
                       },
                       timeout: 500
                   });
               </script>
           <?php endif; ?>

           <?php if(Session::has('error_message')): ?>
               <script>
                   var n = noty({
                       text: '<?php echo e(Session::get('error_message')); ?>',
                       type: 'error',
                       theme: 'cityhub',
                       layout: 'bottomRight',
                       animation: {
                           open: 'animated bounceInUp',
                           close: 'animated bounceOutDown',
                       },
                       timeout: 500
                   });
               </script>
           <?php endif; ?>

           <?php if(Session::has('info_message')): ?>
               <script>
                   var n = noty({
                       text: '<?php echo e(Session::get('info_message')); ?>',
                       type: 'information',
                       theme: 'cityhub',
                       layout: 'bottomRight',
                       animation: {
                           open: 'animated bounceInUp',
                           close: 'animated bounceOutDown',
                       },
                       timeout: 500
                   });
               </script>
           <?php endif; ?>

           <?php if(Session::has('warning_message')): ?>
               <script>
                   var n = noty({
                       text: '<?php echo e(Session::get('warning_message')); ?>',
                       type: 'warning',
                       theme: 'cityhub',
                       layout: 'bottomRight',
                       animation: {
                           open: 'animated bounceInUp',
                           close: 'animated bounceOutDown',
                       },
                       timeout: 500
                   });
               </script>
           <?php endif; ?>

           <?php if(Session::has('success_message')): ?>
               <script>
                   var n = noty({
                       text: '<?php echo e(Session::get('success_message')); ?>',
                       type: 'success',
                       theme: 'cityhub',
                       layout: 'bottomRight',
                       animation: {
                           open: 'animated bounceInUp',
                           close: 'animated bounceOutDown',
                       },
                       timeout: 500
                   });
               </script>
           <?php endif; ?>

           <?php if(isset($load_edit_report_layout) && isset($load_map_layout) && $load_map_layout == true && $load_edit_report_layout == true): ?>
               <div class="container-fluid">
                   <div class="row">
                       <div class="col-xs-12">
                           <?php echo isset($content) ? $content : null; ?>

                       </div>
                   </div>
               </div>
           <?php elseif(!isset($load_edit_report_layout) && isset($load_map_layout) && $load_map_layout == true): ?>
               <div class="container-fluid">
                   <div class="row">
                       <div class="col-xs-12 col-sm-6 col-md-4">
                           <div class="map" id="map-canvas"></div>
                       </div>
                       <div class="col-xs-12 col-sm-6 col-md-8">
                           <?php echo isset($content) ? $content : null; ?>

                       </div>
                   </div>
               </div>
           <?php elseif(isset($load_map_layout_polygon) && $load_map_layout_polygon == true): ?>
               <div class="container-fluid">
                   <div class="row">
                       <div class="col-xs-12 col-sm-6 col-md-4">
                           <div class="map" id="map-canvas"></div>
                       </div>
                       <div class="col-xs-12 col-sm-6 col-md-8">
                           <?php echo isset($content) ? $content : null; ?>

                       </div>
                   </div>
               </div>
           <?php elseif(isset($load_map_layout_reports) && $load_map_layout_reports == true): ?>
               <div class="container-fluid">
                   <div class="row">
                       <div class="col-xs-12">
                           <?php echo isset($content) ? $content : null; ?>

                       </div>
                   </div>
               </div>
           <?php else: ?>
               <?php echo isset($content) ? $content : null; ?>

           <?php endif; ?>

           <?php if(!(Cookie::has('cityhub_cookie'))): ?>
               <div class="container-fluid cookie-warning" id="cookieWarningContainer">
                   <div class="row">
                       <div class="col-xs-12 col-sm-10">
                           <p class="mt20 mb20"><?php echo Lang::get('core.cookie_warning_text'); ?></p>
                       </div>
                       <div class="col-xs-12 col-sm-2">
                           <p class="text-center mt20"><?php echo Form::button(Lang::get('core.cookie_warning_button'), array('type' => 'button', 'class' => 'btn btn-sm btn-danger', 'id' => 'cookieTrigger', 'name' => 'cookieTrigger', 'token' => csrf_token())); ?></p>
                       </div>
                   </div>
               </div>
               <?php echo HTML::script('js/core/cookieWarning.js'); ?>

           <?php endif; ?>
           <?php /* $displayContent ELSE & ENDIF */ ?>
           <?php else: ?>
               <?php echo isset($content) ? $content : null; ?>

           <?php endif; ?>
       </div>
   </div>
</main>


</div>


<?php /* Loop that implements additional footer JS for a module or specific view */ ?>
<?php if(isset($js_footer_files) && is_array($js_footer_files)): ?>
<?php foreach($js_footer_files as $js_file): ?>
<?php echo HTML::script($js_file); ?>

<?php endforeach; ?>
<?php endif; ?>


<script type="text/javascript">
var selectedCity = null;

$(document).ready(function () {

$('select').material_select();
$(".button-collapse").sideNav({});
/*
$("#tabs-top").find('a').each(function (ki, val) {
console.log($(val));
$(val).prop('target', "_self");
});
if (localStorage.getItem('activeTab') != undefined) {
$("a[href='" + localStorage.getItem('activeTab') + "']").addClass('active');
}
*/
$('ul.tabs').tabs();
$('.collapsible').collapsible();
if($('.carousel.carousel-slider').length > 0) {

    $('.carousel.carousel-slider').carousel({fullWidth: true});
}

    if (window.location.href.indexOf('info/posts/showTree') == -1) {
        $('.modal').modal({
            dismissible: false,
            opacity: .85,

        });
    }


});

function selectCity() {
console.log(window.location.href);
if (window.location.href.indexOf('communal-service/reports/city') > -1) {
   var selectedCity = $('#selected-city option:selected').html();
   window.location.assign('/communal-service/reports/city/' + selectedCity);
} else {
   var selectedCity = $('#selected-city').val();
   window.location.assign('/dashboard/' + selectedCity);
}

}

$('.progressbar').click(function () {
    $('.progress').prop('style', 'visibility:visible');

})
/*    $('#tabs-top a').click(function (e) {
$('.progress').prop('style', 'visibility:visible');
$('.main-holder').css('pointer-events', 'none');
localStorage.setItem('activeTab', $(this).prop('href'));
});

$('a:not(#tabs-top a)').click(function (e) {
localStorage.removeItem('activeTab');
});*/

</script>

</body>
</html>
