<!DOCTYPE html>
<html lang="en">
<style type="text/css">
    div.scrollmenu {
        width: 100vw;
        /*position: fixed;*/
        /*overflow-y: scroll;*/
    }
    body{
        /*height: 100%;*/
    }
    .meteorological{
        width: 100vw;
        height: 10vh;
        background-color: #46BE8A;
        text-align: center;
        vertical-align: middle;
    }
    .meteorological-label{
        font-size: 5vh;
        color: white;
    }
    .btn-size{
        width: 48vw;
        height: 20vh;
    }
    .btn-width{
        width: 48vw;
    }
    .label-size-large{
        width: 50%;
        font-size:4vh;
        color: white;
    }
    .label-size-small{
        color: white;
        margin-top: -8px;
    }
    .btn-full-image{
        width: 50vw;
        height: 35vh;
        background-size: 100% 100%;
        margin-left: 1vw;
        background-repeat:no-repeat;
        border: 0px #AAA solid;
    }
    .text-info{
        font-size: 4rem;
    }
    #btn_set_preservation {
        width: 30vw;
        height: 10vh;
        font-size: 2.5rem;
    }
</style>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="user-scalable=0; initial-scale=1.0; width=device-width; maximum-scale=1.0;">
    <!--   <meta content="IE=edge" http-equiv="X-UA-Compatible"> -->
    <link href="ico/favicon.ico" rel="shortcut icon">
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="<?php echo e(asset('front/css/bootstrap.css')); ?>">

    <!-- Custom styles for this template -->
    <link rel="stylesheet" href="<?php echo e(asset('front/css/style.css')); ?>">
    <link rel="stylesheet" href="<?php echo e(asset('front/css/typicons.css')); ?>" />
    <link rel="stylesheet" href="<?php echo e(asset('assets/global/plugins/font-awesome/css/font-awesome.min.css')); ?>"  />
    <link rel="stylesheet" href="<?php echo e(asset('front/js/tip/tooltipster.css')); ?>">
    <script type='text/javascript' src="<?php echo e(asset('front/js/jquery.js')); ?>"></script>
    <link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css')); ?>"/>
</head>
<body>
    <div class="scrollmenu" style="margin-top: 1vh;">
        <table style="width: 100vw;text-align: center;">
            <tr>
                <td>
                    <div class="text-info">保 全 設 定</div>
                </td>
            </tr>
            <tr>
                <a id="btn_back" class="btn btn-success">返回</a>
            </tr>
            <tr style="height: 5vh;"></tr>
            <tr >
                <td>
                    <?php if($mode_value == 1): ?>
                        <input type="button" class="btn-full-image btn_set_preservation" style="background-image: url('<?php echo e(asset('assets/images/preservation.png')); ?>');outline:none;">
                    <?php else: ?>
                        <input type="button" class="btn-full-image btn_set_preservation" style="background-image: url('<?php echo e(asset('assets/images/preservationoff1.png')); ?>');outline:none;">
                    <?php endif; ?>
                </td>
            </tr>
            <tr style="height: 1vh;"></tr>
            <tr>
                <td>
                    <?php if($mode_value == 1): ?>
                    <button id="btn_set_preservation" class="btn btn-danger btn_set_preservation" value="0">關閉</button>
                    <?php else: ?>
                    <button id="btn_set_preservation" class="btn btn-info btn_set_preservation" value="1">啟動</button>
                    <?php endif; ?>
                </td>
            </tr>
        </table>
    </div>
    <form id="form_intercom" action="" method="post"></form>
    <form id="form_back" action="<?php echo e($back_url); ?>" method="post"></form>

    <script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/datatables/media/js/jquery.dataTables.min.js')); ?>"></script>
    <script type="text/javascript" src="<?php echo e(asset('assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js')); ?>"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $(document).on('click','.btn_set_preservation',function(){
                $.ajax({
                    type : 'GET',
                    url  : "<?php echo e($url); ?>" + "setPreservation&uid=" + "<?php echo e($user_id); ?>" + "&mode_value=" + $('#btn_set_preservation').val(),
                    success : function(sendback){
                        var form = $('#form_intercom');
                        form.attr("action", sendback.url);
                        form[0].submit();
                    }
                });
            });

            $(document).on('click','#btn_back',function(){
                var form = $('#form_back');
                form[0].submit();
            });
        });
    </script>
</body>

</html>