<?php $__env->startSection('content'); ?>

	<div id="root">
		<div class="row">
	    	<div class="col-lg-12">
	    		<h1 class="page-header">Builder</h1>
	    	</div>
	    </div>
	    <div class="row">
            <div class="col-lg-12">
                <?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; ?>
				<div class="panel panel-default">
					<div class="panel-heading">
	                    Data: <?php echo e($set->title); ?>

	                </div>
	                <div class="panel-body">
	                    <div class="row">
	                        <div class="col-lg-12">
	                        	<table id="data" class="display table table-striped table-bordered table-hover" style="width:100%">
							        <thead>
							            <tr>
							                <?php foreach($fields as $field): ?>
							                	<th><?php echo e($field->title); ?></th>
							                <?php endforeach; ?>
							            </tr>
							        </thead>
							    </table>
	                        </div>
	                    </div>
	                </div>
	            </div>
	        </div>
	    </div>
	</div>


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

<?php $__env->startSection('extras'); ?>

	<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap4.min.css"/>
	<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.5.1/css/buttons.dataTables.min.css"/>
	<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/select/1.2.5/css/select.dataTables.min.css"/>
	<link rel="stylesheet" type="text/css" href="<?php echo e(asset('editor/css/editor.bootstrap4.css')); ?>"/>

	<style>

	</style>

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

<?php $__env->startSection('bottom'); ?>

	<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
	<script src="https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js"></script>
	<script src="https://cdn.datatables.net/select/1.2.5/js/dataTables.select.min.js"></script>
	<script src="<?php echo e(asset('editor/js/dataTables.editor.min.js')); ?>"></script>
	<script src="<?php echo e(asset('editor/js/editor.bootstrap4.min.js')); ?>"></script>

	<script>
		var editor; // use a global for the submit and return data rendering in the examples
 
		$(document).ready(function() {
		    editor = new $.fn.dataTable.Editor( {
		        ajax: "<?php echo e(url('admin/builder/editrecord/'.$set->id)); ?>",
		        table: "#data",
		        idSrc: "record_id",
		        fields: [ 
		        	<?php foreach($fields as $field): ?>
		        		{
		                	label: "<?php echo e($field->title); ?>", 
		               		name: "<?php echo e($field->name); ?>"
		            	},
		        	<?php endforeach; ?>
		        ]
		    } );
		 
		    $('#data').DataTable( {
		        dom: "Bfrtip",
		        ajax: "<?php echo e(url('admin/builder/getdata/'.$set->id)); ?>",
		        "pageLength": 100,
		        columns: [
		        	<?php foreach($fields as $field): ?>
		        		{ data: "<?php echo e($field->name); ?>" },
		        	<?php endforeach; ?>
		        ],
		        select: true,
		        buttons: [
		            { extend: "create", editor: editor },
		            { extend: "edit",   editor: editor },
		            { extend: "remove", editor: editor }
		        ]
		    } );
		} );
	</script>

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



<?php echo $__env->make('residential.templates.uadmin', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>