<?php $__env->startSection('CSS'); ?>
<?php echo HTML::style('DataTables/dataTables.bootstrap.min.css'); ?>

<?php echo HTML::style('DataTables/responsive.dataTables.min.css'); ?>

<?php echo HTML::style('DataTables/select.dataTables.min.css'); ?>

<?php echo HTML::style('DataTables/buttons.dataTables.min.css'); ?>

<?php echo HTML::style('bootstrap-select/css/bootstrap-select.min.css'); ?>

<style type="text/css">
	@media (max-width: 450px) { .ModalEliminar .modal-dialog { width: auto; } }
	@media (min-width: 451px) { .ModalEliminar .modal-dialog { width: 450px; } }
</style>
<style type="text/css" class="init">
	table.dataTable.stripe tbody > tr.odd.selected, table.dataTable.stripe tbody > tr.odd > .selected, table.dataTable.display tbody > tr.odd.selected, table.dataTable.display tbody > tr.odd > .selected {
		background-color: #E9E9E9;
	}
	table.dataTable tbody > tr.selected, table.dataTable tbody > tr > .selected {
		background-color: #E9E9E9;
	}
	table.dataTable.display tbody > tr.odd.selected > .sorting_1, table.dataTable.order-column.stripe tbody > tr.odd.selected > .sorting_1 {
		background-color: #E9E9E9;
	}
	table.dataTable.order-column tbody > tr.selected > .sorting_1, table.dataTable.order-column tbody > tr.selected > .sorting_2, table.dataTable.order-column tbody > tr.selected > .sorting_3, table.dataTable.order-column tbody > tr > .selected, table.dataTable.display tbody > tr.selected > .sorting_1, table.dataTable.display tbody > tr.selected > .sorting_2, table.dataTable.display tbody > tr.selected > .sorting_3, table.dataTable.display tbody > tr > .selected {
		background-color: #E9E9E9;
	}
	table.dataTable.display tbody > tr.even.selected > .sorting_1, table.dataTable.order-column.stripe tbody > tr.even.selected > .sorting_1 {
		background-color: #E9E9E9;
	}
	table.dataTable.display tbody > tr.selected:hover, table.dataTable.display tbody > tr > .selected:hover {
		background-color: #E9E9E9;
	}
	table.dataTable.display tbody > tr.selected:hover > .sorting_1, table.dataTable.order-column.hover tbody > tr.selected:hover > .sorting_1 {
		background-color: #E9E9E9;
	}
	.table-hover > tbody > tr:hover > td, .table-hover > tbody > tr:hover > th {
		background-color: #E9E9E9;
	}
	.bootstrap-dialog.type-primary .modal-header {
		background-color: #363b3f;
	}
	<?php
		if( !isset($_GET['import']) ){
	?>
	.oculto {
		display: none !important;
	}
	<?php
		}
	?>
</style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('Contenido'); ?>
<div class="row">
	<div class="col-md-12">
		<h2><i class="icons-web-site" style="font-size: 30px !important;"></i> Sitio Web </h2>
	</div><!--/col-md-12-->
</div><!--/row-->

<div class="row">
	<div class="col-md-12">
		<div class="block-web">
			<div class="header"> 
				<h3 class="content-header">
					<?php
						$Cliente = Cliente::find( Cliente::select('id')->where('users_id', '=', Auth::user()->id)->first()->id );
						$dominio = "";
						if(ConfiguracionxSitioWeb::where('clientes_id', '=', $Cliente->id)->count() > 0){
							$Configuraciones = ConfiguracionxSitioWeb::find( ConfiguracionxSitioWeb::select('id')->where('clientes_id', '=', $Cliente->id )->first()->id);
							if($Configuraciones->formato_url == 'hs'){
								$formato_url = 'http://';
							}
							else if($Configuraciones->formato_url == 'hc'){
								$formato_url = 'http://www.';
							}
							else if($Configuraciones->formato_url == 'hss'){
								$formato_url = 'https://';
							}
							else{
								$formato_url = 'https://www.';
							}
							$disenho = false;
							if($Configuraciones->modo_disenho != ''){
								$dato_disenho = json_decode($Configuraciones->modo_disenho, true);
								if($dato_disenho['estado']){
									$disenho = true;
									$dominio = str_replace('.', '-',$Configuraciones->nombre_dominio);
									$dominio = $formato_url.$dominio.'.sumeclientes.space';
								}
								else{
									$dominio = $formato_url.$Configuraciones->nombre_dominio;
								}
							}
							else{
								$dominio = $formato_url.$Configuraciones->nombre_dominio;
							}
						};
					?>
					Listado de Secciones del Sitio: <a href="<?php echo $dominio; ?>" target="_blank" class="btn btn-success" style="width: 12%; border-radius: 3px;"> Ver sitio <i class="fa  fa-external-link" aria-hidden="true" style="padding-left: 5px;"></i> </a>
				</h3> 
			</div>
			<div class="porlets-content">
				<div class="table-responsive">
					<table class="table table-striped-old table-bordered table-hover display" id="tblSeccionesxCliente" cellspacing="0" width="100%">
						<thead>
							<tr>
								<th></th>
                                <th class="all" data-priority="1" style="width: 30%;"> Nombre </th>
                                <th class="all text-center" data-priority="1" style="width: 10%;"> Principal </th>
                                <th class="min-tablet-l" data-priority="1" style="width: 15%;"> Tipo </th>
								<th class="min-tablet-l" data-priority="2" style="width: 20%;"> Acciones </th>
							</tr>
						</thead>
					</table>
				</div>
			</div>
			<div class="bottom">
				<button type="button" class="btn btn-primary" onclick="Agregar()"> Agregar </button>
				<button type="button" style="display: none;" class="btn btn-danger" id="btnEliminarSeleccionados"> Eliminar seleccionados </button>
				<?php
					if( isset($_GET['import']) ){
				?>
				<button type="button" class="btn btn-success" onclick="Importar()"> Importar </button>
				<button type="button" class="btn btn-info" id="btnImportarP" onclick="ImportarPlantilla()"> Importar Plantilla </button>
				<?php
					}
				?>
			</div>
		</div>
	</div>
</div><!--/row end-->
<?php $__env->stopSection(); ?>

<?php $__env->startSection('JS'); ?>
<?php echo HTML::script('DataTables/jquery.dataTables.min.js'); ?>

<?php echo HTML::script('DataTables/dataTables.bootstrap.min.js'); ?>

<?php echo HTML::script('DataTables/dataTables.responsive.min.js'); ?>

<?php echo HTML::script('DataTables/dataTables.select.min.js'); ?>

<?php echo HTML::script('DataTables/dataTables.buttons.min.js'); ?>

<?php echo HTML::script('bootstrap-select/js/bootstrap-select.min.js'); ?>

<?php echo HTML::script('bootstrap-number-input/bootstrap-number-input.js'); ?>

<script type="text/javascript">
	function Eliminar(id){
		var id = id;
		var mensaje = "<div class='row'> \
			<div class='col-xs-12'> \
				<form id='frmEliminar'> \
						<h2> ¿Seguro que desea eliminar? </h2> \
						<input type='hidden' name='idP' value='"+id+"'> \
				</form> \
			</div> \
		</div>";
		BootstrapDialog.show({
			title: "Eliminar registro",
			type: BootstrapDialog.TYPE_DANGER,
			message: mensaje,
			draggable: true,
			cssClass: "ModalEliminar",
			buttons: [{
				id: "btnEliminar",
				label: "Eliminar",
				cssClass: "btn-danger",
				action: function(dialogItself){
					$.isLoading({ text: "Cargando..." }); NProgress.start();
					$("#btnEliminar").prop("disabled", true).html('<i class="fa fa-spinner fa-spin"></i> Eliminando');
					$.post(
						"<?php echo URL::route('SysWebSWebSeccionesxClientesEliminar'); ?>",
						{ idWeb: id },
						function(data){
							$("#btnEliminar").prop("disabled", false).html("Eliminar");
							$.isLoading("hide"); NProgress.done();
							if(data.success){
								new PNotify({ title: "Felicidades!", text: data.mensaje, type: "success" });
								dialogItself.close();
								var table = $("#tblSeccionesxCliente").DataTable();
								table.ajax.reload(null, false);
							}
							else{
								if(data.mensaje != ''){ 
									var num = Object.keys(data.nombre).length;
									var nombre = "";
									for (i = 0; i < num; i++) {
										nombre += "<br><spam>"+data.nombre[i]+"</spam>"
									}
									new PNotify({ title: "Error", text: data.mensaje+nombre, type: "error" }); 
								}
							}
						},
						"json"
					);
				}
			}]
		});
	}
	function Agregar(){
		var id = id;
		var mensaje = "<div class='row'> \
			<div class='col-xs-12'> \
				<form id='frmAgregar'> \
					<div class='form-group'> \
						<label> Nombre: </label> \
						<input type='text' class='form-control' name='nombre' id='nom-seccion'> \
						<span class='text-danger' id='errnombre'> </span> \
						</div> \
					<div class='form-group'> \
						<label for='slTipoSeccion'>Seleccione el tipo de sección :</label> \
						<select class='form-control' id='slTipoSeccion' name='slTipoSeccion'> \
							<option selected disabled>Seleccione una opción</option> \
							<option value ='header'>Encabezado</option> \
							<option value ='sidebar'>Barra Lateral</option> \
							<option value ='footer'>Pie de pagina</option> \
						</select> \
						<span class='text-danger' id='errslTipoSeccion'> </span> \
						<input type='hidden' name='tipo_seccion' value='"+id+"'> \
					</div> \
				</form> \
			</div> \
		</div>";
		BootstrapDialog.show({
			title: "Agregar Sección",
			type: BootstrapDialog.TYPE_PRIMARY,
			message: mensaje,
			draggable: true,
			cssClass: "ModalAgregar",
			onshow: function(dialogRef){
                dialogRef.getModalBody().find("#slTipoSeccion").change(function(){
					var html_footer = "<label id='nombreL'> Numero de columnas: </label> \
						<input id='numColum' type='number' style='margin-bottom: 0;' name='numColum'  class='form-control' value='1'   min='1' max='5' readonly></input> \
						<span class='text-danger' id='errnumColum'> </span>";
					var	html_header = "<label for='slTipoMenu' id='tipoM'>Seleccione el tipo de menú :</label> \
						<select class='form-control' id='slTipoMenu' name='slTipoMenu'> \
							<option selected disabled>Seleccione una opción</option> \
							<option value ='1'>Menú 1</option> \
							<option value ='2'>Menú 2</option> \
							<option value ='3'>Menú 3</option> \
						</select> \
						<span class='text-danger' id='errslTipoMenu'> </span>";
					if($(this).val() == "footer"){
						dialogRef.getModalBody().find(".form-group").parent().append(html_footer);
						dialogRef.getModalBody().find("#slTipoMenu").remove();
						dialogRef.getModalBody().find("#tipoM").remove();
						$("#numColum").bootstrapNumber({
							min: 1,
							max: 5
						});
					}
					else if($(this).val() == "header"){
						dialogRef.getModalBody().find(".form-group").parent().append(html_header);
						dialogRef.getModalBody().find("#numColum").remove();
						dialogRef.getModalBody().find("#nombreL").remove();
						dialogRef.getModalBody().find("#errnumColum").remove();
						dialogRef.getModalBody().find(".input-group-btn").remove();
					}
					else{
						dialogRef.getModalBody().find("#numColum").remove();
						dialogRef.getModalBody().find("#nombreL").remove();
						dialogRef.getModalBody().find("#errnumColum").remove();
						dialogRef.getModalBody().find("#slTipoMenu").remove();
						dialogRef.getModalBody().find("#tipoM").remove();
						dialogRef.getModalBody().find(".input-group-btn").remove();
					}
				});
            },
			buttons: [{
				id: "btnAgregarSeccion",
				label: "Crear Sección",
				cssClass: "btn-success",
				action: function(dialogItself){
					$.isLoading({ text: "Cargando..." }); NProgress.start();
					$("#btnAgregarSeccion").prop("disabled", true).html('<i class="fa fa-spinner fa-spin"></i> Creando');
					$.post(
						"<?php echo URL::route('SysWebSWebSeccionesxClientesAgregar'); ?>",
						$("#frmAgregar").serialize(),
						function(data){
							$.isLoading("hide"); NProgress.done();
							$("#btnAgregarSeccion").prop("disabled", false).html("Crear Sección");
							dialogItself.close();
							if(data.success){
								var table = $("#tblSeccionesxCliente").DataTable();
								table.ajax.reload(null, false);
								var urlEdicion = "<?php echo URL::route('SysWebSWebSeccionesxClientesEditarV2', array(0)); ?>";
								urlEdicion = urlEdicion.replace("0", data.idS);
								new PNotify({ title: "Realizado", text: data.mensaje, type: "success" });
								setTimeout( function(){ window.location.href = urlEdicion; }, 2000 );
							}
							else{
								if(data.mensaje != ''){ new PNotify({ title: "Error", text: data.mensaje, type: "error" }); }
								$.each(data.errMensajes, function(key, value){ if(value != ''){ $("#err"+key).html(value); } else{ $("#err"+key).html(""); } });
							}
						},
						"json"
					);
				}
			}]
		});
	}
	function Clonar(id){
		var id = id;
		var mensaje = "<div class='row'> \
			<div class='col-xs-12'> \
				<form id='frmClonar'> \
					<div class='form-group'> \
						<label> Nombre: </label> \
						<input type='text' class='form-control' name='nombre' id='nombreClon'> \
						<span class='text-danger' id='errnombre'> </span> \
					</div> \
				</form> \
			</div> \
		</div>";
		BootstrapDialog.show({
			title: "Clonar sección",
			type: BootstrapDialog.TYPE_PRIMARY,
			message: mensaje,
			draggable: true,
			cssClass: "ModalAgregar",
			buttons: [{
				id: "btnClonar",
				label: "Clonar",
				cssClass: "btn-success",
				action: function(dialogItself){
					if($(".ModalAgregar").find("#nombreClon").val() != ""){
						$.isLoading({ text: "Cargando..." }); NProgress.start();
						$("#btnClonar").prop("disabled", true).html('<i class="fa fa-spinner fa-spin"></i> Clonando');
						$.post(
							"<?php echo URL::route('SysWebSWebSeccionesxClientesClonar'); ?>",
							{ idWeb: id, nombre:$(".ModalAgregar").find("#nombreClon").val()},
							function(data){
								$("#btnClonar").prop("disabled", false).html("Clonar");
								$.isLoading("hide"); NProgress.done();
								if(data.success){
									new PNotify({ title: "Felicidades!", text: data.mensaje, type: "success" });
									var table = $("#tblSeccionesxCliente").DataTable();
									table.ajax.reload(null, false);
									dialogItself.close();
								}
								else{
									if(data.mensaje != ''){ new PNotify({ title: "Error", text: data.mensaje, type: "error" }); }
									$.each(data.errMensajes, function(key, value){ if(value != ''){ $("#err"+key).html(value); } else{ $("#err"+key).html(""); } });
								}
							},
							"json"
						);
					}
					else{
						$(".ModalAgregar").find("#errnombre").html("Este campo es obligatorio")
					}
				}
			}]
		});	
	}
	<?php
		if( isset($_GET['import']) ){
	?>
	function ImportarPlantilla(){
		var id = id;
		var mensaje = "<div class='row'> \
			<div class='col-xs-12'> \
				<form id='frmImportarPlantilla' enctype='multipart/form-data'> \
					<div class='form-group'> \
						<label for='txtNombre'>Nombre a asignar</label> \
						<input type='text' class='form-control' id='txtNombre' name='txtNombre' placeholder='Nombre a asignar...'> \
						<span class='text-danger' id='errtxtNombre'></span> \
					</div> \
					<div class='form-group'> \
						<label for='slTipoDePlantilla'>Tipo de plantilla</label> \
						<select name='slTipoDePlantilla' class='form-control'> \
							<option value='H' selected>Encabezado</option> \
							<option value='S'>Barra lateral</option> \
							<option value='F'>Pie de página</option> \
						</select> \
						<span class='text-danger' id='errtxtNombre'></span> \
					</div> \
					<div class='form-group'> \
						<label for='slPrincipal'>¿Es principal?</label> \
						<select name='slPrincipal' class='form-control'> \
							<option value='0' selected>No</option> \
							<option value='1'>Si</option> \
						</select> \
						<span class='text-danger' id='errslPrincipal'></span> \
					</div> \
					<div class='form-group'> \
						<label for='slGenerico'>¿Es genérica?</label> \
						<select name='slGenerico' class='form-control'> \
							<option value='0' selected>No</option> \
							<option value='1'>Si</option> \
						</select> \
						<span class='text-danger' id='errslPrincipal'></span> \
					</div> \
					<div class='form-group'> \
						<label for='flArchivo'>Archivo HTML</label> \
						<input type='file' id='flArchivo' name='flArchivo'> \
						<span class='text-danger' id='errflArchivo'></span> \
					</div> \
				</form> \
			</div> \
		</div>";
		BootstrapDialog.show({
			title: "Importar Plantilla de archivo HTML",
			type: BootstrapDialog.TYPE_DEFAULT,
			message: mensaje,
			draggable: true,
			cssClass: "ModalImportarPlantilla",
			buttons: [{
				id: "btnImportarPlantilla",
				label: "Importar",
				cssClass: "btn-default",
				action: function(dialogItself){
					$.isLoading({ text: "Cargando..." }); NProgress.start();
					$.isLoading("hide"); NProgress.done();
					$("#btnImportarPlantilla").prop("disabled", true).html('<i class="fa fa-spinner fa-spin"></i> Importando...');
					var formulario = $("#frmImportarPlantilla");
					var formData = new FormData(document.getElementById("frmImportarPlantilla"));
					$.ajax({
						type: "POST",
						url: "<?php echo URL::route('SysWebSWebSeccionesxClientesImportar', array()); ?>",
						data: formData,
						cache: false,
						contentType: false,
						processData: false,
						dataType: "json",
						timeout: 1800000,
						success: function(data){
							$("#btnImportarPlantilla").prop("disabled", false).html("Importar");
							if(data.success){
								new PNotify({ title: "Realizado", text: data.mensaje, type: "success" });
								var table = $("#tblSeccionesxCliente").DataTable();
								table.ajax.reload(null, false);
								dialogItself.close();
							}
							else{
								if(typeof data.MensajeError != "undefined"){ $("#Errs").html(data.MensajeError); $("#MensajeError").show(); }else{ $("#MensajeError").hide(); $("#Errs").html(""); }
								if(data.mensaje != ""){ new PNotify({ title: "Error", text: data.mensaje, type: "error" }); }
								$.each(data.errMensajes, function(key, value){ if(value != ""){ $("#err"+key).html(value); } else{ $("#err"+key).html(""); } });
							}
						},
						error: function(jqXHR, textStatus, errorThrown){
							$("#btnImportarPlantilla").prop("disabled", false).html("Importar");
							new PNotify({ title: "Error", text: textStatus + " " + errorThrown, type: "error" });
						}
					});
				}
			}]
		});
	}
	function Importar(){
		var id = id;
		var mensaje = "<div class='row'> \
			<div class='col-xs-12'> \
				<form id='frmImportar'> \
					<div class='form-group'> \
						<label for='slPlantilla'>Seleccione la plantilla :</label> \
						<select class='form-control selectpicker' id='slPlantilla' name='slPlantilla' data-live-search='true' > \
							<option selected disabled>Seleccione una opción</option> \
						</select> \
						<span class='text-danger' id='errslPlantilla'> </span> \
						<input type='hidden' name='tipo_seccion' value='"+id+"'> \
					</div> \
					<div class='form-group menu-check'> \
					</div> \
				</form> \
			</div> \
		</div>";
		BootstrapDialog.show({
			title: "Importar Sección",
			type: BootstrapDialog.TYPE_PRIMARY,
			message: mensaje,
			draggable: true,
			cssClass: "ModalImportar",
			onshow: function(dialogRef){
				$.post(
					"<?php echo URL::route('SysWebSWebSeleccionPlantillas'); ?>",
					function(data){
						$.each(data, function(i, items) {
							var captura = '<option value="'+items.id+'" menu="'+items.menu+'">'+items.nombre+'</option>'
							$("#slPlantilla").append(captura);
						});
						dialogRef.getModalBody().find(".selectpicker").selectpicker();
					},
					"json"
				);
				dialogRef.getModalBody().find("#slPlantilla").change(function(){
					var html = "<div class='form-group'> \
						<label for='checkbox_footer' style='padding-left:0; margin-bottom: 5px; font-weight: 700' class='checkbox-inline'> \
						<input type='checkbox' name='checkbox_footer'  id='checkbox_footer' style='margin-left:5px; float:right;'>Pie de Pagina\
						<span class='custom-checkbox'></span> \
						</label> \
						<input type='text' class='form-control nom-plantilla' name='nom-footer' id='nom-footer' placeholder='Nombre'> \
						<span class='text-danger' id='errnom-footer'> </span> \
					</div>";
					if($(this).find(":selected").attr("menu") == 1){
						html ="<div class='form-group'> \
							<label for='checkbox_header' class='checkbox-inline' style='padding-left:0; margin-bottom: 5px; font-weight: 700'> \
							<input type='checkbox' name='checkbox_header' id='checkbox_header' style='margin-left: 5px; float: right;'>Cabecera\
							<span class='custom-checkbox'></span> \
							</label> \
							<input type='text' class='form-control nom-plantilla' name='nom-header' id='nom-header' placeholder='Nombre'  \
							<span class='text-danger' id='errnom-header'> </span> \
						</div>\
						<div class='form-group'> \
							<label for='checkbox_footer' class='checkbox-inline' style='padding-left:0; margin-bottom: 5px; font-weight: 700'> \
							<input type='checkbox' name='checkbox_footer'  id='checkbox_footer' style='margin-left: 5px; float:right;'>Pie de Pagina\
							<span class='custom-checkbox'></span> \
							</label> \
							<input type='text' class='form-control nom-plantilla' name='nom-footer' id='nom-footer' placeholder='Nombre'> \
							<span class='text-danger' id='errnom-footer'> </span> \
						</div>";
					}
					if(	dialogRef.getModalBody().find(".form-group").parent().find(".checkbox-inline").length !=0){
						dialogRef.getModalBody().find(".form-group").parent().find(".checkbox-inline").remove()
						dialogRef.getModalBody().find(".form-group").parent().find(".nom-plantilla").remove()
					}
					dialogRef.getModalBody().find(".form-group").parent().append(html);
				});
            },
			buttons: [{
				id: "btnImportarSeccion",
				label: "Importar Sección",
				cssClass: "btn-default",
				action: function(dialogItself){
					if(!($("#checkbox_footer").is(":checked")) && !($("#checkbox_header").is(":checked"))){
						var alerta = '<div class="alert alert-danger alert-dismissable fade in"> \
								<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a> \
								Debes seleccionar por lo menos una opción \
							</div>';
						$(".ModalImportar").find(".modal-body").prepend(alerta);
						setTimeout(function(){$(".ModalImportar").find(".alert").remove();}, 3000);
					}
					else{
						$.isLoading({ text: "Cargando..." }); NProgress.start();
						$.isLoading("hide"); NProgress.done();
						$("#btnImportarSeccion").prop("disabled", true).html('<i class="fa fa-spinner fa-spin"></i> Importando');
						$.post(
							"<?php echo URL::route('SysWebSWebSeccionesxClientesImportar'); ?>",
							$("#frmImportar").serialize(),
							function(data){
								$("#btnImportarSeccion").prop("disabled", false).html("Importar Sección");
								if(data.success){
									var table = $("#tblSeccionesxCliente").DataTable();
									table.ajax.reload(null, false);
									new PNotify({ title: "Realizado", text: data.mensaje, type: "success" });
									dialogItself.close();
								}
								else{
									if(data.mensaje != ''){ new PNotify({ title: "Error", text: data.mensaje, type: "error" }); }
									$.each(data.errMensajes, function(key, value){ if(value != ''){ $("#err"+key).html(value); } else{ $("#err"+key).html(""); } });
								}
							},
							"json"
						);
					}
				}
			}]
		});
	}
	<?php
		}
	?>
</script>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('JSOr'); ?>
<?php if(Session::has('message')): ?>
new PNotify({ title: "¡Felicidades!", text: "<?php echo Session::get('message'); ?>", type: "success" });
<?php endif; ?>
var tabla = $("#tblSeccionesxCliente").DataTable({
	"processing": true,
	"serverSide": true,
	"ajax": "<?php echo URL::route('SysWebSWebSeccionesxClientes'); ?>",
	columns: [
		{data: null, defaultContent: "", "searchable": false, "orderable": false},
        {data: "nombre", name: "nombre"},
		{data: "principal", name: "principal",
		"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
				if (sData == 1) {
					$(nTd).html("<span class='fa fa-check' aria-hidden='true'></span>");
					$(nTd).addClass("text-center");
				}
				else{
					$(nTd).html("");
				}
			}
		},
		{data: "tipo", name: "tipo", class:"text-center",
		"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
				if (sData == "H") {
					$(nTd).html("Encabezado");
					$(nTd).addClass("text-center principal");
				}
				else if (sData == "C") {
					$(nTd).html("Contenido");
					$(nTd).addClass("text-center principal");
				}
				else if (sData == "S") {
					$(nTd).html("Barra lateral");
					$(nTd).addClass("text-center principal");
				}
				else{
					$(nTd).html("Pie de página");
					$(nTd).addClass("text-center principal");
				}
			}
		},
		{data: "acciones", name: "acciones", "searchable": false, "orderable": false, "class": "text-center"}
	],
	"language": {
		"url": "<?php echo asset('DataTables/Spanish.json'); ?>",
		select: {
			rows: {
				_: "Tienes seleccionada %d filas",
				0: "De clic sobre la fila para seleccionarla",
				1: "Solo tiene 1 fila seleccionada"
			}
		}
	},
	"fnDrawCallback": function( oSettings ) {
		$(".tooltips").tooltip();
		$(".table-responsive").find("[title]").tooltip();
	},
	autoWidth: false,
	responsive: {
		"details": {
			"type": "column",
			"target": 0
		}
	},
	columnDefs: [{
		"data": null,
		"defaultContent": "",
		"className": "control",
		"orderable": false,
		"width": "9%",
		"targets": 0
	}],
});

$("#btnEliminarSeleccionados").click(function(e){
	var mensaje = "<div class='row'> \
		<div class='col-xs-12'> \
			<form id='frmEliminar'> \
				<h2> ¿Seguro que desea eliminar los registros seleccionados? </h2> \
			</form> \
		</div> \
	</div>";
	BootstrapDialog.show({
		title: "Eliminar registro",
		type: BootstrapDialog.TYPE_DANGER,
		message: mensaje,
		draggable: true,
		cssClass: "ModalEliminar",
		buttons: [{
			id: "btnEliminar",
			label: "Eliminar",
			cssClass: "btn-danger",
			action: function(dialogItself){
				$.isLoading({ text: "Cargando..." }); NProgress.start();
				var ids = new Array();
				$("#tblSeccionesxCliente").find(".selected").each(function(e){ ids.push($(this).find(".hdnid").val()); });
				$("#btnEliminarSeleccionados").prop("disabled", true).html('<i class="fa fa-spinner fa-spin"></i> Eliminando...');
				$("#btnEliminar").prop("disabled", true).html('<i class="fa fa-spinner fa-spin"></i> Eliminando...');
				$.post(
					"<?php echo URL::route('SysWebSWebSeccionesxClientesEliminar'); ?>",
					{ idWeb: ids },
					function(data){
						$.isLoading("hide"); NProgress.done();
						$("#btnEliminarSeleccionados").prop("disabled", false).html("Eliminar seleccionados").hide();
						$("#btnEliminar").prop("disabled", false).html("Eliminar");
						if(data.success){
							new PNotify({ title: "Felicidades!", text: data.mensaje, type: "success" });
							dialogItself.close();
							var table = $("#tblSeccionesxCliente").DataTable();
							table.ajax.reload(null, false);
						}
						else{
							if(data.mensaje != ''){ new PNotify({ title: "Error", text: data.mensaje, type: "error" }); }
							$.each(data.errMensajes, function(key, value){ if(value != ''){ $("#err"+key).html(value); } else{ $("#err"+key).html(""); } });
						}
					},
					"json"
				);
			}
		}]
	});
});

<?php $__env->stopSection(); ?>
<?php echo $__env->make('BaseSistemaWeb', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>