<!DOCTYPE html>
<html lang="en">
<head>
    <?php
    $partial = new Partial('head');
    $partial->prepare('baseDir', $BASEDIR);
    $partial->render();
    ?>
    <title><?php echo $TITLE ?></title>
</head>
<body class="no-transitions">
    <div class="row no-gutters main">
        <div class="col-md-3 d-sm-none"></div>
        <div class="col-md-3 nav-container">
            <?php
            $partial = new Partial('menu');
            $partial->prepare('item', 'scene');
            $partial->prepare('langMng',$LANGMNG);
            $partial->prepare('debugMod',$DEBUGMOD);
            $partial->render();
            ?>
        </div>
        <div class="col-md-9 main-body">
            <a class="button is-primary m-1" onClick="$('#modal').removeClass('modal-container-hiden').show();"><?php $LANGMNG->echo('t_createScene');?></a>
            <div class="row no-gutters">
                <?php foreach ($SCENES as $sceneId => $sceneData) {
                    //BUTTON
                    $partialScenButton = new Partial('sceneButton');
                    $partialScenButton->prepare('langMng', $LANGMNG);
                    $partialScenButton->prepare('sceneId', $sceneId);
                    $partialScenButton->prepare('sceneData', $sceneData);

                    $partialScenButton->render();

                    // Edit
                    $partialSceneEdit = new Partial('sceneEdit');
                    $partialSceneEdit->prepare('langMng',$LANGMNG);
                    $partialSceneEdit->prepare('sceneId',$sceneId);
                    $partialSceneEdit->prepare('scene',$sceneData);

                    $partialSceneEdit->render();
                    ?>
                <?php } ?>
            </div>
        </div>
    </div>

    <?php if (isset($_POST['submit'])) {
        $partial = new Partial('sceneCreateFinal');
        $partial->prepare('langMng',$LANGMNG);
        $partial->prepare('setStateFormDevices',$SETSTATEFORMDEVICES );
        $partial->prepare('sceneIcon',$SCENEICON );
        $partial->prepare('SceneName',$SCENENAME );

        $partial->render();
    } else {
        $partial = new Partial('sceneCreate');
        $partial->prepare('langMng',$LANGMNG);
        $partial->prepare('subDevices',$SUBDEVICES);

        $partial->render();
    }
    $partial = new Partial('footer');
    $partial->render();
    ?>
</body>
</html>
