<?php $__env->startSection('content'); ?>
<div class="container-fluid parallax-six modul-bt-one" data-speed="5" data-type="background">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="big-title">
                    <h1>Add Section</h1>
                </div>
            </div>
        </div>
	</div>
</div>

<div class="container-fluid">
	<div class="row">
		<div class="col-md-12 col-md-offset-0">
			<div class="panelX panel-defaultX">

				<div class="panel-body">
					<?php if(session('status')): ?>
						<div class="alert alert-success">
							<?php echo e(session('status')); ?>

						</div>
					<?php endif; ?>
					<?php if(count($errors) > 0): ?>
						<div class="alert alert-danger">
							<strong>Whoops!</strong> There were some problems with your input.<br><br>
							<ul>
								<?php foreach($errors->all() as $error): ?>
									<li><?php echo e($error); ?></li>
								<?php endforeach; ?>
							</ul>
						</div>
					<?php endif; ?>

					<form class="form-horizontal" role="form" method="POST" action="<?php echo e(url('admin/sections/add')); ?>"
						onsubmit="document.getElementById('content').value = editor.getValue()">
						<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
						<input type="hidden" id="content" name="content" value="">
						<div class="form-group">
							<label class="col-md-2 control-label" style="text-align: left;">Section Name</label>
							<div class="col-md-4">
								<input type="text" class="form-control" name="name" value="<?php echo e(old('name')); ?>">	
							</div>
							<label class="col-md-2 control-label" style="text-align: left;">Section Type</label>
							<div class="col-md-4">
								<select class="form-control" name="type">
									<option value="content">Content</option>
									<option value="script">Script</option>
									<option value="style">Style</option>
								</select>
							</div>
						</div>
						
						<div id="editor" class="col-md-12"></div>

						<div class="form-group">
							<div class="col-md-6 col-md-offset-0" style="margin: 15px 0px;">
								<button type="submit" class="btn btn-primary">
									Add Section
								</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>

    	<script>
        	var editor = ace.edit("editor");
        	editor.setTheme("ace/theme/eclipse");
        	editor.setShowPrintMargin(false);
        	editor.setOption('wrap', true);
        	var phpMode = ace.require("ace/mode/php").Mode;
        	editor.getSession().setMode(new phpMode());
        	var heightUpdateFunction = function() {
            	var newHeight =
                    editor.getSession().getScreenLength()
                    * editor.renderer.lineHeight
                    + editor.renderer.scrollBar.getWidth();
            	document.getElementById('editor').setAttribute("style", "height:"+ newHeight +"px");
          		editor.resize();
            	};

            	heightUpdateFunction();
            	editor.getSession().on('change', heightUpdateFunction);
    	</script>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('extras'); ?>
	    <style>
	    	#editor {
        		position: relative;
        		width: 100%;
        		height: 500px;
    		}

    	</style>
    	<script src="<?php echo e(asset('js/ace/ace.js')); ?>" type="text/javascript" charset="utf-8"></script>
    	<script src="<?php echo e(asset('js/ace/mode-php.js')); ?>" type="text/javascript" charset="utf-8"></script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('residential.templates.adminT', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>