<?php $request = app('Illuminate\Http\Request'); ?>
<?php $sentinel = app('Cartalyst\Sentinel\Native\Facades\Sentinel'); ?>
<?php $setting = app('anlutro\LaravelSettings\Facade'); ?>

<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->

<head>
    <meta charset="utf-8" />
    <title>
        <?php $CommunityPresenter = app('NSST\Presenters\CommunityPresenter'); ?>
        <?php echo e($CommunityPresenter->comName()); ?> <?php echo e($setting::get('system_name', '全方位建築智慧化管理系統')); ?>

    </title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1" name="viewport" />
    <meta content="This is the new iNSST community system." name="description" />
    <meta content="imin" name="author" />
    <meta name="csrf-token" content="<?php echo e(csrf_token()); ?>">
    <!-- BEGIN GLOBAL MANDATORY STYLES -->
    <?php /* <script src="<?php echo e(asset('assets/global/plugins/pace/pace.js')); ?>"></script> */ ?>

    <link href="<?php echo e(asset('assets/global/plugins/font-awesome/css/font-awesome.min.css')); ?>" rel="stylesheet"
        type="text/css" />
    <link href="<?php echo e(asset('assets/global/plugins/simple-line-icons/simple-line-icons.min.css')); ?>" rel="stylesheet"
        type="text/css" />
    <link href="<?php echo e(asset('assets/global/plugins/bootstrap/css/bootstrap.min.css')); ?>" rel="stylesheet"
        type="text/css" />
    <link href="<?php echo e(asset('assets/global/plugins/uniform/css/uniform.default.css')); ?>" rel="stylesheet"
        type="text/css" />
    <link href="<?php echo e(asset('assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css')); ?>" rel="stylesheet"
        type="text/css" />
    <?php /* <link href="<?php echo e(asset('assets/global/plugins/pace/themes/pace-theme-center-circle.css')); ?>" rel="stylesheet" /> */ ?>
    <link rel="stylesheet" type="text/css"
        href="<?php echo e(asset('assets/global/plugins/bootstrap-toastr/toastr.min.css')); ?>" />
    <!-- END GLOBAL MANDATORY STYLES -->
    <!-- BEGIN PAGE STYLES -->
    <?php $__env->startSection('css_page_level'); ?>
    <?php echo $__env->yieldSection(); ?>
    <!-- END PAGE STYLES -->
    <!-- BEGIN THEME STYLES -->
    <link href="<?php echo e(asset('assets/global/css/components-md.css')); ?>" id="style_components" rel="stylesheet"
        type="text/css" />
    <link href="<?php echo e(asset('assets/global/css/plugins-md.css')); ?>" rel="stylesheet" type="text/css" />
    <link href="<?php echo e(asset('assets/layouts/layout/css/layout.css')); ?>" rel="stylesheet" type="text/css" />
    <link href="<?php echo e(asset('assets/layouts/layout/css/themes/grey.css')); ?>" rel="stylesheet" type="text/css"
        id="style_color" />
    <link href="<?php echo e(asset('assets/layouts/layout/css/custom.css')); ?>" rel="stylesheet" type="text/css" />
    <!-- END THEME STYLES -->
    <link rel="shortcut icon" href="<?php echo e(asset('favicon.ico')); ?>" />
    <style>
        #preloader {
            position: fixed;
            left: 0;
            top: 0;
            z-index: 999999;
            width: 100%;
            height: 100%;
            overflow: visible;
            background: #333 url('<?php echo e(asset('assets/images/loading.gif')); ?>') no-repeat center center;
        }
        
        /* 在 iframe 中隱藏資產內容以外的 header footer */
        body.in-iframe #pageHeader, body.in-iframe #pageFooter {
            display: none !important;
        }
    </style>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<!-- DOC: Apply "page-header-fixed-mobile" and "page-footer-fixed-mobile" class to body element to force fixed header or footer in mobile devices -->
<!-- DOC: Apply "page-sidebar-closed" class to the body and "page-sidebar-menu-closed" class to the sidebar menu element to hide the sidebar by default -->
<!-- DOC: Apply "page-sidebar-hide" class to the body to make the sidebar completely hidden on toggle -->
<!-- DOC: Apply "page-sidebar-closed-hide-logo" class to the body element to make the logo hidden on sidebar toggle -->
<!-- DOC: Apply "page-sidebar-hide" class to body element to completely hide the sidebar on sidebar toggle -->
<!-- DOC: Apply "page-sidebar-fixed" class to have fixed sidebar -->
<!-- DOC: Apply "page-footer-fixed" class to the body element to have fixed footer -->
<!-- DOC: Apply "page-sidebar-reversed" class to put the sidebar on the right side -->
<!-- DOC: Apply "page-full-width" class to the body element to have full width page without the sidebar menu -->

<body
    class="page-md page-header-fixed page-quick-sidebar-over-content page-sidebar-closed-hide-logo page-sidebar-fixed s">
    <div id="preloader"></div>
    <!-- BEGIN HEADER -->
    <div class="page-header md-shadow-z-1-i navbar navbar-fixed-top" id="pageHeader">
        <!-- BEGIN HEADER INNER -->
        <div class="page-header-inner">
            <!-- BEGIN LOGO -->
            <div class="page-logo">
                <a target="_break" href="<?php echo e($setting::get('company_web', 'http://www.nsst.com.tw/')); ?>">
                    <img src="<?php echo e($setting::get('logo', asset('assets/layouts/layout/img/logo.png'))); ?>" alt="logo"
                        class="logo-default" width="95px" height="16px" />
                </a>
                <div class="menu-toggler sidebar-toggler hide">
                </div>
            </div>
            <!-- END LOGO -->
            <!-- BEGIN RESPONSIVE MENU TOGGLER -->
            <a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse"
                data-target=".navbar-collapse">
            </a>
            <!-- END RESPONSIVE MENU TOGGLER -->
            <!-- BEGIN TOP NAVIGATION MENU -->
            <div class="top-menu">
                <ul class="nav navbar-nav pull-right">
                    <!-- BEGIN NOTIFICATION DROPDOWN -->
                    <!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
                    <?php $NoticePresenter = app('NSST\Presenters\NoticePresenter'); ?>
                    <!-- BEGIN USER LOGIN DROPDOWN -->
                    <!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
                    <li class="dropdown dropdown-user">
                        <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown"
                            data-close-others="true">
                            <?php $setting = app('anlutro\LaravelSettings\Facade'); ?>
                            <!-- 因相對路徑尚未改完，先註解掉避免無法讀取時顯示錯誤，甚至拖慢網頁載入速度 -->
                            <!-- <img alt="" class="img-circle" src="<?php echo e($setting::get('profile', asset('assets/images/profile.jpg'))); ?>" width="30px" height="30px"> -->
                            <span class="username username-hide-on-mobile"><?php echo e($sentinel::check()->name); ?></span>
                            <input type="hidden" id="readonly" value="<?php echo e($sentinel::check()->privilege); ?>">
                            <i class="fa fa-angle-down"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-default">
                            <?php if($sentinel::check()->privilege !== 'readonly'): ?>
                                <li>
                                    <a href="<?php echo e(action('FrontController@index')); ?>">
                                        <i class="icon-globe"></i> <?php echo app('translator')->get('messages.neighborhood_site'); ?>
                                    </a>
                                </li>
                                <li>
                                    <a href="<?php echo e(action('ConsoleController@index')); ?>">
                                        <i class="icon-screen-desktop"></i> <?php echo app('translator')->get('messages.service_system'); ?>
                                    </a>
                                </li>
                            <?php endif; ?>
                            <li class="divider">
                            </li>
                            <li>
                                <a href="<?php echo e(route('logout')); ?>">
                                    <i class="icon-key"></i> <?php echo app('translator')->get('messages.log_out'); ?> </a>
                            </li>
                        </ul>
                    </li>
                    <!-- END USER LOGIN DROPDOWN -->
                </ul>
            </div>
            <!-- END TOP NAVIGATION MENU -->
        </div>
        <!-- END HEADER INNER -->
    </div>
    <!-- END HEADER -->
    <div class="clearfix">
    </div>
    <!-- BEGIN CONTAINER -->
    <div class="page-container">
        <!-- BEGIN SIDEBAR -->
        <div class="page-sidebar-wrapper">
            <!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
            <!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
            <div class="page-sidebar navbar-collapse collapse">
                <!-- BEGIN SIDEBAR MENU -->
                <!-- DOC: Apply "page-sidebar-menu-light" class right after "page-sidebar-menu" to enable light sidebar menu style(without borders) -->
                <!-- DOC: Apply "page-sidebar-menu-hover-submenu" class right after "page-sidebar-menu" to enable hoverable(hover vs accordion) sub menu mode -->
                <!-- DOC: Apply "page-sidebar-menu-closed" class right after "page-sidebar-menu" to collapse("page-sidebar-closed" class must be applied to the body element) the sidebar sub menu mode -->
                <!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
                <!-- DOC: Set data-keep-expand="true" to keep the submenues expanded -->
                <!-- DOC: Set data-auto-speed="200" to adjust the sub menu slide up/down speed -->
                <?php echo $__env->make('layout.menu', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                <!-- END SIDEBAR MENU -->
            </div>
        </div>
        <!-- END SIDEBAR -->
        <!-- BEGIN CONTENT -->
        <?php $__env->startSection('page-content-wrapper'); ?>
        <?php echo $__env->yieldSection(); ?>
        <!-- END CONTENT -->

    </div>
    <!-- END CONTAINER -->
    <!-- BEGIN FOOTER -->
    <div class="page-footer" id="pageFooter">
        <div class="page-footer-inner" style="margin-right:150px;">
            <?php echo e($setting::get('copyright_1', '2015 © NSST 全方位建築智慧化管理系統')); ?> <a
                href="<?php echo e($setting::get('company_web', 'http://www.nsst.com.tw/')); ?>"
                title="<?php echo e($setting::get('copyright_company', '新保科技有限公司')); ?>"
                target="_blank"><?php echo e($setting::get('copyright_company', '新保科技有限公司')); ?>

            </a><!-- 服務電話：<?php echo e($CommunityPresenter->comPhone()); ?> -->
            <?php echo $__env->make('layout.footer_version', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
        </div>
        <?php $setting = app('anlutro\LaravelSettings\Facade'); ?>
        <div style="width:85vw; float:left;">
            <marquee onMouseOver="this.stop()" onMouseOut="this.start()">
                <?php echo e($setting::get('marquee_information', '')); ?></marquee>

        </div>
        <div class="scroll-to-top">
            <i class="icon-arrow-up"></i>
        </div>
    </div>
    <!-- END FOOTER -->
    <!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
    <!-- BEGIN CORE PLUGINS -->
    <!--[if lt IE 9]>
<script src="<?php echo e(asset('assets/global/plugins/respond.min.js')); ?>"></script>
<script src="<?php echo e(asset('assets/global/plugins/excanvas.min.js')); ?>"></script>
<![endif]-->
<script src="<?php echo e(asset('assets/global/plugins/jquery.min.js')); ?>" type="text/javascript"></script>
<script src="<?php echo e(asset('assets/global/plugins/jquery-migrate.min.js')); ?>" type="text/javascript"></script>
<!-- IMPORTANT! Load jquery-ui.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
<script src="<?php echo e(asset('assets/global/plugins/jquery-ui/jquery-ui.min.js')); ?>" type="text/javascript"></script>
<script src="<?php echo e(asset('assets/global/plugins/bootstrap/js/bootstrap.min.js')); ?>" type="text/javascript"></script>
<script src="<?php echo e(asset('assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js')); ?>"
    type="text/javascript"></script>
<script src="<?php echo e(asset('assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js')); ?>" type="text/javascript">
</script>
<script src="<?php echo e(asset('assets/global/plugins/jquery.blockui.min.js')); ?>" type="text/javascript"></script>
<script src="<?php echo e(asset('assets/global/plugins/jquery.cokie.min.js')); ?>" type="text/javascript"></script>
<script src="<?php echo e(asset('assets/global/plugins/uniform/jquery.uniform.min.js')); ?>" type="text/javascript"></script>
<script src="<?php echo e(asset('assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js')); ?>" type="text/javascript">
</script>
<!-- END CORE PLUGINS -->
<?php $__env->startSection('plugins_page_level'); ?>
<?php echo $__env->yieldSection(); ?>
<!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<?php /* <script src="<?php echo e(asset('assets/global/scripts/app.js')); ?>" type="text/javascript"></script> */ ?>
<script src="<?php echo e(asset('assets/global/scripts/app_assets.js')); ?>" type="text/javascript"></script>
<script src="<?php echo e(asset('assets/layouts/layout/scripts/layout.js')); ?>" type="text/javascript"></script>
<script src="<?php echo e(asset('assets/layouts/layout/scripts/demo.js')); ?>" type="text/javascript"></script>
<script src="<?php echo e(asset('assets/layouts/global/scripts/quick-sidebar.min.js')); ?>" type="text/javascript"></script>
<script src="<?php echo e(asset('assets/global/plugins/lrz.bundle.js')); ?>" type="text/javascript"></script>
<script src="<?php echo e(asset('assets/pages/scripts/tasks.js')); ?>" type="text/javascript"></script>
<script src="<?php echo e(asset('assets/global/plugins/bootstrap-toastr/toastr.min.js')); ?>" type="text/javascript"></script>
<!-- END PAGE LEVEL SCRIPTS -->
<script>
    jQuery(document).ready(function($) {
        // site preloader -- also uncomment the div in the header and the css style for #preloader
        $(window).load(function() {
            $('#preloader').fadeOut('slow');
        });
    });
    jQuery(document).ready(function() {
        toastr.options = {
            "closeButton": true,
            "debug": false,
            "newestOnTop": false,
            "progressBar": true,
            "positionClass": "toast-top-right",
            "preventDuplicates": false,
            "onclick": null,
            "showDuration": "300",
            "hideDuration": "1000",
            "timeOut": "5000",
            "extendedTimeOut": "1000",
            "showEasing": "swing",
            "hideEasing": "linear",
            "showMethod": "fadeIn",
            "hideMethod": "fadeOut"
        }
    });
    $(document).ready(function() {
        $('.dropdown-menu').parent().on('shown.bs.dropdown', function() {
            var $menu = $("ul", this);
            offset = $menu.offset();
            position = $menu.position();
            $('body').append($menu);
            $menu.show();
            $menu.css('position', 'absolute');
            $menu.css('top', (offset.top) + 'px');
            $menu.css('left', (offset.left) + 'px');
            $menu.css('width', '150px');
            $(this).data("myDropdownMenu", $menu);
        });
        $('.dropdown-menu').parent().on('hide.bs.dropdown', function() {
            // 2023/12/20 修正console錯誤 myDropdownMenu不存在時不需移除任何屬性;
            var myDropdownMenu = $(this).data("myDropdownMenu");
            if (myDropdownMenu) {
                $(this).append(myDropdownMenu);
                myDropdownMenu.removeAttr('style');
            }
        });
    });
</script>
<!--SocketIO Using JavaScript-->
<script src="<?php echo e(asset('/assets/global/scripts/web_socket.js')); ?>"></script>
<script type="text/javascript">
    var ws, client_list = {};
    var name = '<?php echo e($sentinel::check()->id); ?>';
    $(document).ready(function() {
        connect();
    });
    // 连接服务端
    function connect() {
        // 创建websocket
        ws = new WebSocket("ws://<?php echo e(env('WS_HOST', 'www.nsst.tw')); ?>:<?php echo e(env('WS_PORT', '7272')); ?>");
        // 当socket连接打开时，输入用户名
        ws.onopen = onopen;
        // 当有消息时根据消息类型显示不同信息
        ws.onmessage = onmessage;
        ws.onclose = function() {
            console.log("關閉連線，等待重新嘗試");
            connect();
        };
        ws.onerror = function() {
            console.log("出現錯誤");
        };
    }
    // Send Login Message on connected.
    function onopen() {
        // Login
        var login_data = '{"type":"login","client_uid":"' + name + '","com_id":"<?php echo e(env('DB_DATABASE')); ?>"}';
        console.log("WebSocket shakehand success:" + login_data);
        ws.send(login_data);
    }
    // 服务端发来消息时
    function onmessage(e) {
        //console.log(e.data);
        var data = eval("(" + e.data + ")");
        switch (data['type']) {
            // 服务端ping客户端
            case 'ping':
                ws.send('{"type":"pong"}');
                break;;
                // 登录 更新用户列表
                // case 'login':
                //     //{"type":"login","client_id":xxx,"client_uid":"xxx","client_list":"[...]","time":"xxx"}
                //     //say(data['client_id'], data['client_uid'],  data['client_uid']+' 加入了聊天室', data['time']);
                //     toastr['info'](data['client_uid']+' 連線成功');
                //     if(data['client_list']){
                //         client_list = data['client_list'];
                //     }else{
                //         client_list[data['client_id']] = data['client_uid']; 
                //     }
                //     //flush_client_list();
                //     console.log(data['client_uid']+"登录成功");
                //     break;
                // 发言
            case 'say':
                //{"type":"say","from_client_id":xxx,"to_client_id":"all/client_id","content":"xxx","time":"xxx"}
                //say(data['from_client_id'], data['from_client_uid'], data['content'], data['time']);
                toastr['success'](data['from_client_uid'] + ':' + data['content']);
                break;
                // 用户退出 更新用户列表
                // case 'logout':
                //     //{"type":"logout","client_id":xxx,"time":"xxx"}
                //     //say(data['from_client_id'], data['from_client_uid'], data['from_client_uid']+' 退出了', data['time']);
                //     toastr['warning'](data['client_uid']+' 離線');
                //     delete client_list[data['from_client_id']];
                //     break;
                //flush_client_list();
            case 'system':
                // toastr[data['level']](data['content']);
                break;
        }
    }
</script>
<!-- ImageCheck-->
<script>
    //判斷登入者是否為唯讀帳號，如果是，關閉所有按鈕功能
    if ($("#readonly").val() === "readonly") {
        $(':button').prop('disabled', true);
        //$('.btn').prop('disabled', true);
    }
    //判斷封面圖檔解析度必須小於640*480
    if (document.getElementById('cover_img')) {
        document.querySelector('#cover_img').addEventListener('change', function() {
            lrz(this.files[0], {
                    width: 680
                })
                .then(function(rst) {
                    // 处理成功会执行
                    //console.log(rst);
                    var data = "";
                    data = rst.origin.name + ',' + rst.base64;
                    $('#compressed_cover').val(data);
                })
                .catch(function(err) {
                    $('#compressed_cover').val('');
                })
        });
    };
    $('#cover_reset').click(function() {
        $('.cover_img').fileinput('clear');
        $("div.cover").removeClass('has-error');
        $("#upload-error").remove();
    });
    //附件格式錯誤時 刪除class (.has-error) 該欄位並不是required
    $('#file_reset').click(function() {
        $('.file').fileinput('clear');
        $("div.file").removeClass('has-error');
        $("#upload-error").remove();
    });
</script>



<!-- END JAVASCRIPTS -->
<?php $__env->startSection('js_page_level'); ?>
    <script>
        // 檢測是否在 iframe 內，並添加相應的 class，達成只顯示資產資料的效果
        if (window.self !== window.top) {
            document.body.classList.add('in-iframe');
        }
    </script>
<?php echo $__env->yieldSection(); ?>
</body>
<!-- END BODY -->

</html>
