<div class="content-header" >
      <div class="container-fluid">
        <div class="row mb-2">
		 <div class="col-sm-6">
			<h1>
			Banco
			<small>modulo</small>
			</h1>
		</div>	
		
		<div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
				<li class="breadcrumb-item" >Inicio</li>
				<li class="breadcrumb-item" >Mantenimiento</li>
				<li class="breadcrumb-item" >Caja</li>
				<li class="breadcrumb-item active">Banco</li>
            </ol>
          </div>
		</div>
	</div>
</div>
<section class="content">
	<div class="container-fluid">
	<div class="row">
	    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding:0px;"  >
		    <div class="card">
		        <div class="card-header">
		          <button id="btn_agregar" onClick="banco_form('insertar')" class="btn btn-primary">Agregar</button>
		          <button id="btn_actualizar" class="btn btn-default">Actualizar</button>		        
		        </div>
		    </div>
		</div>
	</div>
	</div>
</section>
	
	<!-- formulario de registro -->
			<div class="modal fade" id="div_proveedor_form_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px;">
			<div class="modal-dialog modal-lg" style="" role="document" >
			<div class="modal-content">
			<div class="modal-body div_proveedor_form" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			<!-- formulario de registro -->
			<div class="modal fade" id="div_proveedorcuenta_form_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px;">
			<div class="modal-dialog " role="document" >
			<div class="modal-content">
			<div class="modal-body div_proveedorcuenta_form" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
	<!-- lista de registros -->
	<div id="div_proveedor_filtro"></div>
	<div id="div_proveedor_tabla"></div>
<script type="text/javascript">
	function banco_filtro(){			
		$.ajax({						
			url: "../banco/banco_filtro.php",
			async:true,
			dataType: "html",                      
			data: ({
			}),
			beforeSend: function() {
				$('#div_proveedor_filtro').addClass("ui-state-disabled");
			},
			success: function(html){
				$('#div_proveedor_filtro').html(html);
			},
			complete: function(){			
				$('#div_proveedor_filtro').removeClass("ui-state-disabled");
				banco_tabla();
			}
		});        
	}
	function banco_tabla(){	
		$.ajax({
			type: "POST",
			url: "../banco/banco_tabla.php",
			async:true,
			dataType: "html",                      
			data: ({
			bannom: $("#txt_fil_ban_nom").val()
			}),
			beforeSend: function() {
				$('#div_proveedor_tabla').addClass("ui-state-disabled");
			},
			success: function(html){
				$('#div_proveedor_tabla').html(html);
			},
			complete: function(){			
				$('#div_proveedor_tabla').removeClass("ui-state-disabled");
			}
		});     
	}
	function banco_form(act,idf){
		$('#div_proveedor_form_dialog').modal();
		$.ajax({
			type: "POST",
			url: "../banco/banco_form.php",
			async:true,
			dataType: "html",                      
			data: ({
				action: act,
				ban_id:	idf,
				vista:	'banco_tabla'
			}),
			beforeSend: function() {
				var div = "<center><div class='overlay col-lg-12 col-sm-12 col-xs-12' style='background-color:#fff;padding:0%;font-size:3rem;' >  <i class='fa fa-refresh fa-spin ' ></i> </div>  </center>";	
				$('.div_proveedor_form').html(div);
			},
			success: function(html){
				$('.div_proveedor_form').html(html);		
			}
		});
	}
	function eliminar_banco(id)
	{   
	if(confirm("Realmente desea eliminar?")){
			$.ajax({
				type: "POST",
				url: "../proveedor/proveedor_reg.php",
				async:true,
				dataType: "html",
				data: ({
					action: "eliminar",
					ban_id:	id
				}),
				beforeSend: function() {				
				},
				success: function(html){
					toastr["success"](html);
				},
				complete: function(){
					banco_tabla();
				}
			});
		}
	}
$(function() {
	
	$('#btn_actualizar').click(function() {
		$("#contenido").load("../banco/banco_vista.php");
	});
	banco_filtro();	
	setTitle("BANCO- "+nombreEmpresa);
});
</script>